Bug 1137910 part 1. Don't lose track of the original 'this' object in THIS_SAVEDFRAME, so we can actually do things based on the principal of the object we're working with. r=fitzgen

This commit is contained in:
Boris Zbarsky 2015-03-03 07:12:01 -05:00
parent 7b450a386a
commit f2c28b670f
2 changed files with 7 additions and 7 deletions

View File

@ -338,7 +338,7 @@ GetFirstSubsumedSavedFrame(JSContext *cx, HandleObject savedFrame)
/* static */ bool
SavedFrame::checkThis(JSContext *cx, CallArgs &args, const char *fnName,
MutableHandleSavedFrame frame)
MutableHandleObject frame)
{
const Value &thisValue = args.thisv();
@ -364,10 +364,10 @@ SavedFrame::checkThis(JSContext *cx, CallArgs &args, const char *fnName,
return false;
}
// The caller might not have the principals to see this frame's data, so get
// the first one they _do_ have access to.
RootedSavedFrame rooted(cx, &thisObject->as<SavedFrame>());
frame.set(GetFirstSubsumedFrame(cx, rooted));
// Now set "frame" to the actual object we were invoked in (which may be a
// wrapper), not the unwrapped version. Consumers will need to know what
// that original object was, and will do principal checks as needed.
frame.set(&thisValue.toObject());
return true;
}
@ -384,7 +384,7 @@ SavedFrame::checkThis(JSContext *cx, CallArgs &args, const char *fnName,
// - Rooted<SavedFrame *> frame (will be non-null)
#define THIS_SAVEDFRAME(cx, argc, vp, fnName, args, frame) \
CallArgs args = CallArgsFromVp(argc, vp); \
RootedSavedFrame frame(cx); \
RootedObject frame(cx); \
if (!checkThis(cx, args, fnName, &frame)) \
return false;

View File

@ -106,7 +106,7 @@ class SavedFrame : public NativeObject {
void updatePrivateParent();
static bool checkThis(JSContext *cx, CallArgs &args, const char *fnName,
MutableHandleSavedFrame frame);
MutableHandleObject frame);
};
struct SavedFrame::HashPolicy