Bug 233391 - [WebDriver][GLIB] Timeout navigating to COOP same-origin pages
Summary: [WebDriver][GLIB] Timeout navigating to COOP same-origin pages
Status: NEW
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebDriver (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks: gtk-webdriver wpe-webdriver
  Show dependency treegraph
 
Reported: 2021-11-19 17:52 PST by Lauro Moura
Modified: 2021-11-19 18:02 PST (History)
3 users (show)

See Also:


Attachments
Selenium standalone script (1.85 KB, text/x-python)
2021-11-19 17:54 PST, Lauro Moura
no flags Details
Standalone server to fetch coop and non-coop pages (1.44 KB, text/x-python)
2021-11-19 17:56 PST, Lauro Moura
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Lauro Moura 2021-11-19 17:52:35 PST
imported/w3c/webdriver/tests/get_window_handle/get.py::test_navigation_with_coop_headers[capabilities0]

Timing out waiting for the response setting the URL in the following snippet:

```
@pytest.mark.capabilities({"acceptInsecureCerts": True})
def test_navigation_with_coop_headers(session, url):
    base_path = ("/webdriver/tests/support/html/subframe.html" +
                 "?pipe=header(Cross-Origin-Opener-Policy,same-origin")

    session.url = url(base_path, protocol="https")
```

If we remove the pipe defining the COOP header, the assignment returns normally. This also happens when trying to fetch a page with COOP same-origin from a custom server through selenium's RemoteWebDriver.

FTR, the coop LayoutTests are working fine.

Checking the journal with WEBKIT_DEBUG=All, the NetworkProcess request for the non-coop page returns right away.

Meanwhile, the response for a COOP page also loads the page to the finish, but the webdriver request never returns, both in the WPT test and the Selenium script. Between the request and the response, the journal logs a large number of loader-related messages (see below)

Maybe something in the automation-related code is losing track of the load after receiving the COOP?

Tests scripts to be attached in the following comments


[NetworkProcess GET request before]
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::setPolicyDocumentLoader: Setting policy document loader to 0x7f41306f6c00 (was (nil))
 WebKitWebProcess[2586504]: 0x7f41306f6c00 - [pageID=17, frameID=3, main=1] DocumentLoader::DocumentLoader::attachToFrame: m_frame=0x7f4199e7f000
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::setProvisionalDocumentLoader: Setting provisional document loader to 0x7f41306f6c00 (was (nil))
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::setDocumentLoader: Setting document loader to 0x7f41306f6c00 (was (nil))
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::transitionToCommitted: Clearing provisional document loader (m_provisionalDocumentLoader=0x7f41306f6c00)
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::setProvisionalDocumentLoader: Setting provisional document loader to (nil) (was 0x7f41306f6c00)
 WebKitWebProcess[2586504]: 0x7f41306f6c00 - [pageID=17, frameID=3, main=1] DocumentLoader::startLoadingMainResource: Returning empty document
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::setState: main frame load completed
 WebKitWebProcess[2586504]: Memory usage info dump at MainFrameLoadCompleted:
 WebKitWebProcess[2586504]:   javascript_gc_heap_capacity_mb: 0
 WebKitWebProcess[2586504]:   page_count: 1
 WebKitWebProcess[2586504]:   backforward_cache_page_count: 0
 WebKitWebProcess[2586504]:   javascript_gc_heap_extra_memory_size_mb: 0
 WebKitWebProcess[2586504]:   document_count: 1
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::load (FrameLoadRequest): frame load started
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::load (DocumentLoader): frame load started
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::loadWithDocumentLoader: frame load started
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::loadWithDocumentLoader: main frame load started
 WebKitWebProcess[2586504]: Memory usage info dump at MainFrameLoadStarted:
 WebKitWebProcess[2586504]:   javascript_gc_heap_capacity_mb: 0
 WebKitWebProcess[2586504]:   page_count: 1
 WebKitWebProcess[2586504]:   backforward_cache_page_count: 0
 WebKitWebProcess[2586504]:   javascript_gc_heap_extra_memory_size_mb: 0
 WebKitWebProcess[2586504]:   document_count: 1
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::setPolicyDocumentLoader: Setting policy document loader to 0x7f41306f8400 (was 0x7f41306f6c00)
 WebKitWebProcess[2586504]: 0x7f41306f8400 - [pageID=17, frameID=3, main=1] DocumentLoader::DocumentLoader::attachToFrame: m_frame=0x7f4199e7f000
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::stopAllLoaders: m_provisionalDocumentLoader=(nil), m_documentLoader=0x7f41306f6c00
 WebKitWebProcess[2586504]: 0x7f41306f6c00 - [pageID=17, frameID=3, main=1] DocumentLoader::DocumentLoader::stopLoading: m_frame=0x7f4199e7f000
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::stopAllLoaders: Clearing provisional document loader (m_provisionalDocumentLoader=(nil))
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::setProvisionalDocumentLoader: Setting provisional document loader to 0x7f41306f8400 (was (nil))
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::continueLoadAfterNavigationPolicy: Setting provisional document loader (m_provisionalDocumentLoader=0x7f41306f8400)
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::setPolicyDocumentLoader: Setting policy document loader to (nil) (was 0x7f41306f8400)
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::prepareForLoadStart: Starting frame load
 WebKitWebProcess[2586504]: 0x7f4199efcea0 - ProgressTracker::progressStarted: frame 0x7f4199e7f000, value 0.100000, tracked frames 1, originating frame 0x7f4199e7f000, isMainLoad 1
 WebKitWebProcess[2586504]: 0x7f41306f8400 - [pageID=17, frameID=3, main=1] DocumentLoader::startLoadingMainResource: Starting load
 WebKitWebProcess[2586504]: 0x7f41984f2480 - [pageID=17, frameID=3, frameLoader=0x7f4199e7e000, resourceID=7] ResourceLoader::willSendRequestInternal: calling completion handler
 WebKitWebProcess[2586504]: 0x7f41984f2480 - [pageID=17, frameID=3, frameLoader=0x7f4199e7e000, resourceID=7] SubresourceLoader::willSendRequestInternal: resource load finished; calling completion handler
 WebKitWebProcess[2586504]: 0x7f4199e7e000 - [pageID=17, frameID=3, main=1] FrameLoader::setDocumentLoader: Setting document loader to 0x7f41306f8400 (was 0x7f41306f6c00)
 WebKitWebProcess[2586504]: 0x7f41306f6c00 - [pageID=17, frameID=3, main=1] DocumentLoader::DocumentLoader::detachFromFrame: m_frame=0x7f4199e7f000
 WebKitWebProcess[2586504]: 0x7f41306f6c00 - [pageID=17, frameID=3, main=1] DocumentLoader::DocumentLoader::stopLoading: m_frame=0x7f4199e7f000
[NetworkProcess GET response after]
Comment 1 Lauro Moura 2021-11-19 17:54:51 PST
Created attachment 444876 [details]
Selenium standalone script

Script used to load the page with selenium.

Usually invoked with `./coop.py --remote 127.0.0.1:8088 http://localhost:8080/noncoop.html` with the WebDriver running on localhost:8088.
Comment 2 Lauro Moura 2021-11-19 17:56:34 PST
Created attachment 444877 [details]
Standalone server to fetch coop and non-coop pages

<server>:<port>/coop.html will return a response with COOP enabled. Any other page will return a non-Coop page.
Comment 3 Lauro Moura 2021-11-19 18:00:07 PST
And to run the WebDriver manually inside the SDK:

```
$ ./Tools/Scripts/webkit-flatpak --gtk --release -c bash
[org.webkit.Sdk WebKit]$ export PATH=/app/webkit/WebKitBuild/Release/bin:$PATH
[org.webkit.Sdk WebKit]$ export WEBKIT_EXEC_PATH=/app/webkit/WebKitBuild/Release/bin
[org.webkit.Sdk WebKit]$ export WEBKIT_INJECTED_BUNDLE_PATH=/app/webkit/WebKitBuild/Release/lib
[org.webkit.Sdk WebKit]$ env WEBKIT_DEBUG=All WebKitWebDriver --port=8088 --host=all 
```

The coop.py script automatically defaults to use GTK's MiniBrowser.