Bug 1405568 - Return false from nsHtml5String::LowerCaseStartsWithASCII when this string is shorter than the literal. draft
authorHenri Sivonen <hsivonen@hsivonen.fi>
Mon, 09 Oct 2017 10:43:48 +0300
changeset 676655 ab9f2936832c2e6bcfa462be94acbe58680e7e2c
parent 676654 daf2afb7a40b2238125ac02acc0791a3676f5538
child 735003 fae0f805764aec720ab43969f4d21ae096562dfd
push id83568
push userbmo:hsivonen@hsivonen.fi
push dateMon, 09 Oct 2017 07:54:36 +0000
bugs1405568
milestone58.0a1
Bug 1405568 - Return false from nsHtml5String::LowerCaseStartsWithASCII when this string is shorter than the literal. MozReview-Commit-ID: AfPZ3nnOGQu
parser/html/nsHtml5String.cpp
testing/web-platform/meta/MANIFEST.json
testing/web-platform/mozilla/meta/MANIFEST.json
testing/web-platform/tests/html/syntax/parsing/empty-doctype-ids.html
--- a/parser/html/nsHtml5String.cpp
+++ b/parser/html/nsHtml5String.cpp
@@ -47,19 +47,22 @@ nsHtml5String::EqualsASCII(const char* a
 
 bool
 nsHtml5String::LowerCaseStartsWithASCII(const char* aLowerCaseLiteral) const
 {
   const char* litPtr = aLowerCaseLiteral;
   const char16_t* strPtr = AsPtr();
   const char16_t* end = strPtr + Length();
   char16_t litChar;
-  while ((litChar = *litPtr) && (strPtr != end)) {
+  while ((litChar = *litPtr)) {
     MOZ_ASSERT(!(litChar >= 'A' && litChar <= 'Z'),
                "Literal isn't in lower case.");
+    if (strPtr == end) {
+      return false;
+    }
     char16_t strChar = *strPtr;
     if (strChar >= 'A' && strChar <= 'Z') {
       strChar += 0x20;
     }
     if (litChar != strChar) {
       return false;
     }
     ++litPtr;
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -351765,16 +351765,22 @@
     ]
    ],
    "html/syntax/parsing/Element.getElementsByTagName-foreign-02.html": [
     [
      "/html/syntax/parsing/Element.getElementsByTagName-foreign-02.html",
      {}
     ]
    ],
+   "html/syntax/parsing/empty-doctype-ids.html": [
+    [
+     "/html/syntax/parsing/empty-doctype-ids.html",
+     {}
+    ]
+   ],
    "html/syntax/parsing/html5lib_adoption01.html": [
     [
      "/html/syntax/parsing/html5lib_adoption01.html?run_type=uri",
      {
       "timeout": "long"
      }
     ],
     [
@@ -415085,17 +415091,17 @@
    "1ffa4ce083beb01cf54d1a5be155c0ae32376303",
    "testharness"
   ],
   "IndexedDB/idbobjectstore_createIndex6-event_order.htm": [
    "785af43d94dd7dbecec5278d33e9c3d4ba1f053c",
    "testharness"
   ],
   "IndexedDB/idbobjectstore_createIndex7-event_order.htm": [
-   "5adcbff25f20bc9e99390ea63dfdfb862a28a38f",
+   "8f7eb9bd63f40ed55cfc8c669dfffefacdb912f4",
    "testharness"
   ],
   "IndexedDB/idbobjectstore_createIndex8-valid_keys.htm": [
    "93265ff4ed812bf5df70a525b06c2de7ef432340",
    "testharness"
   ],
   "IndexedDB/idbobjectstore_createIndex9-emptyname.htm": [
    "2b63a4596f29a04940dc5e83952cff55e87cdbc4",
@@ -416537,41 +416543,41 @@
    "3feb39f2451afa624771437337c669865fac29b5",
    "testharness"
   ],
   "XMLHttpRequest/abort-after-timeout.htm": [
    "26252843e67111ee53079bb67619fccde700000d",
    "testharness"
   ],
   "XMLHttpRequest/abort-during-done.htm": [
-   "644e5580da6584fdddf285758d8f3221914ce433",
+   "f920658b70e4a51eb5b36d6cbd448d2dfc810f5c",
    "testharness"
   ],
   "XMLHttpRequest/abort-during-headers-received.htm": [
-   "eb133e195b982c35589d80dfd1d3a7d4591a473f",
+   "48c028b1b1a3e2adccbafa8c519329297f973e23",
    "testharness"
   ],
   "XMLHttpRequest/abort-during-loading.htm": [
-   "c0384f20416964d719d4504e3afd5e8a92f5b9ed",
+   "98e31e4b2a489543ee9914a75749bc958ef97fca",
    "testharness"
   ],
   "XMLHttpRequest/abort-during-open.htm": [
    "bc528083ac09ef3666eb07d294bc2b48dc142791",
    "testharness"
   ],
   "XMLHttpRequest/abort-during-open.js": [
-   "54d5deeaf004bd84d54ab5628f895e445edd92c9",
+   "f46bf95a38cc79fe499f4990457fcf1eaa193068",
    "support"
   ],
   "XMLHttpRequest/abort-during-open.worker.js": [
    "94180bce348fa9fd3826a8993d701936141b8b0b",
    "testharness"
   ],
   "XMLHttpRequest/abort-during-unsent.htm": [
-   "039927226e468af095bd731b7652c5e1662e4f28",
+   "5caf136ee37109ae482e44f71dbcd8bea2842b33",
    "testharness"
   ],
   "XMLHttpRequest/abort-during-upload.htm": [
    "76a704710cb535699ee4f9e66115fa62351f7a3e",
    "testharness"
   ],
   "XMLHttpRequest/abort-event-abort.htm": [
    "8afc5c9fe3534f452b91255fcdff35c4ab250ec7",
@@ -505773,17 +505779,17 @@
    "a2d7c9368ed8c01ca06c36646666270e85aee070",
    "reftest"
   ],
   "css/css-display-3/display-contents-dynamic-generated-content-fieldset-001-ref.html": [
    "30ec5c8ddacfbfef8434c37ca7a0a766f2bbc89a",
    "support"
   ],
   "css/css-display-3/display-contents-dynamic-generated-content-fieldset-001.html": [
-   "0be8853e66cd7c447725d681a1703a2ad85d8924",
+   "984bebb3c3b8661aedef4a229848dfa818bb1f4a",
    "reftest"
   ],
   "css/css-display-3/display-contents-dynamic-inline-flex-001-inline.html": [
    "40fb07e8ada1530e6835ff2d4e49c5571ffb0baa",
    "reftest"
   ],
   "css/css-display-3/display-contents-dynamic-inline-flex-001-none.html": [
    "40fb07e8ada1530e6835ff2d4e49c5571ffb0baa",
@@ -578705,17 +578711,17 @@
    "ad44e3f4ba132bfb4a522b14a4ff5356dbbbad14",
    "testharness"
   ],
   "cssom-view/offsetParent_element_test.html": [
    "b2261ec702116c211ab5ac6fbb53698dfe60a7be",
    "testharness"
   ],
   "cssom-view/offsetTopLeftInScrollableParent.html": [
-   "79b4a278f0e35646cfdffeebf8f0523e2772bc9b",
+   "82a6920db4d0be087e6ed621313ecf92e3e2ed68",
    "testharness"
   ],
   "cssom-view/resources/elementsFromPoint.js": [
    "0c31158817d4d6f9e59df0d2ebe0e41c6ce41bb5",
    "support"
   ],
   "cssom-view/resources/iframe1.html": [
    "ec93f617bdc7b0055d96c7b00ab7832cca1c1af0",
@@ -601240,16 +601246,20 @@
   "html/syntax/parsing/common.js": [
    "75ee03ce8de0f532c4d8379ea9dfaa171a2faa51",
    "support"
   ],
   "html/syntax/parsing/contains.json": [
    "30c5ad775f196a6b41f7df9326eea775846f7ade",
    "support"
   ],
+  "html/syntax/parsing/empty-doctype-ids.html": [
+   "79b4a278f0e35646cfdffeebf8f0523e2772bc9b",
+   "testharness"
+  ],
   "html/syntax/parsing/foreign_content_001.html": [
    "a2739f24051f77c9fdab26f68218fa1fd6e2c1d3",
    "support"
   ],
   "html/syntax/parsing/foreign_content_003.html": [
    "cf1d6d1318d25f59655e0d0dec08bcab82955e8a",
    "support"
   ],
@@ -624161,17 +624171,17 @@
    "14dcf42e1dbfdc7589f9df64e2622cc599411174",
    "testharness"
   ],
   "service-workers/service-worker/request-end-to-end.https.html": [
    "ee9f8140b492daf89cb715643ee40557f6ed904e",
    "testharness"
   ],
   "service-workers/service-worker/resource-timing.https.html": [
-   "403b3a0183ece928ecd93570067c9eac078aa901",
+   "9ca1caf0b8216eda8956be0d98eb7b5ab2d92a43",
    "testharness"
   ],
   "service-workers/service-worker/resources/404.py": [
    "567d0a7de3ef54adaa8339bb04632a2ecfcc57a5",
    "support"
   ],
   "service-workers/service-worker/resources/appcache-ordering.install.html": [
    "2fbe9f464383783774f08276b8e2cc7103fee83c",
@@ -624921,17 +624931,17 @@
    "c939271e717288203a5a298b95a7328100bd7c80",
    "support"
   ],
   "service-workers/service-worker/resources/resource-timing-iframe.html": [
    "0fc85a13c536aad45a87fb073fdcebf371d4476d",
    "support"
   ],
   "service-workers/service-worker/resources/resource-timing-worker.js": [
-   "ee7888f2e145700cf2590b6d6de9bab39088a979",
+   "45dd429936a3e3f558fac21a5a2e69ec7fa5ab5a",
    "support"
   ],
   "service-workers/service-worker/resources/respond-then-throw-worker.js": [
    "d57215bcad8a3966175930642dfd34281b11aeff",
    "support"
   ],
   "service-workers/service-worker/resources/service-worker-csp-worker.py": [
    "f7c6bb3ba222dc35a09ef806a7c6d145339f9eb2",
@@ -631253,21 +631263,21 @@
    "c9dcf7c17010e5495007e000b33aeb4dc89f92b7",
    "testharness"
   ],
   "web-animations/interfaces/KeyframeEffect/iterationComposite.html": [
    "2ed50cdb27335345015d8b13c64ef86c67048757",
    "testharness"
   ],
   "web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-001.html": [
-   "bc2ddd24f482292a2175ddd94c62293a962cf4af",
+   "83e58d986208b6cbc51e4124a2b17269a26e0520",
    "testharness"
   ],
   "web-animations/interfaces/KeyframeEffect/processing-a-keyframes-argument-002.html": [
-   "120984a06a0d22ca9d008e144a4f8e9f29a9721b",
+   "38b350320a08cc2a9ae4449944eea427bfbe6f9d",
    "testharness"
   ],
   "web-animations/interfaces/KeyframeEffect/setKeyframes.html": [
    "2982bb6f57bb52c6e4e0483e4e47b22868a6010d",
    "testharness"
   ],
   "web-animations/interfaces/KeyframeEffect/setTarget.html": [
    "8c75e6605a134c96e261e5383414b7e15b32d121",
@@ -631813,17 +631823,17 @@
    "904dd1db0e9731148a1793065b1d38acf0ac094b",
    "wdspec"
   ],
   "webdriver/tests/contexts/resizing_and_positioning.py": [
    "479379109115668183643e8a050396219332887d",
    "wdspec"
   ],
   "webdriver/tests/cookies/cookies.py": [
-   "e31177e638269864031e44808945fa1e7c46031c",
+   "afa7bcffd838c939aa6483c26a49d43c4b2dc94b",
    "wdspec"
   ],
   "webdriver/tests/element_click/__init__.py": [
    "da39a3ee5e6b4b0d3255bfef95601890afd80709",
    "support"
   ],
   "webdriver/tests/element_click/select.py": [
    "5ba51b660c7203bba3ada597c2f56fe094358e1f",
@@ -631949,17 +631959,17 @@
    "5a31a3917a5157516c10951a3b3d5ffb43b992d9",
    "support"
   ],
   "webdriver/tests/support/asserts.py": [
    "b02f45e99cdee49f12608e60333e566c8c0e04d0",
    "support"
   ],
   "webdriver/tests/support/fixtures.py": [
-   "ed33ffdd2084ba3c65d82ff7ce7996d45ba98ce5",
+   "4b68fd0f02cc88e9abb422c2c3978812edbbbec7",
    "support"
   ],
   "webdriver/tests/support/http_request.py": [
    "cb40c781fea2280b98135522def5e6a116d7b946",
    "support"
   ],
   "webdriver/tests/support/inline.py": [
    "d05c1b209ab1b8c22ab542d0418340896bc844fb",
--- a/testing/web-platform/mozilla/meta/MANIFEST.json
+++ b/testing/web-platform/mozilla/meta/MANIFEST.json
@@ -974,57 +974,57 @@
    "74e16eb87ecdfeb2dfc28f36e0c73a584abdf9c2",
    "support"
   ],
   "dom/classList.html": [
    "f289334e7b3486259b9aae54b4282a7211b8813e",
    "testharness"
   ],
   "dom/throttling/resources/test.html": [
-   "15bf447545bf4ccd8b6a71d5d2cf2e5bba303293",
+   "0898e3efa5dbcc74138bdf27ff2787d1f1a2d4d8",
    "support"
   ],
   "dom/throttling/resources/throttling.js": [
-   "2dc138ec9298d31711bc33fc47af12da1f64c4ce",
+   "e0bf1a7c5a0d2c8be2b793c786bb9484779dcbbf",
    "support"
   ],
   "dom/throttling/resources/ws.sub.js": [
    "66306649fb96efc2d5f13c566fac3da18339bc38",
    "support"
   ],
   "dom/throttling/throttling-1.window.js": [
-   "609c0d54b0aaf81b28a590217abde69c5e23f168",
+   "216ffff13da87662a1dcddbc6ab091cc0e7380ba",
    "testharness"
   ],
   "dom/throttling/throttling-2.window.js": [
-   "1c6900b823d95ee84791fb04eeae8b61311f5c58",
+   "e76ad877b617c343968211596c34e787849ef587",
    "testharness"
   ],
   "dom/throttling/throttling-3.window.js": [
-   "a9b4b0ade8a22eae9c804735513d89370311d471",
+   "c7e6a0638b216f1f314a022d166ac3d2d6b3ffbd",
    "testharness"
   ],
   "dom/throttling/throttling-4.window.js": [
-   "aeabd55bbb829c92d69bfc44f5e6fe3ad3105a84",
+   "7a6d52ee3f4077bbfc7f0ac635559abc14e0fde5",
    "testharness"
   ],
   "dom/throttling/throttling-indexeddb.window.js": [
-   "275a900b501e54cadc5ca224240489ad27464081",
+   "334beb79c9bd4fd56574b5eca2b6a3709d9057e7",
    "testharness"
   ],
   "dom/throttling/throttling-webaudio.window.js": [
-   "fd5cd3bd05b749e871e5a3e746e2cfc10a48d794",
+   "27e56f68bc041ad07b9c9c27341006d95cd90194",
    "testharness"
   ],
   "dom/throttling/throttling-webrtc.window.js": [
-   "1d832a4e14ad10c5a2143c6b0d7f5cad2c29bdcd",
+   "02e6acec2ff275e0e935cb6d903d348f98d5d437",
    "testharness"
   ],
   "dom/throttling/throttling-ws.window.js": [
-   "df9b37384c42984fe80ea8a35164089f977268b0",
+   "67a981ba2a4d08b684947ed42aba6648dcd262b4",
    "testharness"
   ],
   "fetch/api/redirect/redirect-referrer-mixed-content.js": [
    "f9d7ec9cf9fa8c847e45664b05482e3f8c191385",
    "support"
   ],
   "fetch/api/redirect/redirect-referrer.https.html": [
    "99cbd16b78771f35e075e4012d8dbc5dce3209c0",
new file mode 100644
--- /dev/null
+++ b/testing/web-platform/tests/html/syntax/parsing/empty-doctype-ids.html
@@ -0,0 +1,10 @@
+<!doctype html PUBLIC "" "">
+<meta charset=utf-8>
+<title>Doctype with empty ids should trigger the standards mode.</title>
+<script src=/resources/testharness.js></script>
+<script src=/resources/testharnessreport.js></script>
+<script>
+test(function () {
+  assert_equals(document.compatMode, "CSS1Compat");
+}, "Doctype with empty ids should trigger the standards mode.");
+</script>