Chromium Code Reviews
DescriptionEnsure 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 : . #
Messages
Total messages: 14 (8 generated)
|
||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||