1There are two separate wrappers for V8 here. One is called FXJS, and 2it is used by the non-XFA code. The other is called FXJSE, and it is 3used only by the XFA code. Additionally FXJSE may request services 4from FXJS to bridge the two. 5 6Both the FXJS and FXJSE binding code needs to be replaced by something 7saner, perhaps Gin or perhaps some IDL. See 8 https://bugs.chromium.org/p/pdfium/issues/detail?id=716 9for progress on the issue. 10 11FXJS binds objects by sticking a pointer to a CFXJS_PerObjectData in 12the V8 object's internal slot. FXJSE binds objects by sticking a 13pointer to either an actual v8 function object or a CFXJSE_HostObject 14in the V8 object's internal slot, depending upon whether the object 15represents (in some notion) a "class" or an "instance". Also, V8 objects 16bound in one library may unexpectedly arrive at the other given a script 17that's trying to mess with us. 18 19To distinguish these cases, we use two internal slots for all bound 20objects, regardless of the FXJS/FXJSE distinction. Slot 0 is the 21tag and contains either: 22 kPerObjectDataTag for FXJS objects, or 23 g_FXJSETagString for FXJSE Host objects, or 24 One of 4 specific FXJSE_CLASS_DESCRIPTOR globals for FXJSE classes: 25 GlobalClassDescriptor 26 NormalClassDescriptor 27 VariablesClassDescriptor 28 formcalc_fm2js_descriptor 29 30Slot 1's contents are determined by these tags: 31 kPerObjectDataTag means to expect a CFXJS_PerObjectData. 32 g_FXJSETagString means to expect a CFXJSE_HostObject. 33 A FXJSE_CLASS_DESCRIPTOR pointer means to expect a v8 function. 34