From 84d939ac0ba992249f18c1bd7a12a8bb4ac875b2 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Mon, 13 Jan 2014 23:46:04 +0100 Subject: [PATCH] Bug 959190 - [URL API] stringify href attribute, r=bz --- dom/base/URL.h | 5 +++ dom/base/test/mochitest.ini | 13 ++++---- dom/base/test/test_url.html | 2 ++ dom/base/test/test_urlutils_stringify.html | 38 ++++++++++++++++++++++ dom/webidl/HTMLAnchorElement.webidl | 1 - dom/webidl/HTMLAreaElement.webidl | 1 - dom/webidl/URLUtils.webidl | 3 ++ dom/workers/URL.h | 5 +++ dom/workers/test/urlApi_worker.js | 2 ++ 9 files changed, 62 insertions(+), 8 deletions(-) create mode 100644 dom/base/test/test_urlutils_stringify.html diff --git a/dom/base/URL.h b/dom/base/URL.h index 76a715e64919..20d0109dc4f4 100644 --- a/dom/base/URL.h +++ b/dom/base/URL.h @@ -118,6 +118,11 @@ public: void SetHash(const nsAString& aArg); + void Stringify(nsString& aRetval) const + { + GetHref(aRetval); + } + // URLSearchParamsObserver void URLSearchParamsUpdated() MOZ_OVERRIDE; void URLSearchParamsNeedsUpdates() MOZ_OVERRIDE; diff --git a/dom/base/test/mochitest.ini b/dom/base/test/mochitest.ini index 61a915c49f9c..b8b227fe8e75 100644 --- a/dom/base/test/mochitest.ini +++ b/dom/base/test/mochitest.ini @@ -28,23 +28,24 @@ support-files = [test_messageChannel_post.html] [test_messageChannel_pref.html] [test_messageChannel_start.html] +[test_messagemanager_targetchain.html] [test_messageChannel_transferable.html] [test_messageChannel_unshipped.html] [test_named_frames.html] [test_nondomexception.html] +[test_openDialogChromeOnly.html] +[test_postMessage_solidus.html] [test_screen_orientation.html] [test_settimeout_inner.html] [test_setting_opener.html] [test_url.html] +[test_url_empty_port.html] +[test_urlExceptions.html] +[test_urlSearchParams.html] +[test_urlutils_stringify.html] [test_window_constructor.html] [test_window_cross_origin_props.html] [test_window_enumeration.html] [test_window_extensible.html] [test_window_indexing.html] [test_writable-replaceable.html] -[test_urlExceptions.html] -[test_openDialogChromeOnly.html] -[test_messagemanager_targetchain.html] -[test_url_empty_port.html] -[test_postMessage_solidus.html] -[test_urlSearchParams.html] diff --git a/dom/base/test/test_url.html b/dom/base/test/test_url.html index afa0bbfcfba3..6c60d8cc9d23 100644 --- a/dom/base/test/test_url.html +++ b/dom/base/test/test_url.html @@ -270,6 +270,8 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=887364 if ('pathname' in test) is(test.pathname, url.pathname, "pathname"); if ('search' in test) is(test.search, url.search, "search"); if ('hash' in test) is(test.hash, url.hash, "hash"); + + if ('href' in test) is (test.href, url + '', 'stringify works'); } diff --git a/dom/base/test/test_urlutils_stringify.html b/dom/base/test/test_urlutils_stringify.html new file mode 100644 index 000000000000..a5f9dce83adc --- /dev/null +++ b/dom/base/test/test_urlutils_stringify.html @@ -0,0 +1,38 @@ + + + + + + + Test for Bug 959190 + + + + +Mozilla Bug 959190 +

+ +
+
+ foobar + + + + diff --git a/dom/webidl/HTMLAnchorElement.webidl b/dom/webidl/HTMLAnchorElement.webidl index a603557b0f0e..9d253bc8c4d5 100644 --- a/dom/webidl/HTMLAnchorElement.webidl +++ b/dom/webidl/HTMLAnchorElement.webidl @@ -13,7 +13,6 @@ // http://www.whatwg.org/specs/web-apps/current-work/#the-a-element interface HTMLAnchorElement : HTMLElement { - stringifier; [SetterThrows] attribute DOMString target; [SetterThrows] diff --git a/dom/webidl/HTMLAreaElement.webidl b/dom/webidl/HTMLAreaElement.webidl index 7a512f498aea..b5437f54c303 100644 --- a/dom/webidl/HTMLAreaElement.webidl +++ b/dom/webidl/HTMLAreaElement.webidl @@ -14,7 +14,6 @@ // http://www.whatwg.org/specs/web-apps/current-work/#the-area-element interface HTMLAreaElement : HTMLElement { -stringifier; [SetterThrows] attribute DOMString alt; [SetterThrows] diff --git a/dom/webidl/URLUtils.webidl b/dom/webidl/URLUtils.webidl index 033a6fca9291..12cebceb74de 100644 --- a/dom/webidl/URLUtils.webidl +++ b/dom/webidl/URLUtils.webidl @@ -29,5 +29,8 @@ interface URLUtils { attribute DOMString search; attribute URLSearchParams? searchParams; attribute DOMString hash; + + // Bug 824857 should remove this. + stringifier; }; diff --git a/dom/workers/URL.h b/dom/workers/URL.h index 922c6c837e13..69c041e4a865 100644 --- a/dom/workers/URL.h +++ b/dom/workers/URL.h @@ -112,6 +112,11 @@ public: void SetHash(const nsAString& aHash); + void Stringify(nsString& aRetval) const + { + GetHref(aRetval); + } + // IURLSearchParamsObserver void URLSearchParamsUpdated() MOZ_OVERRIDE; void URLSearchParamsNeedsUpdates() MOZ_OVERRIDE; diff --git a/dom/workers/test/urlApi_worker.js b/dom/workers/test/urlApi_worker.js index 5a4633b6ba35..0fb3ae1c9eb0 100644 --- a/dom/workers/test/urlApi_worker.js +++ b/dom/workers/test/urlApi_worker.js @@ -263,6 +263,8 @@ onmessage = function() { if ('pathname' in test) is(test.pathname, url.pathname, "pathname"); if ('search' in test) is(test.search, url.search, "search"); if ('hash' in test) is(test.hash, url.hash, "hash"); + + if ('href' in test) is (test.href, url + '', 'stringify works'); } postMessage({type: 'finish' });