Loading browser/components/sessionstore/test/Makefile.in +1 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,7 @@ _BROWSER_TEST_FILES = \ browser_687710_2.js \ browser_694378.js \ browser_705597.js \ browser_707862.js \ $(NULL) ifneq ($(OS_ARCH),Darwin) Loading browser/components/sessionstore/test/browser_707862.js 0 → 100644 +56 −0 Original line number Diff line number Diff line /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ let tabState = { entries: [{url: "about:home", children: [{url: "about:mozilla"}]}] }; function test() { waitForExplicitFinish(); let tab = gBrowser.addTab("about:blank"); registerCleanupFunction(function () gBrowser.removeTab(tab)); let browser = tab.linkedBrowser; whenBrowserLoaded(browser, function () { ss.setTabState(tab, JSON.stringify(tabState)); let sessionHistory = browser.sessionHistory; let entry = sessionHistory.getEntryAtIndex(0, false); whenChildCount(entry, 1, function () { whenChildCount(entry, 2, function () { whenBrowserLoaded(browser, function () { let sessionHistory = browser.sessionHistory; let entry = sessionHistory.getEntryAtIndex(0, false); whenChildCount(entry, 0, finish); }); // reload the browser to deprecate the subframes browser.reload(); }); // create a dynamic subframe let doc = browser.contentDocument; let iframe = doc.createElement("iframe"); iframe.setAttribute("src", "about:mozilla"); doc.body.appendChild(iframe); }); }); } function whenBrowserLoaded(aBrowser, aCallback) { aBrowser.addEventListener("load", function onLoad() { aBrowser.removeEventListener("load", onLoad, true); executeSoon(aCallback); }, true); } function whenChildCount(aEntry, aChildCount, aCallback) { if (aEntry.childCount == aChildCount) aCallback(); else executeSoon(function () whenChildCount(aEntry, aChildCount, aCallback)); } docshell/shistory/src/nsSHEntry.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -655,8 +655,16 @@ nsSHEntry::RemoveChild(nsISHEntry * aChild) childRemoved = mChildren.ReplaceObjectAt(nsnull, index); } } if (childRemoved) if (childRemoved) { aChild->SetParent(nsnull); // reduce the child count, i.e. remove empty children at the end for (PRInt32 i = mChildren.Count() - 1; i >= 0 && !mChildren[i]; --i) { if (!mChildren.RemoveObjectAt(i)) { break; } } } return NS_OK; } Loading Loading
browser/components/sessionstore/test/Makefile.in +1 −0 Original line number Diff line number Diff line Loading @@ -160,6 +160,7 @@ _BROWSER_TEST_FILES = \ browser_687710_2.js \ browser_694378.js \ browser_705597.js \ browser_707862.js \ $(NULL) ifneq ($(OS_ARCH),Darwin) Loading
browser/components/sessionstore/test/browser_707862.js 0 → 100644 +56 −0 Original line number Diff line number Diff line /* Any copyright is dedicated to the Public Domain. http://creativecommons.org/publicdomain/zero/1.0/ */ let tabState = { entries: [{url: "about:home", children: [{url: "about:mozilla"}]}] }; function test() { waitForExplicitFinish(); let tab = gBrowser.addTab("about:blank"); registerCleanupFunction(function () gBrowser.removeTab(tab)); let browser = tab.linkedBrowser; whenBrowserLoaded(browser, function () { ss.setTabState(tab, JSON.stringify(tabState)); let sessionHistory = browser.sessionHistory; let entry = sessionHistory.getEntryAtIndex(0, false); whenChildCount(entry, 1, function () { whenChildCount(entry, 2, function () { whenBrowserLoaded(browser, function () { let sessionHistory = browser.sessionHistory; let entry = sessionHistory.getEntryAtIndex(0, false); whenChildCount(entry, 0, finish); }); // reload the browser to deprecate the subframes browser.reload(); }); // create a dynamic subframe let doc = browser.contentDocument; let iframe = doc.createElement("iframe"); iframe.setAttribute("src", "about:mozilla"); doc.body.appendChild(iframe); }); }); } function whenBrowserLoaded(aBrowser, aCallback) { aBrowser.addEventListener("load", function onLoad() { aBrowser.removeEventListener("load", onLoad, true); executeSoon(aCallback); }, true); } function whenChildCount(aEntry, aChildCount, aCallback) { if (aEntry.childCount == aChildCount) aCallback(); else executeSoon(function () whenChildCount(aEntry, aChildCount, aCallback)); }
docshell/shistory/src/nsSHEntry.cpp +9 −1 Original line number Diff line number Diff line Loading @@ -655,8 +655,16 @@ nsSHEntry::RemoveChild(nsISHEntry * aChild) childRemoved = mChildren.ReplaceObjectAt(nsnull, index); } } if (childRemoved) if (childRemoved) { aChild->SetParent(nsnull); // reduce the child count, i.e. remove empty children at the end for (PRInt32 i = mChildren.Count() - 1; i >= 0 && !mChildren[i]; --i) { if (!mChildren.RemoveObjectAt(i)) { break; } } } return NS_OK; } Loading