diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /devtools/client/inspector/test/browser_inspector_open_on_neterror.js | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'devtools/client/inspector/test/browser_inspector_open_on_neterror.js')
-rw-r--r-- | devtools/client/inspector/test/browser_inspector_open_on_neterror.js | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/devtools/client/inspector/test/browser_inspector_open_on_neterror.js b/devtools/client/inspector/test/browser_inspector_open_on_neterror.js new file mode 100644 index 0000000000..96354d3fab --- /dev/null +++ b/devtools/client/inspector/test/browser_inspector_open_on_neterror.js @@ -0,0 +1,41 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +"use strict"; + +// Test that inspector works correctly when opened against a net error page + +const TEST_URL_1 = "http://127.0.0.1:36325/"; +const TEST_URL_2 = "data:text/html,<html><body>test-doc-2</body></html>"; + +add_task(async function () { + // We cannot directly use addTab here as waiting for error pages requires + // a specific code path. + gBrowser.selectedTab = BrowserTestUtils.addTab(gBrowser, TEST_URL_1); + await BrowserTestUtils.waitForErrorPage(gBrowser.selectedBrowser); + + const { inspector } = await openInspector(); + ok(true, "Inspector loaded on the already opened net error"); + + const documentURI = await SpecialPowers.spawn( + gBrowser.selectedBrowser, + [], + () => content.document.documentURI + ); + ok( + documentURI.startsWith("about:neterror"), + "content is really a net error page." + ); + + const netErrorNode = await getNodeFront(".container", inspector); + ok(netErrorNode, "The inspector can get a node front from the neterror page"); + + info("Navigate to a valid url"); + await navigateTo(TEST_URL_2); + + is( + await getDisplayedNodeTextContent("body", inspector), + "test-doc-2", + "Inspector really inspects the valid url" + ); +}); |