From 16e3381dbaf67041fb43639aa1b902538b4f321d Mon Sep 17 00:00:00 2001 From: Tim Chien Date: Fri, 1 Nov 2013 09:01:14 -0400 Subject: [PATCH] Bug 915570 - Rename 'keyboard' permission and role to 'input'. r=yxl --- dom/apps/src/PermissionsTable.jsm | 4 ++-- dom/base/Navigator.cpp | 2 +- dom/browser-element/BrowserElementParent.jsm | 2 +- .../mochitest/browserElement_SetInputMethodActive.js | 4 ++-- dom/inputmethod/Keyboard.jsm | 6 +++--- dom/inputmethod/MozKeyboard.js | 2 +- dom/permission/tests/test_keyboard.html | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/dom/apps/src/PermissionsTable.jsm b/dom/apps/src/PermissionsTable.jsm index db98999ebb8..d78a696fbc0 100644 --- a/dom/apps/src/PermissionsTable.jsm +++ b/dom/apps/src/PermissionsTable.jsm @@ -282,12 +282,12 @@ this.PermissionsTable = { geolocation: { privileged: DENY_ACTION, certified: ALLOW_ACTION }, - "keyboard": { + "input": { app: DENY_ACTION, privileged: ALLOW_ACTION, certified: ALLOW_ACTION }, - "inputmethod-manage": { + "input-manage": { app: DENY_ACTION, privileged: DENY_ACTION, certified: ALLOW_ACTION diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 4a96ede5c88..b374f71bcbe 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -1833,7 +1833,7 @@ bool Navigator::HasInputMethodSupport(JSContext* /* unused */, nsCOMPtr win = GetWindowFromGlobal(aGlobal); return Preferences::GetBool("dom.mozInputMethod.testing", false) || (Preferences::GetBool("dom.mozInputMethod.enabled", false) && - win && CheckPermission(win, "keyboard")); + win && CheckPermission(win, "input")); } /* static */ diff --git a/dom/browser-element/BrowserElementParent.jsm b/dom/browser-element/BrowserElementParent.jsm index 7a26cec7e19..4d6995c5f0e 100644 --- a/dom/browser-element/BrowserElementParent.jsm +++ b/dom/browser-element/BrowserElementParent.jsm @@ -196,7 +196,7 @@ function BrowserElementParent(frameLoader, hasRemoteFrame) { let principal = this._frameElement.ownerDocument.nodePrincipal; let perm = Services.perms - .testExactPermissionFromPrincipal(principal, "inputmethod-manage"); + .testExactPermissionFromPrincipal(principal, "input-manage"); if (perm === Ci.nsIPermissionManager.ALLOW_ACTION) { defineMethod('setInputMethodActive', this._setInputMethodActive); } diff --git a/dom/browser-element/mochitest/browserElement_SetInputMethodActive.js b/dom/browser-element/mochitest/browserElement_SetInputMethodActive.js index 5e494a094ed..6f33806a611 100644 --- a/dom/browser-element/mochitest/browserElement_SetInputMethodActive.js +++ b/dom/browser-element/mochitest/browserElement_SetInputMethodActive.js @@ -12,13 +12,13 @@ browserElementTestHelpers.addPermission(); function setup() { SpecialPowers.setBoolPref("dom.mozInputMethod.enabled", true); SpecialPowers.setBoolPref("dom.mozInputMethod.testing", true); - SpecialPowers.addPermission('inputmethod-manage', true, document); + SpecialPowers.addPermission('input-manage', true, document); } function tearDown() { SpecialPowers.setBoolPref("dom.mozInputMethod.enabled", false); SpecialPowers.setBoolPref("dom.mozInputMethod.testing", false); - SpecialPowers.removePermission("inputmethod-manage", document); + SpecialPowers.removePermission("input-manage", document); SimpleTest.finish(); } diff --git a/dom/inputmethod/Keyboard.jsm b/dom/inputmethod/Keyboard.jsm index e7b4b797660..f99acde1543 100644 --- a/dom/inputmethod/Keyboard.jsm +++ b/dom/inputmethod/Keyboard.jsm @@ -90,7 +90,7 @@ this.Keyboard = { receiveMessage: function keyboardReceiveMessage(msg) { // If we get a 'Keyboard:XXX' message, check that the sender has the - // keyboard permission. + // input permission. if (msg.name.indexOf("Keyboard:") != -1) { if (!this.messageManager) { return; @@ -110,9 +110,9 @@ this.Keyboard = { return; } - if (!mm.assertPermission("keyboard")) { + if (!mm.assertPermission("input")) { dump("Keyboard message " + msg.name + - " from a content process with no 'keyboard' privileges."); + " from a content process with no 'input' privileges."); return; } } diff --git a/dom/inputmethod/MozKeyboard.js b/dom/inputmethod/MozKeyboard.js index 2621c6445d1..067b835f672 100644 --- a/dom/inputmethod/MozKeyboard.js +++ b/dom/inputmethod/MozKeyboard.js @@ -44,7 +44,7 @@ MozKeyboard.prototype = { let principal = win.document.nodePrincipal; // Limited the deprecated mozKeyboard API to certified apps only let perm = Services.perms.testExactPermissionFromPrincipal(principal, - "inputmethod-manage"); + "input-manage"); if (perm != Ci.nsIPermissionManager.ALLOW_ACTION) { dump("No permission to use the keyboard API for " + principal.origin + "\n"); diff --git a/dom/permission/tests/test_keyboard.html b/dom/permission/tests/test_keyboard.html index 09be6f1cc95..bec15d4acd4 100644 --- a/dom/permission/tests/test_keyboard.html +++ b/dom/permission/tests/test_keyboard.html @@ -18,13 +18,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=920977