Bug 873380 - Part 1: Refined the error report policy for card lock functionality. r=smaug. sr=hsinyi
authorEdgar Chen <echen@mozilla.com>
Wed, 25 Sep 2013 14:49:44 +0800
changeset 150434 09057d7a7c7f146c53a924271d6e795344ba9a5c
parent 150433 bf3aa9efc6480e2d2ddc2dbb0a713e1c2d25da33
child 150435 1f391cd3728eb52bfec4f029b5539f773b8c6ff9
push id2993
push usercbook@mozilla.com
push dateFri, 11 Oct 2013 09:22:00 +0000
treeherderfx-team@fe160ec1e0ad [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, hsinyi
bugs873380
milestone27.0a1
Bug 873380 - Part 1: Refined the error report policy for card lock functionality. r=smaug. sr=hsinyi
content/base/src/nsGkAtomList.h
content/events/test/test_all_synthetic_events.html
dom/apps/src/OperatorApps.jsm
dom/icc/interfaces/moz.build
dom/icc/interfaces/nsIDOMIccCardLockErrorEvent.idl
dom/icc/interfaces/nsIDOMIccManager.idl
dom/icc/interfaces/nsIIccProvider.idl
dom/icc/src/IccManager.cpp
dom/tests/mochitest/general/test_interfaces.html
dom/webidl/IccCardLockError.webidl
dom/webidl/IccCardLockErrorEvent.webidl
dom/webidl/moz.build
js/xpconnect/src/event_impl_gen.conf.in
--- a/content/base/src/nsGkAtomList.h
+++ b/content/base/src/nsGkAtomList.h
@@ -715,17 +715,16 @@ GK_ATOM(onfrequencychange, "onfrequencyc
 GK_ATOM(onget, "onget")
 GK_ATOM(ongroupchange, "ongroupchange")
 GK_ATOM(onhashchange, "onhashchange")
 GK_ATOM(onheadphoneschange, "onheadphoneschange")
 GK_ATOM(onheld, "onheld")
 GK_ATOM(onhfpstatuschanged, "onhfpstatuschanged")
 GK_ATOM(onholding, "onholding")
 GK_ATOM(oniccinfochange, "oniccinfochange")
-GK_ATOM(onicccardlockerror, "onicccardlockerror")
 GK_ATOM(onincoming, "onincoming")
 GK_ATOM(oninput, "oninput")
 GK_ATOM(oninvalid, "oninvalid")
 GK_ATOM(onkeydown, "onkeydown")
 GK_ATOM(onkeypress, "onkeypress")
 GK_ATOM(onkeyup, "onkeyup")
 GK_ATOM(onlevelchange, "onlevelchange")
 GK_ATOM(onLoad, "onLoad")
--- a/content/events/test/test_all_synthetic_events.html
+++ b/content/events/test/test_all_synthetic_events.html
@@ -162,20 +162,16 @@ const kEventConstructors = {
   GamepadButtonEvent:                        { create: function (aName, aProps) {
                                                          return new GamepadButtonEvent(aName, aProps);
                                                        },
                                              },
   HashChangeEvent:                           { create: function (aName, aProps) {
                                                          return new HashChangeEvent(aName, aProps);
                                                        },
                                              },
-  IccCardLockErrorEvent:                     { create: function (aName, aProps) {
-                                                          return new IccCardLockErrorEvent(aName, aProps);
-                                                       },
-                                             },
   IDBVersionChangeEvent:                     { create: function (aName, aProps) {
                                                          return new IDBVersionChangeEvent(aName, aProps);
                                                        },
                                              },
   KeyEvent:                                  { create: function (aName, aProps) {
                                                          var e = document.createEvent("keyboardevent");
                                                          e.initKeyEvent(aName, aProps.bubbles, aProps.cancelable,
                                                                         aProps.view,
--- a/dom/apps/src/OperatorApps.jsm
+++ b/dom/apps/src/OperatorApps.jsm
@@ -54,18 +54,16 @@ function isFirstRunWithSIM() {
 }
 
 #ifdef MOZ_B2G_RIL
 let iccListener = {
   notifyStkCommand: function() {},
 
   notifyStkSessionEnd: function() {},
 
-  notifyIccCardLockError: function() {},
-
   notifyCardStateChanged: function() {},
 
   notifyIccInfoChanged: function() {
     let iccInfo = iccProvider.iccInfo;
     if (iccInfo && iccInfo.mcc && iccInfo.mnc) {
       debug("******* iccListener cardIccInfo MCC-MNC: " + iccInfo.mcc +
             "-" + iccInfo.mnc);
       iccProvider.unregisterIccMsg(this);
--- a/dom/icc/interfaces/moz.build
+++ b/dom/icc/interfaces/moz.build
@@ -1,15 +1,14 @@
 # -*- Mode: python; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # 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/.
 
 XPIDL_SOURCES += [
     'SimToolKit.idl',
-    'nsIDOMIccCardLockErrorEvent.idl',
     'nsIDOMIccInfo.idl',
     'nsIDOMIccManager.idl',
     'nsIIccProvider.idl',
 ]
 
 XPIDL_MODULE = 'dom_icc'
deleted file mode 100644
--- a/dom/icc/interfaces/nsIDOMIccCardLockErrorEvent.idl
+++ /dev/null
@@ -1,24 +0,0 @@
-/* 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/. */
-
-#include "nsIDOMEvent.idl"
-
-[scriptable, builtinclass, uuid(47d4db10-a258-11e2-9e96-0800200c9a66)]
-interface nsIDOMIccCardLockErrorEvent : nsIDOMEvent
-{
-  readonly attribute DOMString lockType;
-  readonly attribute long retryCount;
-
-  [noscript] void initIccCardLockErrorEvent(in DOMString aType,
-                                            in boolean aCanBubble,
-                                            in boolean aCancelable,
-                                            in DOMString aLockType,
-                                            in int32_t aRetryCount);
-};
-
-dictionary IccCardLockErrorEventInit : EventInit
-{
-  DOMString  lockType;
-  long       retryCount;
-};
--- a/dom/icc/interfaces/nsIDOMIccManager.idl
+++ b/dom/icc/interfaces/nsIDOMIccManager.idl
@@ -5,17 +5,17 @@
 #include "nsIDOMEventTarget.idl"
 #include "SimToolKit.idl"
 
 interface nsIDOMContact;
 interface nsIDOMDOMRequest;
 interface nsIDOMEventListener;
 interface nsIDOMMozIccInfo;
 
-[scriptable, builtinclass, uuid(904b92cb-dad3-416f-88cf-0291012cf448)]
+[scriptable, builtinclass, uuid(6b5875dc-de44-4681-84a1-9ea12d60fbe2)]
 interface nsIDOMMozIccManager : nsIDOMEventTarget
 {
   /**
    * STK Menu Presentation types.
    */
   const unsigned short STK_MENU_TYPE_NOT_SPECIFIED      = 0x00;
   const unsigned short STK_MENU_TYPE_DATA_VALUES        = 0x01;
   const unsigned short STK_MENU_TYPE_NAVIGATION_OPTIONS = 0x03;
@@ -454,26 +454,16 @@ interface nsIDOMMozIccManager : nsIDOMEv
    *     {
    *       lockType: "pin",
    *       success: true
    *     }
    */
   nsIDOMDOMRequest setCardLock(in jsval info);
 
   /**
-   * The 'icccardlockerror' event is notified whenever 'unlockCardLock' or
-   * 'setCardLock' fails.
-   *
-   * The result will be an object containing information
-   * about the specified lock's status,
-   * e.g. {lockType: "pin", retryCount: 2}.
-   */
-  [implicit_jscontext] attribute jsval onicccardlockerror;
-
-  /**
    * Retrieve the number of remaining tries for unlocking the card.
    *
    * @param lockType
    *        Identifies the lock type, e.g. "pin" for the PIN lock, "puk" for
    *        the PUK lock.
    *
    * @return a DOM Request.
    *         If the lock type is "pin", or "puk", the request's result will be
--- a/dom/icc/interfaces/nsIIccProvider.idl
+++ b/dom/icc/interfaces/nsIIccProvider.idl
@@ -4,23 +4,21 @@
 
 #include "nsISupports.idl"
 
 interface nsIDOMContact;
 interface nsIDOMDOMRequest;
 interface nsIDOMMozIccInfo;
 interface nsIDOMWindow;
 
-[scriptable, uuid(82d25440-c913-11e2-8b8b-0800200c9a66)]
+[scriptable, uuid(87e9ad03-e8e2-40d1-bf28-a6d287c31b93)]
 interface nsIIccListener : nsISupports
 {
   void notifyStkCommand(in DOMString aMessage);
   void notifyStkSessionEnd();
-  void notifyIccCardLockError(in DOMString lockType,
-                              in unsigned long retryCount);
   void notifyCardStateChanged();
   void notifyIccInfoChanged();
 };
 
 /**
  * XPCOM component (in the content process) that provides the ICC information.
  */
 [scriptable, uuid(52fa6780-c913-11e2-8b8b-0800200c9a66)]
--- a/dom/icc/src/IccManager.cpp
+++ b/dom/icc/src/IccManager.cpp
@@ -1,15 +1,14 @@
 /* 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/. */
 
 #include "mozilla/Services.h"
 #include "nsIDOMClassInfo.h"
-#include "nsIDOMIccCardLockErrorEvent.h"
 #include "nsIDOMIccInfo.h"
 #include "GeneratedEvents.h"
 #include "IccManager.h"
 #include "SimToolKit.h"
 #include "StkCommandEvent.h"
 
 #define NS_RILCONTENTHELPER_CONTRACTID "@mozilla.org/ril/content-helper;1"
 
@@ -243,17 +242,16 @@ IccManager::UpdateContact(const nsAStrin
     return NS_ERROR_FAILURE;
   }
 
   return mProvider->UpdateContact(GetOwner(), aContactType, aContact, aPin2, aRequest);
 }
 
 NS_IMPL_EVENT_HANDLER(IccManager, stkcommand)
 NS_IMPL_EVENT_HANDLER(IccManager, stksessionend)
-NS_IMPL_EVENT_HANDLER(IccManager, icccardlockerror)
 NS_IMPL_EVENT_HANDLER(IccManager, cardstatechange)
 NS_IMPL_EVENT_HANDLER(IccManager, iccinfochange)
 
 // nsIIccListener
 
 NS_IMETHODIMP
 IccManager::NotifyStkCommand(const nsAString& aMessage)
 {
@@ -265,31 +263,16 @@ IccManager::NotifyStkCommand(const nsASt
 
 NS_IMETHODIMP
 IccManager::NotifyStkSessionEnd()
 {
   return DispatchTrustedEvent(NS_LITERAL_STRING("stksessionend"));
 }
 
 NS_IMETHODIMP
-IccManager::NotifyIccCardLockError(const nsAString& aLockType, uint32_t aRetryCount)
-{
-  nsCOMPtr<nsIDOMEvent> event;
-  NS_NewDOMIccCardLockErrorEvent(getter_AddRefs(event), this, nullptr, nullptr);
-
-  nsCOMPtr<nsIDOMIccCardLockErrorEvent> ce = do_QueryInterface(event);
-  nsresult rv =
-    ce->InitIccCardLockErrorEvent(NS_LITERAL_STRING("icccardlockerror"),
-                                  false, false, aLockType, aRetryCount);
-  NS_ENSURE_SUCCESS(rv, rv);
-
-  return DispatchTrustedEvent(ce);
-}
-
-NS_IMETHODIMP
 IccManager::NotifyCardStateChanged()
 {
   return DispatchTrustedEvent(NS_LITERAL_STRING("cardstatechange"));
 }
 
 NS_IMETHODIMP
 IccManager::NotifyIccInfoChanged()
 {
--- a/dom/tests/mochitest/general/test_interfaces.html
+++ b/dom/tests/mochitest/general/test_interfaces.html
@@ -275,17 +275,16 @@ var interfaceNamesInGlobalScope =
     "HTMLTableSectionElement",
     "HTMLTemplateElement",
     "HTMLTextAreaElement",
     "HTMLTimeElement",
     "HTMLTitleElement",
     "HTMLUListElement",
     "HTMLUnknownElement",
     "HTMLVideoElement",
-    {name: "IccCardLockErrorEvent", b2g: true},
     "IDBCursor",
     "IDBCursorWithValue",
     "IDBDatabase",
     "IDBFactory",
     "IDBFileHandle",
     "IDBIndex",
     "IDBKeyRange",
     "IDBObjectStore",
new file mode 100644
--- /dev/null
+++ b/dom/webidl/IccCardLockError.webidl
@@ -0,0 +1,12 @@
+/* -*- 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/.
+*/
+
+[JSImplementation="@mozilla.org/dom/icccardlock-error;1",
+ Constructor(DOMString lockType, DOMString errorName, short retryCount)]
+interface IccCardLockError : DOMError {
+  readonly attribute DOMString lockType;
+  readonly attribute short retryCount;
+};
deleted file mode 100644
--- a/dom/webidl/IccCardLockErrorEvent.webidl
+++ /dev/null
@@ -1,18 +0,0 @@
-/* -*- 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 type, optional IccCardLockErrorEventInit eventInitDict), HeaderFile="GeneratedEventClasses.h"]
-interface IccCardLockErrorEvent : Event
-{
-  readonly attribute DOMString? lockType;
-  readonly attribute long retryCount;
-};
-
-dictionary IccCardLockErrorEventInit : EventInit
-{
-  DOMString lockType = "";
-  long retryCount = 0;
-};
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -499,17 +499,17 @@ if CONFIG['MOZ_B2G_BT']:
         'BluetoothManager.webidl',
         'BluetoothStatusChangedEvent.webidl',
     ]
 
 if CONFIG['MOZ_B2G_RIL']:
     WEBIDL_FILES += [
         'CFStateChangeEvent.webidl',
         'DataErrorEvent.webidl',
-        'IccCardLockErrorEvent.webidl',
+        'IccCardLockError.webidl',
         'MozCellBroadcast.webidl',
         'MozCellBroadcastEvent.webidl',
         'MozEmergencyCbModeEvent.webidl',
         'MozOtaStatusEvent.webidl',
         'MozVoicemailEvent.webidl',
         'MozWifiConnectionInfoEvent.webidl',
         'MozWifiStatusChangeEvent.webidl',
         'USSDReceivedEvent.webidl',
--- a/js/xpconnect/src/event_impl_gen.conf.in
+++ b/js/xpconnect/src/event_impl_gen.conf.in
@@ -26,17 +26,16 @@ simple_events = [
     'StyleSheetApplicableStateChangeEvent',
 #ifdef MOZ_B2G_BT
     'BluetoothDeviceEvent',
     'BluetoothStatusChangedEvent',
 #endif
 #ifdef MOZ_B2G_RIL
     'CFStateChangeEvent',
     'DataErrorEvent',
-    'IccCardLockErrorEvent',
     'MozEmergencyCbModeEvent',
     'MozOtaStatusEvent',
     'MozWifiStatusChangeEvent',
     'MozWifiConnectionInfoEvent',
     'MozCellBroadcastEvent',
     'MozVoicemailEvent',
     'USSDReceivedEvent',
 #endif