dom/inputmethod/mochitest/inputmethod_common.js

Fri, 16 Jan 2015 18:13:44 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Fri, 16 Jan 2015 18:13:44 +0100
branch
TOR_BUG_9701
changeset 14
925c144e1f1f
permissions
-rw-r--r--

Integrate suggestion from review to improve consistency with existing code.

     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   }
    10   let permissions = [];
    11   ['input-manage', 'browser'].forEach(function(name) {
    12     permissions.push({
    13       type: name,
    14       allow: true,
    15       context: document
    16     });
    17   });
    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 }
    33 function inputmethod_cleanup() {
    34   SimpleTest.finish();
    35 }

mercurial