Bug 1107443 part 3. Stop defining non-configurable properties on the window in xpconnect sandbox code. r=peterv,jorendorff

This commit is contained in:
Boris Zbarsky
2015-01-23 09:54:15 -05:00
parent f43eff9955
commit d11e2c47b9
3 changed files with 19 additions and 3 deletions

View File

@@ -1639,7 +1639,8 @@ JSObject::nonNativeSetElement(JSContext *cx, HandleObject obj, HandleObject rece
JS_FRIEND_API(bool)
JS_CopyPropertyFrom(JSContext *cx, HandleId id, HandleObject target,
HandleObject obj)
HandleObject obj,
PropertyCopyBehavior copyBehavior)
{
// |obj| and |cx| are generally not same-compartment with |target| here.
assertSameCompartment(cx, obj, id);
@@ -1655,6 +1656,11 @@ JS_CopyPropertyFrom(JSContext *cx, HandleId id, HandleObject target,
if (desc.setter() && !desc.hasSetterObject())
return true;
if (copyBehavior == MakeNonConfigurableIntoConfigurable) {
// Mask off the JSPROP_PERMANENT bit.
desc.attributesRef() &= ~JSPROP_PERMANENT;
}
JSAutoCompartment ac(cx, target);
RootedId wrappedId(cx, id);
if (!cx->compartment()->wrap(cx, &desc))