diff --git a/dom/icc/IccCardLockError.cpp b/dom/icc/IccCardLockError.cpp new file mode 100644 index 000000000000..737a085eeef4 --- /dev/null +++ b/dom/icc/IccCardLockError.cpp @@ -0,0 +1,48 @@ +/* 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/dom/IccCardLockError.h" +#include "mozilla/dom/IccCardLockErrorBinding.h" + +namespace mozilla { +namespace dom { + +NS_IMPL_ISUPPORTS_INHERITED0(IccCardLockError, DOMError) + +/* static */ already_AddRefed +IccCardLockError::Constructor(const GlobalObject& aGlobal, + const nsAString& aLockType, + const nsAString& aName, + int16_t aRetryCount, + ErrorResult& aRv) +{ + nsCOMPtr window = do_QueryInterface(aGlobal.GetAsSupports()); + if (!window) { + aRv.Throw(NS_ERROR_FAILURE); + return nullptr; + } + + nsRefPtr result = + new IccCardLockError(window, aName, aLockType, aRetryCount); + return result.forget(); +} + +IccCardLockError::IccCardLockError(nsPIDOMWindow* aWindow, + const nsAString& aName, + const nsAString& aLockType, + int16_t aRetryCount) + : DOMError(aWindow, aName) + , mLockType(aLockType) + , mRetryCount(aRetryCount) +{ +} + +JSObject* +IccCardLockError::WrapObject(JSContext* aCx) +{ + return IccCardLockErrorBinding::Wrap(aCx, this); +} + +} // namespace dom +} // namespace mozilla diff --git a/dom/icc/IccCardLockError.h b/dom/icc/IccCardLockError.h new file mode 100644 index 000000000000..ded3e36e2ce9 --- /dev/null +++ b/dom/icc/IccCardLockError.h @@ -0,0 +1,54 @@ +/* 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/. */ + +#ifndef mozilla_dom_IccCardLockError_h +#define mozilla_dom_IccCardLockError_h + +#include "mozilla/dom/DOMError.h" + +namespace mozilla { +namespace dom { + +class IccCardLockError MOZ_FINAL : public DOMError +{ +public: + NS_DECL_ISUPPORTS_INHERITED + + IccCardLockError(nsPIDOMWindow* aWindow, const nsAString& aName, + const nsAString& aLockType, int16_t aRetryCount); + + static already_AddRefed + Constructor(const GlobalObject& aGlobal, const nsAString& aLockType, + const nsAString& aName, int16_t aRetryCount, + ErrorResult& aRv); + + virtual JSObject* + WrapObject(JSContext* aCx) MOZ_OVERRIDE; + + // WebIDL interface + + void + GetLockType(nsString& aLockType) const + { + aLockType = mLockType; + } + + int16_t + RetryCount() const + { + return mRetryCount; + } + +private: + ~IccCardLockError() {} + +private: + nsString mLockType; + int16_t mRetryCount; +}; + +} // namespace dom +} // namespace mozilla + +#endif // mozilla_dom_IccCardLockError_h diff --git a/dom/icc/moz.build b/dom/icc/moz.build index da82e9cea2e6..1de5aed4265b 100644 --- a/dom/icc/moz.build +++ b/dom/icc/moz.build @@ -8,6 +8,7 @@ DIRS += ['interfaces'] EXPORTS.mozilla.dom += [ 'Icc.h', + 'IccCardLockError.h', 'IccInfo.h', 'IccManager.h', ] @@ -15,6 +16,7 @@ EXPORTS.mozilla.dom += [ UNIFIED_SOURCES += [ 'Assertions.cpp', 'Icc.cpp', + 'IccCardLockError.cpp', "IccInfo.cpp", 'IccListener.cpp', 'IccManager.cpp', diff --git a/dom/system/gonk/RILContentHelper.js b/dom/system/gonk/RILContentHelper.js index 6b76d191a339..23740ea90e04 100644 --- a/dom/system/gonk/RILContentHelper.js +++ b/dom/system/gonk/RILContentHelper.js @@ -41,8 +41,6 @@ function debug(s) { const RILCONTENTHELPER_CID = Components.ID("{472816e1-1fd6-4405-996c-806f9ea68174}"); -const ICCCARDLOCKERROR_CID = - Components.ID("{08a71987-408c-44ff-93fd-177c0a85c3dd}"); const RIL_IPC_MSG_NAMES = [ "RIL:CardStateChanged", @@ -136,20 +134,6 @@ CdmaIccInfo.prototype = { prlVersion: 0 }; -function IccCardLockError() { -} -IccCardLockError.prototype = { - classDescription: "IccCardLockError", - classID: ICCCARDLOCKERROR_CID, - contractID: "@mozilla.org/dom/icccardlock-error;1", - QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]), - __init: function(lockType, errorMsg, retryCount) { - this.__DOM_IMPL__.init(errorMsg); - this.lockType = lockType; - this.retryCount = retryCount; - }, -}; - function RILContentHelper() { this.updateDebugFlag(); @@ -847,5 +831,4 @@ RILContentHelper.prototype = { } }; -this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RILContentHelper, - IccCardLockError]); +this.NSGetFactory = XPCOMUtils.generateNSGetFactory([RILContentHelper]); diff --git a/dom/system/gonk/RadioInterfaceLayer.manifest b/dom/system/gonk/RadioInterfaceLayer.manifest index 2e0d4266a717..6e8a9ece9c64 100644 --- a/dom/system/gonk/RadioInterfaceLayer.manifest +++ b/dom/system/gonk/RadioInterfaceLayer.manifest @@ -19,7 +19,5 @@ category profile-after-change RadioInterfaceLayer @mozilla.org/ril;1 # RILContentHelper.js component {472816e1-1fd6-4405-996c-806f9ea68174} RILContentHelper.js -component {08a71987-408c-44ff-93fd-177c0a85c3dd} RILContentHelper.js contract @mozilla.org/ril/content-helper;1 {472816e1-1fd6-4405-996c-806f9ea68174} -contract @mozilla.org/dom/icccardlock-error;1 {08a71987-408c-44ff-93fd-177c0a85c3dd} category profile-after-change RILContentHelper @mozilla.org/ril/content-helper;1 diff --git a/dom/webidl/IccCardLockError.webidl b/dom/webidl/IccCardLockError.webidl index fa3aca2f6dc9..35b547396d18 100644 --- a/dom/webidl/IccCardLockError.webidl +++ b/dom/webidl/IccCardLockError.webidl @@ -1,11 +1,10 @@ -/* -*- 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/. -*/ + * 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)] +[Constructor(DOMString lockType, DOMString errorName, short retryCount), + Pref="dom.icc.enabled"] interface IccCardLockError : DOMError { readonly attribute DOMString lockType; readonly attribute short retryCount;