Backed out changeset df26246112ad (bug 828137)

This commit is contained in:
Carsten "Tomcat" Book 2015-03-09 16:49:34 +01:00
parent 1d7c82f8f2
commit 9f406a7b29
7 changed files with 14 additions and 41 deletions

View File

@ -789,9 +789,10 @@ nsOuterWindowProxy::defineProperty(JSContext* cx,
int32_t index = GetArrayIndexFromId(cx, id);
if (IsArrayIndex(index)) {
// Spec says to Reject whether this is a supported index or not,
// since we have no indexed setter or indexed creator. It is up
// to the caller to decide whether to throw a TypeError.
return result.failCantDefineWindowElement();
// since we have no indexed setter or indexed creator. That means
// throwing in strict mode (FIXME: Bug 828137), doing nothing in
// non-strict mode.
return result.succeed();
}
// For now, allow chrome code to define non-configurable properties

View File

@ -50,22 +50,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=823228
is(window[1], undefined, "We should not have a value here");
// defineProperty() hook test
function throws(errorCtor, f) {
try {
f();
} catch (exc) {
if (!(exc instanceof errorCtor))
throw exc;
return;
}
throw new Error("expected " + errCtor.name + ", no exception thrown: " + f);
}
x.parentNode.appendChild(y);
throws(TypeError, function () {
Object.defineProperty(window, "1", { value: "FAIL2", configurable: true,
writable: true });
});
Object.defineProperty(window, "1", { value: "FAIL2", configurable: true,
writable: true })
y.parentNode.removeChild(y);
ok(!("1" in window), "We no longer have two subframes, again");
is(window[1], undefined, "We should not have a value here either");
@ -89,10 +76,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=823228
is(window[1], undefined, "And now we should be back to no [1] property");
// And more defineProperty()
throws(TypeError, function () {
Object.defineProperty(window, "1", { value: "FAIL2", configurable: true,
writable: true });
});
Object.defineProperty(window, "1", { value: "FAIL2", configurable: true,
writable: true })
ok(!("1" in window), "Defining indexed properties really just shouldn't work");
is(window[1], undefined, "Defining past end of list should not work");

View File

@ -121,10 +121,8 @@ class ObjectOpResult
JS_PUBLIC_API(bool) failCantRedefineProp();
JS_PUBLIC_API(bool) failReadOnly();
JS_PUBLIC_API(bool) failGetterOnly();
JS_PUBLIC_API(bool) failCantDelete();
JS_PUBLIC_API(bool) failCantSetInterposed();
JS_PUBLIC_API(bool) failCantDefineWindowElement();
JS_PUBLIC_API(bool) failCantDelete();
JS_PUBLIC_API(bool) failCantDeleteWindowElement();
JS_PUBLIC_API(bool) failCantDeleteWindowNamedProperty();
JS_PUBLIC_API(bool) failCantPreventExtensions();

View File

@ -478,7 +478,6 @@ MSG_DEF(JSMSG_ATOMICS_WAIT_NOT_ALLOWED, 0, JSEXN_ERR, "waiting is not allowed o
// XPConnect wrappers and DOM bindings
MSG_DEF(JSMSG_CANT_SET_INTERPOSED, 1, JSEXN_TYPEERR, "unable to set interposed data property '{0}'")
MSG_DEF(JSMSG_CANT_DEFINE_WINDOW_ELEMENT, 0, JSEXN_TYPEERR, "can't define elements on a Window object")
MSG_DEF(JSMSG_CANT_DELETE_WINDOW_ELEMENT, 0, JSEXN_TYPEERR, "can't delete elements from a Window object")
MSG_DEF(JSMSG_CANT_DELETE_WINDOW_NAMED_PROPERTY, 1, JSEXN_TYPEERR, "can't delete property {0} from window's named properties object")
MSG_DEF(JSMSG_CANT_PREVENT_EXTENSIONS, 0, JSEXN_TYPEERR, "can't prevent extensions on this proxy object")

View File

@ -197,12 +197,6 @@ JS::ObjectOpResult::failGetterOnly()
return fail(JSMSG_GETTER_ONLY);
}
JS_PUBLIC_API(bool)
JS::ObjectOpResult::failCantDelete()
{
return fail(JSMSG_CANT_DELETE);
}
JS_PUBLIC_API(bool)
JS::ObjectOpResult::failCantSetInterposed()
{
@ -210,9 +204,9 @@ JS::ObjectOpResult::failCantSetInterposed()
}
JS_PUBLIC_API(bool)
JS::ObjectOpResult::failCantDefineWindowElement()
JS::ObjectOpResult::failCantDelete()
{
return fail(JSMSG_CANT_DEFINE_WINDOW_ELEMENT);
return fail(JSMSG_CANT_DELETE);
}
JS_PUBLIC_API(bool)

View File

@ -24,11 +24,7 @@ function test()
typeof this.watch != 'undefined' &&
typeof uneval != 'undefined')
{
try {
this.__defineSetter__(0, function(){});
} catch (exc) {
// In the browser, this fails. Ignore the error.
}
this.__defineSetter__(0, function(){});
this.watch(0, function(){});
uneval(this);
}

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 = 248;
static const uint32_t XDR_BYTECODE_VERSION_SUBTRAHEND = 247;
static const uint32_t XDR_BYTECODE_VERSION =
uint32_t(0xb973c0de - XDR_BYTECODE_VERSION_SUBTRAHEND);
static_assert(JSErr_Limit == 387,
static_assert(JSErr_Limit == 386,
"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 "