Bug 1384044 - Stop using preprocessor in osfile.jsm. r=Yoric
authorMarco Castelluccio <mcastelluccio@mozilla.com>
Tue, 25 Jul 2017 13:53:13 +0200
changeset 422106 a53dcc2ca0aab660de8d418bdbe0cd92ac78cfe2
parent 422105 7b2ec925aed51791f02b585efa52cb504d2cc7dd
child 422107 08bef58cdb9db462ebfaeabd6e6cbd92d7ddbe08
push id1517
push userjlorenzo@mozilla.com
push dateThu, 14 Sep 2017 16:50:54 +0000
treeherdermozilla-release@3b41fd564418 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersYoric
bugs1384044
milestone56.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
Bug 1384044 - Stop using preprocessor in osfile.jsm. r=Yoric
toolkit/components/osfile/moz.build
toolkit/components/osfile/osfile.jsm
--- a/toolkit/components/osfile/moz.build
+++ b/toolkit/components/osfile/moz.build
@@ -20,16 +20,16 @@ XPIDL_MODULE = 'toolkit_osfile'
 XPIDL_SOURCES += [
     'nsINativeOSFileInternals.idl',
 ]
 
 EXPORTS.mozilla += [
     'NativeOSFileInternals.h',
 ]
 
-EXTRA_PP_JS_MODULES += [
+EXTRA_JS_MODULES += [
     'osfile.jsm',
 ]
 
 FINAL_LIBRARY = 'xul'
 
 with Files('**'):
     BUG_COMPONENT = ('Toolkit', 'OS.File')
--- a/toolkit/components/osfile/osfile.jsm
+++ b/toolkit/components/osfile/osfile.jsm
@@ -5,28 +5,31 @@
 /**
  * Common front for various implementations of OS.File
  */
 
 if (typeof Components != "undefined") {
   this.EXPORTED_SYMBOLS = ["OS"];
   Components.utils.import("resource://gre/modules/osfile/osfile_async_front.jsm", this);
 } else {
+  importScripts("resource://gre/modules/workers/require.js");
+
+  var SharedAll = require("resource://gre/modules/osfile/osfile_shared_allthreads.jsm");
+
   // At this stage, we need to import all sources at once to avoid
   // a unique failure on tbpl + talos that seems caused by a
   // what looks like a nested event loop bug (see bug 794091).
-#ifdef XP_WIN
-  importScripts(
-    "resource://gre/modules/workers/require.js",
-    "resource://gre/modules/osfile/osfile_win_back.jsm",
-    "resource://gre/modules/osfile/osfile_shared_front.jsm",
-    "resource://gre/modules/osfile/osfile_win_front.jsm"
-  );
-#else
-  importScripts(
-    "resource://gre/modules/workers/require.js",
-    "resource://gre/modules/osfile/osfile_unix_back.jsm",
-    "resource://gre/modules/osfile/osfile_shared_front.jsm",
-    "resource://gre/modules/osfile/osfile_unix_front.jsm"
-  );
-#endif
+  if (SharedAll.Constants.Win) {
+    importScripts(
+      "resource://gre/modules/osfile/osfile_win_back.jsm",
+      "resource://gre/modules/osfile/osfile_shared_front.jsm",
+      "resource://gre/modules/osfile/osfile_win_front.jsm"
+    );
+  } else {
+    importScripts(
+      "resource://gre/modules/osfile/osfile_unix_back.jsm",
+      "resource://gre/modules/osfile/osfile_shared_front.jsm",
+      "resource://gre/modules/osfile/osfile_unix_front.jsm"
+    );
+  }
+
   OS.Path = require("resource://gre/modules/osfile/ospath.jsm");
 }