|
1 function inputmethod_setup(callback) { |
|
2 SimpleTest.waitForExplicitFinish(); |
|
3 SimpleTest.requestCompleteLog(); |
|
4 let appInfo = SpecialPowers.Cc['@mozilla.org/xre/app-info;1'] |
|
5 .getService(SpecialPowers.Ci.nsIXULAppInfo); |
|
6 if (appInfo.name != 'B2G') { |
|
7 SpecialPowers.Cu.import("resource://gre/modules/Keyboard.jsm", this); |
|
8 } |
|
9 |
|
10 let permissions = []; |
|
11 ['input-manage', 'browser'].forEach(function(name) { |
|
12 permissions.push({ |
|
13 type: name, |
|
14 allow: true, |
|
15 context: document |
|
16 }); |
|
17 }); |
|
18 |
|
19 SpecialPowers.pushPermissions(permissions, function() { |
|
20 let prefs = [ |
|
21 ['dom.mozBrowserFramesEnabled', true], |
|
22 // Enable navigator.mozInputMethod. |
|
23 ['dom.mozInputMethod.enabled', true], |
|
24 // Bypass the permission check for mozInputMethod API. |
|
25 ['dom.mozInputMethod.testing', true] |
|
26 ]; |
|
27 SpecialPowers.pushPrefEnv({set: prefs}, function() { |
|
28 SimpleTest.waitForFocus(callback); |
|
29 }); |
|
30 }); |
|
31 } |
|
32 |
|
33 function inputmethod_cleanup() { |
|
34 SimpleTest.finish(); |
|
35 } |