From a776b0d23e1b57f52eff78ea892417807928f2aa Mon Sep 17 00:00:00 2001 From: Maksim Sadym Date: Fri, 22 Nov 2024 12:04:48 +0100 Subject: [PATCH 1/7] feat: do not emit initial navigation events Addressing https://github.com/GoogleChromeLabs/chromium-bidi/issues/2793 --- .../modules/context/BrowsingContextImpl.ts | 137 ++++--- src/utils/UrlHelpers.spec.ts | 89 +++++ src/utils/UrlHelpers.ts | 51 +++ tests/browsing_context/test_create.py | 340 +++++++++--------- .../test_dom_content_loaded.py | 64 +++- tests/browsing_context/test_load.py | 52 ++- tests/script/test_add_preload_script.py | 83 ++--- tests/test_helpers.py | 10 +- 8 files changed, 547 insertions(+), 279 deletions(-) create mode 100644 src/utils/UrlHelpers.spec.ts create mode 100644 src/utils/UrlHelpers.ts diff --git a/src/bidiMapper/modules/context/BrowsingContextImpl.ts b/src/bidiMapper/modules/context/BrowsingContextImpl.ts index 74c3d1ff4a..06ec9c984c 100644 --- a/src/bidiMapper/modules/context/BrowsingContextImpl.ts +++ b/src/bidiMapper/modules/context/BrowsingContextImpl.ts @@ -34,6 +34,7 @@ import {assert} from '../../../utils/assert.js'; import {Deferred} from '../../../utils/Deferred.js'; import {type LoggerFn, LogType} from '../../../utils/log.js'; import {inchesFromCm} from '../../../utils/unitConversions.js'; +import {urlMatchesAboutBlank} from '../../../utils/UrlHelpers.js'; import {uuidv4} from '../../../utils/uuid.js'; import type {CdpTarget} from '../cdp/CdpTarget.js'; import type {Realm} from '../script/Realm.js'; @@ -98,6 +99,11 @@ export class BrowsingContextImpl { // Set if there is a pending navigation initiated by `BrowsingContext.navigate` command. // The promise is resolved when the navigation is finished or rejected when canceled. #pendingCommandNavigation: Deferred | undefined; + // Flags if the initial navigation to `about:blank` is in progress. + #initialNavigation = true; + // Flags if the navigation is initiated by `browsingContext.navigate` or + // `browsingContext.reload` command. + #navigationInitiatedByCommand = false; #originalOpener?: string; @@ -409,6 +415,24 @@ export class BrowsingContextImpl { this.#url = params.targetInfo.url; } + #emitNavigationStarted(url: string) { + this.#navigationId = this.#pendingNavigationId ?? uuidv4(); + this.#pendingNavigationId = undefined; + this.#eventManager.registerEvent( + { + type: 'event', + method: ChromiumBidi.BrowsingContext.EventNames.NavigationStarted, + params: { + context: this.id, + navigation: this.#navigationId, + timestamp: BrowsingContextImpl.getTimestamp(), + url, + }, + }, + this.id, + ); + } + #initListeners() { this.#cdpTarget.cdpClient.on('Page.frameNavigated', (params) => { if (this.id !== params.frame.id) { @@ -468,27 +492,24 @@ export class BrowsingContextImpl { if (this.id !== params.frameId) { return; } - // Use `pendingNavigationId` if navigation initiated by BiDi - // `BrowsingContext.navigate` or generate a new navigation id. - this.#navigationId = this.#pendingNavigationId ?? uuidv4(); - this.#pendingNavigationId = undefined; - this.#eventManager.registerEvent( - { - type: 'event', - method: ChromiumBidi.BrowsingContext.EventNames.NavigationStarted, - params: { - context: this.id, - navigation: this.#navigationId, - timestamp: BrowsingContextImpl.getTimestamp(), - // The URL of the navigation that is currently in progress. Although the URL - // is not yet known in case of user-initiated navigations, it is possible to - // provide the URL in case of BiDi-initiated navigations. - // TODO: provide proper URL in case of user-initiated navigations. - url: this.#pendingNavigationUrl ?? 'UNKNOWN', - }, - }, - this.id, - ); + + if (!this.#navigationInitiatedByCommand) { + // In case of the navigation is not initiated by `browsingContext.navigate` or + // `browsingContext.reload` commands, the `Page.frameRequestedNavigation` is + // emitted, which means the `NavigationStarted` is already emitted as well. + return; + } + + // The `Page.frameRequestedNavigation` is not emitted, as the navigation was + // initiated by `browsingContext.navigate` command. This means the + // `NavigationStarted` event should be emitted now. + + // The URL of the navigation that is currently in progress. Although the URL + // is not yet known in case of user-initiated navigations, it is possible to + // provide the URL in case of BiDi-initiated navigations. + // TODO: provide proper URL in case of user-initiated navigations. + const url = this.#pendingNavigationUrl ?? 'UNKNOWN'; + this.#emitNavigationStarted(url); }); // TODO: don't use deprecated `Page.frameScheduledNavigation` event. @@ -523,7 +544,20 @@ export class BrowsingContextImpl { new UnknownErrorException('navigation aborted'), ); this.#pendingCommandNavigation = undefined; + this.#navigationInitiatedByCommand = false; + } + if (urlMatchesAboutBlank(params.url)) { + // If the url does not match about:blank, do not consider it is an initial + // navigation and emit all the required events. + // https://github.com/GoogleChromeLabs/chromium-bidi/issues/2793. + this.#initialNavigation = false; + } + + if (!this.#initialNavigation) { + // Do not emit the event for the initial navigation to `about:blank`. + this.#emitNavigationStarted(params.url); } + this.#pendingNavigationUrl = params.url; }); @@ -558,36 +592,45 @@ export class BrowsingContextImpl { switch (params.name) { case 'DOMContentLoaded': - this.#eventManager.registerEvent( - { - type: 'event', - method: ChromiumBidi.BrowsingContext.EventNames.DomContentLoaded, - params: { - context: this.id, - navigation: this.#navigationId, - timestamp, - url: this.#url, + if (!this.#initialNavigation) { + // Do not emit for the initial navigation. + this.#eventManager.registerEvent( + { + type: 'event', + method: + ChromiumBidi.BrowsingContext.EventNames.DomContentLoaded, + params: { + context: this.id, + navigation: this.#navigationId, + timestamp, + url: this.#url, + }, }, - }, - this.id, - ); + this.id, + ); + } this.#lifecycle.DOMContentLoaded.resolve(); break; case 'load': - this.#eventManager.registerEvent( - { - type: 'event', - method: ChromiumBidi.BrowsingContext.EventNames.Load, - params: { - context: this.id, - navigation: this.#navigationId, - timestamp, - url: this.#url, + if (!this.#initialNavigation) { + // Do not emit for the initial navigation. + this.#eventManager.registerEvent( + { + type: 'event', + method: ChromiumBidi.BrowsingContext.EventNames.Load, + params: { + context: this.id, + navigation: this.#navigationId, + timestamp, + url: this.#url, + }, }, - }, - this.id, - ); + this.id, + ); + } + // The initial navigation is finished. + this.#initialNavigation = false; this.#lifecycle.load.resolve(); break; } @@ -884,6 +927,7 @@ export class BrowsingContextImpl { const navigationId = uuidv4(); this.#pendingNavigationId = navigationId; this.#pendingCommandNavigation = new Deferred(); + this.#navigationInitiatedByCommand = true; // Navigate and wait for the result. If the navigation fails, the error event is // emitted and the promise is rejected. @@ -949,6 +993,7 @@ export class BrowsingContextImpl { // `#pendingCommandNavigation` can be already rejected and set to undefined. this.#pendingCommandNavigation?.resolve(); + this.#navigationInitiatedByCommand = false; this.#pendingCommandNavigation = undefined; return { navigation: navigationId, @@ -986,6 +1031,8 @@ export class BrowsingContextImpl { this.#resetLifecycleIfFinished(); + this.#navigationInitiatedByCommand = true; + await this.#cdpTarget.cdpClient.sendCommand('Page.reload', { ignoreCache, }); diff --git a/src/utils/UrlHelpers.spec.ts b/src/utils/UrlHelpers.spec.ts new file mode 100644 index 0000000000..d57d6ad7c6 --- /dev/null +++ b/src/utils/UrlHelpers.spec.ts @@ -0,0 +1,89 @@ +/** + * Copyright 2024 Google LLC. + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {expect} from 'chai'; + +import {urlMatchesAboutBlank} from './UrlHelpers.js'; + +describe('BrowsingContextStorage', () => { + describe('urlMatchesAboutBlank', () => { + describe('should return true for matching urls', () => { + it('"about:blank"', () => { + expect(urlMatchesAboutBlank('about:blank')).to.be.true; + }); + + it('"about:blank?foo=bar"', () => { + expect(urlMatchesAboutBlank('about:blank?foo=bar')).to.be.true; + }); + + it('"about:blank#foo"', () => { + expect(urlMatchesAboutBlank('about:blank#foo')).to.be.true; + }); + + it('"about:Blank"', () => { + expect(urlMatchesAboutBlank('about:Blank')).to.be.true; + }); + + it('empty string', () => { + expect(urlMatchesAboutBlank('')).to.be.true; + }); + }); + + describe('should return false for not matching urls', () => { + it('"http://example.com"', () => { + expect(urlMatchesAboutBlank('http://example.com')).to.be.false; + }); + + it('"about:blanka"', () => { + expect(urlMatchesAboutBlank('about:blanka')).to.be.false; + }); + + it('"about:blank/foo"', () => { + expect(urlMatchesAboutBlank('about:blank/foo')).to.be.false; + }); + + it('"about://blank"', () => { + expect(urlMatchesAboutBlank('about://blank')).to.be.false; + }); + + it('"about: blank"', () => { + expect(urlMatchesAboutBlank('about: blank')).to.be.false; + }); + + it('username and password', () => { + expect(urlMatchesAboutBlank('about:username:password@blank')).to.be + .false; + }); + + it('null', () => { + expect(urlMatchesAboutBlank(null as any)).to.be.false; + }); + + it('undefined', () => { + expect(urlMatchesAboutBlank(undefined as any)).to.be.false; + }); + + it('"blob:http://example.com"', () => { + expect(urlMatchesAboutBlank('blob:http://example.com')).to.be.false; + }); + + it('"about:srcdoc"', () => { + expect(urlMatchesAboutBlank('about:srcdoc')).to.be.false; + }); + }); + }); +}); diff --git a/src/utils/UrlHelpers.ts b/src/utils/UrlHelpers.ts new file mode 100644 index 0000000000..98c2aec8d1 --- /dev/null +++ b/src/utils/UrlHelpers.ts @@ -0,0 +1,51 @@ +/* + * Copyright 2024 Google LLC. + * Copyright (c) Microsoft Corporation. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + */ + +/** + * A URL matches about:blank if its scheme is "about", its path contains a single string + * "blank", its username and password are the empty string, and its host is null. + * https://html.spec.whatwg.org/multipage/urls-and-fetching.html#matches-about:blank + * @param {string} url + * @return {boolean} + */ +export function urlMatchesAboutBlank(url: string): boolean { + // An empty string is a special case, and considered to be about:blank. + // https://html.spec.whatwg.org/multipage/nav-history-apis.html#window-open-steps + if (url === '') { + return true; + } + + try { + const parsedUrl = new URL(url); + const schema = parsedUrl.protocol.replace(/:$/, ''); + return ( + schema.toLowerCase() === 'about' && + parsedUrl.pathname.toLowerCase() === 'blank' && + parsedUrl.username === '' && + parsedUrl.password === '' && + parsedUrl.host === '' + ); + } catch (err) { + // Wrong URL considered do not match about:blank. + if (err instanceof TypeError) { + return false; + } + // Re-throw other unexpected errors. + throw err; + } +} diff --git a/tests/browsing_context/test_create.py b/tests/browsing_context/test_create.py index 4e3fa1b9b0..88925a485a 100644 --- a/tests/browsing_context/test_create.py +++ b/tests/browsing_context/test_create.py @@ -13,57 +13,37 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest -from anys import ANY_DICT, ANY_STR +from anys import ANY_STR from test_helpers import (ANY_TIMESTAMP, AnyExtending, execute_command, get_tree, goto_url, read_JSON_message, send_JSON_command, subscribe) @pytest.mark.asyncio -async def test_browsingContext_create_eventContextCreatedEmitted( - websocket, read_sorted_messages): - await subscribe(websocket, [ - "browsingContext.contextCreated", "browsingContext.domContentLoaded", - "browsingContext.load" - ]) - - await send_JSON_command(websocket, { - "id": 9, +async def test_browsingContext_create_eventsEmitted(websocket, + read_sorted_messages, + assert_no_more_messages): + await subscribe(websocket, "browsingContext") + + command_id = await send_JSON_command(websocket, { "method": "browsingContext.create", "params": { "type": "tab" } }) - # Read event messages. The order can vary in headless and headful modes, so - # sort is needed: - # * `browsingContext.contextCreated` event. - # * `browsingContext.domContentLoaded` event. - # * `browsingContext.load` event. - [context_created_event, dom_content_loaded_event, - load_event] = await read_sorted_messages(3) - - # Read the `browsingContext.create` command result. It should be sent after - # all the loading events. - command_result = await read_JSON_message(websocket) - - new_context_id = command_result['result']['context'] - - # Assert command done. - assert command_result == { + [command_result, context_created_event] = await read_sorted_messages(2) + assert [command_result, context_created_event] == [{ "type": "success", - "id": 9, + "id": command_id, "result": { - 'context': new_context_id + 'context': ANY_STR } - } - - # Assert "browsingContext.contextCreated" event emitted. - assert { + }, { "type": "event", "method": "browsingContext.contextCreated", "params": { - "context": new_context_id, + "context": ANY_STR, "url": "about:blank", "children": None, "parent": None, @@ -71,91 +51,126 @@ async def test_browsingContext_create_eventContextCreatedEmitted( "originalOpener": None, 'clientWindow': ANY_STR, } - } == context_created_event - - # Assert "browsingContext.domContentLoaded" event emitted. - assert { - "type": "event", - "method": "browsingContext.domContentLoaded", - "params": { - "context": new_context_id, - "navigation": ANY_STR, - "timestamp": ANY_TIMESTAMP, - "url": "about:blank" - } - } == dom_content_loaded_event + }] + assert command_result['result']['context'] == context_created_event[ + 'params']['context'] - # Assert "browsingContext.load" event emitted. - assert { - "type": "event", - "method": "browsingContext.load", - "params": { - "context": new_context_id, - "navigation": ANY_STR, - "timestamp": ANY_TIMESTAMP, - "url": "about:blank" - } - } == load_event + await assert_no_more_messages() @pytest.mark.asyncio -async def test_browsingContext_create_noNavigationEventsEmitted( - websocket, context_id, read_sorted_messages): - pytest.xfail( - "https://github.com/GoogleChromeLabs/chromium-bidi/issues/2793") +async def test_browsingContext_windowOpen_blank_eventsEmitted( + websocket, context_id, read_sorted_messages, assert_no_more_messages): + await subscribe(websocket, "browsingContext") - await subscribe(websocket, [ - "browsingContext.contextCreated", "browsingContext.domContentLoaded", - "browsingContext.load", "browsingContext.navigationStarted" - ]) + command_id = await send_JSON_command( + websocket, { + "method": "script.evaluate", + "params": { + "expression": "window.open('about:blank')", + "target": { + "context": context_id + }, + "resultOwnership": "root", + "awaitPromise": False, + } + }) - command_id = await send_JSON_command(websocket, { - "method": "browsingContext.create", - "params": { - "type": "tab" + [command_result, context_created_event] = await read_sorted_messages(2) + assert [command_result, context_created_event] == [ + AnyExtending({ + "type": "success", + "id": command_id, + }), { + "type": "event", + "method": "browsingContext.contextCreated", + "params": { + "context": ANY_STR, + "url": "about:blank", + "children": None, + "parent": None, + "userContext": "default", + "originalOpener": ANY_STR, + 'clientWindow': ANY_STR, + } } - }) + ] - [command_result, context_created_event] = await read_sorted_messages(2) + await assert_no_more_messages() - assert command_result == AnyExtending({ - 'id': command_id, - 'type': 'success', - }) - assert context_created_event == { - 'method': 'browsingContext.contextCreated', - 'params': { - 'children': None, - 'clientWindow': '', - 'context': ANY_STR, - 'originalOpener': context_id, - 'parent': None, - 'url': 'about:blank', - 'userContext': 'default', - }, - 'type': 'event', - } - new_context_id = context_created_event["params"]["context"] +@pytest.mark.asyncio +async def test_browsingContext_windowOpen_nonBlank_eventsEmitted( + websocket, context_id, read_sorted_messages, assert_no_more_messages, + url_example): + await subscribe(websocket, "browsingContext") - # Assert no other events. command_id = await send_JSON_command( websocket, { "method": "script.evaluate", "params": { - "expression": "1", + "expression": f"window.open('{url_example}')", "target": { - "context": new_context_id, + "context": context_id }, - "awaitPromise": False + "resultOwnership": "root", + "awaitPromise": False, } }) - response = await read_JSON_message(websocket) - assert response == AnyExtending({ - 'id': command_id, - 'type': 'success', - }) + events = await read_sorted_messages(5) + + events == [ + AnyExtending({ + "type": "success", + "id": command_id, + }), + { + "type": "event", + "method": "browsingContext.contextCreated", + "params": { + "context": ANY_STR, + "url": "about:blank", + "children": None, + "parent": None, + "userContext": "default", + "originalOpener": ANY_STR, + 'clientWindow': ANY_STR, + } + }, + { + 'method': 'browsingContext.domContentLoaded', + 'params': { + 'context': ANY_STR, + 'navigation': ANY_STR, + 'timestamp': ANY_TIMESTAMP, + 'url': url_example, + }, + 'type': 'event', + }, + { + 'method': 'browsingContext.load', + 'params': { + 'context': ANY_STR, + 'navigation': ANY_STR, + 'timestamp': ANY_TIMESTAMP, + 'url': url_example, + }, + 'type': 'event', + }, + { + 'method': 'browsingContext.navigationStarted', + 'params': { + 'context': ANY_STR, + 'navigation': ANY_STR, + 'timestamp': ANY_TIMESTAMP, + 'url': url_example, + }, + 'type': 'event', + }, + ] + + await assert_no_more_messages() @pytest.mark.asyncio @@ -249,17 +264,14 @@ async def test_browsingContext_createWithNestedSameOriginContexts_eventContextCr @pytest.mark.asyncio async def test_browsingContext_create_withUserGesture_eventsEmitted( - websocket, context_id, html, url_example, read_sorted_messages): + websocket, context_id, html, url_example, read_sorted_messages, + assert_no_more_messages): LINK_WITH_BLANK_TARGET = html( f'''new tab''') await goto_url(websocket, context_id, LINK_WITH_BLANK_TARGET) - await subscribe(websocket, [ - 'browsingContext.contextCreated', - 'browsingContext.domContentLoaded', - 'browsingContext.load', - ]) + await subscribe(websocket, 'browsingContext') command_id = await send_JSON_command( websocket, { @@ -274,96 +286,74 @@ async def test_browsingContext_create_withUserGesture_eventsEmitted( } }) - # Read event messages. The order can vary, so read all and sort them. Ignore - # optional "browsingContext.domContentLoaded" event for "about:blank" pages. - # Expected sorted messages order: - # 1. Command result. - # 2. "browsingContext.contextCreated" event. - # (optional). "browsingContext.domContentLoaded" event for "about:blank". - # Omitted in headful mode. - # 3. "browsingContext.domContentLoaded" event for the example_url. - # 4. "browsingContext.load" event. - messages = await read_sorted_messages( - 4, lambda m: 'method' not in m or - (m['method'] != 'browsingContext.domContentLoaded') or m['params'][ - 'url'] != 'about:blank') - - # Get the new context id from the "browsingContext.contextCreated" event. - new_context_id = messages[1]['params']['context'] - - assert messages == [{ - 'id': command_id, - 'type': 'success', - 'result': ANY_DICT - }, { - 'type': 'event', - 'method': 'browsingContext.contextCreated', - 'params': { - 'context': ANY_STR, - 'url': 'about:blank', - 'clientWindow': ANY_STR, - 'children': None, - 'parent': None, - 'userContext': 'default', - 'originalOpener': ANY_STR, - } - }, { - 'type': 'event', - 'method': 'browsingContext.domContentLoaded', - 'params': { - 'context': new_context_id, - 'navigation': ANY_STR, - 'timestamp': ANY_TIMESTAMP, - 'url': url_example - } - }, { - 'type': 'event', - 'method': 'browsingContext.load', - 'params': { - 'context': new_context_id, - 'navigation': ANY_STR, - 'timestamp': ANY_TIMESTAMP, - 'url': url_example + messages = await read_sorted_messages(2) + + assert messages == [ + AnyExtending({ + 'id': command_id, + 'type': 'success', + }), { + 'type': 'event', + 'method': 'browsingContext.contextCreated', + 'params': { + 'context': ANY_STR, + 'url': 'about:blank', + 'clientWindow': ANY_STR, + 'children': None, + 'parent': None, + 'userContext': 'default', + 'originalOpener': ANY_STR, + } } - }] + ] + + await assert_no_more_messages() @pytest.mark.asyncio @pytest.mark.parametrize("type", ["window", "tab"]) -async def test_browsingContext_create_withUserContext(websocket, type): - user_context = await execute_command(websocket, { +async def test_browsingContext_create_withUserContext(websocket, type, + assert_no_more_messages, + read_sorted_messages): + result = await execute_command(websocket, { "method": "browser.createUserContext", "params": {} }) + user_context = result["userContext"] - await subscribe(websocket, [ - "browsingContext.contextCreated", "browsingContext.domContentLoaded", - "browsingContext.load" - ]) + await subscribe(websocket, "browsingContext") - result = await execute_command( + command_id = await send_JSON_command( websocket, { "method": "browsingContext.create", "params": { "type": type, - "userContext": user_context["userContext"] + "userContext": user_context } }) - tree = await execute_command(websocket, { - "method": "browsingContext.getTree", - "params": {} - }) + messages = await read_sorted_messages(2) - assert len(tree['contexts']) == 2 + assert messages == [ + AnyExtending({ + 'id': command_id, + 'type': 'success', + }), { + "type": "event", + "method": "browsingContext.contextCreated", + "params": { + "context": ANY_STR, + "url": "about:blank", + "children": None, + "parent": None, + "userContext": user_context, + "originalOpener": None, + 'clientWindow': ANY_STR, + } + } + ] - assert tree["contexts"][1] == AnyExtending({ - 'context': result['context'], - 'url': 'about:blank', - 'userContext': user_context["userContext"], - 'children': [], - 'parent': None - }) + await assert_no_more_messages() @pytest.mark.asyncio diff --git a/tests/browsing_context/test_dom_content_loaded.py b/tests/browsing_context/test_dom_content_loaded.py index 9b78fa85a3..f8dc15960c 100644 --- a/tests/browsing_context/test_dom_content_loaded.py +++ b/tests/browsing_context/test_dom_content_loaded.py @@ -13,19 +13,71 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest -from test_helpers import send_JSON_command, subscribe, wait_for_event +from anys import ANY_STR +from test_helpers import (ANY_TIMESTAMP, ANY_UUID, read_JSON_message, + send_JSON_command, subscribe) @pytest.mark.asyncio -async def test_browsingContext_subscribeToAllBrowsingContextEvents_eventReceived( - websocket): - await subscribe(websocket, ["browsingContext"]) +async def test_browsingContext_domContentLoaded_create_notReceived( + websocket, assert_no_more_messages): + await subscribe(websocket, ["browsingContext.domContentLoaded"]) - await send_JSON_command(websocket, { + command_id = await send_JSON_command(websocket, { "method": "browsingContext.create", "params": { "type": "tab" } }) - await wait_for_event(websocket, "browsingContext.domContentLoaded") + response = await read_JSON_message(websocket) + assert response == { + 'id': command_id, + 'result': { + 'context': ANY_STR, + }, + 'type': 'success', + } + + await assert_no_more_messages() + + +@pytest.mark.asyncio +async def test_browsingContext_domContentLoaded_navigate_received( + websocket, context_id, url_example, assert_no_more_messages, + read_sorted_messages): + await subscribe(websocket, ["browsingContext.domContentLoaded"]) + + command_id = await send_JSON_command( + websocket, { + "method": "browsingContext.navigate", + "params": { + "url": url_example, + "wait": "complete", + "context": context_id + } + }) + + messages = await read_sorted_messages(2) + assert messages == [ + { + 'id': command_id, + 'result': { + 'navigation': ANY_UUID, + 'url': url_example, + }, + 'type': 'success', + }, + { + 'method': 'browsingContext.domContentLoaded', + 'params': { + 'context': context_id, + 'navigation': ANY_UUID, + 'timestamp': ANY_TIMESTAMP, + 'url': url_example, + }, + 'type': 'event', + }, + ] + + await assert_no_more_messages() diff --git a/tests/browsing_context/test_load.py b/tests/browsing_context/test_load.py index fe5b6c222c..9a84a7fc03 100644 --- a/tests/browsing_context/test_load.py +++ b/tests/browsing_context/test_load.py @@ -13,11 +13,13 @@ # See the License for the specific language governing permissions and # limitations under the License. import pytest -from test_helpers import ANY_TIMESTAMP, read_JSON_message, send_JSON_command +from test_helpers import (ANY_TIMESTAMP, ANY_UUID, read_JSON_message, + send_JSON_command, subscribe) @pytest.mark.asyncio -async def test_browsingContext_noInitialLoadEvents(websocket, html): +async def test_browsingContext_noInitialLoadEvents(websocket, html, + assert_no_more_messages): # Due to the nature, the test does not always fail, even if the # implementation does not guarantee the initial context to be fully loaded. # The test asserts there was no initial "browsingContext.load" emitted @@ -79,3 +81,49 @@ async def test_browsingContext_noInitialLoadEvents(websocket, html): 'url': url } } == resp + assert_no_more_messages() + + +@pytest.mark.asyncio +async def test_browsingContext_load_properNavigation(websocket, context_id, + url_example, + read_sorted_messages, + assert_no_more_messages): + await subscribe(websocket, "browsingContext.load") + + command_id = await send_JSON_command( + websocket, { + "method": "browsingContext.navigate", + "params": { + "url": url_example, + "wait": "none", + "context": context_id + } + }) + + [command_result, load_event] = await read_sorted_messages(2) + assert [command_result, load_event] == [ + { + 'id': command_id, + 'result': { + 'navigation': ANY_UUID, + 'url': url_example, + }, + 'type': 'success', + }, + { + 'method': 'browsingContext.load', + 'params': { + 'context': context_id, + 'navigation': ANY_UUID, + 'timestamp': ANY_TIMESTAMP, + 'url': url_example, + }, + 'type': 'event', + }, + ] + + assert command_result['result']['navigation'] == load_event['params'][ + 'navigation'] + + await assert_no_more_messages() diff --git a/tests/script/test_add_preload_script.py b/tests/script/test_add_preload_script.py index 4679e9bae1..69713be537 100644 --- a/tests/script/test_add_preload_script.py +++ b/tests/script/test_add_preload_script.py @@ -411,32 +411,28 @@ async def test_preloadScript_add_loadedInMultipleContexts( @pytest.mark.asyncio async def test_preloadScript_add_loadedInMultipleContexts_withIframes( websocket, context_id, url_all_origins, html, read_sorted_messages): - await execute_command( - websocket, { - "method": "script.addPreloadScript", - "params": { - "functionDeclaration": "() => { window.foo='bar'; }", - } - }) + await subscribe(websocket, ["script.message"]) await goto_url(websocket, context_id, html()) - result = await execute_command( + await execute_command( websocket, { - "method": "script.evaluate", + "method": "script.addPreloadScript", "params": { - "expression": "window.foo", - "target": { - "context": context_id - }, - "awaitPromise": True, - "resultOwnership": "root" + "functionDeclaration": """ + (channel) => { + setTimeout(() => { + channel('preload script executed') + }, 1); + }""", + "arguments": [{ + "type": "channel", + "value": { + "channel": "some_channel_name" + }, + }, ], } }) - assert result["result"] == {"type": "string", "value": 'bar'} - - # Needed to make sure the iFrame loaded. - await subscribe(websocket, ["browsingContext.load"]) # Create a new iframe within the same context. command_id = await send_JSON_command( @@ -456,37 +452,26 @@ async def test_preloadScript_add_loadedInMultipleContexts_withIframes( # Depending on the URL, the iframe can be loaded before or after the script # is done. - [command_result, browsing_context_load] = await read_sorted_messages(2) - assert command_result == { - "type": "success", - "id": command_id, - "result": ANY_DICT - } - assert browsing_context_load == { - 'type': 'event', - "method": "browsingContext.load", - "params": AnyExtending({ - "context": ANY_STR, - "url": url_all_origins - }) - } - - iframe_context_id = browsing_context_load["params"]["context"] - assert iframe_context_id != context_id - - result = await execute_command( - websocket, { - "method": "script.evaluate", - "params": { - "expression": "window.foo", - "target": { - "context": iframe_context_id + [command_result, script_message_event] = await read_sorted_messages(2) + + assert [command_result, script_message_event] == [ + AnyExtending({ + 'id': command_id, + 'type': 'success', + }), + AnyExtending({ + 'method': 'script.message', + 'params': { + 'channel': 'some_channel_name', + 'data': { + 'value': 'preload script executed', }, - "awaitPromise": True, - "resultOwnership": "root" - } - }) - assert result["result"] == {"type": "string", "value": 'bar'} + }, + 'type': 'event', + }), + ] + + assert context_id != script_message_event['params']['source']['context'] @pytest.mark.asyncio diff --git a/tests/test_helpers.py b/tests/test_helpers.py index 00a6d66230..d2bfbb4100 100644 --- a/tests/test_helpers.py +++ b/tests/test_helpers.py @@ -43,9 +43,15 @@ def get_next_command_id() -> int: async def subscribe(websocket, - events: list[str], - context_ids: list[str] | None = None, + events: list[str] | str, + context_ids: list[str] | str | None = None, channel: str | None = None): + if type(events) is str: + events = [events] + + if type(context_ids) is str: + context_ids = [context_ids] + command: dict = { "method": "session.subscribe", "params": { From 46181e4b750c84117486404b778f8b3d49830973 Mon Sep 17 00:00:00 2001 From: browser-automation-bot <133232582+browser-automation-bot@users.noreply.github.com> Date: Fri, 22 Nov 2024 12:16:24 +0100 Subject: [PATCH 2/7] test: update the expectations for PR (#2804) Automatically generated by https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/.github/workflows/wpt.yml --- .../dom_content_loaded/dom_content_loaded.py.ini | 7 +++++-- .../bidi/browsing_context/get_tree/frames.py.ini | 12 ++++++++++++ .../tests/bidi/browsing_context/load/load.py.ini | 7 +++++-- .../bidi/network/combined/network_events.py.ini | 3 +++ .../tests/bidi/session/subscribe/events.py.ini | 9 +++++++++ .../tests/bidi/session/unsubscribe/events.py.ini | 3 +++ .../dom_content_loaded/dom_content_loaded.py.ini | 7 +++++-- .../bidi/browsing_context/get_tree/frames.py.ini | 12 ++++++++++++ .../tests/bidi/browsing_context/load/load.py.ini | 7 +++++-- .../bidi/network/combined/network_events.py.ini | 3 +++ .../tests/bidi/session/subscribe/events.py.ini | 9 +++++++++ .../tests/bidi/session/unsubscribe/events.py.ini | 3 +++ .../dom_content_loaded/dom_content_loaded.py.ini | 7 +++++-- .../bidi/browsing_context/get_tree/frames.py.ini | 12 ++++++++++++ .../tests/bidi/browsing_context/load/load.py.ini | 7 +++++-- .../navigation_started/navigation_started.py.ini | 9 +++++++++ .../bidi/network/combined/network_events.py.ini | 3 +++ .../tests/bidi/session/subscribe/events.py.ini | 6 ++++++ .../tests/bidi/session/unsubscribe/events.py.ini | 3 +++ 19 files changed, 117 insertions(+), 12 deletions(-) create mode 100644 wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini create mode 100644 wpt-metadata/chromedriver/headful/webdriver/tests/bidi/network/combined/network_events.py.ini create mode 100644 wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/subscribe/events.py.ini create mode 100644 wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/unsubscribe/events.py.ini create mode 100644 wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini create mode 100644 wpt-metadata/chromedriver/headless/webdriver/tests/bidi/network/combined/network_events.py.ini create mode 100644 wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/subscribe/events.py.ini create mode 100644 wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini create mode 100644 wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini create mode 100644 wpt-metadata/mapper/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini index 81f0f5051f..3a8b031820 100644 --- a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini +++ b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini @@ -1,6 +1,9 @@ [dom_content_loaded.py] - [test_new_context_not_emitted[tab\]] + [test_iframe] expected: FAIL - [test_new_context_not_emitted[window\]] + [test_new_context[tab\]] + expected: FAIL + + [test_new_context[window\]] expected: FAIL diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini new file mode 100644 index 0000000000..cba9341853 --- /dev/null +++ b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini @@ -0,0 +1,12 @@ +[frames.py] + [test_user_context[same_origin-default\]] + expected: FAIL + + [test_user_context[same_origin-new\]] + expected: FAIL + + [test_user_context[cross_origin-default\]] + expected: FAIL + + [test_user_context[cross_origin-new\]] + expected: FAIL diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/load/load.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/load/load.py.ini index 6059084803..1fbf0d8d8e 100644 --- a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/load/load.py.ini +++ b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/load/load.py.ini @@ -1,6 +1,9 @@ [load.py] - [test_new_context_not_emitted[tab\]] + [test_iframe] expected: FAIL - [test_new_context_not_emitted[window\]] + [test_new_context[tab\]] + expected: FAIL + + [test_new_context[window\]] expected: FAIL diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/network/combined/network_events.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/network/combined/network_events.py.ini new file mode 100644 index 0000000000..9fc9550222 --- /dev/null +++ b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/network/combined/network_events.py.ini @@ -0,0 +1,3 @@ +[network_events.py] + [test_iframe_navigation_request] + expected: FAIL diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/subscribe/events.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/subscribe/events.py.ini new file mode 100644 index 0000000000..7dae6561ad --- /dev/null +++ b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/subscribe/events.py.ini @@ -0,0 +1,9 @@ +[events.py] + [test_subscribe_to_module] + expected: FAIL + + [test_subscribe_to_one_event_and_then_to_module] + expected: FAIL + + [test_subscribe_to_module_and_then_to_one_event_again] + expected: FAIL diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/unsubscribe/events.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/unsubscribe/events.py.ini new file mode 100644 index 0000000000..5269451a08 --- /dev/null +++ b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/unsubscribe/events.py.ini @@ -0,0 +1,3 @@ +[events.py] + [test_subscribe_to_module_unsubscribe_from_one_event] + expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini index 81f0f5051f..3a8b031820 100644 --- a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini +++ b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini @@ -1,6 +1,9 @@ [dom_content_loaded.py] - [test_new_context_not_emitted[tab\]] + [test_iframe] expected: FAIL - [test_new_context_not_emitted[window\]] + [test_new_context[tab\]] + expected: FAIL + + [test_new_context[window\]] expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini new file mode 100644 index 0000000000..cba9341853 --- /dev/null +++ b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini @@ -0,0 +1,12 @@ +[frames.py] + [test_user_context[same_origin-default\]] + expected: FAIL + + [test_user_context[same_origin-new\]] + expected: FAIL + + [test_user_context[cross_origin-default\]] + expected: FAIL + + [test_user_context[cross_origin-new\]] + expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini index 6059084803..1fbf0d8d8e 100644 --- a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini +++ b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini @@ -1,6 +1,9 @@ [load.py] - [test_new_context_not_emitted[tab\]] + [test_iframe] expected: FAIL - [test_new_context_not_emitted[window\]] + [test_new_context[tab\]] + expected: FAIL + + [test_new_context[window\]] expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/network/combined/network_events.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/network/combined/network_events.py.ini new file mode 100644 index 0000000000..9fc9550222 --- /dev/null +++ b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/network/combined/network_events.py.ini @@ -0,0 +1,3 @@ +[network_events.py] + [test_iframe_navigation_request] + expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/subscribe/events.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/subscribe/events.py.ini new file mode 100644 index 0000000000..7dae6561ad --- /dev/null +++ b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/subscribe/events.py.ini @@ -0,0 +1,9 @@ +[events.py] + [test_subscribe_to_module] + expected: FAIL + + [test_subscribe_to_one_event_and_then_to_module] + expected: FAIL + + [test_subscribe_to_module_and_then_to_one_event_again] + expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini new file mode 100644 index 0000000000..5269451a08 --- /dev/null +++ b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini @@ -0,0 +1,3 @@ +[events.py] + [test_subscribe_to_module_unsubscribe_from_one_event] + expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini index 81f0f5051f..3a8b031820 100644 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini +++ b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini @@ -1,6 +1,9 @@ [dom_content_loaded.py] - [test_new_context_not_emitted[tab\]] + [test_iframe] expected: FAIL - [test_new_context_not_emitted[window\]] + [test_new_context[tab\]] + expected: FAIL + + [test_new_context[window\]] expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini new file mode 100644 index 0000000000..cba9341853 --- /dev/null +++ b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini @@ -0,0 +1,12 @@ +[frames.py] + [test_user_context[same_origin-default\]] + expected: FAIL + + [test_user_context[same_origin-new\]] + expected: FAIL + + [test_user_context[cross_origin-default\]] + expected: FAIL + + [test_user_context[cross_origin-new\]] + expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini index 6059084803..1fbf0d8d8e 100644 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini +++ b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini @@ -1,6 +1,9 @@ [load.py] - [test_new_context_not_emitted[tab\]] + [test_iframe] expected: FAIL - [test_new_context_not_emitted[window\]] + [test_new_context[tab\]] + expected: FAIL + + [test_new_context[window\]] expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini index 9f63915bca..d4819d35b6 100644 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini +++ b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini @@ -7,3 +7,12 @@ [test_window_open_with_about_blank[about:blank?test\]] expected: FAIL + + [test_iframe] + expected: FAIL + + [test_nested_iframes] + expected: FAIL + + [test_window_open_with_url] + expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/network/combined/network_events.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/network/combined/network_events.py.ini index adc3f048c5..c0f9dac0be 100644 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/network/combined/network_events.py.ini +++ b/wpt-metadata/mapper/headless/webdriver/tests/bidi/network/combined/network_events.py.ini @@ -1,3 +1,6 @@ [network_events.py] [test_event_order_with_redirect] expected: FAIL + + [test_iframe_navigation_request] + expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/subscribe/events.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/subscribe/events.py.ini index c80dac9941..b7313fbfc1 100644 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/subscribe/events.py.ini +++ b/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/subscribe/events.py.ini @@ -1,3 +1,9 @@ [events.py] [test_subscribe_to_module] expected: [FAIL, PASS] + + [test_subscribe_to_one_event_and_then_to_module] + expected: FAIL + + [test_subscribe_to_module_and_then_to_one_event_again] + expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini new file mode 100644 index 0000000000..5269451a08 --- /dev/null +++ b/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini @@ -0,0 +1,3 @@ +[events.py] + [test_subscribe_to_module_unsubscribe_from_one_event] + expected: FAIL From 6b66e8a07627695d735c29ba945e23b39d310ce7 Mon Sep 17 00:00:00 2001 From: Maksim Sadym Date: Fri, 22 Nov 2024 13:00:55 +0100 Subject: [PATCH 3/7] fix e2e --- .../modules/context/BrowsingContextImpl.ts | 2 +- tests/browsing_context/test_navigate.py | 139 ++++++++++-------- 2 files changed, 75 insertions(+), 66 deletions(-) diff --git a/src/bidiMapper/modules/context/BrowsingContextImpl.ts b/src/bidiMapper/modules/context/BrowsingContextImpl.ts index 06ec9c984c..e0862d1be3 100644 --- a/src/bidiMapper/modules/context/BrowsingContextImpl.ts +++ b/src/bidiMapper/modules/context/BrowsingContextImpl.ts @@ -546,7 +546,7 @@ export class BrowsingContextImpl { this.#pendingCommandNavigation = undefined; this.#navigationInitiatedByCommand = false; } - if (urlMatchesAboutBlank(params.url)) { + if (!urlMatchesAboutBlank(params.url)) { // If the url does not match about:blank, do not consider it is an initial // navigation and emit all the required events. // https://github.com/GoogleChromeLabs/chromium-bidi/issues/2793. diff --git a/tests/browsing_context/test_navigate.py b/tests/browsing_context/test_navigate.py index 18b41363a0..c3390939c9 100644 --- a/tests/browsing_context/test_navigate.py +++ b/tests/browsing_context/test_navigate.py @@ -406,11 +406,11 @@ async def test_browsingContext_navigationStartedEvent_viaScript( @pytest.mark.asyncio async def test_browsingContext_navigationStartedEvent_iframe_viaCommand( - websocket, context_id, url_base, html, iframe): + websocket, context_id, url_base, html, iframe, read_sorted_messages): await subscribe(websocket, ["browsingContext.navigationStarted"]) iframe_url = html("

FRAME

") page_url = html(iframe(iframe_url)) - await send_JSON_command( + command_id = await send_JSON_command( websocket, { "method": "browsingContext.navigate", "params": { @@ -420,34 +420,38 @@ async def test_browsingContext_navigationStartedEvent_iframe_viaCommand( } }) - response = await read_JSON_message(websocket) - assert response == { - 'type': 'event', - "method": "browsingContext.navigationStarted", - "params": { - "context": context_id, - "navigation": ANY_UUID, - "timestamp": ANY_TIMESTAMP, - "url": page_url, - } - } - - response = await read_JSON_message(websocket) - assert response == { - 'type': 'event', - "method": "browsingContext.navigationStarted", - "params": { - "context": ANY_STR, - "navigation": ANY_UUID, - "timestamp": ANY_TIMESTAMP, - "url": iframe_url, - } - } + messages = await read_sorted_messages(3) + assert messages == [ + AnyExtending({ + 'id': command_id, + 'type': 'success', + }), + { + 'method': 'browsingContext.navigationStarted', + 'params': { + 'context': context_id, + 'navigation': ANY_UUID, + 'timestamp': ANY_TIMESTAMP, + 'url': page_url, + }, + 'type': 'event', + }, + { + 'method': 'browsingContext.navigationStarted', + 'params': { + 'context': ANY_STR, + 'navigation': ANY_UUID, + 'timestamp': ANY_TIMESTAMP, + 'url': iframe_url, + }, + 'type': 'event', + }, + ] @pytest.mark.asyncio async def test_browsingContext_navigationStartedEvent_iframe_viaScript( - websocket, context_id, url_base, html, iframe): + websocket, context_id, url_base, html, iframe, read_sorted_messages): await subscribe(websocket, ["browsingContext.navigationStarted"]) iframe_url = html("

FRAME

") page_url = html(iframe(iframe_url)) @@ -470,42 +474,43 @@ async def test_browsingContext_navigationStartedEvent_iframe_viaScript( } }) - response = await read_JSON_message(websocket) - assert response == { - 'type': 'event', - "method": "browsingContext.navigationStarted", - "params": { - "context": context_id, - "navigation": ANY_UUID, - "timestamp": ANY_TIMESTAMP, - "url": page_url, - } - } - - response = await read_JSON_message(websocket) - assert response == AnyExtending({"id": command_id, "type": "success"}) - - response = await read_JSON_message(websocket) - assert response == { - 'type': 'event', - "method": "browsingContext.navigationStarted", - "params": { - "context": ANY_STR, - "navigation": ANY_UUID, - "timestamp": ANY_TIMESTAMP, - "url": iframe_url, - } - } + messages = await read_sorted_messages(3) + assert messages == [ + AnyExtending({ + 'id': command_id, + 'type': 'success', + }), + { + 'method': 'browsingContext.navigationStarted', + 'params': { + 'context': context_id, + 'navigation': ANY_UUID, + 'timestamp': ANY_TIMESTAMP, + 'url': page_url, + }, + 'type': 'event', + }, + { + 'method': 'browsingContext.navigationStarted', + 'params': { + 'context': ANY_STR, + 'navigation': ANY_UUID, + 'timestamp': ANY_TIMESTAMP, + 'url': iframe_url, + }, + 'type': 'event', + }, + ] @pytest.mark.asyncio async def test_browsingContext_navigationStartedEvent_viaCommand( - websocket, context_id, html): + websocket, context_id, html, read_sorted_messages): url = html() await subscribe(websocket, ["browsingContext.navigationStarted"]) - await send_JSON_command( + command_id = await send_JSON_command( websocket, { "method": "browsingContext.navigate", "params": { @@ -515,18 +520,22 @@ async def test_browsingContext_navigationStartedEvent_viaCommand( } }) - response = await read_JSON_message(websocket) - assert response == { - 'type': 'event', - "method": "browsingContext.navigationStarted", - "params": { - "context": context_id, - "navigation": ANY_UUID, - "timestamp": ANY_TIMESTAMP, - # TODO: Should report correct string - "url": ANY_STR, + messages = await read_sorted_messages(2) + assert messages == [ + AnyExtending({ + 'id': command_id, + 'type': 'success', + }), { + 'method': 'browsingContext.navigationStarted', + 'params': { + 'context': context_id, + 'navigation': ANY_UUID, + 'timestamp': ANY_TIMESTAMP, + 'url': url, + }, + 'type': 'event', } - } + ] @pytest.mark.asyncio From 49e79e478f59b1feb3d5dec528e420106732e3f6 Mon Sep 17 00:00:00 2001 From: browser-automation-bot <133232582+browser-automation-bot@users.noreply.github.com> Date: Fri, 22 Nov 2024 13:12:57 +0100 Subject: [PATCH 4/7] test: update the expectations for PR (#2808) Automatically generated by https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/.github/workflows/wpt.yml --- .../dom_content_loaded.py.ini | 3 --- .../browsing_context/get_tree/frames.py.ini | 12 ------------ .../bidi/browsing_context/load/load.py.ini | 3 --- .../navigation_started.py.ini | 9 --------- .../network/combined/network_events.py.ini | 3 --- .../dom_content_loaded.py.ini | 3 --- .../browsing_context/get_tree/frames.py.ini | 12 ------------ .../bidi/browsing_context/load/load.py.ini | 3 --- .../navigation_started.py.ini | 9 --------- .../network/combined/network_events.py.ini | 3 --- .../dom_content_loaded.py.ini | 3 --- .../browsing_context/get_tree/frames.py.ini | 12 ------------ .../bidi/browsing_context/load/load.py.ini | 3 --- .../navigation_started.py.ini | 18 ------------------ .../network/combined/network_events.py.ini | 3 --- 15 files changed, 99 deletions(-) delete mode 100644 wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini delete mode 100644 wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini delete mode 100644 wpt-metadata/chromedriver/headful/webdriver/tests/bidi/network/combined/network_events.py.ini delete mode 100644 wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini delete mode 100644 wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini delete mode 100644 wpt-metadata/chromedriver/headless/webdriver/tests/bidi/network/combined/network_events.py.ini delete mode 100644 wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini delete mode 100644 wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini index 3a8b031820..98b86903e0 100644 --- a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini +++ b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini @@ -1,7 +1,4 @@ [dom_content_loaded.py] - [test_iframe] - expected: FAIL - [test_new_context[tab\]] expected: FAIL diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini deleted file mode 100644 index cba9341853..0000000000 --- a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini +++ /dev/null @@ -1,12 +0,0 @@ -[frames.py] - [test_user_context[same_origin-default\]] - expected: FAIL - - [test_user_context[same_origin-new\]] - expected: FAIL - - [test_user_context[cross_origin-default\]] - expected: FAIL - - [test_user_context[cross_origin-new\]] - expected: FAIL diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/load/load.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/load/load.py.ini index 1fbf0d8d8e..785c76a25f 100644 --- a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/load/load.py.ini +++ b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/load/load.py.ini @@ -1,7 +1,4 @@ [load.py] - [test_iframe] - expected: FAIL - [test_new_context[tab\]] expected: FAIL diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini deleted file mode 100644 index 9f63915bca..0000000000 --- a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini +++ /dev/null @@ -1,9 +0,0 @@ -[navigation_started.py] - [test_window_open_with_about_blank[\]] - expected: FAIL - - [test_window_open_with_about_blank[about:blank\]] - expected: FAIL - - [test_window_open_with_about_blank[about:blank?test\]] - expected: FAIL diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/network/combined/network_events.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/network/combined/network_events.py.ini deleted file mode 100644 index 9fc9550222..0000000000 --- a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/network/combined/network_events.py.ini +++ /dev/null @@ -1,3 +0,0 @@ -[network_events.py] - [test_iframe_navigation_request] - expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini index 3a8b031820..98b86903e0 100644 --- a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini +++ b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini @@ -1,7 +1,4 @@ [dom_content_loaded.py] - [test_iframe] - expected: FAIL - [test_new_context[tab\]] expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini deleted file mode 100644 index cba9341853..0000000000 --- a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini +++ /dev/null @@ -1,12 +0,0 @@ -[frames.py] - [test_user_context[same_origin-default\]] - expected: FAIL - - [test_user_context[same_origin-new\]] - expected: FAIL - - [test_user_context[cross_origin-default\]] - expected: FAIL - - [test_user_context[cross_origin-new\]] - expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini index 1fbf0d8d8e..785c76a25f 100644 --- a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini +++ b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini @@ -1,7 +1,4 @@ [load.py] - [test_iframe] - expected: FAIL - [test_new_context[tab\]] expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini deleted file mode 100644 index 9f63915bca..0000000000 --- a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini +++ /dev/null @@ -1,9 +0,0 @@ -[navigation_started.py] - [test_window_open_with_about_blank[\]] - expected: FAIL - - [test_window_open_with_about_blank[about:blank\]] - expected: FAIL - - [test_window_open_with_about_blank[about:blank?test\]] - expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/network/combined/network_events.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/network/combined/network_events.py.ini deleted file mode 100644 index 9fc9550222..0000000000 --- a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/network/combined/network_events.py.ini +++ /dev/null @@ -1,3 +0,0 @@ -[network_events.py] - [test_iframe_navigation_request] - expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini index 3a8b031820..98b86903e0 100644 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini +++ b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini @@ -1,7 +1,4 @@ [dom_content_loaded.py] - [test_iframe] - expected: FAIL - [test_new_context[tab\]] expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini deleted file mode 100644 index cba9341853..0000000000 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/get_tree/frames.py.ini +++ /dev/null @@ -1,12 +0,0 @@ -[frames.py] - [test_user_context[same_origin-default\]] - expected: FAIL - - [test_user_context[same_origin-new\]] - expected: FAIL - - [test_user_context[cross_origin-default\]] - expected: FAIL - - [test_user_context[cross_origin-new\]] - expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini index 1fbf0d8d8e..785c76a25f 100644 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini +++ b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini @@ -1,7 +1,4 @@ [load.py] - [test_iframe] - expected: FAIL - [test_new_context[tab\]] expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini deleted file mode 100644 index d4819d35b6..0000000000 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/navigation_started/navigation_started.py.ini +++ /dev/null @@ -1,18 +0,0 @@ -[navigation_started.py] - [test_window_open_with_about_blank[\]] - expected: FAIL - - [test_window_open_with_about_blank[about:blank\]] - expected: FAIL - - [test_window_open_with_about_blank[about:blank?test\]] - expected: FAIL - - [test_iframe] - expected: FAIL - - [test_nested_iframes] - expected: FAIL - - [test_window_open_with_url] - expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/network/combined/network_events.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/network/combined/network_events.py.ini index c0f9dac0be..adc3f048c5 100644 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/network/combined/network_events.py.ini +++ b/wpt-metadata/mapper/headless/webdriver/tests/bidi/network/combined/network_events.py.ini @@ -1,6 +1,3 @@ [network_events.py] [test_event_order_with_redirect] expected: FAIL - - [test_iframe_navigation_request] - expected: FAIL From 5261e093807af40e38df7e30dd0c10aab24ff360 Mon Sep 17 00:00:00 2001 From: Maksim Sadym Date: Fri, 22 Nov 2024 13:54:42 +0100 Subject: [PATCH 5/7] inline `this.#emitNavigationStarted` --- .../modules/context/BrowsingContextImpl.ts | 77 ++++++++++--------- 1 file changed, 41 insertions(+), 36 deletions(-) diff --git a/src/bidiMapper/modules/context/BrowsingContextImpl.ts b/src/bidiMapper/modules/context/BrowsingContextImpl.ts index e0862d1be3..17f9aa871f 100644 --- a/src/bidiMapper/modules/context/BrowsingContextImpl.ts +++ b/src/bidiMapper/modules/context/BrowsingContextImpl.ts @@ -414,25 +414,6 @@ export class BrowsingContextImpl { onTargetInfoChanged(params: Protocol.Target.TargetInfoChangedEvent) { this.#url = params.targetInfo.url; } - - #emitNavigationStarted(url: string) { - this.#navigationId = this.#pendingNavigationId ?? uuidv4(); - this.#pendingNavigationId = undefined; - this.#eventManager.registerEvent( - { - type: 'event', - method: ChromiumBidi.BrowsingContext.EventNames.NavigationStarted, - params: { - context: this.id, - navigation: this.#navigationId, - timestamp: BrowsingContextImpl.getTimestamp(), - url, - }, - }, - this.id, - ); - } - #initListeners() { this.#cdpTarget.cdpClient.on('Page.frameNavigated', (params) => { if (this.id !== params.frame.id) { @@ -493,23 +474,33 @@ export class BrowsingContextImpl { return; } - if (!this.#navigationInitiatedByCommand) { - // In case of the navigation is not initiated by `browsingContext.navigate` or - // `browsingContext.reload` commands, the `Page.frameRequestedNavigation` is - // emitted, which means the `NavigationStarted` is already emitted as well. - return; + if (this.#navigationInitiatedByCommand) { + // In case of the navigation is initiated by `browsingContext.navigate` or + // `browsingContext.reload` commands, the `Page.frameRequestedNavigation` is not + // emitted, which means the `NavigationStarted` is not emitted. + // TODO: consider emit it right after the CDP command `navigate` or `reload` is finished. + + // The URL of the navigation that is currently in progress. Although the URL + // is not yet known in case of user-initiated navigations, it is possible to + // provide the URL in case of BiDi-initiated navigations. + // TODO: provide proper URL in case of user-initiated navigations. + const url = this.#pendingNavigationUrl ?? 'UNKNOWN'; + this.#navigationId = this.#pendingNavigationId ?? uuidv4(); + this.#pendingNavigationId = undefined; + this.#eventManager.registerEvent( + { + type: 'event', + method: ChromiumBidi.BrowsingContext.EventNames.NavigationStarted, + params: { + context: this.id, + navigation: this.#navigationId, + timestamp: BrowsingContextImpl.getTimestamp(), + url, + }, + }, + this.id, + ); } - - // The `Page.frameRequestedNavigation` is not emitted, as the navigation was - // initiated by `browsingContext.navigate` command. This means the - // `NavigationStarted` event should be emitted now. - - // The URL of the navigation that is currently in progress. Although the URL - // is not yet known in case of user-initiated navigations, it is possible to - // provide the URL in case of BiDi-initiated navigations. - // TODO: provide proper URL in case of user-initiated navigations. - const url = this.#pendingNavigationUrl ?? 'UNKNOWN'; - this.#emitNavigationStarted(url); }); // TODO: don't use deprecated `Page.frameScheduledNavigation` event. @@ -555,7 +546,21 @@ export class BrowsingContextImpl { if (!this.#initialNavigation) { // Do not emit the event for the initial navigation to `about:blank`. - this.#emitNavigationStarted(params.url); + this.#navigationId = this.#pendingNavigationId ?? uuidv4(); + this.#pendingNavigationId = undefined; + this.#eventManager.registerEvent( + { + type: 'event', + method: ChromiumBidi.BrowsingContext.EventNames.NavigationStarted, + params: { + context: this.id, + navigation: this.#navigationId, + timestamp: BrowsingContextImpl.getTimestamp(), + url: params.url, + }, + }, + this.id, + ); } this.#pendingNavigationUrl = params.url; From 98c2337dcc17d81491dedd061af86c2f047461d3 Mon Sep 17 00:00:00 2001 From: browser-automation-bot <133232582+browser-automation-bot@users.noreply.github.com> Date: Fri, 22 Nov 2024 15:40:38 +0100 Subject: [PATCH 6/7] test: update the expectations for PR (#2811) Automatically generated by https://github.com/GoogleChromeLabs/chromium-bidi/blob/main/.github/workflows/wpt.yml --- .../webdriver/tests/bidi/session/subscribe/events.py.ini | 9 --------- .../tests/bidi/session/unsubscribe/events.py.ini | 3 --- .../webdriver/tests/bidi/session/subscribe/events.py.ini | 9 --------- .../tests/bidi/session/unsubscribe/events.py.ini | 3 --- .../webdriver/tests/bidi/session/subscribe/events.py.ini | 6 ------ .../tests/bidi/session/unsubscribe/events.py.ini | 3 --- 6 files changed, 33 deletions(-) delete mode 100644 wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/subscribe/events.py.ini delete mode 100644 wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/unsubscribe/events.py.ini delete mode 100644 wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/subscribe/events.py.ini delete mode 100644 wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini delete mode 100644 wpt-metadata/mapper/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/subscribe/events.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/subscribe/events.py.ini deleted file mode 100644 index 7dae6561ad..0000000000 --- a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/subscribe/events.py.ini +++ /dev/null @@ -1,9 +0,0 @@ -[events.py] - [test_subscribe_to_module] - expected: FAIL - - [test_subscribe_to_one_event_and_then_to_module] - expected: FAIL - - [test_subscribe_to_module_and_then_to_one_event_again] - expected: FAIL diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/unsubscribe/events.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/unsubscribe/events.py.ini deleted file mode 100644 index 5269451a08..0000000000 --- a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/session/unsubscribe/events.py.ini +++ /dev/null @@ -1,3 +0,0 @@ -[events.py] - [test_subscribe_to_module_unsubscribe_from_one_event] - expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/subscribe/events.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/subscribe/events.py.ini deleted file mode 100644 index 7dae6561ad..0000000000 --- a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/subscribe/events.py.ini +++ /dev/null @@ -1,9 +0,0 @@ -[events.py] - [test_subscribe_to_module] - expected: FAIL - - [test_subscribe_to_one_event_and_then_to_module] - expected: FAIL - - [test_subscribe_to_module_and_then_to_one_event_again] - expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini deleted file mode 100644 index 5269451a08..0000000000 --- a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini +++ /dev/null @@ -1,3 +0,0 @@ -[events.py] - [test_subscribe_to_module_unsubscribe_from_one_event] - expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/subscribe/events.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/subscribe/events.py.ini index b7313fbfc1..c80dac9941 100644 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/subscribe/events.py.ini +++ b/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/subscribe/events.py.ini @@ -1,9 +1,3 @@ [events.py] [test_subscribe_to_module] expected: [FAIL, PASS] - - [test_subscribe_to_one_event_and_then_to_module] - expected: FAIL - - [test_subscribe_to_module_and_then_to_one_event_again] - expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini deleted file mode 100644 index 5269451a08..0000000000 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/session/unsubscribe/events.py.ini +++ /dev/null @@ -1,3 +0,0 @@ -[events.py] - [test_subscribe_to_module_unsubscribe_from_one_event] - expected: FAIL From 83c18d499097e3cccbc36ba8bfff816c5e8c6b54 Mon Sep 17 00:00:00 2001 From: Maksim Sadym Date: Fri, 22 Nov 2024 15:43:24 +0100 Subject: [PATCH 7/7] update WPT expectations --- .../dom_content_loaded/dom_content_loaded.py.ini | 6 ------ .../webdriver/tests/bidi/browsing_context/load/load.py.ini | 6 ------ .../dom_content_loaded/dom_content_loaded.py.ini | 6 ------ .../webdriver/tests/bidi/browsing_context/load/load.py.ini | 6 ------ .../dom_content_loaded/dom_content_loaded.py.ini | 6 ------ .../webdriver/tests/bidi/browsing_context/load/load.py.ini | 6 ------ 6 files changed, 36 deletions(-) delete mode 100644 wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini delete mode 100644 wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/load/load.py.ini delete mode 100644 wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini delete mode 100644 wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini delete mode 100644 wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini delete mode 100644 wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini deleted file mode 100644 index 98b86903e0..0000000000 --- a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini +++ /dev/null @@ -1,6 +0,0 @@ -[dom_content_loaded.py] - [test_new_context[tab\]] - expected: FAIL - - [test_new_context[window\]] - expected: FAIL diff --git a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/load/load.py.ini b/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/load/load.py.ini deleted file mode 100644 index 785c76a25f..0000000000 --- a/wpt-metadata/chromedriver/headful/webdriver/tests/bidi/browsing_context/load/load.py.ini +++ /dev/null @@ -1,6 +0,0 @@ -[load.py] - [test_new_context[tab\]] - expected: FAIL - - [test_new_context[window\]] - expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini deleted file mode 100644 index 98b86903e0..0000000000 --- a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini +++ /dev/null @@ -1,6 +0,0 @@ -[dom_content_loaded.py] - [test_new_context[tab\]] - expected: FAIL - - [test_new_context[window\]] - expected: FAIL diff --git a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini b/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini deleted file mode 100644 index 785c76a25f..0000000000 --- a/wpt-metadata/chromedriver/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini +++ /dev/null @@ -1,6 +0,0 @@ -[load.py] - [test_new_context[tab\]] - expected: FAIL - - [test_new_context[window\]] - expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini deleted file mode 100644 index 98b86903e0..0000000000 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/dom_content_loaded/dom_content_loaded.py.ini +++ /dev/null @@ -1,6 +0,0 @@ -[dom_content_loaded.py] - [test_new_context[tab\]] - expected: FAIL - - [test_new_context[window\]] - expected: FAIL diff --git a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini b/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini deleted file mode 100644 index 785c76a25f..0000000000 --- a/wpt-metadata/mapper/headless/webdriver/tests/bidi/browsing_context/load/load.py.ini +++ /dev/null @@ -1,6 +0,0 @@ -[load.py] - [test_new_context[tab\]] - expected: FAIL - - [test_new_context[window\]] - expected: FAIL