Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

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 bbe8002a3779368eeec7c5c43fdd8794ca89c73d 1 parent f58a53f
Olli Pettay authored

Showing 1 changed file with 22 additions and 20 deletions. Show diff stats Hide diff stats

  1. +22 20 content/base/src/nsInProcessTabChildGlobal.cpp
42 content/base/src/nsInProcessTabChildGlobal.cpp
@@ -344,27 +344,29 @@ nsInProcessTabChildGlobal::LoadFrameScript(const nsAString& aURL)
344 344 }
345 345
346 346 if (!dataString.IsEmpty()) {
347   - JSAutoRequest ar(mCx);
348   - jsval retval;
349   - JSObject* global = nsnull;
350   - mGlobal->GetJSObject(&global);
351   - if (!global) {
352   - return;
353   - }
354   -
355   - JSPrincipals* jsprin = nsnull;
356   - mPrincipal->GetJSPrincipals(mCx, &jsprin);
357   - nsContentUtils::XPConnect()->FlagSystemFilenamePrefix(url.get(), PR_TRUE);
358 347 nsContentUtils::ThreadJSContextStack()->Push(mCx);
359   - PRBool tmp = mLoadingScript;
360   - mLoadingScript = PR_TRUE;
361   - JS_EvaluateUCScriptForPrincipals(mCx, global, jsprin,
362   - (jschar*)dataString.get(),
363   - dataString.Length(),
364   - url.get(), 1, &retval);
365   - //XXX Argh, JSPrincipals are manually refcounted!
366   - JSPRINCIPALS_DROP(mCx, jsprin);
367   - mLoadingScript = tmp;
  348 + {
  349 + // Need to scope JSAutoRequest to happen after Push but before Pop,
  350 + // at least for now. See bug 584673.
  351 + JSAutoRequest ar(mCx);
  352 + jsval retval;
  353 + JSObject* global = nsnull;
  354 + mGlobal->GetJSObject(&global);
  355 + if (global) {
  356 + JSPrincipals* jsprin = nsnull;
  357 + mPrincipal->GetJSPrincipals(mCx, &jsprin);
  358 + nsContentUtils::XPConnect()->FlagSystemFilenamePrefix(url.get(), PR_TRUE);
  359 + PRBool tmp = mLoadingScript;
  360 + mLoadingScript = PR_TRUE;
  361 + JS_EvaluateUCScriptForPrincipals(mCx, global, jsprin,
  362 + (jschar*)dataString.get(),
  363 + dataString.Length(),
  364 + url.get(), 1, &retval);
  365 + //XXX Argh, JSPrincipals are manually refcounted!
  366 + JSPRINCIPALS_DROP(mCx, jsprin);
  367 + mLoadingScript = tmp;
  368 + }
  369 + }
368 370 JSContext* unused;
369 371 nsContentUtils::ThreadJSContextStack()->Pop(&unused);
370 372 }

0 comments on commit bbe8002

Please sign in to comment.
Something went wrong with that request. Please try again.