New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 733767 link

Starred by 2 users

Issue metadata

Status: Assigned
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: All
Pri: 3
Type: Bug



Sign in to add a comment

PageInfoBubbleViewBrowserTest.ChromeDevtoolsURL times out after making chrome-devtools isolated.

Project Member Reported by pfeldman@chromium.org, Jun 15 2017

Issue description

Times out on the bots:

https://luci-logdog.appspot.com/v/?s=chromium%2Fbb%2Ftryserver.chromium.linux%2Flinux_chromium_rel_ng%2F479140%2F%2B%2Frecipes%2Fsteps%2Fsite_per_process_browser_tests__with_patch_%2F0%2Fstdout

#0 0x000002f92c47 base::debug::StackTrace::StackTrace()
#1 0x0000036a2dd6 content::(anonymous namespace)::DumpStackTraceSignalHandler()
#2 0x7f83f1ecbcb0 <unknown>
#3 0x7f83f1f8584d __poll
#4 0x7f83f7756fe4 <unknown>
#5 0x7f83f77570ec g_main_context_iteration
#6 0x000002fb54d6 base::MessagePumpGlib::Run()
#7 0x000002fb2c72 base::MessageLoop::Run()
#8 0x000002fdd8e7 base::RunLoop::Run()
#9 0x0000036d92dd content::MessageLoopRunner::Run()
#10 0x0000036d80fc content::TestNavigationObserver::Wait()
#11 0x000003071a3e ui_test_utils::NavigateToURLWithDispositionBlockUntilNavigationsComplete()
#12 0x0000013ad037 (anonymous namespace)::PageInfoBubbleViewBrowserTest_ChromeDevtoolsURL_Test::RunTestOnMainThread()
#13 0x0000036a2b26 content::BrowserTestBase::ProxyRunTestOnMainThreadLoop()
#14 0x0000034bd1cd ChromeBrowserMainParts::PreMainMessageLoopRunImpl()
#15 0x0000034bc14a ChromeBrowserMainParts::PreMainMessageLoopRun()
#16 0x000001bcc8ad content::BrowserMainLoop::PreMainMessageLoopRun()
#17 0x000001fe3dd7 content::StartupTaskRunner::RunAllTasksNow()
#18 0x000001bcac28 content::BrowserMainLoop::CreateStartupTasks()
#19 0x000001bcf668 content::BrowserMainRunnerImpl::Initialize()
#20 0x000001bc7fb2 content::BrowserMain()
#21 0x000002f6ec1f content::RunNamedProcessTypeMain()
#22 0x000002f6f5c2 content::ContentMainRunnerImpl::Run()
#23 0x000004c991f4 service_manager::Main()
#24 0x000002f6e352 content::ContentMain()
#25 0x0000036a247f content::BrowserTestBase::SetUp()
#26 0x00000306d87c InProcessBrowserTest::SetUp()
#27 0x0000015db09e testing::Test::Run()
#28 0x0000015dbc10 testing::TestInfo::Run()
#29 0x0000015dc137 testing::TestCase::Run()
#30 0x0000015e32c7 testing::internal::UnitTestImpl::RunAllTests()
#31 0x0000015e2f57 testing::UnitTest::Run()
#32 0x000003080c01 base::TestSuite::Run()
#33 0x000002f85769 ChromeTestSuiteRunner::RunTestSuite()
#34 0x0000036d51cc content::LaunchTests()
#35 0x000002f856c7 main
#36 0x7f83f1eb6f45 __libc_start_main
#37 0x000000605f9d <unknown>
 
Cc: creis@chromium.org nick@chromium.org nasko@chromium.org
Components: UI>Browser>Navigation
Labels: -OS-Linux OS-All
For reference, this test will start timing out, with --site-per-process only, after Pavel lands his https://chromium-review.googlesource.com/c/535022/ to kick devtools extensions out of process.

The test times out while navigating to chrome-devtools://devtools/bundled/inspector.html in a regular tab.  I think the root cause is some confusion about WebUI bindings for devtools pages.  

We start out by forcing a BrowsingInstance swap because ShouldSwapBrowsingInstancesForNavigation thinks the dest URL requires WebUI:

    if (WebUIControllerFactoryRegistry::GetInstance()->UseWebUIBindingsForURL(
            browser_context, new_effective_url)) {
      return true;
    }

The WebUIFactoryFunction needed is DevToolsUI.  

Next, we create a pending RenderFrameHost and call UpdatePendingWebUI() on it.  This should normally grant the necessary WebUI bindings, except that for DevToolsUI, the bindings are 0:

DevToolsUI::DevToolsUI(content::WebUI* web_ui)
    : WebUIController(web_ui), bindings_(web_ui->GetWebContents()) {
  web_ui->SetBindings(0);
  ...

This causes UpdatePendingWebUI to actually skip the call AllowBindings here (which sets them on ChildProcessSecurityPolicy), because enabled bindings (0) match the new ones:
    int new_bindings = pending_web_ui_->GetBindings();
    if ((GetEnabledBindings() & new_bindings) != new_bindings) {
      AllowBindings(new_bindings);

Next, the navigation proceeds, we hit WillProcessResponse and examine whether there should be a transfer in IsRendererTransferNeededForNavigation, for a rfh->GetSiteInstance()->GetSiteURL() of "chrome-devtools://devtools/" (pending RFH) and dest_url of "chrome-devtools://devtools/bundled/inspector.html".

Before Pavel's CL, there was no transfer because we just returned early for the chrome-devtools:// scheme.  Now that this hack is removed, we fall through.  IsCurrentlySameSite (incorrectly) returns *false* even though dest_url matches the current SiteInstance.  This happens because we go to IsCurrentlySameSite -> HasWrongProcessForURL -> RPHI::IsSuitableHost, which returns false here:
  if (ChildProcessSecurityPolicyImpl::GetInstance()->HasWebUIBindings(
          host->GetID()) !=
      WebUIControllerFactoryRegistry::GetInstance()->UseWebUIBindingsForURL(
          browser_context, site_url)) {
    return false;
  }

I.e., we haven't assigned bindings for the pending RFH's process in ChildProcessSecurityPolicy because they weren't needed for this WebUI type, yet UseWebUIBindingsForURL still thinks bindings are needed for this URL.  

Later, with --site-per-process, DoesSiteRequireDedicatedProcess returns true and forces the transfer to happen when it really shouldn't.  The transfer then hangs (haven't tried to understand why).

Interestingly, all this works with PlzNavigate, so might be another bug where we just wait for PlzNavigate to ship. :)

The test is fairly new, added in r476937.  I don't think this is the test's fault though: the same thing seems to happen in regular Chrome with --site-per-process enabled just by navigating a regular tab to chrome-devtools://devtools/bundled/inspector.html from the omnibox.  I suspect it didn't work before we added the RFHM hack for devtools extensions in r460876, and the test just came to rely on the hack before we could remove it.

Also, the SetBindings(0) is only used by DevTools, so this shouldn't affect other WebUI pages.
Wow, thanks for looking into it.

It seems like RenderProcessHostImpl::IsSuitableHost assumes nobody would do SetBindings(0) and DevTools explicitly violates that assumption. There is also a TODO from nick on the same block saying:

// TODO(nick): Consult the SiteIsolationPolicy here.  https://crbug.com/513036 

which makes sense to me - why would we use non-site-isolation-policy hints on determining the isolation...

Sign in to add a comment