Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(7)

Issue 2732483004: Reinitialize WindowProxy on navigations. (Closed)

Created:
3 years, 9 months ago by dcheng
Modified:
3 years, 9 months ago
Reviewers:
haraken, Yuki
CC:
chromium-reviews, blink-reviews, kinuko+watch, blink-reviews-bindings_chromium.org
Target Ref:
refs/pending/heads/master
Project:
chromium
Visibility:
Public.

Description

Ensure WindowProxy reinitialization on navigations if needed. When returning a Window reference to JS, Blink calls ToV8() to convert the C++ DOMWindow pointer to an associated JS DOM wrapper, which ensures the associated WindowProxy is initialized. During a navigation that requires switching DOMWindows, the WindowProxy is detached from the old DOMWindow by calling setDOMWindow() and later reattached to the new DOMWindow by calling ScriptController::updateDocument(). As an optimization, 246e25c5bd72fac9dce3b9b1254e5590d0444d09 skipped initialization of the WindowProxy if it's global proxy reference was null. Skipping initialization is safe here since a null global proxy reference means that ToV8() was never called, and JS cannot hold any references to the Window object. Thus, it is unnecessary to ensure that the global proxy is attached to a DOMWindow. 40458d4dd913d5fd6f4f1bb2da083a8a7136a9af cleaned up the complex WindowProxy initialization logic but introduced a subtle bug: it changed updateDocument() to be a no-op if the WindowProxy is not initialized. Unfortunately, this means that any existing script references to that Window object will be broken unless WindowProxy reinitialization is triggered by something else, such as loading a <script> tag in the new Document or getting a new reference to the Window. BUG=690178 Review-Url: https://codereview.chromium.org/2732483004 Cr-Commit-Position: refs/heads/master@{#454552} Committed: https://chromium.googlesource.com/chromium/src/+/bee44e2b6c7a93b28e1082743784045447498476

Patch Set 1 #

Patch Set 2 : . #

Unified diffs Side-by-side diffs Delta from patch set Stats (+144 lines, -9 lines) Patch
M third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.h View 1 chunk +6 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/bindings/core/v8/LocalWindowProxy.cpp View 2 chunks +16 lines, -6 lines 0 comments Download
M third_party/WebKit/Source/web/BUILD.gn View 2 chunks +3 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/web/tests/WindowProxyTest.cpp View 1 1 chunk +51 lines, -0 lines 0 comments Download
M third_party/WebKit/Source/web/tests/sim/SimTest.h View 2 chunks +11 lines, -1 line 0 comments Download
M third_party/WebKit/Source/web/tests/sim/SimTest.cpp View 3 chunks +6 lines, -2 lines 0 comments Download
A third_party/WebKit/Source/web/tests/sim/SimWebFrameClient.h View 1 chunk +30 lines, -0 lines 0 comments Download
A third_party/WebKit/Source/web/tests/sim/SimWebFrameClient.cpp View 1 chunk +21 lines, -0 lines 0 comments Download

Messages

Total messages: 14 (8 generated)
Yuki
Not directly related to this CL, but I'm wondering that we probably should distinguish "detached ...
3 years, 9 months ago (2017-03-03 07:51:04 UTC) #2
dcheng
On 2017/03/03 07:51:04, Yuki(slow_til_mar08) wrote: > Not directly related to this CL, but I'm wondering ...
3 years, 9 months ago (2017-03-03 08:23:28 UTC) #6
Yuki
LGTM! Thanks for the fix.
3 years, 9 months ago (2017-03-03 08:28:53 UTC) #7
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-cq-status.appspot.com/v2/patch-status/codereview.chromium.org/2732483004/20001
3 years, 9 months ago (2017-03-03 08:38:47 UTC) #10
commit-bot: I haz the power
Committed patchset #2 (id:20001) as https://chromium.googlesource.com/chromium/src/+/bee44e2b6c7a93b28e1082743784045447498476
3 years, 9 months ago (2017-03-03 09:25:45 UTC) #13
haraken
3 years, 9 months ago (2017-03-05 07:12:47 UTC) #14
Message was sent while issue was closed.
LGTM, thanks for the fix! I apologize I couldn't work on this.

Powered by Google App Engine
This is Rietveld 408576698