Bug 974770 - Get rid of dom.mozInputMethod.testing in test scripts. r=kanru, r=mrbkap

This commit is contained in:
Tim Chien 2015-08-26 20:18:00 -04:00
parent 1e3fcef139
commit 8e204ab9bf
11 changed files with 17 additions and 47 deletions

View File

@ -2468,24 +2468,6 @@ Navigator::HasUserMediaSupport(JSContext* /* unused */,
}
#endif // MOZ_MEDIA_NAVIGATOR
/* static */
bool
Navigator::HasInputMethodSupport(JSContext* /* unused */,
JSObject* aGlobal)
{
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
if (!win || !Preferences::GetBool("dom.mozInputMethod.enabled", false)) {
return false;
}
if (Preferences::GetBool("dom.mozInputMethod.testing", false)) {
return true;
}
return CheckPermission(win, "input") ||
CheckPermission(win, "input-manage");
}
/* static */
bool
Navigator::HasDataStoreSupport(nsIPrincipal* aPrincipal)

View File

@ -323,8 +323,6 @@ public:
JSObject* /* unused */);
#endif // MOZ_MEDIA_NAVIGATOR
static bool HasInputMethodSupport(JSContext* /* unused */, JSObject* aGlobal);
static bool HasDataStoreSupport(nsIPrincipal* aPrincipal);
static bool HasDataStoreSupport(JSContext* cx, JSObject* aGlobal);

View File

@ -17,13 +17,11 @@ function setup() {
}
SpecialPowers.setBoolPref("dom.mozInputMethod.enabled", true);
SpecialPowers.setBoolPref("dom.mozInputMethod.testing", true);
SpecialPowers.addPermission('input-manage', true, document);
}
function tearDown() {
SpecialPowers.setBoolPref("dom.mozInputMethod.enabled", false);
SpecialPowers.setBoolPref("dom.mozInputMethod.testing", false);
SpecialPowers.removePermission('input-manage', document);
SimpleTest.finish();
}

View File

@ -86,7 +86,7 @@ skip-if = toolkit == 'android' || (toolkit == 'gonk' && !debug) #TIMED_OUT, bug
skip-if = (toolkit == 'gonk') # Disabled on b2g due to bug 1097419
[test_browserElement_oop_SendEvent.html]
[test_browserElement_oop_SetInputMethodActive.html]
skip-if = (os == "android")
skip-if = (os == "android") || (toolkit == 'gonk') # Disabled on B2G Emulator bug 1198163
[test_browserElement_oop_SetVisible.html]
[test_browserElement_oop_SetVisibleFrames.html]
[test_browserElement_oop_SetVisibleFrames2.html]

View File

@ -209,7 +209,7 @@ skip-if = (toolkit == 'gonk') # Disabled on b2g due to bug 1097419
[test_browserElement_inproc_SendEvent.html]
# The setInputMethodActive() tests will timed out on Android
[test_browserElement_inproc_SetInputMethodActive.html]
skip-if = (os == "android")
skip-if = (os == "android") || (toolkit == 'gonk') # Disabled on B2G Emulator bug 1198163
[test_browserElement_inproc_SetVisible.html]
[test_browserElement_inproc_SetVisibleFrames.html]
[test_browserElement_inproc_SetVisibleFrames2.html]

View File

@ -36,15 +36,6 @@ let Utils = {
return mm;
},
checkPermissionForMM: function u_checkPermissionForMM(mm, permName) {
let testing = false;
try {
testing = Services.prefs.getBoolPref("dom.mozInputMethod.testing");
} catch (e) { }
if (testing) {
return true;
}
return mm.assertPermission(permName);
}
};

View File

@ -213,14 +213,8 @@ MozInputMethod.prototype = {
this._isSystem = true;
}
// Check if we can use keyboard related APIs.
let testing = false;
try {
testing = Services.prefs.getBoolPref("dom.mozInputMethod.testing");
} catch (e) {
}
perm = Services.perms.testExactPermissionFromPrincipal(principal, "input");
if (!testing && perm !== Ci.nsIPermissionManager.ALLOW_ACTION) {
if (perm !== Ci.nsIPermissionManager.ALLOW_ACTION) {
this._isKeyboard = false;
return;
}

View File

@ -8,7 +8,7 @@ function inputmethod_setup(callback) {
}
let permissions = [];
['input-manage', 'browser'].forEach(function(name) {
['input', 'input-manage', 'browser'].forEach(function(name) {
permissions.push({
type: name,
allow: true,
@ -20,9 +20,7 @@ function inputmethod_setup(callback) {
let prefs = [
['dom.mozBrowserFramesEnabled', true],
// Enable navigator.mozInputMethod.
['dom.mozInputMethod.enabled', true],
// Bypass the permission check for mozInputMethod API.
['dom.mozInputMethod.testing', true]
['dom.mozInputMethod.enabled', true]
];
SpecialPowers.pushPrefEnv({set: prefs}, function() {
SimpleTest.waitForFocus(callback);

View File

@ -89,7 +89,11 @@ function runTest() {
SpecialPowers.pushPermissions([{
type: 'input',
allow: true,
context: imeUrl
context: {
url: imeUrl,
appId: SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
isInBrowserElement: true
}
}], function() {
keyboardA.src = imeUrl;
keyboardB.src = imeUrl;

View File

@ -76,7 +76,11 @@ function runTest() {
SpecialPowers.pushPermissions([{
type: 'input',
allow: true,
context: imeUrl
context: {
url: imeUrl,
appId: SpecialPowers.Ci.nsIScriptSecurityManager.NO_APP_ID,
isInBrowserElement: true
}
}], function() {
// STEP 2c: Tell Gecko to use this iframe as its keyboard app
let req = keyboard.setInputMethodActive(true);

View File

@ -6,7 +6,8 @@
[JSImplementation="@mozilla.org/b2g-inputmethod;1",
NavigatorProperty="mozInputMethod",
Func="Navigator::HasInputMethodSupport"]
Pref="dom.mozInputMethod.enabled",
CheckAnyPermissions="input input-manage"]
interface MozInputMethod : EventTarget {
// Input Method Manager contain a few global methods expose to apps
readonly attribute MozInputMethodManager mgmt;