зеркало из https://github.com/mozilla/gecko-dev.git
Merge backout.
This commit is contained in:
Коммит
7d23d26202
|
@ -143,7 +143,7 @@ mozJSSubScriptLoader::ReadScript(nsIURI *uri, JSContext *cx, JSObject *target_ob
|
|||
/* we can't hold onto jsPrincipals as a module var because the
|
||||
* JSPRINCIPALS_DROP macro takes a JSContext, which we won't have in the
|
||||
* destructor */
|
||||
rv = principal->GetJSPrincipals(cx, &jsPrincipals);
|
||||
rv = mSystemPrincipal->GetJSPrincipals(cx, &jsPrincipals);
|
||||
if (NS_FAILED(rv) || !jsPrincipals) {
|
||||
return ReportError(cx, LOAD_ERROR_NOPRINCIPALS);
|
||||
}
|
||||
|
@ -302,24 +302,13 @@ mozJSSubScriptLoader::LoadSubScript (const PRUnichar * aURL
|
|||
|
||||
// Remember an object out of the calling compartment so that we
|
||||
// can properly wrap the result later.
|
||||
nsCOMPtr<nsIPrincipal> principal = mSystemPrincipal;
|
||||
JSObject *result_obj = target_obj;
|
||||
target_obj = JS_FindCompilationScope(cx, target_obj);
|
||||
if (!target_obj) return NS_ERROR_FAILURE;
|
||||
if (target_obj != result_obj)
|
||||
{
|
||||
nsCOMPtr<nsIScriptSecurityManager> secman =
|
||||
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
|
||||
if (!secman)
|
||||
return NS_ERROR_FAILURE;
|
||||
|
||||
rv = secman->GetObjectPrincipal(cx, target_obj, getter_AddRefs(principal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
#ifdef DEBUG_rginda
|
||||
if (target_obj != result_obj)
|
||||
fprintf (stderr, "Final global: %p\n", target_obj);
|
||||
#endif
|
||||
}
|
||||
|
||||
JSAutoEnterCompartment ac;
|
||||
if (!ac.enter(cx, target_obj))
|
||||
|
|
Загрузка…
Ссылка в новой задаче