forked from mirrors/gecko-dev
Previously gecko would drop all subframe history entries on reloading if there exists one or more dynamic subframes. With bug 1326251 and this bug, now that dynamic frame entries are bound to bfcache (so they're still dropped on reloading) but static entries are always kept in normal reloads. Force reload would still drop all subframes regardless they're static or dynamic, so for this test case I think we should just use a force reload. MozReview-Commit-ID: 2mZZa59RMHB --HG-- extra : rebase_source : 188b27f9566ce0652ca92c7765761ad3fd0b8c99
66 lines
2.2 KiB
JavaScript
66 lines
2.2 KiB
JavaScript
/* Any copyright is dedicated to the Public Domain.
|
|
http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
/* eslint-disable mozilla/no-arbitrary-setTimeout */
|
|
|
|
var tabState = {
|
|
entries: [{
|
|
url: "about:robots",
|
|
triggeringPrincipal_base64,
|
|
children: [{url: "about:mozilla", triggeringPrincipal_base64, }]}]
|
|
};
|
|
|
|
function test() {
|
|
waitForExplicitFinish();
|
|
requestLongerTimeout(2);
|
|
|
|
Services.prefs.setIntPref("browser.sessionstore.interval", 4000);
|
|
registerCleanupFunction(function() {
|
|
Services.prefs.clearUserPref("browser.sessionstore.interval");
|
|
});
|
|
|
|
let tab = BrowserTestUtils.addTab(gBrowser, "about:blank");
|
|
|
|
let browser = tab.linkedBrowser;
|
|
|
|
promiseTabState(tab, tabState).then(() => {
|
|
let sessionHistory = browser.sessionHistory;
|
|
let entry = sessionHistory.getEntryAtIndex(0, false);
|
|
entry.QueryInterface(Ci.nsISHContainer);
|
|
|
|
whenChildCount(entry, 1, function() {
|
|
whenChildCount(entry, 2, function() {
|
|
promiseBrowserLoaded(browser).then(() => {
|
|
let newSessionHistory = browser.sessionHistory;
|
|
let newEntry = newSessionHistory.getEntryAtIndex(0, false);
|
|
|
|
whenChildCount(newEntry, 0, function() {
|
|
// Make sure that we reset the state.
|
|
let blankState = { windows: [{ tabs: [{ entries: [{ url: "about:blank",
|
|
triggeringPrincipal_base64 }] }]}]};
|
|
waitForBrowserState(blankState, finish);
|
|
});
|
|
});
|
|
|
|
// Force reload the browser to deprecate the subframes.
|
|
browser.reloadWithFlags(Ci.nsIWebNavigation.LOAD_FLAGS_BYPASS_CACHE);
|
|
});
|
|
|
|
// Create a dynamic subframe.
|
|
let doc = browser.contentDocument;
|
|
let iframe = doc.createElement("iframe");
|
|
doc.body.appendChild(iframe);
|
|
iframe.setAttribute("src", "about:mozilla");
|
|
});
|
|
});
|
|
|
|
// This test relies on the test timing out in order to indicate failure so
|
|
// let's add a dummy pass.
|
|
ok(true, "Each test requires at least one pass, fail or todo so here is a pass.");
|
|
}
|
|
|
|
function whenChildCount(aEntry, aChildCount, aCallback) {
|
|
if (aEntry.childCount == aChildCount)
|
|
aCallback();
|
|
else
|
|
setTimeout(() => whenChildCount(aEntry, aChildCount, aCallback), 100);
|
|
}
|