Skip to content

Commit d1f8ccb

Browse files
authored
url: expose urlpattern as global
PR-URL: #56950 Reviewed-By: Yagiz Nizipli <[email protected]> Reviewed-By: Matthew Aitken <[email protected]> Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Filip Skokan <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Michaël Zasso <[email protected]>
1 parent 6088183 commit d1f8ccb

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

doc/api/globals.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1145,6 +1145,16 @@ added: v10.0.0
11451145

11461146
The WHATWG `URL` class. See the [`URL`][] section.
11471147

1148+
## `URLPattern`
1149+
1150+
<!-- YAML
1151+
added: REPLACEME
1152+
-->
1153+
1154+
<!-- type=global -->
1155+
1156+
The WHATWG `URLPattern` class. See the [`URLPattern`][] section.
1157+
11481158
## `URLSearchParams`
11491159

11501160
<!-- YAML
@@ -1262,6 +1272,7 @@ A browser-compatible implementation of [`WritableStreamDefaultWriter`][].
12621272
[`TextEncoder`]: util.md#class-utiltextencoder
12631273
[`TransformStreamDefaultController`]: webstreams.md#class-transformstreamdefaultcontroller
12641274
[`TransformStream`]: webstreams.md#class-transformstream
1275+
[`URLPattern`]: url.md#class-urlpattern
12651276
[`URLSearchParams`]: url.md#class-urlsearchparams
12661277
[`URL`]: url.md#class-url
12671278
[`WebSocket`]: https://developer.mozilla.org/en-US/docs/Web/API/WebSocket

lib/internal/bootstrap/web/exposed-window-or-worker.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const {
1919
defineLazyProperties,
2020
defineReplaceableLazyAttribute,
2121
exposeLazyInterfaces,
22+
exposeInterface,
2223
} = require('internal/util');
2324

2425
const {
@@ -63,8 +64,9 @@ exposeLazyInterfaces(globalThis, 'perf_hooks', [
6364
defineReplaceableLazyAttribute(globalThis, 'perf_hooks', ['performance']);
6465

6566
// https://w3c.github.io/FileAPI/#creating-revoking
66-
const { installObjectURLMethods } = require('internal/url');
67+
const { installObjectURLMethods, URLPattern } = require('internal/url');
6768
installObjectURLMethods();
69+
exposeInterface(globalThis, 'URLPattern', URLPattern);
6870

6971
let fetchImpl;
7072
// https://fetch.spec.whatwg.org/#fetch-method

test/wpt/test-urlpattern.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,4 @@ const { WPTRunner } = require('../common/wpt');
55
const runner = new WPTRunner('urlpattern');
66

77
runner.pretendGlobalThisAs('Window');
8-
// TODO(@anonrig): Remove this once URLPattern is global.
9-
runner.setInitScript(`global.URLPattern = require('node:url').URLPattern;`);
108
runner.runJsTests();

0 commit comments

Comments
 (0)