зеркало из https://github.com/mozilla/gecko-dev.git
Bug 655649 - Recompute cross-compartment wrappers when setting document.domain. r=mrbkap
This commit is contained in:
Родитель
8a10e6848c
Коммит
9ecc2d4946
|
@ -22,6 +22,8 @@
|
|||
#include "nsIClassInfoImpl.h"
|
||||
#include "nsDOMError.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "jswrapper.h"
|
||||
|
||||
#include "nsPrincipal.h"
|
||||
|
||||
|
@ -963,6 +965,18 @@ nsPrincipal::SetDomain(nsIURI* aDomain)
|
|||
// Domain has changed, forget cached security policy
|
||||
SetSecurityPolicy(nsnull);
|
||||
|
||||
// Recompute all wrappers between compartments using this principal and other
|
||||
// non-chrome compartments.
|
||||
JSContext *cx = nsContentUtils::GetSafeJSContext();
|
||||
NS_ENSURE_TRUE(cx, NS_ERROR_FAILURE);
|
||||
JSPrincipals *principals = nsJSPrincipals::get(static_cast<nsIPrincipal*>(this));
|
||||
bool success = js::RecomputeWrappers(cx, js::ContentCompartmentsOnly(),
|
||||
js::CompartmentsWithPrincipals(principals));
|
||||
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
||||
success = js::RecomputeWrappers(cx, js::CompartmentsWithPrincipals(principals),
|
||||
js::ContentCompartmentsOnly());
|
||||
NS_ENSURE_TRUE(success, NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче