Closed Bug 2046879 Opened 1 month ago Closed 12 days ago

Intermittent Android mozilla/tests/webdriver/classic/navigate_to/privileged_pages.py | test_inherit_principal_url_in_extension_process_context_without_system_access[javascript] - setup error: webdriver.error.NoSuchWindowException: no such window (404)

Categories

(Remote Protocol :: Marionette, defect, P5)

defect
Points:
2

Tracking

(firefox154 fixed)

RESOLVED FIXED
154 Branch
Tracking Status
firefox154 --- fixed

People

(Reporter: intermittent-bug-filer, Assigned: whimboo)

References

(Blocks 1 open bug)

Details

(Keywords: intermittent-failure, Whiteboard: [webdriver:m21])

Attachments

(1 file)

Filed by: abutkovits [at] mozilla.com
Parsed log: https://treeherder.mozilla.org/logviewer?job_id=572194167&repo=autoland&task=XSKMqVnRRbyxHscAKKsDtQ.0
Full log: https://firefox-ci-tc.services.mozilla.com/api/queue/v1/task/XSKMqVnRRbyxHscAKKsDtQ/runs/0/artifacts/public/logs/live_backing.log


[task 2026-06-11T16:52:30.311+00:00] 16:52:30     INFO - TEST-PASS | /_mozilla/webdriver/classic/navigate_to/privileged_pages.py | test_inherit_principal_url_in_extension_process_context_without_system_access[data]
[task 2026-06-11T16:52:30.311+00:00] 16:52:30     INFO - TEST-UNEXPECTED-ERROR | /_mozilla/webdriver/classic/navigate_to/privileged_pages.py | test_inherit_principal_url_in_extension_process_context_without_system_access[javascript] - setup error: webdriver.error.NoSuchWindowException: no such window (404): Browsing context has been discarded
[task 2026-06-11T16:52:30.311+00:00] 16:52:30     INFO - session = <Session 4011fc5f-4006-4fef-bf9a-c73997cab4ec>
[task 2026-06-11T16:52:30.311+00:00] 16:52:30     INFO - 
[task 2026-06-11T16:52:30.311+00:00] 16:52:30     INFO -     @pytest.fixture
[task 2026-06-11T16:52:30.311+00:00] 16:52:30     INFO -     def install_new_tab_extension(session):
[task 2026-06-11T16:52:30.311+00:00] 16:52:30     INFO -         """Install an extension that opens a page on install, wait for the page
[task 2026-06-11T16:52:30.311+00:00] 16:52:30     INFO -         to load, and return its moz-extension:// URL. Cleans up on teardown."""
[task 2026-06-11T16:52:30.311+00:00] 16:52:30     INFO -         original_handles = session.handles
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -     
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -         with open(EXTENSION_NEW_TAB_XPI, "rb") as f:
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -             xpi_base64 = base64.b64encode(f.read()).decode("utf-8")
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -     
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -         response = install_addon(session, "addon", xpi_base64, True)
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -         addon_id = assert_success(response)
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -     
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -         original_handle = session.window_handle
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -     
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -         def find_extension_tab(_):
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -             for handle in session.handles:
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -                 if handle in original_handles:
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -                     continue
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -     
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -                 session.window_handle = handle
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -                 url = session.url
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -     
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -                 if url.startswith("moz-extension://"):
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -                     return handle, url
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -     
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -             return False
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -     
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -         wait = Poll(session, timeout=5)
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - >       ext_handle, ext_url = wait.until(find_extension_tab)
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - 
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - addon_id   = 'extension-page@web-platform-tests.org'
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - f          = <_io.BufferedReader name='/builds/worker/workspace/build/tests/web-platform/mozilla/tests/webdriver/classic/navigate_to/../../support/webextensions/extension_new_tab.xpi'>
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - find_extension_tab = <function install_new_tab_extension.<locals>.find_extension_tab at 0x7f7ee87453a0>
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - original_handle = '7e4865df-824e-42d3-9c07-187e885a253f'
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - original_handles = ['7e4865df-824e-42d3-9c07-187e885a253f']
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - response   = <Response: status=200 body={"value": "extension-page@web-platform-tests.org"}>
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - session    = <Session 4011fc5f-4006-4fef-bf9a-c73997cab4ec>
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - wait       = <tests.support.sync.Poll object at 0x7f7ee86d3bc0>
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - xpi_base64 = 'UEsDBBQAAAAIAPxbw1yKzTC+xwAAAHIBAAANABwAbWFuaWZlc3QuanNvblVUCQADi/Qfaov0H2p1eAsAAQT1AQAABAAAAABVj7FuwzAMRPd8haC5Nlp065QlXxEUBi3TChNbEkQ2DhD43ytZcRJrEo/vcMf7TqWnR3DUI0tzxcjknf5R3x9l5WDENGq8Cbq8UwEsKkm0fiAdsokUpBj14UnKCUT5kCYFxZZEciwwDKv5lai/6s9VbaOfGGPDAQ31ZBpGEXKWE3dfkAWzaC5+Iy0ydZvGVY7eT9hWYQDpfRyrXJ9rH61+OuflN68FwFxs9H+u2yaWS3ON4xtTn1n/bvwB40ic0wsr0GZk3v0DUEsDBBQAAAAIAPxbw1zhz6GwQAAAAEMAAAANABwAYmFja2dyb3VuZC5qc1VUCQADjPQfaoz0H2p1eAsAAQT1AQAABAAAAABLKsovL04t0itJTCrWSy5KTSxJ1ahWKC3KsVJIgkoVleaVZOam6qWnloQG+WgoFSSmp+pllOTmKGkq1GpacwEAUEsDBBQAAAAIAPxbw1xOqSViTQAAAG0AAAAJABwAcGFnZS5odG1sVVQJAAOM9B9qjPQfanV4CwABBPUBAAAEAAAAALNRTMlPLqksSFXIKMnNseOygVGpiSl2NiWZJTmpdq4VJal5xZn5eQoBiempNvoQURt9sBoum6T8lEo7mwIkZQVgZQVAJWA5LqBSsKkAUEsBAh4DFAAAAAgA/FvDXIrNML7HAAAAcgEAAA0AGAAAAAAAAQAAAKSBAAAAAG1hbmlmZXN0Lmpzb25VVAUAA4v0H2p1eAsAAQT1AQAABAAAAABQSwECHgMUAAAACAD8W8Nc4c+hsEAAAABDAAAADQAYAAAAAAABAAAApIEOAQAAYmFja2dyb3VuZC5qc1VUBQADjPQfanV4CwABBPUBAAAEAAAAAFBLAQIeAxQAAAAIAPxbw1xOqSViTQAAAG0AAAAJABgAAAAAAAEAAACkgZUBAABwYWdlLmh0bWxVVAUAA4z0H2p1eAsAAQT1AQAABAAAAABQSwUGAAAAAAMAAwD1AAAAJQIAAAAA'
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - 
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - tests/web-platform/mozilla/tests/webdriver/classic/navigate_to/privileged_pages.py:67: 
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO - tests/web-platform/tests/webdriver/tests/support/sync.py:123: in until
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -     result = condition(self.session)
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -         condition  = <function install_new_tab_extension.<locals>.find_extension_tab at 0x7f7ee87453a0>
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -         condition_msg = None
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -         end        = 1781196753.9222596
[task 2026-06-11T16:52:30.312+00:00] 16:52:30     INFO -         next       = 1781196749.022261
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -         result     = None
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -         self       = <tests.support.sync.Poll object at 0x7f7ee86d3bc0>
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -         start      = 1781196748.9222596
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -         traceback  = None
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO - tests/web-platform/mozilla/tests/webdriver/classic/navigate_to/privileged_pages.py:59: in find_extension_tab
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -     url = session.url
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -         _          = <Session 4011fc5f-4006-4fef-bf9a-c73997cab4ec>
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -         handle     = '14dfbac9-7d2e-4947-bb9d-10dcfed9d3a6'
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -         original_handles = ['7e4865df-824e-42d3-9c07-187e885a253f']
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -         session    = <Session 4011fc5f-4006-4fef-bf9a-c73997cab4ec>
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO - tests/web-platform/tests/tools/webdriver/webdriver/client.py:656: in url
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -     return self.send_session_command("GET", "url")
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -         self       = <Session 4011fc5f-4006-4fef-bf9a-c73997cab4ec>
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO - tests/web-platform/tests/tools/webdriver/webdriver/client.py:652: in send_session_command
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -     return self.send_command(method, url, body, timeout)
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -         body       = None
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -         method     = 'GET'
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -         self       = <Session 4011fc5f-4006-4fef-bf9a-c73997cab4ec>
[task 2026-06-11T16:52:30.313+00:00] 16:52:30     INFO -         timeout    = None
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -         uri        = 'url'
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -         url        = 'session/4011fc5f-4006-4fef-bf9a-c73997cab4ec/url'
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO - _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO - 
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO - self = <Session 4011fc5f-4006-4fef-bf9a-c73997cab4ec>, method = 'GET'
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO - url = 'session/4011fc5f-4006-4fef-bf9a-c73997cab4ec/url', body = None
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO - timeout = None
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO - 
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -     def send_command(self, method, url, body=None, timeout=None):
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -         """
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -         Send a command to the remote end and validate its success.
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -     
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -         :param method: HTTP method to use in request.
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -         :param uri: "Command part" of the HTTP request URL,
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -             e.g. `window/rect`.
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -         :param body: Optional body of the HTTP request.
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -     
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -         :return: `None` if the HTTP response body was empty, otherwise
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -             the `value` field returned after parsing the response
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -             body as JSON.
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -     
[task 2026-06-11T16:52:30.314+00:00] 16:52:30     INFO -         :raises error.WebDriverException: If the remote end returns
[task 2026-06-11T16:52:30.315+00:00] 16:52:30     INFO -             an error.
[task 2026-06-11T16:52:30.315+00:00] 16:52:30     INFO -         :raises ValueError: If the response body does not contain a
[task 2026-06-11T16:52:30.315+00:00] 16:52:30     INFO -             `value` key.

Due to some reason the new tab as opened by the extension during installation gets immediately closed. At least we are able to switch to it:
https://treeherder.mozilla.org/logviewer?job_id=572194167&repo=autoland&task=XSKMqVnRRbyxHscAKKsDtQ.0&lineNumber=18506-18510

[task 2026-06-11T16:52:31.467+00:00] 16:52:31     INFO - PID 6349 | 1781196748945	webdriver::server	DEBUG	<- 200 OK {"value":["7e4865df-824e-42d3-9c07-187e885a253f","14dfbac9-7d2e-4947-bb9d-10dcfed9d3a6"]}
[task 2026-06-11T16:52:31.468+00:00] 16:52:31     INFO - PID 6349 | 1781196748946	webdriver::server	DEBUG	-> POST /session/4011fc5f-4006-4fef-bf9a-c73997cab4ec/window {"handle": "14dfbac9-7d2e-4947-bb9d-10dcfed9d3a6"}
[task 2026-06-11T16:52:31.469+00:00] 16:52:31     INFO - PID 6349 | 1781196748951	webdriver::server	DEBUG	<- 200 OK {"value":null}
[task 2026-06-11T16:52:31.469+00:00] 16:52:31     INFO - PID 6349 | 1781196748951	webdriver::server	DEBUG	-> GET /session/4011fc5f-4006-4fef-bf9a-c73997cab4ec/url
[task 2026-06-11T16:52:31.470+00:00] 16:52:31     INFO - PID 6349 | 1781196748963	webdriver::server	DEBUG	<- 404 Not Found {"value":{"error":"no such window","message":"Browsing context has been discarded","stacktrace":"RemoteError ... ontent/marionette/server.sys.mjs:263:9\n_onJSONObjectReady/<@chrome://remote/content/marionette/transport.sys.mjs:494:20\n"}}

So far it looks like that this failure is Android only.

(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from comment #1)

Due to some reason the new tab as opened by the extension during installation gets immediately closed. At least we are able to switch to it:
https://treeherder.mozilla.org/logviewer?job_id=572194167&repo=autoland&task=XSKMqVnRRbyxHscAKKsDtQ.0&lineNumber=18506-18510

[task 2026-06-11T16:52:31.467+00:00] 16:52:31     INFO - PID 6349 | 1781196748945	webdriver::server	DEBUG	<- 200 OK {"value":["7e4865df-824e-42d3-9c07-187e885a253f","14dfbac9-7d2e-4947-bb9d-10dcfed9d3a6"]}
[task 2026-06-11T16:52:31.468+00:00] 16:52:31     INFO - PID 6349 | 1781196748946	webdriver::server	DEBUG	-> POST /session/4011fc5f-4006-4fef-bf9a-c73997cab4ec/window {"handle": "14dfbac9-7d2e-4947-bb9d-10dcfed9d3a6"}
[task 2026-06-11T16:52:31.469+00:00] 16:52:31     INFO - PID 6349 | 1781196748951	webdriver::server	DEBUG	<- 200 OK {"value":null}
[task 2026-06-11T16:52:31.469+00:00] 16:52:31     INFO - PID 6349 | 1781196748951	webdriver::server	DEBUG	-> GET /session/4011fc5f-4006-4fef-bf9a-c73997cab4ec/url
[task 2026-06-11T16:52:31.470+00:00] 16:52:31     INFO - PID 6349 | 1781196748963	webdriver::server	DEBUG	<- 404 Not Found {"value":{"error":"no such window","message":"Browsing context has been discarded","stacktrace":"RemoteError ... ontent/marionette/server.sys.mjs:263:9\n_onJSONObjectReady/<@chrome://remote/content/marionette/transport.sys.mjs:494:20\n"}}

It doesn't look like that the new tab gets closed but it may not be ready yet:

06-11 16:52:28.500  6874  6874 D WebExtension: handleMessage GeckoView:WebExtension:NewTab
06-11 16:52:28.503  6874  6896 I Gecko   : 1781196748503	Marionette	DEBUG	0 <- [1,51,null,{"value":"extension-page@web-platform-tests.org"}]
06-11 16:52:28.503  6874  6874 D WebExtension: handleMessage GeckoView:WebExtension:OnInstalled
06-11 16:52:28.504  6874  6874 D WebExtension: handleMessage GeckoView:WebExtension:OnReady
06-11 16:52:28.507  6874  6896 I Gecko   : 1781196748507	Marionette	DEBUG	0 -> [0,52,"WebDriver:GetWindowHandle",{}]
06-11 16:52:28.508  6874  6896 I Gecko   : 1781196748508	Marionette	DEBUG	0 <- [1,52,null,{"value":"7e4865df-824e-42d3-9c07-187e885a253f"}]
06-11 16:52:28.527  6874  6896 I GeckoSession: zerdatime 1443232 - chrome startup finished
06-11 16:52:28.530  6874  6896 I Gecko   : 1781196748530	Marionette	DEBUG	0 -> [0,53,"WebDriver:GetWindowHandles",{}]
06-11 16:52:28.531  6874  6896 I Gecko   : 1781196748531	Marionette	DEBUG	0 <- [1,53,null,["7e4865df-824e-42d3-9c07-187e885a253f","14dfbac9-7d2e-4947-bb9d-10dcfed9d3a6"]]
06-11 16:52:28.534  6988  7020 W GeckoEditableChild: No editable parent
06-11 16:52:28.536  6874  6896 I Gecko   : 1781196748536	Marionette	DEBUG	0 -> [0,54,"WebDriver:SwitchToWindow",{"handle":"14dfbac9-7d2e-4947-bb9d-10dcfed9d3a6"}]
06-11 16:52:28.537  6874  6896 I Gecko   : 1781196748537	Marionette	DEBUG	0 <- [1,54,null,{"value":null}]
06-11 16:52:28.545  6874  6874 D GeckoSession: handleMessage GeckoView:LocationChange uri=moz-extension://9ecf02a3-2f57-47f5-bbd8-856221456578/page.html
06-11 16:52:28.547  6874  6896 I Gecko   : 1781196748547	Marionette	DEBUG	0 -> [0,55,"WebDriver:GetCurrentURL",{}]
06-11 16:52:28.547  6874  6896 I Gecko   : 1781196748547	Marionette	DEBUG	0 <- [1,55,{"error":"no such window","message":"Browsing context has been discarded","stacktrace":"RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8\nWebDriverError@chrome://remote/content/shared/webdriver/Er ... ote/content/marionette/server.sys.mjs:263:9\n_onJSONObjectReady/<@chrome://remote/content/marionette/transport.sys.mjs:494:20\n"},null]

The checks that we do for verifying that the browsing context is open are:
https://searchfox.org/firefox-main/rev/c280a3de79038960073359b0b4777c676320b76a/remote/shared/webdriver/Assert.sys.mjs#156-165

   browsingContext => {
      if (!browsingContext?.currentWindowGlobal) {
        return false;
      }

      if (browsingContext.isContent && !browsingContext.top.embedderElement) {
        return false;
      }

      return true;

So most likely the currentWindowGlobal is not set yet. This is also backed by the fact that the relevant test for WebDriver BiDi is not failing, and there we are waiting correctly within the message manager before working with the tab.

Maybe we should update WebDriver:SwitchToWindow to actually wait for the currentWindowGlobal to be set before returning from the command.

(In reply to Henrik Skupin [:whimboo][⌚️UTC+2] from comment #6)

I pushed a try build to verify my assumption:
https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=60194

It's actually still failing. I added the wait for the currentWindowGlobal to the MarionetteCommands actor but this wont work in all the cases. What I missed is that a couple of commands for Marionette do not even use the actor but operate directly in the parent process.

As such we could move all the commands to the actor, which would most likely be too much work, or just wait for the currentWindowGlobal as well in the WebDriver:SwitchToWindow command as mentioned above.

Note that of the 28 commands that touch the MarionetteCommands actor, all are the per-element / per-document / input commands. Everything else is handled in the parent process. Here are the WebDriver: commands that do NOT go through the actor:

Navigation (handled via lazy.navigate + BrowsingContext)

  • WebDriver:NavigatenavigateTo
  • WebDriver:BackgoBack
  • WebDriver:ForwardgoForward
  • WebDriver:Refreshrefresh
  • WebDriver:GetCurrentURLgetCurrentUrl
  • WebDriver:GetTitlegetTitle

Window / session management (via lazy.windowManager, NavigableManager, session state)

  • WebDriver:GetWindowHandle / GetWindowHandles
  • WebDriver:CloseWindow (close) / WebDriver:CloseChromeWindow
  • WebDriver:NewWindow / WebDriver:NewSession / WebDriver:DeleteSession
  • WebDriver:SwitchToWindow
  • WebDriver:SwitchToParentFrame (walks BrowsingContext.parent in the parent; note WebDriver:SwitchToFrame does use the actor)
  • WebDriver:GetWindowRect / WebDriver:SetWindowRect
  • WebDriver:MaximizeWindow / WebDriver:MinimizeWindow / WebDriver:FullscreenWindow
  • WebDriver:GetTimeouts / WebDriver:SetTimeouts

Modal dialogs (via this.#dialog)

  • WebDriver:AcceptAlert / WebDriver:DismissAlert / WebDriver:GetAlertText / WebDriver:SendAlertText

Cookies (via lazy.cookie)

  • WebDriver:AddCookie / WebDriver:GetCookies / WebDriver:DeleteCookie / WebDriver:DeleteAllCookies

Misc parent-process modules

  • WebDriver:Printlazy.print
  • WebDriver:SetPermission / Permissions:SetPermission → lazy.permissions

The non-WebDriver: namespaces are entirely parent-process (no actor), with the lone exceptions of Marionette:GetAccessibilityPropertiesFor* and Reporting:GenerateTestReport:

  • Marionette:* (context, screen orientation, window type, quit, chrome handlers, accept connections)
  • reftest:*, Addon:*, L10n:LocalizeProperty, GPC:*, WebAuthn:*

Given that those are quite a lot of commands I think that we may be able to as well include this simple wait logic to GeckoDriver.getBrowsingContext(). All the methods that rely on the browsing context would call it, so it would be a good fitting point.

Actually GeckoDriver.getBrowsingContext() won't work given that this is a synchronous method and awaiting the currentWindowGlobal would require us to change the method to async, which is not ideal given how much it is used. I need to do further investigation for a proper or multiple places.

Summary: Intermittent mozilla/tests/webdriver/classic/navigate_to/privileged_pages.py | test_inherit_principal_url_in_extension_process_context_without_system_access[javascript] - setup error: webdriver.error.NoSuchWindowException: no such window (404): Browsing c → Intermittent Android mozilla/tests/webdriver/classic/navigate_to/privileged_pages.py | test_inherit_principal_url_in_extension_process_context_without_system_access[javascript] - setup error: webdriver.error.NoSuchWindowException: no such window (404)

I think that we should limit us for the check of the current window global for the initial load of the tab, what's exactly the failure here. That means we can use waitForTopBrowsingContextToBeReady() within setWindowHandle(). Lets see if that works. Here a new try build:

https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=62515

Hm, it looks like that this is not a problem with the current window global given that the switch to window command immediately can find it but then for the next command the lazy.assert.open check is failing:

06-29 21:03:40.078  5759  5785 I Gecko   : 1782767020078	Marionette	DEBUG	0 -> [0,53,"WebDriver:SwitchToWindow",{"handle":"bc284115-3d8a-4336-b27e-19ac3a8637be"}]
06-29 21:03:40.079  5759  5785 I Gecko   : *** currentWindowGlobal immediatelly found
06-29 21:03:40.079  5759  5785 I Gecko   : 
06-29 21:03:40.079  5759  5785 I Gecko   : 1782767020079	Marionette	DEBUG	0 <- [1,53,null,{"value":null}]
06-29 21:03:40.086  5759  5759 D GeckoSession: handleMessage GeckoView:LocationChange uri=moz-extension://9a9166fc-47bf-450c-b6e6-d5acb66e8068/page.html
06-29 21:03:40.087  5759  5785 I Gecko   : 1782767020087	Marionette	DEBUG	0 -> [0,54,"WebDriver:GetCurrentURL",{}]
06-29 21:03:40.087  5759  5785 I Gecko   : 1782767020087	Marionette	DEBUG	0 <- [1,54,{"error":"no such window","message":"Browsing context has been discarded","stacktrace":"RemoteError@chrome://remote/content/shared/RemoteError.sys.mjs:8:8\nWebDriverError@chrome://remote/content/shared/webdriver/Er ... ote/content/marionette/server.sys.mjs:263:9\n_onJSONObjectReady/<@chrome://remote/content/marionette/transport.sys.mjs:494:20\n"},null]

Here a new try build:
https://treeherder.mozilla.org/jobs?repo=try&landoInstance=lando-prod-2025&landoCommitID=62858

The problem is indeed a page load between switching to the window and calling the get current URL command. Because we are not waiting for the currentWindowGlobal (similar to BiDi) we are failing. I filed bug 2051944 to hardening the Marionette code for such situations.

For this particular failure I would just update the test to ignore the NoSuchWindow failure and continue.

See Also: → 2051944
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Points: --- → 2
Whiteboard: [webdriver:m21]
Pushed by hskupin@mozilla.com: https://github.com/mozilla-firefox/firefox/commit/7632840404c4 https://hg.mozilla.org/integration/autoland/rev/35bb5a14c023 [wdspec] Fix mozilla/tests/webdriver/classic/navigate_to/privileged_pages.py for a delayed extension page loading. r=jdescottes
Status: ASSIGNED → RESOLVED
Closed: 12 days ago
Resolution: --- → FIXED
Target Milestone: --- → 154 Branch
Blocks: 1729409
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: