mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-26 22:32:46 +00:00
Backed out 2 changesets (bug 1914407) for causing Wd navigation related failure CLOSED TREE
Backed out changeset 098952454738 (bug 1914407) Backed out changeset 59ae3c80d4f7 (bug 1914407)
This commit is contained in:
parent
63bb1ab64f
commit
8591f727f3
@ -145,7 +145,6 @@ export class ProgressListener {
|
||||
#errorName;
|
||||
#navigationId;
|
||||
#navigationListener;
|
||||
#navigationManager;
|
||||
#promptListener;
|
||||
#seenStartFlag;
|
||||
#targetURI;
|
||||
@ -205,7 +204,6 @@ export class ProgressListener {
|
||||
this.#unloadTimerId = null;
|
||||
|
||||
if (navigationManager !== null) {
|
||||
this.#navigationManager = navigationManager;
|
||||
this.#navigationListener = new lazy.NavigationListener(navigationManager);
|
||||
this.#navigationListener.on(
|
||||
"navigation-failed",
|
||||
@ -316,31 +314,14 @@ export class ProgressListener {
|
||||
return;
|
||||
}
|
||||
|
||||
// Handle NS_BINDING_ABORTED status updates.
|
||||
if (status == Cr.NS_BINDING_ABORTED) {
|
||||
if (this.isInitialDocument) {
|
||||
// For an initial document another navigation to the real document will
|
||||
// happen, so we can ignore the NS_BINDING_ABORTED completely.
|
||||
this.#trace(
|
||||
"Ignore aborted navigation error to the initial document."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
const navigation = this.#getCurrentNavigation();
|
||||
if (
|
||||
navigation &&
|
||||
navigation.navigationId == this.#navigationId &&
|
||||
navigation.state == "started"
|
||||
) {
|
||||
// If the navigation is currently tracked by the navigation manager
|
||||
// and is still in progress, we should get a more detailed error
|
||||
// message from the NavigationManager once if processes the failure.
|
||||
this.#trace(
|
||||
"Ignore aborted navigation error, waiting for NavigationManager navigation-failed event."
|
||||
);
|
||||
return;
|
||||
}
|
||||
// Handle an aborted navigation. While for an initial document another
|
||||
// navigation to the real document will happen it's not the case for
|
||||
// normal documents. Here we need to stop the listener immediately.
|
||||
if (status == Cr.NS_BINDING_ABORTED && this.isInitialDocument) {
|
||||
this.#trace(
|
||||
"Ignore aborted navigation error to the initial document."
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
this.stop({ error: new Error(errorName) });
|
||||
@ -362,15 +343,6 @@ export class ProgressListener {
|
||||
}
|
||||
}
|
||||
|
||||
#getCurrentNavigation() {
|
||||
if (!this.#navigationManager) {
|
||||
return null;
|
||||
}
|
||||
return this.#navigationManager.getNavigationForBrowsingContext(
|
||||
this.browsingContext
|
||||
);
|
||||
}
|
||||
|
||||
#getErrorName(documentURI) {
|
||||
try {
|
||||
// Otherwise try to retrieve it from the document URI if it is an
|
||||
|
@ -328,7 +328,7 @@ class NavigationRegistry extends EventEmitter {
|
||||
// we can't reliable use it.
|
||||
notifyNavigationFailed({
|
||||
contextDetails,
|
||||
errorName: "Navigation was aborted by another navigation",
|
||||
errorName: "A new navigation interrupted an unfinished navigation",
|
||||
url: navigation.url,
|
||||
});
|
||||
}
|
||||
@ -423,7 +423,7 @@ class NavigationRegistry extends EventEmitter {
|
||||
// we can't reliable use it.
|
||||
notifyNavigationFailed({
|
||||
contextDetails,
|
||||
errorName: "Navigation was aborted by another navigation",
|
||||
errorName: "A new navigation interrupted an unfinished navigation",
|
||||
url: navigation.url,
|
||||
});
|
||||
}
|
||||
|
@ -1,35 +0,0 @@
|
||||
import pytest
|
||||
from webdriver.bidi.error import UnknownErrorException
|
||||
|
||||
pytestmark = pytest.mark.asyncio
|
||||
|
||||
|
||||
async def test_early_abort_via_inline_js_redirect(bidi_session, new_tab, url, inline):
|
||||
url_redirect = url("/webdriver/tests/bidi/browsing_context/support/empty.html")
|
||||
page = inline(
|
||||
f"""
|
||||
<script type="text/javascript">
|
||||
window.location.href = "{url_redirect}";
|
||||
</script>
|
||||
"""
|
||||
)
|
||||
|
||||
with pytest.raises(UnknownErrorException) as error:
|
||||
await bidi_session.browsing_context.navigate(
|
||||
context=new_tab["context"], url=page, wait="complete"
|
||||
)
|
||||
|
||||
assert "Navigation was aborted by another navigation" in str(error.value)
|
||||
|
||||
|
||||
async def test_early_abort_via_separate_js_redirect(bidi_session, new_tab, url, inline):
|
||||
url_redirect = url("/webdriver/tests/bidi/browsing_context/support/empty.html")
|
||||
script_url = inline(f"""window.location.href = "{url_redirect}";""", doctype="js")
|
||||
page = inline(f"""<script type="text/javascript" src="{script_url}"></script>""")
|
||||
|
||||
with pytest.raises(UnknownErrorException) as error:
|
||||
await bidi_session.browsing_context.navigate(
|
||||
context=new_tab["context"], url=page, wait="complete"
|
||||
)
|
||||
|
||||
assert "Navigation was aborted by another navigation" in str(error.value)
|
@ -19,7 +19,7 @@ BOILERPLATES = {
|
||||
</body>
|
||||
</html>""",
|
||||
"xml": """<?xml version="1.0" encoding="{charset}"?>\n{src}""",
|
||||
"js": "{src}",
|
||||
"js": "",
|
||||
}
|
||||
MIME_TYPES = {
|
||||
"html": "text/html",
|
||||
|
Loading…
Reference in New Issue
Block a user