Backout 2629257557ff:284be1609a50 (bug 1001842) for debug xpcshell bustage
authorNathan Froyd <froydnj@mozilla.com>
Sat, 26 Apr 2014 13:18:32 -0400
changeset 198924 8feb1c83354a2dd5ac61331deedaf1112bed7e1f
parent 198923 73055a66d95a6580ac49d8d2cddb1b98e33b3ddc
child 198925 9e4afd48a72760a073cfce935f4f3cfb88b0d3df
push id3624
push userasasaki@mozilla.com
push dateMon, 09 Jun 2014 21:49:01 +0000
treeherdermozilla-beta@b1a5da15899a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1001842
milestone31.0a1
backs out2629257557ffe8aa193cd7139394ee0a2780cc1f
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
Backout 2629257557ff:284be1609a50 (bug 1001842) for debug xpcshell bustage
dom/system/OSFileConstants.cpp
dom/system/tests/test_constants.xul
dom/system/tests/worker_constants.js
xpcom/base/nsSystemInfo.cpp
xpcom/base/nsSystemInfo.h
xpcom/build/nsXPComInit.cpp
xpcom/tests/unit/test_systemInfo.js
--- a/dom/system/OSFileConstants.cpp
+++ b/dom/system/OSFileConstants.cpp
@@ -41,17 +41,16 @@
 
 // Used to provide information on the OS
 
 #include "nsThreadUtils.h"
 #include "nsIObserverService.h"
 #include "nsIObserver.h"
 #include "nsDirectoryServiceUtils.h"
 #include "nsIXULRuntime.h"
-#include "nsIPropertyBag2.h"
 #include "nsXPCOMCIDInternal.h"
 #include "nsServiceManagerUtils.h"
 #include "nsString.h"
 #include "nsAutoPtr.h"
 #include "nsDirectoryServiceDefs.h"
 #include "nsXULAppAPI.h"
 #include "nsAppDirectoryServiceDefs.h"
 #include "mozJSComponentLoader.h"
@@ -849,37 +848,16 @@ bool DefineOSFileConstants(JSContext *cx
 
 #if defined(DEBUG)
   JS::Rooted<JS::Value> valDebug(cx, JSVAL_TRUE);
   if (!JS_SetProperty(cx, objSys, "DEBUG", valDebug)) {
     return false;
   }
 #endif
 
-  // Get the umask from the system-info service.
-  // The property will always be present, but it will be zero on
-  // non-Unix systems.
-  {
-    uint32_t userUmask;
-    nsCOMPtr<nsIPropertyBag2> infoService =
-      do_GetService("@mozilla.org/system-info;1");
-    MOZ_ASSERT(infoService, "Could not access the system information service");
-    DebugOnly<nsresult> rv =
-      infoService->GetPropertyAsUint32(NS_LITERAL_STRING("umask"), &userUmask);
-    MOZ_ASSERT(NS_SUCCEEDED(rv), "failed to retrieve umask from info service");
-
-    dom::ConstantSpec umask_cs[] = {
-      { "umask", INT_TO_JSVAL(userUmask) },
-      PROP_END
-    };
-    if (!dom::DefineConstants(cx, objSys, umask_cs)) {
-      return false;
-    }
-  }
-
   // Build OS.Constants.Path
 
   JS::Rooted<JSObject*> objPath(cx);
   if (!(objPath = GetOrCreateObjectProperty(cx, objConstants, "Path"))) {
     return false;
   }
 
   // Locate libxul
--- a/dom/system/tests/test_constants.xul
+++ b/dom/system/tests/test_constants.xul
@@ -59,45 +59,32 @@ function test_Win() {
   }
 }
 
 // Test that OS.Constants.Sys.DEBUG is set properly on main thread
 function test_debugBuildMainThread(isDebugBuild) {
   is(isDebugBuild, !!OS.Constants.Sys.DEBUG, "OS.Constants.Sys.DEBUG is set properly on main thread");
 }
 
-// Test that OS.Constants.Sys.umask is set properly on main thread
-function test_umaskMainThread(umask) {
-  is(umask, OS.Constants.Sys.umask,
-     "OS.Constants.Sys.umask is set properly on main thread: " +
-     ("0000"+umask.toString(8)).slice(-4));
-}
-
-
 function test() {
   ok(true, "test_constants.xul: Starting test");
 
   // Test 1: Load libxul from main thread
   Components.classes["@mozilla.org/net/osfileconstantsservice;1"].
     getService(Components.interfaces.nsIOSFileConstantsService).
     init();
   Components.utils.import("resource://gre/modules/ctypes.jsm");
   test_xul();
   test_libc();
   test_Win();
 
   let isDebugBuild = Components.classes["@mozilla.org/xpcom/debug;1"]
                             .getService(Components.interfaces.nsIDebug2).isDebugBuild;
   test_debugBuildMainThread(isDebugBuild);
 
-  let umask = Components.classes["@mozilla.org/system-info;1"].
-    getService(Components.interfaces.nsIPropertyBag2).
-    getProperty("umask");
-  test_umaskMainThread(umask);
-
   // Test 2: Load libxul from chrome thread
   worker = new ChromeWorker("worker_constants.js");
   SimpleTest.waitForExplicitFinish();
   ok(true, "test_constants.xul: Chrome worker created");
   worker.onerror = function onerror(error) {
     error.preventDefault();
     ok(false, "error " + error);
   }
@@ -116,22 +103,18 @@ function test() {
       SimpleTest.finish();
       return;
     default:
       SimpleTest.ok(false, "test_constants.xul: wrong message " + JSON.stringify(msg.data));
       return;
     }
   };
 
-  // pass expected values that are unavailable off-main-thread
-  // to the worker
-  worker.postMessage({
-    isDebugBuild: isDebugBuild,
-    umask: umask
-  });
+  // nsIDebug2 is inaccessible from ChromeWorker. We need to pass isDebugBuild to the worker
+  worker.postMessage(isDebugBuild);
   ok(true, "test_constants.xul: Test in progress");
 };
 ]]>
   </script>
 
   <body xmlns="http://www.w3.org/1999/xhtml">
     <p id="display"></p>
     <div id="content" style="display:none;"></div>
--- a/dom/system/tests/worker_constants.js
+++ b/dom/system/tests/worker_constants.js
@@ -8,22 +8,21 @@ function log(text) {
 function send(message) {
   self.postMessage(message);
 }
 
 self.onmessage = function(msg) {
   self.onmessage = function(msg) {
     log("ignored message "+JSON.stringify(msg.data));
   };
-  let { isDebugBuild, umask } = msg.data;
+  let isDebugBuild = msg.data;
   try {
     test_name();
     test_xul();
     test_debugBuildWorkerThread(isDebugBuild);
-    test_umaskWorkerThread(umask);
   } catch (x) {
     log("Catching error: " + x);
     log("Stack: " + x.stack);
     log("Source: " + x.toSource());
     ok(false, x.toString() + "\n" + x.stack);
   }
   finish();
 };
@@ -47,23 +46,16 @@ function test_name() {
   isnot(null, OS.Constants.Sys.Name, "OS.Constants.Sys.Name is defined");
 }
 
 // Test that OS.Constants.Sys.DEBUG is set properly in ChromeWorker thread
 function test_debugBuildWorkerThread(isDebugBuild) {
   is(isDebugBuild, !!OS.Constants.Sys.DEBUG, "OS.Constants.Sys.DEBUG is set properly on worker thread");
 }
 
-// Test that OS.Constants.Sys.umask is set properly in ChromeWorker thread
-function test_umaskWorkerThread(umask) {
-  is(umask, OS.Constants.Sys.umask,
-     "OS.Constants.Sys.umask is set properly on worker thread: " +
-     ("0000"+umask.toString(8)).slice(-4));
-}
-
 // Test that OS.Constants.Path.libxul lets us open libxul
 function test_xul() {
   let lib;
   isnot(null, OS.Constants.Path.libxul, "libxul is defined");
   try {
     lib = ctypes.open(OS.Constants.Path.libxul);
     lib.declare("DumpJSStack", ctypes.default_abi, ctypes.void_t);
   } catch (x) {
--- a/xpcom/base/nsSystemInfo.cpp
+++ b/xpcom/base/nsSystemInfo.cpp
@@ -35,23 +35,16 @@ using namespace mozilla::widget::android
 #endif
 
 #ifdef ANDROID
 extern "C" {
 NS_EXPORT int android_sdk_version;
 }
 #endif
 
-// Slot for NS_InitXPCOM2 to pass information to nsSystemInfo::Init.
-// Only set to nonzero (potentially) if XP_UNIX.  On such systems, the
-// system call to discover the appropriate value is not thread-safe,
-// so we must call it before going multithreaded, but nsSystemInfo::Init
-// only happens well after that point.
-uint32_t nsSystemInfo::gUserUmask = 0;
-
 #if defined(XP_WIN)
 namespace {
 nsresult GetHDDInfo(const char* aSpecialDirName, nsAutoCString& aModel,
                     nsAutoCString& aRevision)
 {
     aModel.Truncate();
     aRevision.Truncate();
 
@@ -200,17 +193,16 @@ nsSystemInfo::Init()
 #endif
 
     // Additional informations not available through PR_GetSystemInfo.
     SetInt32Property(NS_LITERAL_STRING("pagesize"), PR_GetPageSize());
     SetInt32Property(NS_LITERAL_STRING("pageshift"), PR_GetPageShift());
     SetInt32Property(NS_LITERAL_STRING("memmapalign"), PR_GetMemMapAlignment());
     SetInt32Property(NS_LITERAL_STRING("cpucount"), PR_GetNumberOfProcessors());
     SetUint64Property(NS_LITERAL_STRING("memsize"), PR_GetPhysicalMemorySize());
-    SetUint32Property(NS_LITERAL_STRING("umask"), nsSystemInfo::gUserUmask);
 
     for (uint32_t i = 0; i < ArrayLength(cpuPropItems); i++) {
         rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16(cpuPropItems[i].name),
                                cpuPropItems[i].propfun());
         if (NS_WARN_IF(NS_FAILED(rv)))
           return rv;
     }
 
@@ -310,29 +302,16 @@ nsSystemInfo::SetInt32Property(const nsA
     nsresult rv =
 #endif
       SetPropertyAsInt32(aPropertyName, aValue);
     NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Unable to set property");
   }
 }
 
 void
-nsSystemInfo::SetUint32Property(const nsAString &aPropertyName,
-                                const uint32_t aValue)
-{
-  // Only one property is currently set via this function.
-  // It may legitimately be zero.
-#ifdef DEBUG
-  nsresult rv =
-#endif
-    SetPropertyAsUint32(aPropertyName, aValue);
-  NS_WARN_IF_FALSE(NS_SUCCEEDED(rv), "Unable to set property");
-}
-
-void
 nsSystemInfo::SetUint64Property(const nsAString &aPropertyName,
                                 const uint64_t aValue)
 {
   NS_WARN_IF_FALSE(aValue > 0, "Unable to read system value");
   if (aValue > 0) {
 #ifdef DEBUG
     nsresult rv =
 #endif
--- a/xpcom/base/nsSystemInfo.h
+++ b/xpcom/base/nsSystemInfo.h
@@ -9,25 +9,19 @@
 #include "nsHashPropertyBag.h"
 
 class nsSystemInfo : public nsHashPropertyBag {
 public:
     nsSystemInfo();
 
     nsresult Init();
 
-    // Slot for NS_InitXPCOM2 to pass information to nsSystemInfo::Init.
-    // See comments above the variable definition and in NS_InitXPCOM2.
-    static uint32_t gUserUmask;
-
 protected:
     void SetInt32Property(const nsAString &aPropertyName,
                           const int32_t aValue);
-    void SetUint32Property(const nsAString &aPropertyName,
-                           const uint32_t aValue);
     void SetUint64Property(const nsAString &aPropertyName,
                            const uint64_t aValue);
 
 private:
     ~nsSystemInfo();
 };
 
 #define NS_SYSTEMINFO_CONTRACTID "@mozilla.org/system-info;1"
--- a/xpcom/build/nsXPComInit.cpp
+++ b/xpcom/build/nsXPComInit.cpp
@@ -456,27 +456,16 @@ NS_InitXPCOM2(nsIServiceManager* *result
 
      // We are not shutting down
     gXPCOMShuttingDown = false;
 
     // Initialize the available memory tracker before other threads have had a
     // chance to start up, because the initialization is not thread-safe.
     mozilla::AvailableMemoryTracker::Init();
 
-#ifdef XP_UNIX
-    // Discover the current value of the umask, and save it where
-    // nsSystemInfo::Init can retrieve it when necessary.  There is no way
-    // to read the umask without changing it, and the setting is process-
-    // global, so this must be done while we are still single-threaded; the
-    // nsSystemInfo object is typically created much later, when some piece
-    // of chrome JS wants it.  The system call is specified as unable to fail.
-    nsSystemInfo::gUserUmask = ::umask(0777);
-    ::umask(nsSystemInfo::gUserUmask);
-#endif
-
     NS_LogInit();
 
     // Set up chromium libs
     NS_ASSERTION(!sExitManager && !sMessageLoop, "Bad logic!");
 
     if (!AtExitManager::AlreadyRegistered()) {
         sExitManager = new AtExitManager();
     }
--- a/xpcom/tests/unit/test_systemInfo.js
+++ b/xpcom/tests/unit/test_systemInfo.js
@@ -8,13 +8,9 @@ function run_test() {
   let sysInfo = Components.classes["@mozilla.org/system-info;1"].
                 getService(Components.interfaces.nsIPropertyBag2);
 
   PROPERTIES.forEach(function(aPropertyName) {
     print("Testing property: " + aPropertyName);
     let value = sysInfo.getProperty(aPropertyName);
     do_check_true(!!value);
   });
-
-  // This property must exist, but its value might be zero.
-  print("Testing property: umask")
-  do_check_eq(typeof sysInfo.getProperty("umask"), "number");
 }