Changeset 232143 in webkit
- Timestamp:
- May 23, 2018, 8:01:43 PM (8 years ago)
- Location:
- trunk/Source
- Files:
-
- 5 edited
-
JavaScriptCore/ChangeLog (modified) (1 diff)
-
JavaScriptCore/runtime/JSGlobalObject.cpp (modified) (3 diffs)
-
JavaScriptCore/runtime/JSGlobalObject.h (modified) (2 diffs)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/testing/js/WebCoreTestSupport.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r232138 r232143 1 2018-05-23 Keith Miller <keith_miller@apple.com> 2 3 Expose $vm if window.internals is exposed 4 https://bugs.webkit.org/show_bug.cgi?id=185900 5 6 Reviewed by Mark Lam. 7 8 This is useful for testing vm internals when running LayoutTests. 9 10 * runtime/JSGlobalObject.cpp: 11 (JSC::JSGlobalObject::init): 12 (JSC::JSGlobalObject::visitChildren): 13 (JSC::JSGlobalObject::exposeDollarVM): 14 * runtime/JSGlobalObject.h: 15 1 16 2018-05-23 Keith Miller <keith_miller@apple.com> 2 17 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp
r232070 r232143 965 965 m_linkTimeConstants[static_cast<unsigned>(LinkTimeConstant::ThrowTypeErrorFunction)] = m_throwTypeErrorFunction.get(); 966 966 967 if (UNLIKELY(Options::useDollarVM())) { 968 m_dollarVMStructure.set(vm, this, JSDollarVM::createStructure(vm, this, m_objectPrototype.get())); 969 JSDollarVM* dollarVM = JSDollarVM::create(vm, m_dollarVMStructure.get()); 970 971 GlobalPropertyInfo extraStaticGlobals[] = { 972 GlobalPropertyInfo(vm.propertyNames->builtinNames().dollarVMPrivateName(), dollarVM, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 973 }; 974 addStaticGlobals(extraStaticGlobals, WTF_ARRAY_LENGTH(extraStaticGlobals)); 975 976 putDirectWithoutTransition(vm, Identifier::fromString(exec, "$vm"), dollarVM, static_cast<unsigned>(PropertyAttribute::DontEnum)); 977 } 967 if (UNLIKELY(Options::useDollarVM())) 968 exposeDollarVM(); 978 969 979 970 #if ENABLE(WEBASSEMBLY) … … 1430 1421 visitor.append(thisObject->m_moduleRecordStructure); 1431 1422 visitor.append(thisObject->m_moduleNamespaceObjectStructure); 1432 visitor.append(thisObject->m_dollarVMStructure);1433 1423 visitor.append(thisObject->m_proxyObjectStructure); 1434 1424 visitor.append(thisObject->m_callableProxyObjectStructure); … … 1481 1471 { 1482 1472 return CallFrame::create(m_globalCallFrame); 1473 } 1474 1475 void JSGlobalObject::exposeDollarVM() 1476 { 1477 VM& vm = this->vm(); 1478 1479 if (hasOwnProperty(globalExec(), vm.propertyNames->builtinNames().dollarVMPrivateName())) 1480 return; 1481 1482 JSDollarVM* dollarVM = JSDollarVM::create(vm, JSDollarVM::createStructure(vm, this, m_objectPrototype.get())); 1483 1484 GlobalPropertyInfo extraStaticGlobals[] = { 1485 GlobalPropertyInfo(vm.propertyNames->builtinNames().dollarVMPrivateName(), dollarVM, PropertyAttribute::DontEnum | PropertyAttribute::DontDelete | PropertyAttribute::ReadOnly), 1486 }; 1487 addStaticGlobals(extraStaticGlobals, WTF_ARRAY_LENGTH(extraStaticGlobals)); 1488 1489 putDirect(vm, Identifier::fromString(globalExec(), "$vm"), dollarVM, static_cast<unsigned>(PropertyAttribute::DontEnum)); 1483 1490 } 1484 1491 -
trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h
r232070 r232143 356 356 WriteBarrier<Structure> m_asyncGeneratorFunctionStructure; 357 357 WriteBarrier<Structure> m_generatorFunctionStructure; 358 WriteBarrier<Structure> m_dollarVMStructure;359 358 WriteBarrier<Structure> m_iteratorResultObjectStructure; 360 359 WriteBarrier<Structure> m_regExpMatchesArrayStructure; … … 903 902 904 903 bool needsSiteSpecificQuirks() const { return m_needsSiteSpecificQuirks; } 904 JS_EXPORT_PRIVATE void exposeDollarVM(); 905 905 906 906 #if JSC_OBJC_API_ENABLED -
trunk/Source/WebCore/ChangeLog
r232139 r232143 1 2018-05-23 Keith Miller <keith_miller@apple.com> 2 3 Expose $vm if window.internals is exposed 4 https://bugs.webkit.org/show_bug.cgi?id=185900 5 6 Reviewed by Mark Lam. 7 8 This is useful for testing vm internals when running LayoutTests. 9 10 * testing/js/WebCoreTestSupport.cpp: 11 (WebCoreTestSupport::injectInternalsObject): 12 1 13 2018-05-23 David Kilzer <ddkilzer@apple.com> 2 14 -
trunk/Source/WebCore/testing/js/WebCoreTestSupport.cpp
r228218 r232143 58 58 JSDOMGlobalObject* globalObject = jsCast<JSDOMGlobalObject*>(exec->lexicalGlobalObject()); 59 59 ScriptExecutionContext* scriptContext = globalObject->scriptExecutionContext(); 60 if (is<Document>(*scriptContext)) 60 if (is<Document>(*scriptContext)) { 61 61 globalObject->putDirect(exec->vm(), Identifier::fromString(exec, Internals::internalsId), toJS(exec, globalObject, Internals::create(downcast<Document>(*scriptContext)))); 62 globalObject->exposeDollarVM(); 63 } 62 64 } 63 65
Note:
See TracChangeset
for help on using the changeset viewer.