Home | History | Annotate | Download | only in fxjs
      1 There are two separate wrappers for V8 here.  One is called FXJS, and
      2 it is used by the non-XFA code.  The other is called FXJSE, and it is
      3 used only by the XFA code.  Additionally FXJSE may request services
      4 from FXJS to bridge the two.
      5 
      6 Both the FXJS and FXJSE binding code needs to be replaced by something
      7 saner, perhaps Gin or perhaps some IDL. See
      8   https://bugs.chromium.org/p/pdfium/issues/detail?id=716
      9 for progress on the issue.
     10 
     11 FXJS binds objects by sticking a pointer to a CFXJS_PerObjectData in
     12 the V8 object's internal slot.  FXJSE binds objects by sticking a
     13 pointer to either an actual v8 function object or a CFXJSE_HostObject
     14 in the V8 object's internal slot, depending upon whether the object
     15 represents (in some notion) a "class" or an "instance". Also, V8 objects
     16 bound in one library may unexpectedly arrive at the other given a script
     17 that's trying to mess with us.
     18 
     19 To distinguish these cases, we use two internal slots for all bound
     20 objects, regardless of the FXJS/FXJSE distinction.  Slot 0 is the
     21 tag 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 
     30 Slot 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