41 let ss =
Cc[
"@mozilla.org/browser/sessionstore;1"].getService(
Ci.nsISessionStore);
43 const baseURL =
"http://localhost:8888/browser/" +
44 "browser/components/sessionstore/test/browser/browser_447951_sample.html#";
46 let
tab = gBrowser.addTab();
47 tab.linkedBrowser.addEventListener(
"load",
function(aEvent) {
50 let tabState = { entries: [] };
51 let max_entries =
gPrefService.getIntPref(
"browser.sessionhistory.max_entries");
52 for (let
i = 0;
i < max_entries;
i++)
53 tabState.entries.push({
url: baseURL +
i });
55 ss.setTabState(tab,
JSON.stringify(tabState));
56 tab.addEventListener(
"SSTabRestored",
function(aEvent) {
58 tabState = eval(
"(" + ss.getTabState(tab) +
")");
59 is(tabState.entries.length, max_entries,
"session history filled to the limit");
60 is(tabState.entries[0].url, baseURL + 0,
"... but not more");
63 let
doc = tab.linkedBrowser.contentDocument;
64 let
event = doc.createEvent(
"MouseEvents");
65 event.initMouseEvent(
"click",
true,
true, doc.defaultView, 1,
66 0, 0, 0, 0,
false,
false,
false,
false, 0,
null);
67 doc.querySelector(
"a").dispatchEvent(
event);
69 executeSoon(
function() {
70 tabState = eval(
"(" + ss.getTabState(tab) +
")");
71 is(tab.linkedBrowser.currentURI.spec, baseURL +
"end",
72 "the new anchor was loaded");
73 is(tabState.entries[tabState.entries.length - 1].url, baseURL +
"end",
75 is(tabState.entries[0].url, baseURL + 1,
76 "... and the first item was removed");
79 gBrowser.removeTab(tab);
function doc() browser.contentDocument
return!aWindow arguments!aWindow arguments[0]
this removeEventListener("load", this.__SS_restore, true)
_getSelectedPageStyle s i