From 73edd3878f7632c75eabbffd6e7b8c4dd8deea40 Mon Sep 17 00:00:00 2001 From: Moonchild Date: Sat, 6 Apr 2024 14:08:41 +0200 Subject: [PATCH] Issue #2495 - Implement webkitURL legacy window alias for URL Resolves #2495 --- dom/url/URL.h | 8 ++++++++ dom/webidl/URL.webidl | 1 + 2 files changed, 9 insertions(+) diff --git a/dom/url/URL.h b/dom/url/URL.h index a0afd8b8b6..53164b7b95 100644 --- a/dom/url/URL.h +++ b/dom/url/URL.h @@ -55,6 +55,14 @@ public: Constructor(const GlobalObject& aGlobal, const nsAString& aURL, const Optional& aBase, ErrorResult& aRv); + // Helper for window.URL constructor + static already_AddRefed + WebkitURL(const GlobalObject& aGlobal, const nsAString& aURL, + const Optional& aBase, ErrorResult& aRv) + { + return Constructor(aGlobal, aURL, aBase, aRv); + } + // Helper for Fetch API static already_AddRefed WorkerConstructor(const GlobalObject& aGlobal, const nsAString& aURL, diff --git a/dom/webidl/URL.webidl b/dom/webidl/URL.webidl index 4d491e1b36..a12635ce3f 100644 --- a/dom/webidl/URL.webidl +++ b/dom/webidl/URL.webidl @@ -15,6 +15,7 @@ // [Constructor(DOMString url, optional (URL or DOMString) base = "about:blank")] [Constructor(DOMString url, URL base), Constructor(DOMString url, optional DOMString base), + NamedConstructor=webkitURL(DOMString url, optional DOMString base), Exposed=(Window,Worker,WorkerDebugger)] interface URL { // Bug 824857: no support for stringifier attributes yet.