Bug 1016300 - Move inline scripts and styles into separate files for in-content preferences. r=Gijs

This commit is contained in:
Sebastian Hengst 2014-08-27 00:08:49 +02:00
parent 34cf5fc573
commit 14e62f7fd5
22 changed files with 341 additions and 144 deletions

View File

@ -45,6 +45,10 @@ var gAdvancedPane = {
this.updateActualCacheSize();
this.updateActualAppCacheSize();
let bundlePrefs = document.getElementById("bundlePreferences");
document.getElementById("offlineAppsList")
.style.height = bundlePrefs.getString("offlineAppsList.height");
// Notify observers that the UI is now ready
Services.obs.notifyObservers(window, "advanced-pane-loaded", null);
},

View File

@ -288,7 +288,6 @@
<vbox flex="1">
<label id="offlineAppsListLabel">&offlineAppsList2.label;</label>
<listbox id="offlineAppsList"
style="height: &offlineAppsList.height;;"
flex="1"
aria-labelledby="offlineAppsListLabel"
onselect="gAdvancedPane.offlineAppSelected(event);">

View File

@ -15,6 +15,12 @@ var gAdvancedPane = {
*/
init: function ()
{
function setEventListener(aId, aEventType, aCallback)
{
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gAdvancedPane));
}
this._inited = true;
var advancedPrefs = document.getElementById("advancedPrefs");
@ -35,6 +41,44 @@ var gAdvancedPane = {
#endif
this.updateActualCacheSize();
this.updateActualAppCacheSize();
setEventListener("layers.acceleration.disabled", "change",
gAdvancedPane.updateHardwareAcceleration);
setEventListener("advancedPrefs", "select",
gAdvancedPane.tabSelectionChanged);
#ifdef MOZ_SERVICES_HEALTHREPORT
setEventListener("submitHealthReportBox", "command",
gAdvancedPane.updateSubmitHealthReport);
#endif
#ifdef MOZ_CRASHREPORTER
setEventListener("submitCrashesBox", "command",
gAdvancedPane.updateSubmitCrashes);
#endif
setEventListener("connectionSettings", "command",
gAdvancedPane.showConnections);
setEventListener("clearCacheButton", "command",
gAdvancedPane.clearCache);
setEventListener("clearOfflineAppCacheButton", "command",
gAdvancedPane.clearOfflineAppCache);
setEventListener("offlineNotifyExceptions", "command",
gAdvancedPane.showOfflineExceptions);
setEventListener("offlineNotifyExceptions", "command", function (event) {
gAdvancedPane.offlineAppSelected(event); })
let bundlePrefs = document.getElementById("bundlePreferences");
document.getElementById("offlineAppsList")
.style.height = bundlePrefs.getString("offlineAppsList.height");
setEventListener("offlineAppsListRemove", "command",
gAdvancedPane.removeOfflineApp);
#ifdef MOZ_UPDATER
setEventListener("updateRadioGroup", "command",
gAdvancedPane.updateWritePrefs);
#endif
setEventListener("showUpdateHistory", "command",
gAdvancedPane.showUpdates);
setEventListener("viewCertificatesButton", "command",
gAdvancedPane.showCertificates);
setEventListener("viewSecurityDevicesButton", "command",
gAdvancedPane.showSecurityDevices);
},
/**

View File

@ -32,8 +32,7 @@
<preference id="layers.acceleration.disabled"
name="layers.acceleration.disabled"
type="bool"
inverted="true"
onchange="gAdvancedPane.updateHardwareAcceleration()"/>
inverted="true"/>
#ifdef XP_WIN
<preference id="gfx.direct2d.disabled"
name="gfx.direct2d.disabled"
@ -133,8 +132,7 @@
handleCtrlPageUpDown="false"
flex="1"
data-category="paneAdvanced"
hidden="true"
onselect="gAdvancedPane.tabSelectionChanged();">
hidden="true">
<tabs id="tabsElement">
<tab id="generalTab" label="&generalTab.label;"/>
@ -215,7 +213,6 @@
<description>&healthReportDesc.label;</description>
<hbox>
<checkbox id="submitHealthReportBox"
oncommand="gAdvancedPane.updateSubmitHealthReport();"
label="&enableHealthReport.label;"
accesskey="&enableHealthReport.accesskey;"/>
<spacer flex="1"/>
@ -230,7 +227,6 @@
<description>&crashReporterDesc.label;</description>
<hbox>
<checkbox id="submitCrashesBox"
oncommand="gAdvancedPane.updateSubmitCrashes();"
label="&enableCrashReporter.label;"
accesskey="&enableCrashReporter.accesskey;"/>
@ -253,8 +249,7 @@
<hbox align="center">
<description flex="1" control="connectionSettings">&connectionDesc.label;</description>
<button id="connectionSettings" icon="network" label="&connectionSettings.label;"
accesskey="&connectionSettings.accesskey;"
oncommand="gAdvancedPane.showConnections();"/>
accesskey="&connectionSettings.accesskey;"/>
</hbox>
</groupbox>
@ -265,8 +260,7 @@
<hbox align="center">
<label id="actualDiskCacheSize" flex="1"/>
<button id="clearCacheButton" icon="clear"
label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"
oncommand="gAdvancedPane.clearCache();"/>
label="&clearCacheNow.label;" accesskey="&clearCacheNow.accesskey;"/>
</hbox>
<hbox>
<checkbox preference="browser.cache.disk.smart_size.enabled"
@ -296,8 +290,7 @@
<hbox align="center">
<label id="actualAppCacheSize" flex="1"/>
<button id="clearOfflineAppCacheButton" icon="clear"
label="&clearOfflineAppCacheNow.label;" accesskey="&clearOfflineAppCacheNow.accesskey;"
oncommand="gAdvancedPane.clearOfflineAppCache();"/>
label="&clearOfflineAppCacheNow.label;" accesskey="&clearOfflineAppCacheNow.accesskey;"/>
</hbox>
<hbox align="center">
<checkbox id="offlineNotify"
@ -307,25 +300,21 @@
<spacer flex="1"/>
<button id="offlineNotifyExceptions"
label="&offlineNotifyExceptions.label;"
accesskey="&offlineNotifyExceptions.accesskey;"
oncommand="gAdvancedPane.showOfflineExceptions();"/>
accesskey="&offlineNotifyExceptions.accesskey;"/>
</hbox>
<hbox>
<vbox flex="1">
<label id="offlineAppsListLabel">&offlineAppsList2.label;</label>
<listbox id="offlineAppsList"
style="height: &offlineAppsList.height;;"
flex="1"
aria-labelledby="offlineAppsListLabel"
onselect="gAdvancedPane.offlineAppSelected(event);">
aria-labelledby="offlineAppsListLabel">
</listbox>
</vbox>
<vbox pack="end">
<button id="offlineAppsListRemove"
disabled="true"
label="&offlineAppsListRemove.label;"
accesskey="&offlineAppsListRemove.accesskey;"
oncommand="gAdvancedPane.removeOfflineApp();"/>
accesskey="&offlineAppsListRemove.accesskey;"/>
</vbox>
</hbox>
</groupbox>
@ -336,8 +325,7 @@
#ifdef MOZ_UPDATER
<groupbox id="updateApp" align="start">
<caption><label>&updateApp.label;</label></caption>
<radiogroup id="updateRadioGroup" align="start"
oncommand="gAdvancedPane.updateWritePrefs();">
<radiogroup id="updateRadioGroup" align="start">
#ifdef XP_WIN
#ifdef MOZ_METRO
<radio id="autoMetro"
@ -374,8 +362,7 @@
<button id="showUpdateHistory"
label="&updateHistory.label;"
accesskey="&updateHistory.accesskey;"
preference="app.update.disable_button.showUpdateHistory"
oncommand="gAdvancedPane.showUpdates();"/>
preference="app.update.disable_button.showUpdateHistory"/>
</hbox>
#ifdef MOZ_MAINTENANCE_SERVICE
@ -428,11 +415,9 @@
<hbox>
<button id="viewCertificatesButton"
label="&viewCerts.label;" accesskey="&viewCerts.accesskey;"
oncommand="gAdvancedPane.showCertificates();"
preference="security.disable_button.openCertManager"/>
<button id="viewSecurityDevicesButton"
label="&viewSecurityDevices.label;" accesskey="&viewSecurityDevices.accesskey;"
oncommand="gAdvancedPane.showSecurityDevices();"
preference="security.disable_button.openDeviceManager"/>
</hbox>
</tabpanel>

View File

@ -904,6 +904,12 @@ var gApplicationsPane = {
// Initialization & Destruction
init: function() {
function setEventListener(aId, aEventType, aCallback)
{
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gApplicationsPane));
}
// Initialize shortcuts to some commonly accessed elements & values.
this._brandShortName =
document.getElementById("bundleBrand").getString("brandShortName");
@ -931,6 +937,14 @@ var gApplicationsPane = {
this._prefSvc.addObserver(PREF_AUDIO_FEED_SELECTED_READER, this, false);
setEventListener("focusSearch1", "command", gApplicationsPane.focusFilterBox);
setEventListener("focusSearch2", "command", gApplicationsPane.focusFilterBox);
setEventListener("filter", "command", gApplicationsPane.filter);
setEventListener("handlersView", "select",
gApplicationsPane.onSelectionChanged);
setEventListener("typeColumn", "click", gApplicationsPane.sort);
setEventListener("actionColumn", "click", gApplicationsPane.sort);
// Listen for window unload so we can remove our preference observers.
window.addEventListener("unload", this, false);

View File

@ -53,8 +53,8 @@
</preferences>
<keyset>
<key key="&focusSearch1.key;" modifiers="accel" oncommand="gApplicationsPane.focusFilterBox();"/>
<key key="&focusSearch2.key;" modifiers="accel" oncommand="gApplicationsPane.focusFilterBox();"/>
<key key="&focusSearch1.key;" modifiers="accel" id="focusSearch1"/>
<key key="&focusSearch2.key;" modifiers="accel" id="focusSearch2"/>
</keyset>
<hbox id="header-application"
@ -72,24 +72,21 @@
<textbox id="filter" flex="1"
type="search"
placeholder="&filter.emptytext;"
aria-controls="handlersView"
oncommand="gApplicationsPane.filter();"/>
aria-controls="handlersView"/>
</hbox>
<separator class="thin"/>
<richlistbox id="handlersView" orient="vertical" persist="lastSelectedType"
preference="pref.downloads.disable_button.edit_actions"
flex="1"
onselect="gApplicationsPane.onSelectionChanged();">
<listheader equalsize="always" style="border: 0; padding: 0; -moz-appearance: none;">
flex="1">
<listheader equalsize="always">
<treecol id="typeColumn" label="&typeColumn.label;" value="type"
accesskey="&typeColumn.accesskey;" persist="sortDirection"
flex="1" onclick="gApplicationsPane.sort(event);"
sortDirection="ascending"/>
flex="1" sortDirection="ascending"/>
<treecol id="actionColumn" label="&actionColumn2.label;" value="action"
accesskey="&actionColumn2.accesskey;" persist="sortDirection"
flex="1" onclick="gApplicationsPane.sort(event);"/>
flex="1"/>
</listheader>
</richlistbox>
</vbox>

View File

@ -9,6 +9,12 @@ var gContentPane = {
*/
init: function ()
{
function setEventListener(aId, aEventType, aCallback)
{
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gContentPane));
}
this._rebuildFonts();
var menulist = document.getElementById("defaultFont");
if (menulist.selectedIndex == -1) {
@ -22,6 +28,21 @@ var gContentPane = {
let row = document.getElementById("translationBox");
row.removeAttribute("hidden");
}
setEventListener("font.language.group", "change",
gContentPane._rebuildFonts);
setEventListener("popupPolicyButton", "command",
gContentPane.showPopupExceptions);
setEventListener("advancedFonts", "command",
gContentPane.configureFonts);
setEventListener("colors", "command",
gContentPane.configureColors);
setEventListener("chooseLanguage", "command",
gContentPane.showLanguages);
setEventListener("translationAttributionImage", "click",
gContentPane.openTranslationProviderAttribution);
setEventListener("translateButton", "command",
gContentPane.showTranslationExceptions);
},
// UTILITY FUNCTIONS

View File

@ -14,8 +14,7 @@
<!-- Fonts -->
<preference id="font.language.group"
name="font.language.group"
type="wstring"
onchange="gContentPane._rebuildFonts();"/>
type="wstring"/>
<!-- Languages -->
<preference id="browser.translation.detectLanguage"
@ -52,7 +51,6 @@
'dom.disable_open_during_load');"/>
</vbox>
<button id="popupPolicyButton" label="&popupExceptions.label;"
oncommand="gContentPane.showPopupExceptions();"
accesskey="&popupExceptions.accesskey;"/>
</row>
</rows>
@ -106,15 +104,13 @@
</hbox>
<button id="advancedFonts" icon="select-font"
label="&advancedFonts.label;"
accesskey="&advancedFonts.accesskey;"
oncommand="gContentPane.configureFonts();"/>
accesskey="&advancedFonts.accesskey;"/>
</row>
<row id="colorsRow">
<hbox/>
<button id="colors" icon="select-color"
label="&colors.label;"
accesskey="&colors.accesskey;"
oncommand="gContentPane.configureColors();"/>
accesskey="&colors.accesskey;"/>
</row>
</rows>
</grid>
@ -128,8 +124,7 @@
<description flex="1" control="chooseLanguage">&chooseLanguage.label;</description>
<button id="chooseLanguage"
label="&chooseButton.label;"
accesskey="&chooseButton.accesskey;"
oncommand="gContentPane.showLanguages();"/>
accesskey="&chooseButton.accesskey;"/>
</hbox>
<hbox id="translationBox" hidden="true">
@ -141,13 +136,11 @@
<label>&translation.options.attribution.beforeLogo;</label>
<separator orient="vertical" class="thin"/>
<image id="translationAttributionImage" aria-label="Microsoft Translator"
onclick="gContentPane.openTranslationProviderAttribution()"
src="chrome://browser/content/microsoft-translator-attribution.png"/>
<separator orient="vertical" class="thin"/>
<label>&translation.options.attribution.afterLogo;</label>
</hbox>
<button id="translateButton" label="&translateExceptions.label;"
oncommand="gContentPane.showTranslationExceptions();"
accesskey="&translateExceptions.accesskey;"/>
</hbox>
</groupbox>

View File

@ -11,6 +11,12 @@ var gMainPane = {
*/
init: function ()
{
function setEventListener(aId, aEventType, aCallback)
{
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gMainPane));
}
#ifdef HAVE_SHELL_SERVICE
this.updateSetDefaultBrowser();
#ifdef XP_WIN
@ -72,6 +78,22 @@ var gMainPane = {
#endif
setEventListener("browser.privatebrowsing.autostart", "change",
gMainPane.updateBrowserStartupLastSession);
setEventListener("browser.download.dir", "change",
gMainPane.displayDownloadDirPref);
#ifdef HAVE_SHELL_SERVICE
setEventListener("setDefaultButton", "command",
gMainPane.setDefaultBrowser);
#endif
setEventListener("useCurrent", "command",
gMainPane.setHomePageToCurrent);
setEventListener("useBookmark", "command",
gMainPane.setHomePageToBookmark);
setEventListener("restoreDefaultHomePage", "command",
gMainPane.restoreDefaultHomePage);
setEventListener("chooseFolder", "command",
gMainPane.chooseFolder);
},
// HOME PAGE

View File

@ -39,8 +39,7 @@
<preference id="browser.privatebrowsing.autostart"
name="browser.privatebrowsing.autostart"
type="bool"
onchange="gMainPane.updateBrowserStartupLastSession();"/>
type="bool"/>
<!-- Downloads -->
<preference id="browser.download.useDownloadDir"
@ -52,8 +51,7 @@
type="int"/>
<preference id="browser.download.dir"
name="browser.download.dir"
type="file"
onchange="gMainPane.displayDownloadDirPref();"/>
type="file"/>
<!-- Tab preferences
Preferences:
@ -121,7 +119,6 @@
<label id="isNotDefaultLabel" flex="1">&isNotDefault.label;</label>
<button id="setDefaultButton"
label="&setAsMyDefaultBrowser.label;" accesskey="&setAsMyDefaultBrowser.accesskey;"
oncommand="gMainPane.setDefaultBrowser();"
preference="pref.general.disable_button.default_browser"/>
</hbox>
<hbox align="center" class="indent">
@ -168,17 +165,14 @@
accesskey="&useCurrentPage.accesskey;"
label1="&useCurrentPage.label;"
label2="&useMultiple.label;"
oncommand="gMainPane.setHomePageToCurrent();"
id="useCurrent"
preference="pref.browser.homepage.disable_button.current_page"/>
<button label="&chooseBookmark.label;"
accesskey="&chooseBookmark.accesskey;"
oncommand="gMainPane.setHomePageToBookmark();"
id="useBookmark"
preference="pref.browser.homepage.disable_button.bookmark_page"/>
<button label="&restoreDefault.label;"
accesskey="&restoreDefault.accesskey;"
oncommand="gMainPane.restoreDefaultHomePage();"
id="restoreDefaultHomePage"
preference="pref.browser.homepage.disable_button.restore_default"/>
</hbox>
@ -207,7 +201,6 @@
onsyncfrompreference="return gMainPane.displayDownloadDirPref();"
onsynctopreference="return gMainPane.getFolderListPref()"/>
<button id="chooseFolder"
oncommand="gMainPane.chooseFolder();"
#ifdef XP_MACOSX
accesskey="&chooseFolderMac.accesskey;"
label="&chooseFolderMac.label;"

View File

@ -52,6 +52,9 @@ function init_all() {
window.addEventListener("hashchange", onHashChange);
gotoPref();
let helpCmd = document.getElementById("help-button");
helpCmd.addEventListener("command", helpButtonCommand);
// Wait until initialization of all preferences are complete before
// notifying observers that the UI is now ready.
Services.obs.notifyObservers(window, "advanced-pane-loaded", null);

View File

@ -172,9 +172,9 @@
#endif
</prefpane>
<hbox pack="end">
<button class="help-button"
aria-label="&helpButton.label;"
oncommand="helpButtonCommand();"/>
<button id="help-button"
class="help-button"
aria-label="&helpButton.label;"/>
</hbox>
</vbox>

View File

@ -20,11 +20,52 @@ var gPrivacyPane = {
*/
init: function ()
{
function setEventListener(aId, aEventType, aCallback)
{
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gPrivacyPane));
}
this._updateSanitizeSettingsButton();
this.initializeHistoryMode();
this.updateHistoryModePane();
this.updatePrivacyMicroControls();
this.initAutoStartPrivateBrowsingReverter();
setEventListener("browser.urlbar.default.behavior", "change",
document.getElementById('browser.urlbar.autocomplete.enabled')
.updateElements
);
setEventListener("privacy.sanitize.sanitizeOnShutdown", "change",
gPrivacyPane._updateSanitizeSettingsButton);
setEventListener("browser.privatebrowsing.autostart", "change",
gPrivacyPane.updatePrivacyMicroControls);
setEventListener("historyMode", "command", function () {
gPrivacyPane.updateHistoryModePane();
gPrivacyPane.updateHistoryModePrefs();
gPrivacyPane.updatePrivacyMicroControls();
gPrivacyPane.updateAutostart();
});
setEventListener("historyRememberClear", "click", function () {
gPrivacyPane.clearPrivateDataNow(false);
return false;
});
setEventListener("historyRememberCookies", "click", function () {
gPrivacyPane.showCookies();
return false;
});
setEventListener("historyDontRememberClear", "click", function () {
gPrivacyPane.clearPrivateDataNow(true);
return false;
});
setEventListener("privateBrowsingAutoStart", "command",
gPrivacyPane.updateAutostart);
setEventListener("cookieExceptions", "command",
gPrivacyPane.showCookieExceptions);
setEventListener("showCookiesButton", "command",
gPrivacyPane.showCookies);
setEventListener("clearDataSettings", "command",
gPrivacyPane.showClearPrivateDataSettings);
},
// HISTORY MODE

View File

@ -31,8 +31,7 @@
type="bool"/>
<preference id="browser.urlbar.default.behavior"
name="browser.urlbar.default.behavior"
type="int"
onchange="document.getElementById('browser.urlbar.autocomplete.enabled').updateElements();"/>
type="int"/>
<!-- History -->
<preference id="places.history.enabled"
@ -54,7 +53,6 @@
<!-- Clear Private Data -->
<preference id="privacy.sanitize.sanitizeOnShutdown"
name="privacy.sanitize.sanitizeOnShutdown"
onchange="gPrivacyPane._updateSanitizeSettingsButton();"
type="bool"/>
<preference id="privacy.sanitize.timeSpan"
name="privacy.sanitize.timeSpan"
@ -62,7 +60,6 @@
<!-- Private Browsing -->
<preference id="browser.privatebrowsing.autostart"
name="browser.privatebrowsing.autostart"
onchange="gPrivacyPane.updatePrivacyMicroControls();"
type="bool"/>
</preferences>
@ -102,11 +99,7 @@
control="historyMode"
accesskey="&historyHeader.pre.accesskey;">&historyHeader.pre.label;
</label>
<menulist id="historyMode"
oncommand="gPrivacyPane.updateHistoryModePane();
gPrivacyPane.updateHistoryModePrefs();
gPrivacyPane.updatePrivacyMicroControls();
gPrivacyPane.updateAutostart();">
<menulist id="historyMode">
<menupopup>
<menuitem label="&historyHeader.remember.label;" value="remember"/>
<menuitem label="&historyHeader.dontremember.label;" value="dontremember"/>
@ -123,11 +116,9 @@
<description>&rememberDescription.label;</description>
<separator/>
<description>&rememberActions.pre.label;<html:a
class="inline-link" href="#"
onclick="gPrivacyPane.clearPrivateDataNow(false); return false;"
class="inline-link" id="historyRememberClear" href="#"
>&rememberActions.clearHistory.label;</html:a>&rememberActions.middle.label;<html:a
class="inline-link" href="#"
onclick="gPrivacyPane.showCookies(); return false;"
class="inline-link" id="historyRememberCookies" href="#"
>&rememberActions.removeCookies.label;</html:a>&rememberActions.post.label;</description>
</vbox>
<spacer flex="1" class="indent"/>
@ -140,8 +131,7 @@
<description>&dontrememberDescription.label;</description>
<separator/>
<description>&dontrememberActions.pre.label;<html:a
class="inline-link" href="#"
onclick="gPrivacyPane.clearPrivateDataNow(true); return false;"
class="inline-link" id="historyDontRememberClear" href="#"
>&dontrememberActions.clearHistory.label;</html:a>&dontrememberActions.post.label;</description>
</vbox>
<spacer flex="1" class="indent"/>
@ -154,8 +144,7 @@
<checkbox id="privateBrowsingAutoStart"
label="&privateBrowsingPermanent2.label;"
accesskey="&privateBrowsingPermanent2.accesskey;"
preference="browser.privatebrowsing.autostart"
oncommand="gPrivacyPane.updateAutostart()"/>
preference="browser.privatebrowsing.autostart"/>
</vbox>
<vbox class="indent">
<vbox align="start">
@ -175,7 +164,7 @@
onsyncfrompreference="return gPrivacyPane.readAcceptCookies();"
onsynctopreference="return gPrivacyPane.writeAcceptCookies();"/>
<spacer flex="1" />
<button id="cookieExceptions" oncommand="gPrivacyPane.showCookieExceptions();"
<button id="cookieExceptions"
label="&cookieExceptions.label;" accesskey="&cookieExceptions.accesskey;"
preference="pref.privacy.disable_button.cookie_exceptions"/>
</hbox>
@ -211,7 +200,6 @@
<spacer 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"
@ -222,8 +210,7 @@
accesskey="&clearOnClose.accesskey;"/>
<spacer flex="1"/>
<button id="clearDataSettings" label="&clearOnCloseSettings.label;"
accesskey="&clearOnCloseSettings.accesskey;"
oncommand="gPrivacyPane.showClearPrivateDataSettings();"/>
accesskey="&clearOnCloseSettings.accesskey;"/>
</hbox>
</vbox>
</vbox>

View File

@ -12,8 +12,25 @@ var gSecurityPane = {
*/
init: function ()
{
function setEventListener(aId, aEventType, aCallback)
{
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gSecurityPane));
}
this._pane = document.getElementById("paneSecurity");
this._initMasterPasswordUI();
setEventListener("addonExceptions", "command",
gSecurityPane.showAddonExceptions);
setEventListener("passwordExceptions", "command",
gSecurityPane.showPasswordExceptions);
setEventListener("useMasterPassword", "command",
gSecurityPane.updateMasterPasswordButton);
setEventListener("changeMasterPassword", "command",
gSecurityPane.changeMasterPassword);
setEventListener("showPasswords", "command",
gSecurityPane.showPasswords);
},
// ADD-ONS

View File

@ -52,8 +52,7 @@
<spacer flex="1"/>
<button id="addonExceptions"
label="&addonExceptions.label;"
accesskey="&addonExceptions.accesskey;"
oncommand="gSecurityPane.showAddonExceptions();"/>
accesskey="&addonExceptions.accesskey;"/>
</hbox>
<separator class="thin"/>
@ -82,26 +81,22 @@
<button id="passwordExceptions"
label="&passwordExceptions.label;"
accesskey="&passwordExceptions.accesskey;"
oncommand="gSecurityPane.showPasswordExceptions();"
preference="pref.privacy.disable_button.view_passwords_exceptions"/>
</hbox>
<hbox id="masterPasswordBox">
<checkbox id="useMasterPassword"
oncommand="gSecurityPane.updateMasterPasswordButton();"
label="&useMasterPassword.label;"
accesskey="&useMasterPassword.accesskey;"/>
<spacer flex="1"/>
<button id="changeMasterPassword"
label="&changeMasterPassword.label;"
accesskey="&changeMasterPassword.accesskey;"
oncommand="gSecurityPane.changeMasterPassword();"/>
accesskey="&changeMasterPassword.accesskey;"/>
</hbox>
<hbox id="showPasswordsBox">
<spacer flex="1"/>
<button id="showPasswords"
label="&savedPasswords.label;" accesskey="&savedPasswords.accesskey;"
oncommand="gSecurityPane.showPasswords();"
preference="pref.privacy.disable_button.view_passwords"/>
</hbox>
</groupbox>

View File

@ -49,6 +49,8 @@ let gSyncPane = {
},
init: function () {
this._setupEventListeners();
// If the Service hasn't finished initializing, wait for it.
let xps = Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
@ -107,6 +109,91 @@ let gSyncPane = {
this.updateWeavePrefs();
},
_setupEventListeners: function() {
function setEventListener(aId, aEventType, aCallback)
{
document.getElementById(aId)
.addEventListener(aEventType, aCallback.bind(gSyncPane));
}
setEventListener("noAccountSetup", "click", function (aEvent) {
aEvent.stopPropagation();
gSyncPane.openSetup(null);
});
setEventListener("noAccountPair", "click", function (aEvent) {
aEvent.stopPropagation();
gSyncPane.openSetup('pair');
});
setEventListener("syncViewQuota", "command", gSyncPane.openQuotaDialog);
setEventListener("syncChangePassword", "command",
gSyncUtils.changePassword);
setEventListener("syncResetPassphrase", "command",
gSyncUtils.resetPassphrase);
setEventListener("syncReset", "command", gSyncPane.resetSync);
setEventListener("syncAddDeviceLabel", "click", function () {
gSyncPane.openAddDevice();
return false;
});
setEventListener("syncEnginesList", "select", function () {
if (this.selectedCount)
this.clearSelection();
});
setEventListener("syncComputerName", "change", function () {
gSyncUtils.changeName(this);
});
setEventListener("unlinkDevice", "click", function () {
gSyncPane.startOver(true);
return false;
});
setEventListener("tosPP-normal-ToS", "click", gSyncPane.openToS);
setEventListener("tosPP-normal-PP", "click", gSyncPane.openPrivacyPolicy);
setEventListener("loginErrorUpdatePass", "click", function () {
gSyncPane.updatePass();
return false;
});
setEventListener("loginErrorResetPass", "click", function () {
gSyncPane.resetPass();
return false;
});
setEventListener("loginErrorStartOver", "click", function () {
gSyncPane.startOver(true);
return false;
});
setEventListener("noFxaSignUp", "click", function () {
gSyncPane.signUp();
return false;
});
setEventListener("noFxaSignIn", "click", function () {
gSyncPane.signIn();
return false;
});
setEventListener("noFxaUseOldSync", "click", function () {
gSyncPane.openOldSyncSupportPage();
return false;
});
setEventListener("verifiedManage", "command",
gSyncPane.manageFirefoxAccount);
setEventListener("fxaUnlinkButton", "click", function () {
gSyncPane.unlinkFirefoxAccount(true);
});
setEventListener("verifyFxaAccount", "command",
gSyncPane.verifyFirefoxAccount);
setEventListener("unverifiedUnlinkFxaAccount", "click", function () {
/* no warning as account can't have previously synced */
gSyncPane.unlinkFirefoxAccount(false);
});
setEventListener("rejectReSignIn", "command",
gSyncPane.reSignIn);
setEventListener("rejectUnlinkFxaAccount", "click", function () {
gSyncPane.unlinkFirefoxAccount(true);
});
setEventListener("fxaSyncComputerName", "change", function () {
gSyncUtils.changeName(this);
});
setEventListener("tosPP-small-ToS", "click", gSyncPane.openToS);
setEventListener("tosPP-small-PP", "click", gSyncPane.openPrivacyPolicy);
},
updateWeavePrefs: function () {
let service = Components.classes["@mozilla.org/weave/service;1"]
.getService(Components.interfaces.nsISupports)
@ -171,7 +258,7 @@ let gSyncPane = {
this.page = PAGE_HAS_ACCOUNT;
document.getElementById("accountName").textContent = Weave.Service.identity.account;
document.getElementById("syncComputerName").value = Weave.Service.clientsEngine.localName;
document.getElementById("tosPP").hidden = this._usingCustomServer;
document.getElementById("tosPP-normal").hidden = this._usingCustomServer;
}
},
@ -251,6 +338,17 @@ let gSyncPane = {
win.openUILinkIn(url, "tab");
},
openPrivacyPolicy: function(aEvent) {
aEvent.stopPropagation();
gSyncUtils.openPrivacyPolicy();
},
openToS: function(aEvent) {
aEvent.stopPropagation();
gSyncUtils.openToS();
},
signUp: function() {
this.openContentInBrowser("about:accounts?action=signup");
},

View File

@ -45,14 +45,12 @@
&weaveDesc.label;
</description>
<separator/>
<label class="text-link"
onclick="event.stopPropagation(); gSyncPane.openSetup(null);">
<label id="noAccountSetup" class="text-link">
&setupButton.label;
</label>
<vbox id="pairDevice">
<separator/>
<label class="text-link"
onclick="event.stopPropagation(); gSyncPane.openSetup('pair');">
<label id="noAccountPair" class="text-link">
&pairDevice.label;
</label>
</vbox>
@ -72,24 +70,19 @@
label="&manageAccount.label;"
accesskey="&manageAccount.accesskey;">
<menupopup>
<menuitem label="&viewQuota.label;"
oncommand="gSyncPane.openQuotaDialog();"/>
<menuitem id="syncViewQuota" label="&viewQuota.label;"/>
<menuseparator/>
<menuitem label="&changePassword2.label;"
oncommand="gSyncUtils.changePassword();"/>
<menuitem label="&myRecoveryKey.label;"
oncommand="gSyncUtils.resetPassphrase();"/>
<menuitem id="syncChangePassword" label="&changePassword2.label;"/>
<menuitem id="syncResetPassphrase" label="&myRecoveryKey.label;"/>
<menuseparator/>
<menuitem label="&resetSync2.label;"
oncommand="gSyncPane.resetSync();"/>
<menuitem id="syncReset" label="&resetSync2.label;"/>
</menupopup>
</button>
</hbox>
<hbox>
<label id="syncAddDeviceLabel"
class="text-link"
onclick="gSyncPane.openAddDevice(); return false;">
class="text-link">
&pairDevice.label;
</label>
</hbox>
@ -97,8 +90,7 @@
<vbox>
<label>&syncMy.label;</label>
<richlistbox id="syncEnginesList"
orient="vertical"
onselect="if (this.selectedCount) this.clearSelection();">
orient="vertical">
<richlistitem>
<checkbox label="&engine.addons.label;"
accesskey="&engine.addons.accesskey;"
@ -145,25 +137,21 @@
control="syncComputerName">
&syncDeviceName.label;
</label>
<textbox id="syncComputerName"
onchange="gSyncUtils.changeName(this)"/>
<textbox id="syncComputerName"/>
</row>
</rows>
</grid>
<hbox>
<label class="text-link"
onclick="gSyncPane.startOver(true); return false;">
<label id="unlinkDevice" class="text-link">
&unlinkDevice.label;
</label>
</hbox>
</groupbox>
<hbox id="tosPP" pack="center">
<label class="text-link"
onclick="event.stopPropagation();gSyncUtils.openToS();">
<hbox id="tosPP-normal" pack="center">
<label id="tosPP-normal-ToS" class="text-link">
&prefs.tosLink.label;
</label>
<label class="text-link"
onclick="event.stopPropagation();gSyncUtils.openPrivacyPolicy();">
<label id="tosPP-normal-PP" class="text-link">
&prefs.ppLink.label;
</label>
</hbox>
@ -172,17 +160,14 @@
<vbox id="needsUpdate" align="center" pack="center">
<hbox>
<label id="loginError"/>
<label class="text-link"
onclick="gSyncPane.updatePass(); return false;">
<label id="loginErrorUpdatePass" class="text-link">
&updatePass.label;
</label>
<label class="text-link"
onclick="gSyncPane.resetPass(); return false;">
<label id="loginErrorResetPass" class="text-link">
&resetPass.label;
</label>
</hbox>
<label class="text-link"
onclick="gSyncPane.startOver(true); return false;">
<label id="loginErrorStartOver" class="text-link">
&unlinkDevice.label;
</label>
</vbox>
@ -196,17 +181,14 @@
<vbox id="noFxaAccount" align="start">
<label>&welcome.description;</label>
<label class="text-link"
onclick="gSyncPane.signUp(); return false;">
<label id="noFxaSignUp" class="text-link">
&welcome.createAccount.label;
</label>
<label class="text-link"
onclick="gSyncPane.signIn(); return false;">
<label id="noFxaSignIn" class="text-link">
&welcome.signIn.label;
</label>
<separator/>
<label class="text-link"
onclick="gSyncPane.openOldSyncSupportPage(); return false;">
<label id="noFxaUseOldSync" class="text-link">
&welcome.useOldSync.label;
</label>
</vbox>
@ -221,10 +203,9 @@
<hbox align="center">
<label id="fxaEmailAddress1"/>
<spacer flex="1"/>
<button oncommand="gSyncPane.manageFirefoxAccount();"
<button id="verifiedManage"
label="&manage.label;"/>
<button id="fxaUnlinkButton"
oncommand="gSyncPane.unlinkFirefoxAccount(true);"
label="&disconnect.label;"/>
</hbox>
@ -237,10 +218,9 @@
</description>
<spacer flex="1"/>
<vbox align="end">
<button oncommand="gSyncPane.verifyFirefoxAccount();"
<button id="verifyFxaAccount"
label="&verify.label;"/>
<label class="text-link"
onclick="/* no warning as account can't have previously synced */ gSyncPane.unlinkFirefoxAccount(false);">
<label id="unverifiedUnlinkFxaAccount" class="text-link">
&forget.label;
</label>
</vbox>
@ -255,10 +235,9 @@
</description>
<spacer flex="1"/>
<vbox align="end">
<button oncommand="gSyncPane.reSignIn();"
<button id="rejectReSignIn"
label="&signIn.label;"/>
<label class="text-link"
onclick="gSyncPane.unlinkFirefoxAccount(true);">
<label id="rejectUnlinkFxaAccount" class="text-link">
&forget.label;
</label>
</vbox>
@ -298,17 +277,14 @@
&syncDeviceName.label;
</label>
<textbox id="fxaSyncComputerName"
flex="1"
onchange="gSyncUtils.changeName(this)"/>
flex="1"/>
</hbox>
<spacer flex="1"/>
<hbox id="tosPP" pack="center">
<label class="text-link small"
onclick="event.stopPropagation();gSyncUtils.openToS();">
<hbox id="tosPP-small" pack="center">
<label id="tosPP-small-ToS" class="text-link small">
&prefs.tosLink.label;
</label>
<label class="text-link small"
onclick="event.stopPropagation();gSyncUtils.openPrivacyPolicy();">
<label id="tosPP-small-PP" class="text-link small">
&fxaPrivacyNotice.link.label;
</label>
</hbox>

View File

@ -171,7 +171,7 @@ let gSyncPane = {
this.page = PAGE_HAS_ACCOUNT;
document.getElementById("accountName").value = Weave.Service.identity.account;
document.getElementById("syncComputerName").value = Weave.Service.clientsEngine.localName;
document.getElementById("tosPP").hidden = this._usingCustomServer;
document.getElementById("tosPP-normal").hidden = this._usingCustomServer;
}
},

View File

@ -153,7 +153,7 @@
value="&unlinkDevice.label;"/>
</hbox>
</groupbox>
<hbox id="tosPP" pack="center">
<hbox id="tosPP-normal" pack="center">
<label class="text-link"
onclick="event.stopPropagation();gSyncUtils.openToS();"
value="&prefs.tosLink.label;"/>
@ -290,7 +290,7 @@
onchange="gSyncUtils.changeName(this)"/>
</hbox>
<spacer flex="1"/>
<hbox id="tosPP" pack="center">
<hbox id="tosPP-small" pack="center">
<label class="text-link small"
onclick="event.stopPropagation();gSyncUtils.openToS();"
value="&prefs.tosLink.label;"/>

View File

@ -94,6 +94,7 @@ cookiesAll=The following cookies are stored on your computer:
cookiesFiltered=The following cookies match your search:
#### Offline apps
offlineAppsList.height=7em
offlineAppRemoveTitle=Remove offline website data
offlineAppRemovePrompt=After removing this data, %S will not be available offline. Are you sure you want to remove this offline website?
offlineAppRemoveConfirm=Remove offline data

View File

@ -131,6 +131,12 @@ prefpane {
height: 500px;
}
#handlersView > listheader {
-moz-appearance: none;
border: 0;
padding: 0;
}
#typeColumn,
#actionColumn {
-moz-appearance: none;
@ -244,7 +250,8 @@ description > html|a {
#weavePrefsDeck > vbox > description,
#weavePrefsDeck > vbox > #pairDevice > label,
#weavePrefsDeck > #needsUpdate > hbox > #loginError,
#weavePrefsDeck > #hasFxaAccount > hbox:not(#tosPP) > label {
#weavePrefsDeck > #hasFxaAccount > hbox:not(#tosPP-normal) > label,
#weavePrefsDeck > #hasFxaAccount > hbox:not(#tosPP-small) > label {
/* no margin-start for elements at the begin of a line */
-moz-margin-start: 0;
}