Fixing bustage.
authorBlake Kaplan <mrbkap@gmail.com>
Thu, 22 Jul 2010 17:04:31 -0700
changeset 48114 93c41e057f905611e52c7f212c43e320f748270b
parent 48113 ae3ea4a4320f46597086517d1b891bf3144a971c
child 48115 6f9698905efb790c6d9956e6432625fb3c14feb5
push id14576
push usermrbkap@mozilla.com
push dateFri, 23 Jul 2010 00:04:44 +0000
treeherdermozilla-central@93c41e057f90 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
milestone2.0b3pre
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
Fixing bustage.
dom/base/nsJSEnvironment.cpp
--- a/dom/base/nsJSEnvironment.cpp
+++ b/dom/base/nsJSEnvironment.cpp
@@ -1935,26 +1935,31 @@ nsJSContext::ExecuteScript(void *aScript
   }
 
   // The result of evaluation, used only if there were no errors.  This need
   // not be a GC root currently, provided we run the GC only from the
   // operation callback or from ScriptEvaluated.
   jsval val;
   JSBool ok;
 
+  JSObject *scriptObj = (JSObject*)aScriptObject;
+  nsCOMPtr<nsIPrincipal> principal;
+
+  rv = sSecurityManager->GetObjectPrincipal(mContext, scriptObj, getter_AddRefs(principal));
+  NS_ENSURE_SUCCESS(rv, rv);
+
   rv = sSecurityManager->PushContextPrincipal(mContext, nsnull, principal);
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsJSContext::TerminationFuncHolder holder(this);
   JSAutoRequest ar(mContext);
   ++mExecuteDepth;
   ok = ::JS_ExecuteScript(mContext,
                           (JSObject *)aScopeObject,
-                          (JSScript*)::JS_GetPrivate(mContext,
-                          (JSObject*)aScriptObject),
+                          (JSScript*)::JS_GetPrivate(mContext, scriptObj),
                           &val);
 
   if (ok) {
     // If all went well, convert val to a string (XXXbe unless undefined?).
     rv = JSValueToAString(mContext, val, aRetValue, aIsUndefined);
   } else {
     if (aIsUndefined) {
       *aIsUndefined = PR_TRUE;