summaryrefslogtreecommitdiffstats
path: root/devtools/client/inspector/test/browser_inspector_open_on_neterror.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /devtools/client/inspector/test/browser_inspector_open_on_neterror.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
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.js37
1 files changed, 37 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 000000000..01e065a1a
--- /dev/null
+++ b/devtools/client/inspector/test/browser_inspector_open_on_neterror.js
@@ -0,0 +1,37 @@
+/* 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(function* () {
+ // Unfortunately, net error page are not firing load event, so that we can't
+ // use addTab helper and have to do that:
+ let tab = gBrowser.selectedTab = gBrowser.addTab("data:text/html,empty");
+ yield BrowserTestUtils.browserLoaded(tab.linkedBrowser);
+ yield ContentTask.spawn(tab.linkedBrowser, { url: TEST_URL_1 }, function* ({ url }) {
+ // Also, the neterror being privileged, the DOMContentLoaded only fires on
+ // the chromeEventHandler.
+ let { chromeEventHandler } = docShell; // eslint-disable-line no-undef
+ let onDOMContentLoaded = ContentTaskUtils.waitForEvent(chromeEventHandler,
+ "DOMContentLoaded", true);
+ content.location = url;
+ yield onDOMContentLoaded;
+ });
+
+ let { inspector, testActor } = yield openInspector();
+ ok(true, "Inspector loaded on the already opened net error");
+
+ let documentURI = yield testActor.eval("document.documentURI;");
+ ok(documentURI.startsWith("about:neterror"), "content is really a net error page.");
+
+ info("Navigate to a valid url");
+ yield navigateTo(inspector, TEST_URL_2);
+
+ is(yield getDisplayedNodeTextContent("body", inspector), "test-doc-2",
+ "Inspector really inspects the valid url");
+});