From 6b366b61a3a6c62b1caa50cd4c45431dad43aff1 Mon Sep 17 00:00:00 2001 From: Michael Wu Date: Thu, 17 Feb 2011 14:20:00 -0800 Subject: [PATCH] Bug 634752 - Always drop jsPrincipals before returning from LoadSubScript, r+a=jst --- js/src/xpconnect/loader/mozJSSubScriptLoader.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/js/src/xpconnect/loader/mozJSSubScriptLoader.cpp b/js/src/xpconnect/loader/mozJSSubScriptLoader.cpp index 765b7b49306..93aa4cc04cd 100644 --- a/js/src/xpconnect/loader/mozJSSubScriptLoader.cpp +++ b/js/src/xpconnect/loader/mozJSSubScriptLoader.cpp @@ -392,6 +392,7 @@ mozJSSubScriptLoader::LoadSubScript (const PRUnichar * aURL if (NS_FAILED(rv)) { + JSPRINCIPALS_DROP(cx, jsPrincipals); errmsg = JS_NewStringCopyZ(cx, LOAD_ERROR_BADCHARSET); goto return_exception; } @@ -405,6 +406,8 @@ mozJSSubScriptLoader::LoadSubScript (const PRUnichar * aURL buf, len, uriStr.get(), 1, rval); } + JSPRINCIPALS_DROP(cx, jsPrincipals); + if (ok) { JSAutoEnterCompartment rac; @@ -417,8 +420,6 @@ mozJSSubScriptLoader::LoadSubScript (const PRUnichar * aURL JS_SetErrorReporter (cx, er); cc->SetReturnValueWasSet (ok); - - JSPRINCIPALS_DROP(cx, jsPrincipals); return NS_OK; return_exception: