Bug 1391405: Part 4 - Avoid easily-avoidable regexp. r?zombie draft
authorKris Maglione <maglione.k@gmail.com>
Thu, 17 Aug 2017 14:45:30 -0700
changeset 649176 eef7eb12615faaf6fa9adc87685ef74be9413a0c
parent 649175 477f1364c0904bde78d54eae083bdb8e49ee5732
child 649177 7f7d5df605bc6544cb7f1c0c7e224d81b211e09c
push id74977
push usermaglione.k@gmail.com
push dateFri, 18 Aug 2017 18:50:35 +0000
reviewerszombie
bugs1391405
milestone57.0a1
Bug 1391405: Part 4 - Avoid easily-avoidable regexp. r?zombie MozReview-Commit-ID: 6xAr5hGxm2r
toolkit/components/extensions/Schemas.jsm
--- a/toolkit/components/extensions/Schemas.jsm
+++ b/toolkit/components/extensions/Schemas.jsm
@@ -1182,17 +1182,17 @@ class Type extends Entry {
   // normalize. Subclasses can choose to use it or not.
   normalizeBase(type, value, context) {
     if (this.checkBaseType(getValueBaseType(value))) {
       this.checkDeprecated(context, value);
       return {value: this.preprocess(value, context)};
     }
 
     let choice;
-    if (/^[aeiou]/.test(type)) {
+    if ("aeiou".includes(type[0])) {
       choice = `be an ${type} value`;
     } else {
       choice = `be a ${type} value`;
     }
 
     return context.error(() => `Expected ${type} instead of ${JSON.stringify(value)}`,
                          choice);
   }