Bug 559231 - Don't assert if there's no code running. r=jst
authorBlake Kaplan <mrbkap@gmail.com>
Tue, 27 Apr 2010 16:24:18 -0700
changeset 41435 5ae5e8a40b4f237127b21e54de15beadcc444dbf
parent 41434 63d5af97ec83cd3b060eff7c653c1611e0febec1
child 41436 87ceb85b85df5267e5b059e3cfd05c88dd2bdc94
push id1
push userroot
push dateTue, 26 Apr 2011 22:38:44 +0000
treeherdermozilla-beta@bfdb6e623a36 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs559231
milestone1.9.3a5pre
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
Bug 559231 - Don't assert if there's no code running. r=jst
js/src/xpconnect/src/xpccomponents.cpp
--- a/js/src/xpconnect/src/xpccomponents.cpp
+++ b/js/src/xpconnect/src/xpccomponents.cpp
@@ -3551,20 +3551,22 @@ xpc_EvalInSandbox(JSContext *cx, JSObjec
                   const char *filename, PRInt32 lineNo,
                   JSVersion jsVersion, PRBool returnStringOnly, jsval *rval)
 {
 #ifdef DEBUG
     // NB: The "unsafe" unwrap here is OK because we must be called from chrome.
     {
         nsIScriptSecurityManager *ssm = XPCWrapper::GetSecurityManager();
         if (ssm) {
-            nsIPrincipal *subjectPrincipal = ssm->GetCxSubjectPrincipal(cx);
+            JSStackFrame *fp;
+            nsIPrincipal *subjectPrincipal =
+                ssm->GetCxSubjectPrincipalAndFrame(cx, &fp);
             PRBool system;
             ssm->IsSystemPrincipal(subjectPrincipal, &system);
-            NS_ASSERTION(system, "Bad caller!");
+            NS_ASSERTION(!fp || system, "Bad caller!");
         }
     }
 #endif
 
     sandbox = XPCWrapper::UnsafeUnwrapSecurityWrapper(cx, sandbox);
     if (!sandbox || sandbox->getClass() != &SandboxClass) {
         return NS_ERROR_INVALID_ARG;
     }