Bug 1460748: Load the correct affix file for WebExtension dictionaries. r?aswan draft
authorKris Maglione <maglione.k@gmail.com>
Thu, 10 May 2018 15:42:29 -0700
changeset 793909 9554a70c97096358c16dbb830230e6ab3366801c
parent 793442 e40e77f848063469114960ac2f13dae5649b328f
push id109529
push usermaglione.k@gmail.com
push dateThu, 10 May 2018 22:43:06 +0000
reviewersaswan
bugs1460748
milestone62.0a1
Bug 1460748: Load the correct affix file for WebExtension dictionaries. r?aswan MozReview-Commit-ID: 1arZbiexgma
toolkit/components/extensions/Extension.jsm
toolkit/mozapps/extensions/test/xpcshell/test_dictionary_webextension.js
--- a/toolkit/components/extensions/Extension.jsm
+++ b/toolkit/components/extensions/Extension.jsm
@@ -1882,17 +1882,17 @@ class Dictionary extends ExtensionData {
 
   static getBootstrapScope(id, file) {
     return new DictionaryBootstrapScope();
   }
 
   async startup(reason) {
     this.dictionaries = {};
     for (let [lang, path] of Object.entries(this.startupData.dictionaries)) {
-      let uri = Services.io.newURI(path, null, this.rootURI);
+      let uri = Services.io.newURI(path.slice(0, -4) + ".aff", null, this.rootURI);
       this.dictionaries[lang] = uri;
 
       spellCheck.addDictionary(lang, uri);
     }
 
     Management.emit("ready", this);
   }
 
--- a/toolkit/mozapps/extensions/test/xpcshell/test_dictionary_webextension.js
+++ b/toolkit/mozapps/extensions/test/xpcshell/test_dictionary_webextension.js
@@ -82,21 +82,32 @@ add_task(async function test_registratio
     manifest: {
       applications: {gecko: {id: "en-US@dictionaries.mozilla.org"}},
       "dictionaries": {
         "en-US": "en-US.dic",
       },
     },
 
     files: {
-      "en-US.dic": `1\n${WORD}\n`,
-      "en-US.aff": "",
+      "en-US.dic": `2\n${WORD}\nnativ/A\n`,
+      "en-US.aff": `
+SET ISO8859-1
+TRY esijanrtolcdugmphbyfvkwqxzäüößáéêàâñESIJANRTOLCDUGMPHBYFVKWQXZÄÜÖÉ-.
+
+SFX A Y 4
+SFX A   0       en         [^elr]
+SFX A   0       en         [^e][rl]
+SFX A   0       en         [^u]er
+SFX A   0       en         [eil]el
+      `
+    ,
     },
   });
 
   ok(spellCheck.check(WORD), "Word should pass check while add-on load is loaded");
+  ok(spellCheck.check("nativen"), "Words should have correct affixes");
 
   addon.uninstall();
 
   await new Promise(executeSoon);
 
   ok(!spellCheck.check(WORD), "Word should not pass check after add-on unloads");
 });