Commit e4a2cb3a authored by Cosmin Sabou's avatar Cosmin Sabou
Browse files

Backed out changeset c0394b2d9173 (bug 1534677) for m-e10s failures on...

Backed out changeset c0394b2d9173 (bug 1534677) for m-e10s failures on test_ManifestProcessor_lang.html CLOSED TREE
parent fa2d5b1c
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -245,8 +245,6 @@ ManifestStartURLShouldBeSameOrigin=The start URL must be same origin as document
ManifestInvalidType=Expected the %1$S’s %2$S member to be a %3$S.
# LOCALIZATION NOTE: %1$S is the name of the property whose value is invalid. %2$S is the (invalid) value of the property. E.g. "theme_color: 42 is not a valid CSS color."
ManifestInvalidCSSColor=%1$S: %2$S is not a valid CSS color.
# LOCALIZATION NOTE: %1$S is the name of the property whose value is invalid. %2$S is the (invalid) value of the property. E.g. "lang: 42 is not a valid language code."
ManifestLangIsInvalid=%1$S: %2$S is not a valid language code.
PatternAttributeCompileFailure=Unable to check <input pattern='%S'> because the pattern is not a valid regexp: %S
# LOCALIZATION NOTE: Do not translate "postMessage" or DOMWindow. %S values are origins, like https://domain.com:port
TargetPrincipalDoesNotMatch=Failed to execute ‘postMessage’ on ‘DOMWindow’: The target origin provided (‘%S’) does not match the recipient window’s origin (‘%S’).
+10 −1
Original line number Diff line number Diff line
@@ -256,7 +256,16 @@ var ManifestProcessor = { // jshint ignore:line
        property: "lang",
        expectedType: "string", trim: true,
      };
      return extractor.extractLanguageValue(spec);
      let tag = extractor.extractValue(spec);
      // TODO: Check if tag is structurally valid.
      //       Cannot do this because we don't support Intl API on Android.
      //       https://bugzilla.mozilla.org/show_bug.cgi?id=864843
      //       https://github.com/tc39/ecma402/issues/5
      // TODO: perform canonicalization on the tag.
      //       Can't do this today because there is no direct means to
      //       access canonicalization algorithms through Intl API.
      //       https://github.com/tc39/ecma402/issues/5
      return tag;
    }
  },
};
+0 −14
Original line number Diff line number Diff line
@@ -61,19 +61,5 @@ ValueExtractor.prototype = {
    }
    return color;
  },
  extractLanguageValue(spec) {
    let langTag;
    const value = this.extractValue(spec);
    if (value === undefined) {
      try {
        langTag = Intl.getCanonicalLocales(value)[0];
      } catch (err) {
        console.warn(this.domBundle.formatStringFromName("ManifestLangIsInvalid",
                                                        [spec.property, value],
                                                        2));
      }
    }
    return langTag;
  },
};
var EXPORTED_SYMBOLS = ["ValueExtractor"]; // jshint ignore:line
+18 −34
Original line number Diff line number Diff line
<!DOCTYPE HTML>
<meta charset="utf-8">
<!--
Bug 1143879 - Implement lang member of Web manifest
https://bugzilla.mozilla.org/show_bug.cgi?id=1143879
@@ -35,11 +34,11 @@ var validTags = [
  "ch", "co", "cr", "cs", "cu", "cv", "cy", "da", "de", "dv", "dz", "ee",
  "el", "en", "eo", "es", "et", "eu", "fa", "ff", "fi", "fj", "fo", "fr",
  "fy", "ga", "gd", "gl", "gn", "gu", "gv", "ha", "he", "hi", "ho", "hr",
  "ht", "hu", "hy", "hz", "ia", "id", "ie", "ig", "ik", "io",
  "is", "it", "iu", "ja", "jv", "ka", "kg", "ki", "kj",
  "ht", "hu", "hy", "hz", "ia", "id", "ie", "ig", "ik", "in", "io",
  "is", "it", "iu", "iw", "ja", "ji", "jv", "jw", "ka", "kg", "ki", "kj",
  "kk", "kl", "km", "kn", "ko", "kr", "ks", "ku", "kv", "kw", "ky", "la",
  "lb", "lg", "li", "ln", "lo", "lt", "lu", "lv", "mg", "mh", "mi", "mk",
  "ml", "mn", "mr", "ms", "mt", "my", "na", "nb", "nd", "ne", "ng",
  "ml", "mn", "mo", "mr", "ms", "mt", "my", "na", "nb", "nd", "ne", "ng",
  "nl", "nn", "no", "nr", "nv", "ny", "oc", "oj", "om", "or", "os", "pa",
  "pi", "pl", "ps", "pt", "qu", "rm", "rn", "ro", "ru", "rw", "sa", "sc",
  "sd", "se", "sg", "sh", "si", "sk", "sl", "sm", "sn", "so", "sq", "sr",
@@ -47,16 +46,17 @@ var validTags = [
  "tn", "to", "tr", "ts", "tt", "tw", "ty", "ug", "uk", "ur", "uz", "ve",
  "vi", "vo", "wa", "wo", "xh", "yi", "yo", "za", "zh", "zu", "en-US",
  "jp-JS", "pt-PT", "pt-BR", "de-CH", "de-DE-1901", "es-419", "sl-IT-nedis",
  "en-US-boont", "mn-Cyrl-MN", "x-fr-ch", "sr-Cyrl", "sr-Latn",
  "zh-TW", "en-GB-boont-posix-r-extended-sequence-x-private",
  "nan-Hans-MM-variant2-variant1-t-zh-latn-u-ca-chinese-x-private", "cmn-Hans-CN",
  "yue-HK", "de-CH-x-phonebk", "az-Arab-x-aze-derbend", "x-whatever",
  "en-US-boont", "mn-Cyrl-MN", "x-fr-CH", "sr-Cyrl", "sr-Latn",
  "hy-Latn-IT-arevela", "zh-TW", "en-GB-boont-r-extended-sequence-x-private",
  "zh-nan-hans-bu-variant2-variant1-u-ca-chinese-t-zh-latn-x-private",
  "zh-cmn-Hans-CN", "cmn-Hans-CN", "zh-yue-HK", "yue-HK",
  "de-CH-x-phonebk", "az-Arab-x-AZE-derbend", "x-whatever",
  "qaa-Qaaa-QM-x-southern",
];


for (var tag of validTags) {
  expected = `Expect lang to be "${tag}"`;
  expected = `Expect lang to be ${tag}.`;
  data.jsonText = JSON.stringify({
    lang: tag,
  });
@@ -64,25 +64,7 @@ for (var tag of validTags) {
  is(result.lang, tag, expected);
}

// Canonical form conversion... old names become new names.
const granfatheredTags = [
  ["in", "id"],
  ["iw", "he"],
  ["ji", "yi"],
  ["jw", "jv"],
  ["mo", "ro"],
  ["zh-cmn-Hans-CN", "cmn-Hans-CN"],
  ["zh-yue-HK", "yue-HK"],
];

for (const [oldTag, newTag] of granfatheredTags) {
  expected = `Expect lang to be "${newTag}"`;
  data.jsonText = JSON.stringify({
    lang: oldTag,
  });
  result = processor.process(data);
  is(result.lang, newTag, expected);
}

// trim tests - check that language tags get trimmed properly.
for (tag of validTags) {
@@ -109,7 +91,7 @@ for (var item of invalidTags) {
    lang: item,
  });
  result = processor.process(data);
  is(result.lang, undefined, expected);
  todo_is(result.lang, undefined, expected);
}

// Canonical form conversion tests. We convert the following tags, which are in
@@ -117,10 +99,11 @@ for (var item of invalidTags) {
// in canonical form.
var canonicalTags = [
"jp-JS", "pt-PT", "pt-BR", "de-CH", "de-DE-1901", "es-419", "sl-IT-nedis",
  "en-US-boont", "mn-Cyrl-MN", "x-fr-ch", "sr-Cyrl", "sr-Latn",
  "hy-Latn-IT", "zh-TW", "en-GB-boont-r-extended-sequence-x-private",
  "cmn-Hans-CN", "yue-HK", "de-CH-x-phonebk", "az-Arab-x-aze-derbend",
  "x-whatever", "qaa-Qaaa-QM-x-southern",
"en-US-boont", "mn-Cyrl-MN", "x-fr-CH", "sr-Cyrl", "sr-Latn",
"hy-Latn-IT-arevela", "zh-TW", "en-GB-boont-r-extended-sequence-x-private",
"zh-cmn-Hans-CN", "cmn-Hans-CN", "zh-yue-HK", "yue-HK",
"de-CH-x-phonebk", "az-Arab-x-AZE-derbend", "x-whatever",
"qaa-Qaaa-QM-x-southern",
];

for (tag of canonicalTags) {
@@ -130,6 +113,7 @@ for (tag of canonicalTags) {
    lang: uppedTag,
  });
  result = processor.process(data);
  is(result.lang, tag, expected);
  todo_is(result.lang, tag, expected);
}

</script>