Loading toolkit/components/alerts/resources/content/alert.js +8 −7 Original line number Diff line number Diff line Loading @@ -36,8 +36,6 @@ # # ***** END LICENSE BLOCK ***** Components.utils.import("resource://gre/modules/Services.jsm"); // Copied from nsILookAndFeel.h, see comments on eMetric_AlertNotificationOrigin const NS_ALERT_HORIZONTAL = 1; const NS_ALERT_LEFT = 2; Loading Loading @@ -95,10 +93,13 @@ function prefillAlertInfo() function onAlertLoad() { gSlideIncrement = Services.prefs.getIntPref("alerts.slideIncrement"); gSlideTime = Services.prefs.getIntPref("alerts.slideIncrementTime"); gOpenTime = Services.prefs.getIntPref("alerts.totalOpenTime"); gDisableSlideEffect = Services.prefs.getBoolPref("alerts.disableSlidingEffect"); var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(); prefService = prefService.QueryInterface(Components.interfaces.nsIPrefService); var prefBranch = prefService.getBranch(null); gSlideIncrement = prefBranch.getIntPref("alerts.slideIncrement"); gSlideTime = prefBranch.getIntPref("alerts.slideIncrementTime"); gOpenTime = prefBranch.getIntPref("alerts.totalOpenTime"); gDisableSlideEffect = prefBranch.getBoolPref("alerts.disableSlidingEffect"); // Make sure that the contents are fixed at the window edge facing the // screen's center so that the window looks like "sliding in" and not Loading toolkit/components/viewconfig/content/config.js +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ const nsPrefService_CONTRACTID = "@mozilla.org/preferences-service;1"; const nsClipboardHelper_CONTRACTID = "@mozilla.org/widget/clipboardhelper;1"; const nsAtomService_CONTRACTID = "@mozilla.org/atom-service;1"; const gPrefBranch = Services.prefs; const gPrefBranch = Services.prefs.getBranch(null); const gClipboardHelper = Components.classes[nsClipboardHelper_CONTRACTID].getService(nsIClipboardHelper); const gAtomService = Components.classes[nsAtomService_CONTRACTID].getService(nsIAtomService); Loading toolkit/components/viewsource/content/viewSource.js +52 −23 Original line number Diff line number Diff line Loading @@ -38,10 +38,9 @@ # # ***** END LICENSE BLOCK ***** Components.utils.import("resource://gre/modules/Services.jsm"); const Cc = Components.classes; const Ci = Components.interfaces; var gPrefs = null; var gLastLineFound = ''; var gGoToLine = 0; Loading Loading @@ -73,6 +72,13 @@ __defineGetter__("gPageLoader", function () { return this.gPageLoader = webnav.QueryInterface(Ci.nsIWebPageDescriptor); }); try { var prefService = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService); gPrefs = prefService.getBranch(null); } catch (ex) { } var gSelectionListener = { timeout: 0, attached: false, Loading Loading @@ -213,14 +219,22 @@ function viewSource(url) // Check the view_source.wrap_long_lines pref and set the menuitem's checked // attribute accordingly. var wraplonglinesPrefValue = Services.prefs .getBoolPref("view_source.wrap_long_lines"); if (gPrefs) { try { var wraplonglinesPrefValue = gPrefs.getBoolPref("view_source.wrap_long_lines"); if (wraplonglinesPrefValue) document.getElementById("menu_wrapLongLines").setAttribute("checked", "true"); } catch (ex) { } try { document.getElementById("menu_highlightSyntax").setAttribute("checked", Services.prefs.getBoolPref("view_source.syntax_highlight")); gPrefs.getBoolPref("view_source.syntax_highlight")); } catch (ex) { } } else { document.getElementById("menu_highlightSyntax").setAttribute("hidden", "true"); } window.addEventListener("AppCommand", HandleAppCommandEvent, true); window.addEventListener("MozSwipeGesture", HandleSwipeGesture, true); Loading Loading @@ -273,6 +287,9 @@ function onClickContent(event) { var target = event.originalTarget; var errorDoc = target.ownerDocument; var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"] .getService(Ci.nsIURLFormatter); if (/^about:blocked/.test(errorDoc.documentURI)) { // The event came from a button on a malware/phishing block page // First check whether it's malware or phishing, so that we can Loading @@ -291,7 +308,7 @@ function onClickContent(event) { // Get the stop badware "why is this blocked" report url, // append the current url, and go there. try { let reportURL = Services.urlFormatter.formatURLPref("browser.safebrowsing.malware.reportURL", true); let reportURL = formatter.formatURLPref("browser.safebrowsing.malware.reportURL", true); reportURL += errorDoc.location.href.slice(12); openURL(reportURL); } catch (e) { Loading @@ -299,7 +316,7 @@ function onClickContent(event) { } } else { // It's a phishing site, not malware try { var infoURL = Services.urlFormatter.formatURLPref("browser.safebrowsing.warning.infoURL", true); var infoURL = formatter.formatURLPref("browser.safebrowsing.warning.infoURL", true); openURL(infoURL); } catch (e) { Components.utils.reportError("Couldn't get phishing info URL: " + e); Loading Loading @@ -405,9 +422,12 @@ function getWebNavigation() function ViewSourceGoToLine() { var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"] .getService(Ci.nsIPromptService); var input = {value:gLastLineFound}; for (;;) { var ok = Services.prompt.prompt( var ok = promptService.prompt( window, gViewSourceBundle.getString("goToLineTitle"), gViewSourceBundle.getString("goToLineText"), Loading @@ -421,7 +441,7 @@ function ViewSourceGoToLine() var line = parseInt(input.value, 10); if (!(line > 0)) { Services.prompt.alert(window, promptService.alert(window, gViewSourceBundle.getString("invalidInputTitle"), gViewSourceBundle.getString("invalidInputText")); Loading @@ -433,7 +453,7 @@ function ViewSourceGoToLine() if (found) break; Services.prompt.alert(window, promptService.alert(window, gViewSourceBundle.getString("outOfRangeTitle"), gViewSourceBundle.getString("outOfRangeText")); } Loading Loading @@ -663,13 +683,22 @@ function wrapLongLines() if (myWrap.className == '') myWrap.className = 'wrap'; else myWrap.className = ''; else myWrap.className = ''; // Since multiple viewsource windows are possible, another window could have // affected the pref, so instead of determining the new pref value via the current // pref value, we use myWrap.className. Services.prefs.setBoolPref("view_source.wrap_long_lines", myWrap.className != ''); if (gPrefs) { try { if (myWrap.className == '') { gPrefs.setBoolPref("view_source.wrap_long_lines", false); } else { gPrefs.setBoolPref("view_source.wrap_long_lines", true); } } catch (ex) { } } } // Toggles syntax highlighting and sets the view_source.syntax_highlight Loading @@ -678,7 +707,7 @@ function highlightSyntax() { var highlightSyntaxMenu = document.getElementById("menu_highlightSyntax"); var highlightSyntax = (highlightSyntaxMenu.getAttribute("checked") == "true"); Services.prefs.setBoolPref("view_source.syntax_highlight", highlightSyntax); gPrefs.setBoolPref("view_source.syntax_highlight", highlightSyntax); gPageLoader.loadPage(gPageLoader.currentDescriptor, gPageLoader.DISPLAY_NORMAL); } Loading Loading
toolkit/components/alerts/resources/content/alert.js +8 −7 Original line number Diff line number Diff line Loading @@ -36,8 +36,6 @@ # # ***** END LICENSE BLOCK ***** Components.utils.import("resource://gre/modules/Services.jsm"); // Copied from nsILookAndFeel.h, see comments on eMetric_AlertNotificationOrigin const NS_ALERT_HORIZONTAL = 1; const NS_ALERT_LEFT = 2; Loading Loading @@ -95,10 +93,13 @@ function prefillAlertInfo() function onAlertLoad() { gSlideIncrement = Services.prefs.getIntPref("alerts.slideIncrement"); gSlideTime = Services.prefs.getIntPref("alerts.slideIncrementTime"); gOpenTime = Services.prefs.getIntPref("alerts.totalOpenTime"); gDisableSlideEffect = Services.prefs.getBoolPref("alerts.disableSlidingEffect"); var prefService = Components.classes["@mozilla.org/preferences-service;1"].getService(); prefService = prefService.QueryInterface(Components.interfaces.nsIPrefService); var prefBranch = prefService.getBranch(null); gSlideIncrement = prefBranch.getIntPref("alerts.slideIncrement"); gSlideTime = prefBranch.getIntPref("alerts.slideIncrementTime"); gOpenTime = prefBranch.getIntPref("alerts.totalOpenTime"); gDisableSlideEffect = prefBranch.getBoolPref("alerts.disableSlidingEffect"); // Make sure that the contents are fixed at the window edge facing the // screen's center so that the window looks like "sliding in" and not Loading
toolkit/components/viewconfig/content/config.js +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ const nsPrefService_CONTRACTID = "@mozilla.org/preferences-service;1"; const nsClipboardHelper_CONTRACTID = "@mozilla.org/widget/clipboardhelper;1"; const nsAtomService_CONTRACTID = "@mozilla.org/atom-service;1"; const gPrefBranch = Services.prefs; const gPrefBranch = Services.prefs.getBranch(null); const gClipboardHelper = Components.classes[nsClipboardHelper_CONTRACTID].getService(nsIClipboardHelper); const gAtomService = Components.classes[nsAtomService_CONTRACTID].getService(nsIAtomService); Loading
toolkit/components/viewsource/content/viewSource.js +52 −23 Original line number Diff line number Diff line Loading @@ -38,10 +38,9 @@ # # ***** END LICENSE BLOCK ***** Components.utils.import("resource://gre/modules/Services.jsm"); const Cc = Components.classes; const Ci = Components.interfaces; var gPrefs = null; var gLastLineFound = ''; var gGoToLine = 0; Loading Loading @@ -73,6 +72,13 @@ __defineGetter__("gPageLoader", function () { return this.gPageLoader = webnav.QueryInterface(Ci.nsIWebPageDescriptor); }); try { var prefService = Components.classes["@mozilla.org/preferences-service;1"] .getService(Components.interfaces.nsIPrefService); gPrefs = prefService.getBranch(null); } catch (ex) { } var gSelectionListener = { timeout: 0, attached: false, Loading Loading @@ -213,14 +219,22 @@ function viewSource(url) // Check the view_source.wrap_long_lines pref and set the menuitem's checked // attribute accordingly. var wraplonglinesPrefValue = Services.prefs .getBoolPref("view_source.wrap_long_lines"); if (gPrefs) { try { var wraplonglinesPrefValue = gPrefs.getBoolPref("view_source.wrap_long_lines"); if (wraplonglinesPrefValue) document.getElementById("menu_wrapLongLines").setAttribute("checked", "true"); } catch (ex) { } try { document.getElementById("menu_highlightSyntax").setAttribute("checked", Services.prefs.getBoolPref("view_source.syntax_highlight")); gPrefs.getBoolPref("view_source.syntax_highlight")); } catch (ex) { } } else { document.getElementById("menu_highlightSyntax").setAttribute("hidden", "true"); } window.addEventListener("AppCommand", HandleAppCommandEvent, true); window.addEventListener("MozSwipeGesture", HandleSwipeGesture, true); Loading Loading @@ -273,6 +287,9 @@ function onClickContent(event) { var target = event.originalTarget; var errorDoc = target.ownerDocument; var formatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"] .getService(Ci.nsIURLFormatter); if (/^about:blocked/.test(errorDoc.documentURI)) { // The event came from a button on a malware/phishing block page // First check whether it's malware or phishing, so that we can Loading @@ -291,7 +308,7 @@ function onClickContent(event) { // Get the stop badware "why is this blocked" report url, // append the current url, and go there. try { let reportURL = Services.urlFormatter.formatURLPref("browser.safebrowsing.malware.reportURL", true); let reportURL = formatter.formatURLPref("browser.safebrowsing.malware.reportURL", true); reportURL += errorDoc.location.href.slice(12); openURL(reportURL); } catch (e) { Loading @@ -299,7 +316,7 @@ function onClickContent(event) { } } else { // It's a phishing site, not malware try { var infoURL = Services.urlFormatter.formatURLPref("browser.safebrowsing.warning.infoURL", true); var infoURL = formatter.formatURLPref("browser.safebrowsing.warning.infoURL", true); openURL(infoURL); } catch (e) { Components.utils.reportError("Couldn't get phishing info URL: " + e); Loading Loading @@ -405,9 +422,12 @@ function getWebNavigation() function ViewSourceGoToLine() { var promptService = Cc["@mozilla.org/embedcomp/prompt-service;1"] .getService(Ci.nsIPromptService); var input = {value:gLastLineFound}; for (;;) { var ok = Services.prompt.prompt( var ok = promptService.prompt( window, gViewSourceBundle.getString("goToLineTitle"), gViewSourceBundle.getString("goToLineText"), Loading @@ -421,7 +441,7 @@ function ViewSourceGoToLine() var line = parseInt(input.value, 10); if (!(line > 0)) { Services.prompt.alert(window, promptService.alert(window, gViewSourceBundle.getString("invalidInputTitle"), gViewSourceBundle.getString("invalidInputText")); Loading @@ -433,7 +453,7 @@ function ViewSourceGoToLine() if (found) break; Services.prompt.alert(window, promptService.alert(window, gViewSourceBundle.getString("outOfRangeTitle"), gViewSourceBundle.getString("outOfRangeText")); } Loading Loading @@ -663,13 +683,22 @@ function wrapLongLines() if (myWrap.className == '') myWrap.className = 'wrap'; else myWrap.className = ''; else myWrap.className = ''; // Since multiple viewsource windows are possible, another window could have // affected the pref, so instead of determining the new pref value via the current // pref value, we use myWrap.className. Services.prefs.setBoolPref("view_source.wrap_long_lines", myWrap.className != ''); if (gPrefs) { try { if (myWrap.className == '') { gPrefs.setBoolPref("view_source.wrap_long_lines", false); } else { gPrefs.setBoolPref("view_source.wrap_long_lines", true); } } catch (ex) { } } } // Toggles syntax highlighting and sets the view_source.syntax_highlight Loading @@ -678,7 +707,7 @@ function highlightSyntax() { var highlightSyntaxMenu = document.getElementById("menu_highlightSyntax"); var highlightSyntax = (highlightSyntaxMenu.getAttribute("checked") == "true"); Services.prefs.setBoolPref("view_source.syntax_highlight", highlightSyntax); gPrefs.setBoolPref("view_source.syntax_highlight", highlightSyntax); gPageLoader.loadPage(gPageLoader.currentDescriptor, gPageLoader.DISPLAY_NORMAL); } Loading