WebKit Bugzilla
Attachment 341063 Details for
Bug 185900
: Expose $vm if window.internals is exposed
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Patch
bug-185900-20180522201610.patch (text/plain), 6.34 KB, created by
Keith Miller
on 2018-05-22 20:16:10 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Keith Miller
Created:
2018-05-22 20:16:10 PDT
Size:
6.34 KB
patch
obsolete
>Subversion Revision: 232083 >diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog >index 4fc72fe9c1f6fa29bdbded6c1dff55545b940ee8..97d5fa1c31ffe7d5b9eb3b7f12fb64c7b232e737 100644 >--- a/Source/JavaScriptCore/ChangeLog >+++ b/Source/JavaScriptCore/ChangeLog >@@ -1,3 +1,18 @@ >+2018-05-22 Keith Miller <keith_miller@apple.com> >+ >+ Expose $vm if window.internals is exposed >+ https://bugs.webkit.org/show_bug.cgi?id=185900 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This is useful for testing vm internals when running LayoutTests. >+ >+ * runtime/JSGlobalObject.cpp: >+ (JSC::JSGlobalObject::init): >+ (JSC::JSGlobalObject::visitChildren): >+ (JSC::JSGlobalObject::exposeDollarVM): >+ * runtime/JSGlobalObject.h: >+ > 2018-05-22 Keith Miller <keith_miller@apple.com> > > Remove the UnconditionalFinalizer class >diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog >index d54854e3ffbbacc1fbd115752f69ceac2105936d..8d28ba10d90d0a5317e85905d12ef7a84ef19c83 100644 >--- a/Source/WebCore/ChangeLog >+++ b/Source/WebCore/ChangeLog >@@ -1,3 +1,15 @@ >+2018-05-22 Keith Miller <keith_miller@apple.com> >+ >+ Expose $vm if window.internals is exposed >+ https://bugs.webkit.org/show_bug.cgi?id=185900 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ This is useful for testing vm internals when running LayoutTests. >+ >+ * testing/js/WebCoreTestSupport.cpp: >+ (WebCoreTestSupport::injectInternalsObject): >+ > 2018-05-22 Brent Fulgham <bfulgham@apple.com> > > Avoid keeping FormState alive longer than necessary >diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp >index 75a252cb4179633c9f79e52cdbc22f1ecf1df46d..d013da573698cb08201b28e6cef536b8258412ab 100644 >--- a/Source/JavaScriptCore/runtime/JSGlobalObject.cpp >+++ b/Source/JavaScriptCore/runtime/JSGlobalObject.cpp >@@ -964,17 +964,8 @@ putDirectWithoutTransition(vm, vm.propertyNames-> jsName, lowerName ## Construct > > m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::ThrowTypeErrorFunction)] = m_throwTypeErrorFunction.get(); > >- if (UNLIKELY(Options::useDollarVM())) { >- m_dollarVMStructure.set(vm, this, JSDollarVM::createStructure(vm, this, m_objectPrototype.get())); >- JSDollarVM* dollarVM = JSDollarVM::create(vm, m_dollarVMStructure.get()); >- >- GlobalPropertyInfo extraStaticGlobals[] = { >- GlobalPropertyInfo(vm.propertyNames->builtinNames().dollarVMPrivateName(), dollarVM, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), >- }; >- addStaticGlobals(extraStaticGlobals, WTF_ARRAY_LENGTH(extraStaticGlobals)); >- >- putDirectWithoutTransition(vm, Identifier::fromString(exec, "$vm"), dollarVM, static_cast<unsigned>(PropertyAttribute::DontEnum)); >- } >+ if (UNLIKELY(Options::useDollarVM())) >+ exposeDollarVM(); > > #if ENABLE(WEBASSEMBLY) > if (Options::useWebAssembly()) { >@@ -1429,7 +1420,6 @@ void JSGlobalObject::visitChildren(JSCell* cell, SlotVisitor& visitor) > visitor.append(thisObject->m_regExpMatchesArrayWithGroupsStructure); > visitor.append(thisObject->m_moduleRecordStructure); > visitor.append(thisObject->m_moduleNamespaceObjectStructure); >- visitor.append(thisObject->m_dollarVMStructure); > visitor.append(thisObject->m_proxyObjectStructure); > visitor.append(thisObject->m_callableProxyObjectStructure); > visitor.append(thisObject->m_proxyRevokeStructure); >@@ -1482,6 +1472,19 @@ ExecState* JSGlobalObject::globalExec() > return CallFrame::create(m_globalCallFrame); > } > >+void JSGlobalObject::exposeDollarVM() >+{ >+ VM& vm = this->vm(); >+ JSDollarVM* dollarVM = JSDollarVM::create(vm, JSDollarVM::createStructure(vm, this, m_objectPrototype.get())); >+ >+ GlobalPropertyInfo extraStaticGlobals[] = { >+ GlobalPropertyInfo(vm.propertyNames->builtinNames().dollarVMPrivateName(), dollarVM, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), >+ }; >+ addStaticGlobals(extraStaticGlobals, WTF_ARRAY_LENGTH(extraStaticGlobals)); >+ >+ putDirect(vm, Identifier::fromString(globalExec(), "$vm"), dollarVM, static_cast<unsigned>(PropertyAttribute::DontEnum)); >+} >+ > void JSGlobalObject::addStaticGlobals(GlobalPropertyInfo* globals, int count) > { > ScopeOffset startOffset = addVariables(count, jsUndefined()); >diff --git a/Source/JavaScriptCore/runtime/JSGlobalObject.h b/Source/JavaScriptCore/runtime/JSGlobalObject.h >index 69b6c8f707f04193e544e3470140b56782df4c73..52d211c0baf409fa2f495d30aa96369eddbbb196 100644 >--- a/Source/JavaScriptCore/runtime/JSGlobalObject.h >+++ b/Source/JavaScriptCore/runtime/JSGlobalObject.h >@@ -355,7 +355,6 @@ public: > WriteBarrier<Structure> m_asyncFunctionStructure; > WriteBarrier<Structure> m_asyncGeneratorFunctionStructure; > WriteBarrier<Structure> m_generatorFunctionStructure; >- WriteBarrier<Structure> m_dollarVMStructure; > WriteBarrier<Structure> m_iteratorResultObjectStructure; > WriteBarrier<Structure> m_regExpMatchesArrayStructure; > WriteBarrier<Structure> m_regExpMatchesArrayWithGroupsStructure; >@@ -902,6 +901,7 @@ public: > WeakRandom& weakRandom() { return m_weakRandom; } > > bool needsSiteSpecificQuirks() const { return m_needsSiteSpecificQuirks; } >+ JS_EXPORT_PRIVATE void exposeDollarVM(); > > #if JSC_OBJC_API_ENABLED > JSWrapperMap* wrapperMap() const { return m_wrapperMap.get(); } >diff --git a/Source/WebCore/testing/js/WebCoreTestSupport.cpp b/Source/WebCore/testing/js/WebCoreTestSupport.cpp >index c018cee866c2facf7d7797240aa4019a6016b4ee..9f6ff2a69d512d6762a65f4b9d45d925167ebf87 100644 >--- a/Source/WebCore/testing/js/WebCoreTestSupport.cpp >+++ b/Source/WebCore/testing/js/WebCoreTestSupport.cpp >@@ -57,8 +57,10 @@ void injectInternalsObject(JSContextRef context) > JSLockHolder lock(exec); > JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()); > ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); >- if (is<Document>(*scriptContext)) >+ if (is<Document>(*scriptContext)) { > globalObject->putDirect(exec->vm(), Identifier::fromString(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(downcast<Document>(*scriptContext)))); >+ globalObject->exposeDollarVM(); >+ } > } > > void resetInternalsObject(JSContextRef context)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 185900
:
341063
|
341067
|
341072
|
341073
|
341097
|
341104
|
341154