| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 4b4336c commit a738164
5 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -119,8 +119,6 @@ class Event { | |||
| 119 | 119 | isTrustedSet.add(this); | |
| 120 | 120 | } | |
| 121 | 121 | ||
| 122 | - // isTrusted is special (LegacyUnforgeable) | ||
| 123 | - ObjectDefineProperty(this, 'isTrusted', isTrustedDescriptor); | ||
| 124 | 122 | this[kTarget] = null; | |
| 125 | 123 | this[kIsBeingDispatched] = false; | |
| 126 | 124 | } | |
@@ -343,6 +341,11 @@ ObjectDefineProperties( | |||
| 343 | 341 | eventPhase: kEnumerableProperty, | |
| 344 | 342 | cancelBubble: kEnumerableProperty, | |
| 345 | 343 | stopPropagation: kEnumerableProperty, | |
| 344 | + // Don't conform to the spec with isTrusted. The spec defines it as | ||
| 345 | + // LegacyUnforgeable but defining it in the constructor has a big | ||
| 346 | + // performance impact and the property doesn't seem to be useful outside of | ||
| 347 | + // browsers. | ||
| 348 | + isTrusted: isTrustedDescriptor, | ||
| 346 | 349 | }); | |
| 347 | 350 | ||
| 348 | 351 | function isCustomEvent(value) { | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -57,9 +57,9 @@ const { setTimeout: sleep } = require('timers/promises'); | |||
| 57 | 57 | })); | |
| 58 | 58 | first.abort(); | |
| 59 | 59 | second.abort(); | |
| 60 | - const firstTrusted = Reflect.getOwnPropertyDescriptor(ev1, 'isTrusted').get; | ||
| 61 | - const secondTrusted = Reflect.getOwnPropertyDescriptor(ev2, 'isTrusted').get; | ||
| 62 | - const untrusted = Reflect.getOwnPropertyDescriptor(ev3, 'isTrusted').get; | ||
| 60 | + const firstTrusted = Reflect.getOwnPropertyDescriptor(Object.getPrototypeOf(ev1), 'isTrusted').get; | ||
| 61 | + const secondTrusted = Reflect.getOwnPropertyDescriptor(Object.getPrototypeOf(ev2), 'isTrusted').get; | ||
| 62 | + const untrusted = Reflect.getOwnPropertyDescriptor(Object.getPrototypeOf(ev3), 'isTrusted').get; | ||
| 63 | 63 | strictEqual(firstTrusted, secondTrusted); | |
| 64 | 64 | strictEqual(untrusted, firstTrusted); | |
| 65 | 65 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -187,7 +187,7 @@ const { Event, EventTarget, CustomEvent } = require('internal/event_target'); | |||
| 187 | 187 | } | |
| 188 | 188 | { | |
| 189 | 189 | const ev = new CustomEvent('foo'); | |
| 190 | - deepStrictEqual(Object.keys(ev), ['isTrusted']); | ||
| 190 | + strictEqual(ev.isTrusted, false); | ||
| 191 | 191 | } | |
| 192 | 192 | ||
| 193 | 193 | // Works with EventTarget | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -126,7 +126,7 @@ let asyncTest = Promise.resolve(); | |||
| 126 | 126 | } | |
| 127 | 127 | { | |
| 128 | 128 | const ev = new Event('foo'); | |
| 129 | - deepStrictEqual(Object.keys(ev), ['isTrusted']); | ||
| 129 | + strictEqual(ev.isTrusted, false); | ||
| 130 | 130 | } | |
| 131 | 131 | { | |
| 132 | 132 | const eventTarget = new EventTarget(); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -11,6 +11,13 @@ | |||
| 11 | 11 | "Event-dispatch-listener-order.window.js": { | |
| 12 | 12 | "skip": "document is not defined" | |
| 13 | 13 | }, | |
| 14 | + "Event-isTrusted.any.js": { | ||
| 15 | + "fail": { | ||
| 16 | + "expected": [ | ||
| 17 | + "Event-isTrusted" | ||
| 18 | + ] | ||
| 19 | + } | ||
| 20 | + }, | ||
| 14 | 21 | "EventListener-addEventListener.sub.window.js": { | |
| 15 | 22 | "skip": "document is not defined" | |
| 16 | 23 | }, | |
| Back | FazBrowse Home | New Git URL |
0 commit comments