dom/inputmethod/mochitest/inputmethod_common.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

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