blob: 3fb4c78b597c57a539b8e45fb7c85eb8e8e667d8 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
|
"use strict";
const { XPCOMUtils } = ChromeUtils.importESModule(
"resource://gre/modules/XPCOMUtils.sys.mjs"
);
XPCOMUtils.defineLazyServiceGetter(
this,
"spellCheck",
"@mozilla.org/spellchecker/engine;1",
"mozISpellCheckingEngine"
);
const nsFile = Components.Constructor(
"@mozilla.org/file/local;1",
"nsIFile",
"initWithPath"
);
add_task(async function () {
let prof = do_get_profile();
let basePath = PathUtils.join(prof.path, "\u263a", "dictionaries");
let baseDir = nsFile(basePath);
await IOUtils.makeDirectory(basePath, { createAncestors: true });
let dicPath = PathUtils.join(basePath, "dict.dic");
let affPath = PathUtils.join(basePath, "dict.aff");
const WORD = "Flehgragh";
await IOUtils.writeUTF8(dicPath, `1\n${WORD}\n`);
await IOUtils.writeUTF8(affPath, "");
spellCheck.loadDictionariesFromDir(baseDir);
spellCheck.dictionaries = ["dict"];
ok(
spellCheck.check(WORD),
"Dictionary should have been loaded from a unicode path"
);
});
|