Bug 965898 - All properties on cross-origin DOM objects should be |own|. r=gabor

This commit is contained in:
Bobby Holley 2014-07-30 12:23:01 -07:00
parent c186e009c9
commit 650ed7043d
2 changed files with 32 additions and 0 deletions

View File

@ -178,6 +178,31 @@ CrossOriginXrayWrapper::~CrossOriginXrayWrapper()
{
}
bool
CrossOriginXrayWrapper::getPropertyDescriptor(JSContext *cx,
JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc) const
{
if (!SecurityXrayDOM::getPropertyDescriptor(cx, wrapper, id, desc))
return false;
if (desc.object()) {
// All properties on cross-origin DOM objects are |own|.
desc.object().set(wrapper);
}
return true;
}
bool
CrossOriginXrayWrapper::getOwnPropertyDescriptor(JSContext *cx,
JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc) const
{
// All properties on cross-origin DOM objects are |own|.
return getPropertyDescriptor(cx, wrapper, id, desc);
}
#define XOW FilteringWrapper<CrossOriginXrayWrapper, CrossOriginAccessiblePropertiesOnly>
#define NNXOW FilteringWrapper<CrossCompartmentSecurityWrapper, Opaque>
#define NNXOWC FilteringWrapper<CrossCompartmentSecurityWrapper, OpaqueWithCall>

View File

@ -61,6 +61,13 @@ class CrossOriginXrayWrapper : public SecurityXrayDOM {
public:
CrossOriginXrayWrapper(unsigned flags);
virtual ~CrossOriginXrayWrapper();
virtual bool getPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
virtual bool getOwnPropertyDescriptor(JSContext *cx, JS::Handle<JSObject*> wrapper,
JS::Handle<jsid> id,
JS::MutableHandle<JSPropertyDescriptor> desc) const MOZ_OVERRIDE;
};
}