Split WindowProxy handling out of ScriptController and into a new class owned by...
authorcdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2018 21:23:54 +0000 (21:23 +0000)
committercdumez@apple.com <cdumez@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 13 Apr 2018 21:23:54 +0000 (21:23 +0000)
commit5a3568f1585abfae21538408460a5ac682237f39
tree7df9caec93bf80ad7088a88c0df800e147d5efed
parent5eba180656122b9735c96ea8489319ca99fa0796
Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame
https://bugs.webkit.org/show_bug.cgi?id=184591

Reviewed by Sam Weinig.

Source/WebCore:

Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
This is work towards fixing Bug 184515.

* Sources.txt:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/DOMWrapperWorld.cpp:
(WebCore::DOMWrapperWorld::~DOMWrapperWorld):
(WebCore::DOMWrapperWorld::clearWrappers):
* bindings/js/DOMWrapperWorld.h:
(WebCore::DOMWrapperWorld::didCreateWindowProxy):
(WebCore::DOMWrapperWorld::didDestroyWindowProxy):
* bindings/js/JSBindingsAllInOne.cpp:
* bindings/js/JSDOMWindowBase.cpp:
(WebCore::toJSDOMWindow):
* bindings/js/JSDOMWindowProxy.cpp:
(WebCore::toJS):
(WebCore::toJSDOMWindowProxy):
* bindings/js/ScriptCachedFrameData.cpp:
(WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
(WebCore::ScriptCachedFrameData::restore):
* bindings/js/ScriptController.cpp:
(WebCore::ScriptController::~ScriptController):
(WebCore::ScriptController::evaluateInWorld):
(WebCore::ScriptController::loadModuleScriptInWorld):
(WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
(WebCore::ScriptController::evaluateModule):
(WebCore::ScriptController::clearWindowProxiesNotMatchingDOMWindow):
(WebCore::ScriptController::setDOMWindowForWindowProxy):
(WebCore::ScriptController::initScriptForWindowProxy):
(WebCore::ScriptController::setupModuleScriptHandlers):
(WebCore::ScriptController::windowProxyController):
(WebCore::ScriptController::enableEval):
(WebCore::ScriptController::enableWebAssembly):
(WebCore::ScriptController::disableEval):
(WebCore::ScriptController::disableWebAssembly):
(WebCore::ScriptController::attachDebugger):
(WebCore::ScriptController::updateDocument):
(WebCore::ScriptController::collectIsolatedContexts):
(WebCore::ScriptController::windowScriptNPObject):
(WebCore::ScriptController::executeIfJavaScriptURL):
* bindings/js/ScriptController.h:
(WebCore::ScriptController::globalObject):
* bindings/js/ScriptControllerMac.mm:
(WebCore::ScriptController::windowScriptObject):
* bindings/js/ScriptState.cpp:
(WebCore::mainWorldExecState):
* bindings/js/WindowProxyController.cpp: Added.
(WebCore::WindowProxyController::WindowProxyController):
(WebCore::WindowProxyController::destroyWindowProxy):
(WebCore::WindowProxyController::createWindowProxy):
(WebCore::WindowProxyController::windowProxies):
(WebCore::WindowProxyController::createWindowProxyWithInitializedScript):
* bindings/js/WindowProxyController.h: Added.
(WebCore::WindowProxyController::releaseWindowProxies):
(WebCore::WindowProxyController::setWindowProxies):
(WebCore::WindowProxyController::windowProxy):
(WebCore::WindowProxyController::existingWindowProxy const):
(WebCore::WindowProxyController::globalObject):
* loader/FrameLoader.cpp:
(WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
* page/AbstractFrame.cpp:
(WebCore::AbstractFrame::AbstractFrame):
* page/AbstractFrame.h:
(WebCore::AbstractFrame::windowProxyController):
(WebCore::AbstractFrame::windowProxyController const):

Source/WebKit:

Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
This is work towards fixing Bug 184515.

* WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::windowScriptNPObject):

Source/WebKitLegacy/mac:

Split WindowProxy handling out of ScriptController and into a new class owned by AbstractFrame.
RemoteFrames do not need a ScriptController but do need to maintain WindowProxies.
This is work towards fixing Bug 184515.

* Plugins/Hosted/NetscapePluginInstanceProxy.mm:
(WebKit::NetscapePluginInstanceProxy::getWindowNPObject):
* WebView/WebFrame.mm:
(-[WebFrame _attachScriptDebugger]):

Source/WTF:

Add isEmpty() convenience method to SizedIteratorRange.

* wtf/IteratorRange.h:
(WTF::SizedIteratorRange::isEmpty const):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@230643 268f45cc-cd09-0410-ab3c-d52691b4dbfc
26 files changed:
Source/WTF/ChangeLog
Source/WTF/wtf/IteratorRange.h
Source/WebCore/ChangeLog
Source/WebCore/Sources.txt
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/bindings/js/DOMWrapperWorld.cpp
Source/WebCore/bindings/js/DOMWrapperWorld.h
Source/WebCore/bindings/js/JSBindingsAllInOne.cpp
Source/WebCore/bindings/js/JSDOMWindowBase.cpp
Source/WebCore/bindings/js/JSDOMWindowProxy.cpp
Source/WebCore/bindings/js/JSDOMWindowProxy.h
Source/WebCore/bindings/js/ScriptCachedFrameData.cpp
Source/WebCore/bindings/js/ScriptController.cpp
Source/WebCore/bindings/js/ScriptController.h
Source/WebCore/bindings/js/ScriptControllerMac.mm
Source/WebCore/bindings/js/ScriptState.cpp
Source/WebCore/bindings/js/WindowProxyController.cpp [new file with mode: 0644]
Source/WebCore/bindings/js/WindowProxyController.h [new file with mode: 0644]
Source/WebCore/loader/FrameLoader.cpp
Source/WebCore/page/AbstractFrame.cpp
Source/WebCore/page/AbstractFrame.h
Source/WebKit/ChangeLog
Source/WebKit/WebProcess/Plugins/PluginView.cpp
Source/WebKitLegacy/mac/ChangeLog
Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm
Source/WebKitLegacy/mac/WebView/WebFrame.mm