Bug 1321020 Part 2: Test that a file:// URI window opened from a file:// page can be navigated to web content. r=gijs
authorBob Owen <bobowencode@gmail.com>
Fri, 23 Dec 2016 12:27:03 +0000
changeset 327111 94dfb2c98d9ca64d986c0baff2abdd782c6bead7
parent 327110 b50562f277da2f968c24b25e81253ad12c0fb7ee
child 327112 981fd29c57012c7e8a28168ca0941e00be560462
push id85100
push userbobowencode@gmail.com
push dateFri, 23 Dec 2016 12:27:28 +0000
treeherdermozilla-inbound@94dfb2c98d9c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgijs
bugs1321020
milestone53.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1321020 Part 2: Test that a file:// URI window opened from a file:// page can be navigated to web content. r=gijs
browser/base/content/test/tabs/browser.ini
browser/base/content/test/tabs/browser_opened_file_tab_navigated_to_web.js
browser/base/content/test/tabs/dummy_page.html
--- a/browser/base/content/test/tabs/browser.ini
+++ b/browser/base/content/test/tabs/browser.ini
@@ -1,5 +1,10 @@
+[DEFAULT]
+support-files =
+  dummy_page.html
+
 [browser_tabSpinnerProbe.js]
 skip-if = !e10s # Tab spinner is e10s only.
 [browser_tabSwitchPrintPreview.js]
 skip-if = os == 'mac'
 [browser_navigatePinnedTab.js]
+[browser_opened_file_tab_navigated_to_web.js]
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/tabs/browser_opened_file_tab_navigated_to_web.js
@@ -0,0 +1,38 @@
+/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- */
+/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
+
+const TEST_FILE = "dummy_page.html";
+
+// Test for bug 1321020.
+add_task(function* () {
+  let dir = getChromeDir(getResolvedURI(gTestPath));
+  dir.append(TEST_FILE);
+  const uriString = Services.io.newFileURI(dir).spec;
+  const openedUriString = uriString + "?opened";
+
+  // Open first file:// page.
+  let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, uriString);
+  registerCleanupFunction(function* () {
+    yield BrowserTestUtils.removeTab(tab);
+  });
+
+  // Open new file:// tab from JavaScript in first file:// page.
+  let promiseTabOpened = BrowserTestUtils.waitForNewTab(gBrowser, openedUriString);
+  yield ContentTask.spawn(tab.linkedBrowser, openedUriString, uri => {
+    content.open(uri, "_blank");
+  });
+
+  let openedTab = yield promiseTabOpened;
+  registerCleanupFunction(function* () {
+    yield BrowserTestUtils.removeTab(openedTab);
+  });
+
+  let openedBrowser = openedTab.linkedBrowser;
+  yield BrowserTestUtils.browserLoaded(openedBrowser);
+
+  // Ensure that new file:// tab can be navigated to web content.
+  openedBrowser.loadURI("http://example.org/");
+  let href = yield BrowserTestUtils.browserLoaded(openedBrowser);
+  is(href, "http://example.org/",
+     "Check that new file:// page has navigated successfully to web content");
+});
copy from browser/base/content/test/general/dummy_page.html
copy to browser/base/content/test/tabs/dummy_page.html