Bug 1226781 - add a regression test for going back from pages that cause about:neterror to be shown, r=mconley
☠☠ backed out by 8696e9783a9f ☠ ☠
authorGijs Kruitbosch <gijskruitbosch@gmail.com>
Tue, 26 Jan 2016 16:20:51 +0000
changeset 281610 3ae6880a94e45d360992daacfefa85239c729309
parent 281609 627ac298f23043bd185b802fe042dee054c8e1b2
child 281611 050018247a87ce534b3aa656164b9c01bf08190e
push id17244
push usergijskruitbosch@gmail.com
push dateTue, 26 Jan 2016 17:22:28 +0000
treeherderfx-team@050018247a87 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmconley
bugs1226781
milestone47.0a1
Bug 1226781 - add a regression test for going back from pages that cause about:neterror to be shown, r=mconley
browser/base/content/test/general/browser.ini
browser/base/content/test/general/browser_invalid_uri_back_forward_manipulation.js
--- a/browser/base/content/test/general/browser.ini
+++ b/browser/base/content/test/general/browser.ini
@@ -315,16 +315,17 @@ support-files = fxa_profile_handler.sjs
 [browser_gestureSupport.js]
 skip-if = e10s # Bug 863514 - no gesture support.
 [browser_getshortcutoruri.js]
 [browser_hide_removing.js]
 [browser_homeDrop.js]
 skip-if = buildapp == 'mulet'
 [browser_identity_UI.js]
 [browser_insecureLoginForms.js]
+[browser_invalid_uri_back_forward_manipulation.js]
 [browser_keywordBookmarklets.js]
 [browser_keywordSearch.js]
 [browser_keywordSearch_postData.js]
 [browser_lastAccessedTab.js]
 skip-if = toolkit == "windows" # Disabled on Windows due to frequent failures (bug 969405)
 [browser_locationBarCommand.js]
 skip-if = os == "linux" # Linux: Intermittent failures, bug 917535
 [browser_locationBarExternalLoad.js]
new file mode 100644
--- /dev/null
+++ b/browser/base/content/test/general/browser_invalid_uri_back_forward_manipulation.js
@@ -0,0 +1,34 @@
+"use strict";
+
+
+/**
+ * Verify that loading an invalid URI does not clobber a previously-loaded page's history
+ * entry, but that the invalid URI gets its own history entry instead. We're checking this
+ * using nsIWebNavigation's canGoBack, as well as actually going back and then checking
+ * canGoForward.
+ */
+add_task(function* checkBackFromInvalidURI() {
+  yield pushPrefs(["keyword.enabled", false]);
+  let tab = yield BrowserTestUtils.openNewForegroundTab(gBrowser, "about:robots", true);
+  gURLBar.value = "::2600";
+  gURLBar.focus();
+
+  let promiseErrorPageLoaded = BrowserTestUtils.waitForEvent(tab.linkedBrowser, "DOMContentLoaded");
+  EventUtils.synthesizeKey("VK_RETURN", {});
+  yield promiseErrorPageLoaded;
+
+  ok(gBrowser.webNavigation.canGoBack, "Should be able to go back");
+  if (gBrowser.webNavigation.canGoBack) {
+    // Can't use DOMContentLoaded here because the page is bfcached. Can't use pageshow for
+    // the error page because it doesn't seem to fire for those.
+    let promiseOtherPageLoaded = BrowserTestUtils.waitForEvent(tab.linkedBrowser, "pageshow", false,
+      // Be paranoid we *are* actually seeing this other page load, not some kind of race
+      // for if/when we do start firing pageshow for the error page...
+      function(e) { return gBrowser.currentURI.spec == "about:robots" }
+    );
+    gBrowser.goBack();
+    yield promiseOtherPageLoaded;
+    ok(gBrowser.webNavigation.canGoForward, "Should be able to go forward from previous page.");
+  }
+  yield BrowserTestUtils.removeTab(tab);
+});