diff options
Diffstat (limited to 'toolkit/components')
20 files changed, 114 insertions, 97 deletions
diff --git a/toolkit/components/alerts/jar.mn b/toolkit/components/alerts/jar.mn index c45939078f..c9bd127dd1 100644 --- a/toolkit/components/alerts/jar.mn +++ b/toolkit/components/alerts/jar.mn @@ -5,4 +5,4 @@ toolkit.jar: content/global/alerts/alert.css (resources/content/alert.css) content/global/alerts/alert.xul (resources/content/alert.xul) - content/global/alerts/alert.js (resources/content/alert.js) +* content/global/alerts/alert.js (resources/content/alert.js) diff --git a/toolkit/components/alerts/resources/content/alert.js b/toolkit/components/alerts/resources/content/alert.js index 12068b5488..e9725bedb0 100644 --- a/toolkit/components/alerts/resources/content/alert.js +++ b/toolkit/components/alerts/resources/content/alert.js @@ -4,7 +4,6 @@ var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components; -Cu.import("resource://gre/modules/AppConstants.jsm"); Cu.import("resource://gre/modules/Services.jsm"); /* @@ -26,10 +25,15 @@ const NS_ALERT_HORIZONTAL = 1; const NS_ALERT_LEFT = 2; const NS_ALERT_TOP = 4; -const WINDOW_MARGIN = AppConstants.platform == "win" ? 0 : 10; -const BODY_TEXT_LIMIT = 200; -const WINDOW_SHADOW_SPREAD = AppConstants.platform == "win" ? 10 : 0; +#ifdef XP_WIN +const WINDOW_MARGIN = 0; +const WINDOW_SHADOW_SPREAD = 10; +#else +const WINDOW_MARGIN = 10; +const WINDOW_SHADOW_SPREAD = 0; +#endif +const BODY_TEXT_LIMIT = 200; var gOrigin = 0; // Default value: alert from bottom right. var gReplacedWindow = null; diff --git a/toolkit/components/apppicker/content/appPicker.js b/toolkit/components/apppicker/content/appPicker.js index 469a6ca231..21a007632b 100644 --- a/toolkit/components/apppicker/content/appPicker.js +++ b/toolkit/components/apppicker/content/appPicker.js @@ -2,8 +2,6 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -Components.utils.import("resource://gre/modules/AppConstants.jsm"); - function AppPicker() {} AppPicker.prototype = @@ -115,19 +113,19 @@ AppPicker.prototype = * Retrieve the pretty description from the file */ getFileDisplayName: function getFileDisplayName(file) { - if (AppConstants.platform == "win") { - if (file instanceof Components.interfaces.nsILocalFileWin) { - try { - return file.getVersionInfoField("FileDescription"); - } catch (e) {} - } - } else if (AppConstants.platform == "macosx") { - if (file instanceof Components.interfaces.nsILocalFileMac) { - try { - return file.bundleDisplayName; - } catch (e) {} - } +#ifdef XP_WIN + if (file instanceof Components.interfaces.nsILocalFileWin) { + try { + return file.getVersionInfoField("FileDescription"); + } catch (e) {} + } +#elifdef XP_MACOSX + if (file instanceof Components.interfaces.nsILocalFileMac) { + try { + return file.bundleDisplayName; + } catch (e) {} } +#endif return file.leafName; }, @@ -183,13 +181,13 @@ AppPicker.prototype = var fileLoc = Components.classes["@mozilla.org/file/directory_service;1"] .getService(Components.interfaces.nsIProperties); var startLocation; - if (AppConstants.platform == "win") { - startLocation = "ProgF"; // Program Files - } else if (AppConstants.platform == "macosx") { - startLocation = "LocApp"; // Local Applications - } else { - startLocation = "Home"; - } +#ifdef XP_WIN + startLocation = "ProgF"; // Program Files +#elifdef XP_MACOSX + startLocation = "LocApp"; // Local Applications +#else + startLocation = "Home"; +#endif fp.displayDirectory = fileLoc.get(startLocation, Components.interfaces.nsILocalFile); diff --git a/toolkit/components/apppicker/jar.mn b/toolkit/components/apppicker/jar.mn index 60e029d8a7..d8431c3fea 100644 --- a/toolkit/components/apppicker/jar.mn +++ b/toolkit/components/apppicker/jar.mn @@ -4,5 +4,5 @@ toolkit.jar: content/global/appPicker.xul (content/appPicker.xul) - content/global/appPicker.js (content/appPicker.js) +* content/global/appPicker.js (content/appPicker.js) diff --git a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm index a6875ec48f..995cc06695 100644 --- a/toolkit/components/jsdownloads/src/DownloadIntegration.jsm +++ b/toolkit/components/jsdownloads/src/DownloadIntegration.jsm @@ -28,8 +28,7 @@ Cu.import("resource://gre/modules/XPCOMUtils.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "AsyncShutdown", "resource://gre/modules/AsyncShutdown.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "AppConstants", - "resource://gre/modules/AppConstants.jsm"); + XPCOMUtils.defineLazyModuleGetter(this, "DeferredTask", "resource://gre/modules/DeferredTask.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Downloads", @@ -696,8 +695,11 @@ this.DownloadIntegration = { fileExtension = match[1]; } - let isWindowsExe = AppConstants.platform == "win" && - fileExtension.toLowerCase() == "exe"; +#ifdef XP_WIN + let isWindowsExe = fileExtension.toLowerCase() == "exe"; +#else + let isWindowsExe = false; +#endif // Ask for confirmation if the file is executable, except for .exe on // Windows where the operating system will show the prompt based on the diff --git a/toolkit/components/jsdownloads/src/DownloadUIHelper.jsm b/toolkit/components/jsdownloads/src/DownloadUIHelper.jsm index ce165205bb..d4ce248e30 100644 --- a/toolkit/components/jsdownloads/src/DownloadUIHelper.jsm +++ b/toolkit/components/jsdownloads/src/DownloadUIHelper.jsm @@ -22,7 +22,6 @@ const Cu = Components.utils; const Cr = Components.results; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/AppConstants.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "OS", "resource://gre/modules/osfile.jsm"); @@ -186,17 +185,17 @@ this.DownloadPrompter.prototype = { switch (aPromptType) { case this.ON_QUIT: title = s.quitCancelDownloadsAlertTitle; - if (AppConstants.platform != "macosx") { - message = aDownloadsCount > 1 - ? s.quitCancelDownloadsAlertMsgMultiple(aDownloadsCount) - : s.quitCancelDownloadsAlertMsg; - cancelButton = s.dontQuitButtonWin; - } else { - message = aDownloadsCount > 1 - ? s.quitCancelDownloadsAlertMsgMacMultiple(aDownloadsCount) - : s.quitCancelDownloadsAlertMsgMac; - cancelButton = s.dontQuitButtonMac; - } +#ifdef XP_MACOSX + message = aDownloadsCount > 1 + ? s.quitCancelDownloadsAlertMsgMacMultiple(aDownloadsCount) + : s.quitCancelDownloadsAlertMsgMac; + cancelButton = s.dontQuitButtonMac; +#else + message = aDownloadsCount > 1 + ? s.quitCancelDownloadsAlertMsgMultiple(aDownloadsCount) + : s.quitCancelDownloadsAlertMsg; + cancelButton = s.dontQuitButtonWin; +#endif break; case this.ON_OFFLINE: title = s.offlineCancelDownloadsAlertTitle; diff --git a/toolkit/components/jsdownloads/src/moz.build b/toolkit/components/jsdownloads/src/moz.build index 87abed62ef..ac37682080 100644 --- a/toolkit/components/jsdownloads/src/moz.build +++ b/toolkit/components/jsdownloads/src/moz.build @@ -19,11 +19,11 @@ EXTRA_JS_MODULES += [ 'DownloadList.jsm', 'Downloads.jsm', 'DownloadStore.jsm', - 'DownloadUIHelper.jsm', ] EXTRA_PP_JS_MODULES += [ 'DownloadIntegration.jsm', + 'DownloadUIHelper.jsm', ] FINAL_LIBRARY = 'xul' diff --git a/toolkit/components/passwordmgr/OSCrypto.jsm b/toolkit/components/passwordmgr/OSCrypto.jsm index 04254f66f5..3d2b27c4e8 100644 --- a/toolkit/components/passwordmgr/OSCrypto.jsm +++ b/toolkit/components/passwordmgr/OSCrypto.jsm @@ -8,15 +8,14 @@ "use strict"; -Components.utils.import("resource://gre/modules/AppConstants.jsm"); Components.utils.import("resource://gre/modules/Services.jsm"); this.EXPORTED_SYMBOLS = ["OSCrypto"]; var OSCrypto = {}; -if (AppConstants.platform == "win") { - Services.scriptloader.loadSubScript("resource://gre/modules/OSCrypto_win.js", this); -} else { - throw new Error("OSCrypto.jsm isn't supported on this platform"); -} +#ifdef XP_WIN +Services.scriptloader.loadSubScript("resource://gre/modules/OSCrypto_win.js", this); +#else +throw new Error("OSCrypto.jsm isn't supported on this platform"); +#endif diff --git a/toolkit/components/passwordmgr/content/passwordManager.js b/toolkit/components/passwordmgr/content/passwordManager.js index 327ebbdf84..662f212790 100644 --- a/toolkit/components/passwordmgr/content/passwordManager.js +++ b/toolkit/components/passwordmgr/content/passwordManager.js @@ -5,7 +5,6 @@ /** * =================== SAVED SIGNONS CODE =================== ***/ const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components; -Cu.import("resource://gre/modules/AppConstants.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); @@ -486,9 +485,13 @@ function HandleSignonKeyPress(e) { if (signonsTree.getAttribute("editing")) { return; } + +#ifdef XP_MACOSX if (e.keyCode == KeyboardEvent.DOM_VK_DELETE || - (AppConstants.platform == "macosx" && - e.keyCode == KeyboardEvent.DOM_VK_BACK_SPACE)) { + e.keyCode == KeyboardEvent.DOM_VK_BACK_SPACE) { +#else + if (e.keyCode == KeyboardEvent.DOM_VK_DELETE) { +#endif DeleteSignon(); } } diff --git a/toolkit/components/passwordmgr/moz.build b/toolkit/components/passwordmgr/moz.build index e54e6ba2d3..af9a4ab03a 100644 --- a/toolkit/components/passwordmgr/moz.build +++ b/toolkit/components/passwordmgr/moz.build @@ -32,11 +32,11 @@ XPIDL_MODULE = 'loginmgr' EXTRA_COMPONENTS += [ 'crypto-SDR.js', 'nsLoginInfo.js', - 'nsLoginManager.js', 'nsLoginManagerPrompter.js', ] EXTRA_PP_COMPONENTS += [ + 'nsLoginManager.js', 'passwordmgr.manifest', ] @@ -46,9 +46,10 @@ EXTRA_JS_MODULES += [ 'LoginManagerContent.jsm', 'LoginManagerParent.jsm', 'LoginRecipes.jsm', - 'OSCrypto.jsm', ] +EXTRA_PP_JS_MODULES += ['OSCrypto.jsm'] + if CONFIG['OS_TARGET'] == 'Android': EXTRA_COMPONENTS += [ 'storage-mozStorage.js', diff --git a/toolkit/components/passwordmgr/nsLoginManager.js b/toolkit/components/passwordmgr/nsLoginManager.js index 514351fa52..87466fe5c1 100644 --- a/toolkit/components/passwordmgr/nsLoginManager.js +++ b/toolkit/components/passwordmgr/nsLoginManager.js @@ -8,7 +8,6 @@ const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components; const PERMISSION_SAVE_LOGINS = "login-saving"; -Cu.import("resource://gre/modules/AppConstants.jsm"); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Timer.jsm"); @@ -113,12 +112,12 @@ LoginManager.prototype = { _initStorage() { - let contractID; - if (AppConstants.platform == "android") { - contractID = "@mozilla.org/login-manager/storage/mozStorage;1"; - } else { - contractID = "@mozilla.org/login-manager/storage/json;1"; - } +#ifdef MOZ_WIDGET_ANDROID + let contractID = "@mozilla.org/login-manager/storage/mozStorage;1"; +#else + let contractID = "@mozilla.org/login-manager/storage/json;1"; +#endif + try { let catMan = Cc["@mozilla.org/categorymanager;1"]. getService(Ci.nsICategoryManager); diff --git a/toolkit/components/places/PlacesUtils.jsm b/toolkit/components/places/PlacesUtils.jsm index 5f6e81f18a..259fb7aa7d 100644 --- a/toolkit/components/places/PlacesUtils.jsm +++ b/toolkit/components/places/PlacesUtils.jsm @@ -30,7 +30,6 @@ const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components; Cu.importGlobalProperties(["URL"]); Cu.import("resource://gre/modules/XPCOMUtils.jsm"); -Cu.import("resource://gre/modules/AppConstants.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Services", "resource://gre/modules/Services.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "NetUtil", @@ -64,7 +63,11 @@ const MIN_TRANSACTIONS_FOR_BATCH = 5; // On Mac OSX, the transferable system converts "\r\n" to "\n\n", where // we really just want "\n". On other platforms, the transferable system // converts "\r\n" to "\n". -const NEWLINE = AppConstants.platform == "macosx" ? "\n" : "\r\n"; +#ifdef XP_MACOSX +const NEWLINE = "\n"; +#else +const NEWLINE = "\r\n"; +#endif function QI_node(aNode, aIID) { var result = null; diff --git a/toolkit/components/places/moz.build b/toolkit/components/places/moz.build index 85e1e93e1e..478b18e02f 100644 --- a/toolkit/components/places/moz.build +++ b/toolkit/components/places/moz.build @@ -72,9 +72,10 @@ if CONFIG['MOZ_PLACES']: 'PlacesSearchAutocompleteProvider.jsm', 'PlacesSyncUtils.jsm', 'PlacesTransactions.jsm', - 'PlacesUtils.jsm', ] + EXTRA_PP_JS_MODULES += ['PlacesUtils.jsm'] + EXTRA_COMPONENTS += [ 'ColorAnalyzer.js', 'nsLivemarkService.js', diff --git a/toolkit/components/printing/content/printPreviewBindings.xml b/toolkit/components/printing/content/printPreviewBindings.xml index 182ecc1993..c33b22e36e 100644 --- a/toolkit/components/printing/content/printPreviewBindings.xml +++ b/toolkit/components/printing/content/printPreviewBindings.xml @@ -161,10 +161,14 @@ let $ = id => document.getAnonymousElementByAttribute(this, "anonid", id); let ltr = document.documentElement.matches(":root:-moz-locale-dir(ltr)"); +#ifdef XP_WIN // Windows 7 doesn't support ⏮ and ⏭ by default, and fallback doesn't // always work (bug 1343330). - let {AppConstants} = Components.utils.import("resource://gre/modules/AppConstants.jsm", {}); - let useCompatCharacters = AppConstants.isPlatformAndVersionAtMost("win", "6.1"); + let useCompatCharacters = Services.vc.compare(Services.sysinfo.getProperty("version"), "6.1") <= 0; +#else + let useCompatCharacters = false; +#endif + let leftEnd = useCompatCharacters ? "⏪" : "⏮"; let rightEnd = useCompatCharacters ? "⏩" : "⏭"; $("navigateHome").label = ltr ? leftEnd : rightEnd; diff --git a/toolkit/components/printing/jar.mn b/toolkit/components/printing/jar.mn index 40f9acf2b0..a0e9510304 100644 --- a/toolkit/components/printing/jar.mn +++ b/toolkit/components/printing/jar.mn @@ -13,7 +13,7 @@ toolkit.jar: #endif content/global/printPageSetup.js (content/printPageSetup.js) content/global/printPageSetup.xul (content/printPageSetup.xul) - content/global/printPreviewBindings.xml (content/printPreviewBindings.xml) +* content/global/printPreviewBindings.xml (content/printPreviewBindings.xml) content/global/printPreviewProgress.js (content/printPreviewProgress.js) content/global/printPreviewProgress.xul (content/printPreviewProgress.xul) content/global/printProgress.js (content/printProgress.js) diff --git a/toolkit/components/satchel/FormHistory.jsm b/toolkit/components/satchel/FormHistory.jsm index 3d4a9fc436..ca9a28f1f6 100644 --- a/toolkit/components/satchel/FormHistory.jsm +++ b/toolkit/components/satchel/FormHistory.jsm @@ -91,7 +91,6 @@ const Cr = Components.results; Components.utils.import("resource://gre/modules/XPCOMUtils.jsm"); Components.utils.import("resource://gre/modules/Services.jsm"); -Components.utils.import("resource://gre/modules/AppConstants.jsm"); XPCOMUtils.defineLazyServiceGetter(this, "uuidService", "@mozilla.org/uuid-generator;1", @@ -102,7 +101,11 @@ const DAY_IN_MS = 86400000; // 1 day in milliseconds const MAX_SEARCH_TOKENS = 10; const NOOP = function noop() {}; -var supportsDeletedTable = AppConstants.platform == "android"; +#ifdef MOZ_WIDGET_ANDROID +var supportsDeletedTable = true; +#else +var supportsDeletedTable = false; +#endif var Prefs = { initialized: false, diff --git a/toolkit/components/satchel/moz.build b/toolkit/components/satchel/moz.build index 239f412bcf..883ee9f230 100644 --- a/toolkit/components/satchel/moz.build +++ b/toolkit/components/satchel/moz.build @@ -28,17 +28,19 @@ LOCAL_INCLUDES += [ EXTRA_COMPONENTS += [ 'FormHistoryStartup.js', 'nsFormAutoComplete.js', - 'nsFormHistory.js', 'nsInputListAutoComplete.js', 'satchel.manifest', ] +EXTRA_PP_COMPONENTS += ['nsFormHistory.js'] + EXTRA_JS_MODULES += [ 'AutoCompletePopup.jsm', - 'FormHistory.jsm', 'nsFormAutoCompleteResult.jsm', ] +EXTRA_PP_JS_MODULES += ['FormHistory.jsm'] + FINAL_LIBRARY = 'xul' JAR_MANIFESTS += ['jar.mn'] diff --git a/toolkit/components/satchel/nsFormHistory.js b/toolkit/components/satchel/nsFormHistory.js index d68be2d587..9d67f0729f 100644 --- a/toolkit/components/satchel/nsFormHistory.js +++ b/toolkit/components/satchel/nsFormHistory.js @@ -12,8 +12,6 @@ Components.utils.import("resource://gre/modules/Services.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Deprecated", "resource://gre/modules/Deprecated.jsm"); -XPCOMUtils.defineLazyModuleGetter(this, "AppConstants", - "resource://gre/modules/AppConstants.jsm"); const DB_VERSION = 4; const DAY_IN_MS = 86400000; // 1 day in milliseconds @@ -351,26 +349,26 @@ FormHistory.prototype = { }, moveToDeletedTable : function moveToDeletedTable(values, params) { - if (AppConstants.platform == "android") { - this.log("Moving entries to deleted table."); - - let stmt; - - try { - // Move the entries to the deleted items table. - let query = "INSERT INTO moz_deleted_formhistory (guid, timeDeleted) "; - if (values) query += values; - stmt = this.dbCreateStatement(query, params); - stmt.execute(); - } catch (e) { - this.log("Moving deleted entries failed: " + e); - throw e; - } finally { - if (stmt) { - stmt.reset(); - } - } - } +#ifdef MOZ_WIDGET_ANDROID + this.log("Moving entries to deleted table."); + + let stmt; + + try { + // Move the entries to the deleted items table. + let query = "INSERT INTO moz_deleted_formhistory (guid, timeDeleted) "; + if (values) query += values; + stmt = this.dbCreateStatement(query, params); + stmt.execute(); + } catch (e) { + this.log("Moving deleted entries failed: " + e); + throw e; + } finally { + if (stmt) { + stmt.reset(); + } + } +#endif }, get dbConnection() { diff --git a/toolkit/components/thumbnails/PageThumbUtils.jsm b/toolkit/components/thumbnails/PageThumbUtils.jsm index dda3a81b3c..fb5d67ddb5 100644 --- a/toolkit/components/thumbnails/PageThumbUtils.jsm +++ b/toolkit/components/thumbnails/PageThumbUtils.jsm @@ -14,7 +14,6 @@ const { classes: Cc, interfaces: Ci, utils: Cu } = Components; Cu.import("resource://gre/modules/XPCOMUtils.jsm", this); Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/Promise.jsm", this); -Cu.import("resource://gre/modules/AppConstants.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "BrowserUtils", "resource://gre/modules/BrowserUtils.jsm"); @@ -72,15 +71,17 @@ this.PageThumbUtils = { let windowScale = aWindow ? aWindow.devicePixelRatio : systemScale; let scale = Math.max(systemScale, windowScale); +#ifdef XP_MACOSX /** * * On retina displays, we can sometimes go down this path * without a window object. In those cases, force 2x scaling * as the system scale doesn't represent the 2x scaling * on OS X. */ - if (AppConstants.platform == "macosx" && !aWindow) { + if (!aWindow) { scale = 2; } +#endif /** * * THESE VALUES ARE DEFINED IN newtab.css and hard coded. diff --git a/toolkit/components/thumbnails/moz.build b/toolkit/components/thumbnails/moz.build index e4a178998f..bd7c1d3444 100644 --- a/toolkit/components/thumbnails/moz.build +++ b/toolkit/components/thumbnails/moz.build @@ -15,11 +15,11 @@ EXTRA_COMPONENTS += [ EXTRA_JS_MODULES += [ 'PageThumbs.jsm', 'PageThumbsWorker.js', - 'PageThumbUtils.jsm', ] EXTRA_PP_JS_MODULES += [ 'BackgroundPageThumbs.jsm', + 'PageThumbUtils.jsm', ] |