OOPIF: Navigating in the unload handler causes the browser and renderer to go out-of-sync |
|||
Issue description
During a cross-process navigation, if the renderer navigates in an unload handler, we leak the process and leave the renderer/browser process out-of-sync. This happens because the browser has already added the RFH to the pending delete list, and created a new process/RFH for the next navigation.
Only in-page navigations are allowed in unload handlers, here's a test that reproduces the problem.
IN_PROC_BROWSER_TEST_F(SitePerProcessBrowserTest, NavigateInUnloadHandler) {
GURL main_url(embedded_test_server()->GetURL(
"a.com", "/cross_site_iframe_factory.html?a(b(b))"));
NavigateToURL(shell(), main_url);
FrameTreeNode* root = static_cast<WebContentsImpl*>(shell()->web_contents())
->GetFrameTree()
->root();
EXPECT_EQ(
" Site A ------------ proxies for B\n"
" +--Site B ------- proxies for A\n"
" +--Site B -- proxies for A\n"
"Where A = http://a.com/\n"
" B = http://b.com/",
DepictFrameTree(root));
int child_count = 0;
EXPECT_TRUE(ExecuteScriptAndExtractInt(
root->child_at(0)->current_frame_host(),
"window.domAutomationController.send(frames.length);", &child_count));
EXPECT_EQ(1, child_count);
EXPECT_TRUE(ExecuteScript(
root->child_at(0)->child_at(0)->current_frame_host(),
"window.onunload=function(e){\n"
" window.location = '#navigate';\n"
"};\n"));
std::string script =
std::string("window.document.getElementById('child-0').src = \"") +
embedded_test_server()
->GetURL("c.com", "/cross_site_iframe_factory.html?c")
.spec() +
"\"";
EXPECT_TRUE(
ExecuteScript(root->child_at(0)->current_frame_host(), script.c_str()));
RenderFrameDeletedObserver deleted_observer(
root->child_at(0)->child_at(0)->current_frame_host());
deleted_observer.WaitUntilDeleted();
EXPECT_TRUE(ExecuteScriptAndExtractInt(
root->child_at(0)->current_frame_host(),
"window.domAutomationController.send(frames.length);", &child_count));
EXPECT_EQ(0, child_count);
EXPECT_EQ(
" Site A ------------ proxies for B\n"
" +--Site B ------- proxies for A\n"
"Where A = http://a.com/\n"
" B = http://b.com/",
DepictFrameTree(root));
}
,
May 26 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/9e8d2940fd58f042dd06e60367de9b2bd478c3bd commit 9e8d2940fd58f042dd06e60367de9b2bd478c3bd Author: lfg <lfg@chromium.org> Date: Thu May 26 01:21:27 2016 Add a counter and a deprecation message when navigating in an unload handler. Blink intent: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/VfItzNe3WO0 BUG= 613244 Review-Url: https://codereview.chromium.org/1969723004 Cr-Commit-Position: refs/heads/master@{#396077} [modify] https://crrev.com/9e8d2940fd58f042dd06e60367de9b2bd478c3bd/third_party/WebKit/LayoutTests/fast/forms/state-restore-skip-stateless-expected.txt [modify] https://crrev.com/9e8d2940fd58f042dd06e60367de9b2bd478c3bd/third_party/WebKit/Source/core/frame/Deprecation.cpp [modify] https://crrev.com/9e8d2940fd58f042dd06e60367de9b2bd478c3bd/third_party/WebKit/Source/core/frame/UseCounter.h [modify] https://crrev.com/9e8d2940fd58f042dd06e60367de9b2bd478c3bd/third_party/WebKit/Source/core/loader/FrameLoader.cpp [modify] https://crrev.com/9e8d2940fd58f042dd06e60367de9b2bd478c3bd/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp [modify] https://crrev.com/9e8d2940fd58f042dd06e60367de9b2bd478c3bd/third_party/WebKit/Source/core/loader/NavigationScheduler.h [modify] https://crrev.com/9e8d2940fd58f042dd06e60367de9b2bd478c3bd/tools/metrics/histograms/histograms.xml
,
Aug 8 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/fe3842388695619214e4b6aa87bac2926356b0df commit fe3842388695619214e4b6aa87bac2926356b0df Author: lfg <lfg@chromium.org> Date: Mon Aug 08 20:25:59 2016 Fix test so that it doesn't rely on hash navigation during unload. BUG= 613244 Review-Url: https://codereview.chromium.org/2215023002 Cr-Commit-Position: refs/heads/master@{#410434} [modify] https://crrev.com/fe3842388695619214e4b6aa87bac2926356b0df/third_party/WebKit/LayoutTests/fast/forms/state-restore-skip-stateless-expected.txt [modify] https://crrev.com/fe3842388695619214e4b6aa87bac2926356b0df/third_party/WebKit/LayoutTests/fast/forms/state-restore-skip-stateless.html
,
Aug 26 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/8fb70277dba468aac9d2eae51e432d76667a79db commit 8fb70277dba468aac9d2eae51e432d76667a79db Author: lfg <lfg@chromium.org> Date: Fri Aug 26 00:08:36 2016 Disable navigations in the unload handler. Blink intent: https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/VfItzNe3WO0 BUG= 613244 Review-Url: https://codereview.chromium.org/2206843003 Cr-Commit-Position: refs/heads/master@{#414588} [add] https://crrev.com/8fb70277dba468aac9d2eae51e432d76667a79db/third_party/WebKit/LayoutTests/http/tests/navigation/hash-navigation-in-unload-handler.html [modify] https://crrev.com/8fb70277dba468aac9d2eae51e432d76667a79db/third_party/WebKit/Source/core/frame/Deprecation.cpp [modify] https://crrev.com/8fb70277dba468aac9d2eae51e432d76667a79db/third_party/WebKit/Source/core/frame/History.cpp [modify] https://crrev.com/8fb70277dba468aac9d2eae51e432d76667a79db/third_party/WebKit/Source/core/frame/UseCounter.h [modify] https://crrev.com/8fb70277dba468aac9d2eae51e432d76667a79db/third_party/WebKit/Source/core/loader/FrameLoader.cpp [modify] https://crrev.com/8fb70277dba468aac9d2eae51e432d76667a79db/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp [modify] https://crrev.com/8fb70277dba468aac9d2eae51e432d76667a79db/third_party/WebKit/Source/core/loader/NavigationScheduler.h
,
Sep 12 2016
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/18ed527d63e722878207ae59b2f5744fca338152 commit 18ed527d63e722878207ae59b2f5744fca338152 Author: lfg <lfg@chromium.org> Date: Mon Sep 12 20:47:08 2016 Adds a test that verifies that navigating in the unload handler while performing a process transfer for a subframe doesn't crash the browser. BUG= 613244 Review-Url: https://codereview.chromium.org/2332073002 Cr-Commit-Position: refs/heads/master@{#418034} [modify] https://crrev.com/18ed527d63e722878207ae59b2f5744fca338152/content/browser/site_per_process_browsertest.cc [modify] https://crrev.com/18ed527d63e722878207ae59b2f5744fca338152/content/renderer/render_frame_impl.cc
,
Sep 12 2016
,
Apr 15 2017
|
|||
►
Sign in to add a comment |
|||
Comment 1 by creis@chromium.org
, May 19 2016