Backed out changeset b08b684644a1 (bug 568816) because of Ts regression on Windows
This commit is contained in:
@@ -531,7 +531,8 @@ nsBrowserContentHandler.prototype = {
|
|||||||
}
|
}
|
||||||
if (cmdLine.handleFlag("silent", false))
|
if (cmdLine.handleFlag("silent", false))
|
||||||
cmdLine.preventDefault = true;
|
cmdLine.preventDefault = true;
|
||||||
if (cmdLine.findFlag("private-toggle", false) >= 0)
|
if (cmdLine.findFlag("private-toggle", false) >= 0 &&
|
||||||
|
cmdLine.state != cmdLine.STATE_INITIAL_LAUNCH)
|
||||||
cmdLine.preventDefault = true;
|
cmdLine.preventDefault = true;
|
||||||
|
|
||||||
var searchParam = cmdLine.handleFlagWithParam("search", false);
|
var searchParam = cmdLine.handleFlagWithParam("search", false);
|
||||||
|
|||||||
@@ -165,10 +165,6 @@ BrowserGlue.prototype = {
|
|||||||
case "final-ui-startup":
|
case "final-ui-startup":
|
||||||
this._onProfileStartup();
|
this._onProfileStartup();
|
||||||
break;
|
break;
|
||||||
case "browser-delayed-startup-finished":
|
|
||||||
this._onFirstWindowLoaded();
|
|
||||||
Services.obs.removeObserver(this, "browser-delayed-startup-finished");
|
|
||||||
break;
|
|
||||||
case "sessionstore-windows-restored":
|
case "sessionstore-windows-restored":
|
||||||
this._onBrowserStartup();
|
this._onBrowserStartup();
|
||||||
break;
|
break;
|
||||||
@@ -264,7 +260,6 @@ BrowserGlue.prototype = {
|
|||||||
os.addObserver(this, "xpcom-shutdown", false);
|
os.addObserver(this, "xpcom-shutdown", false);
|
||||||
os.addObserver(this, "prefservice:after-app-defaults", false);
|
os.addObserver(this, "prefservice:after-app-defaults", false);
|
||||||
os.addObserver(this, "final-ui-startup", false);
|
os.addObserver(this, "final-ui-startup", false);
|
||||||
os.addObserver(this, "browser-delayed-startup-finished", false);
|
|
||||||
os.addObserver(this, "sessionstore-windows-restored", false);
|
os.addObserver(this, "sessionstore-windows-restored", false);
|
||||||
os.addObserver(this, "browser:purge-session-history", false);
|
os.addObserver(this, "browser:purge-session-history", false);
|
||||||
os.addObserver(this, "quit-application-requested", false);
|
os.addObserver(this, "quit-application-requested", false);
|
||||||
@@ -352,22 +347,6 @@ BrowserGlue.prototype = {
|
|||||||
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
|
Services.obs.notifyObservers(null, "browser-ui-startup-complete", "");
|
||||||
},
|
},
|
||||||
|
|
||||||
// the first browser window has finished initializing
|
|
||||||
_onFirstWindowLoaded: function BG__onFirstWindowLoaded() {
|
|
||||||
#ifdef XP_WIN
|
|
||||||
#ifndef WINCE
|
|
||||||
// For windows seven, initialize the jump list module.
|
|
||||||
const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
|
|
||||||
if (WINTASKBAR_CONTRACTID in Cc &&
|
|
||||||
Cc[WINTASKBAR_CONTRACTID].getService(Ci.nsIWinTaskbar).available) {
|
|
||||||
let temp = {};
|
|
||||||
Cu.import("resource://gre/modules/WindowsJumpLists.jsm", temp);
|
|
||||||
temp.WinTaskbarJumpList.startup();
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
},
|
|
||||||
|
|
||||||
// profile shutdown handler (contains profile cleanup routines)
|
// profile shutdown handler (contains profile cleanup routines)
|
||||||
_onProfileShutdown: function BG__onProfileShutdown() {
|
_onProfileShutdown: function BG__onProfileShutdown() {
|
||||||
#ifdef MOZ_UPDATER
|
#ifdef MOZ_UPDATER
|
||||||
@@ -429,6 +408,19 @@ BrowserGlue.prototype = {
|
|||||||
// been warned about them yet, open the plugins update page.
|
// been warned about them yet, open the plugins update page.
|
||||||
if (Services.prefs.getBoolPref(PREF_PLUGINS_NOTIFYUSER))
|
if (Services.prefs.getBoolPref(PREF_PLUGINS_NOTIFYUSER))
|
||||||
this._showPluginUpdatePage();
|
this._showPluginUpdatePage();
|
||||||
|
|
||||||
|
#ifdef XP_WIN
|
||||||
|
#ifndef WINCE
|
||||||
|
// For windows seven, initialize the jump list module.
|
||||||
|
const WINTASKBAR_CONTRACTID = "@mozilla.org/windows-taskbar;1";
|
||||||
|
if (WINTASKBAR_CONTRACTID in Cc &&
|
||||||
|
Cc[WINTASKBAR_CONTRACTID].getService(Ci.nsIWinTaskbar).available) {
|
||||||
|
let temp = {};
|
||||||
|
Cu.import("resource://gre/modules/WindowsJumpLists.jsm", temp);
|
||||||
|
temp.WinTaskbarJumpList.startup();
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
},
|
},
|
||||||
|
|
||||||
_onQuitRequest: function BG__onQuitRequest(aCancelQuit, aQuitType) {
|
_onQuitRequest: function BG__onQuitRequest(aCancelQuit, aQuitType) {
|
||||||
|
|||||||
@@ -129,9 +129,6 @@ PrivateBrowsingService.prototype = {
|
|||||||
// List of nsIXULWindows we are going to be closing during the transition
|
// List of nsIXULWindows we are going to be closing during the transition
|
||||||
_windowsToClose: [],
|
_windowsToClose: [],
|
||||||
|
|
||||||
// Whether private browsing has been turned on from the command line
|
|
||||||
_lastChangedByCommandLine: false,
|
|
||||||
|
|
||||||
// XPCOM registration
|
// XPCOM registration
|
||||||
classID: Components.ID("{c31f4883-839b-45f6-82ad-a6a9bc5ad599}"),
|
classID: Components.ID("{c31f4883-839b-45f6-82ad-a6a9bc5ad599}"),
|
||||||
|
|
||||||
@@ -234,9 +231,6 @@ PrivateBrowsingService.prototype = {
|
|||||||
// to be restored, do it now
|
// to be restored, do it now
|
||||||
if (!this._inPrivateBrowsing) {
|
if (!this._inPrivateBrowsing) {
|
||||||
this._currentStatus = STATE_WAITING_FOR_RESTORE;
|
this._currentStatus = STATE_WAITING_FOR_RESTORE;
|
||||||
if (!this._getBrowserWindow()) {
|
|
||||||
ss.init(null);
|
|
||||||
}
|
|
||||||
ss.setBrowserState(this._savedBrowserState);
|
ss.setBrowserState(this._savedBrowserState);
|
||||||
this._savedBrowserState = null;
|
this._savedBrowserState = null;
|
||||||
|
|
||||||
@@ -279,9 +273,6 @@ PrivateBrowsingService.prototype = {
|
|||||||
};
|
};
|
||||||
// Transition into private browsing mode
|
// Transition into private browsing mode
|
||||||
this._currentStatus = STATE_WAITING_FOR_RESTORE;
|
this._currentStatus = STATE_WAITING_FOR_RESTORE;
|
||||||
if (!this._getBrowserWindow()) {
|
|
||||||
ss.init(null);
|
|
||||||
}
|
|
||||||
ss.setBrowserState(JSON.stringify(privateBrowsingState));
|
ss.setBrowserState(JSON.stringify(privateBrowsingState));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -448,10 +439,6 @@ PrivateBrowsingService.prototype = {
|
|||||||
if (aSubject.findFlag("private", false) >= 0) {
|
if (aSubject.findFlag("private", false) >= 0) {
|
||||||
this.privateBrowsingEnabled = true;
|
this.privateBrowsingEnabled = true;
|
||||||
this._autoStarted = true;
|
this._autoStarted = true;
|
||||||
this._lastChangedByCommandLine = true;
|
|
||||||
}
|
|
||||||
else if (aSubject.findFlag("private-toggle", false) >= 0) {
|
|
||||||
this._lastChangedByCommandLine = true;
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case "sessionstore-browser-state-restored":
|
case "sessionstore-browser-state-restored":
|
||||||
@@ -471,7 +458,6 @@ PrivateBrowsingService.prototype = {
|
|||||||
else if (aCmdLine.handleFlag("private-toggle", false)) {
|
else if (aCmdLine.handleFlag("private-toggle", false)) {
|
||||||
this.privateBrowsingEnabled = !this.privateBrowsingEnabled;
|
this.privateBrowsingEnabled = !this.privateBrowsingEnabled;
|
||||||
this._autoStarted = false;
|
this._autoStarted = false;
|
||||||
this._lastChangedByCommandLine = true;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -548,7 +534,6 @@ PrivateBrowsingService.prototype = {
|
|||||||
} finally {
|
} finally {
|
||||||
this._windowsToClose = [];
|
this._windowsToClose = [];
|
||||||
this._notifyIfTransitionComplete();
|
this._notifyIfTransitionComplete();
|
||||||
this._lastChangedByCommandLine = false;
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@@ -559,13 +544,6 @@ PrivateBrowsingService.prototype = {
|
|||||||
return this._inPrivateBrowsing && this._autoStarted;
|
return this._inPrivateBrowsing && this._autoStarted;
|
||||||
},
|
},
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the latest transition was initiated from the command line.
|
|
||||||
*/
|
|
||||||
get lastChangedByCommandLine() {
|
|
||||||
return this._lastChangedByCommandLine;
|
|
||||||
},
|
|
||||||
|
|
||||||
removeDataFromDomain: function PBS_removeDataFromDomain(aDomain)
|
removeDataFromDomain: function PBS_removeDataFromDomain(aDomain)
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|||||||
@@ -106,15 +106,6 @@ nsPrivateBrowsingServiceWrapper::GetAutoStarted(PRBool *aAutoStarted)
|
|||||||
return mPBService->GetAutoStarted(aAutoStarted);
|
return mPBService->GetAutoStarted(aAutoStarted);
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsPrivateBrowsingServiceWrapper::GetLastChangedByCommandLine(PRBool *aReason)
|
|
||||||
{
|
|
||||||
if (!aReason)
|
|
||||||
return NS_ERROR_NULL_POINTER;
|
|
||||||
JSStackGuard guard;
|
|
||||||
return mPBService->GetLastChangedByCommandLine(aReason);
|
|
||||||
}
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
nsPrivateBrowsingServiceWrapper::RemoveDataFromDomain(const nsACString & aDomain)
|
nsPrivateBrowsingServiceWrapper::RemoveDataFromDomain(const nsACString & aDomain)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -128,8 +128,6 @@ function test() {
|
|||||||
is(browser.contentWindow.location, "about:", "The correct page has been loaded");
|
is(browser.contentWindow.location, "about:", "The correct page has been loaded");
|
||||||
|
|
||||||
simulatePrivateCommandLineArgument();
|
simulatePrivateCommandLineArgument();
|
||||||
is(pb.lastChangedByCommandLine, true,
|
|
||||||
"The status change reason should reflect the PB mode being set from the command line");
|
|
||||||
tab = gBrowser.selectedTab;
|
tab = gBrowser.selectedTab;
|
||||||
browser = gBrowser.getBrowserForTab(tab);
|
browser = gBrowser.getBrowserForTab(tab);
|
||||||
browser.addEventListener("load", function() {
|
browser.addEventListener("load", function() {
|
||||||
@@ -139,8 +137,6 @@ function test() {
|
|||||||
"about:privatebrowsing should now be loaded");
|
"about:privatebrowsing should now be loaded");
|
||||||
|
|
||||||
simulatePrivateCommandLineArgument();
|
simulatePrivateCommandLineArgument();
|
||||||
is(pb.lastChangedByCommandLine, true,
|
|
||||||
"The status change reason should reflect the PB mode being set from the command line");
|
|
||||||
tab = gBrowser.selectedTab;
|
tab = gBrowser.selectedTab;
|
||||||
browser = gBrowser.getBrowserForTab(tab);
|
browser = gBrowser.getBrowserForTab(tab);
|
||||||
browser.addEventListener("load", function() {
|
browser.addEventListener("load", function() {
|
||||||
|
|||||||
@@ -1,250 +0,0 @@
|
|||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
|
||||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is Private Browsing Tests.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Ehsan Akhgari.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Ehsan Akhgari <ehsan.akhgari@gmail.com> (Original Author)
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
||||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
// This tests the private browsing service to make sure it implements its
|
|
||||||
// documented interface correctly.
|
|
||||||
|
|
||||||
// This test should run before the rest of private browsing service unit tests,
|
|
||||||
// hence the naming used for this file.
|
|
||||||
|
|
||||||
function do_test() {
|
|
||||||
// initialization
|
|
||||||
var os = Cc["@mozilla.org/observer-service;1"].
|
|
||||||
getService(Ci.nsIObserverService);
|
|
||||||
|
|
||||||
// the contract ID should be available
|
|
||||||
do_check_true(PRIVATEBROWSING_CONTRACT_ID in Cc);
|
|
||||||
|
|
||||||
// the interface should be available
|
|
||||||
do_check_true("nsIPrivateBrowsingService" in Ci);
|
|
||||||
|
|
||||||
// it should be possible to initialize the component
|
|
||||||
try {
|
|
||||||
var pb = Cc[PRIVATEBROWSING_CONTRACT_ID].
|
|
||||||
getService(Ci.nsIPrivateBrowsingService);
|
|
||||||
} catch (ex) {
|
|
||||||
LOG("exception thrown when trying to get the service: " + ex);
|
|
||||||
do_throw("private browsing service could not be initialized");
|
|
||||||
}
|
|
||||||
|
|
||||||
// private browsing should be turned off initially
|
|
||||||
do_check_false(pb.privateBrowsingEnabled);
|
|
||||||
// private browsing not auto-started
|
|
||||||
do_check_false(pb.autoStarted);
|
|
||||||
// and the status should have never been changed
|
|
||||||
do_check_eq(pb.lastChangedByCommandLine, false);
|
|
||||||
|
|
||||||
// it should be possible to toggle its status
|
|
||||||
pb.privateBrowsingEnabled = true;
|
|
||||||
do_check_true(pb.privateBrowsingEnabled);
|
|
||||||
do_check_false(pb.autoStarted);
|
|
||||||
do_check_eq(pb.lastChangedByCommandLine, false);
|
|
||||||
pb.privateBrowsingEnabled = false;
|
|
||||||
do_check_false(pb.privateBrowsingEnabled);
|
|
||||||
do_check_false(pb.autoStarted);
|
|
||||||
do_check_eq(pb.lastChangedByCommandLine, false);
|
|
||||||
|
|
||||||
// test the private-browsing notification
|
|
||||||
var observer = {
|
|
||||||
observe: function(aSubject, aTopic, aData) {
|
|
||||||
if (aTopic == kPrivateBrowsingNotification)
|
|
||||||
this.data = aData;
|
|
||||||
},
|
|
||||||
data: null
|
|
||||||
};
|
|
||||||
os.addObserver(observer, kPrivateBrowsingNotification, false);
|
|
||||||
pb.privateBrowsingEnabled = true;
|
|
||||||
do_check_eq(observer.data, kEnter);
|
|
||||||
pb.privateBrowsingEnabled = false;
|
|
||||||
do_check_eq(observer.data, kExit);
|
|
||||||
os.removeObserver(observer, kPrivateBrowsingNotification);
|
|
||||||
|
|
||||||
// make sure that setting the private browsing mode from within an observer throws
|
|
||||||
observer = {
|
|
||||||
observe: function(aSubject, aTopic, aData) {
|
|
||||||
if (aTopic == kPrivateBrowsingNotification) {
|
|
||||||
try {
|
|
||||||
pb.privateBrowsingEnabled = (aData == kEnter);
|
|
||||||
do_throw("Setting privateBrowsingEnabled inside the " + aData +
|
|
||||||
" notification should throw");
|
|
||||||
} catch (ex) {
|
|
||||||
if (!("result" in ex && ex.result == Cr.NS_ERROR_FAILURE))
|
|
||||||
do_throw("Unexpected exception caught: " + ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
os.addObserver(observer, kPrivateBrowsingNotification, false);
|
|
||||||
pb.privateBrowsingEnabled = true;
|
|
||||||
do_check_true(pb.privateBrowsingEnabled); // the exception should not interfere with the mode change
|
|
||||||
pb.privateBrowsingEnabled = false;
|
|
||||||
do_check_false(pb.privateBrowsingEnabled); // the exception should not interfere with the mode change
|
|
||||||
os.removeObserver(observer, kPrivateBrowsingNotification);
|
|
||||||
|
|
||||||
// make sure that getting the private browsing mode from within an observer doesn't throw
|
|
||||||
observer = {
|
|
||||||
observe: function(aSubject, aTopic, aData) {
|
|
||||||
if (aTopic == kPrivateBrowsingNotification) {
|
|
||||||
try {
|
|
||||||
var dummy = pb.privateBrowsingEnabled;
|
|
||||||
if (aData == kEnter)
|
|
||||||
do_check_true(dummy);
|
|
||||||
else if (aData == kExit)
|
|
||||||
do_check_false(dummy);
|
|
||||||
} catch (ex) {
|
|
||||||
do_throw("Unexpected exception caught: " + ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
os.addObserver(observer, kPrivateBrowsingNotification, false);
|
|
||||||
pb.privateBrowsingEnabled = true;
|
|
||||||
do_check_true(pb.privateBrowsingEnabled); // just a sanity check
|
|
||||||
pb.privateBrowsingEnabled = false;
|
|
||||||
do_check_false(pb.privateBrowsingEnabled); // just a sanity check
|
|
||||||
os.removeObserver(observer, kPrivateBrowsingNotification);
|
|
||||||
|
|
||||||
// check that the private-browsing-cancel-vote notification is sent before the
|
|
||||||
// private-browsing notification
|
|
||||||
observer = {
|
|
||||||
observe: function(aSubject, aTopic, aData) {
|
|
||||||
switch (aTopic) {
|
|
||||||
case kPrivateBrowsingCancelVoteNotification:
|
|
||||||
case kPrivateBrowsingNotification:
|
|
||||||
this.notifications.push(aTopic + " " + aData);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
notifications: []
|
|
||||||
};
|
|
||||||
os.addObserver(observer, kPrivateBrowsingCancelVoteNotification, false);
|
|
||||||
os.addObserver(observer, kPrivateBrowsingNotification, false);
|
|
||||||
pb.privateBrowsingEnabled = true;
|
|
||||||
do_check_true(pb.privateBrowsingEnabled); // just a sanity check
|
|
||||||
pb.privateBrowsingEnabled = false;
|
|
||||||
do_check_false(pb.privateBrowsingEnabled); // just a sanity check
|
|
||||||
os.removeObserver(observer, kPrivateBrowsingNotification);
|
|
||||||
os.removeObserver(observer, kPrivateBrowsingCancelVoteNotification);
|
|
||||||
var reference_order = [
|
|
||||||
kPrivateBrowsingCancelVoteNotification + " " + kEnter,
|
|
||||||
kPrivateBrowsingNotification + " " + kEnter,
|
|
||||||
kPrivateBrowsingCancelVoteNotification + " " + kExit,
|
|
||||||
kPrivateBrowsingNotification + " " + kExit
|
|
||||||
];
|
|
||||||
do_check_eq(observer.notifications.join(","), reference_order.join(","));
|
|
||||||
|
|
||||||
// make sure that the private-browsing-cancel-vote notification can be used
|
|
||||||
// to cancel the mode switch
|
|
||||||
observer = {
|
|
||||||
observe: function(aSubject, aTopic, aData) {
|
|
||||||
switch (aTopic) {
|
|
||||||
case kPrivateBrowsingCancelVoteNotification:
|
|
||||||
do_check_neq(aSubject, null);
|
|
||||||
try {
|
|
||||||
aSubject.QueryInterface(Ci.nsISupportsPRBool);
|
|
||||||
} catch (ex) {
|
|
||||||
do_throw("aSubject in " + kPrivateBrowsingCancelVoteNotification +
|
|
||||||
" should implement nsISupportsPRBool");
|
|
||||||
}
|
|
||||||
do_check_false(aSubject.data);
|
|
||||||
aSubject.data = true; // cancel the mode switch
|
|
||||||
|
|
||||||
// fall through
|
|
||||||
case kPrivateBrowsingNotification:
|
|
||||||
this.notifications.push(aTopic + " " + aData);
|
|
||||||
}
|
|
||||||
},
|
|
||||||
nextPhase: function() {
|
|
||||||
this.notifications.push("enter phase " + (++this._phase));
|
|
||||||
},
|
|
||||||
notifications: [],
|
|
||||||
_phase: 0
|
|
||||||
};
|
|
||||||
os.addObserver(observer, kPrivateBrowsingCancelVoteNotification, false);
|
|
||||||
os.addObserver(observer, kPrivateBrowsingNotification, false);
|
|
||||||
pb.privateBrowsingEnabled = true;
|
|
||||||
do_check_false(pb.privateBrowsingEnabled); // should have been canceled
|
|
||||||
// temporarily disable the observer
|
|
||||||
os.removeObserver(observer, kPrivateBrowsingCancelVoteNotification);
|
|
||||||
observer.nextPhase();
|
|
||||||
pb.privateBrowsingEnabled = true; // this time, should enter successfully
|
|
||||||
do_check_true(pb.privateBrowsingEnabled); // should have been canceled
|
|
||||||
// re-enable the observer
|
|
||||||
os.addObserver(observer, kPrivateBrowsingCancelVoteNotification, false);
|
|
||||||
pb.privateBrowsingEnabled = false;
|
|
||||||
do_check_true(pb.privateBrowsingEnabled); // should have been canceled
|
|
||||||
os.removeObserver(observer, kPrivateBrowsingCancelVoteNotification);
|
|
||||||
observer.nextPhase();
|
|
||||||
pb.privateBrowsingEnabled = false; // this time, should exit successfully
|
|
||||||
do_check_false(pb.privateBrowsingEnabled);
|
|
||||||
os.removeObserver(observer, kPrivateBrowsingNotification);
|
|
||||||
reference_order = [
|
|
||||||
kPrivateBrowsingCancelVoteNotification + " " + kEnter,
|
|
||||||
"enter phase 1",
|
|
||||||
kPrivateBrowsingNotification + " " + kEnter,
|
|
||||||
kPrivateBrowsingCancelVoteNotification + " " + kExit,
|
|
||||||
"enter phase 2",
|
|
||||||
kPrivateBrowsingNotification + " " + kExit,
|
|
||||||
];
|
|
||||||
do_check_eq(observer.notifications.join(","), reference_order.join(","));
|
|
||||||
|
|
||||||
// make sure that the private browsing transition complete notification is
|
|
||||||
// raised correctly.
|
|
||||||
observer = {
|
|
||||||
observe: function(aSubject, aTopic, aData) {
|
|
||||||
this.notifications.push(aTopic + " " + aData);
|
|
||||||
},
|
|
||||||
notifications: []
|
|
||||||
};
|
|
||||||
os.addObserver(observer, kPrivateBrowsingNotification, false);
|
|
||||||
os.addObserver(observer, kPrivateBrowsingTransitionCompleteNotification, false);
|
|
||||||
pb.privateBrowsingEnabled = true;
|
|
||||||
pb.privateBrowsingEnabled = false;
|
|
||||||
os.removeObserver(observer, kPrivateBrowsingNotification);
|
|
||||||
os.removeObserver(observer, kPrivateBrowsingTransitionCompleteNotification);
|
|
||||||
reference_order = [
|
|
||||||
kPrivateBrowsingNotification + " " + kEnter,
|
|
||||||
kPrivateBrowsingTransitionCompleteNotification + " ",
|
|
||||||
kPrivateBrowsingNotification + " " + kExit,
|
|
||||||
kPrivateBrowsingTransitionCompleteNotification + " ",
|
|
||||||
];
|
|
||||||
do_check_eq(observer.notifications.join(","), reference_order.join(","));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Support running tests on both the service itself and its wrapper
|
|
||||||
function run_test() {
|
|
||||||
run_test_on_all_services();
|
|
||||||
}
|
|
||||||
@@ -118,6 +118,4 @@ function do_test() {
|
|||||||
do_check_true(pb.privateBrowsingEnabled);
|
do_check_true(pb.privateBrowsingEnabled);
|
||||||
// and should appear as auto-started!
|
// and should appear as auto-started!
|
||||||
do_check_true(pb.autoStarted);
|
do_check_true(pb.autoStarted);
|
||||||
// and should be coming from the command line!
|
|
||||||
do_check_eq(pb.lastChangedByCommandLine, true);
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -38,8 +38,209 @@
|
|||||||
// This tests the private browsing service to make sure it implements its
|
// This tests the private browsing service to make sure it implements its
|
||||||
// documented interface correctly.
|
// documented interface correctly.
|
||||||
|
|
||||||
function run_test() {
|
// This test should run before the rest of private browsing service unit tests,
|
||||||
PRIVATEBROWSING_CONTRACT_ID = "@mozilla.org/privatebrowsing;1";
|
// hence the naming used for this file.
|
||||||
load("do_test_0-privatebrowsing.js");
|
|
||||||
do_test();
|
function run_test_on_service() {
|
||||||
|
// initialization
|
||||||
|
var os = Cc["@mozilla.org/observer-service;1"].
|
||||||
|
getService(Ci.nsIObserverService);
|
||||||
|
|
||||||
|
// the contract ID should be available
|
||||||
|
do_check_true(PRIVATEBROWSING_CONTRACT_ID in Cc);
|
||||||
|
|
||||||
|
// the interface should be available
|
||||||
|
do_check_true("nsIPrivateBrowsingService" in Ci);
|
||||||
|
|
||||||
|
// it should be possible to initialize the component
|
||||||
|
try {
|
||||||
|
var pb = Cc[PRIVATEBROWSING_CONTRACT_ID].
|
||||||
|
getService(Ci.nsIPrivateBrowsingService);
|
||||||
|
} catch (ex) {
|
||||||
|
LOG("exception thrown when trying to get the service: " + ex);
|
||||||
|
do_throw("private browsing service could not be initialized");
|
||||||
|
}
|
||||||
|
|
||||||
|
// private browsing should be turned off initially
|
||||||
|
do_check_false(pb.privateBrowsingEnabled);
|
||||||
|
// private browsing not auto-started
|
||||||
|
do_check_false(pb.autoStarted);
|
||||||
|
|
||||||
|
// it should be possible to toggle its status
|
||||||
|
pb.privateBrowsingEnabled = true;
|
||||||
|
do_check_true(pb.privateBrowsingEnabled);
|
||||||
|
do_check_false(pb.autoStarted);
|
||||||
|
pb.privateBrowsingEnabled = false;
|
||||||
|
do_check_false(pb.privateBrowsingEnabled);
|
||||||
|
do_check_false(pb.autoStarted);
|
||||||
|
|
||||||
|
// test the private-browsing notification
|
||||||
|
var observer = {
|
||||||
|
observe: function(aSubject, aTopic, aData) {
|
||||||
|
if (aTopic == kPrivateBrowsingNotification)
|
||||||
|
this.data = aData;
|
||||||
|
},
|
||||||
|
data: null
|
||||||
|
};
|
||||||
|
os.addObserver(observer, kPrivateBrowsingNotification, false);
|
||||||
|
pb.privateBrowsingEnabled = true;
|
||||||
|
do_check_eq(observer.data, kEnter);
|
||||||
|
pb.privateBrowsingEnabled = false;
|
||||||
|
do_check_eq(observer.data, kExit);
|
||||||
|
os.removeObserver(observer, kPrivateBrowsingNotification);
|
||||||
|
|
||||||
|
// make sure that setting the private browsing mode from within an observer throws
|
||||||
|
observer = {
|
||||||
|
observe: function(aSubject, aTopic, aData) {
|
||||||
|
if (aTopic == kPrivateBrowsingNotification) {
|
||||||
|
try {
|
||||||
|
pb.privateBrowsingEnabled = (aData == kEnter);
|
||||||
|
do_throw("Setting privateBrowsingEnabled inside the " + aData +
|
||||||
|
" notification should throw");
|
||||||
|
} catch (ex) {
|
||||||
|
if (!("result" in ex && ex.result == Cr.NS_ERROR_FAILURE))
|
||||||
|
do_throw("Unexpected exception caught: " + ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
os.addObserver(observer, kPrivateBrowsingNotification, false);
|
||||||
|
pb.privateBrowsingEnabled = true;
|
||||||
|
do_check_true(pb.privateBrowsingEnabled); // the exception should not interfere with the mode change
|
||||||
|
pb.privateBrowsingEnabled = false;
|
||||||
|
do_check_false(pb.privateBrowsingEnabled); // the exception should not interfere with the mode change
|
||||||
|
os.removeObserver(observer, kPrivateBrowsingNotification);
|
||||||
|
|
||||||
|
// make sure that getting the private browsing mode from within an observer doesn't throw
|
||||||
|
observer = {
|
||||||
|
observe: function(aSubject, aTopic, aData) {
|
||||||
|
if (aTopic == kPrivateBrowsingNotification) {
|
||||||
|
try {
|
||||||
|
var dummy = pb.privateBrowsingEnabled;
|
||||||
|
if (aData == kEnter)
|
||||||
|
do_check_true(dummy);
|
||||||
|
else if (aData == kExit)
|
||||||
|
do_check_false(dummy);
|
||||||
|
} catch (ex) {
|
||||||
|
do_throw("Unexpected exception caught: " + ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
os.addObserver(observer, kPrivateBrowsingNotification, false);
|
||||||
|
pb.privateBrowsingEnabled = true;
|
||||||
|
do_check_true(pb.privateBrowsingEnabled); // just a sanity check
|
||||||
|
pb.privateBrowsingEnabled = false;
|
||||||
|
do_check_false(pb.privateBrowsingEnabled); // just a sanity check
|
||||||
|
os.removeObserver(observer, kPrivateBrowsingNotification);
|
||||||
|
|
||||||
|
// check that the private-browsing-cancel-vote notification is sent before the
|
||||||
|
// private-browsing notification
|
||||||
|
observer = {
|
||||||
|
observe: function(aSubject, aTopic, aData) {
|
||||||
|
switch (aTopic) {
|
||||||
|
case kPrivateBrowsingCancelVoteNotification:
|
||||||
|
case kPrivateBrowsingNotification:
|
||||||
|
this.notifications.push(aTopic + " " + aData);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
notifications: []
|
||||||
|
};
|
||||||
|
os.addObserver(observer, kPrivateBrowsingCancelVoteNotification, false);
|
||||||
|
os.addObserver(observer, kPrivateBrowsingNotification, false);
|
||||||
|
pb.privateBrowsingEnabled = true;
|
||||||
|
do_check_true(pb.privateBrowsingEnabled); // just a sanity check
|
||||||
|
pb.privateBrowsingEnabled = false;
|
||||||
|
do_check_false(pb.privateBrowsingEnabled); // just a sanity check
|
||||||
|
os.removeObserver(observer, kPrivateBrowsingNotification);
|
||||||
|
os.removeObserver(observer, kPrivateBrowsingCancelVoteNotification);
|
||||||
|
var reference_order = [
|
||||||
|
kPrivateBrowsingCancelVoteNotification + " " + kEnter,
|
||||||
|
kPrivateBrowsingNotification + " " + kEnter,
|
||||||
|
kPrivateBrowsingCancelVoteNotification + " " + kExit,
|
||||||
|
kPrivateBrowsingNotification + " " + kExit
|
||||||
|
];
|
||||||
|
do_check_eq(observer.notifications.join(","), reference_order.join(","));
|
||||||
|
|
||||||
|
// make sure that the private-browsing-cancel-vote notification can be used
|
||||||
|
// to cancel the mode switch
|
||||||
|
observer = {
|
||||||
|
observe: function(aSubject, aTopic, aData) {
|
||||||
|
switch (aTopic) {
|
||||||
|
case kPrivateBrowsingCancelVoteNotification:
|
||||||
|
do_check_neq(aSubject, null);
|
||||||
|
try {
|
||||||
|
aSubject.QueryInterface(Ci.nsISupportsPRBool);
|
||||||
|
} catch (ex) {
|
||||||
|
do_throw("aSubject in " + kPrivateBrowsingCancelVoteNotification +
|
||||||
|
" should implement nsISupportsPRBool");
|
||||||
|
}
|
||||||
|
do_check_false(aSubject.data);
|
||||||
|
aSubject.data = true; // cancel the mode switch
|
||||||
|
|
||||||
|
// fall through
|
||||||
|
case kPrivateBrowsingNotification:
|
||||||
|
this.notifications.push(aTopic + " " + aData);
|
||||||
|
}
|
||||||
|
},
|
||||||
|
nextPhase: function() {
|
||||||
|
this.notifications.push("enter phase " + (++this._phase));
|
||||||
|
},
|
||||||
|
notifications: [],
|
||||||
|
_phase: 0
|
||||||
|
};
|
||||||
|
os.addObserver(observer, kPrivateBrowsingCancelVoteNotification, false);
|
||||||
|
os.addObserver(observer, kPrivateBrowsingNotification, false);
|
||||||
|
pb.privateBrowsingEnabled = true;
|
||||||
|
do_check_false(pb.privateBrowsingEnabled); // should have been canceled
|
||||||
|
// temporarily disable the observer
|
||||||
|
os.removeObserver(observer, kPrivateBrowsingCancelVoteNotification);
|
||||||
|
observer.nextPhase();
|
||||||
|
pb.privateBrowsingEnabled = true; // this time, should enter successfully
|
||||||
|
do_check_true(pb.privateBrowsingEnabled); // should have been canceled
|
||||||
|
// re-enable the observer
|
||||||
|
os.addObserver(observer, kPrivateBrowsingCancelVoteNotification, false);
|
||||||
|
pb.privateBrowsingEnabled = false;
|
||||||
|
do_check_true(pb.privateBrowsingEnabled); // should have been canceled
|
||||||
|
os.removeObserver(observer, kPrivateBrowsingCancelVoteNotification);
|
||||||
|
observer.nextPhase();
|
||||||
|
pb.privateBrowsingEnabled = false; // this time, should exit successfully
|
||||||
|
do_check_false(pb.privateBrowsingEnabled);
|
||||||
|
os.removeObserver(observer, kPrivateBrowsingNotification);
|
||||||
|
reference_order = [
|
||||||
|
kPrivateBrowsingCancelVoteNotification + " " + kEnter,
|
||||||
|
"enter phase 1",
|
||||||
|
kPrivateBrowsingNotification + " " + kEnter,
|
||||||
|
kPrivateBrowsingCancelVoteNotification + " " + kExit,
|
||||||
|
"enter phase 2",
|
||||||
|
kPrivateBrowsingNotification + " " + kExit,
|
||||||
|
];
|
||||||
|
do_check_eq(observer.notifications.join(","), reference_order.join(","));
|
||||||
|
|
||||||
|
// make sure that the private browsing transition complete notification is
|
||||||
|
// raised correctly.
|
||||||
|
observer = {
|
||||||
|
observe: function(aSubject, aTopic, aData) {
|
||||||
|
this.notifications.push(aTopic + " " + aData);
|
||||||
|
},
|
||||||
|
notifications: []
|
||||||
|
};
|
||||||
|
os.addObserver(observer, kPrivateBrowsingNotification, false);
|
||||||
|
os.addObserver(observer, kPrivateBrowsingTransitionCompleteNotification, false);
|
||||||
|
pb.privateBrowsingEnabled = true;
|
||||||
|
pb.privateBrowsingEnabled = false;
|
||||||
|
os.removeObserver(observer, kPrivateBrowsingNotification);
|
||||||
|
os.removeObserver(observer, kPrivateBrowsingTransitionCompleteNotification);
|
||||||
|
reference_order = [
|
||||||
|
kPrivateBrowsingNotification + " " + kEnter,
|
||||||
|
kPrivateBrowsingTransitionCompleteNotification + " ",
|
||||||
|
kPrivateBrowsingNotification + " " + kExit,
|
||||||
|
kPrivateBrowsingTransitionCompleteNotification + " ",
|
||||||
|
];
|
||||||
|
do_check_eq(observer.notifications.join(","), reference_order.join(","));
|
||||||
|
}
|
||||||
|
|
||||||
|
// Support running tests on both the service itself and its wrapper
|
||||||
|
function run_test() {
|
||||||
|
run_test_on_all_services();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,45 +0,0 @@
|
|||||||
/* ***** BEGIN LICENSE BLOCK *****
|
|
||||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
||||||
*
|
|
||||||
* The contents of this file are subject to the Mozilla Public License Version
|
|
||||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
||||||
* the License. You may obtain a copy of the License at
|
|
||||||
* http://www.mozilla.org/MPL/
|
|
||||||
*
|
|
||||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
||||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
||||||
* for the specific language governing rights and limitations under the
|
|
||||||
* License.
|
|
||||||
*
|
|
||||||
* The Original Code is Private Browsing Tests.
|
|
||||||
*
|
|
||||||
* The Initial Developer of the Original Code is
|
|
||||||
* Ehsan Akhgari.
|
|
||||||
* Portions created by the Initial Developer are Copyright (C) 2008
|
|
||||||
* the Initial Developer. All Rights Reserved.
|
|
||||||
*
|
|
||||||
* Contributor(s):
|
|
||||||
* Ehsan Akhgari <ehsan.akhgari@gmail.com> (Original Author)
|
|
||||||
*
|
|
||||||
* Alternatively, the contents of this file may be used under the terms of
|
|
||||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
||||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
||||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
||||||
* of those above. If you wish to allow use of your version of this file only
|
|
||||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
||||||
* use your version of this file under the terms of the MPL, indicate your
|
|
||||||
* decision by deleting the provisions above and replace them with the notice
|
|
||||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
||||||
* the provisions above, a recipient may use your version of this file under
|
|
||||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
||||||
*
|
|
||||||
* ***** END LICENSE BLOCK ***** */
|
|
||||||
|
|
||||||
// This tests the private browsing service to make sure it implements its
|
|
||||||
// documented interface correctly.
|
|
||||||
|
|
||||||
function run_test() {
|
|
||||||
PRIVATEBROWSING_CONTRACT_ID = "@mozilla.org/privatebrowsing-wrapper;1";
|
|
||||||
load("do_test_0-privatebrowsing.js");
|
|
||||||
do_test();
|
|
||||||
}
|
|
||||||
@@ -101,7 +101,7 @@ SessionStartup.prototype = {
|
|||||||
// do not need to initialize anything in auto-started private browsing sessions
|
// do not need to initialize anything in auto-started private browsing sessions
|
||||||
let pbs = Cc["@mozilla.org/privatebrowsing;1"].
|
let pbs = Cc["@mozilla.org/privatebrowsing;1"].
|
||||||
getService(Ci.nsIPrivateBrowsingService);
|
getService(Ci.nsIPrivateBrowsingService);
|
||||||
if (pbs.autoStarted || pbs.lastChangedByCommandLine)
|
if (pbs.autoStarted)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
let prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
let prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
||||||
@@ -237,12 +237,7 @@ SessionStartup.prototype = {
|
|||||||
aWindow.arguments[0] == defaultArgs)
|
aWindow.arguments[0] == defaultArgs)
|
||||||
aWindow.arguments[0] = null;
|
aWindow.arguments[0] = null;
|
||||||
|
|
||||||
try {
|
Services.obs.removeObserver(this, "domwindowopened");
|
||||||
Services.obs.removeObserver(this, "domwindowopened");
|
|
||||||
} catch (e) {
|
|
||||||
// This might throw if we're removing the observer multiple times,
|
|
||||||
// but this is safe to ignore.
|
|
||||||
}
|
|
||||||
},
|
},
|
||||||
|
|
||||||
/* ........ Public API ................*/
|
/* ........ Public API ................*/
|
||||||
|
|||||||
@@ -214,9 +214,6 @@ SessionStoreService.prototype = {
|
|||||||
// The state from the previous session (after restoring pinned tabs)
|
// The state from the previous session (after restoring pinned tabs)
|
||||||
_lastSessionState: null,
|
_lastSessionState: null,
|
||||||
|
|
||||||
// Whether we've been initialized
|
|
||||||
_initialized: false,
|
|
||||||
|
|
||||||
/* ........ Public Getters .............. */
|
/* ........ Public Getters .............. */
|
||||||
|
|
||||||
get canRestoreLastSession() {
|
get canRestoreLastSession() {
|
||||||
@@ -236,7 +233,15 @@ SessionStoreService.prototype = {
|
|||||||
/**
|
/**
|
||||||
* Initialize the component
|
* Initialize the component
|
||||||
*/
|
*/
|
||||||
initService: function() {
|
init: function sss_init(aWindow) {
|
||||||
|
if (!aWindow || this._loadState == STATE_RUNNING) {
|
||||||
|
// make sure that all browser windows which try to initialize
|
||||||
|
// SessionStore are really tracked by it
|
||||||
|
if (aWindow && (!aWindow.__SSi || !this._windows[aWindow.__SSi]))
|
||||||
|
this.onLoad(aWindow);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._prefBranch = Services.prefs.getBranch("browser.");
|
this._prefBranch = Services.prefs.getBranch("browser.");
|
||||||
this._prefBranch.QueryInterface(Ci.nsIPrefBranch2);
|
this._prefBranch.QueryInterface(Ci.nsIPrefBranch2);
|
||||||
|
|
||||||
@@ -348,35 +353,7 @@ SessionStoreService.prototype = {
|
|||||||
if (this._loadState != STATE_QUITTING &&
|
if (this._loadState != STATE_QUITTING &&
|
||||||
this._prefBranch.getBoolPref("sessionstore.resume_session_once"))
|
this._prefBranch.getBoolPref("sessionstore.resume_session_once"))
|
||||||
this._prefBranch.setBoolPref("sessionstore.resume_session_once", false);
|
this._prefBranch.setBoolPref("sessionstore.resume_session_once", false);
|
||||||
|
|
||||||
this._initialized = true;
|
|
||||||
},
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Start tracking a window.
|
|
||||||
* Important note: despite its name, this function doesn't initialize
|
|
||||||
* the component!
|
|
||||||
*/
|
|
||||||
init: function sss_init(aWindow) {
|
|
||||||
if (!aWindow || this._loadState == STATE_RUNNING) {
|
|
||||||
// make sure that all browser windows which try to initialize
|
|
||||||
// SessionStore are really tracked by it
|
|
||||||
if (aWindow && (!aWindow.__SSi || !this._windows[aWindow.__SSi]))
|
|
||||||
this.onLoad(aWindow);
|
|
||||||
// If init is being called with a null window, it's possible that we
|
|
||||||
// just want to tell sessionstore that a session is live (as is the case
|
|
||||||
// with starting Firefox with -private, for example; see bug 568816),
|
|
||||||
// so we should mark the load state as running to make sure that
|
|
||||||
// things like setBrowserState calls will succeed in restoring the session.
|
|
||||||
if (!aWindow && this._loadState == STATE_STOPPED)
|
|
||||||
this._loadState = STATE_RUNNING;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Initialize the service if needed.
|
|
||||||
if (!this._initialized)
|
|
||||||
this.initService();
|
|
||||||
|
|
||||||
// As this is called at delayedStartup, restoration must be initiated here
|
// As this is called at delayedStartup, restoration must be initiated here
|
||||||
this.onLoad(aWindow);
|
this.onLoad(aWindow);
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -150,7 +150,7 @@ var tasksCfg = [
|
|||||||
close: false, // no point
|
close: false, // no point
|
||||||
},
|
},
|
||||||
|
|
||||||
// Toggle the Private Browsing mode
|
// Privacy mode
|
||||||
{
|
{
|
||||||
get title() {
|
get title() {
|
||||||
if (_privateBrowsingSvc.privateBrowsingEnabled)
|
if (_privateBrowsingSvc.privateBrowsingEnabled)
|
||||||
@@ -205,10 +205,6 @@ var WinTaskbarJumpList =
|
|||||||
|
|
||||||
// jump list refresh timer
|
// jump list refresh timer
|
||||||
this._initTimer();
|
this._initTimer();
|
||||||
|
|
||||||
// Do an immediate update
|
|
||||||
Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer)
|
|
||||||
.initWithCallback(this, 0, Ci.nsITimer.TYPE_ONE_SHOT);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
update: function WTBJL_update() {
|
update: function WTBJL_update() {
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ function run_test() {
|
|||||||
|
|
||||||
// if private browsing is available
|
// if private browsing is available
|
||||||
if (pb) {
|
if (pb) {
|
||||||
prefs.setBoolPref("browser.privatebrowsing.keep_current_session", true);
|
|
||||||
|
|
||||||
// enter private browsing mode
|
// enter private browsing mode
|
||||||
pb.privateBrowsingEnabled = true;
|
pb.privateBrowsingEnabled = true;
|
||||||
|
|
||||||
@@ -46,8 +44,6 @@ function run_test() {
|
|||||||
// add a test cookie
|
// add a test cookie
|
||||||
cs.setCookieString(uri, null, "foobaz=bar", null);
|
cs.setCookieString(uri, null, "foobaz=bar", null);
|
||||||
do_check_eq(cs.countCookiesFromHost("foo.bar"), 2);
|
do_check_eq(cs.countCookiesFromHost("foo.bar"), 2);
|
||||||
|
|
||||||
prefs.clearUserPref("browser.privatebrowsing.keep_current_session");
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -37,7 +37,7 @@
|
|||||||
|
|
||||||
#include "nsISupports.idl"
|
#include "nsISupports.idl"
|
||||||
|
|
||||||
[scriptable, uuid(4b731983-9542-49f4-b16b-de68ad1c2068)]
|
[scriptable, uuid(49d6f133-80c0-48c7-876d-0b70bbfd0289)]
|
||||||
interface nsIPrivateBrowsingService : nsISupports
|
interface nsIPrivateBrowsingService : nsISupports
|
||||||
{
|
{
|
||||||
// When read, determines whether the private browsing mode is currently
|
// When read, determines whether the private browsing mode is currently
|
||||||
@@ -52,10 +52,6 @@ interface nsIPrivateBrowsingService : nsISupports
|
|||||||
// This value will never be true if privateBrowsingEnabled is false.
|
// This value will never be true if privateBrowsingEnabled is false.
|
||||||
readonly attribute boolean autoStarted;
|
readonly attribute boolean autoStarted;
|
||||||
|
|
||||||
// Determine whether the last private browsing transition was performed through
|
|
||||||
// the command line (using either the -private or -private-toggle switches).
|
|
||||||
readonly attribute boolean lastChangedByCommandLine;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Removes all data stored for a given domain. This includes all data for
|
* Removes all data stored for a given domain. This includes all data for
|
||||||
* subdomains of the given domain.
|
* subdomains of the given domain.
|
||||||
|
|||||||
Reference in New Issue
Block a user