summaryrefslogtreecommitdiff
path: root/fxjs/cfxjs_engine.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'fxjs/cfxjs_engine.cpp')
-rw-r--r--fxjs/cfxjs_engine.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/fxjs/cfxjs_engine.cpp b/fxjs/cfxjs_engine.cpp
index 54aa28cf4b..5def57e992 100644
--- a/fxjs/cfxjs_engine.cpp
+++ b/fxjs/cfxjs_engine.cpp
@@ -437,6 +437,19 @@ void CFXJS_Engine::InitializeEngine() {
v8::Local<v8::Context> v8Context = v8::Context::New(
GetIsolate(), nullptr, GetGlobalObjectTemplate(GetIsolate()));
+
+ // May not have the internal fields when called from tests.
+ v8::Local<v8::Object> pThisProxy = v8Context->Global();
+ if (pThisProxy->InternalFieldCount() == 2) {
+ pThisProxy->SetAlignedPointerInInternalField(0, nullptr);
+ pThisProxy->SetAlignedPointerInInternalField(1, nullptr);
+ }
+ v8::Local<v8::Object> pThis = pThisProxy->GetPrototype().As<v8::Object>();
+ if (pThis->InternalFieldCount() == 2) {
+ pThis->SetAlignedPointerInInternalField(0, nullptr);
+ pThis->SetAlignedPointerInInternalField(1, nullptr);
+ }
+
v8::Context::Scope context_scope(v8Context);
SetIntoContext(v8Context);