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