-
Notifications
You must be signed in to change notification settings - Fork 29.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
url: make the context non-enumerable
At the moment we expose the context as a normal property on the prototype chain of URL or take them from the base URL which makes them enumerable and considered by assert libraries even though the context carries path-dependent information that do not affect the equivalence of these objects. This patch fixes it in a minimal manner by marking the context non-enumerable as making it full private would require more refactoring and can be done in a bigger patch later.
- Loading branch information
1 parent
5850220
commit 9d9be61
Showing
2 changed files
with
27 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
test/parallel/test-whatwg-url-custom-no-enumerable-context.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
'use strict'; | ||
// This tests that the context of URL objects are not | ||
// enumerable and thus considered by assert libraries. | ||
// See https://github.com/nodejs/node/issues/24211 | ||
|
||
// Tests below are not from WPT. | ||
|
||
require('../common'); | ||
const assert = require('assert'); | ||
|
||
assert.deepStrictEqual( | ||
new URL('./foo', 'https://example.com/'), | ||
new URL('https://example.com/foo') | ||
); |