Backed out changeset e44f689c3756 (bug 1170274) for reflection-embedded.html w-p-t failures.
authorRyan VanderMeulen <ryanvm@gmail.com>
Tue, 16 Jun 2015 11:31:59 -0400
changeset 249103 85f92f328b52e7fb337f5aa209e711df19c88e83
parent 249102 261ed8e1b5e1ebcf1441b9d349479173385b53a2
child 249104 cc6436db5756bd60be9f01326f208d8f9bfb456b
push id61141
push userryanvm@gmail.com
push dateTue, 16 Jun 2015 15:32:07 +0000
treeherdermozilla-inbound@85f92f328b52 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
bugs1170274
milestone41.0a1
backs oute44f689c37565d889ebf96e70cfd891d9c992821
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Backed out changeset e44f689c3756 (bug 1170274) for reflection-embedded.html w-p-t failures. CLOSED TREE
dom/html/nsGenericHTMLElement.cpp
--- a/dom/html/nsGenericHTMLElement.cpp
+++ b/dom/html/nsGenericHTMLElement.cpp
@@ -1727,44 +1727,45 @@ nsGenericHTMLElement::GetURIListAttr(nsI
 
   nsAutoString value;
   if (!GetAttr(kNameSpaceID_None, aAttr, value))
     return NS_OK;
 
   nsIDocument* doc = OwnerDoc(); 
   nsCOMPtr<nsIURI> baseURI = GetBaseURI();
 
-  NS_ConvertUTF16toUTF8 str(value);
-  char* buffer = str.BeginWriting();
-
-  while (char* token = NS_strtok(" ", &buffer)) {
-    if (!aResult.IsEmpty()) {
-      aResult.Append(char16_t(' '));
+  // Value contains relative URIs split on spaces (U+0020)
+  const char16_t *start = value.BeginReading();
+  const char16_t *end   = value.EndReading();
+  const char16_t *iter  = start;
+  for (;;) {
+    if (iter < end && *iter != ' ') {
+      ++iter;
+    } else {  // iter is pointing at either end or a space
+      while (*start == ' ' && start < iter)
+        ++start;
+      if (iter != start) {
+        if (!aResult.IsEmpty())
+          aResult.Append(char16_t(' '));
+        const nsSubstring& uriPart = Substring(start, iter);
+        nsCOMPtr<nsIURI> attrURI;
+        nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(attrURI),
+                                                  uriPart, doc, baseURI);
+        if (attrURI) {
+          nsAutoCString spec;
+          attrURI->GetSpec(spec);
+          AppendUTF8toUTF16(spec, aResult);
+        } else {
+          aResult.Append(uriPart);
+        }
+      }
+      start = iter = iter + 1;
+      if (iter >= end)
+        break;
     }
-
-    NS_ConvertUTF8toUTF16 uriPart(token);
-    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
 {