Bug 808035 - Test. r=smaug
authorOonishi Atsushi <torisugari@gmail.com>
Wed, 07 Nov 2012 18:04:23 -0500
changeset 112630 0ecd2a87b36b6a04316ff36f2a71dba1e0419fed
parent 112629 91879bfc7042f9f9728349b4e7e8c28f1f94b2bf
child 112631 3267977b0f8ac1ec8f9b1627df2a0480e1adebaa
push id23833
push useremorley@mozilla.com
push dateThu, 08 Nov 2012 10:20:57 +0000
treeherdermozilla-central@e0d7b394462b [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs808035
milestone19.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 808035 - Test. r=smaug
docshell/test/browser/Makefile.in
docshell/test/browser/browser_bug808035.js
--- a/docshell/test/browser/Makefile.in
+++ b/docshell/test/browser/Makefile.in
@@ -27,11 +27,12 @@ MOCHITEST_BROWSER_FILES =	\
 		browser_bug554155.js \
 		browser_bug655273.js \
 		browser_bug655270.js \
 		file_bug655270.html \
 		favicon_bug655270.ico \
 		browser_bug670318.js \
 		file_bug670318.html \
 		browser_bug673467.js \
+		browser_bug808035.js \
 		$(NULL)
 
 include $(topsrcdir)/config/rules.mk
new file mode 100644
--- /dev/null
+++ b/docshell/test/browser/browser_bug808035.js
@@ -0,0 +1,33 @@
+/* Any copyright is dedicated to the Public Domain.
+   http://creativecommons.org/publicdomain/zero/1.0/ */
+
+// Test for bug 808035.
+// When we open a new tab, the initial URI is the transient <about:blank> and 
+// then requested URI would be loaded. When the URI's shceme is "javascript:",
+// we can *replace* the transient <about:blank> with an actual requet
+// through <javascript:location.replace("http://example.org/")>.
+//
+// There's no session history entry corresponding to the transient
+// <about:blank>. But we should make sure there exists a session history entry
+// for <http://example.org>.
+
+function test() {
+  const NEW_URI = "http://test1.example.org/";
+  const REQUESTED_URI = "javascript:void(location.replace('" + NEW_URI +
+                        "'))";
+
+  waitForExplicitFinish();
+
+  let tab = gBrowser.addTab(REQUESTED_URI);
+  let browser = tab.linkedBrowser;
+
+  browser.addEventListener('load', function(aEvent) {
+    browser.removeEventListener('load', arguments.callee, true);
+
+    is(browser.contentWindow.location.href, NEW_URI, "The URI is OK.");
+    is(browser.contentWindow.history.length, 1, "There exists a SH entry.");
+
+    gBrowser.removeTab(tab);
+    finish();
+  }, true);
+}