Backed out changeset 95fa879e6855 (bug 1132522) for JP test failures on a CLOSED TREE

This commit is contained in:
Carsten "Tomcat" Book 2015-03-09 16:50:02 +01:00
parent 925ababa09
commit 4fd822080e
16 changed files with 9 additions and 45 deletions

View File

@ -125,6 +125,5 @@ Handler.prototype = {
}
Object.defineProperty(target, key, desc);
}
return true;
}
};

View File

@ -8,11 +8,9 @@ var dstdata = [];
var dst = new Proxy(dstdata, {
defineProperty: function (t, name, desc) {
log.push(["def", name, desc.value]);
return true;
},
set: function (t, name, value) {
log.push(["set", name, value]);
return true;
}
});

View File

@ -14,7 +14,6 @@ var handler = {
assertEq(desc1.writable, true);
assertEq(desc1.enumerable, false);
assertEq(desc1.configurable, true);
return true;
}
};
var desc = {

View File

@ -1,26 +0,0 @@
// Test handling of false return from a handler.defineProperty() hook.
load(libdir + "asserts.js");
var obj = {x: 1, y: 2};
var nope = false;
var p = new Proxy(obj, {
defineProperty(target, key, desc) { return nope; }
});
// Object.defineProperty throws on failure.
print(1);
assertThrowsInstanceOf(() => Object.defineProperty(p, "z", {value: 3}), TypeError);
assertEq("z" in obj, false);
assertThrowsInstanceOf(() => Object.defineProperty(p, "x", {value: 0}), TypeError);
// Setting a property ultimately causes [[DefineOwnProperty]] to be called.
// In strict mode code only, this is a TypeError.
print(2);
assertEq(p.z = 3, 3);
assertThrowsInstanceOf(() => { "use strict"; p.z = 3; }, TypeError);
// Other falsy values also trigger failure.
print(3);
for (nope of [0, -0, NaN, ""])
assertThrowsInstanceOf(() => { "use strict"; p.z = 3; }, TypeError);

View File

@ -4,7 +4,7 @@
var hits = 0;
var t = {};
var p = new Proxy(t, {
defineProperty(t, id, desc) { hits++; return true; }
defineProperty(t, id, desc) { hits++; }
});
p.x = 1;
assertEq(hits, 1);

View File

@ -5,7 +5,7 @@ var hits = 0;
var proto = {x: 1};
var t = Object.create(proto);
var p = new Proxy(t, {
defineProperty(t, id, desc) { hits++; return true; }
defineProperty(t, id, desc) { hits++; }
});
p.x = 2;
assertEq(hits, 1);

View File

@ -11,7 +11,6 @@ var p = new Proxy(t, {
// the value. desc is otherwise empty.
assertEq(Object.getOwnPropertyNames(desc).join(","), "value");
assertEq(desc.value, 42);
return true;
}
});
var hits = 0;

View File

@ -10,7 +10,6 @@ function test(id) {
assertEq(desc.enumerable, true);
assertEq(desc.configurable, true);
assertEq(desc.writable, true);
return true;
}
});
var hits = 0;

View File

@ -11,7 +11,6 @@ var p = new Proxy(a, {
// the value. desc is otherwise empty.
assertEq(Object.getOwnPropertyNames(desc).join(","), "value");
assertEq(desc.value, 2);
return true;
}
});
var hits = 0;

View File

@ -11,7 +11,6 @@ function test(arr) {
// the value. desc is otherwise empty.
assertEq(Object.getOwnPropertyNames(desc).join(","), "value");
assertEq(desc.value, "ponies");
return true;
}
});
var hits = 0;

View File

@ -15,7 +15,6 @@ var q = new Proxy(p, {
assertEq(desc.writable, true);
assertEq(desc.value, 3);
hits++;
return true;
}
});
var hits = 0;

View File

@ -342,7 +342,6 @@ MSG_DEF(JSMSG_CANT_CHANGE_EXTENSIBILITY, 0, JSEXN_TYPEERR, "can't change object'
MSG_DEF(JSMSG_CANT_DEFINE_INVALID, 0, JSEXN_TYPEERR, "proxy can't define an incompatible property descriptor")
MSG_DEF(JSMSG_CANT_DEFINE_NEW, 0, JSEXN_TYPEERR, "proxy can't define a new property on a non-extensible object")
MSG_DEF(JSMSG_CANT_DEFINE_NE_AS_NC, 0, JSEXN_TYPEERR, "proxy can't define a non-existent property as non-configurable")
MSG_DEF(JSMSG_PROXY_DEFINE_RETURNED_FALSE, 1, JSEXN_TYPEERR, "proxy defineProperty handler returned false for property '{0}'")
MSG_DEF(JSMSG_PROXY_DELETE_RETURNED_FALSE, 1, JSEXN_TYPEERR, "can't delete property '{0}': proxy deleteProperty handler returned false")
MSG_DEF(JSMSG_PROXY_PREVENTEXTENSIONS_RETURNED_FALSE, 0, JSEXN_TYPEERR, "proxy preventExtensions handler returned false")
MSG_DEF(JSMSG_CANT_REPORT_AS_NON_EXTENSIBLE, 0, JSEXN_TYPEERR, "proxy can't report an extensible object as non-extensible")

View File

@ -592,9 +592,9 @@ ScriptedDirectProxyHandler::defineProperty(JSContext *cx, HandleObject proxy, Ha
if (!Invoke(cx, ObjectValue(*handler), trap, ArrayLength(argv), argv, &trapResult))
return false;
// step 12
if (!ToBoolean(trapResult))
return result.fail(JSMSG_PROXY_DEFINE_RETURNED_FALSE);
// FIXME - bug 1132522: Step 12 is not implemented yet.
// if (!ToBoolean(trapResult))
// return result.fail(JSMSG_PROXY_DEFINE_RETURNED_FALSE);
// step 13-14
Rooted<PropertyDescriptor> targetDesc(cx);

View File

@ -7,7 +7,7 @@ function LoggingProxy(target) {
var h = {
defineProperty: function (t, id) {
log.push("define", id);
return true;
return undefined;
},
has: function (t, id) {
log.push("has", id);

View File

@ -18,7 +18,7 @@ for (var constructor of constructors) {
var h = {
defineProperty: function (t, id) {
log.push("define", id);
return true;
return undefined;
},
has: function (t, id) {
log.push("has", id);

View File

@ -29,11 +29,11 @@ namespace js {
*
* https://developer.mozilla.org/en-US/docs/SpiderMonkey/Internals/Bytecode
*/
static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 246;
static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 245;
static const uint32_t XDR_BYTECODE_VERSION =
uint32_t(0xb973c0de - XDR_BYTECODE_VERSION_SUBTRAHEND);
static_assert(JSErr_Limit == 385,
static_assert(JSErr_Limit == 384,
"GREETINGS, POTENTIAL SUBTRAHEND INCREMENTER! If you added or "
"removed MSG_DEFs from js.msg, you should increment "
"XDR_BYTECODE_VERSION_SUBTRAHEND and update this assertion's "