Bug 472032 - [win64] sizeof(long) != sizeof(void*) assertion in nsScriptSecurityManager.cpp; changed SecurityLevel to use PRWord, clarified assertion on the protected code; r+sr=dveditz
authorMook <mook.moz+hg@gmail.com>
Thu, 26 Feb 2009 18:31:17 +0100
changeset 25554 04579855a2b73e2cf26831c1dc6a4733bd8744ac
parent 25553 f287843bb4a1f983b8ef2e3c764f97f5edf461fe
child 25555 3701f0e7fa641a4f56cbef562ee5dafb62e32bc0
push idunknown
push userunknown
push dateunknown
bugs472032
milestone1.9.2a1pre
Bug 472032 - [win64] sizeof(long) != sizeof(void*) assertion in nsScriptSecurityManager.cpp; changed SecurityLevel to use PRWord, clarified assertion on the protected code; r+sr=dveditz
caps/include/nsScriptSecurityManager.h
caps/src/nsScriptSecurityManager.cpp
--- a/caps/include/nsScriptSecurityManager.h
+++ b/caps/include/nsScriptSecurityManager.h
@@ -143,17 +143,17 @@ private:
 
 ////////////////////
 // Policy Storage //
 ////////////////////
 
 // Property Policy
 union SecurityLevel
 {
-    PRInt32  level;
+    PRWord   level;
     char*    capability;
 };
 
 // Security levels
 // These values all have the low bit set (except UNDEFINED_ACCESS)
 // to distinguish them from pointer values, because no pointer
 // to allocated memory ever has the low bit set. A SecurityLevel
 // contains either one of these constants or a pointer to a string
--- a/caps/src/nsScriptSecurityManager.cpp
+++ b/caps/src/nsScriptSecurityManager.cpp
@@ -3196,17 +3196,19 @@ nsScriptSecurityManager::nsScriptSecurit
       mCapabilities(nsnull),
       mIsJavaScriptEnabled(PR_FALSE),
       mIsWritingPrefs(PR_FALSE),
       mPolicyPrefsChanged(PR_TRUE)
 #ifdef XPC_IDISPATCH_SUPPORT
       , mXPCDefaultGrantAll(PR_FALSE)
 #endif
 {
-    NS_ASSERTION(sizeof(long) == sizeof(void*), "long and void* have different lengths on this platform. This may cause a security failure.");
+    NS_ASSERTION(sizeof(PRWord) == sizeof(void*),
+                 "PRWord and void* have different lengths on this platform. "
+                 "This may cause a security failure with the SecurityLevel union.");
     mPrincipals.Init(31);
 }
 
 
 nsresult nsScriptSecurityManager::Init()
 {
     nsresult rv = CallGetService(nsIXPConnect::GetCID(), &sXPConnect);
     NS_ENSURE_SUCCESS(rv, rv);