Bug 882164 - Enter the right compartment to create a new JSObject in nsHTMLDocument::GetAll; r=bz

This commit is contained in:
Ms2ger 2013-06-12 22:05:40 +02:00
parent 3e79cdd903
commit 8742f29802

View File

@ -2724,8 +2724,10 @@ JSObject*
nsHTMLDocument::GetAll(JSContext* aCx, ErrorResult& aRv)
{
if (!mAll) {
JS::Rooted<JSObject*> wrapper(aCx, GetWrapper());
JSAutoCompartment ac(aCx, wrapper);
mAll = JS_NewObject(aCx, &sHTMLDocumentAllClass, nullptr,
JS_GetGlobalForObject(aCx, GetWrapper()));
JS_GetGlobalForObject(aCx, wrapper));
if (!mAll) {
aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
return nullptr;