dom/inputmethod/mochitest/inputmethod_common.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     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