Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Bug 583777 - Fix violations of the new JS request model. r=igor a=blo…

…cking-beta3 ok to check into a CLOSED TREE

--HG--
branch : GECKO20b3_20100804_RELBRANCH
  • Loading branch information...
commit 3c283b90873e761840b934f4f81991fea74d2e97 1 parent 4d99133
Olli Pettay authored
Showing with 22 additions and 20 deletions.
  1. +22 −20 content/base/src/nsInProcessTabChildGlobal.cpp
View
42 content/base/src/nsInProcessTabChildGlobal.cpp
@@ -344,27 +344,29 @@ nsInProcessTabChildGlobal::LoadFrameScript(const nsAString& aURL)
}
if (!dataString.IsEmpty()) {
- JSAutoRequest ar(mCx);
- jsval retval;
- JSObject* global = nsnull;
- mGlobal->GetJSObject(&global);
- if (!global) {
- return;
- }
-
- JSPrincipals* jsprin = nsnull;
- mPrincipal->GetJSPrincipals(mCx, &jsprin);
- nsContentUtils::XPConnect()->FlagSystemFilenamePrefix(url.get(), PR_TRUE);
nsContentUtils::ThreadJSContextStack()->Push(mCx);
- PRBool tmp = mLoadingScript;
- mLoadingScript = PR_TRUE;
- JS_EvaluateUCScriptForPrincipals(mCx, global, jsprin,
- (jschar*)dataString.get(),
- dataString.Length(),
- url.get(), 1, &retval);
- //XXX Argh, JSPrincipals are manually refcounted!
- JSPRINCIPALS_DROP(mCx, jsprin);
- mLoadingScript = tmp;
+ {
+ // Need to scope JSAutoRequest to happen after Push but before Pop,
+ // at least for now. See bug 584673.
+ JSAutoRequest ar(mCx);
+ jsval retval;
+ JSObject* global = nsnull;
+ mGlobal->GetJSObject(&global);
+ if (global) {
+ JSPrincipals* jsprin = nsnull;
+ mPrincipal->GetJSPrincipals(mCx, &jsprin);
+ nsContentUtils::XPConnect()->FlagSystemFilenamePrefix(url.get(), PR_TRUE);
+ PRBool tmp = mLoadingScript;
+ mLoadingScript = PR_TRUE;
+ JS_EvaluateUCScriptForPrincipals(mCx, global, jsprin,
+ (jschar*)dataString.get(),
+ dataString.Length(),
+ url.get(), 1, &retval);
+ //XXX Argh, JSPrincipals are manually refcounted!
+ JSPRINCIPALS_DROP(mCx, jsprin);
+ mLoadingScript = tmp;
+ }
+ }
JSContext* unused;
nsContentUtils::ThreadJSContextStack()->Pop(&unused);
}
Please sign in to comment.
Something went wrong with that request. Please try again.