mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Fix for bug 778152 (Content window does not have an XMLHttpRequest property when accessed via an Xray wrapper in a subscript) - followup to fix problem pointed out by reviewer. r=bz.
--HG-- extra : rebase_source : 13271029cb0c7cd18b98fa2ed409e43f1df13e47
This commit is contained in:
parent
0beab091c2
commit
704bdbee45
@ -687,7 +687,7 @@ XrayResolveProperty(JSContext* cx, JSObject* wrapper, jsid id,
|
||||
|
||||
static bool
|
||||
ResolvePrototypeOrConstructor(JSContext* cx, JSObject* wrapper, JSObject* obj,
|
||||
size_t protoAndIfaceArrayIndex,
|
||||
size_t protoAndIfaceArrayIndex, unsigned attrs,
|
||||
JSPropertyDescriptor* desc)
|
||||
{
|
||||
JSObject* global = js::GetGlobalForObjectCrossCompartment(obj);
|
||||
@ -700,7 +700,7 @@ ResolvePrototypeOrConstructor(JSContext* cx, JSObject* wrapper, JSObject* obj,
|
||||
}
|
||||
desc->obj = wrapper;
|
||||
desc->shortid = 0;
|
||||
desc->attrs = JSPROP_PERMANENT | JSPROP_READONLY;
|
||||
desc->attrs = attrs;
|
||||
desc->getter = JS_PropertyStub;
|
||||
desc->setter = JS_StrictPropertyStub;
|
||||
desc->value = JS::ObjectValue(*protoOrIface);
|
||||
@ -718,6 +718,7 @@ XrayResolveNativeProperty(JSContext* cx, JSObject* wrapper,
|
||||
return nativePropertyHooks->mPrototypeID == prototypes::id::_ID_Count ||
|
||||
ResolvePrototypeOrConstructor(cx, wrapper, obj,
|
||||
nativePropertyHooks->mPrototypeID,
|
||||
JSPROP_PERMANENT | JSPROP_READONLY,
|
||||
desc);
|
||||
}
|
||||
|
||||
@ -725,7 +726,7 @@ XrayResolveNativeProperty(JSContext* cx, JSObject* wrapper,
|
||||
return nativePropertyHooks->mConstructorID == constructors::id::_ID_Count ||
|
||||
ResolvePrototypeOrConstructor(cx, wrapper, obj,
|
||||
nativePropertyHooks->mConstructorID,
|
||||
desc);
|
||||
0, desc);
|
||||
}
|
||||
|
||||
const NativePropertiesHolder& nativeProperties =
|
||||
|
@ -49,6 +49,30 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=741267
|
||||
} catch (e) {
|
||||
ok(false, "'XMLHttpRequest.prototype' shouldn't throw in a sandbox");
|
||||
}
|
||||
try {
|
||||
var xhr = Components.utils.evalInSandbox("XMLHttpRequest", sandbox);
|
||||
xhr.prototype = false;
|
||||
} catch (e) {
|
||||
ok(true, "'XMLHttpRequest.prototype' should be readonly");
|
||||
}
|
||||
try {
|
||||
var xhr = Components.utils.evalInSandbox("XMLHttpRequest", sandbox);
|
||||
delete xhr.prototype;
|
||||
} catch (e) {
|
||||
ok(true, "'XMLHttpRequest.prototype' should be permanent");
|
||||
}
|
||||
try {
|
||||
var xhr = Components.utils.evalInSandbox("XMLHttpRequest.prototype", sandbox);
|
||||
xhr.constructor = "ok";
|
||||
} catch (e) {
|
||||
is(xhr.constructor, "ok", "'XMLHttpRequest.prototype.constructor' should be writeable");
|
||||
}
|
||||
try {
|
||||
var xhr = Components.utils.evalInSandbox("XMLHttpRequest.prototype", sandbox);
|
||||
delete xhr.constructor;
|
||||
} catch (e) {
|
||||
is(xhr.constructor, undefined, "'XMLHttpRequest.prototype.constructor' should be permanent");
|
||||
}
|
||||
try {
|
||||
var xhr = Components.utils.evalInSandbox("XMLHttpRequest", sandbox);
|
||||
is(xhr, "[object XrayWrapper " + XMLHttpRequest + "]", "'XMLHttpRequest' in a sandbox should return the XMLHttpRequest interface object");
|
||||
|
Loading…
Reference in New Issue
Block a user