From f29479d47156d180c0b71f6c98aa4de37c2a7ee2 Mon Sep 17 00:00:00 2001 From: Tom Sepez Date: Fri, 8 Jun 2018 18:22:24 +0000 Subject: Fix issue with resolveNodes() not found off global proxy object. We used to assume that a global proxy object could be distinguished by it not having two internal fields, but that invariant isn't correct. Instead, flag it as such so the block of code at line 126 will check the prototype to find an actual object. Squeeze some bytes out of the tags while were at it, no reason for them to be wide. Also remove GetGlobalObjectFromContext() helper, for transparency into what's really going on in v8. This then shows a needless retrieval of an object we already have in one case. Bug: pdfium:1097 Change-Id: Iafc356373166fe5fda76ea7d64193826ee69a6c3 Reviewed-on: https://pdfium-review.googlesource.com/34630 Reviewed-by: dsinclair Commit-Queue: Tom Sepez --- fxjs/README | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'fxjs/README') diff --git a/fxjs/README b/fxjs/README index 6590b58e3c..a1cfe322bf 100644 --- a/fxjs/README +++ b/fxjs/README @@ -20,7 +20,8 @@ To distinguish these cases, we use two internal slots for all bound objects, regardless of the FXJS/FXJSE distinction. Slot 0 is the tag and contains either: kPerObjectDataTag for FXJS objects, or - g_FXJSETagString for FXJSE Host objects, or + g_FXJSEHostObjectTag for FXJSE Host objects, or + g_FXJSEProxyObjectTag for a global proxy object under FXJSE, or One of 4 specific FXJSE_CLASS_DESCRIPTOR globals for FXJSE classes: GlobalClassDescriptor NormalClassDescriptor @@ -29,9 +30,10 @@ tag and contains either: Slot 1's contents are determined by these tags: kPerObjectDataTag means an aligned pointer to CFXJS_PerObjectData. - g_FXJSETagString means an aligned pointer to CFXJSE_HostObject. + g_FXJSEHostObjectTag means an aligned pointer to CFXJSE_HostObject. + g_FXJSEProxyObjectTag means nullptr, and to check the prototype instead. A FXJSE_CLASS_DESCRIPTOR pointer means to expect an actual v8 function - object, and not an aligned pointer. + object (or a string naming that function), and not an aligned pointer. Because PDFium uses V8 for various unrelated purposes, there may be up to four v8::Contexts (JS Global Objects) associated with each document. One is -- cgit v1.2.3