Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* Any copyright is dedicated to the Public Domain.
2 http://creativecommons.org/publicdomain/zero/1.0/ */
4 let tabState = {
5 entries: [{url: "about:robots", children: [{url: "about:mozilla"}]}]
6 };
8 function test() {
9 waitForExplicitFinish();
10 requestLongerTimeout(2);
12 Services.prefs.setIntPref("browser.sessionstore.interval", 4000);
13 registerCleanupFunction(function () {
14 Services.prefs.clearUserPref("browser.sessionstore.interval");
15 });
17 let tab = gBrowser.addTab("about:blank");
19 let browser = tab.linkedBrowser;
21 waitForTabState(tab, tabState, function () {
23 let sessionHistory = browser.sessionHistory;
24 let entry = sessionHistory.getEntryAtIndex(0, false);
25 entry.QueryInterface(Ci.nsISHContainer);
27 whenChildCount(entry, 1, function () {
28 whenChildCount(entry, 2, function () {
29 whenBrowserLoaded(browser, function () {
30 SyncHandlers.get(browser).flush();
31 let {entries} = JSON.parse(ss.getTabState(tab));
32 is(entries.length, 1, "tab has one history entry");
33 ok(!entries[0].children, "history entry has no subframes");
35 // Make sure that we reset the state.
36 let blankState = { windows: [{ tabs: [{ entries: [{ url: "about:blank" }] }]}]};
37 waitForBrowserState(blankState, finish);
38 });
40 // reload the browser to deprecate the subframes
41 browser.reload();
42 });
44 // create a dynamic subframe
45 let doc = browser.contentDocument;
46 let iframe = doc.createElement("iframe");
47 doc.body.appendChild(iframe);
48 iframe.setAttribute("src", "about:mozilla");
49 });
50 });
51 }
53 function whenChildCount(aEntry, aChildCount, aCallback) {
54 if (aEntry.childCount == aChildCount)
55 aCallback();
56 else
57 setTimeout(function () whenChildCount(aEntry, aChildCount, aCallback), 100);
58 }