Loading browser/base/content/test/tabs/browser_e10s_switchbrowser.js +22 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,28 @@ const gExpectedHistory = { entries: [], }; function get_remote_history(browser) { async function get_remote_history(browser) { if (SpecialPowers.getBoolPref("fission.sessionHistoryInParent")) { let sessionHistory = browser.browsingContext?.sessionHistory; if (!sessionHistory) { return null; } let result = { index: sessionHistory.index, entries: [], }; for (let i = 0; i < sessionHistory.count; i++) { let entry = sessionHistory.getEntryAtIndex(i); result.entries.push({ uri: entry.URI.spec, title: entry.title, }); } return result; } return SpecialPowers.spawn(browser, [], () => { let webNav = content.docShell.QueryInterface(Ci.nsIWebNavigation); let sessionHistory = webNav.sessionHistory; Loading docshell/test/browser/browser_bug655273.js +34 −14 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ add_task(async function test() { await BrowserTestUtils.withNewTab( { gBrowser, url: "http://example.com" }, async function(browser) { if (!SpecialPowers.getBoolPref("fission.sessionHistoryInParent")) { await SpecialPowers.spawn(browser, [], async function() { let cw = content; let oldTitle = cw.document.title; Loading @@ -29,6 +30,25 @@ add_task(async function test() { "SHEntry title after pushstate." ); }); return; } let bc = browser.browsingContext; let oldTitle = browser.browsingContext.currentWindowGlobal.documentTitle; ok(oldTitle, "Content window should initially have a title."); SpecialPowers.spawn(browser, [], async function() { content.history.pushState("", "", "new_page"); }); let shistory = bc.sessionHistory; await SHListener.waitForHistory(shistory, SHListener.NewEntry); is( shistory.getEntryAtIndex(shistory.index).title, oldTitle, "SHEntry title after pushstate." ); } ); }); docshell/test/browser/head.js +53 −0 Original line number Diff line number Diff line Loading @@ -198,3 +198,56 @@ function assertBackForwardState(canGoBack, canGoForward) { } disabled` ); } class SHListener { static NewEntry = 0; static Reload = 1; static GotoIndex = 2; static Purge = 3; static ReplaceEntry = 4; static async waitForHistory(history, event) { return new Promise(resolve => { let listener = { OnHistoryNewEntry: () => {}, OnHistoryReload: () => { return true; }, OnHistoryGotoIndex: () => {}, OnHistoryPurge: () => {}, OnHistoryReplaceEntry: () => {}, QueryInterface: ChromeUtils.generateQI([ "nsISHistoryListener", "nsISupportsWeakReference", ]), }; function finish() { history.removeSHistoryListener(listener); resolve(); } switch (event) { case this.NewEntry: listener.OnHistoryNewEntry = finish; break; case this.Reload: listener.OnHistoryReload = () => { finish(); return true; }; break; case this.GotoIndex: listener.OnHistoryGotoIndex = finish; break; case this.Purge: listener.OnHistoryPurge = finish; break; case this.ReplaceEntry: listener.OnHistoryReplaceEntry = finish; break; } history.addSHistoryListener(listener); }); } } docshell/test/chrome/bug112564_window.xhtml +7 −2 Original line number Diff line number Diff line Loading @@ -35,8 +35,13 @@ } // Work around bug 467960 var history = gBrowser.webNavigation.sessionHistory; if (SpecialPowers.getBoolPref("fission.sessionHistoryInParent")) { let history = gBrowser.browsingContext.sessionHistory; history.purgeHistory(history.count); } else { let history = gBrowser.webNavigation.sessionHistory; history.legacySHistory.purgeHistory(history.count); } window.close(); window.arguments[0].SimpleTest.finish(); Loading docshell/test/chrome/bug215405_window.xhtml +7 −2 Original line number Diff line number Diff line Loading @@ -37,8 +37,13 @@ function finish() { gBrowser.removeEventListener("pageshow", eventListener, true); // Work around bug 467960 if (SpecialPowers.getBoolPref("fission.sessionHistoryInParent")) { var history = gBrowser.browsingContext.sessionHistory; history.purgeHistory(history.count); } else { var history = gBrowser.webNavigation.sessionHistory; history.legacySHistory.purgeHistory(history.count); } window.close(); window.arguments[0].SimpleTest.finish(); Loading Loading
browser/base/content/test/tabs/browser_e10s_switchbrowser.js +22 −1 Original line number Diff line number Diff line Loading @@ -9,7 +9,28 @@ const gExpectedHistory = { entries: [], }; function get_remote_history(browser) { async function get_remote_history(browser) { if (SpecialPowers.getBoolPref("fission.sessionHistoryInParent")) { let sessionHistory = browser.browsingContext?.sessionHistory; if (!sessionHistory) { return null; } let result = { index: sessionHistory.index, entries: [], }; for (let i = 0; i < sessionHistory.count; i++) { let entry = sessionHistory.getEntryAtIndex(i); result.entries.push({ uri: entry.URI.spec, title: entry.title, }); } return result; } return SpecialPowers.spawn(browser, [], () => { let webNav = content.docShell.QueryInterface(Ci.nsIWebNavigation); let sessionHistory = webNav.sessionHistory; Loading
docshell/test/browser/browser_bug655273.js +34 −14 Original line number Diff line number Diff line Loading @@ -14,6 +14,7 @@ add_task(async function test() { await BrowserTestUtils.withNewTab( { gBrowser, url: "http://example.com" }, async function(browser) { if (!SpecialPowers.getBoolPref("fission.sessionHistoryInParent")) { await SpecialPowers.spawn(browser, [], async function() { let cw = content; let oldTitle = cw.document.title; Loading @@ -29,6 +30,25 @@ add_task(async function test() { "SHEntry title after pushstate." ); }); return; } let bc = browser.browsingContext; let oldTitle = browser.browsingContext.currentWindowGlobal.documentTitle; ok(oldTitle, "Content window should initially have a title."); SpecialPowers.spawn(browser, [], async function() { content.history.pushState("", "", "new_page"); }); let shistory = bc.sessionHistory; await SHListener.waitForHistory(shistory, SHListener.NewEntry); is( shistory.getEntryAtIndex(shistory.index).title, oldTitle, "SHEntry title after pushstate." ); } ); });
docshell/test/browser/head.js +53 −0 Original line number Diff line number Diff line Loading @@ -198,3 +198,56 @@ function assertBackForwardState(canGoBack, canGoForward) { } disabled` ); } class SHListener { static NewEntry = 0; static Reload = 1; static GotoIndex = 2; static Purge = 3; static ReplaceEntry = 4; static async waitForHistory(history, event) { return new Promise(resolve => { let listener = { OnHistoryNewEntry: () => {}, OnHistoryReload: () => { return true; }, OnHistoryGotoIndex: () => {}, OnHistoryPurge: () => {}, OnHistoryReplaceEntry: () => {}, QueryInterface: ChromeUtils.generateQI([ "nsISHistoryListener", "nsISupportsWeakReference", ]), }; function finish() { history.removeSHistoryListener(listener); resolve(); } switch (event) { case this.NewEntry: listener.OnHistoryNewEntry = finish; break; case this.Reload: listener.OnHistoryReload = () => { finish(); return true; }; break; case this.GotoIndex: listener.OnHistoryGotoIndex = finish; break; case this.Purge: listener.OnHistoryPurge = finish; break; case this.ReplaceEntry: listener.OnHistoryReplaceEntry = finish; break; } history.addSHistoryListener(listener); }); } }
docshell/test/chrome/bug112564_window.xhtml +7 −2 Original line number Diff line number Diff line Loading @@ -35,8 +35,13 @@ } // Work around bug 467960 var history = gBrowser.webNavigation.sessionHistory; if (SpecialPowers.getBoolPref("fission.sessionHistoryInParent")) { let history = gBrowser.browsingContext.sessionHistory; history.purgeHistory(history.count); } else { let history = gBrowser.webNavigation.sessionHistory; history.legacySHistory.purgeHistory(history.count); } window.close(); window.arguments[0].SimpleTest.finish(); Loading
docshell/test/chrome/bug215405_window.xhtml +7 −2 Original line number Diff line number Diff line Loading @@ -37,8 +37,13 @@ function finish() { gBrowser.removeEventListener("pageshow", eventListener, true); // Work around bug 467960 if (SpecialPowers.getBoolPref("fission.sessionHistoryInParent")) { var history = gBrowser.browsingContext.sessionHistory; history.purgeHistory(history.count); } else { var history = gBrowser.webNavigation.sessionHistory; history.legacySHistory.purgeHistory(history.count); } window.close(); window.arguments[0].SimpleTest.finish(); Loading