10.2.1.2.2, step 3:
> 3. Assert: The result of HasProperty(bindings, N) is false .
10.2.1.4.16, step 3:
> 3. Assert: The result of calling envRec’s CanDeclareGlobalVar concrete method with argument N is true.
10.2.1.4.17, step 3, step 8:
> 3. Assert: The result of calling envRec’s CanDeclareGlobalFunction concrete method with argument N is true.
> 8. NOTE The assertion in step 3 means that the above [[DefineOwnProperty]] calls will never return false or an abrupt completion.
These assertions are no longer true because of Proxies and modifiable [[Prototype]].
(BTW: Should assertions ever call user code? I don't think so...)
test cases:
---
function triggerAssertion(global, callCounter, code) {
Object.setPrototypeOf(global, new Proxy(Object.create(null), {
has(t, pk) {
if (pk == "foo" && callCounter > 0 && --callCounter == 0) {
Object.preventExtensions(global);
return true;
}
return false;
}
}));
(1,eval)(`eval("${code}")`)
}
// 10.2.1.2.2, step 3
triggerAssertion(this, 4, "var foo = 0")
// 10.2.1.4.16, step 3
triggerAssertion(this, 1, "var foo = 0")
// 10.2.1.4.17
triggerAssertion(this, 1, "function foo(){}")
---
fixed in rev17 editor's draft
fixed in rev17, August 23, 2013 draft