| Summary: | ScriptState.h/cpp is a remnant of JavaScript engine abstraction that can be removed | ||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Product: | WebKit | Reporter: | Darin Adler <darin> | ||||||||||||||||
| Component: | WebCore JavaScript | Assignee: | Darin Adler <darin> | ||||||||||||||||
| Status: | RESOLVED FIXED | ||||||||||||||||||
| Severity: | Normal | CC: | alecflett, annulen, ashvayka, beidson, cdumez, esprehn+autocc, ews-watchlist, gyuyoung.kim, hi, joepeck, jsbell, kangil.han, pangle, ryuan.choi, sergio, webkit-bug-importer, ysuzuki | ||||||||||||||||
| Priority: | P2 | Keywords: | InRadar | ||||||||||||||||
| Version: | WebKit Nightly Build | ||||||||||||||||||
| Hardware: | All | ||||||||||||||||||
| OS: | All | ||||||||||||||||||
| Attachments: |
|
||||||||||||||||||
|
Description
Darin Adler
2021-12-20 23:53:58 PST
Created attachment 447695 [details]
Patch
Created attachment 447696 [details]
Patch
Created attachment 447697 [details]
Patch
Comment on attachment 447697 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=447697&action=review r=me with comments. > Source/WebCore/ChangeLog:15 > + Also begin to just call global objects "global object", and not "script state". Nice. > Source/WebCore/inspector/InspectorFrontendHost.cpp:164 > + auto& globalObject = *m_frontendPage->mainFrame().script().globalObject(world); In the old code, m_frontendPage can be nullptr. > Source/WebCore/inspector/WebInjectedScriptManager.cpp:91 > + { > + Vector<long> idsToRemove; > + for (auto& entry : m_idToInjectedScript) { > + auto* globalObject = entry.value.globalObject(); > + if (executionContext(globalObject) == document) { > + m_scriptStateToId.remove(globalObject); > + idsToRemove.append(entry.key); > + } > + } > + for (auto& id : idsToRemove) > + m_idToInjectedScript.remove(id); > } How about using `HashMap::removeIf`? > Source/WebCore/inspector/WebInjectedScriptManager.cpp:103 > + // Now remove global objects that have no injected script. > + { > + Vector<JSC::JSGlobalObject*> globalObjectsToRemove; > + for (auto& entry : m_scriptStateToId) { > + auto* globalObject = entry.key; > + if (executionContext(globalObject) == document) > + globalObjectsToRemove.append(globalObject); > + } > + for (auto& globalObject : globalObjectsToRemove) > + m_scriptStateToId.remove(globalObject); > + } How about using `HashMap::removeIf`? > Source/WebCore/inspector/agents/InspectorApplicationCacheAgent.cpp:117 > + m_inspectedPage.forEachFrame([&] (Frame& frame) { Remove space between [&] and (Frame& frame). > Source/WebCore/inspector/agents/InspectorTimelineAgent.cpp:297 > void InspectorTimelineAgent::startFromConsole(JSC::JSGlobalObject* exec, const String& title) Let's rename exec to `globalObject` or `lexicalGlobalObject`. > Source/WebCore/inspector/agents/page/PageRuntimeAgent.cpp:136 > + m_inspectedPage.forEachFrame([&] (Frame& frame) { Remove space between [] part and () part in lambda. Created attachment 447702 [details]
Patch
Created attachment 447703 [details]
Patch
Created attachment 447718 [details]
Patch
Created attachment 447738 [details]
Patch
Committed r287327 (245477@trunk): <https://commits.webkit.org/245477@trunk> |