mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-24 21:31:04 +00:00
Bug 1312742 - Match spec/other browsers for ping reflection; r=bkelly
The spec used to say that getting the .ping property on HTMLAnchorElement or HTMLAreaElement should return a DOMTokenList of parsed URLs, but it now says to return a plain string. All other UAs that implement ping match the new spec, and it's hopefully unlikely that any sites depend on our old behavior. Discussion: https://github.com/whatwg/html/issues/1780 MozReview-Commit-ID: LpmH8ANNT9g
This commit is contained in:
parent
0e290de2a9
commit
2445ed1848
@ -347,10 +347,11 @@ HTMLAnchorElement::ToString(nsAString& aSource)
|
||||
return GetHref(aSource);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
HTMLAnchorElement::GetPing(nsAString& aValue)
|
||||
{
|
||||
return GetURIListAttr(nsGkAtoms::ping, aValue);
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::ping, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -221,10 +221,11 @@ HTMLAreaElement::ToString(nsAString& aSource)
|
||||
return GetHref(aSource);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
NS_IMETHODIMP
|
||||
HTMLAreaElement::GetPing(nsAString& aValue)
|
||||
{
|
||||
return GetURIListAttr(nsGkAtoms::ping, aValue);
|
||||
GetAttr(kNameSpaceID_None, nsGkAtoms::ping, aValue);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
@ -1679,68 +1679,6 @@ nsGenericHTMLElement::IsScrollGrabAllowed(JSContext*, JSObject*)
|
||||
return nsContentUtils::IsSystemPrincipal(prin);
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsGenericHTMLElement::GetURIListAttr(nsIAtom* aAttr, nsAString& aResult)
|
||||
{
|
||||
aResult.Truncate();
|
||||
|
||||
nsAutoString value;
|
||||
if (!GetAttr(kNameSpaceID_None, aAttr, value))
|
||||
return NS_OK;
|
||||
|
||||
nsIDocument* doc = OwnerDoc();
|
||||
nsCOMPtr<nsIURI> baseURI = GetBaseURI();
|
||||
|
||||
nsString::const_iterator end;
|
||||
value.EndReading(end);
|
||||
|
||||
nsAString::const_iterator iter;
|
||||
value.BeginReading(iter);
|
||||
|
||||
while (iter != end) {
|
||||
while (*iter == ' ' && iter != end) {
|
||||
++iter;
|
||||
}
|
||||
|
||||
if (iter == end) {
|
||||
break;
|
||||
}
|
||||
|
||||
nsAString::const_iterator start = iter;
|
||||
|
||||
while (iter != end && *iter != ' ') {
|
||||
++iter;
|
||||
}
|
||||
|
||||
if (!aResult.IsEmpty()) {
|
||||
aResult.Append(NS_LITERAL_STRING(" "));
|
||||
}
|
||||
|
||||
const nsSubstring& uriPart = Substring(start, iter);
|
||||
nsCOMPtr<nsIURI> attrURI;
|
||||
nsresult rv =
|
||||
nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(attrURI),
|
||||
uriPart, doc, baseURI);
|
||||
if (NS_FAILED(rv)) {
|
||||
aResult.Append(uriPart);
|
||||
continue;
|
||||
}
|
||||
|
||||
MOZ_ASSERT(attrURI);
|
||||
|
||||
nsAutoCString spec;
|
||||
rv = attrURI->GetSpec(spec);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
aResult.Append(uriPart);
|
||||
continue;
|
||||
}
|
||||
|
||||
AppendUTF8toUTF16(spec, aResult);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
HTMLMenuElement*
|
||||
nsGenericHTMLElement::GetContextMenu() const
|
||||
{
|
||||
|
@ -1062,20 +1062,6 @@ protected:
|
||||
SetHTMLAttr(aAttr, value, aRv);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method works like GetURIAttr, except that it supports multiple
|
||||
* URIs separated by whitespace (one or more U+0020 SPACE characters).
|
||||
*
|
||||
* Gets the absolute URI values of an attribute, by resolving any relative
|
||||
* URIs in the attribute against the baseuri of the element. If a substring
|
||||
* isn't a relative URI, the substring is returned as is. Only works for
|
||||
* attributes in null namespace.
|
||||
*
|
||||
* @param aAttr name of attribute.
|
||||
* @param aResult result value [out]
|
||||
*/
|
||||
nsresult GetURIListAttr(nsIAtom* aAttr, nsAString& aResult);
|
||||
|
||||
/**
|
||||
* Locates the nsIEditor associated with this node. In general this is
|
||||
* equivalent to GetEditorInternal(), but for designmode or contenteditable,
|
||||
|
@ -696,87 +696,3 @@
|
||||
[area.type: IDL set to object "test-valueOf" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to undefined followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to 7 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to 1.5 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to true followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to false followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to object "[object Object\]" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to NaN followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to -Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to "\\0" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to null followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to object "test-toString" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: setAttribute() to object "test-valueOf" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to undefined followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to 7 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to 1.5 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to true followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to false followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to object "[object Object\]" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to NaN followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to -Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to "\\0" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to null followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to object "test-toString" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[area.ping: IDL set to object "test-valueOf" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
|
@ -174,87 +174,3 @@
|
||||
[wbr.tabIndex: setAttribute() to object "3" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to undefined followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to 7 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to 1.5 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to true followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to false followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to object "[object Object\]" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to NaN followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to -Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to "\\0" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to null followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to object "test-toString" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: setAttribute() to object "test-valueOf" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to " \\0\\x01\\x02\\x03\\x04\\x05\\x06\\x07 \\b\\t\\n\\v\\f\\r\\x0e\\x0f \\x10\\x11\\x12\\x13\\x14\\x15\\x16\\x17 \\x18\\x19\\x1a\\x1b\\x1c\\x1d\\x1e\\x1f foo " followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to undefined followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to 7 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to 1.5 followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to true followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to false followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to object "[object Object\]" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to NaN followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to -Infinity followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to "\\0" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to null followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to object "test-toString" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
[a.ping: IDL set to object "test-valueOf" followed by IDL get]
|
||||
expected: FAIL
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user