45 let
pb =
Cc[
"@mozilla.org/privatebrowsing;1"].
47 gPrefService.setBoolPref(
"browser.privatebrowsing.keep_current_session",
true);
48 let profilePath =
Cc[
"@mozilla.org/file/directory_service;1"].
50 get(
"ProfD",
Ci.nsIFile);
52 function getSessionstoreFile() {
53 let sessionStoreJS = profilePath.clone();
54 sessionStoreJS.append(
"sessionstore.js");
55 return sessionStoreJS;
58 function getSessionstorejsModificationTime() {
59 let
file = getSessionstoreFile();
61 return file.lastModifiedTime;
66 let
os =
Cc[
"@mozilla.org/observer-service;1"].
68 function waitForFileExistence(aMessage, aDoNext) {
69 const TOPIC =
"sessionstore-state-write-complete";
74 os.removeObserver(
this, TOPIC);
77 ok(getSessionstoreFile().exists(), aMessage);
83 os.addObserver(observer, TOPIC,
false);
86 function actualTest() {
93 const testURL_A =
"http://example.org/";
94 let tab_A = gBrowser.addTab(testURL_A);
96 tab_A.linkedBrowser.addEventListener(
"load",
function (aEvent) {
101 let sessionStoreJS = getSessionstoreFile();
102 sessionStoreJS.remove(
false);
105 pb.privateBrowsingEnabled =
true;
106 ok(pb.privateBrowsingEnabled,
"private browsing enabled");
109 waitForFileExistence(
"file should be created after private browsing entered",
112 let startPBModeTimeStamp = getSessionstorejsModificationTime();
115 const testURL_B =
"http://test1.example.org/";
116 let tab_B = gBrowser.addTab(testURL_B);
118 tab_B.linkedBrowser.addEventListener(
"load",
function (aEvent) {
122 const testURL_C =
"http://localhost:8888/";
123 let tab_C = gBrowser.addTab(testURL_C);
125 tab_C.linkedBrowser.addEventListener(
"load",
function (aEvent) {
129 gBrowser.removeTab(tab_C);
132 gBrowser.removeTab(tab_B);
135 gBrowser.removeTab(tab_A);
138 if (
gPrefService.prefHasUserValue(
"browser.sessionstore.interval"))
139 gPrefService.clearUserPref(
"browser.sessionstore.interval");
140 gPrefService.setIntPref(
"browser.sessionstore.interval", 0);
141 let endPBModeTimeStamp = getSessionstorejsModificationTime();
144 pb.privateBrowsingEnabled =
false;
145 ok(!pb.privateBrowsingEnabled,
"private browsing disabled");
148 is(startPBModeTimeStamp, endPBModeTimeStamp,
149 "outside private browsing - sessionStore.js timestamp has not changed");
152 gPrefService.clearUserPref(
"browser.sessionstore.interval");
153 gPrefService.clearUserPref(
"browser.privatebrowsing.keep_current_session");
162 let ss =
Cc[
"@mozilla.org/browser/sessionstore;1"].
165 let sessionStoreJS = getSessionstoreFile();
166 if (sessionStoreJS.exists())
167 sessionStoreJS.remove(
false);
170 gPrefService.setIntPref(
"browser.sessionstore.interval", 0);
172 waitForFileExistence(
"file should be created after setting interval to 0",
getService(Ci.sbIFaceplateManager)
return!aWindow arguments!aWindow arguments[0]
this removeEventListener("load", this.__SS_restore, true)
_updateTextAndScrollDataForFrame aData
sbDeviceFirmwareAutoCheckForUpdate prototype observe