зеркало из https://github.com/mozilla/gecko-dev.git
Bug 959190 - [URL API] stringify href attribute, r=bz
This commit is contained in:
Родитель
7a2dc7c7ea
Коммит
84d939ac0b
|
@ -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;
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -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');
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=959190
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 959190</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=959190">Mozilla Bug 959190</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
<iframe name="x" id="x"></iframe>
|
||||
<iframe name="y" id="y"></iframe>
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
<a id="link" href="http://www.example.com:8080">foobar</a>
|
||||
<area id="area" href="http://www.example.com:8080" />
|
||||
<script type="application/javascript">
|
||||
|
||||
var url = new URL('http://www.example.com:8080');
|
||||
is(url + '', 'http://www.example.com:8080/', 'URL stringify');
|
||||
|
||||
var link = document.getElementById("link");
|
||||
is(link + '', 'http://www.example.com:8080/', 'Anchor stringify');
|
||||
|
||||
var area = document.getElementById("area");
|
||||
is(area + '', 'http://www.example.com:8080/', 'Area stringify');
|
||||
|
||||
is((location + '').indexOf('http://mochi.test:8888/tests/dom/base/test/test_urlutils_stringify.html'), 0, 'Location stringify');
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -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]
|
||||
|
|
|
@ -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]
|
||||
|
|
|
@ -29,5 +29,8 @@ interface URLUtils {
|
|||
attribute DOMString search;
|
||||
attribute URLSearchParams? searchParams;
|
||||
attribute DOMString hash;
|
||||
|
||||
// Bug 824857 should remove this.
|
||||
stringifier;
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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' });
|
||||
|
|
Загрузка…
Ссылка в новой задаче