Bug 915570 - Rename 'keyboard' permission and role to 'input'. r=yxl

This commit is contained in:
Tim Chien
2013-11-01 09:01:14 -04:00
parent 923db21571
commit ee690af4e3
7 changed files with 12 additions and 12 deletions

View File

@@ -282,12 +282,12 @@ this.PermissionsTable = { geolocation: {
privileged: DENY_ACTION, privileged: DENY_ACTION,
certified: ALLOW_ACTION certified: ALLOW_ACTION
}, },
"keyboard": { "input": {
app: DENY_ACTION, app: DENY_ACTION,
privileged: ALLOW_ACTION, privileged: ALLOW_ACTION,
certified: ALLOW_ACTION certified: ALLOW_ACTION
}, },
"inputmethod-manage": { "input-manage": {
app: DENY_ACTION, app: DENY_ACTION,
privileged: DENY_ACTION, privileged: DENY_ACTION,
certified: ALLOW_ACTION certified: ALLOW_ACTION

View File

@@ -1833,7 +1833,7 @@ bool Navigator::HasInputMethodSupport(JSContext* /* unused */,
nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal); nsCOMPtr<nsPIDOMWindow> win = GetWindowFromGlobal(aGlobal);
return Preferences::GetBool("dom.mozInputMethod.testing", false) || return Preferences::GetBool("dom.mozInputMethod.testing", false) ||
(Preferences::GetBool("dom.mozInputMethod.enabled", false) && (Preferences::GetBool("dom.mozInputMethod.enabled", false) &&
win && CheckPermission(win, "keyboard")); win && CheckPermission(win, "input"));
} }
/* static */ /* static */

View File

@@ -196,7 +196,7 @@ function BrowserElementParent(frameLoader, hasRemoteFrame) {
let principal = this._frameElement.ownerDocument.nodePrincipal; let principal = this._frameElement.ownerDocument.nodePrincipal;
let perm = Services.perms let perm = Services.perms
.testExactPermissionFromPrincipal(principal, "inputmethod-manage"); .testExactPermissionFromPrincipal(principal, "input-manage");
if (perm === Ci.nsIPermissionManager.ALLOW_ACTION) { if (perm === Ci.nsIPermissionManager.ALLOW_ACTION) {
defineMethod('setInputMethodActive', this._setInputMethodActive); defineMethod('setInputMethodActive', this._setInputMethodActive);
} }

View File

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

View File

@@ -90,7 +90,7 @@ this.Keyboard = {
receiveMessage: function keyboardReceiveMessage(msg) { receiveMessage: function keyboardReceiveMessage(msg) {
// If we get a 'Keyboard:XXX' message, check that the sender has the // If we get a 'Keyboard:XXX' message, check that the sender has the
// keyboard permission. // input permission.
if (msg.name.indexOf("Keyboard:") != -1) { if (msg.name.indexOf("Keyboard:") != -1) {
if (!this.messageManager) { if (!this.messageManager) {
return; return;
@@ -110,9 +110,9 @@ this.Keyboard = {
return; return;
} }
if (!mm.assertPermission("keyboard")) { if (!mm.assertPermission("input")) {
dump("Keyboard message " + msg.name + dump("Keyboard message " + msg.name +
" from a content process with no 'keyboard' privileges."); " from a content process with no 'input' privileges.");
return; return;
} }
} }

View File

@@ -44,7 +44,7 @@ MozKeyboard.prototype = {
let principal = win.document.nodePrincipal; let principal = win.document.nodePrincipal;
// Limited the deprecated mozKeyboard API to certified apps only // Limited the deprecated mozKeyboard API to certified apps only
let perm = Services.perms.testExactPermissionFromPrincipal(principal, let perm = Services.perms.testExactPermissionFromPrincipal(principal,
"inputmethod-manage"); "input-manage");
if (perm != Ci.nsIPermissionManager.ALLOW_ACTION) { if (perm != Ci.nsIPermissionManager.ALLOW_ACTION) {
dump("No permission to use the keyboard API for " + dump("No permission to use the keyboard API for " +
principal.origin + "\n"); principal.origin + "\n");

View File

@@ -18,13 +18,13 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=920977
<script type="application/javascript;version=1.8"> <script type="application/javascript;version=1.8">
var gData = [ var gData = [
{ {
perm: ["keyboard"], perm: ["input"],
obj: "mozInputMethod", obj: "mozInputMethod",
webidl: "MozInputMethod", webidl: "MozInputMethod",
settings: [["dom.mozInputMethod.enabled", true]], settings: [["dom.mozInputMethod.enabled", true]],
}, },
{ {
perm: ["inputmethod-manage"], perm: ["input-manage"],
obj: "mozKeyboard", obj: "mozKeyboard",
idl: "nsIB2GKeyboard", idl: "nsIB2GKeyboard",
} }