mirror of
https://github.com/denoland/deno.git
synced 2025-03-03 17:34:47 -05:00
fix(op_crates/web) make isTrusted not constructable (#8337)
This commit is contained in:
parent
b255a05f18
commit
c7804c06ad
2 changed files with 16 additions and 3 deletions
|
@ -98,9 +98,11 @@
|
||||||
return "relatedTarget" in event;
|
return "relatedTarget" in event;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isTrusted() {
|
const isTrusted = Object.getOwnPropertyDescriptor({
|
||||||
return eventData.get(this).isTrusted;
|
get isTrusted() {
|
||||||
}
|
return eventData.get(this).isTrusted;
|
||||||
|
},
|
||||||
|
}, "isTrusted").get;
|
||||||
|
|
||||||
class Event {
|
class Event {
|
||||||
#canceledFlag = false;
|
#canceledFlag = false;
|
||||||
|
|
|
@ -96,6 +96,16 @@ function eventIsTrusted() {
|
||||||
assert(desc1.get === desc2.get);
|
assert(desc1.get === desc2.get);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function eventIsTrustedGetterName() {
|
||||||
|
const { get } = Object.getOwnPropertyDescriptor(new Event("x"), "isTrusted");
|
||||||
|
assert(get.name === "get isTrusted");
|
||||||
|
try {
|
||||||
|
Reflect.construct(get);
|
||||||
|
throw new Error("Should not have reached here");
|
||||||
|
} catch (e) {
|
||||||
|
assert(e.message.includes("not a constructor"));
|
||||||
|
}
|
||||||
|
}
|
||||||
function main() {
|
function main() {
|
||||||
eventInitializedWithType();
|
eventInitializedWithType();
|
||||||
eventInitializedWithTypeAndDict();
|
eventInitializedWithTypeAndDict();
|
||||||
|
@ -105,6 +115,7 @@ function main() {
|
||||||
eventPreventDefaultSuccess();
|
eventPreventDefaultSuccess();
|
||||||
eventInitializedWithNonStringType();
|
eventInitializedWithNonStringType();
|
||||||
eventIsTrusted();
|
eventIsTrusted();
|
||||||
|
eventIsTrustedGetterName();
|
||||||
}
|
}
|
||||||
|
|
||||||
main();
|
main();
|
||||||
|
|
Loading…
Add table
Reference in a new issue