Backed out changeset: 764b057e1c3f (Bug 1139958 - Start using AppConstants.jsm in Toolkit)
authorPhilip Chee <philip.chee@gmail.com>
Sat, 28 Mar 2015 20:54:30 +0800
changeset 265211 0a7fd420b3eb5b214cb5a05fe87ee6a1754f8c12
parent 265210 764b057e1c3f32e5e29de1097fac25b65444f612
child 265212 7bcbabfb63fee3d68ba3da7c6c8e4e38ed52556c
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1139958
milestone39.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset: 764b057e1c3f (Bug 1139958 - Start using AppConstants.jsm in Toolkit)
testing/mochitest/browser-test.js
toolkit/modules/AppConstants.jsm
toolkit/modules/CertUtils.jsm
toolkit/modules/GMPInstallManager.jsm
toolkit/modules/LightweightThemeConsumer.jsm
toolkit/modules/ResetProfile.jsm
toolkit/modules/Troubleshoot.jsm
toolkit/modules/UpdateChannel.jsm
toolkit/modules/WindowDraggingUtils.jsm
toolkit/modules/moz.build
toolkit/modules/secondscreen/RokuApp.jsm
--- a/testing/mochitest/browser-test.js
+++ b/testing/mochitest/browser-test.js
@@ -10,17 +10,16 @@ if (Ci === undefined) {
   var Ci = Components.interfaces;
 }
 if (Cu === undefined) {
   var Cu = Components.utils;
 }
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "Services",
   "resource://gre/modules/Services.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "CustomizationTabPreloader",
   "resource:///modules/CustomizationTabPreloader.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "ContentSearch",
@@ -548,51 +547,48 @@ Tester.prototype = {
     // is invoked to start the tests.
     this.waitForWindowsState((function () {
       if (this.done) {
 
         // Uninitialize a few things explicitly so that they can clean up
         // frames and browser intentionally kept alive until shutdown to
         // eliminate false positives.
         if (gConfig.testRoot == "browser") {
-          // Skip if not Firefox e.g. SeaMonkey.
-          if (AppConstants.MOZ_APP_NAME == "browser") {
-            // Replace the document currently loaded in the Firefox sidebar.
-            // This will prevent false positives for tests that were the last
-            // to touch the sidebar. They will thus not be blamed for leaking
-            // a document.
-            let sidebar = document.getElementById("sidebar");
-            sidebar.setAttribute("src", "data:text/html;charset=utf-8,");
-            sidebar.docShell.createAboutBlankContentViewer(null);
-            sidebar.setAttribute("src", "about:blank");
+          // Replace the document currently loaded in the browser's sidebar.
+          // This will prevent false positives for tests that were the last
+          // to touch the sidebar. They will thus not be blamed for leaking
+          // a document.
+          let sidebar = document.getElementById("sidebar");
+          sidebar.setAttribute("src", "data:text/html;charset=utf-8,");
+          sidebar.docShell.createAboutBlankContentViewer(null);
+          sidebar.setAttribute("src", "about:blank");
 
-            // Do the same for the social sidebar.
-            let socialSidebar = document.getElementById("social-sidebar-browser");
-            socialSidebar.setAttribute("src", "data:text/html;charset=utf-8,");
-            socialSidebar.docShell.createAboutBlankContentViewer(null);
-            socialSidebar.setAttribute("src", "about:blank");
-
-            SelfSupportBackend.uninit();
-            CustomizationTabPreloader.uninit();
-            SocialFlyout.unload();
-            SocialShare.uninit();
-            TabView.uninit();
-          }
+          // Do the same for the social sidebar.
+          let socialSidebar = document.getElementById("social-sidebar-browser");
+          socialSidebar.setAttribute("src", "data:text/html;charset=utf-8,");
+          socialSidebar.docShell.createAboutBlankContentViewer(null);
+          socialSidebar.setAttribute("src", "about:blank");
 
           // Destroy BackgroundPageThumbs resources.
           let {BackgroundPageThumbs} =
             Cu.import("resource://gre/modules/BackgroundPageThumbs.jsm", {});
           BackgroundPageThumbs._destroy();
 
           // Destroy preloaded browsers.
           if (gBrowser._preloadedBrowser) {
             let browser = gBrowser._preloadedBrowser;
             gBrowser._preloadedBrowser = null;
             gBrowser.getNotificationBox(browser).remove();
           }
+
+          SelfSupportBackend.uninit();
+          CustomizationTabPreloader.uninit();
+          SocialFlyout.unload();
+          SocialShare.uninit();
+          TabView.uninit();
         }
 
         // Schedule GC and CC runs before finishing in order to detect
         // DOM windows leaked by our tests or the tested code. Note that we
         // use a shrinking GC so that the JS engine will discard JIT code and
         // JIT caches more aggressively.
 
         let checkForLeakedGlobalWindows = aCallback => {
--- a/toolkit/modules/AppConstants.jsm
+++ b/toolkit/modules/AppConstants.jsm
@@ -65,62 +65,35 @@ let AppConstants = Object.freeze({
 
   MOZ_SAFE_BROWSING:
 #ifdef MOZ_SAFE_BROWSING
   true,
 #else
   false,
 #endif
 
-  MOZ_SANDBOX:
-#ifdef MOZ_SANDBOX
-  true,
-#else
-  false,
-#endif
-
-  MOZ_SHARK:
-#ifdef XP_MACOSX
-#ifdef MOZ_SHARK
-  true,
-#else
-  false,
-#endif
-#else
-  false,
-#endif
-
   MOZ_TELEMETRY_REPORTING:
 #ifdef MOZ_TELEMETRY_REPORTING
   true,
 #else
   false,
 #endif
 
-  MOZ_UPDATER:
-#ifdef MOZ_UPDATER
-  true,
-#else
-  false,
-#endif
-
   MOZ_WEBRTC:
 #ifdef MOZ_WEBRTC
   true,
 #else
   false,
 #endif
 
   platform:
 #ifdef MOZ_WIDGET_GTK
   "linux",
 #elif MOZ_WIDGET_QT
   "linux",
-#elif XP_LINUX
-  "linux",
 #elif XP_WIN
   "win",
 #elif XP_MACOSX
   "macosx",
 #elif MOZ_WIDGET_ANDROID
   "android",
 #elif MOZ_WIDGET_GONK
   "gonk",
@@ -137,15 +110,12 @@ let AppConstants = Object.freeze({
 
   E10S_TESTING_ONLY:
 #ifdef E10S_TESTING_ONLY
   true,
 #else
   false,
 #endif
 
-  MOZ_APP_NAME: "@MOZ_APP_NAME@",
   MOZ_APP_VERSION: "@MOZ_APP_VERSION@",
-  MOZ_BUILD_APP: "@MOZ_BUILD_APP@",
-  MOZ_UPDATE_CHANNEL: "@MOZ_UPDATE_CHANNEL@",
-  MOZ_WIDGET_TOOLKIT: "@MOZ_WIDGET_TOOLKIT@",
+
   ANDROID_PACKAGE_NAME: "@ANDROID_PACKAGE_NAME@",
 });
--- a/toolkit/modules/CertUtils.jsm
+++ b/toolkit/modules/CertUtils.jsm
@@ -1,12 +1,14 @@
+#if 0
 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
+#endif
 this.EXPORTED_SYMBOLS = [ "BadCertHandler", "checkCert", "readCertPrefs", "validateCert" ];
 
 const Ce = Components.Exception;
 const Ci = Components.interfaces;
 const Cr = Components.results;
 const Cu = Components.utils;
 
 Components.utils.import("resource://gre/modules/Services.jsm");
--- a/toolkit/modules/GMPInstallManager.jsm
+++ b/toolkit/modules/GMPInstallManager.jsm
@@ -20,17 +20,16 @@ Cu.import("resource://gre/modules/Servic
 Cu.import("resource://gre/modules/FileUtils.jsm");
 Cu.import("resource://gre/modules/Promise.jsm");
 Cu.import("resource://gre/modules/Preferences.jsm");
 Cu.import("resource://gre/modules/Log.jsm");
 Cu.import("resource://gre/modules/osfile.jsm");
 Cu.import("resource://gre/modules/Task.jsm");
 Cu.import("resource://gre/modules/ctypes.jsm");
 Cu.import("resource://gre/modules/GMPUtils.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
 
 this.EXPORTED_SYMBOLS = ["GMPInstallManager", "GMPExtractor", "GMPDownloader",
                          "GMPAddon"];
 
 var gLocale = null;
 
 // Shared code for suppressing bad cert dialogs
 XPCOMUtils.defineLazyGetter(this, "gCertUtils", function() {
@@ -68,122 +67,122 @@ XPCOMUtils.defineLazyGetter(this, "gOSVe
   try {
     osVersion = sysInfo.getProperty("name") + " " + sysInfo.getProperty("version");
   }
   catch (e) {
     LOG("gOSVersion - OS Version unknown: updates are not possible.");
   }
 
   if (osVersion) {
-    if (AppConstants.platform == "win") {
-      const BYTE = ctypes.uint8_t;
-      const WORD = ctypes.uint16_t;
-      const DWORD = ctypes.uint32_t;
-      const WCHAR = ctypes.char16_t;
-      const BOOL = ctypes.int;
-  
-      // This structure is described at:
-      // http://msdn.microsoft.com/en-us/library/ms724833%28v=vs.85%29.aspx
-      const SZCSDVERSIONLENGTH = 128;
-      const OSVERSIONINFOEXW = new ctypes.StructType('OSVERSIONINFOEXW',
-          [
-          {dwOSVersionInfoSize: DWORD},
-          {dwMajorVersion: DWORD},
-          {dwMinorVersion: DWORD},
-          {dwBuildNumber: DWORD},
-          {dwPlatformId: DWORD},
-          {szCSDVersion: ctypes.ArrayType(WCHAR, SZCSDVERSIONLENGTH)},
-          {wServicePackMajor: WORD},
-          {wServicePackMinor: WORD},
-          {wSuiteMask: WORD},
-          {wProductType: BYTE},
-          {wReserved: BYTE}
-          ]);
-  
-      // This structure is described at:
-      // http://msdn.microsoft.com/en-us/library/ms724958%28v=vs.85%29.aspx
-      const SYSTEM_INFO = new ctypes.StructType('SYSTEM_INFO',
-          [
-          {wProcessorArchitecture: WORD},
-          {wReserved: WORD},
-          {dwPageSize: DWORD},
-          {lpMinimumApplicationAddress: ctypes.voidptr_t},
-          {lpMaximumApplicationAddress: ctypes.voidptr_t},
-          {dwActiveProcessorMask: DWORD.ptr},
-          {dwNumberOfProcessors: DWORD},
-          {dwProcessorType: DWORD},
-          {dwAllocationGranularity: DWORD},
-          {wProcessorLevel: WORD},
-          {wProcessorRevision: WORD}
-          ]);
-  
-      let kernel32 = false;
+#ifdef XP_WIN
+    const BYTE = ctypes.uint8_t;
+    const WORD = ctypes.uint16_t;
+    const DWORD = ctypes.uint32_t;
+    const WCHAR = ctypes.char16_t;
+    const BOOL = ctypes.int;
+
+    // This structure is described at:
+    // http://msdn.microsoft.com/en-us/library/ms724833%28v=vs.85%29.aspx
+    const SZCSDVERSIONLENGTH = 128;
+    const OSVERSIONINFOEXW = new ctypes.StructType('OSVERSIONINFOEXW',
+        [
+        {dwOSVersionInfoSize: DWORD},
+        {dwMajorVersion: DWORD},
+        {dwMinorVersion: DWORD},
+        {dwBuildNumber: DWORD},
+        {dwPlatformId: DWORD},
+        {szCSDVersion: ctypes.ArrayType(WCHAR, SZCSDVERSIONLENGTH)},
+        {wServicePackMajor: WORD},
+        {wServicePackMinor: WORD},
+        {wSuiteMask: WORD},
+        {wProductType: BYTE},
+        {wReserved: BYTE}
+        ]);
+
+    // This structure is described at:
+    // http://msdn.microsoft.com/en-us/library/ms724958%28v=vs.85%29.aspx
+    const SYSTEM_INFO = new ctypes.StructType('SYSTEM_INFO',
+        [
+        {wProcessorArchitecture: WORD},
+        {wReserved: WORD},
+        {dwPageSize: DWORD},
+        {lpMinimumApplicationAddress: ctypes.voidptr_t},
+        {lpMaximumApplicationAddress: ctypes.voidptr_t},
+        {dwActiveProcessorMask: DWORD.ptr},
+        {dwNumberOfProcessors: DWORD},
+        {dwProcessorType: DWORD},
+        {dwAllocationGranularity: DWORD},
+        {wProcessorLevel: WORD},
+        {wProcessorRevision: WORD}
+        ]);
+
+    let kernel32 = false;
+    try {
+      kernel32 = ctypes.open("Kernel32");
+    } catch (e) {
+      LOG("gOSVersion - Unable to open kernel32! " + e);
+      osVersion += ".unknown (unknown)";
+    }
+
+    if(kernel32) {
       try {
-        kernel32 = ctypes.open("Kernel32");
-      } catch (e) {
-        LOG("gOSVersion - Unable to open kernel32! " + e);
-        osVersion += ".unknown (unknown)";
-      }
-  
-      if(kernel32) {
+        // Get Service pack info
         try {
-          // Get Service pack info
-          try {
-            let GetVersionEx = kernel32.declare("GetVersionExW",
-                                                ctypes.default_abi,
-                                                BOOL,
-                                                OSVERSIONINFOEXW.ptr);
-            let winVer = OSVERSIONINFOEXW();
-            winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size;
-  
-            if(0 !== GetVersionEx(winVer.address())) {
-              osVersion += "." + winVer.wServicePackMajor
-                        +  "." + winVer.wServicePackMinor;
-            } else {
-              LOG("gOSVersion - Unknown failure in GetVersionEX (returned 0)");
-              osVersion += ".unknown";
-            }
-          } catch (e) {
-            LOG("gOSVersion - error getting service pack information. Exception: " + e);
+          let GetVersionEx = kernel32.declare("GetVersionExW",
+                                              ctypes.default_abi,
+                                              BOOL,
+                                              OSVERSIONINFOEXW.ptr);
+          let winVer = OSVERSIONINFOEXW();
+          winVer.dwOSVersionInfoSize = OSVERSIONINFOEXW.size;
+
+          if(0 !== GetVersionEx(winVer.address())) {
+            osVersion += "." + winVer.wServicePackMajor
+                      +  "." + winVer.wServicePackMinor;
+          } else {
+            LOG("gOSVersion - Unknown failure in GetVersionEX (returned 0)");
             osVersion += ".unknown";
           }
-  
-          // Get processor architecture
-          let arch = "unknown";
-          try {
-            let GetNativeSystemInfo = kernel32.declare("GetNativeSystemInfo",
-                                                       ctypes.default_abi,
-                                                       ctypes.void_t,
-                                                       SYSTEM_INFO.ptr);
-            let sysInfo = SYSTEM_INFO();
-            // Default to unknown
-            sysInfo.wProcessorArchitecture = 0xffff;
-  
-            GetNativeSystemInfo(sysInfo.address());
-            switch(sysInfo.wProcessorArchitecture) {
-              case 9:
-                arch = "x64";
-                break;
-              case 6:
-                arch = "IA64";
-                break;
-              case 0:
-                arch = "x86";
-                break;
-            }
-          } catch (e) {
-            LOG("gOSVersion - error getting processor architecture.  Exception: " + e);
-          } finally {
-            osVersion += " (" + arch + ")";
+        } catch (e) {
+          LOG("gOSVersion - error getting service pack information. Exception: " + e);
+          osVersion += ".unknown";
+        }
+
+        // Get processor architecture
+        let arch = "unknown";
+        try {
+          let GetNativeSystemInfo = kernel32.declare("GetNativeSystemInfo",
+                                                     ctypes.default_abi,
+                                                     ctypes.void_t,
+                                                     SYSTEM_INFO.ptr);
+          let sysInfo = SYSTEM_INFO();
+          // Default to unknown
+          sysInfo.wProcessorArchitecture = 0xffff;
+
+          GetNativeSystemInfo(sysInfo.address());
+          switch(sysInfo.wProcessorArchitecture) {
+            case 9:
+              arch = "x64";
+              break;
+            case 6:
+              arch = "IA64";
+              break;
+            case 0:
+              arch = "x86";
+              break;
           }
+        } catch (e) {
+          LOG("gOSVersion - error getting processor architecture.  Exception: " + e);
         } finally {
-          kernel32.close();
+          osVersion += " (" + arch + ")";
         }
+      } finally {
+        kernel32.close();
       }
     }
+#endif
 
     try {
       osVersion += " (" + sysInfo.getProperty("secondaryLibrary") + ")";
     }
     catch (e) {
       // Not all platforms have a secondary widget library, so an error is nothing to worry about.
     }
     osVersion = encodeURIComponent(osVersion);
@@ -197,29 +196,29 @@ XPCOMUtils.defineLazyGetter(this, "gOSVe
 XPCOMUtils.defineLazyGetter(this, "gABI", function aus_gABI() {
   let abi = null;
   try {
     abi = Services.appinfo.XPCOMABI;
   }
   catch (e) {
     LOG("gABI - XPCOM ABI unknown: updates are not possible.");
   }
-  if (AppConstants.platform == "macosx") {
-    // Mac universal build should report a different ABI than either macppc
-    // or mactel.
-    let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"].
-                   getService(Ci.nsIMacUtils);
+#ifdef XP_MACOSX
+  // Mac universal build should report a different ABI than either macppc
+  // or mactel.
+  let macutils = Cc["@mozilla.org/xpcom/mac-utils;1"].
+                 getService(Ci.nsIMacUtils);
 
-    if (macutils.isUniversalBinary)
-      abi += "-u-" + macutils.architecturesInBinary;
-    if (AppConstants.MOZ_SHARK) {
-      // Disambiguate optimised and shark nightlies
-      abi += "-shark"
-    }
-  }
+  if (macutils.isUniversalBinary)
+    abi += "-u-" + macutils.architecturesInBinary;
+#ifdef MOZ_SHARK
+  // Disambiguate optimised and shark nightlies
+  abi += "-shark"
+#endif
+#endif
   return abi;
 });
 
 /**
  * Provides an easy API for downloading and installing GMP Addons
  */
 function GMPInstallManager() {
 }
--- a/toolkit/modules/LightweightThemeConsumer.jsm
+++ b/toolkit/modules/LightweightThemeConsumer.jsm
@@ -3,17 +3,16 @@
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 this.EXPORTED_SYMBOLS = ["LightweightThemeConsumer"];
 
 const {utils: Cu} = Components;
 
 Cu.import("resource://gre/modules/XPCOMUtils.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "LightweightThemeImageOptimizer",
   "resource://gre/modules/addons/LightweightThemeImageOptimizer.jsm");
 
 XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
   "resource://gre/modules/PrivateBrowsingUtils.jsm");
 
 this.LightweightThemeConsumer =
@@ -134,37 +133,39 @@ LightweightThemeConsumer.prototype = {
       footer.style.backgroundColor = active ? aData.accentcolor || "white" : "";
       _setImage(footer, active, aData.footerURL);
       if (active && aData.footerURL)
         footer.setAttribute("lwthemefooter", "true");
       else
         footer.removeAttribute("lwthemefooter");
     }
 
+#ifdef XP_MACOSX
     // On OS X, we extend the lightweight theme into the titlebar, which means setting
     // the chromemargin attribute. Some XUL applications already draw in the titlebar,
     // so we need to save the chromemargin value before we overwrite it with the value
     // that lets us draw in the titlebar. We stash this value on the root attribute so
     // that XUL applications have the ability to invalidate the saved value.
-    if (AppConstants.platform == "macosx" && stateChanging) {
+    if (stateChanging) {
       if (!root.hasAttribute("chromemargin-nonlwtheme")) {
         root.setAttribute("chromemargin-nonlwtheme", root.getAttribute("chromemargin"));
       }
 
       if (active) {
         root.setAttribute("chromemargin", "0,-1,-1,-1");
       } else {
         let defaultChromemargin = root.getAttribute("chromemargin-nonlwtheme");
         if (defaultChromemargin) {
           root.setAttribute("chromemargin", defaultChromemargin);
         } else {
           root.removeAttribute("chromemargin");
         }
       }
     }
+#endif
     Services.obs.notifyObservers(this._win, "lightweight-theme-window-updated",
                                  JSON.stringify(aData));
   }
 }
 
 function _setImage(aElement, aActive, aURL) {
   aElement.style.backgroundImage =
     (aActive && aURL) ? 'url("' + aURL.replace(/"/g, '\\"') + '")' : "";
--- a/toolkit/modules/ResetProfile.jsm
+++ b/toolkit/modules/ResetProfile.jsm
@@ -2,22 +2,20 @@
  * 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/. */
 
 "use strict";
 
 this.EXPORTED_SYMBOLS = ["ResetProfile"];
 
 const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
+#expand const MOZ_APP_NAME = "__MOZ_APP_NAME__";
+#expand const MOZ_BUILD_APP = "__MOZ_BUILD_APP__";
 
 Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
-
-const MOZ_APP_NAME = AppConstants.MOZ_APP_NAME;
-const MOZ_BUILD_APP = AppConstants.MOZ_BUILD_APP;
 
 this.ResetProfile = {
   /**
    * Check if reset is supported for the currently running profile.
    *
    * @return boolean whether reset is supported.
    */
   resetSupported: function() {
--- a/toolkit/modules/Troubleshoot.jsm
+++ b/toolkit/modules/Troubleshoot.jsm
@@ -5,17 +5,20 @@
 this.EXPORTED_SYMBOLS = [
   "Troubleshoot",
 ];
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
 Cu.import("resource://gre/modules/AddonManager.jsm");
 Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
+
+#ifdef MOZ_CRASHREPORTER
+Cu.import("resource://gre/modules/CrashReports.jsm");
+#endif
 
 let Experiments;
 try {
   Experiments = Cu.import("resource:///modules/experiments/Experiments.jsm").Experiments;
 }
 catch (e) {
 }
 
@@ -146,18 +149,19 @@ let dataProviders = {
       name: Services.appinfo.name,
       version: Services.appinfo.version,
       buildID: Services.appinfo.appBuildID,
       userAgent: Cc["@mozilla.org/network/protocol;1?name=http"].
                  getService(Ci.nsIHttpProtocolHandler).
                  userAgent,
     };
 
-    if (AppConstants.MOZ_UPDATER)
-      data.updateChannel = Cu.import("resource://gre/modules/UpdateChannel.jsm", {}).UpdateChannel.get();
+#ifdef MOZ_UPDATER
+    data.updateChannel = Cu.import("resource://gre/modules/UpdateChannel.jsm", {}).UpdateChannel.get();
+#endif
 
     try {
       data.vendor = Services.prefs.getCharPref("app.support.vendor");
     }
     catch (e) {}
     let urlFormatter = Cc["@mozilla.org/toolkit/URLFormatterService;1"].
                        getService(Ci.nsIURLFormatter);
     try {
@@ -180,16 +184,28 @@ let dataProviders = {
       }
     }
 
     data.remoteAutoStart = Services.appinfo.browserTabsRemoteAutostart;
 
     done(data);
   },
 
+#ifdef MOZ_CRASHREPORTER
+  crashes: function crashes(done) {
+    let reports = CrashReports.getReports();
+    let now = new Date();
+    let reportsNew = reports.filter(report => (now - report.date < Troubleshoot.kMaxCrashAge));
+    let reportsSubmitted = reportsNew.filter(report => (!report.pending));
+    let reportsPendingCount = reportsNew.length - reportsSubmitted.length;
+    let data = {submitted : reportsSubmitted, pending : reportsPendingCount};
+    done(data);
+  },
+#endif
+
   extensions: function extensions(done) {
     AddonManager.getAddonsByTypes(["extension"], function (extensions) {
       extensions.sort(function (a, b) {
         if (a.isActive != b.isActive)
           return b.isActive ? 1 : -1;
         let lc = a.name.localeCompare(b.name);
         if (lc != 0)
           return lc;
@@ -317,19 +333,22 @@ let dataProviders = {
       catch (e) {
         continue;
       }
       if (data.windowLayerManagerType != "Basic")
         data.numAcceleratedWindows++;
     }
 
     if (!data.numAcceleratedWindows && gfxInfo) {
-      let win = AppConstants.platform == "win";
-      let feature = win ? gfxInfo.FEATURE_DIRECT3D_9_LAYERS :
-                          gfxInfo.FEATURE_OPENGL_LAYERS;
+      let feature =
+#ifdef XP_WIN
+        gfxInfo.FEATURE_DIRECT3D_9_LAYERS;
+#else
+        gfxInfo.FEATURE_OPENGL_LAYERS;
+#endif
       data.numAcceleratedWindowsMessage = statusMsgForFeature(feature);
     }
 
     if (!gfxInfo) {
       done(data);
       return;
     }
 
@@ -390,30 +409,30 @@ let dataProviders = {
 
     if (gl) {
       let ext = gl.getExtension("WEBGL_debug_renderer_info");
       // this extension is unconditionally available to chrome. No need to check.
       data.webglRenderer = gl.getParameter(ext.UNMASKED_VENDOR_WEBGL)
                            + " -- "
                            + gl.getParameter(ext.UNMASKED_RENDERER_WEBGL);
     } else {
-      let feature;
-      if (AppConstants.platform == "win") {
+      let feature =
+#ifdef XP_WIN
         // If ANGLE is not available but OpenGL is, we want to report on the
         // OpenGL feature, because that's what's going to get used.  In all
         // other cases we want to report on the ANGLE feature.
-        let angle = gfxInfo.getFeatureStatus(gfxInfo.FEATURE_WEBGL_ANGLE) ==
-                    gfxInfo.FEATURE_STATUS_OK;
-        let opengl = gfxInfo.getFeatureStatus(gfxInfo.FEATURE_WEBGL_OPENGL) ==
-                     gfxInfo.FEATURE_STATUS_OK;
-        feature = !angle && opengl ? gfxInfo.FEATURE_WEBGL_OPENGL :
-                                     gfxInfo.FEATURE_WEBGL_ANGLE;
-      } else {
-        feature = gfxInfo.FEATURE_WEBGL_OPENGL;
-      }
+        gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_WEBGL_ANGLE) !=
+          Ci.nsIGfxInfo.FEATURE_STATUS_OK &&
+        gfxInfo.getFeatureStatus(Ci.nsIGfxInfo.FEATURE_WEBGL_OPENGL) ==
+          Ci.nsIGfxInfo.FEATURE_STATUS_OK ?
+        Ci.nsIGfxInfo.FEATURE_WEBGL_OPENGL :
+        Ci.nsIGfxInfo.FEATURE_WEBGL_ANGLE;
+#else
+        Ci.nsIGfxInfo.FEATURE_WEBGL_OPENGL;
+#endif
       data.webglRendererMessage = statusMsgForFeature(feature);
     }
 
     let infoInfo = gfxInfo.getInfo();
     if (infoInfo)
       data.info = infoInfo;
 
     let failureCount = {};
@@ -476,41 +495,28 @@ let dataProviders = {
   },
 
   userJS: function userJS(done) {
     let userJSFile = Services.dirsvc.get("PrefD", Ci.nsIFile);
     userJSFile.append("user.js");
     done({
       exists: userJSFile.exists() && userJSFile.fileSize > 0,
     });
-  }
-};
+  },
 
-if (AppConstants.MOZ_CRASHREPORTER) {
-  dataProviders.crashes = function crashes(done) {
-    let CrashReports = Cu.import("resource://gre/modules/CrashReports.jsm").CrashReports;
-    let reports = CrashReports.getReports();
-    let now = new Date();
-    let reportsNew = reports.filter(report => (now - report.date < Troubleshoot.kMaxCrashAge));
-    let reportsSubmitted = reportsNew.filter(report => (!report.pending));
-    let reportsPendingCount = reportsNew.length - reportsSubmitted.length;
-    let data = {submitted : reportsSubmitted, pending : reportsPendingCount};
-    done(data);
-  }
-}
-
-if (AppConstants.platform == "linux" && AppConstants.MOZ_SANDBOX) {
-  dataProviders.sandbox = function sandbox(done) {
+#if defined(XP_LINUX) && defined (MOZ_SANDBOX)
+  sandbox: function sandbox(done) {
     const keys = ["hasSeccompBPF", "hasSeccompTSync",
                   "hasPrivilegedUserNamespaces", "hasUserNamespaces",
                   "canSandboxContent", "canSandboxMedia"];
 
     let sysInfo = Cc["@mozilla.org/system-info;1"].
                   getService(Ci.nsIPropertyBag2);
     let data = {};
     for (let key of keys) {
       if (sysInfo.hasKey(key)) {
         data[key] = sysInfo.getPropertyAsBool(key);
       }
     }
     done(data);
   }
-}
+#endif
+};
--- a/toolkit/modules/UpdateChannel.jsm
+++ b/toolkit/modules/UpdateChannel.jsm
@@ -1,30 +1,31 @@
+#filter substitution
+
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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/. */
 
 this.EXPORTED_SYMBOLS = ["UpdateChannel"];
 
 const Cu = Components.utils;
 
 Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
 
 this.UpdateChannel = {
   /**
    * Read the update channel from defaults only.  We do this to ensure that
    * the channel is tightly coupled with the application and does not apply
    * to other instances of the application that may use the same profile.
    *
    * @param [optional] aIncludePartners
    *        Whether or not to include the partner bits. Default: true.
    */
   get: function UpdateChannel_get(aIncludePartners = true) {
-    let channel = AppConstants.MOZ_UPDATE_CHANNEL;
+    let channel = "@MOZ_UPDATE_CHANNEL@";
     let defaults = Services.prefs.getDefaultBranch(null);
     try {
       channel = defaults.getCharPref("app.update.channel");
     } catch (e) {
       // use default value when pref not found
     }
 
     if (aIncludePartners) {
--- a/toolkit/modules/WindowDraggingUtils.jsm
+++ b/toolkit/modules/WindowDraggingUtils.jsm
@@ -1,26 +1,29 @@
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * 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");
-
-const USE_HITTEST = /^(win|macosx)/i.test(AppConstants.platform);
+#ifdef XP_WIN
+#define USE_HITTEST
+#elifdef MOZ_WIDGET_COCOA
+#define USE_HITTEST
+#endif
 
 this.EXPORTED_SYMBOLS = [ "WindowDraggingElement" ];
 
 this.WindowDraggingElement = function WindowDraggingElement(elem) {
   this._elem = elem;
   this._window = elem.ownerDocument.defaultView;
-
-  if (USE_HITTEST && !this.isPanel())
+#ifdef USE_HITTEST
+  if (!this.isPanel())
     this._elem.addEventListener("MozMouseHittest", this, false);
   else
-    this._elem.addEventListener("mousedown", this, false);
+#endif
+  this._elem.addEventListener("mousedown", this, false);
 };
 
 WindowDraggingElement.prototype = {
   mouseDownCheck: function(e) { return true; },
   dragTags: ["box", "hbox", "vbox", "spacer", "label", "statusbarpanel", "stack",
              "toolbaritem", "toolbarseparator", "toolbarspring", "toolbarspacer",
              "radiogroup", "deck", "scrollbox", "arrowscrollbox", "tabs"],
   shouldDrag: function(aEvent) {
@@ -52,45 +55,47 @@ WindowDraggingElement.prototype = {
     return true;
   },
   isPanel : function() {
     return this._elem instanceof Components.interfaces.nsIDOMXULElement &&
            this._elem.localName == "panel";
   },
   handleEvent: function(aEvent) {
     let isPanel = this.isPanel();
-    if (USE_HITTEST && !isPanel) {
+#ifdef USE_HITTEST
+    if (!isPanel) {
       if (this.shouldDrag(aEvent))
         aEvent.preventDefault();
       return;
     }
+#endif
 
     switch (aEvent.type) {
       case "mousedown":
         if (!this.shouldDrag(aEvent))
           return;
 
-        if (/^gtk/i.test(AppConstants.MOZ_WIDGET_TOOLKIT)) {
-          // On GTK, there is a toolkit-level function which handles
-          // window dragging, which must be used.
-          this._window.beginWindowMove(aEvent, isPanel ? this._elem : null);
-          break;
-        }
+#ifdef MOZ_WIDGET_GTK
+        // On GTK, there is a toolkit-level function which handles
+        // window dragging, which must be used.
+        this._window.beginWindowMove(aEvent, isPanel ? this._elem : null);
+#else
         if (isPanel) {
           let screenRect = this._elem.getOuterScreenRect();
           this._deltaX = aEvent.screenX - screenRect.left;
           this._deltaY = aEvent.screenY - screenRect.top;
         }
         else {
           this._deltaX = aEvent.screenX - this._window.screenX;
           this._deltaY = aEvent.screenY - this._window.screenY;
         }
         this._draggingWindow = true;
         this._window.addEventListener("mousemove", this, false);
         this._window.addEventListener("mouseup", this, false);
+#endif
         break;
       case "mousemove":
         if (this._draggingWindow) {
           let toDrag = this.isPanel() ? this._elem : this._window;
           toDrag.moveTo(aEvent.screenX - this._deltaX, aEvent.screenY - this._deltaY);
         }
         break;
       case "mouseup":
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -11,27 +11,24 @@ MOCHITEST_CHROME_MANIFESTS += ['tests/ch
 
 SPHINX_TREES['toolkit_modules'] = 'docs'
 
 EXTRA_JS_MODULES += [
     'AddonWatcher.jsm',
     'Battery.jsm',
     'BinarySearch.jsm',
     'BrowserUtils.jsm',
-    'CertUtils.jsm',
     'CharsetMenu.jsm',
     'debug.js',
     'DeferredTask.jsm',
     'Deprecated.jsm',
     'Dict.jsm',
     'FileUtils.jsm',
     'Finder.jsm',
     'Geometry.jsm',
-    'GMPInstallManager.jsm',
-    'GMPUtils.jsm',
     'Http.jsm',
     'InlineSpellChecker.jsm',
     'InlineSpellCheckerContent.jsm',
     'LoadContextInfo.jsm',
     'Log.jsm',
     'NewTabUtils.jsm',
     'PageMenu.jsm',
     'PageMetadata.jsm',
@@ -45,63 +42,64 @@ EXTRA_JS_MODULES += [
     'PromiseUtils.jsm',
     'PropertyListUtils.jsm',
     'RemoteController.jsm',
     'RemoteFinder.jsm',
     'RemotePageManager.jsm',
     'RemoteSecurityUI.jsm',
     'RemoteWebNavigation.jsm',
     'RemoteWebProgress.jsm',
-    'ResetProfile.jsm',
-    'secondscreen/RokuApp.jsm',
     'secondscreen/SimpleServiceDiscovery.jsm',
     'SelectContentHelper.jsm',
     'SelectParentHelper.jsm',
     'sessionstore/FormData.jsm',
     'sessionstore/ScrollPosition.jsm',
     'sessionstore/XPathGenerator.jsm',
     'ShortcutUtils.jsm',
     'Sntp.jsm',
     'SpatialNavigation.jsm',
     'Sqlite.jsm',
     'Task.jsm',
     'TelemetryTimestamps.jsm',
     'Timer.jsm',
-    'Troubleshoot.jsm',
-    'UpdateChannel.jsm',
     'WebChannel.jsm',
-    'WindowDraggingUtils.jsm',
     'ZipUtils.jsm',
 ]
 
 EXTRA_PP_JS_MODULES += [
+    'CertUtils.jsm',
+    'GMPInstallManager.jsm',
+    'GMPUtils.jsm',
+    'ResetProfile.jsm',
+    'secondscreen/RokuApp.jsm',
     'Services.jsm',
+    'Troubleshoot.jsm',
+    'UpdateChannel.jsm',
+    'WindowDraggingUtils.jsm',
     'WindowsPrefSync.jsm',
 ]
 
 if 'Android' != CONFIG['OS_TARGET']:
-    EXTRA_JS_MODULES += [
+    EXTRA_PP_JS_MODULES += [
         'LightweightThemeConsumer.jsm',
     ]
 else:
     DEFINES['ANDROID'] = True
 
 
 if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows':
     EXTRA_JS_MODULES += [
         'WindowsRegistry.jsm',
     ]
 
 for var in ('ANDROID_PACKAGE_NAME',
             'MOZ_APP_NAME',
-            'MOZ_APP_VERSION',
-            'MOZ_WIDGET_TOOLKIT'):
+            'MOZ_APP_VERSION'):
             DEFINES[var] = CONFIG[var]
 
 for var in ('MOZILLA_OFFICIAL',
-            'MOZ_TOOLKIT_SEARCH',
-            'MOZ_UPDATER'):
+            'MOZ_TOOLKIT_SEARCH'):
     if CONFIG[var]:
         DEFINES[var] = True
 
 EXTRA_PP_JS_MODULES += [
     'AppConstants.jsm',
 ]
--- a/toolkit/modules/secondscreen/RokuApp.jsm
+++ b/toolkit/modules/secondscreen/RokuApp.jsm
@@ -5,17 +5,16 @@
 
 "use strict";
 
 this.EXPORTED_SYMBOLS = ["RokuApp"];
 
 const { classes: Cc, interfaces: Ci, utils: Cu } = Components;
 
 Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/AppConstants.jsm");
 
 const WEBRTC_PLAYER_NAME = "WebRTC Player";
 const MIRROR_PORT = 8011;
 const JSON_MESSAGE_TERMINATOR = "\r\n";
 
 function log(msg) {
   //Services.console.logStringMessage(msg);
 }
@@ -24,17 +23,21 @@ const PROTOCOL_VERSION = 1;
 
 /* RokuApp is a wrapper for interacting with a Roku channel.
  * The basic interactions all use a REST API.
  * spec: http://sdkdocs.roku.com/display/sdkdoc/External+Control+Guide
  */
 function RokuApp(service) {
   this.service = service;
   this.resourceURL = this.service.location;
-  this.app = AppConstants.RELEASE_BUILD ? "Firefox" : "Firefox Nightly";
+#ifdef RELEASE_BUILD
+  this.app = "Firefox";
+#else
+  this.app = "Firefox Nightly";
+#endif
   this.mediaAppID = -1;
   this.mirrorAppID = -1;
 }
 
 RokuApp.prototype = {
   status: function status(callback) {
     // We have no way to know if the app is running, so just return "unknown"
     // but we use this call to fetch the mediaAppID for the given app name