mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Update web-platform-tests to revision d7afcb8708eac08a614d161d5622a48172daf7e3
This commit is contained in:
parent
6f8bb4dd40
commit
edff458e23
791 changed files with 17647 additions and 10322 deletions
|
@ -91,6 +91,38 @@ test_with_window(w => {
|
|||
returnNotAnObject = true;
|
||||
new ElementWithDynamicPrototype();
|
||||
}, "If prototype is not object (" + notAnObject + "), derives the fallback from NewTarget's realm (autonomous custom elements)");
|
||||
|
||||
test_with_window(w => {
|
||||
// We have to return an object during define(), but not during super()
|
||||
let returnNotAnObject = false;
|
||||
|
||||
function TestElement() {
|
||||
const o = Reflect.construct(w.HTMLElement, [], new.target);
|
||||
|
||||
assert_equals(Object.getPrototypeOf(new.target), window.Function.prototype);
|
||||
assert_equals(Object.getPrototypeOf(o), window.HTMLElement.prototype,
|
||||
"Must use the HTMLElement from the realm of NewTarget");
|
||||
assert_not_equals(Object.getPrototypeOf(o), w.HTMLElement.prototype,
|
||||
"Must not use the HTMLElement from the realm of the active function object (w.HTMLElement)");
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
// Create the proxy in the subframe, which should not affect what our
|
||||
// prototype ends up as.
|
||||
const ElementWithDynamicPrototype = new w.Proxy(TestElement, {
|
||||
get: function (target, name) {
|
||||
if (name == "prototype")
|
||||
return returnNotAnObject ? notAnObject : {};
|
||||
return target[name];
|
||||
}
|
||||
});
|
||||
|
||||
w.customElements.define("test-element", ElementWithDynamicPrototype);
|
||||
|
||||
returnNotAnObject = true;
|
||||
new ElementWithDynamicPrototype();
|
||||
}, "If prototype is not object (" + notAnObject + "), derives the fallback from NewTarget's GetFunctionRealm (autonomous custom elements)");
|
||||
});
|
||||
|
||||
[null, undefined, 5, "string"].forEach(function (notAnObject) {
|
||||
|
@ -122,6 +154,37 @@ test_with_window(w => {
|
|||
returnNotAnObject = true;
|
||||
new ElementWithDynamicPrototype();
|
||||
}, "If prototype is not object (" + notAnObject + "), derives the fallback from NewTarget's realm (customized built-in elements)");
|
||||
|
||||
test_with_window(w => {
|
||||
// We have to return an object during define(), but not during super()
|
||||
let returnNotAnObject = false;
|
||||
|
||||
function TestElement() {
|
||||
const o = Reflect.construct(w.HTMLParagraphElement, [], new.target);
|
||||
|
||||
assert_equals(Object.getPrototypeOf(o), window.HTMLParagraphElement.prototype,
|
||||
"Must use the HTMLParagraphElement from the realm of NewTarget");
|
||||
assert_not_equals(Object.getPrototypeOf(o), w.HTMLParagraphElement.prototype,
|
||||
"Must not use the HTMLParagraphElement from the realm of the active function object (w.HTMLParagraphElement)");
|
||||
|
||||
return o;
|
||||
}
|
||||
|
||||
// Create the proxy in the subframe, which should not affect what our
|
||||
// prototype ends up as.
|
||||
const ElementWithDynamicPrototype = new w.Proxy(TestElement, {
|
||||
get: function (target, name) {
|
||||
if (name == "prototype")
|
||||
return returnNotAnObject ? notAnObject : {};
|
||||
return target[name];
|
||||
}
|
||||
});
|
||||
|
||||
w.customElements.define("test-element", ElementWithDynamicPrototype, { extends: "p" });
|
||||
|
||||
returnNotAnObject = true;
|
||||
new ElementWithDynamicPrototype();
|
||||
}, "If prototype is not object (" + notAnObject + "), derives the fallback from NewTarget's GetFunctionRealm (customized built-in elements)");
|
||||
});
|
||||
|
||||
test_with_window(w => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue