Backout 2629257557ff:284be1609a50 (bug 1001842) for debug xpcshell bustage
This commit is contained in:
@@ -46,7 +46,6 @@
|
|||||||
#include "nsIObserver.h"
|
#include "nsIObserver.h"
|
||||||
#include "nsDirectoryServiceUtils.h"
|
#include "nsDirectoryServiceUtils.h"
|
||||||
#include "nsIXULRuntime.h"
|
#include "nsIXULRuntime.h"
|
||||||
#include "nsIPropertyBag2.h"
|
|
||||||
#include "nsXPCOMCIDInternal.h"
|
#include "nsXPCOMCIDInternal.h"
|
||||||
#include "nsServiceManagerUtils.h"
|
#include "nsServiceManagerUtils.h"
|
||||||
#include "nsString.h"
|
#include "nsString.h"
|
||||||
@@ -854,27 +853,6 @@ bool DefineOSFileConstants(JSContext *cx, JS::Handle<JSObject*> global)
|
|||||||
}
|
}
|
||||||
#endif
|
#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
|
// Build OS.Constants.Path
|
||||||
|
|
||||||
JS::Rooted<JSObject*> objPath(cx);
|
JS::Rooted<JSObject*> objPath(cx);
|
||||||
|
|||||||
@@ -64,14 +64,6 @@ function test_debugBuildMainThread(isDebugBuild) {
|
|||||||
is(isDebugBuild, !!OS.Constants.Sys.DEBUG, "OS.Constants.Sys.DEBUG is set properly on main thread");
|
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() {
|
function test() {
|
||||||
ok(true, "test_constants.xul: Starting test");
|
ok(true, "test_constants.xul: Starting test");
|
||||||
|
|
||||||
@@ -88,11 +80,6 @@ function test() {
|
|||||||
.getService(Components.interfaces.nsIDebug2).isDebugBuild;
|
.getService(Components.interfaces.nsIDebug2).isDebugBuild;
|
||||||
test_debugBuildMainThread(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
|
// Test 2: Load libxul from chrome thread
|
||||||
worker = new ChromeWorker("worker_constants.js");
|
worker = new ChromeWorker("worker_constants.js");
|
||||||
SimpleTest.waitForExplicitFinish();
|
SimpleTest.waitForExplicitFinish();
|
||||||
@@ -121,12 +108,8 @@ function test() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// pass expected values that are unavailable off-main-thread
|
// nsIDebug2 is inaccessible from ChromeWorker. We need to pass isDebugBuild to the worker
|
||||||
// to the worker
|
worker.postMessage(isDebugBuild);
|
||||||
worker.postMessage({
|
|
||||||
isDebugBuild: isDebugBuild,
|
|
||||||
umask: umask
|
|
||||||
});
|
|
||||||
ok(true, "test_constants.xul: Test in progress");
|
ok(true, "test_constants.xul: Test in progress");
|
||||||
};
|
};
|
||||||
]]>
|
]]>
|
||||||
|
|||||||
@@ -13,12 +13,11 @@ self.onmessage = function(msg) {
|
|||||||
self.onmessage = function(msg) {
|
self.onmessage = function(msg) {
|
||||||
log("ignored message "+JSON.stringify(msg.data));
|
log("ignored message "+JSON.stringify(msg.data));
|
||||||
};
|
};
|
||||||
let { isDebugBuild, umask } = msg.data;
|
let isDebugBuild = msg.data;
|
||||||
try {
|
try {
|
||||||
test_name();
|
test_name();
|
||||||
test_xul();
|
test_xul();
|
||||||
test_debugBuildWorkerThread(isDebugBuild);
|
test_debugBuildWorkerThread(isDebugBuild);
|
||||||
test_umaskWorkerThread(umask);
|
|
||||||
} catch (x) {
|
} catch (x) {
|
||||||
log("Catching error: " + x);
|
log("Catching error: " + x);
|
||||||
log("Stack: " + x.stack);
|
log("Stack: " + x.stack);
|
||||||
@@ -52,13 +51,6 @@ function test_debugBuildWorkerThread(isDebugBuild) {
|
|||||||
is(isDebugBuild, !!OS.Constants.Sys.DEBUG, "OS.Constants.Sys.DEBUG is set properly on worker thread");
|
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
|
// Test that OS.Constants.Path.libxul lets us open libxul
|
||||||
function test_xul() {
|
function test_xul() {
|
||||||
let lib;
|
let lib;
|
||||||
|
|||||||
@@ -40,13 +40,6 @@ NS_EXPORT int android_sdk_version;
|
|||||||
}
|
}
|
||||||
#endif
|
#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)
|
#if defined(XP_WIN)
|
||||||
namespace {
|
namespace {
|
||||||
nsresult GetHDDInfo(const char* aSpecialDirName, nsAutoCString& aModel,
|
nsresult GetHDDInfo(const char* aSpecialDirName, nsAutoCString& aModel,
|
||||||
@@ -205,7 +198,6 @@ nsSystemInfo::Init()
|
|||||||
SetInt32Property(NS_LITERAL_STRING("memmapalign"), PR_GetMemMapAlignment());
|
SetInt32Property(NS_LITERAL_STRING("memmapalign"), PR_GetMemMapAlignment());
|
||||||
SetInt32Property(NS_LITERAL_STRING("cpucount"), PR_GetNumberOfProcessors());
|
SetInt32Property(NS_LITERAL_STRING("cpucount"), PR_GetNumberOfProcessors());
|
||||||
SetUint64Property(NS_LITERAL_STRING("memsize"), PR_GetPhysicalMemorySize());
|
SetUint64Property(NS_LITERAL_STRING("memsize"), PR_GetPhysicalMemorySize());
|
||||||
SetUint32Property(NS_LITERAL_STRING("umask"), nsSystemInfo::gUserUmask);
|
|
||||||
|
|
||||||
for (uint32_t i = 0; i < ArrayLength(cpuPropItems); i++) {
|
for (uint32_t i = 0; i < ArrayLength(cpuPropItems); i++) {
|
||||||
rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16(cpuPropItems[i].name),
|
rv = SetPropertyAsBool(NS_ConvertASCIItoUTF16(cpuPropItems[i].name),
|
||||||
@@ -314,19 +306,6 @@ nsSystemInfo::SetInt32Property(const nsAString &aPropertyName,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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
|
void
|
||||||
nsSystemInfo::SetUint64Property(const nsAString &aPropertyName,
|
nsSystemInfo::SetUint64Property(const nsAString &aPropertyName,
|
||||||
const uint64_t aValue)
|
const uint64_t aValue)
|
||||||
|
|||||||
@@ -14,15 +14,9 @@ public:
|
|||||||
|
|
||||||
nsresult Init();
|
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:
|
protected:
|
||||||
void SetInt32Property(const nsAString &aPropertyName,
|
void SetInt32Property(const nsAString &aPropertyName,
|
||||||
const int32_t aValue);
|
const int32_t aValue);
|
||||||
void SetUint32Property(const nsAString &aPropertyName,
|
|
||||||
const uint32_t aValue);
|
|
||||||
void SetUint64Property(const nsAString &aPropertyName,
|
void SetUint64Property(const nsAString &aPropertyName,
|
||||||
const uint64_t aValue);
|
const uint64_t aValue);
|
||||||
|
|
||||||
|
|||||||
@@ -461,17 +461,6 @@ NS_InitXPCOM2(nsIServiceManager* *result,
|
|||||||
// chance to start up, because the initialization is not thread-safe.
|
// chance to start up, because the initialization is not thread-safe.
|
||||||
mozilla::AvailableMemoryTracker::Init();
|
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();
|
NS_LogInit();
|
||||||
|
|
||||||
// Set up chromium libs
|
// Set up chromium libs
|
||||||
|
|||||||
@@ -13,8 +13,4 @@ function run_test() {
|
|||||||
let value = sysInfo.getProperty(aPropertyName);
|
let value = sysInfo.getProperty(aPropertyName);
|
||||||
do_check_true(!!value);
|
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");
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user