Commit 559b67fb authored by haraken's avatar haraken Committed by Commit bot

Remove an isContextInitialized() check from ScriptController::windowProxy()

WindowProxy::initializeIfNeeded() is no-op when isContextInitialized() returns true.
So we can remove the check from ScriptController::windowProxy() and unconditionally
call WindowProxy::initializeIfNeeded().

This CL will cause a subtle change: Before this CL, dispatchDidClearWindowObjectInMainWorld
was not called if WindowProxy gets initialized via WindowProxy::setGlobal. After this CL,
dispatchDidClearWindowObjectInMainWorld will be called always when WindowProxy gets initialized.
I don't think the difference matters (and I guess the new behavior will be more correct).

BUG=677253

Review-Url: https://codereview.chromium.org/2613893002
Cr-Commit-Position: refs/heads/master@{#441908}
parent e5b0bedb
......@@ -211,11 +211,7 @@ void ScriptController::executeScriptInMainWorld(
WindowProxy* ScriptController::windowProxy(DOMWrapperWorld& world) {
WindowProxy* windowProxy = m_windowProxyManager->windowProxy(world);
if (!windowProxy->isContextInitialized()) {
windowProxy->initializeIfNeeded();
if (world.isMainWorld())
frame()->loader().dispatchDidClearWindowObjectInMainWorld();
}
windowProxy->initializeIfNeeded();
return windowProxy;
}
......
......@@ -214,6 +214,9 @@ void WindowProxy::initializeIfNeeded() {
if (isContextInitialized())
return;
initialize();
if (m_world->isMainWorld() && m_frame->isLocalFrame())
toLocalFrame(m_frame)->loader().dispatchDidClearWindowObjectInMainWorld();
}
void WindowProxy::initialize() {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment