Commit 2bfd58a
url: define @@toStringTag as a data property
Even though this is not fully Web IDL spec-compliant, it is arguably the
best we can do. Following the spec would mean non-trivial performance
deterioration (10% when parsing a medium-length URL), while the current
getter behavior is not adopted by any implementer, and it causes some
spec ambiguity when the getter is called with !(this instanceof URL).
This commit adopts Chrome's behavior, and is consistent with
ECMAScript-defined classes while providing reasonable behaviors for
corner cases as well. Until the Web IDL spec is changed one way or
another, this is the way to go.
PR-URL: #10906
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>1 parent f1851cb commit 2bfd58aCopy full SHA for 2bfd58a
File tree
Expand file treeCollapse file tree
3 files changed
+11
-8
lines changedOpen diff view settings
Filter options
- lib/internal
- test/parallel
Expand file treeCollapse file tree
3 files changed
+11
-8
lines changedOpen diff view settings
Collapse file
+4-4Lines changed: 4 additions & 4 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
223 | 223 | |
224 | 224 | |
225 | 225 | |
226 | | - |
227 | | - |
228 | | - |
229 | | - |
230 | 226 | |
231 | 227 | |
232 | 228 | |
| ||
314 | 310 | |
315 | 311 | |
316 | 312 | |
| 313 | + |
| 314 | + |
| 315 | + |
| 316 | + |
317 | 317 | |
318 | 318 | |
319 | 319 | |
|
Collapse file
test/parallel/test-whatwg-url-properties.js
Copy file name to clipboardExpand all lines: test/parallel/test-whatwg-url-properties.js+2-2Lines changed: 2 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
45 | 45 | |
46 | 46 | |
47 | 47 | |
48 | | - |
| 48 | + |
49 | 49 | |
50 | 50 | |
51 | 51 | |
| ||
121 | 121 | |
122 | 122 | |
123 | 123 | |
124 | | - |
| 124 | + |
125 | 125 | |
126 | 126 | |
127 | 127 | |
|
Collapse file
test/parallel/test-whatwg-url-tostringtag.js
Copy file name to clipboardExpand all lines: test/parallel/test-whatwg-url-tostringtag.js+5-2Lines changed: 5 additions & 2 deletions
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| ||
10 | 10 | |
11 | 11 | |
12 | 12 | |
13 | | - |
14 | 13 | |
15 | | - |
| 14 | + |
| 15 | + |
| 16 | + |
| 17 | + |
| 18 | + |
16 | 19 | |
17 | 20 | |
18 | 21 | |
|
0 commit comments