diff --git a/dom/url/URL.h b/dom/url/URL.h index 9d40ca9cf03c..9080bca79471 100644 --- a/dom/url/URL.h +++ b/dom/url/URL.h @@ -151,6 +151,12 @@ public: GetHref(aRetval, aRv); } + void + ToJSON(nsAString& aResult, ErrorResult& aRv) const + { + GetHref(aResult, aRv); + } + // URLSearchParamsObserver void URLSearchParamsUpdated(URLSearchParams* aSearchParams) override; diff --git a/dom/url/tests/test_url.html b/dom/url/tests/test_url.html index 533a79f402ec..73e75667d8db 100644 --- a/dom/url/tests/test_url.html +++ b/dom/url/tests/test_url.html @@ -450,5 +450,11 @@ url = new URL("data:text/html,Link"); is(url.href, "data:text/html,Link"); + + diff --git a/dom/webidl/URL.webidl b/dom/webidl/URL.webidl index 53a6fa7aa3f9..bab0864dff79 100644 --- a/dom/webidl/URL.webidl +++ b/dom/webidl/URL.webidl @@ -44,9 +44,12 @@ interface URL { attribute USVString pathname; [Throws] attribute USVString search; - readonly attribute URLSearchParams searchParams; + [SameObject] readonly attribute URLSearchParams searchParams; [Throws] attribute USVString hash; + + [Throws] + USVString toJSON(); }; partial interface URL {