New issue
Advanced search Search tips

Issue 739969 link

Starred by 4 users

Issue metadata

Status: Fixed
Owner: ----
Closed: Aug 2017
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Linux
Pri: 2
Type: Bug



Sign in to add a comment

Can't navigate headless with javascript

Project Member Reported by lushnikov@chromium.org, Jul 7 2017

Issue description

Headless version: HeadlessChrome/61.0.3151.0

1. Run chrome headless with a remote debugging port
2. Get a new target via the /json/new command
3. Try to Runtime.evaluate the following code:

   window.location = "https://google.com";

Expected:  the webpage gets navigated to the google website.
Actual: the webpage doesn't navigate.


However, if the target is first navigated to any URL via the `Page.navigate` method, the subsequent call of

   window.location = "https://google.com";

succeedes.

I've debugged the issue up to the FrameLoader::CheckLoadCanStart method
which fast-returns with kNavigationPolicyIgnore, checking for

    frame_->GetDocument()->PageDismissalEventBeingDispatched()

As a result, the FrameLoader::StartLoad bails out early.
 
Cc: skyos...@chromium.org
Labels: M-61
Labels: TE-NeedsTriageHelp
Labels: -TE-NeedsTriageHelp
Status: Available (was: Unconfirmed)
Does this also happen if you use Target.createTarget instead of /json/new?
Project Member

Comment 5 by bugdroid1@chromium.org, Aug 4 2017

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/4128efccf60f8de7866dbb7af683db4fcdbfa59d

commit 4128efccf60f8de7866dbb7af683db4fcdbfa59d
Author: Luca Versari <veluca@google.com>
Date: Fri Aug 04 13:33:22 2017

headless: Implement HeadlessWebContentImpl::Delegate::OpenURLFromTab

OpenURLFromTab in headless used the default implementation, that does
nothing. This caused a couple of issues when the rendered asked the
browser to create new content. The most clear effect of this was that
setting window.location via JavaScript from the about:blank page had
no effect, but it also caused issues with other renderer-initiated but
browser-controlled navigations.


R=eseckler@chromium.org

Bug:  739969 
Change-Id: I4c1080c2f41d5701b44b8c7e87d8a697c408e539
Reviewed-on: https://chromium-review.googlesource.com/600218
Reviewed-by: Eric Seckler <eseckler@chromium.org>
Commit-Queue: Luca Versari <veluca@google.com>
Cr-Commit-Position: refs/heads/master@{#492010}
[modify] https://crrev.com/4128efccf60f8de7866dbb7af683db4fcdbfa59d/headless/lib/browser/headless_web_contents_impl.cc
[modify] https://crrev.com/4128efccf60f8de7866dbb7af683db4fcdbfa59d/headless/lib/headless_web_contents_browsertest.cc
[add] https://crrev.com/4128efccf60f8de7866dbb7af683db4fcdbfa59d/headless/test/data/link.html

Comment 6 by veluca@google.com, Aug 4 2017

Status: Fixed (was: Available)

Sign in to add a comment