SavedFrame * SavedStacks::createFrameFromLookup(JSContext *cx, SavedFrame::HandleLookup lookup) { RootedObject proto(cx, getOrCreateSavedFramePrototype(cx)); if (!proto) return nullptr; assertSameCompartment(cx, proto); RootedObject global(cx, cx->compartment()->maybeGlobal()); if (!global) return nullptr; assertSameCompartment(cx, global); RootedObject frameObj(cx, NewObjectWithGivenProto(cx, &SavedFrame::class_, proto, global)); if (!frameObj) return nullptr; RootedSavedFrame f(cx, &frameObj->as<SavedFrame>()); f->initFromLookup(lookup); if (!JSObject::freeze(cx, frameObj)) return nullptr; return f.get(); }
SavedFrame * SavedStacks::createFrameFromLookup(JSContext *cx, SavedFrame::Lookup &lookup) { RootedObject proto(cx, getOrCreateSavedFramePrototype(cx)); if (!proto) return nullptr; JS_ASSERT(proto->compartment() == cx->compartment()); RootedObject global(cx, cx->compartment()->maybeGlobal()); if (!global) return nullptr; JS_ASSERT(global->compartment() == cx->compartment()); RootedObject frameObj(cx, NewObjectWithGivenProto(cx, &SavedFrame::class_, proto, global)); if (!frameObj) return nullptr; SavedFrame &f = frameObj->as<SavedFrame>(); f.initFromLookup(lookup); return &f; }