Bug 1139560 - Fix srcset parser 'After descriptor' state mishandling spaces. r=jst
☠☠ backed out by dcc49f2ed016 ☠ ☠
authorJohn Schoenick <john@pointysoftware.net>
Wed, 04 Mar 2015 23:11:00 -0500
changeset 265103 dc2cd9c336c9a37111037fb69870db7afff9095a
parent 265102 1e8b305f26b01608beee5b9002ac0748fec705e1
child 265104 a0ef86da9b150b8d523a9ea9acd24e701b499bdd
push id4718
push userraliiev@mozilla.com
push dateMon, 11 May 2015 18:39:53 +0000
treeherdermozilla-beta@c20c4ef55f08 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjst
bugs1139560
milestone39.0a1
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
Bug 1139560 - Fix srcset parser 'After descriptor' state mishandling spaces. r=jst
dom/base/ResponsiveImageSelector.cpp
--- a/dom/base/ResponsiveImageSelector.cpp
+++ b/dom/base/ResponsiveImageSelector.cpp
@@ -616,21 +616,23 @@ ResponsiveImageCandidate::ConsumeDescrip
         // before breaking
         descriptors.AddDescriptor(Substring(currentDescriptor, iter));
         iter++;
         break;
       } else if (nsContentUtils::IsHTMLWhitespace(*iter)) {
         // End of current descriptor, consume it, skip spaces
         // ("After descriptor" state in spec) before continuing
         descriptors.AddDescriptor(Substring(currentDescriptor, iter));
-        for (; iter != end && *iter == char16_t(' '); ++iter);
+        for (; iter != end && nsContentUtils::IsHTMLWhitespace(*iter); ++iter);
         if (iter == end) {
           break;
         }
         currentDescriptor = iter;
+        // Leave one whitespace so the loop advances to this position next iteration
+        iter--;
       } else if (*iter == char16_t('(')) {
         inParens = true;
       }
     }
   }
 
   descriptors.FillCandidate(*this);