Bug 462041 - Refresh the Privacy preference pane; r=mconnor
|
@ -1218,7 +1218,7 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
|
|||
focusElement(content);
|
||||
|
||||
if (gURLBar)
|
||||
gURLBar.setAttribute("emptytext", gURLBar.getAttribute("delayedemptytext"));
|
||||
gURLBar.setAttribute("emptytext", gURLBarEmptyText.value);
|
||||
|
||||
gNavToolbox.customizeDone = BrowserToolboxCustomizeDone;
|
||||
gNavToolbox.customizeChange = BrowserToolboxCustomizeChange;
|
||||
|
@ -1233,6 +1233,8 @@ function delayedStartup(isLoadingBlank, mustLoadSidebar) {
|
|||
|
||||
gPrefService.addObserver(gHomeButton.prefDomain, gHomeButton, false);
|
||||
|
||||
gPrefService.addObserver(gURLBarEmptyText.domain, gURLBarEmptyText, false);
|
||||
|
||||
var homeButton = document.getElementById("home-button");
|
||||
gHomeButton.updateTooltip(homeButton);
|
||||
gHomeButton.updatePersonalToolbarStyle(homeButton);
|
||||
|
@ -1401,6 +1403,7 @@ function BrowserShutdown()
|
|||
gPrefService.removeObserver(gAutoHideTabbarPrefListener.domain,
|
||||
gAutoHideTabbarPrefListener);
|
||||
gPrefService.removeObserver(gHomeButton.prefDomain, gHomeButton);
|
||||
gPrefService.removeObserver(gURLBarEmptyText.domain, gURLBarEmptyText);
|
||||
} catch (ex) {
|
||||
Components.utils.reportError(ex);
|
||||
}
|
||||
|
@ -3290,7 +3293,7 @@ function BrowserToolboxCustomizeDone(aToolboxChanged) {
|
|||
if (aToolboxChanged) {
|
||||
gURLBar = document.getElementById("urlbar");
|
||||
if (gURLBar)
|
||||
gURLBar.emptyText = gURLBar.getAttribute("delayedemptytext");
|
||||
gURLBar.emptyText = gURLBarEmptyText.value;
|
||||
|
||||
gProxyFavIcon = document.getElementById("page-proxy-favicon");
|
||||
gHomeButton.updateTooltip();
|
||||
|
@ -6952,9 +6955,8 @@ let gPrivateBrowsingUI = {
|
|||
|
||||
if (this._privateBrowsingAutoStarted) {
|
||||
// Disable the menu item in auto-start mode
|
||||
let pbMenuItem = document.getElementById("privateBrowsingItem");
|
||||
if (pbMenuItem)
|
||||
pbMenuItem.setAttribute("disabled", "true");
|
||||
document.getElementById("privateBrowsingItem")
|
||||
.setAttribute("disabled", "true");
|
||||
document.getElementById("Tools:PrivateBrowsing")
|
||||
.setAttribute("disabled", "true");
|
||||
}
|
||||
|
@ -6994,15 +6996,19 @@ let gPrivateBrowsingUI = {
|
|||
docElement.setAttribute("browsingmode", "normal");
|
||||
}
|
||||
|
||||
// Enable the menu item in after exiting the auto-start mode
|
||||
document.getElementById("privateBrowsingItem")
|
||||
.removeAttribute("disabled");
|
||||
document.getElementById("Tools:PrivateBrowsing")
|
||||
.removeAttribute("disabled");
|
||||
|
||||
this._privateBrowsingAutoStarted = false;
|
||||
},
|
||||
|
||||
_setPBMenuTitle: function PBUI__setPBMenuTitle(aMode) {
|
||||
let pbMenuItem = document.getElementById("privateBrowsingItem");
|
||||
if (pbMenuItem) {
|
||||
pbMenuItem.setAttribute("label", pbMenuItem.getAttribute(aMode + "label"));
|
||||
pbMenuItem.setAttribute("accesskey", pbMenuItem.getAttribute(aMode + "accesskey"));
|
||||
}
|
||||
pbMenuItem.setAttribute("label", pbMenuItem.getAttribute(aMode + "label"));
|
||||
pbMenuItem.setAttribute("accesskey", pbMenuItem.getAttribute(aMode + "accesskey"));
|
||||
},
|
||||
|
||||
toggleMode: function PBUI_toggleMode() {
|
||||
|
@ -7019,3 +7025,37 @@ let gPrivateBrowsingUI = {
|
|||
return this._privateBrowsingService.privateBrowsingEnabled;
|
||||
}
|
||||
};
|
||||
|
||||
let gURLBarEmptyText = {
|
||||
domain: "browser.urlbar.",
|
||||
|
||||
observe: function UBET_observe(aSubject, aTopic, aPrefName) {
|
||||
if (aTopic == "nsPref:changed") {
|
||||
switch (aPrefName) {
|
||||
case "browser.urlbar.autocomplete.enabled":
|
||||
case "browser.urlbar.default.behavior":
|
||||
gURLBar.emptyText = this.value;
|
||||
break;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
get value UBET_get_value() {
|
||||
let type = "none";
|
||||
if (gPrefService.getBoolPref("browser.urlbar.autocomplete.enabled")) {
|
||||
// Bottom 2 bits of default.behavior specify history/bookmark
|
||||
switch (gPrefService.getIntPref("browser.urlbar.default.behavior") & 3) {
|
||||
case 0:
|
||||
type = "bookmarkhistory";
|
||||
break;
|
||||
case 1:
|
||||
type = "history";
|
||||
break;
|
||||
case 2:
|
||||
type = "bookmark";
|
||||
break;
|
||||
}
|
||||
}
|
||||
return gURLBar.getAttribute(type + "emptytext");
|
||||
}
|
||||
};
|
||||
|
|
|
@ -350,7 +350,10 @@
|
|||
<toolbaritem id="urlbar-container" align="center" flex="400" persist="width"
|
||||
title="&locationItem.title;" class="chromeclass-location">
|
||||
<textbox id="urlbar" flex="1"
|
||||
delayedemptytext="&urlbar.emptyText;"
|
||||
bookmarkhistoryemptytext="&urlbar.bookmarkhistory.emptyText;"
|
||||
bookmarkemptytext="&urlbar.bookmark.emptyText;"
|
||||
historyemptytext="&urlbar.history.emptyText;"
|
||||
noneemptytext="&urlbar.none.emptyText;"
|
||||
chromedir="&locale.dir;"
|
||||
type="autocomplete"
|
||||
autocompletesearch="history"
|
||||
|
|
|
@ -41,8 +41,15 @@
|
|||
# ***** END LICENSE BLOCK *****
|
||||
*/
|
||||
|
||||
Components.utils.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
|
||||
var gPrivacyPane = {
|
||||
|
||||
/**
|
||||
* Whether the use has selected the auto-start private browsing mode in the UI.
|
||||
*/
|
||||
_autoStartPrivateBrowsing: false,
|
||||
|
||||
/**
|
||||
* Sets up the UI for the number of days of history to keep, and updates the
|
||||
* label of the "Clear Now..." button.
|
||||
|
@ -51,6 +58,221 @@ var gPrivacyPane = {
|
|||
{
|
||||
this._updateHistoryDaysUI();
|
||||
this._updateSanitizeSettingsButton();
|
||||
this.initializeHistoryMode();
|
||||
this.updateHistoryModePane();
|
||||
this.updatePrivacyMicroControls();
|
||||
this.initAutoStartPrivateBrowsingObserver();
|
||||
},
|
||||
|
||||
// HISTORY MODE
|
||||
|
||||
/**
|
||||
* The list of preferences which affect the initial history mode settings.
|
||||
* If the auto start private browsing mode pref is active, the initial
|
||||
* history mode would be set to "Don't remember anything".
|
||||
* If all of these preferences have their default values, and the auto-start
|
||||
* private browsing mode is not active, the initial history mode would be
|
||||
* set to "Remember everything".
|
||||
* Otherwise, the initial history mode would be set to "Custom".
|
||||
*
|
||||
* Extensions adding their own preferences can append their IDs to this array if needed.
|
||||
*/
|
||||
prefsForDefault: [
|
||||
"browser.history_expire_days",
|
||||
"browser.history_expire_days_min",
|
||||
"browser.download.manager.retention",
|
||||
"browser.formfill.enable",
|
||||
"network.cookie.cookieBehavior",
|
||||
"network.cookie.lifetimePolicy",
|
||||
"privacy.sanitize.sanitizeOnShutdown"
|
||||
],
|
||||
|
||||
/**
|
||||
* The list of control IDs which are dependent on the auto-start private
|
||||
* browsing setting, such that in "Custom" mode they would be disabled if
|
||||
* the auto-start private browsing checkbox is checked, and enabled otherwise.
|
||||
*
|
||||
* Extensions adding their own controls can append their IDs to this array if needed.
|
||||
*/
|
||||
dependentControls: [
|
||||
"rememberHistoryDays",
|
||||
"rememberAfter",
|
||||
"rememberDownloads",
|
||||
"rememberForms",
|
||||
"keepUntil",
|
||||
"keepCookiesUntil",
|
||||
"alwaysClear",
|
||||
"clearDataSettings"
|
||||
],
|
||||
|
||||
/**
|
||||
* Check whether all the preferences values are set to their default values
|
||||
*
|
||||
* @param aPrefs an array of pref names to check for
|
||||
* @returns boolean true if all of the prefs are set to their default values,
|
||||
* false otherwise
|
||||
*/
|
||||
_checkDefaultValues: function(aPrefs) {
|
||||
for (let i = 0; i < aPrefs.length; ++i) {
|
||||
let pref = document.getElementById(aPrefs[i]);
|
||||
if (pref.value != pref.defaultValue)
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
/**
|
||||
* Initialize the history mode menulist based on the privacy preferences
|
||||
*/
|
||||
initializeHistoryMode: function PPP_initializeHistoryMode()
|
||||
{
|
||||
let mode;
|
||||
let getVal = function (aPref)
|
||||
document.getElementById(aPref).value;
|
||||
|
||||
if (getVal("browser.privatebrowsing.autostart"))
|
||||
mode = "dontremember";
|
||||
else if (this._checkDefaultValues(this.prefsForDefault))
|
||||
mode = "remember";
|
||||
else
|
||||
mode = "custom";
|
||||
|
||||
document.getElementById("historyMode").value = mode;
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the selected pane based on the history mode menulist
|
||||
*/
|
||||
updateHistoryModePane: function PPP_updateHistoryModePane()
|
||||
{
|
||||
let selectedIndex = -1;
|
||||
switch (document.getElementById("historyMode").value) {
|
||||
case "remember":
|
||||
selectedIndex = 0;
|
||||
break;
|
||||
case "dontremember":
|
||||
selectedIndex = 1;
|
||||
break;
|
||||
case "custom":
|
||||
selectedIndex = 2;
|
||||
break;
|
||||
}
|
||||
document.getElementById("historyPane").selectedIndex = selectedIndex;
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the private browsing auto-start pref and the history mode
|
||||
* micro-management prefs based on the history mode menulist
|
||||
*/
|
||||
updateHistoryModePrefs: function PPP_updateHistoryModePrefs()
|
||||
{
|
||||
let pref = document.getElementById("browser.privatebrowsing.autostart");
|
||||
switch (document.getElementById("historyMode").value) {
|
||||
case "remember":
|
||||
pref.value = false;
|
||||
|
||||
// select the remember history option if needed
|
||||
let rememberHistoryCheckbox = document.getElementById("rememberHistoryDays");
|
||||
if (!rememberHistoryCheckbox.checked) {
|
||||
rememberHistoryCheckbox.checked = true;
|
||||
this.onchangeHistoryDaysCheck();
|
||||
}
|
||||
|
||||
// select the remember downloads option if needed
|
||||
if (!document.getElementById("rememberDownloads").checked)
|
||||
document.getElementById("browser.download.manager.retention").value = 2;
|
||||
|
||||
// select the remember forms history option
|
||||
document.getElementById("browser.formfill.enable").value = true;
|
||||
|
||||
// select the accept cookies option
|
||||
document.getElementById("network.cookie.cookieBehavior").value = 0;
|
||||
// select the cookie lifetime policy option
|
||||
document.getElementById("network.cookie.lifetimePolicy").value = 0;
|
||||
|
||||
// select the clear on close option
|
||||
document.getElementById("privacy.sanitize.sanitizeOnShutdown").value = false;
|
||||
break;
|
||||
case "dontremember":
|
||||
pref.value = true;
|
||||
break;
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Update the privacy micro-management controls based on the
|
||||
* value of the private browsing auto-start checkbox.
|
||||
*/
|
||||
updatePrivacyMicroControls: function PPP_updatePrivacyMicroControls()
|
||||
{
|
||||
if (document.getElementById("historyMode").value == "custom") {
|
||||
let disabled = this._autoStartPrivateBrowsing =
|
||||
document.getElementById("privateBrowsingAutoStart").checked;
|
||||
this.dependentControls
|
||||
.forEach(function (aElement)
|
||||
document.getElementById(aElement).disabled = disabled);
|
||||
|
||||
// adjust the cookie controls status
|
||||
this.readAcceptCookies();
|
||||
document.getElementById("keepCookiesUntil").value = disabled ? 2 :
|
||||
document.getElementById("network.cookie.lifetimePolicy").value;
|
||||
|
||||
// adjust the checked state of the sanitizeOnShutdown checkbox
|
||||
document.getElementById("alwaysClear").checked = disabled ? false :
|
||||
document.getElementById("privacy.sanitize.sanitizeOnShutdown").value;
|
||||
|
||||
// adjust the checked state of the remember history checkboxes
|
||||
document.getElementById("rememberHistoryDays").checked = disabled ? false :
|
||||
document.getElementById("browser.history_expire_days").value > 0;
|
||||
this.onchangeHistoryDaysCheck();
|
||||
document.getElementById("rememberDownloads").checked = disabled ? false :
|
||||
this.readDownloadRetention();
|
||||
document.getElementById("rememberForms").checked = disabled ? false :
|
||||
document.getElementById("browser.formfill.enable").value;
|
||||
|
||||
if (!disabled) {
|
||||
// adjust the Settings button for sanitizeOnShutdown
|
||||
this._updateSanitizeSettingsButton();
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
// PRIVATE BROWSING
|
||||
|
||||
/**
|
||||
* Install the observer for the auto-start private browsing mode pref.
|
||||
*/
|
||||
initAutoStartPrivateBrowsingObserver: function PPP_initAutoStartPrivateBrowsingObserver()
|
||||
{
|
||||
let prefService = document.getElementById("privacyPreferences")
|
||||
.service
|
||||
.QueryInterface(Components.interfaces.nsIPrefBranch2);
|
||||
prefService.addObserver("browser.privatebrowsing.autostart",
|
||||
this.autoStartPrivateBrowsingObserver,
|
||||
true);
|
||||
},
|
||||
|
||||
autoStartPrivateBrowsingObserver:
|
||||
{
|
||||
QueryInterface: XPCOMUtils.generateQI([Components.interfaces.nsIObserver,
|
||||
Components.interfaces.nsISupportsWeakReference]),
|
||||
|
||||
observe: function PPP_observe(aSubject, aTopic, aData)
|
||||
{
|
||||
let privateBrowsingService = Components.classes["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Components.interfaces.nsIPrivateBrowsingService);
|
||||
|
||||
// Toggle the private browsing mode without switching the session
|
||||
let prefValue = document.getElementById("browser.privatebrowsing.autostart").value;
|
||||
let keepCurrentSession = document.getElementById("browser.privatebrowsing.keep_current_session");
|
||||
keepCurrentSession.value = true;
|
||||
// If activating from within the private browsing mode, reset the
|
||||
// private session
|
||||
if (prefValue && privateBrowsingService.privateBrowsingEnabled)
|
||||
privateBrowsingService.privateBrowsingEnabled = false;
|
||||
privateBrowsingService.privateBrowsingEnabled = prefValue;
|
||||
keepCurrentSession.reset();
|
||||
}
|
||||
},
|
||||
|
||||
// HISTORY
|
||||
|
@ -155,7 +377,8 @@ var gPrivacyPane = {
|
|||
var textbox = document.getElementById("historyDays");
|
||||
var checkbox = document.getElementById("rememberHistoryDays");
|
||||
|
||||
pref.value = checkbox.checked ? mirror.value : 0;
|
||||
if (!this._autoStartPrivateBrowsing)
|
||||
pref.value = checkbox.checked ? mirror.value : 0;
|
||||
textbox.disabled = !checkbox.checked;
|
||||
},
|
||||
|
||||
|
@ -226,7 +449,8 @@ var gPrivacyPane = {
|
|||
// enable the rest of the UI for anything other than "disable all cookies"
|
||||
var acceptCookies = (pref.value != 2);
|
||||
|
||||
keepUntil.disabled = menu.disabled = acceptThirdParty.disabled = !acceptCookies;
|
||||
acceptThirdParty.disabled = !acceptCookies;
|
||||
keepUntil.disabled = menu.disabled = this._autoStartPrivateBrowsing || !acceptCookies;
|
||||
|
||||
return acceptCookies;
|
||||
},
|
||||
|
@ -307,7 +531,28 @@ var gPrivacyPane = {
|
|||
"", null);
|
||||
},
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Displays a dialog from which individual parts of private data may be
|
||||
* cleared.
|
||||
*/
|
||||
clearPrivateDataNow: function (aClearEverything)
|
||||
{
|
||||
var ts = document.getElementById("privacy.sanitize.timeSpan");
|
||||
var timeSpanOrig = ts.value;
|
||||
if (aClearEverything)
|
||||
ts.value = 0;
|
||||
|
||||
const Cc = Components.classes, Ci = Components.interfaces;
|
||||
var glue = Cc["@mozilla.org/browser/browserglue;1"]
|
||||
.getService(Ci.nsIBrowserGlue);
|
||||
glue.sanitize(window || null);
|
||||
|
||||
// reset the timeSpan pref
|
||||
if (aClearEverything)
|
||||
ts.value = timeSpanOrig;
|
||||
},
|
||||
|
||||
/**
|
||||
* Enables or disables the "Settings..." button depending
|
||||
* on the privacy.sanitize.sanitizeOnShutdown preference value
|
||||
|
|
|
@ -49,7 +49,8 @@
|
|||
]>
|
||||
|
||||
<overlay id="PrivacyPaneOverlay"
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
|
||||
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns:html="http://www.w3.org/1999/xhtml">
|
||||
|
||||
<prefpane id="panePrivacy"
|
||||
onpaneload="gPrivacyPane.init();"
|
||||
|
@ -101,6 +102,19 @@
|
|||
name="privacy.sanitize.sanitizeOnShutdown"
|
||||
onchange="gPrivacyPane._updateSanitizeSettingsButton();"
|
||||
type="bool"/>
|
||||
<preference id="privacy.sanitize.timeSpan"
|
||||
name="privacy.sanitize.timeSpan"
|
||||
type="int"/>
|
||||
|
||||
<!-- Private Browsing -->
|
||||
<preference id="browser.privatebrowsing.autostart"
|
||||
name="browser.privatebrowsing.autostart"
|
||||
onchange="gPrivacyPane.updatePrivacyMicroControls();"
|
||||
type="bool"/>
|
||||
<preference id="browser.privatebrowsing.keep_current_session"
|
||||
name="browser.privatebrowsing.keep_current_session"
|
||||
instantApply="true"
|
||||
type="bool"/>
|
||||
|
||||
</preferences>
|
||||
|
||||
|
@ -112,6 +126,144 @@
|
|||
<groupbox id="historyGroup">
|
||||
<caption label="&history.label;"/>
|
||||
|
||||
<hbox align="center">
|
||||
<label id="historyModeLabel"
|
||||
control="historyMode"
|
||||
accesskey="&historyHeader.pre.accesskey;">&historyHeader.pre.label;</label>
|
||||
<menulist id="historyMode"
|
||||
oncommand="gPrivacyPane.updateHistoryModePane();
|
||||
gPrivacyPane.updateHistoryModePrefs();
|
||||
gPrivacyPane.updatePrivacyMicroControls();">
|
||||
<menupopup>
|
||||
<menuitem label="&historyHeader.remember.label;" value="remember"/>
|
||||
<menuitem label="&historyHeader.dontremember.label;" value="dontremember"/>
|
||||
<menuitem label="&historyHeader.custom.label;" value="custom"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
<label>&historyHeader.post.label;</label>
|
||||
</hbox>
|
||||
|
||||
<deck id="historyPane">
|
||||
<vbox align="center" id="historyRememberPane">
|
||||
<hbox align="center" flex="1">
|
||||
<spacer flex="1" class="indent"/>
|
||||
<vbox flex="2">
|
||||
<description>&rememberDescription.label;</description>
|
||||
<separator/>
|
||||
<description>&rememberActions.pre.label;<html:a
|
||||
class="inline-link"
|
||||
onclick="gPrivacyPane.clearPrivateDataNow(false);"
|
||||
>&rememberActions.clearHistory.label;</html:a>&rememberActions.middle.label;<html:a
|
||||
class="inline-link"
|
||||
onclick="gPrivacyPane.showCookies();"
|
||||
>&rememberActions.removeCookies.label;</html:a>&rememberActions.post.label;</description>
|
||||
</vbox>
|
||||
<spacer flex="1" class="indent"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox align="center" id="historyDontRememberPane">
|
||||
<hbox align="center" flex="1">
|
||||
<spacer flex="1" class="indent"/>
|
||||
<vbox flex="2">
|
||||
<description>&dontrememberDescription.label;</description>
|
||||
<separator/>
|
||||
<description>&dontrememberActions.pre.label;<html:a
|
||||
class="inline-link"
|
||||
onclick="gPrivacyPane.clearPrivateDataNow(true);"
|
||||
>&dontrememberActions.clearHistory.label;</html:a>&dontrememberActions.post.label;</description>
|
||||
</vbox>
|
||||
<spacer flex="1" class="indent"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
<vbox id="historyCustomPane">
|
||||
<separator class="thin"/>
|
||||
<checkbox id="privateBrowsingAutoStart" class="indent"
|
||||
label="&privateBrowsingAutoStart.label;"
|
||||
accesskey="&privateBrowsingAutoStart.accesskey;"
|
||||
preference="browser.privatebrowsing.autostart"/>
|
||||
|
||||
<vbox class="indent">
|
||||
<vbox class="indent">
|
||||
<hbox align="center">
|
||||
<checkbox id="rememberHistoryDays"
|
||||
label="&rememberHistory.pre.label;"
|
||||
accesskey="&rememberHistory.pre.accesskey;"
|
||||
oncommand="gPrivacyPane.onchangeHistoryDaysCheck();"
|
||||
aria-labelledby="rememberHistoryDays historyDays rememberAfter"/>
|
||||
<textbox id="historyDays" type="number" size="3"
|
||||
aria-labelledby="rememberHistoryDays historyDays rememberAfter"
|
||||
onkeyup="gPrivacyPane.onkeyupHistoryDaysText();"
|
||||
preference="browser.history_expire_days_min"/>
|
||||
<label id="rememberAfter"> &rememberHistory.post.label;</label>
|
||||
</hbox>
|
||||
<checkbox id="rememberDownloads"
|
||||
label="&rememberDownload.label;"
|
||||
accesskey="&rememberDownload.accesskey;"
|
||||
preference="browser.download.manager.retention"
|
||||
onsyncfrompreference="return gPrivacyPane.readDownloadRetention();"
|
||||
onsynctopreference="return gPrivacyPane.writeDownloadRetention();"/>
|
||||
<checkbox id="rememberForms"
|
||||
label="&rememberSearchForm.label;"
|
||||
accesskey="&rememberSearchForm.accesskey;"
|
||||
preference="browser.formfill.enable"/>
|
||||
|
||||
<hbox id="cookiesBox">
|
||||
<checkbox id="acceptCookies" label="&acceptCookies.label;" flex="1"
|
||||
preference="network.cookie.cookieBehavior"
|
||||
accesskey="&acceptCookies.accesskey;"
|
||||
onsyncfrompreference="return gPrivacyPane.readAcceptCookies();"
|
||||
onsynctopreference="return gPrivacyPane.writeAcceptCookies();"/>
|
||||
<button id="cookieExceptions" oncommand="gPrivacyPane.showCookieExceptions();"
|
||||
label="&cookieExceptions.label;" accesskey="&cookieExceptions.accesskey;"
|
||||
preference="pref.privacy.disable_button.cookie_exceptions"/>
|
||||
</hbox>
|
||||
<checkbox id="acceptThirdParty" label="&acceptThirdParty.label;" class="indent"
|
||||
preference="network.cookie.cookieBehavior"
|
||||
accesskey="&acceptThirdParty.accesskey;"
|
||||
onsyncfrompreference="return gPrivacyPane.readAcceptThirdPartyCookies();"
|
||||
onsynctopreference="return gPrivacyPane.writeAcceptThirdPartyCookies();"/>
|
||||
|
||||
<hbox id="keepRow" class="indent">
|
||||
<hbox id="keepBox" align="center">
|
||||
<label id="keepUntil"
|
||||
control="keepCookiesUntil"
|
||||
accesskey="&keepUntil.accesskey;">&keepUntil.label;</label>
|
||||
<menulist id="keepCookiesUntil"
|
||||
preference="network.cookie.lifetimePolicy">
|
||||
<menupopup>
|
||||
<menuitem label="&expire.label;" value="0"/>
|
||||
<menuitem label="&close.label;" value="2"/>
|
||||
<menuitem label="&askEachTime.label;" value="1"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
<hbox flex="1"/>
|
||||
<button id="showCookiesButton"
|
||||
label="&showCookies.label;" accesskey="&showCookies.accesskey;"
|
||||
oncommand="gPrivacyPane.showCookies();"
|
||||
preference="pref.privacy.disable_button.view_cookies"/>
|
||||
</hbox>
|
||||
|
||||
<hbox id="clearDataBox" align="center">
|
||||
<checkbox id="alwaysClear" flex="1"
|
||||
preference="privacy.sanitize.sanitizeOnShutdown"
|
||||
label="&clearOnClose.label;"
|
||||
accesskey="&clearOnClose.accesskey;"/>
|
||||
<button id="clearDataSettings" label="&clearOnCloseSettings.label;"
|
||||
accesskey="&clearOnCloseSettings.accesskey;"
|
||||
oncommand="gPrivacyPane.showClearPrivateDataSettings();"/>
|
||||
</hbox>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</vbox>
|
||||
</deck>
|
||||
|
||||
</groupbox>
|
||||
|
||||
<!-- Location Bar -->
|
||||
<groupbox id="locationBarGroup">
|
||||
<caption label="&locationBar.label;"/>
|
||||
|
||||
<hbox align="center">
|
||||
<label id="locationBarSuggestionLabel"
|
||||
control="locationBarSuggestion"
|
||||
|
@ -129,86 +281,6 @@
|
|||
</menulist>
|
||||
<label>&locbar.post.label;</label>
|
||||
</hbox>
|
||||
|
||||
<hbox align="center">
|
||||
<checkbox id="rememberHistoryDays"
|
||||
label="&rememberDaysBefore.label;"
|
||||
accesskey="&rememberDaysBefore.accesskey;"
|
||||
oncommand="gPrivacyPane.onchangeHistoryDaysCheck();"
|
||||
aria-labelledby="rememberHistoryDays historyDays rememberAfter"/>
|
||||
<textbox id="historyDays" type="number" size="3"
|
||||
aria-labelledby="rememberHistoryDays historyDays rememberAfter"
|
||||
onkeyup="gPrivacyPane.onkeyupHistoryDaysText();"
|
||||
preference="browser.history_expire_days_min"/>
|
||||
<label id="rememberAfter"> &rememberDaysAfter2.label;</label>
|
||||
</hbox>
|
||||
<checkbox id="rememberForms"
|
||||
label="&rememberForms.label;"
|
||||
accesskey="&rememberForms.accesskey;"
|
||||
preference="browser.formfill.enable"/>
|
||||
<checkbox id="rememberDownloads"
|
||||
label="&rememberDownloads.label;"
|
||||
accesskey="&rememberDownloads.accesskey;"
|
||||
preference="browser.download.manager.retention"
|
||||
onsyncfrompreference="return gPrivacyPane.readDownloadRetention();"
|
||||
onsynctopreference="return gPrivacyPane.writeDownloadRetention();"/>
|
||||
</groupbox>
|
||||
|
||||
<!-- Cookies -->
|
||||
<groupbox id="cookiesGroup">
|
||||
<caption label="&cookies.label;"/>
|
||||
|
||||
<hbox id="cookiesBox">
|
||||
<checkbox id="acceptCookies" label="&acceptCookies.label;" flex="1"
|
||||
preference="network.cookie.cookieBehavior"
|
||||
accesskey="&acceptCookies.accesskey;"
|
||||
onsyncfrompreference="return gPrivacyPane.readAcceptCookies();"
|
||||
onsynctopreference="return gPrivacyPane.writeAcceptCookies();"/>
|
||||
<button id="cookieExceptions" oncommand="gPrivacyPane.showCookieExceptions();"
|
||||
label="&cookieExceptions.label;" accesskey="&cookieExceptions.accesskey;"
|
||||
preference="pref.privacy.disable_button.cookie_exceptions"/>
|
||||
</hbox>
|
||||
<checkbox id="acceptThirdParty" label="&acceptThirdParty.label;" class="indent"
|
||||
preference="network.cookie.cookieBehavior"
|
||||
accesskey="&acceptThirdParty.accesskey;"
|
||||
onsyncfrompreference="return gPrivacyPane.readAcceptThirdPartyCookies();"
|
||||
onsynctopreference="return gPrivacyPane.writeAcceptThirdPartyCookies();"/>
|
||||
|
||||
<hbox id="keepRow">
|
||||
<hbox id="keepBox" align="center" class="indent">
|
||||
<label id="keepUntil"
|
||||
control="keepCookiesUntil"
|
||||
accesskey="&keepUntil.accesskey;">&keepUntil.label;</label>
|
||||
<menulist id="keepCookiesUntil"
|
||||
preference="network.cookie.lifetimePolicy">
|
||||
<menupopup>
|
||||
<menuitem label="&expire.label;" value="0"/>
|
||||
<menuitem label="&close.label;" value="2"/>
|
||||
<menuitem label="&askEachTime.label;" value="1"/>
|
||||
</menupopup>
|
||||
</menulist>
|
||||
</hbox>
|
||||
<hbox flex="1"/>
|
||||
<button id="showCookiesButton"
|
||||
label="&showCookies.label;" accesskey="&showCookies.accesskey;"
|
||||
oncommand="gPrivacyPane.showCookies();"
|
||||
preference="pref.privacy.disable_button.view_cookies"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
|
||||
<!-- Private Data -->
|
||||
<groupbox id="privateDataGroup">
|
||||
<caption label="&privateData.label;"/>
|
||||
|
||||
<hbox id="clearDataBox" align="center">
|
||||
<checkbox id="alwaysClear" flex="1"
|
||||
preference="privacy.sanitize.sanitizeOnShutdown"
|
||||
label="&alwaysClear.label;"
|
||||
accesskey="&alwaysClear.accesskey;"/>
|
||||
<button id="clearDataSettings" label="&clearDataSettings.label;"
|
||||
accesskey="&clearDataSettings.accesskey;"
|
||||
oncommand="gPrivacyPane.showClearPrivateDataSettings();"/>
|
||||
</hbox>
|
||||
</groupbox>
|
||||
|
||||
</prefpane>
|
||||
|
|
|
@ -43,7 +43,15 @@ relativesrcdir = browser/components/preferences/tests
|
|||
include $(DEPTH)/config/autoconf.mk
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_BROWSER_FILES = browser_bug410900.js \
|
||||
_BROWSER_FILES = \
|
||||
browser_bug410900.js \
|
||||
privacypane_tests.js \
|
||||
browser_privacypane_1.js \
|
||||
browser_privacypane_2.js \
|
||||
browser_privacypane_3.js \
|
||||
browser_privacypane_4.js \
|
||||
browser_privacypane_5.js \
|
||||
browser_privacypane_6.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_BROWSER_FILES)
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
/* ***** 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 Privacy PrefPane Test.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ehsan Akhgari.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* 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 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 ***** */
|
||||
|
||||
function test() {
|
||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Ci.mozIJSSubScriptLoader);
|
||||
loader.loadSubScript("chrome://mochikit/content/browser/browser/components/preferences/tests/privacypane_tests.js", this);
|
||||
|
||||
run_test_subset([
|
||||
test_locbar_emptyText,
|
||||
test_pane_visibility,
|
||||
test_dependent_elements,
|
||||
test_dependent_cookie_elements,
|
||||
test_dependent_clearonclose_elements,
|
||||
test_dependent_prefs,
|
||||
|
||||
// reset all preferences to their default values once we're done
|
||||
reset_preferences
|
||||
]);
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
/* ***** 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 Privacy PrefPane Test.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ehsan Akhgari.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* 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 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 ***** */
|
||||
|
||||
function test() {
|
||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Ci.mozIJSSubScriptLoader);
|
||||
loader.loadSubScript("chrome://mochikit/content/browser/browser/components/preferences/tests/privacypane_tests.js", this);
|
||||
|
||||
run_test_subset([
|
||||
test_historymode_retention("remember", undefined),
|
||||
test_historymode_retention("dontremember", "remember"),
|
||||
test_historymode_retention("custom", "dontremember"),
|
||||
// custom without any micro-prefs changed won't retain
|
||||
test_historymode_retention("remember", "dontremember"),
|
||||
test_historymode_retention("custom", "remember"),
|
||||
// custom without any micro-prefs changed won't retain
|
||||
test_historymode_retention("remember", "remember"),
|
||||
|
||||
// reset all preferences to their default values once we're done
|
||||
reset_preferences
|
||||
]);
|
||||
}
|
|
@ -0,0 +1,57 @@
|
|||
/* ***** 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 Privacy PrefPane Test.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ehsan Akhgari.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* 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 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 ***** */
|
||||
|
||||
function test() {
|
||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Ci.mozIJSSubScriptLoader);
|
||||
loader.loadSubScript("chrome://mochikit/content/browser/browser/components/preferences/tests/privacypane_tests.js", this);
|
||||
|
||||
run_test_subset([
|
||||
test_custom_retention("rememberHistoryDays", "remember"),
|
||||
test_custom_retention("rememberHistoryDays", "custom"),
|
||||
test_custom_retention("historyDays", "remember", 1),
|
||||
test_custom_retention("historyDays", "custom", -1),
|
||||
test_custom_retention("rememberDownloads", "remember"),
|
||||
test_custom_retention("rememberDownloads", "custom"),
|
||||
test_custom_retention("rememberForms", "remember"),
|
||||
test_custom_retention("rememberForms", "custom"),
|
||||
test_historymode_retention("remember", "remember"),
|
||||
|
||||
// reset all preferences to their default values once we're done
|
||||
reset_preferences
|
||||
]);
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
/* ***** 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 Privacy PrefPane Test.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ehsan Akhgari.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* 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 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 ***** */
|
||||
|
||||
function test() {
|
||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Ci.mozIJSSubScriptLoader);
|
||||
loader.loadSubScript("chrome://mochikit/content/browser/browser/components/preferences/tests/privacypane_tests.js", this);
|
||||
|
||||
run_test_subset([
|
||||
test_custom_retention("acceptCookies", "remember"),
|
||||
test_custom_retention("acceptCookies", "custom"),
|
||||
test_custom_retention("acceptThirdParty", "remember"),
|
||||
test_custom_retention("acceptThirdParty", "custom"),
|
||||
test_custom_retention("keepCookiesUntil", "remember", 1),
|
||||
test_custom_retention("keepCookiesUntil", "custom", 2),
|
||||
test_custom_retention("keepCookiesUntil", "custom", 0),
|
||||
test_custom_retention("alwaysClear", "remember"),
|
||||
test_custom_retention("alwaysClear", "custom"),
|
||||
test_historymode_retention("remember", "remember"),
|
||||
|
||||
// reset all preferences to their default values once we're done
|
||||
reset_preferences
|
||||
]);
|
||||
}
|
|
@ -0,0 +1,53 @@
|
|||
/* ***** 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 Privacy PrefPane Test.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ehsan Akhgari.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* 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 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 ***** */
|
||||
|
||||
function test() {
|
||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Ci.mozIJSSubScriptLoader);
|
||||
loader.loadSubScript("chrome://mochikit/content/browser/browser/components/preferences/tests/privacypane_tests.js", this);
|
||||
|
||||
run_test_subset([
|
||||
test_locbar_suggestion_retention(-1, undefined),
|
||||
test_locbar_suggestion_retention(1, -1),
|
||||
test_locbar_suggestion_retention(2, 1),
|
||||
test_locbar_suggestion_retention(0, 2),
|
||||
test_locbar_suggestion_retention(0, 0),
|
||||
|
||||
// reset all preferences to their default values once we're done
|
||||
reset_preferences
|
||||
]);
|
||||
}
|
|
@ -0,0 +1,54 @@
|
|||
/* ***** 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 Privacy PrefPane Test.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ehsan Akhgari.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* 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 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 ***** */
|
||||
|
||||
function test() {
|
||||
let loader = Cc["@mozilla.org/moz/jssubscript-loader;1"].
|
||||
getService(Ci.mozIJSSubScriptLoader);
|
||||
loader.loadSubScript("chrome://mochikit/content/browser/browser/components/preferences/tests/privacypane_tests.js", this);
|
||||
|
||||
run_test_subset([
|
||||
test_privatebrowsing_toggle,
|
||||
enter_private_browsing, // once again, test with PB initially enabled
|
||||
test_privatebrowsing_toggle,
|
||||
test_privatebrowsing_ui,
|
||||
enter_private_browsing, // once again, test with PB initially enabled
|
||||
test_privatebrowsing_ui,
|
||||
|
||||
// reset all preferences to their default values once we're done
|
||||
reset_preferences
|
||||
]);
|
||||
}
|
|
@ -0,0 +1,560 @@
|
|||
/* ***** 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 Privacy PrefPane Test.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Ehsan Akhgari.
|
||||
* Portions created by the Initial Developer are Copyright (C) 2009
|
||||
* 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 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 ***** */
|
||||
|
||||
function runTestOnPrivacyPrefPane(testFunc) {
|
||||
let ww = Cc["@mozilla.org/embedcomp/window-watcher;1"].
|
||||
getService(Ci.nsIWindowWatcher);
|
||||
let observer = {
|
||||
observe: function(aSubject, aTopic, aData) {
|
||||
if (aTopic == "domwindowopened") {
|
||||
ww.unregisterNotification(this);
|
||||
|
||||
let win = aSubject.QueryInterface(Ci.nsIDOMEventTarget);
|
||||
win.addEventListener("load", function() {
|
||||
win.removeEventListener("load", arguments.callee, false);
|
||||
testFunc(dialog.document.defaultView);
|
||||
|
||||
ww.registerNotification(observer);
|
||||
dialog.close();
|
||||
}, false);
|
||||
} else if (aTopic == "domwindowclosed") {
|
||||
ww.unregisterNotification(this);
|
||||
testRunner.runNext();
|
||||
}
|
||||
}
|
||||
};
|
||||
ww.registerNotification(observer);
|
||||
|
||||
let dialog = openDialog("chrome://browser/content/preferences/preferences.xul", "Preferences",
|
||||
"chrome,titlebar,toolbar,centerscreen,dialog=no", "panePrivacy");
|
||||
}
|
||||
|
||||
function controlChanged(doc, element) {
|
||||
let event = doc.createEvent("Events");
|
||||
event.initEvent("command", true, true);
|
||||
element.dispatchEvent(event);
|
||||
}
|
||||
|
||||
function test_locbar_emptyText(win) {
|
||||
let texts = ["none", "bookmarkhistory", "history", "bookmark"];
|
||||
|
||||
let locbarlist = win.document.getElementById("locationBarSuggestion");
|
||||
ok(locbarlist, "location bar suggestion menulist should exist");
|
||||
|
||||
for (let level = -1; level <= 2; ++level) {
|
||||
locbarlist.value = level;
|
||||
controlChanged(win.document, locbarlist);
|
||||
is(gURLBar.emptyText, gURLBar.getAttribute(texts[level + 1] + "emptytext"),
|
||||
"location bar empty text for for level " + level + " is correctly set");
|
||||
}
|
||||
}
|
||||
|
||||
function test_pane_visibility(win) {
|
||||
let modes = {
|
||||
"remember": "historyRememberPane",
|
||||
"dontremember": "historyDontRememberPane",
|
||||
"custom": "historyCustomPane"
|
||||
};
|
||||
|
||||
let historymode = win.document.getElementById("historyMode");
|
||||
ok(historymode, "history mode menulist should exist");
|
||||
let historypane = win.document.getElementById("historyPane");
|
||||
ok(historypane, "history mode pane should exist");
|
||||
|
||||
for (let mode in modes) {
|
||||
historymode.value = mode;
|
||||
controlChanged(win.document, historymode);
|
||||
is(historypane.selectedPanel, win.document.getElementById(modes[mode]),
|
||||
"The correct pane should be selected for the " + mode + " mode");
|
||||
}
|
||||
}
|
||||
|
||||
function test_dependent_elements(win) {
|
||||
let historymode = win.document.getElementById("historyMode");
|
||||
ok(historymode, "history mode menulist should exist");
|
||||
let pbautostart = win.document.getElementById("privateBrowsingAutoStart");
|
||||
ok(pbautostart, "the private browsing auto-start checkbox should exist");
|
||||
let controls = [
|
||||
win.document.getElementById("rememberHistoryDays"),
|
||||
win.document.getElementById("historyDays"),
|
||||
win.document.getElementById("rememberAfter"),
|
||||
win.document.getElementById("rememberDownloads"),
|
||||
win.document.getElementById("rememberForms"),
|
||||
win.document.getElementById("keepUntil"),
|
||||
win.document.getElementById("keepCookiesUntil"),
|
||||
win.document.getElementById("alwaysClear"),
|
||||
];
|
||||
controls.forEach(function(control) {
|
||||
ok(control, "the dependent controls should exist");
|
||||
});
|
||||
let independents = [
|
||||
win.document.getElementById("acceptCookies"),
|
||||
win.document.getElementById("acceptThirdParty"),
|
||||
];
|
||||
independents.forEach(function(control) {
|
||||
ok(control, "the independent controls should exist");
|
||||
});
|
||||
let cookieexceptions = win.document.getElementById("cookieExceptions");
|
||||
ok(cookieexceptions, "the cookie exceptions button should exist");
|
||||
let keepuntil = win.document.getElementById("keepCookiesUntil");
|
||||
ok(keepuntil, "the keep cookies until menulist should exist");
|
||||
let alwaysclear = win.document.getElementById("alwaysClear");
|
||||
ok(alwaysclear, "the clear data on close checkbox should exist");
|
||||
let rememberhistory = win.document.getElementById("rememberHistoryDays");
|
||||
ok(rememberhistory, "the remember history checkbox should exist");
|
||||
let rememberdownloads = win.document.getElementById("rememberDownloads");
|
||||
ok(rememberdownloads, "the remember downloads checkbox should exist");
|
||||
let rememberforms = win.document.getElementById("rememberForms");
|
||||
ok(rememberforms, "the remember forms checkbox should exist");
|
||||
let alwaysclearsettings = win.document.getElementById("clearDataSettings");
|
||||
ok(alwaysclearsettings, "the clear data settings button should exist");
|
||||
|
||||
function expect_disabled(disabled) {
|
||||
controls.forEach(function(control) {
|
||||
is(control.disabled, disabled,
|
||||
control.getAttribute("id") + " should " + (disabled ? "" : "not ") + "be disabled");
|
||||
});
|
||||
is(keepuntil.value, disabled ? 2 : 0,
|
||||
"the keep cookies until menulist value should be as expected");
|
||||
if (disabled) {
|
||||
ok(!alwaysclear.checked,
|
||||
"the clear data on close checkbox value should be as expected");
|
||||
ok(!rememberhistory.checked,
|
||||
"the remember history checkbox value should be as expected");
|
||||
ok(!rememberdownloads.checked,
|
||||
"the remember downloads checkbox value should be as expected");
|
||||
ok(!rememberforms.checked,
|
||||
"the remember forms checkbox value should be as expected");
|
||||
}
|
||||
}
|
||||
function check_independents(expected) {
|
||||
independents.forEach(function(control) {
|
||||
is(control.disabled, expected,
|
||||
control.getAttribute("id") + " should " + (expected ? "" : "not ") + "be disabled");
|
||||
});
|
||||
ok(!cookieexceptions.disabled,
|
||||
"the cookie exceptions button should never be disabled");
|
||||
ok(alwaysclearsettings.disabled,
|
||||
"the clear data settings button should always be disabled");
|
||||
}
|
||||
|
||||
// controls should only change in custom mode
|
||||
historymode.value = "remember";
|
||||
controlChanged(win.document, historymode);
|
||||
expect_disabled(false);
|
||||
check_independents(false);
|
||||
|
||||
// setting the mode to custom shouldn't change anything
|
||||
historymode.value = "custom";
|
||||
controlChanged(win.document, historymode);
|
||||
expect_disabled(false);
|
||||
check_independents(false);
|
||||
|
||||
// controls should only change in custom mode
|
||||
historymode.value = "dontremember";
|
||||
controlChanged(win.document, historymode);
|
||||
expect_disabled(false);
|
||||
check_independents(false);
|
||||
|
||||
// controls should only change in custom mode
|
||||
historymode.value = "custom";
|
||||
controlChanged(win.document, historymode);
|
||||
expect_disabled(true);
|
||||
check_independents(false);
|
||||
|
||||
// dependent controls should follow pbautostart
|
||||
pbautostart.checked = false;
|
||||
controlChanged(win.document, pbautostart);
|
||||
expect_disabled(false);
|
||||
check_independents(false);
|
||||
|
||||
// dependent controls should follow pbautostart
|
||||
pbautostart.checked = true;
|
||||
controlChanged(win.document, pbautostart);
|
||||
expect_disabled(true);
|
||||
check_independents(false);
|
||||
}
|
||||
|
||||
function test_dependent_cookie_elements(win) {
|
||||
let historymode = win.document.getElementById("historyMode");
|
||||
ok(historymode, "history mode menulist should exist");
|
||||
let pbautostart = win.document.getElementById("privateBrowsingAutoStart");
|
||||
ok(pbautostart, "the private browsing auto-start checkbox should exist");
|
||||
let controls = [
|
||||
win.document.getElementById("acceptThirdParty"),
|
||||
win.document.getElementById("keepUntil"),
|
||||
win.document.getElementById("keepCookiesUntil"),
|
||||
];
|
||||
controls.forEach(function(control) {
|
||||
ok(control, "the dependent cookie controls should exist");
|
||||
});
|
||||
let acceptcookies = win.document.getElementById("acceptCookies");
|
||||
ok(acceptcookies, "the accept cookies checkbox should exist");
|
||||
|
||||
function expect_disabled(disabled) {
|
||||
controls.forEach(function(control) {
|
||||
is(control.disabled, disabled,
|
||||
control.getAttribute("id") + " should " + (disabled ? "" : "not ") + "be disabled");
|
||||
});
|
||||
}
|
||||
|
||||
historymode.value = "custom";
|
||||
controlChanged(win.document, historymode);
|
||||
pbautostart.checked = false;
|
||||
controlChanged(win.document, pbautostart);
|
||||
expect_disabled(false);
|
||||
|
||||
acceptcookies.checked = false;
|
||||
controlChanged(win.document, acceptcookies);
|
||||
expect_disabled(true);
|
||||
|
||||
// pbautostart shouldn't change anything now
|
||||
pbautostart.checked = true;
|
||||
controlChanged(win.document, pbautostart);
|
||||
expect_disabled(true);
|
||||
|
||||
pbautostart.checked = false;
|
||||
controlChanged(win.document, pbautostart);
|
||||
expect_disabled(true);
|
||||
|
||||
acceptcookies.checked = true;
|
||||
controlChanged(win.document, acceptcookies);
|
||||
expect_disabled(false);
|
||||
|
||||
let accessthirdparty = controls.shift();
|
||||
pbautostart.checked = true;
|
||||
controlChanged(win.document, pbautostart);
|
||||
expect_disabled(true);
|
||||
ok(!accessthirdparty.disabled, "access third party button should be enabled");
|
||||
|
||||
acceptcookies.checked = false;
|
||||
controlChanged(win.document, acceptcookies);
|
||||
expect_disabled(true);
|
||||
ok(accessthirdparty.disabled, "access third party button should be disabled");
|
||||
|
||||
pbautostart.checked = false;
|
||||
controlChanged(win.document, pbautostart);
|
||||
expect_disabled(true);
|
||||
ok(accessthirdparty.disabled, "access third party button should be disabled");
|
||||
|
||||
acceptcookies.checked = true;
|
||||
controlChanged(win.document, acceptcookies);
|
||||
expect_disabled(false);
|
||||
ok(!accessthirdparty.disabled, "access third party button should be enabled");
|
||||
}
|
||||
|
||||
function test_dependent_clearonclose_elements(win) {
|
||||
let historymode = win.document.getElementById("historyMode");
|
||||
ok(historymode, "history mode menulist should exist");
|
||||
let pbautostart = win.document.getElementById("privateBrowsingAutoStart");
|
||||
ok(pbautostart, "the private browsing auto-start checkbox should exist");
|
||||
let alwaysclear = win.document.getElementById("alwaysClear");
|
||||
ok(alwaysclear, "the clear data on close checkbox should exist");
|
||||
let alwaysclearsettings = win.document.getElementById("clearDataSettings");
|
||||
ok(alwaysclearsettings, "the clear data settings button should exist");
|
||||
|
||||
function expect_disabled(disabled) {
|
||||
is(alwaysclearsettings.disabled, disabled,
|
||||
"the clear data settings should " + (disabled ? "" : "not ") + "be disabled");
|
||||
}
|
||||
|
||||
historymode.value = "custom";
|
||||
controlChanged(win.document, historymode);
|
||||
pbautostart.checked = false;
|
||||
controlChanged(win.document, pbautostart);
|
||||
alwaysclear.checked = false;
|
||||
controlChanged(win.document, alwaysclear);
|
||||
expect_disabled(true);
|
||||
|
||||
alwaysclear.checked = true;
|
||||
controlChanged(win.document, alwaysclear);
|
||||
expect_disabled(false);
|
||||
|
||||
pbautostart.checked = true;
|
||||
controlChanged(win.document, pbautostart);
|
||||
expect_disabled(true);
|
||||
|
||||
pbautostart.checked = false;
|
||||
controlChanged(win.document, pbautostart);
|
||||
expect_disabled(false);
|
||||
|
||||
alwaysclear.checked = false;
|
||||
controlChanged(win.document, alwaysclear);
|
||||
expect_disabled(true);
|
||||
}
|
||||
|
||||
function test_dependent_prefs(win) {
|
||||
let historymode = win.document.getElementById("historyMode");
|
||||
ok(historymode, "history mode menulist should exist");
|
||||
let controls = [
|
||||
win.document.getElementById("rememberHistoryDays"),
|
||||
win.document.getElementById("rememberDownloads"),
|
||||
win.document.getElementById("rememberForms"),
|
||||
win.document.getElementById("acceptCookies"),
|
||||
win.document.getElementById("acceptThirdParty"),
|
||||
];
|
||||
controls.forEach(function(control) {
|
||||
ok(control, "the micro-management controls should exist");
|
||||
});
|
||||
|
||||
function expect_checked(checked) {
|
||||
controls.forEach(function(control) {
|
||||
is(control.checked, checked,
|
||||
control.getAttribute("id") + " should " + (checked ? "not " : "") + "be checked");
|
||||
});
|
||||
}
|
||||
|
||||
// controls should be checked in remember mode
|
||||
historymode.value = "remember";
|
||||
controlChanged(win.document, historymode);
|
||||
expect_checked(true);
|
||||
|
||||
// even if they're unchecked in custom mode
|
||||
historymode.value = "custom";
|
||||
controlChanged(win.document, historymode);
|
||||
controls.forEach(function(control) {
|
||||
control.checked = false;
|
||||
controlChanged(win.document, control);
|
||||
});
|
||||
expect_checked(false);
|
||||
historymode.value = "remember";
|
||||
controlChanged(win.document, historymode);
|
||||
expect_checked(true);
|
||||
}
|
||||
|
||||
function test_historymode_retention(mode, expect) {
|
||||
return function(win) {
|
||||
let historymode = win.document.getElementById("historyMode");
|
||||
ok(historymode, "history mode menulist should exist");
|
||||
|
||||
if (expect !== undefined) {
|
||||
is(historymode.value, expect,
|
||||
"history mode is expected to remain " + expect);
|
||||
}
|
||||
|
||||
historymode.value = mode;
|
||||
controlChanged(win.document, historymode);
|
||||
};
|
||||
}
|
||||
|
||||
function test_custom_retention(controlToChange, expect, valueIncrement) {
|
||||
return function(win) {
|
||||
let historymode = win.document.getElementById("historyMode");
|
||||
ok(historymode, "history mode menulist should exist");
|
||||
|
||||
if (expect !== undefined) {
|
||||
is(historymode.value, expect,
|
||||
"history mode is expected to remain " + expect);
|
||||
}
|
||||
|
||||
historymode.value = "custom";
|
||||
controlChanged(win.document, historymode);
|
||||
|
||||
controlToChange = win.document.getElementById(controlToChange);
|
||||
ok(controlToChange, "the control to change should exist");
|
||||
switch (controlToChange.localName) {
|
||||
case "checkbox":
|
||||
controlToChange.checked = !controlToChange.checked;
|
||||
break;
|
||||
case "textbox":
|
||||
controlToChange.value = parseInt(controlToChange.value) + valueIncrement;
|
||||
break;
|
||||
case "menulist":
|
||||
controlToChange.value = valueIncrement;
|
||||
break;
|
||||
}
|
||||
controlChanged(win.document, controlToChange);
|
||||
};
|
||||
}
|
||||
|
||||
function test_locbar_suggestion_retention(mode, expect) {
|
||||
return function(win) {
|
||||
let locbarsuggest = win.document.getElementById("locationBarSuggestion");
|
||||
ok(locbarsuggest, "location bar suggestion menulist should exist");
|
||||
|
||||
if (expect !== undefined) {
|
||||
is(locbarsuggest.value, expect,
|
||||
"location bar suggestion is expected to remain " + expect);
|
||||
}
|
||||
|
||||
locbarsuggest.value = mode;
|
||||
controlChanged(win.document, locbarsuggest);
|
||||
};
|
||||
}
|
||||
|
||||
function test_privatebrowsing_toggle(win) {
|
||||
let historymode = win.document.getElementById("historyMode");
|
||||
ok(historymode, "history mode menulist should exist");
|
||||
let pbautostart = win.document.getElementById("privateBrowsingAutoStart");
|
||||
ok(pbautostart, "the private browsing auto-start checkbox should exist");
|
||||
|
||||
let pbService = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
|
||||
// initial state
|
||||
historymode.value = "remember";
|
||||
controlChanged(win.document, historymode);
|
||||
|
||||
// switch to dontremember mode
|
||||
historymode.value = "dontremember";
|
||||
controlChanged(win.document, historymode);
|
||||
ok(pbService.privateBrowsingEnabled, "private browsing should be activated");
|
||||
|
||||
// switch to remember mode
|
||||
historymode.value = "remember";
|
||||
controlChanged(win.document, historymode);
|
||||
ok(!pbService.privateBrowsingEnabled, "private browsing should be deactivated");
|
||||
|
||||
// switch to custom mode
|
||||
historymode.value = "custom";
|
||||
controlChanged(win.document, historymode);
|
||||
ok(!pbService.privateBrowsingEnabled, "private browsing should remain deactivated");
|
||||
|
||||
// check the autostart checkbox
|
||||
pbautostart.checked = true;
|
||||
controlChanged(win.document, pbautostart);
|
||||
ok(pbService.privateBrowsingEnabled, "private browsing should be activated");
|
||||
|
||||
// uncheck the autostart checkbox
|
||||
pbautostart.checked = false;
|
||||
controlChanged(win.document, pbautostart);
|
||||
ok(!pbService.privateBrowsingEnabled, "private browsing should be deactivated");
|
||||
}
|
||||
|
||||
function test_privatebrowsing_ui(win) {
|
||||
let historymode = win.document.getElementById("historyMode");
|
||||
ok(historymode, "history mode menulist should exist");
|
||||
let pbautostart = win.document.getElementById("privateBrowsingAutoStart");
|
||||
ok(pbautostart, "the private browsing auto-start checkbox should exist");
|
||||
|
||||
let pbmenuitem = document.getElementById("privateBrowsingItem");
|
||||
ok(pbmenuitem, "the private browsing menu item should exist");
|
||||
let pbcommand = document.getElementById("Tools:PrivateBrowsing");
|
||||
ok(pbcommand, "the private browsing command should exist");
|
||||
|
||||
// initial state
|
||||
historymode.value = "remember";
|
||||
controlChanged(win.document, historymode);
|
||||
ok(!pbmenuitem.hasAttribute("disabled"),
|
||||
"private browsing menu item should not be initially disabled");
|
||||
ok(!pbcommand.hasAttribute("disabled"),
|
||||
"private browsing command should not be initially disabled");
|
||||
|
||||
// switch to dontremember mode
|
||||
historymode.value = "dontremember";
|
||||
controlChanged(win.document, historymode);
|
||||
ok(pbmenuitem.hasAttribute("disabled"),
|
||||
"private browsing menu item should be disabled");
|
||||
ok(pbcommand.hasAttribute("disabled"),
|
||||
"private browsing command should be disabled");
|
||||
|
||||
// switch to remember mode
|
||||
historymode.value = "remember";
|
||||
controlChanged(win.document, historymode);
|
||||
ok(!pbmenuitem.hasAttribute("disabled"),
|
||||
"private browsing menu item should be enabled");
|
||||
ok(!pbcommand.hasAttribute("disabled"),
|
||||
"private browsing command should be enabled");
|
||||
|
||||
// switch to custom mode
|
||||
historymode.value = "custom";
|
||||
controlChanged(win.document, historymode);
|
||||
ok(!pbmenuitem.hasAttribute("disabled"),
|
||||
"private browsing menu item should remain enabled");
|
||||
ok(!pbcommand.hasAttribute("disabled"),
|
||||
"private browsing command should remain enabled");
|
||||
|
||||
// check the autostart checkbox
|
||||
pbautostart.checked = true;
|
||||
controlChanged(win.document, pbautostart);
|
||||
ok(pbmenuitem.hasAttribute("disabled"),
|
||||
"private browsing menu item should be disabled");
|
||||
ok(pbcommand.hasAttribute("disabled"),
|
||||
"private browsing command should be disabled");
|
||||
|
||||
// uncheck the autostart checkbox
|
||||
pbautostart.checked = false;
|
||||
controlChanged(win.document, pbautostart);
|
||||
ok(!pbmenuitem.hasAttribute("disabled"),
|
||||
"private browsing menu item should be enabled");
|
||||
ok(!pbcommand.hasAttribute("disabled"),
|
||||
"private browsing command should be enabled");
|
||||
}
|
||||
|
||||
function enter_private_browsing(win) {
|
||||
let pbService = Cc["@mozilla.org/privatebrowsing;1"].
|
||||
getService(Ci.nsIPrivateBrowsingService);
|
||||
win.document.getElementById("browser.privatebrowsing.keep_current_session")
|
||||
.value = true;
|
||||
pbService.privateBrowsingEnabled = true;
|
||||
}
|
||||
|
||||
function reset_preferences(win) {
|
||||
let prefs = win.document.getElementsByTagName("preference");
|
||||
for (let i = 0; i < prefs.length; ++i)
|
||||
if (prefs[i].hasUserValue)
|
||||
prefs[i].reset();
|
||||
}
|
||||
|
||||
let testRunner;
|
||||
function run_test_subset(subset) {
|
||||
let psvc = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
let instantApplyOrig = psvc.getBoolPref("browser.preferences.instantApply");
|
||||
psvc.setBoolPref("browser.preferences.instantApply", true);
|
||||
|
||||
waitForExplicitFinish();
|
||||
|
||||
testRunner = {
|
||||
tests: subset,
|
||||
counter: 0,
|
||||
runNext: function() {
|
||||
if (this.counter == this.tests.length) {
|
||||
// cleanup
|
||||
psvc.setBoolPref("browser.preferences.instantApply", instantApplyOrig);
|
||||
finish();
|
||||
} else {
|
||||
let self = this;
|
||||
setTimeout(function() {
|
||||
runTestOnPrivacyPrefPane(self.tests[self.counter++]);
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
testRunner.runNext();
|
||||
}
|
|
@ -93,6 +93,15 @@ PrivateBrowsingService.prototype = {
|
|||
return this.__obs;
|
||||
},
|
||||
|
||||
// Preferences Service
|
||||
__prefs: null,
|
||||
get _prefs() {
|
||||
if (!this.__prefs)
|
||||
this.__prefs = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
return this.__prefs;
|
||||
},
|
||||
|
||||
// Whether the private browsing mode is currently active or not.
|
||||
_inPrivateBrowsing: false,
|
||||
|
||||
|
@ -149,16 +158,14 @@ PrivateBrowsingService.prototype = {
|
|||
}]
|
||||
});
|
||||
|
||||
if (this._inPrivateBrowsing) {
|
||||
// whether we should save and close the current session
|
||||
this._saveSession = true;
|
||||
var prefBranch = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
try {
|
||||
if (prefBranch.getBoolPref("browser.privatebrowsing.keep_current_session"))
|
||||
this._saveSession = false;
|
||||
} catch (ex) {}
|
||||
// whether we should save and close the current session
|
||||
this._saveSession = true;
|
||||
try {
|
||||
if (this._prefs.getBoolPref("browser.privatebrowsing.keep_current_session"))
|
||||
this._saveSession = false;
|
||||
} catch (ex) {}
|
||||
|
||||
if (this._inPrivateBrowsing) {
|
||||
// save the whole browser state in order to restore all windows/tabs later
|
||||
if (this._saveSession && !this._savedBrowserState) {
|
||||
if (this._getBrowserWindow())
|
||||
|
@ -254,9 +261,7 @@ PrivateBrowsingService.prototype = {
|
|||
// private browsing mode upon startup.
|
||||
// This won't interfere with the session store component, because
|
||||
// that component will be initialized on final-ui-startup.
|
||||
let prefsService = Cc["@mozilla.org/preferences-service;1"].
|
||||
getService(Ci.nsIPrefBranch);
|
||||
this._autoStart = prefsService.getBoolPref("browser.privatebrowsing.autostart");
|
||||
this._autoStart = this._prefs.getBoolPref("browser.privatebrowsing.autostart");
|
||||
if (this._autoStart) {
|
||||
this._autoStarted = true;
|
||||
this.privateBrowsingEnabled = true;
|
||||
|
@ -335,8 +340,8 @@ PrivateBrowsingService.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
if (!val)
|
||||
this._autoStarted = false;
|
||||
this._autoStarted = val ?
|
||||
this._prefs.getBoolPref("browser.privatebrowsing.autostart") : false;
|
||||
this._inPrivateBrowsing = val != false;
|
||||
|
||||
let data = val ? "enter" : "exit";
|
||||
|
|
|
@ -65,4 +65,10 @@ function do_test() {
|
|||
|
||||
// private browsing not auto-started
|
||||
do_check_false(pb.autoStarted);
|
||||
|
||||
// enter private browsing mode again
|
||||
pb.privateBrowsingEnabled = true;
|
||||
|
||||
// private browsing is auto-started
|
||||
do_check_true(pb.autoStarted);
|
||||
}
|
||||
|
|
|
@ -197,7 +197,6 @@
|
|||
<!ENTITY showAllHistoryCmd.commandkey "H">
|
||||
|
||||
<!ENTITY openCmd.commandkey "l">
|
||||
<!ENTITY urlbar.emptyText "Search Bookmarks and History">
|
||||
<!ENTITY urlbar.bookmarkhistory.emptyText "Search Bookmarks and History">
|
||||
<!ENTITY urlbar.bookmark.emptyText "Search Bookmarks">
|
||||
<!ENTITY urlbar.history.emptyText "Search History">
|
||||
|
|
|
@ -10,24 +10,6 @@
|
|||
<!ENTITY locbar.bookmarks.label "Bookmarks">
|
||||
<!ENTITY locbar.nothing.label "Nothing">
|
||||
|
||||
<!-- LOCALIZATION NOTE:
|
||||
The entities rememberDaysBefore.label and rememberDaysAfter2.label appear on a single
|
||||
line in preferences as follows:
|
||||
|
||||
&rememberDaysBefore.label [ textbox for number of days ] &rememberDaysAfter2.label;
|
||||
-->
|
||||
<!ENTITY rememberDaysBefore.label "Keep my history for at least">
|
||||
<!ENTITY rememberDaysBefore.accesskey "h">
|
||||
<!ENTITY rememberDaysAfter2.label "days">
|
||||
|
||||
<!ENTITY rememberForms.label "Remember what I enter in forms and the search bar">
|
||||
<!ENTITY rememberForms.accesskey "f">
|
||||
|
||||
<!ENTITY rememberDownloads.label "Remember what I've downloaded">
|
||||
<!ENTITY rememberDownloads.accesskey "d">
|
||||
|
||||
|
||||
<!ENTITY cookies.label "Cookies">
|
||||
|
||||
<!ENTITY acceptCookies.label "Accept cookies from sites">
|
||||
<!ENTITY acceptCookies.accesskey "c">
|
||||
|
@ -49,14 +31,6 @@
|
|||
<!ENTITY showCookies.accesskey "S">
|
||||
|
||||
|
||||
<!ENTITY privateData.label "Private Data">
|
||||
|
||||
<!ENTITY alwaysClear.label "Always clear my private data when I close &brandShortName;">
|
||||
<!ENTITY alwaysClear.accesskey "w">
|
||||
|
||||
<!ENTITY clearDataSettings.label "Settings…">
|
||||
<!ENTITY clearDataSettings.accesskey "t">
|
||||
|
||||
<!ENTITY historyHeader.pre.label "&brandShortName; will:">
|
||||
<!ENTITY historyHeader.pre.accesskey "F">
|
||||
<!ENTITY historyHeader.remember.label "Remember history">
|
||||
|
|
Двоичные данные
browser/themes/gnomestripe/browser/preferences/Options.png
До Ширина: | Высота: | Размер: 12 KiB После Ширина: | Высота: | Размер: 12 KiB |
|
@ -82,6 +82,20 @@ radio[pane=paneAdvanced] {
|
|||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
/* Privacy Pane */
|
||||
|
||||
/* styles for the link elements copied from .text-link in global.css */
|
||||
.inline-link {
|
||||
color: -moz-nativehyperlinktext;
|
||||
text-decoration: underline;
|
||||
outline: 1px solid transparent;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.inline-link:focus, .inline-link:hover:active {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/* Modeless Window Dialogs */
|
||||
.windowDialog,
|
||||
.windowDialog prefpane {
|
||||
|
|
Двоичные данные
browser/themes/pinstripe/browser/preferences/Options.png
До Ширина: | Высота: | Размер: 18 KiB После Ширина: | Высота: | Размер: 20 KiB |
|
@ -247,6 +247,21 @@ caption {
|
|||
font: message-box !important;
|
||||
}
|
||||
|
||||
/**
|
||||
* Privacy Pane
|
||||
*/
|
||||
|
||||
/* styles for the link elements copied from .text-link in global.css */
|
||||
.inline-link {
|
||||
color: -moz-nativehyperlinktext;
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.inline-link:focus, .inline-link:hover:active {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update Preferences
|
||||
*/
|
||||
|
|
Двоичные данные
browser/themes/winstripe/browser/preferences/Options-aero.png
До Ширина: | Высота: | Размер: 9.0 KiB После Ширина: | Высота: | Размер: 9.2 KiB |
Двоичные данные
browser/themes/winstripe/browser/preferences/Options.png
До Ширина: | Высота: | Размер: 9.1 KiB После Ширина: | Высота: | Размер: 9.4 KiB |
|
@ -109,6 +109,19 @@ radio[pane=paneAdvanced][selected="true"] {
|
|||
-moz-box-flex: 1;
|
||||
}
|
||||
|
||||
/* Privacy Pane */
|
||||
|
||||
/* styles for the link elements copied from .text-link in global.css */
|
||||
.inline-link {
|
||||
color: -moz-nativehyperlinktext;
|
||||
text-decoration: underline;
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
.inline-link:focus, .inline-link:hover:active {
|
||||
color: red;
|
||||
}
|
||||
|
||||
/* Modeless Window Dialogs */
|
||||
.windowDialog,
|
||||
.windowDialog prefpane {
|
||||
|
|