Backed out changeset 18ff1472dae9 (bug 1312742) for not updating the expected results of wpt test /html/dom/reflection-embedded.html and more. r=backout
authorSebastian Hengst <archaeopteryx@coole-files.de>
Sun, 30 Oct 2016 02:12:53 +0200
changeset 320157 9a3b8780710b720148346572aec2bf2c235602c2
parent 320156 aadb57a9ddf83910a604f6be3b787fee661249db
child 320158 8f100caf82bf582efcebfd7df8d53e07ce90672f
push id20751
push userphilringnalda@gmail.com
push dateSun, 30 Oct 2016 18:06:35 +0000
treeherderfx-team@e3279760cd97 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbackout
bugs1312742
milestone52.0a1
backs out18ff1472dae91c2b75e0ca843d52ad9a34c438cf
Backed out changeset 18ff1472dae9 (bug 1312742) for not updating the expected results of wpt test /html/dom/reflection-embedded.html and more. r=backout
dom/html/HTMLAnchorElement.cpp
dom/html/HTMLAreaElement.cpp
dom/html/nsGenericHTMLElement.cpp
dom/html/nsGenericHTMLElement.h
--- a/dom/html/HTMLAnchorElement.cpp
+++ b/dom/html/HTMLAnchorElement.cpp
@@ -342,21 +342,20 @@ HTMLAnchorElement::SetText(const nsAStri
 }
 
 NS_IMETHODIMP
 HTMLAnchorElement::ToString(nsAString& aSource)
 {
   return GetHref(aSource);
 }
 
-NS_IMETHODIMP
+NS_IMETHODIMP    
 HTMLAnchorElement::GetPing(nsAString& aValue)
 {
-  GetAttr(kNameSpaceID_None, nsGkAtoms::ping, aValue);
-  return NS_OK;
+  return GetURIListAttr(nsGkAtoms::ping, aValue);
 }
 
 NS_IMETHODIMP
 HTMLAnchorElement::SetPing(const nsAString& aValue)
 {
   return SetAttr(kNameSpaceID_None, nsGkAtoms::ping, aValue, true);
 }
 
--- a/dom/html/HTMLAreaElement.cpp
+++ b/dom/html/HTMLAreaElement.cpp
@@ -216,21 +216,20 @@ IMPL_URI_PART(Hash)
 #undef IMPL_URI_PART
 
 NS_IMETHODIMP
 HTMLAreaElement::ToString(nsAString& aSource)
 {
   return GetHref(aSource);
 }
 
-NS_IMETHODIMP
+NS_IMETHODIMP    
 HTMLAreaElement::GetPing(nsAString& aValue)
 {
-  GetAttr(kNameSpaceID_None, nsGkAtoms::ping, aValue);
-  return NS_OK;
+  return GetURIListAttr(nsGkAtoms::ping, aValue);
 }
 
 NS_IMETHODIMP
 HTMLAreaElement::SetPing(const nsAString& aValue)
 {
   return SetAttr(kNameSpaceID_None, nsGkAtoms::ping, aValue, true);
 }
 
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -1674,16 +1674,78 @@ nsGenericHTMLElement::GetURIAttr(nsIAtom
 /* static */ bool
 nsGenericHTMLElement::IsScrollGrabAllowed(JSContext*, JSObject*)
 {
   // Only allow scroll grabbing in chrome
   nsIPrincipal* prin = nsContentUtils::SubjectPrincipal();
   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
 {
   nsAutoString value;
   GetHTMLAttr(nsGkAtoms::contextmenu, value);
   if (!value.IsEmpty()) {
     //XXXsmaug How should this work in Shadow DOM?
     nsIDocument* doc = GetUncomposedDoc();
--- a/dom/html/nsGenericHTMLElement.h
+++ b/dom/html/nsGenericHTMLElement.h
@@ -1058,16 +1058,30 @@ protected:
   {
     nsAutoString value;
     value.AppendFloat(aValue);
 
     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,
    * this may need to get an editor that's not actually on this element's
    * associated TextControlFrame.  This is used by the spellchecking routines
    * to get the editor affected by changing the spellcheck attribute on this
    * node.
    */
   virtual already_AddRefed<nsIEditor> GetAssociatedEditor();