Diff
Modified: trunk/Source/WebCore/ChangeLog (230793 => 230794)
--- trunk/Source/WebCore/ChangeLog 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/ChangeLog 2018-04-19 04:02:30 UTC (rev 230794)
@@ -1,5 +1,90 @@
2018-04-18 Chris Dumez <[email protected]>
+ Rename WindowProxyController to WindowProxy
+ https://bugs.webkit.org/show_bug.cgi?id=184756
+
+ Reviewed by Sam Weinig.
+
+ Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation
+ needed use WindowProxyController type, which was a bit confusing.
+
+ * 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::toJS):
+ * bindings/js/JSDOMWindowProxy.cpp:
+ (WebCore::toJS):
+ (WebCore::toJSDOMWindowProxy):
+ * bindings/js/JSDOMWindowProxy.h:
+ (WebCore::toJS):
+ (WebCore::toJSDOMWindowProxy):
+ * bindings/js/ScriptCachedFrameData.cpp:
+ (WebCore::ScriptCachedFrameData::ScriptCachedFrameData):
+ (WebCore::ScriptCachedFrameData::restore):
+ * bindings/js/ScriptController.cpp:
+ (WebCore::ScriptController::evaluateInWorld):
+ (WebCore::ScriptController::loadModuleScriptInWorld):
+ (WebCore::ScriptController::linkAndEvaluateModuleScriptInWorld):
+ (WebCore::ScriptController::evaluateModule):
+ (WebCore::ScriptController::setupModuleScriptHandlers):
+ (WebCore::ScriptController::windowProxy):
+ (WebCore::ScriptController::enableEval):
+ (WebCore::ScriptController::enableWebAssembly):
+ (WebCore::ScriptController::disableEval):
+ (WebCore::ScriptController::disableWebAssembly):
+ (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/WindowProxy.cpp: Renamed from Source/WebCore/bindings/js/WindowProxyController.cpp.
+ (WebCore::WindowProxy::WindowProxy):
+ (WebCore::WindowProxy::~WindowProxy):
+ (WebCore::WindowProxy::destroyJSWindowProxy):
+ (WebCore::WindowProxy::createJSWindowProxy):
+ (WebCore::WindowProxy::jsWindowProxiesAsVector const):
+ (WebCore::WindowProxy::createJSWindowProxyWithInitializedScript):
+ (WebCore::WindowProxy::clearJSWindowProxiesNotMatchingDOMWindow):
+ (WebCore::WindowProxy::setDOMWindow):
+ (WebCore::WindowProxy::attachDebugger):
+ * bindings/js/WindowProxy.h: Renamed from Source/WebCore/bindings/js/WindowProxyController.h.
+ (WebCore::WindowProxy::jsWindowProxies const):
+ (WebCore::WindowProxy::releaseJSWindowProxies):
+ (WebCore::WindowProxy::setJSWindowProxies):
+ (WebCore::WindowProxy::jsWindowProxy):
+ (WebCore::WindowProxy::existingJSWindowProxy const):
+ (WebCore::WindowProxy::globalObject):
+ * loader/FrameLoader.cpp:
+ (WebCore::FrameLoader::clear):
+ (WebCore::FrameLoader::dispatchDidClearWindowObjectInWorld):
+ * page/AbstractFrame.cpp:
+ (WebCore::AbstractFrame::AbstractFrame):
+ * page/AbstractFrame.h:
+ (WebCore::AbstractFrame::windowProxy):
+ (WebCore::AbstractFrame::windowProxy const):
+ * page/Page.cpp:
+ (WebCore::Page::setDebugger):
+ * page/RemoteDOMWindow.cpp:
+ (WebCore::RemoteDOMWindow::self const):
+ (WebCore::RemoteDOMWindow::top const):
+ (WebCore::RemoteDOMWindow::opener const):
+ (WebCore::RemoteDOMWindow::parent const):
+ * page/RemoteDOMWindow.h:
+
+2018-04-18 Chris Dumez <[email protected]>
+
Set RemoteDOMWindow's initial opener
https://bugs.webkit.org/show_bug.cgi?id=184716
Modified: trunk/Source/WebCore/Sources.txt (230793 => 230794)
--- trunk/Source/WebCore/Sources.txt 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/Sources.txt 2018-04-19 04:02:30 UTC (rev 230794)
@@ -470,7 +470,7 @@
bindings/js/SerializedScriptValue.cpp
bindings/js/WebCoreJSClientData.cpp
bindings/js/WebCoreTypedArrayController.cpp
-bindings/js/WindowProxyController.cpp
+bindings/js/WindowProxy.cpp
bindings/js/WorkerScriptController.cpp
bridge/IdentifierRep.cpp
Modified: trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj (230793 => 230794)
--- trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj 2018-04-19 04:02:30 UTC (rev 230794)
@@ -1190,7 +1190,7 @@
460BB6161D0A1BF000221812 /* Base64Utilities.h in Headers */ = {isa = PBXBuildFile; fileRef = 460BB6141D0A1BEC00221812 /* Base64Utilities.h */; settings = {ATTRIBUTES = (Private, ); }; };
460CBF361D4BCD0E0092E88E /* JSDOMWindowProperties.h in Headers */ = {isa = PBXBuildFile; fileRef = 460CBF341D4BCCFE0092E88E /* JSDOMWindowProperties.h */; };
46218ACB1F72D64E00574FBE /* DOMHighResTimeStamp.h in Headers */ = {isa = PBXBuildFile; fileRef = 46E016AD1F72D61E00282B2C /* DOMHighResTimeStamp.h */; settings = {ATTRIBUTES = (Private, ); }; };
- 463521AD2081092A00C28922 /* WindowProxyController.h in Headers */ = {isa = PBXBuildFile; fileRef = 463521AA2081090B00C28922 /* WindowProxyController.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ 463521AD2081092A00C28922 /* WindowProxy.h in Headers */ = {isa = PBXBuildFile; fileRef = 463521AA2081090B00C28922 /* WindowProxy.h */; settings = {ATTRIBUTES = (Private, ); }; };
463EB6231B8789E00096ED51 /* TagCollection.h in Headers */ = {isa = PBXBuildFile; fileRef = 463EB6211B8789CB0096ED51 /* TagCollection.h */; };
465307D01DB6EE4800E4137C /* JSUIEventInit.h in Headers */ = {isa = PBXBuildFile; fileRef = 83E045EF1DAA104F00B0D8B9 /* JSUIEventInit.h */; };
46658DC91FA24B8700F7DD54 /* SWContextManager.h in Headers */ = {isa = PBXBuildFile; fileRef = 4672413B1FA24B140088BD6D /* SWContextManager.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -7429,8 +7429,8 @@
460CBF341D4BCCFE0092E88E /* JSDOMWindowProperties.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMWindowProperties.h; sourceTree = "<group>"; };
460D19441FCE21DD00C3DB85 /* JSServiceWorkerGlobalScopeCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSServiceWorkerGlobalScopeCustom.cpp; sourceTree = "<group>"; };
4634592B1AC2271000ECB71C /* PowerObserverMac.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = PowerObserverMac.cpp; sourceTree = "<group>"; };
- 463521AA2081090B00C28922 /* WindowProxyController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowProxyController.h; sourceTree = "<group>"; };
- 463521AC2081090E00C28922 /* WindowProxyController.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WindowProxyController.cpp; sourceTree = "<group>"; };
+ 463521AA2081090B00C28922 /* WindowProxy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WindowProxy.h; sourceTree = "<group>"; };
+ 463521AC2081090E00C28922 /* WindowProxy.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = WindowProxy.cpp; sourceTree = "<group>"; };
463EB6201B8789CB0096ED51 /* TagCollection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagCollection.cpp; sourceTree = "<group>"; };
463EB6211B8789CB0096ED51 /* TagCollection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagCollection.h; sourceTree = "<group>"; };
465A8E781C8A24CE00E7D3E4 /* RuntimeApplicationChecksCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = RuntimeApplicationChecksCocoa.mm; sourceTree = "<group>"; };
@@ -23727,8 +23727,8 @@
BC53D910114310CC000D817E /* WebCoreJSClientData.h */,
0F099D0617B968A100FF84B9 /* WebCoreTypedArrayController.cpp */,
0F099D0717B968A100FF84B9 /* WebCoreTypedArrayController.h */,
- 463521AC2081090E00C28922 /* WindowProxyController.cpp */,
- 463521AA2081090B00C28922 /* WindowProxyController.h */,
+ 463521AC2081090E00C28922 /* WindowProxy.cpp */,
+ 463521AA2081090B00C28922 /* WindowProxy.h */,
E1A643FC0EC097A000779668 /* WorkerScriptController.cpp */,
E1A643F10EC0972500779668 /* WorkerScriptController.h */,
);
@@ -30636,7 +30636,7 @@
0F15ED5C1B7EC7C500EDDFEB /* WillChangeData.h in Headers */,
BC8243E90D0CFD7500460C8F /* WindowFeatures.h in Headers */,
7E99AF530B13846468FB01A5 /* WindowFocusAllowedIndicator.h in Headers */,
- 463521AD2081092A00C28922 /* WindowProxyController.h in Headers */,
+ 463521AD2081092A00C28922 /* WindowProxy.h in Headers */,
E1E1BF00115FF6FB006F52CA /* WindowsKeyboardCodes.h in Headers */,
501BAAA913950E2C00F7ACEB /* WindRule.h in Headers */,
A14832BE187F64CC00DA63A6 /* WKContentObservation.h in Headers */,
Modified: trunk/Source/WebCore/bindings/js/DOMWrapperWorld.cpp (230793 => 230794)
--- trunk/Source/WebCore/bindings/js/DOMWrapperWorld.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/bindings/js/DOMWrapperWorld.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -24,7 +24,7 @@
#include "CommonVM.h"
#include "JSDOMWindow.h"
#include "WebCoreJSClientData.h"
-#include "WindowProxyController.h"
+#include "WindowProxy.h"
#include <wtf/MainThread.h>
@@ -47,8 +47,8 @@
static_cast<JSVMClientData*>(clientData)->forgetWorld(*this);
// These items are created lazily.
- while (!m_windowProxyControllers.isEmpty())
- (*m_windowProxyControllers.begin())->destroyWindowProxy(*this);
+ while (!m_jsWindowProxies.isEmpty())
+ (*m_jsWindowProxies.begin())->destroyJSWindowProxy(*this);
}
void DOMWrapperWorld::clearWrappers()
@@ -56,8 +56,8 @@
m_wrappers.clear();
// These items are created lazily.
- while (!m_windowProxyControllers.isEmpty())
- (*m_windowProxyControllers.begin())->destroyWindowProxy(*this);
+ while (!m_jsWindowProxies.isEmpty())
+ (*m_jsWindowProxies.begin())->destroyJSWindowProxy(*this);
}
DOMWrapperWorld& normalWorld(JSC::VM& vm)
Modified: trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h (230793 => 230794)
--- trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/bindings/js/DOMWrapperWorld.h 2018-04-19 04:02:30 UTC (rev 230794)
@@ -26,7 +26,7 @@
namespace WebCore {
-class WindowProxyController;
+class WindowProxy;
typedef HashMap<void*, JSC::Weak<JSC::JSObject>> DOMObjectWrapperMap;
@@ -41,8 +41,8 @@
// Free as much memory held onto by this world as possible.
WEBCORE_EXPORT void clearWrappers();
- void didCreateWindowProxy(WindowProxyController* controller) { m_windowProxyControllers.add(controller); }
- void didDestroyWindowProxy(WindowProxyController* controller) { m_windowProxyControllers.remove(controller); }
+ void didCreateWindowProxy(WindowProxy* controller) { m_jsWindowProxies.add(controller); }
+ void didDestroyWindowProxy(WindowProxy* controller) { m_jsWindowProxies.remove(controller); }
void setShadowRootIsAlwaysOpen() { m_shadowRootIsAlwaysOpen = true; }
bool shadowRootIsAlwaysOpen() const { return m_shadowRootIsAlwaysOpen; }
@@ -61,7 +61,7 @@
private:
JSC::VM& m_vm;
- HashSet<WindowProxyController*> m_windowProxyControllers;
+ HashSet<WindowProxy*> m_jsWindowProxies;
DOMObjectWrapperMap m_wrappers;
bool m_isNormal;
Modified: trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp (230793 => 230794)
--- trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/bindings/js/JSBindingsAllInOne.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -111,5 +111,5 @@
#include "ScriptState.cpp"
#include "SerializedScriptValue.cpp"
#include "WebCoreTypedArrayController.cpp"
-#include "WindowProxyController.cpp"
+#include "WindowProxy.cpp"
#include "WorkerScriptController.cpp"
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp (230793 => 230794)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowBase.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -253,7 +253,7 @@
auto* frame = domWindow.frame();
if (!frame)
return jsNull();
- return toJS(state, frame->windowProxyController());
+ return toJS(state, frame->windowProxy());
}
JSDOMWindow* toJSDOMWindow(Frame& frame, DOMWrapperWorld& world)
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowProxy.cpp (230793 => 230794)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowProxy.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowProxy.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -140,14 +140,14 @@
return wrapper ? &wrapper->wrapped() : nullptr;
}
-JSValue toJS(ExecState* state, WindowProxyController& windowProxyController)
+JSValue toJS(ExecState* state, WindowProxy& windowProxy)
{
- return &windowProxyController.windowProxy(currentWorld(*state));
+ return &windowProxy.jsWindowProxy(currentWorld(*state));
}
-JSDOMWindowProxy& toJSDOMWindowProxy(WindowProxyController& windowProxyController, DOMWrapperWorld& world)
+JSDOMWindowProxy& toJSDOMWindowProxy(WindowProxy& windowProxy, DOMWrapperWorld& world)
{
- return windowProxyController.windowProxy(world);
+ return windowProxy.jsWindowProxy(world);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/js/JSDOMWindowProxy.h (230793 => 230794)
--- trunk/Source/WebCore/bindings/js/JSDOMWindowProxy.h 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/bindings/js/JSDOMWindowProxy.h 2018-04-19 04:02:30 UTC (rev 230794)
@@ -39,7 +39,7 @@
class AbstractDOMWindow;
class AbstractFrame;
-class WindowProxyController;
+class WindowProxy;
class JSDOMWindowProxy final : public JSC::JSProxy {
using Base = JSC::JSProxy;
@@ -68,12 +68,12 @@
};
// JSDOMWindowProxy is a little odd in that it's not a traditional wrapper and has no back pointer.
-// It is, however, strongly owned by AbstractFrame via its WindowProxyController, so we can get one from a WindowProxyController.
-JSC::JSValue toJS(JSC::ExecState*, WindowProxyController&);
-inline JSC::JSValue toJS(JSC::ExecState* state, WindowProxyController* windowProxyController) { return windowProxyController ? toJS(state, *windowProxyController) : JSC::jsNull(); }
+// It is, however, strongly owned by AbstractFrame via its WindowProxy, so we can get one from a WindowProxy.
+JSC::JSValue toJS(JSC::ExecState*, WindowProxy&);
+inline JSC::JSValue toJS(JSC::ExecState* state, WindowProxy* windowProxy) { return windowProxy ? toJS(state, *windowProxy) : JSC::jsNull(); }
-JSDOMWindowProxy& toJSDOMWindowProxy(WindowProxyController&, DOMWrapperWorld&);
-inline JSDOMWindowProxy* toJSDOMWindowProxy(WindowProxyController* windowProxyController, DOMWrapperWorld& world) { return windowProxyController ? &toJSDOMWindowProxy(*windowProxyController, world) : nullptr; }
+JSDOMWindowProxy& toJSDOMWindowProxy(WindowProxy&, DOMWrapperWorld&);
+inline JSDOMWindowProxy* toJSDOMWindowProxy(WindowProxy* windowProxy, DOMWrapperWorld& world) { return windowProxy ? &toJSDOMWindowProxy(*windowProxy, world) : nullptr; }
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp (230793 => 230794)
--- trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/bindings/js/ScriptCachedFrameData.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -51,13 +51,13 @@
{
JSLockHolder lock(commonVM());
- for (auto windowProxy : frame.windowProxyController().windowProxiesAsVector()) {
+ for (auto windowProxy : frame.windowProxy().jsWindowProxiesAsVector()) {
auto* window = jsCast<JSDOMWindow*>(windowProxy->window());
m_windows.add(&windowProxy->world(), Strong<JSDOMWindow>(window->vm(), window));
window->setConsoleClient(nullptr);
}
- frame.windowProxyController().attachDebugger(nullptr);
+ frame.windowProxy().attachDebugger(nullptr);
}
ScriptCachedFrameData::~ScriptCachedFrameData()
@@ -71,7 +71,7 @@
Page* page = frame.page();
- for (auto windowProxy : frame.windowProxyController().windowProxiesAsVector()) {
+ for (auto windowProxy : frame.windowProxy().jsWindowProxiesAsVector()) {
auto* world = &windowProxy->world();
if (auto* window = m_windows.get(world).get())
Modified: trunk/Source/WebCore/bindings/js/ScriptController.cpp (230793 => 230794)
--- trunk/Source/WebCore/bindings/js/ScriptController.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/bindings/js/ScriptController.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -117,7 +117,7 @@
// and false for <script>doSomething()</script>. Check if it has the
// expected value in all cases.
// See smart window.open policy for where this is used.
- auto& proxy = windowProxyController().windowProxy(world);
+ auto& proxy = windowProxy().jsWindowProxy(world);
auto& exec = *proxy.window()->globalExec();
const String* savedSourceURL = m_sourceURL;
m_sourceURL = &sourceURL;
@@ -150,7 +150,7 @@
{
JSLockHolder lock(world.vm());
- auto& proxy = windowProxyController().windowProxy(world);
+ auto& proxy = windowProxy().jsWindowProxy(world);
auto& state = *proxy.window()->globalExec();
auto& promise = JSMainThreadExecState::loadModule(state, moduleName, JSC::JSScriptFetchParameters::create(state.vm(), WTFMove(topLevelFetchParameters)), JSC::JSScriptFetcher::create(state.vm(), { &moduleScript }));
@@ -166,7 +166,7 @@
{
JSLockHolder lock(world.vm());
- auto& proxy = windowProxyController().windowProxy(world);
+ auto& proxy = windowProxy().jsWindowProxy(world);
auto& state = *proxy.window()->globalExec();
auto& promise = JSMainThreadExecState::loadModule(state, sourceCode.jsSourceCode(), JSC::JSScriptFetcher::create(state.vm(), { &moduleScript }));
@@ -182,7 +182,7 @@
{
JSLockHolder lock(world.vm());
- auto& proxy = windowProxyController().windowProxy(world);
+ auto& proxy = windowProxy().jsWindowProxy(world);
auto& state = *proxy.window()->globalExec();
// FIXME: Preventing Frame from being destroyed is essentially unnecessary.
@@ -211,7 +211,7 @@
const auto& jsSourceCode = moduleRecord.sourceCode();
- auto& proxy = windowProxyController().windowProxy(world);
+ auto& proxy = windowProxy().jsWindowProxy(world);
auto& state = *proxy.window()->globalExec();
SetForScope<const String*> sourceURLScope(m_sourceURL, &sourceURL.string());
@@ -268,7 +268,7 @@
void ScriptController::setupModuleScriptHandlers(LoadableModuleScript& moduleScriptRef, JSInternalPromise& promise, DOMWrapperWorld& world)
{
- auto& proxy = windowProxyController().windowProxy(world);
+ auto& proxy = windowProxy().jsWindowProxy(world);
auto& state = *proxy.window()->globalExec();
// It is not guaranteed that either fulfillHandler or rejectHandler is eventually called.
@@ -320,9 +320,9 @@
promise.then(&state, &fulfillHandler, &rejectHandler);
}
-WindowProxyController& ScriptController::windowProxyController()
+WindowProxy& ScriptController::windowProxy()
{
- return m_frame.windowProxyController();
+ return m_frame.windowProxy();
}
TextPosition ScriptController::eventHandlerPosition() const
@@ -340,34 +340,34 @@
void ScriptController::enableEval()
{
- auto* windowProxy = windowProxyController().existingWindowProxy(mainThreadNormalWorld());
- if (!windowProxy)
+ auto* jsWindowProxy = windowProxy().existingJSWindowProxy(mainThreadNormalWorld());
+ if (!jsWindowProxy)
return;
- windowProxy->window()->setEvalEnabled(true);
+ jsWindowProxy->window()->setEvalEnabled(true);
}
void ScriptController::enableWebAssembly()
{
- auto* windowProxy = windowProxyController().existingWindowProxy(mainThreadNormalWorld());
- if (!windowProxy)
+ auto* jsWindowProxy = windowProxy().existingJSWindowProxy(mainThreadNormalWorld());
+ if (!jsWindowProxy)
return;
- windowProxy->window()->setWebAssemblyEnabled(true);
+ jsWindowProxy->window()->setWebAssemblyEnabled(true);
}
void ScriptController::disableEval(const String& errorMessage)
{
- auto* windowProxy = windowProxyController().existingWindowProxy(mainThreadNormalWorld());
- if (!windowProxy)
+ auto* jsWindowProxy = windowProxy().existingJSWindowProxy(mainThreadNormalWorld());
+ if (!jsWindowProxy)
return;
- windowProxy->window()->setEvalEnabled(false, errorMessage);
+ jsWindowProxy->window()->setEvalEnabled(false, errorMessage);
}
void ScriptController::disableWebAssembly(const String& errorMessage)
{
- auto* windowProxy = windowProxyController().existingWindowProxy(mainThreadNormalWorld());
- if (!windowProxy)
+ auto* jsWindowProxy = windowProxy().existingJSWindowProxy(mainThreadNormalWorld());
+ if (!jsWindowProxy)
return;
- windowProxy->window()->setWebAssemblyEnabled(false, errorMessage);
+ jsWindowProxy->window()->setWebAssemblyEnabled(false, errorMessage);
}
bool ScriptController::canAccessFromCurrentOrigin(Frame* frame)
@@ -383,7 +383,7 @@
void ScriptController::updateDocument()
{
- for (auto& windowProxy : windowProxyController().windowProxiesAsVector()) {
+ for (auto& windowProxy : windowProxy().jsWindowProxiesAsVector()) {
JSLockHolder lock(windowProxy->world().vm());
jsCast<JSDOMWindow*>(windowProxy->window())->updateDocument();
}
@@ -427,7 +427,7 @@
void ScriptController::collectIsolatedContexts(Vector<std::pair<JSC::ExecState*, SecurityOrigin*>>& result)
{
- for (auto& windowProxy : windowProxyController().windowProxiesAsVector()) {
+ for (auto& windowProxy : windowProxy().jsWindowProxiesAsVector()) {
auto* exec = windowProxy->window()->globalExec();
auto* origin = &downcast<DOMWindow>(windowProxy->wrapped()).document()->securityOrigin();
result.append(std::make_pair(exec, origin));
@@ -442,7 +442,7 @@
if (canExecuteScripts(NotAboutToExecuteScript)) {
// _javascript_ is enabled, so there is a _javascript_ window object.
// Return an NPObject bound to the window object.
- auto* window = windowProxyController().windowProxy(pluginWorld()).window();
+ auto* window = windowProxy().jsWindowProxy(pluginWorld()).window();
ASSERT(window);
Bindings::RootObject* root = bindingRootObject();
m_windowScriptNPObject = _NPN_CreateScriptObject(0, window, root);
@@ -603,7 +603,7 @@
return true;
String scriptResult;
- if (!result || !result.getString(windowProxyController().windowProxy(mainThreadNormalWorld()).window()->globalExec(), scriptResult))
+ if (!result || !result.getString(windowProxy().jsWindowProxy(mainThreadNormalWorld()).window()->globalExec(), scriptResult))
return true;
// FIXME: We should always replace the document, but doing so
Modified: trunk/Source/WebCore/bindings/js/ScriptController.h (230793 => 230794)
--- trunk/Source/WebCore/bindings/js/ScriptController.h 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/bindings/js/ScriptController.h 2018-04-19 04:02:30 UTC (rev 230794)
@@ -23,7 +23,7 @@
#include "FrameLoaderTypes.h"
#include "JSDOMWindowProxy.h"
-#include "WindowProxyController.h"
+#include "WindowProxy.h"
#include <_javascript_Core/JSBase.h>
#include <_javascript_Core/Strong.h>
#include <wtf/Forward.h>
@@ -83,7 +83,7 @@
JSDOMWindow* globalObject(DOMWrapperWorld& world)
{
- return JSC::jsCast<JSDOMWindow*>(windowProxyController().windowProxy(world).window());
+ return JSC::jsCast<JSDOMWindow*>(windowProxy().jsWindowProxy(world).window());
}
static void getAllWorlds(Vector<Ref<DOMWrapperWorld>>&);
@@ -165,7 +165,7 @@
void disconnectPlatformScriptObjects();
- WEBCORE_EXPORT WindowProxyController& windowProxyController();
+ WEBCORE_EXPORT WindowProxy& windowProxy();
Frame& m_frame;
const String* m_sourceURL;
Modified: trunk/Source/WebCore/bindings/js/ScriptControllerMac.mm (230793 => 230794)
--- trunk/Source/WebCore/bindings/js/ScriptControllerMac.mm 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/bindings/js/ScriptControllerMac.mm 2018-04-19 04:02:30 UTC (rev 230794)
@@ -103,7 +103,7 @@
if (!m_windowScriptObject) {
JSC::JSLockHolder lock(commonVM());
JSC::Bindings::RootObject* root = bindingRootObject();
- m_windowScriptObject = [WebScriptObject scriptObjectForJSObject:toRef(&windowProxyController().windowProxy(pluginWorld())) originRootObject:root rootObject:root];
+ m_windowScriptObject = [WebScriptObject scriptObjectForJSObject:toRef(&windowProxy().jsWindowProxy(pluginWorld())) originRootObject:root rootObject:root];
}
return m_windowScriptObject.get();
Modified: trunk/Source/WebCore/bindings/js/ScriptState.cpp (230793 => 230794)
--- trunk/Source/WebCore/bindings/js/ScriptState.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/bindings/js/ScriptState.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -75,7 +75,7 @@
{
if (!frame)
return nullptr;
- return frame->windowProxyController().windowProxy(mainThreadNormalWorld()).window()->globalExec();
+ return frame->windowProxy().jsWindowProxy(mainThreadNormalWorld()).window()->globalExec();
}
JSC::ExecState* execStateFromNode(DOMWrapperWorld& world, Node* node)
Copied: trunk/Source/WebCore/bindings/js/WindowProxy.cpp (from rev 230791, trunk/Source/WebCore/bindings/js/WindowProxyController.cpp) (0 => 230794)
--- trunk/Source/WebCore/bindings/js/WindowProxy.cpp (rev 0)
+++ trunk/Source/WebCore/bindings/js/WindowProxy.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -0,0 +1,168 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten ([email protected])
+ * Copyright (C) 2001 Peter Kelly ([email protected])
+ * Copyright (C) 2006-2018 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include "config.h"
+#include "WindowProxy.h"
+
+#include "CommonVM.h"
+#include "Frame.h"
+#include "GCController.h"
+#include "Page.h"
+#include "PageConsoleClient.h"
+#include "PageGroup.h"
+#include "RemoteFrame.h"
+#include "ScriptController.h"
+#include "runtime_root.h"
+#include <_javascript_Core/JSLock.h>
+#include <wtf/MemoryPressureHandler.h>
+
+namespace WebCore {
+
+static void collectGarbageAfterWindowProxyDestruction()
+{
+ // Make sure to GC Extra Soon(tm) during memory pressure conditions
+ // to soften high peaks of memory usage during navigation.
+ if (MemoryPressureHandler::singleton().isUnderMemoryPressure()) {
+ // NOTE: We do the collection on next runloop to ensure that there's no pointer
+ // to the window object on the stack.
+ GCController::singleton().garbageCollectOnNextRunLoop();
+ } else
+ GCController::singleton().garbageCollectSoon();
+}
+
+WindowProxy::WindowProxy(AbstractFrame& frame)
+ : m_frame(frame)
+{
+}
+
+WindowProxy::~WindowProxy()
+{
+ // It's likely that destroying windowProxies will create a lot of garbage.
+ if (!m_jsWindowProxies.isEmpty()) {
+ while (!m_jsWindowProxies.isEmpty()) {
+ auto it = m_jsWindowProxies.begin();
+ it->value->window()->setConsoleClient(nullptr);
+ destroyJSWindowProxy(*it->key);
+ }
+ collectGarbageAfterWindowProxyDestruction();
+ }
+}
+
+void WindowProxy::destroyJSWindowProxy(DOMWrapperWorld& world)
+{
+ ASSERT(m_jsWindowProxies.contains(&world));
+ m_jsWindowProxies.remove(&world);
+ world.didDestroyWindowProxy(this);
+}
+
+JSDOMWindowProxy& WindowProxy::createJSWindowProxy(DOMWrapperWorld& world)
+{
+ ASSERT(!m_jsWindowProxies.contains(&world));
+ ASSERT(m_frame.window());
+
+ VM& vm = world.vm();
+
+ Strong<JSDOMWindowProxy> jsWindowProxy(vm, &JSDOMWindowProxy::create(vm, *m_frame.window(), world));
+ Strong<JSDOMWindowProxy> jsWindowProxy2(jsWindowProxy);
+ m_jsWindowProxies.add(&world, jsWindowProxy);
+ world.didCreateWindowProxy(this);
+ return *jsWindowProxy.get();
+}
+
+Vector<JSC::Strong<JSDOMWindowProxy>> WindowProxy::jsWindowProxiesAsVector() const
+{
+ return copyToVector(m_jsWindowProxies.values());
+}
+
+JSDOMWindowProxy& WindowProxy::createJSWindowProxyWithInitializedScript(DOMWrapperWorld& world)
+{
+ JSLockHolder lock(world.vm());
+ auto& windowProxy = createJSWindowProxy(world);
+ if (is<Frame>(m_frame))
+ downcast<Frame>(m_frame).script().initScriptForWindowProxy(windowProxy);
+ return windowProxy;
+}
+
+void WindowProxy::clearJSWindowProxiesNotMatchingDOMWindow(AbstractDOMWindow* newDOMWindow, bool goingIntoPageCache)
+{
+ if (m_jsWindowProxies.isEmpty())
+ return;
+
+ JSLockHolder lock(commonVM());
+
+ for (auto& windowProxy : jsWindowProxiesAsVector()) {
+ if (&windowProxy->wrapped() == newDOMWindow)
+ continue;
+
+ // Clear the debugger and console from the current window before setting the new window.
+ windowProxy->attachDebugger(nullptr);
+ windowProxy->window()->setConsoleClient(nullptr);
+ if (auto* jsDOMWindow = jsDynamicCast<JSDOMWindowBase*>(*windowProxy->vm(), windowProxy->window()))
+ jsDOMWindow->willRemoveFromWindowProxy();
+ }
+
+ // It's likely that resetting our windows created a lot of garbage, unless
+ // it went in a back/forward cache.
+ if (!goingIntoPageCache)
+ collectGarbageAfterWindowProxyDestruction();
+}
+
+void WindowProxy::setDOMWindow(AbstractDOMWindow* newDOMWindow)
+{
+ ASSERT(newDOMWindow);
+
+ if (m_jsWindowProxies.isEmpty())
+ return;
+
+ JSLockHolder lock(commonVM());
+
+ for (auto& windowProxy : jsWindowProxiesAsVector()) {
+ if (&windowProxy->wrapped() == newDOMWindow)
+ continue;
+
+ windowProxy->setWindow(*newDOMWindow);
+
+ ScriptController* scriptController = nullptr;
+ Page* page = nullptr;
+ if (is<Frame>(m_frame)) {
+ auto& frame = downcast<Frame>(m_frame);
+ scriptController = &frame.script();
+ page = frame.page();
+ }
+
+ // ScriptController's m_cacheableBindingRootObject persists between page navigations
+ // so needs to know about the new JSDOMWindow.
+ if (auto* cacheableBindingRootObject = scriptController ? scriptController->existingCacheableBindingRootObject() : nullptr)
+ cacheableBindingRootObject->updateGlobalObject(windowProxy->window());
+
+ windowProxy->attachDebugger(page ? page->debugger() : nullptr);
+ if (page)
+ windowProxy->window()->setProfileGroup(page->group().identifier());
+ windowProxy->window()->setConsoleClient(page ? &page->console() : nullptr);
+ }
+}
+
+void WindowProxy::attachDebugger(JSC::Debugger* debugger)
+{
+ for (auto& windowProxy : m_jsWindowProxies.values())
+ windowProxy->attachDebugger(debugger);
+}
+
+} // namespace WebCore
Copied: trunk/Source/WebCore/bindings/js/WindowProxy.h (from rev 230791, trunk/Source/WebCore/bindings/js/WindowProxyController.h) (0 => 230794)
--- trunk/Source/WebCore/bindings/js/WindowProxy.h (rev 0)
+++ trunk/Source/WebCore/bindings/js/WindowProxy.h 2018-04-19 04:02:30 UTC (rev 230794)
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 1999-2001 Harri Porten ([email protected])
+ * Copyright (C) 2001 Peter Kelly ([email protected])
+ * Copyright (C) 2006-2018 Apple Inc. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#pragma once
+
+#include "JSDOMWindowProxy.h"
+#include <_javascript_Core/Strong.h>
+#include <wtf/HashMap.h>
+
+namespace JSC {
+class Debugger;
+}
+
+namespace WebCore {
+
+class AbstractFrame;
+
+class WindowProxy {
+ WTF_MAKE_FAST_ALLOCATED;
+public:
+ using ProxyMap = HashMap<RefPtr<DOMWrapperWorld>, JSC::Strong<JSDOMWindowProxy>>;
+
+ explicit WindowProxy(AbstractFrame&);
+ ~WindowProxy();
+
+ void destroyJSWindowProxy(DOMWrapperWorld&);
+
+ ProxyMap::ValuesConstIteratorRange jsWindowProxies() const { return m_jsWindowProxies.values(); }
+ Vector<JSC::Strong<JSDOMWindowProxy>> jsWindowProxiesAsVector() const;
+
+ ProxyMap releaseJSWindowProxies() { return std::exchange(m_jsWindowProxies, ProxyMap()); }
+ void setJSWindowProxies(ProxyMap&& windowProxies) { m_jsWindowProxies = WTFMove(windowProxies); }
+
+ JSDOMWindowProxy& jsWindowProxy(DOMWrapperWorld& world)
+ {
+ auto it = m_jsWindowProxies.find(&world);
+ if (it != m_jsWindowProxies.end())
+ return *it->value.get();
+
+ return createJSWindowProxyWithInitializedScript(world);
+ }
+
+ JSDOMWindowProxy* existingJSWindowProxy(DOMWrapperWorld& world) const
+ {
+ auto it = m_jsWindowProxies.find(&world);
+ return (it != m_jsWindowProxies.end()) ? it->value.get() : nullptr;
+ }
+
+ JSDOMGlobalObject* globalObject(DOMWrapperWorld& world)
+ {
+ return jsWindowProxy(world).window();
+ }
+
+ void clearJSWindowProxiesNotMatchingDOMWindow(AbstractDOMWindow*, bool goingIntoPageCache);
+
+ WEBCORE_EXPORT void setDOMWindow(AbstractDOMWindow*);
+
+ // Debugger can be nullptr to detach any existing Debugger.
+ void attachDebugger(JSC::Debugger*); // Attaches/detaches in all worlds/window proxies.
+
+private:
+ JSDOMWindowProxy& createJSWindowProxy(DOMWrapperWorld&);
+ WEBCORE_EXPORT JSDOMWindowProxy& createJSWindowProxyWithInitializedScript(DOMWrapperWorld&);
+
+ AbstractFrame& m_frame;
+ ProxyMap m_jsWindowProxies;
+};
+
+} // namespace WebCore
Deleted: trunk/Source/WebCore/bindings/js/WindowProxyController.cpp (230793 => 230794)
--- trunk/Source/WebCore/bindings/js/WindowProxyController.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/bindings/js/WindowProxyController.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -1,168 +0,0 @@
-/*
- * Copyright (C) 1999-2001 Harri Porten ([email protected])
- * Copyright (C) 2001 Peter Kelly ([email protected])
- * Copyright (C) 2006-2018 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#include "config.h"
-#include "WindowProxyController.h"
-
-#include "CommonVM.h"
-#include "Frame.h"
-#include "GCController.h"
-#include "Page.h"
-#include "PageConsoleClient.h"
-#include "PageGroup.h"
-#include "RemoteFrame.h"
-#include "ScriptController.h"
-#include "runtime_root.h"
-#include <_javascript_Core/JSLock.h>
-#include <wtf/MemoryPressureHandler.h>
-
-namespace WebCore {
-
-static void collectGarbageAfterWindowProxyDestruction()
-{
- // Make sure to GC Extra Soon(tm) during memory pressure conditions
- // to soften high peaks of memory usage during navigation.
- if (MemoryPressureHandler::singleton().isUnderMemoryPressure()) {
- // NOTE: We do the collection on next runloop to ensure that there's no pointer
- // to the window object on the stack.
- GCController::singleton().garbageCollectOnNextRunLoop();
- } else
- GCController::singleton().garbageCollectSoon();
-}
-
-WindowProxyController::WindowProxyController(AbstractFrame& frame)
- : m_frame(frame)
-{
-}
-
-WindowProxyController::~WindowProxyController()
-{
- // It's likely that destroying windowProxies will create a lot of garbage.
- if (!m_windowProxies.isEmpty()) {
- while (!m_windowProxies.isEmpty()) {
- auto it = m_windowProxies.begin();
- it->value->window()->setConsoleClient(nullptr);
- destroyWindowProxy(*it->key);
- }
- collectGarbageAfterWindowProxyDestruction();
- }
-}
-
-void WindowProxyController::destroyWindowProxy(DOMWrapperWorld& world)
-{
- ASSERT(m_windowProxies.contains(&world));
- m_windowProxies.remove(&world);
- world.didDestroyWindowProxy(this);
-}
-
-JSDOMWindowProxy& WindowProxyController::createWindowProxy(DOMWrapperWorld& world)
-{
- ASSERT(!m_windowProxies.contains(&world));
- ASSERT(m_frame.window());
-
- VM& vm = world.vm();
-
- Strong<JSDOMWindowProxy> windowProxy(vm, &JSDOMWindowProxy::create(vm, *m_frame.window(), world));
- Strong<JSDOMWindowProxy> windowProxy2(windowProxy);
- m_windowProxies.add(&world, windowProxy);
- world.didCreateWindowProxy(this);
- return *windowProxy.get();
-}
-
-Vector<JSC::Strong<JSDOMWindowProxy>> WindowProxyController::windowProxiesAsVector() const
-{
- return copyToVector(m_windowProxies.values());
-}
-
-JSDOMWindowProxy& WindowProxyController::createWindowProxyWithInitializedScript(DOMWrapperWorld& world)
-{
- JSLockHolder lock(world.vm());
- auto& windowProxy = createWindowProxy(world);
- if (is<Frame>(m_frame))
- downcast<Frame>(m_frame).script().initScriptForWindowProxy(windowProxy);
- return windowProxy;
-}
-
-void WindowProxyController::clearWindowProxiesNotMatchingDOMWindow(AbstractDOMWindow* newDOMWindow, bool goingIntoPageCache)
-{
- if (m_windowProxies.isEmpty())
- return;
-
- JSLockHolder lock(commonVM());
-
- for (auto& windowProxy : windowProxiesAsVector()) {
- if (&windowProxy->wrapped() == newDOMWindow)
- continue;
-
- // Clear the debugger and console from the current window before setting the new window.
- windowProxy->attachDebugger(nullptr);
- windowProxy->window()->setConsoleClient(nullptr);
- if (auto* jsDOMWindow = jsDynamicCast<JSDOMWindowBase*>(*windowProxy->vm(), windowProxy->window()))
- jsDOMWindow->willRemoveFromWindowProxy();
- }
-
- // It's likely that resetting our windows created a lot of garbage, unless
- // it went in a back/forward cache.
- if (!goingIntoPageCache)
- collectGarbageAfterWindowProxyDestruction();
-}
-
-void WindowProxyController::setDOMWindowForWindowProxy(AbstractDOMWindow* newDOMWindow)
-{
- ASSERT(newDOMWindow);
-
- if (m_windowProxies.isEmpty())
- return;
-
- JSLockHolder lock(commonVM());
-
- for (auto& windowProxy : windowProxiesAsVector()) {
- if (&windowProxy->wrapped() == newDOMWindow)
- continue;
-
- windowProxy->setWindow(*newDOMWindow);
-
- ScriptController* scriptController = nullptr;
- Page* page = nullptr;
- if (is<Frame>(m_frame)) {
- auto& frame = downcast<Frame>(m_frame);
- scriptController = &frame.script();
- page = frame.page();
- }
-
- // ScriptController's m_cacheableBindingRootObject persists between page navigations
- // so needs to know about the new JSDOMWindow.
- if (auto* cacheableBindingRootObject = scriptController ? scriptController->existingCacheableBindingRootObject() : nullptr)
- cacheableBindingRootObject->updateGlobalObject(windowProxy->window());
-
- windowProxy->attachDebugger(page ? page->debugger() : nullptr);
- if (page)
- windowProxy->window()->setProfileGroup(page->group().identifier());
- windowProxy->window()->setConsoleClient(page ? &page->console() : nullptr);
- }
-}
-
-void WindowProxyController::attachDebugger(JSC::Debugger* debugger)
-{
- for (auto& windowProxy : m_windowProxies.values())
- windowProxy->attachDebugger(debugger);
-}
-
-} // namespace WebCore
Deleted: trunk/Source/WebCore/bindings/js/WindowProxyController.h (230793 => 230794)
--- trunk/Source/WebCore/bindings/js/WindowProxyController.h 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/bindings/js/WindowProxyController.h 2018-04-19 04:02:30 UTC (rev 230794)
@@ -1,86 +0,0 @@
-/*
- * Copyright (C) 1999-2001 Harri Porten ([email protected])
- * Copyright (C) 2001 Peter Kelly ([email protected])
- * Copyright (C) 2006-2018 Apple Inc. All rights reserved.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Lesser General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- * Lesser General Public License for more details.
- *
- * You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- */
-
-#pragma once
-
-#include "JSDOMWindowProxy.h"
-#include <_javascript_Core/Strong.h>
-#include <wtf/HashMap.h>
-
-namespace JSC {
-class Debugger;
-}
-
-namespace WebCore {
-
-class AbstractFrame;
-
-class WindowProxyController {
- WTF_MAKE_FAST_ALLOCATED;
-public:
- using ProxyMap = HashMap<RefPtr<DOMWrapperWorld>, JSC::Strong<JSDOMWindowProxy>>;
-
- explicit WindowProxyController(AbstractFrame&);
- ~WindowProxyController();
-
- void destroyWindowProxy(DOMWrapperWorld&);
-
- ProxyMap::ValuesConstIteratorRange windowProxies() const { return m_windowProxies.values(); }
- Vector<JSC::Strong<JSDOMWindowProxy>> windowProxiesAsVector() const;
-
- ProxyMap releaseWindowProxies() { return std::exchange(m_windowProxies, ProxyMap()); }
- void setWindowProxies(ProxyMap&& windowProxies) { m_windowProxies = WTFMove(windowProxies); }
-
- JSDOMWindowProxy& windowProxy(DOMWrapperWorld& world)
- {
- auto it = m_windowProxies.find(&world);
- if (it != m_windowProxies.end())
- return *it->value.get();
-
- return createWindowProxyWithInitializedScript(world);
- }
-
- JSDOMWindowProxy* existingWindowProxy(DOMWrapperWorld& world) const
- {
- auto it = m_windowProxies.find(&world);
- return (it != m_windowProxies.end()) ? it->value.get() : nullptr;
- }
-
- JSDOMGlobalObject* globalObject(DOMWrapperWorld& world)
- {
- return windowProxy(world).window();
- }
-
- void clearWindowProxiesNotMatchingDOMWindow(AbstractDOMWindow*, bool goingIntoPageCache);
-
- WEBCORE_EXPORT void setDOMWindowForWindowProxy(AbstractDOMWindow*);
-
- // Debugger can be nullptr to detach any existing Debugger.
- void attachDebugger(JSC::Debugger*); // Attaches/detaches in all worlds/window proxies.
-
-private:
- JSDOMWindowProxy& createWindowProxy(DOMWrapperWorld&);
- WEBCORE_EXPORT JSDOMWindowProxy& createWindowProxyWithInitializedScript(DOMWrapperWorld&);
-
- AbstractFrame& m_frame;
- ProxyMap m_windowProxies;
-};
-
-} // namespace WebCore
Modified: trunk/Source/WebCore/loader/FrameLoader.cpp (230793 => 230794)
--- trunk/Source/WebCore/loader/FrameLoader.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/loader/FrameLoader.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -629,7 +629,7 @@
if (clearWindowProperties) {
InspectorInstrumentation::frameWindowDiscarded(m_frame, m_frame.document()->domWindow());
m_frame.document()->domWindow()->resetUnlessSuspendedForDocumentSuspension();
- m_frame.windowProxyController().clearWindowProxiesNotMatchingDOMWindow(newDocument->domWindow(), m_frame.document()->pageCacheState() == Document::AboutToEnterPageCache);
+ m_frame.windowProxy().clearJSWindowProxiesNotMatchingDOMWindow(newDocument->domWindow(), m_frame.document()->pageCacheState() == Document::AboutToEnterPageCache);
if (shouldClearWindowName(m_frame, *newDocument))
m_frame.tree().setName(nullAtom());
@@ -648,7 +648,7 @@
subframeLoader().clear();
if (clearWindowProperties)
- m_frame.windowProxyController().setDOMWindowForWindowProxy(newDocument->domWindow());
+ m_frame.windowProxy().setDOMWindow(newDocument->domWindow());
if (clearScriptObjects)
m_frame.script().clearScriptObjects();
@@ -3645,7 +3645,7 @@
void FrameLoader::dispatchDidClearWindowObjectInWorld(DOMWrapperWorld& world)
{
- if (!m_frame.script().canExecuteScripts(NotAboutToExecuteScript) || !m_frame.windowProxyController().existingWindowProxy(world))
+ if (!m_frame.script().canExecuteScripts(NotAboutToExecuteScript) || !m_frame.windowProxy().existingJSWindowProxy(world))
return;
m_client.dispatchDidClearWindowObjectInWorld(world);
Modified: trunk/Source/WebCore/page/AbstractFrame.cpp (230793 => 230794)
--- trunk/Source/WebCore/page/AbstractFrame.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/page/AbstractFrame.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -26,12 +26,12 @@
#include "config.h"
#include "AbstractFrame.h"
-#include "WindowProxyController.h"
+#include "WindowProxy.h"
namespace WebCore {
AbstractFrame::AbstractFrame()
- : m_windowProxyController(makeUniqueRef<WindowProxyController>(*this))
+ : m_windowProxy(makeUniqueRef<WindowProxy>(*this))
{
}
Modified: trunk/Source/WebCore/page/AbstractFrame.h (230793 => 230794)
--- trunk/Source/WebCore/page/AbstractFrame.h 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/page/AbstractFrame.h 2018-04-19 04:02:30 UTC (rev 230794)
@@ -31,7 +31,7 @@
namespace WebCore {
class AbstractDOMWindow;
-class WindowProxyController;
+class WindowProxy;
// FIXME: Rename Frame to LocalFrame and AbstractFrame to Frame.
class AbstractFrame : public ThreadSafeRefCounted<AbstractFrame> {
@@ -41,8 +41,8 @@
virtual bool isLocalFrame() const = 0;
virtual bool isRemoteFrame() const = 0;
- WindowProxyController& windowProxyController() { return m_windowProxyController; }
- const WindowProxyController& windowProxyController() const { return m_windowProxyController; }
+ WindowProxy& windowProxy() { return m_windowProxy; }
+ const WindowProxy& windowProxy() const { return m_windowProxy; }
AbstractDOMWindow* window() const { return virtualWindow(); }
@@ -52,7 +52,7 @@
private:
virtual AbstractDOMWindow* virtualWindow() const = 0;
- UniqueRef<WindowProxyController> m_windowProxyController;
+ UniqueRef<WindowProxy> m_windowProxy;
};
} // namespace WebCore
Modified: trunk/Source/WebCore/page/Page.cpp (230793 => 230794)
--- trunk/Source/WebCore/page/Page.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/page/Page.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -1257,7 +1257,7 @@
m_debugger = debugger;
for (Frame* frame = &m_mainFrame.get(); frame; frame = frame->tree().traverseNext())
- frame->windowProxyController().attachDebugger(m_debugger);
+ frame->windowProxy().attachDebugger(m_debugger);
}
StorageNamespace* Page::sessionStorage(bool optionalCreate)
Modified: trunk/Source/WebCore/page/RemoteDOMWindow.cpp (230793 => 230794)
--- trunk/Source/WebCore/page/RemoteDOMWindow.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/page/RemoteDOMWindow.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -45,11 +45,11 @@
m_frame->setWindow(nullptr);
}
-WindowProxyController* RemoteDOMWindow::self() const
+WindowProxy* RemoteDOMWindow::self() const
{
if (!m_frame)
return nullptr;
- return &m_frame->windowProxyController();
+ return &m_frame->windowProxy();
}
Location* RemoteDOMWindow::location() const
@@ -85,16 +85,16 @@
return 0;
}
-WindowProxyController* RemoteDOMWindow::top() const
+WindowProxy* RemoteDOMWindow::top() const
{
if (!m_frame)
return nullptr;
// FIXME: Implemented this.
- return &m_frame->windowProxyController();
+ return &m_frame->windowProxy();
}
-WindowProxyController* RemoteDOMWindow::opener() const
+WindowProxy* RemoteDOMWindow::opener() const
{
if (!m_frame)
return nullptr;
@@ -103,16 +103,16 @@
if (!openerFrame)
return nullptr;
- return &openerFrame->windowProxyController();
+ return &openerFrame->windowProxy();
}
-WindowProxyController* RemoteDOMWindow::parent() const
+WindowProxy* RemoteDOMWindow::parent() const
{
if (!m_frame)
return nullptr;
// FIXME: Implemented this.
- return &m_frame->windowProxyController();
+ return &m_frame->windowProxy();
}
ExceptionOr<void> RemoteDOMWindow::postMessage(JSC::ExecState&, DOMWindow& incumbentWindow, JSC::JSValue message, const String& targetOrigin, Vector<JSC::Strong<JSC::JSObject>>&&)
Modified: trunk/Source/WebCore/page/RemoteDOMWindow.h (230793 => 230794)
--- trunk/Source/WebCore/page/RemoteDOMWindow.h 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebCore/page/RemoteDOMWindow.h 2018-04-19 04:02:30 UTC (rev 230794)
@@ -55,7 +55,7 @@
ScriptExecutionContext* scriptExecutionContext() const final { return nullptr; }
// DOM API exposed cross-origin.
- WindowProxyController* self() const;
+ WindowProxy* self() const;
Location* location() const;
void close(Document&);
bool closed() const;
@@ -62,9 +62,9 @@
void focus(DOMWindow& incumbentWindow);
void blur();
unsigned length() const;
- WindowProxyController* top() const;
- WindowProxyController* opener() const;
- WindowProxyController* parent() const;
+ WindowProxy* top() const;
+ WindowProxy* opener() const;
+ WindowProxy* parent() const;
ExceptionOr<void> postMessage(JSC::ExecState&, DOMWindow& incumbentWindow, JSC::JSValue message, const String& targetOrigin, Vector<JSC::Strong<JSC::JSObject>>&&);
private:
Modified: trunk/Source/WebKit/ChangeLog (230793 => 230794)
--- trunk/Source/WebKit/ChangeLog 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebKit/ChangeLog 2018-04-19 04:02:30 UTC (rev 230794)
@@ -1,3 +1,18 @@
+2018-04-18 Chris Dumez <[email protected]>
+
+ Rename WindowProxyController to WindowProxy
+ https://bugs.webkit.org/show_bug.cgi?id=184756
+
+ Reviewed by Sam Weinig.
+
+ Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation
+ needed use WindowProxyController type, which was a bit confusing.
+
+ * WebProcess/Plugins/PluginView.cpp:
+ (WebKit::PluginView::windowScriptNPObject):
+ * WebProcess/WebPage/WebPage.cpp:
+ (WebKit::WebPage::frameBecameRemote):
+
2018-04-18 Youenn Fablet <[email protected]>
Allow SameOrigin credentials handling for synchronous XHR
Modified: trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp (230793 => 230794)
--- trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebKit/WebProcess/Plugins/PluginView.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -1448,7 +1448,7 @@
return nullptr;
}
- return m_npRuntimeObjectMap.getOrCreateNPObject(pluginWorld().vm(), frame()->windowProxyController().windowProxy(pluginWorld()).window());
+ return m_npRuntimeObjectMap.getOrCreateNPObject(pluginWorld().vm(), frame()->windowProxy().jsWindowProxy(pluginWorld()).window());
}
NPObject* PluginView::pluginElementNPObject()
Modified: trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp (230793 => 230794)
--- trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebKit/WebProcess/WebPage/WebPage.cpp 2018-04-19 04:02:30 UTC (rev 230794)
@@ -5888,9 +5888,9 @@
remoteFrame->setOpener(frame->coreFrame()->loader().opener());
- auto windowProxies = frame->coreFrame()->windowProxyController().releaseWindowProxies();
- remoteFrame->windowProxyController().setWindowProxies(WTFMove(windowProxies));
- remoteFrame->windowProxyController().setDOMWindowForWindowProxy(remoteWindow.ptr());
+ auto jsWindowProxies = frame->coreFrame()->windowProxy().releaseJSWindowProxies();
+ remoteFrame->windowProxy().setJSWindowProxies(WTFMove(jsWindowProxies));
+ remoteFrame->windowProxy().setDOMWindow(remoteWindow.ptr());
auto* coreFrame = frame->coreFrame();
coreFrame->setView(nullptr);
Modified: trunk/Source/WebKitLegacy/mac/ChangeLog (230793 => 230794)
--- trunk/Source/WebKitLegacy/mac/ChangeLog 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebKitLegacy/mac/ChangeLog 2018-04-19 04:02:30 UTC (rev 230794)
@@ -1,3 +1,18 @@
+2018-04-18 Chris Dumez <[email protected]>
+
+ Rename WindowProxyController to WindowProxy
+ https://bugs.webkit.org/show_bug.cgi?id=184756
+
+ Reviewed by Sam Weinig.
+
+ Rename WindowProxyController to WindowProxy for clarity. When the IDL uses WindowProxy, the implementation
+ needed use WindowProxyController type, which was a bit confusing.
+
+ * Plugins/Hosted/NetscapePluginInstanceProxy.mm:
+ (WebKit::NetscapePluginInstanceProxy::getWindowNPObject):
+ * WebView/WebFrame.mm:
+ (-[WebFrame _attachScriptDebugger]):
+
2018-04-17 Jonathan Bedard <[email protected]>
Unreviewed rollout of r230632. Regression in memory usage.
Modified: trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm (230793 => 230794)
--- trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebKitLegacy/mac/Plugins/Hosted/NetscapePluginInstanceProxy.mm 2018-04-19 04:02:30 UTC (rev 230794)
@@ -839,7 +839,7 @@
if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
objectID = 0;
else
- objectID = m_localObjects.idForObject(pluginWorld().vm(), frame->windowProxyController().windowProxy(pluginWorld()).window());
+ objectID = m_localObjects.idForObject(pluginWorld().vm(), frame->windowProxy().jsWindowProxy(pluginWorld()).window());
return true;
}
Modified: trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm (230793 => 230794)
--- trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm 2018-04-19 02:05:15 UTC (rev 230793)
+++ trunk/Source/WebKitLegacy/mac/WebView/WebFrame.mm 2018-04-19 04:02:30 UTC (rev 230794)
@@ -360,15 +360,15 @@
- (void)_attachScriptDebugger
{
- auto& windowProxyController = _private->coreFrame->windowProxyController();
+ auto& windowProxy = _private->coreFrame->windowProxy();
// Calling ScriptController::globalObject() would create a window proxy, and dispatch corresponding callbacks, which may be premature
// if the script debugger is attached before a document is created. These calls use the debuggerWorld(), we will need to pass a world
// to be able to debug isolated worlds.
- if (!windowProxyController.existingWindowProxy(debuggerWorld()))
+ if (!windowProxy.existingJSWindowProxy(debuggerWorld()))
return;
- auto* globalObject = windowProxyController.globalObject(debuggerWorld());
+ auto* globalObject = windowProxy.globalObject(debuggerWorld());
if (!globalObject)
return;