Backed out changeset c5505e97155f (bug 936271)
authorWes Kocher <wkocher@mozilla.com>
Thu, 30 Jan 2014 17:34:55 -0800
changeset 182225 bd46860e441d85b6608d515386bb672f116b0f05
parent 182224 d2c4e022d5acb3f1ba67f6f0529b58614dd116cf
child 182226 d1223e424134996f6854277976538b20b524daac
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs936271
milestone29.0a1
backs outc5505e97155f7d175f6948257bcf0c99c6ac0585
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
Backed out changeset c5505e97155f (bug 936271)
browser/components/sessionstore/test/browser.ini
browser/components/sessionstore/test/browser_597315.js
browser/components/sessionstore/test/browser_597315_a.html
browser/components/sessionstore/test/browser_597315_b.html
browser/components/sessionstore/test/browser_597315_c.html
browser/components/sessionstore/test/browser_597315_c1.html
browser/components/sessionstore/test/browser_597315_c2.html
browser/components/sessionstore/test/browser_597315_index.html
browser/components/sessionstore/test/browser_819510_perwindowpb.js
browser/components/sessionstore/test/browser_dynamic_frames.js
browser/components/sessionstore/test/browser_frame_history.js
browser/components/sessionstore/test/browser_frame_history_a.html
browser/components/sessionstore/test/browser_frame_history_b.html
browser/components/sessionstore/test/browser_frame_history_c.html
browser/components/sessionstore/test/browser_frame_history_c1.html
browser/components/sessionstore/test/browser_frame_history_c2.html
browser/components/sessionstore/test/browser_frame_history_index.html
browser/components/sessionstore/test/browser_frame_history_index2.html
browser/components/sessionstore/test/browser_frame_history_index_blank.html
--- a/browser/components/sessionstore/test/browser.ini
+++ b/browser/components/sessionstore/test/browser.ini
@@ -11,24 +11,16 @@
 support-files =
   head.js
   content.js
   content-forms.js
   browser_formdata_sample.html
   browser_formdata_xpath_sample.html
   browser_frametree_sample.html
   browser_frametree_sample_frameset.html
-  browser_frame_history_index.html
-  browser_frame_history_index2.html
-  browser_frame_history_index_blank.html
-  browser_frame_history_a.html
-  browser_frame_history_b.html
-  browser_frame_history_c.html
-  browser_frame_history_c1.html
-  browser_frame_history_c2.html
   browser_form_restore_events_sample.html
   browser_formdata_format_sample.html
   browser_pageStyle_sample.html
   browser_pageStyle_sample_nested.html
   browser_scrollPositions_sample.html
   browser_scrollPositions_sample_frameset.html
   browser_sessionStorage.html
   browser_248970_b_sample.html
@@ -36,16 +28,22 @@ support-files =
   browser_423132_sample.html
   browser_447951_sample.html
   browser_454908_sample.html
   browser_456342_sample.xhtml
   browser_463205_sample.html
   browser_463206_sample.html
   browser_466937_sample.html
   browser_485482_sample.html
+  browser_597315_index.html
+  browser_597315_a.html
+  browser_597315_b.html
+  browser_597315_c.html
+  browser_597315_c1.html
+  browser_597315_c2.html
   browser_662743_sample.html
   browser_739531_sample.html
   browser_911547_sample.html
   browser_911547_sample.html^headers^
 
 #NB: the following are disabled
 #  browser_464620_a.html
 #  browser_464620_b.html 
@@ -55,23 +53,21 @@ support-files =
 #disabled-for-intermittent-failures--bug-766044, browser_459906_empty.html
 #disabled-for-intermittent-failures--bug-766044, browser_459906_sample.html
 #disabled-for-intermittent-failures--bug-765389, browser_461743_sample.html
 
 [browser_attributes.js]
 [browser_broadcast.js]
 [browser_capabilities.js]
 [browser_dying_cache.js]
-[browser_dynamic_frames.js]
 [browser_form_restore_events.js]
 [browser_formdata.js]
 [browser_formdata_format.js]
 [browser_formdata_xpath.js]
 [browser_frametree.js]
-[browser_frame_history.js]
 [browser_global_store.js]
 [browser_label_and_icon.js]
 [browser_merge_closed_tabs.js]
 [browser_pageStyle.js]
 [browser_privatetabs.js]
 [browser_scrollPositions.js]
 [browser_sessionHistory.js]
 [browser_sessionStorage.js]
@@ -140,16 +136,17 @@ skip-if = true
 [browser_586068-reload.js]
 [browser_586068-select.js]
 [browser_586068-window_state.js]
 [browser_586068-window_state_override.js]
 [browser_588426.js]
 [browser_590268.js]
 [browser_590563.js]
 [browser_595601-restore_hidden.js]
+[browser_597315.js]
 [browser_599909.js]
 [browser_600545.js]
 [browser_601955.js]
 [browser_607016.js]
 [browser_615394-SSWindowState_events.js]
 [browser_618151.js]
 [browser_623779.js]
 [browser_624727.js]
new file mode 100644
--- /dev/null
+++ b/browser/components/sessionstore/test/browser_597315.js
@@ -0,0 +1,58 @@
+/* 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/. */
+
+function test() {
+  /** Test for Bug 597315 - Frameset history does not work properly when restoring a tab **/
+  waitForExplicitFinish();
+
+  let testURL = getRootDirectory(gTestPath) + "browser_597315_index.html";
+  let tab = gBrowser.addTab(testURL);
+  gBrowser.selectedTab = tab;
+
+  waitForLoadsInBrowser(tab.linkedBrowser, 4, function() {
+    let browser_b = tab.linkedBrowser.contentDocument.getElementsByTagName("frame")[1];
+    let document_b = browser_b.contentDocument;
+    let links = document_b.getElementsByTagName("a");
+
+    // We're going to click on the first link, so listen for another load event
+    waitForLoadsInBrowser(tab.linkedBrowser, 1, function() {
+      waitForLoadsInBrowser(tab.linkedBrowser, 1, function() {
+
+        gBrowser.removeTab(tab);
+        // wait for 4 loads again...
+        let newTab = ss.undoCloseTab(window, 0);
+
+        waitForLoadsInBrowser(newTab.linkedBrowser, 4, function() {
+          gBrowser.goBack();
+          waitForLoadsInBrowser(newTab.linkedBrowser, 1, function() {
+
+            let expectedURLEnds = ["a.html", "b.html", "c1.html"];
+            let frames = newTab.linkedBrowser.contentDocument.getElementsByTagName("frame");
+            for (let i = 0; i < frames.length; i++) {
+              is(frames[i].contentDocument.location,
+                 getRootDirectory(gTestPath) + "browser_597315_" + expectedURLEnds[i],
+                 "frame " + i + " has the right url");
+            }
+            gBrowser.removeTab(newTab);
+            executeSoon(finish);
+          });
+        });
+      });
+      EventUtils.sendMouseEvent({type:"click"}, links[1], browser_b.contentWindow);
+    });
+    EventUtils.sendMouseEvent({type:"click"}, links[0], browser_b.contentWindow);
+  });
+}
+
+// helper function
+function waitForLoadsInBrowser(aBrowser, aLoadCount, aCallback) {
+  let loadCount = 0;
+  aBrowser.addEventListener("load", function(aEvent) {
+    if (++loadCount < aLoadCount)
+      return;
+
+    aBrowser.removeEventListener("load", arguments.callee, true);
+    aCallback();
+  }, true);
+}
rename from browser/components/sessionstore/test/browser_frame_history_a.html
rename to browser/components/sessionstore/test/browser_597315_a.html
new file mode 100644
--- /dev/null
+++ b/browser/components/sessionstore/test/browser_597315_b.html
@@ -0,0 +1,10 @@
+<html>
+  <body>
+    I'm B!<br/>
+    <a target="c" href="browser_597315_c1.html">click me first</a><br/>
+    <a target="c" href="browser_597315_c2.html">then click me</a><br/>
+    Close this tab.<br/>
+    Restore this tab.<br/>
+    Click back.<br/>
+  </body>
+</html>
rename from browser/components/sessionstore/test/browser_frame_history_c.html
rename to browser/components/sessionstore/test/browser_597315_c.html
rename from browser/components/sessionstore/test/browser_frame_history_c1.html
rename to browser/components/sessionstore/test/browser_597315_c1.html
rename from browser/components/sessionstore/test/browser_frame_history_c2.html
rename to browser/components/sessionstore/test/browser_597315_c2.html
new file mode 100644
--- /dev/null
+++ b/browser/components/sessionstore/test/browser_597315_index.html
@@ -0,0 +1,10 @@
+<html>
+  <frameset cols="20%,80%">
+    <frameset rows="30%,70%">
+      <frame src="browser_597315_a.html"/>
+      <frame src="browser_597315_b.html"/>
+    </frameset>
+    <frame src="browser_597315_c.html" name="c"/>
+  </frameset>
+</html>
+
--- a/browser/components/sessionstore/test/browser_819510_perwindowpb.js
+++ b/browser/components/sessionstore/test/browser_819510_perwindowpb.js
@@ -173,15 +173,11 @@ function forceWriteState(aCallback) {
   Services.prefs.setIntPref("browser.sessionstore.interval", 0);
 }
 
 function testOnWindow(aIsPrivate, aCallback) {
   whenNewWindowLoaded({private: aIsPrivate}, aCallback);
 }
 
 function waitForTabLoad(aWin, aURL, aCallback) {
-  let browser = aWin.gBrowser.selectedBrowser;
-  whenBrowserLoaded(browser, function () {
-    SyncHandlers.get(browser).flush();
-    executeSoon(aCallback);
-  });
-  browser.loadURI(aURL);
+  whenBrowserLoaded(aWin.gBrowser.selectedBrowser, aCallback);
+  aWin.gBrowser.selectedBrowser.loadURI(aURL);
 }
deleted file mode 100644
--- a/browser/components/sessionstore/test/browser_dynamic_frames.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-"use strict";
-
-/**
- * Ensure that static frames of framesets are serialized but dynamically
- * inserted iframes are ignored.
- */
-add_task(function () {
-  // This URL has the following frames:
-  //  + about:mozilla (static)
-  //  + about:robots (static)
-  //  + about:rights (dynamic iframe)
-  const URL = "data:text/html;charset=utf-8," +
-              "<frameset cols=50%25,50%25><frame src=about%3Amozilla>" +
-              "<frame src=about%3Arobots></frameset>" +
-              "<script>var i=document.createElement('iframe');" +
-              "i.setAttribute('src', 'about%3Arights');" +
-              "document.body.appendChild(i);</script>";
-
-  // Add a new tab with two "static" and one "dynamic" frame.
-  let tab = gBrowser.addTab(URL);
-  let browser = tab.linkedBrowser;
-  yield promiseBrowserLoaded(browser);
-
-  SyncHandlers.get(browser).flush();
-  let {entries} = JSON.parse(ss.getTabState(tab));
-
-  // Check URLs.
-  ok(entries[0].url.startsWith("data:text/html"), "correct root url");
-  is(entries[0].children[0].url, "about:mozilla", "correct url for 1st frame");
-  is(entries[0].children[1].url, "about:robots", "correct url for 2nd frame");
-
-  // Check the number of children.
-  is(entries.length, 1, "there is one root entry ...");
-  is(entries[0].children.length, 2, "... with two child entries");
-
-  // Cleanup.
-  gBrowser.removeTab(tab);
-});
-
-/**
- * Ensure that iframes created by the network parser are serialized but
- * dynamically inserted iframes are ignored. Navigating a subframe should
- * create a second root entry that doesn't contain any dynamic children either.
- */
-add_task(function () {
-  // This URL has the following frames:
-  //  + about:mozilla (static iframe)
-  //  + about:rights (dynamic iframe)
-  const URL = "data:text/html;charset=utf-8," +
-              "<iframe name=t src=about%3Amozilla></iframe>" +
-              "<a id=lnk href=about%3Arobots target=t>clickme</a>" +
-              "<script>var i=document.createElement('iframe');" +
-              "i.setAttribute('src', 'about%3Arights');" +
-              "document.body.appendChild(i);</script>";
-
-  // Add a new tab with one "static" and one "dynamic" frame.
-  let tab = gBrowser.addTab(URL);
-  let browser = tab.linkedBrowser;
-  yield promiseBrowserLoaded(browser);
-
-  SyncHandlers.get(browser).flush();
-  let {entries} = JSON.parse(ss.getTabState(tab));
-
-  // Check URLs.
-  ok(entries[0].url.startsWith("data:text/html"), "correct root url");
-  is(entries[0].children[0].url, "about:mozilla", "correct url for static frame");
-
-  // Check the number of children.
-  is(entries.length, 1, "there is one root entry ...");
-  is(entries[0].children.length, 1, "... with a single child entry");
-
-  // Navigate the subframe.
-  browser.messageManager.sendAsyncMessage("ss-test:click", {id: "lnk"});
-  yield promiseBrowserLoaded(browser, false /* don't ignore subframes */);
-
-  SyncHandlers.get(browser).flush();
-  let {entries} = JSON.parse(ss.getTabState(tab));
-
-  // Check URLs.
-  ok(entries[0].url.startsWith("data:text/html"), "correct 1st root url");
-  ok(entries[1].url.startsWith("data:text/html"), "correct 2nd root url");
-  is(entries[0].children[0].url, "about:mozilla", "correct url for 1st static frame");
-  is(entries[1].children[0].url, "about:robots", "correct url for 2ns static frame");
-
-  // Check the number of children.
-  is(entries.length, 2, "there are two root entries ...");
-  is(entries[0].children.length, 1, "... with a single child entry ...");
-  is(entries[1].children.length, 1, "... each");
-
-  // Cleanup.
-  gBrowser.removeTab(tab);
-});
deleted file mode 100644
--- a/browser/components/sessionstore/test/browser_frame_history.js
+++ /dev/null
@@ -1,170 +0,0 @@
-/* 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/. */
-
-/**
- Ensure that frameset history works properly when restoring a tab,
- provided that the frameset is static.
- */
-
-// Loading a toplevel frameset
-add_task(function() {
-  let testURL = getRootDirectory(gTestPath) + "browser_frame_history_index.html";
-  let tab = gBrowser.addTab(testURL);
-  gBrowser.selectedTab = tab;
-
-  info("Opening a page with three frames, 4 loads should take place");
-  yield waitForLoadsInBrowser(tab.linkedBrowser, 4);
-
-  let browser_b = tab.linkedBrowser.contentDocument.getElementsByTagName("frame")[1];
-  let document_b = browser_b.contentDocument;
-  let links = document_b.getElementsByTagName("a");
-
-  // We're going to click on the first link, so listen for another load event
-  info("Clicking on link 1, 1 load should take place");
-  let promise = waitForLoadsInBrowser(tab.linkedBrowser, 1);
-  EventUtils.sendMouseEvent({type:"click"}, links[0], browser_b.contentWindow);
-  yield promise;
-
-  info("Clicking on link 2, 1 load should take place");
-  promise = waitForLoadsInBrowser(tab.linkedBrowser, 1);
-  EventUtils.sendMouseEvent({type:"click"}, links[1], browser_b.contentWindow);
-  yield promise;
-
-  info("Close then un-close page, 4 loads should take place");
-  gBrowser.removeTab(tab);
-  let newTab = ss.undoCloseTab(window, 0);
-  yield waitForLoadsInBrowser(newTab.linkedBrowser, 4);
-
-  info("Go back in time, 1 load should take place");
-  gBrowser.goBack();
-  yield waitForLoadsInBrowser(newTab.linkedBrowser, 1);
-
-  let expectedURLEnds = ["a.html", "b.html", "c1.html"];
-  let frames = newTab.linkedBrowser.contentDocument.getElementsByTagName("frame");
-  for (let i = 0; i < frames.length; i++) {
-    is(frames[i].contentDocument.location,
-       getRootDirectory(gTestPath) + "browser_frame_history_" + expectedURLEnds[i],
-       "frame " + i + " has the right url");
-  }
-  gBrowser.removeTab(newTab);
-});
-
-// Loading the frameset inside an iframe
-add_task(function() {
-  let testURL = getRootDirectory(gTestPath) + "browser_frame_history_index2.html";
-  let tab = gBrowser.addTab(testURL);
-  gBrowser.selectedTab = tab;
-
-  info("iframe: Opening a page with an iframe containing three frames, 5 loads should take place");
-  yield waitForLoadsInBrowser(tab.linkedBrowser, 5);
-
-  let browser_b = tab.linkedBrowser.contentDocument.
-    getElementById("iframe").contentDocument.
-    getElementsByTagName("frame")[1];
-  let document_b = browser_b.contentDocument;
-  let links = document_b.getElementsByTagName("a");
-
-  // We're going to click on the first link, so listen for another load event
-  info("iframe: Clicking on link 1, 1 load should take place");
-  let promise = waitForLoadsInBrowser(tab.linkedBrowser, 1);
-  EventUtils.sendMouseEvent({type:"click"}, links[0], browser_b.contentWindow);
-  yield promise;
-
-  info("iframe: Clicking on link 2, 1 load should take place");
-  promise = waitForLoadsInBrowser(tab.linkedBrowser, 1);
-  EventUtils.sendMouseEvent({type:"click"}, links[1], browser_b.contentWindow);
-  yield promise;
-
-  info("iframe: Close then un-close page, 5 loads should take place");
-  gBrowser.removeTab(tab);
-  let newTab = ss.undoCloseTab(window, 0);
-  yield waitForLoadsInBrowser(newTab.linkedBrowser, 5);
-
-  info("iframe: Go back in time, 1 load should take place");
-  gBrowser.goBack();
-  yield waitForLoadsInBrowser(newTab.linkedBrowser, 1);
-
-  let expectedURLEnds = ["a.html", "b.html", "c1.html"];
-  let frames = newTab.linkedBrowser.contentDocument.
-    getElementById("iframe").contentDocument.
-        getElementsByTagName("frame");
-  for (let i = 0; i < frames.length; i++) {
-    is(frames[i].contentDocument.location,
-       getRootDirectory(gTestPath) + "browser_frame_history_" + expectedURLEnds[i],
-       "frame " + i + " has the right url");
-  }
-  gBrowser.removeTab(newTab);
-});
-
-// Now, test that we don't record history if the iframe is added dynamically
-add_task(function() {
-  // Start with an empty history
-    let blankState = JSON.stringify({
-      windows: [{
-        tabs: [{ entries: [{ url: "about:blank" }] }],
-        _closedTabs: []
-      }],
-      _closedWindows: []
-    });
-    ss.setBrowserState(blankState);
-
-  let testURL = getRootDirectory(gTestPath) + "browser_frame_history_index_blank.html";
-  let tab = gBrowser.addTab(testURL);
-  gBrowser.selectedTab = tab;
-  yield waitForLoadsInBrowser(tab.linkedBrowser, 1);
-
-  info("dynamic: Opening a page with an iframe containing three frames, 4 dynamic loads should take place");
-  let doc = tab.linkedBrowser.contentDocument;
-  let iframe = doc.createElement("iframe");
-  iframe.id = "iframe";
-  iframe.src="browser_frame_history_index.html";
-  doc.body.appendChild(iframe);
-  yield waitForLoadsInBrowser(tab.linkedBrowser, 4);
-
-  let browser_b = tab.linkedBrowser.contentDocument.
-    getElementById("iframe").contentDocument.
-    getElementsByTagName("frame")[1];
-  let document_b = browser_b.contentDocument;
-  let links = document_b.getElementsByTagName("a");
-
-  // We're going to click on the first link, so listen for another load event
-  info("dynamic: Clicking on link 1, 1 load should take place");
-  let promise = waitForLoadsInBrowser(tab.linkedBrowser, 1);
-  EventUtils.sendMouseEvent({type:"click"}, links[0], browser_b.contentWindow);
-  yield promise;
-
-  info("dynamic: Clicking on link 2, 1 load should take place");
-  promise = waitForLoadsInBrowser(tab.linkedBrowser, 1);
-  EventUtils.sendMouseEvent({type:"click"}, links[1], browser_b.contentWindow);
-  yield promise;
-
-  info("Check in the state that we have not stored this history");
-  let state = ss.getBrowserState();
-  info(JSON.stringify(JSON.parse(state), null, "\t"));
-  is(state.indexOf("c1.html"), -1, "History entry was not stored in the session state");;
-  gBrowser.removeTab(tab);
-});
-
-// helper functions
-function waitForLoadsInBrowser(aBrowser, aLoadCount) {
-  let deferred = Promise.defer();
-  let loadCount = 0;
-  aBrowser.addEventListener("load", function(aEvent) {
-    if (++loadCount < aLoadCount) {
-      info("Got " + loadCount + " loads, waiting until we have " + aLoadCount);
-      return;
-    }
-
-    aBrowser.removeEventListener("load", arguments.callee, true);
-    deferred.resolve();
-  }, true);
-  return deferred.promise;
-}
-
-function timeout(delay, task) {
-  let deferred = Promise.defer();
-  setTimeout(() => deferred.resolve(true), delay);
-  task.then(() => deferred.resolve(false), deferred.reject);
-  return deferred.promise;
-}
deleted file mode 100755
--- a/browser/components/sessionstore/test/browser_frame_history_b.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html>
-  <body>
-    I'm B!<br/>
-    <a target="c" href="browser_frame_history_c1.html">click me first</a><br/>
-    <a target="c" href="browser_frame_history_c2.html">then click me</a><br/>
-    Close this tab.<br/>
-    Restore this tab.<br/>
-    Click back.<br/>
-  </body>
-</html>
deleted file mode 100644
--- a/browser/components/sessionstore/test/browser_frame_history_index.html
+++ /dev/null
@@ -1,10 +0,0 @@
-<html>
-  <frameset cols="20%,80%">
-    <frameset rows="30%,70%">
-      <frame src="browser_frame_history_a.html"/>
-      <frame src="browser_frame_history_b.html"/>
-    </frameset>
-    <frame src="browser_frame_history_c.html" name="c"/>
-  </frameset>
-</html>
-
deleted file mode 100644
--- a/browser/components/sessionstore/test/browser_frame_history_index2.html
+++ /dev/null
@@ -1,4 +0,0 @@
-<html>
-  <iframe src="browser_frame_history_index.html" id="iframe" />
-</html>
-
deleted file mode 100644
--- a/browser/components/sessionstore/test/browser_frame_history_index_blank.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<html>
- <body>
- </body>
-</html>
-