Bug 613452 - "Assertion failure: obj->isExtensible()" with Object.seal, sharps. r=Waldo.

This commit is contained in:
Jason Orendorff 2011-08-11 13:24:56 -05:00
parent c216b7caf6
commit 06d366fad2
3 changed files with 18 additions and 1 deletions

View File

@ -130,7 +130,6 @@ PropertyCache::testForInit(JSRuntime *rt, jsbytecode *pc, JSObject *obj,
const js::Shape **shapep, PropertyCacheEntry **entryp)
{
JS_ASSERT(obj->slotSpan() >= JSSLOT_FREE(obj->getClass()));
JS_ASSERT(obj->isExtensible());
uint32 kshape = obj->shape();
PropertyCacheEntry *entry = &table[hash(pc, kshape)];
*entryp = entry;
@ -142,6 +141,10 @@ PropertyCache::testForInit(JSRuntime *rt, jsbytecode *pc, JSObject *obj,
if (entry->kpc == pc &&
entry->kshape == kshape &&
entry->vshape() == rt->protoHazardShape) {
// If obj is not extensible, we cannot have a cache hit. This happens
// for sharp-variable expressions like (#1={x: Object.seal(#1#)}).
JS_ASSERT(obj->isExtensible());
PCMETER(pchits++);
PCMETER(inipchits++);
JS_ASSERT(entry->vcapTag() == 0);

View File

@ -34,6 +34,7 @@ script findReferences-01.js
script findReferences-02.js
script findReferences-03.js
script findReferences-04.js
script regress-613452.js
script regress-627859.js
script regress-627984-1.js
script regress-627984-2.js

View File

@ -0,0 +1,13 @@
// Any copyright is dedicated to the Public Domain.
// http://creativecommons.org/licenses/publicdomain/
for (var i = 0; i < 2; i++) {
try {
(#1={x: Object.seal(#1#)}); // do not assert
} catch (exc) {}
}
for (var i = 0; i < 2; i++)
(#1={x: (#1#.x = 1, Object.seal(#1#))}); // do not assert
reportCompare(0, 0, 'ok');