Update web-platform-tests to revision 4a5223502fa660ce03e470af6a61c8bc26c5a8ee

This commit is contained in:
WPT Sync Bot 2018-04-23 21:13:37 -04:00
parent c5f7c9ccf3
commit e891345f26
1328 changed files with 36632 additions and 20588 deletions

View file

@ -124,5 +124,46 @@ test_with_window(w => {
}, "If prototype is not object (" + notAnObject + "), derives the fallback from NewTarget's realm (customized built-in elements)");
});
test_with_window(w => {
class SomeCustomElement extends HTMLParagraphElement {};
var getCount = 0;
var countingProxy = new Proxy(SomeCustomElement, {
get: function(target, prop, receiver) {
if (prop == "prototype") {
++getCount;
}
return Reflect.get(target, prop, receiver);
}
});
w.customElements.define("failure-counting-element", countingProxy);
// define() gets the prototype of the constructor it's passed, so
// reset the counter.
getCount = 0;
assert_throws({'name': 'TypeError'},
function () { new countingProxy() },
"Should not be able to construct an HTMLParagraphElement not named 'p'");
assert_equals(getCount, 0, "Should never have gotten .prototype");
}, 'HTMLParagraphElement constructor must not get .prototype until it finishes its extends sanity checks, calling proxy constructor directly');
test_with_window(w => {
class SomeCustomElement extends HTMLParagraphElement {};
var getCount = 0;
var countingProxy = new Proxy(SomeCustomElement, {
get: function(target, prop, receiver) {
if (prop == "prototype") {
++getCount;
}
return Reflect.get(target, prop, receiver);
}
});
w.customElements.define("failure-counting-element", countingProxy);
// define() gets the prototype of the constructor it's passed, so
// reset the counter.
getCount = 0;
assert_throws({'name': 'TypeError'},
function () { Reflect.construct(HTMLParagraphElement, [], countingProxy) },
"Should not be able to construct an HTMLParagraphElement not named 'p'");
assert_equals(getCount, 0, "Should never have gotten .prototype");
}, 'HTMLParagraphElement constructor must not get .prototype until it finishes its extends sanity checks, calling via Reflect');
</script>
</body>
</body>