dom/inputmethod/mochitest/inputmethod_common.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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 }

mercurial