summaryrefslogtreecommitdiffstats
path: root/dom/url
diff options
context:
space:
mode:
authorwolfbeast <mcwerewolf@gmail.com>2018-02-22 08:59:14 +0100
committerwolfbeast <mcwerewolf@gmail.com>2018-02-22 08:59:14 +0100
commiteaac0616072e22313ea96eb6e68d9a8f28f70dc7 (patch)
treec967d49511cb2696bdca86affac1e6ee7b374a3b /dom/url
parentd77729916b4b9c2b67abd41181336c2cbb1da968 (diff)
parent6f96569b4499be07c210ca6c38739bbbc7ebdee7 (diff)
downloadUXP-eaac0616072e22313ea96eb6e68d9a8f28f70dc7.tar
UXP-eaac0616072e22313ea96eb6e68d9a8f28f70dc7.tar.gz
UXP-eaac0616072e22313ea96eb6e68d9a8f28f70dc7.tar.lz
UXP-eaac0616072e22313ea96eb6e68d9a8f28f70dc7.tar.xz
UXP-eaac0616072e22313ea96eb6e68d9a8f28f70dc7.zip
Merge branch 'ported-moebius'
Diffstat (limited to 'dom/url')
-rw-r--r--dom/url/URL.h6
-rw-r--r--dom/url/tests/test_url.html6
2 files changed, 12 insertions, 0 deletions
diff --git a/dom/url/URL.h b/dom/url/URL.h
index 16b4678ba..45e4dd289 100644
--- a/dom/url/URL.h
+++ b/dom/url/URL.h
@@ -155,6 +155,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 3f3f727d6..d07a752bb 100644
--- a/dom/url/tests/test_url.html
+++ b/dom/url/tests/test_url.html
@@ -438,5 +438,11 @@
url = new URL("data:text/html,<a href=\"http://example.org/?q\">Link</a>");
is(url.href, "data:text/html,<a%20href=\"http://example.org/?q\">Link</a>");
</script>
+
+ <script>
+ var u = new URL('http://www.example.org');
+ ok(u.toJSON(), 'http://www.example.org', "URL.toJSON()");
+ is(JSON.stringify(u), "\"http://www.example.org/\"", "JSON.stringify(u) works");
+ </script>
</body>
</html>