Bug 1460748: Load the correct affix file for WebExtension dictionaries. r?aswan
MozReview-Commit-ID: 1arZbiexgma
--- 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");
});