Bug 1286530 - Turn Input-related APIs to ChromeOnly draft
authorAlexandre Lissy <lissyx@lissyx.dyndns.org>
Fri, 22 Apr 2016 11:10:55 +0200
changeset 387244 1a92cd70bc298b3cfc8daee3e44d1e0e37f44fd2
parent 387243 b3f135fc6dd02ad19bc4ff0f9590da51adb1f7f7
child 387245 e4682f657b74cac9f42386be2ba95eb6f5e683e2
push id22914
push userbmo:lissyx+mozillians@lissyx.dyndns.org
push dateWed, 13 Jul 2016 15:39:24 +0000
bugs1286530
milestone50.0a1
Bug 1286530 - Turn Input-related APIs to ChromeOnly MozReview-Commit-ID: 8LuaE2V0fx1
dom/webidl/BeforeAfterKeyboardEvent.webidl
dom/webidl/BrowserElement.webidl
dom/webidl/InputMethod.webidl
--- a/dom/webidl/BeforeAfterKeyboardEvent.webidl
+++ b/dom/webidl/BeforeAfterKeyboardEvent.webidl
@@ -1,18 +1,18 @@
 /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
 /* This Source Code Form is subject to the terms of the Mozilla Public
  * License, v. 2.0. If a copy of the MPL was not distributed with this file,
  * You can obtain one at http://mozilla.org/MPL/2.0/.
  */
 
 [Constructor(DOMString typeArg,
  optional BeforeAfterKeyboardEventInit eventInitDict),
- CheckAnyPermissions="embed-apps before-after-keyboard-event",
- Pref="dom.beforeAfterKeyboardEvent.enabled"]
+ Pref="dom.beforeAfterKeyboardEvent.enabled",
+ ChromeOnly]
 interface BeforeAfterKeyboardEvent : KeyboardEvent
 {
   // The valid value of embeddedCancelled is:
   // - "mozbrowserbeforekeydown": null
   // - "mozbrowserbeforekeyup": null
   // - "mozbrowserafterkeydown": true/false
   // - "mozbrowserafterkeyup": true/false
   readonly attribute boolean? embeddedCancelled;
--- a/dom/webidl/BrowserElement.webidl
+++ b/dom/webidl/BrowserElement.webidl
@@ -141,17 +141,17 @@ interface BrowserElementPrivileged {
 
   [Throws,
    Pref="dom.mozBrowserFramesEnabled",
    CheckAnyPermissions="browser"]
   DOMRequest getContentDimensions();
 
   [Throws,
    Pref="dom.mozBrowserFramesEnabled",
-   CheckAllPermissions="browser input-manage"]
+   ChromeOnly]
   DOMRequest setInputMethodActive(boolean isActive);
 
   [Throws,
    Pref="dom.mozBrowserFramesEnabled",
    CheckAllPermissions="browser nfc-manager"]
   void setNFCFocus(boolean isFocus);
 
   [Throws,
--- a/dom/webidl/InputMethod.webidl
+++ b/dom/webidl/InputMethod.webidl
@@ -11,17 +11,17 @@
  * the remote input element.
  * The API also contains a few Gaia System app only methods
  * (marked with "input-manage" permission) for Gaia System app to interact with
  * some types of inputs and to regulate the input apps.
  */
 [JSImplementation="@mozilla.org/b2g-inputmethod;1",
  NavigatorProperty="mozInputMethod",
  Pref="dom.mozInputMethod.enabled",
- CheckAnyPermissions="input input-manage"]
+ ChromeOnly]
 interface MozInputMethod : EventTarget {
   /**
    * Activate or decactive current API instance.
    * Gaia System app call this method via BrowserElement#setInputMethodActive.
    */
   [ChromeOnly]
   void setActive(boolean isActive);
 
@@ -34,206 +34,187 @@ interface MozInputMethod : EventTarget {
    * Fired when the input context changes, include changes from and to null.
    * The new InputContext instance will be available in the event
    * object under |inputcontext| property.  When it changes to null it
    * means the app (the user of this API) no longer has the control of
    * the original focused input field.
    * Note that if the app saves the original context, it might get
    * void; implementation decides when to void the input context.
    */
-  [CheckAnyPermissions="input"]
   attribute EventHandler oninputcontextchange;
 
   /**
    * An "input context" is mapped to a text field that the app is
    * allow to mutate. This attribute should be null when there is no
    * text field currently focused.
    */
-  [CheckAnyPermissions="input"]
   readonly attribute MozInputContext? inputcontext;
 
   /**
    * Add a dynamically declared input.
    *
    * The id must not be the same with any statically declared input in the app
    * manifest. If an input of the same id is already declared, the info of that
    * input will be updated.
    */
-  [CheckAnyPermissions="input"]
   Promise<void> addInput(DOMString inputId,
                          MozInputMethodInputManifest inputManifest);
 
   /**
    * Remove a dynamically declared input.
    *
    * The id must not be the same with any statically declared input in the app
    * manifest. Silently resolves if the input is not previously declared;
    * rejects if attempt to remove a statically declared input.
    */
-  [CheckAnyPermissions="input"]
   Promise<void> removeInput(DOMString id);
 
   /**
    * Remove focus from the current input, usable by Gaia System app, globally,
    * regardless of the current focus state.
    */
-  [CheckAnyPermissions="input-manage"]
   void removeFocus();
 
   /**
    * The following are internal methods for Firefox OS System app only,
    * for handling the "option" group inputs.
    */
 
   /**
    * Set the value on the currently focused element. This has to be used
    * for special situations where the value had to be chosen amongst a
    * list (type=month) or a widget (type=date, time, etc.).
    * If the value passed in parameter isn't valid (in the term of HTML5
    * Forms Validation), the value will simply be ignored by the element.
    */
-  [CheckAnyPermissions="input-manage"]
   void setValue(DOMString value);
 
   /**
    * Select the <select> option specified by index.
    * If this method is called on a <select> that support multiple
    * selection, then the option specified by index will be added to
    * the selection.
    * If this method is called for a select that does not support multiple
    * selection the previous element will be unselected.
    */
-  [CheckAnyPermissions="input-manage"]
   void setSelectedOption(long index);
 
   /**
    * Select the <select> options specified by indexes. All other options
    * will be deselected.
    * If this method is called for a <select> that does not support multiple
    * selection, then the last index specified in indexes will be selected.
    */
-  [CheckAnyPermissions="input-manage"]
   void setSelectedOptions(sequence<long> indexes);
 };
 
 /**
  * InputMethodManager contains a few of the global methods for the input app.
  */
 [JSImplementation="@mozilla.org/b2g-imm;1",
  Pref="dom.mozInputMethod.enabled",
- CheckAnyPermissions="input input-manage"]
+ ChromeOnly]
 interface MozInputMethodManager : EventTarget {
   /**
    * Ask the OS to show a list of available inputs for users to switch from.
    * OS should sliently ignore this request if the app is currently not the
    * active one.
    */
-  [CheckAllPermissions="input"]
   void showAll();
 
   /**
    * Ask the OS to switch away from the current active input app.
    * OS should sliently ignore this request if the app is currently not the
    * active one.
    */
-  [CheckAllPermissions="input"]
   void next();
 
   /**
    * If this method returns true, it is recommended that the input app provides
    * a shortcut that would invoke the next() method above, for easy switching
    * between inputs -- i.e. show a "global" button on screen if the input app
    * implements an on-screen virtual keyboard.
    *
    * The returning value is depend on the inputType of the current input context.
    */
-  [CheckAllPermissions="input"]
   boolean supportsSwitching();
 
   /**
    * Ask the OS to remove the input focus, will cause the lost of input context.
    * OS should sliently ignore this request if the app is currently not the
    * active one.
    */
-  [CheckAllPermissions="input"]
   void hide();
 
   /**
    * Update Gecko with information on the input types which supportsSwitching()
    * should return ture.
    *
    * @param types Array of input types in which supportsSwitching() should
    *              return true.
    */
-  [CheckAllPermissions="input-manage"]
   void setSupportsSwitchingTypes(sequence<MozInputMethodInputContextInputTypes> types);
 
   /**
    * CustomEvent dispatches to System when there is an input to handle.
    * If the API consumer failed to handle and call preventDefault(),
    * there will be a message printed on the console.
    *
    * evt.detail is defined by MozInputContextFocusEventDetail.
    */
-  [CheckAnyPermissions="input-manage"]
   attribute EventHandler oninputcontextfocus;
 
   /**
    * Event dispatches to System when there is no longer an input to handle.
    * If the API consumer failed to handle and call preventDefault(),
    * there will be a message printed on the console.
    */
-  [CheckAnyPermissions="input-manage"]
   attribute EventHandler oninputcontextblur;
 
   /**
    * Event dispatches to System when there is a showAll() call.
    * If the API consumer failed to handle and call preventDefault(),
    * there will be a message printed on the console.
    */
-  [CheckAnyPermissions="input-manage"]
   attribute EventHandler onshowallrequest;
 
   /**
    * Event dispatches to System when there is a next() call.
    * If the API consumer failed to handle and call preventDefault(),
    * there will be a message printed on the console.
    */
-  [CheckAnyPermissions="input-manage"]
   attribute EventHandler onnextrequest;
 
   /**
    * Event dispatches to System when there is a addInput() call.
    * The API consumer must call preventDefault() to indicate the event is
    * consumed, otherwise the request is not considered handled even if
    * waitUntil() was called.
    *
    * evt.detail is defined by MozInputRegistryEventDetail.
    */
-  [CheckAnyPermissions="input-manage"]
   attribute EventHandler onaddinputrequest;
 
   /**
    * Event dispatches to System when there is a removeInput() call.
    * The API consumer must call preventDefault() to indicate the event is
    * consumed, otherwise the request is not considered handled even if
    * waitUntil() was called.
    *
    * evt.detail is defined by MozInputRegistryEventDetail.
    */
-  [CheckAnyPermissions="input-manage"]
   attribute EventHandler onremoveinputrequest;
 };
 
 /**
  * Detail of the inputcontextfocus event.
  */
 [JSImplementation="@mozilla.org/b2g-imm-focus;1",
  Pref="dom.mozInputMethod.enabled",
- CheckAnyPermissions="input-manage"]
+ ChromeOnly]
 interface MozInputContextFocusEventDetail {
   /**
    * The type of the focused input.
    */
   readonly attribute MozInputMethodInputContextTypes type;
   /**
    * The input type of the focused input.
    */
@@ -281,17 +262,17 @@ dictionary MozInputMethodChoiceDict {
   long? optionIndex;
 };
 
 /**
  * detail of addinputrequest or removeinputrequest event.
  */
 [JSImplementation="@mozilla.org/b2g-imm-input-registry;1",
  Pref="dom.mozInputMethod.enabled",
- CheckAnyPermissions="input-manage"]
+ ChromeOnly]
 interface MozInputRegistryEventDetail {
   /**
    * Manifest URL of the requesting app.
    */
   readonly attribute DOMString manifestURL;
   /**
    * ID of the input
    */
@@ -315,17 +296,17 @@ interface MozInputRegistryEventDetail {
  * input field. It also hosts the methods available to the keyboard app to
  * mutate the input field represented. An "input context" gets void when the
  * app is no longer allowed to interact with the text field,
  * e.g., the text field does no longer exist, the app is being switched to
  * background, and etc.
  */
 [JSImplementation="@mozilla.org/b2g-inputcontext;1",
  Pref="dom.mozInputMethod.enabled",
- CheckAnyPermissions="input"]
+ ChromeOnly]
 interface MozInputContext: EventTarget {
   /**
    * Type of the InputContext. See MozInputMethodInputContextTypes
    */
   readonly attribute MozInputMethodInputContextTypes? type;
 
   /**
    * InputType of the InputContext. See MozInputMethodInputContextInputTypes.
@@ -536,26 +517,26 @@ interface MozInputContext: EventTarget {
  * This interface will be added into inputcontext and used to receive the
  * events from the hardware keyboard.
  * Example:
  *   mozInputMethod.inputcontext.hardwareinput.addEventListener('keyup', this);
  *   mozInputMethod.inputcontext.hardwareinput.removeEventListener('keyup', this);
  */
 [JSImplementation="@mozilla.org/b2g-hardwareinput;1",
  Pref="dom.mozInputMethod.enabled",
- CheckAnyPermissions="input"]
+ ChromeOnly]
 interface MozHardwareInput: EventTarget {
 };
 
 /**
  * Detail of the selectionchange event.
  */
 [JSImplementation="@mozilla.org/b2g-imm-selectionchange;1",
  Pref="dom.mozInputMethod.enabled",
- CheckAnyPermissions="input"]
+ ChromeOnly]
 interface MozInputContextSelectionChangeEventDetail {
   /**
    * Indicate whether or not the change is due to our own action from,
    * for example, sendKey() call.
    *
    * Note: this property is untrustworthy because it would still be true even
    * if script in the page changed the text synchronously upon responding to
    * events trigger by the call.
@@ -569,17 +550,17 @@ interface MozInputContextSelectionChange
   readonly attribute long selectionEnd;
 };
 
 /**
  * Detail of the surroundingtextchange event.
  */
 [JSImplementation="@mozilla.org/b2g-imm-surroundingtextchange;1",
  Pref="dom.mozInputMethod.enabled",
- CheckAnyPermissions="input"]
+ ChromeOnly]
 interface MozInputContextSurroundingTextChangeEventDetail {
   /**
    * Indicate whether or not the change is due to our own action from,
    * for example, sendKey() call.
    *
    * Note: this property is untrustworthy because it would still be true even
    * if script in the page changed the text synchronously upon responding to
    * events trigger by the call.