summaryrefslogtreecommitdiff
path: root/cli/tests/unit/urlpattern_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit/urlpattern_test.ts')
-rw-r--r--cli/tests/unit/urlpattern_test.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/cli/tests/unit/urlpattern_test.ts b/cli/tests/unit/urlpattern_test.ts
index 1ec64b2fe..9bed09235 100644
--- a/cli/tests/unit/urlpattern_test.ts
+++ b/cli/tests/unit/urlpattern_test.ts
@@ -43,3 +43,18 @@ Deno.test(function urlPatternFromInit() {
assert(pattern.test({ pathname: "/foo/x" }));
});
+
+Deno.test(function urlPatternWithPrototypePollution() {
+ const originalExec = RegExp.prototype.exec;
+ try {
+ RegExp.prototype.exec = () => {
+ throw Error();
+ };
+ const pattern = new URLPattern({
+ pathname: "/foo/:bar",
+ });
+ assert(pattern.test("https://deno.land/foo/x"));
+ } finally {
+ RegExp.prototype.exec = originalExec;
+ }
+});