diff options
author | Tom Sepez <tsepez@chromium.org> | 2017-06-01 14:59:33 -0700 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2017-06-01 22:53:07 +0000 |
commit | 8cb884102c17ef0530277126fd8da054d329d065 (patch) | |
tree | c1261704e61637b69115d488406e252fb668097a /fxjs/fxjse.h | |
parent | 5171a27eaa7489939310bd2864864867cc78ce21 (diff) | |
download | pdfium-8cb884102c17ef0530277126fd8da054d329d065.tar.xz |
Tag CFXJSE_HostObject sub-classes.
CXFA_FM2JSContext and CXFA_Object both subclass CFXJSE_HostObject.
When a CFXJSE_HostObject is obtained from an opaque pointer inside
a V8 object internal slot, there is no way to distinguish one from
the other.
Bug: 728158
Change-Id: Iabc648e8b7226e2819d8795227442c3f6c61a793
Reviewed-on: https://pdfium-review.googlesource.com/6211
Reviewed-by: Lei Zhang <thestig@chromium.org>
Commit-Queue: Tom Sepez <tsepez@chromium.org>
Diffstat (limited to 'fxjs/fxjse.h')
-rw-r--r-- | fxjs/fxjse.h | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/fxjs/fxjse.h b/fxjs/fxjse.h index a29c0893af..8fc514bba3 100644 --- a/fxjs/fxjse.h +++ b/fxjs/fxjse.h @@ -14,10 +14,20 @@ class CFXJSE_Arguments; class CFXJSE_Value; -// C++ object which can be wrapped by CFXJSE_value. +// C++ object which is retrieved from v8 object's slot. class CFXJSE_HostObject { public: virtual ~CFXJSE_HostObject() {} + + // Small layering violation here, but we need to distinguish between the + // two kinds of subclasses. + enum Type { kXFA, kFM2JS }; + Type type() const { return type_; } + + protected: + explicit CFXJSE_HostObject(Type type) { type_ = type; } + + Type type_; }; typedef void (*FXJSE_FuncCallback)(CFXJSE_Value* pThis, |