--- a/b2g/app/b2g.js
+++ b/b2g/app/b2g.js
@@ -195,17 +195,16 @@ pref("privacy.item.downloads", true);
pref("privacy.item.passwords", true);
pref("privacy.item.sessions", true);
pref("privacy.item.geolocation", true);
pref("privacy.item.siteSettings", true);
pref("privacy.item.syncAccount", true);
// base url for the wifi geolocation network provider
pref("geo.provider.use_mls", false);
-pref("geo.cell.scan", true);
pref("geo.wifi.uri", "https://location.services.mozilla.com/v1/geolocate?key=%MOZILLA_API_KEY%");
// base url for the stumbler
pref("geo.stumbler.url", "https://location.services.mozilla.com/v1/geosubmit?key=%MOZILLA_API_KEY%");
// enable geo
pref("geo.enabled", true);
--- a/b2g/chrome/content/shell.js
+++ b/b2g/chrome/content/shell.js
@@ -1,17 +1,16 @@
/* -*- indent-tabs-mode: nil; js-indent-level: 2 -*- /
/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */
/* 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/. */
window.performance.mark('gecko-shell-loadstart');
-Cu.import('resource://gre/modules/ContactService.jsm');
Cu.import('resource://gre/modules/NotificationDB.jsm');
Cu.import("resource://gre/modules/AppsUtils.jsm");
Cu.import('resource://gre/modules/UserAgentOverrides.jsm');
Cu.import('resource://gre/modules/Keyboard.jsm');
Cu.import('resource://gre/modules/ErrorPage.jsm');
Cu.import('resource://gre/modules/AlertsHelper.jsm');
Cu.import('resource://gre/modules/SystemUpdateService.jsm');
--- a/b2g/installer/package-manifest.in
+++ b/b2g/installer/package-manifest.in
@@ -152,21 +152,17 @@
@RESPATH@/components/dom_audiochannel.xpt
@RESPATH@/components/dom_base.xpt
@RESPATH@/components/dom_system.xpt
@RESPATH@/components/dom_workers.xpt
#ifdef MOZ_WIDGET_GONK
@RESPATH@/components/dom_wifi.xpt
@RESPATH@/components/dom_system_gonk.xpt
#endif
-#ifdef MOZ_B2G_RIL
-@RESPATH@/components/dom_mobileconnection.xpt
-#endif
@RESPATH@/components/dom_canvas.xpt
-@RESPATH@/components/dom_contacts.xpt
@RESPATH@/components/dom_core.xpt
@RESPATH@/components/dom_css.xpt
@RESPATH@/components/dom_events.xpt
@RESPATH@/components/dom_geolocation.xpt
@RESPATH@/components/dom_media.xpt
@RESPATH@/components/dom_network.xpt
#ifdef MOZ_SECUREELEMENT
@RESPATH@/components/dom_secureelement.xpt
@@ -332,18 +328,16 @@
; JavaScript components
@RESPATH@/components/ConsoleAPI.manifest
@RESPATH@/components/ConsoleAPIStorage.js
@RESPATH@/components/BrowserElementParent.manifest
@RESPATH@/components/BrowserElementParent.js
@RESPATH@/components/BrowserElementProxy.manifest
@RESPATH@/components/BrowserElementProxy.js
-@RESPATH@/components/ContactManager.js
-@RESPATH@/components/ContactManager.manifest
@RESPATH@/components/PhoneNumberService.js
@RESPATH@/components/PhoneNumberService.manifest
@RESPATH@/components/NotificationStorage.js
@RESPATH@/components/NotificationStorage.manifest
@RESPATH@/components/PermissionSettings.js
@RESPATH@/components/PermissionSettings.manifest
@RESPATH@/components/PermissionPromptService.js
@RESPATH@/components/PermissionPromptService.manifest
@@ -445,18 +439,16 @@
@RESPATH@/components/IccService.manifest
@RESPATH@/components/MmsService.js
@RESPATH@/components/MmsService.manifest
@RESPATH@/components/MobileMessageDatabaseService.js
@RESPATH@/components/MobileMessageDatabaseService.manifest
#ifndef DISABLE_MOZ_RIL_GEOLOC
@RESPATH@/components/DataCallInterfaceService.js
@RESPATH@/components/DataCallInterfaceService.manifest
-@RESPATH@/components/MobileConnectionService.js
-@RESPATH@/components/MobileConnectionService.manifest
@RESPATH@/components/RadioInterfaceLayer.js
@RESPATH@/components/RadioInterfaceLayer.manifest
@RESPATH@/components/SmsService.js
@RESPATH@/components/SmsService.manifest
#endif
@RESPATH@/components/StkCmdFactory.js
@RESPATH@/components/StkCmdFactory.manifest
@RESPATH@/components/RILSystemMessengerHelper.js
--- a/browser/installer/package-manifest.in
+++ b/browser/installer/package-manifest.in
@@ -188,17 +188,16 @@
@RESPATH@/components/dom_core.xpt
@RESPATH@/components/dom_css.xpt
@RESPATH@/components/dom_events.xpt
@RESPATH@/components/dom_geolocation.xpt
@RESPATH@/components/dom_media.xpt
@RESPATH@/components/dom_network.xpt
@RESPATH@/components/dom_notification.xpt
@RESPATH@/components/dom_html.xpt
-@RESPATH@/components/dom_icc.xpt
@RESPATH@/components/dom_offline.xpt
@RESPATH@/components/dom_json.xpt
@RESPATH@/components/dom_power.xpt
@RESPATH@/components/dom_push.xpt
@RESPATH@/components/dom_quota.xpt
@RESPATH@/components/dom_range.xpt
@RESPATH@/components/dom_security.xpt
@RESPATH@/components/dom_settings.xpt
@@ -504,18 +503,16 @@
@RESPATH@/components/AppsService.manifest
@RESPATH@/components/recording-cmdline.js
@RESPATH@/components/recording-cmdline.manifest
@RESPATH@/components/htmlMenuBuilder.js
@RESPATH@/components/htmlMenuBuilder.manifest
@RESPATH@/components/PermissionSettings.js
@RESPATH@/components/PermissionSettings.manifest
-@RESPATH@/components/ContactManager.js
-@RESPATH@/components/ContactManager.manifest
@RESPATH@/components/PhoneNumberService.js
@RESPATH@/components/PhoneNumberService.manifest
@RESPATH@/components/NotificationStorage.js
@RESPATH@/components/NotificationStorage.manifest
@RESPATH@/components/Push.js
@RESPATH@/components/Push.manifest
@RESPATH@/components/PushComponents.js
--- a/dom/apps/PermissionsTable.jsm
+++ b/dom/apps/PermissionsTable.jsm
@@ -131,21 +131,16 @@ this.PermissionsTable = { geolocation:
privileged: ALLOW_ACTION,
certified: ALLOW_ACTION
},
"browser:embedded-system-app": {
app: DENY_ACTION,
privileged: DENY_ACTION,
certified: ALLOW_ACTION
},
- mobileconnection: {
- app: DENY_ACTION,
- privileged: DENY_ACTION,
- certified: ALLOW_ACTION
- },
mobilenetwork: {
app: DENY_ACTION,
privileged: ALLOW_ACTION,
certified: ALLOW_ACTION
},
power: {
app: DENY_ACTION,
privileged: DENY_ACTION,
--- a/dom/base/Navigator.cpp
+++ b/dom/base/Navigator.cpp
@@ -35,36 +35,32 @@
#ifdef MOZ_GAMEPAD
#include "mozilla/dom/GamepadServiceTest.h"
#endif
#include "mozilla/dom/PowerManager.h"
#include "mozilla/dom/WakeLock.h"
#include "mozilla/dom/power/PowerManagerService.h"
#include "mozilla/dom/FlyWebPublishedServer.h"
#include "mozilla/dom/FlyWebService.h"
-#include "mozilla/dom/IccManager.h"
#include "mozilla/dom/InputPortManager.h"
#include "mozilla/dom/Permissions.h"
#include "mozilla/dom/Presentation.h"
#include "mozilla/dom/ServiceWorkerContainer.h"
#include "mozilla/dom/StorageManager.h"
#include "mozilla/dom/TCPSocket.h"
#include "mozilla/dom/VRDisplay.h"
#include "mozilla/dom/workers/RuntimeService.h"
#include "mozilla/Hal.h"
#include "nsISiteSpecificUserAgent.h"
#include "mozilla/ClearOnShutdown.h"
#include "mozilla/SSE.h"
#include "mozilla/StaticPtr.h"
#include "Connection.h"
#include "mozilla/dom/Event.h" // for nsIDOMEvent::InternalDOMEvent()
#include "nsGlobalWindow.h"
-#ifdef MOZ_B2G_RIL
-#include "mozilla/dom/MobileConnectionArray.h"
-#endif
#include "nsIIdleObserver.h"
#include "nsIPermissionManager.h"
#include "nsMimeTypes.h"
#include "nsNetUtil.h"
#include "nsStringStream.h"
#include "nsComponentManagerUtils.h"
#include "nsIStringStream.h"
#include "nsIHttpChannel.h"
@@ -206,23 +202,19 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN(
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMimeTypes)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPlugins)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPermissions)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mGeolocation)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mNotification)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mBatteryPromise)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mPowerManager)
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIccManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mInputPortManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mConnection)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mStorageManager)
-#ifdef MOZ_B2G_RIL
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMobileConnections)
-#endif
#ifdef MOZ_AUDIO_CHANNEL_MANAGER
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mAudioChannelManager)
#endif
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mMediaDevices)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mTimeManager)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mServiceWorkerContainer)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mWindow)
@@ -273,36 +265,25 @@ Navigator::Invalidate()
mBatteryPromise = nullptr;
if (mPowerManager) {
mPowerManager->Shutdown();
mPowerManager = nullptr;
}
- if (mIccManager) {
- mIccManager->Shutdown();
- mIccManager = nullptr;
- }
-
if (mInputPortManager) {
mInputPortManager = nullptr;
}
if (mConnection) {
mConnection->Shutdown();
mConnection = nullptr;
}
-#ifdef MOZ_B2G_RIL
- if (mMobileConnections) {
- mMobileConnections = nullptr;
- }
-#endif
-
mMediaDevices = nullptr;
#ifdef MOZ_AUDIO_CHANNEL_MANAGER
if (mAudioChannelManager) {
mAudioChannelManager = nullptr;
}
#endif
@@ -1621,50 +1602,16 @@ Navigator::GetInputPortManager(ErrorResu
already_AddRefed<LegacyMozTCPSocket>
Navigator::MozTCPSocket()
{
RefPtr<LegacyMozTCPSocket> socket = new LegacyMozTCPSocket(GetWindow());
return socket.forget();
}
-#ifdef MOZ_B2G_RIL
-
-MobileConnectionArray*
-Navigator::GetMozMobileConnections(ErrorResult& aRv)
-{
- if (!mMobileConnections) {
- if (!mWindow) {
- aRv.Throw(NS_ERROR_UNEXPECTED);
- return nullptr;
- }
- mMobileConnections = new MobileConnectionArray(mWindow);
- }
-
- return mMobileConnections;
-}
-
-#endif // MOZ_B2G_RIL
-
-IccManager*
-Navigator::GetMozIccManager(ErrorResult& aRv)
-{
- if (!mIccManager) {
- if (!mWindow) {
- aRv.Throw(NS_ERROR_UNEXPECTED);
- return nullptr;
- }
- NS_ENSURE_TRUE(mWindow->GetDocShell(), nullptr);
-
- mIccManager = new IccManager(mWindow);
- }
-
- return mIccManager;
-}
-
#ifdef MOZ_GAMEPAD
void
Navigator::GetGamepads(nsTArray<RefPtr<Gamepad> >& aGamepads,
ErrorResult& aRv)
{
if (!mWindow) {
aRv.Throw(NS_ERROR_UNEXPECTED);
return;
--- a/dom/base/Navigator.h
+++ b/dom/base/Navigator.h
@@ -67,22 +67,17 @@ class GamepadServiceTest;
class NavigatorUserMediaSuccessCallback;
class NavigatorUserMediaErrorCallback;
class MozGetUserMediaDevicesSuccessCallback;
namespace network {
class Connection;
} // namespace network
-#ifdef MOZ_B2G_RIL
-class MobileConnectionArray;
-#endif
-
class PowerManager;
-class IccManager;
class InputPortManager;
class DeviceStorageAreaListener;
class Presentation;
class LegacyMozTCPSocket;
class VRDisplay;
class StorageManager;
namespace time {
@@ -209,25 +204,21 @@ public:
nsTArray<RefPtr<nsDOMDeviceStorage> >& aStores,
ErrorResult& aRv);
already_AddRefed<nsDOMDeviceStorage>
GetDeviceStorageByNameAndType(const nsAString& aName, const nsAString& aType,
ErrorResult& aRv);
DesktopNotificationCenter* GetMozNotification(ErrorResult& aRv);
- IccManager* GetMozIccManager(ErrorResult& aRv);
InputPortManager* GetInputPortManager(ErrorResult& aRv);
already_AddRefed<LegacyMozTCPSocket> MozTCPSocket();
network::Connection* GetConnection(ErrorResult& aRv);
MediaDevices* GetMediaDevices(ErrorResult& aRv);
-#ifdef MOZ_B2G_RIL
- MobileConnectionArray* GetMozMobileConnections(ErrorResult& aRv);
-#endif // MOZ_B2G_RIL
#ifdef MOZ_GAMEPAD
void GetGamepads(nsTArray<RefPtr<Gamepad> >& aGamepads, ErrorResult& aRv);
GamepadServiceTest* RequestGamepadServiceTest();
#endif // MOZ_GAMEPAD
already_AddRefed<Promise> GetVRDisplays(ErrorResult& aRv);
void GetActiveVRDisplays(nsTArray<RefPtr<VRDisplay>>& aDisplays) const;
#ifdef MOZ_TIME_MANAGER
time::TimeManager* GetMozTime(ErrorResult& aRv);
@@ -306,22 +297,18 @@ private:
RefPtr<nsMimeTypeArray> mMimeTypes;
RefPtr<nsPluginArray> mPlugins;
RefPtr<Permissions> mPermissions;
RefPtr<Geolocation> mGeolocation;
RefPtr<DesktopNotificationCenter> mNotification;
RefPtr<battery::BatteryManager> mBatteryManager;
RefPtr<Promise> mBatteryPromise;
RefPtr<PowerManager> mPowerManager;
- RefPtr<IccManager> mIccManager;
RefPtr<InputPortManager> mInputPortManager;
RefPtr<network::Connection> mConnection;
-#ifdef MOZ_B2G_RIL
- RefPtr<MobileConnectionArray> mMobileConnections;
-#endif
#ifdef MOZ_AUDIO_CHANNEL_MANAGER
RefPtr<system::AudioChannelManager> mAudioChannelManager;
#endif
RefPtr<MediaDevices> mMediaDevices;
nsTArray<nsWeakPtr> mDeviceStorageStores;
RefPtr<time::TimeManager> mTimeManager;
RefPtr<ServiceWorkerContainer> mServiceWorkerContainer;
nsCOMPtr<nsPIDOMWindowInner> mWindow;
--- a/dom/base/test/chrome.ini
+++ b/dom/base/test/chrome.ini
@@ -8,18 +8,16 @@ support-files =
mozbrowser_api_utils.js
[test_anonymousContent_xul_window.xul]
[test_bug715041.xul]
[test_bug715041_removal.xul]
[test_domrequesthelper.xul]
[test_navigator_resolve_identity_xrays.xul]
support-files = file_navigator_resolve_identity_xrays.xul
-[test_navigator_resolve_identity.html]
-support-files = file_navigator_resolve_identity.html
[test_sendQueryContentAndSelectionSetEvent.html]
[test_bug1016960.html]
[test_copypaste.xul]
subsuite = clipboard
[test_messagemanager_principal.html]
[test_messagemanager_send_principal.html]
skip-if = buildapp == 'mulet'
[test_bug945152.html]
deleted file mode 100644
--- a/dom/base/test/file_navigator_resolve_identity.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=985827
--->
-<head>
- <meta charset="utf-8">
- <title>Test for Bug 985827</title>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
- <script type="application/javascript">
-
- function test() {
- var is = parent.is;
-
- // Test WebIDL NavigatorProperty objects
- var x = navigator.mozContacts;
- is(typeof x, "object", "Should have a mozContacts object");
- delete navigator.mozContacts;
- var y = navigator.mozContacts;
- is(x, y, "Should have gotten the same mozContacts object again");
- }
-
- test();
- </script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=985827">Mozilla Bug 985827</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-</pre>
-</body>
-</html>
--- a/dom/base/test/file_navigator_resolve_identity_xrays.xul
+++ b/dom/base/test/file_navigator_resolve_identity_xrays.xul
@@ -18,18 +18,13 @@ https://bugzilla.mozilla.org/show_bug.cg
addLoadEvent(function() {
var ok = parent.ok;
var is = parent.is;
var nav = document.getElementById("t").contentWindow.navigator;
ok(Components.utils.isXrayWrapper(nav), "Should have an Xray here");
-
- // Test WebIDL NavigatorProperty objects
- is(typeof nav.mozContacts, "object", "Should have a mozContacts object");
- is(nav.mozContacts, nav.mozContacts,
- "Should have gotten the same mozContacts object again");
});
]]>
</script>
</window>
deleted file mode 100644
--- a/dom/base/test/test_navigator_resolve_identity.html
+++ /dev/null
@@ -1,36 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=985827
--->
-<head>
- <meta charset="utf-8">
- <title>Test for Bug 985827</title>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
- <script type="application/javascript">
-
- /** Test for Bug 985827 **/
-
- SimpleTest.waitForExplicitFinish();
-
- addEventListener('load', function() {
- var iframe = document.createElement("iframe");
- var dir = "chrome://mochitests/content/chrome/dom/base/test/";
- iframe.src = dir + "file_navigator_resolve_identity.html";
- document.body.appendChild(iframe);
- iframe.onload = function() { SimpleTest.finish(); };
- });
-
- </script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=985827">Mozilla Bug 985827</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-</pre>
-</body>
-</html>
--- a/dom/bindings/Bindings.conf
+++ b/dom/bindings/Bindings.conf
@@ -583,58 +583,16 @@ DOMInterfaces = {
'nativeType': 'mozilla::dom::HTMLCanvasPrintState',
},
'MozChannel': {
'nativeType': 'nsIChannel',
'notflattened': True
},
-'MozCdmaIccInfo': {
- 'headerFile': 'mozilla/dom/IccInfo.h',
- 'nativeType': 'mozilla::dom::CdmaIccInfo',
-},
-
-'MozGsmIccInfo': {
- 'headerFile': 'mozilla/dom/IccInfo.h',
- 'nativeType': 'mozilla::dom::GsmIccInfo',
-},
-
-'MozIcc': {
- 'nativeType': 'mozilla::dom::Icc',
-},
-
-'MozIccInfo': {
- 'nativeType': 'mozilla::dom::IccInfo',
-},
-
-'MozIccManager': {
- 'nativeType': 'mozilla::dom::IccManager',
-},
-
-'MozMobileCellInfo': {
- 'nativeType': 'mozilla::dom::MobileCellInfo',
-},
-
-'MozMobileConnection': {
- 'nativeType': 'mozilla::dom::MobileConnection',
-},
-
-'MozMobileConnectionArray': {
- 'nativeType': 'mozilla::dom::MobileConnectionArray',
-},
-
-'MozMobileConnectionInfo': {
- 'nativeType': 'mozilla::dom::MobileConnectionInfo',
-},
-
-'MozMobileNetworkInfo': {
- 'nativeType': 'mozilla::dom::MobileNetworkInfo',
-},
-
'MozSpeakerManager': {
'nativeType': 'mozilla::dom::SpeakerManager',
'headerFile': 'SpeakerManager.h'
},
'MozPowerManager': {
'nativeType': 'mozilla::dom::PowerManager',
},
--- a/dom/bindings/test/chrome.ini
+++ b/dom/bindings/test/chrome.ini
@@ -1,20 +1,16 @@
[DEFAULT]
skip-if = buildapp == 'b2g'
support-files =
- file_bug707564.html
- file_bug707564-2.html
- !/dom/bindings/test/file_bug707564.html
!/dom/bindings/test/file_bug775543.html
!/dom/bindings/test/file_document_location_set_via_xray.html
!/dom/bindings/test/file_dom_xrays.html
!/dom/bindings/test/file_proxies_via_xray.html
-[test_bug707564.html]
[test_bug775543.html]
[test_document_location_set_via_xray.html]
[test_dom_xrays.html]
[test_proxies_via_xray.html]
[test_document_location_via_xray_cached.html]
[test_blacklisted_prerendering_function.xul]
support-files =
file_focuser.html
deleted file mode 100644
--- a/dom/bindings/test/file_bug707564-2.html
+++ /dev/null
@@ -1,45 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=707564
--->
-<head>
- <meta charset="utf-8">
- <title>Test for Bug 707564</title>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
- <script type="application/javascript">
-
- /** Test for Bug 707564 **/
- var ok = parent.ok;
- var isnot = parent.isnot;
-
- addLoadEvent(function() {
- var props = Object.getOwnPropertyNames(Object.getPrototypeOf(frames[0].navigator));
- isnot(props.indexOf("mozContacts"), -1,
- "Should enumerate a mozContacts property on navigator");
-
- // Now enumerate a different navigator object
- var found = false;
- for (var name in frames[1].navigator) {
- if (name == "mozContacts") {
- found = true;
- }
- }
- ok(found, "Should enumerate a mozContacts property on navigator via for...in");
- parent.SimpleTest.finish();
- });
-
- </script>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=707564">Mozilla Bug 707564</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-<iframe></iframe>
-<iframe></iframe>
-</div>
-<pre id="test">
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/bindings/test/file_bug707564.html
+++ /dev/null
@@ -1,5 +0,0 @@
-<body>
-<script>
- navigator.foopy = 5;
-</script>
-</body>
deleted file mode 100644
--- a/dom/bindings/test/test_bug707564.html
+++ /dev/null
@@ -1,24 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<iframe></iframe>
-<pre id="test">
-<script type="application/javascript">
-
-function run_tests() {
- var iframe = document.querySelector("iframe");
- iframe.src = "file_bug707564-2.html";
-}
-
-SimpleTest.waitForExplicitFinish();
-
-addEventListener('load', run_tests);
-
-</script>
-</pre>
-</body>
-</html>
--- a/dom/bindings/test/test_dom_xrays.html
+++ b/dom/bindings/test/test_dom_xrays.html
@@ -143,30 +143,16 @@ function test()
checkXrayProperty(coll, 0, [ doc.getElementById("shadowedIframe") ]);
// WebIDL-defined properties live on the prototype, overriding any named properties.
checkXrayProperty(coll, "item", [ undefined, win.HTMLCollection.prototype.item ]);
// ECMAScript-defined properties live on the prototype, overriding any named properties.
checkXrayProperty(coll, "toString", [ undefined, undefined, win.Object.prototype.toString ]);
- // NavigatorProperty things should come from the target compartment, always.
- var contacts = win.navigator.mozContacts;
- isnot(contacts, undefined,
- "Must have a mozContacts for this to work. Find another " +
- "NavigatorProperty, or remove all this NavigatorProperty code")
- ok(Cu.isXrayWrapper(contacts),
- "Should have an Xray for the underlying value, not a value newly " +
- "created for us");
- is(Cu.getGlobalForObject(contacts), win,
- "contacts should come from the underlying window");
- // Unfortunately, I can't figure out a decent way to test that we're not
- // creating a separate thing from the thing content sees, because none of the
- // NavigatorProperty things are available to content.
-
// Frozen arrays should come from our compartment, not the target one.
var languages1 = win.navigator.languages;
isnot(languages1, undefined, "Must have .languages");
ok(Array.isArray(languages1), ".languages should be an array");
ok(Object.isFrozen(languages1), ".languages should be a frozen array");
ok(!Cu.isXrayWrapper(languages1), "Should have our own version of array");
is(Cu.getGlobalForObject(languages1), window,
"languages1 should come from our window");
deleted file mode 100644
--- a/dom/contacts/ContactManager.js
+++ /dev/null
@@ -1,541 +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/. */
-
-"use strict";
-
-const DEBUG = false;
-function debug(s) { dump("-*- ContactManager: " + s + "\n"); }
-
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-const Cu = Components.utils;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/DOMRequestHelper.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(Services, "DOMRequest",
- "@mozilla.org/dom/dom-request-service;1",
- "nsIDOMRequestService");
-
-XPCOMUtils.defineLazyServiceGetter(this, "cpmm",
- "@mozilla.org/childprocessmessagemanager;1",
- "nsIMessageSender");
-
-const CONTACTS_SENDMORE_MINIMUM = 5;
-
-// We need this to create a copy of the mozContact object in ContactManager.save
-// Keep in sync with the interfaces.
-const PROPERTIES = [
- "name", "honorificPrefix", "givenName", "additionalName", "familyName",
- "phoneticGivenName", "phoneticFamilyName",
- "honorificSuffix", "nickname", "photo", "category", "org", "jobTitle",
- "bday", "note", "anniversary", "sex", "genderIdentity", "key", "adr", "email",
- "url", "impp", "tel"
-];
-
-var mozContactInitWarned = false;
-
-function Contact() { }
-
-Contact.prototype = {
- __init: function(aProp) {
- for (let prop in aProp) {
- this[prop] = aProp[prop];
- }
- },
-
- init: function(aProp) {
- // init is deprecated, warn once in the console if it's used
- if (!mozContactInitWarned) {
- mozContactInitWarned = true;
- Cu.reportError("mozContact.init is DEPRECATED. Use the mozContact constructor instead. " +
- "See https://developer.mozilla.org/docs/WebAPI/Contacts for details.");
- }
-
- for (let prop of PROPERTIES) {
- this[prop] = aProp[prop];
- }
- },
-
- setMetadata: function(aId, aPublished, aUpdated) {
- this.id = aId;
- if (aPublished) {
- this.published = aPublished;
- }
- if (aUpdated) {
- this.updated = aUpdated;
- }
- },
-
- classID: Components.ID("{72a5ee28-81d8-4af8-90b3-ae935396cc66}"),
- contractID: "@mozilla.org/contact;1",
- QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports]),
-};
-
-function ContactManager() { }
-
-ContactManager.prototype = {
- __proto__: DOMRequestIpcHelper.prototype,
- hasListenPermission: false,
- _cachedContacts: [] ,
-
- set oncontactchange(aHandler) {
- this.__DOM_IMPL__.setEventHandler("oncontactchange", aHandler);
- },
-
- get oncontactchange() {
- return this.__DOM_IMPL__.getEventHandler("oncontactchange");
- },
-
- _convertContact: function(aContact) {
- let properties = aContact.properties;
- if (properties.photo && properties.photo.length) {
- properties.photo = Cu.cloneInto(properties.photo, this._window);
- }
- let newContact = new this._window.mozContact(aContact.properties);
- newContact.setMetadata(aContact.id, aContact.published, aContact.updated);
- return newContact;
- },
-
- _convertContacts: function(aContacts) {
- let contacts = new this._window.Array();
- for (let i in aContacts) {
- contacts.push(this._convertContact(aContacts[i]));
- }
- return contacts;
- },
-
- _fireSuccessOrDone: function(aCursor, aResult) {
- if (aResult == null) {
- Services.DOMRequest.fireDone(aCursor);
- } else {
- Services.DOMRequest.fireSuccess(aCursor, aResult);
- }
- },
-
- _pushArray: function(aArr1, aArr2) {
- aArr1.push.apply(aArr1, aArr2);
- },
-
- receiveMessage: function(aMessage) {
- if (DEBUG) debug("receiveMessage: " + aMessage.name);
- let msg = aMessage.json;
- let contacts = msg.contacts;
-
- let req;
- switch (aMessage.name) {
- case "Contacts:Find:Return:OK":
- req = this.getRequest(msg.requestID);
- if (req) {
- let result = this._convertContacts(contacts);
- Services.DOMRequest.fireSuccess(req.request, result);
- } else {
- if (DEBUG) debug("no request stored!" + msg.requestID);
- }
- break;
- case "Contacts:GetAll:Next":
- let data = this.getRequest(msg.cursorId);
- if (!data) {
- break;
- }
- let result = contacts ? this._convertContacts(contacts) : [null];
- if (data.waitingForNext) {
- if (DEBUG) debug("cursor waiting for contact, sending");
- data.waitingForNext = false;
- let contact = result.shift();
- this._pushArray(data.cachedContacts, result);
- this.nextTick(this._fireSuccessOrDone.bind(this, data.cursor, contact));
- if (!contact) {
- this.removeRequest(msg.cursorId);
- }
- } else {
- if (DEBUG) debug("cursor not waiting, saving");
- this._pushArray(data.cachedContacts, result);
- }
- break;
- case "Contact:Save:Return:OK":
- // If a cached contact was saved and a new contact ID was returned, update the contact's ID
- if (this._cachedContacts[msg.requestID]) {
- if (msg.contactID) {
- this._cachedContacts[msg.requestID].id = msg.contactID;
- }
- delete this._cachedContacts[msg.requestID];
- }
- case "Contacts:Clear:Return:OK":
- case "Contact:Remove:Return:OK":
- req = this.getRequest(msg.requestID);
- if (req)
- Services.DOMRequest.fireSuccess(req.request, null);
- break;
- case "Contacts:Find:Return:KO":
- case "Contact:Save:Return:KO":
- case "Contact:Remove:Return:KO":
- case "Contacts:Clear:Return:KO":
- case "Contacts:GetRevision:Return:KO":
- case "Contacts:Count:Return:KO":
- req = this.getRequest(msg.requestID);
- if (req) {
- if (req.request) {
- req = req.request;
- }
- Services.DOMRequest.fireError(req, msg.errorMsg);
- }
- break;
- case "Contacts:GetAll:Return:KO":
- req = this.getRequest(msg.requestID);
- if (req) {
- Services.DOMRequest.fireError(req.cursor, msg.errorMsg);
- }
- break;
- case "Contact:Changed":
- // Fire oncontactchange event
- if (DEBUG) debug("Contacts:ContactChanged: " + msg.contactID + ", " + msg.reason);
- let event = new this._window.MozContactChangeEvent("contactchange", {
- contactID: msg.contactID,
- reason: msg.reason
- });
- this.dispatchEvent(event);
- break;
- case "Contacts:Revision":
- if (DEBUG) debug("new revision: " + msg.revision);
- req = this.getRequest(msg.requestID);
- if (req) {
- Services.DOMRequest.fireSuccess(req.request, msg.revision);
- }
- break;
- case "Contacts:Count":
- if (DEBUG) debug("count: " + msg.count);
- req = this.getRequest(msg.requestID);
- if (req) {
- Services.DOMRequest.fireSuccess(req.request, msg.count);
- }
- break;
- default:
- if (DEBUG) debug("Wrong message: " + aMessage.name);
- }
- this.removeRequest(msg.requestID);
- },
-
- dispatchEvent: function(event) {
- if (this.hasListenPermission) {
- this.__DOM_IMPL__.dispatchEvent(event);
- }
- },
-
- askPermission: function (aAccess, aRequest, aAllowCallback, aCancelCallback) {
- if (DEBUG) debug("askPermission for contacts");
-
- let access;
- switch(aAccess) {
- case "create":
- access = "create";
- break;
- case "update":
- case "remove":
- access = "write";
- break;
- case "find":
- case "listen":
- case "revision":
- case "count":
- access = "read";
- break;
- default:
- access = "unknown";
- }
-
- // Shortcut for ALLOW_ACTION so we avoid a parent roundtrip
- let principal = this._window.document.nodePrincipal;
- let type = "contacts-" + access;
- let permValue =
- Services.perms.testExactPermissionFromPrincipal(principal, type);
- DEBUG && debug("Existing permission " + permValue);
- if (permValue == Ci.nsIPermissionManager.ALLOW_ACTION) {
- if (aAllowCallback) {
- aAllowCallback();
- }
- return;
- } else if (permValue == Ci.nsIPermissionManager.DENY_ACTION ||
- permValue == Ci.nsIPermissionManager.UNKNOWN_ACTION) {
- if (aCancelCallback) {
- aCancelCallback("PERMISSION_DENIED");
- }
- return;
- }
-
- // Create an array with a single nsIContentPermissionType element.
- type = {
- type: "contacts",
- access: access,
- options: [],
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionType])
- };
- let typeArray = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray);
- typeArray.appendElement(type, false);
-
- // create a nsIContentPermissionRequest
- let request = {
- types: typeArray,
- principal: principal,
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIContentPermissionRequest]),
- allow: function() {
- aAllowCallback && aAllowCallback();
- DEBUG && debug("Permission granted. Access " + access +"\n");
- },
- cancel: function() {
- aCancelCallback && aCancelCallback("PERMISSION_DENIED");
- DEBUG && debug("Permission denied. Access " + access +"\n");
- },
- window: this._window
- };
-
- // Using askPermission from nsIDOMWindowUtils that takes care of the
- // remoting if needed.
- let windowUtils = this._window.QueryInterface(Ci.nsIInterfaceRequestor)
- .getInterface(Ci.nsIDOMWindowUtils);
- windowUtils.askPermission(request);
- },
-
- save: function save(aContact) {
- // We have to do a deep copy of the contact manually here because
- // nsFrameMessageManager doesn't know how to create a structured clone of a
- // mozContact object.
- let newContact = {properties: {}};
-
- try {
- for (let field of PROPERTIES) {
- // This hack makes sure modifications to the sequence attributes get validated.
- aContact[field] = aContact[field];
- newContact.properties[field] = aContact[field];
- }
- } catch (e) {
- // And then make sure we throw a proper error message (no internal file and line #)
- throw new this._window.Error(e.message);
- }
-
- let request = this.createRequest();
- let requestID = this.getRequestId({request: request});
-
- let reason;
- if (aContact.id == "undefined") {
- // for example {25c00f01-90e5-c545-b4d4-21E2ddbab9e0} becomes
- // 25c00f0190e5c545b4d421E2ddbab9e0
- aContact.id = this._getRandomId().replace(/[{}-]/g, "");
- // Cache the contact so that its ID may be updated later if necessary
- this._cachedContacts[requestID] = aContact;
- reason = "create";
- } else {
- reason = "update";
- }
-
- newContact.id = aContact.id;
- newContact.published = aContact.published;
- newContact.updated = aContact.updated;
-
- if (DEBUG) debug("send: " + JSON.stringify(newContact));
-
- let options = { contact: newContact, reason: reason };
- let allowCallback = function() {
- cpmm.sendAsyncMessage("Contact:Save", {
- requestID: requestID,
- options: options
- });
- }.bind(this);
-
- let cancelCallback = function(reason) {
- Services.DOMRequest.fireErrorAsync(request, reason);
- };
-
- this.askPermission(reason, request, allowCallback, cancelCallback);
- return request;
- },
-
- find: function(aOptions) {
- if (DEBUG) debug("find! " + JSON.stringify(aOptions));
- let request = this.createRequest();
- let options = { findOptions: aOptions };
-
- let allowCallback = function() {
- cpmm.sendAsyncMessage("Contacts:Find", {
- requestID: this.getRequestId({request: request, reason: "find"}),
- options: options
- });
- }.bind(this);
-
- let cancelCallback = function(reason) {
- Services.DOMRequest.fireErrorAsync(request, reason);
- };
-
- this.askPermission("find", request, allowCallback, cancelCallback);
- return request;
- },
-
- createCursor: function CM_createCursor(aRequest) {
- let data = {
- cursor: Services.DOMRequest.createCursor(this._window, function() {
- this.handleContinue(id);
- }.bind(this)),
- cachedContacts: [],
- waitingForNext: true,
- };
- let id = this.getRequestId(data);
- if (DEBUG) debug("saved cursor id: " + id);
- return [id, data.cursor];
- },
-
- getAll: function CM_getAll(aOptions) {
- if (DEBUG) debug("getAll: " + JSON.stringify(aOptions));
- let [cursorId, cursor] = this.createCursor();
-
- let allowCallback = function() {
- cpmm.sendAsyncMessage("Contacts:GetAll", {
- cursorId: cursorId,
- findOptions: aOptions
- });
- }.bind(this);
-
- let cancelCallback = function(reason) {
- Services.DOMRequest.fireErrorAsync(cursor, reason);
- };
-
- this.askPermission("find", cursor, allowCallback, cancelCallback);
- return cursor;
- },
-
- nextTick: function nextTick(aCallback) {
- Services.tm.currentThread.dispatch(aCallback, Ci.nsIThread.DISPATCH_NORMAL);
- },
-
- handleContinue: function CM_handleContinue(aCursorId) {
- if (DEBUG) debug("handleContinue: " + aCursorId);
- let data = this.getRequest(aCursorId);
- if (data.cachedContacts.length > 0) {
- if (DEBUG) debug("contact in cache");
- let contact = data.cachedContacts.shift();
- this.nextTick(this._fireSuccessOrDone.bind(this, data.cursor, contact));
- if (!contact) {
- this.removeRequest(aCursorId);
- } else if (data.cachedContacts.length === CONTACTS_SENDMORE_MINIMUM) {
- cpmm.sendAsyncMessage("Contacts:GetAll:SendNow", { cursorId: aCursorId });
- }
- } else {
- if (DEBUG) debug("waiting for contact");
- data.waitingForNext = true;
- }
- },
-
- remove: function removeContact(aRecordOrId) {
- let request = this.createRequest();
- let id;
- if (typeof aRecordOrId === "string") {
- id = aRecordOrId;
- } else if (!aRecordOrId || !aRecordOrId.id) {
- Services.DOMRequest.fireErrorAsync(request, true);
- return request;
- } else {
- id = aRecordOrId.id;
- }
-
- let options = { id: id };
-
- let allowCallback = function() {
- cpmm.sendAsyncMessage("Contact:Remove", {
- requestID: this.getRequestId({request: request, reason: "remove"}),
- options: options
- });
- }.bind(this);
-
- let cancelCallback = function(reason) {
- Services.DOMRequest.fireErrorAsync(request, reason);
- };
-
- this.askPermission("remove", request, allowCallback, cancelCallback);
- return request;
- },
-
- clear: function() {
- if (DEBUG) debug("clear");
- let request = this.createRequest();
- let options = {};
-
- let allowCallback = function() {
- cpmm.sendAsyncMessage("Contacts:Clear", {
- requestID: this.getRequestId({request: request, reason: "remove"}),
- options: options
- });
- }.bind(this);
-
- let cancelCallback = function(reason) {
- Services.DOMRequest.fireErrorAsync(request, reason);
- };
-
- this.askPermission("remove", request, allowCallback, cancelCallback);
- return request;
- },
-
- getRevision: function() {
- let request = this.createRequest();
-
- let allowCallback = function() {
- cpmm.sendAsyncMessage("Contacts:GetRevision", {
- requestID: this.getRequestId({ request: request })
- });
- }.bind(this);
-
- let cancelCallback = function(reason) {
- Services.DOMRequest.fireErrorAsync(request, reason);
- };
-
- this.askPermission("revision", request, allowCallback, cancelCallback);
- return request;
- },
-
- getCount: function() {
- let request = this.createRequest();
-
- let allowCallback = function() {
- cpmm.sendAsyncMessage("Contacts:GetCount", {
- requestID: this.getRequestId({ request: request })
- });
- }.bind(this);
-
- let cancelCallback = function(reason) {
- Services.DOMRequest.fireErrorAsync(request, reason);
- };
-
- this.askPermission("count", request, allowCallback, cancelCallback);
- return request;
- },
-
- init: function(aWindow) {
- // DOMRequestIpcHelper.initHelper sets this._window
- this.initDOMRequestHelper(aWindow, ["Contacts:Find:Return:OK", "Contacts:Find:Return:KO",
- "Contacts:Clear:Return:OK", "Contacts:Clear:Return:KO",
- "Contact:Save:Return:OK", "Contact:Save:Return:KO",
- "Contact:Remove:Return:OK", "Contact:Remove:Return:KO",
- "Contact:Changed",
- "Contacts:GetAll:Next", "Contacts:GetAll:Return:KO",
- "Contacts:Count",
- "Contacts:Revision", "Contacts:GetRevision:Return:KO",]);
-
-
- let allowCallback = function() {
- cpmm.sendAsyncMessage("Contacts:RegisterForMessages");
- this.hasListenPermission = true;
- }.bind(this);
-
- this.askPermission("listen", null, allowCallback);
- },
-
- classID: Components.ID("{8beb3a66-d70a-4111-b216-b8e995ad3aff}"),
- contractID: "@mozilla.org/contactManager;1",
- QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference,
- Ci.nsIObserver,
- Ci.nsIDOMGlobalPropertyInitializer]),
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([
- Contact, ContactManager
-]);
deleted file mode 100644
--- a/dom/contacts/ContactManager.manifest
+++ /dev/null
@@ -1,5 +0,0 @@
-component {72a5ee28-81d8-4af8-90b3-ae935396cc66} ContactManager.js
-contract @mozilla.org/contact;1 {72a5ee28-81d8-4af8-90b3-ae935396cc66}
-
-component {8beb3a66-d70a-4111-b216-b8e995ad3aff} ContactManager.js
-contract @mozilla.org/contactManager;1 {8beb3a66-d70a-4111-b216-b8e995ad3aff}
deleted file mode 100644
--- a/dom/contacts/fallback/ContactDB.jsm
+++ /dev/null
@@ -1,1401 +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/. */
-
-"use strict";
-
-// Everything but "ContactDB" is only exported here for testing.
-this.EXPORTED_SYMBOLS = ["ContactDB", "DB_NAME", "STORE_NAME", "SAVED_GETALL_STORE_NAME",
- "REVISION_STORE", "DB_VERSION"];
-
-const DEBUG = false;
-function debug(s) { dump("-*- ContactDB component: " + s + "\n"); }
-
-const Cu = Components.utils;
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/IndexedDBHelper.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PhoneNumberUtils",
- "resource://gre/modules/PhoneNumberUtils.jsm");
-Cu.importGlobalProperties(["indexedDB"]);
-
-/* all exported symbols need to be bound to this on B2G - Bug 961777 */
-this.DB_NAME = "contacts";
-this.DB_VERSION = 20;
-this.STORE_NAME = "contacts";
-this.SAVED_GETALL_STORE_NAME = "getallcache";
-const CHUNK_SIZE = 20;
-this.REVISION_STORE = "revision";
-const REVISION_KEY = "revision";
-
-function exportContact(aRecord) {
- if (aRecord) {
- delete aRecord.search;
- }
- return aRecord;
-}
-
-function ContactDispatcher(aContacts, aFullContacts, aCallback, aNewTxn, aClearDispatcher, aFailureCb) {
- let nextIndex = 0;
-
- let sendChunk;
- let count = 0;
- if (aFullContacts) {
- sendChunk = function() {
- try {
- let chunk = aContacts.splice(0, CHUNK_SIZE);
- if (chunk.length > 0) {
- aCallback(chunk);
- }
- if (aContacts.length === 0) {
- aCallback(null);
- aClearDispatcher();
- }
- } catch (e) {
- aClearDispatcher();
- }
- }
- } else {
- sendChunk = function() {
- try {
- let start = nextIndex;
- nextIndex += CHUNK_SIZE;
- let chunk = [];
- aNewTxn("readonly", STORE_NAME, function(txn, store) {
- for (let i = start; i < Math.min(start+CHUNK_SIZE, aContacts.length); ++i) {
- store.get(aContacts[i]).onsuccess = function(e) {
- chunk.push(exportContact(e.target.result));
- count++;
- if (count === aContacts.length) {
- aCallback(chunk);
- aCallback(null);
- aClearDispatcher();
- } else if (chunk.length === CHUNK_SIZE) {
- aCallback(chunk);
- chunk.length = 0;
- }
- }
- }
- }, null, function(errorMsg) {
- aFailureCb(errorMsg);
- });
- } catch (e) {
- aClearDispatcher();
- }
- }
- }
-
- return {
- sendNow: function() {
- sendChunk();
- }
- };
-}
-
-this.ContactDB = function ContactDB() {
- if (DEBUG) debug("Constructor");
-};
-
-ContactDB.prototype = {
- __proto__: IndexedDBHelper.prototype,
-
- _dispatcher: {},
-
- useFastUpgrade: true,
-
- upgradeSchema: function upgradeSchema(aTransaction, aDb, aOldVersion, aNewVersion) {
- let loadInitialContacts = function() {
- // Add default contacts
- let jsm = {};
- Cu.import("resource://gre/modules/FileUtils.jsm", jsm);
- Cu.import("resource://gre/modules/NetUtil.jsm", jsm);
- // Loading resource://app/defaults/contacts.json doesn't work because
- // contacts.json is not in the omnijar.
- // So we look for the app dir instead and go from here...
- let contactsFile = jsm.FileUtils.getFile("DefRt", ["contacts.json"], false);
- if (!contactsFile || (contactsFile && !contactsFile.exists())) {
- // For b2g desktop
- contactsFile = jsm.FileUtils.getFile("ProfD", ["contacts.json"], false);
- if (!contactsFile || (contactsFile && !contactsFile.exists())) {
- return;
- }
- }
-
- let chan = jsm.NetUtil.newChannel({
- uri: NetUtil.newURI(contactsFile),
- loadUsingSystemPrincipal: true});
-
- let stream = chan.open2();
- // Obtain a converter to read from a UTF-8 encoded input stream.
- let converter = Cc["@mozilla.org/intl/scriptableunicodeconverter"]
- .createInstance(Ci.nsIScriptableUnicodeConverter);
- converter.charset = "UTF-8";
- let rawstr = converter.ConvertToUnicode(jsm.NetUtil.readInputStreamToString(
- stream,
- stream.available()) || "");
- stream.close();
- let contacts;
- try {
- contacts = JSON.parse(rawstr);
- } catch(e) {
- if (DEBUG) debug("Error parsing " + contactsFile.path + " : " + e);
- return;
- }
-
- let idService = Cc["@mozilla.org/uuid-generator;1"].getService(Ci.nsIUUIDGenerator);
- objectStore = aTransaction.objectStore(STORE_NAME);
-
- for (let i = 0; i < contacts.length; i++) {
- let contact = {};
- contact.properties = contacts[i];
- contact.id = idService.generateUUID().toString().replace(/[{}-]/g, "");
- contact = this.makeImport(contact);
- this.updateRecordMetadata(contact);
- if (DEBUG) debug("import: " + JSON.stringify(contact));
- objectStore.put(contact);
- }
- }.bind(this);
-
- function createFinalSchema() {
- if (DEBUG) debug("creating final schema");
- let objectStore = aDb.createObjectStore(STORE_NAME, {keyPath: "id"});
- objectStore.createIndex("familyName", "properties.familyName", { multiEntry: true });
- objectStore.createIndex("givenName", "properties.givenName", { multiEntry: true });
- objectStore.createIndex("name", "properties.name", { multiEntry: true });
- objectStore.createIndex("familyNameLowerCase", "search.familyName", { multiEntry: true });
- objectStore.createIndex("givenNameLowerCase", "search.givenName", { multiEntry: true });
- objectStore.createIndex("nameLowerCase", "search.name", { multiEntry: true });
- objectStore.createIndex("telLowerCase", "search.tel", { multiEntry: true });
- objectStore.createIndex("emailLowerCase", "search.email", { multiEntry: true });
- objectStore.createIndex("tel", "search.exactTel", { multiEntry: true });
- objectStore.createIndex("category", "properties.category", { multiEntry: true });
- objectStore.createIndex("email", "search.email", { multiEntry: true });
- objectStore.createIndex("telMatch", "search.parsedTel", {multiEntry: true});
- objectStore.createIndex("phoneticFamilyName", "properties.phoneticFamilyName", { multiEntry: true });
- objectStore.createIndex("phoneticGivenName", "properties.phoneticGivenName", { multiEntry: true });
- objectStore.createIndex("phoneticFamilyNameLowerCase", "search.phoneticFamilyName", { multiEntry: true });
- objectStore.createIndex("phoneticGivenNameLowerCase", "search.phoneticGivenName", { multiEntry: true });
- aDb.createObjectStore(SAVED_GETALL_STORE_NAME);
- aDb.createObjectStore(REVISION_STORE).put(0, REVISION_KEY);
- }
-
- let valueUpgradeSteps = [];
-
- function scheduleValueUpgrade(upgradeFunc) {
- var length = valueUpgradeSteps.push(upgradeFunc);
- if (DEBUG) debug("Scheduled a value upgrade function, index " + (length - 1));
- }
-
- // We always output this debug line because it's useful and the noise ratio
- // very low.
- debug("upgrade schema from: " + aOldVersion + " to " + aNewVersion + " called!");
- let db = aDb;
- let objectStore;
-
- if (aOldVersion === 0 && this.useFastUpgrade) {
- createFinalSchema();
- loadInitialContacts();
- return;
- }
-
- let steps = [
- function upgrade0to1() {
- /**
- * Create the initial database schema.
- *
- * The schema of records stored is as follows:
- *
- * {id: "...", // UUID
- * published: Date(...), // First published date.
- * updated: Date(...), // Last updated date.
- * properties: {...} // Object holding the ContactProperties
- * }
- */
- if (DEBUG) debug("create schema");
- objectStore = db.createObjectStore(STORE_NAME, {keyPath: "id"});
-
- // Properties indexes
- objectStore.createIndex("familyName", "properties.familyName", { multiEntry: true });
- objectStore.createIndex("givenName", "properties.givenName", { multiEntry: true });
-
- objectStore.createIndex("familyNameLowerCase", "search.familyName", { multiEntry: true });
- objectStore.createIndex("givenNameLowerCase", "search.givenName", { multiEntry: true });
- objectStore.createIndex("telLowerCase", "search.tel", { multiEntry: true });
- objectStore.createIndex("emailLowerCase", "search.email", { multiEntry: true });
- next();
- },
- function upgrade1to2() {
- if (DEBUG) debug("upgrade 1");
-
- // Create a new scheme for the tel field. We move from an array of tel-numbers to an array of
- // ContactTelephone.
- if (!objectStore) {
- objectStore = aTransaction.objectStore(STORE_NAME);
- }
- // Delete old tel index.
- if (objectStore.indexNames.contains("tel")) {
- objectStore.deleteIndex("tel");
- }
-
- // Upgrade existing tel field in the DB.
- objectStore.openCursor().onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- if (DEBUG) debug("upgrade tel1: " + JSON.stringify(cursor.value));
- for (let number in cursor.value.properties.tel) {
- cursor.value.properties.tel[number] = {number: number};
- }
- cursor.update(cursor.value);
- if (DEBUG) debug("upgrade tel2: " + JSON.stringify(cursor.value));
- cursor.continue();
- } else {
- next();
- }
- };
-
- // Create new searchable indexes.
- objectStore.createIndex("tel", "search.tel", { multiEntry: true });
- objectStore.createIndex("category", "properties.category", { multiEntry: true });
- },
- function upgrade2to3() {
- if (DEBUG) debug("upgrade 2");
- // Create a new scheme for the email field. We move from an array of emailaddresses to an array of
- // ContactEmail.
- if (!objectStore) {
- objectStore = aTransaction.objectStore(STORE_NAME);
- }
-
- // Delete old email index.
- if (objectStore.indexNames.contains("email")) {
- objectStore.deleteIndex("email");
- }
-
- // Upgrade existing email field in the DB.
- objectStore.openCursor().onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- if (cursor.value.properties.email) {
- if (DEBUG) debug("upgrade email1: " + JSON.stringify(cursor.value));
- cursor.value.properties.email =
- cursor.value.properties.email.map(function(address) { return { address: address }; });
- cursor.update(cursor.value);
- if (DEBUG) debug("upgrade email2: " + JSON.stringify(cursor.value));
- }
- cursor.continue();
- } else {
- next();
- }
- };
-
- // Create new searchable indexes.
- objectStore.createIndex("email", "search.email", { multiEntry: true });
- },
- function upgrade3to4() {
- if (DEBUG) debug("upgrade 3");
-
- if (!objectStore) {
- objectStore = aTransaction.objectStore(STORE_NAME);
- }
-
- // Upgrade existing impp field in the DB.
- objectStore.openCursor().onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- if (cursor.value.properties.impp) {
- if (DEBUG) debug("upgrade impp1: " + JSON.stringify(cursor.value));
- cursor.value.properties.impp =
- cursor.value.properties.impp.map(function(value) { return { value: value }; });
- cursor.update(cursor.value);
- if (DEBUG) debug("upgrade impp2: " + JSON.stringify(cursor.value));
- }
- cursor.continue();
- }
- };
- // Upgrade existing url field in the DB.
- objectStore.openCursor().onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- if (cursor.value.properties.url) {
- if (DEBUG) debug("upgrade url1: " + JSON.stringify(cursor.value));
- cursor.value.properties.url =
- cursor.value.properties.url.map(function(value) { return { value: value }; });
- cursor.update(cursor.value);
- if (DEBUG) debug("upgrade impp2: " + JSON.stringify(cursor.value));
- }
- cursor.continue();
- } else {
- next();
- }
- };
- },
- function upgrade4to5() {
- if (DEBUG) debug("Add international phone numbers upgrade");
- if (!objectStore) {
- objectStore = aTransaction.objectStore(STORE_NAME);
- }
-
- objectStore.openCursor().onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- if (cursor.value.properties.tel) {
- if (DEBUG) debug("upgrade : " + JSON.stringify(cursor.value));
- cursor.value.properties.tel.forEach(
- function(duple) {
- let parsedNumber = PhoneNumberUtils.parse(duple.value.toString());
- if (parsedNumber) {
- if (DEBUG) {
- debug("InternationalFormat: " + parsedNumber.internationalFormat);
- debug("InternationalNumber: " + parsedNumber.internationalNumber);
- debug("NationalNumber: " + parsedNumber.nationalNumber);
- debug("NationalFormat: " + parsedNumber.nationalFormat);
- }
- if (duple.value.toString() !== parsedNumber.internationalNumber) {
- cursor.value.search.tel.push(parsedNumber.internationalNumber);
- }
- } else {
- dump("Warning: No international number found for " + duple.value + "\n");
- }
- }
- )
- cursor.update(cursor.value);
- }
- if (DEBUG) debug("upgrade2 : " + JSON.stringify(cursor.value));
- cursor.continue();
- } else {
- next();
- }
- };
- },
- function upgrade5to6() {
- if (DEBUG) debug("Add index for equals tel searches");
- if (!objectStore) {
- objectStore = aTransaction.objectStore(STORE_NAME);
- }
-
- // Delete old tel index (not on the right field).
- if (objectStore.indexNames.contains("tel")) {
- objectStore.deleteIndex("tel");
- }
-
- // Create new index for "equals" searches
- objectStore.createIndex("tel", "search.exactTel", { multiEntry: true });
-
- objectStore.openCursor().onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- if (cursor.value.properties.tel) {
- if (DEBUG) debug("upgrade : " + JSON.stringify(cursor.value));
- cursor.value.properties.tel.forEach(
- function(duple) {
- let number = duple.value.toString();
- let parsedNumber = PhoneNumberUtils.parse(number);
-
- cursor.value.search.exactTel = [number];
- if (parsedNumber &&
- parsedNumber.internationalNumber &&
- number !== parsedNumber.internationalNumber) {
- cursor.value.search.exactTel.push(parsedNumber.internationalNumber);
- }
- }
- )
- cursor.update(cursor.value);
- }
- if (DEBUG) debug("upgrade : " + JSON.stringify(cursor.value));
- cursor.continue();
- } else {
- next();
- }
- };
- },
- function upgrade6to7() {
- if (!objectStore) {
- objectStore = aTransaction.objectStore(STORE_NAME);
- }
- let names = objectStore.indexNames;
- let whiteList = ["tel", "familyName", "givenName", "familyNameLowerCase",
- "givenNameLowerCase", "telLowerCase", "category", "email",
- "emailLowerCase"];
- for (var i = 0; i < names.length; i++) {
- if (whiteList.indexOf(names[i]) < 0) {
- objectStore.deleteIndex(names[i]);
- }
- }
- next();
- },
- function upgrade7to8() {
- if (DEBUG) debug("Adding object store for cached searches");
- db.createObjectStore(SAVED_GETALL_STORE_NAME);
- next();
- },
- function upgrade8to9() {
- if (DEBUG) debug("Make exactTel only contain the value entered by the user");
- if (!objectStore) {
- objectStore = aTransaction.objectStore(STORE_NAME);
- }
-
- objectStore.openCursor().onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- if (cursor.value.properties.tel) {
- cursor.value.search.exactTel = [];
- cursor.value.properties.tel.forEach(
- function(tel) {
- let normalized = PhoneNumberUtils.normalize(tel.value.toString());
- cursor.value.search.exactTel.push(normalized);
- }
- );
- cursor.update(cursor.value);
- }
- cursor.continue();
- } else {
- next();
- }
- };
- },
- function upgrade9to10() {
- // no-op, see https://bugzilla.mozilla.org/show_bug.cgi?id=883770#c16
- next();
- },
- function upgrade10to11() {
- if (DEBUG) debug("Adding object store for database revision");
- db.createObjectStore(REVISION_STORE).put(0, REVISION_KEY);
- next();
- },
- function upgrade11to12() {
- if (DEBUG) debug("Add a telMatch index with national and international numbers");
- if (!objectStore) {
- objectStore = aTransaction.objectStore(STORE_NAME);
- }
- if (!objectStore.indexNames.contains("telMatch")) {
- objectStore.createIndex("telMatch", "search.parsedTel", {multiEntry: true});
- }
- objectStore.openCursor().onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- if (cursor.value.properties.tel) {
- cursor.value.search.parsedTel = [];
- cursor.value.properties.tel.forEach(
- function(tel) {
- let parsed = PhoneNumberUtils.parse(tel.value.toString());
- if (parsed) {
- cursor.value.search.parsedTel.push(parsed.nationalNumber);
- cursor.value.search.parsedTel.push(PhoneNumberUtils.normalize(parsed.nationalFormat));
- cursor.value.search.parsedTel.push(parsed.internationalNumber);
- cursor.value.search.parsedTel.push(PhoneNumberUtils.normalize(parsed.internationalFormat));
- }
- cursor.value.search.parsedTel.push(PhoneNumberUtils.normalize(tel.value.toString()));
- }
- );
- cursor.update(cursor.value);
- }
- cursor.continue();
- } else {
- next();
- }
- };
- },
- function upgrade12to13() {
- if (DEBUG) debug("Add phone substring to the search index if appropriate for country");
- if (this.substringMatching) {
- scheduleValueUpgrade(function upgradeValue12to13(value) {
- if (value.properties.tel) {
- value.search.parsedTel = value.search.parsedTel || [];
- value.properties.tel.forEach(
- function(tel) {
- let normalized = PhoneNumberUtils.normalize(tel.value.toString());
- if (normalized) {
- if (this.substringMatching && normalized.length > this.substringMatching) {
- let sub = normalized.slice(-this.substringMatching);
- if (value.search.parsedTel.indexOf(sub) === -1) {
- if (DEBUG) debug("Adding substring index: " + tel + ", " + sub);
- value.search.parsedTel.push(sub);
- }
- }
- }
- }.bind(this)
- );
- return true;
- } else {
- return false;
- }
- }.bind(this));
- }
- next();
- },
- function upgrade13to14() {
- if (DEBUG) debug("Cleaning up empty substring entries in telMatch index");
- scheduleValueUpgrade(function upgradeValue13to14(value) {
- function removeEmptyStrings(value) {
- if (value) {
- const oldLength = value.length;
- for (let i = 0; i < value.length; ++i) {
- if (!value[i] || value[i] == "null") {
- value.splice(i, 1);
- }
- }
- return oldLength !== value.length;
- }
- }
-
- let modified = removeEmptyStrings(value.search.parsedTel);
- let modified2 = removeEmptyStrings(value.search.tel);
- return (modified || modified2);
- });
-
- next();
- },
- function upgrade14to15() {
- if (DEBUG) debug("Fix array properties saved as scalars");
- const ARRAY_PROPERTIES = ["photo", "adr", "email", "url", "impp", "tel",
- "name", "honorificPrefix", "givenName",
- "additionalName", "familyName", "honorificSuffix",
- "nickname", "category", "org", "jobTitle",
- "note", "key"];
- const PROPERTIES_WITH_TYPE = ["adr", "email", "url", "impp", "tel"];
-
- scheduleValueUpgrade(function upgradeValue14to15(value) {
- let changed = false;
-
- let props = value.properties;
- for (let prop of ARRAY_PROPERTIES) {
- if (props[prop]) {
- if (!Array.isArray(props[prop])) {
- value.properties[prop] = [props[prop]];
- changed = true;
- }
- if (PROPERTIES_WITH_TYPE.indexOf(prop) !== -1) {
- let subprop = value.properties[prop];
- for (let i = 0; i < subprop.length; ++i) {
- if (!Array.isArray(subprop[i].type)) {
- value.properties[prop][i].type = [subprop[i].type];
- changed = true;
- }
- }
- }
- }
- }
-
- return changed;
- });
-
- next();
- },
- function upgrade15to16() {
- if (DEBUG) debug("Fix Date properties");
- const DATE_PROPERTIES = ["bday", "anniversary"];
-
- scheduleValueUpgrade(function upgradeValue15to16(value) {
- let changed = false;
- let props = value.properties;
- for (let prop of DATE_PROPERTIES) {
- if (props[prop] && !(props[prop] instanceof Date)) {
- value.properties[prop] = new Date(props[prop]);
- changed = true;
- }
- }
-
- return changed;
- });
-
- next();
- },
- function upgrade16to17() {
- if (DEBUG) debug("Fix array with null values");
- const ARRAY_PROPERTIES = ["photo", "adr", "email", "url", "impp", "tel",
- "name", "honorificPrefix", "givenName",
- "additionalName", "familyName", "honorificSuffix",
- "nickname", "category", "org", "jobTitle",
- "note", "key"];
-
- const PROPERTIES_WITH_TYPE = ["adr", "email", "url", "impp", "tel"];
-
- const DATE_PROPERTIES = ["bday", "anniversary"];
-
- scheduleValueUpgrade(function upgradeValue16to17(value) {
- let changed;
-
- function filterInvalidValues(val) {
- let shouldKeep = val != null; // null or undefined
- if (!shouldKeep) {
- changed = true;
- }
- return shouldKeep;
- }
-
- function filteredArray(array) {
- return array.filter(filterInvalidValues);
- }
-
- let props = value.properties;
-
- for (let prop of ARRAY_PROPERTIES) {
-
- // properties that were empty strings weren't converted to arrays
- // in upgrade14to15
- if (props[prop] != null && !Array.isArray(props[prop])) {
- props[prop] = [props[prop]];
- changed = true;
- }
-
- if (props[prop] && props[prop].length) {
- props[prop] = filteredArray(props[prop]);
-
- if (PROPERTIES_WITH_TYPE.indexOf(prop) !== -1) {
- let subprop = props[prop];
-
- for (let i = 0; i < subprop.length; ++i) {
- let curSubprop = subprop[i];
- // upgrade14to15 transformed type props into an array
- // without checking invalid values
- if (curSubprop.type) {
- curSubprop.type = filteredArray(curSubprop.type);
- }
- }
- }
- }
- }
-
- for (let prop of DATE_PROPERTIES) {
- if (props[prop] != null && !(props[prop] instanceof Date)) {
- // props[prop] is probably '' and wasn't converted
- // in upgrade15to16
- props[prop] = null;
- changed = true;
- }
- }
-
- if (changed) {
- value.properties = props;
- return true;
- } else {
- return false;
- }
- });
-
- next();
- },
- function upgrade17to18() {
- // this upgrade function has been moved to the next upgrade path because
- // a previous version of it had a bug
- next();
- },
- function upgrade18to19() {
- if (DEBUG) {
- debug("Adding the name index");
- }
-
- if (!objectStore) {
- objectStore = aTransaction.objectStore(STORE_NAME);
- }
-
- // an earlier version of this code could have run, so checking whether
- // the index exists
- if (!objectStore.indexNames.contains("name")) {
- objectStore.createIndex("name", "properties.name", { multiEntry: true });
- objectStore.createIndex("nameLowerCase", "search.name", { multiEntry: true });
- }
-
- scheduleValueUpgrade(function upgradeValue18to19(value) {
- value.search.name = [];
- if (value.properties.name) {
- value.properties.name.forEach(function addNameIndex(name) {
- var lowerName = name.toLowerCase();
- // an earlier version of this code could have added it already
- if (value.search.name.indexOf(lowerName) === -1) {
- value.search.name.push(lowerName);
- }
- });
- }
- return true;
- });
-
- next();
- },
- function upgrade19to20() {
- if (DEBUG) debug("upgrade19to20 create schema(phonetic)");
- if (!objectStore) {
- objectStore = aTransaction.objectStore(STORE_NAME);
- }
- objectStore.createIndex("phoneticFamilyName", "properties.phoneticFamilyName", { multiEntry: true });
- objectStore.createIndex("phoneticGivenName", "properties.phoneticGivenName", { multiEntry: true });
- objectStore.createIndex("phoneticFamilyNameLowerCase", "search.phoneticFamilyName", { multiEntry: true });
- objectStore.createIndex("phoneticGivenNameLowerCase", "search.phoneticGivenName", { multiEntry: true });
- next();
- },
- ];
-
- let index = aOldVersion;
- let outer = this;
-
- /* This function runs all upgrade functions that are in the
- * valueUpgradeSteps array. These functions have the following properties:
- * - they must be synchronous
- * - they must take the value as parameter and modify it directly. They
- * must not create a new object.
- * - they must return a boolean true/false; true if the value was actually
- * changed
- */
- function runValueUpgradeSteps(done) {
- if (DEBUG) debug("Running the value upgrade functions.");
- if (!objectStore) {
- objectStore = aTransaction.objectStore(STORE_NAME);
- }
- objectStore.openCursor().onsuccess = function(event) {
- let cursor = event.target.result;
- if (cursor) {
- let changed = false;
- let oldValue;
- let value = cursor.value;
- if (DEBUG) {
- oldValue = JSON.stringify(value);
- }
- valueUpgradeSteps.forEach(function(upgradeFunc, i) {
- if (DEBUG) debug("Running upgrade function " + i);
- changed = upgradeFunc(value) || changed;
- });
-
- if (changed) {
- cursor.update(value);
- } else if (DEBUG) {
- let newValue = JSON.stringify(value);
- if (newValue !== oldValue) {
- // oops something went wrong
- debug("upgrade: `changed` was false and still the value changed! Aborting.");
- aTransaction.abort();
- return;
- }
- }
- cursor.continue();
- } else {
- done();
- }
- };
- }
-
- function finish() {
- // We always output this debug line because it's useful and the noise ratio
- // very low.
- debug("Upgrade finished");
-
- outer.incrementRevision(aTransaction);
- }
-
- function next() {
- if (index == aNewVersion) {
- runValueUpgradeSteps(finish);
- return;
- }
-
- try {
- var i = index++;
- if (DEBUG) debug("Upgrade step: " + i + "\n");
- steps[i].call(outer);
- } catch(ex) {
- dump("Caught exception" + ex);
- aTransaction.abort();
- return;
- }
- }
-
- function fail(why) {
- why = why || "";
- if (this.error) {
- why += " (root cause: " + this.error.name + ")";
- }
-
- debug("Contacts DB upgrade error: " + why);
- aTransaction.abort();
- }
-
- if (aNewVersion > steps.length) {
- fail("No migration steps for the new version!");
- }
-
- this.cpuLock = Cc["@mozilla.org/power/powermanagerservice;1"]
- .getService(Ci.nsIPowerManagerService)
- .newWakeLock("cpu");
-
- function unlockCPU() {
- if (outer.cpuLock) {
- if (DEBUG) debug("unlocking cpu wakelock");
- outer.cpuLock.unlock();
- outer.cpuLock = null;
- }
- }
-
- aTransaction.addEventListener("complete", unlockCPU);
- aTransaction.addEventListener("abort", unlockCPU);
-
- next();
- },
-
- makeImport: function makeImport(aContact) {
- let contact = {properties: {}};
-
- contact.search = {
- name: [],
- givenName: [],
- familyName: [],
- email: [],
- category: [],
- tel: [],
- exactTel: [],
- parsedTel: [],
- phoneticFamilyName: [],
- phoneticGivenName: [],
- };
-
- for (let field in aContact.properties) {
- contact.properties[field] = aContact.properties[field];
- // Add search fields
- if (aContact.properties[field] && contact.search[field]) {
- for (let i = 0; i <= aContact.properties[field].length; i++) {
- if (aContact.properties[field][i]) {
- if (field == "tel" && aContact.properties[field][i].value) {
- let number = aContact.properties.tel[i].value.toString();
- let normalized = PhoneNumberUtils.normalize(number);
- // We use an object here to avoid duplicates
- let containsSearch = {};
- let matchSearch = {};
-
- if (normalized) {
- // exactTel holds normalized version of entered phone number.
- // normalized: +1 (949) 123 - 4567 -> +19491234567
- contact.search.exactTel.push(normalized);
- // matchSearch holds normalized version of entered phone number,
- // nationalNumber, nationalFormat, internationalNumber, internationalFormat
- matchSearch[normalized] = 1;
- let parsedNumber = PhoneNumberUtils.parse(number);
- if (parsedNumber) {
- if (DEBUG) {
- debug("InternationalFormat: " + parsedNumber.internationalFormat);
- debug("InternationalNumber: " + parsedNumber.internationalNumber);
- debug("NationalNumber: " + parsedNumber.nationalNumber);
- debug("NationalFormat: " + parsedNumber.nationalFormat);
- debug("NationalMatchingFormat: " + parsedNumber.nationalMatchingFormat);
- }
- matchSearch[parsedNumber.nationalNumber] = 1;
- matchSearch[parsedNumber.internationalNumber] = 1;
- matchSearch[PhoneNumberUtils.normalize(parsedNumber.nationalFormat)] = 1;
- matchSearch[PhoneNumberUtils.normalize(parsedNumber.internationalFormat)] = 1;
- matchSearch[PhoneNumberUtils.normalize(parsedNumber.nationalMatchingFormat)] = 1;
- } else if (this.substringMatching && normalized.length > this.substringMatching) {
- matchSearch[normalized.slice(-this.substringMatching)] = 1;
- }
-
- // containsSearch holds incremental search values for:
- // normalized number and national format
- for (let i = 0; i < normalized.length; i++) {
- containsSearch[normalized.substring(i, normalized.length)] = 1;
- }
- if (parsedNumber && parsedNumber.nationalFormat) {
- let number = PhoneNumberUtils.normalize(parsedNumber.nationalFormat);
- for (let i = 0; i < number.length; i++) {
- containsSearch[number.substring(i, number.length)] = 1;
- }
- }
- }
- for (let num in containsSearch) {
- if (num && num != "null") {
- contact.search.tel.push(num);
- }
- }
- for (let num in matchSearch) {
- if (num && num != "null") {
- contact.search.parsedTel.push(num);
- }
- }
- } else if ((field == "impp" || field == "email") && aContact.properties[field][i].value) {
- let value = aContact.properties[field][i].value;
- if (value && typeof value == "string") {
- contact.search[field].push(value.toLowerCase());
- }
- } else {
- let val = aContact.properties[field][i];
- if (typeof val == "string") {
- contact.search[field].push(val.toLowerCase());
- }
- }
- }
- }
- }
- }
-
- contact.updated = aContact.updated;
- contact.published = aContact.published;
- contact.id = aContact.id;
-
- return contact;
- },
-
- updateRecordMetadata: function updateRecordMetadata(record) {
- if (!record.id) {
- Cu.reportError("Contact without ID");
- }
- if (!record.published) {
- record.published = new Date();
- }
- record.updated = new Date();
- },
-
- removeObjectFromCache: function CDB_removeObjectFromCache(aObjectId, aCallback, aFailureCb) {
- if (DEBUG) debug("removeObjectFromCache: " + aObjectId);
- if (!aObjectId) {
- if (DEBUG) debug("No object ID passed");
- return;
- }
- this.newTxn("readwrite", this.dbStoreNames, function(txn, stores) {
- let store = txn.objectStore(SAVED_GETALL_STORE_NAME);
- store.openCursor().onsuccess = function(e) {
- let cursor = e.target.result;
- if (cursor) {
- for (let i = 0; i < cursor.value.length; ++i) {
- if (cursor.value[i] == aObjectId) {
- if (DEBUG) debug("id matches cache");
- cursor.value.splice(i, 1);
- cursor.update(cursor.value);
- break;
- }
- }
- cursor.continue();
- } else {
- aCallback(txn);
- }
- }.bind(this);
- }.bind(this), null, aFailureCb);
- },
-
- incrementRevision: function CDB_incrementRevision(txn) {
- let revStore = txn.objectStore(REVISION_STORE);
- revStore.get(REVISION_KEY).onsuccess = function(e) {
- revStore.put(parseInt(e.target.result, 10) + 1, REVISION_KEY);
- };
- },
-
- saveContact: function CDB_saveContact(aContact, successCb, errorCb) {
- let contact = this.makeImport(aContact);
- this.newTxn("readwrite", this.dbStoreNames, function (txn, stores) {
- if (DEBUG) debug("Going to update" + JSON.stringify(contact));
- let store = txn.objectStore(STORE_NAME);
-
- // Look up the existing record and compare the update timestamp.
- // If no record exists, just add the new entry.
- let newRequest = store.get(contact.id);
- newRequest.onsuccess = function (event) {
- if (!event.target.result) {
- if (DEBUG) debug("new record!")
- this.updateRecordMetadata(contact);
- store.put(contact);
- } else {
- if (DEBUG) debug("old record!")
- if (new Date(typeof contact.updated === "undefined" ? 0 : contact.updated) < new Date(event.target.result.updated)) {
- if (DEBUG) debug("rev check fail!");
- txn.abort();
- return;
- } else {
- if (DEBUG) debug("rev check OK");
- contact.published = event.target.result.published;
- contact.updated = new Date();
- store.put(contact);
- }
- }
- // Invalidate the entire cache. It will be incrementally regenerated on demand
- // See getCacheForQuery
- let getAllStore = txn.objectStore(SAVED_GETALL_STORE_NAME);
- getAllStore.clear().onerror = errorCb;
- }.bind(this);
-
- this.incrementRevision(txn);
- }.bind(this), successCb, errorCb);
- },
-
- removeContact: function removeContact(aId, aSuccessCb, aErrorCb) {
- if (DEBUG) debug("removeContact: " + aId);
- this.removeObjectFromCache(aId, function(txn) {
- let store = txn.objectStore(STORE_NAME)
- store.delete(aId).onsuccess = function() {
- aSuccessCb();
- };
- this.incrementRevision(txn);
- }.bind(this), aErrorCb);
- },
-
- clear: function clear(aSuccessCb, aErrorCb) {
- this.newTxn("readwrite", STORE_NAME, function (txn, store) {
- if (DEBUG) debug("Going to clear all!");
- store.clear();
- this.incrementRevision(txn);
- }.bind(this), aSuccessCb, aErrorCb);
- },
-
- createCacheForQuery: function CDB_createCacheForQuery(aQuery, aSuccessCb, aFailureCb) {
- this.find(function (aContacts) {
- if (aContacts) {
- let contactsArray = [];
- for (let i in aContacts) {
- contactsArray.push(aContacts[i]);
- }
-
- let contactIdsArray = contactsArray.map(el => el.id);
-
- // save contact ids in cache
- this.newTxn("readwrite", SAVED_GETALL_STORE_NAME, function(txn, store) {
- store.put(contactIdsArray, aQuery);
- }, null, aFailureCb);
-
- // send full contacts
- aSuccessCb(contactsArray, true);
- } else {
- aSuccessCb([], true);
- }
- }.bind(this),
- function (aErrorMsg) { aFailureCb(aErrorMsg); },
- JSON.parse(aQuery));
- },
-
- getCacheForQuery: function CDB_getCacheForQuery(aQuery, aSuccessCb, aFailureCb) {
- if (DEBUG) debug("getCacheForQuery");
- // Here we try to get the cached results for query `aQuery'. If they don't
- // exist, it means the cache was invalidated and needs to be recreated, so
- // we do that. Otherwise, we just return the existing cache.
- this.newTxn("readonly", SAVED_GETALL_STORE_NAME, function(txn, store) {
- let req = store.get(aQuery);
- req.onsuccess = function(e) {
- if (e.target.result) {
- if (DEBUG) debug("cache exists");
- aSuccessCb(e.target.result, false);
- } else {
- if (DEBUG) debug("creating cache for query " + aQuery);
- this.createCacheForQuery(aQuery, aSuccessCb);
- }
- }.bind(this);
- req.onerror = function(e) {
- aFailureCb(e.target.errorMessage);
- };
- }.bind(this), null, aFailureCb);
- },
-
- sendNow: function CDB_sendNow(aCursorId) {
- if (aCursorId in this._dispatcher) {
- this._dispatcher[aCursorId].sendNow();
- }
- },
-
- clearDispatcher: function CDB_clearDispatcher(aCursorId) {
- if (DEBUG) debug("clearDispatcher: " + aCursorId);
- if (aCursorId in this._dispatcher) {
- delete this._dispatcher[aCursorId];
- }
- },
-
- getAll: function CDB_getAll(aSuccessCb, aFailureCb, aOptions, aCursorId) {
- if (DEBUG) debug("getAll")
- let optionStr = JSON.stringify(aOptions);
- this.getCacheForQuery(optionStr, function(aCachedResults, aFullContacts) {
- // aFullContacts is true if the cache didn't exist and had to be created.
- // In that case, we receive the full contacts since we already have them
- // in memory to create the cache. This allows us to avoid accessing the
- // object store again.
- if (aCachedResults && aCachedResults.length > 0) {
- let newTxnFn = this.newTxn.bind(this);
- let clearDispatcherFn = this.clearDispatcher.bind(this, aCursorId);
- this._dispatcher[aCursorId] = new ContactDispatcher(aCachedResults, aFullContacts,
- aSuccessCb, newTxnFn,
- clearDispatcherFn, aFailureCb);
- this._dispatcher[aCursorId].sendNow();
- } else { // no contacts
- if (DEBUG) debug("query returned no contacts");
- aSuccessCb(null);
- }
- }.bind(this), aFailureCb);
- },
-
- getRevision: function CDB_getRevision(aSuccessCb, aErrorCb) {
- if (DEBUG) debug("getRevision");
- this.newTxn("readonly", REVISION_STORE, function (txn, store) {
- store.get(REVISION_KEY).onsuccess = function (e) {
- aSuccessCb(e.target.result);
- };
- },null, aErrorCb);
- },
-
- getCount: function CDB_getCount(aSuccessCb, aErrorCb) {
- if (DEBUG) debug("getCount");
- this.newTxn("readonly", STORE_NAME, function (txn, store) {
- store.count().onsuccess = function (e) {
- aSuccessCb(e.target.result);
- };
- }, null, aErrorCb);
- },
-
- getSortByParam: function CDB_getSortByParam(aFindOptions) {
- switch (aFindOptions.sortBy) {
- case "familyName":
- return [ "familyName", "givenName" ];
- case "givenName":
- return [ "givenName" , "familyName" ];
- case "phoneticFamilyName":
- return [ "phoneticFamilyName" , "phoneticGivenName" ];
- case "phoneticGivenName":
- return [ "phoneticGivenName" , "phoneticFamilyName" ];
- default:
- return [ "givenName" , "familyName" ];
- }
- },
-
- /*
- * Sorting the contacts by sortBy field. aSortBy can either be familyName or givenName.
- * If 2 entries have the same sortyBy field or no sortBy field is present, we continue
- * sorting with the other sortyBy field.
- */
- sortResults: function CDB_sortResults(aResults, aFindOptions) {
- if (!aFindOptions)
- return;
- if (aFindOptions.sortBy != "undefined") {
- const sortOrder = aFindOptions.sortOrder;
- const sortBy = this.getSortByParam(aFindOptions);
-
- aResults.sort(function (a, b) {
- let x, y;
- let result = 0;
- let xIndex = 0;
- let yIndex = 0;
-
- do {
- while (xIndex < sortBy.length && !x) {
- x = a.properties[sortBy[xIndex]];
- if (x) {
- x = x.join("").toLowerCase();
- }
- xIndex++;
- }
- while (yIndex < sortBy.length && !y) {
- y = b.properties[sortBy[yIndex]];
- if (y) {
- y = y.join("").toLowerCase();
- }
- yIndex++;
- }
- if (!x) {
- if (!y) {
- let px, py;
- px = JSON.stringify(a.published);
- py = JSON.stringify(b.published);
- if (px && py) {
- return px.localeCompare(py);
- }
- } else {
- return sortOrder == 'descending' ? 1 : -1;
- }
- }
- if (!y) {
- return sortOrder == "ascending" ? 1 : -1;
- }
-
- result = x.localeCompare(y);
- x = null;
- y = null;
- } while (result == 0);
-
- return sortOrder == "ascending" ? result : -result;
- });
- }
- if (aFindOptions.filterLimit && aFindOptions.filterLimit != 0) {
- if (DEBUG) debug("filterLimit is set: " + aFindOptions.filterLimit);
- aResults.splice(aFindOptions.filterLimit, aResults.length);
- }
- },
-
- /**
- * @param successCb
- * Callback function to invoke with result array.
- * @param failureCb [optional]
- * Callback function to invoke when there was an error.
- * @param options [optional]
- * Object specifying search options. Possible attributes:
- * - filterBy
- * - filterOp
- * - filterValue
- * - count
- */
- find: function find(aSuccessCb, aFailureCb, aOptions) {
- if (DEBUG) debug("ContactDB:find val:" + aOptions.filterValue + " by: " + aOptions.filterBy + " op: " + aOptions.filterOp);
- let self = this;
- this.newTxn("readonly", STORE_NAME, function (txn, store) {
- let filterOps = ["equals", "contains", "match", "startsWith"];
- if (aOptions && (filterOps.indexOf(aOptions.filterOp) >= 0)) {
- self._findWithIndex(txn, store, aOptions);
- } else {
- self._findAll(txn, store, aOptions);
- }
- }, aSuccessCb, aFailureCb);
- },
-
- _findWithIndex: function _findWithIndex(txn, store, options) {
- if (DEBUG) debug("_findWithIndex: " + options.filterValue +" " + options.filterOp + " " + options.filterBy + " ");
- let fields = options.filterBy;
- for (let key in fields) {
- if (DEBUG) debug("key: " + fields[key]);
- if (!store.indexNames.contains(fields[key]) && fields[key] != "id") {
- if (DEBUG) debug("Key not valid!" + fields[key] + ", " + JSON.stringify(store.indexNames));
- txn.abort();
- return;
- }
- }
-
- // lookup for all keys
- if (options.filterBy.length == 0) {
- if (DEBUG) debug("search in all fields!" + JSON.stringify(store.indexNames));
- for(let myIndex = 0; myIndex < store.indexNames.length; myIndex++) {
- fields = Array.concat(fields, store.indexNames[myIndex])
- }
- }
-
- // Sorting functions takes care of limit if set.
- let limit = options.sortBy === 'undefined' ? options.filterLimit : null;
-
- let filter_keys = fields.slice();
- for (let key = filter_keys.shift(); key; key = filter_keys.shift()) {
- let request;
- let substringResult = {};
- if (key == "id") {
- // store.get would return an object and not an array
- request = store.mozGetAll(options.filterValue);
- } else if (key == "category") {
- let index = store.index(key);
- request = index.mozGetAll(options.filterValue, limit);
- } else if (options.filterOp == "equals") {
- if (DEBUG) debug("Getting index: " + key);
- // case sensitive
- let index = store.index(key);
- let filterValue = options.filterValue;
- if (key == "tel") {
- filterValue = PhoneNumberUtils.normalize(filterValue,
- /*numbersOnly*/ true);
- }
- request = index.mozGetAll(filterValue, limit);
- } else if (options.filterOp == "match") {
- if (DEBUG) debug("match");
- if (key != "tel") {
- dump("ContactDB: 'match' filterOp only works on tel\n");
- return txn.abort();
- }
-
- let index = store.index("telMatch");
- let normalized = PhoneNumberUtils.normalize(options.filterValue,
- /*numbersOnly*/ true);
-
- if (!normalized.length) {
- dump("ContactDB: normalized filterValue is empty, can't perform match search.\n");
- return txn.abort();
- }
-
- // Some countries need special handling for number matching. Bug 877302
- if (this.substringMatching && normalized.length > this.substringMatching) {
- let substring = normalized.slice(-this.substringMatching);
- if (DEBUG) debug("Substring: " + substring);
-
- let substringRequest = index.mozGetAll(substring, limit);
-
- substringRequest.onsuccess = function (event) {
- if (DEBUG) debug("Request successful. Record count: " + event.target.result.length);
- for (let i in event.target.result) {
- substringResult[event.target.result[i].id] = event.target.result[i];
- }
- }.bind(this);
- } else if (normalized[0] !== "+") {
- // We might have an international prefix like '00'
- let parsed = PhoneNumberUtils.parse(normalized);
- if (parsed && parsed.internationalNumber &&
- parsed.nationalNumber &&
- parsed.nationalNumber !== normalized &&
- parsed.internationalNumber !== normalized) {
- if (DEBUG) debug("Search with " + parsed.internationalNumber);
- let prefixRequest = index.mozGetAll(parsed.internationalNumber, limit);
-
- prefixRequest.onsuccess = function (event) {
- if (DEBUG) debug("Request successful. Record count: " + event.target.result.length);
- for (let i in event.target.result) {
- substringResult[event.target.result[i].id] = event.target.result[i];
- }
- }.bind(this);
- }
- }
-
- request = index.mozGetAll(normalized, limit);
- } else {
- // XXX: "contains" should be handled separately, this is "startsWith"
- if (options.filterOp === 'contains' && key !== 'tel') {
- dump("ContactDB: 'contains' only works for 'tel'. Falling back " +
- "to 'startsWith'.\n");
- }
- // not case sensitive
- let lowerCase = options.filterValue.toString().toLowerCase();
- if (key === "tel") {
- let origLength = lowerCase.length;
- let tmp = PhoneNumberUtils.normalize(lowerCase, /*numbersOnly*/ true);
- if (tmp.length != origLength) {
- let NON_SEARCHABLE_CHARS = /[^#+\*\d\s()-]/;
- // e.g. number "123". find with "(123)" but not with "123a"
- if (tmp === "" || NON_SEARCHABLE_CHARS.test(lowerCase)) {
- if (DEBUG) debug("Call continue!");
- continue;
- }
- lowerCase = tmp;
- }
- }
- if (DEBUG) debug("lowerCase: " + lowerCase);
- let range = IDBKeyRange.bound(lowerCase, lowerCase + "\uFFFF");
- let index = store.index(key + "LowerCase");
- request = index.mozGetAll(range, limit);
- }
- if (!txn.result)
- txn.result = {};
-
- request.onsuccess = function (event) {
- if (DEBUG) debug("Request successful. Record count: " + event.target.result.length);
- if (Object.keys(substringResult).length > 0) {
- for (let attrname in substringResult) {
- event.target.result[attrname] = substringResult[attrname];
- }
- }
- this.sortResults(event.target.result, options);
- for (let i in event.target.result)
- txn.result[event.target.result[i].id] = exportContact(event.target.result[i]);
- }.bind(this);
- }
- },
-
- _findAll: function _findAll(txn, store, options) {
- if (DEBUG) debug("ContactDB:_findAll: " + JSON.stringify(options));
- if (!txn.result)
- txn.result = {};
- // Sorting functions takes care of limit if set.
- let limit = options.sortBy === 'undefined' ? options.filterLimit : null;
- store.mozGetAll(null, limit).onsuccess = function (event) {
- if (DEBUG) debug("Request successful. Record count:" + event.target.result.length);
- this.sortResults(event.target.result, options);
- for (let i in event.target.result) {
- txn.result[event.target.result[i].id] = exportContact(event.target.result[i]);
- }
- }.bind(this);
- },
-
- // Enable special phone number substring matching. Does not update existing DB entries.
- enableSubstringMatching: function enableSubstringMatching(aDigits) {
- if (DEBUG) debug("MCC enabling substring matching " + aDigits);
- this.substringMatching = aDigits;
- },
-
- disableSubstringMatching: function disableSubstringMatching() {
- if (DEBUG) debug("MCC disabling substring matching");
- delete this.substringMatching;
- },
-
- init: function init() {
- this.initDBHelper(DB_NAME, DB_VERSION, [STORE_NAME, SAVED_GETALL_STORE_NAME, REVISION_STORE]);
- }
-};
deleted file mode 100644
--- a/dom/contacts/fallback/ContactService.jsm
+++ /dev/null
@@ -1,266 +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/. */
-
-"use strict";
-
-const DEBUG = false;
-function debug(s) { dump("-*- Fallback ContactService component: " + s + "\n"); }
-
-const Cu = Components.utils;
-const Cc = Components.classes;
-const Ci = Components.interfaces;
-
-this.EXPORTED_SYMBOLS = ["ContactService"];
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-XPCOMUtils.defineLazyModuleGetter(this, "ContactDB",
- "resource://gre/modules/ContactDB.jsm");
-XPCOMUtils.defineLazyModuleGetter(this, "PhoneNumberUtils",
- "resource://gre/modules/PhoneNumberUtils.jsm");
-
-XPCOMUtils.defineLazyServiceGetter(this, "ppmm",
- "@mozilla.org/parentprocessmessagemanager;1",
- "nsIMessageListenerManager");
-
-
-/* all exported symbols need to be bound to this on B2G - Bug 961777 */
-var ContactService = this.ContactService = {
- init: function() {
- if (DEBUG) debug("Init");
- this._messages = ["Contacts:Find", "Contacts:GetAll", "Contacts:GetAll:SendNow",
- "Contacts:Clear", "Contact:Save",
- "Contact:Remove", "Contacts:RegisterForMessages",
- "child-process-shutdown", "Contacts:GetRevision",
- "Contacts:GetCount"];
- this._children = [];
- this._cursors = new Map();
- this._messages.forEach(function(msgName) {
- ppmm.addMessageListener(msgName, this);
- }.bind(this));
-
- this._db = new ContactDB();
- this._db.init();
-
- this.configureSubstringMatching();
-
- Services.obs.addObserver(this, "profile-before-change", false);
- Services.prefs.addObserver("ril.lastKnownSimMcc", this, false);
- },
-
- observe: function(aSubject, aTopic, aData) {
- if (aTopic === 'profile-before-change') {
- this._messages.forEach(function(msgName) {
- ppmm.removeMessageListener(msgName, this);
- }.bind(this));
- Services.obs.removeObserver(this, "profile-before-change");
- Services.prefs.removeObserver("dom.phonenumber.substringmatching", this);
- ppmm = null;
- this._messages = null;
- if (this._db)
- this._db.close();
- this._db = null;
- this._children = null;
- this._cursors = null;
- } else if (aTopic === 'nsPref:changed' && aData === "ril.lastKnownSimMcc") {
- this.configureSubstringMatching();
- }
- },
-
- configureSubstringMatching: function() {
- let countryName = PhoneNumberUtils.getCountryName();
- if (Services.prefs.getPrefType("dom.phonenumber.substringmatching." + countryName) == Ci.nsIPrefBranch.PREF_INT) {
- let val = Services.prefs.getIntPref("dom.phonenumber.substringmatching." + countryName);
- if (val) {
- this._db.enableSubstringMatching(val);
- return;
- }
- }
- // if we got here, we dont have a substring setting
- // for this country, so disable substring matching
- this._db.disableSubstringMatching();
- },
-
- assertPermission: function(aMessage, aPerm) {
- if (!aMessage.target.assertPermission(aPerm)) {
- Cu.reportError("Contacts message " + aMessage.name +
- " from a content process with no" + aPerm + " privileges.");
- return false;
- }
- return true;
- },
-
- broadcastMessage: function broadcastMessage(aMsgName, aContent) {
- this._children.forEach(function(msgMgr) {
- msgMgr.sendAsyncMessage(aMsgName, aContent);
- });
- },
-
- receiveMessage: function(aMessage) {
- if (DEBUG) debug("receiveMessage " + aMessage.name);
- let mm = aMessage.target;
- let msg = aMessage.data;
- let cursorList;
-
- switch (aMessage.name) {
- case "Contacts:Find":
- if (!this.assertPermission(aMessage, "contacts-read")) {
- return null;
- }
- let result = [];
- this._db.find(
- function(contacts) {
- for (let i in contacts) {
- result.push(contacts[i]);
- }
-
- if (DEBUG) debug("result:" + JSON.stringify(result));
- mm.sendAsyncMessage("Contacts:Find:Return:OK", {requestID: msg.requestID, contacts: result});
- }.bind(this),
- function(aErrorMsg) { mm.sendAsyncMessage("Contacts:Find:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg }); }.bind(this),
- msg.options.findOptions);
- break;
- case "Contacts:GetAll":
- if (!this.assertPermission(aMessage, "contacts-read")) {
- return null;
- }
- cursorList = this._cursors.get(mm);
- if (!cursorList) {
- cursorList = [];
- this._cursors.set(mm, cursorList);
- }
- cursorList.push(msg.cursorId);
-
- this._db.getAll(
- function(aContacts) {
- try {
- mm.sendAsyncMessage("Contacts:GetAll:Next", {cursorId: msg.cursorId, contacts: aContacts});
- if (aContacts === null) {
- let cursorList = this._cursors.get(mm);
- let index = cursorList.indexOf(msg.cursorId);
- cursorList.splice(index, 1);
- }
- } catch (e) {
- if (DEBUG) debug("Child is dead, DB should stop sending contacts");
- throw e;
- }
- }.bind(this),
- function(aErrorMsg) { mm.sendAsyncMessage("Contacts:GetAll:Return:KO", { requestID: msg.cursorId, errorMsg: aErrorMsg }); },
- msg.findOptions, msg.cursorId);
- break;
- case "Contacts:GetAll:SendNow":
- // sendNow is a no op if there isn't an existing cursor in the DB, so we
- // don't need to assert the permission again.
- this._db.sendNow(msg.cursorId);
- break;
- case "Contact:Save":
- if (msg.options.reason === "create") {
- if (!this.assertPermission(aMessage, "contacts-create")) {
- return null;
- }
- } else {
- if (!this.assertPermission(aMessage, "contacts-write")) {
- return null;
- }
- }
- this._db.saveContact(
- msg.options.contact,
- function() {
- mm.sendAsyncMessage("Contact:Save:Return:OK", { requestID: msg.requestID, contactID: msg.options.contact.id });
- this.broadcastMessage("Contact:Changed", { contactID: msg.options.contact.id, reason: msg.options.reason });
- }.bind(this),
- function(aErrorMsg) { mm.sendAsyncMessage("Contact:Save:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg }); }.bind(this)
- );
- break;
- case "Contact:Remove":
- if (!this.assertPermission(aMessage, "contacts-write")) {
- return null;
- }
- this._db.removeContact(
- msg.options.id,
- function() {
- mm.sendAsyncMessage("Contact:Remove:Return:OK", { requestID: msg.requestID, contactID: msg.options.id });
- this.broadcastMessage("Contact:Changed", { contactID: msg.options.id, reason: "remove" });
- }.bind(this),
- function(aErrorMsg) { mm.sendAsyncMessage("Contact:Remove:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg }); }.bind(this)
- );
- break;
- case "Contacts:Clear":
- if (!this.assertPermission(aMessage, "contacts-write")) {
- return null;
- }
- this._db.clear(
- function() {
- mm.sendAsyncMessage("Contacts:Clear:Return:OK", { requestID: msg.requestID });
- this.broadcastMessage("Contact:Changed", { reason: "remove" });
- }.bind(this),
- function(aErrorMsg) {
- mm.sendAsyncMessage("Contacts:Clear:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg });
- }.bind(this)
- );
- break;
- case "Contacts:GetRevision":
- if (!this.assertPermission(aMessage, "contacts-read")) {
- return null;
- }
- this._db.getRevision(
- function(revision) {
- mm.sendAsyncMessage("Contacts:Revision", {
- requestID: msg.requestID,
- revision: revision
- });
- },
- function(aErrorMsg) {
- mm.sendAsyncMessage("Contacts:GetRevision:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg });
- }.bind(this)
- );
- break;
- case "Contacts:GetCount":
- if (!this.assertPermission(aMessage, "contacts-read")) {
- return null;
- }
- this._db.getCount(
- function(count) {
- mm.sendAsyncMessage("Contacts:Count", {
- requestID: msg.requestID,
- count: count
- });
- },
- function(aErrorMsg) {
- mm.sendAsyncMessage("Contacts:Count:Return:KO", { requestID: msg.requestID, errorMsg: aErrorMsg });
- }.bind(this)
- );
- break;
- case "Contacts:RegisterForMessages":
- if (!aMessage.target.assertPermission("contacts-read")) {
- return null;
- }
- if (DEBUG) debug("Register!");
- if (this._children.indexOf(mm) == -1) {
- this._children.push(mm);
- }
- break;
- case "child-process-shutdown":
- if (DEBUG) debug("Unregister");
- let index = this._children.indexOf(mm);
- if (index != -1) {
- if (DEBUG) debug("Unregister index: " + index);
- this._children.splice(index, 1);
- }
- cursorList = this._cursors.get(mm);
- if (cursorList) {
- for (let id of cursorList) {
- this._db.clearDispatcher(id);
- }
- this._cursors.delete(mm);
- }
- break;
- default:
- if (DEBUG) debug("WRONG MESSAGE NAME: " + aMessage.name);
- }
- }
-}
-
-ContactService.init();
deleted file mode 100644
--- a/dom/contacts/moz.build
+++ /dev/null
@@ -1,20 +0,0 @@
-# -*- Mode: python; 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/.
-
-# Disable the tests on Android for now (bug 927869)
-if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'android':
- MOCHITEST_MANIFESTS += ['tests/mochitest.ini']
- MOCHITEST_CHROME_MANIFESTS += ['tests/chrome.ini']
-
-EXTRA_COMPONENTS += [
- 'ContactManager.js',
- 'ContactManager.manifest',
-]
-
-EXTRA_JS_MODULES += [
- 'fallback/ContactDB.jsm',
- 'fallback/ContactService.jsm'
-]
deleted file mode 100644
--- a/dom/contacts/tests/chrome.ini
+++ /dev/null
@@ -1,44 +0,0 @@
-[DEFAULT]
-skip-if = toolkit == 'android' # Bug 1287455: takes too long to complete on Android
-support-files =
- shared.js
- file_contacts_basics.html
- file_contacts_basics2.html
- file_contacts_blobs.html
- file_contacts_events.html
- file_contacts_getall.html
- file_contacts_getall2.html
- file_contacts_international.html
- file_contacts_substringmatching.html
- file_contacts_substringmatchingVE.html
- file_contacts_substringmatchingCL.html
- test_migration_chrome.js
- file_migration.html
-
-# renaming with "_a_" to execure before others, since we hardcode open of
-# database and this messes up with mozContacts when done after mozContacts
-# did opened the database. those should really be xpcshell and not chrome
-# mochitests maybe ...
-[test_contacts_a_shutdown.xul]
-skip-if = buildapp == 'b2g'
-[test_contacts_a_upgrade.xul]
-skip-if = buildapp == 'b2g'
-[test_contacts_a_cache.xul]
-skip-if = buildapp == 'b2g'
-[test_contacts_basics.html]
-skip-if = (toolkit == 'gonk' && debug) #debug-only failure
-[test_contacts_basics2.html]
-skip-if = (toolkit == 'gonk' && debug) || (os == 'win' && os_version == '5.1') #debug-only failure, bug 967258 on XP
-[test_contacts_blobs.html]
-skip-if = (toolkit == 'gonk' && debug) #debug-only failure
-[test_contacts_events.html]
-[test_contacts_getall.html]
-skip-if = (toolkit == 'gonk' && debug) #debug-only failure
-[test_contacts_getall2.html]
-skip-if = (toolkit == 'gonk' && debug) #debug-only failure
-[test_contacts_international.html]
-[test_contacts_substringmatching.html]
-[test_contacts_substringmatchingVE.html]
-[test_contacts_substringmatchingCL.html]
-[test_migration.html]
- support-files +=
deleted file mode 100644
--- a/dom/contacts/tests/file_contacts_basics.html
+++ /dev/null
@@ -1,787 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=674720
--->
-<head>
- <title>Test for Bug 674720 WebContacts</title>
- <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
- <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=674720">Mozilla Bug 674720</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script type="text/javascript;version=1.8" src="http://mochi.test:8888/tests/dom/contacts/tests/shared.js"></script>
-<script class="testbody" type="text/javascript">
-"use strict";
-
-var ok = parent.ok;
-var is = parent.is;
-
-var initialRev;
-
-function checkRevision(revision, msg, then) {
- var revReq = mozContacts.getRevision();
- revReq.onsuccess = function(e) {
- is(e.target.result, initialRev+revision, msg);
- then();
- };
- // The revision function isn't supported on Android so treat on failure as success
- if (isAndroid) {
- revReq.onerror = function(e) {
- then();
- };
- } else {
- revReq.onerror = onFailure;
- }
-}
-
-var req;
-
-var steps = [
- function() {
- req = mozContacts.getRevision();
- req.onsuccess = function(e) {
- initialRev = e.target.result;
- next();
- };
-
- // Android does not support the revision function. Treat errors as success.
- if (isAndroid) {
- req.onerror = function(e) {
- initialRev = 0;
- next();
- };
- } else {
- req.onerror = onFailure;
- }
- },
- function () {
- ok(true, "Deleting database");
- checkRevision(0, "Initial revision is 0", function() {
- req = mozContacts.clear();
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- checkCount(0, "No contacts after clear", function() {
- checkRevision(1, "Revision was incremented on clear", next);
- });
- };
- req.onerror = onFailure;
- });
- },
- function () {
- ok(true, "Retrieving all contacts");
- req = mozContacts.find(defaultOptions);
- req.onsuccess = function () {
- is(req.result.length, 0, "Empty database.");
- checkRevision(1, "Revision was not incremented on find", next);
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding empty contact");
- createResult1 = new mozContact({});
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- checkCount(1, "1 contact after adding empty contact", function() {
- checkRevision(2, "Revision was incremented on save", next);
- });
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts");
- req = mozContacts.find(defaultOptions);
- req.onsuccess = function () {
- is(req.result.length, 1, "One contact.");
- findResult1 = req.result[0];
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting empty contact");
- req = navigator.mozContacts.remove(findResult1);
- req.onsuccess = function () {
- var req2 = mozContacts.find(defaultOptions);
- req2.onsuccess = function () {
- is(req2.result.length, 0, "Empty Database.");
- clearTemps();
- checkRevision(3, "Revision was incremented on remove", next);
- }
- req2.onerror = onFailure;
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding a new contact1");
- createResult1 = new mozContact(properties1);
-
- mozContacts.oncontactchange = function(event) {
- is(event.contactID, createResult1.id, "Same contactID");
- is(event.reason, "create", "Same reason");
- next();
- }
-
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- checkContacts(createResult1, properties1);
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 1");
- var options = {filterBy: ["givenName"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[1].substring(0,3)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, properties1);
- // Some manual testing. Testint the testfunctions
- // tel: [{type: ["work"], value: "123456", carrier: "testCarrier"} , {type: ["home", "fax"], value: "+55 (31) 9876-3456"}],
- is(findResult1.tel[0].carrier, "testCarrier", "Same Carrier");
- is(String(findResult1.tel[0].type), "work", "Same type");
- is(findResult1.tel[0].value, "123456", "Same Value");
- is(findResult1.tel[1].type[1], "fax", "Same type");
- is(findResult1.tel[1].value, "+55 (31) 9876-3456", "Same Value");
-
- is(findResult1.adr[0].countryName, "country 1", "Same country");
-
- // email: [{type: ["work"], value: "x@y.com"}]
- is(String(findResult1.email[0].type), "work", "Same Type");
- is(findResult1.email[0].value, "x@y.com", "Same Value");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching for exact email");
- var options = {filterBy: ["email"],
- filterOp: "equals",
- filterValue: properties1.email[0].value};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(findResult1, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring and update");
- mozContacts.oncontactchange = function(event) {
- is(event.contactID, findResult1.id, "Same contactID");
- is(event.reason, "update", "Same reason");
- }
- var options = {filterBy: ["givenName"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[0].substring(0,3)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- findResult1.jobTitle = ["new Job"];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding a new contact");
- mozContacts.oncontactchange = function(event) {
- is(event.contactID, createResult2.id, "Same contactID");
- is(event.reason, "create", "Same reason");
- }
- createResult2 = new mozContact({name: ["newName"]});
- req = navigator.mozContacts.save(createResult2);
- req.onsuccess = function () {
- ok(createResult2.id, "The contact now has an ID.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 2");
- var options = {filterBy: ["givenName"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[0].substring(0,3)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- checkContacts(createResult1, findResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function() {
- ok(true, "Retrieving by name equality 1");
- var options = {filterBy: ["name"],
- filterOp: "equals",
- filterValue: properties1.name[0]};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- checkContacts(createResult1, findResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function() {
- ok(true, "Retrieving by name equality 2");
- var options = {filterBy: ["name"],
- filterOp: "equals",
- filterValue: properties1.name[1]};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- checkContacts(createResult1, findResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function() {
- ok(true, "Retrieving by name substring 1");
- var options = {filterBy: ["name"],
- filterOp: "startsWith",
- filterValue: properties1.name[0].substring(0,3).toLowerCase()};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- checkContacts(createResult1, findResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function() {
- ok(true, "Retrieving by name substring 2");
- var options = {filterBy: ["name"],
- filterOp: "startsWith",
- filterValue: properties1.name[1].substring(0,3).toLowerCase()};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- checkContacts(createResult1, findResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Remove contact1");
- mozContacts.oncontactchange = function(event) {
- is(event.contactID, createResult1.id, "Same contactID");
- is(event.reason, "remove", "Same reason");
- }
- req = navigator.mozContacts.remove(createResult1);
- req.onsuccess = function () {
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 3");
- var options = {filterBy: ["givenName"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[1].substring(0,3)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 0, "Found no contact.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Remove contact2");
- mozContacts.oncontactchange = function(event) {
- is(event.contactID, createResult2.id, "Same contactID");
- is(event.reason, "remove", "Same reason");
- }
- req = navigator.mozContacts.remove(createResult2);
- req.onsuccess = function () {
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 4");
- var options = {filterBy: ["givenName"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[1].substring(0,3)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 0, "Found no contact.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- mozContacts.oncontactchange = function(event) {
- is(event.contactID, "undefined", "Same contactID");
- is(event.reason, "remove", "Same reason");
- }
- req = mozContacts.clear();
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding a new contact with properties1");
- createResult1 = new mozContact(properties1);
- mozContacts.oncontactchange = null;
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- checkContacts(createResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring tel1");
- var options = {filterBy: ["tel"],
- filterOp: "contains",
- filterValue: properties1.tel[1].value.substring(2,5)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by tel exact");
- var options = {filterBy: ["tel"],
- filterOp: "equals",
- filterValue: "+55 319 8 7 6 3456"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by tel exact with substring");
- var options = {filterBy: ["tel"],
- filterOp: "equals",
- filterValue: "3456"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 0, "Found no contacts.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by tel exact with substring");
- var options = {filterBy: ["tel"],
- filterOp: "equals",
- filterValue: "+55 (31)"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 0, "Found no contacts.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by tel match national number");
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: "3198763456"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by tel match national format");
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: "0451 491934"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by tel match entered number");
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: "123456"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by tel match international number");
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: "+55 31 98763456"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by match with field other than tel");
- var options = {filterBy: ["givenName"],
- filterOp: "match",
- filterValue: "my friends call me 555-4040"};
- req = mozContacts.find(options);
- req.onsuccess = onUnwantedSuccess;
- req.onerror = function() {
- ok(true, "Failed");
- next();
- }
- },
- function () {
- ok(true, "Retrieving by substring tel2");
- var options = {filterBy: ["tel"],
- filterOp: "startsWith",
- filterValue: "9876"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring tel3");
- var options = {filterBy: ["tel"],
- filterOp: "startsWith",
- filterValue: "98763456"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 5");
- var options = {filterBy: ["givenName"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[0].substring(0,3)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 6");
- var options = {filterBy: ["familyName", "givenName"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[0].substring(0,3)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring3, Testing multi entry");
- var options = {filterBy: ["givenName", "familyName"],
- filterOp: "startsWith",
- filterValue: properties1.familyName[1].substring(0,3).toLowerCase()};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts");
- req = mozContacts.find(defaultOptions);
- req.onsuccess = function() {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(createResult1, findResult1);
- if (!isAndroid) {
- ok(findResult1.updated, "Has updated field");
- ok(findResult1.published, "Has published field");
- }
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Modifying contact1");
- if (!findResult1) {
- SpecialPowers.executeSoon(next);
- } else {
- findResult1.impp = properties1.impp = [{value:"phil impp"}];
- req = navigator.mozContacts.save(findResult1);
- req.onsuccess = function () {
- var req2 = mozContacts.find(defaultOptions);
- req2.onsuccess = function() {
- is(req2.result.length, 1, "Found exactly 1 contact.");
- findResult2 = req2.result[0];
- ok(findResult2.id == sample_id1, "Same ID");
- checkContacts(findResult2, properties1);
- is(findResult2.impp.length, 1, "Found exactly 1 IMS info.");
- next();
- };
- req2.onerror = onFailure;
- };
- req.onerror = onFailure;
- }
- },
- function() {
- // Android does not support published/updated fields. Skip this.
- if (isAndroid) {
- next();
- return;
- }
-
- ok(true, "Saving old contact, should abort!");
- req = mozContacts.save(createResult1);
- req.onsuccess = onUnwantedSuccess;
- req.onerror = function() { ok(true, "Successfully declined updating old contact!"); next(); };
- },
- function () {
- ok(true, "Retrieving a specific contact by ID");
- var options = {filterBy: ["id"],
- filterOp: "equals",
- filterValue: sample_id1};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(findResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving a specific contact by givenName");
- var options = {filterBy: ["givenName"],
- filterOp: "equals",
- filterValue: properties1.givenName[0]};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(findResult1, properties1);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Modifying contact2");
- if (!findResult1) {
- SpecialPowers.executeSoon(next);
- } else {
- findResult1.impp = properties1.impp = [{value: "phil impp"}];
- req = mozContacts.save(findResult1);
- req.onsuccess = function () {
- var req2 = mozContacts.find(defaultOptions);
- req2.onsuccess = function () {
- is(req2.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req2.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(findResult1, properties1);
- is(findResult1.impp.length, 1, "Found exactly 1 IMS info.");
- next();
- }
- req2.onerror = onFailure;
- };
- req.onerror = onFailure;
- }
- },
- function () {
- ok(true, "Searching contacts by query");
- var options = {filterBy: ["givenName", "email"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[0].substring(0,4)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(findResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching contacts by query");
- var options = {filterBy: ["givenName", "email"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[0]};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(findResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching contacts with multiple indices");
- var options = {filterBy: ["email", "givenName"],
- filterOp: "equals",
- filterValue: properties1.givenName[1]};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(findResult1, properties1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Modifying contact3");
- if (!findResult1) {
- SpecialPowers.executeSoon(next);
- } else {
- findResult1.email = [{value: properties1.nickname}];
- findResult1.nickname = ["TEST"];
- var newContact = new mozContact(findResult1);
- req = mozContacts.save(newContact);
- req.onsuccess = function () {
- var options = {filterBy: ["email", "givenName"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[0]};
- // One contact has it in nickname and the other in email
- var req2 = mozContacts.find(options);
- req2.onsuccess = function () {
- is(req2.result.length, 2, "Found exactly 2 contacts.");
- ok(req2.result[0].id != req2.result[1].id, "Different ID");
- next();
- }
- req2.onerror = onFailure;
- };
- req.onerror = onFailure;
- }
- },
- function () {
- ok(true, "Deleting contact" + findResult1);
- req = mozContacts.remove(findResult1);
- req.onsuccess = function () {
- var req2 = mozContacts.find(defaultOptions);
- req2.onsuccess = function () {
- is(req2.result.length, 1, "One contact left.");
- findResult1 = req2.result[0];
- next();
- }
- req2.onerror = onFailure;
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.remove(findResult1);
- req.onsuccess = function () {
- clearTemps();
- next();
- };
- req.onerror = onFailure;
- },
- function() {
- ok(true, "Test JSON.stringify output for mozContact objects");
- var json = JSON.parse(JSON.stringify(new mozContact(properties1)));
- checkContacts(json, properties1);
- next();
- },
- function() {
- ok(true, "Test slice");
- var c = new mozContact();
- c.email = [{ type: ["foo"], value: "bar@baz" }]
- var arr = c.email;
- is(arr[0].value, "bar@baz", "Should have the right value");
- arr = arr.slice();
- is(arr[0].value, "bar@baz", "Should have the right value after slicing");
- next();
- },
- function () {
- ok(true, "all done!\n");
- clearTemps();
-
- parent.SimpleTest.finish();
- }
-];
-
-start_tests();
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/file_contacts_basics2.html
+++ /dev/null
@@ -1,1153 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=674720
--->
-<head>
- <title>Test for Bug 674720 WebContacts</title>
- <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
- <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=674720">Mozilla Bug 674720</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script type="text/javascript;version=1.8" src="http://mochi.test:8888/tests/dom/contacts/tests/shared.js"></script>
-<script class="testbody" type="text/javascript">
-"use strict";
-
-var ok = parent.ok;
-var is = parent.is;
-var isnot = parent.isnot;
-
-var req;
-
-var steps = [
- function () {
- ok(true, "Adding a new contact");
- createResult1 = new mozContact(properties1);
- req = mozContacts.save(createResult1)
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding a new contact2");
- createResult2 = new mozContact(properties2);
- req = mozContacts.save(createResult2);
- req.onsuccess = function () {
- ok(createResult2.id, "The contact now has an ID.");
- sample_id2 = createResult2.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts");
- req = mozContacts.find({sortBy: "familyName"});
- req.onsuccess = function () {
- is(req.result.length, 2, "Found exactly 2 contact.");
- checkContacts(req.result[1], properties1);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- console.log("Searching contacts by query1");
- var options = {filterBy: ["givenName", "email"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[0].substring(0, 4)}
- req = mozContacts.find(options)
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(findResult1, createResult1);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching contacts by query2");
- var options = {filterBy: ["givenName", "email"],
- filterOp: "startsWith",
- filterValue: properties2.givenName[0].substring(0, 4)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- is(findResult1.adr.length, 2, "Adr length 2");
- checkContacts(findResult1, createResult2);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching contacts by tel");
- var options = {filterBy: ["tel"],
- filterOp: "contains",
- filterValue: properties2.tel[0].value.substring(3, 7)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id2, "Same ID");
- checkContacts(findResult1, createResult2);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching contacts by email");
- var options = {filterBy: ["email"],
- filterOp: "startsWith",
- filterValue: properties2.email[0].value.substring(0, 4)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id2, "Same ID");
- checkContacts(findResult1, createResult2);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear();
- req.onsuccess = function () {
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding 20 contacts");
- for (var i=0; i<19; i++) {
- createResult1 = new mozContact(properties1);
- req = mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- };
- req.onerror = onFailure;
- };
- createResult1 = new mozContact(properties1);
- req = mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkStrArray(createResult1.name, properties1.name, "Same Name");
- checkCount(20, "20 contacts in DB", next);
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts");
- req = mozContacts.find(defaultOptions);
- req.onsuccess = function () {
- is(req.result.length, 20, "20 Entries.");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts with limit 10");
- var options = { filterLimit: 10 };
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 10, "10 Entries.");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts with limit 10 and sorted");
- var options = { filterLimit: 10,
- sortBy: 'FamilyName',
- sortOrder: 'descending' };
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 10, "10 Entries.");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts2");
- var options = {filterBy: ["givenName"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[0].substring(0, 4)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 20, "20 Entries.");
- checkContacts(createResult1, req.result[19]);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts3");
- var options = {filterBy: ["givenName", "tel", "email"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[0].substring(0, 4)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 20, "20 Entries.");
- checkContacts(createResult1, req.result[10]);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear();
- req.onsuccess = function () {
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Testing clone contact");
- createResult1 = new mozContact(properties1);
- req = mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkStrArray(createResult1.name, properties1.name, "Same Name");
- next();
- }
- req.onerror = onFailure;
- },
- function() {
- ok(true, "Testing clone contact2");
- var cloned = new mozContact(createResult1);
- ok(cloned.id != createResult1.id, "Cloned contact has new ID");
- cloned.email = [{value: "new email!"}];
- cloned.givenName = ["Tom"];
- req = mozContacts.save(cloned);
- req.onsuccess = function () {
- ok(cloned.id, "The contact now has an ID.");
- is(cloned.email[0].value, "new email!", "Same Email");
- isnot(createResult1.email[0].value, cloned.email[0].value, "Clone has different email");
- is(String(cloned.givenName), "Tom", "New Name");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts");
- var options = {filterBy: ["givenName"],
- filterOp: "startsWith",
- filterValue: properties2.givenName[0].substring(0, 4)};
- req = mozContacts.find(defaultOptions);
- req.onsuccess = function () {
- is(req.result.length, 2, "2 Entries.");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Search with redundant fields should only return 1 contact");
- createResult1 = new mozContact({name: ["XXX"],
- givenName: ["XXX"],
- email: [{value: "XXX"}],
- tel: [{value: "XXX"}]
- });
- req = mozContacts.save(createResult1);
- req.onsuccess = function() {
- var options = {filterBy: ["givenName", "familyName"],
- filterOp: "equals",
- filterValue: "XXX"};
- var req2 = mozContacts.find(options);
- req2.onsuccess = function() {
- is(req2.result.length, 1, "1 Entry");
- next();
- }
- req2.onerror = onFailure;
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear()
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c3);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c3, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c2);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c2, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c4);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c4, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c1);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c1, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- var options = {sortBy: "familyName",
- sortOrder: "ascending"};
- req = navigator.mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 4, "4 results");
- checkContacts(req.result[0], c1);
- checkContacts(req.result[1], c2);
- checkContacts(req.result[2], c3);
- checkContacts(req.result[3], c4);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- var options = {sortBy: "familyName",
- sortOrder: "descending"};
- req = navigator.mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 4, "4 results");
- checkContacts(req.result[0], c4);
- checkContacts(req.result[1], c3);
- checkContacts(req.result[2], c2);
- checkContacts(req.result[3], c1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c5);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c5, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting with empty string");
- var options = {sortBy: "familyName",
- sortOrder: "ascending"};
- req = navigator.mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 5, "5 results");
- checkContacts(req.result[0], c5);
- checkContacts(req.result[1], c1);
- checkContacts(req.result[2], c2);
- checkContacts(req.result[3], c3);
- checkContacts(req.result[4], c4);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Don't allow to add custom fields");
- createResult1 = new mozContact({givenName: ["customTest"], yyy: "XXX"});
- req = mozContacts.save(createResult1);
- req.onsuccess = function() {
- var options = {filterBy: ["givenName"],
- filterOp: "equals",
- filterValue: "customTest"};
- var req2 = mozContacts.find(options);
- req2.onsuccess = function() {
- is(req2.result.length, 1, "1 Entry");
- checkStrArray(req2.result[0].givenName, ["customTest"], "same name");
- ok(req2.result.yyy === undefined, "custom property undefined");
- next();
- }
- req2.onerror = onFailure;
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear()
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c7);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c7, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c6);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c6, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c8);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c8, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- // Android does not support published/updated fields. Skip this.
- if (isAndroid) {
- next();
- return;
- }
-
- ok(true, "Test sorting with published");
- var options = {sortBy: "familyName",
- sortOrder: "descending"};
- req = navigator.mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 3, "3 results");
- ok(req.result[0].published < req.result[1].published, "Right sorting order");
- ok(req.result[1].published < req.result[2].published, "Right sorting order");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear();
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding a new contact with properties2");
- createResult2 = new mozContact(properties2);
- req = mozContacts.save(createResult2);
- req.onsuccess = function () {
- ok(createResult2.id, "The contact now has an ID.");
- sample_id2 = createResult2.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test category search with startsWith");
- var options = {filterBy: ["category"],
- filterOp: "startsWith",
- filterValue: properties2.category[0]};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "1 Entry.");
- checkContacts(req.result[0], createResult2);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test category search with equals");
- var options = {filterBy: ["category"],
- filterOp: "equals",
- filterValue: properties2.category[0]};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "1 Entry.");
- checkContacts(req.result[0], createResult2);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear()
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding contact for category search");
- createResult1 = new mozContact({name: ["5"], givenName: ["5"]});
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test category search with equals");
- var options = {filterBy: ["givenName"],
- filterOp: "startsWith",
- filterValue: "5"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "1 Entry.");
- checkContacts(req.result[0], createResult1);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear()
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding contact with invalid data");
- var obj = {
- honorificPrefix: [],
- honorificSuffix: [{foo: "bar"}],
- sex: 17,
- genderIdentity: 18,
- email: [{type: ["foo"], value: "bar"}]
- };
- obj.honorificPrefix.__defineGetter__('0',(function() {
- var c = 0;
- return function() {
- if (c == 0) {
- c++;
- return "string";
- } else {
- return {foo:"bar"};
- }
- }
- })());
- createResult1 = new mozContact(obj);
- createResult1.email.push({aeiou: "abcde"});
- req = mozContacts.save(createResult1);
- req.onsuccess = function () {
- checkContacts(createResult1, {
- honorificPrefix: ["string"],
- honorificSuffix: ["[object Object]"],
- sex: "17",
- genderIdentity: "18",
- email: [{type: ["foo"], value: "bar"}, {}]
- });
- next();
- };
- },
- function () {
- ok(true, "Adding contact with no number but carrier");
- createResult1 = new mozContact({ tel: [{type: ["home"], carrier: "myCarrier"} ] });
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding contact with email but no value");
- createResult1 = new mozContact({ email: [{type: ["home"]}] });
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Testing numbersOnly search 1");
- createResult1 = new mozContact({ name: ["aaaaaaaaa"], givenName: ["aaaaaaaaa"], tel: [{ value: "1234567890"}]});
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test numbersOnly search 2");
- var options = {filterBy: ["givenName", "tel"],
- filterOp: "contains",
- filterValue: "a"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- ok(req.result.length == 1, "1 Entry.");
- checkContacts(req.result[0], createResult1);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test numbersOnly search 3");
- var options = {filterBy: ["givenName", "tel"],
- filterOp: "contains",
- filterValue: "b"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- ok(req.result.length == 0, "0 Entries.");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test numbersOnly search 4");
- var options = {filterBy: ["givenName", "tel"],
- filterOp: "contains",
- filterValue: "1a"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- ok(req.result.length == 0, "0 Entries.");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test numbersOnly search 5");
- var options = {filterBy: ["givenName", "tel"],
- filterOp: "contains",
- filterValue: "1(23)"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- ok(req.result.length == 1, "1 Entry.");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test numbersOnly search 6");
- var options = {filterBy: ["givenName", "tel"],
- filterOp: "contains",
- filterValue: "1(23)a"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- ok(req.result.length == 0, "0 Entries.");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear()
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function() {
- ok(true, "Test that after setting array properties to scalar values the property os not a non-array")
- const FIELDS = ["email","url","adr","tel","impp"];
- createResult1 = new mozContact();
- for (var prop of FIELDS) {
- try {
- createResult1[prop] = {type: ["foo"]};
- } catch (e) {}
- ok(createResult1[prop] === null ||
- Array.isArray(createResult1[prop]), prop + " is array");
- }
- next();
- },
- function() {
- ok(true, "Undefined properties of fields should be treated correctly");
- var c = new mozContact({
- adr: [{streetAddress: undefined}],
- email: [{value: undefined}],
- url: [{value: undefined}],
- impp: [{value: undefined}],
- tel: [{value: undefined}],
- });
- is(c.adr[0].streetAddress, undefined, "adr.streetAddress is undefined");
- is(c.adr[0].locality, undefined, "adr.locality is undefined");
- is(c.adr[0].pref, undefined, "adr.pref is undefined");
- is(c.email[0].value, undefined, "email.value is undefined");
- is(c.url[0].value, undefined, "url.value is undefined");
- is(c.impp[0].value, undefined, "impp.value is undefined");
- is(c.tel[0].value, undefined, "tel.value is undefined");
- next();
- },
- function() {
- ok(true, "Setting array properties to an empty array should work");
- var c = new mozContact();
- function testArrayProp(prop) {
- is(c[prop], null, "property is initially null");
- c[prop] = [];
- ok(Array.isArray(c[prop]), "property is an array after setting");
- is(c[prop].length, 0, "property has length 0 after setting");
- }
- testArrayProp("email");
- testArrayProp("adr");
- testArrayProp("tel");
- testArrayProp("impp");
- testArrayProp("url");
- next();
- },
- function() {
- ok(true, "Passing a mozContact with invalid data to save() should throw");
- var c = new mozContact({
- photo: [],
- tel: []
- });
- c.photo.push({});
- SimpleTest.doesThrow(()=>navigator.mozContacts.save(c), "Invalid data in Blob array");
- c.tel.push(123);
- SimpleTest.doesThrow(()=>navigator.mozContacts.save(c), "Invalid data in dictionary array");
- next();
- },
- function() {
- ok(true, "Inline changes to array properties should be seen by save");
- var c = new mozContact({
- name: [],
- familyName: [],
- givenName: [],
- phoneticFamilyName: [],
- phoneticGivenName: [],
- nickname: [],
- tel: [],
- adr: [],
- email: []
- });
- for (var prop of Object.getOwnPropertyNames(properties1)) {
- if (!Array.isArray(properties1[prop])) {
- continue;
- }
- for (var i = 0; i < properties1[prop].length; ++i) {
- c[prop].push(properties1[prop][i]);
- }
- }
- req = navigator.mozContacts.save(c);
- req.onsuccess = function() {
- req = navigator.mozContacts.find(defaultOptions);
- req.onsuccess = function() {
- is(req.result.length, 1, "Got 1 contact");
- checkContacts(req.result[0], properties1);
- next();
- };
- req.onerror = onFailure;
- };
- req.onerror = onFailure;
- },
- clearDatabase,
- function() {
- ok(true, "mozContact.init deprecation message");
- var c = new mozContact();
- SimpleTest.monitorConsole(next, [
- { errorMessage: "mozContact.init is DEPRECATED. Use the mozContact constructor instead. " +
- "See https://developer.mozilla.org/docs/WebAPI/Contacts for details." }
- ], /* forbidUnexpectedMsgs */ true);
- c.init({name: ["Bar"]});
- c.init({name: ["Bar"]});
- SimpleTest.endMonitorConsole();
- },
- function() {
- ok(true, "mozContact.init works as expected");
- var c = new mozContact({name: ["Foo"]});
- c.init({name: ["Bar"]});
- is(c.name[0], "Bar", "Same name");
- next();
- },
- function() {
- ok(true, "mozContact.init without parameters");
- var c = new mozContact({name: ["Foo"]});
- c.init();
- next();
- },
- function() {
- ok(true, "mozContact.init resets properties");
- var c = new mozContact({jobTitle: ["Software Engineer"]});
- c.init({nickname: ["Jobless Johnny"]});
- is(c.nickname[0], "Jobless Johnny", "Same nickname");
- ok(!c.jobTitle, "jobTitle is not set");
- next();
- },
- function() {
- ok(true, "mozContacts.remove with an ID works");
- var c = new mozContact({name: ["Ephemeral Jimmy"]});
- req = navigator.mozContacts.save(c);
- req.onsuccess = function() {
- req = navigator.mozContacts.remove(c.id);
- req.onsuccess = function() {
- req = navigator.mozContacts.find({
- filterBy: ["id"],
- filterOp: "equals",
- filterValue: c.id
- });
- req.onsuccess = function() {
- is(req.result.length, 0, "Successfully removed contact by ID");
- next();
- };
- req.onerror = onFailure;
- };
- req.onerror = onFailure;
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding a new contact");
- createResult1 = new mozContact(properties3);
- req = mozContacts.save(createResult1)
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding a new contact2");
- createResult2 = new mozContact(properties4);
- req = mozContacts.save(createResult2);
- req.onsuccess = function () {
- ok(createResult2.id, "The contact now has an ID.");
- sample_id2 = createResult2.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts");
- req = mozContacts.find({sortBy: "phoneticFamilyName"});
- req.onsuccess = function () {
- is(req.result.length, 2, "Found exactly 2 contact.");
- checkContacts(req.result[1], properties3);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching contacts by query1");
- var options = {filterBy: ["phoneticGivenName", "email"],
- filterOp: "startsWith",
- filterValue: properties3.phoneticGivenName[0].substring(0, 3)}
- req = mozContacts.find(options)
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- checkContacts(findResult1, createResult1);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching contacts by query2");
- var options = {filterBy: ["phoneticGivenName", "email"],
- filterOp: "startsWith",
- filterValue: properties4.phoneticGivenName[0].substring(0, 3)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- is(findResult1.adr.length, 2, "Adr length 2");
- checkContacts(findResult1, createResult2);
- next();
- }
- req.onerror = onFailure;
- },
- clearDatabase,
- function () {
- ok(true, "Adding 20 contacts");
- for (var i=0; i<19; i++) {
- createResult1 = new mozContact(properties3);
- req = mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- };
- req.onerror = onFailure;
- };
- createResult1 = new mozContact(properties3);
- req = mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkStrArray(createResult1.name, properties3.name, "Same Name");
- checkCount(20, "20 contacts in DB", next);
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts");
- req = mozContacts.find(defaultOptions);
- req.onsuccess = function () {
- is(req.result.length, 20, "20 Entries.");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts2");
- var options = {filterBy: ["phoneticGivenName"],
- filterOp: "startsWith",
- filterValue: properties3.phoneticGivenName[0].substring(0, 3)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 20, "20 Entries.");
- checkContacts(createResult1, req.result[19]);
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts3");
- var options = {filterBy: ["phoneticGivenName", "tel", "email"],
- filterOp: "startsWith",
- filterValue: properties3.phoneticGivenName[0].substring(0, 3)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 20, "20 Entries.");
- checkContacts(createResult1, req.result[10]);
- next();
- }
- req.onerror = onFailure;
- },
- clearDatabase,
- function () {
- ok(true, "Testing clone contact");
- createResult1 = new mozContact(properties3);
- req = mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkStrArray(createResult1.phoneticFamilyName, properties3.phoneticFamilyName, "Same phoneticFamilyName");
- checkStrArray(createResult1.phoneticGivenName, properties3.phoneticGivenName, "Same phoneticGivenName");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts");
- req = mozContacts.find({sortBy: "phoneticGivenName"});
- req.onsuccess = function () {
- is(req.result.length, 1, "1 Entries.");
- next();
- }
- req.onerror = onFailure;
- },
- clearDatabase,
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c11);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c11, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c10);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c10, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c12);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c12, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c9);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c9, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- var options = {sortBy: "phoneticFamilyName",
- sortOrder: "ascending"};
- req = navigator.mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 4, "4 results");
- checkContacts(req.result[0], c9);
- checkContacts(req.result[1], c10);
- checkContacts(req.result[2], c11);
- checkContacts(req.result[3], c12);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- var options = {sortBy: "phoneticFamilyName",
- sortOrder: "descending"};
- req = navigator.mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 4, "4 results");
- checkContacts(req.result[0], c12);
- checkContacts(req.result[1], c11);
- checkContacts(req.result[2], c10);
- checkContacts(req.result[3], c9);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c13);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c13, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting with empty string");
- var options = {sortBy: "phoneticFamilyName",
- sortOrder: "ascending"};
- req = navigator.mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 5, "5 results");
- checkContacts(req.result[0], c13);
- checkContacts(req.result[1], c9);
- checkContacts(req.result[2], c10);
- checkContacts(req.result[3], c11);
- checkContacts(req.result[4], c12);
- next();
- };
- req.onerror = onFailure;
- },
- clearDatabase,
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c15);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c15, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c14);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c14, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Test sorting");
- createResult1 = new mozContact(c16);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- checkContacts(c16, createResult1);
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- // Android does not support published/updated fields. Skip this.
- if (isAndroid) {
- next();
- return;
- }
-
- ok(true, "Test sorting with published");
- var options = {sortBy: "phoneticFamilyName",
- sortOrder: "descending"};
- req = navigator.mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 3, "3 results");
- ok(req.result[0].published < req.result[1].published, "Right sorting order");
- ok(req.result[1].published < req.result[2].published, "Right sorting order");
- next();
- };
- req.onerror = onFailure;
- },
- clearDatabase,
- function () {
- ok(true, "all done!\n");
- parent.SimpleTest.finish();
- }
-];
-
-function next() {
- ok(true, "Begin!");
- if (index >= steps.length) {
- ok(false, "Shouldn't get here!");
- return;
- }
- try {
- var i = index++;
- steps[i]();
- } catch(ex) {
- ok(false, "Caught exception", ex);
- }
-}
-
-start_tests();
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/file_contacts_blobs.html
+++ /dev/null
@@ -1,226 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=674720
--->
-<head>
- <title>Test for Bug 674720 WebContacts</title>
- <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
- <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=674720">Mozilla Bug 674720</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script type="text/javascript;version=1.8" src="http://mochi.test:8888/tests/dom/contacts/tests/shared.js"></script>
-<script class="testbody" type="text/javascript">
-"use strict";
-
-var ok = parent.ok;
-var is = parent.is;
-var isnot = parent.isnot;
-
-var utils = SpecialPowers.getDOMWindowUtils(window);
-
-function getView(size)
-{
- var buffer = new ArrayBuffer(size);
- var view = new Uint8Array(buffer);
- is(buffer.byteLength, size, "Correct byte length");
- return view;
-}
-
-function getRandomView(size)
-{
- var view = getView(size);
- for (var i = 0; i < size; i++) {
- view[i] = parseInt(Math.random() * 255)
- }
- return view;
-}
-
-function getRandomBlob(size)
-{
- return new Blob([getRandomView(size)], { type: "binary/random" });
-}
-
-function compareBuffers(buffer1, buffer2)
-{
- if (buffer1.byteLength != buffer2.byteLength) {
- return false;
- }
- var view1 = new Uint8Array(buffer1);
- var view2 = new Uint8Array(buffer2);
- for (var i = 0; i < buffer1.byteLength; i++) {
- if (view1[i] != view2[i]) {
- return false;
- }
- }
- return true;
-}
-
-function verifyBuffers(buffer1, buffer2, isLast)
-{
- ok(compareBuffers(buffer1, buffer2), "Correct blob data");
- if (isLast)
- next();
-}
-
-var randomBlob = getRandomBlob(1024);
-var randomBlob2 = getRandomBlob(1024);
-
-var properties1 = {
- name: ["xTestname1"],
- givenName: ["xTestname1"],
- photo: [randomBlob]
-};
-
-var properties2 = {
- name: ["yTestname2"],
- givenName: ["yTestname2"],
- photo: [randomBlob, randomBlob2]
-};
-
-var sample_id1;
-var createResult1;
-var findResult1;
-
-function verifyBlob(blob1, blob2, isLast)
-{
- is(blob1 instanceof Blob, true,
- "blob1 is an instance of DOMBlob");
- is(blob2 instanceof Blob, true,
- "blob2 is an instance of DOMBlob");
- isnot(blob1 instanceof File, true,
- "blob1 is an instance of File");
- isnot(blob2 instanceof File, true,
- "blob2 is an instance of File");
- is(blob1.size, blob2.size, "Same size");
- is(blob1.type, blob2.type, "Same type");
-
- var buffer1;
- var buffer2;
-
- var reader1 = new FileReader();
- reader1.readAsArrayBuffer(blob2);
- reader1.onload = function(event) {
- buffer2 = event.target.result;
- if (buffer1) {
- verifyBuffers(buffer1, buffer2, isLast);
- }
- }
-
- var reader2 = new FileReader();
- reader2.readAsArrayBuffer(blob1);
- reader2.onload = function(event) {
- buffer1 = event.target.result;
- if (buffer2) {
- verifyBuffers(buffer1, buffer2, isLast);
- }
- }
-}
-
-function verifyBlobArray(blobs1, blobs2)
-{
- is(blobs1 instanceof Array, true, "blobs1 is an array object");
- is(blobs2 instanceof Array, true, "blobs2 is an array object");
- is(blobs1.length, blobs2.length, "Same length");
-
- if (!blobs1.length) {
- next();
- return;
- }
-
- for (var i = 0; i < blobs1.length; i++) {
- verifyBlob(blobs1[i], blobs2[i], i == blobs1.length - 1);
- }
-}
-
-var req;
-
-var steps = [
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear();
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding contact with photo");
- createResult1 = new mozContact(properties1);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring");
- var options = {filterBy: ["givenName"],
- filterOp: "startsWith",
- filterValue: properties1.givenName[0].substring(0,3)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- ok(req.result.length == 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- verifyBlobArray(findResult1.photo, properties1.photo);
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding contact with 2 photos");
- createResult1 = new mozContact(properties2);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring");
- var options = {filterBy: ["givenName"],
- filterOp: "startsWith",
- filterValue: properties2.givenName[0].substring(0,3)};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- ok(req.result.length == 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- verifyBlobArray(findResult1.photo, properties2.photo);
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear()
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "all done!\n");
-
- parent.SimpleTest.finish();
- }
-];
-
-start_tests();
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/file_contacts_events.html
+++ /dev/null
@@ -1,43 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=764667
--->
-<head>
- <title>Test for Bug 678695</title>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=764667">Mozilla Bug 764667</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-/** Test for Bug 764667 **/
-
-var ok = parent.ok;
-var is = parent.is;
-
-var e = new MozContactChangeEvent("contactchanged", {contactID: "123", reason: "create"});
-ok(e, "Should have contactsChange event!");
-is(e.contactID, "123", "ID should be 123.");
-is(e.reason, "create", "Reason should be create.");
-
-e = new MozContactChangeEvent("contactchanged", {contactID: "test", reason: "test"});
-is(e.contactID, "test", "Name should be 'test'.");
-is(e.reason, "test", "Name should be 'test'.");
-
-e = new MozContactChangeEvent("contactchanged", {contactID: "a", reason: ""});
-is(e.contactID, "a", "Name should be a.");
-is(e.reason, "", "Value should be empty");
-
-parent.SimpleTest.finish();
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/file_contacts_getall.html
+++ /dev/null
@@ -1,156 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=836519
--->
-<head>
- <title>Mozilla Bug 836519</title>
- <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
- <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=836519">Mozilla Bug 836519</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script type="text/javascript;version=1.8" src="http://mochi.test:8888/tests/dom/contacts/tests/shared.js"></script>
-<script class="testbody" type="text/javascript;version=1.8">
-"use strict";
-
-var ok = parent.ok;
-var is = parent.is;
-var isnot = parent.isnot;
-
-let req;
-
-let steps = [
- function start() {
- SpecialPowers.Cc["@mozilla.org/tools/profiler;1"].getService(SpecialPowers.Ci.nsIProfiler).AddMarker("GETALL_START");
- next();
- },
- clearDatabase,
- addContacts,
-
- function() {
- ok(true, "Delete the current contact while iterating");
- req = mozContacts.getAll({});
- let count = 0;
- let previousId = null;
- req.onsuccess = function() {
- if (req.result) {
- ok(true, "on success");
- if (previousId) {
- isnot(previousId, req.result.id, "different contacts returned");
- }
- previousId = req.result.id;
- count++;
- let delReq = mozContacts.remove(req.result);
- delReq.onsuccess = function() {
- ok(true, "deleted current contact");
- req.continue();
- };
- } else {
- is(count, 40, "returned 40 contacts");
- next();
- }
- };
- },
-
- clearDatabase,
- addContacts,
-
- function() {
- ok(true, "Iterating through the contact list inside a cursor callback");
- let count1 = 0, count2 = 0;
- let req1 = mozContacts.getAll({});
- let req2;
- req1.onsuccess = function() {
- if (count1 == 0) {
- count1++;
- req2 = mozContacts.getAll({});
- req2.onsuccess = function() {
- if (req2.result) {
- count2++;
- req2.continue();
- } else {
- is(count2, 40, "inner cursor returned 40 contacts");
- req1.continue();
- }
- };
- } else {
- if (req1.result) {
- count1++;
- req1.continue();
- } else {
- is(count1, 40, "outer cursor returned 40 contacts");
- next();
- }
- }
- };
- },
-
- clearDatabase,
- addContacts,
-
- function() {
- ok(true, "20 concurrent cursors");
- const NUM_CURSORS = 20;
- let completed = 0;
- for (let i = 0; i < NUM_CURSORS; ++i) {
- mozContacts.getAll({}).onsuccess = (function(i) {
- let count = 0;
- return function(event) {
- let req = event.target;
- if (req.result) {
- count++;
- req.continue();
- } else {
- is(count, 40, "cursor " + i + " returned 40 contacts");
- if (++completed == NUM_CURSORS) {
- next();
- }
- }
- };
- })(i);
- }
- },
-
- clearDatabase,
- addContacts,
-
- function() {
- if (!SpecialPowers.isMainProcess()) {
- // We stop calling continue() intentionally here to see if the cursor gets
- // cleaned up properly in the parent.
- ok(true, "Leaking a cursor");
- req = mozContacts.getAll({
- sortBy: "familyName",
- sortOrder: "ascending"
- });
- req.onsuccess = function(event) {
- next();
- };
- req.onerror = onFailure;
- } else {
- next();
- }
- },
-
- clearDatabase,
-
- function() {
- ok(true, "all done!\n");
- SpecialPowers.Cc["@mozilla.org/tools/profiler;1"].getService(SpecialPowers.Ci.nsIProfiler).AddMarker("GETALL_END");
- parent.SimpleTest.finish();
- }
-];
-
-start_tests();
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/file_contacts_getall2.html
+++ /dev/null
@@ -1,124 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=836519
--->
-<head>
- <title>Mozilla Bug 836519</title>
- <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
- <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=836519">Mozilla Bug 836519</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script type="text/javascript;version=1.8" src="http://mochi.test:8888/tests/dom/contacts/tests/shared.js"></script>
-<script class="testbody" type="text/javascript;version=1.8">
-"use strict";
-
-var ok = parent.ok;
-var is = parent.is;
-
-let req;
-
-let steps = [
- clearDatabase,
- function() {
- // add a contact
- createResult1 = new mozContact({});
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function() {
- next();
- };
- req.onerror = onFailure;
- },
-
- getOne(),
- getOne("Retrieving one contact with getAll - cached"),
-
- clearDatabase,
- addContacts,
-
- getAll(),
- getAll("Retrieving 40 contacts with getAll - cached"),
-
- function() {
- ok(true, "Deleting one contact");
- req = mozContacts.remove(createResult1);
- req.onsuccess = function() {
- next();
- };
- req.onerror = onFailure;
- },
- function() {
- ok(true, "Test cache invalidation");
- req = mozContacts.getAll({});
- let count = 0;
- req.onsuccess = function(event) {
- ok(true, "on success");
- if (req.result) {
- ok(true, "result is valid");
- count++;
- req.continue();
- } else {
- is(count, 39, "last contact - 39 contacts returned");
- next();
- }
- };
- req.onerror = onFailure;
- },
-
- clearDatabase,
- addContacts,
-
- function() {
- ok(true, "Test cache consistency when deleting contact during getAll");
- req = mozContacts.find({});
- req.onsuccess = function(e) {
- let lastContact = e.target.result[e.target.result.length-1];
- req = mozContacts.getAll({});
- let count = 0;
- let firstResult = true;
- req.onsuccess = function(event) {
- ok(true, "on success");
- if (firstResult) {
- if (req.result) {
- count++;
- }
- let delReq = mozContacts.remove(lastContact);
- delReq.onsuccess = function() {
- firstResult = false;
- req.continue();
- };
- } else {
- if (req.result) {
- ok(true, "result is valid");
- count++;
- req.continue();
- } else {
- is(count, 40, "last contact - 40 contacts returned");
- next();
- }
- }
- };
- };
- },
-
- clearDatabase,
-
- function() {
- ok(true, "all done!\n");
- parent.SimpleTest.finish();
- }
-];
-
-start_tests();
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/file_contacts_international.html
+++ /dev/null
@@ -1,277 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=815833
--->
-<head>
- <title>Test for Bug 815833 WebContacts</title>
- <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
- <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=815833">Mozilla Bug 815833</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script type="text/javascript;version=1.8" src="http://mochi.test:8888/tests/dom/contacts/tests/shared.js"></script>
-<script class="testbody" type="text/javascript">
-"use strict";
-
-var ok = parent.ok;
-var ise = parent.ise;
-
-var number1 = {
- local: "7932012345",
- international: "+557932012345"
-};
-
-var number2 = {
- local: "7932012346",
- international: "+557932012346"
-};
-
-var properties1 = {
- name: ["Testname1"],
- tel: [{type: ["work"], value: number1.local, carrier: "testCarrier"} , {type: ["home", "fax"], value: number2.local}],
-};
-
-var shortNumber = "888";
-var properties2 = {
- name: ["Testname2"],
- tel: [{type: ["work"], value: shortNumber, carrier: "testCarrier"}]
-};
-
-var number3 = {
- local: "7932012345",
- international: "+557932012345"
-};
-
-var properties3 = {
- name: ["Testname2"],
- tel: [{value: number3.international}]
-};
-
-var req;
-var createResult1;
-var findResult1;
-var sample_id1;
-
-var steps = [
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear();
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding a new contact1");
- createResult1 = new mozContact(properties1);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding a new contact2");
- var createResult2 = new mozContact(properties2);
- req = navigator.mozContacts.save(createResult2);
- req.onsuccess = function () {
- ok(createResult2.id, "The contact now has an ID.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching for local number");
- var options = {filterBy: ["tel"],
- filterOp: "startsWith",
- filterValue: number1.local};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- is(findResult1.id, sample_id1, "Same ID");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching for international number");
- var options = {filterBy: ["tel"],
- filterOp: "startsWith",
- filterValue: number1.international};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 0, "Found exactly 0 contacts.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching for a short number matching the prefix");
- var shortNumber = number1.local.substring(0, 3);
- var options = {filterBy: ["tel"],
- filterOp: "equals",
- filterValue: shortNumber};
- req = mozContacts.find(options);
- req.onsuccess = function() {
- is(req.result.length, 0, "The prefix short number should not match any contact.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching for a short number matching the suffix");
- var shortNumber = number1.local.substring(number1.local.length - 3);
- var options = {filterBy: ["tel"],
- filterOp: "equals",
- filterValue: shortNumber};
- req = mozContacts.find(options);
- req.onsuccess = function() {
- is(req.result.length, 0, "The suffix short number should not match any contact.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching for a short number matching a contact");
- var options = {filterBy: ["tel"],
- filterOp: "equals",
- filterValue: shortNumber};
- req = mozContacts.find(options);
- req.onsuccess = function() {
- is(req.result.length, 1, "Found the contact equally matching the shortNumber.");
- next();
- };
- req.onerror = onFailure;
- },
- function() {
- ok(true, "Modifying number");
- if (!findResult1) {
- SpecialPowers.executeSoon(next);
- } else {
- findResult1.tel[0].value = number2.local;
- req = mozContacts.save(findResult1);
- req.onsuccess = function () {
- next();
- };
- }
- },
- function () {
- ok(true, "Searching for local number");
- var options = {filterBy: ["tel"],
- filterOp: "startsWith",
- filterValue: number1.local};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 0, "Found exactly 0 contact.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching for local number");
- var options = {filterBy: ["tel"],
- filterOp: "startsWith",
- filterValue: number1.international};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 0, "Found exactly 0 contact.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching for local number");
- var options = {filterBy: ["tel"],
- filterOp: "startsWith",
- filterValue: number2.local};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- is(findResult1.id, sample_id1, "Same ID");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching for local number");
- var options = {filterBy: ["tel"],
- filterOp: "startsWith",
- filterValue: number2.international};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 0, "Found exactly 1 contact.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear();
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding a contact with a Brazilian country code");
- createResult1 = new mozContact(properties3);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching for Brazilian number using local number");
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: number3.local};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- is(findResult1.id, sample_id1, "Same ID");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear();
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "all done!\n");
- parent.SimpleTest.finish();
- }
-];
-
-SpecialPowers.pushPrefEnv({
- set: [
- ["ril.lastKnownSimMcc", "000"]
- ]
-}, start_tests);
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/file_contacts_substringmatching.html
+++ /dev/null
@@ -1,351 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=877302
--->
-<head>
- <title>Test for Bug 877302 substring matching for WebContacts</title>
- <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
- <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=877302">Mozilla Bug 877302</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script type="text/javascript;version=1.8" src="http://mochi.test:8888/tests/dom/contacts/tests/shared.js"></script>
-<script class="testbody" type="text/javascript">
-"use strict";
-
-var ok = parent.ok;
-var is = parent.is;
-
-var substringLength = 8;
-
-var prop = {
- tel: [{value: "7932012345" }, {value: "7932012346"}]
-};
-
-var prop2 = {
- tel: [{value: "01187654321" }]
-};
-
-var prop3 = {
- tel: [{ value: "+43332112346" }]
-};
-
-var prop4 = {
- tel: [{ value: "(0414) 233-9888" }]
-};
-
-var brazilianNumber = {
- international1: "0041557932012345",
- international2: "+557932012345"
-};
-
-var prop5 = {
- tel: [{value: brazilianNumber.international2}]
-};
-
-var req;
-var steps = [
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear()
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding contact");
- createResult1 = new mozContact(prop);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts");
- req = mozContacts.find({});
- req.onsuccess = function () {
- is(req.result.length, 1, "One contact.");
- findResult1 = req.result[0];
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 1");
- var length = prop.tel[0].value.length;
- var num = prop.tel[0].value.substring(length - substringLength, length);
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: num};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- is(findResult1.tel[0].value, "7932012345", "Same Value");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 2");
- var length = prop.tel[1].value.length;
- var num = prop.tel[1].value.substring(length - substringLength, length);
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: num};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- is(findResult1.tel[0].value, "7932012345", "Same Value");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 3");
- var length = prop.tel[0].value.length;
- var num = prop.tel[0].value.substring(length - substringLength + 1, length);
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: num};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 0, "Found exactly 0 contacts.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 4");
- var length = prop.tel[0].value.length;
- var num = prop.tel[0].value.substring(length - substringLength - 1, length);
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: num};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contacts.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding contact");
- createResult1 = new mozContact(prop2);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 5");
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: "87654321"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contacts.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 6");
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: "01187654321"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contacts.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 7");
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: "909087654321"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contacts.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 8");
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: "0411187654321"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contacts.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 9");
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: "90411187654321"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contacts.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 10");
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: "+551187654321"};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contacts.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear()
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding contact");
- createResult1 = new mozContact(prop3);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- if (!isAndroid) { // Bug 905927
- ok(true, "Retrieving by substring 1");
- var length = prop3.tel[0].value.length;
- var num = prop3.tel[0].value.substring(length - substringLength, length);
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: num};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 0, "Found exactly 0 contacts.");
- next();
- };
- req.onerror = onFailure;
- } else {
- SpecialPowers.executeSoon(next);
- }
- },
- function () {
- ok(true, "Adding contact");
- createResult1 = new mozContact(prop4);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 1");
- var num = "(0424) 233-9888"
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: num};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contacts.");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear()
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding a new contact with a Brazilian country code");
- createResult1 = new mozContact(prop5);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching for international number with prefix");
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: brazilianNumber.international1};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- ok(req.result.length == 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear()
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "all done!\n");
- parent.SimpleTest.finish();
- }
-];
-
-SpecialPowers.pushPrefEnv({
- set: [
- ["dom.phonenumber.substringmatching.BR", substringLength],
- ["ril.lastKnownSimMcc", "724"]
- ]
-}, start_tests);
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/file_contacts_substringmatchingCL.html
+++ /dev/null
@@ -1,207 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=877302
--->
-<head>
- <title>Test for Bug 949537 substring matching for WebContacts</title>
- <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
- <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=949537">Mozilla Bug 949537</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script type="text/javascript;version=1.8" src="http://mochi.test:8888/tests/dom/contacts/tests/shared.js"></script>
-<script class="testbody" type="text/javascript">
-"use strict";
-
-var ok = parent.ok;
-var ise = parent.ise;
-
-var landlineNumber = "+56 2 27654321";
-
-var number = {
- local: "87654321",
- international: "+56 9 87654321"
-};
-
-var properties = {
- name: ["Testname2"],
- tel: [{value: number.international}]
-};
-
-var req;
-var steps = [
- function () {
- ok(true, "Adding a contact with a Chilean number");
- createResult1 = new mozContact(properties);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching for Chilean number with prefix");
- req = mozContacts.find({
- filterBy: ["tel"],
- filterOp: "match",
- filterValue: number.international
- });
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- is(findResult1.id, sample_id1, "Same ID");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Searching for Chilean number using local number");
- req = mozContacts.find({
- filterBy: ["tel"],
- filterOp: "match",
- filterValue: number.local
- });
- req.onsuccess = function () {
- is(req.result.length, 1, "Found 0 contacts.");
- next();
- };
- req.onerror = onFailure;
- },
-
- clearDatabase,
-
- function () {
- ok(true, "Adding contact with mobile number");
- createResult1 = new mozContact({tel: [{value: number.international}]});
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts");
- req = mozContacts.find({});
- req.onsuccess = function () {
- is(req.result.length, 1, "One contact.");
- findResult1 = req.result[0];
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by last 8 digits");
- req = mozContacts.find({
- filterBy: ["tel"],
- filterOp: "match",
- filterValue: number.international.slice(-8)
- });
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- is(findResult1.id, sample_id1, "Same ID");
- is(findResult1.tel[0].value, number.international, "Same Value");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by last 9 digits");
- req = mozContacts.find({
- filterBy: ["tel"],
- filterOp: "match",
- filterValue: number.international.slice(-9)
- });
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- is(findResult1.id, sample_id1, "Same ID");
- is(findResult1.tel[0].value, number.international, "Same Value");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by last 6 digits");
- req = mozContacts.find({
- filterBy: ["tel"],
- filterOp: "match",
- filterValue: number.international.slice(-6)
- });
- req.onsuccess = function () {
- is(req.result.length, 0, "Found exactly zero contacts.");
- next();
- };
- req.onerror = onFailure;
- },
-
- clearDatabase,
-
- function () {
- ok(true, "Adding contact with landline number");
- createResult1 = new mozContact({tel: [{value: landlineNumber}]});
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts");
- req = mozContacts.find({});
- req.onsuccess = function () {
- is(req.result.length, 1, "One contact.");
- findResult1 = req.result[0];
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by last 7 digits (local number) with landline calling prefix");
- req = mozContacts.find({
- filterBy: ["tel"],
- filterOp: "match",
- filterValue: "022" + landlineNumber.slice(-7)
- });
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- is(findResult1.id, sample_id1, "Same ID");
- is(findResult1.tel[0].value, landlineNumber, "Same Value");
- next();
- };
- req.onerror = onFailure;
- },
-
- clearDatabase,
-
- function () {
- ok(true, "all done!\n");
- parent.SimpleTest.finish();
- }
-];
-
-SpecialPowers.pushPrefEnv({
- set: [
- ["dom.phonenumber.substringmatching.CL", 8],
- ["ril.lastKnownSimMcc", "730"]
- ]
-}, start_tests);
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/file_contacts_substringmatchingVE.html
+++ /dev/null
@@ -1,135 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=877302
--->
-<head>
- <title>Test for Bug 877302 substring matching for WebContacts</title>
- <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
- <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=877302">Mozilla Bug 877302</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script type="text/javascript;version=1.8" src="http://mochi.test:8888/tests/dom/contacts/tests/shared.js"></script>
-<script class="testbody" type="text/javascript">
-"use strict";
-
-var ok = parent.ok;
-var is = parent.is;
-
-var prop = {
- tel: [{value: "7932012345" }, {value: "7704143727591"}]
-};
-
-var prop2 = {
- tel: [{value: "7932012345" }, {value: "+58 212 5551212"}]
-};
-
-var req;
-var steps = [
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear()
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding contact");
- createResult1 = new mozContact(prop);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving all contacts");
- req = mozContacts.find({});
- req.onsuccess = function () {
- is(req.result.length, 1, "One contact.");
- findResult1 = req.result[0];
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 1");
- var length = prop.tel[0].value.length;
- var num = "04143727591"
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: num};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- is(findResult1.tel[1].value, "7704143727591", "Same Value");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Adding contact");
- createResult1 = new mozContact(prop2);
- req = navigator.mozContacts.save(createResult1);
- req.onsuccess = function () {
- ok(createResult1.id, "The contact now has an ID.");
- sample_id1 = createResult1.id;
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Retrieving by substring 2");
- var num = "5551212";
- var options = {filterBy: ["tel"],
- filterOp: "match",
- filterValue: num};
- req = mozContacts.find(options);
- req.onsuccess = function () {
- is(req.result.length, 1, "Found exactly 1 contact.");
- findResult1 = req.result[0];
- ok(findResult1.id == sample_id1, "Same ID");
- is(findResult1.tel[1].value, "+58 212 5551212", "Same Value");
- next();
- };
- req.onerror = onFailure;
- },
- function () {
- ok(true, "Deleting database");
- req = mozContacts.clear()
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
- },
- function () {
- ok(true, "all done!\n");
- parent.SimpleTest.finish();
- }
-];
-
-SpecialPowers.pushPrefEnv({
- set: [
- ["dom.phonenumber.substringmatching.VE", 7],
- ["ril.lastKnownSimMcc", "734"]
- ]
-}, start_tests);
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/file_migration.html
+++ /dev/null
@@ -1,197 +0,0 @@
-<!DOCTYPE html>
-<html>
-<head>
- <title>Migration tests</title>
- <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
- <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" />
-</head>
-<body>
-<h1>migration tests</h1>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script type="text/javascript;version=1.8" src="shared.js"></script>
-<script class="testbody" type="text/javascript">
-"use strict";
-
-var ok = parent.ok;
-var ise = parent.ise;
-
-var backend, contactsCount, allContacts;
-function loadChromeScript() {
- var url = SimpleTest.getTestFileURL("test_migration_chrome.js");
- backend = SpecialPowers.loadChromeScript(url);
-}
-
-function addBackendEvents() {
- backend.addMessageListener("createDB.success", function(count) {
- contactsCount = count;
- ok(true, "Created the database");
- next();
- });
- backend.addMessageListener("createDB.error", function(err) {
- ok(false, err);
- next();
- });
-
- backend.addMessageListener("deleteDB.success", function() {
- ok(true, "Deleted the database");
- next();
- });
- backend.addMessageListener("deleteDB.error", function(err) {
- ok(false, err);
- next();
- });
-}
-
-function createDB(version) {
- info("Will create the DB at version " + version);
- backend.sendAsyncMessage("createDB", version);
-}
-
-function deleteDB() {
- info("Will delete the DB.");
- backend.sendAsyncMessage("deleteDB");
-}
-
-var steps = [
- function setupChromeScript() {
- loadChromeScript();
- addBackendEvents();
- next();
- },
-
- deleteDB, // let's be sure the DB does not exist yet
- createDB.bind(null, 12),
-
- function testAccessMozContacts() {
- info("Checking we have the right number of contacts: " + contactsCount);
- var req = mozContacts.getCount();
- req.onsuccess = function onsuccess() {
- ok(true, "Could access the mozContacts API");
- is(this.result, contactsCount, "Contacts count is correct");
- next();
- };
-
- req.onerror = function onerror() {
- ok(false, "Couldn't access the mozContacts API");
- next();
- };
- },
-
- function testRetrieveAllContacts() {
- /* if the migration does not work right, either we'll have an error, or the
- contacts won't be migrated properly and thus will fail WebIDL conversion,
- which will manifest as a timeout */
- info("Checking the contacts are corrected to obey WebIDL constraints. (upgrades 14 to 17)");
- var req = mozContacts.find();
- req.onsuccess = function onsuccess() {
- if (this.result) {
- is(this.result.length, contactsCount, "Contacts array length is correct");
- allContacts = this.result;
- next();
- } else {
- ok(false, "Could access the mozContacts API but got no contacts!");
- next();
- }
- };
-
- req.onerror = function onerror() {
- ok(false, "Couldn't access the mozContacts API");
- next();
- };
- },
-
- function checkNameIndex() {
- info("Checking name index migration (upgrades 17 to 19).");
- if (!allContacts) {
- next();
- }
-
- var count = allContacts.length;
-
- function finishRequest() {
- count--;
- if (!count) {
- next();
- }
- }
-
- allContacts.forEach(function(contact) {
- var name = contact.name && contact.name[0];
- if (!name) {
- count--;
- return;
- }
-
- var req = mozContacts.find({
- filterBy: ["name"],
- filterValue: name,
- filterOp: "equals"
- });
-
- req.onsuccess = function onsuccess() {
- if (this.result) {
- info("Found contact '" + name + "', checking it's the correct one.");
- checkContacts(this.result[0], contact);
- } else {
- ok(false, "Could not find contact with name '" + name + "'");
- }
-
- finishRequest();
- };
-
- req.onerror = function onerror() {
- ok(false, "Error while finding contact with name '" + name + "'!");
- finishRequest();
- }
- });
-
- if (!count) {
- ok(false, "No contact had a name, this is unexpected.");
- next();
- }
- },
-
- function checkSubstringMatching() {
- var subject = "0004567890"; // the last 7 digits are the same that at least one contact
- info("Looking for a contact matching " + subject);
- var req = mozContacts.find({
- filterValue: subject,
- filterOp: "match",
- filterBy: ["tel"],
- filterLimit: 1
- });
-
- req.onsuccess = function onsuccess() {
- if (this.result && this.result[0]) {
- ok(true, "Found a contact with number " + this.result[0].tel[0].value);
- }
- next();
- };
-
- req.onerror = function onerror() {
- ok(false, "Error while finding contact for substring matching check!");
- next();
- };
- },
-
- deleteDB,
-
- function finish() {
- backend.destroy();
- info("all done!\n");
- parent.SimpleTest.finish();
- }
-];
-
-// this is the Mcc for Brazil, so that we trigger the previous pref
-SpecialPowers.pushPrefEnv({"set": [["dom.phonenumber.substringmatching.BR", 7],
- ["ril.lastKnownSimMcc", "724"]]}, start_tests);
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/file_permission_denied.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE html>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=1081873
--->
-<head>
- <title>Test for Bug 1081873</title>
- <script type="text/javascript" src="/MochiKit/MochiKit.js"></script>
- <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
-</head>
-<body>
-
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1081873">Mozilla Bug 1081873</a>
-<p id="display"></p>
-<div id="content" style="display: none">
-
-</div>
-<pre id="test">
-<script class="testbody" type="text/javascript">
-
-"use strict";
-
-parent.is("mozContacts" in navigator, false, "navigator.mozContacts must be inaccessible");
-parent.SimpleTest.finish();
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/mochitest.ini
+++ /dev/null
@@ -1,6 +0,0 @@
-[DEFAULT]
-support-files =
- shared.js
- file_permission_denied.html
-
-[test_permission_denied.html]
deleted file mode 100644
--- a/dom/contacts/tests/shared.js
+++ /dev/null
@@ -1,503 +0,0 @@
-"use strict";
-
-// Fix the environment to run Contacts tests
-SpecialPowers.importInMainProcess("resource://gre/modules/ContactService.jsm");
-
-// Some helpful global vars
-var isAndroid = (navigator.userAgent.indexOf("Android") !== -1);
-
-var defaultOptions = {
- sortBy: "givenName",
-};
-
-// Make sure we only touch |navigator.mozContacts| after we have the necessary
-// permissions, or we'll race when checking the listen permission needed for the
-// oncontactchange event. This is only needed for tests because at first we have
-// the permission set to UNKNOWN_ACTION. That should never happen for real apps,
-// see dom/apps/PermissionsTable.jsm.
-var mozContacts;
-
-// To test sorting
-var c1 = {
- name: ["a a"],
- familyName: ["a"],
- givenName: ["a"],
-};
-
-var c2 = {
- name: ["b b"],
- familyName: ["b"],
- givenName: ["b"],
-};
-
-var c3 = {
- name: ["c c", "a a", "b b"],
- familyName: ["c","a","b"],
- givenName: ["c","a","b"],
-};
-
-var c4 = {
- name: ["c c", "a a", "c c"],
- familyName: ["c","a","c"],
- givenName: ["c","a","c"],
-};
-
-var c5 = {
- familyName: [],
- givenName: [],
-};
-
-var c6 = {
- name: ["e"],
- familyName: ["e","e","e"],
- givenName: ["e","e","e"],
-};
-
-var c7 = {
- name: ["e"],
- familyName: ["e","e","e"],
- givenName: ["e","e","e"],
-};
-
-var c8 = {
- name: ["e"],
- familyName: ["e","e","e"],
- givenName: ["e","e","e"],
-};
-
-var adr1 = {
- type: ["work"],
- streetAddress: "street 1",
- locality: "locality 1",
- region: "region 1",
- postalCode: "postal code 1",
- countryName: "country 1"
-};
-
-var adr2 = {
- type: ["home, fax"],
- streetAddress: "street2",
- locality: "locality2",
- region: "region2",
- postalCode: "postal code2",
- countryName: "country2"
-};
-
-var properties1 = {
- // please keep capital letters at the start of these names
- name: ["Test1 TestFamilyName", "Test2 Wagner"],
- familyName: ["TestFamilyName","Wagner"],
- givenName: ["Test1","Test2"],
- phoneticFamilyName: ["TestphoneticFamilyName1","TestphoneticFamilyName2"],
- phoneticGivenName: ["TestphoneticGivenName1","TestphoneticGivenName2"],
- nickname: ["nicktest"],
- tel: [{type: ["work"], value: "123456", carrier: "testCarrier"} , {type: ["home", "fax"], value: "+55 (31) 9876-3456"}, {type: ["home"], value: "+49 451 491934"}],
- adr: [adr1],
- email: [{type: ["work"], value: "x@y.com"}],
-};
-
-var properties2 = {
- name: ["dummyHonorificPrefix dummyGivenName dummyFamilyName dummyHonorificSuffix", "dummyHonorificPrefix2"],
- familyName: ["dummyFamilyName"],
- givenName: ["dummyGivenName"],
- phoneticFamilyName: ["dummyphoneticFamilyName"],
- phoneticGivenName: ["dummyphoneticGivenName"],
- honorificPrefix: ["dummyHonorificPrefix","dummyHonorificPrefix2"],
- honorificSuffix: ["dummyHonorificSuffix"],
- additionalName: ["dummyadditionalName"],
- nickname: ["dummyNickname"],
- tel: [{type: ["test"], value: "7932012345", carrier: "myCarrier", pref: 1},{type: ["home", "custom"], value: "7932012346", pref: 0}],
- email: [{type: ["test"], value: "a@b.c"}, {value: "b@c.d", pref: 1}],
- adr: [adr1, adr2],
- impp: [{type: ["aim"], value:"im1", pref: 1}, {value: "im2"}],
- org: ["org1", "org2"],
- jobTitle: ["boss", "superboss"],
- note: ["test note"],
- category: ["cat1", "cat2"],
- url: [{type: ["work", "work2"], value: "www.1.com", pref: 1}, {value:"www2.com"}],
- bday: new Date("1980, 12, 01"),
- anniversary: new Date("2000, 12, 01"),
- sex: "male",
- genderIdentity: "test",
- key: ["ERPJ394GJJWEVJ0349GJ09W3H4FG0WFW80VHW3408GH30WGH348G3H"]
-};
-
-// To test sorting(CJK)
-var c9 = {
- phoneticFamilyName: ["a"],
- phoneticGivenName: ["a"],
-};
-
-var c10 = {
- phoneticFamilyName: ["b"],
- phoneticGivenName: ["b"],
-};
-
-var c11 = {
- phoneticFamilyName: ["c","a","b"],
- phoneticGivenName: ["c","a","b"],
-};
-
-var c12 = {
- phoneticFamilyName: ["c","a","c"],
- phoneticGivenName: ["c","a","c"],
-};
-
-var c13 = {
- phoneticFamilyName: [],
- phoneticGivenName: [],
-};
-
-var c14 = {
- phoneticFamilyName: ["e","e","e"],
- phoneticGivenName: ["e","e","e"],
-};
-
-var c15 = {
- phoneticFamilyName: ["e","e","e"],
- phoneticGivenName: ["e","e","e"],
-};
-
-var c16 = {
- phoneticFamilyName: ["e","e","e"],
- phoneticGivenName: ["e","e","e"],
-};
-
-var properties3 = {
- // please keep capital letters at the start of these names
- name: ["Taro Yamada", "Ichiro Suzuki"],
- familyName: ["Yamada","Suzuki"],
- givenName: ["Taro","Ichiro"],
- phoneticFamilyName: ["TestPhoneticFamilyYamada","TestPhoneticFamilySuzuki"],
- phoneticGivenName: ["TestPhoneticGivenTaro","TestPhoneticGivenIchiro"],
- nickname: ["phoneticNicktest"],
- tel: [{type: ["work"], value: "123456", carrier: "testCarrier"} , {type: ["home", "fax"], value: "+55 (31) 9876-3456"}, {type: ["home"], value: "+49 451 491934"}],
- adr: [adr1],
- email: [{type: ["work"], value: "x@y.com"}],
-};
-
-var properties4 = {
- name: ["dummyHonorificPrefix dummyTaro dummyYamada dummyHonorificSuffix", "dummyHonorificPrefix2"],
- familyName: ["dummyYamada"],
- givenName: ["dummyTaro"],
- phoneticFamilyName: ["dummyTestPhoneticFamilyYamada"],
- phoneticGivenName: ["dummyTestPhoneticGivenTaro"],
- honorificPrefix: ["dummyPhoneticHonorificPrefix","dummyPhoneticHonorificPrefix2"],
- honorificSuffix: ["dummyPhoneticHonorificSuffix"],
- additionalName: ["dummyPhoneticAdditionalName"],
- nickname: ["dummyPhoneticNickname"],
- tel: [{type: ["test"], value: "7932012345", carrier: "myCarrier", pref: 1},{type: ["home", "custom"], value: "7932012346", pref: 0}],
- email: [{type: ["test"], value: "a@b.c"}, {value: "b@c.d", pref: 1}],
- adr: [adr1, adr2],
- impp: [{type: ["aim"], value:"im1", pref: 1}, {value: "im2"}],
- org: ["org1", "org2"],
- jobTitle: ["boss", "superboss"],
- note: ["test note"],
- category: ["cat1", "cat2"],
- url: [{type: ["work", "work2"], value: "www.1.com", pref: 1}, {value:"www2.com"}],
- bday: new Date("1980, 12, 01"),
- anniversary: new Date("2000, 12, 01"),
- sex: "male",
- genderIdentity: "test",
- key: ["ERPJ394GJJWEVJ0349GJ09W3H4FG0WFW80VHW3408GH30WGH348G3H"]
-};
-
-var sample_id1;
-var sample_id2;
-
-var createResult1;
-var createResult2;
-
-var findResult1;
-var findResult2;
-
-// DOMRequest helper functions
-function onUnwantedSuccess() {
- ok(false, "onUnwantedSuccess: shouldn't get here");
-}
-
-function onFailure() {
- ok(false, "in on Failure!");
- next();
-}
-
-// Validation helper functions
-function checkStr(str1, str2, msg) {
- if (str1 ^ str2) {
- ok(false, "Expected both strings to be either present or absent");
- return;
- }
- if (!str1 || str1 == "null") {
- str1 = null;
- }
- if (!str2 || str2 == "null") {
- str2 = null;
- }
- is(str1, str2, msg);
-}
-
-function checkStrArray(str1, str2, msg) {
- function normalize_falsy(v) {
- if (!v || v == "null" || v == "undefined") {
- return "";
- }
- return v;
- }
- function optArray(val) {
- return Array.isArray(val) ? val : [val];
- }
- str1 = optArray(str1).map(normalize_falsy).filter(v => v != "");
- str2 = optArray(str2).map(normalize_falsy).filter(v => v != "");
- is(JSON.stringify(str1), JSON.stringify(str2), msg);
-}
-
-function checkPref(pref1, pref2) {
- // If on Android treat one preference as 0 and the other as undefined as matching
- if (isAndroid) {
- if ((!pref1 && pref2 == undefined) || (pref1 == undefined && !pref2)) {
- pref1 = false;
- pref2 = false;
- }
- }
- is(!!pref1, !!pref2, "Same pref");
-}
-
-function checkAddress(adr1, adr2) {
- if (adr1 ^ adr2) {
- ok(false, "Expected both adrs to be either present or absent");
- return;
- }
- checkStrArray(adr1.type, adr2.type, "Same type");
- checkStr(adr1.streetAddress, adr2.streetAddress, "Same streetAddress");
- checkStr(adr1.locality, adr2.locality, "Same locality");
- checkStr(adr1.region, adr2.region, "Same region");
- checkStr(adr1.postalCode, adr2.postalCode, "Same postalCode");
- checkStr(adr1.countryName, adr2.countryName, "Same countryName");
- checkPref(adr1.pref, adr2.pref);
-}
-
-function checkField(field1, field2) {
- if (field1 ^ field2) {
- ok(false, "Expected both fields to be either present or absent");
- return;
- }
- checkStrArray(field1.type, field2.type, "Same type");
- checkStr(field1.value, field2.value, "Same value");
- checkPref(field1.pref, field2.pref);
-}
-
-function checkTel(tel1, tel2) {
- if (tel1 ^ tel2) {
- ok(false, "Expected both tels to be either present or absent");
- return;
- }
- checkField(tel1, tel2);
- checkStr(tel1.carrier, tel2.carrier, "Same carrier");
-}
-
-function checkCategory(category1, category2) {
- // Android adds contacts to the a default category. This should be removed from the
- // results before comparing them
- if (isAndroid) {
- category1 = removeAndroidDefaultCategory(category1);
- category2 = removeAndroidDefaultCategory(category2);
- }
- checkStrArray(category1, category2, "Same Category")
-}
-
-function removeAndroidDefaultCategory(category) {
- if (!category) {
- return category;
- }
-
- var result = [];
-
- for (var i of category) {
- // Some devices may return the full group name (prefixed with "System Group: ")
- if (i != "My Contacts" && i != "System Group: My Contacts") {
- result.push(i);
- }
- }
-
- return result;
-}
-
-function checkArrayField(array1, array2, func, msg) {
- if (!!array1 ^ !!array2) {
- ok(false, "Expected both arrays to be either present or absent: " + JSON.stringify(array1) + " vs. " + JSON.stringify(array2) + ". (" + msg + ")");
- return;
- }
- if (!array1 && !array2) {
- ok(true, msg);
- return;
- }
- is(array1.length, array2.length, "Same length");
- for (var i = 0; i < array1.length; ++i) {
- func(array1[i], array2[i], msg);
- }
-}
-
-function checkContacts(contact1, contact2) {
- if (!!contact1 ^ !!contact2) {
- ok(false, "Expected both contacts to be either present or absent");
- return;
- }
- checkStrArray(contact1.name, contact2.name, "Same name");
- checkStrArray(contact1.honorificPrefix, contact2.honorificPrefix, "Same honorificPrefix");
- checkStrArray(contact1.givenName, contact2.givenName, "Same givenName");
- checkStrArray(contact1.additionalName, contact2.additionalName, "Same additionalName");
- checkStrArray(contact1.familyName, contact2.familyName, "Same familyName");
- checkStrArray(contact1.phoneticFamilyName, contact2.phoneticFamilyName, "Same phoneticFamilyName");
- checkStrArray(contact1.phoneticGivenName, contact2.phoneticGivenName, "Same phoneticGivenName");
- checkStrArray(contact1.honorificSuffix, contact2.honorificSuffix, "Same honorificSuffix");
- checkStrArray(contact1.nickname, contact2.nickname, "Same nickname");
- checkCategory(contact1.category, contact2.category);
- checkStrArray(contact1.org, contact2.org, "Same org");
- checkStrArray(contact1.jobTitle, contact2.jobTitle, "Same jobTitle");
- is(contact1.bday ? contact1.bday.valueOf() : null, contact2.bday ? contact2.bday.valueOf() : null, "Same birthday");
- checkStrArray(contact1.note, contact2.note, "Same note");
- is(contact1.anniversary ? contact1.anniversary.valueOf() : null , contact2.anniversary ? contact2.anniversary.valueOf() : null, "Same anniversary");
- checkStr(contact1.sex, contact2.sex, "Same sex");
- checkStr(contact1.genderIdentity, contact2.genderIdentity, "Same genderIdentity");
- checkStrArray(contact1.key, contact2.key, "Same key");
-
- checkArrayField(contact1.adr, contact2.adr, checkAddress, "Same adr");
- checkArrayField(contact1.tel, contact2.tel, checkTel, "Same tel");
- checkArrayField(contact1.email, contact2.email, checkField, "Same email");
- checkArrayField(contact1.url, contact2.url, checkField, "Same url");
- checkArrayField(contact1.impp, contact2.impp, checkField, "Same impp");
-}
-
-function addContacts() {
- ok(true, "Adding 40 contacts");
- let req;
- for (let i = 0; i < 39; ++i) {
- properties1.familyName[0] = "Testname" + (i < 10 ? "0" + i : i);
- properties1.name = [properties1.givenName[0] + " " + properties1.familyName[0]];
- createResult1 = new mozContact(properties1);
- req = mozContacts.save(createResult1);
- req.onsuccess = function() {
- ok(createResult1.id, "The contact now has an ID.");
- };
- req.onerror = onFailure;
- };
- properties1.familyName[0] = "Testname39";
- properties1.name = [properties1.givenName[0] + " Testname39"];
- createResult1 = new mozContact(properties1);
- req = mozContacts.save(createResult1);
- req.onsuccess = function() {
- ok(createResult1.id, "The contact now has an ID.");
- checkStrArray(createResult1.name, properties1.name, "Same Name");
- next();
- };
- req.onerror = onFailure;
-}
-
-function getOne(msg) {
- return function() {
- ok(true, msg || "Retrieving one contact with getAll");
- let req = mozContacts.getAll({});
-
- let count = 0;
- req.onsuccess = function(event) {
- ok(true, "on success");
- if (req.result) {
- ok(true, "result is valid");
- count++;
- req.continue();
- } else {
- is(count, 1, "last contact - only one contact returned");
- next();
- }
- };
- req.onerror = onFailure;
- };
-}
-
-function getAll(msg) {
- return function() {
- ok(true, msg || "Retrieving 40 contacts with getAll");
- let req = mozContacts.getAll({
- sortBy: "familyName",
- sortOrder: "ascending"
- });
- let count = 0;
- let result;
- let props;
- req.onsuccess = function(event) {
- if (req.result) {
- ok(true, "result is valid");
- result = req.result;
- properties1.familyName[0] = "Testname" + (count < 10 ? "0" + count : count);
- is(result.familyName[0], properties1.familyName[0], "Same familyName");
- count++;
- req.continue();
- } else {
- is(count, 40, "last contact - 40 contacts returned");
- next();
- }
- };
- req.onerror = onFailure;
- };
-}
-
-function clearTemps() {
- sample_id1 = null;
- sample_id2 = null;
- createResult1 = null;
- createResult2 = null;
- findResult1 = null;
- findResult2 = null;
-}
-
-function clearDatabase() {
- ok(true, "Deleting database");
- let req = mozContacts.clear()
- req.onsuccess = function () {
- ok(true, "Deleted the database");
- next();
- }
- req.onerror = onFailure;
-}
-
-function checkCount(count, msg, then) {
- var request = mozContacts.getCount();
- request.onsuccess = function(e) {
- is(e.target.result, count, msg);
- then();
- };
- request.onerror = onFailure;
-}
-
-// Helper functions to run tests
-var index = 0;
-
-function next() {
- info("Step " + index);
- if (index >= steps.length) {
- ok(false, "Shouldn't get here!");
- return;
- }
- try {
- var i = index++;
- steps[i]();
- } catch(ex) {
- ok(false, "Caught exception", ex);
- }
-}
-
-SimpleTest.waitForExplicitFinish();
-
-function start_tests() {
- // Skip tests on Android < 4.0 due to test failures on tbpl (see bugs 897924 & 888891)
- let androidVersion = SpecialPowers.Cc['@mozilla.org/system-info;1']
- .getService(SpecialPowers.Ci.nsIPropertyBag2)
- .getProperty('version');
- if (!isAndroid || androidVersion >= 14) {
- mozContacts = navigator.mozContacts;
- next();
- } else {
- ok(true, "Skip tests on Android < 4.0 (bugs 897924 & 888891");
- parent.SimpleTest.finish();
- }
-}
deleted file mode 100644
--- a/dom/contacts/tests/test_contacts_a_cache.xul
+++ /dev/null
@@ -1,168 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
-<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
-<!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/
--->
-
-<window title="Mozilla Bug 1114520"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-
- <script type="application/javascript;version=1.7">
- <![CDATA[
- "use strict";
-
- const { 'utils': Cu } = Components;
- Cu.import("resource://gre/modules/ContactDB.jsm", window);
-
- let contactsDB = new ContactDB();
- contactsDB.init();
-
- function makeFailure(reason, skipDelete) {
- return function() {
- ok(false, reason);
- if (skipDelete) {
- SimpleTest.finish();
- return;
- }
- deleteDatabase(SimpleTest.finish);
- };
- };
-
- function deleteDatabase(then) {
- contactsDB.close();
- let req = indexedDB.deleteDatabase(DB_NAME);
- req.onsuccess = then;
- req.onblocked = makeFailure("blocked", true);
- req.onupgradeneeded = makeFailure("onupgradeneeded", true);
- req.onerror = makeFailure("onerror", true);
- };
-
- function checkRevision(expectedRevision, then) {
- contactsDB.getRevision(function(revision) {
- ok(expectedRevision === revision, "Revision OK");
- then();
- }, makeFailure("Could not get revision"));
- };
-
- let CONTACT_PROPS = {
- id: "ab74671e36be41b680f8f030e7e24ea2",
- properties: {
- name: ["Magnificentest foo bar the third"],
- givenName: ["foo"],
- familyName: ["bar"]
- }
- };
-
- let ANOTHER_CONTACT_PROPS = {
- id: "b461d53d548b4e8aaa8256911a415f79",
- properties: {
- name: ["Magnificentest foo bar the fourth"],
- givenName: ["foo"],
- familyName: ["bar"]
- }
- };
-
- let Tests = [function() {
- info("Deleting database");
- deleteDatabase(next);
- }, function() {
- info("Checking initial revision");
- checkRevision(0, next);
- }, function() {
- info("Save contact");
- contactsDB.saveContact(CONTACT_PROPS, function() {
- ok(true, "Saved contact successfully");
- checkRevision(1, next);
- }, makeFailure("Could not save contact"));
- }, function() {
- info("Save another contact");
- contactsDB.saveContact(ANOTHER_CONTACT_PROPS, function() {
- ok(true, "Saved contact successfully");
- checkRevision(2, next);
- }, makeFailure("Could not save contact"));
- }, function() {
- info("Get all contacts so cache is built");
- contactsDB.getAll(function(contacts) {
- ok(true, "Got all contacts " + contacts.length);
- next();
- }, makeFailure("Unexpected error getting contacts"), {
- "sortBy":"givenName","sortOrder":"ascending"
- });
- }, function() {
- info("Contacts cache should have both ids");
- let contactsCount = 0;
- contactsDB.newTxn("readonly", SAVED_GETALL_STORE_NAME, function(txn, store) {
- store.openCursor().onsuccess = function(e) {
- let cursor = e.target.result;
- if (!cursor) {
- makeFailure("Wrong cache")();
- return;
- }
- ok(cursor.value.length == 2, "Both contacts ids are in the cache");
- next();
- };
- }, null, makeFailure("Txn error"));
- }, function() {
- info("Remove contact " + CONTACT_PROPS.id);
- contactsDB.removeContact(CONTACT_PROPS.id, function() {
- ok(true, "Removed contact");
- checkRevision(3, next);
- }, makeFailure("Unexpected error removing contact "));
- }, function() {
- info("Check that contact has been removed for good");
- contactsDB.newTxn("readonly", STORE_NAME, function(txn, store) {
- let req = store.openCursor(IDBKeyRange.only(CONTACT_PROPS.id));
- req.onsuccess = function(event) {
- if (event.target.result) {
- makeFailure("Should not have cursor")();
- return;
- }
- ok(true, "Yep, the contact was removed");
- next();
- };
- req.onerror = makeFailure("OpenCursor error");
- });
- }, function() {
- info("Contacts cache should have only one id");
- contactsDB.newTxn("readonly", SAVED_GETALL_STORE_NAME, function(txn, store) {
- store.openCursor().onsuccess = function(e) {
- let cursor = e.target.result;
- if (!cursor) {
- makeFailure("Missing cursor")();
- return;
- }
- ok(cursor.value.length == 1, "Only one contacts id is in the cache");
- ok(cursor.value[0] == ANOTHER_CONTACT_PROPS.id, "And it is the right id");
- next();
- };
- }, null, makeFailure("Txn error"));
- }, function() {
- deleteDatabase(next);
- }];
-
- function next() {
- let step = Tests.shift();
- if (step) {
- step();
- } else {
- info("All done");
- SimpleTest.finish();
- }
- }
-
- SimpleTest.waitForExplicitFinish();
-
- next();
-
- ]]>
- </script>
-
- <body xmlns="http://www.w3.org/1999/xhtml">
- <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1114520"
- target="_blank">Mozilla Bug 1114520</a>
- </body>
-</window>
deleted file mode 100644
--- a/dom/contacts/tests/test_contacts_a_shutdown.xul
+++ /dev/null
@@ -1,103 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
-<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
-<!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/
--->
-
-<window title="Mozilla Bug 945948"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-
- <script type="application/javascript;version=1.7">
- <![CDATA[
- "use strict";
- const { 'utils': Cu } = Components;
- Cu.import("resource://gre/modules/ContactService.jsm", window);
-
- //
- // Mock message manager
- //
- function MockMessageManager() { }
- MockMessageManager.prototype.assertPermission = function() { return true; };
- MockMessageManager.prototype.sendAsyncMessage = function(name, data) { };
-
- //
- // Mock ContactDB
- //
- function MockContactDB() { }
- MockContactDB.prototype.getAll = function(cb) {
- cb([]);
- };
- MockContactDB.prototype.clearDispatcher = function() { }
- MockContactDB.prototype.close = function() { }
-
- let realContactDB = ContactService._db;
-
- function before() {
- ok(true, "Install mock ContactDB object");
- ContactService._db = new MockContactDB();
- }
-
- function after() {
- ok(true, "Restore real ContactDB object");
- ContactService._db = realContactDB;
- }
-
- function steps() {
- let mm1 = new MockMessageManager();
- let mm2 = new MockMessageManager();
-
- is(ContactService._cursors.size, 0, "Verify clean contact init");
-
- ContactService.receiveMessage({
- target: mm1,
- name: "Contacts:GetAll",
- data: { cursorId: 1 },
- findOptions: {}
- });
- is(ContactService._cursors.size, 1, "Add contact cursor 1");
-
- ContactService.receiveMessage({
- target: mm2,
- name: "Contacts:GetAll",
- data: { cursorId: 2 },
- findOptions: {}
- });
- is(ContactService._cursors.size, 2, "Add contact cursor 2");
-
- ContactService.receiveMessage({
- target: mm1,
- name: "child-process-shutdown"
- });
- is(ContactService._cursors.size, 1, "Shutdown contact cursor 1");
-
- ContactService.receiveMessage({
- target: mm2,
- name: "child-process-shutdown"
- });
- is(ContactService._cursors.size, 0, "Shutdown contact cursor 2");
- }
-
- function runTests() {
- SimpleTest.waitForExplicitFinish();
- try {
- before();
- steps();
- } finally {
- after();
- SimpleTest.finish();
- }
- }
-
- runTests();
- ]]>
- </script>
-
- <body xmlns="http://www.w3.org/1999/xhtml">
- <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=945948"
- target="_blank">Mozilla Bug 945948</a>
- </body>
-</window>
deleted file mode 100644
--- a/dom/contacts/tests/test_contacts_a_upgrade.xul
+++ /dev/null
@@ -1,271 +0,0 @@
-<?xml version="1.0"?>
-<?xml-stylesheet type="text/css" href="chrome://global/skin"?>
-<?xml-stylesheet type="text/css" href="/tests/SimpleTest/test.css"?>
-<!--
- Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/
--->
-
-<window title="Mozilla Bug 889239"
- xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
- <script type="application/javascript"
- src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
-
- <script type="application/javascript;version=1.7">
- <![CDATA[
- "use strict";
-
- function checkStr(str1, str2, msg) {
- if (str1 ^ str2) {
- ok(false, "Expected both strings to be either present or absent");
- return;
- }
- is(str1, str2, msg);
- }
-
- function checkStrArray(str1, str2, msg) {
- // comparing /[null(,null)+]/ and undefined should pass
- function nonNull(e) {
- return e != null;
- }
- if ((Array.isArray(str1) && str1.filter(nonNull).length == 0 && str2 == undefined)
- ||(Array.isArray(str2) && str2.filter(nonNull).length == 0 && str1 == undefined)) {
- ok(true, msg);
- } else if (str1) {
- is(JSON.stringify(typeof str1 == "string" ? [str1] : str1), JSON.stringify(typeof str2 == "string" ? [str2] : str2), msg);
- }
- }
-
- function checkAddress(adr1, adr2) {
- if (adr1 ^ adr2) {
- ok(false, "Expected both adrs to be either present or absent");
- return;
- }
- checkStrArray(adr1.type, adr2.type, "Same type");
- checkStrArray(adr1.streetAddress, adr2.streetAddress, "Same streetAddress");
- checkStrArray(adr1.locality, adr2.locality, "Same locality");
- checkStrArray(adr1.region, adr2.region, "Same region");
- checkStrArray(adr1.postalCode, adr2.postalCode, "Same postalCode");
- checkStrArray(adr1.countryName, adr2.countryName, "Same countryName");
- is(adr1.pref, adr2.pref, "Same pref");
- }
-
- function checkTel(tel1, tel2) {
- if (tel1 ^ tel2) {
- ok(false, "Expected both tels to be either present or absent");
- return;
- }
- checkStrArray(tel1.type, tel2.type, "Same type");
- checkStrArray(tel1.value, tel2.value, "Same value");
- checkStrArray(tel1.carrier, tel2.carrier, "Same carrier");
- is(tel1.pref, tel2.pref, "Same pref");
- }
-
- function checkField(field1, field2) {
- if (field1 ^ field2) {
- ok(false, "Expected both fields to be either present or absent");
- return;
- }
- checkStrArray(field1.type, field2.type, "Same type");
- checkStrArray(field1.value, field2.value, "Same value");
- is(field1.pref, field2.pref, "Same pref");
- }
-
- function checkDBContacts(dbContact1, dbContact2) {
- let contact1 = dbContact1.properties;
- let contact2 = dbContact2.properties;
-
- checkStrArray(contact1.name, contact2.name, "Same name");
- checkStrArray(contact1.honorificPrefix, contact2.honorificPrefix, "Same honorificPrefix");
- checkStrArray(contact1.givenName, contact2.givenName, "Same givenName");
- checkStrArray(contact1.additionalName, contact2.additionalName, "Same additionalName");
- checkStrArray(contact1.familyName, contact2.familyName, "Same familyName");
- checkStrArray(contact1.honorificSuffix, contact2.honorificSuffix, "Same honorificSuffix");
- checkStrArray(contact1.nickname, contact2.nickname, "Same nickname");
- checkStrArray(contact1.category, contact2.category, "Same category");
- checkStrArray(contact1.org, contact2.org, "Same org");
- checkStrArray(contact1.jobTitle, contact2.jobTitle, "Same jobTitle");
- is(contact1.bday ? contact1.bday.valueOf() : null, contact2.bday ? contact2.bday.valueOf() : null, "Same birthday");
- checkStrArray(contact1.note, contact2.note, "Same note");
- is(contact1.anniversary ? contact1.anniversary.valueOf() : null , contact2.anniversary ? contact2.anniversary.valueOf() : null, "Same anniversary");
- checkStr(contact1.sex, contact2.sex, "Same sex");
- checkStr(contact1.genderIdentity, contact2.genderIdentity, "Same genderIdentity");
- checkStrArray(contact1.key, contact2.key, "Same key");
-
- is(contact1.email.length, contact2.email.length, "Same number of emails");
- for (let i = 0; i < contact1.email.length; ++i) {
- checkField(contact1.email[i], contact2.email[i]);
- }
-
- is(contact1.adr.length, contact2.adr.length, "Same number of adrs");
- for (var i in contact1.adr) {
- checkAddress(contact1.adr[i], contact2.adr[i]);
- }
-
- is(contact1.tel.length, contact2.tel.length, "Same number of tels");
- for (var i in contact1.tel) {
- checkTel(contact1.tel[i], contact2.tel[i]);
- }
-
- is(contact1.url.length, contact2.url.length, "Same number of urls");
- for (var i in contact1.url) {
- checkField(contact1.url[i], contact2.url[i]);
- }
-
- is(contact1.impp.length, contact2.impp.length, "Same number of impps");
- for (var i in contact1.impp) {
- checkField(contact1.impp[i], contact2.impp[i]);
- }
-
- // test search indexes
- contact1 = dbContact1.search;
- contact2 = dbContact2.search;
- checkStrArray(contact1.category, contact2.category, "Same cateogry index");
- checkStrArray(contact1.email, contact2.email, "Same email index");
- checkStrArray(contact1.emailLowerCase, contact2.emailLowerCase, "Same emailLowerCase index");
- checkStrArray(contact1.familyName, contact2.familyName, "Same familyName index");
- checkStrArray(contact1.familyNameLowerCase, contact2.familyNameLowerCase, "Same familyNameLowerCase index");
- checkStrArray(contact1.givenName, contact2.givenName, "Same givenName index");
- checkStrArray(contact1.givenNameLowerCase, contact2.givenNameLowerCase, "Same givenNameLowerCase index");
- checkStrArray(contact1.name, contact2.name, "Same name index");
- checkStrArray(contact1.tel, contact2.tel, "Same tel index");
- checkStrArray(contact1.telLowerCase, contact2.telLowerCase, "Same telLowerCase index");
- checkStrArray(contact1.telMatch, contact2.telMatch, "Same telMatch index");
- }
-
- function makeFailure(reason) {
- return function() {
- ok(false, reason);
- SimpleTest.finish();
- };
- };
-
- const { 'utils': Cu } = Components;
- Cu.import("resource://gre/modules/ContactDB.jsm", window);
-
- let cdb = new ContactDB();
- cdb.init();
-
- let CONTACT_PROPS = {
- id: "ab74671e36be41b680f8f030e7e24ea2",
- properties: {
- name: ["Magnificentest foo bar the third"],
- givenName: ["foo"],
- familyName: ["bar"],
- honorificPrefix: ["magnificentest"],
- honorificSuffix: ["the third"],
- additionalName: ["addl"],
- nickname: ["foo"],
- tel: [
- {type: ["mobile"], value: "+12345678901", carrier: "ACME Telecommunications", pref: true},
- {type: ["home", "custom"], value: "7932012346", pref: false},
- ],
- email: [{type: ["work"], value: "a@b.c"}, {value: "b@c.d", pref: true}],
- adr: [
- {
- type: ["home"],
- streetAddress: "street 1",
- locality: "locality 1",
- region: "region 1",
- postalCode: "postal code 1",
- countryName: "country 1",
- }
- ],
- impp: [{type: ["aim"], value:"im1", pref: true}, {value: "im2"}],
- org: ["org1", "org2"],
- jobTitle: ["boss", "superboss"],
- bday: new Date("1980, 12, 01"),
- note: ["bla bla bla"],
- category: ["cat1", "cat2"],
- url: [{type: ["work", "work2"], value: "www.1.com", pref: true}, {value: "www2.com"}],
- anniversary: new Date("2000, 12, 01"),
- sex: "male",
- genderIdentity: "trisexual",
- key: "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAACXBIWXMAAC4jAAAuIwF4pT92AAACrElEQVQozwXBTW8bRRgA4Hfemf1er7/iJI4Tq7VFlEZN1VZIlapy4MQBTkXcuSH+G/APKnGAAyCVCqmtCHETp64db5zdtdf7NbMzw/OQH378HkCZpmmapqYMy8yrNnadS6026HC/Z7k+SCkEBwKEEKaUQtQAmlDqrucH23nH4BRkJVRcwmod5gcn6LehFgCaEIIalFZaEcLCq73w355RdvY7nfGQGVTlmRXfqMlrUaSUMUQkhCISJIggKj3/YBHt7PRbpy+cwbF7dN/0vEqTMoo3s0tmGAAAoJAgImMq3xZ5WTPbHj4Mho8Nf+QcPtZBLxEkqeQ2WmklkRCtNdNaI1KpVCnqOC3j5ZK++4vnm6xSWZpzwQtRV2mOiBoRpEKtNQAQggjQcCwqinRxJeKlWW93dlqEsa2QRZbF85nWBAAZY4YUgl9fRJWKVuWgmhwHhpD1+ZrfVjAN867rMCne//rq7OuXjWaLCVHnOWHgFDwMw+Tvi09PdhtJXoVC7bWDIi8Lg8qyMk3rYjLzvJh2O30hwK6TpiG7zWDcck9GR17D9wxDcH7/oNtElRa1aZuLDJN4S7/87tssLVg0/eZs/3h0D5R89vR0v+1AVT0YHX31ZDy9uv7IeJrryeyu2+nS50/PqOXM5qt8Nf/jv08UwTfN27vkchldLpPf/nx/nqSz5sbzhkTYzLRppzNYre/ycrMIZwqsHdf96fd/Xr354AYBr/jESWhgGb6zVSuGrrQS1j4Zk8nc2Hs7frFb3Phc6+fOKDGLKOJTHvlj2u85N4t6vbw7OM4YRVquboPdsPNZ9eb8pvfAOf2iN4dN3EzWadnoO5JY19Oo0TYtw1t8TBqBR9v7wbOXROLWtZ3PH937+ZfXrb6BUHEbXL+FCIfDw92e5zebg8GR54r/AaMVcBxE6hgPAAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDEyLTA3LTIxVDEwOjUzOjE5LTA0OjAwYyXbYgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAxMi0wNy0yMVQxMDo1MzoxOS0wNDowMBJ4Y94AAAARdEVYdGpwZWc6Y29sb3JzcGFjZQAyLHVVnwAAACB0RVh0anBlZzpzYW1wbGluZy1mYWN0b3IAMXgxLDF4MSwxeDHplfxwAAAAAElFTkSuQmCC"
- }
- };
-
- function deleteDatabase(then) {
- cdb.close();
- let req = indexedDB.deleteDatabase(DB_NAME);
- req.onsuccess = then;
- req.onblocked = makeFailure("blocked");
- req.onupgradeneeded = makeFailure("onupgradeneeded");
- req.onerror = makeFailure("onerror");
- }
-
- function saveContact() {
- // takes fast upgrade path
- cdb.saveContact(CONTACT_PROPS,
- function() {
- ok(true, "Saved contact successfully");
- next();
- }
- );
- }
-
- function getContact(callback) {
- return function() {
- let req = indexedDB.open(STORE_NAME, DB_VERSION);
- req.onsuccess = function(event) {
- let db = event.target.result;
- let txn = db.transaction([STORE_NAME], "readonly");
- txn.onabort = makeFailure("Failed to open transaction");
- let r2 = txn.objectStore(STORE_NAME).get(CONTACT_PROPS.id);
- r2.onsuccess = function() {
- db.close();
- callback(r2.result);
- };
- r2.onerror = makeFailure("Failed to get contact");
- };
- };
- }
-
- let savedContact;
-
- let Tests = [
- saveContact,
-
- getContact(function(contact) {
- savedContact = contact;
- next();
- }),
-
- function() {
- deleteDatabase(function() {
- info("slow upgrade");
- cdb.useFastUpgrade = false;
- cdb.init();
- next();
- });
- },
-
- saveContact,
-
- getContact(function(contact) {
- checkDBContacts(savedContact, contact);
- next();
- }),
- ];
-
- function next() {
- let step = Tests.shift();
- if (step) {
- step();
- } else {
- info("All done");
- SimpleTest.finish();
- }
- }
-
- SimpleTest.waitForExplicitFinish();
- next();
-
- ]]>
- </script>
-
- <body xmlns="http://www.w3.org/1999/xhtml">
- <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=889239"
- target="_blank">Mozilla Bug 889239</a>
- </body>
-</window>
deleted file mode 100644
--- a/dom/contacts/tests/test_contacts_basics.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<iframe></iframe>
-<pre id="test">
-<script type="application/javascript">
-
-function run_tests() {
- var iframe = document.querySelector("iframe");
- iframe.src = "file_contacts_basics.html";
-}
-
-SimpleTest.waitForExplicitFinish();
-onload = run_tests;
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/test_contacts_basics2.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<iframe></iframe>
-<pre id="test">
-<script type="application/javascript">
-
-function run_tests() {
- var iframe = document.querySelector("iframe");
- iframe.src = "file_contacts_basics2.html";
-}
-
-SimpleTest.waitForExplicitFinish();
-onload = run_tests;
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/test_contacts_blobs.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<iframe></iframe>
-<pre id="test">
-<script type="application/javascript">
-
-function run_tests() {
- var iframe = document.querySelector("iframe");
- iframe.src = "file_contacts_blobs.html";
-}
-
-SimpleTest.waitForExplicitFinish();
-onload = run_tests;
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/test_contacts_events.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<iframe></iframe>
-<pre id="test">
-<script type="application/javascript">
-
-function run_tests() {
- var iframe = document.querySelector("iframe");
- iframe.src = "file_contacts_events.html";
-}
-
-SimpleTest.waitForExplicitFinish();
-onload = run_tests;
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/test_contacts_getall.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<iframe></iframe>
-<pre id="test">
-<script type="application/javascript">
-
-function run_tests() {
- var iframe = document.querySelector("iframe");
- iframe.src = "file_contacts_getall.html";
-}
-
-SimpleTest.waitForExplicitFinish();
-onload = run_tests;
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/test_contacts_getall2.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<iframe></iframe>
-<pre id="test">
-<script type="application/javascript">
-
-function run_tests() {
- var iframe = document.querySelector("iframe");
- iframe.src = "file_contacts_getall2.html";
-}
-
-SimpleTest.waitForExplicitFinish();
-onload = run_tests;
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/test_contacts_international.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<iframe></iframe>
-<pre id="test">
-<script type="application/javascript">
-
-function run_tests() {
- var iframe = document.querySelector("iframe");
- iframe.src = "file_contacts_international.html";
-}
-
-SimpleTest.waitForExplicitFinish();
-onload = run_tests;
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/test_contacts_substringmatching.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<iframe></iframe>
-<pre id="test">
-<script type="application/javascript">
-
-function run_tests() {
- var iframe = document.querySelector("iframe");
- iframe.src = "file_contacts_substringmatching.html";
-}
-
-SimpleTest.waitForExplicitFinish();
-onload = run_tests;
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/test_contacts_substringmatchingCL.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<iframe></iframe>
-<pre id="test">
-<script type="application/javascript">
-
-function run_tests() {
- var iframe = document.querySelector("iframe");
- iframe.src = "file_contacts_substringmatchingCL.html";
-}
-
-SimpleTest.waitForExplicitFinish();
-onload = run_tests;
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/test_contacts_substringmatchingVE.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<iframe></iframe>
-<pre id="test">
-<script type="application/javascript">
-
-function run_tests() {
- var iframe = document.querySelector("iframe");
- iframe.src = "file_contacts_substringmatchingVE.html";
-}
-
-SimpleTest.waitForExplicitFinish();
-onload = run_tests;
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/test_migration.html
+++ /dev/null
@@ -1,23 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<iframe></iframe>
-<pre id="test">
-<script type="application/javascript">
-
-function run_tests() {
- var iframe = document.querySelector("iframe");
- iframe.src = "file_migration.html";
-}
-
-SimpleTest.waitForExplicitFinish();
-onload = run_tests;
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/contacts/tests/test_migration_chrome.js
+++ /dev/null
@@ -1,336 +0,0 @@
-/* global
- sendAsyncMessage,
- addMessageListener,
- indexedDB
- */
-"use strict";
-
-var {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-var imports = {};
-
-Cu.import("resource://gre/modules/ContactDB.jsm", imports);
-Cu.import("resource://gre/modules/ContactService.jsm", imports);
-Cu.import("resource://gre/modules/Promise.jsm", imports);
-Cu.importGlobalProperties(["indexedDB"]);
-
-const {
- STORE_NAME,
- SAVED_GETALL_STORE_NAME,
- REVISION_STORE,
- DB_NAME,
- ContactService,
-} = imports;
-// |const| will not work because
-// it will make the Promise object immutable before assigning.
-// Using Object.defineProperty() instead.
-Object.defineProperty(this, "Promise", {
- value: imports.Promise, writable: false, configurable: false
-});
-
-var DEBUG = false;
-function debug(str) {
- if (DEBUG){
- dump("-*- TestMigrationChromeScript: " + str + "\n");
- }
-}
-
-const DATA = {
- 12: {
- SCHEMA: function createSchema12(db, transaction) {
- let objectStore = db.createObjectStore(STORE_NAME, {keyPath: "id"});
- objectStore.createIndex("familyName", "properties.familyName", { multiEntry: true });
- objectStore.createIndex("givenName", "properties.givenName", { multiEntry: true });
- objectStore.createIndex("familyNameLowerCase", "search.familyName", { multiEntry: true });
- objectStore.createIndex("givenNameLowerCase", "search.givenName", { multiEntry: true });
- objectStore.createIndex("telLowerCase", "search.tel", { multiEntry: true });
- objectStore.createIndex("emailLowerCase", "search.email", { multiEntry: true });
- objectStore.createIndex("tel", "search.exactTel", { multiEntry: true });
- objectStore.createIndex("category", "properties.category", { multiEntry: true });
- objectStore.createIndex("email", "search.email", { multiEntry: true });
- objectStore.createIndex("telMatch", "search.parsedTel", {multiEntry: true});
- db.createObjectStore(SAVED_GETALL_STORE_NAME);
- db.createObjectStore(REVISION_STORE).put(0, "revision");
- },
- BAD: [
- {
- // this contact is bad because its "name" property is not an array and
- // is the empty string (upgrade 16 to 17)
- "properties": {
- "name": "",
- "email": [],
- "url": [{
- "type": ["source"],
- "value": "urn:service:gmail:uid:http://www.google.com/m8/feeds/contacts/XXX/base/4567894654"
- }],
- "category": ["gmail"],
- "adr": [],
- "tel": [{
- "type": ["mobile"],
- "value": "+7 123 456-78-90"
- }],
- "sex": "undefined",
- "genderIdentity": "undefined"
- },
- "search": {
- "givenName": [],
- "familyName": [],
- "email": [],
- "category": ["gmail"],
- "tel": ["+71234567890","71234567890","1234567890","234567890","34567890",
- "4567890","567890","67890","7890","890","90","0","81234567890"],
- "exactTel": ["+71234567890"],
- "parsedTel": ["+71234567890","1234567890","81234567890","34567890"]
- },
- "updated": new Date("2013-07-27T16:47:40.974Z"),
- "published": new Date("2013-07-27T16:47:40.974Z"),
- "id": "bad-1"
- },
- {
- // This contact is bad because its "name" property is not an array
- // (upgrade 14 to 15)
- "properties": {
- "name": "name-bad-2",
- "email": [],
- "url": [{
- "type": ["source"],
- "value": "urn:service:gmail:uid:http://www.google.com/m8/feeds/contacts/XXX/base/4567894654"
- }],
- "category": ["gmail"],
- "adr": [],
- "tel": [{
- "type": ["mobile"],
- "value": "+7 123 456-78-90"
- }],
- "sex": "undefined",
- "genderIdentity": "undefined"
- },
- "search": {
- "givenName": [],
- "familyName": [],
- "email": [],
- "category": ["gmail"],
- "tel": ["+71234567890","71234567890","1234567890","234567890","34567890",
- "4567890","567890","67890","7890","890","90","0","81234567890"],
- "exactTel": ["+71234567890"],
- "parsedTel": ["+71234567890","1234567890","81234567890","34567890"]
- },
- "updated": new Date("2013-07-27T16:47:40.974Z"),
- "published": new Date("2013-07-27T16:47:40.974Z"),
- "id": "bad-2"
- },
- {
- // This contact is bad because its bday property is a String (upgrade 15
- // to 16), and its anniversary property is an empty string (upgrade 16
- // to 17)
- "properties": {
- "name": ["name-bad-3"],
- "email": [],
- "url": [{
- "type": ["source"],
- "value": "urn:service:gmail:uid:http://www.google.com/m8/feeds/contacts/XXX/base/4567894654"
- }],
- "category": ["gmail"],
- "adr": [],
- "tel": [{
- "type": ["mobile"],
- "value": "+7 123 456-78-90"
- }],
- "sex": "undefined",
- "genderIdentity": "undefined",
- "bday": "2013-07-27T16:47:40.974Z",
- "anniversary": ""
- },
- "search": {
- "givenName": [],
- "familyName": [],
- "email": [],
- "category": ["gmail"],
- "tel": ["+71234567890","71234567890","1234567890","234567890","34567890",
- "4567890","567890","67890","7890","890","90","0","81234567890"],
- "exactTel": ["+71234567890"],
- "parsedTel": ["+71234567890","1234567890","81234567890","34567890"]
- },
- "updated": new Date("2013-07-27T16:47:40.974Z"),
- "published": new Date("2013-07-27T16:47:40.974Z"),
- "id": "bad-3"
- },
- {
- // This contact is bad because its tel property has a tel.type null
- // value (upgrade 16 to 17), and email.type not array value (upgrade 14
- // to 15)
- "properties": {
- "name": ["name-bad-4"],
- "email": [{
- "value": "toto@toto.com",
- "type": "home"
- }],
- "url": [{
- "type": ["source"],
- "value": "urn:service:gmail:uid:http://www.google.com/m8/feeds/contacts/XXX/base/4567894654"
- }],
- "category": ["gmail"],
- "adr": [],
- "tel": [{
- "type": null,
- "value": "+7 123 456-78-90"
- }],
- "sex": "undefined",
- "genderIdentity": "undefined"
- },
- "search": {
- "givenName": [],
- "familyName": [],
- "email": [],
- "category": ["gmail"],
- "tel": ["+71234567890","71234567890","1234567890","234567890","34567890",
- "4567890","567890","67890","7890","890","90","0","81234567890"],
- "exactTel": ["+71234567890"],
- "parsedTel": ["+71234567890","1234567890","81234567890","34567890"]
- },
- "updated": new Date("2013-07-27T16:47:40.974Z"),
- "published": new Date("2013-07-27T16:47:40.974Z"),
- "id": "bad-4"
- }
- ],
- GOOD: [
- {
- "properties": {
- "name": ["name-good-1"],
- "email": [],
- "url": [{
- "type": ["source"],
- "value": "urn:service:gmail:uid:http://www.google.com/m8/feeds/contacts/XXX/base/4567894654"
- }],
- "category": ["gmail"],
- "adr": [],
- "tel": [{
- "type": ["mobile"],
- "value": "+7 123 456-78-90"
- }],
- "sex": "undefined",
- "genderIdentity": "undefined"
- },
- "search": {
- "givenName": [],
- "familyName": [],
- "email": [],
- "category": ["gmail"],
- "tel": ["+71234567890","71234567890","1234567890","234567890","34567890",
- "4567890","567890","67890","7890","890","90","0","81234567890"],
- "exactTel": ["+71234567890"],
- "parsedTel": ["+71234567890","1234567890","81234567890","34567890"]
- },
- "updated": new Date("2013-07-27T16:47:40.974Z"),
- "published": new Date("2013-07-27T16:47:40.974Z"),
- "id": "good-1"
- }
- ]
- }
-};
-
-function DataManager(version) {
- if (!(version in DATA)) {
- throw new Error("Version " + version + " can't be found in our test datas.");
- }
-
- this.version = version;
- this.data = DATA[version];
-}
-
-DataManager.prototype = {
- open: function() {
- debug("opening for version " + this.version);
- var deferred = Promise.defer();
-
- let req = indexedDB.open(DB_NAME, this.version);
- req.onupgradeneeded = function() {
- let db = req.result;
- let transaction = req.transaction;
- this.createSchema(db, transaction);
- this.addContacts(db, transaction);
- }.bind(this);
-
- req.onsuccess = function() {
- debug("succeeded opening the db, let's close it now");
- req.result.close();
- deferred.resolve(this.contactsCount());
- }.bind(this);
-
- req.onerror = function() {
- deferred.reject(this.error);
- };
-
- return deferred.promise;
- },
-
- createSchema: function(db, transaction) {
- debug("createSchema for version " + this.version);
- this.data.SCHEMA(db, transaction);
- },
-
- addContacts: function(db, transaction) {
- debug("adding contacts for version " + this.version);
- var os = transaction.objectStore(STORE_NAME);
-
- this.data.GOOD.forEach(function(contact) {
- os.put(contact);
- });
- this.data.BAD.forEach(function(contact) {
- os.put(contact);
- });
- },
-
- contactsCount: function() {
- return this.data.BAD.length + this.data.GOOD.length;
- }
-};
-
-DataManager.delete = function() {
- debug("Deleting the database");
- var deferred = Promise.defer();
-
- /* forcibly close the db before deleting it */
- ContactService._db.close();
-
- var req = indexedDB.deleteDatabase(DB_NAME);
- req.onsuccess = function() {
- debug("Successfully deleted!");
- deferred.resolve();
- };
-
- req.onerror = function() {
- debug("Not deleted, error is " + this.error.name);
- deferred.reject(this.error);
- };
-
- req.onblocked = function() {
- debug("Waiting for the current users");
- };
-
- return deferred.promise;
-};
-
-addMessageListener("createDB", function(version) {
- // Promises help handling gracefully exceptions
- Promise.resolve().then(function() {
- return new DataManager(version);
- }).then(function(manager) {
- return manager.open();
- }).then(function onSuccess(count) {
- sendAsyncMessage("createDB.success", count);
- }, function onError(err) {
- sendAsyncMessage("createDB.error", "Failed to create the DB: " +
- "(" + err.name + ") " + err.message);
- });
-});
-
-addMessageListener("deleteDB", function() {
- Promise.resolve().then(
- DataManager.delete
- ).then(function onSuccess() {
- sendAsyncMessage("deleteDB.success");
- }, function onError(err) {
- sendAsyncMessage("deleteDB.error", "Failed to delete the DB:" + err.name);
- });
-});
deleted file mode 100644
--- a/dom/contacts/tests/test_permission_denied.html
+++ /dev/null
@@ -1,29 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<iframe></iframe>
-<pre id="test">
-<script type="application/javascript">
-
-function run_tests() {
- var iframe = document.querySelector("iframe");
- iframe.src = "file_permission_denied.html";
-}
-
-SimpleTest.waitForExplicitFinish();
-onload = function() {
- SpecialPowers.pushPermissions([
- {type: "contacts-read", allow: false, context: document},
- {type: "contacts-write", allow: false, context: document},
- {type: "contacts-create", allow: false, context: document},
- ], run_tests);
-};
-
-</script>
-</pre>
-</body>
-</html>
--- a/dom/events/test/test_all_synthetic_events.html
+++ b/dom/events/test/test_all_synthetic_events.html
@@ -170,20 +170,16 @@ const kEventConstructors = {
GamepadButtonEvent: { create: function (aName, aProps) {
return new GamepadButtonEvent(aName, aProps);
},
},
HashChangeEvent: { create: function (aName, aProps) {
return new HashChangeEvent(aName, aProps);
},
},
- IccChangeEvent: { create: function (aName, aProps) {
- return new IccChangeEvent(aName, aProps);
- },
- },
IDBVersionChangeEvent: { create: function (aName, aProps) {
return new IDBVersionChangeEvent(aName, aProps);
},
},
ImageCaptureErrorEvent: { create: function (aName, aProps) {
return new ImageCaptureErrorEvent(aName, aProps);
},
},
--- a/dom/gamepad/GamepadServiceTest.h
+++ b/dom/gamepad/GamepadServiceTest.h
@@ -3,16 +3,17 @@
/* 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_GamepadServiceTest_h_
#define mozilla_dom_GamepadServiceTest_h_
#include "nsIIPCBackgroundChildCreateCallback.h"
+#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/dom/GamepadBinding.h"
namespace mozilla {
namespace dom {
class GamepadChangeEvent;
class GamepadManager;
class GamepadTestChannelChild;
deleted file mode 100644
--- a/dom/icc/Assertions.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/MozIccBinding.h"
-#include "nsIIccService.h"
-
-namespace mozilla {
-namespace dom {
-namespace icc {
-
-#define ASSERT_EQUALITY(webidlType, webidlState, xpidlState) \
- static_assert(static_cast<uint32_t>(webidlType::webidlState) == nsIIcc::xpidlState, \
- #webidlType "::" #webidlState " should equal to nsIIccService::" #xpidlState)
-
-/**
- * Enum IccCardState
- */
-#define ASSERT_ICC_CARD_STATE_EQUALITY(webidlState, xpidlState) \
- ASSERT_EQUALITY(IccCardState, webidlState, xpidlState)
-
-ASSERT_ICC_CARD_STATE_EQUALITY(Unknown, CARD_STATE_UNKNOWN);
-ASSERT_ICC_CARD_STATE_EQUALITY(Ready, CARD_STATE_READY);
-ASSERT_ICC_CARD_STATE_EQUALITY(PinRequired, CARD_STATE_PIN_REQUIRED);
-ASSERT_ICC_CARD_STATE_EQUALITY(PukRequired, CARD_STATE_PUK_REQUIRED);
-ASSERT_ICC_CARD_STATE_EQUALITY(PermanentBlocked, CARD_STATE_PERMANENT_BLOCKED);
-ASSERT_ICC_CARD_STATE_EQUALITY(PersonalizationInProgress, CARD_STATE_PERSONALIZATION_IN_PROGRESS);
-ASSERT_ICC_CARD_STATE_EQUALITY(PersonalizationReady, CARD_STATE_PERSONALIZATION_READY);
-ASSERT_ICC_CARD_STATE_EQUALITY(NetworkLocked, CARD_STATE_NETWORK_LOCKED);
-ASSERT_ICC_CARD_STATE_EQUALITY(NetworkSubsetLocked, CARD_STATE_NETWORK_SUBSET_LOCKED);
-ASSERT_ICC_CARD_STATE_EQUALITY(CorporateLocked, CARD_STATE_CORPORATE_LOCKED);
-ASSERT_ICC_CARD_STATE_EQUALITY(ServiceProviderLocked, CARD_STATE_SERVICE_PROVIDER_LOCKED);
-ASSERT_ICC_CARD_STATE_EQUALITY(SimPersonalizationLocked, CARD_STATE_SIM_LOCKED);
-ASSERT_ICC_CARD_STATE_EQUALITY(NetworkPukRequired, CARD_STATE_NETWORK_PUK_REQUIRED);
-ASSERT_ICC_CARD_STATE_EQUALITY(NetworkSubsetPukRequired, CARD_STATE_NETWORK_SUBSET_PUK_REQUIRED);
-ASSERT_ICC_CARD_STATE_EQUALITY(CorporatePukRequired, CARD_STATE_CORPORATE_PUK_REQUIRED);
-ASSERT_ICC_CARD_STATE_EQUALITY(ServiceProviderPukRequired, CARD_STATE_SERVICE_PROVIDER_PUK_REQUIRED);
-ASSERT_ICC_CARD_STATE_EQUALITY(SimPersonalizationPukRequired, CARD_STATE_SIM_PUK_REQUIRED);
-ASSERT_ICC_CARD_STATE_EQUALITY(Network1Locked, CARD_STATE_NETWORK1_LOCKED);
-ASSERT_ICC_CARD_STATE_EQUALITY(Network2Locked, CARD_STATE_NETWORK2_LOCKED);
-ASSERT_ICC_CARD_STATE_EQUALITY(HrpdNetworkLocked, CARD_STATE_HRPD_NETWORK_LOCKED);
-ASSERT_ICC_CARD_STATE_EQUALITY(RuimCorporateLocked, CARD_STATE_RUIM_CORPORATE_LOCKED);
-ASSERT_ICC_CARD_STATE_EQUALITY(RuimServiceProviderLocked, CARD_STATE_RUIM_SERVICE_PROVIDER_LOCKED);
-ASSERT_ICC_CARD_STATE_EQUALITY(RuimPersonalizationLocked, CARD_STATE_RUIM_LOCKED);
-ASSERT_ICC_CARD_STATE_EQUALITY(Network1PukRequired, CARD_STATE_NETWORK1_PUK_REQUIRED);
-ASSERT_ICC_CARD_STATE_EQUALITY(Network2PukRequired, CARD_STATE_NETWORK2_PUK_REQUIRED);
-ASSERT_ICC_CARD_STATE_EQUALITY(HrpdNetworkPukRequired, CARD_STATE_HRPD_NETWORK_PUK_REQUIRED);
-ASSERT_ICC_CARD_STATE_EQUALITY(RuimCorporatePukRequired, CARD_STATE_RUIM_CORPORATE_PUK_REQUIRED);
-ASSERT_ICC_CARD_STATE_EQUALITY(RuimServiceProviderPukRequired, CARD_STATE_RUIM_SERVICE_PROVIDER_PUK_REQUIRED);
-ASSERT_ICC_CARD_STATE_EQUALITY(RuimPersonalizationPukRequired, CARD_STATE_RUIM_PUK_REQUIRED);
-ASSERT_ICC_CARD_STATE_EQUALITY(Illegal, CARD_STATE_ILLEGAL);
-
-#undef ASSERT_ICC_CARD_STATE_EQUALITY
-
-/**
- * Enum IccLockType
- */
-#define ASSERT_ICC_LOCK_TYPE_EQUALITY(webidlState, xpidlState) \
- ASSERT_EQUALITY(IccLockType, webidlState, xpidlState)
-
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Pin, CARD_LOCK_TYPE_PIN);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Pin2, CARD_LOCK_TYPE_PIN2);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Puk, CARD_LOCK_TYPE_PUK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Puk2, CARD_LOCK_TYPE_PUK2);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Nck, CARD_LOCK_TYPE_NCK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Nsck, CARD_LOCK_TYPE_NSCK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Nck1, CARD_LOCK_TYPE_NCK1);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Nck2, CARD_LOCK_TYPE_NCK2);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Hnck, CARD_LOCK_TYPE_HNCK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Cck, CARD_LOCK_TYPE_CCK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Spck, CARD_LOCK_TYPE_SPCK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Pck, CARD_LOCK_TYPE_PCK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Rcck, CARD_LOCK_TYPE_RCCK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Rspck, CARD_LOCK_TYPE_RSPCK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(NckPuk, CARD_LOCK_TYPE_NCK_PUK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(NsckPuk, CARD_LOCK_TYPE_NSCK_PUK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Nck1Puk, CARD_LOCK_TYPE_NCK1_PUK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Nck2Puk, CARD_LOCK_TYPE_NCK2_PUK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(HnckPuk, CARD_LOCK_TYPE_HNCK_PUK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(CckPuk, CARD_LOCK_TYPE_CCK_PUK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(SpckPuk, CARD_LOCK_TYPE_SPCK_PUK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(PckPuk, CARD_LOCK_TYPE_PCK_PUK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(RcckPuk, CARD_LOCK_TYPE_RCCK_PUK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(RspckPuk, CARD_LOCK_TYPE_RSPCK_PUK);
-ASSERT_ICC_LOCK_TYPE_EQUALITY(Fdn, CARD_LOCK_TYPE_FDN);
-
-#undef ASSERT_ICC_LOCK_TYPE_EQUALITY
-
-/**
- * Enum IccContactType
- */
-#define ASSERT_ICC_CONTACT_TYPE_EQUALITY(webidlState, xpidlState) \
- ASSERT_EQUALITY(IccContactType, webidlState, xpidlState)
-
-ASSERT_ICC_CONTACT_TYPE_EQUALITY(Adn, CARD_CONTACT_TYPE_ADN);
-ASSERT_ICC_CONTACT_TYPE_EQUALITY(Fdn, CARD_CONTACT_TYPE_FDN);
-ASSERT_ICC_CONTACT_TYPE_EQUALITY(Sdn, CARD_CONTACT_TYPE_SDN);
-
-#undef ASSERT_ICC_CONTACT_TYPE_EQUALITY
-
-/**
- * Enum IccMvnoType
- */
-#define ASSERT_ICC_MVNO_TYPE_EQUALITY(webidlState, xpidlState) \
- ASSERT_EQUALITY(IccMvnoType, webidlState, xpidlState)
-
-ASSERT_ICC_MVNO_TYPE_EQUALITY(Imsi, CARD_MVNO_TYPE_IMSI);
-ASSERT_ICC_MVNO_TYPE_EQUALITY(Spn, CARD_MVNO_TYPE_SPN);
-ASSERT_ICC_MVNO_TYPE_EQUALITY(Gid, CARD_MVNO_TYPE_GID);
-
-#undef ASSERT_ICC_MVNO_TYPE_EQUALITY
-
-/**
- * Enum IccService
- */
-#define ASSERT_ICC_SERVICE_EQUALITY(webidlState, xpidlState) \
- ASSERT_EQUALITY(IccService, webidlState, xpidlState)
-
-ASSERT_ICC_SERVICE_EQUALITY(Fdn, CARD_SERVICE_FDN);
-
-#undef ASSERT_ICC_SERVICE_EQUALITY
-
-#undef ASSERT_EQUALITY
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/icc/Icc.cpp
+++ /dev/null
@@ -1,519 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/Icc.h"
-
-#include "IccCallback.h"
-#include "IccContact.h"
-#include "mozilla/dom/ContactsBinding.h"
-#include "mozilla/dom/DOMRequest.h"
-#include "mozilla/dom/IccInfo.h"
-#include "mozilla/dom/MozStkCommandEvent.h"
-#include "mozilla/dom/Promise.h"
-#include "mozilla/dom/ScriptSettings.h"
-#include "nsIIccInfo.h"
-#include "nsIIccService.h"
-#include "nsIStkCmdFactory.h"
-#include "nsIStkProactiveCmd.h"
-#include "nsServiceManagerUtils.h"
-#include "nsContentUtils.h"
-
-using mozilla::dom::icc::IccCallback;
-using mozilla::dom::icc::IccContact;
-
-namespace mozilla {
-namespace dom {
-
-namespace {
-
-bool
-IsPukCardLockType(IccLockType aLockType)
-{
- switch(aLockType) {
- case IccLockType::Puk:
- case IccLockType::Puk2:
- case IccLockType::NckPuk:
- case IccLockType::Nck1Puk:
- case IccLockType::Nck2Puk:
- case IccLockType::HnckPuk:
- case IccLockType::CckPuk:
- case IccLockType::SpckPuk:
- case IccLockType::RcckPuk:
- case IccLockType::RspckPuk:
- case IccLockType::NsckPuk:
- case IccLockType::PckPuk:
- return true;
- default:
- return false;
- }
-}
-
-} // namespace
-
-NS_IMPL_CYCLE_COLLECTION_INHERITED(Icc, DOMEventTargetHelper, mIccInfo)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(Icc)
-NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
-
-NS_IMPL_ADDREF_INHERITED(Icc, DOMEventTargetHelper)
-NS_IMPL_RELEASE_INHERITED(Icc, DOMEventTargetHelper)
-
-Icc::Icc(nsPIDOMWindowInner* aWindow, nsIIcc* aHandler, nsIIccInfo* aIccInfo)
- : mLive(true)
- , mHandler(aHandler)
-{
- BindToOwner(aWindow);
-
- if (aIccInfo) {
- aIccInfo->GetIccid(mIccId);
- UpdateIccInfo(aIccInfo);
- }
-}
-
-Icc::~Icc()
-{
-}
-
-void
-Icc::Shutdown()
-{
- mIccInfo.SetNull();
- mHandler = nullptr;
- mLive = false;
-}
-
-nsresult
-Icc::NotifyEvent(const nsAString& aName)
-{
- return DispatchTrustedEvent(aName);
-}
-
-nsresult
-Icc::NotifyStkEvent(const nsAString& aName, nsIStkProactiveCmd* aStkProactiveCmd)
-{
- JS::RootingContext* cx = RootingCx();
- JS::Rooted<JS::Value> value(cx);
-
- nsCOMPtr<nsIStkCmdFactory> cmdFactory =
- do_GetService(ICC_STK_CMD_FACTORY_CONTRACTID);
- NS_ENSURE_TRUE(cmdFactory, NS_ERROR_UNEXPECTED);
-
- cmdFactory->CreateCommandMessage(aStkProactiveCmd, &value);
- NS_ENSURE_TRUE(value.isObject(), NS_ERROR_UNEXPECTED);
-
- RootedDictionary<MozStkCommandEventInit> init(cx);
- init.mBubbles = false;
- init.mCancelable = false;
- init.mCommand = value;
-
- RefPtr<MozStkCommandEvent> event =
- MozStkCommandEvent::Constructor(this, aName, init);
-
- return DispatchTrustedEvent(event);
-}
-
-void
-Icc::UpdateIccInfo(nsIIccInfo* aIccInfo)
-{
- if (!aIccInfo) {
- mIccInfo.SetNull();
- return;
- }
-
- nsCOMPtr<nsIGsmIccInfo> gsmIccInfo(do_QueryInterface(aIccInfo));
- if (gsmIccInfo) {
- if (mIccInfo.IsNull() || !mIccInfo.Value().IsMozGsmIccInfo()) {
- mIccInfo.SetValue().SetAsMozGsmIccInfo() = new GsmIccInfo(GetOwner());
- }
- mIccInfo.Value().GetAsMozGsmIccInfo().get()->Update(gsmIccInfo);
- return;
- }
-
- nsCOMPtr<nsICdmaIccInfo> cdmaIccInfo(do_QueryInterface(aIccInfo));
- if (cdmaIccInfo) {
- if (mIccInfo.IsNull() || !mIccInfo.Value().IsMozCdmaIccInfo()) {
- mIccInfo.SetValue().SetAsMozCdmaIccInfo() = new CdmaIccInfo(GetOwner());
- }
- mIccInfo.Value().GetAsMozCdmaIccInfo().get()->Update(cdmaIccInfo);
- return;
- }
-
- if (mIccInfo.IsNull() || !mIccInfo.Value().IsMozIccInfo()) {
- mIccInfo.SetValue().SetAsMozIccInfo() = new IccInfo(GetOwner());
- }
- mIccInfo.Value().GetAsMozIccInfo().get()->Update(aIccInfo);
-}
-
-// WrapperCache
-
-JSObject*
-Icc::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return MozIccBinding::Wrap(aCx, this, aGivenProto);
-}
-
-// MozIcc WebIDL
-
-void
-Icc::GetIccInfo(Nullable<OwningMozIccInfoOrMozGsmIccInfoOrMozCdmaIccInfo>& aIccInfo) const
-{
- aIccInfo = mIccInfo;
-}
-
-Nullable<IccCardState>
-Icc::GetCardState() const
-{
- Nullable<IccCardState> result;
-
- uint32_t cardState = nsIIcc::CARD_STATE_UNDETECTED;
- if (mHandler &&
- NS_SUCCEEDED(mHandler->GetCardState(&cardState)) &&
- cardState != nsIIcc::CARD_STATE_UNDETECTED) {
- MOZ_ASSERT(cardState < static_cast<uint32_t>(IccCardState::EndGuard_));
- result.SetValue(static_cast<IccCardState>(cardState));
- }
-
- return result;
-}
-
-void
-Icc::SendStkResponse(const JSContext* aCx, JS::Handle<JS::Value> aCommand,
- JS::Handle<JS::Value> aResponse, ErrorResult& aRv)
-{
- if (!mHandler) {
- aRv.Throw(NS_ERROR_FAILURE);
- return;
- }
-
- nsCOMPtr<nsIStkCmdFactory> cmdFactory =
- do_GetService(ICC_STK_CMD_FACTORY_CONTRACTID);
- if (!cmdFactory) {
- aRv.Throw(NS_ERROR_FAILURE);
- return;
- }
-
- nsCOMPtr<nsIStkProactiveCmd> command;
- cmdFactory->CreateCommand(aCommand, getter_AddRefs(command));
- if (!command) {
- aRv.Throw(NS_ERROR_FAILURE);
- return;
- }
-
- nsCOMPtr<nsIStkTerminalResponse> response;
- cmdFactory->CreateResponse(aResponse, getter_AddRefs(response));
- if (!response) {
- aRv.Throw(NS_ERROR_FAILURE);
- return;
- }
-
- nsresult rv = mHandler->SendStkResponse(command, response);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- }
-}
-
-void
-Icc::SendStkMenuSelection(uint16_t aItemIdentifier, bool aHelpRequested,
- ErrorResult& aRv)
-{
- if (!mHandler) {
- aRv.Throw(NS_ERROR_FAILURE);
- return;
- }
-
- nsresult rv = mHandler->SendStkMenuSelection(aItemIdentifier, aHelpRequested);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- }
-}
-
-void
-Icc::SendStkTimerExpiration(const JSContext* aCx, JS::Handle<JS::Value> aTimer,
- ErrorResult& aRv)
-{
- if (!mHandler) {
- aRv.Throw(NS_ERROR_FAILURE);
- return;
- }
-
- nsCOMPtr<nsIStkCmdFactory> cmdFactory =
- do_GetService(ICC_STK_CMD_FACTORY_CONTRACTID);
- if (!cmdFactory) {
- aRv.Throw(NS_ERROR_FAILURE);
- return;
- }
-
- nsCOMPtr<nsIStkTimer> timer;
- cmdFactory->CreateTimer(aTimer, getter_AddRefs(timer));
- if (!timer) {
- aRv.Throw(NS_ERROR_FAILURE);
- return;
- }
-
- uint16_t timerId;
- nsresult rv = timer->GetTimerId(&timerId);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- }
-
- uint32_t timerValue;
- rv = timer->GetTimerValue(&timerValue);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- }
-
- rv = mHandler->SendStkTimerExpiration(timerId, timerValue);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- }
-}
-
-void
-Icc::SendStkEventDownload(const JSContext* aCx, JS::Handle<JS::Value> aEvent,
- ErrorResult& aRv)
-{
- if (!mHandler) {
- aRv.Throw(NS_ERROR_FAILURE);
- return;
- }
-
- nsCOMPtr<nsIStkCmdFactory> cmdFactory =
- do_GetService(ICC_STK_CMD_FACTORY_CONTRACTID);
- if (!cmdFactory) {
- aRv.Throw(NS_ERROR_FAILURE);
- return;
- }
-
- nsCOMPtr<nsIStkDownloadEvent> event;
- cmdFactory->CreateEvent(aEvent, getter_AddRefs(event));
- if (!event) {
- aRv.Throw(NS_ERROR_FAILURE);
- return;
- }
-
- nsresult rv = mHandler->SendStkEventDownload(event);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- }
-}
-
-already_AddRefed<DOMRequest>
-Icc::GetCardLock(IccLockType aLockType, ErrorResult& aRv)
-{
- if (!mHandler) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- // TODO: Bug 1125018 - Simplify The Result of GetCardLock and
- // getCardLockRetryCount in MozIcc.webidl without a wrapper object.
- RefPtr<IccCallback> requestCallback =
- new IccCallback(GetOwner(), request, true);
- nsresult rv = mHandler->GetCardLockEnabled(static_cast<uint32_t>(aLockType),
- requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-Icc::UnlockCardLock(const IccUnlockCardLockOptions& aOptions, ErrorResult& aRv)
-{
- if (!mHandler) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<IccCallback> requestCallback =
- new IccCallback(GetOwner(), request);
- const nsString& password = IsPukCardLockType(aOptions.mLockType)
- ? aOptions.mPuk : aOptions.mPin;
- nsresult rv =
- mHandler->UnlockCardLock(static_cast<uint32_t>(aOptions.mLockType),
- password, aOptions.mNewPin, requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-Icc::SetCardLock(const IccSetCardLockOptions& aOptions, ErrorResult& aRv)
-{
- if (!mHandler) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- nsresult rv;
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<IccCallback> requestCallback =
- new IccCallback(GetOwner(), request);
-
- if (aOptions.mEnabled.WasPassed()) {
- // Enable card lock.
- const nsString& password = (aOptions.mLockType == IccLockType::Fdn) ?
- aOptions.mPin2 : aOptions.mPin;
-
- rv =
- mHandler->SetCardLockEnabled(static_cast<uint32_t>(aOptions.mLockType),
- password, aOptions.mEnabled.Value(),
- requestCallback);
- } else {
- // Change card lock password.
- rv =
- mHandler->ChangeCardLockPassword(static_cast<uint32_t>(aOptions.mLockType),
- aOptions.mPin, aOptions.mNewPin,
- requestCallback);
- }
-
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-Icc::GetCardLockRetryCount(IccLockType aLockType, ErrorResult& aRv)
-{
- if (!mHandler) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<IccCallback> requestCallback =
- new IccCallback(GetOwner(), request);
- nsresult rv = mHandler->GetCardLockRetryCount(static_cast<uint32_t>(aLockType),
- requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-Icc::ReadContacts(IccContactType aContactType, ErrorResult& aRv)
-{
- if (!mHandler) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<IccCallback> requestCallback =
- new IccCallback(GetOwner(), request);
-
- nsresult rv = mHandler->ReadContacts(static_cast<uint32_t>(aContactType),
- requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-Icc::UpdateContact(IccContactType aContactType, mozContact& aContact,
- const nsAString& aPin2, ErrorResult& aRv)
-{
- if (!mHandler) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<IccCallback> requestCallback =
- new IccCallback(GetOwner(), request);
-
- nsCOMPtr<nsIIccContact> iccContact;
- nsresult rv = IccContact::Create(aContact, getter_AddRefs(iccContact));
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- rv = mHandler->UpdateContact(static_cast<uint32_t>(aContactType),
- iccContact,
- aPin2,
- requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-Icc::MatchMvno(IccMvnoType aMvnoType, const nsAString& aMvnoData,
- ErrorResult& aRv)
-{
- if (!mHandler) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<IccCallback> requestCallback =
- new IccCallback(GetOwner(), request);
- nsresult rv = mHandler->MatchMvno(static_cast<uint32_t>(aMvnoType),
- aMvnoData, requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<Promise>
-Icc::GetServiceState(IccService aService, ErrorResult& aRv)
-{
- if (!mHandler) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(GetOwner());
- if (!global) {
- return nullptr;
- }
-
- RefPtr<Promise> promise = Promise::Create(global, aRv);
- if (aRv.Failed()) {
- return nullptr;
- }
-
- RefPtr<IccCallback> requestCallback =
- new IccCallback(GetOwner(), promise);
-
- nsresult rv =
- mHandler->GetServiceStateEnabled(static_cast<uint32_t>(aService),
- requestCallback);
-
- if (NS_FAILED(rv)) {
- promise->MaybeReject(NS_ERROR_DOM_INVALID_STATE_ERR);
- // fall-through to return promise.
- }
-
- return promise.forget();
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/icc/Icc.h
+++ /dev/null
@@ -1,134 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_Icc_h
-#define mozilla_dom_Icc_h
-
-#include "mozilla/dom/MozIccBinding.h"
-#include "mozilla/DOMEventTargetHelper.h"
-
-class nsIIcc;
-class nsIIccInfo;
-class nsIIccProvider;
-class nsIStkProactiveCmd;
-
-namespace mozilla {
-namespace dom {
-
-class DOMRequest;
-class OwningMozIccInfoOrMozGsmIccInfoOrMozCdmaIccInfo;
-class mozContact;
-class Promise;
-
-class Icc final : public DOMEventTargetHelper
-{
-public:
- NS_DECL_ISUPPORTS_INHERITED
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(Icc, DOMEventTargetHelper)
- NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
-
- Icc(nsPIDOMWindowInner* aWindow, nsIIcc* aHandler, nsIIccInfo* aIccInfo);
-
- void
- Shutdown();
-
- nsresult
- NotifyEvent(const nsAString& aName);
-
- nsresult
- NotifyStkEvent(const nsAString& aName, nsIStkProactiveCmd* aStkProactiveCmd);
-
- nsString
- GetIccId()
- {
- return mIccId;
- }
-
- void
- UpdateIccInfo(nsIIccInfo* aIccInfo);
-
- nsPIDOMWindowInner*
- GetParentObject() const
- {
- return GetOwner();
- }
-
- // WrapperCache
- virtual JSObject*
- WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
- // MozIcc WebIDL
- void
- GetIccInfo(Nullable<OwningMozIccInfoOrMozGsmIccInfoOrMozCdmaIccInfo>& aIccInfo) const;
-
- Nullable<IccCardState>
- GetCardState() const;
-
- void
- SendStkResponse(const JSContext* aCx, JS::Handle<JS::Value> aCommand,
- JS::Handle<JS::Value> aResponse, ErrorResult& aRv);
-
- void
- SendStkMenuSelection(uint16_t aItemIdentifier, bool aHelpRequested,
- ErrorResult& aRv);
-
- void
- SendStkTimerExpiration(const JSContext* aCx, JS::Handle<JS::Value> aTimer,
- ErrorResult& aRv);
-
- void
- SendStkEventDownload(const JSContext* aCx, JS::Handle<JS::Value> aEvent,
- ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- GetCardLock(IccLockType aLockType, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- UnlockCardLock(const IccUnlockCardLockOptions& aOptions, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- SetCardLock(const IccSetCardLockOptions& aOptions, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- GetCardLockRetryCount(IccLockType aLockType, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- ReadContacts(IccContactType aContactType, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- UpdateContact(IccContactType aContactType, mozContact& aContact,
- const nsAString& aPin2, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- MatchMvno(IccMvnoType aMvnoType, const nsAString& aMatchData,
- ErrorResult& aRv);
-
- already_AddRefed<Promise>
- GetServiceState(IccService aService, ErrorResult& aRv);
-
- IMPL_EVENT_HANDLER(iccinfochange)
- IMPL_EVENT_HANDLER(cardstatechange)
- IMPL_EVENT_HANDLER(stkcommand)
- IMPL_EVENT_HANDLER(stksessionend)
-
-private:
- // Put definition of the destructor in Icc.cpp to ensure forward declaration
- // of nsIIccProvider, nsIIcc for the auto-generated .cpp file (i.e.,
- // MozIccManagerBinding.cpp) that includes this header.
- ~Icc();
-
- bool mLive;
- nsString mIccId;
- // mHandler will be released at Shutdown(), so there is no need to join cycle
- // collection.
- nsCOMPtr<nsIIcc> mHandler;
- Nullable<OwningMozIccInfoOrMozGsmIccInfoOrMozCdmaIccInfo> mIccInfo;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_icc_Icc_h
deleted file mode 100644
--- a/dom/icc/IccCallback.cpp
+++ /dev/null
@@ -1,297 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "IccCallback.h"
-
-#include "mozilla/dom/ContactsBinding.h"
-#include "mozilla/dom/IccCardLockError.h"
-#include "mozilla/dom/MozIccBinding.h"
-#include "mozilla/dom/Promise.h"
-#include "mozilla/dom/ToJSValue.h"
-#include "nsIIccContact.h"
-#include "nsJSUtils.h"
-#include "nsServiceManagerUtils.h"
-
-namespace mozilla {
-namespace dom {
-namespace icc {
-
-namespace {
-
-static nsresult
-IccContactToMozContact(JSContext* aCx, GlobalObject& aGlobal,
- nsIIccContact* aIccContact,
- mozContact** aMozContact)
-{
- *aMozContact = nullptr;
-
- ContactProperties properties;
-
- // Names
- char16_t** rawStringArray = nullptr;
- uint32_t count = 0;
- nsresult rv = aIccContact->GetNames(&count, &rawStringArray);
- NS_ENSURE_SUCCESS(rv, rv);
- if (count > 0) {
- Sequence<nsString>& nameSeq = properties.mName.Construct().SetValue();
- for (uint32_t i = 0; i < count; i++) {
- nameSeq.AppendElement(
- rawStringArray[i] ? nsDependentString(rawStringArray[i])
- : EmptyString(),
- fallible);
- }
- NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, rawStringArray);
- }
-
- // Numbers
- rawStringArray = nullptr;
- count = 0;
- rv = aIccContact->GetNumbers(&count, &rawStringArray);
- NS_ENSURE_SUCCESS(rv, rv);
- if (count > 0) {
- Sequence<ContactTelField>& numberSeq = properties.mTel.Construct().SetValue();
- for (uint32_t i = 0; i < count; i++) {
- ContactTelField number;
- number.mValue.Construct() =
- rawStringArray[i] ? nsDependentString(rawStringArray[i])
- : EmptyString();
- numberSeq.AppendElement(number, fallible);
- }
- NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, rawStringArray);
- }
-
- // Emails
- rawStringArray = nullptr;
- count = 0;
- rv = aIccContact->GetEmails(&count, &rawStringArray);
- NS_ENSURE_SUCCESS(rv, rv);
- if (count > 0) {
- Sequence<ContactField>& emailSeq = properties.mEmail.Construct().SetValue();
- for (uint32_t i = 0; i < count; i++) {
- ContactField email;
- email.mValue.Construct() =
- rawStringArray[i] ? nsDependentString(rawStringArray[i])
- : EmptyString();
- emailSeq.AppendElement(email, fallible);
- }
- NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, rawStringArray);
- }
-
- ErrorResult er;
- RefPtr<mozContact> contact
- = mozContact::Constructor(aGlobal, aCx, properties, er);
- rv = er.StealNSResult();
- NS_ENSURE_SUCCESS(rv, rv);
-
- nsAutoString contactId;
- rv = aIccContact->GetId(contactId);
- NS_ENSURE_SUCCESS(rv, rv);
-
- contact->SetId(contactId, er);
- rv = er.StealNSResult();
- NS_ENSURE_SUCCESS(rv, rv);
-
- contact.forget(aMozContact);
-
- return NS_OK;
-}
-
-static nsresult
-IccContactListToMozContactList(JSContext* aCx, GlobalObject& aGlobal,
- nsIIccContact** aContacts, uint32_t aCount,
- nsTArray<RefPtr<mozContact>>& aContactList)
-{
- aContactList.SetCapacity(aCount);
- for (uint32_t i = 0; i < aCount ; i++) {
- RefPtr<mozContact> contact;
- nsresult rv =
- IccContactToMozContact(aCx, aGlobal, aContacts[i], getter_AddRefs(contact));
- NS_ENSURE_SUCCESS(rv, rv);
-
- aContactList.AppendElement(contact);
- }
-
- return NS_OK;
-}
-
-} // anonymous namespace
-
-NS_IMPL_ISUPPORTS(IccCallback, nsIIccCallback)
-
-IccCallback::IccCallback(nsPIDOMWindowInner* aWindow, DOMRequest* aRequest,
- bool aIsCardLockEnabled)
- : mWindow(aWindow)
- , mRequest(aRequest)
- , mIsCardLockEnabled(aIsCardLockEnabled)
-{
-}
-
-IccCallback::IccCallback(nsPIDOMWindowInner* aWindow, Promise* aPromise)
- : mWindow(aWindow)
- , mPromise(aPromise)
-{
-}
-
-nsresult
-IccCallback::NotifySuccess(JS::Handle<JS::Value> aResult)
-{
- nsCOMPtr<nsIDOMRequestService> rs =
- do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
- NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
-
- return rs->FireSuccessAsync(mRequest, aResult);
-}
-
-nsresult
-IccCallback::NotifyGetCardLockEnabled(bool aResult)
-{
- IccCardLockStatus result;
- result.mEnabled.Construct(aResult);
-
- AutoJSAPI jsapi;
- if (NS_WARN_IF(!jsapi.Init(mWindow))) {
- return NS_ERROR_FAILURE;
- }
-
- JSContext* cx = jsapi.cx();
- JS::Rooted<JS::Value> jsResult(cx);
- if (!ToJSValue(cx, result, &jsResult)) {
- jsapi.ClearException();
- return NS_ERROR_TYPE_ERR;
- }
-
- return NotifySuccess(jsResult);
-}
-
-NS_IMETHODIMP
-IccCallback::NotifySuccess()
-{
- return NotifySuccess(JS::UndefinedHandleValue);
-}
-
-NS_IMETHODIMP
-IccCallback::NotifySuccessWithBoolean(bool aResult)
-{
- if (mPromise) {
- mPromise->MaybeResolve(aResult ? JS::TrueHandleValue : JS::FalseHandleValue);
- return NS_OK;
- }
-
- return mIsCardLockEnabled
- ? NotifyGetCardLockEnabled(aResult)
- : NotifySuccess(aResult ? JS::TrueHandleValue : JS::FalseHandleValue);
-}
-
-NS_IMETHODIMP
-IccCallback::NotifyGetCardLockRetryCount(int32_t aCount)
-{
- // TODO: Bug 1125018 - Simplify The Result of GetCardLock and
- // getCardLockRetryCount in MozIcc.webidl without a wrapper object.
- IccCardLockRetryCount result;
- result.mRetryCount.Construct(aCount);
-
- AutoJSAPI jsapi;
- if (NS_WARN_IF(!jsapi.Init(mWindow))) {
- return NS_ERROR_FAILURE;
- }
-
- JSContext* cx = jsapi.cx();
- JS::Rooted<JS::Value> jsResult(cx);
- if (!ToJSValue(cx, result, &jsResult)) {
- jsapi.ClearException();
- return NS_ERROR_TYPE_ERR;
- }
-
- return NotifySuccess(jsResult);
-}
-
-NS_IMETHODIMP
-IccCallback::NotifyError(const nsAString & aErrorMsg)
-{
- if (mPromise) {
- mPromise->MaybeRejectBrokenly(aErrorMsg);
- return NS_OK;
- }
-
- nsCOMPtr<nsIDOMRequestService> rs =
- do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
- NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
-
- return rs->FireErrorAsync(mRequest, aErrorMsg);
-}
-
-NS_IMETHODIMP
-IccCallback::NotifyCardLockError(const nsAString & aErrorMsg,
- int32_t aRetryCount)
-{
- RefPtr<IccCardLockError> error =
- new IccCardLockError(mWindow, aErrorMsg, aRetryCount);
- mRequest->FireDetailedError(error);
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
-IccCallback::NotifyRetrievedIccContacts(nsIIccContact** aContacts,
- uint32_t aCount)
-{
- MOZ_ASSERT(aContacts);
-
- AutoJSAPI jsapi;
- if (NS_WARN_IF(!jsapi.Init(mWindow))) {
- return NS_ERROR_FAILURE;
- }
-
- JSContext* cx = jsapi.cx();
- nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);
- GlobalObject global(cx, go->GetGlobalJSObject());
-
- nsTArray<RefPtr<mozContact>> contactList;
-
- nsresult rv =
- IccContactListToMozContactList(cx, global, aContacts, aCount, contactList);
- NS_ENSURE_SUCCESS(rv, rv);
-
- JS::Rooted<JS::Value> jsResult(cx);
-
- if (!ToJSValue(cx, contactList, &jsResult)) {
- return NS_ERROR_FAILURE;
- }
-
- return NotifySuccess(jsResult);
-}
-
-NS_IMETHODIMP
-IccCallback::NotifyUpdatedIccContact(nsIIccContact* aContact)
-{
- MOZ_ASSERT(aContact);
-
- AutoJSAPI jsapi;
- if (NS_WARN_IF(!jsapi.Init(mWindow))) {
- return NS_ERROR_FAILURE;
- }
-
- JSContext* cx = jsapi.cx();
- nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);
- GlobalObject global(cx, go->GetGlobalJSObject());
-
- RefPtr<mozContact> mozContact;
- nsresult rv =
- IccContactToMozContact(cx, global, aContact, getter_AddRefs(mozContact));
- NS_ENSURE_SUCCESS(rv, rv);
-
- JS::Rooted<JS::Value> jsResult(cx);
-
- if (!ToJSValue(cx, mozContact, &jsResult)) {
- return NS_ERROR_FAILURE;
- }
-
- return NotifySuccess(jsResult);
-}
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/icc/IccCallback.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_icc_IccCallback_h
-#define mozilla_dom_icc_IccCallback_h
-
-#include "nsCOMPtr.h"
-#include "nsIIccService.h"
-
-namespace mozilla {
-namespace dom {
-
-class DOMRequest;
-class Promise;
-
-namespace icc {
-
-/**
- * A callback object for handling asynchronous request/response. This object is
- * created when an asynchronous request is made and should be destroyed after
- * Notify*Success/Error is called.
- * The modules hold the reference of IccCallback in OOP mode and non-OOP mode
- * are different.
- * - OOP mode: IccRequestChild
- * - non-OOP mode: IccService
- * The reference should be released after Notify*Success/Error is called.
- */
-class IccCallback final : public nsIIccCallback
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIICCCALLBACK
-
- // TODO: Bug 1125018 - Simplify The Result of GetCardLock and
- // getCardLockRetryCount in MozIcc.webidl without a wrapper object.
- IccCallback(nsPIDOMWindowInner* aWindow, DOMRequest* aRequest,
- bool aIsCardLockEnabled = false);
- IccCallback(nsPIDOMWindowInner* aWindow, Promise* aPromise);
-
-private:
- ~IccCallback() {}
-
- nsresult
- NotifySuccess(JS::Handle<JS::Value> aResult);
-
- // TODO: Bug 1125018 - Simplify The Result of GetCardLock and
- // getCardLockRetryCount in MozIcc.webidl without a wrapper object.
- nsresult
- NotifyGetCardLockEnabled(bool aResult);
-
- nsCOMPtr<nsPIDOMWindowInner> mWindow;
- RefPtr<DOMRequest> mRequest;
- RefPtr<Promise> mPromise;
- // TODO: Bug 1125018 - Simplify The Result of GetCardLock and
- // getCardLockRetryCount in MozIcc.webidl without a wrapper object.
- bool mIsCardLockEnabled;
-};
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_icc_IccCallback_h
deleted file mode 100644
--- a/dom/icc/IccCardLockError.cpp
+++ /dev/null
@@ -1,47 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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>
-IccCardLockError::Constructor(const GlobalObject& aGlobal,
- const nsAString& aName,
- int16_t aRetryCount,
- ErrorResult& aRv)
-{
- nsCOMPtr<nsPIDOMWindowInner> window = do_QueryInterface(aGlobal.GetAsSupports());
- if (!window) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<IccCardLockError> result =
- new IccCardLockError(window, aName, aRetryCount);
- return result.forget();
-}
-
-IccCardLockError::IccCardLockError(nsPIDOMWindowInner* aWindow,
- const nsAString& aName,
- int16_t aRetryCount)
- : DOMError(aWindow, aName)
- , mRetryCount(aRetryCount)
-{
-}
-
-JSObject*
-IccCardLockError::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return IccCardLockErrorBinding::Wrap(aCx, this, aGivenProto);
-}
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/icc/IccCardLockError.h
+++ /dev/null
@@ -1,48 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 final : public DOMError
-{
-public:
- NS_DECL_ISUPPORTS_INHERITED
-
- IccCardLockError(nsPIDOMWindowInner* aWindow, const nsAString& aName,
- int16_t aRetryCount);
-
- static already_AddRefed<IccCardLockError>
- Constructor(const GlobalObject& aGlobal, const nsAString& aName,
- int16_t aRetryCount, ErrorResult& aRv);
-
- virtual JSObject*
- WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
- // WebIDL interface
-
- int16_t
- RetryCount() const
- {
- return mRetryCount;
- }
-
-private:
- ~IccCardLockError() {}
-
-private:
- int16_t mRetryCount;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_IccCardLockError_h
deleted file mode 100644
--- a/dom/icc/IccContact.cpp
+++ /dev/null
@@ -1,154 +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 "IccContact.h"
-#include "mozilla/dom/ContactsBinding.h"
-#include "nsReadableUtils.h"
-
-using namespace mozilla::dom::icc;
-
-using mozilla::dom::mozContact;
-
-NS_IMPL_ISUPPORTS(IccContact, nsIIccContact)
-
-/* static */ nsresult
-IccContact::Create(mozContact& aMozContact, nsIIccContact** aIccContact)
-{
- *aIccContact = nullptr;
- ErrorResult er;
-
- // Id
- nsAutoString id;
- aMozContact.GetId(id, er);
- nsresult rv = er.StealNSResult();
- NS_ENSURE_SUCCESS(rv, rv);
-
- // Names
- Nullable<nsTArray<nsString>> names;
- aMozContact.GetName(names, er);
- rv = er.StealNSResult();
- NS_ENSURE_SUCCESS(rv, rv);
- if (names.IsNull()) {
- // Set as Empty nsTarray<nsString> for IccContact constructor.
- names.SetValue();
- }
-
- // Numbers
- Nullable<nsTArray<ContactTelField>> nullableNumberList;
- aMozContact.GetTel(nullableNumberList, er);
- rv = er.StealNSResult();
- NS_ENSURE_SUCCESS(rv, rv);
- nsTArray<nsString> numbers;
- if (!nullableNumberList.IsNull()) {
- const nsTArray<ContactTelField>& numberList = nullableNumberList.Value();
- for (uint32_t i = 0; i < numberList.Length(); i++) {
- if (numberList[i].mValue.WasPassed()) {
- numbers.AppendElement(numberList[i].mValue.Value());
- }
- }
- }
-
- // Emails
- Nullable<nsTArray<ContactField>> nullableEmailList;
- aMozContact.GetEmail(nullableEmailList, er);
- rv = er.StealNSResult();
- NS_ENSURE_SUCCESS(rv, rv);
- nsTArray<nsString> emails;
- if (!nullableEmailList.IsNull()) {
- const nsTArray<ContactField>& emailList = nullableEmailList.Value();
- for (uint32_t i = 0; i < emailList.Length(); i++) {
- if (emailList[i].mValue.WasPassed()) {
- emails.AppendElement(emailList[i].mValue.Value());
- }
- }
- }
-
- nsCOMPtr<nsIIccContact> iccContact = new IccContact(id,
- names.Value(),
- numbers,
- emails);
- iccContact.forget(aIccContact);
-
- return NS_OK;
-}
-
-/*static*/ nsresult
-IccContact::Create(const nsAString& aId,
- const nsTArray<nsString>& aNames,
- const nsTArray<nsString>& aNumbers,
- const nsTArray<nsString>& aEmails,
- nsIIccContact** aIccContact)
-{
- *aIccContact = nullptr;
-
- nsCOMPtr<nsIIccContact> iccContact = new IccContact(aId,
- aNames,
- aNumbers,
- aEmails);
- iccContact.forget(aIccContact);
-
- return NS_OK;
-}
-
-IccContact::IccContact(const nsAString& aId,
- const nsTArray<nsString>& aNames,
- const nsTArray<nsString>& aNumbers,
- const nsTArray<nsString>& aEmails)
- : mId(aId),
- mNames(aNames),
- mNumbers(aNumbers),
- mEmails(aEmails)
-{
-}
-
-// nsIIccInfo implementation.
-
-NS_IMETHODIMP IccContact::GetId(nsAString & aId)
-{
- aId = mId;
- return NS_OK;
-}
-
-#define ICCCONTACT_IMPL_GET_CONTACT_FIELD(_field) \
-NS_IMETHODIMP IccContact::Get##_field(uint32_t* aCount, char16_t*** a##_field) \
-{ \
- NS_ENSURE_ARG_POINTER(aCount); \
- NS_ENSURE_ARG_POINTER(a##_field); \
- \
- *aCount = 0; \
- *a##_field = nullptr; \
- \
- uint32_t count = m##_field.Length(); \
- if (count == 0) { \
- return NS_OK; \
- } \
- char16_t** temp = \
- static_cast<char16_t**>(moz_xmalloc(sizeof(char16_t*) * (count))); \
- if (temp == nullptr) { \
- return NS_ERROR_OUT_OF_MEMORY; \
- } \
- for (uint32_t i = 0; i < count; i++) { \
- if(m##_field[i].IsVoid()) { \
- (temp)[i] = nullptr; \
- continue; \
- } \
- \
- (temp)[i] = ToNewUnicode(m##_field[i]); \
- if (!(temp)[i]) { \
- NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(i, temp); \
- return NS_ERROR_OUT_OF_MEMORY; \
- } \
- } \
- \
- *aCount = count; \
- *a##_field = temp; \
- \
- return NS_OK; \
-}
-
-ICCCONTACT_IMPL_GET_CONTACT_FIELD(Names)
-ICCCONTACT_IMPL_GET_CONTACT_FIELD(Numbers)
-ICCCONTACT_IMPL_GET_CONTACT_FIELD(Emails)
-
-#undef ICCCONTACT_GET_CONTACT_FIELD
deleted file mode 100644
--- a/dom/icc/IccContact.h
+++ /dev/null
@@ -1,50 +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/. */
-
-#ifndef mozilla_dom_icc_IccContact_h
-#define mozilla_dom_icc_IccContact_h
-
-#include "nsIIccContact.h"
-
-namespace mozilla {
-namespace dom {
-class mozContact;
-namespace icc {
-
-class IccContact : public nsIIccContact
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIICCCONTACT
-
- static nsresult
- Create(mozContact& aMozContact,
- nsIIccContact** aIccContact);
-
- static nsresult
- Create(const nsAString& aId,
- const nsTArray<nsString>& aNames,
- const nsTArray<nsString>& aNumbers,
- const nsTArray<nsString>& aEmails,
- nsIIccContact** aIccContact);
-
-private:
- IccContact(const nsAString& aId,
- const nsTArray<nsString>& aNames,
- const nsTArray<nsString>& aNumbers,
- const nsTArray<nsString>& aEmails);
- virtual ~IccContact() {}
-
- nsString mId;
- nsTArray<nsString> mNames;
- nsTArray<nsString> mNumbers;
- nsTArray<nsString> mEmails;
-};
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_icc_IccContact_h
-
deleted file mode 100644
--- a/dom/icc/IccInfo.cpp
+++ /dev/null
@@ -1,297 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/IccInfo.h"
-
-#include "mozilla/dom/icc/PIccTypes.h"
-#include "nsPIDOMWindow.h"
-
-#define CONVERT_STRING_TO_NULLABLE_ENUM(_string, _enumType, _enum) \
-{ \
- uint32_t i = 0; \
- for (const EnumEntry* entry = _enumType##Values::strings; \
- entry->value; \
- ++entry, ++i) { \
- if (_string.EqualsASCII(entry->value)) { \
- _enum.SetValue(static_cast<_enumType>(i)); \
- } \
- } \
-}
-
-using namespace mozilla::dom;
-
-using mozilla::dom::icc::IccInfoData;
-
-// IccInfo
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(IccInfo, mWindow)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(IccInfo)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(IccInfo)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(IccInfo)
- NS_INTERFACE_MAP_ENTRY(nsIIccInfo)
- NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
-NS_INTERFACE_MAP_END
-
-IccInfo::IccInfo(nsPIDOMWindowInner* aWindow)
- : mWindow(aWindow)
-{
- mIccType.SetIsVoid(true);
- mIccid.SetIsVoid(true);
- mMcc.SetIsVoid(true);
- mMnc.SetIsVoid(true);
- mSpn.SetIsVoid(true);
-}
-
-IccInfo::IccInfo(const IccInfoData& aData)
-{
- mIccType = aData.iccType();
- mIccid = aData.iccid();
- mMcc = aData.mcc();
- mMnc = aData.mnc();
- mSpn = aData.spn();
- mIsDisplayNetworkNameRequired = aData.isDisplayNetworkNameRequired();
- mIsDisplaySpnRequired = aData.isDisplaySpnRequired();
-}
-
-// nsIIccInfo
-
-NS_IMETHODIMP
-IccInfo::GetIccType(nsAString & aIccType)
-{
- aIccType = mIccType;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-IccInfo::GetIccid(nsAString & aIccid)
-{
- aIccid = mIccid;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-IccInfo::GetMcc(nsAString & aMcc)
-{
- aMcc = mMcc;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-IccInfo::GetMnc(nsAString & aMnc)
-{
- aMnc = mMnc;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-IccInfo::GetSpn(nsAString & aSpn)
-{
- aSpn = mSpn;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-IccInfo::GetIsDisplayNetworkNameRequired(bool *aIsDisplayNetworkNameRequired)
-{
- *aIsDisplayNetworkNameRequired = mIsDisplayNetworkNameRequired;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-IccInfo::GetIsDisplaySpnRequired(bool *aIsDisplaySpnRequired)
-{
- *aIsDisplaySpnRequired = mIsDisplaySpnRequired;
- return NS_OK;
-}
-
-void
-IccInfo::Update(nsIIccInfo* aInfo)
-{
- NS_ASSERTION(aInfo, "aInfo is null");
-
- aInfo->GetIccType(mIccType);
- aInfo->GetIccid(mIccid);
- aInfo->GetMcc(mMcc);
- aInfo->GetMnc(mMnc);
- aInfo->GetSpn(mSpn);
- aInfo->GetIsDisplayNetworkNameRequired(
- &mIsDisplayNetworkNameRequired);
- aInfo->GetIsDisplaySpnRequired(
- &mIsDisplaySpnRequired);
-}
-
-// WebIDL implementation
-
-JSObject*
-IccInfo::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return MozIccInfoBinding::Wrap(aCx, this, aGivenProto);
-}
-
-Nullable<IccType>
-IccInfo::GetIccType() const
-{
- Nullable<IccType> iccType;
-
- CONVERT_STRING_TO_NULLABLE_ENUM(mIccType, IccType, iccType);
-
- return iccType;
-}
-
-void
-IccInfo::GetIccid(nsAString& aIccId) const
-{
- aIccId = mIccid;
-}
-
-void
-IccInfo::GetMcc(nsAString& aMcc) const
-{
- aMcc = mMcc;
-}
-
-void
-IccInfo::GetMnc(nsAString& aMnc) const
-{
- aMnc = mMnc;
-}
-
-void
-IccInfo::GetSpn(nsAString& aSpn) const
-{
- aSpn = mSpn;
-}
-
-bool
-IccInfo::IsDisplayNetworkNameRequired() const
-{
- return mIsDisplayNetworkNameRequired;
-}
-
-bool
-IccInfo::IsDisplaySpnRequired() const
-{
- return mIsDisplaySpnRequired;
-}
-
-// GsmIccInfo
-
-NS_IMPL_ISUPPORTS_INHERITED(GsmIccInfo, IccInfo, nsIGsmIccInfo)
-
-GsmIccInfo::GsmIccInfo(nsPIDOMWindowInner* aWindow)
- : IccInfo(aWindow)
-{
- mPhoneNumber.SetIsVoid(true);
-}
-
-GsmIccInfo::GsmIccInfo(const IccInfoData& aData)
- : IccInfo(aData)
-{
- mPhoneNumber = aData.phoneNumber();
-}
-
-// nsIGsmIccInfo
-
-NS_IMETHODIMP
-GsmIccInfo::GetMsisdn(nsAString & aMsisdn)
-{
- aMsisdn = mPhoneNumber;
- return NS_OK;
-}
-
-// WebIDL implementation
-
-void
-GsmIccInfo::Update(nsIGsmIccInfo* aInfo)
-{
- MOZ_ASSERT(aInfo);
- nsCOMPtr<nsIIccInfo> iccInfo = do_QueryInterface(aInfo);
- MOZ_ASSERT(iccInfo);
-
- IccInfo::Update(iccInfo);
-
- aInfo->GetMsisdn(mPhoneNumber);
-}
-
-JSObject*
-GsmIccInfo::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return MozGsmIccInfoBinding::Wrap(aCx, this, aGivenProto);
-}
-
-void
-GsmIccInfo::GetMsisdn(nsAString& aMsisdn) const
-{
- aMsisdn = mPhoneNumber;
-}
-
-// CdmaIccInfo
-
-NS_IMPL_ISUPPORTS_INHERITED(CdmaIccInfo, IccInfo, nsICdmaIccInfo)
-
-CdmaIccInfo::CdmaIccInfo(nsPIDOMWindowInner* aWindow)
- : IccInfo(aWindow)
-{
- mPhoneNumber.SetIsVoid(true);
-}
-
-CdmaIccInfo::CdmaIccInfo(const IccInfoData& aData)
- : IccInfo(aData)
-{
- mPhoneNumber = aData.phoneNumber();
- mPrlVersion = aData.prlVersion();
-}
-
-// nsICdmaIccInfo
-
-NS_IMETHODIMP
-CdmaIccInfo::GetMdn(nsAString & aMdn)
-{
- aMdn = mPhoneNumber;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-CdmaIccInfo::GetPrlVersion(int32_t *aPrlVersion)
-{
- *aPrlVersion = mPrlVersion;
- return NS_OK;
-}
-
-void
-CdmaIccInfo::Update(nsICdmaIccInfo* aInfo)
-{
- MOZ_ASSERT(aInfo);
- nsCOMPtr<nsIIccInfo> iccInfo = do_QueryInterface(aInfo);
- MOZ_ASSERT(iccInfo);
-
- IccInfo::Update(iccInfo);
-
- aInfo->GetMdn(mPhoneNumber);
- aInfo->GetPrlVersion(&mPrlVersion);
-}
-
-// WebIDL implementation
-
-JSObject*
-CdmaIccInfo::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return MozCdmaIccInfoBinding::Wrap(aCx, this, aGivenProto);
-}
-
-void
-CdmaIccInfo::GetMdn(nsAString& aMdn) const
-{
- aMdn = mPhoneNumber;
-}
-
-int32_t
-CdmaIccInfo::PrlVersion() const
-{
- return mPrlVersion;
-}
deleted file mode 100644
--- a/dom/icc/IccInfo.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_IccInfo_h
-#define mozilla_dom_IccInfo_h
-
-#include "MozIccInfoBinding.h"
-#include "nsIIccInfo.h"
-#include "nsWrapperCache.h"
-
-class nsPIDOMWindowInner;
-
-namespace mozilla {
-namespace dom {
-
-namespace icc {
-class IccInfoData;
-} // namespace icc
-
-class IccInfo : public nsIIccInfo
- , public nsWrapperCache
-{
-public:
- NS_DECL_CYCLE_COLLECTING_ISUPPORTS
- NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(IccInfo)
- NS_DECL_NSIICCINFO
-
- explicit IccInfo(nsPIDOMWindowInner* aWindow);
- explicit IccInfo(const icc::IccInfoData& aData);
-
- void
- Update(nsIIccInfo* aInfo);
-
- nsPIDOMWindowInner*
- GetParentObject() const
- {
- return mWindow;
- }
-
- // WrapperCache
- virtual JSObject*
- WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
- // WebIDL interface
- Nullable<IccType>
- GetIccType() const;
-
- void
- GetIccid(nsAString& aIccId) const;
-
- void
- GetMcc(nsAString& aMcc) const;
-
- void
- GetMnc(nsAString& aMnc) const;
-
- void
- GetSpn(nsAString& aSpn) const;
-
- bool
- IsDisplayNetworkNameRequired() const;
-
- bool
- IsDisplaySpnRequired() const;
-
-protected:
- virtual ~IccInfo() {}
-
- nsCOMPtr<nsPIDOMWindowInner> mWindow;
- // To prevent compiling error in OS_WIN in auto-generated UnifiedBindingsXX.cpp,
- // we have all data fields expended here instead of having a data member of
- // |IccInfoData| defined in PIccTypes.h which indirectly includes "windows.h"
- // See 925382 for the restriction of including "windows.h" in UnifiedBindings.cpp.
- nsString mIccType;
- nsString mIccid;
- nsString mMcc;
- nsString mMnc;
- nsString mSpn;
- // The following booleans shall be initialized either in the constructor or in Update
- MOZ_INIT_OUTSIDE_CTOR bool mIsDisplayNetworkNameRequired;
- MOZ_INIT_OUTSIDE_CTOR bool mIsDisplaySpnRequired;
-};
-
-class GsmIccInfo final : public IccInfo
- , public nsIGsmIccInfo
-{
-public:
- NS_DECL_ISUPPORTS_INHERITED
- NS_FORWARD_NSIICCINFO(IccInfo::)
- NS_DECL_NSIGSMICCINFO
-
- explicit GsmIccInfo(nsPIDOMWindowInner* aWindow);
- explicit GsmIccInfo(const icc::IccInfoData& aData);
-
- void
- Update(nsIGsmIccInfo* aInfo);
-
- // WrapperCache
- virtual JSObject*
- WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
- // MozCdmaIccInfo WebIDL
- void
- GetMsisdn(nsAString& aMsisdn) const;
-
-private:
- ~GsmIccInfo() {}
-
- nsString mPhoneNumber;
-};
-
-class CdmaIccInfo final : public IccInfo
- , public nsICdmaIccInfo
-{
-public:
- NS_DECL_ISUPPORTS_INHERITED
- NS_FORWARD_NSIICCINFO(IccInfo::)
- NS_DECL_NSICDMAICCINFO
-
- explicit CdmaIccInfo(nsPIDOMWindowInner* aWindow);
- explicit CdmaIccInfo(const icc::IccInfoData& aData);
-
- void
- Update(nsICdmaIccInfo* aInfo);
-
- // WrapperCache
- virtual JSObject*
- WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
- // MozCdmaIccInfo WebIDL
- void
- GetMdn(nsAString& aMdn) const;
-
- int32_t
- PrlVersion() const;
-
-private:
- ~CdmaIccInfo() {}
-
- nsString mPhoneNumber;
- // The following integer shall be initialized either in the constructor or in Update
- MOZ_INIT_OUTSIDE_CTOR int32_t mPrlVersion;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_IccInfo_h
-
deleted file mode 100644
--- a/dom/icc/IccListener.cpp
+++ /dev/null
@@ -1,142 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "IccListener.h"
-
-#include "Icc.h"
-#include "IccManager.h"
-#include "nsIDOMClassInfo.h"
-#include "nsIIccInfo.h"
-
-using namespace mozilla::dom;
-
-NS_IMPL_ISUPPORTS(IccListener, nsIIccListener)
-
-IccListener::IccListener(IccManager* aIccManager, uint32_t aClientId)
- : mClientId(aClientId)
- , mIccManager(aIccManager)
-{
- MOZ_ASSERT(mIccManager);
-
- nsCOMPtr<nsIIccService> iccService = do_GetService(ICC_SERVICE_CONTRACTID);
-
- if (!iccService) {
- NS_WARNING("Could not acquire nsIIccService!");
- return;
- }
-
- iccService->GetIccByServiceId(mClientId, getter_AddRefs(mHandler));
- if (!mHandler) {
- NS_WARNING("Could not acquire nsIIcc!");
- return;
- }
-
- nsCOMPtr<nsIIccInfo> iccInfo;
- mHandler->GetIccInfo(getter_AddRefs(iccInfo));
- if (iccInfo) {
- nsString iccId;
- iccInfo->GetIccid(iccId);
- if (!iccId.IsEmpty()) {
- mIcc = new Icc(mIccManager->GetOwner(), mHandler, iccInfo);
- }
- }
-
- DebugOnly<nsresult> rv = mHandler->RegisterListener(this);
- NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
- "Failed registering icc listener with Icc Handler");
-}
-
-IccListener::~IccListener()
-{
- Shutdown();
-}
-
-void
-IccListener::Shutdown()
-{
- if (mHandler) {
- mHandler->UnregisterListener(this);
- mHandler = nullptr;
- }
-
- if (mIcc) {
- mIcc->Shutdown();
- mIcc = nullptr;
- }
-
- mIccManager = nullptr;
-}
-
-// nsIIccListener
-
-NS_IMETHODIMP
-IccListener::NotifyStkCommand(nsIStkProactiveCmd *aStkProactiveCmd)
-{
- if (!mIcc) {
- return NS_OK;
- }
-
- return mIcc->NotifyStkEvent(NS_LITERAL_STRING("stkcommand"), aStkProactiveCmd);
-}
-
-NS_IMETHODIMP
-IccListener::NotifyStkSessionEnd()
-{
- if (!mIcc) {
- return NS_OK;
- }
-
- return mIcc->NotifyEvent(NS_LITERAL_STRING("stksessionend"));
-}
-
-NS_IMETHODIMP
-IccListener::NotifyCardStateChanged()
-{
- if (!mIcc) {
- return NS_OK;
- }
-
- return mIcc->NotifyEvent(NS_LITERAL_STRING("cardstatechange"));
-}
-
-NS_IMETHODIMP
-IccListener::NotifyIccInfoChanged()
-{
- if (!mHandler) {
- return NS_OK;
- }
-
- nsCOMPtr<nsIIccInfo> iccInfo;
- mHandler->GetIccInfo(getter_AddRefs(iccInfo));
-
- // Create/delete icc object based on current iccInfo.
- // 1. If the mIcc is nullptr and iccInfo has valid data, create icc object and
- // notify mIccManager a new icc is added.
- // 2. If the mIcc is not nullptr and iccInfo becomes to null, delete existed
- // icc object and notify mIccManager the icc is removed.
- if (!mIcc) {
- if (iccInfo) {
- nsString iccId;
- iccInfo->GetIccid(iccId);
- if (!iccId.IsEmpty()) {
- mIcc = new Icc(mIccManager->GetOwner(), mHandler, iccInfo);
- mIccManager->NotifyIccAdd(iccId);
- mIcc->NotifyEvent(NS_LITERAL_STRING("iccinfochange"));
- }
- }
- } else {
- mIcc->UpdateIccInfo(iccInfo);
- mIcc->NotifyEvent(NS_LITERAL_STRING("iccinfochange"));
- if (!iccInfo) {
- nsString iccId = mIcc->GetIccId();
- mIcc->Shutdown();
- mIcc = nullptr;
- mIccManager->NotifyIccRemove(iccId);
- }
- }
-
- return NS_OK;
-}
deleted file mode 100644
--- a/dom/icc/IccListener.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_IccListener_h
-#define mozilla_dom_IccListener_h
-
-#include "nsIIccService.h"
-
-namespace mozilla {
-namespace dom {
-
-class IccManager;
-class Icc;
-
-class IccListener final : public nsIIccListener
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIICCLISTENER
-
- IccListener(IccManager* aIccManager, uint32_t aClientId);
-
- void
- Shutdown();
-
- Icc*
- GetIcc()
- {
- return mIcc;
- }
-
-private:
- ~IccListener();
-
-private:
- uint32_t mClientId;
- // We did not setup 'mIcc' and 'mIccManager' being a participant of cycle
- // collection is because in Navigator->Invalidate() it will call
- // mIccManager->Shutdown(), then IccManager will call Shutdown() of each
- // IccListener, this will release the reference and break the cycle.
- RefPtr<Icc> mIcc;
- RefPtr<IccManager> mIccManager;
- // mHandler will be released at Shutdown(), there is no need to join cycle
- // collection.
- nsCOMPtr<nsIIcc> mHandler;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_IccListener_h
deleted file mode 100644
--- a/dom/icc/IccManager.cpp
+++ /dev/null
@@ -1,155 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "IccManager.h"
-#include "mozilla/dom/MozIccManagerBinding.h"
-#include "Icc.h"
-#include "IccListener.h"
-#include "mozilla/AsyncEventDispatcher.h"
-#include "mozilla/dom/IccChangeEvent.h"
-#include "mozilla/Preferences.h"
-#include "nsIIccInfo.h"
-// Service instantiation
-#include "ipc/IccIPCService.h"
-#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
-#include "nsIGonkIccService.h"
-#endif
-#include "nsXULAppAPI.h" // For XRE_GetProcessType()
-
-using namespace mozilla::dom;
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(IccManager)
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(IccManager,
- DOMEventTargetHelper)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(IccManager,
- DOMEventTargetHelper)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
-// QueryInterface implementation for IccManager
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(IccManager)
-NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
-
-NS_IMPL_ADDREF_INHERITED(IccManager, DOMEventTargetHelper)
-NS_IMPL_RELEASE_INHERITED(IccManager, DOMEventTargetHelper)
-
-IccManager::IccManager(nsPIDOMWindowInner* aWindow)
- : DOMEventTargetHelper(aWindow)
-{
- uint32_t numberOfServices =
- mozilla::Preferences::GetUint("ril.numRadioInterfaces", 1);
-
- for (uint32_t i = 0; i < numberOfServices; i++) {
- RefPtr<IccListener> iccListener = new IccListener(this, i);
- mIccListeners.AppendElement(iccListener);
- }
-}
-
-IccManager::~IccManager()
-{
- Shutdown();
-}
-
-JSObject*
-IccManager::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return MozIccManagerBinding::Wrap(aCx, this, aGivenProto);
-}
-
-void
-IccManager::Shutdown()
-{
- for (uint32_t i = 0; i < mIccListeners.Length(); i++) {
- mIccListeners[i]->Shutdown();
- mIccListeners[i] = nullptr;
- }
- mIccListeners.Clear();
-}
-
-nsresult
-IccManager::NotifyIccAdd(const nsAString& aIccId)
-{
- MozIccManagerBinding::ClearCachedIccIdsValue(this);
-
- IccChangeEventInit init;
- init.mBubbles = false;
- init.mCancelable = false;
- init.mIccId = aIccId;
-
- RefPtr<IccChangeEvent> event =
- IccChangeEvent::Constructor(this, NS_LITERAL_STRING("iccdetected"), init);
- event->SetTrusted(true);
-
- RefPtr<AsyncEventDispatcher> asyncDispatcher =
- new AsyncEventDispatcher(this, event);
-
- return asyncDispatcher->PostDOMEvent();
-}
-
-nsresult
-IccManager::NotifyIccRemove(const nsAString& aIccId)
-{
- MozIccManagerBinding::ClearCachedIccIdsValue(this);
-
- IccChangeEventInit init;
- init.mBubbles = false;
- init.mCancelable = false;
- init.mIccId = aIccId;
-
- RefPtr<IccChangeEvent> event =
- IccChangeEvent::Constructor(this, NS_LITERAL_STRING("iccundetected"), init);
- event->SetTrusted(true);
-
- RefPtr<AsyncEventDispatcher> asyncDispatcher =
- new AsyncEventDispatcher(this, event);
-
- return asyncDispatcher->PostDOMEvent();
-}
-
-// MozIccManager
-
-void
-IccManager::GetIccIds(nsTArray<nsString>& aIccIds)
-{
- nsTArray<RefPtr<IccListener>>::size_type i;
- for (i = 0; i < mIccListeners.Length(); ++i) {
- Icc* icc = mIccListeners[i]->GetIcc();
- if (icc) {
- aIccIds.AppendElement(icc->GetIccId());
- }
- }
-}
-
-Icc*
-IccManager::GetIccById(const nsAString& aIccId) const
-{
- nsTArray<RefPtr<IccListener>>::size_type i;
- for (i = 0; i < mIccListeners.Length(); ++i) {
- Icc* icc = mIccListeners[i]->GetIcc();
- if (icc && aIccId == icc->GetIccId()) {
- return icc;
- }
- }
- return nullptr;
-}
-
-already_AddRefed<nsIIccService>
-NS_CreateIccService()
-{
- nsCOMPtr<nsIIccService> service;
-
- if (XRE_IsContentProcess()) {
- service = new mozilla::dom::icc::IccIPCService();
-#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
- } else {
- service = do_GetService(GONK_ICC_SERVICE_CONTRACTID);
-#endif
- }
-
- return service.forget();
-}
deleted file mode 100644
--- a/dom/icc/IccManager.h
+++ /dev/null
@@ -1,65 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_IccManager_h
-#define mozilla_dom_IccManager_h
-
-#include "mozilla/DOMEventTargetHelper.h"
-#include "nsCycleCollectionParticipant.h"
-#include "nsTArrayHelpers.h"
-
-namespace mozilla {
-namespace dom {
-
-class Icc;
-class IccListener;
-
-class IccManager final : public DOMEventTargetHelper
-{
-public:
- NS_DECL_ISUPPORTS_INHERITED
-
- NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
-
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(IccManager, DOMEventTargetHelper)
-
- explicit IccManager(nsPIDOMWindowInner* aWindow);
-
- void
- Shutdown();
-
- nsresult
- NotifyIccAdd(const nsAString& aIccId);
-
- nsresult
- NotifyIccRemove(const nsAString& aIccId);
-
- IMPL_EVENT_HANDLER(iccdetected)
- IMPL_EVENT_HANDLER(iccundetected)
-
- void
- GetIccIds(nsTArray<nsString>& aIccIds);
-
- Icc*
- GetIccById(const nsAString& aIccId) const;
-
- nsPIDOMWindowInner*
- GetParentObject() const { return GetOwner(); }
-
- virtual JSObject*
- WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
-private:
- ~IccManager();
-
-private:
- nsTArray<RefPtr<IccListener>> mIccListeners;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_IccManager_h
deleted file mode 100644
--- a/dom/icc/gonk/IccService.js
+++ /dev/null
@@ -1,741 +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/. */
-
-"use strict";
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-Cu.import("resource://gre/modules/Services.jsm");
-
-var RIL = {};
-Cu.import("resource://gre/modules/ril_consts.js", RIL);
-
-const GONK_ICCSERVICE_CONTRACTID = "@mozilla.org/icc/gonkiccservice;1";
-const GONK_ICCSERVICE_CID = Components.ID("{df854256-9554-11e4-a16c-c39e8d106c26}");
-
-const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
-const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
-
-const kPrefRilDebuggingEnabled = "ril.debugging.enabled";
-const kPrefRilNumRadioInterfaces = "ril.numRadioInterfaces";
-
-XPCOMUtils.defineLazyServiceGetter(this, "gRadioInterfaceLayer",
- "@mozilla.org/ril;1",
- "nsIRadioInterfaceLayer");
-
-XPCOMUtils.defineLazyServiceGetter(this, "gMobileConnectionService",
- "@mozilla.org/mobileconnection/mobileconnectionservice;1",
- "nsIGonkMobileConnectionService");
-
-XPCOMUtils.defineLazyServiceGetter(this, "gIccMessenger",
- "@mozilla.org/ril/system-messenger-helper;1",
- "nsIIccMessenger");
-
-XPCOMUtils.defineLazyServiceGetter(this, "gStkCmdFactory",
- "@mozilla.org/icc/stkcmdfactory;1",
- "nsIStkCmdFactory");
-
-var DEBUG = RIL.DEBUG_RIL;
-function debug(s) {
- dump("IccService: " + s);
-}
-
-function IccInfo() {}
-IccInfo.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIIccInfo]),
-
- // nsIIccInfo
-
- iccType: null,
- iccid: null,
- mcc: null,
- mnc: null,
- spn: null,
- isDisplayNetworkNameRequired: false,
- isDisplaySpnRequired: false
-};
-
-function GsmIccInfo() {}
-GsmIccInfo.prototype = {
- __proto__: IccInfo.prototype,
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIGsmIccInfo,
- Ci.nsIIccInfo]),
-
- // nsIGsmIccInfo
-
- msisdn: null
-};
-
-function CdmaIccInfo() {}
-CdmaIccInfo.prototype = {
- __proto__: IccInfo.prototype,
- QueryInterface: XPCOMUtils.generateQI([Ci.nsICdmaIccInfo,
- Ci.nsIIccInfo]),
-
- // nsICdmaIccInfo
-
- mdn: null,
- prlVersion: 0
-};
-
-function IccContact(aContact) {
- this.id = aContact.contactId || null;
- this._names = [];
- this._numbers = [];
- this._emails = [];
-
- this._names.push(aContact.alphaId);
- this._numbers.push(aContact.number);
-
- let anrLen = aContact.anr ? aContact.anr.length : 0;
- for (let i = 0; i < anrLen; i++) {
- this._numbers.push(aContact.anr[i]);
- }
-
- if (aContact.email) {
- this._emails.push(aContact.email);
- }
-}
-IccContact.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIIccContact]),
-
- _names: null,
- _numbers: null,
- _emails: null,
-
- // nsIIccContact
-
- id: null,
-
- getNames: function(aCount) {
- if (!this._names) {
- if (aCount) {
- aCount.value = 0;
- }
- return null;
- }
-
- if (aCount) {
- aCount.value = this._names.length;
- }
-
- return this._names.slice();
- },
-
- getNumbers: function(aCount) {
- if (!this._numbers) {
- if (aCount) {
- aCount.value = 0;
- }
- return null;
- }
-
- if (aCount) {
- aCount.value = this._numbers.length;
- }
-
- return this._numbers.slice();
- },
-
- getEmails: function(aCount) {
- if (!this._emails) {
- if (aCount) {
- aCount.value = 0;
- }
- return null;
- }
-
- if (aCount) {
- aCount.value = this._emails.length;
- }
-
- return this._emails.slice();
- },
-};
-
-function IccService() {
- this._iccs = [];
-
- let numClients = gRadioInterfaceLayer.numRadioInterfaces;
- for (let i = 0; i < numClients; i++) {
- this._iccs.push(new Icc(i));
- }
-
- this._updateDebugFlag();
-
- Services.prefs.addObserver(kPrefRilDebuggingEnabled, this, false);
- Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
-}
-IccService.prototype = {
- classID: GONK_ICCSERVICE_CID,
-
- classInfo: XPCOMUtils.generateCI({classID: GONK_ICCSERVICE_CID,
- contractID: GONK_ICCSERVICE_CONTRACTID,
- classDescription: "IccService",
- interfaces: [Ci.nsIIccService,
- Ci.nsIGonkIccService],
- flags: Ci.nsIClassInfo.SINGLETON}),
-
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIIccService,
- Ci.nsIGonkIccService,
- Ci.nsIObserver]),
-
- // An array of Icc instances.
- _iccs: null,
-
- _updateDebugFlag: function() {
- try {
- DEBUG = DEBUG ||
- Services.prefs.getBoolPref(kPrefRilDebuggingEnabled);
- } catch (e) {}
- },
-
- /**
- * nsIIccService interface.
- */
- getIccByServiceId: function(aServiceId) {
- let icc = this._iccs[aServiceId];
- if (!icc) {
- throw Cr.NS_ERROR_UNEXPECTED;
- }
-
- return icc;
- },
-
- /**
- * nsIGonkIccService interface.
- */
- notifyStkCommand: function(aServiceId, aStkcommand) {
- if (DEBUG) {
- debug("notifyStkCommand for service Id: " + aServiceId);
- }
-
- let icc = this.getIccByServiceId(aServiceId);
-
- if (!icc.iccInfo || !icc.iccInfo.iccid) {
- debug("Warning: got STK command when iccid is invalid.");
- return;
- }
-
- gIccMessenger.notifyStkProactiveCommand(icc.iccInfo.iccid, aStkcommand);
-
- icc._deliverListenerEvent("notifyStkCommand", [aStkcommand]);
- },
-
- notifyStkSessionEnd: function(aServiceId) {
- if (DEBUG) {
- debug("notifyStkSessionEnd for service Id: " + aServiceId);
- }
-
- this.getIccByServiceId(aServiceId)
- ._deliverListenerEvent("notifyStkSessionEnd");
- },
-
- notifyCardStateChanged: function(aServiceId, aCardState) {
- if (DEBUG) {
- debug("notifyCardStateChanged for service Id: " + aServiceId +
- ", CardState: " + aCardState);
- }
-
- this.getIccByServiceId(aServiceId)._updateCardState(aCardState);
- },
-
- notifyIccInfoChanged: function(aServiceId, aIccInfo) {
- if (DEBUG) {
- debug("notifyIccInfoChanged for service Id: " + aServiceId +
- ", IccInfo: " + JSON.stringify(aIccInfo));
- }
-
- this.getIccByServiceId(aServiceId)._updateIccInfo(aIccInfo);
- },
-
- notifyImsiChanged: function(aServiceId, aImsi) {
- if (DEBUG) {
- debug("notifyImsiChanged for service Id: " + aServiceId +
- ", Imsi: " + aImsi);
- }
-
- let icc = this.getIccByServiceId(aServiceId);
- icc.imsi = aImsi || null;
- },
-
- /**
- * nsIObserver interface.
- */
- observe: function(aSubject, aTopic, aData) {
- switch (aTopic) {
- case NS_PREFBRANCH_PREFCHANGE_TOPIC_ID:
- if (aData === kPrefRilDebuggingEnabled) {
- this._updateDebugFlag();
- }
- break;
- case NS_XPCOM_SHUTDOWN_OBSERVER_ID:
- Services.prefs.removeObserver(kPrefRilDebuggingEnabled, this);
- Services.obs.removeObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
- break;
- }
- }
-};
-
-function Icc(aClientId) {
- this._clientId = aClientId;
- this._radioInterface = gRadioInterfaceLayer.getRadioInterface(aClientId);
- this._listeners = [];
-}
-Icc.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIIcc]),
-
- _clientId: 0,
- _radioInterface: null,
- _listeners: null,
-
- _updateCardState: function(aCardState) {
- if (this.cardState != aCardState) {
- this.cardState = aCardState;
- }
-
- this._deliverListenerEvent("notifyCardStateChanged");
- },
-
- // An utility function to copy objects.
- _updateInfo: function(aSrcInfo, aDestInfo) {
- for (let key in aSrcInfo) {
- aDestInfo[key] = aSrcInfo[key];
- }
- },
-
- /**
- * A utility function to compare objects. The srcInfo may contain
- * "rilMessageType", should ignore it.
- */
- _isInfoChanged: function(srcInfo, destInfo) {
- if (!destInfo) {
- return true;
- }
-
- for (let key in srcInfo) {
- if (key === "rilMessageType") {
- continue;
- }
- if (srcInfo[key] !== destInfo[key]) {
- return true;
- }
- }
-
- return false;
- },
-
- /**
- * We need to consider below cases when update iccInfo:
- * 1. Should clear iccInfo to null if there is no card detected.
- * 2. Need to create corresponding object based on iccType.
- */
- _updateIccInfo: function(aIccInfo) {
- let oldSpn = this.iccInfo ? this.iccInfo.spn : null;
-
- // Card is not detected, clear iccInfo to null.
- if (!aIccInfo || !aIccInfo.iccid) {
- if (this.iccInfo) {
- if (DEBUG) {
- debug("Card is not detected, clear iccInfo to null.");
- }
- this.imsi = null;
- this.iccInfo = null;
- this._deliverListenerEvent("notifyIccInfoChanged");
- }
- return;
- }
-
- if (!this._isInfoChanged(aIccInfo, this.iccInfo)) {
- return;
- }
-
- // If iccInfo is null, new corresponding object based on iccType.
- if (!this.iccInfo ||
- this.iccInfo.iccType != aIccInfo.iccType) {
- if (aIccInfo.iccType === "ruim" || aIccInfo.iccType === "csim") {
- this.iccInfo = new CdmaIccInfo();
- } else if (aIccInfo.iccType === "sim" || aIccInfo.iccType === "usim") {
- this.iccInfo = new GsmIccInfo();
- } else {
- this.iccInfo = new IccInfo();
- }
- }
-
- this._updateInfo(aIccInfo, this.iccInfo);
-
- this._deliverListenerEvent("notifyIccInfoChanged");
-
- // Update lastKnownSimMcc.
- if (aIccInfo.mcc) {
- try {
- Services.prefs.setCharPref("ril.lastKnownSimMcc",
- aIccInfo.mcc.toString());
- } catch (e) {}
- }
-
- // Update lastKnownHomeNetwork.
- if (aIccInfo.mcc && aIccInfo.mnc) {
- let lastKnownHomeNetwork = aIccInfo.mcc + "-" + aIccInfo.mnc;
- // Append spn information if available.
- if (aIccInfo.spn) {
- lastKnownHomeNetwork += "-" + aIccInfo.spn;
- }
-
- gMobileConnectionService.notifyLastHomeNetworkChanged(this._clientId,
- lastKnownHomeNetwork);
- }
-
- // If spn becomes available, we should check roaming again.
- if (!oldSpn && aIccInfo.spn) {
- gMobileConnectionService.notifySpnAvailable(this._clientId);
- }
- },
-
- _deliverListenerEvent: function(aName, aArgs) {
- let listeners = this._listeners.slice();
- for (let listener of listeners) {
- if (this._listeners.indexOf(listener) === -1) {
- continue;
- }
- let handler = listener[aName];
- if (typeof handler != "function") {
- throw new Error("No handler for " + aName);
- }
- try {
- handler.apply(listener, aArgs);
- } catch (e) {
- if (DEBUG) {
- debug("listener for " + aName + " threw an exception: " + e);
- }
- }
- }
- },
-
- _modifyCardLock: function(aOperation, aOptions, aCallback) {
- this._radioInterface.sendWorkerMessage(aOperation,
- aOptions,
- (aResponse) => {
- if (aResponse.errorMsg) {
- let retryCount =
- (aResponse.retryCount !== undefined) ? aResponse.retryCount : -1;
- aCallback.notifyCardLockError(aResponse.errorMsg, retryCount);
- return;
- }
-
- aCallback.notifySuccess();
- });
- },
-
- /**
- * Helper to match the MVNO pattern with IMSI.
- *
- * Note: Characters 'x' and 'X' in MVNO are skipped and not compared.
- * E.g., if the aMvnoData passed is '310260x10xxxxxx', then the
- * function returns true only if imsi has the same first 6 digits, 8th
- * and 9th digit.
- *
- * @param aMvnoData
- * MVNO pattern.
- * @param aImsi
- * IMSI of this ICC.
- *
- * @return true if matched.
- */
- _isImsiMatches: function(aMvnoData, aImsi) {
- // This should not be an error, but a mismatch.
- if (aMvnoData.length > aImsi.length) {
- return false;
- }
-
- for (let i = 0; i < aMvnoData.length; i++) {
- let c = aMvnoData[i];
- if ((c !== 'x') && (c !== 'X') && (c !== aImsi[i])) {
- return false;
- }
- }
- return true;
- },
-
- /**
- * nsIIcc interface.
- */
- iccInfo: null,
- cardState: Ci.nsIIcc.CARD_STATE_UNKNOWN,
- imsi: null,
-
- registerListener: function(aListener) {
- if (this._listeners.indexOf(aListener) >= 0) {
- throw Cr.NS_ERROR_UNEXPECTED;
- }
-
- this._listeners.push(aListener);
- },
-
- unregisterListener: function(aListener) {
- let index = this._listeners.indexOf(aListener);
- if (index >= 0) {
- this._listeners.splice(index, 1);
- }
- },
-
- getCardLockEnabled: function(aLockType, aCallback) {
- this._radioInterface.sendWorkerMessage("iccGetCardLockEnabled",
- { lockType: aLockType },
- (aResponse) => {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return;
- }
-
- aCallback.notifySuccessWithBoolean(aResponse.enabled);
- });
- },
-
- unlockCardLock: function(aLockType, aPassword, aNewPin, aCallback) {
- this._modifyCardLock("iccUnlockCardLock",
- { lockType: aLockType,
- password: aPassword,
- newPin: aNewPin },
- aCallback);
- },
-
- setCardLockEnabled: function(aLockType, aPassword, aEnabled, aCallback) {
- this._modifyCardLock("iccSetCardLockEnabled",
- { lockType: aLockType,
- password: aPassword,
- enabled: aEnabled },
- aCallback);
- },
-
- changeCardLockPassword: function(aLockType, aPassword, aNewPassword, aCallback) {
- this._modifyCardLock("iccChangeCardLockPassword",
- { lockType: aLockType,
- password: aPassword,
- newPassword: aNewPassword, },
- aCallback);
- },
-
- getCardLockRetryCount: function(aLockType, aCallback) {
- this._radioInterface.sendWorkerMessage("iccGetCardLockRetryCount",
- { lockType: aLockType },
- (aResponse) => {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return;
- }
-
- aCallback.notifyGetCardLockRetryCount(aResponse.retryCount);
- });
- },
-
- matchMvno: function(aMvnoType, aMvnoData, aCallback) {
- if (!aMvnoData) {
- aCallback.notifyError(RIL.GECKO_ERROR_INVALID_PARAMETER);
- return;
- }
-
- switch (aMvnoType) {
- case Ci.nsIIcc.CARD_MVNO_TYPE_IMSI:
- let imsi = this.imsi;
- if (!imsi) {
- aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE);
- break;
- }
- aCallback.notifySuccessWithBoolean(
- this._isImsiMatches(aMvnoData, imsi));
- break;
- case Ci.nsIIcc.CARD_MVNO_TYPE_SPN:
- let spn = this.iccInfo && this.iccInfo.spn;
- if (!spn) {
- aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE);
- break;
- }
- aCallback.notifySuccessWithBoolean(spn == aMvnoData);
- break;
- case Ci.nsIIcc.CARD_MVNO_TYPE_GID:
- this._radioInterface.sendWorkerMessage("getGID1",
- null,
- (aResponse) => {
- let gid = aResponse.gid1;
- let mvnoDataLength = aMvnoData.length;
-
- if (!gid) {
- aCallback.notifyError(RIL.GECKO_ERROR_GENERIC_FAILURE);
- } else if (mvnoDataLength > gid.length) {
- aCallback.notifySuccessWithBoolean(false);
- } else {
- let result =
- gid.substring(0, mvnoDataLength).toLowerCase() ==
- aMvnoData.toLowerCase();
- aCallback.notifySuccessWithBoolean(result);
- }
- });
- break;
- default:
- aCallback.notifyError(RIL.GECKO_ERROR_MODE_NOT_SUPPORTED);
- break;
- }
- },
-
- getServiceStateEnabled: function(aService, aCallback) {
- this._radioInterface.sendWorkerMessage("getIccServiceState",
- { service: aService },
- (aResponse) => {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return;
- }
-
- aCallback.notifySuccessWithBoolean(aResponse.result);
- });
- },
-
- iccOpenChannel: function(aAid, aCallback) {
- this._radioInterface.sendWorkerMessage("iccOpenChannel",
- { aid: aAid },
- (aResponse) => {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return;
- }
-
- aCallback.notifyOpenChannelSuccess(aResponse.channel);
- });
- },
-
- iccExchangeAPDU: function(aChannel, aCla, aIns, aP1, aP2, aP3, aData, aCallback) {
- if (!aData) {
- if (DEBUG) debug('data is not set , aP3 : ' + aP3);
- }
-
- let apdu = {
- cla: aCla,
- command: aIns,
- p1: aP1,
- p2: aP2,
- p3: aP3,
- data: aData
- };
-
- this._radioInterface.sendWorkerMessage("iccExchangeAPDU",
- { channel: aChannel, apdu: apdu },
- (aResponse) => {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return;
- }
-
- aCallback.notifyExchangeAPDUResponse(aResponse.sw1,
- aResponse.sw2,
- aResponse.simResponse);
- });
- },
-
- iccCloseChannel: function(aChannel, aCallback) {
- this._radioInterface.sendWorkerMessage("iccCloseChannel",
- { channel: aChannel },
- (aResponse) => {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return;
- }
-
- aCallback.notifyCloseChannelSuccess();
- });
- },
-
- sendStkResponse: function(aCommand, aResponse) {
- let response = gStkCmdFactory.createResponseMessage(aResponse);
- response.command = gStkCmdFactory.createCommandMessage(aCommand);
- this._radioInterface.sendWorkerMessage("sendStkTerminalResponse", response);
- },
-
- sendStkMenuSelection: function(aItemIdentifier, aHelpRequested) {
- this._radioInterface
- .sendWorkerMessage("sendStkMenuSelection", {
- itemIdentifier: aItemIdentifier,
- helpRequested: aHelpRequested
- });
- },
-
- sendStkTimerExpiration: function(aTimerId, aTimerValue) {
- this._radioInterface
- .sendWorkerMessage("sendStkTimerExpiration",{
- timer: {
- timerId: aTimerId,
- timerValue: aTimerValue
- }
- });
- },
-
- sendStkEventDownload: function(aEvent) {
- this._radioInterface
- .sendWorkerMessage("sendStkEventDownload",
- { event: gStkCmdFactory.createEventMessage(aEvent) });
- },
-
- readContacts: function(aContactType, aCallback) {
- this._radioInterface
- .sendWorkerMessage("readICCContacts",
- { contactType: aContactType },
- (aResponse) => {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return;
- }
-
- let iccContacts = [];
-
- aResponse.contacts.forEach(c => iccContacts.push(new IccContact(c)));
-
- aCallback.notifyRetrievedIccContacts(iccContacts, iccContacts.length);
- });
- },
-
- updateContact: function(aContactType, aContact, aPin2, aCallback) {
- let iccContact = { contactId: aContact.id };
- let count = { value: 0 };
- let names = aContact.getNames(count);
- if (count.value > 0) {
- iccContact.alphaId = names[0];
- }
-
- let numbers = aContact.getNumbers(count);
- if (count.value > 0) {
- iccContact.number = numbers[0];
-
- let anrArray = numbers.slice(1);
- let length = anrArray.length;
- if (length > 0) {
- iccContact.anr = [];
- for (let i = 0; i < length; i++) {
- iccContact.anr.push(anrArray[i]);
- }
- }
- }
-
- let emails = aContact.getEmails(count);
- if (count.value > 0) {
- iccContact.email = emails[0];
- }
-
- this._radioInterface
- .sendWorkerMessage("updateICCContact",
- { contactType: aContactType,
- contact: iccContact,
- pin2: aPin2 },
- (aResponse) => {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return;
- }
-
- aCallback.notifyUpdatedIccContact(new IccContact(aResponse.contact));
- });
- },
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([IccService]);
deleted file mode 100644
--- a/dom/icc/gonk/IccService.manifest
+++ /dev/null
@@ -1,6 +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/.
-
-component {df854256-9554-11e4-a16c-c39e8d106c26} IccService.js
-contract @mozilla.org/icc/gonkiccservice;1 {df854256-9554-11e4-a16c-c39e8d106c26}
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/gonk/StkCmdFactory.js
+++ /dev/null
@@ -1,1616 +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/. */
-
-"use strict";
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-var RIL = {};
-Cu.import("resource://gre/modules/ril_consts.js", RIL);
-
-const GONK_STKCMDFACTORY_CONTRACTID = "@mozilla.org/icc/stkcmdfactory;1";
-const GONK_STKCMDFACTORY_CID = Components.ID("{7a663440-e336-11e4-8fd5-c3140a7ff307}");
-
-/**
- * Helper Utilities to convert JS Objects to IDL Objects.
- */
-
-/**
- * To map { timeUnit, timeInterval } into StkDuration.
- */
-function mapDurationToStkDuration(aDuration) {
- return (aDuration)
- ? new StkDuration(aDuration.timeUnit, aDuration.timeInterval)
- : null;
-}
-
-/**
- * To map { iconSelfExplanatory, icons } into StkIconInfo.
- */
-function mapIconInfoToStkIconInfo(aIconInfo) {
- let mapIconToStkIcon = function(aIcon) {
- return new StkIcon(aIcon.width, aIcon.height,
- aIcon.codingScheme, aIcon.pixels);
- };
-
- return (aIconInfo &&
- aIconInfo.icons !== undefined &&
- aIconInfo.iconSelfExplanatory !== undefined)
- ? new StkIconInfo(aIconInfo.iconSelfExplanatory,
- aIconInfo.icons.map(mapIconToStkIcon))
- : null;
-}
-
-/**
- * Helper Utilities to append the STK attributes to System Message.
- */
-
-function appendDuration(aTarget, aStkDuration) {
- aTarget.timeUnit = aStkDuration.timeUnit;
- aTarget.timeInterval = aStkDuration.timeInterval;
-}
-
-function appendIconInfo(aTarget, aStkIconInfo) {
- aTarget.iconSelfExplanatory = aStkIconInfo.iconSelfExplanatory;
- aTarget.icons = aStkIconInfo.getIcons().map(function(aStkIcon) {
- return {
- width: aStkIcon.width,
- height: aStkIcon.height,
- codingScheme: RIL.ICC_IMG_CODING_SCHEME_TO_GECKO[aStkIcon.codingScheme],
- pixels: aStkIcon.getPixels()
- };
- });
-}
-
-/**
- * The implementation of the data types used in variant types of
- * StkProactiveCommand, StkTerminalResponse, StkDownloadEvent.
- */
-
-function StkDuration(aTimeUnit, aTimeInterval) {
- this.timeUnit = aTimeUnit;
- this.timeInterval = aTimeInterval;
-}
-StkDuration.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIStkDuration]),
-
- // nsIStkDuration
- timeUnit: 0,
- timeInterval: 0
-};
-
-function StkIcon(aWidth, aHeight, aCodingScheme, aPixels) {
- this.width = aWidth;
- this.height = aHeight;
- this.codingScheme = this.IMG_CODING_SCHEME[aCodingScheme];
- this.pixels = aPixels.slice();
-}
-StkIcon.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIStkIcon]),
-
- // Cache pixels for getPixels()
- pixels: null,
-
- // Scheme mapping.
- IMG_CODING_SCHEME: {
- "basic": Ci.nsIStkIcon.CODING_SCHEME_BASIC,
- "color": Ci.nsIStkIcon.CODING_SCHEME_COLOR,
- "color-transparency": Ci.nsIStkIcon.CODING_SCHEME_COLOR_TRANSPARENCY
- },
-
- // StkIcon
- width: 0,
- height: 0,
- codingScheme: 0,
- getPixels: function(aCount) {
- if (!this.pixels) {
- if (aCount) {
- aCount.value = 0;
- }
- return null;
- }
-
- if (aCount) {
- aCount.value = this.pixels.length;
- }
-
- return this.pixels.slice();
- }
-};
-
-function StkIconInfo(aIconSelfExplanatory, aStkIcons) {
- this.iconSelfExplanatory = aIconSelfExplanatory;
- this.icons = aStkIcons;
-}
-StkIconInfo.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIStkIconInfo]),
-
- // Cache the list of StkIcon(s) for getIcons()
- icons: null,
-
- // nsIStkIconInfo
- iconSelfExplanatory: false,
-
- getIcons: function(aCount) {
- if (!this.icons) {
- if (aCount) {
- aCount.value = 0;
- }
- return null;
- }
-
- if (aCount) {
- aCount.value = this.icons.length;
- }
-
- return this.icons.slice();
- }
-};
-
-function StkItem(aIdentifier, aText, aStkIconInfo) {
- this.identifier = aIdentifier;
- if (aText !== undefined) {
- this.text = aText;
- }
- this.iconInfo = aStkIconInfo;
-}
-StkItem.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIStkItem]),
-
- // nsIStkItem
- identifier: 0,
- text: null,
- iconInfo: null
-};
-
-function StkTimer(aTimerId, aTimerValue, aTimerAction) {
- this.timerId = aTimerId;
- if (aTimerValue !== undefined &&
- aTimerValue !== null) {
- this.timerValue = aTimerValue;
- }
- this.timerAction = aTimerAction;
-}
-StkTimer.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIStkTimer]),
-
- // nsIStkTimer
- timerId: 0,
- timerValue: Ci.nsIStkTimer.TIMER_VALUE_INVALID,
- timerAction: Ci.nsIStkTimer.TIMER_ACTION_INVALID
-};
-
-function StkLocationInfo(aMcc, aMnc, aGsmLocationAreaCode, aGsmCellId) {
- this.mcc = aMcc;
- this.mnc = aMnc;
- this.gsmLocationAreaCode = aGsmLocationAreaCode;
- this.gsmCellId = aGsmCellId;
-}
-StkLocationInfo.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIStkLocationInfo]),
-
- // nsIStkLocationInfo
- mcc: null,
- mnc: null,
- gsmLocationAreaCode: -1,
- gsmCellId: -1
-};
-
-/**
- * The implementation of nsIStkProactiveCommand set and paired JS object set.
- */
-function StkProactiveCommand(aCommandDetails) {
- this.commandNumber = aCommandDetails.commandNumber;
- this.typeOfCommand = aCommandDetails.typeOfCommand;
- this.commandQualifier = aCommandDetails.commandQualifier;
-}
-StkProactiveCommand.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd]),
-
- // nsIStkProactiveCmd
- commandNumber: 0,
- typeOfCommand: 0,
- commandQualifier: 0
-};
-
-function StkCommandMessage(aStkProactiveCmd) {
- this.commandNumber = aStkProactiveCmd.commandNumber;
- this.typeOfCommand = aStkProactiveCmd.typeOfCommand;
- this.commandQualifier = aStkProactiveCmd.commandQualifier;
-}
-StkCommandMessage.prototype = {
- commandNumber: 0,
- typeOfCommand: 0,
- commandQualifier: 0,
- options: null
-};
-
-function StkPollIntervalCmd(aCommandDetails) {
- // Call |StkProactiveCommand| constructor.
- StkProactiveCommand.call(this, aCommandDetails);
-
- this.duration = mapDurationToStkDuration(aCommandDetails.options);
-}
-StkPollIntervalCmd.prototype = Object.create(StkProactiveCommand.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkPollIntervalCmd])
- },
-
- // nsIStkPollIntervalCmd
- duration: { value: null, writable: true }
-});
-
-function StkPollIntervalMessage(aStkPollIntervalCmd) {
- // Call |StkCommandMessage| constructor.
- StkCommandMessage.call(this, aStkPollIntervalCmd);
-
- this.options = {};
- appendDuration(this.options, aStkPollIntervalCmd.duration);
-}
-StkPollIntervalMessage.prototype = Object.create(StkCommandMessage.prototype);
-
-function StkProvideLocalInfoCmd(aCommandDetails) {
- // Call |StkProactiveCommand| constructor.
- StkProactiveCommand.call(this, aCommandDetails);
-
- this.localInfoType = aCommandDetails.options.localInfoType;
-}
-StkProvideLocalInfoCmd.prototype = Object.create(StkProactiveCommand.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkProvideLocalInfoCmd])
- },
-
- // nsIStkPollIntervalCmd
- localInfoType: { value: 0x00, writable: true }
-});
-
-function StkProvideLocalInfoMessage(aStkProvideLocalInfoCmd) {
- // Call |StkCommandMessage| constructor.
- StkCommandMessage.call(this, aStkProvideLocalInfoCmd);
-
- this.options = {
- localInfoType: aStkProvideLocalInfoCmd.localInfoType
- };
-}
-StkProvideLocalInfoMessage.prototype = Object.create(StkCommandMessage.prototype);
-
-function StkSetupEventListCmd(aCommandDetails) {
- // Call |StkProactiveCommand| constructor.
- StkProactiveCommand.call(this, aCommandDetails);
- let eventList = aCommandDetails.options.eventList;
- if (eventList) {
- this.eventList = eventList.slice();
- }
-}
-StkSetupEventListCmd.prototype = Object.create(StkProactiveCommand.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkSetupEventListCmd])
- },
-
- // Cache eventList for getEventList()
- eventList: { value: null, writable: true },
-
- // nsIStkSetupEventListCmd
- getEventList: {
- value: function(aCount) {
- if (!this.eventList) {
- if (aCount) {
- aCount.value = 0;
- }
- return null;
- }
-
- if (aCount) {
- aCount.value = this.eventList.length;
- }
-
- return this.eventList.slice();
- }
- }
-});
-
-function StkSetupEventListMessage(aStkSetupEventListCmd) {
- // Call |StkCommandMessage| constructor.
- StkCommandMessage.call(this, aStkSetupEventListCmd);
-
- this.options = {
- eventList: null
- };
-
- let eventList = aStkSetupEventListCmd.getEventList();
-
- if (eventList && eventList.length > 0) {
- this.options.eventList = eventList;
- }
-}
-StkSetupEventListMessage.prototype = Object.create(StkCommandMessage.prototype);
-
-function StkSetUpMenuCmd(aCommandDetails) {
- // Call |StkProactiveCommand| constructor.
- StkProactiveCommand.call(this, aCommandDetails);
-
- let options = aCommandDetails.options;
-
- if (options.title !== undefined) {
- this.title = options.title;
- }
-
- this.items = options.items.map(function(aItem) {
- // For |SET-UP MENU|, the 1st item in |aItems| could be null as an
- // indication to the ME to remove the existing menu from the menu
- // system in the ME.
- return (aItem) ? new StkItem(aItem.identifier,
- aItem.text,
- mapIconInfoToStkIconInfo(aItem))
- : null;
- });
-
- if (options.nextActionList) {
- this.nextActionList = options.nextActionList.slice();
- }
-
- this.iconInfo = mapIconInfoToStkIconInfo(options);
-
- this.isHelpAvailable = !!(options.isHelpAvailable);
-}
-StkSetUpMenuCmd.prototype = Object.create(StkProactiveCommand.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkSetUpMenuCmd])
- },
-
- // Cache items for getItems()
- items: { value: null, writable: true },
-
- // Cache items for getNextActionList()
- nextActionList: { value: null, writable: true },
-
- // nsIStkSetUpMenuCmd
- title: { value: null, writable: true },
-
- getItems: {
- value: function(aCount) {
- if (!this.items) {
- if (aCount) {
- aCount.value = 0;
- }
- return null;
- }
-
- if (aCount) {
- aCount.value = this.items.length;
- }
-
- return this.items.slice();
- }
- },
-
- getNextActionList: {
- value: function(aCount) {
- if (!this.nextActionList) {
- if (aCount) {
- aCount.value = 0;
- }
- return null;
- }
-
- if (aCount) {
- aCount.value = this.nextActionList.length;
- }
-
- return this.nextActionList.slice();
- }
- },
-
- iconInfo: { value: null, writable: true },
- isHelpAvailable: { value: false, writable: true }
-});
-
-function StkSetUpMenuMessage(aStkSetUpMenuCmd) {
- // Call |StkCommandMessage| constructor.
- StkCommandMessage.call(this, aStkSetUpMenuCmd);
-
- this.options = {
- items: aStkSetUpMenuCmd.getItems().map(function(aStkItem) {
- if (!aStkItem) {
- return null;
- }
-
- let item = {
- identifier: aStkItem.identifier,
- text: aStkItem.text
- };
-
- if (aStkItem.iconInfo) {
- appendIconInfo(item, aStkItem.iconInfo);
- }
-
- return item;
- }),
- isHelpAvailable: aStkSetUpMenuCmd.isHelpAvailable,
- title: aStkSetUpMenuCmd.title
- };
-
- let nextActionList = aStkSetUpMenuCmd.getNextActionList();
- if (nextActionList && nextActionList.length > 0) {
- this.options.nextActionList = nextActionList;
- }
-
- if (aStkSetUpMenuCmd.iconInfo) {
- appendIconInfo(this.options, aStkSetUpMenuCmd.iconInfo);
- }
-}
-StkSetUpMenuMessage.prototype = Object.create(StkCommandMessage.prototype);
-
-function StkSelectItemCmd(aCommandDetails) {
- // Call |StkSetUpMenuCmd| constructor.
- StkSetUpMenuCmd.call(this, aCommandDetails);
-
- let options = aCommandDetails.options;
-
- this.presentationType = options.presentationType;
-
- if (options.defaultItem !== undefined &&
- options.defaultItem !== null) {
- this.defaultItem = options.defaultItem;
- }
-}
-StkSelectItemCmd.prototype = Object.create(StkSetUpMenuCmd.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkSetUpMenuCmd,
- Ci.nsIStkSelectItemCmd])
- },
-
- // nsIStkSelectItemCmd
- presentationType: {
- value: 0,
- writable: true
- },
-
- defaultItem: {
- value: Ci.nsIStkSelectItemCmd.DEFAULT_ITEM_INVALID,
- writable: true
- }
-});
-
-function StkSelectItemMessage(aStkSelectItemCmd) {
- // Call |StkSetUpMenuMessage| constructor.
- StkSetUpMenuMessage.call(this, aStkSelectItemCmd);
-
- this.options.presentationType = aStkSelectItemCmd.presentationType;
-
- if (aStkSelectItemCmd.defaultItem !== Ci.nsIStkSelectItemCmd.DEFAULT_ITEM_INVALID) {
- this.options.defaultItem = aStkSelectItemCmd.defaultItem;
- }
-}
-StkSelectItemMessage.prototype = Object.create(StkSetUpMenuMessage.prototype);
-
-function StkTextMessageCmd(aCommandDetails) {
- // Call |StkProactiveCommand| constructor.
- StkProactiveCommand.call(this, aCommandDetails);
-
- let options = aCommandDetails.options;
-
- if (options.text !== undefined) {
- this.text = options.text;
- }
-
- this.iconInfo = mapIconInfoToStkIconInfo(options);
-}
-StkTextMessageCmd.prototype = Object.create(StkProactiveCommand.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkTextMessageCmd])
- },
-
- // nsIStkTextMessageCmd
- text: { value: null, writable: true },
- iconInfo: { value: null, writable: true }
-});
-
-function StkTextMessage(aStkTextMessageCmd) {
- // Call |StkCommandMessage| constructor.
- StkCommandMessage.call(this, aStkTextMessageCmd);
-
- this.options = {
- text: aStkTextMessageCmd.text
- };
-
- if (aStkTextMessageCmd.iconInfo) {
- appendIconInfo(this.options, aStkTextMessageCmd.iconInfo);
- }
-}
-StkTextMessage.prototype = Object.create(StkCommandMessage.prototype);
-
-function StkDisplayTextCmd(aCommandDetails) {
- // Call |StkTextMessageCmd| constructor.
- StkTextMessageCmd.call(this, aCommandDetails);
-
- let options = aCommandDetails.options;
-
- this.duration = mapDurationToStkDuration(options.duration);
-
- this.isHighPriority = !!(options.isHighPriority);
- this.userClear = !!(options.userClear);
- this.responseNeeded = !!(options.responseNeeded);
-}
-StkDisplayTextCmd.prototype = Object.create(StkTextMessageCmd.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkTextMessageCmd,
- Ci.nsIStkDisplayTextCmd])
- },
-
- // nsIStkDisplayTextCmd
- duration: { value: null, writable: true },
- isHighPriority: { value: false, writable: true },
- userClear: { value: false, writable: true },
- responseNeeded: { value: false, writable: true }
-});
-
-function StkDisplayTextMessage(aStkDisplayTextCmd) {
- // Call |StkTextMessage| constructor.
- StkTextMessage.call(this, aStkDisplayTextCmd);
-
- this.options.isHighPriority = aStkDisplayTextCmd.isHighPriority;
- this.options.userClear = aStkDisplayTextCmd.userClear;
- this.options.responseNeeded = aStkDisplayTextCmd.responseNeeded;
-
- if (aStkDisplayTextCmd.duration) {
- this.options.duration = {};
- appendDuration(this.options.duration, aStkDisplayTextCmd.duration);
- }
-}
-StkDisplayTextMessage.prototype = Object.create(StkTextMessage.prototype);
-
-function StkInputCmd(aCommandDetails) {
- // Call |StkProactiveCommand| constructor.
- StkProactiveCommand.call(this, aCommandDetails);
-
- let options = aCommandDetails.options;
-
- if (options.text !== undefined) {
- this.text = options.text;
- }
-
- this.duration = mapDurationToStkDuration(options.duration);
-
- if (options.defaultText !== undefined) {
- this.defaultText = options.defaultText;
- }
-
- this.isAlphabet = !!(options.isAlphabet);
- this.isUCS2 = !!(options.isUCS2);
- this.isHelpAvailable = !!(options.isHelpAvailable);
-
- this.iconInfo = mapIconInfoToStkIconInfo(options);
-}
-StkInputCmd.prototype = Object.create(StkProactiveCommand.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkInputCmd])
- },
-
- // nsIStkInputCmd
- text: { value: null, writable: true },
- duration: { value: null, writable: true },
- minLength: { value: 1, writable: true },
- maxLength: { value: 1, writable: true },
- defaultText: { value: null, writable: true },
- isAlphabet: { value: false, writable: true },
- isUCS2: { value: false, writable: true },
- isHelpAvailable: { value: false, writable: true },
- iconInfo: { value: null, writable: true }
-});
-
-function StkInputMessage(aStkInputCmd) {
- // Call |StkCommandMessage| constructor.
- StkCommandMessage.call(this, aStkInputCmd);
-
- this.options = {
- text: aStkInputCmd.text,
- minLength: aStkInputCmd.minLength,
- maxLength: aStkInputCmd.maxLength,
- isAlphabet: aStkInputCmd.isAlphabet,
- isUCS2: aStkInputCmd.isUCS2,
- isHelpAvailable: aStkInputCmd.isHelpAvailable,
- defaultText: aStkInputCmd.defaultText
- };
-
- if (aStkInputCmd.duration) {
- this.options.duration = {};
- appendDuration(this.options.duration, aStkInputCmd.duration);
- }
-
- if (aStkInputCmd.iconInfo) {
- appendIconInfo(this.options, aStkInputCmd.iconInfo);
- }
-}
-StkInputMessage.prototype = Object.create(StkCommandMessage.prototype);
-
-function StkInputKeyCmd(aCommandDetails) {
- // Call |StkInputCmd| constructor.
- StkInputCmd.call(this, aCommandDetails);
-
- let options = aCommandDetails.options;
-
- // Note: For STK_CMD_INKEY,
- // this.minLength = this.maxLength = 1;
-
- this.isYesNoRequested = !!(options.isYesNoRequested);
-}
-StkInputKeyCmd.prototype = Object.create(StkInputCmd.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkInputCmd,
- Ci.nsIStkInputKeyCmd])
- },
-
- // nsIStkInputKeyCmd
- isYesNoRequested: { value: false, writable: true }
-});
-
-function StkInputKeyMessage(aStkInputKeyCmd) {
- // Call |StkInputMessage| constructor.
- StkInputMessage.call(this, aStkInputKeyCmd);
-
- this.options.isYesNoRequested = aStkInputKeyCmd.isYesNoRequested;
-}
-StkInputKeyMessage.prototype = Object.create(StkInputMessage.prototype);
-
-function StkInputTextCmd(aCommandDetails) {
- // Call |StkInputCmd| constructor.
- StkInputCmd.call(this, aCommandDetails);
-
- let options = aCommandDetails.options;
-
- this.minLength = options.minLength;
- this.maxLength = options.maxLength;
-
- this.hideInput = !!(options.hideInput);
- this.isPacked = !!(options.isPacked);
-}
-StkInputTextCmd.prototype = Object.create(StkInputCmd.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkInputCmd,
- Ci.nsIStkInputTextCmd])
- },
-
- // nsIStkInputTextCmd
- hideInput: { value: false, writable: true },
- isPacked: { value: false, writable: true }
-});
-
-function StkInputTextMessage(aStkInputTextCmd) {
- // Call |StkInputMessage| constructor.
- StkInputMessage.call(this, aStkInputTextCmd);
-
- this.options.hideInput = aStkInputTextCmd.hideInput;
- this.options.isPacked = aStkInputTextCmd.isPacked;
-}
-StkInputTextMessage.prototype = Object.create(StkInputMessage.prototype);
-
-function StkSetUpCallCmd(aCommandDetails) {
- // Call |StkProactiveCommand| constructor.
- StkProactiveCommand.call(this, aCommandDetails);
-
- let options = aCommandDetails.options;
-
- let confirmMessage = options.confirmMessage;
- let callMessage = options.callMessage;
-
- this.address = options.address;
-
- if(confirmMessage) {
- if (confirmMessage.text !== undefined) {
- this.confirmText = confirmMessage.text;
- }
- this.confirmIconInfo = mapIconInfoToStkIconInfo(confirmMessage);
- }
-
- if(callMessage) {
- if (callMessage.text !== undefined) {
- this.callText = callMessage.text;
- }
- this.callIconInfo = mapIconInfoToStkIconInfo(callMessage);
- }
-
- this.duration = mapDurationToStkDuration(options.duration);
-}
-StkSetUpCallCmd.prototype = Object.create(StkProactiveCommand.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkSetUpCallCmd])
- },
-
- // nsIStkSetUpCallCmd
- address: { value: null, writable: true },
- confirmText: { value: null, writable: true },
- confirmIconInfo: { value: null, writable: true },
- callText: { value: null, writable: true },
- callIconInfo: { value: null, writable: true },
- duration: { value: null, writable: true }
-});
-
-function StkSetUpCallMessage(aStkSetUpCallCmd) {
- // Call |StkCommandMessage| constructor.
- StkCommandMessage.call(this, aStkSetUpCallCmd);
-
- this.options = {
- address: aStkSetUpCallCmd.address
- };
-
- if (aStkSetUpCallCmd.confirmText !== null ||
- aStkSetUpCallCmd.confirmIconInfo) {
- let confirmMessage = {
- text: aStkSetUpCallCmd.confirmText
- };
- if (aStkSetUpCallCmd.confirmIconInfo) {
- appendIconInfo(confirmMessage, aStkSetUpCallCmd.confirmIconInfo);
- }
- this.options.confirmMessage = confirmMessage;
- }
-
- if (aStkSetUpCallCmd.callText !== null ||
- aStkSetUpCallCmd.callIconInfo) {
- let callMessage = {
- text: aStkSetUpCallCmd.callText
- };
- if (aStkSetUpCallCmd.callIconInfo) {
- appendIconInfo(callMessage, aStkSetUpCallCmd.callIconInfo);
- }
- this.options.callMessage = callMessage;
- }
-
- if (aStkSetUpCallCmd.duration) {
- this.options.duration = {};
- appendDuration(this.options.duration, aStkSetUpCallCmd.duration);
- }
-}
-StkSetUpCallMessage.prototype = Object.create(StkCommandMessage.prototype);
-
-function StkBrowserSettingCmd(aCommandDetails) {
- // Call |StkProactiveCommand| constructor.
- StkProactiveCommand.call(this, aCommandDetails);
-
- let options = aCommandDetails.options;
-
- this.url = options.url;
-
- this.mode = options.mode;
-
- let confirmMessage = options.confirmMessage;
-
- if(confirmMessage) {
- if (confirmMessage.text !== undefined) {
- this.confirmText = confirmMessage.text;
- }
- this.confirmIconInfo = mapIconInfoToStkIconInfo(confirmMessage);
- }
-}
-StkBrowserSettingCmd.prototype = Object.create(StkProactiveCommand.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkBrowserSettingCmd])
- },
-
- // nsIStkBrowserSettingCmd
- url: { value: null, writable: true },
- mode: { value: 0, writable: true },
- confirmText: { value: null, writable: true },
- confirmIconInfo: { value: null, writable: true }
-});
-
-function StkBrowserSettingMessage(aStkBrowserSettingCmd) {
- // Call |StkCommandMessage| constructor.
- StkCommandMessage.call(this, aStkBrowserSettingCmd);
-
- this.options = {
- url: aStkBrowserSettingCmd.url,
- mode: aStkBrowserSettingCmd.mode
- };
-
- if (aStkBrowserSettingCmd.confirmText !== null ||
- aStkBrowserSettingCmd.confirmIconInfo) {
- let confirmMessage = {
- text: aStkBrowserSettingCmd.confirmText
- };
- if (aStkBrowserSettingCmd.confirmIconInfo) {
- appendIconInfo(confirmMessage, aStkBrowserSettingCmd.confirmIconInfo);
- }
- this.options.confirmMessage = confirmMessage;
- }
-}
-StkBrowserSettingMessage.prototype = Object.create(StkCommandMessage.prototype);
-
-function StkPlayToneCmd(aCommandDetails) {
- // Call |StkProactiveCommand| constructor.
- StkProactiveCommand.call(this, aCommandDetails);
-
- let options = aCommandDetails.options;
-
- if(options.text !== undefined) {
- this.text = options.text;
- }
-
- if (options.tone !== undefined &&
- options.tone !== null) {
- this.tone = options.tone;
- }
-
- if (options.isVibrate) {
- this.isVibrate = true;
- }
-
- this.duration = mapDurationToStkDuration(options.duration);
-
- this.iconInfo = mapIconInfoToStkIconInfo(options);
-}
-StkPlayToneCmd.prototype = Object.create(StkProactiveCommand.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkPlayToneCmd])
- },
-
- // nsIStkPlayToneCmd
- text: { value: null, writable: true },
- tone: { value: Ci.nsIStkPlayToneCmd.TONE_TYPE_INVALID, writable: true },
- duration: { value: null, writable: true },
- isVibrate: { value: false, writable: true },
- iconInfo: { value: null, writable: true }
-});
-
-function StkPlayToneMessage(aStkPlayToneCmd) {
- // Call |StkCommandMessage| constructor.
- StkCommandMessage.call(this, aStkPlayToneCmd);
-
- this.options = {
- isVibrate: aStkPlayToneCmd.isVibrate,
- text: aStkPlayToneCmd.text
- };
-
- if (aStkPlayToneCmd.tone != Ci.nsIStkPlayToneCmd.TONE_TYPE_INVALID) {
- this.options.tone = aStkPlayToneCmd.tone;
- }
-
- if (aStkPlayToneCmd.duration) {
- this.options.duration = {};
- appendDuration(this.options.duration, aStkPlayToneCmd.duration);
- }
-
- if (aStkPlayToneCmd.iconInfo) {
- appendIconInfo(this.options, aStkPlayToneCmd.iconInfo);
- }
-}
-StkPlayToneMessage.prototype = Object.create(StkCommandMessage.prototype);
-
-function StkTimerManagementCmd(aCommandDetails) {
- // Call |StkProactiveCommand| constructor.
- StkProactiveCommand.call(this, aCommandDetails);
-
- let options = aCommandDetails.options;
-
- this.timerInfo = new StkTimer(options.timerId,
- options.timerValue,
- options.timerAction);
-
-}
-StkTimerManagementCmd.prototype = Object.create(StkProactiveCommand.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkProactiveCmd,
- Ci.nsIStkTimerManagementCmd])
- },
-
- // nsIStkTimerManagementCmd
- timerInfo: { value: null, writable: true }
-});
-
-function StkTimerMessage(aStkTimerManagementCmd) {
- // Call |StkCommandMessage| constructor.
- StkCommandMessage.call(this, aStkTimerManagementCmd);
-
- let timerInfo = aStkTimerManagementCmd.timerInfo;
-
- this.options = {
- timerId: timerInfo.timerId,
- timerAction: timerInfo.timerAction
- };
-
- if (timerInfo.timerValue !== Ci.nsIStkTimer.TIMER_VALUE_INVALID) {
- this.options.timerValue = timerInfo.timerValue;
- }
-}
-StkTimerMessage.prototype = Object.create(StkCommandMessage.prototype);
-
-/**
- * Command Prototype Mappings.
- */
-var CmdPrototypes = {};
-CmdPrototypes[RIL.STK_CMD_REFRESH] = StkProactiveCommand;
-CmdPrototypes[RIL.STK_CMD_POLL_INTERVAL] = StkPollIntervalCmd;
-CmdPrototypes[RIL.STK_CMD_POLL_OFF] = StkProactiveCommand;
-CmdPrototypes[RIL.STK_CMD_PROVIDE_LOCAL_INFO] = StkProvideLocalInfoCmd;
-CmdPrototypes[RIL.STK_CMD_SET_UP_EVENT_LIST] = StkSetupEventListCmd;
-CmdPrototypes[RIL.STK_CMD_SET_UP_MENU] = StkSetUpMenuCmd;
-CmdPrototypes[RIL.STK_CMD_SELECT_ITEM] = StkSelectItemCmd;
-CmdPrototypes[RIL.STK_CMD_DISPLAY_TEXT] = StkDisplayTextCmd;
-CmdPrototypes[RIL.STK_CMD_SET_UP_IDLE_MODE_TEXT] = StkTextMessageCmd;
-CmdPrototypes[RIL.STK_CMD_SEND_SS] = StkTextMessageCmd;
-CmdPrototypes[RIL.STK_CMD_SEND_USSD] = StkTextMessageCmd;
-CmdPrototypes[RIL.STK_CMD_SEND_SMS] = StkTextMessageCmd;
-CmdPrototypes[RIL.STK_CMD_SEND_DTMF] = StkTextMessageCmd;
-CmdPrototypes[RIL.STK_CMD_GET_INKEY] = StkInputKeyCmd;
-CmdPrototypes[RIL.STK_CMD_GET_INPUT] = StkInputTextCmd;
-CmdPrototypes[RIL.STK_CMD_SET_UP_CALL] = StkSetUpCallCmd;
-CmdPrototypes[RIL.STK_CMD_LAUNCH_BROWSER] = StkBrowserSettingCmd;
-CmdPrototypes[RIL.STK_CMD_PLAY_TONE] = StkPlayToneCmd;
-CmdPrototypes[RIL.STK_CMD_TIMER_MANAGEMENT] = StkTimerManagementCmd;
-CmdPrototypes[RIL.STK_CMD_OPEN_CHANNEL] = StkTextMessageCmd;
-CmdPrototypes[RIL.STK_CMD_CLOSE_CHANNEL] = StkTextMessageCmd;
-CmdPrototypes[RIL.STK_CMD_SEND_DATA] = StkTextMessageCmd;
-CmdPrototypes[RIL.STK_CMD_RECEIVE_DATA] = StkTextMessageCmd;
-
-/**
- * Message Prototype Mappings.
- */
-var MsgPrototypes = {};
-MsgPrototypes[RIL.STK_CMD_REFRESH] = StkCommandMessage;
-MsgPrototypes[RIL.STK_CMD_POLL_INTERVAL] = StkPollIntervalMessage;
-MsgPrototypes[RIL.STK_CMD_POLL_OFF] = StkCommandMessage;
-MsgPrototypes[RIL.STK_CMD_PROVIDE_LOCAL_INFO] = StkProvideLocalInfoMessage;
-MsgPrototypes[RIL.STK_CMD_SET_UP_EVENT_LIST] = StkSetupEventListMessage;
-MsgPrototypes[RIL.STK_CMD_SET_UP_MENU] = StkSetUpMenuMessage;
-MsgPrototypes[RIL.STK_CMD_SELECT_ITEM] = StkSelectItemMessage;
-MsgPrototypes[RIL.STK_CMD_DISPLAY_TEXT] = StkDisplayTextMessage;
-MsgPrototypes[RIL.STK_CMD_SET_UP_IDLE_MODE_TEXT] = StkTextMessage;
-MsgPrototypes[RIL.STK_CMD_SEND_SS] = StkTextMessage;
-MsgPrototypes[RIL.STK_CMD_SEND_USSD] = StkTextMessage;
-MsgPrototypes[RIL.STK_CMD_SEND_SMS] = StkTextMessage;
-MsgPrototypes[RIL.STK_CMD_SEND_DTMF] = StkTextMessage;
-MsgPrototypes[RIL.STK_CMD_GET_INKEY] = StkInputKeyMessage;
-MsgPrototypes[RIL.STK_CMD_GET_INPUT] = StkInputTextMessage;
-MsgPrototypes[RIL.STK_CMD_SET_UP_CALL] = StkSetUpCallMessage;
-MsgPrototypes[RIL.STK_CMD_LAUNCH_BROWSER] = StkBrowserSettingMessage;
-MsgPrototypes[RIL.STK_CMD_PLAY_TONE] = StkPlayToneMessage;
-MsgPrototypes[RIL.STK_CMD_TIMER_MANAGEMENT] = StkTimerMessage;
-MsgPrototypes[RIL.STK_CMD_OPEN_CHANNEL] = StkTextMessage;
-MsgPrototypes[RIL.STK_CMD_CLOSE_CHANNEL] = StkTextMessage;
-MsgPrototypes[RIL.STK_CMD_SEND_DATA] = StkTextMessage;
-MsgPrototypes[RIL.STK_CMD_RECEIVE_DATA] = StkTextMessage;
-
-/**
- * QueryInterface Mappings.
- */
-var QueriedIFs = {};
-QueriedIFs[RIL.STK_CMD_REFRESH] = Ci.nsIStkProactiveCmd;
-QueriedIFs[RIL.STK_CMD_POLL_INTERVAL] = Ci.nsIStkPollIntervalCmd;
-QueriedIFs[RIL.STK_CMD_POLL_OFF] = Ci.nsIStkProactiveCmd;
-QueriedIFs[RIL.STK_CMD_PROVIDE_LOCAL_INFO] = Ci.nsIStkProvideLocalInfoCmd;
-QueriedIFs[RIL.STK_CMD_SET_UP_EVENT_LIST] = Ci.nsIStkSetupEventListCmd;
-QueriedIFs[RIL.STK_CMD_SET_UP_MENU] = Ci.nsIStkSetUpMenuCmd;
-QueriedIFs[RIL.STK_CMD_SELECT_ITEM] = Ci.nsIStkSelectItemCmd;
-QueriedIFs[RIL.STK_CMD_DISPLAY_TEXT] = Ci.nsIStkDisplayTextCmd;
-QueriedIFs[RIL.STK_CMD_SET_UP_IDLE_MODE_TEXT] = Ci.nsIStkTextMessageCmd;
-QueriedIFs[RIL.STK_CMD_SEND_SS] = Ci.nsIStkTextMessageCmd;
-QueriedIFs[RIL.STK_CMD_SEND_USSD] = Ci.nsIStkTextMessageCmd;
-QueriedIFs[RIL.STK_CMD_SEND_SMS] = Ci.nsIStkTextMessageCmd;
-QueriedIFs[RIL.STK_CMD_SEND_DTMF] = Ci.nsIStkTextMessageCmd;
-QueriedIFs[RIL.STK_CMD_GET_INKEY] = Ci.nsIStkInputKeyCmd;
-QueriedIFs[RIL.STK_CMD_GET_INPUT] = Ci.nsIStkInputTextCmd;
-QueriedIFs[RIL.STK_CMD_SET_UP_CALL] = Ci.nsIStkSetUpCallCmd;
-QueriedIFs[RIL.STK_CMD_LAUNCH_BROWSER] = Ci.nsIStkBrowserSettingCmd;
-QueriedIFs[RIL.STK_CMD_PLAY_TONE] = Ci.nsIStkPlayToneCmd;
-QueriedIFs[RIL.STK_CMD_TIMER_MANAGEMENT] = Ci.nsIStkTimerManagementCmd;
-QueriedIFs[RIL.STK_CMD_OPEN_CHANNEL] = Ci.nsIStkTextMessageCmd;
-QueriedIFs[RIL.STK_CMD_CLOSE_CHANNEL] = Ci.nsIStkTextMessageCmd;
-QueriedIFs[RIL.STK_CMD_SEND_DATA] = Ci.nsIStkTextMessageCmd;
-QueriedIFs[RIL.STK_CMD_RECEIVE_DATA] = Ci.nsIStkTextMessageCmd;
-
-/**
- * The implementation of nsIStkTerminalResponse set and paired JS object set.
- */
-function StkTerminalResponse(aResponseMessage) {
- this.resultCode = aResponseMessage.resultCode;
- if (aResponseMessage.additionalInformation != undefined) {
- this.additionalInformation = aResponseMessage.additionalInformation;
- }
-}
-StkTerminalResponse.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIStkTerminalResponse]),
-
- // nsIStkTerminalResponse
- resultCode: 0,
- additionalInformation: Ci.nsIStkTerminalResponse.ADDITIONAL_INFO_INVALID
-};
-
-function StkResponseMessage(aStkTerminalResponse) {
- this.resultCode = aStkTerminalResponse.resultCode;
- if (aStkTerminalResponse.additionalInformation
- !== Ci.nsIStkTerminalResponse.ADDITIONAL_INFO_INVALID) {
- this.additionalInformation = aStkTerminalResponse.additionalInformation;
- }
-}
-StkResponseMessage.prototype = {
- resultCode: Ci.nsIStkTerminalResponse.RESULT_OK
-};
-
-function StkSelectItemResponse(aStkSelectItemResponseMessage) {
- // Call |StkTerminalResponse| constructor.
- StkTerminalResponse.call(this, aStkSelectItemResponseMessage);
- this.itemIdentifier = aStkSelectItemResponseMessage.itemIdentifier;
-}
-StkSelectItemResponse.prototype = Object.create(StkTerminalResponse.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkTerminalResponse,
- Ci.nsIStkSelectItemResponse])
- },
-
- // nsIStkSelectItemResponse
- itemIdentifier: { value: 0, writable: true }
-});
-
-function StkSelectItemResponseMessage(aStkSelectItemResponse) {
- // Call |StkResponseMessage| constructor.
- StkResponseMessage.call(this, aStkSelectItemResponse);
-
- this.itemIdentifier = aStkSelectItemResponse.itemIdentifier;
-}
-StkSelectItemResponseMessage.prototype = Object.create(StkResponseMessage.prototype);
-
-function StkGetInputResponse(aStkGetInputResponseMessage) {
- // Call |StkTerminalResponse| constructor.
- StkTerminalResponse.call(this, aStkGetInputResponseMessage);
- if (aStkGetInputResponseMessage.isYesNo !== undefined) {
- this.isYesNo = (aStkGetInputResponseMessage.isYesNo)
- ? Ci.nsIStkGetInputResponse.YES
- : Ci.nsIStkGetInputResponse.NO;
- }
-
- if (aStkGetInputResponseMessage.input !== undefined) {
- // We expect input to be "" if user confirmed the input with nothing,
- // and we use null to present 'undefined' internally for the conversion
- // between nsIStkTerminalResponse and JS objects.
- this.input = aStkGetInputResponseMessage.input || "";
- }
-
-}
-StkGetInputResponse.prototype = Object.create(StkTerminalResponse.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkTerminalResponse,
- Ci.nsIStkGetInputResponse])
- },
-
- // nsIStkGetInputResponse
- isYesNo: { value: Ci.nsIStkGetInputResponse.YES_NO_INVALID, writable: true },
- input: { value: null, writable: true }
-});
-
-function StkGetInputResponseMessage(aStkGetInputResponse) {
- // Call |StkResponseMessage| constructor.
- StkResponseMessage.call(this, aStkGetInputResponse);
-
- if (aStkGetInputResponse.isYesNo !== Ci.nsIStkGetInputResponse.YES_NO_INVALID) {
- this.isYesNo = !!aStkGetInputResponse.isYesNo;
- }
-
- if (aStkGetInputResponse.input !== null) {
- this.input = aStkGetInputResponse.input;
- }
-}
-StkGetInputResponseMessage.prototype = Object.create(StkResponseMessage.prototype);
-
-function StkCallSetupResponse(aStkCallSetupResponseMessage) {
- // Call |StkTerminalResponse| constructor.
- StkTerminalResponse.call(this, aStkCallSetupResponseMessage);
- this.hasConfirmed = !! aStkCallSetupResponseMessage.hasConfirmed;
-}
-StkCallSetupResponse.prototype = Object.create(StkTerminalResponse.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkTerminalResponse,
- Ci.nsIStkCallSetupResponse])
- },
-
- // nsIStkCallSetupResponse
- hasConfirmed: { value: false, writable: true }
-});
-
-function StkCallSetupResponseMessage(aStkCallSetupResponse) {
- // Call |StkResponseMessage| constructor.
- StkResponseMessage.call(this, aStkCallSetupResponse);
-
- this.hasConfirmed = aStkCallSetupResponse.hasConfirmed;
-}
-StkCallSetupResponseMessage.prototype = Object.create(StkResponseMessage.prototype);
-
-function StkLocalInfoResponse(aStkLocalInfoResponseMessage) {
- // Call |StkTerminalResponse| constructor.
- StkTerminalResponse.call(this, aStkLocalInfoResponseMessage);
-
- let localInfo = aStkLocalInfoResponseMessage.localInfo;
-
- if (localInfo.imei) {
- this.imei = localInfo.imei;
- return;
- }
-
- if (localInfo.locationInfo) {
- let info = localInfo.locationInfo;
-
- this.locationInfo = new StkLocationInfo(info.mcc,
- info.mnc,
- info.gsmLocationAreaCode,
- info.gsmCellId);
- return;
- }
-
- if (localInfo.date) {
- if (localInfo.date instanceof Date) {
- this.date = localInfo.date.getTime();
- } else {
- // JSON is adopted as our IPDL protocol, so Date object will be presented as
- // a String in ISO8601 format by JSON.
- // For the conversion between Date and JSON, please see:
- // https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toJSON#Example:_Using_toJSON
- this.date = new Date(localInfo.date).getTime();
- }
-
- return;
- }
-
- if (localInfo.language) {
- this.language = localInfo.language;
- return;
- }
-}
-StkLocalInfoResponse.prototype = Object.create(StkTerminalResponse.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkTerminalResponse,
- Ci.nsIStkLocalInfoResponse])
- },
-
- // nsIStkLocalInfoResponse
- imei: { value: null, writable: true },
- locationInfo: { value: null, writable: true },
- date: { value: Ci.nsIStkLocalInfoResponse.DATE_INVALID, writable: true },
- language: { value: null, writable: true },
-});
-
-function StkLocalInfoResponseMessage(aStkLocalInfoResponse) {
- // Call |StkResponseMessage| constructor.
- StkResponseMessage.call(this, aStkLocalInfoResponse);
-
- let localInfo = this.localInfo = {};
-
- if (aStkLocalInfoResponse.imei) {
- localInfo.imei = aStkLocalInfoResponse.imei;
- return;
- }
-
- if (aStkLocalInfoResponse.locationInfo) {
- let srcInfo = aStkLocalInfoResponse.locationInfo;
- let destInfo = localInfo.locationInfo = {};
-
- destInfo.mcc = srcInfo.mcc;
- destInfo.mnc = srcInfo.mnc;
- destInfo.gsmLocationAreaCode = srcInfo.gsmLocationAreaCode;
- destInfo.gsmCellId = srcInfo.gsmCellId;
-
- return;
- }
-
- if (aStkLocalInfoResponse.date !== Ci.nsIStkLocalInfoResponse.DATE_INVALID) {
- localInfo.date = new Date(aStkLocalInfoResponse.date);
- return;
- }
-
- if (aStkLocalInfoResponse.language) {
- localInfo.language = aStkLocalInfoResponse.language;
- return;
- }
-}
-StkLocalInfoResponseMessage.prototype = Object.create(StkResponseMessage.prototype);
-
-function StkTimerResponse(aStkTimerResponseMessage) {
- // Call |StkTerminalResponse| constructor.
- StkTerminalResponse.call(this, aStkTimerResponseMessage);
- let timer = aStkTimerResponseMessage.timer;
- // timerAction is useless in Terminal Response,
- // so we always set it to TIMER_ACTION_INVALID.
- this.timer = new StkTimer(timer.timerId,
- Math.floor(timer.timerValue),
- Ci.nsIStkTimer.TIMER_ACTION_INVALID);
-}
-StkTimerResponse.prototype = Object.create(StkTerminalResponse.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkTerminalResponse,
- Ci.nsIStkTimerResponse])
- },
-
- // nsIStkTimerResponse
- timer: { value: null, writable: true }
-});
-
-function StkTimerResponseMessage(aStkTimerResponse) {
- // Call |StkResponseMessage| constructor.
- StkResponseMessage.call(this, aStkTimerResponse);
-
- let timer = this.timer = {};
- // timerAction is meaningless for terminal response.
- timer.timerId = aStkTimerResponse.timer.timerId;
- timer.timerValue = aStkTimerResponse.timer.timerValue;
-}
-StkTimerResponseMessage.prototype = Object.create(StkResponseMessage.prototype);
-
-/**
- * The implementation of nsIStkDownloadEvent set and paired JS object set.
- */
-function StkDownloadEvent(aEventMessage) {
- this.eventType = aEventMessage.eventType;
-}
-StkDownloadEvent.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIStkDownloadEvent]),
-
- // nsIStkDownloadEvent
- eventType: 0
-};
-
-function StkEventMessage(aStkDownloadEvent) {
- this.eventType = aStkDownloadEvent.eventType;
-}
-StkEventMessage.prototype = {
- eventType: 0
-};
-
-function StkLocationEvent(aStkLocationEventMessage) {
- // Call |StkDownloadEvent| constructor.
- StkDownloadEvent.call(this, aStkLocationEventMessage);
- this.locationStatus = aStkLocationEventMessage.locationStatus;
-
- if (this.locationStatus == Ci.nsIStkLocationEvent.SERVICE_STATE_NORMAL &&
- aStkLocationEventMessage.locationInfo) {
- let info = aStkLocationEventMessage.locationInfo;
-
- this.locationInfo = new StkLocationInfo(info.mcc,
- info.mnc,
- info.gsmLocationAreaCode,
- info.gsmCellId);
- }
-}
-StkLocationEvent.prototype = Object.create(StkDownloadEvent.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkDownloadEvent,
- Ci.nsIStkLocationEvent])
- },
-
- // nsIStkLocationEvent
- locationStatus: { value: Ci.nsIStkLocationEvent.SERVICE_STATE_UNAVAILABLE, writable: true },
- locationInfo: { value: null, writable: true }
-});
-
-function StkLocationEventMessage(aStkLocationEvent) {
- // Call |StkEventMessage| constructor.
- StkEventMessage.call(this, aStkLocationEvent);
- this.locationStatus = aStkLocationEvent.locationStatus;
- if (aStkLocationEvent.locationInfo) {
- let info = aStkLocationEvent.locationInfo;
-
- this.locationInfo = new StkLocationInfo(info.mcc,
- info.mnc,
- info.gsmLocationAreaCode,
- info.gsmCellId);
- }
-}
-StkLocationEventMessage.prototype = Object.create(StkEventMessage.prototype);
-
-function StkCallEvent(aStkCallEventMessage) {
- // Call |StkDownloadEvent| constructor.
- StkDownloadEvent.call(this, aStkCallEventMessage);
-
- if (aStkCallEventMessage.number) {
- this.number = aStkCallEventMessage.number;
- }
-
- this.isIssuedByRemote = !!aStkCallEventMessage.isIssuedByRemote;
-
- if (aStkCallEventMessage.error) {
- this.error = aStkCallEventMessage.error;
- }
-}
-StkCallEvent.prototype = Object.create(StkDownloadEvent.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkDownloadEvent,
- Ci.nsIStkCallEvent])
- },
-
- // nsIStkCallEvent
- number: { value: null, writable: true },
- isIssuedByRemote: { value: false, writable: true },
- error: { value: null, writable: true }
-});
-
-function StkCallEventMessage(aStkCallEvent) {
- // Call |StkEventMessage| constructor.
- StkEventMessage.call(this, aStkCallEvent);
- this.number = aStkCallEvent.number;
- this.isIssuedByRemote = aStkCallEvent.isIssuedByRemote;
- this.error = aStkCallEvent.error;
-}
-StkCallEventMessage.prototype = Object.create(StkEventMessage.prototype);
-
-function StkLanguageSelectionEvent(aStkLanguageSelectionEventMessage) {
- // Call |StkDownloadEvent| constructor.
- StkDownloadEvent.call(this, aStkLanguageSelectionEventMessage);
-
- if (aStkLanguageSelectionEventMessage.language) {
- this.language = aStkLanguageSelectionEventMessage.language;
- }
-}
-StkLanguageSelectionEvent.prototype = Object.create(StkDownloadEvent.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkDownloadEvent,
- Ci.nsIStkLanguageSelectionEvent])
- },
-
- // nsIStkLanguageSelectionEvent
- language: { value: null, writable: true }
-});
-
-function StkLanguageSelectionEventMessage(aStkLanguageSelectionEvent) {
- // Call |StkEventMessage| constructor.
- StkEventMessage.call(this, aStkLanguageSelectionEvent);
- this.language = aStkLanguageSelectionEvent.language;
-}
-StkLanguageSelectionEventMessage.prototype = Object.create(StkEventMessage.prototype);
-
-function StkBrowserTerminationEvent(aStkBrowserTerminationEventMessage) {
- // Call |StkDownloadEvent| constructor.
- StkDownloadEvent.call(this, aStkBrowserTerminationEventMessage);
-
- if (aStkBrowserTerminationEventMessage.terminationCause) {
- this.terminationCause = aStkBrowserTerminationEventMessage.terminationCause;
- }
-}
-StkBrowserTerminationEvent.prototype = Object.create(StkDownloadEvent.prototype, {
- QueryInterface: {
- value: XPCOMUtils.generateQI([Ci.nsIStkDownloadEvent,
- Ci.nsIStkBrowserTerminationEvent])
- },
-
- // nsIStkBrowserTerminationEvent
- terminationCause: { value: Ci.nsIStkBrowserTerminationEvent.BROWSER_TERMINATION_CAUSE_USER, writable: true }
-});
-
-function StkBrowserTerminationEventMessage(aStkBrowserTerminationEvent) {
- // Call |StkEventMessage| constructor.
- StkEventMessage.call(this, aStkBrowserTerminationEvent);
- this.terminationCause = aStkBrowserTerminationEvent.terminationCause;
-}
-StkBrowserTerminationEventMessage.prototype = Object.create(StkEventMessage.prototype);
-
-/**
- * Event Prototype Mappings.
- */
-var EventPrototypes = {};
-EventPrototypes[RIL.STK_EVENT_TYPE_USER_ACTIVITY] = StkDownloadEvent;
-EventPrototypes[RIL.STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE] = StkDownloadEvent;
-EventPrototypes[RIL.STK_EVENT_TYPE_MT_CALL] = StkCallEvent;
-EventPrototypes[RIL.STK_EVENT_TYPE_CALL_CONNECTED] = StkCallEvent;
-EventPrototypes[RIL.STK_EVENT_TYPE_CALL_DISCONNECTED] = StkCallEvent;
-EventPrototypes[RIL.STK_EVENT_TYPE_LOCATION_STATUS] = StkLocationEvent;
-EventPrototypes[RIL.STK_EVENT_TYPE_LANGUAGE_SELECTION] = StkLanguageSelectionEvent;
-EventPrototypes[RIL.STK_EVENT_TYPE_BROWSER_TERMINATION] = StkBrowserTerminationEvent;
-
-/**
- * Event Message Prototype Mappings.
- */
-var EventMsgPrototypes = {};
-EventMsgPrototypes[RIL.STK_EVENT_TYPE_USER_ACTIVITY] = StkEventMessage;
-EventMsgPrototypes[RIL.STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE] = StkEventMessage;
-EventMsgPrototypes[RIL.STK_EVENT_TYPE_MT_CALL] = StkCallEventMessage;
-EventMsgPrototypes[RIL.STK_EVENT_TYPE_CALL_CONNECTED] = StkCallEventMessage;
-EventMsgPrototypes[RIL.STK_EVENT_TYPE_CALL_DISCONNECTED] = StkCallEventMessage;
-EventMsgPrototypes[RIL.STK_EVENT_TYPE_LOCATION_STATUS] = StkLocationEventMessage;
-EventMsgPrototypes[RIL.STK_EVENT_TYPE_LANGUAGE_SELECTION] = StkLanguageSelectionEventMessage;
-EventMsgPrototypes[RIL.STK_EVENT_TYPE_BROWSER_TERMINATION] = StkBrowserTerminationEventMessage;
-
-/**
- * Event QueryInterface Mappings.
- */
-var QueriedEventIFs = {};
-QueriedEventIFs[RIL.STK_EVENT_TYPE_USER_ACTIVITY] = Ci.nsIStkDownloadEvent;
-QueriedEventIFs[RIL.STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE] = Ci.nsIStkDownloadEvent;
-QueriedEventIFs[RIL.STK_EVENT_TYPE_MT_CALL] = Ci.nsIStkCallEvent;
-QueriedEventIFs[RIL.STK_EVENT_TYPE_CALL_CONNECTED] = Ci.nsIStkCallEvent;
-QueriedEventIFs[RIL.STK_EVENT_TYPE_CALL_DISCONNECTED] = Ci.nsIStkCallEvent;
-QueriedEventIFs[RIL.STK_EVENT_TYPE_LOCATION_STATUS] = Ci.nsIStkLocationEvent;
-QueriedEventIFs[RIL.STK_EVENT_TYPE_LANGUAGE_SELECTION] = Ci.nsIStkLanguageSelectionEvent;
-QueriedEventIFs[RIL.STK_EVENT_TYPE_BROWSER_TERMINATION] = Ci.nsIStkBrowserTerminationEvent;
-
-/**
- * StkProactiveCmdFactory
- */
-function StkProactiveCmdFactory() {
-}
-StkProactiveCmdFactory.prototype = {
- classID: GONK_STKCMDFACTORY_CID,
-
- classInfo: XPCOMUtils.generateCI({classID: GONK_STKCMDFACTORY_CID,
- contractID: GONK_STKCMDFACTORY_CONTRACTID,
- classDescription: "StkProactiveCmdFactory",
- interfaces: [Ci.nsIStkCmdFactory],
- flags: Ci.nsIClassInfo.SINGLETON}),
-
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIStkCmdFactory]),
-
- /**
- * nsIStkCmdFactory interface.
- */
- createCommand: function(aCommandDetails) {
- let cmdType = CmdPrototypes[aCommandDetails.typeOfCommand];
-
- if (typeof cmdType != "function") {
- throw new Error("Unknown Command Type: " + aCommandDetails.typeOfCommand);
- }
-
- return new cmdType(aCommandDetails);
- },
-
- createCommandMessage: function(aStkProactiveCmd) {
- let cmd = null;
-
- let msgType = MsgPrototypes[aStkProactiveCmd.typeOfCommand];
-
- if (typeof msgType != "function") {
- throw new Error("Unknown Command Type: " + aStkProactiveCmd.typeOfCommand);
- }
-
- // convert aStkProactiveCmd to it's concrete interface before creating
- // system message.
- try {
- cmd = aStkProactiveCmd.QueryInterface(QueriedIFs[aStkProactiveCmd.typeOfCommand]);
- } catch (e) {
- throw new Error("Failed to convert command into concrete class: " + e);
- }
-
- return new msgType(cmd);
- },
-
- deflateCommand: function(aStkProactiveCmd) {
- return JSON.stringify(this.createCommandMessage(aStkProactiveCmd));
- },
-
- inflateCommand: function(aJSON) {
- return this.createCommand(JSON.parse(aJSON));
- },
-
- createResponse: function(aResponseMessage) {
- if (!aResponseMessage || aResponseMessage.resultCode === undefined) {
- throw new Error("Invalid response message: " + JSON.stringify(aResponseMessage));
- }
-
- if (aResponseMessage.itemIdentifier !== undefined) {
- return new StkSelectItemResponse(aResponseMessage);
- }
-
- if (aResponseMessage.input !== undefined ||
- aResponseMessage.isYesNo !== undefined) {
- return new StkGetInputResponse(aResponseMessage);
- }
-
- if (aResponseMessage.hasConfirmed !== undefined) {
- return new StkCallSetupResponse(aResponseMessage);
- }
-
- if (aResponseMessage.localInfo !== undefined) {
- return new StkLocalInfoResponse(aResponseMessage);
- }
-
- if (aResponseMessage.timer !== undefined) {
- return new StkTimerResponse(aResponseMessage);
- }
-
- return new StkTerminalResponse(aResponseMessage);
- },
-
- createResponseMessage: function(aStkTerminalResponse) {
- if (!aStkTerminalResponse) {
- throw new Error("Invalid terminal response: " + JSON.stringify(aStkTerminalResponse));
- }
-
- let response;
- if (aStkTerminalResponse instanceof Ci.nsIStkSelectItemResponse) {
- response = aStkTerminalResponse.QueryInterface(Ci.nsIStkSelectItemResponse);
- return new StkSelectItemResponseMessage(response);
- }
-
- if (aStkTerminalResponse instanceof Ci.nsIStkGetInputResponse) {
- response = aStkTerminalResponse.QueryInterface(Ci.nsIStkGetInputResponse);
- return new StkGetInputResponseMessage(response);
- }
-
- if (aStkTerminalResponse instanceof Ci.nsIStkCallSetupResponse) {
- response = aStkTerminalResponse.QueryInterface(Ci.nsIStkCallSetupResponse);
- return new StkCallSetupResponseMessage(response);
- }
-
- if (aStkTerminalResponse instanceof Ci.nsIStkLocalInfoResponse) {
- response = aStkTerminalResponse.QueryInterface(Ci.nsIStkLocalInfoResponse);
- return new StkLocalInfoResponseMessage(response);
- }
-
- if (aStkTerminalResponse instanceof Ci.nsIStkTimerResponse) {
- response = aStkTerminalResponse.QueryInterface(Ci.nsIStkTimerResponse);
- return new StkTimerResponseMessage(response);
- }
-
- return new StkResponseMessage(aStkTerminalResponse);
- },
-
- deflateResponse: function(aStkTerminalResponse) {
- return JSON.stringify(this.createResponseMessage(aStkTerminalResponse));
- },
-
- inflateResponse: function(aJSON) {
- return this.createResponse(JSON.parse(aJSON));
- },
-
- createEvent: function(aEventMessage) {
- let eventType = EventPrototypes[aEventMessage.eventType];
-
- if (typeof eventType != "function") {
- throw new Error("Unknown Event Type: " + aEventMessage.eventType);
- }
-
- return new eventType(aEventMessage);
- },
-
- createEventMessage: function(aStkDownloadEvent) {
- let event = null;
-
- let eventType = EventMsgPrototypes[aStkDownloadEvent.eventType];
-
- if (typeof eventType != "function") {
- throw new Error("Unknown Event Type: " + aStkDownloadEvent.eventType);
- }
-
- // convert aStkDownloadEvent to it's concrete interface before creating message.
- try {
- event = aStkDownloadEvent.QueryInterface(QueriedEventIFs[aStkDownloadEvent.eventType]);
- } catch (e) {
- throw new Error("Failed to convert event into concrete class: " + e);
- }
-
- return new eventType(event);
- },
-
- deflateDownloadEvent: function(aStkDownloadEvent) {
- return JSON.stringify(this.createEventMessage(aStkDownloadEvent));
- },
-
- inflateDownloadEvent: function(aJSON) {
- return this.createEvent(JSON.parse(aJSON));
- },
-
- createTimer: function(aStkTimerMessage) {
- if (!aStkTimerMessage ||
- aStkTimerMessage.timerId === undefined) {
- throw new Error("Invalid timer object: " + JSON.stringify(aStkTimerMessage));
- }
-
- // timerAction is useless in TIMER EXPIRATION envelope,
- // so we always set it to TIMER_ACTION_INVALID.
- return new StkTimer(aStkTimerMessage.timerId,
- Math.floor(aStkTimerMessage.timerValue),
- Ci.nsIStkTimer.TIMER_ACTION_INVALID);
- }
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([StkProactiveCmdFactory]);
deleted file mode 100644
--- a/dom/icc/gonk/StkCmdFactory.manifest
+++ /dev/null
@@ -1,6 +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/.
-
-component {7a663440-e336-11e4-8fd5-c3140a7ff307} StkCmdFactory.js
-contract @mozilla.org/icc/stkcmdfactory;1 {7a663440-e336-11e4-8fd5-c3140a7ff307}
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/interfaces/moz.build
+++ /dev/null
@@ -1,21 +0,0 @@
-# -*- Mode: python; 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 += [
- 'nsIIccContact.idl',
- 'nsIIccInfo.idl',
- 'nsIIccService.idl',
- 'nsIStkCmdFactory.idl',
- 'nsIStkProactiveCmd.idl',
-]
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:
- XPIDL_SOURCES += [
- 'nsIGonkIccService.idl',
- 'nsIIccMessenger.idl',
- ]
-
-XPIDL_MODULE = 'dom_icc'
deleted file mode 100644
--- a/dom/icc/interfaces/nsIGonkIccService.idl
+++ /dev/null
@@ -1,20 +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 "nsIIccService.idl"
-
-%{C++
-#define GONK_ICC_SERVICE_CONTRACTID \
- "@mozilla.org/icc/gonkiccservice;1"
-%}
-
-[scriptable, uuid(cdcdd800-ef24-11e4-99e7-1f0f5f2576c5)]
-interface nsIGonkIccService : nsIIccService
-{
- void notifyStkCommand(in unsigned long aServiceId, in nsIStkProactiveCmd aStkcommand);
- void notifyStkSessionEnd(in unsigned long aServiceId);
- void notifyCardStateChanged(in unsigned long aServiceId, in unsigned long aCardState);
- void notifyIccInfoChanged(in unsigned long aServiceId, in jsval aIccInfo);
- void notifyImsiChanged(in unsigned long aServiceId, in DOMString aImsi);
-};
deleted file mode 100644
--- a/dom/icc/interfaces/nsIIccContact.idl
+++ /dev/null
@@ -1,60 +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 "nsISupports.idl"
-
-[scriptable, uuid(0f3dbcd1-9f7b-40a8-aa3c-b5701978ec53)]
-interface nsIIccContact : nsISupports
-{
- /**
- * The unique identifier of this ICC Contact.
- *
- * Note: This id is composed of the iccid and its record index of EF_ADN.
- */
- readonly attribute DOMString id;
-
- /**
- * Name list.
- *
- * The container of Alpha-Id in EF_ADN and Second Name in EF_SNE of this contact,
- * where EF_SNE provides the possibility to store a name in different language.
- *
- * @see 10.2.1 Support of two name fields per entry, 3GPP TS 21.111.
- *
- * @param aCount
- * The number of names.
- *
- * @returns the array of names.
- */
- void getNames([optional] out unsigned long aCount,
- [array, size_is(aCount), retval] out wstring aNames);
-
- /**
- * Phone number list.
- *
- * The container of the dialing numbers of this contact in EF_ADN and EF_ANR.
- *
- * @see 10.2.2 Support of multiple phone numbers per entry, 3GPP TS 21.111.
- *
- * @param aCount
- * The number of phone numbers.
- *
- * @returns the array of phone numbers.
- */
- void getNumbers([optional] out unsigned long aCount,
- [array, size_is(aCount), retval] out wstring aNumbers);
-
- /**
- * Email list.
- *
- * The container of the emails of this contact in EF_EMAIL.
- *
- * @param aCount
- * The number of emails.
- *
- * @returns the array of emails.
- */
- void getEmails([optional] out unsigned long aCount,
- [array, size_is(aCount), retval] out wstring aEmails);
-};
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/interfaces/nsIIccInfo.idl
+++ /dev/null
@@ -1,70 +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 "nsISupports.idl"
-
-[scriptable, uuid(3ba11a90-34e0-11e4-8c21-0800200c9a66)]
-interface nsIIccInfo : nsISupports
-{
- /**
- * Integrated Circuit Card Type.
- *
- * Possible values: null(unknown), "sim", "usim", "csim", ruim".
- */
- readonly attribute DOMString iccType;
-
- /**
- * Integrated Circuit Card Identifier.
- */
- readonly attribute DOMString iccid;
-
- /**
- * Mobile Country Code (MCC) of the subscriber's home network.
- */
- readonly attribute DOMString mcc;
-
- /**
- * Mobile Network Code (MNC) of the subscriber's home network.
- */
- readonly attribute DOMString mnc;
-
- /**
- * Service Provider Name (SPN) of the subscriber's home network.
- */
- readonly attribute DOMString spn;
-
- /**
- * Network name must be a part of displayed carrier name.
- */
- readonly attribute boolean isDisplayNetworkNameRequired;
-
- /**
- * Service provider name must be a part of displayed carrier name.
- */
- readonly attribute boolean isDisplaySpnRequired;
-};
-
-[scriptable, uuid(6c9c78b0-34e0-11e4-8c21-0800200c9a66)]
-interface nsIGsmIccInfo : nsIIccInfo
-{
- /**
- * Mobile Station ISDN Number (MSISDN) of the subscriber, aka
- * his phone number.
- */
- readonly attribute DOMString msisdn;
-};
-
-[scriptable, uuid(7452f570-34e0-11e4-8c21-0800200c9a66)]
-interface nsICdmaIccInfo : nsIIccInfo
-{
- /**
- * Mobile Directory Number (MDN) of the subscriber, aka his phone number.
- */
- readonly attribute DOMString mdn;
-
- /**
- * Preferred Roaming List (PRL) version of the subscriber.
- */
- readonly attribute long prlVersion;
-};
deleted file mode 100644
--- a/dom/icc/interfaces/nsIIccMessenger.idl
+++ /dev/null
@@ -1,22 +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 "nsISupports.idl"
-
-interface nsIStkProactiveCmd;
-
-[scriptable, uuid(000696fe-5d85-11e4-8da2-2fdf3880276b)]
-interface nsIIccMessenger : nsISupports
-{
- /**
- * To broadcast 'icc-stkcommand' system message
- *
- * @param aIccId
- * Integrated Circuit Card Identifier.
- * @param aCommand
- * An instance of nsIStkProactiveCmd or its sub-class.
- */
- void notifyStkProactiveCommand(in DOMString aIccId,
- in nsIStkProactiveCmd aCommand);
-};
deleted file mode 100644
--- a/dom/icc/interfaces/nsIIccService.idl
+++ /dev/null
@@ -1,538 +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 "nsISupports.idl"
-
-interface nsIIcc;
-interface nsIIccContact;
-interface nsIIccInfo;
-interface nsIStkDownloadEvent;
-interface nsIStkProactiveCmd;
-interface nsIStkTerminalResponse;
-
-[scriptable, uuid(71b33012-eca2-11e4-a40d-9ff040a6fe2a)]
-interface nsIIccListener : nsISupports
-{
- void notifyStkCommand(in nsIStkProactiveCmd aStkProactiveCmd);
- void notifyStkSessionEnd();
- void notifyCardStateChanged();
- void notifyIccInfoChanged();
-};
-
-/**
- * A callback interface for handling asynchronous response.
- */
-[scriptable, uuid(b7b0623f-fb2c-4cec-b0dc-00ac2fe7b296)]
-interface nsIIccCallback : nsISupports
-{
- /**
- * The success callback with no result required:
- * |unlockCardLock|, |setCardLockEnabled| and |changeCardLockPassword|.
- */
- void notifySuccess();
-
- /**
- * The success callback with boolean response:
- * |getCardLockEnabled|, |matchMvno|, and |getServiceStateEnabled|.
- */
- void notifySuccessWithBoolean(in boolean aResult);
-
- /**
- * The success callback of |getCardLockRetryCount|.
- *
- * @param aCount
- * The number of remaining retries. -1 if unknown.
- */
- void notifyGetCardLockRetryCount(in long aCount);
-
- /**
- * The success callback of |readContacts|.
- *
- * @param aContacts
- * The list of contacts retrieved from ICC.
- * @param aCount
- * The number of contacts retrieved from ICC.
- */
- void notifyRetrievedIccContacts([array, size_is(aCount)] in nsIIccContact aContacts,
- in uint32_t aCount);
-
- /**
- * The success callback of |updateContact|.
- *
- * @param aContact
- * The contact with the updated result.
- */
- void notifyUpdatedIccContact(in nsIIccContact aContact);
-
- /**
- * The error callback of |getCardLockEnabled|, |getCardLockRetryCount|,
- * |matchMvno|, |getServiceStateEnabled|, |readContacts| and |updateContact|.
- *
- * @param aErrorMsg
- * The error message.
- */
- void notifyError(in DOMString aErrorMsg);
-
- /**
- * The error callback of |unlockCardLock|, |setCardLockEnabled| and
- * |changeCardLockPassword|.
- *
- * @param aErrorMsg
- * The error message.
- * @param aRetryCount
- * The number of remaining retries. -1 if unknown.
- */
- void notifyCardLockError(in DOMString aErrorMsg, in long aRetryCount);
-};
-
-[scriptable, uuid(6136acab-b50e-494a-a86d-df392a032897)]
-interface nsIIccChannelCallback : nsISupports
-{
- /**
- * Callback function to notify on successfully opening a logical channel.
- *
- * @param channel
- * The Channel Number/Handle that is successfully opened.
- */
- void notifyOpenChannelSuccess(in long channel);
-
- /**
- * Callback function to notify on successfully closing the logical channel.
- *
- */
- void notifyCloseChannelSuccess();
-
- /**
- * Callback function to notify the status of 'iccExchangeAPDU' command.
- *
- * @param sw1
- * Response's First Status Byte
- * @param sw2
- * Response's Second Status Byte
- * @param data
- * Response's data
- */
- void notifyExchangeAPDUResponse(in octet sw1,
- in octet sw2,
- in DOMString data);
-
- /**
- * Callback function to notify error
- *
- */
- void notifyError(in DOMString error);
-};
-
-%{C++
-#define ICC_SERVICE_CID \
- { 0xbab0277a, 0x900e, 0x11e4, { 0x80, 0xc7, 0xdb, 0xd7, 0xad, 0x05, 0x24, 0x01 } }
-#define ICC_SERVICE_CONTRACTID \
- "@mozilla.org/icc/iccservice;1"
-
-template<typename T> struct already_AddRefed;
-%}
-
-/**
- * XPCOM Service for the selection of the ICC to be accessed.
- */
-[scriptable, uuid(6590a04c-9ca4-11e4-ae95-570876ecc428)]
-interface nsIIccService : nsISupports
-{
- /**
- * Get Icc instance with specified Service Id.
- *
- * @param aServiceId
- * Started from 0 to nsIMobileConnectionService.numItems - 1;
- *
- * @return a nsIcc instance.
- */
- nsIIcc getIccByServiceId(in unsigned long aServiceId);
-};
-
-%{C++
-already_AddRefed<nsIIccService>
-NS_CreateIccService();
-%}
-
-/**
- * XPCOM component that provides the access to the selected ICC.
- */
-[scriptable, uuid(1791f102-b081-4435-8555-37eb035fa4e2)]
-interface nsIIcc : nsISupports
-{
- /**
- * Card State Constants
- *
- * Note: MUST be matched with enum IccCardState in MozIcc.webidl!
- */
- const unsigned long CARD_STATE_UNKNOWN = 0;
- const unsigned long CARD_STATE_READY = 1;
- const unsigned long CARD_STATE_PIN_REQUIRED = 2;
- const unsigned long CARD_STATE_PUK_REQUIRED = 3;
- const unsigned long CARD_STATE_PERMANENT_BLOCKED = 4;
- const unsigned long CARD_STATE_PERSONALIZATION_IN_PROGRESS = 5;
- const unsigned long CARD_STATE_PERSONALIZATION_READY = 6;
- const unsigned long CARD_STATE_NETWORK_LOCKED = 7;
- const unsigned long CARD_STATE_NETWORK_SUBSET_LOCKED = 8;
- const unsigned long CARD_STATE_CORPORATE_LOCKED = 9;
- const unsigned long CARD_STATE_SERVICE_PROVIDER_LOCKED = 10;
- const unsigned long CARD_STATE_SIM_LOCKED = 11;
- const unsigned long CARD_STATE_NETWORK_PUK_REQUIRED = 12;
- const unsigned long CARD_STATE_NETWORK_SUBSET_PUK_REQUIRED = 13;
- const unsigned long CARD_STATE_CORPORATE_PUK_REQUIRED = 14;
- const unsigned long CARD_STATE_SERVICE_PROVIDER_PUK_REQUIRED = 15;
- const unsigned long CARD_STATE_SIM_PUK_REQUIRED = 16;
- const unsigned long CARD_STATE_NETWORK1_LOCKED = 17;
- const unsigned long CARD_STATE_NETWORK2_LOCKED = 18;
- const unsigned long CARD_STATE_HRPD_NETWORK_LOCKED = 19;
- const unsigned long CARD_STATE_RUIM_CORPORATE_LOCKED = 20;
- const unsigned long CARD_STATE_RUIM_SERVICE_PROVIDER_LOCKED = 21;
- const unsigned long CARD_STATE_RUIM_LOCKED = 22;
- const unsigned long CARD_STATE_NETWORK1_PUK_REQUIRED = 23;
- const unsigned long CARD_STATE_NETWORK2_PUK_REQUIRED = 24;
- const unsigned long CARD_STATE_HRPD_NETWORK_PUK_REQUIRED = 25;
- const unsigned long CARD_STATE_RUIM_CORPORATE_PUK_REQUIRED = 26;
- const unsigned long CARD_STATE_RUIM_SERVICE_PROVIDER_PUK_REQUIRED = 27;
- const unsigned long CARD_STATE_RUIM_PUK_REQUIRED = 28;
- const unsigned long CARD_STATE_ILLEGAL = 29;
-
- const unsigned long CARD_STATE_UNDETECTED = 4294967295; // UINT32_MAX
-
- /**
- * Card Lock Constants
- *
- * Note: MUST be matched with enum IccLockType in MozIcc.webidl!
- */
- const unsigned long CARD_LOCK_TYPE_PIN = 0;
- const unsigned long CARD_LOCK_TYPE_PIN2 = 1;
- const unsigned long CARD_LOCK_TYPE_PUK = 2;
- const unsigned long CARD_LOCK_TYPE_PUK2 = 3;
- const unsigned long CARD_LOCK_TYPE_NCK = 4;
- const unsigned long CARD_LOCK_TYPE_NSCK = 5;
- const unsigned long CARD_LOCK_TYPE_NCK1 = 6;
- const unsigned long CARD_LOCK_TYPE_NCK2 = 7;
- const unsigned long CARD_LOCK_TYPE_HNCK = 8;
- const unsigned long CARD_LOCK_TYPE_CCK = 9;
- const unsigned long CARD_LOCK_TYPE_SPCK = 10;
- const unsigned long CARD_LOCK_TYPE_PCK = 11;
- const unsigned long CARD_LOCK_TYPE_RCCK = 12;
- const unsigned long CARD_LOCK_TYPE_RSPCK = 13;
- const unsigned long CARD_LOCK_TYPE_NCK_PUK = 14;
- const unsigned long CARD_LOCK_TYPE_NSCK_PUK = 15;
- const unsigned long CARD_LOCK_TYPE_NCK1_PUK = 16;
- const unsigned long CARD_LOCK_TYPE_NCK2_PUK = 17;
- const unsigned long CARD_LOCK_TYPE_HNCK_PUK = 18;
- const unsigned long CARD_LOCK_TYPE_CCK_PUK = 19;
- const unsigned long CARD_LOCK_TYPE_SPCK_PUK = 20;
- const unsigned long CARD_LOCK_TYPE_PCK_PUK = 21;
- const unsigned long CARD_LOCK_TYPE_RCCK_PUK = 22;
- const unsigned long CARD_LOCK_TYPE_RSPCK_PUK = 23;
- const unsigned long CARD_LOCK_TYPE_FDN = 24;
-
- /**
- * Contact Type Constants
- *
- * Note: MUST be matched with enum IccContactType in MozIcc.webidl!
- */
- const unsigned long CARD_CONTACT_TYPE_ADN = 0;
- const unsigned long CARD_CONTACT_TYPE_FDN = 1;
- const unsigned long CARD_CONTACT_TYPE_SDN = 2;
-
- /**
- * MVNO Type Constants
- *
- * Note: MUST be matched with enum IccMvnoType in MozIcc.webidl!
- */
- const unsigned long CARD_MVNO_TYPE_IMSI = 0;
- const unsigned long CARD_MVNO_TYPE_SPN = 1;
- const unsigned long CARD_MVNO_TYPE_GID = 2;
-
- /**
- * Card Service Constants
- *
- * Note: MUST be matched with enum IccService in MozIcc.webidl!
- */
- const unsigned long CARD_SERVICE_FDN = 0;
-
- /**
- * Icc Contact Type Constants
- *
- * Note: MUST be matched with enum IccContactType in MozIcc.webidl!
- */
- const unsigned long CONTACT_TYPE_ADN = 0;
- const unsigned long CONTACT_TYPE_FDN = 1;
- const unsigned long CONTACT_TYPE_SDN = 2;
-
- /**
- * Called to register icc-related changes.
- *
- * 'mobileconnection' permission is required to register.
- */
- void registerListener(in nsIIccListener aListener);
- void unregisterListener(in nsIIccListener aListener);
-
- /**
- * Information stored in this ICC.
- */
- readonly attribute nsIIccInfo iccInfo;
-
- /**
- * Indicates the state of this ICC.
- *
- * One of the CARD_STATE_* values.
- */
- readonly attribute unsigned long cardState;
-
- /**
- * IMSI of this ICC.
- */
- readonly attribute DOMString imsi;
-
- /**
- * Get the status of an ICC lock (e.g. the PIN lock).
- *
- * @param aLockType
- * One of the CARD_LOCK_TYPE_* values.
- * @param aCallback
- * An instance of nsIIccCallback:
- * nsIIccCallback::notifySuccessWithBoolean() if success.
- * nsIIccCallback::notifyError(), otherwise.
- */
- void getCardLockEnabled(in unsigned long aLockType,
- in nsIIccCallback aCallback);
-
- /**
- * Unlock a card lock.
- *
- * @param aLockType
- * One of the CARD_LOCK_TYPE_* values.
- * @param aPassword
- * The password of this lock.
- * @param aNewPin (Optional)
- * The new PIN to be set after PUK/PUK2 is unlock.
- * @param aCallback
- * An instance of nsIIccCallback:
- * nsIIccCallback::notifySuccess() if success.
- * nsIIccCallback::notifyCardLockError(), otherwise.
- */
- void unlockCardLock(in unsigned long aLockType,
- in DOMString aPassword,
- in DOMString aNewPin,
- in nsIIccCallback aCallback);
-
- /**
- * Enable/Disable a card lock.
- *
- * @param aLockType
- * One of the CARD_LOCK_TYPE_* values.
- * @param aPassword
- * The password of this lock.
- * @param aEnabled.
- * True to enable the lock. False to disable, otherwise.
- * @param aCallback
- * An instance of nsIIccCallback:
- * nsIIccCallback::notifySuccess() if success.
- * nsIIccCallback::notifyCardLockError(), otherwise.
- */
- void setCardLockEnabled(in unsigned long aLockType,
- in DOMString aPassword,
- in boolean aEnabled,
- in nsIIccCallback aCallback);
-
- /**
- * Change the password of a card lock.
- *
- * @param aLockType
- * One of the CARD_LOCK_TYPE_* values.
- * @param aPassword
- * The password of this lock.
- * @param aNewPassword.
- * The new password of this lock.
- * @param aCallback
- * An instance of nsIIccCallback:
- * nsIIccCallback::notifySuccess() if success.
- * nsIIccCallback::notifyCardLockError(), otherwise.
- */
- void changeCardLockPassword(in unsigned long aLockType,
- in DOMString aPassword,
- in DOMString aNewPassword,
- in nsIIccCallback aCallback);
-
- /**
- * Get the number of remaining tries of a lock.
- *
- * @param aLockType
- * One of the CARD_LOCK_TYPE_* values.
- * @param aCallback
- * An instance of nsIIccCallback:
- * nsIIccCallback::notifyGetCardLockRetryCount() if success.
- * nsIIccCallback::notifyError(), otherwise.
- */
- void getCardLockRetryCount(in unsigned long aLockType,
- in nsIIccCallback aCallback);
-
- /**
- * Verify whether the passed data (matchData) matches with some ICC's field
- * according to the mvno type (mvnoType).
- *
- * @param aMvnoType
- * One of CARD_MVNO_TYPE_* values.
- * @param aMvnoData
- * Data to be compared with ICC's field.
- * @param aCallback
- * An instance of nsIIccCallback:
- * nsIIccCallback::notifySuccessWithBoolean() if success.
- * nsIIccCallback::notifyError(), otherwise.
- */
- void matchMvno(in unsigned long aMvnoType,
- in DOMString aMvnoData,
- in nsIIccCallback aCallback);
-
- /**
- * Retrieve the the availability of an icc service.
- *
- * @param aService
- * One of CARD_SERVICE_* values.
- * @param aCallback
- * An instance of nsIIccCallback:
- * nsIIccCallback::notifySuccessWithBoolean() if success.
- * nsIIccCallback::notifyError(), otherwise.
- */
- void getServiceStateEnabled(in unsigned long aService,
- in nsIIccCallback aCallback);
-
- /**
- * Open Secure Card Icc communication channel
- *
- * @param aAid
- * Card Application Id in this UICC.
- * @param aCallback
- * An instance of nsIIccChannelCallback.
- * nsIIccChannelCallback::notifyOpenChannelSuccess() if success.
- * nsIIccChannelCallback::notifyError(), otherwise.
- */
- void iccOpenChannel(in DOMString aAid,
- in nsIIccChannelCallback aCallback);
-
- /**
- * Exchange Command APDU (C-APDU) with UICC on the given logical channel.
- * Note that 'P3' parameter could be Le/Lc depending on command APDU case.
- * For Case 1 scenario (when only command header is present), the value
- * of 'P3' should be set to '-1' explicitly.
- * Refer to 3G TS 31.101 , 10.2 'Command APDU Structure' for all the cases.
- *
- * @param aChannel
- * given logical channel.
- * @param aCla
- * APDU class.
- * @param aIns
- * Instruction code.
- * @param aP1, aP2, aP3
- * P1, P2, P3 parameters in APDU.
- * @param aData
- * The hex data to be sent by this PDU.
- * @param aCallback
- * An instance of nsIIccChannelCallback.
- * nsIIccChannelCallback::notifyExchangeAPDUResponse() if success.
- * nsIIccChannelCallback::notifyError(), otherwise.
- */
- void iccExchangeAPDU(in long aChannel,
- in octet aCla,
- in octet aIns,
- in octet aP1,
- in octet aP2,
- in short aP3,
- in DOMString aData,
- in nsIIccChannelCallback aCallback);
-
- /**
- * Close Secure Card Icc communication channel
- *
- * @param aChannel
- * Channel to be closed.
- * @param aCallback
- * An instance of nsIIccChannelCallback.
- * nsIIccChannelCallback::notifyCloseChannelSuccess() if success.
- * nsIIccChannelCallback::notifyError(), otherwise.
- */
- void iccCloseChannel(in long aChannel,
- in nsIIccChannelCallback aCallback);
-
- /**
- * Send STK terminal response to the received proactive command.
- *
- * @param aCommand
- * The received proactive command.
- * @param aResponse
- * The response to be reply to the card application that issues
- * this proactive command.
- */
- void sendStkResponse(in nsIStkProactiveCmd aCommand,
- in nsIStkTerminalResponse aResponse);
-
- /**
- * Send envelope to notify the selected item of the main STK menu.
- *
- * @param aItemIdentifier
- * The identifier of the menu item.
- * @param aHelpRequested
- * True if help information of the selected item is requested by
- * the user.
- */
- void sendStkMenuSelection(in unsigned short aItemIdentifier,
- in boolean aHelpRequested);
-
- /**
- * Send envelope to notify the expiration of a requested timer.
- *
- * @param aTimerId
- * The TimerId provided from previous proactive command.
- * @param aTimerValue
- * The real used seconds when expired.
- */
- void sendStkTimerExpiration(in unsigned short aTimerId,
- in unsigned long aTimerValue);
-
- /**
- * Send "Event Download" envelope to the ICC.
- *
- * @param aEvent
- * The event that ICC listening to in STK_CMD_SET_UP_EVENT_LIST.
- */
- void sendStkEventDownload(in nsIStkDownloadEvent aEvent);
-
- /**
- * Read Specified type of Contact from ICC.
- *
- * @param aContactType
- * One of CONTACT_TYPE_*.
- *
- * @param aCallback
- * An instance of nsIIccCallback:
- * nsIIccCallback::notifyRetrievedIccContacts() if success.
- * nsIIccCallback::notifyError(), otherwise.
- */
- void readContacts(in unsigned long aContactType,
- in nsIIccCallback aCallback);
-
- /**
- * Update Specified type of Contact in ICC.
- *
- * @param aContactType
- * One of CONTACT_TYPE_*.
- * @param aContact
- * an nsIIccContact instance with information to be updated.
- * @param aPin2 (Optional)
- * The PIN2 required to update FDN contact.
- *
- * @param aCallback
- * An instance of nsIIccCallback:
- * nsIIccCallback::notifyUpdatedIccContact() if success.
- * nsIIccCallback::notifyError(), otherwise.
- */
- void updateContact(in unsigned long aContactType,
- in nsIIccContact aContact,
- in DOMString aPin2,
- in nsIIccCallback aCallback);
-};
deleted file mode 100644
--- a/dom/icc/interfaces/nsIStkCmdFactory.idl
+++ /dev/null
@@ -1,140 +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 "nsISupports.idl"
-
-%{C++
-#define ICC_STK_CMD_FACTORY_CONTRACTID \
- "@mozilla.org/icc/stkcmdfactory;1"
-%}
-
-interface nsIStkProactiveCmd;
-interface nsIStkTerminalResponse;
-interface nsIStkDownloadEvent;
-interface nsIStkTimer;
-
-/**
- * This StkCmdFactory provides series factory methods to create objects defined
- * in nsIStkProactiveCmd.idl and MozStkCommandEvent.webidl.
- */
-[scriptable, uuid(743536c4-006f-11e5-a3f7-bf7a7fd59b9b)]
-interface nsIStkCmdFactory : nsISupports
-{
- /**
- * @param aCommandDetails
- * A JS object which complies with 'dictionary MozStkCommand'
- * in MozStkCommandEvent.webidl
- *
- * @return a nsIStkProactiveCmd instance.
- */
- nsIStkProactiveCmd createCommand(in jsval aCommandDetails);
-
- /**
- * @param aStkProactiveCmd
- * a nsIStkProactiveCmd instance.
- *
- * @return a JS object which complies with 'dictionary MozStkCommand'
- * in MozStkCommandEvent.webidl
- */
- jsval createCommandMessage(in nsIStkProactiveCmd aStkProactiveCmd);
-
- /**
- * @param aStkProactiveCmd
- * a nsIStkProactiveCmd instance.
- *
- * @return a JSON string which complies with 'dictionary MozStkCommand'
- * in MozStkCommandEvent.webidl
- */
- AString deflateCommand(in nsIStkProactiveCmd aStkProactiveCmd);
-
- /**
- * @param a JSON string which complies with 'dictionary MozStkCommand'
- * in MozStkCommandEvent.webidl
- *
- * @return a nsIStkProactiveCmd instance.
- */
- nsIStkProactiveCmd inflateCommand(in AString aJSON);
-
- /**
- * @param aResponseMessage
- * A JS object which complies with 'dictionary MozStkResponse'
- * in MozStkCommandEvent.webidl
- *
- * @return a nsIStkTerminalResponse instance.
- */
- nsIStkTerminalResponse createResponse(in jsval aResponseMessage);
-
- /**
- * @param aStkTerminalResponse
- * a nsIStkTerminalResponse instance.
- *
- * @return a JS object which complies with 'dictionary MozStkResponse'
- * in MozStkCommandEvent.webidl
- */
- jsval createResponseMessage(in nsIStkTerminalResponse aStkTerminalResponse);
-
- /**
- * @param aStkTerminalResponse
- * a nsIStkTerminalResponse instance.
- *
- * @return a JSON string which complies with 'dictionary MozStkResponse'
- * in MozStkCommandEvent.webidl
- */
- AString deflateResponse(in nsIStkTerminalResponse aStkTerminalResponse);
-
- /**
- * @param a JSON string which complies with 'dictionary MozStkResponse'
- * in MozStkCommandEvent.webidl
- *
- * @return a nsIStkTerminalResponse instance.
- */
- nsIStkTerminalResponse inflateResponse(in AString aJSON);
-
- /**
- * @param aEventMessage
- * A JS object which complies with 'dictionary MozStkXxxEvent'
- * in MozStkCommandEvent.webidl
- *
- * @return a nsIStkDownloadEvent instance.
- */
- nsIStkDownloadEvent createEvent(in jsval aEventMessage);
-
- /**
- * @param aStkDownloadEvent
- * a nsIStkDownloadEvent instance.
- *
- * @return a JS object which complies with 'dictionary MozStkXxxEvent'
- * in MozStkCommandEvent.webidl
- */
- jsval createEventMessage(in nsIStkDownloadEvent aStkDownloadEvent);
-
- /**
- * @param aStkDownloadEvent
- * a nsIStkDownloadEvent instance.
- *
- * @return a JSON string which complies with 'dictionary MozStkXxxEvent'
- * in MozStkCommandEvent.webidl
- */
- AString deflateDownloadEvent(in nsIStkDownloadEvent aStkDownloadEvent);
-
- /**
- * @param a JSON string which complies with 'dictionary MozStkXxxEvent'
- * in MozStkCommandEvent.webidl
- *
- * @return a nsIStkDownloadEvent instance.
- */
- nsIStkDownloadEvent inflateDownloadEvent(in AString aJSON);
-
- /**
- * @param aStkTimerMessage
- * a JS object which complies with 'dictionary MozStkTimer'
- * in MozStkCommandEvent.webidl
- *
- * @return an instance of nsIStkTimer with the same timerId and timerValue
- * from aStkTimerMessage.
- *
- * Note: This API is specific to nsIIcc::sendStkTimerExpiration().
- */
- nsIStkTimer createTimer(in jsval aStkTimerMessage);
-};
deleted file mode 100644
--- a/dom/icc/interfaces/nsIStkProactiveCmd.idl
+++ /dev/null
@@ -1,1017 +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 "domstubs.idl"
-
-[scriptable, uuid(1510cf0c-5db6-11e4-9869-6bf419e26642)]
-interface nsIStkDuration : nsISupports
-{
- /**
- * The value of Time units defined in 12.8 Duration of TS 11.14.
- */
- readonly attribute unsigned short timeUnit;
-
- /**
- * The length of time required, expressed in timeUnit.
- *
- * Note: the range is from 1 unit to 255 units.
- */
- readonly attribute unsigned short timeInterval;
-};
-
-[scriptable, uuid(c7b6e57a-696d-11e4-bcaa-bfe8386e75a9)]
-interface nsIStkIcon : nsISupports
-{
- /**
- * The color coding schemes defined in 4.6.1.1 of TS 31.102.
- */
- const unsigned short CODING_SCHEME_BASIC = 0x11;
- const unsigned short CODING_SCHEME_COLOR = 0x21;
- const unsigned short CODING_SCHEME_COLOR_TRANSPARENCY = 0x22;
-
- /**
- * Width of the icon.
- */
- readonly attribute unsigned long width;
-
- /**
- * Height of the icon.
- */
- readonly attribute unsigned long height;
-
- /**
- * Image coding scheme of the icon.
- * One of CODING_SCHEME_*.
- */
- readonly attribute unsigned short codingScheme;
-
- /**
- * Array of pixels. Each pixel represents a color in the RGBA format made up
- * of four bytes, that is, the Red sample in the highest 8 bits, followed by
- * the Green sample, Blue sample and the Alpha sample in the lowest 8 bits.
- *
- * @param aCount
- * The number of pixels.
- *
- * @returns a copy of the array of pixels.
- */
- void getPixels([optional] out unsigned long aCount,
- [array, size_is(aCount), retval] out unsigned long aPixels);
-};
-
-[scriptable, uuid(4a6d173e-5e8b-11e4-9d78-071bb3d6ba8f)]
-interface nsIStkIconInfo : nsISupports
-{
- /**
- * Indicates how the icon is to be used.
- *
- * @see TS 11.14, clause 12.31, Icon Identifier.
- *
- * true: icon replaces the text string.
- * false: icon shall be displayed together with the text string.
- */
- readonly attribute boolean iconSelfExplanatory;
-
- /**
- * Icon(s) that replaces or accompanies the text string.
- *
- * @see TS 11.14, clause 12.31, Icon Identifier.
- *
- * Array of icons, basically of a same image, that may differ in size,
- * resolution or coding scheme. The first icon should be the default one.
- *
- * @param aCount
- * The number of icons.
- *
- * @returns a copy of the list of icons.
- */
- void getIcons([optional] out unsigned long aCount,
- [array, size_is(aCount), retval] out nsIStkIcon aIcons);
-};
-
-[scriptable, uuid(ea95d25c-5e84-11e4-bd96-07285c50c1f2)]
-interface nsIStkItem : nsISupports
-{
- /**
- * Identifier of item.
- *
- * The identifier is a single byte between '01' and 'FF'. Each item shall
- * have a unique identifier within an Item list.
- */
- readonly attribute unsigned short identifier;
-
- /**
- * Text string of item.
- */
- readonly attribute DOMString text;
-
- /**
- * (Optional)
- * Icon info of item.
- */
- readonly attribute nsIStkIconInfo iconInfo;
-};
-
-[scriptable, uuid(1ec0d430-eeec-11e4-8566-df81b6d562c8)]
-interface nsIStkTimer : nsISupports
-{
- /**
- * Identifier of a timer.
- */
- readonly attribute unsigned short timerId;
-
- const unsigned long TIMER_VALUE_INVALID = 0xFFFFFFFF;
-
- /**
- * Length of time during which the timer has to run.
- *
- * The possible duration of a timer is between 1 s and 24 h.
- * The resolution of a timer is 1 second.
- *
- * Note: In TS 11.14, clause 6.6.21 TIMER MANAGEMENT,
- * "
- * The SIM shall supply this data object only when a timer has to
- * be started.
- * "
- * Hence, set to TIMER_VALUE_INVALID when |timerAction| is not equal to
- * TIMER_ACTION_START.
- */
- readonly attribute unsigned long timerValue;
-
- /*
- * Times actions defined in TS 11.14, clause 12.6,
- * Command Qualifier, TIMER MANAGEMENT
- */
- const unsigned short TIMER_ACTION_START = 0x00;
- const unsigned short TIMER_ACTION_DEACTIVATE = 0x01;
- const unsigned short TIMER_ACTION_GET_CURRENT_VALUE = 0x02;
- const unsigned short TIMER_ACTION_INVALID = 0xFF;
-
- /**
- * The action requested from UICC.
- * It shall be one of TIMER_ACTION_*.
- */
- readonly attribute unsigned short timerAction;
-};
-
-[scriptable, uuid(09903cfe-f3bf-11e4-a029-23d988cd1a82)]
-interface nsIStkLocationInfo : nsISupports
-{
- /**
- * Mobile Country Code (MCC) of the current serving operator.
- */
- readonly attribute DOMString mcc;
-
- /**
- * Mobile Network Code (MNC) of the current serving operator.
- */
- readonly attribute DOMString mnc;
-
- /**
- * Mobile Location Area Code (LAC) for the current serving operator.
- */
- readonly attribute unsigned short gsmLocationAreaCode;
-
- /**
- * Mobile Cell ID for the current serving operator.
- */
- readonly attribute unsigned long gsmCellId;
-};
-
-/**
- * The base class of all STK Proactive Commands.
- *
- * This interface is to be applied by the commands that provide info no more than:
- * |commandNumber|, |typeOfCommand|, |commandQualifier|.
- *
- * The commands in this category are:
- * - STK_CMD_REFRESH
- * - STK_CMD_POLL_OFF
- */
-[scriptable, uuid(f47f25b2-5d84-11e4-8637-7f59ea6da82f)]
-interface nsIStkProactiveCmd : nsISupports
-{
- /**
- * The number of command issued by ICC. And it is assigned
- * by ICC may take any hexadecimal value betweean '01' and 'FE'.
- *
- * @see TS 11.14, clause 6.5.1
- */
- readonly attribute unsigned short commandNumber;
-
- /**
- * The value of |Type of Command| defined in TS 11.14, clause 13.4
- */
- readonly attribute unsigned short typeOfCommand;
-
- /**
- * Qualifiers specific to the command.
- */
- readonly attribute unsigned short commandQualifier;
-};
-
-/**
- * This interface is to be applied by STK_CMD_POLL_INTERVAL.
- */
-[scriptable, uuid(0a27c090-5dbc-11e4-92eb-ebc26db3db29)]
-interface nsIStkPollIntervalCmd : nsIStkProactiveCmd
-{
- /**
- * The maximum interval between two STATUS commands related to
- * Proactive Polling.
- *
- * Note: Mandatory for STK_CMD_POLL_INTERVAL.
- *
- * @See TS 11.14, clause 6.6.6 POLL INTERVAL
- */
- readonly attribute nsIStkDuration duration;
-};
-
-/**
- * This interface is to be applied by STK_CMD_PROVIDE_LOCAL_INFO.
- */
-[scriptable, uuid(89a304ce-5dc6-11e4-8dce-23723fb242b4)]
-interface nsIStkProvideLocalInfoCmd : nsIStkProactiveCmd
-{
- /**
- * Values defined in TS 11.14, clause 12.6, Command Qualifier,
- * PROVIDE LOCAL INFORMATION
- */
- readonly attribute unsigned short localInfoType;
-};
-
-/**
- * This interface is to be applied by STK_CMD_SET_UP_EVENT_LIST.
- */
-[scriptable, uuid(5f796dec-5e6a-11e4-aaf3-bb675cb36df5)]
-interface nsIStkSetupEventListCmd : nsIStkProactiveCmd
-{
- /**
- * (Optional)
- * Get the list of events.
- * Each event could be one of values defined in TS 11.14, clause 8.25, Event list.
- *
- * Note: It could be null as an indication to the terminal to remove the
- * existing list of events in the terminal.
- *
- * @param aCount
- * The number of events.
- *
- * @returns a copy of the list of events.
- */
- void getEventList([optional] out unsigned long aCount,
- [array, size_is(aCount), retval] out unsigned short aEventList);
-};
-
-/**
- * This interface is to be applied by STK_CMD_SET_UP_MENU.
- */
-[scriptable, uuid(d7a66664-a602-11e4-9cc7-c7ce5fdade7d)]
-interface nsIStkSetUpMenuCmd : nsIStkProactiveCmd
-{
- /**
- * (Optional for STK_CMD_SELECT_ITEM)
- * Title of the menu.
- */
- readonly attribute DOMString title;
-
- /**
- * Get the list of menu items.
- *
- * Note: The minimal number of items is 1.
- * See TS 11.14, clause 6.6.7 SET-UP MENU and 6.6.8 SELECT ITEM.
- *
- * @param aCount
- * The number of items.
- *
- * @returns a copy of the list of menu items.
- * For |SET-UP MENU|, the 1st item in |aItems| could be null as an
- * indication to the ME to remove the existing menu from the menu
- * system in the ME.
- */
- void getItems([optional] out unsigned long aCount,
- [array, size_is(aCount), retval] out nsIStkItem aItems);
-
- /**
- * (Optional)
- * Get the list of Next Action Indicators.
- *
- * Each element should be the value of |Next Action Indicator| in TS 11.14,
- * clause 13.4.
- *
- * @see TS 11.14, clause 12.24, Items Next Action Indicator.
- *
- * @param aCount
- * The number of indicators.
- *
- * @returns a copy of the list of Next Action Indicators.
- */
- void getNextActionList([optional] out unsigned long aCount,
- [array, size_is(aCount), retval] out unsigned short aActions);
-
- /**
- * (Optional)
- * Icon info of the menu.
- */
- readonly attribute nsIStkIconInfo iconInfo;
-
- /**
- * Help information available or not.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, SET UP MENU, bit 8.
- *
- * true: help information available.
- * false: no help information available.
- *
- */
- readonly attribute boolean isHelpAvailable;
-};
-
-/**
- * This interface is to be applied by STK_CMD_SELECT_ITEM.
- */
-[scriptable, uuid(eb71f0fa-a602-11e4-926f-a3814461d218)]
-interface nsIStkSelectItemCmd : nsIStkSetUpMenuCmd
-{
- /**
- * Presentation type, one of PRESENTATION_TYPE_*.
- *
- * @See TS 11.14, clause 12.6, Command Qualifier: Select Item
- */
- const unsigned short PRESENTATION_TYPE_NOT_SPECIFIED = 0x00;
- const unsigned short PRESENTATION_TYPE_DATA_VALUES = 0x01;
- const unsigned short PRESENTATION_TYPE_NAVIGATION_OPTIONS = 0x03;
-
- readonly attribute unsigned short presentationType;
-
- const unsigned short DEFAULT_ITEM_INVALID = 0xFFFF;
-
- /**
- * (Optional)
- * Default item identifier of the menu.
- *
- * Set to DEFAULT_ITEM_INVALID if null.
- */
- readonly attribute unsigned short defaultItem;
-};
-
-/**
- * This interface is to be applied by
- * - STK_CMD_SET_UP_IDLE_MODE_TEXT
- * - STK_CMD_SEND_{SS|USSD|SMS|DTMF}
- * - STK_CMD_OPEN_CHANNEL
- * - STK_CMD_CLOSE_CHANNEL
- * - STK_CMD_SEND_DATA
- * - STK_CMD_RECEIVE_DATA
- */
-[scriptable, uuid(61c42b3c-6324-11e4-959e-7fb2dc9a3f0d)]
-interface nsIStkTextMessageCmd : nsIStkProactiveCmd
-{
- /**
- * Text String.
- */
- readonly attribute DOMString text;
-
- /**
- * (Optional)
- * Icon to be displayed.
- */
- readonly attribute nsIStkIconInfo iconInfo;
-};
-
-/**
- * This interface is to be applied by STK_CMD_DISPLAY_TEXT.
- */
-[scriptable, uuid(66a83f0a-6322-11e4-a773-9382de87a74a)]
-interface nsIStkDisplayTextCmd : nsIStkTextMessageCmd
-{
- /**
- * (Optional)
- * The length of time for which the ME shall display the dialog.
- */
- readonly attribute nsIStkDuration duration;
-
- /**
- * Indicate this text message is high priority or normal priority.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, Display Text, bit 1.
- *
- * true: high priority
- * false: normal priority
- */
- readonly attribute boolean isHighPriority;
-
- /**
- * Need to wait for user to clear message or not.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, Display Text, bit 8.
- *
- * true: Wait for user to clear message.
- * false: clear message after a delay.
- */
- readonly attribute boolean userClear;
-
- /**
- * Need to response immediately or not.
- *
- * @see TS 11.14, clause 12.43, Immediate response.
- *
- * true: The terminal shall send response immediately.
- * false: otherwise.
- */
- readonly attribute boolean responseNeeded;
-};
-
-/**
- * The base interface of nsIStkInputKeyCmd, nsIStkInputTextCmd.
- */
-[scriptable, uuid(ed16a67e-6022-11e4-a8fd-c34fe6e6bb11)]
-interface nsIStkInputCmd : nsIStkProactiveCmd
-{
- /**
- * Text for the ME to display in conjunction with asking the user to respond.
- */
- readonly attribute DOMString text;
-
- /**
- * (Optional)
- * The length of time for which the ME shall display the dialog.
- */
- readonly attribute nsIStkDuration duration;
-
- /**
- * Minimum length of response.
- * Set to 1 for STK_CMD_GET_INKEY.
- */
- readonly attribute unsigned short minLength;
-
- /**
- * Maximum length of response.
- * Set to 1 for STK_CMD_GET_INKEY.
- */
- readonly attribute unsigned short maxLength;
-
- /**
- * (Optional)
- * Text for the ME to display, corresponds to a default text string offered
- * by the ICC.
- */
- readonly attribute DOMString defaultText;
-
- /**
- * Input format.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT/GET INKEY, bit 1.
- *
- * true: Alphabet set.
- * false: Digits only.
- */
- readonly attribute boolean isAlphabet;
-
- /**
- * Alphabet encoding.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT/GET INKEY, bit 2.
- *
- * true: UCS2 alphabet.
- * false: default SMS alphabet.
- */
- readonly attribute boolean isUCS2;
-
- /**
- * Help information available or not.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT/GET INKEY, bit 8.
- *
- * true: help information available.
- * false: no help information available.
- */
- readonly attribute boolean isHelpAvailable;
-
- /**
- * (Optional)
- * Icon to be displayed.
- */
- readonly attribute nsIStkIconInfo iconInfo;
-};
-
-/**
- * This interface is to be applied by STK_CMD_GET_INKEY.
- */
-[scriptable, uuid(27a4078a-6025-11e4-a9ab-bf39252bfaf1)]
-interface nsIStkInputKeyCmd : nsIStkInputCmd
-{
- /**
- * Yes/No response is requested.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, GET INKEY, bit 3.
- *
- * true: Yes/No response is requested, and character sets
- * (Alphabet set and UCS2) are disabled.
- * false: Character sets (Alphabet set and UCS2) are enabled.
- */
- readonly attribute boolean isYesNoRequested;
-};
-
-/**
- * This interface is to be applied by STK_CMD_GET_INPUT.
- */
-[scriptable, uuid(f3c33ae8-60d4-11e4-9da8-4ff4cb8566c3)]
-interface nsIStkInputTextCmd : nsIStkInputCmd
-{
- /**
- * Visibility of input.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 3.
- *
- * true: User input shall not be revealed in any way.
- * false: ME may echo user input on the display.
- */
- readonly attribute boolean hideInput;
-
- /**
- * User input in packed or unpacked format.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 4.
- *
- * true: User input to be in SMS packed format.
- * false: User input to be in unpacked format.
- */
- readonly attribute boolean isPacked;
-};
-
-/**
- * This interface is to be applied by STK_CMD_SET_UP_CALL.
- */
-[scriptable, uuid(6abbf688-6956-11e4-a9d3-4b07f063ef21)]
-interface nsIStkSetUpCallCmd : nsIStkProactiveCmd
-{
- /**
- * The Dialling number.
- */
- readonly attribute DOMString address;
-
- /**
- * (Optional)
- * The text message used in user confirmation phase.
- */
- readonly attribute DOMString confirmText;
-
- /**
- * (Optional)
- * Icon to be displayed in user confirmation phase.
- */
- readonly attribute nsIStkIconInfo confirmIconInfo;
-
- /**
- * (Optional)
- * The text message used in call set up phase.
- */
- readonly attribute DOMString callText;
-
- /**
- * (Optional)
- * Icon to be displayed in call set up phase.
- */
- readonly attribute nsIStkIconInfo callIconInfo;
-
- /**
- * (Optional)
- * The maximum duration for the redial mechanism.
- * The time elapsed since the first call set-up attempt has exceeded the duration
- * requested by the UICC, the redial mechanism is terminated.
- */
- readonly attribute nsIStkDuration duration;
-};
-
-/**
- * This interface is to be applied by STK_CMD_LAUNCH_BROWSER.
- */
-[scriptable, uuid(b9bca548-695b-11e4-8c1f-cfb850f421ab)]
-interface nsIStkBrowserSettingCmd : nsIStkProactiveCmd
-{
- /**
- * The URL to be opened by browser.
- */
- readonly attribute DOMString url;
-
- /**
- * Browser launch mode.
- * @See TS 11.14, clause 12.6, Command Qualifier, LAUNCH BROWSER.
- */
- readonly attribute unsigned short mode;
-
- /**
- * (Optional)
- * Confirm message to launch browser.
- */
- readonly attribute DOMString confirmText;
-
- /**
- * (Optional)
- * Icon to be displayed in user confirmation phase.
- */
- readonly attribute nsIStkIconInfo confirmIconInfo;
-};
-
-/**
- * This interface is to be applied by STK_CMD_PLAY_TONE.
- */
-[scriptable, uuid(f49dd148-60ee-11e4-af46-6b938538de51)]
-interface nsIStkPlayToneCmd : nsIStkProactiveCmd
-{
- const unsigned short TONE_TYPE_INVALID = 0xFFFF;
-
- /**
- * (Optional)
- * Text String.
- */
- readonly attribute DOMString text;
-
- /**
- * (Optional)
- * One of the tone value coded in TS 11.14, clause 12.16, Tone.
- *
- * Set to TONE_TYPE_INVALID if null.
- */
- readonly attribute unsigned short tone;
-
- /**
- * (Optional)
- * The length of time for which the ME shall generate the tone.
- */
- readonly attribute nsIStkDuration duration;
-
- /**
- * Need to vibrate or not.
- * true: vibrate alert, if available, with the tone.
- * false: use of vibrate alert is up to the ME.
- */
- readonly attribute boolean isVibrate;
-
- /**
- * (Optional)
- * Icon to be displayed.
- */
- readonly attribute nsIStkIconInfo iconInfo;
-};
-
-/**
- * This interface is to be applied by STK_CMD_TIMER_MANAGEMENT.
- */
-[scriptable, uuid(e421b122-60f3-11e4-b8d7-bfe75825a796)]
-interface nsIStkTimerManagementCmd : nsIStkProactiveCmd
-{
- /**
- * Timer Information.
- */
- readonly attribute nsIStkTimer timerInfo;
-};
-
-/**
- * The base class of all STK Terminal Respones.
- *
- * This interface is to be applied by the responses that provide info no more
- * than |resultCode| and |additionalInformation|.
- *
- * @see |6.8 Structure of Terminal Response| and |12.12 Result| in TS 11.14 for
- * for the common structure of the response.
- */
-[scriptable, uuid(8e9f94de-0059-11e5-8608-67b08648d3d9)]
-interface nsIStkTerminalResponse : nsISupports
-{
- /**
- * STK result code.
- *
- * @see TS 11.14, clause 12.12
- *
- * Results '0X' and '1X' indicate that the command has been performed.
- */
- /** Command performed successfully */
- const unsigned short RESULT_OK = 0x00;
-
- /** Command performed with partial comprehension */
- const unsigned short RESULT_PRFRMD_WITH_PARTIAL_COMPREHENSION = 0x01;
-
- /** Command performed, with missing information */
- const unsigned short RESULT_PRFRMD_WITH_MISSING_INFO = 0x02;
-
- /** REFRESH performed with additional EFs read */
- const unsigned short RESULT_PRFRMD_WITH_ADDITIONAL_EFS_READ = 0x03;
-
- /** Command performed successfully, but icon could not be displayed */
- const unsigned short RESULT_PRFRMD_ICON_NOT_DISPLAYED = 0x04;
-
- /** Command performed successfully, limited service */
- const unsigned short RESULT_PRFRMD_LIMITED_SERVICE = 0x06;
-
- /** Proactive UICC session terminated by the user */
- const unsigned short RESULT_UICC_SESSION_TERM_BY_USER = 0x10;
-
- /** Backward move in the proactive UICC session requested by the user */
- const unsigned short RESULT_BACKWARD_MOVE_BY_USER = 0x11;
-
- /** No response from user */
- const unsigned short RESULT_NO_RESPONSE_FROM_USER = 0x12;
-
- /** Help information required by the user */
- const unsigned short RESULT_HELP_INFO_REQUIRED = 0x13;
-
- /** USSD or SS transaction terminated by the user */
- const unsigned short RESULT_USSD_SS_SESSION_TERM_BY_USER = 0x14;
-
- /**
- * Results '2X' indicate to the UICC that it may be worth re-trying the
- * command at a later opportunity.
- */
- /** Terminal currently unable to process command */
- const unsigned short RESULT_TERMINAL_CRNTLY_UNABLE_TO_PROCESS = 0x20;
-
- /** Network currently unable to process command */
- const unsigned short RESULT_NETWORK_CRNTLY_UNABLE_TO_PROCESS = 0x21;
-
- /** User did not accept the proactive command */
- const unsigned short RESULT_USER_NOT_ACCEPT = 0x22;
-
- /** User cleared down call before connection or network release */
- const unsigned short RESULT_USER_CLEAR_DOWN_CALL = 0x23;
-
- /** Action in contradiction with the current timer state */
- const unsigned short RESULT_ACTION_CONTRADICTION_TIMER_STATE = 0x24;
-
- /** Launch browser generic error code */
- const unsigned short RESULT_LAUNCH_BROWSER_ERROR = 0x26;
-
- /**
- * Results '3X' indicate that it is not worth the UICC re-trying with an
- * identical command, as it will only get the same response. However, the
- * decision to retry lies with the application.
- */
- /** Command beyond terminal's capabilities */
- const unsigned short RESULT_BEYOND_TERMINAL_CAPABILITY = 0x30;
-
- /** Command type not understood by terminal */
- const unsigned short RESULT_CMD_TYPE_NOT_UNDERSTOOD = 0x31;
-
- /** Command data not understood by terminal */
- const unsigned short RESULT_CMD_DATA_NOT_UNDERSTOOD = 0x32;
-
- /** Command number not known by terminal */
- const unsigned short RESULT_CMD_NUM_NOT_KNOWN = 0x33;
-
- /** SS return error */
- const unsigned short RESULT_SS_RETURN_ERROR = 0x34;
-
- /** SMS RP-ERROR */
- const unsigned short RESULT_SMS_RP_ERROR = 0x35;
-
- /** Error, required values are missing */
- const unsigned short RESULT_REQUIRED_VALUES_MISSING = 0x36;
-
- /** USSD return error */
- const unsigned short RESULT_USSD_RETURN_ERROR = 0x37;
-
- /** MultipleCard commands error */
- const unsigned short RESULT_MULTI_CARDS_CMD_ERROR = 0x38;
-
- /**
- * Interaction with call control by USIM or MO short message control by
- * USIM, permanent problem.
- */
- const unsigned short RESULT_USIM_CALL_CONTROL_PERMANENT = 0x39;
-
- /** Bearer independent protocol error */
- const unsigned short RESULT_BIP_ERROR = 0x3a;
-
- /**
- * 12.12.2 Additional information for ME problem:
- */
- const unsigned short ADDITIONAL_INFO_ME_PROBLEM_SCREEN_IS_BUSY = 0x01;
-
- const unsigned short ADDITIONAL_INFO_INVALID = 0xFFFF;
-
- /**
- * The general result of the response.
- * One of RESULT_*.
- */
- readonly attribute unsigned short resultCode;
-
- /**
- * (Optional)
- * The additional info of the response.
- *
- * One of ADDITIONAL_INFO_*.
- * Set to ADDITIONAL_INFO_INVALID if not available.
- */
- readonly attribute unsigned short additionalInformation;
-};
-
-/**
- * This interface is to be applied by the response of STK_CMD_SELECT_ITEM.
- */
-[scriptable, uuid(8eaa2496-ed7e-11e4-9aff-bfcf22a78770)]
-interface nsIStkSelectItemResponse : nsIStkTerminalResponse
-{
- /**
- * The selected menu item.
- */
- readonly attribute unsigned short itemIdentifier;
-};
-
-/**
- * This interface is to be applied by the response of STK_CMD_GET_INKEY and
- * STK_CMD_GET_INPUT.
- *
- * Note: Either |isYesNo| or |input| shall be valid.
- */
-[scriptable, uuid(f39d9cd8-ee33-11e4-a55b-ef2489a0707d)]
-interface nsIStkGetInputResponse : nsIStkTerminalResponse
-{
- const unsigned short YES_NO_INVALID = 0xFFFF;
- const unsigned short YES = 1;
- const unsigned short NO = 0;
-
- /**
- * (Optional)
- * The response if Yes/No response is requested.
- * Set to YES_NO_INVALID if not available.
- */
- readonly attribute unsigned short isYesNo;
-
- /**
- * (Optional)
- * The response of user input.
- */
- readonly attribute DOMString input;
-};
-
-/**
- * This interface is to be applied for the response of STK_CMD_CALL_SET_UP.
- */
-[scriptable, uuid(dbf61506-ed7f-11e4-93ea-233485a1bac9)]
-interface nsIStkCallSetupResponse : nsIStkTerminalResponse
-{
- /**
- * True if user confirm to set up call.
- */
- readonly attribute boolean hasConfirmed;
-};
-
-/**
- * This interface is to be applied by the response of STK_CMD_PROVIDE_LOCAL_INFO.
- */
-[scriptable, uuid(24fd4ece-ee37-11e4-8ac4-af876b1ce771)]
-interface nsIStkLocalInfoResponse : nsIStkTerminalResponse
-{
- const unsigned short DATE_INVALID = 0;
-
- /**
- * (Optional)
- * IMEI information
- */
- readonly attribute DOMString imei;
-
- /**
- * (Optional)
- * Location Information
- */
- readonly attribute nsIStkLocationInfo locationInfo;
-
- /**
- * (Optional)
- * Date information
- */
- readonly attribute DOMTimeStamp date;
-
- /**
- * (Optional)
- * Language Information
- *
- * @see ISO 639-1, Alpha-2 code
- */
- readonly attribute DOMString language;
-};
-
-/**
- * This interface is to be applied by the response of STK_CMD_TIMER_MANAGEMENT.
- */
-[scriptable, uuid(19f37a02-ed84-11e4-8316-0fde52ecfba6)]
-interface nsIStkTimerResponse : nsIStkTerminalResponse
-{
- /**
- * Timer Info.
- *
- * Note: Only timer.timerId and timer.timerValue will be used in response.
- */
- readonly attribute nsIStkTimer timer;
-};
-
-/**
- * The base class of events used by Event Download.
- *
- * This interface is to be applied by the event that provide info no more
- * than |eventType|. e.g. STK_EVENT_TYPE_USER_ACTIVITY,
- * STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE.
- *
- * @see TS 102 223, clause 8.25 Event List, caluse 7.5 Event download
- * for all structures of the event download.
- */
-[scriptable, uuid(0215d918-ee4a-11e4-9dcf-ab2c197c9211)]
-interface nsIStkDownloadEvent : nsISupports
-{
- /**
- * The event type of this download event.
- *
- * @see TS 102 223, clause 8.25 Event List.
- */
- readonly attribute unsigned short eventType;
-};
-
-/**
- * This interface is to be applied by STK_EVENT_TYPE_LOCATION_STATUS.
- */
-[scriptable, uuid(807b14f0-0059-11e5-aff7-1f8b4e659dbc)]
-interface nsIStkLocationEvent : nsIStkDownloadEvent
-{
- const unsigned short SERVICE_STATE_NORMAL = 0x00;
- const unsigned short SERVICE_STATE_LIMITED = 0x01;
- const unsigned short SERVICE_STATE_UNAVAILABLE = 0x02;
-
- /**
- * Indicate current service state of the MS with one of the values listed
- * One of SERVICE_STATE_*.
- */
- readonly attribute unsigned short locationStatus;
-
- /**
- * (Optional)
- * Location Information
- *
- * Note: This object shall be included only if locationStatus is equal to
- * SERVICE_STATE_NORMAL.
- *
- * @See TS 102 223, clause 7.5.4 Location status event.
- */
- readonly attribute nsIStkLocationInfo locationInfo;
-};
-
-/**
- * This interface is to be applied by STK_EVENT_TYPE_MT_CALL,
- * STK_EVENT_TYPE_CALL_CONNECTED and STK_EVENT_TYPE_CALL_DISCONNECTED.
- */
-[scriptable, uuid(e47dfc98-ee51-11e4-a672-43216a0b375a)]
-interface nsIStkCallEvent : nsIStkDownloadEvent
-{
- /**
- * Remote party number.
- */
- readonly attribute DOMString number;
-
- /**
- * For the STK_EVENT_TYPE_CALL_CONNECTED event, setting this to true means
- * the connection is answered by remote end, that is, this is an outgoing call.
- * For the STK_EVENT_TYPE_CALL_DISCONNECTED event, setting this to true
- * indicates the connection is hung up by remote.
- * For the STK_EVENT_TYPE_MT_CALL event, this flag is ignored.
- */
- readonly attribute boolean isIssuedByRemote;
-
- /**
- * Indicate the cause of disconnection.
- * The cause string is the one passed to gaia through the error listener of
- * CallEvent.
- * Set to null if there's no error.
- */
- readonly attribute DOMString error;
-};
-
-/**
- * This interface is to be applied by STK_EVENT_TYPE_LANGUAGE_SELECTION.
- */
-[scriptable, uuid(d185f0dc-ee51-11e4-912a-933874ee6cec)]
-interface nsIStkLanguageSelectionEvent : nsIStkDownloadEvent
-{
- /**
- * Language Information
- *
- * @see ISO 639-1, Alpha-2 code
- * "de" for German, "en" for English, "zh" for Chinese, etc.
- */
- readonly attribute DOMString language;
-};
-
-/**
- * This interface is to be applied by STK_EVENT_TYPE_LANGUAGE_SELECTION.
- */
-[scriptable, uuid(7ae84bde-0059-11e5-8238-8ba12036dc26)]
-interface nsIStkBrowserTerminationEvent : nsIStkDownloadEvent
-{
- const unsigned short BROWSER_TERMINATION_CAUSE_USER = 0x00;
- const unsigned short BROWSER_TERMINATION_CAUSE_ERROR = 0x01;
- /**
- * The browser termination cause.
- * One of BROWSER_TERMINATION_CAUSE_*
- */
- readonly attribute unsigned short terminationCause;
-};
deleted file mode 100644
--- a/dom/icc/ipc/IccChild.cpp
+++ /dev/null
@@ -1,481 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "IccInfo.h"
-#include "mozilla/dom/icc/IccChild.h"
-#include "mozilla/dom/icc/IccIPCUtils.h"
-#include "nsIStkCmdFactory.h"
-#include "nsIStkProactiveCmd.h"
-
-using mozilla::dom::IccInfo;
-
-namespace mozilla {
-namespace dom {
-namespace icc {
-
-/**
- * PIccChild Implementation.
- */
-
-IccChild::IccChild()
- : mCardState(nsIIcc::CARD_STATE_UNKNOWN)
- , mIsAlive(true)
-{
- MOZ_COUNT_CTOR(IccChild);
-}
-
-IccChild::~IccChild()
-{
- MOZ_COUNT_DTOR(IccChild);
-}
-
-void
-IccChild::Init()
-{
- OptionalIccInfoData infoData;
-
- bool rv = SendInit(&infoData, &mCardState);
- NS_ENSURE_TRUE_VOID(rv);
-
- UpdateIccInfo(infoData);
-}
-
-void
-IccChild::Shutdown(){
- if (mIsAlive) {
- mIsAlive = false;
- Send__delete__(this);
- }
-
- mListeners.Clear();
- mIccInfo = nullptr;
- mCardState = nsIIcc::CARD_STATE_UNKNOWN;
-}
-
-void
-IccChild::ActorDestroy(ActorDestroyReason why)
-{
- mIsAlive = false;
-}
-
-bool
-IccChild::RecvNotifyCardStateChanged(const uint32_t& aCardState)
-{
- mCardState = aCardState;
-
- for (int32_t i = 0; i < mListeners.Count(); i++) {
- mListeners[i]->NotifyCardStateChanged();
- }
-
- return true;
-}
-
-bool
-IccChild::RecvNotifyIccInfoChanged(const OptionalIccInfoData& aInfoData)
-{
- UpdateIccInfo(aInfoData);
-
- for (int32_t i = 0; i < mListeners.Count(); i++) {
- mListeners[i]->NotifyIccInfoChanged();
- }
-
- return true;
-}
-
-bool
-IccChild::RecvNotifyStkCommand(const nsString& aStkProactiveCmd)
-{
- nsCOMPtr<nsIStkCmdFactory> cmdFactory =
- do_GetService(ICC_STK_CMD_FACTORY_CONTRACTID);
- NS_ENSURE_TRUE(cmdFactory, false);
-
- nsCOMPtr<nsIStkProactiveCmd> cmd;
- cmdFactory->InflateCommand(aStkProactiveCmd, getter_AddRefs(cmd));
-
- NS_ENSURE_TRUE(cmd, false);
-
- for (int32_t i = 0; i < mListeners.Count(); i++) {
- mListeners[i]->NotifyStkCommand(cmd);
- }
-
- return true;
-}
-
-bool
-IccChild::RecvNotifyStkSessionEnd()
-{
- for (int32_t i = 0; i < mListeners.Count(); i++) {
- mListeners[i]->NotifyStkSessionEnd();
- }
-
- return true;
-}
-
-PIccRequestChild*
-IccChild::AllocPIccRequestChild(const IccRequest& aRequest)
-{
- MOZ_CRASH("Caller is supposed to manually construct a request!");
-}
-
-bool
-IccChild::DeallocPIccRequestChild(PIccRequestChild* aActor)
-{
- delete aActor;
- return true;
-}
-
-bool
-IccChild::SendRequest(const IccRequest& aRequest, nsIIccCallback* aRequestReply)
-{
- NS_ENSURE_TRUE(mIsAlive, false);
-
- // Deallocated in IccChild::DeallocPIccRequestChild().
- IccRequestChild* actor = new IccRequestChild(aRequestReply);
- SendPIccRequestConstructor(actor, aRequest);
-
- return true;
-}
-
-void
-IccChild::UpdateIccInfo(const OptionalIccInfoData& aInfoData) {
- if (aInfoData.type() == OptionalIccInfoData::Tvoid_t) {
- mIccInfo = nullptr;
- return;
- }
-
- NS_ENSURE_TRUE_VOID(aInfoData.type() == OptionalIccInfoData::TIccInfoData);
-
- RefPtr<IccInfo> iccInfo;
- const IccInfoData& infoData = aInfoData.get_IccInfoData();
- if (infoData.iccType().EqualsLiteral("sim")
- || infoData.iccType().EqualsLiteral("usim")) {
- iccInfo = new GsmIccInfo(infoData);
- } else if (infoData.iccType().EqualsLiteral("ruim")
- || infoData.iccType().EqualsLiteral("csim")){
- iccInfo = new CdmaIccInfo(infoData);
- } else {
- iccInfo = new IccInfo(infoData);
- }
-
- // We update the orignal one instead of replacing with a new one
- // if the IccType is the same.
- if (mIccInfo) {
- nsAutoString oldIccType;
- nsAutoString newIccType;
- mIccInfo->GetIccType(oldIccType);
- iccInfo->GetIccType(newIccType);
-
- if (oldIccType.Equals(newIccType)) {
- mIccInfo->Update(iccInfo);
- return;
- }
- }
-
- mIccInfo = iccInfo;
-}
-
-/**
- * nsIIcc Implementation.
- */
-
-NS_IMPL_ISUPPORTS(IccChild, nsIIcc)
-
-NS_IMETHODIMP
-IccChild::RegisterListener(nsIIccListener *aListener)
-{
- NS_ENSURE_TRUE(!mListeners.Contains(aListener), NS_ERROR_UNEXPECTED);
-
- mListeners.AppendObject(aListener);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-IccChild::UnregisterListener(nsIIccListener *aListener)
-{
- NS_ENSURE_TRUE(mListeners.Contains(aListener), NS_ERROR_UNEXPECTED);
-
- mListeners.RemoveObject(aListener);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-IccChild::GetIccInfo(nsIIccInfo** aIccInfo)
-{
- nsCOMPtr<nsIIccInfo> info(mIccInfo);
- info.forget(aIccInfo);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-IccChild::GetCardState(uint32_t* aCardState)
-{
- *aCardState = mCardState;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-IccChild::GetImsi(nsAString & aImsi)
-{
- NS_WARNING("IMSI shall not directly be fetched in child process.");
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IccChild::GetCardLockEnabled(uint32_t aLockType,
- nsIIccCallback* aRequestReply)
-{
- return SendRequest(GetCardLockEnabledRequest(aLockType), aRequestReply)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccChild::UnlockCardLock(uint32_t aLockType,
- const nsAString& aPassword,
- const nsAString& aNewPin,
- nsIIccCallback* aRequestReply)
-{
- return SendRequest(UnlockCardLockRequest(aLockType,
- nsAutoString(aPassword),
- nsAutoString(aNewPin)),
- aRequestReply)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccChild::SetCardLockEnabled(uint32_t aLockType,
- const nsAString& aPassword,
- bool aEnabled,
- nsIIccCallback* aRequestReply)
-{
- return SendRequest(SetCardLockEnabledRequest(aLockType,
- nsAutoString(aPassword),
- aEnabled),
- aRequestReply)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccChild::ChangeCardLockPassword(uint32_t aLockType,
- const nsAString& aPassword,
- const nsAString& aNewPassword,
- nsIIccCallback* aRequestReply)
-{
- return SendRequest(ChangeCardLockPasswordRequest(aLockType,
- nsAutoString(aPassword),
- nsAutoString(aNewPassword)),
- aRequestReply)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccChild::GetCardLockRetryCount(uint32_t aLockType,
- nsIIccCallback* aRequestReply)
-{
- return SendRequest(GetCardLockRetryCountRequest(aLockType), aRequestReply)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccChild::MatchMvno(uint32_t aMvnoType,
- const nsAString& aMvnoData,
- nsIIccCallback* aRequestReply)
-{
- return SendRequest(MatchMvnoRequest(aMvnoType, nsAutoString(aMvnoData)),
- aRequestReply)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccChild::GetServiceStateEnabled(uint32_t aService,
- nsIIccCallback* aRequestReply)
-{
- return SendRequest(GetServiceStateEnabledRequest(aService),
- aRequestReply)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccChild::IccOpenChannel(const nsAString& aAid, nsIIccChannelCallback* aCallback)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IccChild::IccExchangeAPDU(int32_t aChannel, uint8_t aCla, uint8_t aIns, uint8_t aP1,
- uint8_t aP2, int16_t aP3, const nsAString & aData,
- nsIIccChannelCallback* aCallback)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IccChild::IccCloseChannel(int32_t aChannel, nsIIccChannelCallback* aCallback)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-IccChild::SendStkResponse(nsIStkProactiveCmd* aCommand, nsIStkTerminalResponse* aResponse)
-{
- nsCOMPtr<nsIStkCmdFactory> cmdFactory =
- do_GetService(ICC_STK_CMD_FACTORY_CONTRACTID);
- NS_ENSURE_TRUE(cmdFactory, NS_ERROR_FAILURE);
-
- nsAutoString cmd, response;
-
- nsresult rv = cmdFactory->DeflateCommand(aCommand, cmd);
- NS_ENSURE_SUCCESS(rv, rv);
-
- rv = cmdFactory->DeflateResponse(aResponse, response);
- NS_ENSURE_SUCCESS(rv, rv);
-
- return PIccChild::SendStkResponse(cmd, response) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccChild::SendStkMenuSelection(uint16_t aItemIdentifier, bool aHelpRequested)
-{
- return PIccChild::SendStkMenuSelection(aItemIdentifier, aHelpRequested)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccChild::SendStkTimerExpiration(uint16_t aTimerId, uint32_t aTimerValue)
-{
- return PIccChild::SendStkTimerExpiration(aTimerId, aTimerValue)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccChild::SendStkEventDownload(nsIStkDownloadEvent* aEvent)
-{
- MOZ_ASSERT(aEvent);
-
- nsCOMPtr<nsIStkCmdFactory> cmdFactory =
- do_GetService(ICC_STK_CMD_FACTORY_CONTRACTID);
- NS_ENSURE_TRUE(cmdFactory, NS_ERROR_FAILURE);
-
- nsAutoString event;
-
- nsresult rv = cmdFactory->DeflateDownloadEvent(aEvent, event);
- NS_ENSURE_SUCCESS(rv, rv);
-
- return PIccChild::SendStkEventDownload(event) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccChild::ReadContacts(uint32_t aContactType, nsIIccCallback* aRequestReply)
-{
- return SendRequest(ReadContactsRequest(aContactType),
- aRequestReply)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccChild::UpdateContact(uint32_t aContactType, nsIIccContact* aContact,
- const nsAString& aPin2,
- nsIIccCallback* aRequestReply)
-{
- MOZ_ASSERT(aContact);
-
- IccContactData contactData;
- IccIPCUtils::GetIccContactDataFromIccContact(aContact, contactData);
-
- return SendRequest(UpdateContactRequest(aContactType,
- nsAutoString(aPin2),
- contactData),
- aRequestReply)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-/**
- * PIccRequestChild Implementation.
- */
-
-IccRequestChild::IccRequestChild(nsIIccCallback* aRequestReply)
- : mRequestReply(aRequestReply)
-{
- MOZ_COUNT_CTOR(IccRequestChild);
- MOZ_ASSERT(aRequestReply);
-}
-
-bool
-IccRequestChild::Recv__delete__(const IccReply& aResponse)
-{
- MOZ_ASSERT(mRequestReply);
-
- switch(aResponse.type()) {
- case IccReply::TIccReplySuccess:
- return NS_SUCCEEDED(mRequestReply->NotifySuccess());
- case IccReply::TIccReplySuccessWithBoolean: {
- const IccReplySuccessWithBoolean& resultWithBoolean
- = aResponse.get_IccReplySuccessWithBoolean();
- return NS_SUCCEEDED(
- mRequestReply->NotifySuccessWithBoolean(resultWithBoolean.result()));
- }
- case IccReply::TIccReplyCardLockRetryCount: {
- const IccReplyCardLockRetryCount& retryCount
- = aResponse.get_IccReplyCardLockRetryCount();
- return NS_SUCCEEDED(
- mRequestReply->NotifyGetCardLockRetryCount(retryCount.count()));
- }
- case IccReply::TIccReplyError: {
- const IccReplyError& error = aResponse.get_IccReplyError();
- return NS_SUCCEEDED(mRequestReply->NotifyError(error.message()));
- }
- case IccReply::TIccReplyCardLockError: {
- const IccReplyCardLockError& error
- = aResponse.get_IccReplyCardLockError();
- return NS_SUCCEEDED(
- mRequestReply->NotifyCardLockError(error.message(),
- error.retryCount()));
- }
- case IccReply::TIccReplyReadContacts: {
- const nsTArray<IccContactData>& data
- = aResponse.get_IccReplyReadContacts().contacts();
-
- uint32_t count = data.Length();
- nsCOMArray<nsIIccContact> contactList;
- nsresult rv;
- for (uint32_t i = 0; i < count; i++) {
- nsCOMPtr<nsIIccContact> contact;
- rv = IccContact::Create(data[i].id(),
- data[i].names(),
- data[i].numbers(),
- data[i].emails(),
- getter_AddRefs(contact));
- NS_ENSURE_SUCCESS(rv, false);
- contactList.AppendElement(contact);
- }
-
- rv = mRequestReply->NotifyRetrievedIccContacts(contactList.Elements(),
- count);
-
- return NS_SUCCEEDED(rv);
- }
- case IccReply::TIccReplyUpdateContact: {
- IccContactData data
- = aResponse.get_IccReplyUpdateContact().contact();
- nsCOMPtr<nsIIccContact> contact;
- IccContact::Create(data.id(),
- data.names(),
- data.numbers(),
- data.emails(),
- getter_AddRefs(contact));
-
- return NS_SUCCEEDED(
- mRequestReply->NotifyUpdatedIccContact(contact));
- }
- default:
- MOZ_CRASH("Received invalid response type!");
- }
-
- return true;
-}
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/ipc/IccChild.h
+++ /dev/null
@@ -1,94 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_icc_IccChild_h
-#define mozilla_dom_icc_IccChild_h
-
-#include "mozilla/dom/icc/PIccChild.h"
-#include "mozilla/dom/icc/PIccRequestChild.h"
-#include "nsIIccService.h"
-
-namespace mozilla {
-namespace dom {
-
-class IccInfo;
-
-namespace icc {
-
-class IccChild final : public PIccChild
- , public nsIIcc
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIICC
-
- explicit IccChild();
-
-void
- Init();
-
- void
- Shutdown();
-
-protected:
- virtual void
- ActorDestroy(ActorDestroyReason why) override;
-
- virtual PIccRequestChild*
- AllocPIccRequestChild(const IccRequest& aRequest) override;
-
- virtual bool
- DeallocPIccRequestChild(PIccRequestChild* aActor) override;
-
- virtual bool
- RecvNotifyCardStateChanged(const uint32_t& aCardState) override;
-
- virtual bool
- RecvNotifyIccInfoChanged(const OptionalIccInfoData& aInfoData) override;
-
- virtual bool
- RecvNotifyStkCommand(const nsString& aStkProactiveCmd) override;
-
- virtual bool
- RecvNotifyStkSessionEnd() override;
-
-private:
- ~IccChild();
-
- void
- UpdateIccInfo(const OptionalIccInfoData& aInfoData);
-
- bool
- SendRequest(const IccRequest& aRequest, nsIIccCallback* aRequestReply);
-
- nsCOMArray<nsIIccListener> mListeners;
- RefPtr<IccInfo> mIccInfo;
- uint32_t mCardState;
- bool mIsAlive;
-};
-
-class IccRequestChild final : public PIccRequestChild
-{
-public:
- explicit IccRequestChild(nsIIccCallback* aRequestReply);
-
-protected:
- virtual bool
- Recv__delete__(const IccReply& aReply) override;
-
-private:
- virtual ~IccRequestChild() {
- MOZ_COUNT_DTOR(IccRequestChild);
- }
-
- nsCOMPtr<nsIIccCallback> mRequestReply;
-};
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_icc_IccChild_h
deleted file mode 100644
--- a/dom/icc/ipc/IccIPCService.cpp
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "IccIPCService.h"
-
-#include "mozilla/dom/ContentChild.h"
-#include "mozilla/Preferences.h"
-
-namespace mozilla {
-namespace dom {
-namespace icc {
-
-NS_IMPL_ISUPPORTS(IccIPCService, nsIIccService)
-
-IccIPCService::IccIPCService()
-{
- int32_t numRil = Preferences::GetInt("ril.numRadioInterfaces", 1);
- mIccs.SetLength(numRil);
-}
-
-IccIPCService::~IccIPCService()
-{
- uint32_t count = mIccs.Length();
- for (uint32_t i = 0; i < count; i++) {
- if (mIccs[i]) {
- mIccs[i]->Shutdown();
- }
- }
-}
-
-NS_IMETHODIMP
-IccIPCService::GetIccByServiceId(uint32_t aServiceId, nsIIcc** aIcc)
-{
- NS_ENSURE_TRUE(aServiceId < mIccs.Length(), NS_ERROR_INVALID_ARG);
-
- if (!mIccs[aServiceId]) {
- RefPtr<IccChild> child = new IccChild();
-
- // |SendPIccConstructor| adds another reference to the child
- // actor and removes in |DeallocPIccChild|.
- ContentChild::GetSingleton()->SendPIccConstructor(child, aServiceId);
- child->Init();
-
- mIccs[aServiceId] = child;
- }
-
- nsCOMPtr<nsIIcc> icc(mIccs[aServiceId]);
- icc.forget(aIcc);
-
- return NS_OK;
-}
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/icc/ipc/IccIPCService.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_icc_IccIPCService_h
-#define mozilla_dom_icc_IccIPCService_h
-
-#include "nsCOMPtr.h"
-#include "nsIIccService.h"
-
-namespace mozilla {
-namespace dom {
-namespace icc {
-
-class IccChild;
-
-class IccIPCService final : public nsIIccService
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIICCSERVICE
-
- IccIPCService();
-
-private:
- ~IccIPCService();
-
- nsTArray<RefPtr<IccChild>> mIccs;
-};
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_icc_IccIPCService_h
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/ipc/IccIPCUtils.cpp
+++ /dev/null
@@ -1,92 +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 "mozilla/dom/icc/IccIPCUtils.h"
-#include "mozilla/dom/icc/PIccTypes.h"
-#include "nsIIccContact.h"
-#include "nsIIccInfo.h"
-
-namespace mozilla {
-namespace dom {
-namespace icc {
-
-/*static*/ void
-IccIPCUtils::GetIccInfoDataFromIccInfo(nsIIccInfo* aInInfo,
- IccInfoData& aOutData)
-{
- aInInfo->GetIccType(aOutData.iccType());
- aInInfo->GetIccid(aOutData.iccid());
- aInInfo->GetMcc(aOutData.mcc());
- aInInfo->GetMnc(aOutData.mnc());
- aInInfo->GetSpn(aOutData.spn());
- aInInfo->GetIsDisplayNetworkNameRequired(
- &aOutData.isDisplayNetworkNameRequired());
- aInInfo->GetIsDisplaySpnRequired(
- &aOutData.isDisplaySpnRequired());
-
- nsCOMPtr<nsIGsmIccInfo> gsmIccInfo(do_QueryInterface(aInInfo));
- if (gsmIccInfo) {
- gsmIccInfo->GetMsisdn(aOutData.phoneNumber());
- }
-
- nsCOMPtr<nsICdmaIccInfo> cdmaIccInfo(do_QueryInterface(aInInfo));
- if (cdmaIccInfo) {
- cdmaIccInfo->GetMdn(aOutData.phoneNumber());
- cdmaIccInfo->GetPrlVersion(&aOutData.prlVersion());
- }
-}
-
-/*static*/ void
-IccIPCUtils::GetIccContactDataFromIccContact(nsIIccContact* aContact,
- IccContactData& aOutData){
- // Id
- nsresult rv = aContact->GetId(aOutData.id());
- NS_ENSURE_SUCCESS_VOID(rv);
-
- // Names
- char16_t** rawStringArray = nullptr;
- uint32_t count = 0;
- rv = aContact->GetNames(&count, &rawStringArray);
- NS_ENSURE_SUCCESS_VOID(rv);
- if (count > 0) {
- for (uint32_t i = 0; i < count; i++) {
- aOutData.names().AppendElement(
- rawStringArray[i] ? nsDependentString(rawStringArray[i])
- : NullString());
- }
- NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, rawStringArray);
- }
-
- // Numbers
- rawStringArray = nullptr;
- count = 0;
- rv = aContact->GetNumbers(&count, &rawStringArray);
- NS_ENSURE_SUCCESS_VOID(rv);
- if (count > 0) {
- for (uint32_t i = 0; i < count; i++) {
- aOutData.numbers().AppendElement(
- rawStringArray[i] ? nsDependentString(rawStringArray[i])
- : NullString());
- }
- NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, rawStringArray);
- }
-
- // Emails
- rawStringArray = nullptr;
- count = 0;
- rv = aContact->GetEmails(&count, &rawStringArray);
- NS_ENSURE_SUCCESS_VOID(rv);
- if (count > 0) {
- for (uint32_t i = 0; i < count; i++) {
- aOutData.emails().AppendElement(
- rawStringArray[i] ? nsDependentString(rawStringArray[i])
- : NullString());
- }
- NS_FREE_XPCOM_ALLOCATED_POINTER_ARRAY(count, rawStringArray);
- }
-}
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/ipc/IccIPCUtils.h
+++ /dev/null
@@ -1,35 +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/. */
-
-#ifndef mozilla_dom_icc_IccIPCUtils_h
-#define mozilla_dom_icc_IccIPCUtils_h
-
-class nsIIccContact;
-class nsIIccInfo;
-
-namespace mozilla {
-namespace dom {
-namespace icc {
-
-class IccInfoData;
-class IccContactData;
-
-class IccIPCUtils
-{
-public:
- static void GetIccInfoDataFromIccInfo(nsIIccInfo* aInInfo,
- IccInfoData& aOutData);
- static void GetIccContactDataFromIccContact(nsIIccContact* aContact,
- IccContactData& aOutData);
-
-private:
- IccIPCUtils() {}
- virtual ~IccIPCUtils() {}
-};
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_icc_IccIPCUtils_h
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/ipc/IccParent.cpp
+++ /dev/null
@@ -1,424 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/icc/IccIPCUtils.h"
-#include "mozilla/dom/icc/IccParent.h"
-#include "nsIIccService.h"
-#include "nsIStkCmdFactory.h"
-#include "nsIStkProactiveCmd.h"
-
-namespace mozilla {
-namespace dom {
-namespace icc {
-
-/**
- * PIccParent Implementation.
- */
-
-IccParent::IccParent(uint32_t aServiceId)
-{
- MOZ_COUNT_CTOR(IccParent);
-
- nsCOMPtr<nsIIccService> service =
- do_GetService(ICC_SERVICE_CONTRACTID);
-
- NS_ASSERTION(service, "Failed to get IccService!");
-
- service->GetIccByServiceId(aServiceId, getter_AddRefs(mIcc));
-
- NS_ASSERTION(mIcc, "Failed to get Icc with specified serviceId.");
-
- mIcc->RegisterListener(this);
-}
-
-void
-IccParent::ActorDestroy(ActorDestroyReason aWhy)
-{
- if (mIcc) {
- mIcc->UnregisterListener(this);
- mIcc = nullptr;
- }
-}
-
-bool
-IccParent::RecvInit(OptionalIccInfoData* aInfoData,
- uint32_t* aCardState)
-{
- NS_ENSURE_TRUE(mIcc, false);
-
- nsresult rv = mIcc->GetCardState(aCardState);
- NS_ENSURE_SUCCESS(rv, false);
-
- nsCOMPtr<nsIIccInfo> iccInfo;
- rv = mIcc->GetIccInfo(getter_AddRefs(iccInfo));
- NS_ENSURE_SUCCESS(rv, false);
-
- if (iccInfo) {
- IccInfoData data;
- IccIPCUtils::GetIccInfoDataFromIccInfo(iccInfo, data);
- *aInfoData = OptionalIccInfoData(data);
-
- return true;
- }
-
- *aInfoData = OptionalIccInfoData(void_t());
-
- return true;
-}
-
-bool
-IccParent::RecvStkResponse(const nsString& aCmd, const nsString& aResponse)
-{
- NS_ENSURE_TRUE(mIcc, false);
-
- nsCOMPtr<nsIStkCmdFactory> cmdFactory =
- do_GetService(ICC_STK_CMD_FACTORY_CONTRACTID);
- NS_ENSURE_TRUE(cmdFactory, false);
-
- nsCOMPtr<nsIStkProactiveCmd> cmd;
- cmdFactory->InflateCommand(aCmd, getter_AddRefs(cmd));
- NS_ENSURE_TRUE(cmd, false);
-
- nsCOMPtr<nsIStkTerminalResponse> response;
- cmdFactory->InflateResponse(aResponse, getter_AddRefs(response));
- NS_ENSURE_TRUE(response, false);
-
- nsresult rv = mIcc->SendStkResponse(cmd, response);
- NS_ENSURE_SUCCESS(rv, false);
-
- return true;
-}
-
-bool
-IccParent::RecvStkMenuSelection(const uint16_t& aItemIdentifier,
- const bool& aHelpRequested)
-{
- NS_ENSURE_TRUE(mIcc, false);
-
- nsresult rv = mIcc->SendStkMenuSelection(aItemIdentifier, aHelpRequested);
- NS_ENSURE_SUCCESS(rv, false);
-
- return true;
-}
-
-bool
-IccParent::RecvStkTimerExpiration(const uint16_t& aTimerId,
- const uint32_t& aTimerValue)
-{
- NS_ENSURE_TRUE(mIcc, false);
-
- nsresult rv = mIcc->SendStkTimerExpiration(aTimerId, aTimerValue);
- NS_ENSURE_SUCCESS(rv, false);
-
- return true;
-}
-
-bool
-IccParent::RecvStkEventDownload(const nsString& aEvent)
-{
- NS_ENSURE_TRUE(mIcc, false);
-
- nsCOMPtr<nsIStkCmdFactory> cmdFactory =
- do_GetService(ICC_STK_CMD_FACTORY_CONTRACTID);
- NS_ENSURE_TRUE(cmdFactory, false);
-
- nsCOMPtr<nsIStkDownloadEvent> event;
- cmdFactory->InflateDownloadEvent(aEvent, getter_AddRefs(event));
- NS_ENSURE_TRUE(event, false);
-
- nsresult rv = mIcc->SendStkEventDownload(event);
- NS_ENSURE_SUCCESS(rv, false);
-
- return true;
-}
-
-PIccRequestParent*
-IccParent::AllocPIccRequestParent(const IccRequest& aRequest)
-{
- NS_ASSERTION(mIcc, "AllocPIccRequestParent after actor was destroyed!");
-
- IccRequestParent* actor = new IccRequestParent(mIcc);
- // Add an extra ref for IPDL. Will be released in
- // IccParent::DeallocPIccRequestParent().
- actor->AddRef();
- return actor;
-}
-
-bool
-IccParent::DeallocPIccRequestParent(PIccRequestParent* aActor)
-{
- // IccRequestParent is refcounted, must not be freed manually.
- static_cast<IccRequestParent*>(aActor)->Release();
- return true;
-}
-
-bool
-IccParent::RecvPIccRequestConstructor(PIccRequestParent* aActor,
- const IccRequest& aRequest)
-{
- NS_ASSERTION(mIcc, "RecvPIccRequestConstructor after actor was destroyed!");
-
- IccRequestParent* actor = static_cast<IccRequestParent*>(aActor);
-
- switch (aRequest.type()) {
- case IccRequest::TGetCardLockEnabledRequest:
- return actor->DoRequest(aRequest.get_GetCardLockEnabledRequest());
- case IccRequest::TUnlockCardLockRequest:
- return actor->DoRequest(aRequest.get_UnlockCardLockRequest());
- case IccRequest::TSetCardLockEnabledRequest:
- return actor->DoRequest(aRequest.get_SetCardLockEnabledRequest());
- case IccRequest::TChangeCardLockPasswordRequest:
- return actor->DoRequest(aRequest.get_ChangeCardLockPasswordRequest());
- case IccRequest::TGetCardLockRetryCountRequest:
- return actor->DoRequest(aRequest.get_GetCardLockRetryCountRequest());
- case IccRequest::TMatchMvnoRequest:
- return actor->DoRequest(aRequest.get_MatchMvnoRequest());
- case IccRequest::TGetServiceStateEnabledRequest:
- return actor->DoRequest(aRequest.get_GetServiceStateEnabledRequest());
- case IccRequest::TReadContactsRequest:
- return actor->DoRequest(aRequest.get_ReadContactsRequest());
- case IccRequest::TUpdateContactRequest:
- return actor->DoRequest(aRequest.get_UpdateContactRequest());
- default:
- MOZ_CRASH("Received invalid request type!");
- }
-
- return true;
-}
-
-/**
- * nsIIccListener Implementation.
- */
-
-NS_IMPL_ISUPPORTS(IccParent, nsIIccListener)
-
-NS_IMETHODIMP
-IccParent::NotifyStkCommand(nsIStkProactiveCmd *aStkProactiveCmd)
-{
- nsCOMPtr<nsIStkCmdFactory> cmdFactory =
- do_GetService(ICC_STK_CMD_FACTORY_CONTRACTID);
- NS_ENSURE_TRUE(cmdFactory, NS_ERROR_UNEXPECTED);
-
- nsAutoString cmd;
- nsresult rv = cmdFactory->DeflateCommand(aStkProactiveCmd, cmd);
- NS_ENSURE_SUCCESS(rv, rv);
-
- return SendNotifyStkCommand(cmd) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccParent::NotifyStkSessionEnd()
-{
- return SendNotifyStkSessionEnd() ? NS_OK : NS_ERROR_FAILURE;;
-}
-
-NS_IMETHODIMP
-IccParent::NotifyCardStateChanged()
-{
- NS_ENSURE_TRUE(mIcc, NS_ERROR_FAILURE);
-
- uint32_t cardState;
- nsresult rv = mIcc->GetCardState(&cardState);
- NS_ENSURE_SUCCESS(rv, rv);
-
- return SendNotifyCardStateChanged(cardState) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-IccParent::NotifyIccInfoChanged()
-{
- NS_ENSURE_TRUE(mIcc, NS_ERROR_FAILURE);
-
- nsCOMPtr<nsIIccInfo> iccInfo;
- nsresult rv = mIcc->GetIccInfo(getter_AddRefs(iccInfo));
- NS_ENSURE_SUCCESS(rv, rv);
-
- if (!iccInfo) {
- return SendNotifyIccInfoChanged(OptionalIccInfoData(void_t()))
- ? NS_OK : NS_ERROR_FAILURE;
- }
-
- IccInfoData data;
- IccIPCUtils::GetIccInfoDataFromIccInfo(iccInfo, data);
-
- return SendNotifyIccInfoChanged(OptionalIccInfoData(data))
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-/**
- * PIccRequestParent Implementation.
- */
-
-IccRequestParent::IccRequestParent(nsIIcc* aIcc)
- : mIcc(aIcc)
-{
- MOZ_COUNT_CTOR(IccRequestParent);
-}
-
-void
-IccRequestParent::ActorDestroy(ActorDestroyReason aWhy)
-{
- mIcc = nullptr;
-}
-
-bool
-IccRequestParent::DoRequest(const GetCardLockEnabledRequest& aRequest)
-{
- return NS_SUCCEEDED(mIcc->GetCardLockEnabled(aRequest.lockType(),
- this));
-}
-
-bool
-IccRequestParent::DoRequest(const UnlockCardLockRequest& aRequest)
-{
- return NS_SUCCEEDED(mIcc->UnlockCardLock(aRequest.lockType(),
- aRequest.password(),
- aRequest.newPin(),
- this));
-}
-
-bool
-IccRequestParent::DoRequest(const SetCardLockEnabledRequest& aRequest)
-{
- return NS_SUCCEEDED(mIcc->SetCardLockEnabled(aRequest.lockType(),
- aRequest.password(),
- aRequest.enabled(),
- this));
-}
-
-bool
-IccRequestParent::DoRequest(const ChangeCardLockPasswordRequest& aRequest)
-{
- return NS_SUCCEEDED(mIcc->ChangeCardLockPassword(aRequest.lockType(),
- aRequest.password(),
- aRequest.newPassword(),
- this));
-}
-
-bool
-IccRequestParent::DoRequest(const GetCardLockRetryCountRequest& aRequest)
-{
- return NS_SUCCEEDED(mIcc->GetCardLockRetryCount(aRequest.lockType(),
- this));
-}
-
-bool
-IccRequestParent::DoRequest(const MatchMvnoRequest& aRequest)
-{
- return NS_SUCCEEDED(mIcc->MatchMvno(aRequest.mvnoType(),
- aRequest.mvnoData(),
- this));
-}
-
-bool
-IccRequestParent::DoRequest(const GetServiceStateEnabledRequest& aRequest)
-{
- return NS_SUCCEEDED(mIcc->GetServiceStateEnabled(aRequest.service(),
- this));
-}
-
-bool
-IccRequestParent::DoRequest(const ReadContactsRequest& aRequest)
-{
- return NS_SUCCEEDED(mIcc->ReadContacts(aRequest.contactType(),
- this));
-}
-
-bool
-IccRequestParent::DoRequest(const UpdateContactRequest& aRequest)
-{
- nsCOMPtr<nsIIccContact> contact;
- nsresult rv = IccContact::Create(aRequest.contact().id(),
- aRequest.contact().names(),
- aRequest.contact().numbers(),
- aRequest.contact().emails(),
- getter_AddRefs(contact));
- NS_ENSURE_SUCCESS(rv, false);
-
- return NS_SUCCEEDED(mIcc->UpdateContact(aRequest.contactType(),
- contact,
- aRequest.pin2(),
- this));
-}
-
-nsresult
-IccRequestParent::SendReply(const IccReply& aReply)
-{
- NS_ENSURE_TRUE(mIcc, NS_ERROR_FAILURE);
-
- return Send__delete__(this, aReply) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-/**
- * nsIIccCallback Implementation.
- */
-
-NS_IMPL_ISUPPORTS(IccRequestParent, nsIIccCallback)
-
-NS_IMETHODIMP
-IccRequestParent::NotifySuccess()
-{
- return SendReply(IccReplySuccess());
-}
-
-NS_IMETHODIMP
-IccRequestParent::NotifySuccessWithBoolean(bool aResult)
-{
- return SendReply(IccReplySuccessWithBoolean(aResult));
-}
-
-NS_IMETHODIMP
-IccRequestParent::NotifyGetCardLockRetryCount(int32_t aCount)
-{
- return SendReply(IccReplyCardLockRetryCount(aCount));
-}
-
-NS_IMETHODIMP
-IccRequestParent::NotifyError(const nsAString & aErrorMsg)
-{
- return SendReply(IccReplyError(nsAutoString(aErrorMsg)));
-}
-
-NS_IMETHODIMP
-IccRequestParent::NotifyCardLockError(const nsAString & aErrorMsg,
- int32_t aRetryCount)
-{
- return SendReply(IccReplyCardLockError(aRetryCount, nsAutoString(aErrorMsg)));
-}
-
-NS_IMETHODIMP
-IccRequestParent::NotifyRetrievedIccContacts(nsIIccContact** aContacts,
- unsigned int aCount)
-{
- nsTArray<IccContactData> contacts;
-
- for (uint32_t i = 0; i < aCount; i++) {
- MOZ_ASSERT(aContacts[i]);
-
- IccContactData contactData;
-
- IccIPCUtils::GetIccContactDataFromIccContact(aContacts[i], contactData);
- contacts.AppendElement(contactData);
- }
-
- return SendReply(IccReplyReadContacts(contacts));
-}
-
-NS_IMETHODIMP
-IccRequestParent::NotifyUpdatedIccContact(nsIIccContact* aContact)
-{
- MOZ_ASSERT(aContact);
-
- IccContactData contactData;
-
- IccIPCUtils::GetIccContactDataFromIccContact(aContact, contactData);
-
- return SendReply(IccReplyUpdateContact(contactData));
-}
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/icc/ipc/IccParent.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_icc_IccParent_h
-#define mozilla_dom_icc_IccParent_h
-
-#include "mozilla/dom/icc/PIccParent.h"
-#include "mozilla/dom/icc/PIccRequestParent.h"
-#include "nsIIccService.h"
-
-namespace mozilla {
-namespace dom {
-namespace icc {
-
-class IccParent final : public PIccParent
- , public nsIIccListener
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIICCLISTENER
-
- explicit IccParent(uint32_t aServiceId);
-
-protected:
- virtual
- ~IccParent()
- {
- MOZ_COUNT_DTOR(IccParent);
- }
-
- virtual void
- ActorDestroy(ActorDestroyReason aWhy) override;
-
- virtual bool
- RecvInit(
- OptionalIccInfoData* aInfoData,
- uint32_t* aCardState) override;
-
- virtual bool
- RecvStkResponse(const nsString& aCmd, const nsString& aResponse) override;
-
- virtual bool
- RecvStkMenuSelection(const uint16_t& aItemIdentifier,
- const bool& aHelpRequested) override;
-
- virtual bool
- RecvStkTimerExpiration(const uint16_t& aTimerId,
- const uint32_t& aTimerValue) override;
-
- virtual bool
- RecvStkEventDownload(const nsString& aEvent) override;
-
- virtual PIccRequestParent*
- AllocPIccRequestParent(const IccRequest& aRequest) override;
-
- virtual bool
- DeallocPIccRequestParent(PIccRequestParent* aActor) override;
-
- virtual bool
- RecvPIccRequestConstructor(PIccRequestParent* aActor,
- const IccRequest& aRequest) override;
-
-private:
- IccParent();
- nsCOMPtr<nsIIcc> mIcc;
-};
-
-class IccRequestParent final : public PIccRequestParent
- , public nsIIccCallback
-{
- friend class IccParent;
-
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIICCCALLBACK
-
- explicit IccRequestParent(nsIIcc* icc);
-
-protected:
- virtual void
- ActorDestroy(ActorDestroyReason why) override;
-
-private:
- ~IccRequestParent()
- {
- MOZ_COUNT_DTOR(IccRequestParent);
- }
-
- bool
- DoRequest(const GetCardLockEnabledRequest& aRequest);
-
- bool
- DoRequest(const UnlockCardLockRequest& aRequest);
-
- bool
- DoRequest(const SetCardLockEnabledRequest& aRequest);
-
- bool
- DoRequest(const ChangeCardLockPasswordRequest& aRequest);
-
- bool
- DoRequest(const GetCardLockRetryCountRequest& aRequest);
-
- bool
- DoRequest(const MatchMvnoRequest& aRequest);
-
- bool
- DoRequest(const GetServiceStateEnabledRequest& aRequest);
-
- bool
- DoRequest(const ReadContactsRequest& aRequest);
-
- bool
- DoRequest(const UpdateContactRequest& aRequest);
-
- nsresult
- SendReply(const IccReply& aReply);
-
- nsCOMPtr<nsIIcc> mIcc;
-};
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_icc_IccParent_h
deleted file mode 100644
--- a/dom/icc/ipc/PIcc.ipdl
+++ /dev/null
@@ -1,166 +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 protocol PContent;
-include protocol PIccRequest;
-include PIccTypes;
-
-using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
-
-namespace mozilla {
-namespace dom {
-namespace icc {
-
-union OptionalIccInfoData
-{
- void_t;
- IccInfoData;
-};
-
-struct GetCardLockEnabledRequest
-{
- uint32_t lockType;
-};
-
-struct UnlockCardLockRequest
-{
- uint32_t lockType;
- nsString password;
- nsString newPin;
-};
-
-struct SetCardLockEnabledRequest
-{
- uint32_t lockType;
- nsString password;
- bool enabled;
-};
-
-struct ChangeCardLockPasswordRequest
-{
- uint32_t lockType;
- nsString password;
- nsString newPassword;
-};
-
-struct GetCardLockRetryCountRequest
-{
- uint32_t lockType;
-};
-
-struct MatchMvnoRequest
-{
- uint32_t mvnoType;
- nsString mvnoData;
-};
-
-struct GetServiceStateEnabledRequest
-{
- uint32_t service;
-};
-
-struct ReadContactsRequest
-{
- uint32_t contactType;
-};
-
-struct UpdateContactRequest
-{
- uint32_t contactType;
- nsString pin2;
- IccContactData contact;
-};
-
-union IccRequest
-{
- GetCardLockEnabledRequest;
- UnlockCardLockRequest;
- SetCardLockEnabledRequest;
- ChangeCardLockPasswordRequest;
- GetCardLockRetryCountRequest;
- MatchMvnoRequest;
- GetServiceStateEnabledRequest;
- ReadContactsRequest;
- UpdateContactRequest;
-};
-
-sync protocol PIcc
-{
- manager PContent;
- manages PIccRequest;
-
-child:
- /**
- * Notify CardStateChanged with updated CardState.
- */
- async NotifyCardStateChanged(uint32_t aCardState);
-
- /**
- * Notify IccInfoChanged with updated IccInfo.
- */
- async NotifyIccInfoChanged(OptionalIccInfoData aInfoData);
-
- /**
- * Notify STK proactive command issue by selected UICC.
- *
- * @param aStkProactiveCmd
- * a MozStkCommand instance serialized in JSON.
- */
- async NotifyStkCommand(nsString aStkProactiveCmd);
-
- /**
- * Notify that STK session is ended by selected UICC.
- */
- async NotifyStkSessionEnd();
-
-parent:
- /**
- * Sent when the child no longer needs to use PIcc.
- */
- async __delete__();
-
- /**
- * Sent when the child makes an asynchronous request to the parent.
- */
- async PIccRequest(IccRequest aRequest);
-
- /**
- * Send STK response to the selected UICC.
- *
- * @param aCommand
- * a MozStkCommand instance serialized in JSON.
- * @param aResponse
- * a MozStkResponse instance serialized in JSON.
- */
- async StkResponse(nsString aCommand, nsString aResponse);
-
- /**
- * Send STK Menu Selection to the selected UICC.
- */
- async StkMenuSelection(uint16_t aItemIdentifier, bool aHelpRequested);
-
- /**
- * Send STK Timer Expiration to the selected UICC.
- */
- async StkTimerExpiration(uint16_t aTimerId, uint32_t aTimerValue);
-
- /**
- * Send STK Event Download to the selected UICC.
- *
- * @param aEvent
- * a MozStkXxxEvent instance serialized in JSON.
- */
- async StkEventDownload(nsString aEvent);
-
- /**
- * Sync call to initialize the updated IccInfo/CardState.
- */
- sync Init()
- returns (OptionalIccInfoData aInfoData, uint32_t aCardState);
-
-};
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/ipc/PIccRequest.ipdl
+++ /dev/null
@@ -1,73 +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 protocol PIcc;
-include PIccTypes;
-
-namespace mozilla {
-namespace dom {
-namespace icc {
-
-struct IccReplySuccess
-{
-};
-
-struct IccReplySuccessWithBoolean
-{
- bool result;
-};
-
-struct IccReplyCardLockRetryCount
-{
- int32_t count;
-};
-
-struct IccReplyError
-{
- nsString message;
-};
-
-struct IccReplyCardLockError
-{
- int32_t retryCount;
- nsString message;
-};
-
-struct IccReplyReadContacts
-{
- IccContactData[] contacts;
-};
-
-struct IccReplyUpdateContact
-{
- IccContactData contact;
-};
-
-union IccReply
-{
- // Success
- IccReplySuccess;
- IccReplySuccessWithBoolean;
- IccReplyCardLockRetryCount;
- IccReplyReadContacts;
- IccReplyUpdateContact;
- // Error
- IccReplyError;
- IccReplyCardLockError;
-};
-
-protocol PIccRequest
-{
- manager PIcc;
-
-child:
- /**
- * Sent when the asynchronous request has completed.
- */
- async __delete__(IccReply response);
-};
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/ipc/PIccTypes.ipdlh
+++ /dev/null
@@ -1,32 +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/. */
-
-namespace mozilla {
-namespace dom {
-namespace icc {
-
-struct IccInfoData
-{
- nsString iccType;
- nsString iccid;
- nsString mcc;
- nsString mnc;
- nsString spn;
- bool isDisplayNetworkNameRequired;
- bool isDisplaySpnRequired;
- nsString phoneNumber;
- int32_t prlVersion;
-};
-
-struct IccContactData
-{
- nsString id;
- nsString[] names;
- nsString[] numbers;
- nsString[] emails;
-};
-
-} // namespace icc
-} // namespace dom
-} // namespace mozilla
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/moz.build
+++ /dev/null
@@ -1,57 +0,0 @@
-# -*- Mode: python; 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/.
-
-DIRS += ['interfaces']
-
-EXPORTS.mozilla.dom += [
- 'Icc.h',
- 'IccCardLockError.h',
- 'IccInfo.h',
- 'IccManager.h',
-]
-
-EXPORTS.mozilla.dom.icc += [
- 'ipc/IccChild.h',
- 'ipc/IccIPCUtils.h',
- 'ipc/IccParent.h'
-]
-
-UNIFIED_SOURCES += [
- 'Assertions.cpp',
- 'Icc.cpp',
- 'IccCallback.cpp',
- 'IccCardLockError.cpp',
- 'IccContact.cpp',
- "IccInfo.cpp",
- 'IccListener.cpp',
- 'IccManager.cpp',
- 'ipc/IccChild.cpp',
- 'ipc/IccIPCService.cpp',
- 'ipc/IccIPCUtils.cpp',
- 'ipc/IccParent.cpp',
-]
-
-IPDL_SOURCES += [
- 'ipc/PIcc.ipdl',
- 'ipc/PIccRequest.ipdl',
- 'ipc/PIccTypes.ipdlh',
-]
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:
- EXTRA_COMPONENTS += [
- 'gonk/IccService.js',
- 'gonk/IccService.manifest',
- 'gonk/StkCmdFactory.js',
- 'gonk/StkCmdFactory.manifest'
- ]
-
-include('/ipc/chromium/chromium-config.mozbuild')
-
-FINAL_LIBRARY = 'xul'
-
-LOCAL_INCLUDES += [
- '/dom/system/gonk',
-]
deleted file mode 100644
--- a/dom/icc/tests/marionette/head.js
+++ /dev/null
@@ -1,539 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers;
-
-const PREF_KEY_RIL_DEBUGGING_ENABLED = "ril.debugging.enabled";
-
-// The pin code hard coded in emulator is "0000".
-const DEFAULT_PIN = "0000";
-// The puk code hard coded in emulator is "12345678".
-const DEFAULT_PUK = "12345678";
-
-const WHT = 0xFFFFFFFF;
-const BLK = 0x000000FF;
-const RED = 0xFF0000FF;
-const GRN = 0x00FF00FF;
-const BLU = 0x0000FFFF;
-const TSP = 0;
-
-// Basic Image, see record number 1 in EFimg.
-const BASIC_ICON = {
- width: 8,
- height: 8,
- codingScheme: "basic",
- pixels: [WHT, WHT, WHT, WHT, WHT, WHT, WHT, WHT,
- BLK, BLK, BLK, BLK, BLK, BLK, WHT, WHT,
- WHT, BLK, WHT, BLK, BLK, WHT, BLK, WHT,
- WHT, BLK, BLK, WHT, WHT, BLK, BLK, WHT,
- WHT, BLK, BLK, WHT, WHT, BLK, BLK, WHT,
- WHT, BLK, WHT, BLK, BLK, WHT, BLK, WHT,
- WHT, WHT, BLK, BLK, BLK, BLK, WHT, WHT,
- WHT, WHT, WHT, WHT, WHT, WHT, WHT, WHT]
-};
-// Color Image, see record number 3 in EFimg.
-const COLOR_ICON = {
- width: 8,
- height: 8,
- codingScheme: "color",
- pixels: [BLU, BLU, BLU, BLU, BLU, BLU, BLU, BLU,
- BLU, RED, RED, RED, RED, RED, RED, BLU,
- BLU, RED, GRN, GRN, GRN, RED, RED, BLU,
- BLU, RED, RED, GRN, GRN, RED, RED, BLU,
- BLU, RED, RED, GRN, GRN, RED, RED, BLU,
- BLU, RED, RED, GRN, GRN, GRN, RED, BLU,
- BLU, RED, RED, RED, RED, RED, RED, BLU,
- BLU, BLU, BLU, BLU, BLU, BLU, BLU, BLU]
-};
-// Color Image with Transparency, see record number 5 in EFimg.
-const COLOR_TRANSPARENCY_ICON = {
- width: 8,
- height: 8,
- codingScheme: "color-transparency",
- pixels: [TSP, TSP, TSP, TSP, TSP, TSP, TSP, TSP,
- TSP, RED, RED, RED, RED, RED, RED, TSP,
- TSP, RED, GRN, GRN, GRN, RED, RED, TSP,
- TSP, RED, RED, GRN, GRN, RED, RED, TSP,
- TSP, RED, RED, GRN, GRN, RED, RED, TSP,
- TSP, RED, RED, GRN, GRN, GRN, RED, TSP,
- TSP, RED, RED, RED, RED, RED, RED, TSP,
- TSP, TSP, TSP, TSP, TSP, TSP, TSP, TSP]
-};
-
-/**
- * Helper function for checking stk icon.
- */
-function isIcons(aIcons, aExpectedIcons) {
- is(aIcons.length, aExpectedIcons.length, "icons.length");
- for (let i = 0; i < aIcons.length; i++) {
- let icon = aIcons[i];
- let expectedIcon = aExpectedIcons[i];
-
- is(icon.width, expectedIcon.width, "icon.width");
- is(icon.height, expectedIcon.height, "icon.height");
- is(icon.codingScheme, expectedIcon.codingScheme, "icon.codingScheme");
-
- is(icon.pixels.length, expectedIcon.pixels.length);
- for (let j = 0; j < icon.pixels.length; j++) {
- is(icon.pixels[j], expectedIcon.pixels[j], "icon.pixels[" + j + "]");
- }
- }
-}
-
-/**
- * Helper function for checking stk text.
- */
-function isStkText(aStkText, aExpectedStkText) {
- is(aStkText.text, aExpectedStkText.text, "stkText.text");
- if (aExpectedStkText.icons) {
- is(aStkText.iconSelfExplanatory, aExpectedStkText.iconSelfExplanatory,
- "stkText.iconSelfExplanatory");
- isIcons(aStkText.icons, aExpectedStkText.icons);
- }
-}
-
-var _pendingEmulatorCmdCount = 0;
-
-/**
- * Send emulator command with safe guard.
- *
- * We should only call |finish()| after all emulator command transactions
- * end, so here comes with the pending counter. Resolve when the emulator
- * gives positive response, and reject otherwise.
- *
- * Fulfill params:
- * result -- an array of emulator response lines.
- * Reject params:
- * result -- an array of emulator response lines.
- *
- * @param aCommand
- * A string command to be passed to emulator through its telnet console.
- *
- * @return A deferred promise.
- */
-function runEmulatorCmdSafe(aCommand) {
- return new Promise(function(aResolve, aReject) {
- ++_pendingEmulatorCmdCount;
- runEmulatorCmd(aCommand, function(aResult) {
- --_pendingEmulatorCmdCount;
-
- ok(true, "Emulator response: " + JSON.stringify(aResult));
- if (Array.isArray(aResult) &&
- aResult[aResult.length - 1] === "OK") {
- aResolve(aResult);
- } else {
- aReject(aResult);
- }
- });
- });
-}
-
-/**
- * Send stk proactive pdu.
- *
- * Fulfill params:
- * result -- an array of emulator response lines.
- * Reject params:
- * result -- an array of emulator response lines.
- *
- * @param aPdu
- *
- * @return A deferred promise.
- */
-function sendEmulatorStkPdu(aPdu) {
- let cmd = "stk pdu " + aPdu;
- return runEmulatorCmdSafe(cmd);
-}
-
-/**
- * Peek the last STK terminal response sent to modem.
- *
- * Fulfill params:
- * result -- last terminal response in HEX String.
- * Reject params:
- * result -- an array of emulator response lines.
- *
- * @return A deferred promise.
- */
-function peekLastStkResponse() {
- return runEmulatorCmdSafe("stk lastresponse")
- .then(aResult => aResult[0]);
-}
-
-/**
- * Peek the last STK envelope sent to modem.
- *
- * Fulfill params:
- * result -- last envelope in HEX String.
- * Reject params:
- * result -- an array of emulator response lines.
- *
- * @return A deferred promise.
- */
-function peekLastStkEnvelope() {
- return runEmulatorCmdSafe("stk lastenvelope")
- .then(aResult => aResult[0]);
-}
-
-/**
- * Verify with the peeked STK response.
- *
- * Fulfill params:
- * result -- (none)
- * Reject params:
- * result -- an array of emulator response lines.
- *
- * @param aExpectResponse
- * The expected Response PDU in HEX String.
- *
- * @return A deferred promise.
- */
-function verifyWithPeekedStkResponse(aExpectResponse) {
- return new Promise(function(aResolve, aReject) {
- window.setTimeout(function() {
- peekLastStkResponse().then(aResult => {
- is(aResult, aExpectResponse, "Verify sent APDU");
- aResolve();
- });
- }, 3000);
- });
-}
-
-/**
- * Verify with the peeked STK response.
- *
- * Fulfill params:
- * result -- (none)
- * Reject params:
- * result -- an array of emulator response lines.
- *
- * @param aExpectEnvelope
- * The expected Envelope PDU in HEX String.
- *
- * @return A deferred promise.
- */
-function verifyWithPeekedStkEnvelope(aExpectEnvelope) {
- return new Promise(function(aResolve, aReject) {
- window.setTimeout(function() {
- peekLastStkEnvelope().then(aResult => {
- is(aResult, aExpectEnvelope, "Verify sent APDU");
- aResolve();
- });
- }, 3000);
- });
-}
-
-var workingFrame;
-var iccManager;
-
-/**
- * Push required permissions and test if
- * |navigator.mozIccManager| exists. Resolve if it does,
- * reject otherwise.
- *
- * Fulfill params:
- * iccManager -- an reference to navigator.mozIccManager.
- *
- * Reject params: (none)
- *
- * @param aAdditonalPermissions [optional]
- * An array of permission strings other than "mobileconnection" to be
- * pushed. Default: empty string.
- *
- * @return A deferred promise.
- */
-function ensureIccManager(aAdditionalPermissions) {
- return new Promise(function(aResolve, aReject) {
- aAdditionalPermissions = aAdditionalPermissions || [];
-
- if (aAdditionalPermissions.indexOf("mobileconnection") < 0) {
- aAdditionalPermissions.push("mobileconnection");
- }
- let permissions = [];
- for (let perm of aAdditionalPermissions) {
- permissions.push({ "type": perm, "allow": 1, "context": document });
- }
-
- SpecialPowers.pushPermissions(permissions, function() {
- ok(true, "permissions pushed: " + JSON.stringify(permissions));
-
- // Permission changes can't change existing Navigator.prototype
- // objects, so grab our objects from a new Navigator.
- workingFrame = document.createElement("iframe");
- workingFrame.addEventListener("load", function load() {
- workingFrame.removeEventListener("load", load);
-
- iccManager = workingFrame.contentWindow.navigator.mozIccManager;
-
- if (iccManager) {
- ok(true, "navigator.mozIccManager is instance of " + iccManager.constructor);
- } else {
- ok(true, "navigator.mozIccManager is undefined");
- }
-
- if (iccManager instanceof MozIccManager) {
- aResolve(iccManager);
- } else {
- aReject();
- }
- });
-
- document.body.appendChild(workingFrame);
- });
- });
-}
-
-/**
- * Get MozIcc by IccId
- *
- * @param aIccId [optional]
- * Default: The first item of |aIccManager.iccIds|.
- *
- * @return A MozIcc.
- */
-function getMozIcc(aIccId) {
- aIccId = aIccId || iccManager.iccIds[0];
-
- if (!aIccId) {
- ok(true, "iccManager.iccIds[0] is undefined");
- return null;
- }
-
- return iccManager.getIccById(aIccId);
-}
-
-/**
- * Get MozMobileConnection by ServiceId
- *
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: 0 if not indicated.
- *
- * @return A MozMobileConnection.
- */
-function getMozMobileConnectionByServiceId(aServiceId) {
- aServiceId = aServiceId || 0;
- return workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
-}
-
-/**
- * Set radio enabling state.
- *
- * Resolve no matter the request succeeds or fails. Never reject.
- *
- * Fulfill params: (none)
- *
- * @param aEnabled
- * A boolean state.
- * @param aServiceId [optional]
- * A numeric DSDS service id.
- *
- * @return A deferred promise.
- */
-function setRadioEnabled(aEnabled, aServiceId) {
- return getMozMobileConnectionByServiceId(aServiceId).setRadioEnabled(aEnabled)
- .then(() => {
- ok(true, "setRadioEnabled " + aEnabled + " on " + aServiceId + " success.");
- }, (aError) => {
- ok(false, "setRadioEnabled " + aEnabled + " on " + aServiceId + " " +
- aError.name);
- });
-}
-
-/**
- * Wait for one named event.
- *
- * Resolve if that named event occurs. Never reject.
- *
- * Fulfill params: the DOMEvent passed.
- *
- * @param aEventTarget
- * An EventTarget object.
- * @param aEventName
- * A string event name.
- * @param aMatchFun [optional]
- * A matching function returns true or false to filter the event.
- *
- * @return A deferred promise.
- */
-function waitForTargetEvent(aEventTarget, aEventName, aMatchFun) {
- return new Promise(function(aResolve, aReject) {
- aEventTarget.addEventListener(aEventName, function onevent(aEvent) {
- if (!aMatchFun || aMatchFun(aEvent)) {
- aEventTarget.removeEventListener(aEventName, onevent);
- ok(true, "Event '" + aEventName + "' got.");
- aResolve(aEvent);
- }
- });
- });
-}
-
-/**
- * Wait for one named system message.
- *
- * Resolve if that named message is received. Never reject.
- *
- * Fulfill params: the message passed.
- *
- * @param aEventName
- * A string message name.
- * @param aMatchFun [optional]
- * A matching function returns true or false to filter the message. If no
- * matching function passed the promise is resolved after receiving the
- * first message.
- *
- * @return A deferred promise.
- */
-function waitForSystemMessage(aMessageName, aMatchFun) {
- let target = workingFrame.contentWindow.navigator;
-
- return new Promise(function(aResolve, aReject) {
- target.mozSetMessageHandler(aMessageName, function(aMessage) {
- if (!aMatchFun || aMatchFun(aMessage)) {
- target.mozSetMessageHandler(aMessageName, null);
- ok(true, "System message '" + aMessageName + "' got.");
- aResolve(aMessage);
- }
- });
- });
-}
-
-/**
- * Set radio enabling state and wait for "radiostatechange" event.
- *
- * Resolve if radio state changed to the expected one. Never reject.
- *
- * Fulfill params: (none)
- *
- * @param aEnabled
- * A boolean state.
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: the one indicated in
- * start*TestCommon() or 0 if not indicated.
- *
- * @return A deferred promise.
- */
-function setRadioEnabledAndWait(aEnabled, aServiceId) {
- let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
- let promises = [];
-
- promises.push(waitForTargetEvent(mobileConn, "radiostatechange", function() {
- // To ignore some transient states, we only resolve that deferred promise
- // when |radioState| equals to the expected one.
- return mobileConn.radioState === (aEnabled ? "enabled" : "disabled");
- }));
- promises.push(setRadioEnabled(aEnabled, aServiceId));
-
- return Promise.all(promises);
-}
-
-/**
- * Restart radio and wait card state changes to expected one.
- *
- * Resolve if card state changed to the expected one. Never reject.
- *
- * Fulfill params: (none)
- *
- * @param aCardState
- * Expected card state.
- *
- * @return A deferred promise.
- */
-function restartRadioAndWait(aCardState) {
- return setRadioEnabledAndWait(false).then(() => {
- let promises = [];
-
- promises.push(waitForTargetEvent(iccManager, "iccdetected")
- .then((aEvent) => {
- let icc = getMozIcc(aEvent.iccId);
- if (icc.cardState !== aCardState) {
- return waitForTargetEvent(icc, "cardstatechange", function() {
- return icc.cardState === aCardState;
- });
- }
- }));
- promises.push(setRadioEnabledAndWait(true));
-
- return Promise.all(promises);
- });
-}
-
-/**
- * Enable/Disable PIN-lock.
- *
- * Fulfill params: (none)
- * Reject params:
- * An object contains error name and remaining retry count.
- * @see IccCardLockError
- *
- * @param aIcc
- * A MozIcc object.
- * @param aEnabled
- * A boolean state.
- *
- * @return A deferred promise.
- */
-function setPinLockEnabled(aIcc, aEnabled) {
- let options = {
- lockType: "pin",
- enabled: aEnabled,
- pin: DEFAULT_PIN
- };
-
- return aIcc.setCardLock(options);
-}
-
-/**
- * Wait for pending emulator transactions and call |finish()|.
- */
-function cleanUp() {
- // Use ok here so that we have at least one test run.
- ok(true, ":: CLEANING UP ::");
-
- waitFor(finish, function() {
- return _pendingEmulatorCmdCount === 0;
- });
-}
-
-/**
- * Basic test routine helper for icc tests.
- *
- * This helper does nothing but clean-ups.
- *
- * @param aTestCaseMain
- * A function that takes no parameter.
- */
-function startTestBase(aTestCaseMain) {
- // Turn on debugging pref.
- let debugPref = SpecialPowers.getBoolPref(PREF_KEY_RIL_DEBUGGING_ENABLED);
- SpecialPowers.setBoolPref(PREF_KEY_RIL_DEBUGGING_ENABLED, true);
-
- Promise.resolve()
- .then(aTestCaseMain)
- .catch((aError) => {
- ok(false, "promise rejects during test: " + aError);
- })
- .then(() => {
- // Restore debugging pref.
- SpecialPowers.setBoolPref(PREF_KEY_RIL_DEBUGGING_ENABLED, debugPref);
- cleanUp();
- });
-}
-
-/**
- * Common test routine helper for icc tests.
- *
- * This function ensures global variable |iccManager| and |icc| is available
- * during the process and performs clean-ups as well.
- *
- * @param aTestCaseMain
- * A function that takes one parameter -- icc.
- * @param aAdditonalPermissions [optional]
- * An array of permission strings other than "mobileconnection" to be
- * pushed. Default: empty string..
- */
-function startTestCommon(aTestCaseMain, aAdditionalPermissions) {
- startTestBase(function() {
- return ensureIccManager(aAdditionalPermissions)
- .then(aTestCaseMain);
- });
-}
deleted file mode 100644
--- a/dom/icc/tests/marionette/manifest.ini
+++ /dev/null
@@ -1,41 +0,0 @@
-[DEFAULT]
-run-if = buildapp == 'b2g'
-
-[test_icc_contact_read.js]
-[test_icc_contact_add.js]
-[test_icc_contact_update.js]
-[test_icc_card_lock_get_retry_count.js]
-[test_icc_card_lock_change_pin.js]
-[test_icc_card_lock_enable_pin.js]
-[test_icc_card_lock_unlock_pin.js]
-[test_icc_card_lock_unlock_puk.js]
-[test_icc_card_state.js]
-[test_icc_info.js]
-[test_stk_refresh.js]
-[test_stk_play_tone.js]
-[test_stk_poll_off.js]
-[test_stk_poll_interval.js]
-[test_stk_setup_event_list.js]
-[test_stk_setup_call.js]
-[test_stk_send_ss.js]
-[test_stk_send_ussd.js]
-[test_stk_send_sms.js]
-[test_stk_send_dtmf.js]
-[test_stk_launch_browser.js]
-[test_stk_display_text.js]
-[test_stk_get_inkey.js]
-[test_stk_get_input.js]
-[test_stk_select_item.js]
-[test_stk_setup_menu.js]
-[test_stk_setup_idle_mode_text.js]
-[test_stk_bip_command.js]
-[test_stk_local_info.js]
-[test_stk_timer_management.js]
-[test_icc_access_invalid_object.js]
-[test_icc_detected_undetected_event.js]
-[test_icc_match_mvno.js]
-[test_icc_service_state.js]
-[test_stk_menu_selection.js]
-[test_stk_timer_expiration.js]
-[test_stk_event_download.js]
-[test_stk_response.js]
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_access_invalid_object.js
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 30000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function testInvalidIccObject(aIcc) {
- // Test access iccInfo.
- try {
- is(aIcc.iccInfo, null, "iccInfo: expect to get null");
- } catch(e) {
- ok(false, "access iccInfo should not get exception");
- }
-
- // Test access cardState.
- try {
- is(aIcc.cardState, null, "cardState: expect to get null");
- } catch(e) {
- ok(false, "access cardState should not get exception");
- }
-
- // Test STK related function.
- try {
- aIcc.sendStkResponse({}, {});
- ok(false, "sendStkResponse() should get exception");
- } catch(e) {}
- try {
- aIcc.sendStkMenuSelection(0, false);
- ok(false, "sendStkMenuSelection() should get exception");
- } catch(e) {}
- try {
- aIcc.sendStkTimerExpiration({});
- ok(false, "sendStkTimerExpiration() should get exception");
- } catch(e) {}
- try {
- aIcc.sendStkEventDownload({});
- ok(false, "sendStkEventDownload() should get exception");
- } catch(e) {}
-
- // Test card lock related function.
- try {
- aIcc.getCardLock("pin");
- ok(false, "getCardLock() should get exception");
- } catch(e) {}
- try {
- aIcc.unlockCardLock({});
- ok(false, "unlockCardLock() should get exception");
- } catch(e) {}
- try {
- aIcc.setCardLock({});
- ok(false, "setCardLock() should get exception");
- } catch(e) {}
- try {
- aIcc.getCardLockRetryCount("pin");
- ok(false, "getCardLockRetryCount() should get exception");
- } catch(e) {}
-
- // Test contact related function.
- try {
- aIcc.readContacts("adn");
- ok(false, "readContacts() should get exception");
- } catch(e) {}
- try {
- aIcc.updateContact("adn", {});
- ok(false, "updateContact() should get exception");
- } catch(e) {}
-
- // Test mvno function.
- try {
- aIcc.matchMvno("imsi");
- ok(false, "matchMvno() should get exception");
- } catch(e) {}
-
- // Test service state function.
- return aIcc.getServiceState("fdn").then(() => {
- ok(false, "getServiceState() should be rejected");
- }, () => {});
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
-
- return Promise.resolve()
- // Turn off radio.
- .then(() => {
- let promises = [];
- promises.push(setRadioEnabled(false));
- promises.push(waitForTargetEvent(iccManager, "iccundetected"));
- return Promise.all(promises);
- })
- // Test accessing invalid icc object.
- .then(() => testInvalidIccObject(icc))
- // We should restore the radio status.
- .then(() => {
- let promises = [];
- promises.push(setRadioEnabled(true));
- promises.push(waitForTargetEvent(iccManager, "iccdetected"));
- return Promise.all(promises);
- });
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_card_lock_change_pin.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const LOCK_TYPE = "pin";
-
-function testChangePin(aIcc, aPin, aNewPin, aErrorName, aRetryCount) {
- log("testChangePin for pin=" + aPin + " and newPin=" + aNewPin);
- return aIcc.setCardLock({ lockType: LOCK_TYPE, pin: aPin, newPin: aNewPin })
- .then((aResult) => {
- if (aErrorName) {
- ok(false, "changing pin should not success");
- }
- }, (aError) => {
- if (!aErrorName) {
- ok(false, "changing pin should not fail");
- return;
- }
-
- // check the request error.
- is(aError.name, aErrorName, "error.name");
- is(aError.retryCount, aRetryCount, "error.retryCount");
- });
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let retryCount;
-
- return icc.getCardLockRetryCount(LOCK_TYPE)
- // Get current PIN-lock retry count.
- .then((aResult) => {
- retryCount = aResult.retryCount;
- ok(true, LOCK_TYPE + " retryCount is " + retryCount);
- })
- // Test PIN code changes fail.
- // The retry count should be decreased by 1.
- .then(() => testChangePin(icc, "1111", DEFAULT_PIN, "IncorrectPassword",
- retryCount - 1))
- // Test PIN code changes success. This will reset the retry count.
- .then(() => testChangePin(icc, DEFAULT_PIN, DEFAULT_PIN));
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_card_lock_enable_pin.js
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function setCardLockAndCheck(aIcc, aLockType, aPin, aEnabled, aErrorName,
- aRetryCount) {
- let options = {
- lockType: aLockType,
- enabled: aEnabled,
- pin: aPin
- };
-
- return aIcc.setCardLock(options)
- .then((aResult) => {
- if (aErrorName) {
- ok(false, "setting pin should not success");
- return;
- }
-
- // Check lock state.
- return aIcc.getCardLock(aLockType)
- .then((aResult) => {
- is(aResult.enabled, aEnabled, "result.enabled");
- });
- }, (aError) => {
- if (!aErrorName) {
- ok(false, "setting pin should not fail");
- return;
- }
-
- // Check the request error.
- is(aError.name, aErrorName, "error.name");
- is(aError.retryCount, aRetryCount, "error.retryCount");
- });
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let lockType = "pin";
- let retryCount;
-
- return icc.getCardLockRetryCount(lockType)
- // Get current PIN-lock retry count.
- .then((aResult) => {
- retryCount = aResult.retryCount;
- ok(true, lockType + " retryCount is " + retryCount);
- })
- // Test fail to enable PIN-lock by passing wrong pin.
- // The retry count should be decreased by 1.
- .then(() => setCardLockAndCheck(icc, lockType, "1111", true,
- "IncorrectPassword", retryCount -1))
- // Test enabling PIN-lock.
- .then(() => setCardLockAndCheck(icc, lockType, DEFAULT_PIN, true))
- // Restore pin state.
- .then(() => setCardLockAndCheck(icc, lockType, DEFAULT_PIN, false));
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_card_lock_get_retry_count.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function testGetCardLockRetryCount(aIcc, aLockType, aRetryCount) {
- log("testGetCardLockRetryCount for " + aLockType);
-
- try {
- return aIcc.getCardLockRetryCount(aLockType)
- .then((aResult) => {
- if (!aRetryCount) {
- ok(false, "getCardLockRetryCount(" + aLockType + ") should not success");
- return;
- }
-
- // Check the request result.
- is(aResult.retryCount, aRetryCount, "result.retryCount");
- }, (aError) => {
- if (aRetryCount) {
- ok(false, "getCardLockRetryCount(" + aLockType + ") should not fail" +
- aError.name);
- }
- });
- } catch (e) {
- ok(!aRetryCount, "caught an exception: " + e);
- return Promise.resolve();
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
-
- // Read PIN-lock retry count.
- // The default PIN-lock retry count hard coded in emulator is 3.
- return testGetCardLockRetryCount(icc, "pin", 3)
- // Read PUK-lock retry count.
- // The default PUK-lock retry count hard coded in emulator is 6.
- .then(() => testGetCardLockRetryCount(icc, "puk", 6))
- // Read lock retry count for an invalid entries.
- .then(() => testGetCardLockRetryCount(icc, "invalid-lock-type"));
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_card_lock_unlock_pin.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function testUnlockPin(aIcc, aPin, aErrorName, aRetryCount) {
- log("testUnlockPin with pin=" + aPin);
-
- return aIcc.unlockCardLock({ lockType: "pin", pin: aPin })
- .then((aResult) => {
- if (aErrorName) {
- ok(false, "unlocking pin should not success");
- }
- }, (aError) => {
- if (!aErrorName) {
- ok(false, "unlocking pin should not fail");
- return;
- }
-
- // Check the request error.
- is(aError.name, aErrorName, "error.name");
- is(aError.retryCount, aRetryCount, "error.retryCount");
- });
-}
-
-function testUnlockPinAndWait(aIcc, aPin, aCardState) {
- log("testUnlockPin with pin=" + aPin + ", and wait cardState changes to '" +
- aCardState + "'");
-
- let promises = [];
-
- promises.push(waitForTargetEvent(aIcc, "cardstatechange", function() {
- return aIcc.cardState === aCardState;
- }));
- promises.push(testUnlockPin(aIcc, aPin));
-
- return Promise.all(promises);
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let retryCount;
-
- // Enable PIN-lock.
- return setPinLockEnabled(icc, true)
- // Reset card state to "pinRequired" by restarting radio
- .then(() => restartRadioAndWait("pinRequired"))
- .then(() => { icc = getMozIcc(); })
-
- // Get current PIN-lock retry count.
- .then(() => icc.getCardLockRetryCount("pin"))
- .then((aResult) => {
- retryCount = aResult.retryCount;
- ok(true, "pin retryCount is " + retryCount);
- })
-
- // Test fail to unlock PIN-lock.
- // The retry count should be decreased by 1.
- .then(() => testUnlockPin(icc, "1111", "IncorrectPassword", retryCount - 1))
-
- // Test success to unlock PIN-lock.
- .then(() => testUnlockPinAndWait(icc, DEFAULT_PIN, "ready"))
-
- // Restore pin state.
- .then(() => setPinLockEnabled(icc, false));
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_card_lock_unlock_puk.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function passingWrongPinAndWait(aIcc) {
- return aIcc.getCardLockRetryCount("pin").then((aResult) => {
- let promises = [];
- let retryCount = aResult.retryCount;
-
- ok(true, "pin retryCount is " + retryCount);
-
- promises.push(waitForTargetEvent(aIcc, "cardstatechange", function() {
- return aIcc.cardState === "pukRequired";
- }));
-
- for (let i = 0; i < retryCount; i++) {
- promises.push(aIcc.unlockCardLock({ lockType: "pin", pin: "1111" })
- .then(() => {
- ok(false, "unlocking pin should not success");
- }, function reject(aRetryCount, aError) {
- // check the request error.
- is(aError.name, "IncorrectPassword", "error.name");
- is(aError.retryCount, aRetryCount, "error.retryCount");
- }.bind(null, retryCount - i - 1)));
- }
-
- return Promise.all(promises);
- });
-}
-
-function testUnlockPuk(aIcc, aPuk, aNewPin, aErrorName, aRetryCount) {
- log("testUnlockPuk with puk=" + aPuk + " and newPin=" + aNewPin);
-
- return aIcc.unlockCardLock({ lockType: "puk", puk: aPuk, newPin: aNewPin })
- .then((aResult) => {
- if (aErrorName) {
- ok(false, "unlocking puk should not success");
- }
- }, (aError) => {
- if (!aErrorName) {
- ok(false, "unlocking puk should not fail");
- return;
- }
-
- // Check the request error.
- is(aError.name, aErrorName, "error.name");
- is(aError.retryCount, aRetryCount, "error.retryCount");
- });
-}
-
-function testUnlockPukAndWait(aIcc, aPuk, aNewPin, aCardState) {
- log("testUnlockPuk with puk=" + aPuk + "/newPin=" + aNewPin +
- ", and wait card state changes to '" + aCardState + "'");
-
- let promises = [];
-
- promises.push(waitForTargetEvent(aIcc, "cardstatechange", function() {
- return aIcc.cardState === aCardState;
- }));
- promises.push(testUnlockPuk(aIcc, aPuk, aNewPin));
-
- return Promise.all(promises);
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let retryCount;
-
- // Enable pin lock.
- return setPinLockEnabled(icc, true)
- // Reset card state to "pinRequired" by restarting radio
- .then(() => restartRadioAndWait("pinRequired"))
- .then(() => { icc = getMozIcc() })
- // Switch cardState to "pukRequired" by entering wrong pin code.
- .then(() => passingWrongPinAndWait(icc))
-
- // Get current PUK-lock retry count.
- .then(() => icc.getCardLockRetryCount("puk"))
- .then((aResult) => {
- retryCount = aResult.retryCount;
- ok(true, "puk retryCount is " + retryCount);
- })
-
- // Test unlock PUK code fail.
- // The retry count should be decreased by 1.
- .then(() => testUnlockPuk(icc, "11111111", DEFAULT_PIN, "IncorrectPassword",
- retryCount - 1))
-
- // Test unlock PUK code success.
- .then(() => testUnlockPukAndWait(icc, DEFAULT_PUK, DEFAULT_PIN, "ready"))
-
- // Restore pin state.
- .then(() => setPinLockEnabled(icc, false));
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_card_state.js
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 30000;
-MARIONETTE_HEAD_JS = "head.js";
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
-
- // Basic test.
- is(icc.cardState, "ready", "card state is " + icc.cardState);
-
- // Test cardstatechange event by switching radio off.
- return Promise.resolve()
- // Turn off radio and expect to get card state changing to null.
- .then(() => {
- let promises = [];
- promises.push(setRadioEnabled(false));
- promises.push(waitForTargetEvent(icc, "cardstatechange", function() {
- return icc.cardState === null;
- }));
- return Promise.all(promises);
- })
- // Restore radio status and expect to get iccdetected event.
- .then(() => {
- let promises = [];
- promises.push(setRadioEnabled(true));
- promises.push(waitForTargetEvent(iccManager, "iccdetected"));
- return Promise.all(promises);
- });
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_contact_add.js
+++ /dev/null
@@ -1,119 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 120000;
-MARIONETTE_HEAD_JS = "head.js";
-
-var TEST_ADD_DATA = [{
- // a contact without email and anr.
- name: ["add1"],
- tel: [{value: "0912345678"}],
- }, {
- // a contact over 20 digits.
- name: ["add2"],
- tel: [{value: "012345678901234567890123456789"}],
- }, {
- // a contact over 40 digits.
- name: ["add3"],
- tel: [{value: "01234567890123456789012345678901234567890123456789"}],
- }, {
- // a contact with email but without anr.
- name: ["add4"],
- tel: [{value: "01234567890123456789"}],
- email:[{value: "test@mozilla.com"}],
- }, {
- // a contact with anr but without email.
- name: ["add5"],
- tel: [{value: "01234567890123456789"}, {value: "123456"}, {value: "123"}],
- }, {
- // a contact with email and anr.
- name: ["add6"],
- tel: [{value: "01234567890123456789"}, {value: "123456"}, {value: "123"}],
- email:[{value: "test@mozilla.com"}],
- }, {
- // a contact without number.
- name: ["add7"],
- tel: [{value: ""}],
- }, {
- // a contact without name.
- name: [""],
- tel: [{value: "0987654321"}],
- }];
-
-function testAddContact(aIcc, aType, aMozContact, aPin2) {
- log("testAddContact: type=" + aType + ", pin2=" + aPin2);
- let contact = new mozContact(aMozContact);
-
- return aIcc.updateContact(aType, contact, aPin2)
- .then((aResult) => {
- is(aResult.name[0], aMozContact.name[0]);
- // Maximum digits of the Dialling Number is 20, and maximum digits of Extension is 20.
- is(aResult.tel[0].value, aMozContact.tel[0].value.substring(0, 40));
- // We only support SIM in emulator, so we don't have anr and email field.
- ok(aResult.tel.length == 1);
- ok(!aResult.email);
- }, (aError) => {
- if (aType === "fdn" && aPin2 === undefined) {
- ok(aError.name === "SimPin2",
- "expected error when pin2 is not provided");
- } else {
- ok(false, "Cannot add " + aType + " contact: " + aError.name);
- }
- });
-}
-
-function removeContacts(aIcc, aContacts, aType, aPin2) {
- log("removeContacts: type=" + aType + ", pin2=" + aPin2);
- let promise = Promise.resolve();
-
- // Clean up contacts
- for (let i = 0; i < aContacts.length ; i++) {
- let contact = new mozContact({});
- contact.id = aContacts[i].id;
- promise = promise.then(() => aIcc.updateContact(aType, contact, aPin2));
- }
- return promise;
-}
-
-function testAddContacts(aIcc, aType, aPin2) {
- let promise = Promise.resolve();
-
- for (let i = 0; i < TEST_ADD_DATA.length; i++) {
- let test_data = TEST_ADD_DATA[i];
-
- promise = promise.then(() => testAddContact(aIcc, aType, test_data, aPin2));
- }
-
- // Get ICC contact for checking new contacts
- promise = promise.then(() => aIcc.readContacts(aType))
- .then((aResult) => {
- aResult = aResult.slice(aResult.length - TEST_ADD_DATA.length);
-
- for (let i = 0; i < aResult.length ; i++) {
- let contact = aResult[i];
- let expectedResult = TEST_ADD_DATA[i];
-
- is(contact.name[0], expectedResult.name[0]);
- // Maximum digits of the Dialling Number is 20, and maximum digits of Extension is 20.
- is(contact.tel[0].value, expectedResult.tel[0].value.substring(0, 40));
- is(contact.id.substring(0, aIcc.iccInfo.iccid.length), aIcc.iccInfo.iccid);
- }
- return removeContacts(aIcc, aResult, aType, aPin2);
- });
-
-
- return promise;
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
-
- return Promise.resolve()
- // Test add adn contacts
- .then(() => testAddContacts(icc, "adn"))
- // Test add fdn contacts
- .then(() => testAddContacts(icc, "fdn", "0000"))
- // Test one fdn contact without passing pin2
- .then(() => testAddContact(icc, "fdn", TEST_ADD_DATA[0]));
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_contact_read.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-MARIONETTE_CONTEXT = "chrome";
-
-function testReadContacts(aIcc, aType) {
- log("testReadContacts: type=" + aType);
- let iccId = aIcc.iccInfo.iccid;
- return aIcc.readContacts(aType)
- .then((aResult) => {
-
- is(Array.isArray(aResult), true);
- is(aResult.length, 6, "Check contact number.");
-
- // Alpha Id(Encoded with GSM 8 bit): "Mozilla", Dialling Number: 15555218201
- is(aResult[0].name[0], "Mozilla");
- is(aResult[0].tel[0].value, "15555218201");
- is(aResult[0].id, iccId + "1");
-
- // Alpha Id(Encoded with UCS2 0x80: "Saßê\u9ec3", Dialling Number: 15555218202
- is(aResult[1].name[0], "Saßê黃");
- is(aResult[1].tel[0].value, "15555218202");
- is(aResult[1].id, iccId + "2");
-
- // Alpha Id(Encoded with UCS2 0x81): "Fire \u706b", Dialling Number: 15555218203
- is(aResult[2].name[0], "Fire 火");
- is(aResult[2].tel[0].value, "15555218203");
- is(aResult[2].id, iccId + "3");
-
- // Alpha Id(Encoded with UCS2 0x82): "Huang \u9ec3", Dialling Number: 15555218204
- is(aResult[3].name[0], "Huang 黃");
- is(aResult[3].tel[0].value, "15555218204");
- is(aResult[3].id, iccId + "4");
-
- // Alpha Id(Encoded with GSM 8 bit): "Contact001",
- // Dialling Number: 9988776655443322110001234567890123456789
- is(aResult[4].name[0], "Contact001");
- is(aResult[4].tel[0].value, "9988776655443322110001234567890123456789");
- is(aResult[4].id, iccId + "5");
-
- // Alpha Id(Encoded with GSM 8 bit): "Contact002",
- // Dialling Number: 0123456789012345678999887766554433221100
- is(aResult[5].name[0], "Contact002");
- is(aResult[5].tel[0].value, "0123456789012345678999887766554433221100");
- is(aResult[5].id, iccId + "6");
- }, (aError) => {
- ok(false, "Cannot get " + aType + " contacts");
- });
-}
-
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
-
- // Test read adn contacts
- return testReadContacts(icc, "adn")
- // Test read fdn contact
- .then(() => testReadContacts(icc, "fdn"))
- // Test read sdn contacts
- .then(() => testReadContacts(icc, "sdn"));
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_contact_update.js
+++ /dev/null
@@ -1,130 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 120000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_UPDATE_DATA = [{
- id: 1,
- data: {
- name: ["Mozilla"],
- tel: [{value: "9876543210987654321001234"}]},
- expect: {
- number: "9876543210987654321001234"}
- }, {
- id:2,
- data: {
- name: ["Saßê黃"],
- tel: [{value: "98765432109876543210998877665544332211001234"}]},
- expect: {
- // We don't support extension chain now.
- number: "9876543210987654321099887766554433221100"}
- }, {
- id: 3,
- data: {
- name: ["Fire 火"],
- tel: [{value: ""}]},
- expect: {
- number: ""}
- }, {
- id: 5,
- data: {
- name: ["Contact001"],
- tel: [{value: "9988776655443322110098765432109876543210"}]},
- expect: {
- number: "9988776655443322110098765432109876543210"}
- }, {
- id: 6,
- data: {
- name: ["Contact002"],
- tel: [{value: "+99887766554433221100"}]},
- expect: {
- number: "+99887766554433221100"}
- }];
-
-function testUpdateContact(aIcc, aType, aContactId, aMozContact, aExpect, aPin2) {
- log("testUpdateContact: type=" + aType +
- ", mozContact=" + JSON.stringify(aMozContact) +
- ", expect=" + aExpect.number + ", pin2=" + aPin2);
-
- let contact = new mozContact(aMozContact);
- contact.id = aIcc.iccInfo.iccid + aContactId;
-
- return aIcc.updateContact(aType, contact, aPin2)
- .then((aResult) => {
- is(aResult.tel[0].value, aExpect.number);
- ok(aResult.tel.length == 1);
- // We only support SIM in emulator, so we don't have anr and email field.
- ok(!aResult.email);
- is(contact.id, aIcc.iccInfo.iccid + aContactId);
- }, (aError) => {
- if (aType === "fdn" && aPin2 === undefined) {
- ok(aError.name === "SimPin2",
- "expected error when pin2 is not provided");
- } else {
- ok(false, "Cannot update " + aType + " contact: " + aError.name);
- }
- });
-}
-
-function revertContacts(aIcc, aContacts, aType, aPin2) {
- log("revertContacts type=" + aType + ", pin2=" + aPin2);
- let promise = Promise.resolve();
-
- for (let i = 0; i < aContacts.length; i++) {
- let aContact = aContacts[i];
- promise = promise.then(() => aIcc.updateContact(aType, aContact, aPin2));
- }
- return promise;
-}
-
-function testUpdateContacts(aIcc, aType, aCacheContacts, aPin2) {
- let promise = Promise.resolve();
-
- for (let i = 0; i < TEST_UPDATE_DATA.length; i++) {
- let test_data = TEST_UPDATE_DATA[i];
- promise = promise.then(() => testUpdateContact(aIcc, aType, test_data.id,
- test_data.data, test_data.expect,
- aPin2));
- }
-
- // Get ICC contact for checking expect contacts
- promise = promise.then(() => aIcc.readContacts(aType))
- .then((aResult) => {
- for (let i = 0; i < TEST_UPDATE_DATA.length; i++) {
- let expectedResult = TEST_UPDATE_DATA[i];
- let contact = aResult[expectedResult.id - 1];
-
- is(contact.name[0], expectedResult.data.name[0]);
- is(contact.id, aIcc.iccInfo.iccid + expectedResult.id);
- is(contact.tel[0].value, expectedResult.expect.number);
- }
- return revertContacts(aIcc, aCacheContacts, aType, aPin2);
- });
-
- return promise;
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let adnContacts;
- let fdnContacts;
-
- return icc.readContacts("adn")
- .then((aResult) => {
- adnContacts = aResult;
- })
- .then(() => icc.readContacts("fdn"))
- .then((aResult) => {
- fdnContacts = aResult;
- })
- // Test update adn contacts
- .then(() => testUpdateContacts(icc, "adn", adnContacts))
- // Test update fdn contacts
- .then(() => testUpdateContacts(icc, "fdn", fdnContacts, "0000"))
- // Test one fdn contact without passing pin2
- .then(() => testUpdateContact(icc, "fdn", TEST_UPDATE_DATA[0].id,
- TEST_UPDATE_DATA[0].data,
- TEST_UPDATE_DATA[0].expect));
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_detected_undetected_event.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 30000;
-MARIONETTE_HEAD_JS = "head.js";
-
-// Start tests
-startTestCommon(function() {
- let origNumIccs = iccManager.iccIds.length;
- let icc = getMozIcc();
- let iccId = icc.iccInfo.iccid;
- let mobileConnection = getMozMobileConnectionByServiceId();
-
- return Promise.resolve()
- // Test iccundetected event.
- .then(() => {
- let promises = [];
-
- promises.push(setRadioEnabled(false));
- promises.push(waitForTargetEvent(iccManager, "iccundetected").then((aEvt) => {
- is(aEvt.iccId, iccId, "icc " + aEvt.iccId + " becomes undetected");
- is(iccManager.iccIds.length, origNumIccs - 1,
- "iccIds.length becomes to " + iccManager.iccIds.length);
- is(iccManager.getIccById(aEvt.iccId), null,
- "should not get a valid icc object here");
-
- // The mozMobileConnection.iccId should be in sync.
- is(mobileConnection.iccId, null, "check mozMobileConnection.iccId");
- }));
-
- return Promise.all(promises);
- })
- // Test iccdetected event.
- .then(() => {
- let promises = [];
-
- promises.push(setRadioEnabled(true));
- promises.push(waitForTargetEvent(iccManager, "iccdetected").then((aEvt) => {
- is(aEvt.iccId, iccId, "icc " + aEvt.iccId + " is detected");
- is(iccManager.iccIds.length, origNumIccs,
- "iccIds.length becomes to " + iccManager.iccIds.length);
- ok(iccManager.getIccById(aEvt.iccId) instanceof MozIcc,
- "should get a valid icc object here");
-
- // The mozMobileConnection.iccId should be in sync.
- is(mobileConnection.iccId, iccId, "check mozMobileConnection.iccId");
- }));
-
- return Promise.all(promises);
- });
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_info.js
+++ /dev/null
@@ -1,64 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 30000;
-MARIONETTE_HEAD_JS = "head.js";
-
-/* Basic test */
-function basicTest(aIcc) {
- let iccInfo = aIcc.iccInfo;
-
- // The emulator's hard coded iccid value.
- // See it here {B2G_HOME}/external/qemu/telephony/sim_card.c#L299.
- is(iccInfo.iccid, 89014103211118510720);
-
- if (iccInfo instanceof MozGsmIccInfo) {
- log("Test Gsm IccInfo");
- is(iccInfo.iccType, "sim");
- is(iccInfo.spn, "Android");
- // The emulator's hard coded mcc and mnc codes.
- // See it here {B2G_HOME}/external/qemu/telephony/android_modem.c#L2465.
- is(iccInfo.mcc, 310);
- is(iccInfo.mnc, 410);
- // Phone number is hardcoded in MSISDN
- // See {B2G_HOME}/external/qemu/telephony/sim_card.c, in asimcard_io().
- is(iccInfo.msisdn, "15555215554");
- } else {
- log("Test Cdma IccInfo");
- is(iccInfo.iccType, "ruim");
- // MDN is hardcoded as "8587777777".
- // See it here {B2G_HOME}/hardware/ril/reference-ril/reference-ril.c,
- // in requestCdmaSubscription().
- is(iccInfo.mdn, "8587777777");
- // PRL version is hardcoded as 1.
- // See it here {B2G_HOME}/hardware/ril/reference-ril/reference-ril.c,
- // in requestCdmaSubscription().
- is(iccInfo.prlVersion, 1);
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
-
- return Promise.resolve()
- // Basic test
- .then(() => basicTest(icc))
- // Test iccInfo when card becomes undetected
- .then(() => {
- let promises = [];
- promises.push(setRadioEnabled(false));
- promises.push(waitForTargetEvent(icc, "iccinfochange", function() {
- // Expect iccInfo changes to null
- return icc.iccInfo === null;
- }));
- return Promise.all(promises);
- })
- // Restore radio status and expect to get iccdetected event.
- .then(() => {
- let promises = [];
- promises.push(setRadioEnabled(true));
- promises.push(waitForTargetEvent(iccManager, "iccdetected"));
- return Promise.all(promises);
- });
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_match_mvno.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 30000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- // mvno type, mvno data, request success, expected result
- // Emulator's hard coded IMSI: 310410000000000
- ["imsi", "3104100", true, true ],
- // x and X means skip the comparison.
- ["imsi", "31041xx0", true, true ],
- ["imsi", "310410x0x", true, true ],
- ["imsi", "310410X00", true, true ],
- ["imsi", "310410XX1", true, false ],
- ["imsi", "31041012", true, false ],
- ["imsi", "310410000000000", true, true ],
- ["imsi", "310410000000000123", true, false ],
- ["imsi", "", false, "InvalidParameter"],
- // Emulator's hard coded SPN: Android
- ["spn", "Android", true, true ],
- ["spn", "", false, "InvalidParameter"],
- ["spn", "OneTwoThree", true, false ],
- // Emulator's hard coded GID1: 5a4d
- ["gid", "", false, "InvalidParameter"],
- ["gid", "A1", true, false ],
- ["gid", "5A", true, true ],
- ["gid", "5a", true, true ],
- ["gid", "5a4d", true, true ],
- ["gid", "5A4D", true, true ],
- ["gid", "5a4d6c", true, false ]
-];
-
-function testMatchMvno(aIcc, aMvnoType, aMvnoData, aSuccess, aExpectedResult) {
- log("matchMvno: " + aMvnoType + ", " + aMvnoData);
- return aIcc.matchMvno(aMvnoType, aMvnoData)
- .then((aResult) => {
- log("onsuccess: " + aResult);
- ok(aSuccess, "onsuccess while error expected");
- is(aResult, aExpectedResult);
- }, (aError) => {
- log("onerror: " + aError.name);
- ok(!aSuccess, "onerror while success expected");
- is(aError.name, aExpectedResult);
- });
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => testMatchMvno.apply(null, [icc].concat(data)));
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_icc_service_state.js
+++ /dev/null
@@ -1,28 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function testUnsupportedService() {
- try {
- icc.getServiceState("unsupported-service");
- ok(false, "should get exception");
- } catch (aException) {
- ok(true, "got exception: " + aException);
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
-
- // Check fdn service state
- return icc.getServiceState("fdn")
- .then((aResult) => {
- is(aResult, true, "check fdn service state");
- })
-
- // Test unsupported service
- .then(() => testUnsupportedService());
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_bip_command.js
+++ /dev/null
@@ -1,137 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- // Open channel.
- {command: "D02E" + // Length
- "8103014001" + // Command details
- "82028182" + // Device identities
- "05074F70656E204944" + // Alpha identifier
- "9E020007" + // Icon identifier
- "86099111223344556677F8" + // Address
- "350702030403041F02" + // Bear description
- "39020578", // Buffer size
- expect: {typeOfCommand: MozIccManager.STK_CMD_OPEN_CHANNEL,
- commandQualifier: 0x01,
- text: "Open ID",
- iconSelfExplanatory: true,
- icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
- {command: "D023" + // Length
- "8103014001" + // Command details
- "82028182" + // Device identities
- "0500" + // Alpha identifier
- "86099111223344556677F8" + // Address
- "350702030403041F02" + // Bear description
- "39020578", // Buffer size
- expect: {typeOfCommand: MozIccManager.STK_CMD_OPEN_CHANNEL,
- commandQualifier: 0x01,
- text: ""}},
- {command: "D02C" + // Length
- "8103014001" + // Command details
- "82028182" + // Device identities
- "05094F70656E2049442031" + // Alpha identifier
- "86099111223344556677F8" + // Address
- "350702030403041F02" + // Bear description
- "39020578", // Buffer size
- expect: {typeOfCommand: MozIccManager.STK_CMD_OPEN_CHANNEL,
- commandQualifier: 0x01,
- text: "Open ID 1"}},
- // Close channel.
- {command: "D00D" + // Length
- "8103014100" + // Command details
- "82028182" + // Device identities
- "9E020007", // Icon identifier
- expect: {typeOfCommand: MozIccManager.STK_CMD_CLOSE_CHANNEL,
- commandQualifier: 0x00,
- iconSelfExplanatory: true,
- icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
- {command: "D015" + // Length
- "8103014100" + // Command details
- "82028121" + // Device identities
- "850A436C6F73652049442031", // Alpha identifier
- expect: {typeOfCommand: MozIccManager.STK_CMD_CLOSE_CHANNEL,
- commandQualifier: 0x00,
- text: "Close ID 1"}},
- // Receive data.
- {command: "D00C" + // Length
- "8103014200" + // Command details
- "82028121" + // Device identities
- "B701C8", // Channel data length
- expect: {typeOfCommand: MozIccManager.STK_CMD_RECEIVE_DATA,
- commandQualifier: 0x00}},
- {command: "D01C" + // Length
- "8103014200" + // Command details
- "82028121" + // Device identities
- "850E5265636569766520446174612031" + // Alpha identifier
- "B701C8", // Channel data length
- expect: {typeOfCommand: MozIccManager.STK_CMD_RECEIVE_DATA,
- commandQualifier: 0x00,
- text: "Receive Data 1"}},
- // Send data.
- {command: "D017" + // Length
- "8103014301" + // Command details
- "82028121" + // Device identities
- "9E020007" + // Icon identifier
- "B6080001020304050607", // Channel data
- expect: {typeOfCommand: MozIccManager.STK_CMD_SEND_DATA,
- commandQualifier: 0x01,
- iconSelfExplanatory: true,
- icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
- {command: "D020" + // Length
- "8103014301" + // Command details
- "82028121" + // Device identities
- "850B53656E6420446174612031" + // Alpha identifier
- "B6080001020304050607", // Channel data
- expect: {typeOfCommand: MozIccManager.STK_CMD_SEND_DATA,
- commandQualifier: 0x01,
- text: "Send Data 1"}},
-];
-
-function testBipCommand(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, aExpect.typeOfCommand, "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- // text is optional.
- if ("text" in aExpect) {
- is(aCommand.options.text, aExpect.text, "options.text");
- }
-
- // icons is optional.
- if ("icons" in aExpect) {
- isIcons(aCommand.options.icons, aExpect.icons);
- is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
- "options.iconSelfExplanatory");
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("bip_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testBipCommand(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testBipCommand(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_display_text.js
+++ /dev/null
@@ -1,246 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D01A" + // Length
- "8103012101" + // Command details
- "82028102" + // Device identities
- "8D0F04546F6F6C6B697420546573742031", // Text string
- expect: {commandQualifier: 0x01,
- text: "Toolkit Test 1",
- responseNeeded: false}},
- {command: "D01C" + // Length
- "8103012181" + // Command details
- "82028102" + // Device identities
- "8D0F04546F6F6C6B697420546573742032" + // Text string
- "2B00", // Immediate response
- expect: {commandQualifier: 0x81,
- text: "Toolkit Test 2",
- responseNeeded: true}},
- {command: "D081AD" + // Length
- "8103012180" + // Command details
- "82028102" + // Device identities
- "8D81A1045468697320636F6D6D616E6420696E73747275" + // Text string
- "63747320746865204D4520746F20646973706C61792061" +
- "2074657874206D6573736167652E20497420616C6C6F77" +
- "73207468652053494D20746F20646566696E6520746865" +
- "207072696F72697479206F662074686174206D65737361" +
- "67652C20616E6420746865207465787420737472696E67" +
- "20666F726D61742E2054776F207479706573206F662070" +
- "72696F",
- expect: {commandQualifier: 0x80,
- text: "This command instructs the ME to display a text message. " +
- "It allows the SIM to define the priority of that message," +
- " and the text string format. Two types of prio",
- responseNeeded: false}},
- {command: "D01A" + // Length
- "8103012180" + // Command details
- "82028102" + // Device identities
- "8D0F043C474F2D4241434B57415244533E", // Text string
- expect: {commandQualifier: 0x80,
- text: "<GO-BACKWARDS>",
- responseNeeded: false}},
- {command: "D024" + // Length
- "8103012180" + // Command details
- "82028102" + // Device identities
- "8D19080417041404200410041204210422041204230419" + // Text string
- "04220415",
- expect: {commandQualifier: 0x80,
- text: "ЗДРАВСТВУЙТЕ",
- responseNeeded: false}},
- {command: "D010" + // Length
- "8103012180" + // Command details
- "82028102" + // Device identities
- "8D05084F60597D", // Text string
- expect: {commandQualifier: 0x80,
- text: "你好",
- responseNeeded: false}},
- {command: "D028" + // Length
- "8103012180" + // Command details
- "82028102" + // Device identities
- "0D1D00D3309BFC06C95C301AA8E80259C3EC34B9AC07C9" + // Text string
- "602F58ED159BB940",
- expect: {commandQualifier: 0x80,
- text: "Saldo 2.04 E. Validez 20/05/13. ",
- responseNeeded: false}},
- {command: "D019" + // Length
- "8103012180" + // Command details
- "82028102" + // Device identities
- "8D0A043130205365636F6E64" + // Text string
- "8402010A", // Duration
- expect: {commandQualifier: 0x80,
- text: "10 Second",
- responseNeeded: false,
- duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
- timeInterval: 0x0A}}},
- {command: "D01A" + // Length
- "8103012180" + // Command details
- "82028102" + // Device identities
- "8D0B0442617369632049636F6E" + // Text string
- "9E020001", // Icon identifier
- expect: {commandQualifier: 0x80,
- text: "Basic Icon",
- responseNeeded: false,
- iconSelfExplanatory: true,
- icons: [BASIC_ICON]}},
- {command: "D026" + // Length
- "8103012100" + // Command details
- "82028102" + // Device identities
- "8D1B" + // Text string
- "00" + // 7BIT
- "D4F79BBD4ED341D4F29C0E3A4A9F55A80E8687C158A09B304905",
- expect: {commandQualifier: 0x00,
- text: "Toolkit Test GROUP:0x00, 7BIT",
- responseNeeded: false}},
- {command: "D029" + // Length
- "8103012100" + // Command details
- "82028102" + // Device identities
- "8D1E" + // Text string
- "04" + // 8BIT
- "546F6F6C6B697420546573742047524F55503A307830302C2038424954",
- expect: {commandQualifier: 0x00,
- text: "Toolkit Test GROUP:0x00, 8BIT",
- responseNeeded: false}},
- {command: "D046" + // Length
- "8103012100" + // Command details
- "82028102" + // Device identities
- "8D3B" + // Text string
- "08" + // UCS2
- "0054006F006F006C006B0069007400200054006500730074002000470052004F" +
- "00550050003A0030007800300030002C00200055004300530032",
- expect: {commandQualifier: 0x00,
- text: "Toolkit Test GROUP:0x00, UCS2",
- responseNeeded: false}},
- {command: "D026" + // Length
- "8103012100" + // Command details
- "82028102" + // Device identities
- "8D1B" + // Text string
- "12" + // 7BIT + Class 2
- "D4F79BBD4ED341D4F29C0E3A4A9F55A80E868FC158A09B304905",
- expect: {commandQualifier: 0x00,
- text: "Toolkit Test GROUP:0x10, 7BIT",
- responseNeeded: false}},
- {command: "D029" + // Length
- "8103012100" + // Command details
- "82028102" + // Device identities
- "8D1E" + // Text string
- "16" + // 8BIT + Class 2
- "546F6F6C6B697420546573742047524F55503A307831302C2038424954",
- expect: {commandQualifier: 0x00,
- text: "Toolkit Test GROUP:0x10, 8BIT",
- responseNeeded: false}},
- {command: "D046" + // Length
- "8103012100" + // Command details
- "82028102" + // Device identities
- "8D3B" + // Text string
- "1A" + // UCS2 + Class 2
- "0054006F006F006C006B0069007400200054006500730074002000470052004F" +
- "00550050003A0030007800310030002C00200055004300530032",
- expect: {commandQualifier: 0x00,
- text: "Toolkit Test GROUP:0x10, UCS2",
- responseNeeded: false}},
- {command: "D026" + // Length
- "8103012100" + // Command details
- "82028102" + // Device identities
- "8D1B" + // Text string
- "F2" + // 7BIT + Class 2
- "D4F79BBD4ED341D4F29C0E3A4A9F55A80E8637C258A09B304905",
- expect: {commandQualifier: 0x00,
- text: "Toolkit Test GROUP:0xF0, 7BIT",
- responseNeeded: false}},
- {command: "D029" + // Length
- "8103012100" + // Command details
- "82028102" + // Device identities
- "8D1E" + // Text string
- "F6" + // 8BIT + Class 2
- "546F6F6C6B697420546573742047524F55503A307846302C2038424954",
- expect: {commandQualifier: 0x00,
- text: "Toolkit Test GROUP:0xF0, 8BIT",
- responseNeeded: false}},
- // Bug 1088573: this test case is to ensure that we provide |length| argument
- // in |integer| format to GsmPDUHelper.readSeptetsToString().
- {command: "D081FC" + // Length (2-byte length encoded: 252)
- "8103012100" + // Command details
- "82028102" + // Device identities
- "8D" + // Text string
- "81F0" + // 2-byte length encoded: 240
- "00" + // 7BIT
- "C332A85D9ECFC3E732685E068DDF6DF87B5E0691CB20D96D061A87E5E131BD2C" +
- "2FCF416537A8FD269741E3771B2E2FCFE76517685806B5CBF379F85C0695E774" +
- "50D86C4E8FD165D0BC2E07C1D9F579BA5C97CF41E5B13CEC9E83CA7490BB0C22" +
- "BFD374103C3C0795E9F232882E7FBBE3F5B20B24BBCD40E5391DC42E83DCEFB6" +
- "585E06B5C3F874BBDE0691CBA071581E1ED3CBF2F21C14369BD3637458CC2EBB" +
- "40C3329D5E0699DFEE313DFD76BBC3EC34BD0C0A83CAF432280C87CBDF757BB9" +
- "0C8287E5207619346D1E73A0783D0D9A9FCA733A885C96BFEBEC32280C9A6689" +
- "CE621654768382D529551A64268B2E",
- expect: {commandQualifier: 0x00,
- text: "Ce message se compose de 273 caracteres en mode " +
- "compresse. Ce message est affiche sur plusieurs " +
- "ecrans et ne doit pas etre tronque. 273 est le " +
- "nombre maximum de caracteres affichable. Cette " +
- "fonctionnalite a ete approuvee par le SMG9 qui s'est " +
- "deroule a SYDNEY en AUSTRALIE.",
- responseNeeded: false}},
-];
-
-function testDisplayText(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_DISPLAY_TEXT,
- "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- is(aCommand.options.userClear, !!(aExpect.commandQualifier & 0x80),
- "options.userClear");
- is(aCommand.options.isHighPriority, !!(aExpect.commandQualifier & 0x01),
- "options.isHighPriority");
- is(aCommand.options.text, aExpect.text, "options.text");
- is(aCommand.options.responseNeeded, aExpect.responseNeeded,
- "options.responseNeeded");
-
- // duration is optional.
- if ("duration" in aExpect) {
- let duration = aCommand.options.duration;
- is(duration.timeUnit, aExpect.duration.timeUnit,
- "options.duration.timeUnit");
- is(duration.timeInterval, aExpect.duration.timeInterval,
- "options.duration.timeInterval");
- }
-
- // icons is optional.
- if ("icons" in aExpect) {
- isIcons(aCommand.options.icons, aExpect.icons);
- is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
- "options.iconSelfExplanatory");
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("display_text_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testDisplayText(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testDisplayText(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_event_download.js
+++ /dev/null
@@ -1,204 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 90000;
-MARIONETTE_HEAD_JS = "head.js";
-
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
-
- // APDU format of ENVELOPE:
- // Class = 'A0', INS = 'C2', P1 = '00', P2 = '00', XXXX, (No Le)
-
- // Since |sendStkEventDownload| is an API without call back to identify the
- // result, the tests of |sendStkMenuSelection| must be executed one by one with
- // |verifyWithPeekedStkEnvelope| introduced here.
- return Promise.resolve()
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_USER_ACTIVITY
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "07" + // Length
- "990104" + // TAG_EVENT_LIST (STK_EVENT_TYPE_USER_ACTIVITY)
- "82028281" // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- ))
-
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "07" + // Length
- "990105" + // TAG_EVENT_LIST (STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE)
- "82020281" // TAG_DEVICE_ID (STK_DEVICE_ID_DISPLAY, STK_DEVICE_ID_SIM)
- ))
-
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_LOCATION_STATUS,
- locationStatus: MozIccManager.STK_SERVICE_STATE_NORMAL,
- locationInfo: {
- mcc: "466",
- mnc: "92",
- gsmLocationAreaCode: 10291,
- gsmCellId: 19072823
- }
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "15" + // Length
- "990103" + // TAG_EVENT_LIST (STK_EVENT_TYPE_LOCATION_STATUS)
- "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "9B0100" + // TAG_LOCATION_STATUS (STK_SERVICE_STATE_NORMAL)
- "930964F629283301230737" // TAG_LOCATION_INFO (mccmnc = 46692, lac = 10291, cellId = 19072823)
- ))
-
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_LOCATION_STATUS,
- locationStatus: MozIccManager.STK_SERVICE_STATE_LIMITED,
- // locationInfo shall be ignored if locationStatus != STK_SERVICE_STATE_NORMAL
- locationInfo: {
- mcc: "466",
- mnc: "92",
- gsmLocationAreaCode: 10291,
- gsmCellId: 19072823
- }
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "0A" + // Length
- "990103" + // TAG_EVENT_LIST (STK_EVENT_TYPE_LOCATION_STATUS)
- "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "9B0101" // TAG_LOCATION_STATUS (STK_SERVICE_STATE_LIMITED)
- ))
-
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_LOCATION_STATUS,
- locationStatus: MozIccManager.STK_SERVICE_STATE_UNAVAILABLE,
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "0A" + // Length
- "990103" + // TAG_EVENT_LIST (STK_EVENT_TYPE_LOCATION_STATUS)
- "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "9B0102" // TAG_LOCATION_STATUS (STK_SERVICE_STATE_UNAVAILABLE)
- ))
-
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_MT_CALL,
- number: "+9876543210", // International number
- isIssuedByRemote: true,
- error: null
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "12" + // Length
- "990100" + // TAG_EVENT_LIST (STK_EVENT_TYPE_MT_CALL)
- "82028381" + // TAG_DEVICE_ID (STK_DEVICE_ID_NETWORK, STK_DEVICE_ID_SIM)
- "9C0100" + // TAG_TRANSACTION_ID (transactionId always set to 0)
- "8606918967452301" // TAG_ADDRESS (+9876543210)
- ))
-
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_MT_CALL,
- number: "987654321", // National number
- isIssuedByRemote: true,
- error: null
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "12" + // Length
- "990100" + // TAG_EVENT_LIST (STK_EVENT_TYPE_MT_CALL)
- "82028381" + // TAG_DEVICE_ID (STK_DEVICE_ID_NETWORK, STK_DEVICE_ID_SIM)
- "9C0100" + // TAG_TRANSACTION_ID (transactionId always set to 0)
- "86068189674523F1" // TAG_ADDRESS (987654321)
- ))
-
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_CALL_CONNECTED,
- isIssuedByRemote: true,
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "0A" + // Length
- "990101" + // TAG_EVENT_LIST (STK_EVENT_TYPE_CALL_CONNECTED)
- "82028381" + // TAG_DEVICE_ID (STK_DEVICE_ID_NETWORK, STK_DEVICE_ID_SIM)
- "9C0100" // TAG_TRANSACTION_ID (transactionId always set to 0)
- ))
-
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_CALL_CONNECTED,
- isIssuedByRemote: false,
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "0A" + // Length
- "990101" + // TAG_EVENT_LIST (STK_EVENT_TYPE_CALL_CONNECTED)
- "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "9C0100" // TAG_TRANSACTION_ID (transactionId always set to 0)
- ))
-
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_CALL_DISCONNECTED,
- isIssuedByRemote: false,
- error: "BusyError"
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "0E" + // Length
- "990102" + // TAG_EVENT_LIST (STK_EVENT_TYPE_CALL_DISCONNECTED)
- "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "9C0100" + // TAG_TRANSACTION_ID (transactionId always set to 0)
- "9A026091" // TAG_CAUSE (Busy)
- ))
-
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_CALL_DISCONNECTED,
- isIssuedByRemote: true,
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "0A" + // Length
- "990102" + // TAG_EVENT_LIST (STK_EVENT_TYPE_CALL_DISCONNECTED)
- "82028381" + // TAG_DEVICE_ID (STK_DEVICE_ID_NETWORK, STK_DEVICE_ID_SIM)
- "9C0100" // TAG_TRANSACTION_ID (transactionId always set to 0)
- ))
-
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_LANGUAGE_SELECTION,
- language: "zh",
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "0B" + // Length
- "990107" + // TAG_EVENT_LIST (STK_EVENT_TYPE_LANGUAGE_SELECTION)
- "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "2D027A68" // TAG_LANGUAGE ("zh")
- ))
-
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_BROWSER_TERMINATION,
- terminationCause: MozIccManager.STK_BROWSER_TERMINATION_CAUSE_USER,
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "0A" + // Length
- "990108" + // TAG_EVENT_LIST (STK_EVENT_TYPE_BROWSER_TERMINATION)
- "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "B40100" // TAG_BROWSER_TERMINATION_CAUSE (USER)
- ))
-
- .then(() => icc.sendStkEventDownload({
- eventType: MozIccManager.STK_EVENT_TYPE_BROWSER_TERMINATION,
- terminationCause: MozIccManager.STK_BROWSER_TERMINATION_CAUSE_ERROR,
- }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D6" + // BER_EVENT_DOWNLOAD_TAG
- "0A" + // Length
- "990108" + // TAG_EVENT_LIST (STK_EVENT_TYPE_BROWSER_TERMINATION)
- "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "B40101" // TAG_BROWSER_TERMINATION_CAUSE (ERROR)
- ));
-});
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_get_inkey.js
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D014" + // Length
- "8103012200" + // Command details
- "82028182" + // Device identities
- "8D09004537BD2C07896022", // Text string
- expect: {commandQualifier: 0x00,
- text: "Enter \"0\""}},
- {command: "D00B" + // Length
- "8103012200" + // Command details
- "82028182" + // Device identities
- "8D00", // Text string
- expect: {commandQualifier: 0x00,
- text: null}},
- {command: "D00C" + // Length
- "8103012200" + // Command details
- "82028182" + // Device identities
- "8D0100", // Text string
- expect: {commandQualifier: 0x00,
- text: ""}},
- {command: "D081AD" + // Length
- "8103012201" + // Command details
- "82028182" + // Device identities
- "8D81A104456E746572202278222E205468697320636F6D" + // Text string
- "6D616E6420696E7374727563747320746865204D452074" +
- "6F20646973706C617920746578742C20616E6420746F20" +
- "65787065637420746865207573657220746F20656E7465" +
- "7220612073696E676C65206368617261637465722E2041" +
- "6E7920726573706F6E736520656E746572656420627920" +
- "7468652075736572207368616C6C206265207061737365" +
- "642074",
- expect: {commandQualifier: 0x01,
- text: "Enter \"x\". This command instructs the ME to display " +
- "text, and to expect the user to enter a single character. " +
- "Any response entered by the user shall be passed t"}},
- {command: "D016" + // Length
- "8103012200" + // Command details
- "82028182" + // Device identities
- "8D0B043C54494D452D4F55543E", // Text string
- expect: {commandQualifier: 0x00,
- text: "<TIME-OUT>"}},
- {command: "D08199" + // Length
- "8103012200" + // Command details
- "82028182" + // Device identities
- "8D818D0804170414042004100412042104220412042304" + // Text string
- "1904220415041704140420041004120421042204120423" +
- "0419042204150417041404200410041204210422041204" +
- "2304190422041504170414042004100412042104220412" +
- "0423041904220415041704140420041004120421042204" +
- "1204230419042204150417041404200410041204210422" +
- "041204230419",
- expect: {commandQualifier: 0x00,
- text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДР" +
- "АВСТВУЙТЕЗДРАВСТВУЙ"}},
- {command: "D011" + // Length
- "8103012203" + // Command details
- "82028182" + // Device identities
- "8D0604456E746572", // Text string
- expect: {commandQualifier: 0x03,
- text: "Enter"}},
- {command: "D015" + // Length
- "8103012204" + // Command details
- "82028182" + // Device identities
- "8D0A04456E74657220594553", // Text string
- expect: {commandQualifier: 0x04,
- text: "Enter YES"}},
- {command: "D019" + // Length
- "8103012200" + // Command details
- "82028182" + // Device identities
- "8D0A043C4E4F2D49434F4E3E" + // Text string
- "1E020002", // Icon identifier
- expect: {commandQualifier: 0x00,
- // The record number 02 in EFimg is not defined, so no icon will be
- // shown, but the text string should still be displayed.
- text: "<NO-ICON>"}},
- {command: "D016" + // Length
- "8103012280" + // Command details
- "82028182" + // Device identities
- "8D07043C49434F4E3E" + // Text string
- "1E020101", // Icon identifier
- expect: {commandQualifier: 0x80,
- text: "<ICON>",
- iconSelfExplanatory: false,
- icons : [BASIC_ICON]}},
- {command: "D019" + // Length
- "8103012200" + // Command details
- "82028182" + // Device identities
- "8D0A04456E74657220222B22" + // Text string
- "8402010A", // Duration
- expect: {commandQualifier: 0x00,
- text: "Enter \"+\"",
- duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
- timeInterval: 0x0A}}},
-];
-
-function testGetInKey(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_GET_INKEY, "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- is(aCommand.options.isAlphabet, !!(aExpect.commandQualifier & 0x01),
- "options.isAlphabet");
- is(aCommand.options.isUCS2, !!(aExpect.commandQualifier & 0x02),
- "options.isUCS2");
- is(aCommand.options.isYesNoRequested, !!(aExpect.commandQualifier & 0x04),
- "options.isYesNoRequested");
- is(aCommand.options.isHelpAvailable, !!(aExpect.commandQualifier & 0x80),
- "options.isHelpAvailable");
- is(aCommand.options.text, aExpect.text, "options.text");
- is(aCommand.options.minLength, 1, "options.minLength");
- is(aCommand.options.maxLength, 1, "options.maxLength");
-
- // duration is optional.
- if ("duration" in aExpect) {
- let duration = aCommand.options.duration;
- is(duration.timeUnit, aExpect.duration.timeUnit,
- "options.duration.timeUnit");
- is(duration.timeInterval, aExpect.duration.timeInterval,
- "options.duration.timeInterval");
- }
-
- // icons is optional.
- if ("icons" in aExpect) {
- isIcons(aCommand.options.icons, aExpect.icons);
- is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
- "options.iconSelfExplanatory");
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("get_inkey_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testGetInKey(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testGetInKey(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_get_input.js
+++ /dev/null
@@ -1,202 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D01B" + // Length
- "8103012300" + // Command details
- "82028182" + // Device identities
- "8D0C04456E746572203132333435" + // Text string
- "91020505", // Response length
- expect: {commandQualifier: 0x00,
- text: "Enter 12345",
- minLength: 5,
- maxLength: 5}},
- {command: "D01A" + // Length
- "8103012308" + // Command details
- "82028182" + // Device identities
- "8D0B004537BD2C07D96EAAD10A" + // Text string
- "91020505", // Response length
- expect: {commandQualifier: 0x08,
- text: "Enter 67*#+",
- minLength: 5,
- maxLength: 5}},
- {command: "D01B" + // Length
- "8103012301" + // Command details
- "82028182" + // Device identities
- "8D0C04456E746572204162436445" + // Text string
- "91020505", // Response length
- expect: {commandQualifier: 0x01,
- text: "Enter AbCdE",
- minLength: 5,
- maxLength: 5}},
- {command: "D027" + // Length
- "8103012304" + // Command details
- "82028182" + // Device identities
- "8D180450617373776F726420313C53454E443E323334" + // Text string
- "35363738" +
- "91020408", // Response length
- expect: {commandQualifier: 0x04,
- text: "Password 1<SEND>2345678",
- minLength: 4,
- maxLength: 8}},
- {command: "D01E" + // Length
- "8103012300" + // Command details
- "82028182" + // Device identities
- "8D0F043C474F2D4241434B57415244533E" + // Text string
- "91020008", // Response length
- expect: {commandQualifier: 0x00,
- text: "<GO-BACKWARDS>",
- minLength: 0,
- maxLength: 8}},
- {command: "D081B1" + // Length
- "8103012300" + // Command details
- "82028182" + // Device identities
- "8D81A1042A2A2A313131313131313131312323232A2A2A" + // Text string
- "323232323232323232322323232A2A2A33333333333333" +
- "3333332323232A2A2A343434343434343434342323232A" +
- "2A2A353535353535353535352323232A2A2A3636363636" +
- "36363636362323232A2A2A373737373737373737372323" +
- "232A2A2A383838383838383838382323232A2A2A393939" +
- "393939393939392323232A2A2A30303030303030303030" +
- "232323" +
- "9102A0A0", // Response length
- expect: {commandQualifier: 0x00,
- text: "***1111111111###***2222222222###***3333333333###***444444" +
- "4444###***5555555555###***6666666666###***7777777777###**" +
- "*8888888888###***9999999999###***0000000000###",
- minLength: 160,
- maxLength: 160}},
- {command: "D0819D" + // Length
- "8103012301" + // Command details
- "82028182" + // Device identities
- "8D818D0804170414042004100412042104220412042304" + // Text string
- "1904220415041704140420041004120421042204120423" +
- "0419042204150417041404200410041204210422041204" +
- "2304190422041504170414042004100412042104220412" +
- "0423041904220415041704140420041004120421042204" +
- "1204230419042204150417041404200410041204210422" +
- "041204230419" +
- "91020505", // Response length
- expect: {commandQualifier: 0x01,
- text: "ЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУЙТЕЗДРАВСТВУ" +
- "ЙТЕЗДРАВСТВУЙ",
- minLength: 5,
- maxLength: 5}},
- {command: "D01B" + // Length
- "8103012303" + // Command details
- "82028182" + // Device identities
- "8D0C04456E7465722048656C6C6F" + // Text string
- "910205FF", // Response length
- expect: {commandQualifier: 0x03,
- text: "Enter Hello",
- minLength: 5,
- maxLength: 0xFF}},
- {command: "D081BA" + // Length
- "8103012300" + // Command details
- "82028182" + // Device identities
- "8D0704456E7465723A" + // Text string
- "9102A0A0" + // Response length
- "1781A1042A2A2A313131313131313131312323232A2A2A" + // Default text
- "323232323232323232322323232A2A2A33333333333333" +
- "3333332323232A2A2A343434343434343434342323232A" +
- "2A2A353535353535353535352323232A2A2A3636363636" +
- "36363636362323232A2A2A373737373737373737372323" +
- "232A2A2A383838383838383838382323232A2A2A393939" +
- "393939393939392323232A2A2A30303030303030303030" +
- "232323",
- expect: {commandQualifier: 0x00,
- text: "Enter:",
- minLength: 160,
- maxLength: 160,
- defaultText: "***1111111111###***2222222222###***3333333333###**" +
- "*4444444444###***5555555555###***6666666666###***7" +
- "777777777###***8888888888###***9999999999###***000" +
- "0000000###"}},
- {command: "D01D" + // Length
- "8103012300" + // Command details
- "82028182" + // Device identities
- "8D0A043C4E4F2D49434F4E3E" + // Text string
- "9102000A" + // Response length
- "1E020002", // Icon identifier
- expect: {commandQualifier: 0x00,
- // The record number 02 in EFimg is not defined, so no icon will be
- // shown, but the text string should still be displayed.
- text: "<NO-ICON>",
- minLength: 0,
- maxLength: 10}},
- {command: "D020" + // Length
- "8103012380" + // Command details
- "82028182" + // Device identities
- "8D0D043C42415349432D49434F4E3E" + // Text string
- "9102000A" + // Response length
- "1E020101", // Icon identifier
- expect: {commandQualifier: 0x80,
- text: "<BASIC-ICON>",
- minLength: 0,
- maxLength: 10,
- iconSelfExplanatory: false,
- icons: [BASIC_ICON]}},
-];
-
-function testGetInput(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_GET_INPUT, "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- is(aCommand.options.isAlphabet, !!(aExpect.commandQualifier & 0x01),
- "options.isAlphabet");
- is(aCommand.options.isUCS2, !!(aExpect.commandQualifier & 0x02),
- "options.isUCS2");
- is(aCommand.options.hideInput, !!(aExpect.commandQualifier & 0x04),
- "options.hideInput");
- is(aCommand.options.isPacked, !!(aExpect.commandQualifier & 0x08),
- "options.isPacked");
- is(aCommand.options.isHelpAvailable, !!(aExpect.commandQualifier & 0x80),
- "options.isHelpAvailable");
- is(aCommand.options.text, aExpect.text, "options.text");
- is(aCommand.options.minLength, aExpect.minLength, "options.minLength");
- is(aCommand.options.maxLength, aExpect.maxLength, "options.maxLength");
-
- // defaultText is optional.
- if ("defaultText" in aExpect) {
- is(aCommand.options.defaultText, aExpect.defaultText, "options.defaultText");
- }
-
- // icons is optional.
- if ("icons" in aExpect) {
- isIcons(aCommand.options.icons, aExpect.icons);
- is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
- "options.iconSelfExplanatory");
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("get_input_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testGetInput(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testGetInput(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_launch_browser.js
+++ /dev/null
@@ -1,151 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D018" + // Length
- "8103011500" + // Command details
- "82028182" + // Device identities
- "3100" + // URL
- "050B44656661756C742055524C", // Alpha identifier
- expect: {commandQualifier: 0x00,
- url: "",
- mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED,
- confirmMessage: { text: "Default URL" }}},
- {command: "D01F" + // Length
- "8103011500" + // Command details
- "82028182" + // Device identities
- "3112687474703A2F2F7878782E7979792E7A7A7A" + // URL
- "0500", // Alpha identifier
- expect: {commandQualifier: 0x00,
- url: "http://xxx.yyy.zzz",
- mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED,
- confirmMessage: { text: "" }}},
- {command: "D023" + // Length
- "8103011500" + // Command details
- "82028182" + // Device identities
- "300100" + // Browser identity
- "3100" + // URL
- "320103" + // Bear
- "0D10046162632E6465662E6768692E6A6B6C", // Text string
- expect: {commandQualifier: 0x00,
- // Browser identity, Bear and Text string are useless.
- url: "",
- mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED}},
- {command: "D018" + // Length
- "8103011502" + // Command details
- "82028182" + // Device identities
- "3100" + // URL
- "050B44656661756C742055524C", // Alpha identifier
- expect: {commandQualifier: 0x02,
- url: "",
- mode: MozIccManager.STK_BROWSER_MODE_USING_EXISTING_BROWSER,
- confirmMessage: { text: "Default URL" }}},
- {command: "D018" + // Length
- "8103011503" + // Command details
- "82028182" + // Device identities
- "3100" + // URL
- "050B44656661756C742055524C", // Alpha identifier
- expect: {commandQualifier: 0x03,
- url: "",
- mode: MozIccManager.STK_BROWSER_MODE_USING_NEW_BROWSER,
- confirmMessage: { text: "Default URL"}}},
- {command: "D026" + // Length
- "8103011502" + // Command details
- "82028182" + // Device identities
- "3100" + // URL
- "051980041704140420041004120421042204120423" + // Alpha identifier
- "041904220415",
- expect: {commandQualifier: 0x02,
- url: "",
- mode: MozIccManager.STK_BROWSER_MODE_USING_EXISTING_BROWSER,
- confirmMessage: { text: "ЗДРАВСТВУЙТЕ" }}},
- {command: "D021" + // Length
- "8103011502" + // Command details
- "82028182" + // Device identities
- "3100" + // URL
- "05104E6F742073656C66206578706C616E2E" + // Alpha identifier
- "1E020101", // Icon identifier
- expect: {commandQualifier: 0x02,
- url: "",
- mode: MozIccManager.STK_BROWSER_MODE_USING_EXISTING_BROWSER,
- confirmMessage: { text: "Not self explan.",
- iconSelfExplanatory: false,
- icons : [BASIC_ICON] }
- }},
- {command: "D012" + // Length
- "8103011502" + // Command details
- "82028182" + // Device identities
- "3100" + // URL
- "0505804F60597D", // Alpha identifier
- expect: {commandQualifier: 0x02,
- url: "",
- mode: MozIccManager.STK_BROWSER_MODE_USING_EXISTING_BROWSER,
- confirmMessage: { text: "你好" }}},
- {command: "D00F" + // Length
- "8103011500" + // Command details
- "82028182" + // Device identities
- "3100" + // URL
- "1E020001", // Icon identifier
- expect: {commandQualifier: 0x00,
- url: "",
- mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED,
- confirmMessage: { iconSelfExplanatory: true,
- icons: [BASIC_ICON] }}},
- {command: "D00F" + // Length
- "8103011500" + // Command details
- "82028182" + // Device identities
- "3100" + // URL
- "1E020003", // Icon identifier
- expect: {commandQualifier: 0x00,
- url: "",
- mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED,
- confirmMessage: { iconSelfExplanatory: true,
- icons: [COLOR_ICON] }}},
-];
-
-function testLaunchBrowser(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_LAUNCH_BROWSER,
- "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- is(aCommand.options.url, aExpect.url, "options.url");
- is(aCommand.options.mode, aExpect.mode, "options.mode");
-
- // confirmMessage is optional
- if ("confirmMessage" in aExpect) {
- isStkText(aCommand.options.confirmMessage, aExpect.confirmMessage,
- "options.confirmMessage");
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("launch_browser_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testLaunchBrowser(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testLaunchBrowser(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_local_info.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- // Location
- {command: "D009" + // Length
- "8103012600" + // Command details
- "82028182", // Device identities
- expect: {commandQualifier: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO,
- localInfoType: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO}},
- // Imei
- {command: "D009" + // Length
- "8103012601" + // Command details
- "82028182", // Device identities
- expect: {commandQualifier: MozIccManager.STK_LOCAL_INFO_IMEI,
- localInfoType: MozIccManager.STK_LOCAL_INFO_IMEI}},
- // Data
- {command: "D009" + // Length
- "8103012603" + // Command details
- "82028182", // Device identities
- expect: {commandQualifier: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE,
- localInfoType: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE}},
- // Language
- {command: "D009" + // Length
- "8103012604" + // Command details
- "82028182", // Device identities
- expect: {commandQualifier: MozIccManager.STK_LOCAL_INFO_LANGUAGE,
- localInfoType: MozIccManager.STK_LOCAL_INFO_LANGUAGE}},
-];
-
-function testLocalInfo(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO,
- "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
- is(aCommand.options.localInfoType, aExpect.localInfoType,
- "options.localInfoType");
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("local_info_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testLocalInfo(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testLocalInfo(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_menu_selection.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 30000;
-MARIONETTE_HEAD_JS = "head.js";
-
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
-
- // APDU format of ENVELOPE:
- // Class = 'A0', INS = 'C2', P1 = '00', P2 = '00', XXXX, (No Le)
-
- // Since |sendStkMenuSelection| is an API without call back to identify the
- // result, the tests of |sendStkMenuSelection| must be executed one by one with
- // |verifyWithPeekedStkEnvelope| introduced here.
- return Promise.resolve()
- .then(() => icc.sendStkMenuSelection(1, true))
- .then(() => verifyWithPeekedStkEnvelope(
- "D3" + // BER_MENU_SELECTION_TAG
- "09" + // Length
- "82020181" + // TAG_DEVICE_ID (STK_DEVICE_ID_KEYPAD, STK_DEVICE_ID_SIM)
- "900101" + // TAG_ITEM_ID (Item (1))
- "9500" // TAG_HELP_REQUEST
- ))
-
- .then(() => icc.sendStkMenuSelection(0, false))
- .then(() => verifyWithPeekedStkEnvelope(
- "D3" + // BER_MENU_SELECTION_TAG
- "07" + // Length
- "82020181" + // TAG_DEVICE_ID (STK_DEVICE_ID_KEYPAD, STK_DEVICE_ID_SIM)
- "900100" // TAG_ITEM_ID (Item (0))
- ));
-});
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_play_tone.js
+++ /dev/null
@@ -1,120 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D009" + // Length
- "8103012000" + // Command details
- "82028182", // Device identities
- expect: {commandQualifier: 0x00}},
- {command: "D014" + // Length
- "8103012001" + // Command details
- "82028182" + // Device identities
- "8509506C617920546F6E65", // Alpha identifier
- expect: {commandQualifier: 0x01,
- text: "Play Tone"}},
- {command: "D00B" + // Length
- "8103012001" + // Command details
- "82028182" + // Device identities
- "8500", // Alpha identifier
- expect: {commandQualifier: 0x01,
- text: ""}},
- {command: "D00C" + // Length
- "8103012000" + // Command details
- "82028182" + // Device identities
- "8E0101", // Tone
- expect: {commandQualifier: 0x00,
- tone: 0x01}},
- {command: "D00D" + // Length
- "8103012000" + // Command details
- "82028182" + // Device identities
- "84020205", // Duration
- expect: {commandQualifier: 0x00,
- duration: {timeUnit: MozIccManager.STK_TIME_UNIT_TENTH_SECOND,
- timeInterval: 0x05}}},
- {command: "D00D" + // Length
- "8103012000" + // Command details
- "82028182" + // Device identities
- "1E020101", // Icon identifier
- expect: {commandQualifier: 0x00,
- iconSelfExplanatory: false,
- icons: [BASIC_ICON]}},
- {command: "D01F" + // Length
- "8103012001" + // Command details
- "82028182" + // Device identities
- "8509506C617920546F6E65" + // Alpha identifier
- "8E0101" + // Tone
- "84020202" + // Duration
- "1E020003", // Icon identifier
- expect: {commandQualifier: 0x01,
- text: "Play Tone",
- duration: {timeUnit: MozIccManager.STK_TIME_UNIT_TENTH_SECOND,
- timeInterval: 0x02},
- iconSelfExplanatory: true,
- icons: [COLOR_ICON]}},
-];
-
-function testPlayTone(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_PLAY_TONE, "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- is(aCommand.options.isVibrate, !!(aExpect.commandQualifier & 0x01),
- "options.isVibrate");
-
- // text is optional.
- if ("text" in aExpect) {
- is(aCommand.options.text, aExpect.text, "options.text");
- }
-
- // tone is optional.
- if ("tone" in aExpect) {
- is(aCommand.options.tone, aExpect.tone, "options.tone");
- }
-
- // duration is optional.
- if ("duration" in aExpect) {
- let duration = aCommand.options.duration;
- is(duration.timeUnit, aExpect.duration.timeUnit,
- "options.duration.timeUnit");
- is(duration.timeInterval, aExpect.duration.timeInterval,
- "options.duration.timeInterval");
- }
-
- // icons is optional.
- if ("icons" in aExpect) {
- isIcons(aCommand.options.icons, aExpect.icons);
- is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
- "options.iconSelfExplanatory");
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("play_tone_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testPlayTone(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testPlayTone(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_poll_interval.js
+++ /dev/null
@@ -1,68 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D00D" + // Length
- "8103010300" + // Command details
- "82028182" + // Device identities
- "8402001A", // Duration
- expect: {commandQualifier: 0x00,
- timeUnit: MozIccManager.STK_TIME_UNIT_MINUTE,
- timeInterval: 0x1A}},
- {command: "D00D" + // Length
- "8103010300" + // Command details
- "82028182" + // Device identities
- "8402010A", // Duration
- expect: {commandQualifier: 0x00,
- timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
- timeInterval: 0x0A}},
- {command: "D00D" + // Length
- "8103010300" + // Command details
- "82028182" + // Device identities
- "84020205", // Duration
- expect: {commandQualifier: 0x00,
- timeUnit: MozIccManager.STK_TIME_UNIT_TENTH_SECOND,
- timeInterval: 0x05}},
-];
-
-function testPollOff(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_POLL_INTERVAL,
- "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
- is(aCommand.options.timeUnit, aExpect.timeUnit,
- "options.timeUnit");
- is(aCommand.options.timeInterval, aExpect.timeInterval,
- "options.timeInterval");
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("poll_interval_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testPollOff(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testPollOff(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_poll_off.js
+++ /dev/null
@@ -1,46 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D009" + // Length
- "8103010400" + // Command details
- "82028182", // Device identities
- expect: {commandQualifier: 0x00}}
-];
-
-function testPollOff(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_POLL_OFF, "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("poll_off_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testPollOff(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testPollOff(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_refresh.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D010" + // Length
- "8103010101" + // Command details
- "82028182" + // Device identities
- "9205013F002FE2", // File list
- expect: {commandQualifier: 0x01}},
- {command: "D009" + // Length
- "8103010104" + // Command details
- "82028182", // Device identities
- expect: {commandQualifier: 0x04}}
-];
-
-function testRefresh(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_REFRESH, "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("refresh_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testRefresh(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testRefresh(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_response.js
+++ /dev/null
@@ -1,288 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 120000;
-MARIONETTE_HEAD_JS = "head.js";
-
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
-
- // APDU format of TERMINAL RESPONSE:
- // Class = 'A0', INS = '14', P1 = '00', P2 = '00', XXXX, (No Le)
-
- // Since |sendStkResponse| is an API without call back to identify the
- // result, the tests of |sendStkResponse| must be executed one by one with
- // |verifyWithPeekedStkResponse| introduced here.
- return Promise.resolve()
- .then(() => icc.sendStkResponse({
- commandNumber: 0x01,
- typeOfCommand: MozIccManager.STK_CMD_LAUNCH_BROWSER,
- commandQualifier: 0x00,
- options: {
- url: "",
- mode: MozIccManager.STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED
- }
- }, {
- resultCode: MozIccManager.STK_RESULT_OK
- }))
- .then(() => verifyWithPeekedStkResponse(
- "8103011500" + // TAG_COMMAND_DETAILS (STK_CMD_LAUNCH_BROWSER)
- "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "830100" // TAG_RESULT (STK_RESULT_OK)
- ))
-
- .then(() => icc.sendStkResponse({
- commandNumber: 0x02,
- typeOfCommand: MozIccManager.STK_CMD_DISPLAY_TEXT,
- commandQualifier: 0x01,
- options: {
- text: "Toolkit Test 1",
- responseNeeded: false
- }
- }, {
- resultCode:
- MozIccManager.STK_RESULT_TERMINAL_CRNTLY_UNABLE_TO_PROCESS,
- additionalInformation:
- MozIccManager.STK_ADDITIONAL_INFO_ME_PROBLEM_SCREEN_IS_BUSY
- }))
- .then(() => verifyWithPeekedStkResponse(
- "8103022101" + // TAG_COMMAND_DETAILS (STK_CMD_DISPLAY_TEXT)
- "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "83022001" // TAG_RESULT (STK_ADDITIONAL_INFO_ME_PROBLEM_SCREEN_IS_BUSY)
- ))
-
- .then(() => icc.sendStkResponse({
- commandNumber: 0x03,
- typeOfCommand: MozIccManager.STK_CMD_SELECT_ITEM,
- commandQualifier: 0x00,
- options: {
- title: "Toolkit Select",
- items: [{identifier: 1, text: "Item 1"},
- {identifier: 2, text: "Item 2"},
- {identifier: 3, text: "Item 3"},
- {identifier: 4, text: "Item 4"}]
- }
- }, {
- resultCode: MozIccManager.STK_RESULT_HELP_INFO_REQUIRED,
- itemIdentifier: 5
- }))
- .then(() => verifyWithPeekedStkResponse(
- "8103032400" + // TAG_COMMAND_DETAILS (STK_CMD_SELECT_ITEM)
- "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "830113" + // TAG_RESULT (STK_RESULT_HELP_INFO_REQUIRED)
- "900105" // TAG_ITEM_ID (5)
- ))
-
- .then(() => icc.sendStkResponse({
- commandNumber: 0x04,
- typeOfCommand: MozIccManager.STK_CMD_GET_INKEY,
- commandQualifier: 0x04,
- options: {
- text: "Enter Y/N"
- }
- }, {
- resultCode: MozIccManager.STK_RESULT_OK,
- isYesNo: true
- }))
- .then(() => verifyWithPeekedStkResponse(
- "8103042204" + // TAG_COMMAND_DETAILS (STK_CMD_GET_INKEY)
- "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "830100" + // TAG_RESULT (STK_RESULT_OK)
- "8D020401" // TAG_TEXT_STRING (STK_TEXT_CODING_GSM_8BIT, YES)
- ))
-
- .then(() => icc.sendStkResponse({
- commandNumber: 0x05,
- typeOfCommand: MozIccManager.STK_CMD_GET_INKEY,
- commandQualifier: 0x04,
- options: {
- text: "Enter Y/N",
- duration: {
- timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
- timeInterval: 10
- }
- }
- }, {
- resultCode: MozIccManager.STK_RESULT_NO_RESPONSE_FROM_USER,
- }))
- .then(() => verifyWithPeekedStkResponse(
- "8103052204" + // TAG_COMMAND_DETAILS (STK_CMD_GET_INKEY)
- "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "830112" + // TAG_RESULT (STK_RESULT_NO_RESPONSE_FROM_USER)
- "0402010A" // TAG_DURATION (10 seconds)
- ))
-
- .then(() => icc.sendStkResponse({
- commandNumber: 0x06,
- typeOfCommand: MozIccManager.STK_CMD_GET_INPUT,
- commandQualifier: 0x01,
- options: {
- text: "Enter Yes"
- }
- }, {
- resultCode: MozIccManager.STK_RESULT_OK,
- input: "Yes"
- }))
- .then(() => verifyWithPeekedStkResponse(
- "8103062301" + // TAG_COMMAND_DETAILS (STK_CMD_GET_INPUT)
- "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "830100" + // TAG_RESULT (STK_RESULT_OK)
- "8D0404596573" // TAG_TEXT_STRING (STK_TEXT_CODING_GSM_8BIT, "Yes")
- ))
-
- .then(() => icc.sendStkResponse({
- commandNumber: 0x07,
- typeOfCommand: MozIccManager.STK_CMD_TIMER_MANAGEMENT,
- commandQualifier: MozIccManager.STK_TIMER_START,
- options: {
- timerAction: MozIccManager.STK_TIMER_START,
- timerId: 0x01,
- timerValue: (0x01 * 60 * 60) + (0x02 * 60) + 0x03 // 01:02:03
- }
- }, {
- resultCode: MozIccManager.STK_RESULT_OK,
- timer: {
- timerAction: MozIccManager.STK_TIMER_START,
- timerId: 0x01,
- timerValue: (0x01 * 60 * 60) + (0x02 * 60) + 0x03 // 01:02:03
- },
- }))
- .then(() => verifyWithPeekedStkResponse(
- "8103072700" + // TAG_COMMAND_DETAILS (STK_CMD_TIMER_MANAGEMENT)
- "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "830100" + // TAG_RESULT (STK_RESULT_OK)
- "240101" + // TIMER_IDENTIFIER (TIMER ID = 1)
- "2503102030" // TAG_TIMER_VALUE
- ))
-
- .then(() => icc.sendStkResponse({
- commandNumber: 0x08,
- typeOfCommand: MozIccManager.STK_CMD_TIMER_MANAGEMENT,
- commandQualifier: MozIccManager.STK_TIMER_DEACTIVATE,
- options: {
- timerAction: MozIccManager.STK_TIMER_DEACTIVATE,
- timerId: 0x02,
- timerValue: (0x01 * 60 * 60) + (0x02 * 60) + 0x03 // 01:02:03
- }
- }, {
- resultCode: MozIccManager.STK_RESULT_OK,
- timer: {
- timerId: 0x02
- },
- }))
- .then(() => verifyWithPeekedStkResponse(
- "8103082701" + // TAG_COMMAND_DETAILS (STK_CMD_TIMER_MANAGEMENT)
- "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "830100" + // TAG_RESULT (STK_RESULT_OK)
- "240102" // TIMER_IDENTIFIER (TIMER ID = 2)
- ))
-
- .then(() => icc.sendStkResponse({
- commandNumber: 0x09,
- typeOfCommand: MozIccManager.STK_CMD_TIMER_MANAGEMENT,
- commandQualifier: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
- options: {
- timerAction: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
- timerId: 0x03,
- }
- }, {
- resultCode: MozIccManager.STK_RESULT_ACTION_CONTRADICTION_TIMER_STATE,
- timer: {
- timerId: 0x03
- },
- }))
- .then(() => verifyWithPeekedStkResponse(
- "8103092702" + // TAG_COMMAND_DETAILS (STK_CMD_TIMER_MANAGEMENT)
- "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "830124" + // TAG_RESULT (STK_RESULT_ACTION_CONTRADICTION_TIMER_STATE)
- "240103" // TIMER_IDENTIFIER (TIMER ID = 3)
- ))
-
- .then(() => icc.sendStkResponse({
- commandNumber: 0x0A,
- typeOfCommand: MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO,
- commandQualifier: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO,
- options: {
- localInfoType: MozIccManager.STK_LOCAL_INFO_LOCATION_INFO
- }
- }, {
- resultCode: MozIccManager.STK_RESULT_OK,
- localInfo: {
- locationInfo: {
- mcc: "466",
- mnc: "92",
- gsmLocationAreaCode: 10291,
- gsmCellId: 19072823
- }
- },
- }))
- .then(() => verifyWithPeekedStkResponse(
- "81030A2600" + // TAG_COMMAND_DETAILS (STK_CMD_PROVIDE_LOCAL_INFO)
- "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "830100" + // TAG_RESULT (STK_RESULT_OK)
- "930964F629283301230737" // TAG_LOCATION_INFO (mccmnc = 46692, lac = 10291, cellId = 19072823)
- ))
-
- .then(() => icc.sendStkResponse({
- commandNumber: 0x0B,
- typeOfCommand: MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO,
- commandQualifier: MozIccManager.STK_LOCAL_INFO_IMEI,
- options: {
- localInfoType: MozIccManager.STK_LOCAL_INFO_IMEI
- }
- }, {
- resultCode: MozIccManager.STK_RESULT_OK,
- localInfo: {
- imei: "123456789012345"
- },
- }))
- .then(() => verifyWithPeekedStkResponse(
- "81030B2601" + // TAG_COMMAND_DETAILS (STK_CMD_PROVIDE_LOCAL_INFO)
- "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "830100" + // TAG_RESULT (STK_RESULT_OK)
- "14081234567890123450" // TAG_IMEI ("123456789012345")
- ))
-
- .then(() => icc.sendStkResponse({
- commandNumber: 0x0C,
- typeOfCommand: MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO,
- commandQualifier: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE,
- options: {
- localInfoType: MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE
- }
- }, {
- resultCode: MozIccManager.STK_RESULT_OK,
- localInfo: {
- // 2012, 3/4, 5:06:07 (Month is zero-based)
- date: new Date(Date.UTC(2012, 2, 4, 5, 6, 7))
- },
- }))
- .then(() => verifyWithPeekedStkResponse(
- "81030C2603" + // TAG_COMMAND_DETAILS (STK_CMD_PROVIDE_LOCAL_INFO)
- "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "830100" + // TAG_RESULT (STK_RESULT_OK)
- "260721304050607000" // TAG_DATE_TIME_ZONE ("2012, 3/4, 5:06:07" in UTC)
- ))
-
- .then(() => icc.sendStkResponse({
- commandNumber: 0x0D,
- typeOfCommand: MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO,
- commandQualifier: MozIccManager.STK_LOCAL_INFO_LANGUAGE,
- options: {
- localInfoType: MozIccManager.STK_LOCAL_INFO_LANGUAGE
- }
- }, {
- resultCode: MozIccManager.STK_RESULT_OK,
- localInfo: {
- language: "zh"
- },
- }))
- .then(() => verifyWithPeekedStkResponse(
- "81030D2604" + // TAG_COMMAND_DETAILS (STK_CMD_PROVIDE_LOCAL_INFO)
- "02028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "830100" + // TAG_RESULT (STK_RESULT_OK)
- "2D027A68" // TAG_LANGUAGE ("zh")
- ));
-});
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_select_item.js
+++ /dev/null
@@ -1,347 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D03D" + // Length
- "8103012400" + // Command details
- "82028182" + // Device identities
- "850E546F6F6C6B69742053656C656374" + // Alpha identifier
- "8F07014974656D2031" + // Item
- "8F07024974656D2032" + // Item
- "8F07034974656D2033" + // Item
- "8F07044974656D2034", // Item
- expect: {commandQualifier: 0x00,
- title: "Toolkit Select",
- items: [{identifier: 1, text: "Item 1"},
- {identifier: 2, text: "Item 2"},
- {identifier: 3, text: "Item 3"},
- {identifier: 4, text: "Item 4"}]}},
- {command: "D081FC" + // Length
- "8103012400" + // Command details
- "82028182" + // Device identities
- "850A4C617267654D656E7531" + // Alpha identifier
- "8F05505A65726F" + // Item
- "8F044F4F6E65" + // Item
- "8F044E54776F" + // Item
- "8F064D5468726565" + // Item
- "8F054C466F7572" + // Item
- "8F054B46697665" + // Item
- "8F044A536978" + // Item
- "8F0649536576656E" + // Item
- "8F06484569676874" + // Item
- "8F05474E696E65" + // Item
- "8F0646416C706861" + // Item
- "8F0645427261766F" + // Item
- "8F0844436861726C6965" + // Item
- "8F064344656C7461" + // Item
- "8F05424563686F" + // Item
- "8F0941466F782D74726F74" + // Item
- "8F0640426C61636B" + // Item
- "8F063F42726F776E" + // Item
- "8F043E526564" + // Item
- "8F073D4F72616E6765" + // Item
- "8F073C59656C6C6F77" + // Item
- "8F063B477265656E" + // Item
- "8F053A426C7565" + // Item
- "8F073956696F6C6574" + // Item
- "8F053847726579" + // Item
- "8F06375768697465" + // Item
- "8F06366D696C6C69" + // Item
- "8F06356D6963726F" + // Item
- "8F05346E616E6F" + // Item
- "8F05337069636F", // Item
- expect: {commandQualifier: 0x00,
- title: "LargeMenu1",
- items: [{identifier: 80, text: "Zero"},
- {identifier: 79, text: "One"},
- {identifier: 78, text: "Two"},
- {identifier: 77, text: "Three"},
- {identifier: 76, text: "Four"},
- {identifier: 75, text: "Five"},
- {identifier: 74, text: "Six"},
- {identifier: 73, text: "Seven"},
- {identifier: 72, text: "Eight"},
- {identifier: 71, text: "Nine"},
- {identifier: 70, text: "Alpha"},
- {identifier: 69, text: "Bravo"},
- {identifier: 68, text: "Charlie"},
- {identifier: 67, text: "Delta"},
- {identifier: 66, text: "Echo"},
- {identifier: 65, text: "Fox-trot"},
- {identifier: 64, text: "Black"},
- {identifier: 63, text: "Brown"},
- {identifier: 62, text: "Red"},
- {identifier: 61, text: "Orange"},
- {identifier: 60, text: "Yellow"},
- {identifier: 59, text: "Green"},
- {identifier: 58, text: "Blue"},
- {identifier: 57, text: "Violet"},
- {identifier: 56, text: "Grey"},
- {identifier: 55, text: "White"},
- {identifier: 54, text: "milli"},
- {identifier: 53, text: "micro"},
- {identifier: 52, text: "nano"},
- {identifier: 51, text: "pico"}]}},
- {command: "D081FB" + // Length
- "8103012400" + // Command details
- "82028182" + // Device identities
- "850A4C617267654D656E7532" + // Alpha identifier
- "8F1EFF43616C6C20466F7277617264696E6720556E636F6E6469" + // Item
- "74696F6E616C" +
- "8F1DFE43616C6C20466F7277617264696E67204F6E2055736572" + // Item
- "2042757379" +
- "8F1CFD43616C6C20466F7277617264696E67204F6E204E6F2052" + // Item
- "65706C79" +
- "8F26FC43616C6C20466F7277617264696E67204F6E2055736572" + // Item
- "204E6F7420526561636861626C65" +
- "8F1EFB42617272696E67204F6620416C6C204F7574676F696E67" + // Item
- "2043616C6C73" +
- "8F2CFA42617272696E67204F6620416C6C204F7574676F696E67" + // Item
- "20496E7465726E6174696F6E616C2043616C6C73" +
- "8F11F9434C492050726573656E746174696F6E", // Item
- expect: {commandQualifier: 0x00,
- title: "LargeMenu2",
- items: [{identifier: 255, text: "Call Forwarding Unconditional"},
- {identifier: 254, text: "Call Forwarding On User Busy"},
- {identifier: 253, text: "Call Forwarding On No Reply"},
- {identifier: 252, text: "Call Forwarding On User Not Reachable"},
- {identifier: 251, text: "Barring Of All Outgoing Calls"},
- {identifier: 250, text: "Barring Of All Outgoing International Calls"},
- {identifier: 249, text: "CLI Presentation"}]}},
- {command: "D081FD" + // Length
- "8103012400" + // Command details
- "82028182" + // Device identities
- "8581ED5468652053494D207368616C6C20737570" + // Alpha identifier
- "706C79206120736574206F66206974656D732066" +
- "726F6D207768696368207468652075736572206D" +
- "61792063686F6F7365206F6E652E204561636820" +
- "6974656D20636F6D70726973657320612073686F" +
- "7274206964656E74696669657220287573656420" +
- "746F20696E646963617465207468652073656C65" +
- "6374696F6E2920616E6420612074657874207374" +
- "72696E672E204F7074696F6E616C6C7920746865" +
- "2053494D206D617920696E636C75646520616E20" +
- "616C706861206964656E7469666965722E205468" +
- "6520616C706861206964656E7469666965722069" +
- "8F020159", // Item
- expect: {commandQualifier: 0x00,
- title: "The SIM shall supply a set of items from which the user " +
- "may choose one. Each item comprises a short identifier " +
- "(used to indicate the selection) and a text string. " +
- "Optionally the SIM may include an alpha identifier. " +
- "The alpha identifier i",
- items: [{identifier: 1, text: "Y"}]}},
- {command: "D039" + // Length
- "8103012400" + // Command details
- "82028182" + // Device identities
- "850E546F6F6C6B69742053656C656374" + // Alpha identifier
- "8F07014974656D2031" + // Item
- "8F07024974656D2032" + // Item
- "8F07034974656D2033" + // Item
- "1803131026", // Items next action indicator
- expect: {commandQualifier: 0x00,
- title: "Toolkit Select",
- items: [{identifier: 1, text: "Item 1"},
- {identifier: 2, text: "Item 2"},
- {identifier: 3, text: "Item 3"}],
- nextActionList: [MozIccManager.STK_CMD_SEND_SMS,
- MozIccManager.STK_CMD_SET_UP_CALL,
- MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
- {command: "D03E" + // Length
- "8103012400" + // Command details
- "82028182" + // Device identities
- "850E546F6F6C6B69742053656C656374" + // Alpha identifier
- "8F07014974656D2031" + // Item
- "8F07024974656D2032" + // Item
- "8F07034974656D2033" + // Item
- "9E020101" + // Icon identifier
- "9F0401030303", // Item icon identifier list
- expect: {commandQualifier: 0x00,
- title: "Toolkit Select",
- iconSelfExplanatory: false,
- icons: [BASIC_ICON],
- items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: false, icons: [COLOR_ICON]},
- {identifier: 2, text: "Item 2", iconSelfExplanatory: false, icons: [COLOR_ICON]},
- {identifier: 3, text: "Item 3", iconSelfExplanatory: false, icons: [COLOR_ICON]}]}},
- {command: "D028" + // Length
- "8103012400" + // Command details
- "82028182" + // Device identities
- "850E546F6F6C6B69742053656C656374" + // Alpha identifier
- "8F0101" + // Item
- "8F0102" + // Item
- "8F0103" + // Item
- "9F0400050505", // Item icon identifier list
- expect: {commandQualifier: 0x00,
- title: "Toolkit Select",
- items: [{identifier: 1, text: "", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
- {identifier: 2, text: "", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
- {identifier: 3, text: "", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]}]}},
- {command: "D034" + // Length
- "8103012483" + // Command details
- "82028182" + // Device identities
- "850E546F6F6C6B69742053656C656374" + // Alpha identifier
- "8F07014974656D2031" + // Item
- "8F07024974656D2032" + // Item
- "8F07034974656D2033", // Item
- expect: {commandQualifier: 0x83,
- title: "Toolkit Select",
- items: [{identifier: 1, text: "Item 1"},
- {identifier: 2, text: "Item 2"},
- {identifier: 3, text: "Item 3"}]}},
- {command: "D03D" + // Length
- "8103012400" + // Command details
- "82028182" + // Device identities
- "8510546F6F6C6B69742053656C6563742031" + // Alpha identifier
- "8F07014974656D2031" + // Item
- "8F07024974656D2032" + // Item
- "D004001000B4" + // Text attribute
- "D108000600B4000600B4", // Item text attribute list
- expect: {commandQualifier: 0x00,
- title: "Toolkit Select 1",
- items: [{identifier: 1, text: "Item 1"},
- {identifier: 2, text: "Item 2"}]}},
- {command: "D069" + // Length
- "8103012400" + // Command details
- "82028182" + // Device identities
- "851980041704140420041004120421042204120423041904220415" + // Alpha identifier
- "8F1C01800417041404200410041204210422041204230419042204150031" + // Item
- "8F1102810D089794A09092A1A292A399A29532" + // Item
- "8F1203820D041087849080829192829389928533", // Item
- expect: {commandQualifier: 0x00,
- title: "ЗДРАВСТВУЙТЕ",
- items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"},
- {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"},
- {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"}]}},
- {command: "D038" + // Length
- "8103012400" + // Command details
- "82028182" + // Device identities
- "8509800038003030EB0030" + // Alpha identifier
- "8F0A01800038003030EB0031" + // Item
- "8F0A02800038003030EB0032" + // Item
- "8F0A03800038003030EB0033", // Item
- expect: {commandQualifier: 0x00,
- title: "80ル0",
- items: [{identifier: 1, text: "80ル1"},
- {identifier: 2, text: "80ル2"},
- {identifier: 3, text: "80ル3"}]}},
- {command: "D030" + // Length
- "8103012400" + // Command details
- "82028182" + // Device identities
- "85078104613831EB30" + // Alpha identifier
- "8F08018104613831EB31" + // Item
- "8F08028104613831EB32" + // Item
- "8F08038104613831EB33", // Item
- expect: {commandQualifier: 0x00,
- title: "81ル0",
- items: [{identifier: 1, text: "81ル1"},
- {identifier: 2, text: "81ル2"},
- {identifier: 3, text: "81ル3"}]}},
- {command: "D034" + // Length
- "8103012400" + // Command details
- "82028182" + // Device identities
- "8508820430A03832CB30" + // Alpha identifier
- "8F0901820430A03832CB31" + // Item
- "8F0902820430A03832CB32" + // Item
- "8F0903820430A03832CB33", // Item
- expect: {commandQualifier: 0x00,
- title: "82ル0",
- items: [{identifier: 1, text: "82ル1"},
- {identifier: 2, text: "82ル2"},
- {identifier: 3, text: "82ル3"}]}},
- {command: "D03C" + // Length
- "8103012400" + // Command details
- "82028182" + // Device identities
- "850E546F6F6C6B69742053656C656374" + // Alpha identifier
- "8F07014974656D2031" + // Item
- "8F07024974656D2032" + // Item
- "8F07034974656D2033" + // Item
- "1803000081" + // Items next action indicator
- "100102", // Item identifier
- expect: {commandQualifier: 0x00,
- title: "Toolkit Select",
- items: [{identifier: 1, text: "Item 1"},
- {identifier: 2, text: "Item 2"},
- {identifier: 3, text: "Item 3"}],
- nextActionList: [MozIccManager.STK_NEXT_ACTION_NULL,
- MozIccManager.STK_NEXT_ACTION_NULL,
- MozIccManager.STK_NEXT_ACTION_END_PROACTIVE_SESSION],
- defaultItem: 1}},
-];
-
-function testSelectItem(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SELECT_ITEM, "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- is(aCommand.options.presentationType, aCommand.commandQualifier & 0x03,
- "presentationType");
- is(aCommand.options.isHelpAvailable, !!(aCommand.commandQualifier & 0x80),
- "isHelpAvailable");
- is(aCommand.options.title, aExpect.title, "options.title");
-
- for (let index in aExpect.items) {
- let item = aCommand.options.items[index];
- let itemExpect = aExpect.items[index];
- is(item.identifier, itemExpect.identifier,
- "options.items[" + index + "].identifier");
- is(item.text, itemExpect.text,
- "options.items[" + index + "].text");
-
- if (itemExpect.icons) {
- isIcons(item.icons, itemExpect.icons);
- is(item.iconSelfExplanatory, itemExpect.iconSelfExplanatory,
- "options.items[" + index + "].iconSelfExplanatory");
- }
- }
-
- // icons is optional.
- if ("icons" in aExpect) {
- isIcons(aCommand.options.icons, aExpect.icons);
- is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
- "options.iconSelfExplanatory");
- }
-
- // nextActionList is optional.
- if ("nextActionList" in aExpect) {
- for (let index in aExpect.nextActionList) {
- is(aCommand.options.nextActionList[index], aExpect.nextActionList[index],
- "options.nextActionList[" + index + "]");
- }
- }
-
- // defaultItem is optional.
- if ("defaultItem" in aExpect) {
- is(aCommand.options.defaultItem, aExpect.defaultItem, "options.defaultItem");
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("select_item_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testSelectItem(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testSelectItem(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_send_dtmf.js
+++ /dev/null
@@ -1,145 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D01B" + // Length
- "8103011400" + // Command details
- "82028183" + // Device identities
- "850953656E642044544D46" + // Alpha identifier
- "AC052143658709", // DTMF string
- expect: {commandQualifier: 0x00,
- text: "Send DTMF"}},
- {command: "D010" + // Length
- "8103011400" + // Command details
- "82028183" + // Device identities
- "AC052143658709", // DTMF string
- expect: {commandQualifier: 0x00}},
- {command: "D011" + // Length
- "8103011400" + // Command details
- "82028183" + // Device identities
- "AC06C1CCCCCCCC2C", // DTMF string
- expect: {commandQualifier: 0x00}},
- {command: "D01D" + // Length
- "8103011400" + // Command details
- "82028183" + // Device identities
- "850A42617369632049636F6E" + // Alpha identifier
- "AC02C1F2" + // DTMF string
- "9E020001", // Icon identifier
- expect: {commandQualifier: 0x00,
- text: "Basic Icon",
- iconSelfExplanatory: true,
- icons: [BASIC_ICON]}},
- {command: "D011" + // Length
- "8103011400" + // Command details
- "82028183" + // Device identities
- "AC02C1F2" + // DTMF string
- "9E020005", // Icon identifier
- expect: {commandQualifier: 0x00,
- iconSelfExplanatory: true,
- icons: [COLOR_TRANSPARENCY_ICON]}},
- {command: "D028" + // Length
- "8103011400" + // Command details
- "82028183" + // Device identities
- "851980041704140420041004120421042204120423041904220415" + // Alpha identifier
- "AC02C1F2", // DTMF string
- expect: {commandQualifier: 0x00,
- text: "ЗДРАВСТВУЙТЕ"}},
- {command: "D023" + // Length
- "8103011400" + // Command details
- "82028183" + // Device identities
- "850B53656E642044544D462031" + // Alpha identifier
- "AC052143658709" + // DTMF string
- "D004000B00B4", // Text attribute
- expect: {commandQualifier: 0x00,
- text: "Send DTMF 1"}},
- {command: "D014" + // Length
- "8103011400" + // Command details
- "82028183" + // Device identities
- "8505804F60597D" + // Alpha identifier
- "AC02C1F2", // DTMF string
- expect: {commandQualifier: 0x00,
- text: "你好"}},
-];
-
-const TEST_CMD_NULL_ALPHA_ID =
- "D013" + // Length
- "8103011400" + // Command details
- "82028183" + // Device identities
- "8500" + // Alpha identifier
- "AC06C1CCCCCCCC2C";
-
-function verifySendDTMF(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_DTMF, "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- // text is optional.
- if ("text" in aExpect) {
- is(aCommand.options.text, aExpect.text, "options.text");
- }
-
- // icons is optional.
- if ("icons" in aExpect) {
- isIcons(aCommand.options.icons, aExpect.icons);
- is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
- "options.iconSelfExplanatory");
- }
-}
-
-function testSendDTMF() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("send_dtmf_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => verifySendDTMF(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- verifySendDTMF(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-}
-
-function testSendDTMFNullAlphaId() {
- let icc = getMozIcc();
-
- // No "stkcommand" event should occur.
- icc.addEventListener("stkcommand",
- (event) => ok(false, event + " should not occur."));
-
- // No "icc-stkcommand" system message should be sent.
- workingFrame.contentWindow.navigator.mozSetMessageHandler("icc-stkcommand",
- (msg) => ok(false, msg + " should not be sent."));
-
- // If nothing happens within 3 seconds after the emulator command sent,
- // treat as success.
- log("send_dtmf_cmd: " + TEST_CMD_NULL_ALPHA_ID);
- return sendEmulatorStkPdu(TEST_CMD_NULL_ALPHA_ID)
- .then(() => new Promise(function(resolve, reject) {
- setTimeout(() => resolve(), 3000);
- }));
-}
-
-
-// Start tests
-startTestCommon(function() {
- return Promise.resolve()
- .then(() => testSendDTMF())
- .then(() => testSendDTMFNullAlphaId());
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_send_sms.js
+++ /dev/null
@@ -1,240 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D02E" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "86099111223344556677F8" + // Address
- "8B180100099110325476F840F40C54657374204D657373616765", // 3GPP-SMS TPDU
- expect: {commandQualifier: 0x00}},
- {command: "D03D" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "850D53686F7274204D657373616765" + // Alpha identifier
- "86099111223344556677F8" + // Address
- "8B180100099110325476F840F00D53F45B4E0735CBF379F85C06", // 3GPP-SMS TPDU
- expect: {commandQualifier: 0x00,
- text: "Short Message"}},
- {command: "D081FD" + // Length
- "8103011301" + // Command details
- "82028183" + // Device identities
- "853854686520616464726573732064617461206F62" + // Alpha identifier
- "6A65637420686F6C64732074686520525011446573" +
- "74696E6174696F6E1141646472657373" +
- "86099111223344556677F8" + // Address
- "8B81AC0100099110325476F840F4A054776F20747970" + // 3GPP-SMS TPDU
- "65732061726520646566696E65643A202D2041207368" +
- "6F7274206D65737361676520746F2062652073656E74" +
- "20746F20746865206E6574776F726B20696E20616E20" +
- "534D532D5355424D4954206D6573736167652C206F72" +
- "20616E20534D532D434F4D4D414E44206D6573736167" +
- "652C2077686572652074686520757365722064617461" +
- "2063616E20626520706173736564207472616E7370",
- expect: {commandQualifier: 0x01,
- text: "The address data object holds the RP_Destination_Address"}},
- {command: "D081C3" + // Length
- "8103011301" + // Command details
- "82028183" + // Device identities
- "86099111223344556677F8" + // Address
- "8B81AC0100099110325476F840F4A054776F20747970" + // 3GPP-SMS TPDU
- "65732061726520646566696E65643A202D2041207368" +
- "6F7274206D65737361676520746F2062652073656E74" +
- "20746F20746865206E6574776F726B20696E20616E20" +
- "534D532D5355424D4954206D6573736167652C206F72" +
- "20616E20534D532D434F4D4D414E44206D6573736167" +
- "652C2077686572652074686520757365722064617461" +
- "2063616E20626520706173736564207472616E7370",
- expect: {commandQualifier: 0x01}},
- {command: "D081FD" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "8581E654776F207479706573206172652064656669" + // Alpha identifier
- "6E65643A202D20412073686F7274206D6573736167" +
- "6520746F2062652073656E7420746F20746865206E" +
- "6574776F726B20696E20616E20534D532D5355424D" +
- "4954206D6573736167652C206F7220616E20534D53" +
- "2D434F4D4D414E44206D6573736167652C20776865" +
- "726520746865207573657220646174612063616E20" +
- "626520706173736564207472616E73706172656E74" +
- "6C793B202D20412073686F7274206D657373616765" +
- "20746F2062652073656E7420746F20746865206E65" +
- "74776F726B20696E20616E20534D532D5355424D49" +
- "5420" +
- "8B09010002911040F00120", // 3GPP-SMS TPDU
- expect: {commandQualifier: 0x00,
- text: "Two types are defined: - A short message to be sent to " +
- "the network in an SMS-SUBMIT message, or an SMS-COMMAND " +
- "message, where the user data can be passed transparently; " +
- "- A short message to be sent to the network in an " +
- "SMS-SUBMIT "}},
- {command: "D02E" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "86099111223344556677F8" + // Address
- "8B180100099110325476F840F40C54657374204D657373616765", // 3GPP-SMS TPDU
- expect: {commandQualifier: 0x00}},
- {command: "D055" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "851980041704140420041004120421042204120423041904220415" + // Alpha identifier
- "86099111223344556677F8" + // Address
- "8B240100099110325476F8400818041704140420041004120421042204120423041904220415", // 3GPP-SMS TPDU
- expect: {commandQualifier: 0x00,
- text: "ЗДРАВСТВУЙТЕ"}},
- {command: "D04B" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "850F810C089794A09092A1A292A399A295" + // Alpha identifier
- "86099111223344556677F8" + // Address
- "8B240100099110325476F8400818041704140420041004120421042204120423041904220415", // 3GPP-SMS TPDU
- expect: {commandQualifier: 0x00,
- text: "ЗДРАВСТВУЙТЕ"}},
- {command: "D03B" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "85074E4F2049434F4E" + // Alpha identifier
- "86099111223344556677F8" + // Address
- "8B180100099110325476F840F40C54657374204D657373616765" + // 3GPP-SMS TPDU
- "9E020002", // Icon identifier
- expect: {commandQualifier: 0x00,
- // The record number 02 in EFimg is not defined, so no icon will be
- // shown, but the text string should still be displayed.
- text: "NO ICON"}},
- {command: "D032" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "86099111223344556677F8" + // Address
- "8B180100099110325476F840F40C54657374204D657373616765" + // 3GPP-SMS TPDU
- "9E020001", // Icon identifier
- expect: {commandQualifier: 0x00,
- iconSelfExplanatory: true,
- icons: [BASIC_ICON]}},
- {command: "D03B" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "850753656E6420534D" + // Alpha identifier
- "86099111223344556677F8" + // Address
- "8B180100099110325476F840F40C54657374204D657373616765" + // 3GPP-SMS TPDU
- "1E020101", // Icon identifier
- expect: {commandQualifier: 0x00,
- text: "Send SM",
- iconSelfExplanatory: false,
- icons: [BASIC_ICON]}},
- {command: "D02C" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "851054657874204174747269627574652031" + // Alpha identifier
- "8B09010002911040F00120" + // 3GPP-SMS TPDU
- "D004001000B4", // Text attribute
- expect: {commandQualifier: 0x00,
- text: "Text Attribute 1"}},
- {command: "D035" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "8509800038003030EB0030" + // Alpha identifier
- "86099111223344556677F8" + // Address
- "8B140100099110325476F84008080038003030EB0031",
- expect: {commandQualifier: 0x00, // 3GPP-SMS TPDU
- text: "80ル0"}},
- {command: "D033" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "85078104613831EB31" + // Alpha identifier
- "86099111223344556677F8" + // Address
- "8B140100099110325476F84008080038003030EB0032",
- expect: {commandQualifier: 0x00, // 3GPP-SMS TPDU
- text: "81ル1"}},
- {command: "D034" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "8508820430A03832CB32" + // Alpha identifier
- "86099111223344556677F8" + // Address
- "8B140100099110325476F84008080038003030EB0033",
- expect: {commandQualifier: 0x00, // 3GPP-SMS TPDU
- text: "82ル2"}},
-];
-
-const TEST_CMD_NULL_ALPHA_ID =
- "D030" + // Length
- "8103011300" + // Command details
- "82028183" + // Device identities
- "8500" + // Alpha identifier
- "86099111223344556677F8" + // Address
- "8B180100099110325476F840F40C54657374204D657373616765"; // 3GPP-SMS TPDU
-
-function verifySendSMS(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_SMS, "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- // text is optional.
- if ("text" in aExpect) {
- is(aCommand.options.text, aExpect.text, "options.text");
- }
-
- // icons is optional.
- if ("icons" in aExpect) {
- isIcons(aCommand.options.icons, aExpect.icons);
- is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
- "options.iconSelfExplanatory");
- }
-}
-
-// Test normal cases of send SMS proactive command
-function testSendSMS() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("send_sms_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => verifySendSMS(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- verifySendSMS(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-}
-
-function testSendSMSNullAlphaId() {
- let icc = getMozIcc();
-
- // No "stkcommand" event should occur.
- icc.addEventListener("stkcommand",
- (event) => ok(false, event + " should not occur."));
-
- // No "icc-stkcommand" system message should be sent.
- workingFrame.contentWindow.navigator.mozSetMessageHandler("icc-stkcommand",
- (msg) => ok(false, msg + " should not be sent."));
-
- // If nothing happens within 3 seconds after the emulator command sent,
- // treat as success.
- log("send_sms_cmd: " + TEST_CMD_NULL_ALPHA_ID);
- return sendEmulatorStkPdu(TEST_CMD_NULL_ALPHA_ID)
- .then(() => new Promise(function(resolve, reject) {
- setTimeout(() => resolve(), 3000);
- }));
-}
-
-// Start tests
-startTestCommon(function() {
- return Promise.resolve()
- .then(() => testSendSMS())
- .then(() => testSendSMSNullAlphaId());
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_send_ss.js
+++ /dev/null
@@ -1,166 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D029" + // Length
- "8103011100" + // Command details
- "82028183" + // Device identities
- "850C43616C6C20466F7277617264" + // Alpha identifier
- "891091AA120A214365870921436587A901FB", // SS string
- expect: {commandQualifier: 0x00,
- text: "Call Forward"}},
- {command: "D01B" + // Length
- "8103011100" + // Command details
- "82028183" + // Device identities
- "891091AA120A214365870921436587A901FB", // SS string
- expect: {commandQualifier: 0x00}},
- {command: "D081FD" + // Length
- "8103011100" + // Command details
- "82028183" + // Device identities
- "8581EB4576656E2069662074686520466978656420" + // Alpha identifier
- "4469616C6C696E67204E756D626572207365727669" +
- "636520697320656E61626C65642C20746865207375" +
- "70706C656D656E7461727920736572766963652063" +
- "6F6E74726F6C20737472696E6720696E636C756465" +
- "6420696E207468652053454E442053532070726F61" +
- "637469766520636F6D6D616E64207368616C6C206E" +
- "6F7420626520636865636B656420616761696E7374" +
- "2074686F7365206F66207468652046444E206C6973" +
- "742E2055706F6E20726563656976696E6720746869" +
- "7320636F6D6D616E642C20746865204D4520736861" +
- "6C6C2064656369" +
- "8904FFBA13FB", // SS string
- expect: {commandQualifier: 0x00,
- text: "Even if the Fixed Dialling Number service is enabled, " +
- "the supplementary service control string included in the " +
- "SEND SS proactive command shall not be checked against " +
- "those of the FDN list. Upon receiving this command, the " +
- "ME shall deci"}},
- {command: "D01B" + // Length
- "8103011100" + // Command details
- "82028183" + // Device identities
- "891091AA120A214365870921436587A901FB", // SS string
- expect: {commandQualifier: 0x00}},
- {command: "D02B" + // Length
- "8103011100" + // Command details
- "82028183" + // Device identities
- "850A42617369632049636F6E" + // Alpha identifier
- "891091AA120A214365870921436587A901FB" + // SS string
- "9E020001", // Icon identifier
- expect: {commandQualifier: 0x00,
- text: "Basic Icon",
- iconSelfExplanatory: true,
- icons: [BASIC_ICON]}},
- {command: "D01F" + // Length
- "8103011100" + // Command details
- "82028183" + // Device identities
- "891091AA120A214365870921436587A901FB" + // SS string
- "9E020103", // Icon identifier
- expect: {commandQualifier: 0x00,
- iconSelfExplanatory: false,
- icons: [COLOR_ICON]}},
- {command: "D036" + // Length
- "8103011100" + // Command details
- "82028183" + // Device identities
- "851980041704140420041004120421042204120423041904220415" + // Alpha identifier
- "891091AA120A214365870921436587A901FB", // SS string
- expect: {commandQualifier: 0x00,
- text: "ЗДРАВСТВУЙТЕ"}},
- {command: "D033" + // Length
- "8103011100" + // Command details
- "82028183" + // Device identities
- "851054657874204174747269627574652031" + // Alpha identifier
- "891091AA120A214365870921436587A901FB" + // SS string
- "D004001000B4", // Text attribute
- expect: {commandQualifier: 0x00,
- text: "Text Attribute 1"}},
- {command: "D022" + // Length
- "8103011100" + // Command details
- "82028183" + // Device identities
- "8505804F60597D" + // Alpha identifier
- "891091AA120A214365870921436587A901FB", // SS string
- expect: {commandQualifier: 0x00,
- text: "你好"}},
-];
-
-const TEST_CMD_NULL_ALPHA_ID =
- "D01D" + // Length
- "8103011100" + // Command details
- "82028183" + // Device identities
- "8500" + // Alpha identifier
- "891091AA120A214365870921436587A901FB"; // SS string
-
-function verifySendSS(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_SS, "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- // text is optional.
- if ("text" in aExpect) {
- is(aCommand.options.text, aExpect.text, "options.text");
- }
-
- // icons is optional.
- if ("icons" in aExpect) {
- isIcons(aCommand.options.icons, aExpect.icons);
- is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
- "options.iconSelfExplanatory");
- }
-}
-
-function testSendSS() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("send_ss_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => verifySendSS(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- verifySendSS(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-}
-
-function testSendSSNullAlphaId() {
- let icc = getMozIcc();
-
- // No "stkcommand" event should occur.
- icc.addEventListener("stkcommand",
- (event) => ok(false, event + " should not occur."));
-
- // No "icc-stkcommand" system message should be sent.
- workingFrame.contentWindow.navigator.mozSetMessageHandler("icc-stkcommand",
- (msg) => ok(false, msg + " should not be sent."));
-
- // If nothing happens within 3 seconds after the emulator command sent,
- // treat as success.
- log("send_ss_cmd: " + TEST_CMD_NULL_ALPHA_ID);
- return sendEmulatorStkPdu(TEST_CMD_NULL_ALPHA_ID)
- .then(() => new Promise(function(resolve, reject) {
- setTimeout(() => resolve(), 3000);
- }));
-}
-
-// Start tests
-startTestCommon(function() {
- return Promise.resolve()
- .then(() => testSendSS())
- .then(() => testSendSSNullAlphaId());
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_send_ussd.js
+++ /dev/null
@@ -1,206 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D050" + // Length
- "8103011200" + // Command details
- "82028183" + // Device identities
- "850A372D6269742055535344" + // Alpha identifier
- "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
- "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
- "3B3EAF6FC564335ACD76C3E560",
- expect: {commandQualifier: 0x00,
- text: "7-bit USSD"}},
- {command: "D044" + // Length
- "8103011200" + // Command details
- "82028183" + // Device identities
- "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
- "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
- "3B3EAF6FC564335ACD76C3E560",
- expect: {commandQualifier: 0x00}},
- {command: "D058" + // Length
- "8103011200" + // Command details
- "82028183" + // Device identities
- "850A382D6269742055535344" + // Alpha identifier
- "8A41444142434445464748494A4B4C4D4E4F5051525354" + // USSD string
- "55565758595A2D6162636465666768696A6B6C6D6E6F70" +
- "7172737475767778797A2D31323334353637383930",
- expect: {commandQualifier: 0x00,
- text: "8-bit USSD"}},
- {command: "D02F" + // Length
- "8103011200" + // Command details
- "82028183" + // Device identities
- "8509554353322055535344" + // Alpha identifier
- "8A1948041704140420041004120421042204120423041904220415", // USSD string
- expect: {commandQualifier: 0x00,
- text: "UCS2 USSD"}},
- {command: "D081FD" + // Length
- "8103011200" + // Command details
- "82028183" + // Device identities
- "8581B66F6E636520612052454C4541534520434F4D" + // Alpha identifier
- "504C455445206D65737361676520636F6E7461696E" +
- "696E672074686520555353442052657475726E2052" +
- "6573756C74206D657373616765206E6F7420636F6E" +
- "7461696E696E6720616E206572726F722068617320" +
- "6265656E2072656365697665642066726F6D207468" +
- "65206E6574776F726B2C20746865204D4520736861" +
- "6C6C20696E666F726D207468652053494D20746861" +
- "742074686520636F6D6D616E6420686173" +
- "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
- "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
- "3B3EAF6FC564335ACD76C3E560",
- expect: {commandQualifier: 0x00,
- text: "once a RELEASE COMPLETE message containing the USSD " +
- "Return Result message not containing an error has been " +
- "received from the network, the ME shall inform the SIM " +
- "that the command has"}},
- {command: "D044" + // Length
- "8103011200" + // Command details
- "82028183" + // Device identities
- "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
- "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
- "3B3EAF6FC564335ACD76C3E560",
- expect: {commandQualifier: 0x00}},
- {command: "D054" + // Length
- "8103011200" + // Command details
- "82028183" + // Device identities
- "850A42617369632049636F6E" + // Alpha identifier
- "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
- "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
- "3B3EAF6FC564335ACD76C3E560" +
- "9E020001", // Icon identifier
- expect: {commandQualifier: 0x00,
- text: "Basic Icon",
- iconSelfExplanatory: true,
- icons: [BASIC_ICON]}},
- {command: "D048" + // Length
- "8103011200" + // Command details
- "82028183" + // Device identities
- "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
- "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
- "3B3EAF6FC564335ACD76C3E560" +
- "9E020103", // Icon identifier
- expect: {commandQualifier: 0x00,
- iconSelfExplanatory: false,
- icons: [COLOR_ICON]}},
- {command: "D05F" + // Length
- "8103011200" + // Command details
- "82028183" + // Device identities
- "851980041704140420041004120421042204120423041904220415" + // Alpha identifier
- "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
- "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
- "3B3EAF6FC564335ACD76C3E560",
- expect: {commandQualifier: 0x00,
- text: "ЗДРАВСТВУЙТЕ"}},
- {command: "D05C" + // Length
- "8103011200" + // Command details
- "82028183" + // Device identities
- "851054657874204174747269627574652031" + // Alpha identifier
- "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
- "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
- "3B3EAF6FC564335ACD76C3E560" +
- "D004001000B4", // Text attribute
- expect: {commandQualifier: 0x00,
- text: "Text Attribute 1"}},
- {command: "D04A" + // Length
- "8103011200" + // Command details
- "82028183" + // Device identities
- "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
- "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
- "3B3EAF6FC564335ACD76C3E560" +
- "D004001000B4", // Text attribute
- expect: {commandQualifier: 0x00}},
- {command: "D04B" + // Length
- "8103011200" + // Command details
- "82028183" + // Device identities
- "8505804F60597D" + // Alpha identifier
- "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
- "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
- "3B3EAF6FC564335ACD76C3E560",
- expect: {commandQualifier: 0x00,
- text: "你好"}},
-];
-
-const TEST_CMD_NULL_ALPHA_ID =
- "D046" + // Length
- "8103011200" + // Command details
- "82028183" + // Device identities
- "8500" + // Alpha identifier
- "8A39F041E19058341E9149E592D9743EA151E9945AB55E" + // USSD string
- "B1596D2B2C1E93CBE6333AAD5EB3DBEE373C2E9FD3EBF6" +
- "3B3EAF6FC564335ACD76C3E560";
-
-function verifySendUSSD(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SEND_USSD, "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- // text is optional.
- if ("text" in aExpect) {
- is(aCommand.options.text, aExpect.text, "options.text");
- }
-
- // icons is optional.
- if ("icons" in aExpect) {
- isIcons(aCommand.options.icons, aExpect.icons);
- is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
- "options.iconSelfExplanatory");
- }
-}
-
-function testSendUSSD() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("send_ussd_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => verifySendUSSD(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- verifySendUSSD(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-}
-
-function testSendUSSDNullAlphaId() {
- let icc = getMozIcc();
-
- // No "stkcommand" event should occur.
- icc.addEventListener("stkcommand",
- (event) => ok(false, event + " should not occur."));
-
- // No "icc-stkcommand" system message should be sent.
- workingFrame.contentWindow.navigator.mozSetMessageHandler("icc-stkcommand",
- (msg) => ok(false, msg + " should not be sent."));
-
- // If nothing happens within 3 seconds after the emulator command sent,
- // treat as success.
- log("send_ussd_cmd: " + TEST_CMD_NULL_ALPHA_ID);
- return sendEmulatorStkPdu(TEST_CMD_NULL_ALPHA_ID)
- .then(() => new Promise(function(resolve, reject) {
- setTimeout(() => resolve(), 3000);
- }));
-}
-
-// Start tests
-startTestCommon(function() {
- return Promise.resolve()
- .then(() => testSendUSSD())
- .then(() => testSendUSSDNullAlphaId());
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_setup_call.js
+++ /dev/null
@@ -1,236 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D01E" + // Length
- "8103011000" + // Command details
- "82028183" + // Device identities
- "85084E6F742062757379" + // Alpha identifier
- "8609911032042143651C2C", // Address
- expect: {commandQualifier: 0x00,
- confirmMessage: { text: "Not busy" },
- address: "+012340123456,1,2"}},
- {command: "D01D" + // Length
- "8103011002" + // Command details
- "82028183" + // Device identities
- "85074F6E20686F6C64" + // Alpha identifier
- "8609911032042143651C2C", // Address
- expect: {commandQualifier: 0x02,
- confirmMessage: { text: "On hold" },
- address: "+012340123456,1,2"}},
- {command: "D020" + // Length
- "8103011004" + // Command details
- "82028183" + // Device identities
- "850A446973636F6E6E656374" + // Alpha identifier
- "8609911032042143651C2C", // Address
- expect: {commandQualifier: 0x04,
- confirmMessage: { text: "Disconnect" },
- address: "+012340123456,1,2"}},
- {command: "D02B" + // Length
- "8103011000" + // Command details
- "82028183" + // Device identities
- "85114361706162696C69747920636F6E666967" + // Alpha identifier
- "8609911032042143651C2C" + // Address
- "870201A0", // Capability configuration parameters
- expect: {commandQualifier: 0x00,
- confirmMessage: { text: "Capability config" },
- address: "+012340123456,1,2"}},
- {command: "D01C" + // Length
- "8103011001" + // Command details
- "82028183" + // Device identities
- "86119110325476981032547698103254769810", // Address
- expect: {commandQualifier: 0x01,
- address: "+01234567890123456789012345678901"}},
- {command: "D081FD" + // Length
- "8103011001" + // Command details
- "82028183" + // Device identities
- "8581ED546872656520747970657320617265206465" + // Alpha identifier
- "66696E65643A202D2073657420757020612063616C" +
- "6C2C20627574206F6E6C79206966206E6F74206375" +
- "7272656E746C792062757379206F6E20616E6F7468" +
- "65722063616C6C3B202D2073657420757020612063" +
- "616C6C2C2070757474696E6720616C6C206F746865" +
- "722063616C6C732028696620616E7929206F6E2068" +
- "6F6C643B202D2073657420757020612063616C6C2C" +
- "20646973636F6E6E656374696E6720616C6C206F74" +
- "6865722063616C6C732028696620616E7929206669" +
- "7273742E20466F722065616368206F662074686573" +
- "652074797065732C20" +
- "86029110", // Address
- expect: {commandQualifier: 0x01,
- confirmMessage: {
- text: "Three types are defined: - set up a call, but only if " +
- "not currently busy on another call; - set up a call, " +
- "putting all other calls (if any) on hold; - set up a " +
- "call, disconnecting all other calls (if any) first. For " +
- "each of these types, "
- },
- address: "+01"}},
- {command: "D022" + // Length
- "8103011001" + // Command details
- "82028183" + // Device identities
- "85084475726174696F6E" + // Alpha identifier
- "8609911032042143651C2C" + // Address
- "8402010A", // Duration
- expect: {commandQualifier: 0x01,
- confirmMessage: { text: "Duration" },
- address: "+012340123456,1,2",
- duration: {timeUnit: MozIccManager.STK_TIME_UNIT_SECOND,
- timeInterval: 0x0A}}},
- {command: "D028" + // Length
- "8103011000" + // Command details
- "82028183" + // Device identities
- "850C434F4E4649524D4154494F4E" + // Alpha identifier
- "8609911032042143651C2C" + // Address
- "850443414C4C", // Alpha identifier
- expect: {commandQualifier: 0x00,
- confirmMessage: { text: "CONFIRMATION" },
- callMessage: { text: "CALL" },
- address: "+012340123456,1,2"}},
- {command: "D030" + // Length
- "8103011000" + // Command details
- "82028183" + // Device identities
- "85165365742075702063616C6C2049636F6E20332E312E31" + // Alpha identifier
- "8609911032042143651C2C" + // Address
- "9E020101", // Icon identifier
- expect: {commandQualifier: 0x00,
- confirmMessage: { text: "Set up call Icon 3.1.1",
- iconSelfExplanatory: false,
- icons: [BASIC_ICON] },
- address: "+012340123456,1,2"}},
- {command: "D04C" + // Length
- "8103011000" + // Command details
- "82028183" + // Device identities
- "85165365742075702063616C6C2049636F6E20332E342E31" + // Alpha identifier
- "8609911032042143651C2C" + // Address
- "9E020001" + // Icon identifier
- "85165365742075702063616C6C2049636F6E20332E342E32" + // Alpha identifier
- "9E020003", // Icon identifier
- expect: {commandQualifier: 0x00,
- confirmMessage: { text: "Set up call Icon 3.4.1",
- iconSelfExplanatory: true,
- icons: [BASIC_ICON] },
- callMessage: { text: "Set up call Icon 3.4.2" ,
- iconSelfExplanatory: true,
- icons: [COLOR_ICON] },
- address: "+012340123456,1,2"}},
- {command: "D038" + // Length
- "8103011000" + // Command details
- "82028183" + // Device identities
- "850E434F4E4649524D4154494F4E2031" + // Alpha identifier
- "8609911032042143651C2C" + // Address
- "850643414C4C2031" + // Alpha identifier
- "D004000E00B4" + // Text attribute
- "D004000600B4", // Text attribute
- expect: {commandQualifier: 0x00,
- confirmMessage: { text: "CONFIRMATION 1" },
- callMessage: { text: "CALL 1" },
- address: "+012340123456,1,2"}},
- {command: "D04C" + // Length
- "8103011000" + // Command details
- "82028183" + // Device identities
- "851B800417041404200410041204210422041204230419042204150031" + // Alpha identifier
- "860791103204214365" + // Address
- "851B800417041404200410041204210422041204230419042204150032", // Alpha identifier
- expect: {commandQualifier: 0x00,
- confirmMessage: { text: "ЗДРАВСТВУЙТЕ1" },
- callMessage: { text: "ЗДРАВСТВУЙТЕ2" },
- address: "+012340123456"}},
- {command: "D019" + // Length
- "8103011000" + // Command details
- "82028183" + // Device identities
- "8505804E0D5FD9" + // Alpha identifier
- "860791103204214365", // Address
- expect: {commandQualifier: 0x00,
- confirmMessage: { text: "不忙" },
- address: "+012340123456"}},
- {command: "D022" + // Length
- "8103011000" + // Command details
- "82028183" + // Device identities
- "850580786E5B9A" + // Alpha identifier
- "860791103204214365" + // Address
- "850780625375358BDD", // Alpha identifier
- expect: {commandQualifier: 0x00,
- confirmMessage: { text: "确定" },
- callMessage: { text: "打电话" },
- address: "+012340123456"}},
- {command: "D016" + // Length
- "8103011000" + // Command details
- "82028183" + // Device identities
- "8500" + // Alpha identifier
- "860791103204214365" + // Address
- "8500", // Alpha identifier
- expect: {commandQualifier: 0x00,
- confirmMessage: { text: "" },
- callMessage: { text: "" },
- address: "+012340123456"}},
- {command: "D01C" + // Length
- "8103011000" + // Command details
- "82028183" + // Device identities
- "8609911032042143651C2C" + // Address
- "9E020001" + // Icon identifier
- "9E020103", // Icon identifier
- expect: {commandQualifier: 0x00,
- confirmMessage: { iconSelfExplanatory: true,
- icons: [BASIC_ICON] },
- callMessage: { iconSelfExplanatory: false,
- icons: [COLOR_ICON] },
- address: "+012340123456,1,2"}},
-];
-
-function testSetupCall(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_CALL,
- "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
- is(aCommand.options.address, aExpect.address, "options.address");
-
- // confirmMessage is optional.
- if ("confirmMessage" in aExpect) {
- isStkText(aCommand.options.confirmMessage, aExpect.confirmMessage);
- }
-
- // callMessage is optional.
- if ("callMessage" in aExpect) {
- isStkText(aCommand.options.callMessage, aExpect.callMessage);
- }
-
- // duration is optional.
- if ("duration" in aExpect) {
- let duration = aCommand.options.duration;
- is(duration.timeUnit, aExpect.duration.timeUnit, "duration.timeUnit");
- is(duration.timeInterval, aExpect.duration.timeInterval,
- "duration.timeInterval");
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("setup_call_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testSetupCall(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testSetupCall(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_setup_event_list.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D00C" + // Length
- "8103010500" + // Command details
- "82028182" + // Device identities
- "990104", // Event list
- expect: {commandQualifier: 0x00,
- eventList: [4]}},
- {command: "D00D" + // Length
- "8103010500" + // Command details
- "82028182" + // Device identities
- "99020507", // Event list
- expect: {commandQualifier: 0x00,
- eventList: [5, 7]}},
- {command: "D00C" + // Length
- "8103010500" + // Command details
- "82028182" + // Device identities
- "990107", // Event list
- expect: {commandQualifier: 0x00,
- eventList: [7]}},
- {command: "D00C" + // Length
- "8103010500" + // Command details
- "82028182" + // Device identities
- "990107", // Event list
- expect: {commandQualifier: 0x00,
- eventList: [7]}},
- {command: "D00B" + // Length
- "8103010500" + // Command details
- "82028182" + // Device identities
- "9900", // Event list
- expect: {commandQualifier: 0x00,
- eventList: null}},
- {command: "D00C" + // Length
- "8103010500" + // Command details
- "82028182" + // Device identities
- "990107", // Event list
- expect: {commandQualifier: 0x00,
- eventList: [7]}}
-];
-
-function testSetupEventList(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_EVENT_LIST,
- "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- for (let index in aExpect.eventList) {
- is(aCommand.options.eventList[index], aExpect.eventList[index],
- "options.eventList[" + index + "]");
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("setup_event_list_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testSetupEventList(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testSetupEventList(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_setup_idle_mode_text.js
+++ /dev/null
@@ -1,115 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D01A" + // Length
- "8103012800" + // Command details
- "82028182" + // Device identities
- "8D0F0449646C65204D6F64652054657874", // Text string
- expect: {commandQualifier: 0x00,
- text: "Idle Mode Text"}},
- {command: "D081FD" + // Length
- "8103012800" + // Command details
- "82028182" + // Device identities
- "8D81F100547419344D3641737498CD06CDEB70383B0F0A" + // Text string
- "83E8653C1D34A7CBD3EE330B7447A7C768D01C1D66B341" +
- "E232889C9EC3D9E17C990C12E741747419D42C82C27350" +
- "D80D4A93D96550FB4D2E83E8653C1D943683E8E832A859" +
- "04A5E7A0B0985D06D1DF20F21B94A6BBA8E832082E2FCF" +
- "CB6E7A989E7EBB41737A9E5D06A5E72076D94C0785E7A0" +
- "B01B946EC3D9E576D94D0FD3D36F37885C1EA7E7E9B71B" +
- "447F83E8E832A85904B5C3EEBA393CA6D7E565B90B4445" +
- "97416932BB0C6ABFC96510BD8CA783E6E8309B0D129741" +
- "E4F41CCE0EE7CB6450DA0D0A83DA61B7BB2C07D1D1613A" +
- "A8EC9ED7E5E539888E0ED341EE32",
- expect: {commandQualifier: 0x00,
- text: "The SIM shall supply a text string, which shall be " +
- "displayed by the ME as an idle mode text if the ME is " +
- "able to do it.The presentation style is left as an " +
- "implementation decision to the ME manufacturer. The idle " +
- "mode text shall be displayed in a manner that ensures " +
- "that ne"}},
- {command: "D019" + // Length
- "8103012800" + // Command details
- "82028182" + // Device identities
- "8D0A0449646C652074657874" + // Text string
- "9E020101", // Icon identifier
- expect: {commandQualifier: 0x00,
- text: "Idle text",
- iconSelfExplanatory: false,
- icons: [BASIC_ICON]}},
- {command: "D019" + // Length
- "8103012800" + // Command details
- "82028182" + // Device identities
- "8D0A0449646C652074657874" + // Text string
- "9E020007", // Icon identifier
- expect: {commandQualifier: 0x00,
- text: "Idle text",
- iconSelfExplanatory: true,
- icons: [COLOR_ICON, COLOR_TRANSPARENCY_ICON]}},
- {command: "D024" + // Length
- "8103012800" + // Command details
- "82028182" + // Device identities
- "8D1908041704140420041004120421042204120423041904220415", // Text string
- expect: {commandQualifier: 0x00,
- text: "ЗДРАВСТВУЙТЕ"}},
- {command: "D022" + // Length
- "8103012800" + // Command details
- "82028182" + // Device identities
- "8D110449646C65204D6F646520546578742031" + // Text string
- "D004001000B4", // Text attribute
- expect: {commandQualifier: 0x00,
- text: "Idle Mode Text 1"}},
- {command: "D010" + // Length
- "8103012800" + // Command details
- "82028182" + // Device identities
- "8D05084F60597D", // Text string
- expect: {commandQualifier: 0x00,
- text: "你好"}},
-];
-
-function testSetupIdleModeText(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_IDLE_MODE_TEXT,
- "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
- is(aCommand.options.text, aExpect.text, "options.text");
-
- // icons is optional.
- if ("icons" in aExpect) {
- isIcons(aCommand.options.icons, aExpect.icons);
- is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
- "options.iconSelfExplanatory");
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("setup_idle_mode_text_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testSetupIdleModeText(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testSetupIdleModeText(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_setup_menu.js
+++ /dev/null
@@ -1,312 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {command: "D081FC" + // Length
- "8103012500" + // Command details
- "82028182" + // Device identities
- "850A4C617267654D656E7531" + // Alpha identifier
- "8F05505A65726F" + // Item
- "8F044F4F6E65" + // Item
- "8F044E54776F" + // Item
- "8F064D5468726565" + // Item
- "8F054C466F7572" + // Item
- "8F054B46697665" + // Item
- "8F044A536978" + // Item
- "8F0649536576656E" + // Item
- "8F06484569676874" + // Item
- "8F05474E696E65" + // Item
- "8F0646416C706861" + // Item
- "8F0645427261766F" + // Item
- "8F0844436861726C6965" + // Item
- "8F064344656C7461" + // Item
- "8F05424563686F" + // Item
- "8F0941466F782D74726F74" + // Item
- "8F0640426C61636B" + // Item
- "8F063F42726F776E" + // Item
- "8F043E526564" + // Item
- "8F073D4F72616E6765" + // Item
- "8F073C59656C6C6F77" + // Item
- "8F063B477265656E" + // Item
- "8F053A426C7565" + // Item
- "8F073956696F6C6574" + // Item
- "8F053847726579" + // Item
- "8F06375768697465" + // Item
- "8F06366D696C6C69" + // Item
- "8F06356D6963726F" + // Item
- "8F05346E616E6F" + // Item
- "8F05337069636F", // Item
- expect: {commandQualifier: 0x00,
- title: "LargeMenu1",
- items: [{identifier: 80, text: "Zero"},
- {identifier: 79, text: "One"},
- {identifier: 78, text: "Two"},
- {identifier: 77, text: "Three"},
- {identifier: 76, text: "Four"},
- {identifier: 75, text: "Five"},
- {identifier: 74, text: "Six"},
- {identifier: 73, text: "Seven"},
- {identifier: 72, text: "Eight"},
- {identifier: 71, text: "Nine"},
- {identifier: 70, text: "Alpha"},
- {identifier: 69, text: "Bravo"},
- {identifier: 68, text: "Charlie"},
- {identifier: 67, text: "Delta"},
- {identifier: 66, text: "Echo"},
- {identifier: 65, text: "Fox-trot"},
- {identifier: 64, text: "Black"},
- {identifier: 63, text: "Brown"},
- {identifier: 62, text: "Red"},
- {identifier: 61, text: "Orange"},
- {identifier: 60, text: "Yellow"},
- {identifier: 59, text: "Green"},
- {identifier: 58, text: "Blue"},
- {identifier: 57, text: "Violet"},
- {identifier: 56, text: "Grey"},
- {identifier: 55, text: "White"},
- {identifier: 54, text: "milli"},
- {identifier: 53, text: "micro"},
- {identifier: 52, text: "nano"},
- {identifier: 51, text: "pico"}]}},
- {command: "D081F3" + // Length
- "8103012500" + // Command details
- "82028182" + // Device identities
- "850A4C617267654D656E7532" + // Alpha identifier
- "8F1DFF312043616C6C20466F727761726420556E636F6E646974" + // Item
- "696F6E616C" +
- "8F1CFE322043616C6C20466F7277617264204F6E205573657220" + // Item
- "42757379" +
- "8F1BFD332043616C6C20466F7277617264204F6E204E6F205265" + // Item
- "706C79" +
- "8F25FC342043616C6C20466F7277617264204F6E205573657220" + // Item
- "4E6F7420526561636861626C65" +
- "8F20FB352042617272696E67204F6620416C6C204F7574676F69" + // Item
- "6E672043616C6C73" +
- "8F24FA362042617272696E67204F6620416C6C204F7574676F69" + // Item
- "6E6720496E742043616C6C73" +
- "8F13F93720434C492050726573656E746174696F6E", // Item
- expect: {commandQualifier: 0x00,
- title: "LargeMenu2",
- items: [{identifier: 255, text: "1 Call Forward Unconditional"},
- {identifier: 254, text: "2 Call Forward On User Busy"},
- {identifier: 253, text: "3 Call Forward On No Reply"},
- {identifier: 252, text: "4 Call Forward On User Not Reachable"},
- {identifier: 251, text: "5 Barring Of All Outgoing Calls"},
- {identifier: 250, text: "6 Barring Of All Outgoing Int Calls"},
- {identifier: 249, text: "7 CLI Presentation"}]}},
- {command: "D081FC" + // Length
- "8103012500" + // Command details
- "82028182" + // Device identities
- "8581EC5468652053494D207368616C6C20737570" + // Alpha identifier
- "706C79206120736574206F66206D656E75206974" +
- "656D732C207768696368207368616C6C20626520" +
- "696E746567726174656420776974682074686520" +
- "6D656E752073797374656D20286F72206F746865" +
- "72204D4D4920666163696C6974792920696E206F" +
- "7264657220746F20676976652074686520757365" +
- "7220746865206F70706F7274756E69747920746F" +
- "2063686F6F7365206F6E65206F66207468657365" +
- "206D656E75206974656D7320617420686973206F" +
- "776E2064697363726574696F6E2E204561636820" +
- "6974656D20636F6D7072697365732061207368" +
- "8F020159", // Item
- expect: {commandQualifier: 0x00,
- title: "The SIM shall supply a set of menu items, which shall " +
- "be integrated with the menu system (or other MMI " +
- "facility) in order to give the user the opportunity to " +
- "choose one of these menu items at his own discretion. " +
- "Each item comprises a sh",
- items: [{identifier: 1, text: "Y"}]}},
- {command: "D03B" + // Length
- "8103012580" + // Command details
- "82028182" + // Device identities
- "850C546F6F6C6B6974204D656E75" + // Alpha identifier
- "8F07014974656D2031" + // Item
- "8F07024974656D2032" + // Item
- "8F07034974656D2033" + // Item
- "8F07044974656D2034", // Item
- expect: {commandQualifier: 0x80,
- title: "Toolkit Menu",
- items: [{identifier: 1, text: "Item 1"},
- {identifier: 2, text: "Item 2"},
- {identifier: 3, text: "Item 3"},
- {identifier: 4, text: "Item 4"}]}},
- {command: "D041" + // Length
- "8103012500" + // Command details
- "82028182" + // Device identities
- "850C546F6F6C6B6974204D656E75" + // Alpha identifier
- "8F07014974656D2031" + // Item
- "8F07024974656D2032" + // Item
- "8F07034974656D2033" + // Item
- "8F07044974656D2034" + // Item
- "180413101526", // Items next action indicator
- expect: {commandQualifier: 0x00,
- title: "Toolkit Menu",
- items: [{identifier: 1, text: "Item 1"},
- {identifier: 2, text: "Item 2"},
- {identifier: 3, text: "Item 3"},
- {identifier: 4, text: "Item 4"}],
- nextActionList: [MozIccManager.STK_CMD_SEND_SMS,
- MozIccManager.STK_CMD_SET_UP_CALL,
- MozIccManager.STK_CMD_LAUNCH_BROWSER,
- MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO]}},
- {command: "D03C" + // Length
- "8103012500" + // Command details
- "82028182" + // Device identities
- "850C546F6F6C6B6974204D656E75" + // Alpha identifier
- "8F07014974656D2031" + // Item
- "8F07024974656D2032" + // Item
- "8F07034974656D2033" + // Item
- "9E020001" + // Icon identifier
- "9F0400050505", // Item icon identifier list
- expect: {commandQualifier: 0x00,
- title: "Toolkit Menu",
- iconSelfExplanatory: true,
- icons: [BASIC_ICON],
- items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
- {identifier: 2, text: "Item 2", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]},
- {identifier: 3, text: "Item 3", iconSelfExplanatory: true, icons: [COLOR_TRANSPARENCY_ICON]}]}},
- {command: "D036" + // Length
- "8103012500" + // Command details
- "82028182" + // Device identities
- "850C546F6F6C6B6974204D656E75" + // Alpha identifier
- "8F07014974656D2031" + // Item
- "8F07024974656D2032" + // Item
- "8F07034974656D2033" + // Item
- "9E020001", // Icon identifier
- expect: {commandQualifier: 0x00,
- title: "Toolkit Menu",
- iconSelfExplanatory: true,
- icons: [BASIC_ICON],
- items: [{identifier: 1, text: "Item 1"},
- {identifier: 2, text: "Item 2"},
- {identifier: 3, text: "Item 3"}]}},
- {command: "D038" + // Length
- "8103012500" + // Command details
- "82028182" + // Device identities
- "850C546F6F6C6B6974204D656E75" + // Alpha identifier
- "8F07014974656D2031" + // Item
- "8F07024974656D2032" + // Item
- "8F07034974656D2033" + // Item
- "9F0400030303", // Item icon identifier list
- expect: {commandQualifier: 0x00,
- title: "Toolkit Menu",
- items: [{identifier: 1, text: "Item 1", iconSelfExplanatory: true, icons: [COLOR_ICON]},
- {identifier: 2, text: "Item 2", iconSelfExplanatory: true, icons: [COLOR_ICON]},
- {identifier: 3, text: "Item 3", iconSelfExplanatory: true, icons: [COLOR_ICON]}]}},
- {command: "D0819C" + // Length
- "8103012500" + // Command details
- "82028182" + // Device identities
- "851980041704140420041004120421042204120423041904220415" + // Alpha identifier
- "8F1C01800417041404200410041204210422041204230419042204150031" + // Item
- "8F1C02800417041404200410041204210422041204230419042204150032" + // Item
- "8F1C03800417041404200410041204210422041204230419042204150033" + // Item
- "8F1C04800417041404200410041204210422041204230419042204150034", // Item
- expect: {commandQualifier: 0x00,
- title: "ЗДРАВСТВУЙТЕ",
- items: [{identifier: 1, text: "ЗДРАВСТВУЙТЕ1"},
- {identifier: 2, text: "ЗДРАВСТВУЙТЕ2"},
- {identifier: 3, text: "ЗДРАВСТВУЙТЕ3"},
- {identifier: 4, text: "ЗДРАВСТВУЙТЕ4"}]}},
- {command: "D03C" + // Length
- "8103012500" + // Command details
- "82028182" + // Device identities
- "8509805DE551777BB15355" + // Alpha identifier
- "8F080180987976EE4E00" + // Item
- "8F080280987976EE4E8C" + // Item
- "8F080380987976EE4E09" + // Item
- "8F080480987976EE56DB", // Item
- expect: {commandQualifier: 0x00,
- title: "工具箱单",
- items: [{identifier: 1, text: "项目一"},
- {identifier: 2, text: "项目二"},
- {identifier: 3, text: "项目三"},
- {identifier: 4, text: "项目四"}]}},
- // Test remove setup menu.
- {command: "D00D" + // Length
- "8103012500" + // Command details
- "82028182" + // Device identities
- "8500" + // Alpha identifier
- "8F00", // Item
- expect: {commandQualifier: 0x00,
- title: "",
- items: [null]}},
-];
-
-function testSetupMenu(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_SET_UP_MENU, "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- // To ensure that 'presentationType' will only be available in SELECT_ITEM.
- is(aCommand.options.presentationType, undefined, "presentationType");
- is(aCommand.options.isHelpAvailable, !!(aCommand.commandQualifier & 0x80),
- "isHelpAvailable");
- is(aCommand.options.title, aExpect.title, "options.title");
-
- for (let index in aExpect.items) {
- let item = aCommand.options.items[index];
- let itemExpect = aExpect.items[index];
-
- if (!itemExpect) {
- is(item, itemExpect, "options.items[" + index + "]");
- } else {
- is(item.identifier, itemExpect.identifier,
- "options.items[" + index + "].identifier");
- is(item.text, itemExpect.text,
- "options.items[" + index + "].text");
-
- if (itemExpect.icons) {
- isIcons(item.icons, itemExpect.icons);
- is(item.iconSelfExplanatory, itemExpect.iconSelfExplanatory,
- "options.items[" + index + "].iconSelfExplanatory");
- }
- }
- }
-
- // icons is optional.
- if ("icons" in aExpect) {
- isIcons(aCommand.options.icons, aExpect.icons);
- is(aCommand.options.iconSelfExplanatory, aExpect.iconSelfExplanatory,
- "options.iconSelfExplanatory");
- }
-
- // nextActionList is optional.
- if ("nextActionList" in aExpect) {
- for (let index in aExpect.nextActionList) {
- is(aCommand.options.nextActionList[index], aExpect.nextActionList[index],
- "options.nextActionList[" + index + "]");
- }
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("setup_menu_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testSetupMenu(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testSetupMenu(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_timer_expiration.js
+++ /dev/null
@@ -1,27 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 20000;
-MARIONETTE_HEAD_JS = "head.js";
-
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
-
- // APDU format of ENVELOPE:
- // Class = 'A0', INS = 'C2', P1 = '00', P2 = '00', XXXX, (No Le)
-
- // Since |sendStkTimerExpiration| is an API without call back to identify the
- // result, the tests of |sendStkMenuSelection| must be executed one by one with
- // |verifyWithPeekedStkEnvelope| introduced here.
- return Promise.resolve()
- .then(() => icc.sendStkTimerExpiration({ timerId: 5, timerValue: 1234567 / 1000 }))
- .then(() => verifyWithPeekedStkEnvelope(
- "D7" + // BER_TIMER_EXPIRATION_TAG
- "0C" + // Length
- "82028281" + // TAG_DEVICE_ID (STK_DEVICE_ID_ME, STK_DEVICE_ID_SIM)
- "A40105" + // TAG_TIMER_IDENTIFIER (5)
- "A503000243" // TIMER_VALUE (00:20:34) = 1234 seconds
- ));
-});
\ No newline at end of file
deleted file mode 100644
--- a/dom/icc/tests/marionette/test_stk_timer_management.js
+++ /dev/null
@@ -1,76 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- // Start
- {command: "D011" + // Length
- "8103012700" + // Command details
- "82028182" + // Device identities
- "A40101" + // Timer identifier
- "A503102030", // Timer value
- expect: {commandQualifier: MozIccManager.STK_TIMER_START,
- timerAction: MozIccManager.STK_TIMER_START,
- timerId: 0x01,
- timerValue: (0x01 * 60 * 60) + (0x02 * 60) + 0x03}},
- // Deactivate
- {command: "D00C" + // Length
- "8103012701" + // Command details
- "82028182" + // Device identities
- "A40104", // Timer identifier
- expect: {commandQualifier: MozIccManager.STK_TIMER_DEACTIVATE,
- timerAction: MozIccManager.STK_TIMER_DEACTIVATE,
- timerId: 0x04}},
- // Get current value
- {command: "D00C" + // Length
- "8103012702" + // Command details
- "82028182" + // Device identities
- "A40108", // Timer identifier
- expect: {commandQualifier: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
- timerAction: MozIccManager.STK_TIMER_GET_CURRENT_VALUE,
- timerId: 0x08}},
-];
-
-function testTimerManagement(aCommand, aExpect) {
- is(aCommand.commandNumber, 0x01, "commandNumber");
- is(aCommand.typeOfCommand, MozIccManager.STK_CMD_TIMER_MANAGEMENT,
- "typeOfCommand");
- is(aCommand.commandQualifier, aExpect.commandQualifier, "commandQualifier");
-
- is(aCommand.options.timerAction, aExpect.timerAction, "options.timerAction");
- is(aCommand.options.timerId, aExpect.timerId, "options.timerId");
-
- if ("timerValue" in aExpect) {
- is(aCommand.options.timerValue, aExpect.timerValue, "options.timerValue");
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let icc = getMozIcc();
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => {
- log("timer_management_cmd: " + data.command);
-
- let promises = [];
- // Wait onstkcommand event.
- promises.push(waitForTargetEvent(icc, "stkcommand")
- .then((aEvent) => testTimerManagement(aEvent.command, data.expect)));
- // Wait icc-stkcommand system message.
- promises.push(waitForSystemMessage("icc-stkcommand")
- .then((aMessage) => {
- is(aMessage.iccId, icc.iccInfo.iccid, "iccId");
- testTimerManagement(aMessage.command, data.expect);
- }));
- // Send emulator command to generate stk unsolicited event.
- promises.push(sendEmulatorStkPdu(data.command));
-
- return Promise.all(promises);
- });
- }
- return promise;
-});
--- a/dom/ipc/ContentChild.cpp
+++ b/dom/ipc/ContentChild.cpp
@@ -166,18 +166,16 @@
#include "mozilla/X11Util.h"
#endif
#ifdef ACCESSIBILITY
#include "nsAccessibilityService.h"
#endif
#include "mozilla/dom/File.h"
-#include "mozilla/dom/icc/IccChild.h"
-#include "mozilla/dom/mobileconnection/MobileConnectionChild.h"
#include "mozilla/dom/devicestorage/DeviceStorageRequestChild.h"
#include "mozilla/dom/PPresentationChild.h"
#include "mozilla/dom/PresentationIPCService.h"
#include "mozilla/ipc/InputStreamUtils.h"
#ifdef MOZ_WEBSPEECH
#include "mozilla/dom/PSpeechSynthesisChild.h"
#endif
@@ -197,19 +195,17 @@
#include "GMPDecoderModule.h"
#include "gfxPlatform.h"
#include "nscore.h" // for NS_FREE_PERMANENT_DATA
#include "VRManagerChild.h"
using namespace mozilla;
using namespace mozilla::docshell;
using namespace mozilla::dom::devicestorage;
-using namespace mozilla::dom::icc;
using namespace mozilla::dom::ipc;
-using namespace mozilla::dom::mobileconnection;
using namespace mozilla::dom::workers;
using namespace mozilla::media;
using namespace mozilla::embedding;
using namespace mozilla::gmp;
using namespace mozilla::hal_sandbox;
using namespace mozilla::ipc;
using namespace mozilla::layers;
using namespace mozilla::layout;
@@ -1764,41 +1760,16 @@ ContentChild::AllocPHeapSnapshotTempFile
bool
ContentChild::DeallocPHeapSnapshotTempFileHelperChild(
devtools::PHeapSnapshotTempFileHelperChild* aHeapSnapshotHelper)
{
delete aHeapSnapshotHelper;
return true;
}
-PIccChild*
-ContentChild::SendPIccConstructor(PIccChild* aActor,
- const uint32_t& aServiceId)
-{
- // Add an extra ref for IPDL. Will be released in
- // ContentChild::DeallocPIccChild().
- static_cast<IccChild*>(aActor)->AddRef();
- return PContentChild::SendPIccConstructor(aActor, aServiceId);
-}
-
-PIccChild*
-ContentChild::AllocPIccChild(const uint32_t& aServiceId)
-{
- MOZ_CRASH("No one should be allocating PIccChild actors");
- return nullptr;
-}
-
-bool
-ContentChild::DeallocPIccChild(PIccChild* aActor)
-{
- // IccChild is refcounted, must not be freed manually.
- static_cast<IccChild*>(aActor)->Release();
- return true;
-}
-
PTestShellChild*
ContentChild::AllocPTestShellChild()
{
return new TestShellChild();
}
bool
ContentChild::DeallocPTestShellChild(PTestShellChild* shell)
@@ -1830,53 +1801,16 @@ ContentChild::AllocPDeviceStorageRequest
bool
ContentChild::DeallocPDeviceStorageRequestChild(PDeviceStorageRequestChild* aDeviceStorage)
{
delete aDeviceStorage;
return true;
}
-PMobileConnectionChild*
-ContentChild::SendPMobileConnectionConstructor(PMobileConnectionChild* aActor,
- const uint32_t& aClientId)
-{
-#ifdef MOZ_B2G_RIL
- // Add an extra ref for IPDL. Will be released in
- // ContentChild::DeallocPMobileConnectionChild().
- static_cast<MobileConnectionChild*>(aActor)->AddRef();
- return PContentChild::SendPMobileConnectionConstructor(aActor, aClientId);
-#else
- MOZ_CRASH("No support for mobileconnection on this platform!");
-#endif
-}
-
-PMobileConnectionChild*
-ContentChild::AllocPMobileConnectionChild(const uint32_t& aClientId)
-{
-#ifdef MOZ_B2G_RIL
- MOZ_CRASH("No one should be allocating PMobileConnectionChild actors");
- return nullptr;
-#else
- MOZ_CRASH("No support for mobileconnection on this platform!");
-#endif
-}
-
-bool
-ContentChild::DeallocPMobileConnectionChild(PMobileConnectionChild* aActor)
-{
-#ifdef MOZ_B2G_RIL
- // MobileConnectionChild is refcounted, must not be freed manually.
- static_cast<MobileConnectionChild*>(aActor)->Release();
- return true;
-#else
- MOZ_CRASH("No support for mobileconnection on this platform!");
-#endif
-}
-
PNeckoChild*
ContentChild::AllocPNeckoChild()
{
return new NeckoChild();
}
bool
ContentChild::DeallocPNeckoChild(PNeckoChild* necko)
--- a/dom/ipc/ContentChild.h
+++ b/dom/ipc/ContentChild.h
@@ -218,23 +218,16 @@ public:
virtual bool DeallocPHalChild(PHalChild*) override;
virtual PHeapSnapshotTempFileHelperChild*
AllocPHeapSnapshotTempFileHelperChild() override;
virtual bool
DeallocPHeapSnapshotTempFileHelperChild(PHeapSnapshotTempFileHelperChild*) override;
- PIccChild*
- SendPIccConstructor(PIccChild* aActor, const uint32_t& aServiceId);
-
- virtual PIccChild* AllocPIccChild(const uint32_t& aClientId) override;
-
- virtual bool DeallocPIccChild(PIccChild* aActor) override;
-
virtual PMemoryReportRequestChild*
AllocPMemoryReportRequestChild(const uint32_t& aGeneration,
const bool& aAnonymize,
const bool& aMinimizeMemoryUsage,
const MaybeFileDesc& aDMDFile) override;
virtual bool
DeallocPMemoryReportRequestChild(PMemoryReportRequestChild* actor) override;
@@ -275,26 +268,16 @@ public:
virtual PTestShellChild* AllocPTestShellChild() override;
virtual bool DeallocPTestShellChild(PTestShellChild*) override;
virtual bool RecvPTestShellConstructor(PTestShellChild*) override;
jsipc::CPOWManager* GetCPOWManager() override;
- PMobileConnectionChild*
- SendPMobileConnectionConstructor(PMobileConnectionChild* aActor,
- const uint32_t& aClientId);
-
- virtual PMobileConnectionChild*
- AllocPMobileConnectionChild(const uint32_t& aClientId) override;
-
- virtual bool
- DeallocPMobileConnectionChild(PMobileConnectionChild* aActor) override;
-
virtual PNeckoChild* AllocPNeckoChild() override;
virtual bool DeallocPNeckoChild(PNeckoChild*) override;
virtual PPrintingChild* AllocPPrintingChild() override;
virtual bool DeallocPPrintingChild(PPrintingChild*) override;
--- a/dom/ipc/ContentParent.cpp
+++ b/dom/ipc/ContentParent.cpp
@@ -52,18 +52,16 @@
#include "mozilla/dom/GeolocationBinding.h"
#include "mozilla/dom/Notification.h"
#include "mozilla/dom/PContentBridgeParent.h"
#include "mozilla/dom/PContentPermissionRequestParent.h"
#include "mozilla/dom/PCycleCollectWithLogsParent.h"
#include "mozilla/dom/PMemoryReportRequestParent.h"
#include "mozilla/dom/ServiceWorkerRegistrar.h"
#include "mozilla/dom/devicestorage/DeviceStorageRequestParent.h"
-#include "mozilla/dom/icc/IccParent.h"
-#include "mozilla/dom/mobileconnection/MobileConnectionParent.h"
#include "mozilla/dom/power/PowerManagerService.h"
#include "mozilla/dom/Permissions.h"
#include "mozilla/dom/PresentationParent.h"
#include "mozilla/dom/PPresentationParent.h"
#include "mozilla/dom/PushNotifier.h"
#include "mozilla/dom/FlyWebPublishedServerIPC.h"
#include "mozilla/dom/quota/QuotaManagerService.h"
#include "mozilla/dom/time/DateCacheCleaner.h"
@@ -273,19 +271,17 @@ using base::KillProcess;
#ifdef MOZ_ENABLE_PROFILER_SPS
using mozilla::ProfileGatherer;
#endif
#ifdef MOZ_CRASHREPORTER
using namespace CrashReporter;
#endif
using namespace mozilla::dom::devicestorage;
-using namespace mozilla::dom::icc;
using namespace mozilla::dom::power;
-using namespace mozilla::dom::mobileconnection;
using namespace mozilla::media;
using namespace mozilla::embedding;
using namespace mozilla::gfx;
using namespace mozilla::gmp;
using namespace mozilla::hal;
using namespace mozilla::ipc;
using namespace mozilla::layers;
using namespace mozilla::layout;
@@ -3200,37 +3196,16 @@ ContentParent::AllocPHeapSnapshotTempFil
bool
ContentParent::DeallocPHeapSnapshotTempFileHelperParent(
devtools::PHeapSnapshotTempFileHelperParent* aHeapSnapshotHelper)
{
delete aHeapSnapshotHelper;
return true;
}
-PIccParent*
-ContentParent::AllocPIccParent(const uint32_t& aServiceId)
-{
- if (!AssertAppProcessPermission(this, "mobileconnection")) {
- return nullptr;
- }
- IccParent* parent = new IccParent(aServiceId);
- // We release this ref in DeallocPIccParent().
- parent->AddRef();
-
- return parent;
-}
-
-bool
-ContentParent::DeallocPIccParent(PIccParent* aActor)
-{
- // IccParent is refcounted, must not be freed manually.
- static_cast<IccParent*>(aActor)->Release();
- return true;
-}
-
PMemoryReportRequestParent*
ContentParent::AllocPMemoryReportRequestParent(const uint32_t& aGeneration,
const bool &aAnonymize,
const bool &aMinimizeMemoryUsage,
const MaybeFileDesc &aDMDFile)
{
MemoryReportRequestParent* parent =
new MemoryReportRequestParent(aGeneration);
@@ -3278,42 +3253,16 @@ ContentParent::AllocPTestShellParent()
bool
ContentParent::DeallocPTestShellParent(PTestShellParent* shell)
{
delete shell;
return true;
}
-PMobileConnectionParent*
-ContentParent::AllocPMobileConnectionParent(const uint32_t& aClientId)
-{
-#ifdef MOZ_B2G_RIL
- RefPtr<MobileConnectionParent> parent = new MobileConnectionParent(aClientId);
- // We release this ref in DeallocPMobileConnectionParent().
- parent->AddRef();
-
- return parent;
-#else
- MOZ_CRASH("No support for mobileconnection on this platform!");
-#endif
-}
-
-bool
-ContentParent::DeallocPMobileConnectionParent(PMobileConnectionParent* aActor)
-{
-#ifdef MOZ_B2G_RIL
- // MobileConnectionParent is refcounted, must not be freed manually.
- static_cast<MobileConnectionParent*>(aActor)->Release();
- return true;
-#else
- MOZ_CRASH("No support for mobileconnection on this platform!");
-#endif
-}
-
PNeckoParent*
ContentParent::AllocPNeckoParent()
{
return new NeckoParent();
}
bool
ContentParent::DeallocPNeckoParent(PNeckoParent* necko)
--- a/dom/ipc/ContentParent.h
+++ b/dom/ipc/ContentParent.h
@@ -771,20 +771,16 @@ private:
const bool& aActive,
const bool& aHSTSPriming) override;
virtual bool DeallocPHalParent(PHalParent*) override;
virtual bool
DeallocPHeapSnapshotTempFileHelperParent(PHeapSnapshotTempFileHelperParent*) override;
- virtual PIccParent* AllocPIccParent(const uint32_t& aServiceId) override;
-
- virtual bool DeallocPIccParent(PIccParent* aActor) override;
-
virtual PMemoryReportRequestParent*
AllocPMemoryReportRequestParent(const uint32_t& aGeneration,
const bool &aAnonymize,
const bool &aMinimizeMemoryUsage,
const MaybeFileDesc &aDMDFile) override;
virtual bool
DeallocPMemoryReportRequestParent(PMemoryReportRequestParent* actor) override;
@@ -796,20 +792,16 @@ private:
virtual bool
DeallocPCycleCollectWithLogsParent(PCycleCollectWithLogsParent* aActor) override;
virtual PTestShellParent* AllocPTestShellParent() override;
virtual bool DeallocPTestShellParent(PTestShellParent* shell) override;
- virtual PMobileConnectionParent* AllocPMobileConnectionParent(const uint32_t& aClientId) override;
-
- virtual bool DeallocPMobileConnectionParent(PMobileConnectionParent* aActor) override;
-
virtual bool DeallocPNeckoParent(PNeckoParent* necko) override;
virtual PPSMContentDownloaderParent*
AllocPPSMContentDownloaderParent(const uint32_t& aCertType) override;
virtual bool
DeallocPPSMContentDownloaderParent(PPSMContentDownloaderParent* aDownloader) override;
--- a/dom/ipc/PContent.ipdl
+++ b/dom/ipc/PContent.ipdl
@@ -14,22 +14,20 @@ include protocol PCycleCollectWithLogs;
include protocol PCrashReporter;
include protocol PPSMContentDownloader;
include protocol PExternalHelperApp;
include protocol PHandlerService;
include protocol PDeviceStorageRequest;
include protocol PFileDescriptorSet;
include protocol PHal;
include protocol PHeapSnapshotTempFileHelper;
-include protocol PIcc;
include protocol PProcessHangMonitor;
include protocol PImageBridge;
include protocol PMedia;
include protocol PMemoryReportRequest;
-include protocol PMobileConnection;
include protocol PNecko;
// FIXME This is pretty ridiculous, but we have to keep the order of the
// following 4 includes, or the parser is confused about PGMPContent
// bridging PContent and PGMP. As soon as it registers the bridge between
// PContent and PPluginModule it seems to think that PContent's parent and
// child live in the same process!
include protocol PGMPContent;
include protocol PGMPService;
@@ -364,20 +362,18 @@ nested(upto inside_cpow) sync protocol P
manages PCycleCollectWithLogs;
manages PDeviceStorageRequest;
manages PPSMContentDownloader;
manages PExternalHelperApp;
manages PFileDescriptorSet;
manages PHal;
manages PHandlerService;
manages PHeapSnapshotTempFileHelper;
- manages PIcc;
manages PMedia;
manages PMemoryReportRequest;
- manages PMobileConnection;
manages PNecko;
manages POfflineCacheUpdate;
manages PPrinting;
manages PSendStream;
manages PScreenManager;
manages PSpeechSynthesis;
manages PStorage;
manages PTestShell;
@@ -804,20 +800,16 @@ parent:
sync GetLookAndFeelCache()
returns (LookAndFeelInt[] lookAndFeelIntCache);
nested(inside_cpow) async PHal();
async PHeapSnapshotTempFileHelper();
- async PIcc(uint32_t serviceId);
-
- async PMobileConnection(uint32_t clientId);
-
async PNecko();
async PPrinting();
async PSendStream();
nested(inside_sync) sync PScreenManager()
returns (uint32_t numberOfScreens,
deleted file mode 100644
--- a/dom/mobileconnection/Assertions.cpp
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/MozMobileConnectionBinding.h"
-#include "nsIMobileConnectionService.h"
-
-namespace mozilla {
-namespace dom {
-
-#define ASSERT_NETWORK_SELECTION_MODE_EQUALITY(webidlState, xpidlState) \
- static_assert(static_cast<int32_t>(MobileNetworkSelectionMode::webidlState) == nsIMobileConnection::xpidlState, \
- "MobileNetworkSelectionMode::" #webidlState " should equal to nsIMobileConnection::" #xpidlState)
-
-ASSERT_NETWORK_SELECTION_MODE_EQUALITY(Automatic, NETWORK_SELECTION_MODE_AUTOMATIC);
-ASSERT_NETWORK_SELECTION_MODE_EQUALITY(Manual, NETWORK_SELECTION_MODE_MANUAL);
-
-#undef ASSERT_NETWORK_SELECTION_MODE_EQUALITY
-
-#define ASSERT_MOBILE_RADIO_STATE_EQUALITY(webidlState, xpidlState) \
- static_assert(static_cast<int32_t>(MobileRadioState::webidlState) == nsIMobileConnection::xpidlState, \
- "MobileRadioState::" #webidlState " should equal to nsIMobileConnection::" #xpidlState)
-
-ASSERT_MOBILE_RADIO_STATE_EQUALITY(Enabling, MOBILE_RADIO_STATE_ENABLING);
-ASSERT_MOBILE_RADIO_STATE_EQUALITY(Enabled, MOBILE_RADIO_STATE_ENABLED);
-ASSERT_MOBILE_RADIO_STATE_EQUALITY(Disabling, MOBILE_RADIO_STATE_DISABLING);
-ASSERT_MOBILE_RADIO_STATE_EQUALITY(Disabled, MOBILE_RADIO_STATE_DISABLED);
-
-#undef ASSERT_MOBILE_RADIO_STATE_EQUALITY
-
-#define ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY(webidlState, xpidlState) \
- static_assert(static_cast<int32_t>(MobilePreferredNetworkType::webidlState) == nsIMobileConnection::xpidlState, \
- "MobilePreferredNetworkType::" #webidlState " should equal to nsIMobileConnection::" #xpidlState)
-
-ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY(Wcdma_gsm, PREFERRED_NETWORK_TYPE_WCDMA_GSM);
-ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY(Gsm, PREFERRED_NETWORK_TYPE_GSM_ONLY);
-ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY(Wcdma, PREFERRED_NETWORK_TYPE_WCDMA_ONLY);
-ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY(Wcdma_gsm_auto, PREFERRED_NETWORK_TYPE_WCDMA_GSM_AUTO);
-ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY(Cdma_evdo, PREFERRED_NETWORK_TYPE_CDMA_EVDO);
-ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY(Cdma, PREFERRED_NETWORK_TYPE_CDMA_ONLY);
-ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY(Evdo, PREFERRED_NETWORK_TYPE_EVDO_ONLY);
-ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY(Wcdma_gsm_cdma_evdo, PREFERRED_NETWORK_TYPE_WCDMA_GSM_CDMA_EVDO);
-ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY(Lte_cdma_evdo, PREFERRED_NETWORK_TYPE_LTE_CDMA_EVDO);
-ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY(Lte_wcdma_gsm, PREFERRED_NETWORK_TYPE_LTE_WCDMA_GSM);
-ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY(Lte_wcdma_gsm_cdma_evdo, PREFERRED_NETWORK_TYPE_LTE_WCDMA_GSM_CDMA_EVDO);
-ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY(Lte, PREFERRED_NETWORK_TYPE_LTE_ONLY);
-
-#undef ASSERT_PREFERRED_NETWORK_TYPE_EQUALITY
-
-#define ASSERT_MOBILE_ROAMING_MODE_EQUALITY(webidlState, xpidlState) \
- static_assert(static_cast<int32_t>(MobileRoamingMode::webidlState) == nsIMobileConnection::xpidlState, \
- "MobileRoamingMode::" #webidlState " should equal to nsIMobileConnection::" #xpidlState)
-
-ASSERT_MOBILE_ROAMING_MODE_EQUALITY(Home, CDMA_ROAMING_PREFERENCE_HOME);
-ASSERT_MOBILE_ROAMING_MODE_EQUALITY(Affiliated, CDMA_ROAMING_PREFERENCE_AFFILIATED);
-ASSERT_MOBILE_ROAMING_MODE_EQUALITY(Any, CDMA_ROAMING_PREFERENCE_ANY);
-
-#undef ASSERT_MOBILE_ROAMING_MODE_EQUALITY
-
-#define ASSERT_MOBILE_NETWORK_TYPE_EQUALITY(webidlState, xpidlState) \
- static_assert(static_cast<int32_t>(MobileNetworkType::webidlState) == nsIMobileConnection::xpidlState, \
- "MobileNetworkType::" #webidlState " should equal to nsIMobileConnection::" #xpidlState)
-
-ASSERT_MOBILE_NETWORK_TYPE_EQUALITY(Gsm, MOBILE_NETWORK_TYPE_GSM);
-ASSERT_MOBILE_NETWORK_TYPE_EQUALITY(Wcdma, MOBILE_NETWORK_TYPE_WCDMA);
-ASSERT_MOBILE_NETWORK_TYPE_EQUALITY(Cdma, MOBILE_NETWORK_TYPE_CDMA);
-ASSERT_MOBILE_NETWORK_TYPE_EQUALITY(Evdo, MOBILE_NETWORK_TYPE_EVDO);
-ASSERT_MOBILE_NETWORK_TYPE_EQUALITY(Lte, MOBILE_NETWORK_TYPE_LTE);
-
-#undef ASSERT_MOBILE_NETWORK_TYPE_EQUALITY
-
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/mobileconnection/MobileCallForwardingOptions.cpp
+++ /dev/null
@@ -1,74 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/mobileconnection/MobileCallForwardingOptions.h"
-
-namespace mozilla {
-namespace dom {
-namespace mobileconnection {
-
-NS_IMPL_ISUPPORTS(MobileCallForwardingOptions, nsIMobileCallForwardingOptions)
-
-MobileCallForwardingOptions::MobileCallForwardingOptions(bool aActive,
- int16_t aAction,
- int16_t aReason,
- const nsAString& aNumber,
- int16_t aTimeSeconds,
- int16_t aServiceClass)
- : mActive(aActive)
- , mAction(aAction)
- , mReason(aReason)
- , mNumber(aNumber)
- , mTimeSeconds(aTimeSeconds)
- , mServiceClass(aServiceClass)
-{
-}
-
-NS_IMETHODIMP
-MobileCallForwardingOptions::GetActive(bool* aActive)
-{
- *aActive = mActive;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileCallForwardingOptions::GetAction(int16_t* aAction)
-{
- *aAction = mAction;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileCallForwardingOptions::GetReason(int16_t* aReason)
-{
- *aReason = mReason;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileCallForwardingOptions::GetNumber(nsAString& aNumber)
-{
- aNumber = mNumber;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileCallForwardingOptions::GetTimeSeconds(int16_t* aTimeSeconds)
-{
- *aTimeSeconds = mTimeSeconds;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileCallForwardingOptions::GetServiceClass(int16_t *aServiceClass)
-{
- *aServiceClass = mServiceClass;
- return NS_OK;
-}
-
-} // namespace mobileconnection
-} // namespace dom
-} // namespace mozilla
\ No newline at end of file
deleted file mode 100644
--- a/dom/mobileconnection/MobileCallForwardingOptions.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_MobileCallForwardingOptions_h
-#define mozilla_dom_MobileCallForwardingOptions_h
-
-#include "nsIMobileCallForwardingOptions.h"
-#include "nsString.h"
-#include "mozilla/Attributes.h"
-
-namespace mozilla {
-namespace dom {
-namespace mobileconnection {
-
-class MobileCallForwardingOptions final : public nsIMobileCallForwardingOptions
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIMOBILECALLFORWARDINGOPTIONS
-
- MobileCallForwardingOptions(bool aActive, int16_t aAction,
- int16_t aReason, const nsAString& aNumber,
- int16_t aTimeSeconds, int16_t aServiceClass);
-
-private:
- // Don't try to use the default constructor.
- MobileCallForwardingOptions()
- : mActive(false)
- , mAction(0)
- , mReason(0)
- , mTimeSeconds(0)
- , mServiceClass(0)
- {}
-
- ~MobileCallForwardingOptions() {}
-
- bool mActive;
- int16_t mAction;
- int16_t mReason;
- nsString mNumber;
- int16_t mTimeSeconds;
- int16_t mServiceClass;
-};
-
-} // namespace mobileconnection
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_MobileCallForwardingOptions_h
deleted file mode 100644
--- a/dom/mobileconnection/MobileCellInfo.cpp
+++ /dev/null
@@ -1,126 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/MobileCellInfo.h"
-#include "mozilla/dom/MozMobileCellInfoBinding.h"
-
-using namespace mozilla::dom;
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MobileCellInfo, mWindow)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(MobileCellInfo)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(MobileCellInfo)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MobileCellInfo)
- NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
- NS_INTERFACE_MAP_ENTRY(nsISupports)
- NS_INTERFACE_MAP_ENTRY(nsIMobileCellInfo)
-NS_INTERFACE_MAP_END
-
-MobileCellInfo::MobileCellInfo(nsPIDOMWindowInner* aWindow)
- : mWindow(aWindow)
- , mGsmLocationAreaCode(-1)
- , mGsmCellId(-1)
- , mCdmaBaseStationId(-1)
- , mCdmaBaseStationLatitude(-1)
- , mCdmaBaseStationLongitude(-1)
- , mCdmaSystemId(-1)
- , mCdmaNetworkId(-1)
-{
-}
-
-MobileCellInfo::MobileCellInfo(int32_t aGsmLocationAreaCode,
- int64_t aGsmCellId,
- int32_t aCdmaBaseStationId,
- int32_t aCdmaBaseStationLatitude,
- int32_t aCdmaBaseStationLongitude,
- int32_t aCdmaSystemId,
- int32_t aCdmaNetworkId)
- : mGsmLocationAreaCode(aGsmLocationAreaCode)
- , mGsmCellId(aGsmCellId)
- , mCdmaBaseStationId(aCdmaBaseStationId)
- , mCdmaBaseStationLatitude(aCdmaBaseStationLatitude)
- , mCdmaBaseStationLongitude(aCdmaBaseStationLongitude)
- , mCdmaSystemId(aCdmaSystemId)
- , mCdmaNetworkId(aCdmaNetworkId)
-{
- // The instance created by this way is only used for IPC stuff. It won't be
- // exposed to JS directly, we will clone this instance to the one that is
- // maintained in MobileConnectionChild.
-}
-
-void
-MobileCellInfo::Update(nsIMobileCellInfo* aInfo)
-{
- if (!aInfo) {
- return;
- }
-
- aInfo->GetGsmLocationAreaCode(&mGsmLocationAreaCode);
- aInfo->GetGsmCellId(&mGsmCellId);
- aInfo->GetCdmaBaseStationId(&mCdmaBaseStationId);
- aInfo->GetCdmaBaseStationLatitude(&mCdmaBaseStationLatitude);
- aInfo->GetCdmaBaseStationLongitude(&mCdmaBaseStationLongitude);
- aInfo->GetCdmaSystemId(&mCdmaSystemId);
- aInfo->GetCdmaNetworkId(&mCdmaNetworkId);
-}
-
-JSObject*
-MobileCellInfo::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return MozMobileCellInfoBinding::Wrap(aCx, this, aGivenProto);
-}
-
-// nsIMobileCellInfo
-
-NS_IMETHODIMP
-MobileCellInfo::GetGsmLocationAreaCode(int32_t* aGsmLocationAreaCode)
-{
- *aGsmLocationAreaCode = GsmLocationAreaCode();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileCellInfo::GetGsmCellId(int64_t* aGsmCellId)
-{
- *aGsmCellId = GsmCellId();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileCellInfo::GetCdmaBaseStationId(int32_t* aCdmaBaseStationId)
-{
- *aCdmaBaseStationId = CdmaBaseStationId();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileCellInfo::GetCdmaBaseStationLatitude(int32_t* aCdmaBaseStationLatitude)
-{
- *aCdmaBaseStationLatitude = CdmaBaseStationLatitude();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileCellInfo::GetCdmaBaseStationLongitude(int32_t* aCdmaBaseStationLongitude)
-{
- *aCdmaBaseStationLongitude = CdmaBaseStationLongitude();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileCellInfo::GetCdmaSystemId(int32_t* aCdmaSystemId)
-{
- *aCdmaSystemId = CdmaSystemId();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileCellInfo::GetCdmaNetworkId(int32_t* aCdmaNetworkId)
-{
- *aCdmaNetworkId = CdmaNetworkId();
- return NS_OK;
-}
deleted file mode 100644
--- a/dom/mobileconnection/MobileCellInfo.h
+++ /dev/null
@@ -1,104 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_MobileCellInfo_h
-#define mozilla_dom_MobileCellInfo_h
-
-#include "nsIMobileCellInfo.h"
-#include "nsPIDOMWindow.h"
-#include "nsWrapperCache.h"
-
-namespace mozilla {
-namespace dom {
-
-class MobileCellInfo final : public nsIMobileCellInfo
- , public nsWrapperCache
-{
-public:
- NS_DECL_NSIMOBILECELLINFO
- NS_DECL_CYCLE_COLLECTING_ISUPPORTS
- NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MobileCellInfo)
-
- explicit MobileCellInfo(nsPIDOMWindowInner* aWindow);
-
- MobileCellInfo(int32_t aGsmLocationAreaCode, int64_t aGsmCellId,
- int32_t aCdmaBaseStationId, int32_t aCdmaBaseStationLatitude,
- int32_t aCdmaBaseStationLongitude, int32_t aCdmaSystemId,
- int32_t aCdmaNetworkId);
-
- void
- Update(nsIMobileCellInfo* aInfo);
-
- nsPIDOMWindowInner*
- GetParentObject() const
- {
- return mWindow;
- }
-
- virtual JSObject*
- WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
- // WebIDL interface
- int32_t
- GsmLocationAreaCode() const
- {
- return mGsmLocationAreaCode;
- }
-
- int64_t
- GsmCellId() const
- {
- return mGsmCellId;
- }
-
- int32_t
- CdmaBaseStationId() const
- {
- return mCdmaBaseStationId;
- }
-
- int32_t
- CdmaBaseStationLatitude() const
- {
- return mCdmaBaseStationLatitude;
- }
-
- int32_t
- CdmaBaseStationLongitude() const
- {
- return mCdmaBaseStationLongitude;
- }
-
- int32_t
- CdmaSystemId() const
- {
- return mCdmaSystemId;
- }
-
- int32_t
- CdmaNetworkId() const
- {
- return mCdmaNetworkId;
- }
-
-private:
- ~MobileCellInfo() {}
-
-private:
- nsCOMPtr<nsPIDOMWindowInner> mWindow;
- int32_t mGsmLocationAreaCode;
- int64_t mGsmCellId;
- int32_t mCdmaBaseStationId;
- int32_t mCdmaBaseStationLatitude;
- int32_t mCdmaBaseStationLongitude;
- int32_t mCdmaSystemId;
- int32_t mCdmaNetworkId;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_MobileCellInfo_h
deleted file mode 100644
--- a/dom/mobileconnection/MobileConnection.cpp
+++ /dev/null
@@ -1,1174 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/MobileConnection.h"
-
-#include "MobileConnectionCallback.h"
-#include "mozilla/AsyncEventDispatcher.h"
-#include "mozilla/dom/CFStateChangeEvent.h"
-#include "mozilla/dom/DataErrorEvent.h"
-#include "mozilla/dom/MozClirModeEvent.h"
-#include "mozilla/dom/MozEmergencyCbModeEvent.h"
-#include "mozilla/dom/MozOtaStatusEvent.h"
-#include "mozilla/dom/ToJSValue.h"
-#include "mozilla/Preferences.h"
-#include "mozilla/Services.h"
-#include "nsIDOMDOMRequest.h"
-#include "nsIIccInfo.h"
-#include "nsIPermissionManager.h"
-#include "nsIVariant.h"
-#include "nsJSON.h"
-#include "nsJSUtils.h"
-#include "nsServiceManagerUtils.h"
-
-#define MOBILECONN_ERROR_INVALID_PARAMETER NS_LITERAL_STRING("InvalidParameter")
-#define MOBILECONN_ERROR_INVALID_PASSWORD NS_LITERAL_STRING("InvalidPassword")
-
-#ifdef CONVERT_STRING_TO_NULLABLE_ENUM
-#undef CONVERT_STRING_TO_NULLABLE_ENUM
-#endif
-#define CONVERT_STRING_TO_NULLABLE_ENUM(_string, _enumType, _enum) \
-{ \
- uint32_t i = 0; \
- for (const EnumEntry* entry = _enumType##Values::strings; \
- entry->value; \
- ++entry, ++i) { \
- if (_string.EqualsASCII(entry->value)) { \
- _enum.SetValue(static_cast<_enumType>(i)); \
- } \
- } \
-}
-
-using mozilla::ErrorResult;
-using namespace mozilla::dom;
-using namespace mozilla::dom::mobileconnection;
-
-class MobileConnection::Listener final : public nsIMobileConnectionListener
- , public nsIIccListener
-{
- MobileConnection* mMobileConnection;
-
-public:
- NS_DECL_ISUPPORTS
- NS_FORWARD_SAFE_NSIMOBILECONNECTIONLISTENER(mMobileConnection)
- NS_FORWARD_SAFE_NSIICCLISTENER(mMobileConnection)
-
- explicit Listener(MobileConnection* aMobileConnection)
- : mMobileConnection(aMobileConnection)
- {
- MOZ_ASSERT(mMobileConnection);
- }
-
- void Disconnect()
- {
- MOZ_ASSERT(mMobileConnection);
- mMobileConnection = nullptr;
- }
-
-private:
- ~Listener()
- {
- MOZ_ASSERT(!mMobileConnection);
- }
-};
-
-NS_IMPL_ISUPPORTS(MobileConnection::Listener, nsIMobileConnectionListener,
- nsIIccListener)
-
-NS_IMPL_CYCLE_COLLECTION_CLASS(MobileConnection)
-
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(MobileConnection,
- DOMEventTargetHelper)
- // Don't traverse mListener because it doesn't keep any reference to
- // MobileConnection but a raw pointer instead. Neither does mMobileConnection
- // because it's an xpcom service owned object and is only released at shutting
- // down.
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mVoice)
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mData)
- NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mIccHandler)
-NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
-
-NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(MobileConnection,
- DOMEventTargetHelper)
- tmp->Shutdown();
- NS_IMPL_CYCLE_COLLECTION_UNLINK(mVoice)
- NS_IMPL_CYCLE_COLLECTION_UNLINK(mData)
- NS_IMPL_CYCLE_COLLECTION_UNLINK(mIccHandler)
-NS_IMPL_CYCLE_COLLECTION_UNLINK_END
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(MobileConnection)
- // MobileConnection does not expose nsIMobileConnectionListener. mListener is
- // the exposed nsIMobileConnectionListener and forwards the calls it receives
- // to us.
-NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
-
-NS_IMPL_ADDREF_INHERITED(MobileConnection, DOMEventTargetHelper)
-NS_IMPL_RELEASE_INHERITED(MobileConnection, DOMEventTargetHelper)
-
-MobileConnection::MobileConnection(nsPIDOMWindowInner* aWindow,
- uint32_t aClientId)
- : DOMEventTargetHelper(aWindow)
- , mClientId(aClientId)
-{
- nsCOMPtr<nsIMobileConnectionService> service =
- do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
-
- // Per WebAPI design, mIccId should be null instead of an empty string when no
- // SIM card is inserted. Set null as default value.
- mIccId.SetIsVoid(true);
-
- // Not being able to acquire the service isn't fatal since we check
- // for it explicitly below.
- if (!service) {
- NS_WARNING("Could not acquire nsIMobileConnectionService!");
- return;
- }
-
- nsresult rv = service->GetItemByServiceId(mClientId,
- getter_AddRefs(mMobileConnection));
-
- if (NS_FAILED(rv) || !mMobileConnection) {
- NS_WARNING("Could not acquire nsIMobileConnection!");
- return;
- }
-
- mListener = new Listener(this);
- mVoice = new MobileConnectionInfo(GetOwner());
- mData = new MobileConnectionInfo(GetOwner());
-
- if (CheckPermission("mobileconnection")) {
- DebugOnly<nsresult> rv = mMobileConnection->RegisterListener(mListener);
- NS_WARNING_ASSERTION(
- NS_SUCCEEDED(rv),
- "Failed registering mobile connection messages with service");
- UpdateVoice();
- UpdateData();
-
- nsCOMPtr<nsIIccService> iccService = do_GetService(ICC_SERVICE_CONTRACTID);
-
- if (iccService) {
- iccService->GetIccByServiceId(mClientId, getter_AddRefs(mIccHandler));
- }
-
- if (!mIccHandler) {
- NS_WARNING("Could not acquire nsIMobileConnection or nsIIcc!");
- return;
- }
-
- rv = mIccHandler->RegisterListener(mListener);
- NS_WARNING_ASSERTION(NS_SUCCEEDED(rv),
- "Failed registering icc messages with service");
- UpdateIccId();
- }
-}
-
-void
-MobileConnection::Shutdown()
-{
- if (mListener) {
- if (mMobileConnection) {
- mMobileConnection->UnregisterListener(mListener);
- }
-
- if (mIccHandler) {
- mIccHandler->UnregisterListener(mListener);
- }
-
- mListener->Disconnect();
- mListener = nullptr;
- }
-}
-
-MobileConnection::~MobileConnection()
-{
- Shutdown();
-}
-
-void
-MobileConnection::DisconnectFromOwner()
-{
- DOMEventTargetHelper::DisconnectFromOwner();
- // Event listeners can't be handled anymore, so we can shutdown
- // the MobileConnection.
- Shutdown();
-}
-
-JSObject*
-MobileConnection::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return MozMobileConnectionBinding::Wrap(aCx, this, aGivenProto);
-}
-
-bool
-MobileConnection::CheckPermission(const char* aType) const
-{
- nsCOMPtr<nsIPermissionManager> permMgr =
- mozilla::services::GetPermissionManager();
- NS_ENSURE_TRUE(permMgr, false);
-
- uint32_t permission = nsIPermissionManager::DENY_ACTION;
- permMgr->TestPermissionFromWindow(GetOwner(), aType, &permission);
- return permission == nsIPermissionManager::ALLOW_ACTION;
-}
-
-void
-MobileConnection::UpdateVoice()
-{
- if (!mMobileConnection) {
- return;
- }
-
- nsCOMPtr<nsIMobileConnectionInfo> info;
- mMobileConnection->GetVoice(getter_AddRefs(info));
- mVoice->Update(info);
-}
-
-void
-MobileConnection::UpdateData()
-{
- if (!mMobileConnection) {
- return;
- }
-
- nsCOMPtr<nsIMobileConnectionInfo> info;
- mMobileConnection->GetData(getter_AddRefs(info));
- mData->Update(info);
-}
-
-bool
-MobileConnection::UpdateIccId()
-{
- nsAutoString iccId;
- nsCOMPtr<nsIIccInfo> iccInfo;
- if (mIccHandler &&
- NS_SUCCEEDED(mIccHandler->GetIccInfo(getter_AddRefs(iccInfo))) &&
- iccInfo) {
- iccInfo->GetIccid(iccId);
- } else {
- iccId.SetIsVoid(true);
- }
-
- if (!mIccId.Equals(iccId)) {
- mIccId = iccId;
- return true;
- }
-
- return false;
-}
-
-nsresult
-MobileConnection::NotifyError(nsIDOMDOMRequest* aRequest, const nsAString& aMessage)
-{
- nsCOMPtr<nsIDOMRequestService> rs = do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
- NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
-
- return rs->FireErrorAsync(aRequest, aMessage);
-}
-
-bool
-MobileConnection::IsValidPassword(const nsAString& aPassword)
-{
- // Check valid PIN for supplementary services. See TS.22.004 clause 5.2.
- if (aPassword.IsEmpty() || aPassword.Length() != 4) {
- return false;
- }
-
- nsresult rv;
- int32_t password = nsString(aPassword).ToInteger(&rv);
- return NS_SUCCEEDED(rv) && password >= 0 && password <= 9999;
-}
-
-bool
-MobileConnection::IsValidCallForwardingReason(int32_t aReason)
-{
- return aReason >= nsIMobileConnection::CALL_FORWARD_REASON_UNCONDITIONAL &&
- aReason <= nsIMobileConnection::CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING;
-}
-
-bool
-MobileConnection::IsValidCallForwardingAction(int32_t aAction)
-{
- return aAction >= nsIMobileConnection::CALL_FORWARD_ACTION_DISABLE &&
- aAction <= nsIMobileConnection::CALL_FORWARD_ACTION_ERASURE &&
- // Set operation doesn't allow "query" action.
- aAction != nsIMobileConnection::CALL_FORWARD_ACTION_QUERY_STATUS;
-}
-
-bool
-MobileConnection::IsValidCallBarringProgram(int32_t aProgram)
-{
- return aProgram >= nsIMobileConnection::CALL_BARRING_PROGRAM_ALL_OUTGOING &&
- aProgram <= nsIMobileConnection::CALL_BARRING_PROGRAM_INCOMING_SERVICE;
-}
-
-bool
-MobileConnection::IsValidCallBarringOptions(const MozCallBarringOptions& aOptions,
- bool isSetting)
-{
- if (!aOptions.mServiceClass.WasPassed() || aOptions.mServiceClass.Value().IsNull() ||
- !aOptions.mProgram.WasPassed() || aOptions.mProgram.Value().IsNull() ||
- !IsValidCallBarringProgram(aOptions.mProgram.Value().Value())) {
- return false;
- }
-
- // For setting callbarring options, |enabled| and |password| are required.
- if (isSetting &&
- (!aOptions.mEnabled.WasPassed() || aOptions.mEnabled.Value().IsNull() ||
- !aOptions.mPassword.WasPassed() || aOptions.mPassword.Value().IsVoid())) {
- return false;
- }
-
- return true;
-}
-
-bool
-MobileConnection::IsValidCallForwardingOptions(const MozCallForwardingOptions& aOptions)
-{
- if (!aOptions.mReason.WasPassed() || aOptions.mReason.Value().IsNull() ||
- !aOptions.mAction.WasPassed() || aOptions.mAction.Value().IsNull() ||
- !IsValidCallForwardingReason(aOptions.mReason.Value().Value()) ||
- !IsValidCallForwardingAction(aOptions.mAction.Value().Value())) {
- return false;
- }
-
- return true;
-}
-
-// WebIDL interface
-
-void
-MobileConnection::GetLastKnownNetwork(nsString& aRetVal) const
-{
- aRetVal.SetIsVoid(true);
-
- if (!mMobileConnection) {
- return;
- }
-
- mMobileConnection->GetLastKnownNetwork(aRetVal);
-}
-
-void
-MobileConnection::GetLastKnownHomeNetwork(nsString& aRetVal) const
-{
- aRetVal.SetIsVoid(true);
-
- if (!mMobileConnection) {
- return;
- }
-
- mMobileConnection->GetLastKnownHomeNetwork(aRetVal);
-}
-
-// All fields below require the "mobileconnection" permission.
-
-MobileConnectionInfo*
-MobileConnection::Voice() const
-{
- return mVoice;
-}
-
-MobileConnectionInfo*
-MobileConnection::Data() const
-{
- return mData;
-}
-
-void
-MobileConnection::GetIccId(nsString& aRetVal) const
-{
- aRetVal = mIccId;
-}
-
-Nullable<MobileNetworkSelectionMode>
-MobileConnection::GetNetworkSelectionMode() const
-{
- Nullable<MobileNetworkSelectionMode> retVal =
- Nullable<MobileNetworkSelectionMode>();
-
- if (!mMobileConnection) {
- return retVal;
- }
-
- int32_t mode = nsIMobileConnection::NETWORK_SELECTION_MODE_UNKNOWN;
- if (NS_SUCCEEDED(mMobileConnection->GetNetworkSelectionMode(&mode)) &&
- mode != nsIMobileConnection::NETWORK_SELECTION_MODE_UNKNOWN) {
- MOZ_ASSERT(mode < static_cast<int32_t>(MobileNetworkSelectionMode::EndGuard_));
- retVal.SetValue(static_cast<MobileNetworkSelectionMode>(mode));
- }
-
- return retVal;
-}
-
-Nullable<MobileRadioState>
-MobileConnection::GetRadioState() const
-{
- Nullable<MobileRadioState> retVal = Nullable<MobileRadioState>();
-
- if (!mMobileConnection) {
- return retVal;
- }
-
- int32_t state = nsIMobileConnection::MOBILE_RADIO_STATE_UNKNOWN;
- if (NS_SUCCEEDED(mMobileConnection->GetRadioState(&state)) &&
- state != nsIMobileConnection::MOBILE_RADIO_STATE_UNKNOWN) {
- MOZ_ASSERT(state < static_cast<int32_t>(MobileRadioState::EndGuard_));
- retVal.SetValue(static_cast<MobileRadioState>(state));
- }
-
- return retVal;
-}
-
-void
-MobileConnection::GetSupportedNetworkTypes(nsTArray<MobileNetworkType>& aTypes) const
-{
- if (!mMobileConnection) {
- return;
- }
-
- int32_t* types = nullptr;
- uint32_t length = 0;
-
- nsresult rv = mMobileConnection->GetSupportedNetworkTypes(&types, &length);
- NS_ENSURE_SUCCESS_VOID(rv);
-
- for (uint32_t i = 0; i < length; ++i) {
- int32_t type = types[i];
-
- MOZ_ASSERT(type < static_cast<int32_t>(MobileNetworkType::EndGuard_));
- aTypes.AppendElement(static_cast<MobileNetworkType>(type));
- }
-
- free(types);
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::GetNetworks(ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->GetNetworks(requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::SelectNetwork(MobileNetworkInfo& aNetwork, ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->SelectNetwork(&aNetwork, requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::SelectNetworkAutomatically(ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv =
- mMobileConnection->SelectNetworkAutomatically(requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::SetPreferredNetworkType(MobilePreferredNetworkType& aType,
- ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- int32_t type = static_cast<int32_t>(aType);
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv =
- mMobileConnection->SetPreferredNetworkType(type, requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::GetPreferredNetworkType(ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->GetPreferredNetworkType(requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::SetRoamingPreference(MobileRoamingMode& aMode,
- ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- int32_t mode = static_cast<int32_t>(aMode);
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->SetRoamingPreference(mode, requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::GetRoamingPreference(ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->GetRoamingPreference(requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::SetVoicePrivacyMode(bool aEnabled, ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv =
- mMobileConnection->SetVoicePrivacyMode(aEnabled, requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::GetVoicePrivacyMode(ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->GetVoicePrivacyMode(requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::GetCallForwardingOption(uint16_t aReason, ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
-
- if (!IsValidCallForwardingReason(aReason)) {
- nsresult rv = NotifyError(request, MOBILECONN_ERROR_INVALID_PARAMETER);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
- return request.forget();
- }
-
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->GetCallForwarding(aReason, requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::SetCallForwardingOption(const MozCallForwardingOptions& aOptions,
- ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
-
- if (!IsValidCallForwardingOptions(aOptions)) {
- nsresult rv = NotifyError(request, MOBILECONN_ERROR_INVALID_PARAMETER);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
- return request.forget();
- }
-
- // Fill in optional attributes.
- uint16_t timeSeconds = 0;
- if (aOptions.mTimeSeconds.WasPassed() && !aOptions.mTimeSeconds.Value().IsNull()) {
- timeSeconds = aOptions.mTimeSeconds.Value().Value();
- }
- uint16_t serviceClass = nsIMobileConnection::ICC_SERVICE_CLASS_NONE;
- if (aOptions.mServiceClass.WasPassed() && !aOptions.mServiceClass.Value().IsNull()) {
- serviceClass = aOptions.mServiceClass.Value().Value();
- }
- nsAutoString number;
- if (aOptions.mNumber.WasPassed()) {
- number = aOptions.mNumber.Value();
- } else {
- number.SetIsVoid(true);
- }
-
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->SetCallForwarding(aOptions.mAction.Value().Value(),
- aOptions.mReason.Value().Value(),
- number,
- timeSeconds,
- serviceClass,
- requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::GetCallBarringOption(const MozCallBarringOptions& aOptions,
- ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
-
- if (!IsValidCallBarringOptions(aOptions, false)) {
- nsresult rv = NotifyError(request, MOBILECONN_ERROR_INVALID_PARAMETER);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
- return request.forget();
- }
-
- // Fill in optional attributes.
- nsAutoString password;
- if (aOptions.mPassword.WasPassed()) {
- password = aOptions.mPassword.Value();
- } else {
- password.SetIsVoid(true);
- }
-
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->GetCallBarring(aOptions.mProgram.Value().Value(),
- password,
- aOptions.mServiceClass.Value().Value(),
- requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::SetCallBarringOption(const MozCallBarringOptions& aOptions,
- ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
-
- if (!IsValidCallBarringOptions(aOptions, true)) {
- nsresult rv = NotifyError(request, MOBILECONN_ERROR_INVALID_PARAMETER);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
- return request.forget();
- }
-
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->SetCallBarring(aOptions.mProgram.Value().Value(),
- aOptions.mEnabled.Value().Value(),
- aOptions.mPassword.Value(),
- aOptions.mServiceClass.Value().Value(),
- requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::ChangeCallBarringPassword(const MozCallBarringOptions& aOptions,
- ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
-
- if (!aOptions.mPin.WasPassed() || aOptions.mPin.Value().IsVoid() ||
- !aOptions.mNewPin.WasPassed() || aOptions.mNewPin.Value().IsVoid() ||
- !IsValidPassword(aOptions.mPin.Value()) ||
- !IsValidPassword(aOptions.mNewPin.Value())) {
- nsresult rv = NotifyError(request, MOBILECONN_ERROR_INVALID_PASSWORD);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
- return request.forget();
- }
-
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv =
- mMobileConnection->ChangeCallBarringPassword(aOptions.mPin.Value(),
- aOptions.mNewPin.Value(),
- requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::GetCallWaitingOption(ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->GetCallWaiting(requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::SetCallWaitingOption(bool aEnabled, ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->SetCallWaiting(aEnabled,
- nsIMobileConnection::ICC_SERVICE_CLASS_VOICE,
- requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::GetCallingLineIdRestriction(ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv =
- mMobileConnection->GetCallingLineIdRestriction(requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::SetCallingLineIdRestriction(uint16_t aMode,
- ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv =
- mMobileConnection->SetCallingLineIdRestriction(aMode, requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::ExitEmergencyCbMode(ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->ExitEmergencyCbMode(requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-already_AddRefed<DOMRequest>
-MobileConnection::SetRadioEnabled(bool aEnabled, ErrorResult& aRv)
-{
- if (!mMobileConnection) {
- aRv.Throw(NS_ERROR_FAILURE);
- return nullptr;
- }
-
- RefPtr<DOMRequest> request = new DOMRequest(GetOwner());
- RefPtr<MobileConnectionCallback> requestCallback =
- new MobileConnectionCallback(GetOwner(), request);
-
- nsresult rv = mMobileConnection->SetRadioEnabled(aEnabled, requestCallback);
- if (NS_FAILED(rv)) {
- aRv.Throw(rv);
- return nullptr;
- }
-
- return request.forget();
-}
-
-// nsIMobileConnectionListener
-
-NS_IMETHODIMP
-MobileConnection::NotifyVoiceChanged()
-{
- if (!CheckPermission("mobileconnection")) {
- return NS_OK;
- }
-
- UpdateVoice();
-
- return DispatchTrustedEvent(NS_LITERAL_STRING("voicechange"));
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyDataChanged()
-{
- if (!CheckPermission("mobileconnection")) {
- return NS_OK;
- }
-
- UpdateData();
-
- return DispatchTrustedEvent(NS_LITERAL_STRING("datachange"));
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyDataError(const nsAString& aMessage)
-{
- if (!CheckPermission("mobileconnection")) {
- return NS_OK;
- }
-
- DataErrorEventInit init;
- init.mBubbles = false;
- init.mCancelable = false;
- init.mMessage = aMessage;
-
- RefPtr<DataErrorEvent> event =
- DataErrorEvent::Constructor(this, NS_LITERAL_STRING("dataerror"), init);
-
- return DispatchTrustedEvent(event);
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyCFStateChanged(unsigned short aAction,
- unsigned short aReason,
- const nsAString& aNumber,
- unsigned short aSeconds,
- unsigned short aServiceClass)
-{
- if (!CheckPermission("mobileconnection")) {
- return NS_OK;
- }
-
- CFStateChangeEventInit init;
- init.mBubbles = false;
- init.mCancelable = false;
- init.mAction = aAction;
- init.mReason = aReason;
- init.mNumber = aNumber;
- init.mTimeSeconds = aSeconds;
- init.mServiceClass = aServiceClass;
-
- RefPtr<CFStateChangeEvent> event =
- CFStateChangeEvent::Constructor(this, NS_LITERAL_STRING("cfstatechange"), init);
-
- return DispatchTrustedEvent(event);
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyEmergencyCbModeChanged(bool aActive,
- uint32_t aTimeoutMs)
-{
- if (!CheckPermission("mobileconnection")) {
- return NS_OK;
- }
-
- MozEmergencyCbModeEventInit init;
- init.mBubbles = false;
- init.mCancelable = false;
- init.mActive = aActive;
- init.mTimeoutMs = aTimeoutMs;
-
- RefPtr<MozEmergencyCbModeEvent> event =
- MozEmergencyCbModeEvent::Constructor(this, NS_LITERAL_STRING("emergencycbmodechange"), init);
-
- return DispatchTrustedEvent(event);
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyOtaStatusChanged(const nsAString& aStatus)
-{
- if (!CheckPermission("mobileconnection")) {
- return NS_OK;
- }
-
- MozOtaStatusEventInit init;
- init.mBubbles = false;
- init.mCancelable = false;
- init.mStatus = aStatus;
-
- RefPtr<MozOtaStatusEvent> event =
- MozOtaStatusEvent::Constructor(this, NS_LITERAL_STRING("otastatuschange"), init);
-
- return DispatchTrustedEvent(event);
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyRadioStateChanged()
-{
- if (!CheckPermission("mobileconnection")) {
- return NS_OK;
- }
-
- return DispatchTrustedEvent(NS_LITERAL_STRING("radiostatechange"));
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyClirModeChanged(uint32_t aMode)
-{
- if (!CheckPermission("mobileconnection")) {
- return NS_OK;
- }
-
- MozClirModeEventInit init;
- init.mBubbles = false;
- init.mCancelable = false;
- init.mMode = aMode;
-
- RefPtr<MozClirModeEvent> event =
- MozClirModeEvent::Constructor(this, NS_LITERAL_STRING("clirmodechange"), init);
-
- return DispatchTrustedEvent(event);
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyLastKnownNetworkChanged()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyLastKnownHomeNetworkChanged()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyNetworkSelectionModeChanged()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyDeviceIdentitiesChanged()
-{
- // To be supported when bug 1222870 is required in m-c.
- return NS_OK;
-}
-
-// nsIIccListener
-
-NS_IMETHODIMP
-MobileConnection::NotifyStkCommand(nsIStkProactiveCmd *aStkProactiveCmd)
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyStkSessionEnd()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyCardStateChanged()
-{
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnection::NotifyIccInfoChanged()
-{
- if (!CheckPermission("mobileconnection")) {
- return NS_OK;
- }
-
- if (!UpdateIccId()) {
- return NS_OK;
- }
-
- RefPtr<AsyncEventDispatcher> asyncDispatcher =
- new AsyncEventDispatcher(this, NS_LITERAL_STRING("iccchange"), false);
-
- return asyncDispatcher->PostDOMEvent();
-}
deleted file mode 100644
--- a/dom/mobileconnection/MobileConnection.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_MobileConnection_h
-#define mozilla_dom_MobileConnection_h
-
-#include "mozilla/DOMEventTargetHelper.h"
-#include "mozilla/dom/DOMRequest.h"
-#include "mozilla/dom/MobileConnectionInfo.h"
-#include "mozilla/dom/MobileNetworkInfo.h"
-#include "mozilla/dom/MozMobileConnectionBinding.h"
-#include "nsCycleCollectionParticipant.h"
-#include "nsIIccService.h"
-#include "nsIMobileConnectionService.h"
-#include "nsWeakPtr.h"
-
-namespace mozilla {
-namespace dom {
-
-class MobileConnection final : public DOMEventTargetHelper
- , private nsIMobileConnectionListener
- , private nsIIccListener
-{
- /**
- * Class MobileConnection doesn't actually expose
- * nsIMobileConnectionListener. Instead, it owns an
- * nsIMobileConnectionListener derived instance mListener and passes it to
- * nsIMobileConnectionService. The onreceived events are first delivered to
- * mListener and then forwarded to its owner, MobileConnection. See also bug
- * 775997 comment #51.
- */
- class Listener;
-
-public:
- NS_DECL_ISUPPORTS_INHERITED
- NS_DECL_NSIMOBILECONNECTIONLISTENER
- NS_DECL_NSIICCLISTENER
- NS_REALLY_FORWARD_NSIDOMEVENTTARGET(DOMEventTargetHelper)
- NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(MobileConnection,
- DOMEventTargetHelper)
-
- MobileConnection(nsPIDOMWindowInner* aWindow, uint32_t aClientId);
-
- void
- Shutdown();
-
- virtual void
- DisconnectFromOwner() override;
-
- nsPIDOMWindowInner*
- GetParentObject() const
- {
- return GetOwner();
- }
-
- // WrapperCache
- virtual JSObject*
- WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
- // WebIDL interface
- void
- GetLastKnownNetwork(nsString& aRetVal) const;
-
- void
- GetLastKnownHomeNetwork(nsString& aRetVal) const;
-
- MobileConnectionInfo*
- Voice() const;
-
- MobileConnectionInfo*
- Data() const;
-
- void
- GetIccId(nsString& aRetVal) const;
-
- Nullable<MobileNetworkSelectionMode>
- GetNetworkSelectionMode() const;
-
- Nullable<MobileRadioState>
- GetRadioState() const;
-
- void
- GetSupportedNetworkTypes(nsTArray<MobileNetworkType>& aTypes) const;
-
- already_AddRefed<DOMRequest>
- GetNetworks(ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- SelectNetwork(MobileNetworkInfo& aNetwork, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- SelectNetworkAutomatically(ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- SetPreferredNetworkType(MobilePreferredNetworkType& aType, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- GetPreferredNetworkType(ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- SetRoamingPreference(MobileRoamingMode& aMode, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- GetRoamingPreference(ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- SetVoicePrivacyMode(bool aEnabled, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- GetVoicePrivacyMode(ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- SetCallForwardingOption(const MozCallForwardingOptions& aOptions,
- ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- GetCallForwardingOption(uint16_t aReason, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- SetCallBarringOption(const MozCallBarringOptions& aOptions, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- GetCallBarringOption(const MozCallBarringOptions& aOptions, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- ChangeCallBarringPassword(const MozCallBarringOptions& aOptions,
- ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- SetCallWaitingOption(bool aEnabled, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- GetCallWaitingOption(ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- SetCallingLineIdRestriction(uint16_t aMode, ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- GetCallingLineIdRestriction(ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- ExitEmergencyCbMode(ErrorResult& aRv);
-
- already_AddRefed<DOMRequest>
- SetRadioEnabled(bool aEnabled, ErrorResult& aRv);
-
- IMPL_EVENT_HANDLER(voicechange)
- IMPL_EVENT_HANDLER(datachange)
- IMPL_EVENT_HANDLER(dataerror)
- IMPL_EVENT_HANDLER(cfstatechange)
- IMPL_EVENT_HANDLER(emergencycbmodechange)
- IMPL_EVENT_HANDLER(otastatuschange)
- IMPL_EVENT_HANDLER(iccchange)
- IMPL_EVENT_HANDLER(radiostatechange)
- IMPL_EVENT_HANDLER(clirmodechange)
-
-private:
- ~MobileConnection();
-
-private:
- uint32_t mClientId;
- nsString mIccId;
- nsCOMPtr<nsIMobileConnection> mMobileConnection;
- nsCOMPtr<nsIIcc> mIccHandler;
- RefPtr<Listener> mListener;
- RefPtr<MobileConnectionInfo> mVoice;
- RefPtr<MobileConnectionInfo> mData;
-
- bool
- CheckPermission(const char* aType) const;
-
- void
- UpdateVoice();
-
- void
- UpdateData();
-
- bool
- UpdateIccId();
-
- nsresult
- NotifyError(nsIDOMDOMRequest* aRequest, const nsAString& aMessage);
-
- bool
- IsValidPassword(const nsAString& aPassword);
-
- bool
- IsValidCallBarringOptions(const MozCallBarringOptions& aOptions, bool isSetting);
-
- bool
- IsValidCallForwardingOptions(const MozCallForwardingOptions& aOptions);
-
- bool
- IsValidCallForwardingReason(int32_t aReason);
-
- bool
- IsValidCallForwardingAction(int32_t aAction);
-
- bool
- IsValidCallBarringProgram(int32_t aProgram);
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_MobileConnection_h
deleted file mode 100644
--- a/dom/mobileconnection/MobileConnectionArray.cpp
+++ /dev/null
@@ -1,113 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/MobileConnectionArray.h"
-#include "mozilla/dom/MozMobileConnectionArrayBinding.h"
-#include "mozilla/Preferences.h"
-#include "nsServiceManagerUtils.h"
-
-// Service instantiation
-#include "ipc/MobileConnectionIPCService.h"
-#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
-#include "nsIGonkMobileConnectionService.h"
-#endif
-#include "nsXULAppAPI.h" // For XRE_GetProcessType()
-
-using namespace mozilla::dom;
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MobileConnectionArray,
- mWindow,
- mMobileConnections)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(MobileConnectionArray)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(MobileConnectionArray)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MobileConnectionArray)
- NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
- NS_INTERFACE_MAP_ENTRY(nsISupports)
-NS_INTERFACE_MAP_END
-
-MobileConnectionArray::MobileConnectionArray(nsPIDOMWindowInner* aWindow)
- : mLengthInitialized(false)
- , mWindow(aWindow)
-{
-}
-
-MobileConnectionArray::~MobileConnectionArray()
-{
-}
-
-nsPIDOMWindowInner*
-MobileConnectionArray::GetParentObject() const
-{
- MOZ_ASSERT(mWindow);
- return mWindow;
-}
-
-JSObject*
-MobileConnectionArray::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return MozMobileConnectionArrayBinding::Wrap(aCx, this, aGivenProto);
-}
-
-MobileConnection*
-MobileConnectionArray::Item(uint32_t aIndex)
-{
- bool unused;
- return IndexedGetter(aIndex, unused);
-}
-
-uint32_t
-MobileConnectionArray::Length()
-{
- if (!mLengthInitialized) {
- mLengthInitialized = true;
-
- nsCOMPtr<nsIMobileConnectionService> service =
- do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
- NS_ENSURE_TRUE(service, 0);
-
- uint32_t length = 0;
- nsresult rv = service->GetNumItems(&length);
- NS_ENSURE_SUCCESS(rv, 0);
-
- mMobileConnections.SetLength(length);
- }
-
- return mMobileConnections.Length();
-}
-
-MobileConnection*
-MobileConnectionArray::IndexedGetter(uint32_t aIndex, bool& aFound)
-{
-
- aFound = aIndex < Length();
- if (!aFound) {
- return nullptr;
- }
-
- if (!mMobileConnections[aIndex]) {
- mMobileConnections[aIndex] = new MobileConnection(mWindow, aIndex);
- }
-
- return mMobileConnections[aIndex];
-}
-
-already_AddRefed<nsIMobileConnectionService>
-NS_CreateMobileConnectionService()
-{
- nsCOMPtr<nsIMobileConnectionService> service;
-
- if (XRE_IsContentProcess()) {
- service = new mozilla::dom::mobileconnection::MobileConnectionIPCService();
- } else {
-#if defined(MOZ_WIDGET_GONK) && defined(MOZ_B2G_RIL)
- service = do_GetService(GONK_MOBILECONNECTION_SERVICE_CONTRACTID);
-#endif
- }
-
- return service.forget();
-}
deleted file mode 100644
--- a/dom/mobileconnection/MobileConnectionArray.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_network_MobileConnectionArray_h__
-#define mozilla_dom_network_MobileConnectionArray_h__
-
-#include "mozilla/dom/MobileConnection.h"
-#include "nsWrapperCache.h"
-
-namespace mozilla {
-namespace dom {
-
-class MobileConnectionArray final : public nsISupports
- , public nsWrapperCache
-{
-public:
- NS_DECL_CYCLE_COLLECTING_ISUPPORTS
- NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MobileConnectionArray)
-
- explicit MobileConnectionArray(nsPIDOMWindowInner* aWindow);
-
- nsPIDOMWindowInner*
- GetParentObject() const;
-
- // WrapperCache
- virtual JSObject*
- WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
- // WebIDL
- MobileConnection*
- Item(uint32_t aIndex);
-
- uint32_t
- Length();
-
- MobileConnection*
- IndexedGetter(uint32_t aIndex, bool& aFound);
-
-private:
- ~MobileConnectionArray();
-
- bool mLengthInitialized;
-
- nsCOMPtr<nsPIDOMWindowInner> mWindow;
- nsTArray<RefPtr<MobileConnection>> mMobileConnections;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_network_MobileConnectionArray_h__
deleted file mode 100644
--- a/dom/mobileconnection/MobileConnectionCallback.cpp
+++ /dev/null
@@ -1,258 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "MobileConnectionCallback.h"
-
-#include "mozilla/dom/MobileNetworkInfo.h"
-#include "mozilla/dom/MozMobileConnectionBinding.h"
-#include "mozilla/dom/ToJSValue.h"
-#include "nsJSUtils.h"
-#include "nsServiceManagerUtils.h"
-
-namespace mozilla {
-namespace dom {
-namespace mobileconnection {
-
-#define CONVERT_ENUM_TO_STRING(_enumType, _enum, _string) \
-{ \
- uint32_t index = uint32_t(_enum); \
- _string.AssignASCII(_enumType##Values::strings[index].value, \
- _enumType##Values::strings[index].length); \
-}
-
-NS_IMPL_ISUPPORTS(MobileConnectionCallback, nsIMobileConnectionCallback)
-
-MobileConnectionCallback::MobileConnectionCallback(nsPIDOMWindowInner* aWindow,
- DOMRequest* aRequest)
- : mWindow(aWindow)
- , mRequest(aRequest)
-{
-}
-
-/**
- * Notify Success.
- */
-nsresult
-MobileConnectionCallback::NotifySuccess(JS::Handle<JS::Value> aResult)
-{
- nsCOMPtr<nsIDOMRequestService> rs = do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
- NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
-
- return rs->FireSuccessAsync(mRequest, aResult);
-}
-
-/**
- * Notify Success with string.
- */
-nsresult
-MobileConnectionCallback::NotifySuccessWithString(const nsAString& aResult)
-{
- AutoJSAPI jsapi;
- if (NS_WARN_IF(!jsapi.Init(mWindow))) {
- return NS_ERROR_FAILURE;
- }
-
- JSContext* cx = jsapi.cx();
- JS::Rooted<JS::Value> jsResult(cx);
-
- if (!ToJSValue(cx, aResult, &jsResult)) {
- jsapi.ClearException();
- return NS_ERROR_TYPE_ERR;
- }
-
- return NotifySuccess(jsResult);
-}
-
-// nsIMobileConnectionCallback
-
-NS_IMETHODIMP
-MobileConnectionCallback::NotifySuccess()
-{
- return NotifySuccess(JS::UndefinedHandleValue);
-}
-
-NS_IMETHODIMP
-MobileConnectionCallback::NotifySuccessWithBoolean(bool aResult)
-{
- return aResult ? NotifySuccess(JS::TrueHandleValue)
- : NotifySuccess(JS::FalseHandleValue);
-}
-
-NS_IMETHODIMP
-MobileConnectionCallback::NotifyGetNetworksSuccess(uint32_t aCount,
- nsIMobileNetworkInfo** aNetworks)
-{
- nsTArray<RefPtr<MobileNetworkInfo>> results;
- for (uint32_t i = 0; i < aCount; i++)
- {
- RefPtr<MobileNetworkInfo> networkInfo = new MobileNetworkInfo(mWindow);
- networkInfo->Update(aNetworks[i]);
- results.AppendElement(networkInfo);
- }
-
- AutoJSAPI jsapi;
- if (NS_WARN_IF(!jsapi.Init(mWindow))) {
- return NS_ERROR_FAILURE;
- }
-
- JSContext* cx = jsapi.cx();
- JS::Rooted<JS::Value> jsResult(cx);
-
- if (!ToJSValue(cx, results, &jsResult)) {
- jsapi.ClearException();
- return NS_ERROR_TYPE_ERR;
- }
-
- return NotifySuccess(jsResult);
-}
-
-NS_IMETHODIMP
-MobileConnectionCallback::NotifyGetCallForwardingSuccess(uint32_t aCount,
- nsIMobileCallForwardingOptions** aResults)
-{
- nsTArray<MozCallForwardingOptions> results;
- for (uint32_t i = 0; i < aCount; i++)
- {
- MozCallForwardingOptions result;
- int16_t pShort;
- nsString pString;
- bool pBool;
-
- aResults[i]->GetActive(&pBool);
- result.mActive.Construct(pBool);
-
- aResults[i]->GetAction(&pShort);
- if (pShort != nsIMobileConnection::CALL_FORWARD_ACTION_UNKNOWN) {
- result.mAction.Construct(pShort);
- }
-
- aResults[i]->GetReason(&pShort);
- if (pShort != nsIMobileConnection::CALL_FORWARD_REASON_UNKNOWN) {
- result.mReason.Construct(pShort);
- }
-
- aResults[i]->GetNumber(pString);
- result.mNumber.Construct(pString.get());
-
- aResults[i]->GetTimeSeconds(&pShort);
- if (pShort >= 0) {
- result.mTimeSeconds.Construct(pShort);
- }
-
- aResults[i]->GetServiceClass(&pShort);
- if (pShort != nsIMobileConnection::ICC_SERVICE_CLASS_NONE) {
- result.mServiceClass.Construct(pShort);
- }
-
- results.AppendElement(result);
- }
-
- AutoJSAPI jsapi;
- if (NS_WARN_IF(!jsapi.Init(mWindow))) {
- return NS_ERROR_FAILURE;
- }
-
- JSContext* cx = jsapi.cx();
- JS::Rooted<JS::Value> jsResult(cx);
-
- if (!ToJSValue(cx, results, &jsResult)) {
- jsapi.ClearException();
- return NS_ERROR_TYPE_ERR;
- }
-
- return NotifySuccess(jsResult);
-}
-
-NS_IMETHODIMP
-MobileConnectionCallback::NotifyGetCallBarringSuccess(uint16_t aProgram,
- bool aEnabled,
- uint16_t aServiceClass)
-{
- MozCallBarringOptions result;
- result.mProgram.Construct().SetValue(aProgram);
- result.mEnabled.Construct().SetValue(aEnabled);
- result.mServiceClass.Construct().SetValue(aServiceClass);
-
- AutoJSAPI jsapi;
- if (NS_WARN_IF(!jsapi.Init(mWindow))) {
- return NS_ERROR_FAILURE;
- }
-
- JSContext* cx = jsapi.cx();
- JS::Rooted<JS::Value> jsResult(cx);
- if (!ToJSValue(cx, result, &jsResult)) {
- jsapi.ClearException();
- return NS_ERROR_TYPE_ERR;
- }
-
- return NotifySuccess(jsResult);
-}
-
-NS_IMETHODIMP
-MobileConnectionCallback::NotifyGetCallWaitingSuccess(uint16_t aServiceClass)
-{
- return (aServiceClass & nsIMobileConnection::ICC_SERVICE_CLASS_VOICE)
- ? NotifySuccess(JS::TrueHandleValue)
- : NotifySuccess(JS::FalseHandleValue);
-}
-
-NS_IMETHODIMP
-MobileConnectionCallback::NotifyGetClirStatusSuccess(uint16_t aN, uint16_t aM)
-{
- MozClirStatus result;
- result.mN.Construct(aN);
- result.mM.Construct(aM);
-
- AutoJSAPI jsapi;
- if (NS_WARN_IF(!jsapi.Init(mWindow))) {
- return NS_ERROR_FAILURE;
- }
-
- JSContext* cx = jsapi.cx();
- JS::Rooted<JS::Value> jsResult(cx);
- if (!ToJSValue(cx, result, &jsResult)) {
- jsapi.ClearException();
- return NS_ERROR_TYPE_ERR;
- }
-
- return NotifySuccess(jsResult);
-};
-
-NS_IMETHODIMP
-MobileConnectionCallback::NotifyGetPreferredNetworkTypeSuccess(int32_t aType)
-{
- MOZ_ASSERT(aType < static_cast<int32_t>(MobilePreferredNetworkType::EndGuard_));
- MobilePreferredNetworkType type = static_cast<MobilePreferredNetworkType>(aType);
-
- nsAutoString typeString;
- CONVERT_ENUM_TO_STRING(MobilePreferredNetworkType, type, typeString);
-
- return NotifySuccessWithString(typeString);
-};
-
-NS_IMETHODIMP
-MobileConnectionCallback::NotifyGetRoamingPreferenceSuccess(int32_t aMode)
-{
- MOZ_ASSERT(aMode < static_cast<int32_t>(MobileRoamingMode::EndGuard_));
- MobileRoamingMode mode = static_cast<MobileRoamingMode>(aMode);
-
- nsAutoString modeString;
- CONVERT_ENUM_TO_STRING(MobileRoamingMode, mode, modeString);
-
- return NotifySuccessWithString(modeString);
-};
-
-NS_IMETHODIMP
-MobileConnectionCallback::NotifyError(const nsAString& aName)
-{
- nsCOMPtr<nsIDOMRequestService> rs = do_GetService(DOMREQUEST_SERVICE_CONTRACTID);
- NS_ENSURE_TRUE(rs, NS_ERROR_FAILURE);
- return rs->FireErrorAsync(mRequest, aName);
-}
-
-} // namespace mobileconnection
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/mobileconnection/MobileConnectionCallback.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_mobileconnection_MobileConnectionCallback_h
-#define mozilla_dom_mobileconnection_MobileConnectionCallback_h
-
-#include "mozilla/dom/DOMRequest.h"
-#include "mozilla/dom/mobileconnection/MobileConnectionIPCSerializer.h"
-#include "nsCOMPtr.h"
-#include "nsIMobileConnectionService.h"
-
-namespace mozilla {
-namespace dom {
-namespace mobileconnection {
-
-/**
- * A callback object for handling asynchronous request/response. This object is
- * created when an asynchronous request is made and should be destroyed after
- * Notify*Success/Error is called.
- * The modules hold the reference of MobileConnectionCallback in OOP mode and
- * non-OOP mode are different.
- * - OOP mode: MobileConnectionRequestChild
- * - non-OOP mode: MobileConnectionService
- * The reference should be released after Notify*Success/Error is called.
- */
-class MobileConnectionCallback final : public nsIMobileConnectionCallback
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIMOBILECONNECTIONCALLBACK
-
- MobileConnectionCallback(nsPIDOMWindowInner* aWindow, DOMRequest* aRequest);
-
-private:
- ~MobileConnectionCallback() {}
-
- nsresult
- NotifySuccess(JS::Handle<JS::Value> aResult);
-
- nsresult
- NotifySuccessWithString(const nsAString& aResult);
-
- nsCOMPtr<nsPIDOMWindowInner> mWindow;
- RefPtr<DOMRequest> mRequest;
-};
-
-} // namespace mobileconnection
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_mobileconnection_MobileConnectionCallback_h
deleted file mode 100644
--- a/dom/mobileconnection/MobileConnectionInfo.cpp
+++ /dev/null
@@ -1,241 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/MobileConnectionInfo.h"
-
-#include "mozilla/dom/ScriptSettings.h"
-
-#include "jsapi.h"
-
-#ifdef CONVERT_STRING_TO_NULLABLE_ENUM
-#undef CONVERT_STRING_TO_NULLABLE_ENUM
-#endif
-#define CONVERT_STRING_TO_NULLABLE_ENUM(_string, _enumType, _enum) \
-{ \
- _enum.SetNull(); \
- \
- uint32_t i = 0; \
- for (const EnumEntry* entry = _enumType##Values::strings; \
- entry->value; \
- ++entry, ++i) { \
- if (_string.EqualsASCII(entry->value)) { \
- _enum.SetValue(static_cast<_enumType>(i)); \
- } \
- } \
-}
-
-#define CONVERT_NULLABLE_ENUM_TO_STRING(_enumType, _enum, _string) \
-{ \
- if (_enum.IsNull()) { \
- _string.SetIsVoid(true); \
- } else { \
- uint32_t index = uint32_t(_enum.Value()); \
- _string.AssignASCII(_enumType##Values::strings[index].value, \
- _enumType##Values::strings[index].length); \
- } \
-}
-
-using namespace mozilla::dom;
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MobileConnectionInfo, mWindow,
- mNetworkInfo, mCellInfo)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(MobileConnectionInfo)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(MobileConnectionInfo)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MobileConnectionInfo)
- NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
- NS_INTERFACE_MAP_ENTRY(nsISupports)
- NS_INTERFACE_MAP_ENTRY(nsIMobileConnectionInfo)
-NS_INTERFACE_MAP_END
-
-MobileConnectionInfo::MobileConnectionInfo(nsPIDOMWindowInner* aWindow)
- : mConnected(false)
- , mEmergencyCallsOnly(false)
- , mRoaming(false)
- , mWindow(aWindow)
-{
-}
-
-MobileConnectionInfo::MobileConnectionInfo(const nsAString& aState,
- bool aConnected,
- bool aEmergencyCallsOnly,
- bool aRoaming,
- nsIMobileNetworkInfo* aNetworkInfo,
- const nsAString& aType,
- const Nullable<int32_t>& aSignalStrength,
- const Nullable<uint16_t>& aRelSignalStrength,
- nsIMobileCellInfo* aCellInfo)
- : mConnected(aConnected)
- , mEmergencyCallsOnly(aEmergencyCallsOnly)
- , mRoaming(aRoaming)
- , mSignalStrength(aSignalStrength)
- , mRelSignalStrength(aRelSignalStrength)
-{
- // The instance created by this way is only used for IPC stuff. It won't be
- // exposed to JS directly, we will clone this instance to the one that is
- // maintained in MobileConnectionChild.
-
- // Update mState and mType
- CONVERT_STRING_TO_NULLABLE_ENUM(aState, MobileConnectionState, mState);
- CONVERT_STRING_TO_NULLABLE_ENUM(aType, MobileConnectionType, mType);
-
- // Update mNetworkInfo
- if (aNetworkInfo) {
- mNetworkInfo = new MobileNetworkInfo(mWindow);
- mNetworkInfo->Update(aNetworkInfo);
- }
-
- // Update mCellInfo
- if (aCellInfo) {
- mCellInfo = new MobileCellInfo(mWindow);
- mCellInfo->Update(aCellInfo);
- }
-}
-
-void
-MobileConnectionInfo::Update(nsIMobileConnectionInfo* aInfo)
-{
- if (!aInfo) {
- return;
- }
-
- aInfo->GetConnected(&mConnected);
- aInfo->GetEmergencyCallsOnly(&mEmergencyCallsOnly);
- aInfo->GetRoaming(&mRoaming);
-
- // Update mState
- nsAutoString state;
- aInfo->GetState(state);
- CONVERT_STRING_TO_NULLABLE_ENUM(state, MobileConnectionState, mState);
-
- // Update mType
- nsAutoString type;
- aInfo->GetType(type);
- CONVERT_STRING_TO_NULLABLE_ENUM(type, MobileConnectionType, mType);
-
- // Update mSignalStrength
- AutoJSContext cx;
- JS::Rooted<JS::Value> signalStrength(cx, JS::UndefinedValue());
- aInfo->GetSignalStrength(&signalStrength);
- if (signalStrength.isNumber()) {
- mSignalStrength.SetValue(signalStrength.toNumber());
- } else {
- mSignalStrength.SetNull();
- }
-
- // Update mRelSignalStrength
- JS::Rooted<JS::Value> relSignalStrength(cx, JS::UndefinedValue());
- aInfo->GetRelSignalStrength(&relSignalStrength);
- if (relSignalStrength.isNumber()) {
- mRelSignalStrength.SetValue(relSignalStrength.toNumber());
- } else {
- mRelSignalStrength.SetNull();
- }
-
- // Update mNetworkInfo
- nsCOMPtr<nsIMobileNetworkInfo> networkInfo;
- aInfo->GetNetwork(getter_AddRefs(networkInfo));
- if (networkInfo) {
- if (!mNetworkInfo) {
- mNetworkInfo = new MobileNetworkInfo(mWindow);
- }
- mNetworkInfo->Update(networkInfo);
- } else {
- mNetworkInfo = nullptr;
- }
-
- // Update mCellInfo
- nsCOMPtr<nsIMobileCellInfo> cellInfo;
- aInfo->GetCell(getter_AddRefs(cellInfo));
- if (cellInfo) {
- if (!mCellInfo) {
- mCellInfo = new MobileCellInfo(mWindow);
- }
- mCellInfo->Update(cellInfo);
- } else {
- mCellInfo = nullptr;
- }
-}
-
-JSObject*
-MobileConnectionInfo::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return MozMobileConnectionInfoBinding::Wrap(aCx, this, aGivenProto);
-}
-
-// nsIMobileConnectionInfo
-
-NS_IMETHODIMP
-MobileConnectionInfo::GetState(nsAString& aState)
-{
- CONVERT_NULLABLE_ENUM_TO_STRING(MobileConnectionState, mState, aState);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionInfo::GetConnected(bool* aConnected)
-{
- *aConnected = Connected();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionInfo::GetEmergencyCallsOnly(bool* aEmergencyCallsOnly)
-{
- *aEmergencyCallsOnly = EmergencyCallsOnly();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionInfo::GetRoaming(bool* aRoaming)
-{
- *aRoaming = Roaming();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionInfo::GetNetwork(nsIMobileNetworkInfo** aInfo)
-{
- NS_IF_ADDREF(*aInfo = GetNetwork());
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionInfo::GetType(nsAString& aType)
-{
- CONVERT_NULLABLE_ENUM_TO_STRING(MobileConnectionType, mType, aType);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionInfo::GetSignalStrength(JS::MutableHandle<JS::Value> aSignal)
-{
- if (mSignalStrength.IsNull()) {
- aSignal.setNull();
- } else {
- aSignal.setInt32(mSignalStrength.Value());
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionInfo::GetRelSignalStrength(JS::MutableHandle<JS::Value> aSignal)
-{
- if (mRelSignalStrength.IsNull()) {
- aSignal.setNull();
- } else {
- aSignal.setNumber(uint32_t(mRelSignalStrength.Value()));
- }
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionInfo::GetCell(nsIMobileCellInfo** aInfo)
-{
- NS_IF_ADDREF(*aInfo = GetCell());
- return NS_OK;
-}
deleted file mode 100644
--- a/dom/mobileconnection/MobileConnectionInfo.h
+++ /dev/null
@@ -1,124 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_MobileConnectionInfo_h
-#define mozilla_dom_MobileConnectionInfo_h
-
-#include "mozilla/dom/MobileCellInfo.h"
-#include "mozilla/dom/MobileNetworkInfo.h"
-#include "mozilla/dom/MozMobileConnectionInfoBinding.h"
-#include "nsIMobileConnectionInfo.h"
-#include "nsPIDOMWindow.h"
-#include "nsWrapperCache.h"
-
-namespace mozilla {
-namespace dom {
-
-class MobileConnectionInfo final : public nsIMobileConnectionInfo
- , public nsWrapperCache
-{
-public:
- NS_DECL_NSIMOBILECONNECTIONINFO
- NS_DECL_CYCLE_COLLECTING_ISUPPORTS
- NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MobileConnectionInfo)
-
- explicit MobileConnectionInfo(nsPIDOMWindowInner* aWindow);
-
- MobileConnectionInfo(const nsAString& aState, bool aConnected,
- bool aEmergencyCallsOnly, bool aRoaming,
- nsIMobileNetworkInfo* aNetworkInfo,
- const nsAString& aType,
- const Nullable<int32_t>& aSignalStrength,
- const Nullable<uint16_t>& aRelSignalStrength,
- nsIMobileCellInfo* aCellInfo);
-
- void
- Update(nsIMobileConnectionInfo* aInfo);
-
- nsPIDOMWindowInner*
- GetParentObject() const
- {
- return mWindow;
- }
-
- virtual JSObject*
- WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
- // WebIDL interface
- bool
- Connected() const
- {
- return mConnected;
- }
-
- bool
- EmergencyCallsOnly() const
- {
- return mEmergencyCallsOnly;
- }
-
- bool
- Roaming() const
- {
- return mRoaming;
- }
-
- Nullable<MobileConnectionState>
- GetState() const
- {
- return mState;
- }
-
- Nullable<MobileConnectionType>
- GetType() const
- {
- return mType;
- }
-
- MobileNetworkInfo*
- GetNetwork() const
- {
- return mNetworkInfo;
- }
-
- Nullable<int32_t>
- GetSignalStrength() const
- {
- return mSignalStrength;
- }
-
- Nullable<uint16_t>
- GetRelSignalStrength() const
- {
- return mRelSignalStrength;
- }
-
- MobileCellInfo*
- GetCell() const
- {
- return mCellInfo;
- }
-
-private:
- ~MobileConnectionInfo() {}
-
-private:
- bool mConnected;
- bool mEmergencyCallsOnly;
- bool mRoaming;
- nsCOMPtr<nsPIDOMWindowInner> mWindow;
- RefPtr<MobileNetworkInfo> mNetworkInfo;
- RefPtr<MobileCellInfo> mCellInfo;
- Nullable<MobileConnectionState> mState;
- Nullable<MobileConnectionType> mType;
- Nullable<int32_t> mSignalStrength;
- Nullable<uint16_t> mRelSignalStrength;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_MobileConnectionInfo_h
deleted file mode 100644
--- a/dom/mobileconnection/MobileNetworkInfo.cpp
+++ /dev/null
@@ -1,97 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/MobileNetworkInfo.h"
-
-using namespace mozilla::dom;
-
-NS_IMPL_CYCLE_COLLECTION_WRAPPERCACHE(MobileNetworkInfo, mWindow)
-
-NS_IMPL_CYCLE_COLLECTING_ADDREF(MobileNetworkInfo)
-NS_IMPL_CYCLE_COLLECTING_RELEASE(MobileNetworkInfo)
-
-NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(MobileNetworkInfo)
- NS_WRAPPERCACHE_INTERFACE_MAP_ENTRY
- NS_INTERFACE_MAP_ENTRY(nsISupports)
- NS_INTERFACE_MAP_ENTRY(nsIMobileNetworkInfo)
-NS_INTERFACE_MAP_END
-
-MobileNetworkInfo::MobileNetworkInfo(nsPIDOMWindowInner* aWindow)
- : mWindow(aWindow)
-{
-}
-
-MobileNetworkInfo::MobileNetworkInfo(const nsAString& aShortName,
- const nsAString& aLongName,
- const nsAString& aMcc,
- const nsAString& aMnc,
- const nsAString& aState)
- : mShortName(aShortName)
- , mLongName(aLongName)
- , mMcc(aMcc)
- , mMnc(aMnc)
- , mState(aState)
-{
- // The parent object is nullptr when MobileNetworkInfo is created by this way.
- // And it won't be exposed to web content.
-}
-
-void
-MobileNetworkInfo::Update(nsIMobileNetworkInfo* aInfo)
-{
- if (!aInfo) {
- return;
- }
-
- aInfo->GetShortName(mShortName);
- aInfo->GetLongName(mLongName);
- aInfo->GetMcc(mMcc);
- aInfo->GetMnc(mMnc);
- aInfo->GetState(mState);
-}
-
-JSObject*
-MobileNetworkInfo::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
-{
- return MozMobileNetworkInfoBinding::Wrap(aCx, this, aGivenProto);
-}
-
-// nsIMobileNetworkInfo
-
-NS_IMETHODIMP
-MobileNetworkInfo::GetShortName(nsAString& aShortName)
-{
- aShortName = mShortName;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileNetworkInfo::GetLongName(nsAString& aLongName)
-{
- aLongName = mLongName;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileNetworkInfo::GetMcc(nsAString& aMcc)
-{
- aMcc = mMcc;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileNetworkInfo::GetMnc(nsAString& aMnc)
-{
- aMnc = mMnc;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileNetworkInfo::GetState(nsAString& aState)
-{
- aState = mState;
- return NS_OK;
-}
deleted file mode 100644
--- a/dom/mobileconnection/MobileNetworkInfo.h
+++ /dev/null
@@ -1,75 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_MobileNetworkInfo_h
-#define mozilla_dom_MobileNetworkInfo_h
-
-#include "mozilla/dom/MozMobileNetworkInfoBinding.h"
-#include "nsIMobileNetworkInfo.h"
-#include "nsPIDOMWindow.h"
-#include "nsWrapperCache.h"
-
-namespace mozilla {
-namespace dom {
-
-class MobileNetworkInfo final : public nsIMobileNetworkInfo
- , public nsWrapperCache
-{
-public:
- NS_DECL_NSIMOBILENETWORKINFO
- NS_DECL_CYCLE_COLLECTING_ISUPPORTS
- NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(MobileNetworkInfo)
-
- explicit MobileNetworkInfo(nsPIDOMWindowInner* aWindow);
-
- MobileNetworkInfo(const nsAString& aShortName, const nsAString& aLongName,
- const nsAString& aMcc, const nsAString& aMnc,
- const nsAString& aState);
-
- void
- Update(nsIMobileNetworkInfo* aInfo);
-
- nsPIDOMWindowInner*
- GetParentObject() const
- {
- return mWindow;
- }
-
- virtual JSObject*
- WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
-
- // WebIDL interface
- Nullable<MobileNetworkState>
- GetState() const
- {
- uint32_t i = 0;
- for (const EnumEntry* entry = MobileNetworkStateValues::strings;
- entry->value;
- ++entry, ++i) {
- if (mState.EqualsASCII(entry->value)) {
- return Nullable<MobileNetworkState>(static_cast<MobileNetworkState>(i));
- }
- }
-
- return Nullable<MobileNetworkState>();
- }
-
-private:
- ~MobileNetworkInfo() {}
-
-private:
- nsCOMPtr<nsPIDOMWindowInner> mWindow;
- nsString mShortName;
- nsString mLongName;
- nsString mMcc;
- nsString mMnc;
- nsString mState;
-};
-
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_MobileNetworkInfo_h
deleted file mode 100644
--- a/dom/mobileconnection/gonk/MobileConnectionService.js
+++ /dev/null
@@ -1,1762 +0,0 @@
-/* -*- Mode: js; 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/. */
-
-"use strict";
-
-const {classes: Cc, interfaces: Ci, utils: Cu, results: Cr} = Components;
-
-Cu.import("resource://gre/modules/Services.jsm");
-Cu.import("resource://gre/modules/systemlibs.js");
-Cu.import("resource://gre/modules/XPCOMUtils.jsm");
-
-var RIL = {};
-Cu.import("resource://gre/modules/ril_consts.js", RIL);
-
-const GONK_MOBILECONNECTIONSERVICE_CONTRACTID =
- "@mozilla.org/mobileconnection/gonkmobileconnectionservice;1";
-
-const GONK_MOBILECONNECTIONSERVICE_CID =
- Components.ID("{0c9c1a96-2c72-4c55-9e27-0ca73eb16f63}");
-const MOBILECONNECTIONINFO_CID =
- Components.ID("{8162b3c0-664b-45f6-96cd-f07b4e193b0e}");
-const MOBILENETWORKINFO_CID =
- Components.ID("{a6c8416c-09b4-46d1-bf29-6520d677d085}");
-const MOBILECELLINFO_CID =
- Components.ID("{0635d9ab-997e-4cdf-84e7-c1883752dff3}");
-const MOBILECALLFORWARDINGOPTIONS_CID =
- Components.ID("{e0cf4463-ee63-4b05-ab2e-d94bf764836c}");
-const NEIGHBORINGCELLINFO_CID =
- Components.ID("{6078cbf1-f34c-44fa-96f8-11a88d4bfdd3}");
-const GSMCELLINFO_CID =
- Components.ID("{e3cf3aa0-f992-48fe-967b-ec98a28c8535}");
-const WCDMACELLINFO_CID =
- Components.ID("{62e2c83c-b535-4068-9762-8039fac48106}");
-const CDMACELLINFO_CID =
- Components.ID("{40f491f0-dd8b-42fd-af32-aef5b002749a}");
-const LTECELLINFO_CID =
- Components.ID("{715e2c76-3b08-41e4-8ea5-e60c5ce6393e}");
-
-
-const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
-const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
-const NS_NETWORK_ACTIVE_CHANGED_TOPIC_ID = "network-active-changed";
-const NS_DATA_CALL_ERROR_TOPIC_ID = "data-call-error";
-
-const kPrefRilDebuggingEnabled = "ril.debugging.enabled";
-
-const UNKNOWN_VALUE = Ci.nsICellInfo.UNKNOWN_VALUE;
-
-XPCOMUtils.defineLazyServiceGetter(this, "gMobileConnectionMessenger",
- "@mozilla.org/ril/system-messenger-helper;1",
- "nsIMobileConnectionMessenger");
-
-XPCOMUtils.defineLazyServiceGetter(this, "gNetworkManager",
- "@mozilla.org/network/manager;1",
- "nsINetworkManager");
-
-XPCOMUtils.defineLazyServiceGetter(this, "gIccService",
- "@mozilla.org/icc/iccservice;1",
- "nsIIccService");
-
-XPCOMUtils.defineLazyServiceGetter(this, "gDataCallManager",
- "@mozilla.org/datacall/manager;1",
- "nsIDataCallManager");
-
-XPCOMUtils.defineLazyModuleGetter(this, "gTelephonyUtils",
- "resource://gre/modules/TelephonyUtils.jsm",
- "TelephonyUtils");
-
-XPCOMUtils.defineLazyGetter(this, "gRadioInterfaceLayer", function() {
- let ril = { numRadioInterfaces: 0 };
- try {
- ril = Cc["@mozilla.org/ril;1"].getService(Ci.nsIRadioInterfaceLayer);
- } catch(e) {}
- return ril;
-});
-
-var DEBUG = RIL.DEBUG_RIL;
-function debug(s) {
- dump("MobileConnectionService: " + s + "\n");
-}
-
-function MobileNetworkInfo() {
- this.shortName = null;
- this.longName = null;
- this.mcc = null;
- this.mnc = null;
- this.stat = null;
-}
-MobileNetworkInfo.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileNetworkInfo]),
- classID: MOBILENETWORKINFO_CID,
- classInfo: XPCOMUtils.generateCI({
- classID: MOBILENETWORKINFO_CID,
- classDescription: "MobileNetworkInfo",
- interfaces: [Ci.nsIMobileNetworkInfo]
- })
-};
-
-function MobileCellInfo() {
- this.gsmLocationAreaCode = -1;
- this.gsmCellId = -1;
- this.cdmaBaseStationId = -1;
- this.cdmaBaseStationLatitude = -2147483648;
- this.cdmaBaseStationLongitude = -2147483648;
- this.cdmaSystemId = -1;
- this.cdmaNetworkId = -1;
-}
-MobileCellInfo.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileCellInfo]),
- classID: MOBILECELLINFO_CID,
- classInfo: XPCOMUtils.generateCI({
- classID: MOBILECELLINFO_CID,
- classDescription: "MobileCellInfo",
- interfaces: [Ci.nsIMobileCellInfo]
- })
-};
-
-function MobileConnectionInfo() {}
-MobileConnectionInfo.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionInfo]),
- classID: MOBILECONNECTIONINFO_CID,
- classInfo: XPCOMUtils.generateCI({
- classID: MOBILECONNECTIONINFO_CID,
- classDescription: "MobileConnectionInfo",
- interfaces: [Ci.nsIMobileConnectionInfo]
- }),
-
- state: null,
- connected: false,
- emergencyCallsOnly: false,
- roaming: false,
- network: null,
- cell: null,
- type: null,
- signalStrength: null,
- relSignalStrength: null
-};
-
-function MobileCallForwardingOptions(aOptions) {
- for (let key in aOptions) {
- this[key] = aOptions[key];
- }
-}
-MobileCallForwardingOptions.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileCallForwardingOptions]),
- classID: MOBILECALLFORWARDINGOPTIONS_CID,
- classInfo: XPCOMUtils.generateCI({
- classID: MOBILECALLFORWARDINGOPTIONS_CID,
- classDescription: "MobileCallForwardingOptions",
- interfaces: [Ci.nsIMobileCallForwardingOptions]
- }),
-
- // nsIMobileForwardingOptions
-
- active: false,
- action: Ci.nsIMobileConnection.CALL_FORWARD_ACTION_UNKNOWN,
- reason: Ci.nsIMobileConnection.CALL_FORWARD_REASON_UNKNOWN,
- number: null,
- timeSeconds: -1,
- serviceClass: Ci.nsIMobileConnection.ICC_SERVICE_CLASS_NONE
-}
-
-function NeighboringCellInfo(aOptions) {
- this.networkType = aOptions.networkType;
- this.gsmLocationAreaCode = (aOptions.gsmLocationAreaCode !== undefined &&
- aOptions.gsmLocationAreaCode >= 0 &&
- aOptions.gsmLocationAreaCode <= 65535) ?
- aOptions.gsmLocationAreaCode : UNKNOWN_VALUE;
- this.gsmCellId = (aOptions.gsmCellId !== undefined &&
- aOptions.gsmCellId >= 0 &&
- aOptions.gsmCellId <= 65535) ?
- aOptions.gsmCellId : UNKNOWN_VALUE;
- this.wcdmaPsc = (aOptions.wcdmaPsc !== undefined && aOptions.wcdmaPsc >= 0 &&
- aOptions.wcdmaPsc <= 511) ?
- aOptions.wcdmaPsc : UNKNOWN_VALUE;
- this.signalStrength = (aOptions.signalStrength !== undefined &&
- ((aOptions.signalStrength >= 0 &&
- aOptions.signalStrength <= 31) ||
- (aOptions.signalStrength >= -120 &&
- aOptions.signalStrength <= -25))) ?
- aOptions.signalStrength : UNKNOWN_VALUE;
-}
-NeighboringCellInfo.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsINeighboringCellInfo]),
- classID: NEIGHBORINGCELLINFO_CID,
- classInfo: XPCOMUtils.generateCI({
- classID: NEIGHBORINGCELLINFO_CID,
- classDescription: "NeighboringCellInfo",
- interfaces: [Ci.nsINeighboringCellInfo]
- }),
-
- isValid: function() {
- return !(this.gsmLocationAreaCode == UNKNOWN_VALUE &&
- this.gsmCellId == UNKNOWN_VALUE &&
- this.wcdmaPsc == UNKNOWN_VALUE &&
- this.signalStrength == UNKNOWN_VALUE);
- },
-
- // nsINeighboringCellInfo
-
- networkType: null,
- gsmLocationAreaCode: UNKNOWN_VALUE,
- gsmCellId: UNKNOWN_VALUE,
- wcdmaPsc: UNKNOWN_VALUE,
- signalStrength: UNKNOWN_VALUE
-};
-
-function CellInfo(aOptions) {
- this.type = aOptions.type;
- this.registered = aOptions.registered;
- this.timestampType = aOptions.timestampType;
- this.timestamp = aOptions.timestamp;
-}
-CellInfo.prototype = {
-
- // nsICellInfo
-
- type: null,
- registered: false,
- timestampType: Ci.nsICellInfo.TIMESTAMP_TYPE_UNKNOWN,
- timestamp: 0
-};
-
-function GsmCellInfo(aOptions) {
- CellInfo.call(this, aOptions);
-
- // Cell Identity
- this.mcc = (aOptions.mcc !== undefined && aOptions.mcc >= 0 &&
- aOptions.mcc <= 999) ? aOptions.mcc : UNKNOWN_VALUE;
- this.mnc = (aOptions.mnc !== undefined && aOptions.mnc >= 0 &&
- aOptions.mnc <= 999) ? aOptions.mnc : UNKNOWN_VALUE;
- this.lac = (aOptions.lac !== undefined && aOptions.lac >= 0 &&
- aOptions.lac <= 65535) ? aOptions.lac : UNKNOWN_VALUE;
- this.cid = (aOptions.cid !== undefined && aOptions.cid >= 0 &&
- aOptions.cid <= 65535) ? aOptions.cid : UNKNOWN_VALUE;
-
- // Signal Strength
- this.signalStrength = (aOptions.signalStrength !== undefined &&
- aOptions.signalStrength >= 0 &&
- aOptions.signalStrength <= 31) ?
- aOptions.signalStrength : UNKNOWN_VALUE;
- this.bitErrorRate = (aOptions.bitErrorRate !== undefined &&
- aOptions.bitErrorRate >= 0 && aOptions.bitErrorRate <= 7)
- ? aOptions.bitErrorRate : UNKNOWN_VALUE;
-}
-GsmCellInfo.prototype = {
- __proto__: CellInfo.prototype,
- QueryInterface: XPCOMUtils.generateQI([Ci.nsICellInfo,
- Ci.nsIGsmCellInfo]),
- classID: GSMCELLINFO_CID,
- classInfo: XPCOMUtils.generateCI({
- classID: GSMCELLINFO_CID,
- classDescription: "GsmCellInfo",
- interfaces: [Ci.nsIGsmCellInfo]
- }),
-
- isValid: function() {
- return !(this.mcc == UNKNOWN_VALUE && this.mnc == UNKNOWN_VALUE &&
- this.lac == UNKNOWN_VALUE && this.cid == UNKNOWN_VALUE &&
- this.signalStrength == UNKNOWN_VALUE &&
- this.bitErrorRate == UNKNOWN_VALUE);
- },
-
- // nsIGsmCellInfo
-
- mcc: UNKNOWN_VALUE,
- mnc: UNKNOWN_VALUE,
- lac: UNKNOWN_VALUE,
- cid: UNKNOWN_VALUE,
- signalStrength: UNKNOWN_VALUE,
- bitErrorRate: UNKNOWN_VALUE
-};
-
-function WcdmaCellInfo(aOptions) {
- CellInfo.call(this, aOptions);
-
- // Cell Identity
- this.mcc = (aOptions.mcc !== undefined && aOptions.mcc >= 0 &&
- aOptions.mcc <= 999) ? aOptions.mcc : UNKNOWN_VALUE;
- this.mnc = (aOptions.mnc !== undefined && aOptions.mnc >= 0 &&
- aOptions.mnc <= 999) ? aOptions.mnc : UNKNOWN_VALUE;
- this.lac = (aOptions.lac !== undefined && aOptions.lac >= 0 &&
- aOptions.lac <= 65535) ? aOptions.lac : UNKNOWN_VALUE;
- this.cid = (aOptions.cid !== undefined && aOptions.cid >= 0 &&
- aOptions.cid <= 268435455) ? aOptions.cid : UNKNOWN_VALUE;
- this.psc = (aOptions.psc !== undefined && aOptions.psc >= 0 &&
- aOptions.psc <= 511) ? aOptions.psc : UNKNOWN_VALUE;
-
- // Signal Strength
- this.signalStrength = (aOptions.signalStrength !== undefined &&
- aOptions.signalStrength >= 0 &&
- aOptions.signalStrength <= 31) ?
- aOptions.signalStrength : UNKNOWN_VALUE;
- this.bitErrorRate = (aOptions.bitErrorRate !== undefined &&
- aOptions.bitErrorRate >= 0 && aOptions.bitErrorRate <= 7)
- ? aOptions.bitErrorRate : UNKNOWN_VALUE;
-}
-WcdmaCellInfo.prototype = {
- __proto__: CellInfo.prototype,
- QueryInterface: XPCOMUtils.generateQI([Ci.nsICellInfo,
- Ci.nsIWcdmaCellInfo]),
- classID: WCDMACELLINFO_CID,
- classInfo: XPCOMUtils.generateCI({
- classID: WCDMACELLINFO_CID,
- classDescription: "WcdmaCellInfo",
- interfaces: [Ci.nsIWcdmaCellInfo]
- }),
-
- isValid: function() {
- return !(this.mcc == UNKNOWN_VALUE && this.mnc == UNKNOWN_VALUE &&
- this.lac == UNKNOWN_VALUE && this.cid == UNKNOWN_VALUE &&
- this.psc == UNKNOWN_VALUE && this.signalStrength == UNKNOWN_VALUE &&
- this.bitErrorRate == UNKNOWN_VALUE);
- },
-
- // nsIWcdmaCellInfo
-
- mcc: UNKNOWN_VALUE,
- mnc: UNKNOWN_VALUE,
- lac: UNKNOWN_VALUE,
- cid: UNKNOWN_VALUE,
- psc: UNKNOWN_VALUE,
- signalStrength: UNKNOWN_VALUE,
- bitErrorRate: UNKNOWN_VALUE
-};
-
-function LteCellInfo(aOptions) {
- CellInfo.call(this, aOptions);
-
- // Cell Identity
- this.mcc = (aOptions.mcc !== undefined && aOptions.mcc >= 0 &&
- aOptions.mcc <= 999) ? aOptions.mcc : UNKNOWN_VALUE;
- this.mnc = (aOptions.mnc !== undefined && aOptions.mnc >= 0 &&
- aOptions.mnc <= 999) ? aOptions.mnc : UNKNOWN_VALUE;
- this.cid = (aOptions.cid !== undefined && aOptions.cid >= 0 &&
- aOptions.cid <= 268435455) ? aOptions.cid : UNKNOWN_VALUE;
- this.pcid = (aOptions.pcid !== undefined && aOptions.pcid >= 0 &&
- aOptions.pcid <= 503) ? aOptions.pcid : UNKNOWN_VALUE;
- this.tac = (aOptions.tac !== undefined && aOptions.tac >= 0 &&
- aOptions.tac <= 65535) ? aOptions.tac : UNKNOWN_VALUE;
-
- // Signal Strength
- this.signalStrength = (aOptions.signalStrength !== undefined &&
- aOptions.signalStrength >= 0 &&
- aOptions.signalStrength <= 31) ?
- aOptions.signalStrength : UNKNOWN_VALUE;
- this.rsrp = (aOptions.rsrp !== undefined && aOptions.rsrp >= 44 &&
- aOptions.rsrp <= 140) ? aOptions.rsrp : UNKNOWN_VALUE;
- this.rsrq = (aOptions.rsrq !== undefined && aOptions.rsrq >= 3 &&
- aOptions.rsrq <= 20) ? aOptions.rsrq : UNKNOWN_VALUE;
- this.rssnr = (aOptions.rssnr !== undefined && aOptions.rssnr >= -200 &&
- aOptions.rssnr <= 300) ? aOptions.rssnr : UNKNOWN_VALUE;
- this.cqi = (aOptions.cqi !== undefined && aOptions.cqi >= 0 &&
- aOptions.cqi <= 15) ? aOptions.cqi : UNKNOWN_VALUE;
- this.timingAdvance = (aOptions.timingAdvance !== undefined &&
- aOptions.timingAdvance >= 0 &&
- aOptions.timingAdvance <= 2147483646) ?
- aOptions.timingAdvance : UNKNOWN_VALUE;
-}
-LteCellInfo.prototype = {
- __proto__: CellInfo.prototype,
- QueryInterface: XPCOMUtils.generateQI([Ci.nsICellInfo,
- Ci.nsILteCellInfo]),
- classID: LTECELLINFO_CID,
- classInfo: XPCOMUtils.generateCI({
- classID: LTECELLINFO_CID,
- classDescription: "LteCellInfo",
- interfaces: [Ci.nsILteCellInfo]
- }),
-
- isValid: function() {
- return !(this.mcc == UNKNOWN_VALUE && this.mnc == UNKNOWN_VALUE &&
- this.cid == UNKNOWN_VALUE && this.pcid == UNKNOWN_VALUE &&
- this.tac == UNKNOWN_VALUE && this.signalStrength == UNKNOWN_VALUE &&
- this.rsrp == UNKNOWN_VALUE && this.rsrq == UNKNOWN_VALUE &&
- this.rssnr == UNKNOWN_VALUE && this.cqi == UNKNOWN_VALUE &&
- this.timingAdvance == UNKNOWN_VALUE);
- },
-
- // nsILteCellInfo
-
- mcc: UNKNOWN_VALUE,
- mnc: UNKNOWN_VALUE,
- cid: UNKNOWN_VALUE,
- pcid: UNKNOWN_VALUE,
- tac: UNKNOWN_VALUE,
- signalStrength: UNKNOWN_VALUE,
- rsrp: UNKNOWN_VALUE,
- rsrq: UNKNOWN_VALUE,
- rssnr: UNKNOWN_VALUE,
- cqi: UNKNOWN_VALUE,
- timingAdvance: UNKNOWN_VALUE
-};
-
-function CdmaCellInfo(aOptions) {
- CellInfo.call(this, aOptions);
-
- // Cell Identity
- this.networkId = (aOptions.networkId !== undefined &&
- aOptions.networkId >= 0 && aOptions.networkId <= 65535) ?
- aOptions.networkId : UNKNOWN_VALUE;
- this.systemId = (aOptions.systemId !== undefined && aOptions.systemId >= 0 &&
- aOptions.systemId <= 32767) ?
- aOptions.systemId : UNKNOWN_VALUE;
- this.baseStationId = (aOptions.baseStationId !== undefined &&
- aOptions.baseStationId >= 0 &&
- aOptions.baseStationId <= 65535) ?
- aOptions.baseStationId : UNKNOWN_VALUE;
- this.longitude = (aOptions.longitude !== undefined &&
- aOptions.longitude >= -2592000 &&
- aOptions.longitude <= 2592000) ?
- aOptions.longitude : UNKNOWN_VALUE;
- this.latitude = (aOptions.latitude !== undefined &&
- aOptions.latitude >= -1296000 &&
- aOptions.latitude <= 1296000) ?
- aOptions.latitude : UNKNOWN_VALUE;
-
- // Signal Strength
- this.cdmaEcio = (aOptions.cdmaEcio !== undefined &&
- aOptions.cdmaEcio >= 0) ? aOptions.cdmaEcio : UNKNOWN_VALUE;
- this.evdoDbm = (aOptions.evdoDbm !== undefined &&
- aOptions.evdoDbm >= 0) ? aOptions.evdoDbm : UNKNOWN_VALUE;
- this.evdoEcio = (aOptions.evdoEcio !== undefined &&
- aOptions.evdoEcio >= 0) ? aOptions.evdoEcio : UNKNOWN_VALUE;
- this.evdoSnr = (aOptions.evdoSnr !== undefined &&
- aOptions.evdoSnr >= 0 && aOptions.evdoSnr <= 8) ?
- aOptions.evdoSnr : UNKNOWN_VALUE;
-}
-CdmaCellInfo.prototype = {
- __proto__: CellInfo.prototype,
- QueryInterface: XPCOMUtils.generateQI([Ci.nsICellInfo,
- Ci.nsICdmaCellInfo]),
- classID: CDMACELLINFO_CID,
- classInfo: XPCOMUtils.generateCI({
- classID: CDMACELLINFO_CID,
- classDescription: "CdmaCellInfo",
- interfaces: [Ci.nsICdmaCellInfo]
- }),
-
- isValid: function() {
- return !(this.networkId == UNKNOWN_VALUE && this.systemId == UNKNOWN_VALUE &&
- this.baseStationId == UNKNOWN_VALUE &&
- this.longitude == UNKNOWN_VALUE &&
- this.latitude == UNKNOWN_VALUE && this.cdmaDbm == UNKNOWN_VALUE &&
- this.cdmaEcio == UNKNOWN_VALUE && this.evdoDbm == UNKNOWN_VALUE &&
- this.evdoEcio == UNKNOWN_VALUE && this.evdoSnr == UNKNOWN_VALUE);
- },
-
- // nsICdmaCellInfo
-
- networkId: UNKNOWN_VALUE,
- systemId: UNKNOWN_VALUE,
- baseStationId: UNKNOWN_VALUE,
- longitude: UNKNOWN_VALUE,
- latitude: UNKNOWN_VALUE,
- cdmaDbm: UNKNOWN_VALUE,
- cdmaEcio: UNKNOWN_VALUE,
- evdoDbm: UNKNOWN_VALUE,
- evdoEcio: UNKNOWN_VALUE,
- evdoSnr: UNKNOWN_VALUE
-};
-
-function MobileDeviceIdentities(aImei, aImeisv, aEsn, aMeid) {
- this.imei = aImei;
- this.imeisv = aImeisv;
- this.esn = aEsn;
- this.meid = aMeid;
-}
-MobileDeviceIdentities.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileDeviceIdentities]),
-
- // nsIMobileDeviceIdentities
- imei: null,
- imeisv: null,
- esn: null,
- meid: null
-};
-
-function MobileConnectionProvider(aClientId, aRadioInterface) {
- this._clientId = aClientId;
- this._radioInterface = aRadioInterface;
- this._operatorInfo = new MobileNetworkInfo();
- // An array of nsIMobileConnectionListener instances.
- this._listeners = [];
-
- this.supportedNetworkTypes = this._getSupportedNetworkTypes();
- this.voice = new MobileConnectionInfo();
- this.data = new MobileConnectionInfo();
-}
-MobileConnectionProvider.prototype = {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnection]),
-
- _clientId: null,
- _radioInterface: null,
- _operatorInfo: null,
- _listeners: null,
-
- /**
- * The networks that are currently trying to be selected (or "automatic").
- * This helps ensure that only one network per client is selected at a time.
- */
- _selectingNetwork: null,
-
- /**
- * The two radio states below stand for the user expectation and the hardware
- * status, respectively. |radioState| will be updated based on their values.
- */
- _expectedRadioState: RIL.GECKO_RADIOSTATE_UNKNOWN,
- _hardwareRadioState: RIL.GECKO_RADIOSTATE_UNKNOWN,
-
- voice: null,
- data: null,
- networkSelectionMode: Ci.nsIMobileConnection.NETWORK_SELECTION_MODE_UNKNOWN,
- radioState: Ci.nsIMobileConnection.MOBILE_RADIO_STATE_UNKNOWN,
- lastKnownNetwork: null,
- lastKnownHomeNetwork: null,
- supportedNetworkTypes: null,
- deviceIdentities: null,
-
- /**
- * A utility function to dump debug message.
- */
- _debug: function(aMessage) {
- dump("MobileConnectionProvider[" + this._clientId + "]: " + aMessage + "\n");
- },
-
- /**
- * A utility function to get supportedNetworkTypes from system property.
- */
- _getSupportedNetworkTypes: function() {
- let key = "ro.moz.ril." + this._clientId + ".network_types";
- let supportedNetworkTypes = libcutils.property_get(key, "").split(",");
-
- // If mozRIL system property is not available, fallback to AOSP system
- // property for support network types.
- if (supportedNetworkTypes.length === 1 && supportedNetworkTypes[0] === "") {
- key = "ro.telephony.default_network";
- let indexString = libcutils.property_get(key, "");
- let index = parseInt(indexString, 10);
- if (DEBUG) this._debug("Fallback to " + key + ": " + index);
-
- let networkTypes = RIL.RIL_PREFERRED_NETWORK_TYPE_TO_GECKO[index];
- supportedNetworkTypes = networkTypes ?
- networkTypes.replace(/-auto/g, "").split("/") :
- RIL.GECKO_SUPPORTED_NETWORK_TYPES_DEFAULT.split(",");
- }
-
- let enumNetworkTypes = [];
- for (let type of supportedNetworkTypes) {
- // If the value in system property is not valid, use the default one which
- // is defined in ril_consts.js.
- if (RIL.GECKO_SUPPORTED_NETWORK_TYPES.indexOf(type) < 0) {
- if (DEBUG) {
- this._debug("Unknown network type: " + type);
- }
- RIL.GECKO_SUPPORTED_NETWORK_TYPES_DEFAULT.split(",").forEach(aType => {
- enumNetworkTypes.push(RIL.GECKO_SUPPORTED_NETWORK_TYPES.indexOf(aType));
- });
- break;
- }
- enumNetworkTypes.push(RIL.GECKO_SUPPORTED_NETWORK_TYPES.indexOf(type));
- }
- if (DEBUG) {
- this._debug("Supported Network Types: " + enumNetworkTypes);
- }
-
- return enumNetworkTypes;
- },
-
- /**
- * Helper for guarding us against invalid mode for clir.
- */
- _isValidClirMode: function(aMode) {
- switch (aMode) {
- case Ci.nsIMobileConnection.CLIR_DEFAULT:
- case Ci.nsIMobileConnection.CLIR_INVOCATION:
- case Ci.nsIMobileConnection.CLIR_SUPPRESSION:
- return true;
- default:
- return false;
- }
- },
-
- /**
- * Fix the roaming. RIL can report roaming in some case it is not
- * really the case. See bug 787967
- */
- _checkRoamingBetweenOperators: function(aNetworkInfo) {
- let icc = gIccService.getIccByServiceId(this._clientId);
- let iccInfo = icc ? icc.iccInfo : null;
- let operator = aNetworkInfo.network;
- let state = aNetworkInfo.state;
-
- if (!iccInfo || !operator ||
- state !== RIL.GECKO_MOBILE_CONNECTION_STATE_REGISTERED) {
- return false;
- }
-
- let spn = iccInfo.spn && iccInfo.spn.toLowerCase();
- let longName = operator.longName && operator.longName.toLowerCase();
- let shortName = operator.shortName && operator.shortName.toLowerCase();
-
- let equalsLongName = longName && (spn == longName);
- let equalsShortName = shortName && (spn == shortName);
- let equalsMcc = iccInfo.mcc == operator.mcc;
-
- let newRoaming = aNetworkInfo.roaming &&
- !(equalsMcc && (equalsLongName || equalsShortName));
- if (newRoaming === aNetworkInfo.roaming) {
- return false;
- }
-
- aNetworkInfo.roaming = newRoaming;
- return true;
- },
-
- /**
- * The design of this updating function is to update the attribute in
- * |aDestInfo| *only if* new data (e.g. aSrcInfo) contains the same attribute.
- * Thus, for the attribute in |aDestInfo| that isn't showed in |aSrcInfo|, it
- * should just keep the original value unchanged.
- */
- _updateConnectionInfo: function(aDestInfo, aSrcInfo) {
- let isUpdated = false;
- for (let key in aSrcInfo) {
- if (key === "network" || key === "cell") {
- // nsIMobileNetworkInfo and nsIMobileCellInfo are handled explicitly below.
- continue;
- }
-
- if (aDestInfo[key] !== aSrcInfo[key]) {
- isUpdated = true;
- aDestInfo[key] = aSrcInfo[key];
- }
- }
-
- // Make sure we also reset the operator and signal strength information
- // if we drop off the network.
- if (aDestInfo.state !== RIL.GECKO_MOBILE_CONNECTION_STATE_REGISTERED) {
- aDestInfo.cell = null;
- aDestInfo.network = null;
- aDestInfo.signalStrength = null;
- aDestInfo.relSignalStrength = null;
- } else {
- aDestInfo.network = this._operatorInfo;
-
- // If no new cell data is passed, we should just keep the original cell
- // data unchanged.
- if (aSrcInfo.cell) {
- if (!aDestInfo.cell) {
- aDestInfo.cell = new MobileCellInfo();
- }
-
- isUpdated = this._updateInfo(aDestInfo.cell, aSrcInfo.cell) || isUpdated;
- }
- }
-
- // Check roaming state
- isUpdated = this._checkRoamingBetweenOperators(aDestInfo) || isUpdated;
- return isUpdated;
- },
-
- /**
- * The design of this updating function is to update the attribute in
- * |aDestInfo| *only if* new data (e.g. aSrcInfo) contains the same attribute.
- * Thus, for the attribute in |aDestInfo| that isn't showed in |aSrcInfo|, it
- * should just keep the original value unchanged.
- */
- _updateInfo: function(aDestInfo, aSrcInfo) {
- let isUpdated = false;
- for (let key in aSrcInfo) {
- if (aDestInfo[key] !== aSrcInfo[key]) {
- isUpdated = true;
- aDestInfo[key] = aSrcInfo[key];
- }
- }
- return isUpdated;
- },
-
- _rulesToCallForwardingOptions: function(aRules) {
- return aRules.map(rule => new MobileCallForwardingOptions(rule));
- },
-
- _dispatchNotifyError: function(aCallback, aErrorMsg) {
- Services.tm.currentThread.dispatch(() => aCallback.notifyError(aErrorMsg),
- Ci.nsIThread.DISPATCH_NORMAL);
- },
-
- registerListener: function(aListener) {
- if (this._listeners.indexOf(aListener) >= 0) {
- throw Cr.NS_ERROR_UNEXPECTED;
- }
-
- this._listeners.push(aListener);
- },
-
- unregisterListener: function(aListener) {
- let index = this._listeners.indexOf(aListener);
- if (index >= 0) {
- this._listeners.splice(index, 1);
- }
- },
-
- deliverListenerEvent: function(aName, aArgs) {
- let listeners = this._listeners.slice();
- for (let listener of listeners) {
- if (this._listeners.indexOf(listener) === -1) {
- continue;
- }
- let handler = listener[aName];
- if (typeof handler != "function") {
- throw new Error("No handler for " + aName);
- }
- try {
- handler.apply(listener, aArgs);
- } catch (e) {
- if (DEBUG) {
- this._debug("listener for " + aName + " threw an exception: " + e);
- }
- }
- }
- },
-
- updateVoiceInfo: function(aNewInfo, aBatch = false) {
- let isUpdated = this._updateConnectionInfo(this.voice, aNewInfo);
- if (isUpdated && !aBatch) {
- this.deliverListenerEvent("notifyVoiceChanged");
- }
- },
-
- updateDataInfo: function(aNewInfo, aBatch = false) {
- // For the data connection, the `connected` flag indicates whether
- // there's an active data call. We get correct `connected` state here.
- let active = gNetworkManager.activeNetworkInfo;
- aNewInfo.connected = false;
- if (active &&
- active.type === Ci.nsINetworkInfo.NETWORK_TYPE_MOBILE &&
- active.serviceId === this._clientId) {
- aNewInfo.connected = true;
- }
-
- let isUpdated = this._updateConnectionInfo(this.data, aNewInfo);
- if (isUpdated && !aBatch) {
- this.deliverListenerEvent("notifyDataChanged");
- }
-
- if (isUpdated) {
- this._ensureDataRegistration();
- }
- },
-
- _dataRegistrationFailed: false,
- _ensureDataRegistration: function() {
- let isDataRegistered =
- this.data &&
- this.data.state == RIL.GECKO_MOBILE_CONNECTION_STATE_REGISTERED;
- let isVoiceRegistered =
- this.voice &&
- this.voice.state == RIL.GECKO_MOBILE_CONNECTION_STATE_REGISTERED;
-
- if (isVoiceRegistered && isDataRegistered) {
- if (DEBUG) {
- this._debug("Voice and data registered.");
- }
- this._dataRegistrationFailed = false;
- return;
- }
-
- if (isVoiceRegistered && !isDataRegistered &&
- this._clientId == gDataCallManager.dataDefaultServiceId) {
-
- // We have been here before, no more recovery.
- if (this._dataRegistrationFailed) {
- if (DEBUG) {
- this._debug("Voice and data not consistent: " + this.voice.state +
- " != " + this.data.state + ".");
- }
- return;
- }
-
- if (DEBUG) {
- this._debug("Voice and data not consistent: " + this.voice.state +
- " != " + this.data.state + ", try to recover.");
- }
-
- this._dataRegistrationFailed = true;
- // If there is any ongoing call, wait for them to disconnect.
- if (gTelephonyUtils.hasAnyCalls(this._clientId)) {
- gTelephonyUtils.waitForNoCalls(this._clientId)
- .then(() => {
- if (this._dataRegistrationFailed) {
- this._recoverDataRegistration();
- }
- });
- return;
- }
-
- this._recoverDataRegistration();
- }
- },
-
-
- /**
- * To recover data registration, get the current preferred network type first,
- * then set it to a temporary preferred network type, and last set back to the
- * previous preferred network type. This is will cause deregistration and
- * registration on both voice and data networks.
- */
- _recoverDataRegistration: function() {
- if (DEBUG) {
- this._debug("Trying to recover data registration...");
- }
-
- let currentPreferredNetworkType;
-
- let resetPreferredNetworkType = () => {
- this.setPreferredNetworkType(currentPreferredNetworkType, {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionCallback]),
- notifySuccess: () => {},
- notifyError: aErrorMsg => {}
- });
- };
-
- let setTemporaryPreferredNetworkType = () => {
- this.setPreferredNetworkType(
- Ci.nsIMobileConnection.PREFERRED_NETWORK_TYPE_WCDMA_GSM_CDMA_EVDO, {
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionCallback]),
- notifySuccess: () => resetPreferredNetworkType(),
- notifyError: aErrorMsg => resetPreferredNetworkType()
- });
- };
-
- this.getPreferredNetworkType({
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIMobileConnectionCallback]),
- notifyGetPreferredNetworkTypeSuccess: networkType => {
- currentPreferredNetworkType = networkType;
- setTemporaryPreferredNetworkType();
- },
- notifyError: aErrorMsg => {
- currentPreferredNetworkType =
- Ci.nsIMobileConnection.PREFERRED_NETWORK_TYPE_LTE_WCDMA_GSM_CDMA_EVDO;
- setTemporaryPreferredNetworkType();
- }
- });
- },
-
- updateOperatorInfo: function(aNewInfo, aBatch = false) {
- let isUpdated = this._updateInfo(this._operatorInfo, aNewInfo);
-
- // Update lastKnownNetwork
- if (this._operatorInfo.mcc && this._operatorInfo.mnc) {
- let network = this._operatorInfo.mcc + "-" + this._operatorInfo.mnc;
- if (this.lastKnownNetwork !== network) {
- if (DEBUG) {
- this._debug("lastKnownNetwork now is " + network);
- }
-
- this.lastKnownNetwork = network;
- this.deliverListenerEvent("notifyLastKnownNetworkChanged");
- }
- }
-
- // If the voice is unregistered, no need to send notification.
- if (this.voice.state !== RIL.GECKO_MOBILE_CONNECTION_STATE_REGISTERED &&
- isUpdated && !aBatch) {
- this.deliverListenerEvent("notifyVoiceChanged");
- }
-
- // If the data is unregistered, no need to send notification.
- if (this.data.state !== RIL.GECKO_MOBILE_CONNECTION_STATE_REGISTERED &&
- isUpdated && !aBatch) {
- this.deliverListenerEvent("notifyDataChanged");
- }
- },
-
- updateSignalInfo: function(aNewInfo, aBatch = false) {
- // If the voice is not registered, no need to update signal information.
- if (this.voice.state === RIL.GECKO_MOBILE_CONNECTION_STATE_REGISTERED) {
- if (this._updateInfo(this.voice, aNewInfo.voice) && !aBatch) {
- this.deliverListenerEvent("notifyVoiceChanged");
- }
- }
-
- // If the data is not registered, no need to update signal information.
- if (this.data.state === RIL.GECKO_MOBILE_CONNECTION_STATE_REGISTERED) {
- if (this._updateInfo(this.data, aNewInfo.data) && !aBatch) {
- this.deliverListenerEvent("notifyDataChanged");
- }
- }
- },
-
- updateRadioState: function(aMessage, aCallback = null) {
- switch (aMessage.msgType) {
- case "ExpectedRadioState":
- this._expectedRadioState = aMessage.msgData;
- break;
- case "HardwareRadioState":
- this._hardwareRadioState = aMessage.msgData;
- break;
- default:
- if (DEBUG) this._debug("updateRadioState: Invalid message type");
- return;
- }
-
- if (aMessage.msgType === "ExpectedRadioState" && aCallback &&
- this._hardwareRadioState === this._expectedRadioState) {
- // Early resolved
- aCallback.notifySuccess();
- return;
- }
-
- let newState;
- switch (this._expectedRadioState) {
- case RIL.GECKO_RADIOSTATE_ENABLED:
- newState = this._hardwareRadioState === this._expectedRadioState ?
- Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED :
- Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLING;
- break;
-
- case RIL.GECKO_RADIOSTATE_DISABLED:
- newState = this._hardwareRadioState === this._expectedRadioState ?
- Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED :
- Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLING;
- break;
-
- default: /* RIL.GECKO_RADIOSTATE_UNKNOWN */
- switch (this._hardwareRadioState) {
- case RIL.GECKO_RADIOSTATE_ENABLED:
- newState = Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED;
- break;
- case RIL.GECKO_RADIOSTATE_DISABLED:
- newState = Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED;
- break;
- default: /* RIL.GECKO_RADIOSTATE_UNKNOWN */
- newState = Ci.nsIMobileConnection.MOBILE_RADIO_STATE_UNKNOWN;
- }
- }
-
- // This update is triggered by underlying layers and the state is UNKNOWN
- if (aMessage.msgType === "HardwareRadioState" &&
- aMessage.msgData === RIL.GECKO_RADIOSTATE_UNKNOWN) {
- // TODO: Find a better way than just setting the radio state to UNKNOWN
- newState = Ci.nsIMobileConnection.MOBILE_RADIO_STATE_UNKNOWN;
- }
-
- if (newState === Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLING ||
- newState === Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLING) {
- let action = this._expectedRadioState === RIL.GECKO_RADIOSTATE_ENABLED;
- this._radioInterface.sendWorkerMessage("setRadioEnabled",
- {enabled: action},
- function(aResponse) {
- if (!aCallback) {
- return false;
- }
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
- aCallback.notifySuccess();
- return false;
- });
- }
-
- if (DEBUG) this._debug("Current Radio State is '" + newState + "'");
- if (this.radioState === newState) {
- return;
- }
- this.radioState = newState;
- this.deliverListenerEvent("notifyRadioStateChanged");
- },
-
- notifyCFStateChanged: function(aAction, aReason, aNumber, aTimeSeconds,
- aServiceClass) {
- this.deliverListenerEvent("notifyCFStateChanged",
- [aAction, aReason, aNumber, aTimeSeconds,
- aServiceClass]);
- },
-
- notifyDeviceIdentitiesChanged: function(aImei, aImeisv, aEsn, aMeid) {
- if (this.deviceIdentities) {
- if (DEBUG) this._debug("deviceIdentities shall not be changed once being updated.");
- return;
- }
-
- this.deviceIdentities =
- new MobileDeviceIdentities(aImei, aImeisv, aEsn, aMeid);
- this.deliverListenerEvent("notifyDeviceIdentitiesChanged");
- },
-
- getSupportedNetworkTypes: function(aTypes) {
- aTypes.value = this.supportedNetworkTypes.slice();
- return aTypes.value.length;
- },
-
- getNetworks: function(aCallback) {
- this._radioInterface.sendWorkerMessage("getAvailableNetworks", null,
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- let networks = aResponse.networks;
- for (let i = 0; i < networks.length; i++) {
- let info = new MobileNetworkInfo();
- this._updateInfo(info, networks[i]);
- networks[i] = info;
- }
-
- aCallback.notifyGetNetworksSuccess(networks.length, networks);
- return false;
- }).bind(this));
- },
-
- selectNetwork: function(aNetwork, aCallback) {
- if (!aNetwork ||
- isNaN(parseInt(aNetwork.mcc, 10)) ||
- isNaN(parseInt(aNetwork.mnc, 10))) {
- this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_INVALID_PARAMETER);
- return;
- }
-
- if (this._selectingNetwork) {
- this._dispatchNotifyError(aCallback, "AlreadySelectingANetwork");
- return;
- }
-
- let options = {mcc: aNetwork.mcc, mnc: aNetwork.mnc};
- this._selectingNetwork = options;
- this._radioInterface.sendWorkerMessage("selectNetwork", options,
- (function(aResponse) {
- this._selectingNetwork = null;
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifySuccess();
- return false;
- }).bind(this));
- },
-
- selectNetworkAutomatically: function(aCallback) {
- if (this._selectingNetwork) {
- this._dispatchNotifyError(aCallback, "AlreadySelectingANetwork");
- return;
- }
-
- this._selectingNetwork = "automatic";
- this._radioInterface.sendWorkerMessage("selectNetworkAuto", null,
- (function(aResponse) {
- this._selectingNetwork = null;
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifySuccess();
- return false;
- }).bind(this));
- },
-
- setPreferredNetworkType: function(aType, aCallback) {
- if (this.radioState !== Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
- this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
- return;
- }
-
- this._radioInterface.sendWorkerMessage("setPreferredNetworkType",
- {type: aType},
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifySuccess();
- return false;
- }).bind(this));
- },
-
- getPreferredNetworkType: function(aCallback) {
- if (this.radioState !== Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
- this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
- return;
- }
-
- this._radioInterface.sendWorkerMessage("getPreferredNetworkType", null,
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifyGetPreferredNetworkTypeSuccess(aResponse.type);
- return false;
- }).bind(this));
- },
-
- setRoamingPreference: function(aMode, aCallback) {
- this._radioInterface.sendWorkerMessage("setRoamingPreference",
- {mode: aMode},
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifySuccess();
- return false;
- }).bind(this));
- },
-
- getRoamingPreference: function(aCallback) {
- this._radioInterface.sendWorkerMessage("queryRoamingPreference", null,
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifyGetRoamingPreferenceSuccess(aResponse.mode);
- return false;
- }).bind(this));
- },
-
- setVoicePrivacyMode: function(aEnabled, aCallback) {
- this._radioInterface.sendWorkerMessage("setVoicePrivacyMode",
- {enabled: aEnabled},
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifySuccess();
- return false;
- }).bind(this));
- },
-
- getVoicePrivacyMode: function(aCallback) {
- this._radioInterface.sendWorkerMessage("queryVoicePrivacyMode", null,
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifySuccessWithBoolean(aResponse.enabled);
- return false;
- }).bind(this));
- },
-
- setCallForwarding: function(aAction, aReason, aNumber, aTimeSeconds,
- aServiceClass, aCallback) {
- let options = {
- action: aAction,
- reason: aReason,
- number: aNumber,
- timeSeconds: aTimeSeconds,
- serviceClass: RIL.ICC_SERVICE_CLASS_VOICE
- };
-
- this._radioInterface.sendWorkerMessage("setCallForward", options,
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- this.notifyCFStateChanged(aResponse.action, aResponse.reason,
- aResponse.number, aResponse.timeSeconds,
- aResponse.serviceClass);
- aCallback.notifySuccess();
- return false;
- }).bind(this));
- },
-
- getCallForwarding: function(aReason, aCallback) {
- this._radioInterface.sendWorkerMessage("queryCallForwardStatus",
- {reason: aReason},
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- let infos = this._rulesToCallForwardingOptions(aResponse.rules);
- aCallback.notifyGetCallForwardingSuccess(infos.length, infos);
- return false;
- }).bind(this));
- },
-
- setCallBarring: function(aProgram, aEnabled, aPassword, aServiceClass,
- aCallback) {
- let options = {
- program: aProgram,
- enabled: aEnabled,
- password: aPassword,
- serviceClass: aServiceClass
- };
-
- this._radioInterface.sendWorkerMessage("setCallBarring", options,
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifySuccess();
- return false;
- }).bind(this));
- },
-
- getCallBarring: function(aProgram, aPassword, aServiceClass, aCallback) {
- let options = {
- program: aProgram,
- password: aPassword,
- serviceClass: aServiceClass
- };
-
- this._radioInterface.sendWorkerMessage("queryCallBarringStatus", options,
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifyGetCallBarringSuccess(aResponse.program,
- aResponse.enabled,
- aResponse.serviceClass);
- return false;
- }).bind(this));
- },
-
- changeCallBarringPassword: function(aPin, aNewPin, aCallback) {
- let options = {
- pin: aPin,
- newPin: aNewPin
- };
-
- this._radioInterface.sendWorkerMessage("changeCallBarringPassword", options,
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifySuccess();
- return false;
- }).bind(this));
- },
-
- setCallWaiting: function(aEnabled, aServiceClass, aCallback) {
- let options = {
- enabled: aEnabled,
- serviceClass: aServiceClass
- };
-
- this._radioInterface.sendWorkerMessage("setCallWaiting", options,
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifySuccess();
- return false;
- }).bind(this));
- },
-
- getCallWaiting: function(aCallback) {
- this._radioInterface.sendWorkerMessage("queryCallWaiting", null,
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifyGetCallWaitingSuccess(aResponse.serviceClass);
- return false;
- }).bind(this));
- },
-
- setCallingLineIdRestriction: function(aMode, aCallback) {
- if (!this._isValidClirMode(aMode)) {
- this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_INVALID_PARAMETER);
- return;
- }
-
- if (this.radioState !== Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
- this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
- return;
- }
-
- this._radioInterface.sendWorkerMessage("setCLIR", {clirMode: aMode},
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- this.deliverListenerEvent("notifyClirModeChanged", [aResponse.mode]);
- aCallback.notifySuccess();
- return false;
- }).bind(this));
- },
-
- getCallingLineIdRestriction: function(aCallback) {
- if (this.radioState !== Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED) {
- this._dispatchNotifyError(aCallback, RIL.GECKO_ERROR_RADIO_NOT_AVAILABLE);
- return;
- }
-
- this._radioInterface.sendWorkerMessage("getCLIR", null,
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifyGetClirStatusSuccess(aResponse.n, aResponse.m);
- return false;
- }).bind(this));
- },
-
- exitEmergencyCbMode: function(aCallback) {
- this._radioInterface.sendWorkerMessage("exitEmergencyCbMode", null,
- (function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyError(aResponse.errorMsg);
- return false;
- }
-
- aCallback.notifySuccess();
- return false;
- }).bind(this));
- },
-
- setRadioEnabled: function(aEnabled, aCallback) {
- if (DEBUG) {
- this._debug("setRadioEnabled: " + aEnabled);
- }
-
- // Before sending a equest to |ril_worker.js|, we should check radioState.
- switch (this.radioState) {
- case Ci.nsIMobileConnection.MOBILE_RADIO_STATE_UNKNOWN:
- case Ci.nsIMobileConnection.MOBILE_RADIO_STATE_ENABLED:
- case Ci.nsIMobileConnection.MOBILE_RADIO_STATE_DISABLED:
- break;
- default:
- aCallback.notifyError("InvalidStateError");
- return;
- }
-
- let message = {
- msgType: "ExpectedRadioState",
- msgData: (aEnabled ? RIL.GECKO_RADIOSTATE_ENABLED :
- RIL.GECKO_RADIOSTATE_DISABLED)
- };
- this.updateRadioState(message, aCallback);
- },
-
- getCellInfoList: function(aCallback) {
- this._radioInterface.sendWorkerMessage("getCellInfoList",
- null,
- function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyGetCellInfoListFailed(aResponse.errorMsg);
- return;
- }
-
- let cellInfoList = [];
- let count = aResponse.result.length;
- for (let i = 0; i < count; i++) {
- let srcCellInfo = aResponse.result[i];
- let cellInfo;
- switch (srcCellInfo.type) {
- case RIL.CELL_INFO_TYPE_GSM:
- cellInfo = new GsmCellInfo(srcCellInfo);
- break;
- case RIL.CELL_INFO_TYPE_WCDMA:
- cellInfo = new WcdmaCellInfo(srcCellInfo);
- break;
- case RIL.CELL_INFO_TYPE_LTE:
- cellInfo = new LteCellInfo(srcCellInfo);
- break;
- case RIL.CELL_INFO_TYPE_CDMA:
- cellInfo = new CdmaCellInfo(srcCellInfo);
- break;
- }
-
- if (!cellInfo || !cellInfo.isValid()) {
- continue;
- }
-
- cellInfoList.push(cellInfo);
- }
- aCallback.notifyGetCellInfoList(cellInfoList.length, cellInfoList);
- }.bind(this));
- },
-
- getNeighboringCellIds: function(aCallback) {
- this._radioInterface.sendWorkerMessage("getNeighboringCellIds",
- null,
- function(aResponse) {
- if (aResponse.errorMsg) {
- aCallback.notifyGetNeighboringCellIdsFailed(aResponse.errorMsg);
- return;
- }
-
- let neighboringCellIds = [];
- let count = aResponse.result.length;
- for (let i = 0; i < count; i++) {
- let srcCellInfo = aResponse.result[i];
- let cellInfo = new NeighboringCellInfo(srcCellInfo);
- if (cellInfo && cellInfo.isValid()) {
- neighboringCellIds.push(cellInfo);
- }
- }
- aCallback.notifyGetNeighboringCellIds(neighboringCellIds.length,
- neighboringCellIds);
-
- }.bind(this));
- },
-};
-
-function MobileConnectionService() {
- this._providers = [];
-
- let numClients = gRadioInterfaceLayer.numRadioInterfaces;
- for (let i = 0; i < numClients; i++) {
- let radioInterface = gRadioInterfaceLayer.getRadioInterface(i);
- let provider = new MobileConnectionProvider(i, radioInterface);
- this._providers.push(provider);
- }
-
- Services.prefs.addObserver(kPrefRilDebuggingEnabled, this, false);
- Services.obs.addObserver(this, NS_NETWORK_ACTIVE_CHANGED_TOPIC_ID, false);
- Services.obs.addObserver(this, NS_DATA_CALL_ERROR_TOPIC_ID, false);
- Services.obs.addObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID, false);
-
- debug("init complete");
-}
-MobileConnectionService.prototype = {
- classID: GONK_MOBILECONNECTIONSERVICE_CID,
- classInfo: XPCOMUtils.generateCI({classID: GONK_MOBILECONNECTIONSERVICE_CID,
- contractID: GONK_MOBILECONNECTIONSERVICE_CONTRACTID,
- classDescription: "MobileConnectionService",
- interfaces: [Ci.nsIGonkMobileConnectionService,
- Ci.nsIMobileConnectionService],
- flags: Ci.nsIClassInfo.SINGLETON}),
- QueryInterface: XPCOMUtils.generateQI([Ci.nsIGonkMobileConnectionService,
- Ci.nsIMobileConnectionService,
- Ci.nsIObserver]),
-
- // An array of MobileConnectionProvider instances.
- _providers: null,
-
- _shutdown: function() {
- Services.prefs.removeObserver(kPrefRilDebuggingEnabled, this);
- Services.obs.removeObserver(this, NS_NETWORK_ACTIVE_CHANGED_TOPIC_ID);
- Services.obs.removeObserver(this, NS_DATA_CALL_ERROR_TOPIC_ID);
- Services.obs.removeObserver(this, NS_XPCOM_SHUTDOWN_OBSERVER_ID);
- },
-
- _updateDebugFlag: function() {
- try {
- DEBUG = RIL.DEBUG_RIL ||
- Services.prefs.getBoolPref(kPrefRilDebuggingEnabled);
- } catch (e) {}
- },
-
- /**
- * nsIMobileConnectionService interface.
- */
- get numItems() {
- return this._providers.length;
- },
-
- getItemByServiceId: function(aServiceId) {
- let provider = this._providers[aServiceId];
- if (!provider) {
- throw Cr.NS_ERROR_UNEXPECTED;
- }
-
- return provider;
- },
-
- /**
- * nsIGonkMobileConnectionService interface.
- */
- notifyVoiceInfoChanged: function(aClientId, aVoiceInfo) {
- if (DEBUG) {
- debug("notifyVoiceInfoChanged for " + aClientId + ": " +
- JSON.stringify(aVoiceInfo));
- }
-
- this.getItemByServiceId(aClientId).updateVoiceInfo(aVoiceInfo);
- },
-
- notifyDataInfoChanged: function(aClientId, aDataInfo) {
- if (DEBUG) {
- debug("notifyDataInfoChanged for " + aClientId + ": " +
- JSON.stringify(aDataInfo));
- }
-
- this.getItemByServiceId(aClientId).updateDataInfo(aDataInfo);
- },
-
- notifyDataError: function(aClientId, aMessage) {
- if (DEBUG) {
- debug("notifyDataError for " + aClientId + ": " + aMessage);
- }
-
- this.getItemByServiceId(aClientId)
- .deliverListenerEvent("notifyDataError", [aMessage]);
- },
-
- notifyEmergencyCallbackModeChanged: function(aClientId, aActive, aTimeoutMs) {
- if (DEBUG) {
- debug("notifyEmergencyCbModeChanged for " + aClientId + ": " +
- JSON.stringify({active: aActive, timeoutMs: aTimeoutMs}));
- }
-
- this.getItemByServiceId(aClientId)
- .deliverListenerEvent("notifyEmergencyCbModeChanged",
- [aActive, aTimeoutMs]);
- },
-
- notifyOtaStatusChanged: function(aClientId, aStatus) {
- if (DEBUG) {
- debug("notifyOtaStatusChanged for " + aClientId + ": " + aStatus);
- }
-
- this.getItemByServiceId(aClientId)
- .deliverListenerEvent("notifyOtaStatusChanged", [aStatus]);
- },
-
- notifyRadioStateChanged: function(aClientId, aRadioState) {
- if (DEBUG) {
- debug("notifyRadioStateChanged for " + aClientId + ": " + aRadioState);
- }
-
- let message = {
- msgType: "HardwareRadioState",
- msgData: aRadioState
- };
- this.getItemByServiceId(aClientId).updateRadioState(message);
- },
-
- notifyNetworkInfoChanged: function(aClientId, aNetworkInfo) {
- if (DEBUG) {
- debug("notifyNetworkInfoChanged for " + aClientId + ": " +
- JSON.stringify(aNetworkInfo));
- }
-
- let provider = this.getItemByServiceId(aClientId);
-
- let isVoiceUpdated = false;
- let isDataUpdated = false;
- let operatorMessage = aNetworkInfo[RIL.NETWORK_INFO_OPERATOR];
- let voiceMessage = aNetworkInfo[RIL.NETWORK_INFO_VOICE_REGISTRATION_STATE];
- let dataMessage = aNetworkInfo[RIL.NETWORK_INFO_DATA_REGISTRATION_STATE];
- let signalMessage = aNetworkInfo[RIL.NETWORK_INFO_SIGNAL];
- let selectionMessage = aNetworkInfo[RIL.NETWORK_INFO_NETWORK_SELECTION_MODE];
-
- // Batch the *InfoChanged messages together
- if (operatorMessage) {
- provider.updateOperatorInfo(operatorMessage, true);
- }
-
- if (voiceMessage) {
- provider.updateVoiceInfo(voiceMessage, true);
- }
-
- if (dataMessage) {
- provider.updateDataInfo(dataMessage, true);
- }
-
- if (signalMessage) {
- provider.updateSignalInfo(signalMessage, true);
- }
-
- if (selectionMessage) {
- this.notifyNetworkSelectModeChanged(aClientId, selectionMessage.mode);
- }
-
- if (voiceMessage || operatorMessage || signalMessage) {
- provider.deliverListenerEvent("notifyVoiceChanged");
- }
-
- if (dataMessage || operatorMessage || signalMessage) {
- provider.deliverListenerEvent("notifyDataChanged");
- }
- },
-
- notifySignalStrengthChanged: function(aClientId, aSignal) {
- if (DEBUG) {
- debug("notifySignalStrengthChanged for " + aClientId + ": " +
- JSON.stringify(aSignal));
- }
-
- this.getItemByServiceId(aClientId).updateSignalInfo(aSignal);
- },
-
- notifyOperatorChanged: function(aClientId, aOperator) {
- if (DEBUG) {
- debug("notifyOperatorChanged for " + aClientId + ": " +
- JSON.stringify(aOperator));
- }
-
- this.getItemByServiceId(aClientId).updateOperatorInfo(aOperator);
- },
-
- notifyNetworkSelectModeChanged: function(aClientId, aMode) {
- if (DEBUG) {
- debug("notifyNetworkSelectModeChanged for " + aClientId + ": " + aMode);
- }
-
- let provider = this.getItemByServiceId(aClientId);
- if (provider.networkSelectionMode === aMode) {
- return;
- }
-
- provider.networkSelectionMode = aMode;
- provider.deliverListenerEvent("notifyNetworkSelectionModeChanged");
- },
-
- notifySpnAvailable: function(aClientId) {
- if (DEBUG) {
- debug("notifySpnAvailable for " + aClientId);
- }
-
- let provider = this.getItemByServiceId(aClientId);
-
- // Update voice roaming state
- provider.updateVoiceInfo({});
-
- // Update data roaming state
- provider.updateDataInfo({});
- },
-
- notifyLastHomeNetworkChanged: function(aClientId, aNetwork) {
- if (DEBUG) {
- debug("notifyLastHomeNetworkChanged for " + aClientId + ": " + aNetwork);
- }
-
- let provider = this.getItemByServiceId(aClientId);
- if (provider.lastKnownHomeNetwork === aNetwork) {
- return;
- }
-
- provider.lastKnownHomeNetwork = aNetwork;
- provider.deliverListenerEvent("notifyLastKnownHomeNetworkChanged");
- },
-
- notifyCFStateChanged: function(aClientId, aAction, aReason, aNumber,
- aTimeSeconds, aServiceClass) {
- if (DEBUG) {
- debug("notifyCFStateChanged for " + aClientId);
- }
-
- let provider = this.getItemByServiceId(aClientId);
- provider.notifyCFStateChanged(aAction, aReason, aNumber, aTimeSeconds,
- aServiceClass);
- },
-
- notifyCdmaInfoRecDisplay: function(aClientId, aDisplay) {
- gMobileConnectionMessenger.notifyCdmaInfoRecDisplay(aClientId, aDisplay);
- },
-
- notifyCdmaInfoRecCalledPartyNumber: function(aClientId, aType, aPlan, aNumber,
- aPi, aSi) {
- gMobileConnectionMessenger
- .notifyCdmaInfoRecCalledPartyNumber(aClientId, aType, aPlan, aNumber,
- aPi, aSi);
- },
-
- notifyCdmaInfoRecCallingPartyNumber: function(aClientId, aType, aPlan, aNumber,
- aPi, aSi) {
- gMobileConnectionMessenger
- .notifyCdmaInfoRecCallingPartyNumber(aClientId, aType, aPlan, aNumber,
- aPi, aSi);
- },
-
- notifyCdmaInfoRecConnectedPartyNumber: function(aClientId, aType, aPlan, aNumber,
- aPi, aSi) {
- gMobileConnectionMessenger
- .notifyCdmaInfoRecConnectedPartyNumber(aClientId, aType, aPlan, aNumber,
- aPi, aSi);
- },
-
- notifyCdmaInfoRecSignal: function(aClientId, aType, aAlertPitch, aSignal){
- gMobileConnectionMessenger
- .notifyCdmaInfoRecSignal(aClientId, aType, aAlertPitch, aSignal);
- },
-
- notifyCdmaInfoRecRedirectingNumber: function(aClientId, aType, aPlan, aNumber,
- aPi, aSi, aReason) {
- gMobileConnectionMessenger
- .notifyCdmaInfoRecRedirectingNumber(aClientId, aType, aPlan, aNumber,
- aPi, aSi, aReason);
- },
-
- notifyCdmaInfoRecLineControl: function(aClientId, aPolarityIncluded, aToggle,
- aReverse, aPowerDenial) {
- gMobileConnectionMessenger
- .notifyCdmaInfoRecLineControl(aClientId, aPolarityIncluded, aToggle,
- aReverse, aPowerDenial);
- },
-
- notifyCdmaInfoRecClir: function(aClientId, aCause) {
- gMobileConnectionMessenger.notifyCdmaInfoRecClir(aClientId, aCause);
- },
-
- notifyCdmaInfoRecAudioControl: function(aClientId, aUpLink, aDownLink) {
- gMobileConnectionMessenger
- .notifyCdmaInfoRecAudioControl(aClientId, aUpLink, aDownLink);
- },
-
- notifyDeviceIdentitiesChanged: function(aClientId, aImei, aImeisv,
- aEsn, aMeid) {
- this.getItemByServiceId(aClientId)
- .notifyDeviceIdentitiesChanged(aImei, aImeisv, aEsn, aMeid);
- },
-
- /**
- * nsIObserver interface.
- */
- observe: function(aSubject, aTopic, aData) {
- switch (aTopic) {
- case NS_NETWORK_ACTIVE_CHANGED_TOPIC_ID:
- for (let i = 0; i < this.numItems; i++) {
- let provider = this._providers[i];
- // Update connected flag only.
- provider.updateDataInfo({});
- }
- break;
- case NS_DATA_CALL_ERROR_TOPIC_ID:
- try {
- if (aSubject instanceof Ci.nsIRilNetworkInfo) {
- let rilInfo = aSubject.QueryInterface(Ci.nsIRilNetworkInfo);
- this.notifyDataError(rilInfo.serviceId, aData);
- }
- } catch (e) {}
- break;
- case NS_PREFBRANCH_PREFCHANGE_TOPIC_ID:
- if (aData === kPrefRilDebuggingEnabled) {
- this._updateDebugFlag();
- }
- break;
- case NS_XPCOM_SHUTDOWN_OBSERVER_ID:
- this._shutdown();
- break;
- }
- }
-};
-
-this.NSGetFactory = XPCOMUtils.generateNSGetFactory([MobileConnectionService]);
deleted file mode 100644
--- a/dom/mobileconnection/gonk/MobileConnectionService.manifest
+++ /dev/null
@@ -1,2 +0,0 @@
-component {0c9c1a96-2c72-4c55-9e27-0ca73eb16f63} MobileConnectionService.js
-contract @mozilla.org/mobileconnection/gonkmobileconnectionservice;1 {0c9c1a96-2c72-4c55-9e27-0ca73eb16f63}
deleted file mode 100644
--- a/dom/mobileconnection/gonk/nsIGonkMobileConnectionService.idl
+++ /dev/null
@@ -1,274 +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 "nsIMobileConnectionService.idl"
-
-%{C++
-#define GONK_MOBILECONNECTION_SERVICE_CONTRACTID \
- "@mozilla.org/mobileconnection/gonkmobileconnectionservice;1"
-%}
-
-[scriptable, uuid(3c306f88-86bf-11e5-91af-3b2233acec65)]
-interface nsIGonkMobileConnectionService : nsIMobileConnectionService
-{
- void notifyNetworkInfoChanged(in unsigned long clientId, in jsval networkInfo);
-
- void notifyVoiceInfoChanged(in unsigned long clientId, in jsval voiceInfo);
-
- void notifyDataInfoChanged(in unsigned long clientId, in jsval dataInfo);
-
- void notifyDataError(in unsigned long clientId, in DOMString message);
-
- void notifySignalStrengthChanged(in unsigned long clientId, in jsval signal);
-
- void notifyOperatorChanged(in unsigned long clientId, in jsval info);
-
- void notifyOtaStatusChanged(in unsigned long clientId, in DOMString status);
-
- void notifyRadioStateChanged(in unsigned long clientId,
- in long radioState);
-
- void notifyEmergencyCallbackModeChanged(in unsigned long clientId,
- in boolean active,
- in unsigned long timeoutMs);
-
- void notifyNetworkSelectModeChanged(in unsigned long clientId,
- in long mode);
-
- void notifySpnAvailable(in unsigned long clientId);
-
- void notifyLastHomeNetworkChanged(in unsigned long clientId,
- in DOMString network);
-
- void notifyCFStateChanged(in unsigned long clientId,
- in unsigned short action,
- in unsigned short reason,
- in DOMString number,
- in unsigned short timeSeconds,
- in unsigned short serviceClass);
-
- /**
- * Notify Display Info from received Cdma-Info-Record.
- * See 3.7.4.1 Display in 3GPP2 C.S0005-F.
- *
- * @param clientId
- * The ID of radioInterface where this info is notified from.
- * @param display
- The string to be displayed.
- */
- void notifyCdmaInfoRecDisplay(in unsigned long clientId,
- in DOMString display);
-
- /**
- * Notify Called Party Number from received Cdma-Info-Record.
- * See 3.7.4.2 Called Party Number in 3GPP2 C.S0005-F.
- *
- * @param clientId
- * The ID of radioInterface where this info is notified from.
- * @param type
- * The type of number. (3-bit binary)
- * See Table 2.7.1.3.2.4-2 in 3GPP2 C.S0005-F.
- * @param plan
- * The numbering plan. (4-bit binary)
- * See Table 2.7.1.3.2.4-3 in 3GPP2 C.S0005-F.
- * @param number
- * The string presentation of the number.
- * @param pi (2-bit binary)
- * The Presentation indicator of the number.
- * See Table 2.7.4.4-1 in 3GPP2 C.S0005-F.
- * @param si (2-bit binary)
- * The Screening Indicator of the number.
- * See Table 2.7.4.4-2 in 3GPP2 C.S0005-F.
- */
- void notifyCdmaInfoRecCalledPartyNumber(in unsigned long clientId,
- in unsigned short type,
- in unsigned short plan,
- in DOMString number,
- in unsigned short pi,
- in unsigned short si);
-
- /**
- * Notify Calling Party Number from received Cdma-Info-Record.
- * See 3.7.4.3 Calling Party Number in 3GPP2 C.S0005-F.
- *
- * @param clientId
- * The ID of radioInterface where this info is notified from.
- * @param type
- * The type of number. (3-bit binary)
- * See Table 2.7.1.3.2.4-2 in 3GPP2 C.S0005-F.
- * @param plan
- * The numbering plan. (4-bit binary)
- * See Table 2.7.1.3.2.4-3 in 3GPP2 C.S0005-F.
- * @param number
- * The string presentation of the number.
- * @param pi (2-bit binary)
- * The Presentation indicator of the number.
- * See Table 2.7.4.4-1 in 3GPP2 C.S0005-F.
- * @param si (2-bit binary)
- * The Screening Indicator of the number.
- * See Table 2.7.4.4-2 in 3GPP2 C.S0005-F.
- */
- void notifyCdmaInfoRecCallingPartyNumber(in unsigned long clientId,
- in unsigned short type,
- in unsigned short plan,
- in DOMString number,
- in unsigned short pi,
- in unsigned short si);
-
- /**
- * Notify Connected Party Number from received Cdma-Info-Record.
- * See 3.7.4.4 Connected Party Number in 3GPP2 C.S0005-F.
- *
- * @param clientId
- * The ID of radioInterface where this info is notified from.
- * @param type
- * The type of number. (3-bit binary)
- * See Table 2.7.1.3.2.4-2 in 3GPP2 C.S0005-F.
- * @param plan
- * The numbering plan. (4-bit binary)
- * See Table 2.7.1.3.2.4-3 in 3GPP2 C.S0005-F.
- * @param number
- * The string presentation of the number.
- * @param pi (2-bit binary)
- * The Presentation indicator of the number.
- * See Table 2.7.4.4-1 in 3GPP2 C.S0005-F.
- * @param si (2-bit binary)
- * The Screening Indicator of the number.
- * See Table 2.7.4.4-2 in 3GPP2 C.S0005-F.
- */
- void notifyCdmaInfoRecConnectedPartyNumber(in unsigned long clientId,
- in unsigned short type,
- in unsigned short plan,
- in DOMString number,
- in unsigned short pi,
- in unsigned short si);
-
- /**
- * Notify Signal Info from received Cdma-Info-Record.
- * See 3.7.4.5 Signal in 3GPP2 C.S0005-F.
- *
- * @param clientId
- * The ID of radioInterface where this info is notified from.
- * @param type
- * The signal type. (2-bit binary)
- * See Table 3.7.5.5-1 in 3GPP2 C.S0005-F.
- * @param alertPitch
- * The pitch of the alerting signal. (2-bit binary)
- * See Table 3.7.5.5-2 in 3GPP2 C.S0005-F.
- * @param signal
- * The signal code. (6-bit binary)
- * See Table 3.7.5.5-3, 3.7.5.5-4, 3.7.5.5-5 in 3GPP2 C.S0005-F.
- */
- void notifyCdmaInfoRecSignal(in unsigned long clientId,
- in unsigned short type,
- in unsigned short alertPitch,
- in unsigned short signal);
-
- /**
- * Notify Redirecting Number from received Cdma-Info-Record.
- * See 3.7.4.11 Redirecting Number in 3GPP2 C.S0005-F.
- *
- * @param clientId
- * The ID of radioInterface where this info is notified from.
- * @param type
- * The type of number. (3-bit binary)
- * See Table 2.7.1.3.2.4-2 in 3GPP2 C.S0005-F.
- * @param plan
- * The numbering plan. (4-bit binary)
- * See Table 2.7.1.3.2.4-3 in 3GPP2 C.S0005-F.
- * @param number
- * The string presentation of the number.
- * @param pi (2-bit binary)
- * The Presentation indicator of the number.
- * See Table 2.7.4.4-1 in 3GPP2 C.S0005-F.
- * @param si (2-bit binary)
- * The Screening Indicator of the number.
- * See Table 2.7.4.4-2 in 3GPP2 C.S0005-F.
- * @param reason (4-bit binary)
- * The redirection reason.
- * See Table 3.7.5.11-1 in 3GPP2 C.S0005-F.
- */
- void notifyCdmaInfoRecRedirectingNumber(in unsigned long clientId,
- in unsigned short type,
- in unsigned short plan,
- in DOMString number,
- in unsigned short pi,
- in unsigned short si,
- in unsigned short reason);
-
- /**
- * Notify Line Control from received Cdma-Info-Record.
- * See 3.7.4.15 Line Control in 3GPP2 C.S0005-F.
- *
- * @param clientId
- * The ID of radioInterface where this info is notified from.
- * @param polarityIncluded (1-bit)
- * Polarity parameter included.
- * @param toggle (1-bit)
- * Toggle mode.
- * @param reverse (1-bit)
- * Reverse polarity.
- * @param powerDenial (8-bit)
- * Power denial timeout.
- */
- void notifyCdmaInfoRecLineControl(in unsigned long clientId,
- in unsigned short polarityIncluded,
- in unsigned short toggle,
- in unsigned short reverse,
- in unsigned short powerDenial);
-
- /**
- * Notify CLIR from received Cdma-Info-Record.
- * See 'ANNEX 1 Country-Specific Record Type for Japan' in T53.
- * http://www.arib.or.jp/english/html/overview/doc/T53v6_5_pdf/5_ANNEX_v6_5.pdf
- *
- * @param clientId
- * The ID of radioInterface where this info is notified from.
- * @param cause
- * Reason code. (8-bit binary)
- * See Table A 1.1-1 in T53.
- */
- void notifyCdmaInfoRecClir(in unsigned long clientId,
- in unsigned short cause);
-
- /**
- * Notify Audio Control from received Cdma-Info-Record.
- *
- * Note: No information from ARIB about Audio Control.
- * It seems obsolete according to ANNEX 1 in T53.
- * upLink/downLink are 'byte' value according to ril.h.
- * Treat them as 'signed short' to preserve the flexibility when needed.
- *
- * @param clientId
- * The ID of radioInterface where this info is notified from.
- * @param upLink
- * @param downLink
- */
- void notifyCdmaInfoRecAudioControl(in unsigned long clientId,
- in short upLink,
- in short downLink);
-
- /**
- * Notify Device Identities.
- *
- * @param aClientId
- * The ID of radioInterface where this info is notified from.
- * @param aImei
- * Device IMEI, valid if GSM subscription is available.
- * @param aImeisv
- * Device IMEISV, valid if GSM subscription is available.
- * @param aEsn
- * Device ESN, valid if CDMA subscription is available.
- * @param aMeid
- * Device MEID, valid if CDMA subscription is available.
- *
- * Note: The value might be dummy like "000..." from modem
- * if the corresponding subscription is not available.
- */
- void notifyDeviceIdentitiesChanged(in unsigned long aClientId,
- in DOMString aImei,
- in DOMString aImeisv,
- in DOMString aEsn,
- in DOMString aMeid);
-};
deleted file mode 100644
--- a/dom/mobileconnection/gonk/nsIMobileConnectionMessenger.idl
+++ /dev/null
@@ -1,199 +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 "nsISupports.idl"
-
-[scriptable, uuid(b9ec941e-8504-11e4-810e-7b62c60e8261)]
-interface nsIMobileConnectionMessenger : nsISupports
-{
- /**
- * 'cdma-info-rec-received' system message with Display Info
- *
- * @param aServiceId
- * The ID of Service where this info is notified from.
- * @param aDisplay
- * The text to be displayed.
- */
- void notifyCdmaInfoRecDisplay(in unsigned long aServiceId,
- in DOMString aDisplay);
-
- /**
- * 'cdma-info-rec-received' system message with Called Party Number Info
- *
- * @param aServiceId
- * The ID of Service where this info is notified from.
- * @param aTtype
- * The type of number. (3-bit binary)
- * See Table 2.7.1.3.2.4-2 in 3GPP2 C.S0005-F.
- * @param aPlan
- * The numbering plan. (4-bit binary)
- * See Table 2.7.1.3.2.4-3 in 3GPP2 C.S0005-F.
- * @param aNumber
- * The string presentation of the number.
- * @param aPi (2-bit binary)
- * The Presentation indicator of the number.
- * See Table 2.7.4.4-1 in 3GPP2 C.S0005-F.
- * @param aSi (2-bit binary)
- * The Screening Indicator of the number.
- * See Table 2.7.4.4-2 in 3GPP2 C.S0005-F.
- */
- void notifyCdmaInfoRecCalledPartyNumber(in unsigned long aServiceId,
- in unsigned short aType,
- in unsigned short aPlan,
- in DOMString aNumber,
- in unsigned short aPi,
- in unsigned short aSi);
-
- /**
- * 'cdma-info-rec-received' system message with Calling Party Number Info
- *
- * @param aServiceId
- * The ID of Service where this info is notified from.
- * @param aTtype
- * The type of number. (3-bit binary)
- * See Table 2.7.1.3.2.4-2 in 3GPP2 C.S0005-F.
- * @param aPlan
- * The numbering plan. (4-bit binary)
- * See Table 2.7.1.3.2.4-3 in 3GPP2 C.S0005-F.
- * @param aNumber
- * The string presentation of the number.
- * @param aPi (2-bit binary)
- * The Presentation indicator of the number.
- * See Table 2.7.4.4-1 in 3GPP2 C.S0005-F.
- * @param aSi (2-bit binary)
- * The Screening Indicator of the number.
- * See Table 2.7.4.4-2 in 3GPP2 C.S0005-F.
- */
- void notifyCdmaInfoRecCallingPartyNumber(in unsigned long aServiceId,
- in unsigned short aType,
- in unsigned short aPlan,
- in DOMString aNumber,
- in unsigned short aPi,
- in unsigned short aSi);
-
- /**
- * 'cdma-info-rec-received' system message with Connected Party Number Info
- *
- * @param aServiceId
- * The ID of Service where this info is notified from.
- * @param aTtype
- * The type of number. (3-bit binary)
- * See Table 2.7.1.3.2.4-2 in 3GPP2 C.S0005-F.
- * @param aPlan
- * The numbering plan. (4-bit binary)
- * See Table 2.7.1.3.2.4-3 in 3GPP2 C.S0005-F.
- * @param aNumber
- * The string presentation of the number.
- * @param aPi (2-bit binary)
- * The Presentation indicator of the number.
- * See Table 2.7.4.4-1 in 3GPP2 C.S0005-F.
- * @param aSi (2-bit binary)
- * The Screening Indicator of the number.
- * See Table 2.7.4.4-2 in 3GPP2 C.S0005-F.
- */
- void notifyCdmaInfoRecConnectedPartyNumber(in unsigned long aServiceId,
- in unsigned short aType,
- in unsigned short aPlan,
- in DOMString aNumber,
- in unsigned short aPi,
- in unsigned short aSi);
-
- /**
- * 'cdma-info-rec-received' system message with Signal Info
- *
- * @param aServiceId
- * The ID of Service where this info is notified from.
- * @param aType
- * The signal type. (2-bit binary)
- * See Table 3.7.5.5-1 in 3GPP2 C.S0005-F.
- * @param aAlertPitch
- * The pitch of the alerting signal. (2-bit binary)
- * See Table 3.7.5.5-2 in 3GPP2 C.S0005-F.
- * @param aSignal
- * The signal code. (6-bit binary)
- * See Table 3.7.5.5-3, 3.7.5.5-4, 3.7.5.5-5 in 3GPP2 C.S0005-F.
- */
- void notifyCdmaInfoRecSignal(in unsigned long aServiceId,
- in unsigned short aType,
- in unsigned short aAlertPitch,
- in unsigned short aSignal);
-
- /**
- * 'cdma-info-rec-received' system message with Redirecting Number Info
- *
- * @param aServiceId
- * The ID of Service where this info is notified from.
- * @param aTtype
- * The type of number. (3-bit binary)
- * See Table 2.7.1.3.2.4-2 in 3GPP2 C.S0005-F.
- * @param aPlan
- * The numbering plan. (4-bit binary)
- * See Table 2.7.1.3.2.4-3 in 3GPP2 C.S0005-F.
- * @param aNumber
- * The string presentation of the number.
- * @param aPi (2-bit binary)
- * The Presentation indicator of the number.
- * See Table 2.7.4.4-1 in 3GPP2 C.S0005-F.
- * @param aSi (2-bit binary)
- * The Screening Indicator of the number.
- * See Table 2.7.4.4-2 in 3GPP2 C.S0005-F.
- * @param aReason (4-bit binary)
- * The redirection reason.
- * See Table 3.7.5.11-1 in 3GPP2 C.S0005-F.
- */
- void notifyCdmaInfoRecRedirectingNumber(in unsigned long aServiceId,
- in unsigned short aType,
- in unsigned short aPlan,
- in DOMString aNumber,
- in unsigned short aPi,
- in unsigned short aSi,
- in unsigned short aReason);
-
- /**
- * 'cdma-info-rec-received' system message with Line Control Info
- *
- * @param aServiceId
- * The ID of Service where this info is notified from.
- * @param aPolarityIncluded (1-bit)
- * Polarity parameter included.
- * @param aToggle (1-bit)
- * Toggle mode.
- * @param aReverse (1-bit)
- * Reverse polarity.
- * @param aPowerDenial (8-bit)
- * Power denial timeout.
- */
- void notifyCdmaInfoRecLineControl(in unsigned long aServiceId,
- in unsigned short aPolarityIncluded,
- in unsigned short aToggle,
- in unsigned short aReverse,
- in unsigned short aPowerDenial);
-
- /**
- * 'cdma-info-rec-received' system message with CLIR Info
- *
- * @param aServiceId
- * The ID of Service where this info is notified from.
- * @param aCause
- * Reason code. (8-bit binary)
- * See Table A 1.1-1 in T53.
- *
- * See 'ANNEX 1 Country-Specific Record Type for Japan' in T53.
- * http://www.arib.or.jp/english/html/overview/doc/T53v6_5_pdf/5_ANNEX_v6_5.pdf
- */
- void notifyCdmaInfoRecClir(in unsigned long aServiceId,
- in unsigned short aCause);
-
- /**
- * 'cdma-info-rec-received' system message with Audio Control Info
- *
- * @param aServiceId
- * The ID of Service where this info is notified from.
- * @param aUpLink
- * @param aDownLink
- */
- void notifyCdmaInfoRecAudioControl(in unsigned long aServiceId,
- in short aUpLink,
- in short aDownLink);
-};
deleted file mode 100644
--- a/dom/mobileconnection/interfaces/nsICellInfo.idl
+++ /dev/null
@@ -1,265 +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 "nsISupports.idl"
-
-interface nsICellInfo;
-
-[scriptable, uuid(d8fae631-7ade-4024-b288-7efe75e6b091)]
-interface nsICellInfoListCallback : nsISupports
-{
- /**
- * result is an array of nsICellInfo, which could be instances of
- * nsIGsmCellInfo, nsIWcdmaCellInfo, nsICdmaCellInfo or nsILteCellInfo.
- */
- void notifyGetCellInfoList(in uint32_t count,
- [array, size_is(count)] in nsICellInfo result);
-
- /**
- * Callback function with error message.
- */
- void notifyGetCellInfoListFailed(in DOMString error);
-};
-
-[scriptable, uuid(a9a34341-5a33-4e0a-98e1-13e7ea4228be)]
-interface nsICellInfo : nsISupports
-{
- const long CELL_INFO_TYPE_GSM = 1;
- const long CELL_INFO_TYPE_CDMA = 2;
- const long CELL_INFO_TYPE_LTE = 3;
- const long CELL_INFO_TYPE_WCDMA = 4;
-
- const long TIMESTAMP_TYPE_UNKNOWN = 0;
- const long TIMESTAMP_TYPE_ANTENNA = 1;
- const long TIMESTAMP_TYPE_MODEM = 2;
- const long TIMESTAMP_TYPE_OEM_RIL = 3;
- const long TIMESTAMP_TYPE_JAVA_RIL = 4;
-
- const long UNKNOWN_VALUE = 0x7FFFFFFF;
-
- /**
- * Network type. One of the CELL_INFO_TYPE_* constants.
- */
- readonly attribute long type;
-
- /*
- * Registration state of this cell.
- */
- readonly attribute boolean registered;
-
- /**
- * Time stamp type. One of the TIMESTAMP_TYPE_* constants.
- */
- readonly attribute long timestampType;
-
- /**
- * Time in nanoseconds since boot.
- */
- readonly attribute long long timestamp;
-};
-
-[scriptable, uuid(cc476ded-350f-4c25-9a57-6a876e32f092)]
-interface nsIGsmCellInfo : nsICellInfo
-{
- /**
- * 3-digit Mobile Country Code, 0..999, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long mcc;
-
- /**
- * 2 or 3-digit Mobile Network Code, 0..999, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long mnc;
-
- /**
- * 16-bit Location Area Code, 0..65535, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long lac;
-
- /**
- * 16-bit GSM Cell Identity described in TS 27.007, 0..65535,
- * UNKNOWN_VALUE if unknown.
- */
- readonly attribute long cid;
-
- /**
- * Valid values are 0-31 as defined in TS 27.007 8.5, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long signalStrength;
-
- /**
- * Bit error rate 0-7 as defined in TS 27.007 8.5, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long bitErrorRate;
-};
-
-[scriptable, uuid(aa52647b-38dd-487c-be36-b46ed2e99554)]
-interface nsIWcdmaCellInfo : nsICellInfo
-{
- /**
- * 2 or 3-digit Mobile Network Code, 0..999, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long mcc;
-
- /**
- * 2 or 3-digit Mobile Network Code, 0..999, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long mnc;
-
- /**
- * 16-bit Location Area Code, 0..65535, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long lac;
-
- /**
- * 28-bit UMTS Cell Identity described in TS 25.331, 0..268435455,
- * UNKNOWN_VALUE if unknown.
- */
- readonly attribute long cid;
-
- /**
- * 9-bit UMTS Primary Scrambling Code described in TS 25.331, 0..511,
- * UNKNOWN_VALUE if unknown.
- */
- readonly attribute long psc;
-
- /**
- * Valid values are 0-31 as defined in TS 27.007 8.5, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long signalStrength;
-
- /**
- * Bit error rate 0-7 as defined in TS 27.007 8.5, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long bitErrorRate;
-};
-
-[scriptable, uuid(60a38ca7-ca62-4384-aa07-eac7d4893786)]
-interface nsICdmaCellInfo : nsICellInfo
-{
- /**
- * Network Id, 0..65535, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long networkId;
-
- /**
- * CDMA System Id, 0..32767, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long systemId;
-
- /**
- * Base Station Id, 0..65535, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long baseStationId;
-
- /**
- * Longitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
- * It is represented in units of 0.25 seconds and ranges from -2592000 to
- * 2592000, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long longitude;
-
- /**
- * Latitude is a decimal number as specified in 3GPP2 C.S0005-A v6.0.
- * It is represented in units of 0.25 seconds and ranges from -1296000 to
- * 1296000, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long latitude;
-
- /**
- * Valid values are positive integers, UNKNOWN_VALUE if unknown. This value is
- * the actual RSSI value multiplied by -1.
- */
- readonly attribute long cdmaDbm;
-
- /**
- * Valid values are positive integers, UNKNOWN_VALUE if unknown. This value is
- * the actual Ec/Io multiplied by -10.
- */
- readonly attribute long cdmaEcio;
-
- /**
- * Valid values are positive integers, UNKNOWN_VALUE if unknown. This value is
- * the actual Evdo RSSI value multiplied by -1.
- */
- readonly attribute long evdoDbm;
-
- /**
- * Valid values are positive integers, UNKNOWN_VALUE if unknown. This value is
- * the actual Evdo Ec/Io multiplied by -10.
- */
- readonly attribute long evdoEcio;
-
- /**
- * Valid values are 0-8, UNKNOWN_VALUE if unknown. 8 is the highest signal to
- * noise ratio.
- */
- readonly attribute long evdoSnr;
-};
-
-[scriptable, uuid(e7b3e826-bb85-49b2-a2f1-70af46c47733)]
-interface nsILteCellInfo : nsICellInfo
-{
- /**
- * 3-digit Mobile Country Code, 0..999, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long mcc;
-
- /**
- * 2 or 3-digit Mobile Network Code, 0..999, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long mnc;
-
- /**
- * 28-bit Cell Identity, 0..268435455, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long cid;
-
- /**
- * Physical cell id, 0..503, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long pcid;
-
- /**
- * 16-bit tracking area code, 0..65535, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long tac;
-
- /**
- * Valid values are 0-31 as defined in TS 27.007 8.5, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long signalStrength;
-
- /**
- * The current Reference Signal Receive Power in dBm multipled by -1.
- * Range: 44 to 140 dBm, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long rsrp;
-
- /**
- * The current Reference Signal Receive Quality in dB multiplied by -1.
- * Range: 3 to 20 dB, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long rsrq;
-
- /**
- * The current reference signal signal-to-noise ratio in 0.1 dB units.
- * Range: -200 to +300 (-200 = -20.0 dB, +300 = 30dB), UNKNOWN_VALUE if
- * unknown.
- */
- readonly attribute long rssnr;
-
- /**
- * The current Channel Quality Indicator. Range: 0 to 15, UNKNOWN_VALUE if
- * unknown.
- */
- readonly attribute long cqi;
-
- /**
- * Timing advance in micro seconds for a one way trip from cell to device.
- * Approximate distance can be calculated using 300m/us * timingAdvance.
- * Range: 0 to 0x7FFFFFFE, UNKNOWN_VALUE if unknown.
- */
- readonly attribute long timingAdvance;
-};
\ No newline at end of file
deleted file mode 100644
--- a/dom/mobileconnection/interfaces/nsIMobileCallForwardingOptions.idl
+++ /dev/null
@@ -1,51 +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 "nsISupports.idl"
-
-[scriptable, uuid(c616ecb6-65f5-441e-b97e-c642ddef6888)]
-interface nsIMobileCallForwardingOptions : nsISupports
-{
- /**
- * Call forwarding rule status.
- *
- * It will be either not active (false), or active (true).
- *
- * Note: Unused for setting call forwarding options. It reports
- * the status of the rule when getting how the rule is
- * configured.
- *
- * @see 3GPP TS 27.007 7.11 "status".
- */
- readonly attribute bool active;
-
- /**
- * Indicates what to do with the rule. It shall be one of the
- * nsIMobileConnection.CALL_FORWARD_ACTION_* values.
- */
- readonly attribute short action;
-
- /**
- * Indicates the reason the call is being forwarded. It shall be one of the
- * nsIMobileConnection.CALL_FORWARD_REASON_* values.
- */
- readonly attribute short reason;
-
- /**
- * Phone number of forwarding address.
- */
- readonly attribute DOMString number;
-
- /**
- * When "no reply" is enabled or queried, this gives the time in
- * seconds to wait before call is forwarded.
- */
- readonly attribute short timeSeconds;
-
- /**
- * Service for which the call forward is set up. It should be one of the
- * nsIMobileConnection.ICC_SERVICE_CLASS_* values.
- */
- readonly attribute short serviceClass;
-};
deleted file mode 100644
--- a/dom/mobileconnection/interfaces/nsIMobileCellInfo.idl
+++ /dev/null
@@ -1,69 +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 "nsISupports.idl"
-
-[scriptable, uuid(286a96fe-5519-459b-9ef8-2e34b9c1f9f2)]
-interface nsIMobileCellInfo: nsISupports
-{
- /**
- * Mobile Location Area Code (LAC) for GSM/WCDMA networks.
- *
- * Possible ranges from 0x0000 to 0xffff.
- * -1 if the LAC is unknown.
- */
- readonly attribute long gsmLocationAreaCode;
-
- /**
- * Mobile Cell ID for GSM/WCDMA networks.
- *
- * Possible ranges from 0x00000000 to 0xffffffff.
- * -1 if the cell id is unknown.
- */
- readonly attribute long long gsmCellId;
-
- /**
- * Base Station ID for CDMA networks.
- *
- * Possible ranges from 0 to 65535.
- * -1 if the base station id is unknown.
- */
- readonly attribute long cdmaBaseStationId;
-
- /**
- * Base Station Latitude for CDMA networks.
- *
- * Possible ranges from -1296000 to 1296000.
- * -2147483648 if the latitude is unknown.
- *
- * @see 3GPP2 C.S0005-A v6.0.
- */
- readonly attribute long cdmaBaseStationLatitude;
-
- /**
- * Base Station Longitude for CDMA networks.
- *
- * Possible ranges from -2592000 to 2592000.
- * -2147483648 if the longitude is unknown.
- *
- * @see 3GPP2 C.S0005-A v6.0.
- */
- readonly attribute long cdmaBaseStationLongitude;
-
- /**
- * System ID for CDMA networks.
- *
- * Possible ranges from 0 to 32767.
- * -1 if the system id is unknown.
- */
- readonly attribute long cdmaSystemId;
-
- /**
- * Network ID for CDMA networks.
- *
- * Possible ranges from 0 to 65535.
- * -1 if the network id is unknown.
- */
- readonly attribute long cdmaNetworkId;
-};
deleted file mode 100644
--- a/dom/mobileconnection/interfaces/nsIMobileConnectionInfo.idl
+++ /dev/null
@@ -1,73 +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 "nsISupports.idl"
-
-interface nsIMobileCellInfo;
-interface nsIMobileNetworkInfo;
-
-[scriptable, uuid(d5208e13-42dc-4dce-9427-2572fa252751)]
-interface nsIMobileConnectionInfo : nsISupports
-{
- /**
- * State of the connection.
- *
- * Possible values: 'notSearching', 'searching', 'denied', 'registered' or
- * null (unknown).
- */
- readonly attribute DOMString state;
-
- /**
- * Indicates whether the connection is ready.
- *
- * Note: The meaning of "connection ready" for data and voice are different.
- * - Data: the "default" data connection is established or not.
- * - Voice: voice is registered to network or not.
- */
- readonly attribute bool connected;
-
- /**
- * Indicates whether only emergency calls are possible.
- *
- * This flag is only relevant to voice connections and when 'connected' is
- * false.
- */
- readonly attribute bool emergencyCallsOnly;
-
- /**
- * Indicates whether the connection is going through a foreign operator
- * (roaming) or not.
- */
- readonly attribute bool roaming;
-
- /**
- * Network operator information.
- */
- readonly attribute nsIMobileNetworkInfo network;
-
- /**
- * Type of connection.
- *
- * Possible values: 'gsm', 'gprs', 'edge', 'umts', 'hsdpa', 'hsupa', 'hspa',
- * 'hspa+', 'is95a', 'is95b', '1xrtt', 'evdo0', 'evdoa',
- * 'evdob', 'ehrpd', 'lte' or null (unknown).
- */
- readonly attribute DOMString type;
-
- /**
- * Signal strength in dBm, or null if no service is available.
- */
- readonly attribute jsval signalStrength;
-
- /**
- * Signal strength, represented linearly as a number between 0 (weakest
- * signal) and 100 (full signal).
- */
- readonly attribute jsval relSignalStrength;
-
- /**
- * Cell location information.
- */
- readonly attribute nsIMobileCellInfo cell;
-};
deleted file mode 100644
--- a/dom/mobileconnection/interfaces/nsIMobileConnectionService.idl
+++ /dev/null
@@ -1,738 +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 "nsISupports.idl"
-
-interface nsICellInfoListCallback;
-interface nsIMobileCallForwardingOptions;
-interface nsIMobileConnection;
-interface nsIMobileConnectionInfo;
-interface nsIMobileDeviceIdentities;
-interface nsIMobileNetworkInfo;
-interface nsINeighboringCellIdsCallback;
-interface nsIVariant;
-
-[scriptable, uuid(8884b326-891c-11e5-a434-67def07c4a41)]
-interface nsIMobileConnectionListener : nsISupports
-{
- /**
- * Notify when voice info is changed.
- */
- void notifyVoiceChanged();
-
- /**
- * Notify when data info is changed.
- */
- void notifyDataChanged();
-
- /**
- * Notify when data call is failed to establish.
- *
- * @param message
- * Error message from RIL.
- */
- void notifyDataError(in DOMString message);
-
- /**
- * Notify when call forwarding state is changed.
- *
- * @param action
- * One of the nsIMobileConnection.CALL_FORWARD_ACTION_* values.
- * @param reason
- * One of the nsIMobileConnection.CALL_FORWARD_REASON_* values.
- * @param number
- * Phone number of forwarding address.
- * @param timeSeconds
- * The time in seconds should wait before call is forwarded.
- * @param serviceClass
- * One of the nsIMobileConnection.ICC_SERVICE_CLASS_* values.
- */
- void notifyCFStateChanged(in unsigned short action,
- in unsigned short reason,
- in DOMString number,
- in unsigned short timeSeconds,
- in unsigned short serviceClass);
-
- /**
- * Notify when emergency callback mode is changed.
- *
- * @param active
- * Indicates whether the emergency callback mode is activated.
- * @param timeoutMs
- * The timeout in millisecond for emergency callback mode.
- */
- void notifyEmergencyCbModeChanged(in boolean active,
- in unsigned long timeoutMs);
-
- /**
- * Notify when ota status is changed.
- *
- * @param status
- * Ota status. Possible values: 'spl_unlocked', 'spc_retries_exceeded',
- * 'a_key_exchanged', 'ssd_updated', 'nam_downloaded', 'mdn_downloaded',
- * 'imsi_downloaded', 'prl_downloaded', 'committed', 'otapa_started',
- * 'otapa_stopped', 'otapa_aborted'.
- */
- void notifyOtaStatusChanged(in DOMString status);
-
- /**
- * Notify when radio state is changed.
- */
- void notifyRadioStateChanged();
-
- /**
- * Notify when clir mode is changed.
- *
- * @param mode
- * One of the nsIMobileConnection.CLIR_* values.
- */
- void notifyClirModeChanged(in unsigned long mode);
-
- /**
- * Notify when last known network is changed.
- */
- void notifyLastKnownNetworkChanged();
-
- /**
- * Notify when last known home network is changed.
- */
- void notifyLastKnownHomeNetworkChanged();
-
- /**
- * Notify when network selection mode is changed.
- */
- void notifyNetworkSelectionModeChanged();
-
- /**
- * Notify when device identities are changed.
- */
- void notifyDeviceIdentitiesChanged();
-};
-
-%{C++
-#define NO_ADDITIONAL_INFORMATION 0
-%}
-
-[scriptable, uuid(ef5e02a6-adff-4425-8634-ec49ced1f14f)]
-interface nsIMobileConnectionCallback : nsISupports
-{
- /**
- * notify*Success*() will be called, when request is succeed.
- */
- void notifySuccess();
-
- void notifySuccessWithBoolean(in boolean result);
-
- void notifyGetNetworksSuccess(in uint32_t count,
- [array, size_is(count)] in nsIMobileNetworkInfo networks);
-
- void notifyGetCallForwardingSuccess(in uint32_t count,
- [array, size_is(count)] in nsIMobileCallForwardingOptions results);
-
- void notifyGetCallBarringSuccess(in unsigned short program,
- in boolean enabled,
- in unsigned short serviceClass);
-
- void notifyGetCallWaitingSuccess(in unsigned short serviceClass);
-
- void notifyGetClirStatusSuccess(in unsigned short n, in unsigned short m);
-
- void notifyGetPreferredNetworkTypeSuccess(in long type);
-
- void notifyGetRoamingPreferenceSuccess(in long mode);
-
- /**
- * notifyError() will be called, when request is failed.
- */
- void notifyError(in DOMString name);
-};
-
-%{C++
-#define NS_MOBILE_CONNECTION_SERVICE_CID \
- { 0xc6f229d4, 0x16e2, 0x4600, \
- { 0x87, 0x2a, 0x3d, 0x3d, 0xc5, 0xb8, 0x55, 0x41 } }
-#define NS_MOBILE_CONNECTION_SERVICE_CONTRACTID \
- "@mozilla.org/mobileconnection/mobileconnectionservice;1"
-%}
-
-[scriptable, uuid(eaba3c4a-0dd5-4919-b1a2-7812e49dbbcb)]
-interface nsIMobileConnectionService : nsISupports
-{
- readonly attribute unsigned long numItems;
-
- nsIMobileConnection getItemByServiceId(in unsigned long serviceId);
-};
-
-%{C++
-template<typename T> struct already_AddRefed;
-
-already_AddRefed<nsIMobileConnectionService>
-NS_CreateMobileConnectionService();
-%}
-
-[scriptable, uuid(7a557116-8753-11e5-9f9b-6794b577c0a1)]
-interface nsIMobileConnection : nsISupports
-{
- /*
- * ICC service class.
- */
- const long ICC_SERVICE_CLASS_NONE = 0; // not available
- const long ICC_SERVICE_CLASS_VOICE = (1 << 0);
- const long ICC_SERVICE_CLASS_DATA = (1 << 1);
- const long ICC_SERVICE_CLASS_FAX = (1 << 2);
- const long ICC_SERVICE_CLASS_SMS = (1 << 3);
- const long ICC_SERVICE_CLASS_DATA_SYNC = (1 << 4);
- const long ICC_SERVICE_CLASS_DATA_ASYNC = (1 << 5);
- const long ICC_SERVICE_CLASS_PACKET = (1 << 6);
- const long ICC_SERVICE_CLASS_PAD = (1 << 7);
- const long ICC_SERVICE_CLASS_MAX = (1 << 7);
-
- /**
- * Call forwarding action.
- *
- * @see 3GPP TS 27.007 7.11 "mode".
- */
- const long CALL_FORWARD_ACTION_UNKNOWN = -1; // not available
- const long CALL_FORWARD_ACTION_DISABLE = 0;
- const long CALL_FORWARD_ACTION_ENABLE = 1;
- const long CALL_FORWARD_ACTION_QUERY_STATUS = 2;
- const long CALL_FORWARD_ACTION_REGISTRATION = 3;
- const long CALL_FORWARD_ACTION_ERASURE = 4;
-
- /**
- * Call forwarding reason.
- *
- * @see 3GPP TS 27.007 7.11 "reason".
- */
- const long CALL_FORWARD_REASON_UNKNOWN = -1; // not available
- const long CALL_FORWARD_REASON_UNCONDITIONAL = 0;
- const long CALL_FORWARD_REASON_MOBILE_BUSY = 1;
- const long CALL_FORWARD_REASON_NO_REPLY = 2;
- const long CALL_FORWARD_REASON_NOT_REACHABLE = 3;
- const long CALL_FORWARD_REASON_ALL_CALL_FORWARDING = 4;
- const long CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING = 5;
-
- /**
- * Call barring program.
- */
- const long CALL_BARRING_PROGRAM_UNKNOWN = -1; // not available
- const long CALL_BARRING_PROGRAM_ALL_OUTGOING = 0;
- const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL = 1;
- const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME = 2;
- const long CALL_BARRING_PROGRAM_ALL_INCOMING = 3;
- const long CALL_BARRING_PROGRAM_INCOMING_ROAMING = 4;
- const long CALL_BARRING_PROGRAM_ALL_SERVICE = 5;
- const long CALL_BARRING_PROGRAM_OUTGOING_SERVICE = 6;
- const long CALL_BARRING_PROGRAM_INCOMING_SERVICE = 7;
-
- /**
- * Calling line identification restriction constants.
- *
- * @see 3GPP TS 27.007 7.7 Defined values.
- */
- const long CLIR_DEFAULT = 0;
- const long CLIR_INVOCATION = 1;
- const long CLIR_SUPPRESSION = 2;
-
- /**
- * Network selection mode.
- */
- const long NETWORK_SELECTION_MODE_UNKNOWN = -1; // not available
- const long NETWORK_SELECTION_MODE_AUTOMATIC = 0;
- const long NETWORK_SELECTION_MODE_MANUAL = 1;
-
- /**
- * Mobile Radio State.
- */
- const long MOBILE_RADIO_STATE_UNKNOWN = -1;
- const long MOBILE_RADIO_STATE_ENABLING = 0;
- const long MOBILE_RADIO_STATE_ENABLED = 1;
- const long MOBILE_RADIO_STATE_DISABLING = 2;
- const long MOBILE_RADIO_STATE_DISABLED = 3;
-
- /**
- * Preferred network type.
- */
- const long PREFERRED_NETWORK_TYPE_WCDMA_GSM = 0;
- const long PREFERRED_NETWORK_TYPE_GSM_ONLY = 1;
- const long PREFERRED_NETWORK_TYPE_WCDMA_ONLY = 2;
- const long PREFERRED_NETWORK_TYPE_WCDMA_GSM_AUTO = 3;
- const long PREFERRED_NETWORK_TYPE_CDMA_EVDO = 4;
- const long PREFERRED_NETWORK_TYPE_CDMA_ONLY = 5;
- const long PREFERRED_NETWORK_TYPE_EVDO_ONLY = 6;
- const long PREFERRED_NETWORK_TYPE_WCDMA_GSM_CDMA_EVDO = 7;
- const long PREFERRED_NETWORK_TYPE_LTE_CDMA_EVDO = 8;
- const long PREFERRED_NETWORK_TYPE_LTE_WCDMA_GSM = 9;
- const long PREFERRED_NETWORK_TYPE_LTE_WCDMA_GSM_CDMA_EVDO = 10;
- const long PREFERRED_NETWORK_TYPE_LTE_ONLY = 11;
-
- /**
- * CDMA roaming preference.
- */
- const long CDMA_ROAMING_PREFERENCE_HOME = 0;
- const long CDMA_ROAMING_PREFERENCE_AFFILIATED = 1;
- const long CDMA_ROAMING_PREFERENCE_ANY = 2;
-
- /**
- * Supported network type.
- */
- const long MOBILE_NETWORK_TYPE_GSM = 0;
- const long MOBILE_NETWORK_TYPE_WCDMA = 1;
- const long MOBILE_NETWORK_TYPE_CDMA = 2;
- const long MOBILE_NETWORK_TYPE_EVDO = 3;
- const long MOBILE_NETWORK_TYPE_LTE = 4;
-
- readonly attribute unsigned long serviceId;
-
- /**
- * Called when any one who is interested in receiving unsolicited messages
- * from this nsIMobileConnection instance.
- */
- void registerListener(in nsIMobileConnectionListener listener);
- void unregisterListener(in nsIMobileConnectionListener listener);
-
- /**
- * String of format '<mcc>-<mnc>'. When changed, listener method
- * 'notifyLastKnownNetworkChanged' is called.
- */
- readonly attribute DOMString lastKnownNetwork;
-
- /**
- * String of format '<mcc>-<mnc>[-<spn>]'. When changed, listener method
- * 'notifyLastKnownHomeNetworkChanged' is called.
- */
- readonly attribute DOMString lastKnownHomeNetwork;
-
- /**
- * Connection information about the voice.
- */
- readonly attribute nsIMobileConnectionInfo voice;
-
- /**
- * Connection information about the data.
- */
- readonly attribute nsIMobileConnectionInfo data;
-
- /**
- * The selection mode of the voice and data networks. One of the
- * nsIMobileConnection.NETWORK_SELECTION_MODE_* values.
- */
- readonly attribute long networkSelectionMode;
-
- /**
- * Current radio state. One of the nsIMobileConnection.MOBILE_RADIO_STATE_*
- * values.
- */
- readonly attribute long radioState;
-
- /**
- * Device Identities, including IMEI, IMEISV, ESN and MEID.
- */
- readonly attribute nsIMobileDeviceIdentities deviceIdentities;
-
- /**
- * The network types supported by this radio.
- *
- * @return an array of nsIMobileConnection.MOBILE_NETWORK_TYPE_* values.
- */
- void getSupportedNetworkTypes([array, size_is(length)] out long types,
- [retval] out unsigned long length);
-
- /**
- * Search for available networks.
- *
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifyGetNetworksSuccess() will be called. And the
- * result will be an array of nsIMobileNetworkInfo.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'IllegalSIMorME', or
- * 'GenericFailure'.
- */
- void getNetworks(in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Manually selects the passed in network, overriding the radio's current
- * selection.
- *
- * @param network
- * The manually selecting network.
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifySuccess() will be called.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'IllegalSIMorME', or
- * 'GenericFailure'.
- */
- void selectNetwork(in nsIMobileNetworkInfo network,
- in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Tell the radio to automatically select a network.
- *
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifySuccess() will be called.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'IllegalSIMorME', or
- * 'GenericFailure'.
- */
- void selectNetworkAutomatically(in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Set preferred network type.
- *
- * @param type
- * One of the nsIMobileConnection.PREFERRED_NETWORK_TYPE_* values.
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifySuccess() will be called.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- void setPreferredNetworkType(in long type,
- in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Query current preferred network type.
- *
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifyGetPreferredNetworkTypeSuccess() will be called,
- * and the result 'type' will be one of the
- * nsIMobileConnection.PREFERRED_NETWORK_TYPE_* values, indicating the current
- * preferred network type.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'IllegalSIMorME', or
- * 'GenericFailure'.
- */
- void getPreferredNetworkType(in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Set roaming preference.
- *
- * @param mode
- * One of the nsIMobileConnection.CDMA_ROAMING_PREFERENCE_* values.
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifySuccess() will be called.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', InvalidParameter',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- void setRoamingPreference(in long mode,
- in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Query current roaming preference.
- *
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifyGetRoamingPreferenceSuccess() will be called, and
- * the result 'mode' will be one of the
- * nsIMobileConnection.CDMA_ROAMING_PREFERENCE_* values, indicating the
- * current roaming preference.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'IllegalSIMorME', or
- * 'GenericFailure'.
- */
- void getRoamingPreference(in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Set voice privacy preference.
- *
- * @param enabled
- * Boolean indicates the preferred voice privacy mode used in voice
- * scrambling in CDMA networks. 'True' means the enhanced voice security
- * is required.
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifySuccess() will be called.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'IllegalSIMorME', or
- * 'GenericFailure'.
- */
- void setVoicePrivacyMode(in bool enabled,
- in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Query current voice privacy mode.
- *
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifySuccessWithBoolean() will be called. And the result
- * will be a boolean indicating the current voice privacy mode.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'IllegalSIMorME', or
- * 'GenericFailure'.
- */
- void getVoicePrivacyMode(in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Queries current call forwarding options.
- *
- * @param reason
- * Indicates the reason the call is being forwarded. It shall be one of
- * the nsIMobileConnectionService.CALL_FORWARD_REASON_* values.
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifyGetCallForwardingSuccess() will be called. And the
- * result will be an array of nsIMobileCallForwardingOptions.
- * @see nsIMobileCallForwardingOptions for the detail of result.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- void getCallForwarding(in unsigned short reason,
- in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Configures call forwarding options.
- *
- * @param action
- * One of the nsIMobileConnection.CALL_FORWARD_ACTION_* values.
- * @param reason
- * One of the nsIMobileConnection.CALL_FORWARD_REASON_* values.
- * @param number
- * Phone number of forwarding address.
- * @param timeSeconds
- * When "no reply" is enabled or queried, this gives the time in
- * seconds to wait before call is forwarded.
- * @param serviceClass
- * One of the nsIMobileConnection.ICC_SERVICE_CLASS_* values.
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifySuccess() will be called.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- void setCallForwarding(in unsigned short action,
- in unsigned short reason,
- in DOMString number,
- in unsigned short timeSeconds,
- in unsigned short serviceClass,
- in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Queries current call barring status.
- *
- * @param program
- * One of the nsIMobileConnection.CALL_BARRING_PROGRAM_* values.
- * @param password
- * Call barring password. Use "" if no password specified.
- * @param serviceClass
- * One of the nsIMobileConnection.ICC_SERVICE_CLASS_* values.
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifyGetCallBarringSuccess() will be called. And the
- * result will contain correct 'enabled' property indicating the status of
- * this rule.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- void getCallBarring(in unsigned short program,
- in DOMString password,
- in unsigned short serviceClass,
- in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Configures call barring option.
- *
- * @param program
- * One of the nsIMobileConnection.CALL_BARRING_PROGRAM_* values.
- * @param enabled
- * Enable or disable the call barring program.
- * @param password
- * Call barring password. Use "" if no password specified.
- * @param serviceClass
- * One of the nsIMobileConnection.ICC_SERVICE_CLASS_* values.
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifySuccess() will be called.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- void setCallBarring(in unsigned short program,
- in bool enabled,
- in DOMString password,
- in unsigned short serviceClass,
- in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Change call barring facility password.
- *
- * @param pin
- * Old call barring password.
- * @param newPin
- * New call barring password.
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifySuccess() will be called.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- void changeCallBarringPassword(in DOMString pin,
- in DOMString newPin,
- in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Configures call waiting options.
- *
- * @param enabled
- * Boolean indicates the desired call waiting status.
- * @param serviceClass
- * One of the nsIMobileConnection.ICC_SERVICE_CLASS_* values.
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifySuccess() will be called.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'IllegalSIMorME', or
- * 'GenericFailure'.
- */
- void setCallWaiting(in bool enabled,
- in unsigned short serviceClass,
- in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Queries current call waiting options.
- *
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifyGetCallWaitingSuccess() will be called. And the
- * result will be a service class bit vector of services for which call
- * waiting is enabled. e.g. 3 means call waiting is enabled for data
- * and voice and disabled for everything else. 0 means call waiting is
- * disabled for all service.
- * @see nsIMobileConnection.ICC_SERVICE_CLASS_*.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'IllegalSIMorME', or
- * 'GenericFailure'.
- */
- void getCallWaiting(in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Enables or disables the presentation of the calling line identity (CLI) to
- * the called party when originating a call.
- *
- * @param clirMode
- * One of the nsIMobileConnection.CLIR_* values.
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifySuccess() will be called.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- void setCallingLineIdRestriction(in unsigned short clirMode,
- in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Queries current CLIR status.
- *
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifyGetClirStatusSuccess() will be called. And the
- * result will be a an object containing CLIR 'n' and 'm' parameter.
- * @see MozClirStatus for the detail of result.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'IllegalSIMorME', or
- * 'GenericFailure'.
- */
- void getCallingLineIdRestriction(in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Exit emergency callback mode.
- *
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifySuccess() will be called.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'RadioNotAvailable', 'RequestNotSupported', 'IllegalSIMorME', or
- * 'GenericFailure'.
- */
- void exitEmergencyCbMode(in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Set radio enabled/disabled.
- *
- * @param enabled
- * Boolean indicates the desired radio power. True to enable the radio.
- * @param requestCallback
- * Called when request is finished.
- *
- * If successful, the notifySuccess() will be called.
- *
- * Otherwise, the notifyError() will be called, and the error will be either
- * 'InvalidStateError', 'RadioNotAvailable', 'IllegalSIMorME', or
- * 'GenericFailure'.
- *
- * Note: Request is not available when radioState is null, 'enabling', or
- * 'disabling'. Calling the function in above conditions will receive
- * 'InvalidStateError' error.
- */
- void setRadioEnabled(in bool enabled,
- in nsIMobileConnectionCallback requestCallback);
-
- /**
- * Request neighboring cell ids in GSM/UMTS network.
- *
- * @param callback
- * Called when request is finished. See nsINeighboringCellIdsCallback
- * for details.
- */
- void getNeighboringCellIds(in nsINeighboringCellIdsCallback callback);
-
- /**
- * Request all of the current cell information known to the radio, including
- * neighboring cells.
- *
- * @param callback
- * Called when request is finished. See nsICellInfoListCallback
- * for details.
- */
- void getCellInfoList(in nsICellInfoListCallback callback);
-};
deleted file mode 100644
--- a/dom/mobileconnection/interfaces/nsIMobileDeviceIdentities.idl
+++ /dev/null
@@ -1,46 +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 "nsISupports.idl"
-
-[scriptable, uuid(3fc79ece-8399-11e5-beff-6b8209cb93f6)]
-interface nsIMobileDeviceIdentities : nsISupports
-{
- /**
- * Device IMEI, including check digit.
- *
- * Valid if GSM subscription is available.
- *
- * Note: The value might be dummy like "000..." from modem if invalid.
- */
- readonly attribute DOMString imei;
-
- /**
- * Device IMEISV.
- *
- * Valid if GSM subscription is available.
- *
- * Note: IMEISV is presented in 2-decimal digits.
- * The value might be dummy like "00" from modem if invalid.
- */
- readonly attribute DOMString imeisv;
-
- /**
- * Device ESN.
- *
- * Valid if CDMA subscription is available.
- *
- * Note: The value might be dummy like "000..." from modem if invalid.
- */
- readonly attribute DOMString esn;
-
- /**
- * Device MEID.
- *
- * Valid if CDMA subscription is available.
- *
- * Note: The value might be dummy like "000..." from modem if invalid.
- */
- readonly attribute DOMString meid;
-};
deleted file mode 100644
--- a/dom/mobileconnection/interfaces/nsIMobileNetworkInfo.idl
+++ /dev/null
@@ -1,36 +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 "nsISupports.idl"
-
-[scriptable, uuid(d7e1364c-61a0-4cf1-bae3-a960e87064e1)]
-interface nsIMobileNetworkInfo: nsISupports
-{
- /**
- * Short name of the network operator.
- */
- readonly attribute DOMString shortName;
-
- /**
- * Long name of the network operator.
- */
- readonly attribute DOMString longName;
-
- /**
- * Mobile Country Code (MCC) of the network operator.
- */
- readonly attribute DOMString mcc;
-
- /**
- * Mobile Network Code (MNC) of the network operator.
- */
- readonly attribute DOMString mnc;
-
- /**
- * State of this network operator.
- *
- * Possible values: 'available', 'connected', 'forbidden', or null (unknown).
- */
- readonly attribute DOMString state;
-};
deleted file mode 100644
--- a/dom/mobileconnection/interfaces/nsINeighboringCellInfo.idl
+++ /dev/null
@@ -1,67 +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 "nsISupports.idl"
-
-interface nsINeighboringCellInfo;
-
-[scriptable, uuid(0941cb79-36e5-41e0-b05f-cdb854c53f03)]
-interface nsINeighboringCellIdsCallback : nsISupports
-{
- /**
- * result is an array of nsINeighboringCellInfo.
- */
- void notifyGetNeighboringCellIds(in uint32_t count,
- [array, size_is(count)] in nsINeighboringCellInfo result);
-
- /**
- * Callback function with error message.
- */
- void notifyGetNeighboringCellIdsFailed(in DOMString error);
-};
-
-[scriptable, uuid(87dc222e-abb3-4342-95bf-626aa19fa20e)]
-interface nsINeighboringCellInfo: nsISupports
-{
- /**
- * Type of radio technology.
- *
- * Possible values: 'gsm', 'gprs', 'edge', 'umts', 'hsdpa', 'hsupa', 'hspa',
- * 'hspa+' or null (unknown).
- */
- readonly attribute DOMString networkType;
-
- /**
- * Mobile Location Area Code (LAC) for GSM networks.
- *
- * Possible ranges from 0x0000 to 0xffff.
- * nsICellInfo.UNKNOWN_VALUE if the LAC is unknown.
- */
- readonly attribute long gsmLocationAreaCode;
-
- /**
- * Mobile Cell ID for GSM networks.
- *
- * Possible ranges from 0x0000 to 0xffff.
- * nsICellInfo.UNKNOWN_VALUE if the cell id is unknown.
- */
- readonly attribute long long gsmCellId;
-
- /**
- * Primary Scrambling Code (PSC) for WCDMA networks.
- *
- * Possible ranges from 0x0000 to 0x01ff.
- * nsICellInfo.UNKNOWN_VALUE if the psc is unknown.
- */
- readonly attribute long wcdmaPsc;
-
- /**
- * For GSM networks, signalStrength is the received rssi, ranging from 0 to 31.
- * For WCDMA networks, signalStrength is the CPICH Received Signal Code Power,
- * ranging from -120 to -25.
- *
- * nsICellInfo.UNKNOWN_VALUE if signalStrength is unknown.
- */
- readonly attribute long signalStrength;
-};
\ No newline at end of file
deleted file mode 100644
--- a/dom/mobileconnection/ipc/MobileConnectionChild.cpp
+++ /dev/null
@@ -1,624 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/mobileconnection/MobileConnectionChild.h"
-
-#include "MobileConnectionCallback.h"
-#include "mozilla/dom/MozMobileConnectionBinding.h"
-#include "nsComponentManagerUtils.h"
-
-using namespace mozilla::dom;
-using namespace mozilla::dom::mobileconnection;
-
-NS_IMPL_ISUPPORTS(MobileConnectionChild, nsIMobileConnection)
-
-MobileConnectionChild::MobileConnectionChild(uint32_t aServiceId)
- : mServiceId(aServiceId)
- , mLive(true)
- , mRadioState(0)
- , mNetworkSelectionMode(0)
-{
- MOZ_COUNT_CTOR(MobileConnectionChild);
-}
-
-void
-MobileConnectionChild::Init()
-{
- nsIMobileConnectionInfo* rawVoice;
- nsIMobileConnectionInfo* rawData;
-
- SendInit(&rawVoice, &rawData, &mLastNetwork, &mLastHomeNetwork,
- &mNetworkSelectionMode, &mRadioState, &mSupportedNetworkTypes);
-
- // Use dont_AddRef here because this instances is already AddRef-ed in
- // MobileConnectionIPCSerializer.h
- nsCOMPtr<nsIMobileConnectionInfo> voice = dont_AddRef(rawVoice);
- mVoice = new MobileConnectionInfo(nullptr);
- mVoice->Update(voice);
-
- // Use dont_AddRef here because this instances is already AddRef-ed in
- // MobileConnectionIPCSerializer.h
- nsCOMPtr<nsIMobileConnectionInfo> data = dont_AddRef(rawData);
- mData = new MobileConnectionInfo(nullptr);
- mData->Update(data);
-}
-
-void
-MobileConnectionChild::Shutdown()
-{
- if (mLive) {
- mLive = false;
- Send__delete__(this);
- }
-
- mListeners.Clear();
- mVoice = nullptr;
- mData = nullptr;
-}
-
-// nsIMobileConnection
-
-NS_IMETHODIMP
-MobileConnectionChild::GetServiceId(uint32_t* aServiceId)
-{
- *aServiceId = mServiceId;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::RegisterListener(nsIMobileConnectionListener* aListener)
-{
- NS_ENSURE_TRUE(!mListeners.Contains(aListener), NS_ERROR_UNEXPECTED);
-
- mListeners.AppendObject(aListener);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::UnregisterListener(nsIMobileConnectionListener* aListener)
-{
- NS_ENSURE_TRUE(mListeners.Contains(aListener), NS_ERROR_UNEXPECTED);
-
- mListeners.RemoveObject(aListener);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetVoice(nsIMobileConnectionInfo** aVoice)
-{
- RefPtr<nsIMobileConnectionInfo> voice(mVoice);
- voice.forget(aVoice);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetData(nsIMobileConnectionInfo** aData)
-{
- RefPtr<nsIMobileConnectionInfo> data(mData);
- data.forget(aData);
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetRadioState(int32_t* aRadioState)
-{
- *aRadioState = mRadioState;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetDeviceIdentities(nsIMobileDeviceIdentities** aIdentities)
-{
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetSupportedNetworkTypes(int32_t** aTypes,
- uint32_t* aLength)
-{
- NS_ENSURE_ARG(aTypes);
- NS_ENSURE_ARG(aLength);
-
- *aLength = mSupportedNetworkTypes.Length();
- *aTypes =
- static_cast<int32_t*>(moz_xmalloc((*aLength) * sizeof(int32_t)));
- NS_ENSURE_TRUE(*aTypes, NS_ERROR_OUT_OF_MEMORY);
-
- for (uint32_t i = 0; i < *aLength; i++) {
- (*aTypes)[i] = mSupportedNetworkTypes[i];
- }
-
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetLastKnownNetwork(nsAString& aNetwork)
-{
- aNetwork = mLastNetwork;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetLastKnownHomeNetwork(nsAString& aNetwork)
-{
- aNetwork = mLastHomeNetwork;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetNetworkSelectionMode(int32_t* aMode)
-{
- *aMode = mNetworkSelectionMode;
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetNetworks(nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(GetNetworksRequest(), aCallback) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::SelectNetwork(nsIMobileNetworkInfo* aNetwork,
- nsIMobileConnectionCallback* aCallback)
-{
- nsCOMPtr<nsIMobileNetworkInfo> network = aNetwork;
- // We release the ref after serializing process is finished in
- // MobileConnectionIPCSerializer.
- return SendRequest(SelectNetworkRequest(network.forget().take()), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::SelectNetworkAutomatically(nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(SelectNetworkAutoRequest(), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-
-NS_IMETHODIMP
-MobileConnectionChild::SetPreferredNetworkType(int32_t aType,
- nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(SetPreferredNetworkTypeRequest(aType), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetPreferredNetworkType(nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(GetPreferredNetworkTypeRequest(), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::SetRoamingPreference(int32_t aMode,
- nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(SetRoamingPreferenceRequest(aMode), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetRoamingPreference(nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(GetRoamingPreferenceRequest(), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::SetVoicePrivacyMode(bool aEnabled,
- nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(SetVoicePrivacyModeRequest(aEnabled), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetVoicePrivacyMode(nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(GetVoicePrivacyModeRequest(), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::SetCallForwarding(uint16_t aAction, uint16_t aReason,
- const nsAString& aNumber,
- uint16_t aTimeSeconds, uint16_t aServiceClass,
- nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(SetCallForwardingRequest(aAction, aReason,
- nsString(aNumber),
- aTimeSeconds, aServiceClass),
- aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetCallForwarding(uint16_t aReason,
- nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(GetCallForwardingRequest(aReason), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::SetCallBarring(uint16_t aProgram, bool aEnabled,
- const nsAString& aPassword,
- uint16_t aServiceClass,
- nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(SetCallBarringRequest(aProgram, aEnabled,
- nsString(aPassword),
- aServiceClass),
- aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetCallBarring(uint16_t aProgram,
- const nsAString& aPassword,
- uint16_t aServiceClass,
- nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(GetCallBarringRequest(aProgram, nsString(aPassword),
- aServiceClass),
- aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::ChangeCallBarringPassword(const nsAString& aPin,
- const nsAString& aNewPin,
- nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(ChangeCallBarringPasswordRequest(nsString(aPin),
- nsString(aNewPin)),
- aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::SetCallWaiting(bool aEnabled,
- uint16_t aServiceClass,
- nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(SetCallWaitingRequest(aEnabled, aServiceClass), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetCallWaiting(nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(GetCallWaitingRequest(), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::SetCallingLineIdRestriction(uint16_t aMode,
- nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(SetCallingLineIdRestrictionRequest(aMode), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetCallingLineIdRestriction(nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(GetCallingLineIdRestrictionRequest(), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::ExitEmergencyCbMode(nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(ExitEmergencyCbModeRequest(), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::SetRadioEnabled(bool aEnabled,
- nsIMobileConnectionCallback* aCallback)
-{
- return SendRequest(SetRadioEnabledRequest(aEnabled), aCallback)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetNeighboringCellIds(nsINeighboringCellIdsCallback* aCallback)
-{
- // This function is supported in chrome context only.
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-NS_IMETHODIMP
-MobileConnectionChild::GetCellInfoList(nsICellInfoListCallback* aCallback)
-{
- // This function is supported in chrome context only.
- return NS_ERROR_NOT_IMPLEMENTED;
-}
-
-bool
-MobileConnectionChild::SendRequest(const MobileConnectionRequest& aRequest,
- nsIMobileConnectionCallback* aCallback)
-{
- NS_ENSURE_TRUE(mLive, false);
-
- // Deallocated in MobileConnectionChild::DeallocPMobileConnectionRequestChild().
- MobileConnectionRequestChild* actor =
- new MobileConnectionRequestChild(aCallback);
- SendPMobileConnectionRequestConstructor(actor, aRequest);
-
- return true;
-}
-
-void
-MobileConnectionChild::ActorDestroy(ActorDestroyReason why)
-{
- mLive = false;
-}
-
-PMobileConnectionRequestChild*
-MobileConnectionChild::AllocPMobileConnectionRequestChild(const MobileConnectionRequest& request)
-{
- MOZ_CRASH("Caller is supposed to manually construct a request!");
-}
-
-bool
-MobileConnectionChild::DeallocPMobileConnectionRequestChild(PMobileConnectionRequestChild* aActor)
-{
- delete aActor;
- return true;
-}
-
-bool
-MobileConnectionChild::RecvNotifyVoiceInfoChanged(nsIMobileConnectionInfo* const& aInfo)
-{
- // Use dont_AddRef here because this instances is already AddRef-ed in
- // MobileConnectionIPCSerializer.h
- nsCOMPtr<nsIMobileConnectionInfo> voice = dont_AddRef(aInfo);
- mVoice->Update(voice);
-
- for (int32_t i = 0; i < mListeners.Count(); i++) {
- mListeners[i]->NotifyVoiceChanged();
- }
-
- return true;
-}
-
-bool
-MobileConnectionChild::RecvNotifyDataInfoChanged(nsIMobileConnectionInfo* const& aInfo)
-{
- // Use dont_AddRef here because this instances is already AddRef-ed in
- // MobileConnectionIPCSerializer.h
- nsCOMPtr<nsIMobileConnectionInfo> data = dont_AddRef(aInfo);
- mData->Update(data);
-
- for (int32_t i = 0; i < mListeners.Count(); i++) {
- mListeners[i]->NotifyDataChanged();
- }
-
- return true;
-}
-
-bool
-MobileConnectionChild::RecvNotifyDataError(const nsString& aMessage)
-{
- for (int32_t i = 0; i < mListeners.Count(); i++) {
- mListeners[i]->NotifyDataError(aMessage);
- }
-
- return true;
-}
-
-bool
-MobileConnectionChild::RecvNotifyCFStateChanged(const uint16_t& aAction,
- const uint16_t& aReason,
- const nsString& aNumber,
- const uint16_t& aTimeSeconds,
- const uint16_t& aServiceClass)
-{
- for (int32_t i = 0; i < mListeners.Count(); i++) {
- mListeners[i]->NotifyCFStateChanged(aAction, aReason, aNumber, aTimeSeconds,
- aServiceClass);
- }
-
- return true;
-}
-
-bool
-MobileConnectionChild::RecvNotifyEmergencyCbModeChanged(const bool& aActive,
- const uint32_t& aTimeoutMs)
-{
- for (int32_t i = 0; i < mListeners.Count(); i++) {
- mListeners[i]->NotifyEmergencyCbModeChanged(aActive, aTimeoutMs);
- }
-
- return true;
-}
-
-bool
-MobileConnectionChild::RecvNotifyOtaStatusChanged(const nsString& aStatus)
-{
- for (int32_t i = 0; i < mListeners.Count(); i++) {
- mListeners[i]->NotifyOtaStatusChanged(aStatus);
- }
-
- return true;
-}
-
-bool
-MobileConnectionChild::RecvNotifyRadioStateChanged(const int32_t& aRadioState)
-{
- mRadioState = aRadioState;
-
- for (int32_t i = 0; i < mListeners.Count(); i++) {
- mListeners[i]->NotifyRadioStateChanged();
- }
-
- return true;
-}
-
-bool
-MobileConnectionChild::RecvNotifyClirModeChanged(const uint32_t& aMode)
-{
- for (int32_t i = 0; i < mListeners.Count(); i++) {
- mListeners[i]->NotifyClirModeChanged(aMode);
- }
-
- return true;
-}
-
-bool
-MobileConnectionChild::RecvNotifyLastNetworkChanged(const nsString& aNetwork)
-{
- mLastNetwork.Assign(aNetwork);
-
- return true;
-}
-
-bool
-MobileConnectionChild::RecvNotifyLastHomeNetworkChanged(const nsString& aNetwork)
-{
- mLastHomeNetwork.Assign(aNetwork);
-
- return true;
-}
-
-bool
-MobileConnectionChild::RecvNotifyNetworkSelectionModeChanged(const int32_t& aMode)
-{
- mNetworkSelectionMode = aMode;
-
- return true;
-}
-
-/******************************************************************************
- * MobileConnectionRequestChild
- ******************************************************************************/
-
-void
-MobileConnectionRequestChild::ActorDestroy(ActorDestroyReason why)
-{
- mRequestCallback = nullptr;
-}
-
-bool
-MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccess& aReply)
-{
- return NS_SUCCEEDED(mRequestCallback->NotifySuccess());
-}
-
-bool
-MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessBoolean& aReply)
-{
- return NS_SUCCEEDED(mRequestCallback->NotifySuccessWithBoolean(aReply.result()));
-}
-
-bool
-MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessNetworks& aReply)
-{
- uint32_t count = aReply.results().Length();
- nsTArray<nsCOMPtr<nsIMobileNetworkInfo>> results;
- for (uint32_t i = 0; i < count; i++) {
- // Use dont_AddRef here because these instances are already AddRef-ed in
- // MobileConnectionIPCSerializer.h
- nsCOMPtr<nsIMobileNetworkInfo> item = dont_AddRef(aReply.results()[i]);
- results.AppendElement(item);
- }
-
- return NS_SUCCEEDED(mRequestCallback->NotifyGetNetworksSuccess(count,
- const_cast<nsIMobileNetworkInfo**>(aReply.results().Elements())));
-}
-
-bool
-MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessCallForwarding& aReply)
-{
- uint32_t count = aReply.results().Length();
- nsTArray<nsCOMPtr<nsIMobileCallForwardingOptions>> results;
- for (uint32_t i = 0; i < count; i++) {
- // Use dont_AddRef here because these instances are already AddRef-ed in
- // MobileConnectionIPCSerializer.h
- nsCOMPtr<nsIMobileCallForwardingOptions> item = dont_AddRef(aReply.results()[i]);
- results.AppendElement(item);
- }
-
- return NS_SUCCEEDED(mRequestCallback->NotifyGetCallForwardingSuccess(
- count, const_cast<nsIMobileCallForwardingOptions**>(aReply.results().Elements())));
-}
-
-bool
-MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessCallBarring& aReply)
-{
- return NS_SUCCEEDED(mRequestCallback->NotifyGetCallBarringSuccess(aReply.program(),
- aReply.enabled(),
- aReply.serviceClass()));
-}
-
-bool
-MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessCallWaiting& aReply)
-{
- return NS_SUCCEEDED(mRequestCallback->NotifyGetCallWaitingSuccess(aReply.serviceClass()));
-}
-
-bool
-MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessClirStatus& aReply)
-{
- return NS_SUCCEEDED(mRequestCallback->NotifyGetClirStatusSuccess(aReply.n(),
- aReply.m()));
-}
-
-bool
-MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessPreferredNetworkType& aReply)
-{
- return NS_SUCCEEDED(mRequestCallback->NotifyGetPreferredNetworkTypeSuccess(aReply.type()));
-}
-
-bool
-MobileConnectionRequestChild::DoReply(const MobileConnectionReplySuccessRoamingPreference& aReply)
-{
- return NS_SUCCEEDED(mRequestCallback->NotifyGetRoamingPreferenceSuccess(aReply.mode()));
-}
-
-bool
-MobileConnectionRequestChild::DoReply(const MobileConnectionReplyError& aReply)
-{
- return NS_SUCCEEDED(mRequestCallback->NotifyError(aReply.message()));
-}
-
-bool
-MobileConnectionRequestChild::Recv__delete__(const MobileConnectionReply& aReply)
-{
- MOZ_ASSERT(mRequestCallback);
-
- switch (aReply.type()) {
- case MobileConnectionReply::TMobileConnectionReplySuccess:
- return DoReply(aReply.get_MobileConnectionReplySuccess());
- case MobileConnectionReply::TMobileConnectionReplySuccessBoolean:
- return DoReply(aReply.get_MobileConnectionReplySuccessBoolean());
- case MobileConnectionReply::TMobileConnectionReplySuccessNetworks:
- return DoReply(aReply.get_MobileConnectionReplySuccessNetworks());
- case MobileConnectionReply::TMobileConnectionReplySuccessCallForwarding:
- return DoReply(aReply.get_MobileConnectionReplySuccessCallForwarding());
- case MobileConnectionReply::TMobileConnectionReplySuccessCallBarring:
- return DoReply(aReply.get_MobileConnectionReplySuccessCallBarring());
- case MobileConnectionReply::TMobileConnectionReplySuccessCallWaiting:
- return DoReply(aReply.get_MobileConnectionReplySuccessCallWaiting());
- case MobileConnectionReply::TMobileConnectionReplySuccessClirStatus:
- return DoReply(aReply.get_MobileConnectionReplySuccessClirStatus());
- case MobileConnectionReply::TMobileConnectionReplySuccessPreferredNetworkType:
- return DoReply(aReply.get_MobileConnectionReplySuccessPreferredNetworkType());
- case MobileConnectionReply::TMobileConnectionReplySuccessRoamingPreference:
- return DoReply(aReply.get_MobileConnectionReplySuccessRoamingPreference());
- case MobileConnectionReply::TMobileConnectionReplyError:
- return DoReply(aReply.get_MobileConnectionReplyError());
- default:
- MOZ_CRASH("Received invalid response type!");
- }
-
- return false;
-}
deleted file mode 100644
--- a/dom/mobileconnection/ipc/MobileConnectionChild.h
+++ /dev/null
@@ -1,187 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_mobileconnection_MobileConnectionChild_h
-#define mozilla_dom_mobileconnection_MobileConnectionChild_h
-
-#include "mozilla/dom/MobileConnectionInfo.h"
-#include "mozilla/dom/mobileconnection/PMobileConnectionChild.h"
-#include "mozilla/dom/mobileconnection/PMobileConnectionRequestChild.h"
-#include "nsCOMArray.h"
-#include "nsCOMPtr.h"
-#include "nsIMobileConnectionService.h"
-#include "nsIVariant.h"
-
-class nsIMobileConnectionCallback;
-
-namespace mozilla {
-namespace dom {
-namespace mobileconnection {
-
-/**
- * Child actor of PMobileConnection. The object is created by
- * MobileConnectionIPCService and destroyed after MobileConnectionIPCService is
- * shutdown. For multi-sim device, more than one instance will
- * be created and each instance represents a sim slot.
- */
-class MobileConnectionChild final : public PMobileConnectionChild
- , public nsIMobileConnection
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIMOBILECONNECTION
-
- explicit MobileConnectionChild(uint32_t aServiceId);
-
- void
- Init();
-
- void
- Shutdown();
-
-private:
- MobileConnectionChild() = delete;
-
- // final suppresses -Werror,-Wdelete-non-virtual-dtor
- ~MobileConnectionChild()
- {
- MOZ_COUNT_DTOR(MobileConnectionChild);
- }
-
-protected:
- bool
- SendRequest(const MobileConnectionRequest& aRequest,
- nsIMobileConnectionCallback* aCallback);
-
- virtual void
- ActorDestroy(ActorDestroyReason why) override;
-
- virtual PMobileConnectionRequestChild*
- AllocPMobileConnectionRequestChild(const MobileConnectionRequest& request) override;
-
- virtual bool
- DeallocPMobileConnectionRequestChild(PMobileConnectionRequestChild* aActor) override;
-
- virtual bool
- RecvNotifyVoiceInfoChanged(nsIMobileConnectionInfo* const& aInfo) override;
-
- virtual bool
- RecvNotifyDataInfoChanged(nsIMobileConnectionInfo* const& aInfo) override;
-
- virtual bool
- RecvNotifyDataError(const nsString& aMessage) override;
-
- virtual bool
- RecvNotifyCFStateChanged(const uint16_t& aAction, const uint16_t& aReason,
- const nsString& aNumber, const uint16_t& aTimeSeconds,
- const uint16_t& aServiceClass) override;
-
- virtual bool
- RecvNotifyEmergencyCbModeChanged(const bool& aActive,
- const uint32_t& aTimeoutMs) override;
-
- virtual bool
- RecvNotifyOtaStatusChanged(const nsString& aStatus) override;
-
- virtual bool
- RecvNotifyRadioStateChanged(const int32_t& aRadioState) override;
-
- virtual bool
- RecvNotifyClirModeChanged(const uint32_t& aMode) override;
-
- virtual bool
- RecvNotifyLastNetworkChanged(const nsString& aNetwork) override;
-
- virtual bool
- RecvNotifyLastHomeNetworkChanged(const nsString& aNetwork) override;
-
- virtual bool
- RecvNotifyNetworkSelectionModeChanged(const int32_t& aMode) override;
-
-private:
- uint32_t mServiceId;
- bool mLive;
- nsCOMArray<nsIMobileConnectionListener> mListeners;
- RefPtr<MobileConnectionInfo> mVoice;
- RefPtr<MobileConnectionInfo> mData;
- int32_t mRadioState;
- nsString mLastNetwork;
- nsString mLastHomeNetwork;
- int32_t mNetworkSelectionMode;
- nsTArray<int32_t> mSupportedNetworkTypes;
-};
-
-/******************************************************************************
- * PMobileConnectionRequestChild
- ******************************************************************************/
-
-/**
- * Child actor of PMobileConnectionRequest. The object is created when an
- * asynchronous request is made and destroyed after receiving the response sent
- * by parent actor.
- */
-class MobileConnectionRequestChild : public PMobileConnectionRequestChild
-{
-public:
- explicit MobileConnectionRequestChild(nsIMobileConnectionCallback* aRequestCallback)
- : mRequestCallback(aRequestCallback)
- {
- MOZ_COUNT_CTOR(MobileConnectionRequestChild);
- MOZ_ASSERT(mRequestCallback);
- }
-
- bool
- DoReply(const MobileConnectionReplySuccess& aReply);
-
- bool
- DoReply(const MobileConnectionReplySuccessBoolean& aReply);
-
- bool
- DoReply(const MobileConnectionReplySuccessNetworks& aReply);
-
- bool
- DoReply(const MobileConnectionReplySuccessCallForwarding& aReply);
-
- bool
- DoReply(const MobileConnectionReplySuccessCallBarring& aReply);
-
- bool
- DoReply(const MobileConnectionReplySuccessCallWaiting& aReply);
-
- bool
- DoReply(const MobileConnectionReplySuccessClirStatus& aReply);
-
- bool
- DoReply(const MobileConnectionReplySuccessPreferredNetworkType& aReply);
-
- bool
- DoReply(const MobileConnectionReplySuccessRoamingPreference& aMode);
-
- bool
- DoReply(const MobileConnectionReplyError& aReply);
-
-protected:
- virtual
- ~MobileConnectionRequestChild()
- {
- MOZ_COUNT_DTOR(MobileConnectionRequestChild);
- }
-
- virtual void
- ActorDestroy(ActorDestroyReason why) override;
-
- virtual bool
- Recv__delete__(const MobileConnectionReply& aReply) override;
-
-private:
- nsCOMPtr<nsIMobileConnectionCallback> mRequestCallback;
-};
-
-} // namespace mobileconnection
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_mobileconnection_MobileConnectionChild_h
deleted file mode 100644
--- a/dom/mobileconnection/ipc/MobileConnectionIPCSerializer.h
+++ /dev/null
@@ -1,651 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_mobileconnection_MobileConnectionIPCSerialiser_h
-#define mozilla_dom_mobileconnection_MobileConnectionIPCSerialiser_h
-
-#include "ipc/IPCMessageUtils.h"
-#include "mozilla/dom/mobileconnection/MobileCallForwardingOptions.h"
-#include "mozilla/dom/MobileCellInfo.h"
-#include "mozilla/dom/MobileConnectionInfo.h"
-#include "mozilla/dom/MobileNetworkInfo.h"
-#include "mozilla/dom/MozMobileConnectionBinding.h"
-#include "mozilla/dom/ScriptSettings.h"
-
-using mozilla::AutoJSContext;
-using mozilla::dom::mobileconnection::MobileCallForwardingOptions;
-using mozilla::dom::MobileNetworkInfo;
-using mozilla::dom::MobileCellInfo;
-using mozilla::dom::MobileConnectionInfo;
-
-typedef nsIMobileCellInfo* nsMobileCellInfo;
-typedef nsIMobileConnectionInfo* nsMobileConnectionInfo;
-typedef nsIMobileNetworkInfo* nsMobileNetworkInfo;
-typedef nsIMobileCallForwardingOptions* nsMobileCallForwardingOptions;
-
-namespace IPC {
-
-struct MozCallForwardingOptions : public mozilla::dom::MozCallForwardingOptions
-{
- bool operator==(const MozCallForwardingOptions& aOther) const
- {
- return // Compare mActive
- ((!mActive.WasPassed() && !aOther.mActive.WasPassed()) ||
- (mActive.WasPassed() && aOther.mActive.WasPassed() &&
- mActive.Value() == aOther.mActive.Value())) &&
- // Compare mAction
- ((!mAction.WasPassed() && !aOther.mAction.WasPassed()) ||
- (mAction.WasPassed() && aOther.mAction.WasPassed() &&
- mAction.Value() == aOther.mAction.Value())) &&
- // Compare mReason
- ((!mReason.WasPassed() && !aOther.mReason.WasPassed()) ||
- (mReason.WasPassed() && aOther.mReason.WasPassed() &&
- mReason.Value() == aOther.mReason.Value())) &&
- // Compare mNumber
- ((!mNumber.WasPassed() && !aOther.mNumber.WasPassed()) ||
- (mNumber.WasPassed() && aOther.mNumber.WasPassed() &&
- mNumber.Value() == aOther.mNumber.Value())) &&
- // Compare mTimeSeconds
- ((!mTimeSeconds.WasPassed() && !aOther.mTimeSeconds.WasPassed()) ||
- (mTimeSeconds.WasPassed() && aOther.mTimeSeconds.WasPassed() &&
- mTimeSeconds.Value() == aOther.mTimeSeconds.Value())) &&
- // Compare mServiceClass
- ((!mServiceClass.WasPassed() && !aOther.mServiceClass.WasPassed()) ||
- (mServiceClass.WasPassed() && aOther.mServiceClass.WasPassed() &&
- mServiceClass.Value() == aOther.mServiceClass.Value()));
- };
-};
-
-template <>
-struct ParamTraits<nsIMobileCallForwardingOptions*>
-{
- typedef nsIMobileCallForwardingOptions* paramType;
-
- // Function to serialize a MobileCallForwardingOptions.
- static void Write(Message *aMsg, const paramType& aParam)
- {
- bool isNull = !aParam;
- WriteParam(aMsg, isNull);
- // If it is a null object, then we are done.
- if (isNull) {
- return;
- }
-
- int16_t pShort;
- nsString pString;
- bool pBool;
-
- aParam->GetActive(&pBool);
- WriteParam(aMsg, pBool);
-
- aParam->GetAction(&pShort);
- WriteParam(aMsg, pShort);
-
- aParam->GetReason(&pShort);
- WriteParam(aMsg, pShort);
-
- aParam->GetNumber(pString);
- WriteParam(aMsg, pString);
-
- aParam->GetTimeSeconds(&pShort);
- WriteParam(aMsg, pShort);
-
- aParam->GetServiceClass(&pShort);
- WriteParam(aMsg, pShort);
- }
-
- // Function to de-serialize a MobileCallForwardingOptions.
- static bool Read(const Message *aMsg, PickleIterator* aIter, paramType* aResult)
- {
- // Check if is the null pointer we have transfered.
- bool isNull;
- if (!ReadParam(aMsg, aIter, &isNull)) {
- return false;
- }
-
- if (isNull) {
- *aResult = nullptr;
- return true;
- }
-
- bool active;
- int16_t action;
- int16_t reason;
- nsString number;
- int16_t timeSeconds;
- int16_t serviceClass;
-
- // It's not important to us where it fails, but rather if it fails
- if (!(ReadParam(aMsg, aIter, &active) &&
- ReadParam(aMsg, aIter, &action) &&
- ReadParam(aMsg, aIter, &reason) &&
- ReadParam(aMsg, aIter, &number) &&
- ReadParam(aMsg, aIter, &timeSeconds) &&
- ReadParam(aMsg, aIter, &serviceClass))) {
- return false;
- }
-
- *aResult = new MobileCallForwardingOptions(active, action, reason,
- number, timeSeconds, serviceClass);
-
- // We release this ref after receiver finishes processing.
- NS_ADDREF(*aResult);
-
- return true;
- }
-};
-
-/**
- * nsIMobileNetworkInfo Serialize/De-serialize.
- */
-template <>
-struct ParamTraits<nsIMobileNetworkInfo*>
-{
- typedef nsIMobileNetworkInfo* paramType;
-
- // Function to serialize a MobileNetworkInfo.
- static void Write(Message *aMsg, const paramType& aParam)
- {
- bool isNull = !aParam;
- WriteParam(aMsg, isNull);
- // If it is a null object, then we are done.
- if (isNull) {
- return;
- }
-
- nsString pString;
- aParam->GetShortName(pString);
- WriteParam(aMsg, pString);
-
- aParam->GetLongName(pString);
- WriteParam(aMsg, pString);
-
- aParam->GetMcc(pString);
- WriteParam(aMsg, pString);
-
- aParam->GetMnc(pString);
- WriteParam(aMsg, pString);
-
- aParam->GetState(pString);
- WriteParam(aMsg, pString);
-
- // We release the ref here given that ipdl won't handle reference counting.
- aParam->Release();
- }
-
- // Function to de-serialize a MobileNetworkInfo.
- static bool Read(const Message *aMsg, PickleIterator* aIter, paramType* aResult)
- {
- // Check if is the null pointer we have transfered.
- bool isNull;
- if (!ReadParam(aMsg, aIter, &isNull)) {
- return false;
- }
-
- if (isNull) {
- *aResult = nullptr;
- return true;
- }
-
- nsString shortName;
- nsString longName;
- nsString mcc;
- nsString mnc;
- nsString state;
-
- // It's not important to us where it fails, but rather if it fails
- if (!(ReadParam(aMsg, aIter, &shortName) &&
- ReadParam(aMsg, aIter, &longName) &&
- ReadParam(aMsg, aIter, &mcc) &&
- ReadParam(aMsg, aIter, &mnc) &&
- ReadParam(aMsg, aIter, &state))) {
- return false;
- }
-
- *aResult = new MobileNetworkInfo(shortName,
- longName,
- mcc,
- mnc,
- state);
- // We release this ref after receiver finishes processing.
- NS_ADDREF(*aResult);
-
- return true;
- }
-};
-
-/**
- * nsIMobileCellInfo Serialize/De-serialize.
- */
-template <>
-struct ParamTraits<nsIMobileCellInfo*>
-{
- typedef nsIMobileCellInfo* paramType;
-
- // Function to serialize a MobileCellInfo.
- static void Write(Message *aMsg, const paramType& aParam)
- {
- bool isNull = !aParam;
- WriteParam(aMsg, isNull);
- // If it is a null object, then we are done.
- if (isNull) {
- return;
- }
-
- int32_t pLong;
- int64_t pLongLong;
-
- aParam->GetGsmLocationAreaCode(&pLong);
- WriteParam(aMsg, pLong);
-
- aParam->GetGsmCellId(&pLongLong);
- WriteParam(aMsg, pLongLong);
-
- aParam->GetCdmaBaseStationId(&pLong);
- WriteParam(aMsg, pLong);
-
- aParam->GetCdmaBaseStationLatitude(&pLong);
- WriteParam(aMsg, pLong);
-
- aParam->GetCdmaBaseStationLongitude(&pLong);
- WriteParam(aMsg, pLong);
-
- aParam->GetCdmaSystemId(&pLong);
- WriteParam(aMsg, pLong);
-
- aParam->GetCdmaNetworkId(&pLong);
- WriteParam(aMsg, pLong);
-
- // We release the ref here given that ipdl won't handle reference counting.
- aParam->Release();
- }
-
- // Function to de-serialize a MobileCellInfo.
- static bool Read(const Message *aMsg, PickleIterator* aIter, paramType* aResult)
- {
- // Check if is the null pointer we have transfered.
- bool isNull;
- if (!ReadParam(aMsg, aIter, &isNull)) {
- return false;
- }
-
- if (isNull) {
- *aResult = nullptr;
- return true;
- }
-
- int32_t gsmLac;
- int64_t gsmCellId;
- int32_t cdmaBsId;
- int32_t cdmaBsLat;
- int32_t cdmaBsLong;
- int32_t cdmaSystemId;
- int32_t cdmaNetworkId;
-
- // It's not important to us where it fails, but rather if it fails
- if (!(ReadParam(aMsg, aIter, &gsmLac) &&
- ReadParam(aMsg, aIter, &gsmCellId) &&
- ReadParam(aMsg, aIter, &cdmaBsId) &&
- ReadParam(aMsg, aIter, &cdmaBsLat) &&
- ReadParam(aMsg, aIter, &cdmaBsLong) &&
- ReadParam(aMsg, aIter, &cdmaSystemId) &&
- ReadParam(aMsg, aIter, &cdmaNetworkId))) {
- return false;
- }
-
- *aResult = new MobileCellInfo(gsmLac, gsmCellId, cdmaBsId, cdmaBsLat,
- cdmaBsLong, cdmaSystemId, cdmaNetworkId);
- // We release this ref after receiver finishes processing.
- NS_ADDREF(*aResult);
-
- return true;
- }
-};
-
-/**
- * nsIMobileConnectionInfo Serialize/De-serialize.
- */
-template <>
-struct ParamTraits<nsIMobileConnectionInfo*>
-{
- typedef nsIMobileConnectionInfo* paramType;
-
- // Function to serialize a MobileConnectionInfo.
- static void Write(Message *aMsg, const paramType& aParam)
- {
- bool isNull = !aParam;
- WriteParam(aMsg, isNull);
- // If it is a null object, then we are done.
- if (isNull) {
- return;
- }
-
- AutoJSContext cx;
- nsString pString;
- bool pBool;
- nsCOMPtr<nsIMobileNetworkInfo> pNetworkInfo;
- nsCOMPtr<nsIMobileCellInfo> pCellInfo;
- JS::Rooted<JS::Value> pJsval(cx);
- int32_t pInt32;
-
- aParam->GetState(pString);
- WriteParam(aMsg, pString);
-
- aParam->GetConnected(&pBool);
- WriteParam(aMsg, pBool);
-
- aParam->GetEmergencyCallsOnly(&pBool);
- WriteParam(aMsg, pBool);
-
- aParam->GetRoaming(&pBool);
- WriteParam(aMsg, pBool);
-
- aParam->GetType(pString);
- WriteParam(aMsg, pString);
-
- aParam->GetNetwork(getter_AddRefs(pNetworkInfo));
- // Release ref when WriteParam is finished.
- WriteParam(aMsg, pNetworkInfo.forget().take());
-
- aParam->GetCell(getter_AddRefs(pCellInfo));
- // Release ref when WriteParam is finished.
- WriteParam(aMsg, pCellInfo.forget().take());
-
- // Serialize jsval signalStrength
- aParam->GetSignalStrength(&pJsval);
- isNull = !pJsval.isInt32();
- WriteParam(aMsg, isNull);
-
- if (!isNull) {
- pInt32 = pJsval.toInt32();
- WriteParam(aMsg, pInt32);
- }
-
- // Serialize jsval relSignalStrength
- aParam->GetRelSignalStrength(&pJsval);
- isNull = !pJsval.isInt32();
- WriteParam(aMsg, isNull);
-
- if (!isNull) {
- pInt32 = pJsval.toInt32();
- WriteParam(aMsg, pInt32);
- }
-
- // We release the ref here given that ipdl won't handle reference counting.
- aParam->Release();
- }
-
- // Function to de-serialize a MobileConectionInfo.
- static bool Read(const Message* aMsg, PickleIterator* aIter, paramType* aResult)
- {
- // Check if is the null pointer we have transfered.
- bool isNull;
- if (!ReadParam(aMsg, aIter, &isNull)) {
- return false;
- }
-
- if (isNull) {
- *aResult = nullptr;
- return true;
- }
-
- AutoJSContext cx;
- nsString state;
- bool connected;
- bool emergencyOnly;
- bool roaming;
- nsString type;
- nsIMobileNetworkInfo* networkInfo = nullptr;
- nsIMobileCellInfo* cellInfo = nullptr;
- Nullable<int32_t> signalStrength;
- Nullable<uint16_t> relSignalStrength;
-
- // It's not important to us where it fails, but rather if it fails
- if (!(ReadParam(aMsg, aIter, &state) &&
- ReadParam(aMsg, aIter, &connected) &&
- ReadParam(aMsg, aIter, &emergencyOnly) &&
- ReadParam(aMsg, aIter, &roaming) &&
- ReadParam(aMsg, aIter, &type) &&
- ReadParam(aMsg, aIter, &networkInfo) &&
- ReadParam(aMsg, aIter, &cellInfo))) {
- return false;
- }
-
- // De-serialize jsval signalStrength
- if (!ReadParam(aMsg, aIter, &isNull)) {
- return false;
- }
-
- if (!isNull) {
- int32_t value;
-
- if (!ReadParam(aMsg, aIter, &value)) {
- return false;
- }
-
- signalStrength.SetValue(value);
- }
-
- // De-serialize jsval relSignalStrength
- if (!ReadParam(aMsg, aIter, &isNull)) {
- return false;
- }
-
- if (!isNull) {
- int32_t value;
-
- if (!ReadParam(aMsg, aIter, &value)) {
- return false;
- }
-
- relSignalStrength.SetValue(uint16_t(value));
- }
-
- *aResult = new MobileConnectionInfo(state,
- connected,
- emergencyOnly,
- roaming,
- networkInfo,
- type,
- signalStrength,
- relSignalStrength,
- cellInfo);
- // We release this ref after receiver finishes processing.
- NS_ADDREF(*aResult);
- // We already clone the data into MobileConnectionInfo, so release the ref
- // of networkInfo and cellInfo here.
- NS_IF_RELEASE(networkInfo);
- NS_IF_RELEASE(cellInfo);
-
- return true;
- }
-};
-
-/**
- * MozCallForwardingOptions Serialize/De-serialize.
- */
-template <>
-struct ParamTraits<MozCallForwardingOptions>
-{
- typedef MozCallForwardingOptions paramType;
-
- // Function to serialize a MozCallForwardingOptions.
- static void Write(Message *aMsg, const paramType& aParam)
- {
- bool wasPassed = false;
- bool isNull = false;
-
- // Write mActive
- wasPassed = aParam.mActive.WasPassed();
- WriteParam(aMsg, wasPassed);
- if (wasPassed) {
- isNull = aParam.mActive.Value().IsNull();
- WriteParam(aMsg, isNull);
- if (!isNull) {
- WriteParam(aMsg, aParam.mActive.Value().Value());
- }
- }
-
- // Write mAction
- wasPassed = aParam.mAction.WasPassed();
- WriteParam(aMsg, wasPassed);
- if (wasPassed) {
- isNull = aParam.mAction.Value().IsNull();
- WriteParam(aMsg, isNull);
- if (!isNull) {
- WriteParam(aMsg, aParam.mAction.Value().Value());
- }
- }
-
- // Write mReason
- wasPassed = aParam.mReason.WasPassed();
- WriteParam(aMsg, wasPassed);
- if (wasPassed) {
- isNull = aParam.mReason.Value().IsNull();
- WriteParam(aMsg, isNull);
- if (!isNull) {
- WriteParam(aMsg, aParam.mReason.Value().Value());
- }
- }
-
- // Write mNumber
- wasPassed = aParam.mNumber.WasPassed();
- WriteParam(aMsg, wasPassed);
- if (wasPassed) {
- WriteParam(aMsg, aParam.mNumber.Value());
- }
-
- // Write mTimeSeconds
- wasPassed = aParam.mTimeSeconds.WasPassed();
- WriteParam(aMsg, wasPassed);
- if (wasPassed) {
- isNull = aParam.mTimeSeconds.Value().IsNull();
- WriteParam(aMsg, isNull);
- if (!isNull) {
- WriteParam(aMsg, aParam.mTimeSeconds.Value().Value());
- }
- }
-
- // Write mServiceClass
- wasPassed = aParam.mServiceClass.WasPassed();
- WriteParam(aMsg, wasPassed);
- if (wasPassed) {
- isNull = aParam.mServiceClass.Value().IsNull();
- WriteParam(aMsg, isNull);
- if (!isNull) {
- WriteParam(aMsg, aParam.mServiceClass.Value().Value());
- }
- }
- }
-
- // Function to de-serialize a MozCallForwardingOptions.
- static bool Read(const Message *aMsg, PickleIterator* aIter, paramType* aResult)
- {
- bool wasPassed = false;
- bool isNull = false;
-
- // Read mActive
- if (!ReadParam(aMsg, aIter, &wasPassed)) {
- return false;
- }
- if (wasPassed) {
- aResult->mActive.Construct();
- if (!ReadParam(aMsg, aIter, &isNull)) {
- return false;
- }
-
- if (!isNull) {
- if (!ReadParam(aMsg, aIter, &aResult->mActive.Value().SetValue())) {
- return false;
- }
- }
- }
-
- // Read mAction
- if (!ReadParam(aMsg, aIter, &wasPassed)) {
- return false;
- }
- if (wasPassed) {
- aResult->mAction.Construct();
- if (!ReadParam(aMsg, aIter, &isNull)) {
- return false;
- }
-
- if (!isNull) {
- if (!ReadParam(aMsg, aIter, &aResult->mAction.Value().SetValue())) {
- return false;
- }
- }
- }
-
- // Read mReason
- if (!ReadParam(aMsg, aIter, &wasPassed)) {
- return false;
- }
- if (wasPassed) {
- aResult->mReason.Construct();
- if (!ReadParam(aMsg, aIter, &isNull)) {
- return false;
- }
-
- if (!isNull) {
- if (!ReadParam(aMsg, aIter, &aResult->mReason.Value().SetValue())) {
- return false;
- }
- }
- }
-
- // Read mNumber
- if (!ReadParam(aMsg, aIter, &wasPassed)) {
- return false;
- }
- if (wasPassed) {
- if (!ReadParam(aMsg, aIter, &aResult->mNumber.Construct())) {
- return false;
- }
- }
-
- // Read mTimeSeconds
- if (!ReadParam(aMsg, aIter, &wasPassed)) {
- return false;
- }
- if (wasPassed) {
- aResult->mTimeSeconds.Construct();
- if (!ReadParam(aMsg, aIter, &isNull)) {
- return false;
- }
-
- if (!isNull) {
- if (!ReadParam(aMsg, aIter, &aResult->mTimeSeconds.Value().SetValue())) {
- return false;
- }
- }
- }
-
- // Read mServiceClass
- if (!ReadParam(aMsg, aIter, &wasPassed)) {
- return false;
- }
- if (wasPassed) {
- aResult->mServiceClass.Construct();
- if (!ReadParam(aMsg, aIter, &isNull)) {
- return false;
- }
-
- if (!isNull) {
- if (!ReadParam(aMsg, aIter, &aResult->mServiceClass.Value().SetValue())) {
- return false;
- }
- }
- }
-
- return true;
- }
-};
-
-} // namespace IPC
-
-#endif // mozilla_dom_mobileconnection_MobileConnectionIPCSerialiser_h
deleted file mode 100644
--- a/dom/mobileconnection/ipc/MobileConnectionIPCService.cpp
+++ /dev/null
@@ -1,66 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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 "MobileConnectionIPCService.h"
-
-#include "mozilla/dom/ContentChild.h"
-#include "mozilla/Preferences.h"
-#include "mozilla/StaticPtr.h"
-
-using namespace mozilla;
-using namespace mozilla::dom;
-using namespace mozilla::dom::mobileconnection;
-
-NS_IMPL_ISUPPORTS(MobileConnectionIPCService, nsIMobileConnectionService)
-
-MobileConnectionIPCService::MobileConnectionIPCService()
-{
- int32_t numRil = Preferences::GetInt("ril.numRadioInterfaces", 1);
- mItems.SetLength(numRil);
-}
-
-MobileConnectionIPCService::~MobileConnectionIPCService()
-{
- uint32_t count = mItems.Length();
- for (uint32_t i = 0; i < count; i++) {
- if (mItems[i]) {
- mItems[i]->Shutdown();
- }
- }
-}
-
-// nsIMobileConnectionService
-
-NS_IMETHODIMP
-MobileConnectionIPCService::GetNumItems(uint32_t* aNumItems)
-{
- *aNumItems = mItems.Length();
- return NS_OK;
-}
-
-NS_IMETHODIMP
-MobileConnectionIPCService::GetItemByServiceId(uint32_t aServiceId,
- nsIMobileConnection** aItem)
-{
- NS_ENSURE_TRUE(aServiceId < mItems.Length(), NS_ERROR_INVALID_ARG);
-
- if (!mItems[aServiceId]) {
- RefPtr<MobileConnectionChild> child = new MobileConnectionChild(aServiceId);
-
- // |SendPMobileConnectionConstructor| adds another reference to the child
- // actor and removes in |DeallocPMobileConnectionChild|.
- ContentChild::GetSingleton()->SendPMobileConnectionConstructor(child,
- aServiceId);
- child->Init();
-
- mItems[aServiceId] = child;
- }
-
- RefPtr<nsIMobileConnection> item(mItems[aServiceId]);
- item.forget(aItem);
-
- return NS_OK;
-}
deleted file mode 100644
--- a/dom/mobileconnection/ipc/MobileConnectionIPCService.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_mobileconnection_MobileConnectionIPCService_h
-#define mozilla_dom_mobileconnection_MobileConnectionIPCService_h
-
-#include "nsCOMPtr.h"
-#include "mozilla/dom/mobileconnection/MobileConnectionChild.h"
-#include "nsIMobileConnectionService.h"
-
-namespace mozilla {
-namespace dom {
-namespace mobileconnection {
-
-class MobileConnectionIPCService final : public nsIMobileConnectionService
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIMOBILECONNECTIONSERVICE
-
- MobileConnectionIPCService();
-
-private:
- // final suppresses -Werror,-Wdelete-non-virtual-dtor
- ~MobileConnectionIPCService();
-
- nsTArray<RefPtr<MobileConnectionChild>> mItems;
-};
-
-} // namespace mobileconnection
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_mobileconnection_MobileConnectionIPCService_h
deleted file mode 100644
--- a/dom/mobileconnection/ipc/MobileConnectionParent.cpp
+++ /dev/null
@@ -1,578 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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/mobileconnection/MobileConnectionParent.h"
-
-#include "mozilla/AppProcessChecker.h"
-#include "mozilla/dom/BindingUtils.h"
-#include "mozilla/dom/mobileconnection/MobileConnectionIPCSerializer.h"
-#include "mozilla/dom/MozMobileConnectionBinding.h"
-#include "mozilla/dom/ToJSValue.h"
-#include "nsIVariant.h"
-#include "nsJSUtils.h"
-
-using namespace mozilla;
-using namespace mozilla::dom;
-using namespace mozilla::dom::mobileconnection;
-
-MobileConnectionParent::MobileConnectionParent(uint32_t aClientId)
- : mLive(true)
-{
- MOZ_COUNT_CTOR(MobileConnectionParent);
-
- nsCOMPtr<nsIMobileConnectionService> service =
- do_GetService(NS_MOBILE_CONNECTION_SERVICE_CONTRACTID);
- NS_ASSERTION(service, "This shouldn't fail!");
-
- nsresult rv = service->GetItemByServiceId(aClientId,
- getter_AddRefs(mMobileConnection));
- if (NS_SUCCEEDED(rv) && mMobileConnection) {
- mMobileConnection->RegisterListener(this);
- }
-}
-
-void
-MobileConnectionParent::ActorDestroy(ActorDestroyReason why)
-{
- mLive = false;
- if (mMobileConnection) {
- mMobileConnection->UnregisterListener(this);
- mMobileConnection = nullptr;
- }
-}
-
-bool
-MobileConnectionParent::RecvPMobileConnectionRequestConstructor(PMobileConnectionRequestParent* aActor,
- const MobileConnectionRequest& aRequest)
-{
- MobileConnectionRequestParent* actor = static_cast<MobileConnectionRequestParent*>(aActor);
-
- switch (aRequest.type()) {
- case MobileConnectionRequest::TGetNetworksRequest:
- return actor->DoRequest(aRequest.get_GetNetworksRequest());
- case MobileConnectionRequest::TSelectNetworkRequest:
- return actor->DoRequest(aRequest.get_SelectNetworkRequest());
- case MobileConnectionRequest::TSelectNetworkAutoRequest:
- return actor->DoRequest(aRequest.get_SelectNetworkAutoRequest());
- case MobileConnectionRequest::TSetPreferredNetworkTypeRequest:
- return actor->DoRequest(aRequest.get_SetPreferredNetworkTypeRequest());
- case MobileConnectionRequest::TGetPreferredNetworkTypeRequest:
- return actor->DoRequest(aRequest.get_GetPreferredNetworkTypeRequest());
- case MobileConnectionRequest::TSetRoamingPreferenceRequest:
- return actor->DoRequest(aRequest.get_SetRoamingPreferenceRequest());
- case MobileConnectionRequest::TGetRoamingPreferenceRequest:
- return actor->DoRequest(aRequest.get_GetRoamingPreferenceRequest());
- case MobileConnectionRequest::TSetVoicePrivacyModeRequest:
- return actor->DoRequest(aRequest.get_SetVoicePrivacyModeRequest());
- case MobileConnectionRequest::TGetVoicePrivacyModeRequest:
- return actor->DoRequest(aRequest.get_GetVoicePrivacyModeRequest());
- case MobileConnectionRequest::TSetCallForwardingRequest:
- return actor->DoRequest(aRequest.get_SetCallForwardingRequest());
- case MobileConnectionRequest::TGetCallForwardingRequest:
- return actor->DoRequest(aRequest.get_GetCallForwardingRequest());
- case MobileConnectionRequest::TSetCallBarringRequest:
- return actor->DoRequest(aRequest.get_SetCallBarringRequest());
- case MobileConnectionRequest::TGetCallBarringRequest:
- return actor->DoRequest(aRequest.get_GetCallBarringRequest());
- case MobileConnectionRequest::TChangeCallBarringPasswordRequest:
- return actor->DoRequest(aRequest.get_ChangeCallBarringPasswordRequest());
- case MobileConnectionRequest::TSetCallWaitingRequest:
- return actor->DoRequest(aRequest.get_SetCallWaitingRequest());
- case MobileConnectionRequest::TGetCallWaitingRequest:
- return actor->DoRequest(aRequest.get_GetCallWaitingRequest());
- case MobileConnectionRequest::TSetCallingLineIdRestrictionRequest:
- return actor->DoRequest(aRequest.get_SetCallingLineIdRestrictionRequest());
- case MobileConnectionRequest::TGetCallingLineIdRestrictionRequest:
- return actor->DoRequest(aRequest.get_GetCallingLineIdRestrictionRequest());
- case MobileConnectionRequest::TExitEmergencyCbModeRequest:
- return actor->DoRequest(aRequest.get_ExitEmergencyCbModeRequest());
- case MobileConnectionRequest::TSetRadioEnabledRequest:
- return actor->DoRequest(aRequest.get_SetRadioEnabledRequest());
- default:
- MOZ_CRASH("Received invalid request type!");
- }
-
- return false;
-}
-
-PMobileConnectionRequestParent*
-MobileConnectionParent::AllocPMobileConnectionRequestParent(const MobileConnectionRequest& request)
-{
- if (!AssertAppProcessPermission(Manager(), "mobileconnection")) {
- return nullptr;
- }
-
- MobileConnectionRequestParent* actor =
- new MobileConnectionRequestParent(mMobileConnection);
- // Add an extra ref for IPDL. Will be released in
- // MobileConnectionParent::DeallocPMobileConnectionRequestParent().
- actor->AddRef();
- return actor;
-}
-
-bool
-MobileConnectionParent::DeallocPMobileConnectionRequestParent(PMobileConnectionRequestParent* aActor)
-{
- // MobileConnectionRequestParent is refcounted, must not be freed manually.
- static_cast<MobileConnectionRequestParent*>(aActor)->Release();
- return true;
-}
-
-bool
-MobileConnectionParent::RecvInit(nsMobileConnectionInfo* aVoice,
- nsMobileConnectionInfo* aData,
- nsString* aLastKnownNetwork,
- nsString* aLastKnownHomeNetwork,
- int32_t* aNetworkSelectionMode,
- int32_t* aRadioState,
- nsTArray<int32_t>* aSupportedNetworkTypes)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- NS_ENSURE_SUCCESS(mMobileConnection->GetVoice(aVoice), false);
- NS_ENSURE_SUCCESS(mMobileConnection->GetData(aData), false);
- NS_ENSURE_SUCCESS(mMobileConnection->GetLastKnownNetwork(*aLastKnownNetwork), false);
- NS_ENSURE_SUCCESS(mMobileConnection->GetLastKnownHomeNetwork(*aLastKnownHomeNetwork), false);
- NS_ENSURE_SUCCESS(mMobileConnection->GetNetworkSelectionMode(aNetworkSelectionMode), false);
- NS_ENSURE_SUCCESS(mMobileConnection->GetRadioState(aRadioState), false);
-
- int32_t* types = nullptr;
- uint32_t length = 0;
-
- nsresult rv = mMobileConnection->GetSupportedNetworkTypes(&types, &length);
- NS_ENSURE_SUCCESS(rv, false);
-
- for (uint32_t i = 0; i < length; ++i) {
- aSupportedNetworkTypes->AppendElement(types[i]);
- }
-
- free(types);
-
- return true;
-}
-
-// nsIMobileConnectionListener
-
-NS_IMPL_ISUPPORTS(MobileConnectionParent, nsIMobileConnectionListener)
-
-NS_IMETHODIMP
-MobileConnectionParent::NotifyVoiceChanged()
-{
- NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
-
- nsresult rv;
- nsCOMPtr<nsIMobileConnectionInfo> info;
- rv = mMobileConnection->GetVoice(getter_AddRefs(info));
- NS_ENSURE_SUCCESS(rv, rv);
-
- // We release the ref after serializing process is finished in
- // MobileConnectionIPCSerializer.
- return SendNotifyVoiceInfoChanged(info.forget().take()) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionParent::NotifyDataChanged()
-{
- NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
-
- nsresult rv;
- nsCOMPtr<nsIMobileConnectionInfo> info;
- rv = mMobileConnection->GetData(getter_AddRefs(info));
- NS_ENSURE_SUCCESS(rv, rv);
-
- // We release the ref after serializing process is finished in
- // MobileConnectionIPCSerializer.
- return SendNotifyDataInfoChanged(info.forget().take()) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionParent::NotifyDataError(const nsAString& aMessage)
-{
- NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
-
- return SendNotifyDataError(nsAutoString(aMessage)) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionParent::NotifyCFStateChanged(uint16_t aAction,
- uint16_t aReason,
- const nsAString &aNumber,
- uint16_t aTimeSeconds,
- uint16_t aServiceClass)
-{
- NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
-
- return SendNotifyCFStateChanged(aAction, aReason, nsAutoString(aNumber),
- aTimeSeconds, aServiceClass) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionParent::NotifyEmergencyCbModeChanged(bool aActive,
- uint32_t aTimeoutMs)
-{
- NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
-
- return SendNotifyEmergencyCbModeChanged(aActive, aTimeoutMs)
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionParent::NotifyOtaStatusChanged(const nsAString& aStatus)
-{
- NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
-
- return SendNotifyOtaStatusChanged(nsAutoString(aStatus))
- ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionParent::NotifyRadioStateChanged()
-{
- NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
-
- nsresult rv;
- int32_t radioState;
- rv = mMobileConnection->GetRadioState(&radioState);
- NS_ENSURE_SUCCESS(rv, rv);
-
- return SendNotifyRadioStateChanged(radioState) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionParent::NotifyClirModeChanged(uint32_t aMode)
-{
- NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
-
- return SendNotifyClirModeChanged(aMode) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionParent::NotifyLastKnownNetworkChanged()
-{
- NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
-
- nsresult rv;
- nsAutoString network;
- rv = mMobileConnection->GetLastKnownNetwork(network);
- NS_ENSURE_SUCCESS(rv, rv);
-
- return SendNotifyLastNetworkChanged(network) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionParent::NotifyLastKnownHomeNetworkChanged()
-{
- NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
-
- nsresult rv;
- nsAutoString network;
- rv = mMobileConnection->GetLastKnownHomeNetwork(network);
- NS_ENSURE_SUCCESS(rv, rv);
-
- return SendNotifyLastHomeNetworkChanged(network) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionParent::NotifyNetworkSelectionModeChanged()
-{
- NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
-
- nsresult rv;
- int32_t mode;
- rv = mMobileConnection->GetNetworkSelectionMode(&mode);
- NS_ENSURE_SUCCESS(rv, rv);
-
- return SendNotifyNetworkSelectionModeChanged(mode) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-NS_IMETHODIMP
-MobileConnectionParent::NotifyDeviceIdentitiesChanged()
-{
- // To be supported when bug 1222870 is required in m-c.
- return NS_OK;
-}
-
-/******************************************************************************
- * PMobileConnectionRequestParent
- ******************************************************************************/
-
-void
-MobileConnectionRequestParent::ActorDestroy(ActorDestroyReason why)
-{
- mLive = false;
- mMobileConnection = nullptr;
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const GetNetworksRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->GetNetworks(this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const SelectNetworkRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- // Use dont_AddRef here because this instances is already AddRef-ed in
- // MobileConnectionIPCSerializer.h
- nsCOMPtr<nsIMobileNetworkInfo> network = dont_AddRef(aRequest.network());
- return NS_SUCCEEDED(mMobileConnection->SelectNetwork(network, this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const SelectNetworkAutoRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->SelectNetworkAutomatically(this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const SetPreferredNetworkTypeRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->SetPreferredNetworkType(aRequest.type(), this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const GetPreferredNetworkTypeRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->GetPreferredNetworkType(this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const SetRoamingPreferenceRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->SetRoamingPreference(aRequest.mode(), this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const GetRoamingPreferenceRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->GetRoamingPreference(this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const SetVoicePrivacyModeRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->SetVoicePrivacyMode(aRequest.enabled(), this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const GetVoicePrivacyModeRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->GetVoicePrivacyMode(this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const SetCallForwardingRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->SetCallForwarding(aRequest.action(),
- aRequest.reason(),
- aRequest.number(),
- aRequest.timeSeconds(),
- aRequest.serviceClass(),
- this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const GetCallForwardingRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->GetCallForwarding(aRequest.reason(),
- this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const SetCallBarringRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->SetCallBarring(aRequest.program(),
- aRequest.enabled(),
- aRequest.password(),
- aRequest.serviceClass(),
- this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const GetCallBarringRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->GetCallBarring(aRequest.program(),
- aRequest.password(),
- aRequest.serviceClass(),
- this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const ChangeCallBarringPasswordRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->ChangeCallBarringPassword(aRequest.pin(),
- aRequest.newPin(),
- this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const SetCallWaitingRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->SetCallWaiting(aRequest.enabled(),
- aRequest.serviceClass(),
- this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const GetCallWaitingRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->GetCallWaiting(this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const SetCallingLineIdRestrictionRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->SetCallingLineIdRestriction(aRequest.mode(), this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const GetCallingLineIdRestrictionRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->GetCallingLineIdRestriction(this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const ExitEmergencyCbModeRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->ExitEmergencyCbMode(this));
-}
-
-bool
-MobileConnectionRequestParent::DoRequest(const SetRadioEnabledRequest& aRequest)
-{
- NS_ENSURE_TRUE(mMobileConnection, false);
-
- return NS_SUCCEEDED(mMobileConnection->SetRadioEnabled(aRequest.enabled(), this));
-}
-
-nsresult
-MobileConnectionRequestParent::SendReply(const MobileConnectionReply& aReply)
-{
- NS_ENSURE_TRUE(mLive, NS_ERROR_FAILURE);
-
- return Send__delete__(this, aReply) ? NS_OK : NS_ERROR_FAILURE;
-}
-
-// nsIMobileConnectionListener
-
-NS_IMPL_ISUPPORTS(MobileConnectionRequestParent, nsIMobileConnectionCallback);
-
-NS_IMETHODIMP
-MobileConnectionRequestParent::NotifySuccess()
-{
- return SendReply(MobileConnectionReplySuccess());
-}
-
-NS_IMETHODIMP
-MobileConnectionRequestParent::NotifySuccessWithBoolean(bool aResult)
-{
- return SendReply(MobileConnectionReplySuccessBoolean(aResult));
-}
-
-NS_IMETHODIMP
-MobileConnectionRequestParent::NotifyGetNetworksSuccess(uint32_t aCount,
- nsIMobileNetworkInfo** aNetworks)
-{
- nsTArray<nsIMobileNetworkInfo*> networks;
- for (uint32_t i = 0; i < aCount; i++) {
- nsCOMPtr<nsIMobileNetworkInfo> network = aNetworks[i];
- // We release the ref after serializing process is finished in
- // MobileConnectionIPCSerializer.
- networks.AppendElement(network.forget().take());
- }
- return SendReply(MobileConnectionReplySuccessNetworks(networks));
-}
-
-NS_IMETHODIMP
-MobileConnectionRequestParent::NotifyGetCallForwardingSuccess(uint32_t aCount,
- nsIMobileCallForwardingOptions** aResults)
-{
- nsTArray<nsIMobileCallForwardingOptions*> results;
- for (uint32_t i = 0; i < aCount; i++) {
- results.AppendElement(aResults[i]);
- }
-
- return SendReply(MobileConnectionReplySuccessCallForwarding(results));
-}
-
-NS_IMETHODIMP
-MobileConnectionRequestParent::NotifyGetCallBarringSuccess(uint16_t aProgram,
- bool aEnabled,
- uint16_t aServiceClass)
-{
- return SendReply(MobileConnectionReplySuccessCallBarring(aProgram, aEnabled,
- aServiceClass));
-}
-
-NS_IMETHODIMP
-MobileConnectionRequestParent::NotifyGetCallWaitingSuccess(uint16_t aServiceClass)
-{
- return SendReply(MobileConnectionReplySuccessCallWaiting(aServiceClass));
-}
-
-NS_IMETHODIMP
-MobileConnectionRequestParent::NotifyGetClirStatusSuccess(uint16_t aN,
- uint16_t aM)
-{
- return SendReply(MobileConnectionReplySuccessClirStatus(aN, aM));
-}
-
-NS_IMETHODIMP
-MobileConnectionRequestParent::NotifyGetPreferredNetworkTypeSuccess(int32_t aType)
-{
- return SendReply(MobileConnectionReplySuccessPreferredNetworkType(aType));
-}
-
-NS_IMETHODIMP
-MobileConnectionRequestParent::NotifyGetRoamingPreferenceSuccess(int32_t aMode)
-{
- return SendReply(MobileConnectionReplySuccessRoamingPreference(aMode));
-}
-
-NS_IMETHODIMP
-MobileConnectionRequestParent::NotifyError(const nsAString& aName)
-{
- nsAutoString error(aName);
- return SendReply(MobileConnectionReplyError(error));
-}
deleted file mode 100644
--- a/dom/mobileconnection/ipc/MobileConnectionParent.h
+++ /dev/null
@@ -1,171 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set ts=8 sts=2 et sw=2 tw=80: */
-/* 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_mobileconnection_MobileConnectionParent_h
-#define mozilla_dom_mobileconnection_MobileConnectionParent_h
-
-#include "mozilla/dom/mobileconnection/PMobileConnectionParent.h"
-#include "mozilla/dom/mobileconnection/PMobileConnectionRequestParent.h"
-#include "nsIMobileConnectionInfo.h"
-#include "nsIMobileConnectionService.h"
-#include "nsServiceManagerUtils.h"
-
-namespace mozilla {
-namespace dom {
-namespace mobileconnection {
-
-/**
- * Parent actor of PMobileConnection. This object is created/destroyed along
- * with child actor.
- */
-class MobileConnectionParent : public PMobileConnectionParent
- , public nsIMobileConnectionListener
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIMOBILECONNECTIONLISTENER
-
- explicit MobileConnectionParent(uint32_t aClientId);
-
-protected:
- virtual
- ~MobileConnectionParent()
- {
- MOZ_COUNT_DTOR(MobileConnectionParent);
- }
-
- virtual void
- ActorDestroy(ActorDestroyReason aWhy) override;
-
- virtual bool
- RecvPMobileConnectionRequestConstructor(PMobileConnectionRequestParent* aActor,
- const MobileConnectionRequest& aRequest) override;
-
- virtual PMobileConnectionRequestParent*
- AllocPMobileConnectionRequestParent(const MobileConnectionRequest& request) override;
-
- virtual bool
- DeallocPMobileConnectionRequestParent(PMobileConnectionRequestParent* aActor) override;
-
- virtual bool
- RecvInit(nsMobileConnectionInfo* aVoice, nsMobileConnectionInfo* aData,
- nsString* aLastKnownNetwork, nsString* aLastKnownHomeNetwork,
- int32_t* aNetworkSelectionMode, int32_t* aRadioState,
- nsTArray<int32_t>* aSupportedNetworkTypes) override;
-
-private:
- nsCOMPtr<nsIMobileConnection> mMobileConnection;
- bool mLive;
-};
-
-/******************************************************************************
- * PMobileConnectionRequestParent
- ******************************************************************************/
-
-/**
- * Parent actor of PMobileConnectionRequestParent. The object is created along
- * with child actor and destroyed after the callback function of
- * nsIMobileConnectionCallback is called. Child actor might be destroyed before
- * any callback is triggered. So we use mLive to maintain the status of child
- * actor in order to present sending data to a dead one.
- */
-class MobileConnectionRequestParent : public PMobileConnectionRequestParent
- , public nsIMobileConnectionCallback
-{
-public:
- NS_DECL_ISUPPORTS
- NS_DECL_NSIMOBILECONNECTIONCALLBACK
-
- explicit MobileConnectionRequestParent(nsIMobileConnection* aMobileConnection)
- : mMobileConnection(aMobileConnection)
- , mLive(true)
- {
- MOZ_COUNT_CTOR(MobileConnectionRequestParent);
- }
-
- bool
- DoRequest(const GetNetworksRequest& aRequest);
-
- bool
- DoRequest(const SelectNetworkRequest& aRequest);
-
- bool
- DoRequest(const SelectNetworkAutoRequest& aRequest);
-
- bool
- DoRequest(const SetPreferredNetworkTypeRequest& aRequest);
-
- bool
- DoRequest(const GetPreferredNetworkTypeRequest& aRequest);
-
- bool
- DoRequest(const SetRoamingPreferenceRequest& aRequest);
-
- bool
- DoRequest(const GetRoamingPreferenceRequest& aRequest);
-
- bool
- DoRequest(const SetVoicePrivacyModeRequest& aRequest);
-
- bool
- DoRequest(const GetVoicePrivacyModeRequest& aRequest);
-
- bool
- DoRequest(const SetCallForwardingRequest& aRequest);
-
- bool
- DoRequest(const GetCallForwardingRequest& aRequest);
-
- bool
- DoRequest(const SetCallBarringRequest& aRequest);
-
- bool
- DoRequest(const GetCallBarringRequest& aRequest);
-
- bool
- DoRequest(const ChangeCallBarringPasswordRequest& aRequest);
-
- bool
- DoRequest(const SetCallWaitingRequest& aRequest);
-
- bool
- DoRequest(const GetCallWaitingRequest& aRequest);
-
- bool
- DoRequest(const SetCallingLineIdRestrictionRequest& aRequest);
-
- bool
- DoRequest(const GetCallingLineIdRestrictionRequest& aRequest);
-
- bool
- DoRequest(const ExitEmergencyCbModeRequest& aRequest);
-
- bool
- DoRequest(const SetRadioEnabledRequest& aRequest);
-
-protected:
- virtual
- ~MobileConnectionRequestParent()
- {
- MOZ_COUNT_DTOR(MobileConnectionRequestParent);
- }
-
- virtual void
- ActorDestroy(ActorDestroyReason aWhy) override;
-
- nsresult
- SendReply(const MobileConnectionReply& aReply);
-
-private:
- nsCOMPtr<nsIMobileConnection> mMobileConnection;
- bool mLive;
-};
-
-} // namespace mobileconnection
-} // namespace dom
-} // namespace mozilla
-
-#endif // mozilla_dom_mobileconnection_MobileConnectionParent_h
deleted file mode 100644
--- a/dom/mobileconnection/ipc/PMobileConnection.ipdl
+++ /dev/null
@@ -1,187 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set sw=2 ts=8 et ft=cpp : */
-/* 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 protocol PContent;
-include protocol PMobileConnectionRequest;
-include PMobileConnectionTypes;
-
-namespace mozilla {
-namespace dom {
-namespace mobileconnection {
-
-sync protocol PMobileConnection
-{
- manager PContent;
- manages PMobileConnectionRequest;
-
-child:
- async NotifyVoiceInfoChanged(nsMobileConnectionInfo aInfo);
- async NotifyDataInfoChanged(nsMobileConnectionInfo aInfo);
- async NotifyDataError(nsString aMessage);
- async NotifyCFStateChanged(uint16_t aAction, uint16_t aReason, nsString aNumber,
- uint16_t aTimeSeconds, uint16_t aServiceClass);
- async NotifyEmergencyCbModeChanged(bool aActive, uint32_t aTimeoutMs);
- async NotifyOtaStatusChanged(nsString aStatus);
- async NotifyRadioStateChanged(int32_t aRadioState);
- async NotifyClirModeChanged(uint32_t aMode);
- async NotifyLastNetworkChanged(nsString aNetwork);
- async NotifyLastHomeNetworkChanged(nsString aNetwork);
- async NotifyNetworkSelectionModeChanged(int32_t aMode);
-
-parent:
- /**
- * Send when child no longer needs to use PMobileConnection.
- */
- async __delete__();
-
- /**
- * Sent when the child makes an asynchronous request to the parent.
- */
- async PMobileConnectionRequest(MobileConnectionRequest aRequest);
-
- /**
- * Sync call only be called once per child actor for initialization.
- */
- sync Init()
- returns (nsMobileConnectionInfo aVoice, nsMobileConnectionInfo aData,
- nsString aLastKnownNetwork, nsString aLastKnownHomeNetwork,
- int32_t aNetworkSelectionMode, int32_t aRadioState,
- int32_t[] aSupportedNetworkTypes);
-};
-
-/**
- * MobileConnectionRequest
- */
-struct GetNetworksRequest
-{
-};
-
-struct SelectNetworkRequest
-{
- nsMobileNetworkInfo network;
-};
-
-struct SelectNetworkAutoRequest
-{
-};
-
-struct SetPreferredNetworkTypeRequest
-{
- int32_t type;
-};
-
-struct GetPreferredNetworkTypeRequest
-{
-};
-
-struct SetRoamingPreferenceRequest
-{
- int32_t mode;
-};
-
-struct GetRoamingPreferenceRequest
-{
-};
-
-struct SetVoicePrivacyModeRequest
-{
- bool enabled;
-};
-
-struct GetVoicePrivacyModeRequest
-{
-};
-
-struct SetCallForwardingRequest
-{
- uint16_t action;
- uint16_t reason;
- nsString number;
- uint16_t timeSeconds;
- uint16_t serviceClass;
-};
-
-struct GetCallForwardingRequest
-{
- uint16_t reason;
-};
-
-struct SetCallBarringRequest
-{
- uint16_t program;
- bool enabled;
- nsString password;
- uint16_t serviceClass;
-};
-
-struct GetCallBarringRequest
-{
- uint16_t program;
- nsString password;
- uint16_t serviceClass;
-};
-
-struct ChangeCallBarringPasswordRequest
-{
- nsString pin;
- nsString newPin;
-};
-
-struct SetCallWaitingRequest
-{
- bool enabled;
- uint16_t serviceClass;
-};
-
-struct GetCallWaitingRequest
-{
-};
-
-struct SetCallingLineIdRestrictionRequest
-{
- uint16_t mode;
-};
-
-struct GetCallingLineIdRestrictionRequest
-{
-};
-
-struct ExitEmergencyCbModeRequest
-{
-};
-
-struct SetRadioEnabledRequest
-{
- bool enabled;
-};
-
-union MobileConnectionRequest
-{
- GetNetworksRequest;
- SelectNetworkRequest;
- SelectNetworkAutoRequest;
- SetPreferredNetworkTypeRequest;
- GetPreferredNetworkTypeRequest;
- SetRoamingPreferenceRequest;
- GetRoamingPreferenceRequest;
- SetVoicePrivacyModeRequest;
- GetVoicePrivacyModeRequest;
- SetCallForwardingRequest;
- GetCallForwardingRequest;
- SetCallBarringRequest;
- GetCallBarringRequest;
- ChangeCallBarringPasswordRequest;
- SetCallWaitingRequest;
- GetCallWaitingRequest;
- SetCallingLineIdRestrictionRequest;
- GetCallingLineIdRestrictionRequest;
- ExitEmergencyCbModeRequest;
- SetRadioEnabledRequest;
-};
-
-} // namespace mobileconnection
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/mobileconnection/ipc/PMobileConnectionRequest.ipdl
+++ /dev/null
@@ -1,100 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set sw=2 ts=8 et ft=cpp : */
-/* 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 protocol PMobileConnection;
-include PMobileConnectionTypes;
-
-namespace mozilla {
-namespace dom {
-namespace mobileconnection {
-
-protocol PMobileConnectionRequest
-{
- manager PMobileConnection;
-
-child:
- /**
- * Send when asynchronous request has completed.
- */
- async __delete__(MobileConnectionReply aResponse);
-};
-
-/**
- * MobileConnectionReply
- */
-// Success
-struct MobileConnectionReplySuccess
-{
-};
-
-struct MobileConnectionReplySuccessBoolean
-{
- bool result;
-};
-
-struct MobileConnectionReplySuccessNetworks
-{
- nsMobileNetworkInfo[] results;
-};
-
-struct MobileConnectionReplySuccessCallForwarding
-{
- nsMobileCallForwardingOptions[] results;
-};
-
-struct MobileConnectionReplySuccessCallBarring
-{
- uint16_t program;
- bool enabled;
- uint16_t serviceClass;
-};
-
-struct MobileConnectionReplySuccessCallWaiting
-{
- uint16_t serviceClass;
-};
-
-struct MobileConnectionReplySuccessClirStatus
-{
- uint16_t n;
- uint16_t m;
-};
-
-struct MobileConnectionReplySuccessPreferredNetworkType
-{
- int32_t type;
-};
-
-struct MobileConnectionReplySuccessRoamingPreference
-{
- int32_t mode;
-};
-
-// Error
-struct MobileConnectionReplyError
-{
- nsString message;
-};
-
-union MobileConnectionReply
-{
- // Success
- MobileConnectionReplySuccess;
- MobileConnectionReplySuccessBoolean;
- MobileConnectionReplySuccessNetworks;
- MobileConnectionReplySuccessCallForwarding;
- MobileConnectionReplySuccessCallBarring;
- MobileConnectionReplySuccessCallWaiting;
- MobileConnectionReplySuccessClirStatus;
- MobileConnectionReplySuccessPreferredNetworkType;
- MobileConnectionReplySuccessRoamingPreference;
- // Error
- MobileConnectionReplyError;
-};
-
-} // namespace mobileconnection
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/mobileconnection/ipc/PMobileConnectionTypes.ipdlh
+++ /dev/null
@@ -1,26 +0,0 @@
-/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
-/* vim: set sw=2 ts=8 et ft=cpp : */
-/* 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/. */
-
-using nsMobileConnectionInfo from "mozilla/dom/mobileconnection/MobileConnectionIPCSerializer.h";
-using nsMobileNetworkInfo from "mozilla/dom/mobileconnection/MobileConnectionIPCSerializer.h";
-using struct mozilla::void_t from "ipc/IPCMessageUtils.h";
-using struct IPC::MozCallForwardingOptions from "mozilla/dom/mobileconnection/MobileConnectionIPCSerializer.h";
-using nsMobileCallForwardingOptions from "mozilla/dom/mobileconnection/MobileConnectionIPCSerializer.h";
-
-namespace mozilla {
-namespace dom {
-namespace mobileconnection {
-
-union AdditionalInformation {
- void_t;
- uint16_t;
- nsString[];
- nsMobileCallForwardingOptions[];
-};
-
-} // namespace mobileconnection
-} // namespace dom
-} // namespace mozilla
deleted file mode 100644
--- a/dom/mobileconnection/moz.build
+++ /dev/null
@@ -1,77 +0,0 @@
-# -*- Mode: python; 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/.
-
-MOCHITEST_MANIFESTS += ['tests/mochitest/mochitest.ini']
-
-EXPORTS.mozilla.dom += [
- 'MobileCellInfo.h',
- 'MobileConnection.h',
- 'MobileConnectionArray.h',
- 'MobileConnectionInfo.h',
- 'MobileNetworkInfo.h',
-]
-
-EXPORTS.mozilla.dom.mobileconnection += [
- 'ipc/MobileConnectionChild.h',
- 'ipc/MobileConnectionIPCSerializer.h',
- 'ipc/MobileConnectionParent.h',
- 'MobileCallForwardingOptions.h',
-]
-
-XPIDL_SOURCES += [
- 'interfaces/nsICellInfo.idl',
- 'interfaces/nsIMobileCallForwardingOptions.idl',
- 'interfaces/nsIMobileCellInfo.idl',
- 'interfaces/nsIMobileConnectionInfo.idl',
- 'interfaces/nsIMobileConnectionService.idl',
- 'interfaces/nsIMobileDeviceIdentities.idl',
- 'interfaces/nsIMobileNetworkInfo.idl',
- 'interfaces/nsINeighboringCellInfo.idl',
-]
-
-UNIFIED_SOURCES += [
- 'Assertions.cpp',
- 'ipc/MobileConnectionChild.cpp',
- 'ipc/MobileConnectionIPCService.cpp',
- 'ipc/MobileConnectionParent.cpp',
- 'MobileCallForwardingOptions.cpp',
- 'MobileCellInfo.cpp',
- 'MobileConnection.cpp',
- 'MobileConnectionArray.cpp',
- 'MobileConnectionCallback.cpp',
- 'MobileConnectionInfo.cpp',
- 'MobileNetworkInfo.cpp',
-]
-
-IPDL_SOURCES += [
- 'ipc/PMobileConnection.ipdl',
- 'ipc/PMobileConnectionRequest.ipdl',
- 'ipc/PMobileConnectionTypes.ipdlh',
-]
-
-if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk' and CONFIG['MOZ_B2G_RIL']:
- XPIDL_SOURCES += [
- 'gonk/nsIGonkMobileConnectionService.idl',
- 'gonk/nsIMobileConnectionMessenger.idl',
- ]
- if not CONFIG['DISABLE_MOZ_RIL_GEOLOC']:
- EXTRA_COMPONENTS += [
- 'gonk/MobileConnectionService.js',
- 'gonk/MobileConnectionService.manifest',
- ]
-
-LOCAL_INCLUDES += [
- '/dom/system/gonk',
-]
-
-include('/ipc/chromium/chromium-config.mozbuild')
-
-FINAL_LIBRARY = 'xul'
-
-XPIDL_MODULE = 'dom_mobileconnection'
-
-if CONFIG['GNU_CXX']:
- CXXFLAGS += ['-Wno-error=shadow']
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/head.js
+++ /dev/null
@@ -1,1256 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-const {Cc: Cc, Ci: Ci, Cr: Cr, Cu: Cu} = SpecialPowers;
-
-const SETTINGS_KEY_DATA_ENABLED = "ril.data.enabled";
-const SETTINGS_KEY_DATA_ROAMING_ENABLED = "ril.data.roaming_enabled";
-const SETTINGS_KEY_DATA_APN_SETTINGS = "ril.data.apnSettings";
-
-const PREF_KEY_RIL_DEBUGGING_ENABLED = "ril.debugging.enabled";
-
-// The pin code hard coded in emulator is "0000".
-const DEFAULT_PIN = "0000";
-// The puk code hard coded in emulator is "12345678".
-const DEFAULT_PUK = "12345678";
-
-// Emulate Promise.jsm semantics.
-Promise.defer = function() { return new Deferred(); };
-function Deferred() {
- this.promise = new Promise(function(resolve, reject) {
- this.resolve = resolve;
- this.reject = reject;
- }.bind(this));
- Object.freeze(this);
-}
-
-var _pendingEmulatorCmdCount = 0;
-var _pendingEmulatorShellCmdCount = 0;
-
-/**
- * Send emulator command with safe guard.
- *
- * We should only call |finish()| after all emulator command transactions
- * end, so here comes with the pending counter. Resolve when the emulator
- * gives positive response, and reject otherwise.
- *
- * Fulfill params:
- * result -- an array of emulator response lines.
- * Reject params:
- * result -- an array of emulator response lines.
- *
- * @param aCommand
- * A string command to be passed to emulator through its telnet console.
- *
- * @return A deferred promise.
- */
-function runEmulatorCmdSafe(aCommand) {
- log("Emulator command: " + aCommand);
- let deferred = Promise.defer();
-
- ++_pendingEmulatorCmdCount;
- runEmulatorCmd(aCommand, function(aResult) {
- --_pendingEmulatorCmdCount;
-
- log("Emulator response: " + JSON.stringify(aResult));
- if (Array.isArray(aResult) &&
- aResult[aResult.length - 1] === "OK") {
- deferred.resolve(aResult);
- } else {
- deferred.reject(aResult);
- }
- });
-
- return deferred.promise;
-}
-
-/**
- * Send emulator shell command with safe guard.
- *
- * We should only call |finish()| after all emulator shell command transactions
- * end, so here comes with the pending counter. Resolve when the emulator
- * shell gives response. Never reject.
- *
- * Fulfill params:
- * result -- an array of emulator shell response lines.
- *
- * @param aCommands
- * A string array commands to be passed to emulator through adb shell.
- *
- * @return A deferred promise.
- */
-function runEmulatorShellCmdSafe(aCommands) {
- let deferred = Promise.defer();
-
- ++_pendingEmulatorShellCmdCount;
- runEmulatorShell(aCommands, function(aResult) {
- --_pendingEmulatorShellCmdCount;
-
- log("Emulator shell response: " + JSON.stringify(aResult));
- deferred.resolve(aResult);
- });
-
- return deferred.promise;
-}
-
-var workingFrame;
-
-/**
- * Get mozSettings value specified by @aKey.
- *
- * Resolve if that mozSettings value is retrieved successfully, reject
- * otherwise.
- *
- * Fulfill params:
- * The corresponding mozSettings value of the key.
- * Reject params: (none)
- *
- * @param aKey
- * A string.
- * @param aAllowError [optional]
- * A boolean value. If set to true, an error response won't be treated
- * as test failure. Default: false.
- *
- * @return A deferred promise.
- */
-function getSettings(aKey, aAllowError) {
- let request =
- workingFrame.contentWindow.navigator.mozSettings.createLock().get(aKey);
- return request.then(function resolve(aValue) {
- ok(true, "getSettings(" + aKey + ") - success");
- return aValue[aKey];
- }, function reject(aError) {
- ok(aAllowError, "getSettings(" + aKey + ") - error");
- });
-}
-
-/**
- * Set mozSettings values.
- *
- * Resolve if that mozSettings value is set successfully, reject otherwise.
- *
- * Fulfill params: (none)
- * Reject params: (none)
- *
- * @param aSettings
- * An object of format |{key1: value1, key2: value2, ...}|.
- * @param aAllowError [optional]
- * A boolean value. If set to true, an error response won't be treated
- * as test failure. Default: false.
- *
- * @return A deferred promise.
- */
-
-function setSettings(aSettings, aAllowError) {
- let lock = window.navigator.mozSettings.createLock();
- let request = lock.set(aSettings);
- let deferred = Promise.defer();
- lock.onsettingstransactionsuccess = function () {
- ok(true, "setSettings(" + JSON.stringify(aSettings) + ")");
- deferred.resolve();
- };
- lock.onsettingstransactionfailure = function (aEvent) {
- ok(aAllowError, "setSettings(" + JSON.stringify(aSettings) + ")");
- deferred.reject();
- };
- return deferred.promise;
-}
-
-/**
- * Set mozSettings value with only one key.
- *
- * Resolve if that mozSettings value is set successfully, reject otherwise.
- *
- * Fulfill params: (none)
- * Reject params: (none)
- *
- * @param aKey
- * A string key.
- * @param aValue
- * An object value.
- * @param aAllowError [optional]
- * A boolean value. If set to true, an error response won't be treated
- * as test failure. Default: false.
- *
- * @return A deferred promise.
- */
-function setSettings1(aKey, aValue, aAllowError) {
- let settings = {};
- settings[aKey] = aValue;
- return setSettings(settings, aAllowError);
-}
-
-/**
- * Convenient MozSettings getter for SETTINGS_KEY_DATA_ENABLED.
- */
-function getDataEnabled(aAllowError) {
- return getSettings(SETTINGS_KEY_DATA_ENABLED, aAllowError);
-}
-
-/**
- * Convenient MozSettings setter for SETTINGS_KEY_DATA_ENABLED.
- */
-function setDataEnabled(aEnabled, aAllowError) {
- return setSettings1(SETTINGS_KEY_DATA_ENABLED, aEnabled, aAllowError);
-}
-
-/**
- * Convenient MozSettings getter for SETTINGS_KEY_DATA_ROAMING_ENABLED.
- */
-function getDataRoamingEnabled(aAllowError) {
- return getSettings(SETTINGS_KEY_DATA_ROAMING_ENABLED, aAllowError);
-}
-
-/**
- * Convenient MozSettings setter for SETTINGS_KEY_DATA_ROAMING_ENABLED.
- */
-function setDataRoamingEnabled(aEnabled, aAllowError) {
- return setSettings1(SETTINGS_KEY_DATA_ROAMING_ENABLED, aEnabled, aAllowError);
-}
-
-/**
- * Convenient MozSettings getter for SETTINGS_KEY_DATA_APN_SETTINGS.
- */
-function getDataApnSettings(aAllowError) {
- return getSettings(SETTINGS_KEY_DATA_APN_SETTINGS, aAllowError);
-}
-
-/**
- * Convenient MozSettings setter for SETTINGS_KEY_DATA_APN_SETTINGS.
- */
-function setDataApnSettings(aApnSettings, aAllowError) {
- return setSettings1(SETTINGS_KEY_DATA_APN_SETTINGS, aApnSettings, aAllowError);
-}
-
-var mobileConnection;
-
-/**
- * Push required permissions and test if
- * |navigator.mozMobileConnections[<aServiceId>]| exists. Resolve if it does,
- * reject otherwise.
- *
- * Fulfill params:
- * mobileConnection -- an reference to navigator.mozMobileMessage.
- *
- * Reject params: (none)
- *
- * @param aAdditonalPermissions [optional]
- * An array of permission strings other than "mobileconnection" to be
- * pushed. Default: empty string.
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: 0.
- *
- * @return A deferred promise.
- */
-function ensureMobileConnection(aAdditionalPermissions, aServiceId) {
- let deferred = Promise.defer();
-
- aAdditionalPermissions = aAdditionalPermissions || [];
- aServiceId = aServiceId || 0;
-
- if (aAdditionalPermissions.indexOf("mobileconnection") < 0) {
- aAdditionalPermissions.push("mobileconnection");
- }
- let permissions = [];
- for (let perm of aAdditionalPermissions) {
- permissions.push({ "type": perm, "allow": 1, "context": document });
- }
-
- SpecialPowers.pushPermissions(permissions, function() {
- ok(true, "permissions pushed: " + JSON.stringify(permissions));
-
- // Permission changes can't change existing Navigator.prototype
- // objects, so grab our objects from a new Navigator.
- workingFrame = document.createElement("iframe");
- workingFrame.addEventListener("load", function load() {
- workingFrame.removeEventListener("load", load);
-
- mobileConnection =
- workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
-
- if (mobileConnection) {
- log("navigator.mozMobileConnections[" + aServiceId + "] is instance of " +
- mobileConnection.constructor);
- } else {
- log("navigator.mozMobileConnections[" + aServiceId + "] is undefined");
- }
-
- if (mobileConnection instanceof MozMobileConnection) {
- deferred.resolve(mobileConnection);
- } else {
- deferred.reject();
- }
- });
-
- document.body.appendChild(workingFrame);
- });
-
- return deferred.promise;
-}
-
-/**
- * Get MozMobileConnection by ServiceId
- *
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: the one indicated in
- * start*TestCommon() or 0 if not indicated.
- *
- * @return A MozMobileConnection.
- */
-function getMozMobileConnectionByServiceId(aServiceId) {
- let mobileConn = mobileConnection;
- if (aServiceId !== undefined) {
- mobileConn =
- workingFrame.contentWindow.navigator.mozMobileConnections[aServiceId];
- }
- return mobileConn;
-}
-
-/**
- * Get MozIccManager
- *
- * @return a MozIccManager
- */
-function getMozIccManager() {
- return workingFrame.contentWindow.navigator.mozIccManager;
-}
-
-/**
- * Get MozIcc by IccId
- *
- * @param aIccId [optional]
- * Default: The first item of |mozIccManager.iccIds|.
- *
- * @return A MozIcc.
- */
-function getMozIccByIccId(aIccId) {
- let iccManager = getMozIccManager();
-
- aIccId = aIccId || iccManager.iccIds[0];
- if (!aIccId) {
- ok(true, "iccManager.iccIds[0] is " + aIccId);
- return null;
- }
-
- return iccManager.getIccById(aIccId);
-}
-
-/**
- * Wait for one named event.
- *
- * Resolve if that named event occurs. Never reject.
- *
- * Fulfill params: the DOMEvent passed.
- *
- * @param aEventTarget
- * An EventTarget object.
- * @param aEventName
- * A string event name.
- * @param aMatchFun [optional]
- * A matching function returns true or false to filter the event.
- *
- * @return A deferred promise.
- */
-function waitForTargetEvent(aEventTarget, aEventName, aMatchFun) {
- let deferred = Promise.defer();
-
- aEventTarget.addEventListener(aEventName, function onevent(aEvent) {
- if (!aMatchFun || aMatchFun(aEvent)) {
- aEventTarget.removeEventListener(aEventName, onevent);
- ok(true, "Event '" + aEventName + "' got.");
- deferred.resolve(aEvent);
- }
- });
-
- return deferred.promise;
-}
-
-/**
- * Wait for one named MobileConnection event.
- *
- * Resolve if that named event occurs. Never reject.
- *
- * Fulfill params: the DOMEvent passed.
- *
- * @param aEventName
- * A string event name.
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: the one indicated in
- * start*TestCommon() or 0 if not indicated.
- * @param aMatchFun [optional]
- * A matching function returns true or false to filter the event.
- *
- * @return A deferred promise.
- */
-function waitForManagerEvent(aEventName, aServiceId, aMatchFun) {
- let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
- return waitForTargetEvent(mobileConn, aEventName, aMatchFun);
-}
-
-/**
- * Get available networks.
- *
- * Fulfill params:
- * An array of MozMobileNetworkInfo.
- * Reject params:
- * A DOMEvent.
- *
- * @return A deferred promise.
- */
-function getNetworks() {
- let request = mobileConnection.getNetworks();
- return request.then(() => request.result);
-}
-
-/**
- * Manually select a network.
- *
- * Fulfill params: (none)
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'
- *
- * @param aNetwork
- * A MozMobileNetworkInfo.
- *
- * @return A deferred promise.
- */
-function selectNetwork(aNetwork) {
- let request = mobileConnection.selectNetwork(aNetwork);
- return request.then(null, () => { throw request.error });
-}
-
-/**
- * Manually select a network and wait for a 'voicechange' event.
- *
- * Fulfill params: (none)
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'
- *
- * @param aNetwork
- * A MozMobileNetworkInfo.
- *
- * @return A deferred promise.
- */
-function selectNetworkAndWait(aNetwork) {
- let promises = [];
-
- promises.push(waitForManagerEvent("voicechange"));
- promises.push(selectNetwork(aNetwork));
-
- return Promise.all(promises);
-}
-
-/**
- * Automatically select a network.
- *
- * Fulfill params: (none)
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'
- *
- * @return A deferred promise.
- */
-function selectNetworkAutomatically() {
- let request = mobileConnection.selectNetworkAutomatically();
- return request.then(null, () => { throw request.error });
-}
-
-/**
- * Automatically select a network and wait for a 'voicechange' event.
- *
- * Fulfill params: (none)
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'
- *
- * @return A deferred promise.
- */
-function selectNetworkAutomaticallyAndWait() {
- let promises = [];
-
- promises.push(waitForManagerEvent("voicechange"));
- promises.push(selectNetworkAutomatically());
-
- return Promise.all(promises);
-}
-
-/**
- * Set roaming preference.
- *
- * Fulfill params: (none)
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'.
- *
- * @param aMode
- * 'home', 'affiliated', or 'any'.
- *
- * @return A deferred promise.
- */
- function setRoamingPreference(aMode) {
- let request = mobileConnection.setRoamingPreference(aMode);
- return request.then(null, () => { throw request.error });
-}
-
-/**
- * Set preferred network type.
- *
- * Fulfill params: (none)
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', 'ModeNotSupported' or
- * 'GenericFailure'.
- *
- * @param aType
- * 'wcdma/gsm', 'gsm', 'wcdma', 'wcdma/gsm-auto', 'cdma/evdo', 'cdma',
- * 'evdo', 'wcdma/gsm/cdma/evdo', 'lte/cdma/evdo', 'lte/wcdma/gsm',
- * 'lte/wcdma/gsm/cdma/evdo' or 'lte'.
- *
- * @return A deferred promise.
- */
- function setPreferredNetworkType(aType) {
- let request = mobileConnection.setPreferredNetworkType(aType);
- return request.then(null, () => { throw request.error });
-}
-
-/**
- * Query current preferred network type.
- *
- * Fulfill params:
- * 'wcdma/gsm', 'gsm', 'wcdma', 'wcdma/gsm-auto', 'cdma/evdo', 'cdma',
- * 'evdo', 'wcdma/gsm/cdma/evdo', 'lte/cdma/evdo', 'lte/wcdma/gsm',
- * 'lte/wcdma/gsm/cdma/evdo' or 'lte'.
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'.
- *
- * @return A deferred promise.
- */
- function getPreferredNetworkType() {
- let request = mobileConnection.getPreferredNetworkType();
- return request.then(() => request.result, () => { throw request.error });
-}
-
-/**
- * Configures call forward options.
- *
- * Fulfill params: (none)
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter', or
- * 'GenericFailure'.
- *
- * @param aOptions
- * A MozCallForwardingOptions.
- *
- * @return A deferred promise.
- */
- function setCallForwardingOption(aOptions) {
- let request = mobileConnection.setCallForwardingOption(aOptions);
- return request.then(null, () => { throw request.error });
-}
-
-/**
- * Configures call forward options.
- *
- * Fulfill params:
- * An array of MozCallForwardingOptions.
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter', or
- * 'GenericFailure'.
- *
- * @param aReason
- * One of MozMobileConnection.CALL_FORWARD_REASON_* values.
- *
- * @return A deferred promise.
- */
- function getCallForwardingOption(aReason) {
- let request = mobileConnection.getCallForwardingOption(aReason);
- return request.then(() => request.result, () => { throw request.error });
-}
-
-/**
- * Set voice privacy preference.
- *
- * Fulfill params: (none)
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'.
- *
- * @param aEnabled
- * Boolean indicates the preferred voice privacy mode.
- *
- * @return A deferred promise.
- */
- function setVoicePrivacyMode(aEnabled) {
- let request = mobileConnection.setVoicePrivacyMode(aEnabled);
- return request.then(null, () => { throw request.error });
-}
-
-/**
- * Query current voice privacy mode.
- *
- * Fulfill params:
- * A boolean indicates the current voice privacy mode.
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'.
- *
- * @return A deferred promise.
- */
- function getVoicePrivacyMode() {
- let request = mobileConnection.getVoicePrivacyMode();
- return request.then(() => request.result, () => { throw request.error });
-}
-
-/**
- * Configures call barring options.
- *
- * Fulfill params: (none)
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter' or
- * 'GenericFailure'.
- *
- * @return A deferred promise.
- */
- function setCallBarringOption(aOptions) {
- let request = mobileConnection.setCallBarringOption(aOptions);
- return request.then(null, () => { throw request.error });
-}
-
-/**
- * Queries current call barring status.
- *
- * Fulfill params:
- * An object contains call barring status.
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter' or
- * 'GenericFailure'.
- *
- * @return A deferred promise.
- */
- function getCallBarringOption(aOptions) {
- let request = mobileConnection.getCallBarringOption(aOptions);
- return request.then(() => request.result, () => { throw request.error });
-}
-
-/**
- * Change call barring facility password.
- *
- * Fulfill params: (none)
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'.
- *
- * @return A deferred promise.
- */
- function changeCallBarringPassword(aOptions) {
- let request = mobileConnection.changeCallBarringPassword(aOptions);
- return request.then(null, () => { throw request.error });
-}
-
-/**
- * Configures call waiting options.
- *
- * Fulfill params: (none)
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter' or
- * 'GenericFailure'.
- *
- * @return A deferred promise.
- */
- function setCallWaitingOption(aEnabled) {
- let request = mobileConnection.setCallWaitingOption(aEnabled);
- return request.then(null, () => { throw request.error });
-}
-
-/**
- * Queries current call waiting status.
- *
- * Fulfill params:
- * A boolean indicating the call waiting status.
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', 'InvalidParameter' or
- * 'GenericFailure'.
- *
- * @return A deferred promise.
- */
- function getCallWaitingOption() {
- let request = mobileConnection.getCallWaitingOption();
- return request.then(() => request.result, () => { throw request.error });
-}
-
-/**
- * Set data connection enabling state and wait for "datachange" event.
- *
- * Resolve if data connection state changed to the expected one. Never reject.
- *
- * Fulfill params: (none)
- *
- * @param aEnabled
- * A boolean state.
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: the one indicated in
- * start*TestCommon() or 0 if not indicated.
- *
- * @return A deferred promise.
- */
-function setDataEnabledAndWait(aEnabled, aServiceId) {
- let deferred = Promise.defer();
-
- let promises = [];
- promises.push(waitForManagerEvent("datachange", aServiceId));
- promises.push(setDataEnabled(aEnabled));
- Promise.all(promises).then(function keepWaiting() {
- let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
- // To ignore some transient states, we only resolve that deferred promise
- // when the |connected| state equals to the expected one and never rejects.
- let connected = mobileConn.data.connected;
- if (connected == aEnabled) {
- deferred.resolve();
- return;
- }
-
- return waitForManagerEvent("datachange", aServiceId).then(keepWaiting);
- });
-
- return deferred.promise;
-}
-
-/**
- * Set radio enabling state.
- *
- * Resolve no matter the request succeeds or fails. Never reject.
- *
- * Fulfill params: (none)
- *
- * @param aEnabled
- * A boolean state.
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: the one indicated in
- * start*TestCommon() or 0 if not indicated.
- *
- * @return A deferred promise.
- */
-function setRadioEnabled(aEnabled, aServiceId) {
- let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
- let request = mobileConn.setRadioEnabled(aEnabled);
- return request.then(function onsuccess() {
- ok(true, "setRadioEnabled " + aEnabled + " on " + aServiceId + " success.");
- }, function onerror() {
- ok(false, "setRadioEnabled " + aEnabled + " on " + aServiceId + " " +
- request.error.name);
- });
-}
-
-/**
- * Set radio enabling state and wait for "radiostatechange" event.
- *
- * Resolve if radio state changed to the expected one. Never reject.
- *
- * Fulfill params: (none)
- *
- * @param aEnabled
- * A boolean state.
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: the one indicated in
- * start*TestCommon() or 0 if not indicated.
- *
- * @return A deferred promise.
- */
-function setRadioEnabledAndWait(aEnabled, aServiceId) {
- let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
-
- if (mobileConn.radioState === (aEnabled ? "enabled" : "disabled")) {
- return Promise.resolve();
- }
-
- let expectedSequence = aEnabled ? ["enabling", "enabled"] :
- ["disabling", "disabled"];
-
- let p1 = waitForManagerEvent("radiostatechange", aServiceId, function() {
- let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
- let expectedRadioState = expectedSequence.shift();
- is(mobileConn.radioState, expectedRadioState, "Check radio state");
- return expectedSequence.length === 0;
- });
-
- let p2 = setRadioEnabled(aEnabled, aServiceId);
-
- return Promise.all([p1, p2]);
-}
-
-/**
- * Set CLIR (calling line id restriction).
- *
- * Fulfill params: (none)
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'
- *
- * @param aMode
- * A short number.
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: the one indicated in
- * start*TestCommon() or 0 if not indicated.
- *
- * @return A deferred promise.
- */
-function setClir(aMode, aServiceId) {
- ok(true, "setClir(" + aMode + ", " + aServiceId + ")");
- let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
- let request = mobileConn.setCallingLineIdRestriction(aMode);
- return request.then(null, () => { throw request.error });
-}
-
-/**
- * Get CLIR (calling line id restriction).
- *
- * Fulfill params:
- * CLIR mode.
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'
- *
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: the one indicated in
- * start*TestCommon() or 0 if not indicated.
- *
- * @return A deferred promise.
- */
-function getClir(aServiceId) {
- ok(true, "getClir(" + aServiceId + ")");
- let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
- let request = mobileConn.getCallingLineIdRestriction();
- return request.then(() => request.result, () => { throw request.error });
-}
-
-/**
- * Set voice/data state and wait for state change.
- *
- * Fulfill params: (none)
- *
- * @param aWhich
- * "voice" or "data".
- * @param aState
- * "unregistered", "searching", "denied", "roaming", or "home".
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: the one indicated in
- * start*TestCommon() or 0 if not indicated.
- *
- * @return A deferred promise.
- */
-function setEmulatorVoiceDataStateAndWait(aWhich, aState, aServiceId) {
- let promises = [];
- promises.push(waitForManagerEvent(aWhich + "change", aServiceId));
-
- let cmd = "gsm " + aWhich + " " + aState;
- promises.push(runEmulatorCmdSafe(cmd));
- return Promise.all(promises);
-}
-
-/**
- * Set voice and data roaming emulation and wait for state change.
- *
- * Fulfill params: (none)
- *
- * @param aRoaming
- * A boolean state.
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: the one indicated in
- * start*TestCommon() or 0 if not indicated.
- *
- * @return A deferred promise.
- */
-function setEmulatorRoamingAndWait(aRoaming, aServiceId) {
- function doSetAndWait(aWhich, aRoaming, aServiceId) {
- let state = (aRoaming ? "roaming" : "home");
- return setEmulatorVoiceDataStateAndWait(aWhich, state, aServiceId)
- .then(() => {
- let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
- is(mobileConn[aWhich].roaming, aRoaming,
- aWhich + ".roaming")
- });
- }
-
- // Set voice registration state first and then data registration state.
- return doSetAndWait("voice", aRoaming, aServiceId)
- .then(() => doSetAndWait("data", aRoaming, aServiceId));
-}
-
-/**
- * Get GSM location emulation.
- *
- * Fulfill params:
- * { lac: <lac>, cid: <cid> }
- * Reject params:
- * result -- an array of emulator response lines.
- *
- * @return A deferred promise.
- */
-function getEmulatorGsmLocation() {
- let cmd = "gsm location";
- return runEmulatorCmdSafe(cmd)
- .then(function(aResults) {
- // lac: <lac>
- // ci: <cid>
- // OK
- is(aResults[0].substring(0,3), "lac", "lac output");
- is(aResults[1].substring(0,2), "ci", "ci output");
-
- let lac = parseInt(aResults[0].substring(5));
- let cid = parseInt(aResults[1].substring(4));
- return { lac: lac, cid: cid };
- });
-}
-
-/**
- * Set GSM location emulation.
- *
- * Fulfill params: (none)
- * Reject params: (none)
- *
- * @param aLac
- * @param aCid
- *
- * @return A deferred promise.
- */
-function setEmulatorGsmLocation(aLac, aCid) {
- let cmd = "gsm location " + aLac + " " + aCid;
- return runEmulatorCmdSafe(cmd);
-}
-
-/**
- * Set GSM location and wait for voice and/or data state change.
- *
- * Fulfill params: (none)
- *
- * @param aLac
- * @param aCid
- * @param aWaitVoice [optional]
- * A boolean value. Default true.
- * @param aWaitData [optional]
- * A boolean value. Default false.
- *
- * @return A deferred promise.
- */
-function setEmulatorGsmLocationAndWait(aLac, aCid,
- aWaitVoice = true, aWaitData = false) {
- let promises = [];
- if (aWaitVoice) {
- promises.push(waitForManagerEvent("voicechange"));
- }
- if (aWaitData) {
- promises.push(waitForManagerEvent("datachange"));
- }
- promises.push(setEmulatorGsmLocation(aLac, aCid));
- return Promise.all(promises);
-}
-
-/**
- * Get emulator operators info.
- *
- * Fulfill params:
- * An array of { longName: <string>, shortName: <string>, mccMnc: <string> }.
- * Reject params:
- * result -- an array of emulator response lines.
- *
- * @return A deferred promise.
- */
-function getEmulatorOperatorNames() {
- let cmd = "operator dumpall";
- return runEmulatorCmdSafe(cmd)
- .then(function(aResults) {
- let operators = [];
-
- for (let i = 0; i < aResults.length - 1; i++) {
- let names = aResults[i].split(',');
- operators.push({
- longName: names[0],
- shortName: names[1],
- mccMnc: names[2],
- });
- }
-
- ok(true, "emulator operators list: " + JSON.stringify(operators));
- return operators;
- });
-}
-
-/**
- * Set emulator operators info.
- *
- * Fulfill params: (none)
- * Reject params:
- * result -- an array of emulator response lines.
- *
- * @param aOperator
- * "home" or "roaming".
- * @param aLongName
- * A string.
- * @param aShortName
- * A string.
- * @param aMcc [optional]
- * A string.
- * @param aMnc [optional]
- * A string.
- *
- * @return A deferred promise.
- */
-function setEmulatorOperatorNames(aOperator, aLongName, aShortName, aMcc, aMnc) {
- const EMULATOR_OPERATORS = [ "home", "roaming" ];
-
- let index = EMULATOR_OPERATORS.indexOf(aOperator);
- if (index < 0) {
- throw "invalid operator";
- }
-
- let cmd = "operator set " + index + " " + aLongName + "," + aShortName;
- if (aMcc && aMnc) {
- cmd = cmd + "," + aMcc + aMnc;
- }
- return runEmulatorCmdSafe(cmd)
- .then(function(aResults) {
- let exp = "^" + aLongName + "," + aShortName + ",";
- if (aMcc && aMnc) {
- cmd = cmd + aMcc + aMnc;
- }
-
- let re = new RegExp(exp);
- ok(aResults[index].match(new RegExp(exp)),
- "Long/short name and/or mcc/mnc should be changed.");
- });
-}
-
-/**
- * Set emulator operators info and wait for voice and/or data state change.
- *
- * Fulfill params: (none)
- *
- * @param aOperator
- * "home" or "roaming".
- * @param aLongName
- * A string.
- * @param aShortName
- * A string.
- * @param aMcc [optional]
- * A string.
- * @param aMnc [optional]
- * A string.
- * @param aWaitVoice [optional]
- * A boolean value. Default true.
- * @param aWaitData [optional]
- * A boolean value. Default false.
- *
- * @return A deferred promise.
- */
-function setEmulatorOperatorNamesAndWait(aOperator, aLongName, aShortName,
- aMcc, aMnc,
- aWaitVoice = true, aWaitData = false) {
- let promises = [];
- if (aWaitVoice) {
- promises.push(waitForManagerEvent("voicechange"));
- }
- if (aWaitData) {
- promises.push(waitForManagerEvent("datachange"));
- }
- promises.push(setEmulatorOperatorNames(aOperator, aLongName, aShortName,
- aMcc, aMnc));
- return Promise.all(promises);
-}
-
-/**
- * Set GSM signal strength.
- *
- * Fulfill params: (none)
- * Reject params: (none)
- *
- * @param aRssi
- *
- * @return A deferred promise.
- */
-function setEmulatorGsmSignalStrength(aRssi) {
- let cmd = "gsm signal " + aRssi;
- return runEmulatorCmdSafe(cmd);
-}
-
-/**
- * Set emulator GSM signal strength and wait for voice and/or data state change.
- *
- * Fulfill params: (none)
- *
- * @param aRssi
- * @param aWaitVoice [optional]
- * A boolean value. Default true.
- * @param aWaitData [optional]
- * A boolean value. Default false.
- *
- * @return A deferred promise.
- */
-function setEmulatorGsmSignalStrengthAndWait(aRssi,
- aWaitVoice = true,
- aWaitData = false) {
- let promises = [];
- if (aWaitVoice) {
- promises.push(waitForManagerEvent("voicechange"));
- }
- if (aWaitData) {
- promises.push(waitForManagerEvent("datachange"));
- }
- promises.push(setEmulatorGsmSignalStrength(aRssi));
- return Promise.all(promises);
-}
-
-/**
- * Set LTE signal strength.
- *
- * Fulfill params: (none)
- * Reject params: (none)
- *
- * @param aRxlev
- * @param aRsrp
- * @param aRssnr
- *
- * @return A deferred promise.
- */
-function setEmulatorLteSignalStrength(aRxlev, aRsrp, aRssnr) {
- let cmd = "gsm lte_signal " + aRxlev + " " + aRsrp + " " + aRssnr;
- return runEmulatorCmdSafe(cmd);
-}
-
-/**
- * Set emulator LTE signal strength and wait for voice and/or data state change.
- *
- * Fulfill params: (none)
- *
- * @param aRxlev
- * @param aRsrp
- * @param aRssnr
- * @param aWaitVoice [optional]
- * A boolean value. Default true.
- * @param aWaitData [optional]
- * A boolean value. Default false.
- *
- * @return A deferred promise.
- */
-function setEmulatorLteSignalStrengthAndWait(aRxlev, aRsrp, aRssnr,
- aWaitVoice = true,
- aWaitData = false) {
- let promises = [];
- if (aWaitVoice) {
- promises.push(waitForManagerEvent("voicechange"));
- }
- if (aWaitData) {
- promises.push(waitForManagerEvent("datachange"));
- }
- promises.push(setEmulatorLteSignalStrength(aRxlev, aRsrp, aRssnr));
- return Promise.all(promises);
-}
-
-var _networkManager;
-
-/**
- * Get internal NetworkManager service.
- */
-function getNetworkManager() {
- if (!_networkManager) {
- _networkManager = Cc["@mozilla.org/network/manager;1"]
- .getService(Ci.nsINetworkManager);
- ok(_networkManager, "NetworkManager");
- }
-
- return _networkManager;
-}
-
-var _numOfRadioInterfaces;
-
-/*
- * Get number of radio interfaces. Default is 1 if preference is not set.
- */
-function getNumOfRadioInterfaces() {
- if (!_numOfRadioInterfaces) {
- try {
- _numOfRadioInterfaces = SpecialPowers.getIntPref("ril.numRadioInterfaces");
- } catch (ex) {
- _numOfRadioInterfaces = 1; // Pref not set.
- }
- }
-
- return _numOfRadioInterfaces;
-}
-
-/**
- * Wait for pending emulator transactions and call |finish()|.
- */
-function cleanUp() {
- // Use ok here so that we have at least one test run.
- ok(true, ":: CLEANING UP ::");
-
- waitFor(finish, function() {
- return _pendingEmulatorCmdCount === 0 &&
- _pendingEmulatorShellCmdCount === 0;
- });
-}
-
-/**
- * Basic test routine helper for mobile connection tests.
- *
- * This helper does nothing but clean-ups.
- *
- * @param aTestCaseMain
- * A function that takes no parameter.
- */
-function startTestBase(aTestCaseMain) {
- // Turn on debugging pref.
- let debugPref = SpecialPowers.getBoolPref(PREF_KEY_RIL_DEBUGGING_ENABLED);
- SpecialPowers.setBoolPref(PREF_KEY_RIL_DEBUGGING_ENABLED, true);
-
- return Promise.resolve()
- .then(aTestCaseMain)
- .catch((aError) => {
- ok(false, "promise rejects during test: " + aError);
- })
- .then(() => {
- // Restore debugging pref.
- SpecialPowers.setBoolPref(PREF_KEY_RIL_DEBUGGING_ENABLED, debugPref);
- cleanUp();
- })
-}
-
-/**
- * Common test routine helper for mobile connection tests.
- *
- * This function ensures global |mobileConnection| variable is available during
- * the process and performs clean-ups as well.
- *
- * @param aTestCaseMain
- * A function that takes one parameter -- mobileConnection.
- * @param aAdditonalPermissions [optional]
- * An array of permission strings other than "mobileconnection" to be
- * pushed. Default: empty string.
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: 0.
- */
-function startTestCommon(aTestCaseMain, aAdditionalPermissions, aServiceId) {
- startTestBase(function() {
- return ensureMobileConnection(aAdditionalPermissions, aServiceId)
- .then(aTestCaseMain);
- });
-}
-
-/**
- * Common test routine helper for multi-sim mobile connection tests. The test
- * ends immediately if the device tested is not multi-sim.
- *
- * This function ensures global |mobileConnection| variable is available during
- * the process and performs clean-ups as well.
- *
- * @param aTestCaseMain
- * A function that takes one parameter -- mobileConnection.
- * @param aAdditonalPermissions [optional]
- * An array of permission strings other than "mobileconnection" to be
- * pushed. Default: empty string.
- * @param aServiceId [optional]
- * A numeric DSDS service id. Default: 0.
- */
-function startDSDSTestCommon(aTestCaseMain, aAdditionalPermissions, aServiceId) {
- if (getNumOfRadioInterfaces() > 1) {
- startTestBase(function() {
- return ensureMobileConnection(aAdditionalPermissions, aServiceId)
- .then(aTestCaseMain);
- });
- } else {
- log("Skipping DSDS tests on single SIM device.")
- ok(true); // We should run at least one test.
- cleanUp();
- }
-}
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/head_chrome.js
+++ /dev/null
@@ -1,144 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_CONTEXT = "chrome";
-
-var XPCOMUtils = Cu.import("resource://gre/modules/XPCOMUtils.jsm").XPCOMUtils;
-var Promise = Cu.import("resource://gre/modules/Promise.jsm").Promise;
-
-var mobileConnectionService =
- Cc["@mozilla.org/mobileconnection/gonkmobileconnectionservice;1"]
- .getService(Ci.nsIMobileConnectionService);
-ok(mobileConnectionService,
- "mobileConnectionService.constructor is " + mobileConnectionService.constructor);
-
-var _pendingEmulatorShellCmdCount = 0;
-
-/**
- * Send emulator shell command with safe guard.
- *
- * We should only call |finish()| after all emulator shell command transactions
- * end, so here comes with the pending counter. Resolve when the emulator
- * shell gives response. Never reject.
- *
- * Fulfill params:
- * result -- an array of emulator shell response lines.
- *
- * @param aCommands
- * A string array commands to be passed to emulator through adb shell.
- *
- * @return A deferred promise.
- */
-function runEmulatorShellCmdSafe(aCommands) {
- return new Promise(function(aResolve, aReject) {
- ++_pendingEmulatorShellCmdCount;
- runEmulatorShell(aCommands, function(aResult) {
- --_pendingEmulatorShellCmdCount;
-
- ok(true, "Emulator shell response: " + JSON.stringify(aResult));
- aResolve(aResult);
- });
- });
-}
-
-/**
- * Get nsIMobileConnection by clientId
- *
- * @param aClient [optional]
- * A numeric DSDS client id. Default: 0.
- *
- * @return A nsIMobileConnection.
- */
-function getMobileConnection(aClientId = 0) {
- let mobileConnection = mobileConnectionService.getItemByServiceId(0);
- ok(mobileConnection,
- "mobileConnection.constructor is " + mobileConnection.constructor);
- return mobileConnection;
-}
-
-/**
- * Get Neighboring Cell Ids.
- *
- * Fulfill params:
- * An array of nsINeighboringCellInfo.
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'
- *
- * @param aClient [optional]
- * A numeric DSDS client id. Default: 0.
- *
- * @return A deferred promise.
- */
-function getNeighboringCellIds(aClientId = 0) {
- let mobileConnection = getMobileConnection(aClientId);
- return new Promise(function(aResolve, aReject) {
- ok(true, "getNeighboringCellIds");
- mobileConnection.getNeighboringCellIds({
- QueryInterface: XPCOMUtils.generateQI([Ci.nsINeighboringCellIdsCallback]),
- notifyGetNeighboringCellIds: function(aCount, aResults) {
- aResolve(aResults);
- },
- notifyGetNeighboringCellIdsFailed: function(aErrorMsg) {
- aReject(aErrorMsg);
- },
- });
- });
-}
-
-/**
- * Get Cell Info List.
- *
- * Fulfill params:
- * An array of nsICellInfo.
- * Reject params:
- * 'RadioNotAvailable', 'RequestNotSupported', or 'GenericFailure'
- *
- * @param aClient [optional]
- * A numeric DSDS client id. Default: 0.
- *
- * @return A deferred promise.
- */
-function getCellInfoList(aClientId = 0) {
- let mobileConnection = getMobileConnection(aClientId);
- return new Promise(function(aResolve, aReject) {
- ok(true, "getCellInfoList");
- mobileConnection.getCellInfoList({
- QueryInterface: XPCOMUtils.generateQI([Ci.nsICellInfoListCallback]),
- notifyGetCellInfoList: function(aCount, aResults) {
- aResolve(aResults);
- },
- notifyGetCellInfoListFailed: function(aErrorMsg) {
- aReject(aErrorMsg);
- },
- });
- });
-}
-
-/**
- * Wait for pending emulator transactions and call |finish()|.
- */
-function cleanUp() {
- // Use ok here so that we have at least one test run.
- ok(true, ":: CLEANING UP ::");
-
- waitFor(finish, function() {
- return _pendingEmulatorShellCmdCount === 0;
- });
-}
-
-/**
- * Basic test routine helper.
- *
- * This helper does nothing but clean-ups.
- *
- * @param aTestCaseMain
- * A function that takes no parameter.
- */
-function startTestBase(aTestCaseMain) {
- return Promise.resolve()
- .then(aTestCaseMain)
- .catch((aException) => {
- ok(false, "promise rejects during test: " + aException);
- })
- .then(cleanUp);
-}
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/manifest.ini
+++ /dev/null
@@ -1,38 +0,0 @@
-[DEFAULT]
-run-if = buildapp == 'b2g'
-
-[test_mobile_networks.js]
-[test_mobile_voice_state.js]
-[test_mobile_voice_location.js]
-[test_mobile_operator_names.js]
-[test_mobile_operator_names_plmnlist.js]
-skip-if = true # Bug 1234746
-[test_mobile_operator_names_roaming.js]
-[test_mobile_preferred_network_type.js]
-[test_mobile_preferred_network_type_radio_off.js]
-[test_mobile_data_connection.js]
-[test_mobile_data_location.js]
-[test_mobile_data_state.js]
-[test_mobile_roaming_preference.js]
-[test_call_barring_basic_operations.js]
-[test_call_barring_get_error.js]
-[test_call_barring_set_error.js]
-[test_call_barring_change_password.js]
-[test_call_waiting.js]
-[test_mobile_set_radio.js]
-[test_mobile_last_known_network.js]
-[test_mobile_icc_change.js]
-[test_mobile_connections_array_uninitialized.js]
-[test_mobile_signal_strength.js]
-[test_mobile_data_ipv6.js]
-[test_mobile_supported_network_types.js]
-[test_mobile_call_forwarding.js]
-[test_mobile_call_forwarding_set_error.js]
-[test_mobile_call_forwarding_get_error.js]
-[test_mobile_voice_privacy.js]
-[test_dsds_mobile_data_connection.js]
-[test_mobile_clir.js]
-[test_mobile_clir_radio_off.js]
-[test_mobile_neighboring_cell_ids.js]
-[test_mobile_cell_Info_list.js]
-skip-if = android_version < '19'
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_call_barring_basic_operations.js
+++ /dev/null
@@ -1,130 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const AO = MozMobileConnection.CALL_BARRING_PROGRAM_ALL_OUTGOING;
-const OI = MozMobileConnection.CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL;
-const OX = MozMobileConnection.CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME;
-var outgoingPrograms = [null, AO, OI, OX];
-
-const AI = MozMobileConnection.CALL_BARRING_PROGRAM_ALL_INCOMING;
-const IR = MozMobileConnection.CALL_BARRING_PROGRAM_INCOMING_ROAMING;
-var incomingPrograms = [null, AI, IR];
-
-const SERVICE_CLASS_VOICE = MozMobileConnection.ICC_SERVICE_CLASS_VOICE;
-
-function getProgram(aProgram, aEnabled) {
- if (aProgram === null) {
- return Promise.resolve();
- }
-
- return Promise.resolve()
- .then(() => getCallBarringOption({
- program: aProgram,
- serviceClass: SERVICE_CLASS_VOICE
- }))
-
- .then(result => {
- is(result.program, aProgram, "Program");
- is(result.enabled, aEnabled, "Enabled");
- is(result.serviceClass, SERVICE_CLASS_VOICE, "ServiceClass");
- });
-}
-
-function setProgram(aProgram, aEnabled) {
- if (aProgram === null) {
- return Promise.resolve();
- }
-
- return Promise.resolve()
- .then(() => setCallBarringOption({
- program: aProgram,
- serviceClass: SERVICE_CLASS_VOICE,
- enabled: aEnabled,
- password: "0000" // The dafault call barring password of the emulator
- }));
-}
-
-function setAndCheckProgram(aActiveProgram, aAllPrograms) {
- let promise = Promise.resolve();
-
- if (aActiveProgram !== null) {
- promise = promise.then(() => setProgram(aActiveProgram, true));
- } else {
- // Deactive all barring programs in |aAllPrograms|.
- promise = aAllPrograms.reduce((previousPromise, program) => {
- return previousPromise.then(() => setProgram(program, false));
- }, promise);
- }
-
- // Make sure |aActiveProgram| is the only active program in |aAllPrograms|.
- promise = aAllPrograms.reduce((previousPromise, program) => {
- return previousPromise.then(() => getProgram(program, program === aActiveProgram));
- }, promise);
-
- return promise;
-}
-
-function testSingleProgram(aOriginProgram, aTargetPrograms, aOriginPrograms) {
- let promise = setAndCheckProgram(aOriginProgram, aOriginPrograms);
-
- return aTargetPrograms.reduce((previousPromise, targetProgram) => {
- return previousPromise
- .then(() => log(aOriginProgram + " <-> " + targetProgram))
- .then(() => setAndCheckProgram(targetProgram, aOriginPrograms))
- .then(() => setAndCheckProgram(aOriginProgram, aOriginPrograms));
- }, promise);
-}
-
-function testAllPrograms(aPrograms) {
- let targetPrograms = aPrograms.slice();
-
- return aPrograms.reduce((previousPromise, program) => {
- return previousPromise
- .then(() => {
- targetPrograms.shift();
- return testSingleProgram(program, targetPrograms, aPrograms);
- });
- }, Promise.resolve());
-}
-
-function testUnsupportedPrograms() {
- // Emulator now doesn't support these three programs.
- let unsupportedPrograms =
- [MozMobileConnection.CALL_BARRING_PROGRAM_ALL_SERVICE,
- MozMobileConnection.CALL_BARRING_PROGRAM_OUTGOING_SERVICE,
- MozMobileConnection.CALL_BARRING_PROGRAM_INCOMING_SERVICE];
-
- return unsupportedPrograms.reduce((previousPromise, program) => {
- return previousPromise
- .then(() => log("Test " + program))
- .then(() => setProgram(program, false))
- .then(() => {
- ok(false, "Should be rejected");
- }, error => {
- is(error.name, "RequestNotSupported",
- "Failed to setProgram: "+ error.name);
- });
- }, Promise.resolve());
-}
-
-// Start tests
-startTestCommon(function() {
- return Promise.resolve()
- .then(() => setAndCheckProgram(null, outgoingPrograms))
- .then(() => setAndCheckProgram(null, incomingPrograms))
-
- .then(() => log("=== Test outgoing call barring programs ==="))
- .then(() => testAllPrograms(outgoingPrograms))
- .then(() => log("=== Test incoming call barring programs ==="))
- .then(() => testAllPrograms(incomingPrograms))
-
- .then(() => log("=== Test unsupported call barring programs ==="))
- .then(() => testUnsupportedPrograms())
-
- .catch(aError => ok(false, "promise rejects during test: " + aError))
- .then(() => setAndCheckProgram(null, outgoingPrograms))
- .then(() => setAndCheckProgram(null, incomingPrograms));
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_call_barring_change_password.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function testChangeCallBarringPassword(aExpectedError, aOptions) {
- log("Test changing call barring password from " +
- aOptions.pin + " to " + aOptions.newPin);
-
- return changeCallBarringPassword(aOptions)
- .then(function resolve() {
- ok(!aExpectedError, "changeCallBarringPassword success");
- }, function reject(aError) {
- is(aError.name, aExpectedError, "failed to changeCallBarringPassword");
- });
-}
-
-// Start tests
-startTestCommon(function() {
- return Promise.resolve()
-
- // According to TS.22.004 clause 5.2, the password should consist of four
- // digits in the range 0000 to 9999.
-
- // Test passing an invalid pin.
- .then(() => testChangeCallBarringPassword("InvalidPassword", {
- pin: null,
- newPin: "0000"
- }))
-
- .then(() => testChangeCallBarringPassword("InvalidPassword", {
- pin: "000",
- newPin: "0000"
- }))
-
- .then(() => testChangeCallBarringPassword("InvalidPassword", {
- pin: "00000",
- newPin: "0000"
- }))
-
- .then(() => testChangeCallBarringPassword("InvalidPassword", {
- pin: "abcd",
- newPin: "0000"
- }))
-
- // Test passing an invalid newPin
- .then(() => testChangeCallBarringPassword("InvalidPassword", {
- pin: "0000",
- newPin: null
- }))
-
- .then(() => testChangeCallBarringPassword("InvalidPassword", {
- pin: "0000",
- newPin: "000"
- }))
-
- .then(() => testChangeCallBarringPassword("InvalidPassword", {
- pin: "0000",
- newPin: "00000"
- }))
-
- .then(() => testChangeCallBarringPassword("InvalidPassword", {
- pin: "0000",
- newPin: "abcd"
- }))
-
- // Test passing an incorrect password, where the default password is "0000".
- .then(() => testChangeCallBarringPassword("IncorrectPassword", {
- pin: "1111",
- newPin: "2222"
- }))
-
- // Sucessful
- .then(() => testChangeCallBarringPassword(null, {
- pin: "0000",
- newPin: "2222"
- }))
-
- .then(() => testChangeCallBarringPassword(null, {
- pin: "2222",
- newPin: "0000"
- }));
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_call_barring_get_error.js
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function testGetCallBarringOption(aExpectedError, aOptions) {
- log("Test getCallBarringOption with " + JSON.stringify(aOptions));
-
- return getCallBarringOption(aOptions)
- .then(function resolve(aResult) {
- ok(false, "should be rejected");
- }, function reject(aError) {
- is(aError.name, aExpectedError, "failed to getCallBarringOption");
- });
-}
-
-// Start tests
-startTestCommon(function() {
- return Promise.resolve()
-
- // Test program
- .then(() => testGetCallBarringOption("InvalidParameter", {
- program: 8, /* Invalid program */
- serviceClass: 0
- }))
-
- .then(() => testGetCallBarringOption("InvalidParameter", {
- program: null, /* Invalid program */
- serviceClass: 0
- }))
-
- .then(() => testGetCallBarringOption("InvalidParameter", {
- /* Undefined program */
- serviceClass: 0
- }))
-
- // Test serviceClass
- .then(() => testGetCallBarringOption("InvalidParameter", {
- program: MozMobileConnection.CALL_BARRING_PROGRAM_ALL_OUTGOING,
- serviceClass: null /* Invalid serviceClass */
- }))
-
- .then(() => testGetCallBarringOption("InvalidParameter", {
- program: MozMobileConnection.CALL_BARRING_PROGRAM_ALL_OUTGOING,
- /* Undefined serviceClass */
- }));
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_call_barring_set_error.js
+++ /dev/null
@@ -1,95 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function testSetCallBarringOption(aExpectedError, aOptions) {
- log("Test setCallBarringOption with " + JSON.stringify(aOptions));
-
- return setCallBarringOption(aOptions)
- .then(function resolve() {
- ok(false, "should be rejected");
- }, function reject(aError) {
- is(aError.name, aExpectedError, "failed to changeCallBarringPassword");
- });
-}
-
-// Start tests
-startTestCommon(function() {
- return Promise.resolve()
-
- // Test program
- .then(() => testSetCallBarringOption("InvalidParameter", {
- "program": 8, /* Invalid program */
- "enabled": true,
- "password": "0000",
- "serviceClass": 0
- }))
-
- .then(() => testSetCallBarringOption("InvalidParameter", {
- "program": null,
- "enabled": true,
- "password": "0000",
- "serviceClass": 0
- }))
-
- .then(() => testSetCallBarringOption("InvalidParameter", {
- /* Undefined program */
- "enabled": true,
- "password": "0000",
- "serviceClass": 0
- }))
-
- // Test enabled
- .then(() => testSetCallBarringOption("InvalidParameter", {
- "program": MozMobileConnection.CALL_BARRING_PROGRAM_ALL_OUTGOING,
- "enabled": null, /* Invalid enabled */
- "password": "0000",
- "serviceClass": 0
- }))
-
- .then(() => testSetCallBarringOption("InvalidParameter", {
- "program": MozMobileConnection.CALL_BARRING_PROGRAM_ALL_OUTGOING,
- /* Undefined enabled */
- "password": "0000",
- "serviceClass": 0
- }))
-
- // Test password
- .then(() => testSetCallBarringOption("InvalidParameter", {
- "program": MozMobileConnection.CALL_BARRING_PROGRAM_ALL_OUTGOING,
- "enabled": true,
- "password": null, /* Invalid password */
- "serviceClass": 0
- }))
-
- .then(() => testSetCallBarringOption("InvalidParameter", {
- "program": MozMobileConnection.CALL_BARRING_PROGRAM_ALL_OUTGOING,
- "enabled": true,
- /* Undefined password */
- "serviceClass": 0
- }))
-
- .then(() => testSetCallBarringOption("IncorrectPassword", {
- "program": MozMobileConnection.CALL_BARRING_PROGRAM_ALL_OUTGOING,
- "enabled": true,
- "password": "1111", /* Incorrect password */
- "serviceClass": 0
- }))
-
- // Test serviceClass
- .then(() => testSetCallBarringOption("InvalidParameter", {
- "program": MozMobileConnection.CALL_BARRING_PROGRAM_ALL_OUTGOING,
- "enabled": true,
- "password": "0000",
- "serviceClass": null /* Invalid serviceClass */
- }))
-
- .then(() => testSetCallBarringOption("InvalidParameter", {
- "program": MozMobileConnection.CALL_BARRING_PROGRAM_ALL_OUTGOING,
- "enabled": true,
- "password": "0000",
- /* Undefined serviceClass */
- }))
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_call_waiting.js
+++ /dev/null
@@ -1,29 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-// Start tests
-startTestCommon(function() {
- return Promise.resolve()
- // TODO: Bug 1090811 - [B2G] support SET_CALL_WAITING and QUERY_CALL_WAITING
- // Currently emulator doesn't support RIL_REQUEST_QUERY_CALL_WAITING and
- // RIL_REQUEST_SET_CALL_WAITING, so we expect to get a 'RequestNotSupported'
- // error here.
- .then(() => setCallWaitingOption(true))
- .then(() => {
- ok(false, "setCallWaitingOption should not success");
- }, aError => {
- is(aError.name, "RequestNotSupported",
- "failed to setCallWaitingOption");
- })
-
- .then(() => getCallWaitingOption())
- .then(() => {
- ok(false, "getCallWaitingOption should not success");
- }, aError => {
- is(aError.name, "RequestNotSupported",
- "failed to getCallWaitingOption");
- });
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_dsds_mobile_data_connection.js
+++ /dev/null
@@ -1,154 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const SETTINGS_KEY_DATA_DEFAULT_ID = "ril.data.defaultServiceId";
-
-var connections;
-var numOfRadioInterfaces;
-var currentDataDefaultId = 0;
-
-function muxModem(id) {
- return runEmulatorCmdSafe("mux modem " + id);
-}
-
-function switchDataDefaultId(defaultId) {
- return Promise.resolve()
- .then(() => setSettings1(SETTINGS_KEY_DATA_DEFAULT_ID, defaultId))
- .then(() => {
- log("Data default id switched to: " + defaultId);
- currentDataDefaultId = defaultId;
- });
-}
-
-function setDataRoamingSettings(enableDataRoammingIds) {
- let dataRoamingSettings = [];
- for (let i = 0; i < numOfRadioInterfaces; i++) {
- dataRoamingSettings.push(false);
- }
-
- for (let i = 0; i < enableDataRoammingIds.length; i++) {
- log("Enable data roaming for id: " + enableDataRoammingIds[i]);
- dataRoamingSettings[enableDataRoammingIds[i]] = true;
- }
-
- return setDataRoamingEnabled(dataRoamingSettings);
-}
-
-function setApnSettings() {
- let apn = [{
- "carrier":"T-Mobile US",
- "apn":"epc.tmobile.com",
- "mmsc":"http://mms.msg.eng.t-mobile.com/mms/wapenc",
- "types":["default","supl","mms"]
- }];
-
- // Use the same APN for all sims for now.
- let apns = [];
- for (let i = 0; i < numOfRadioInterfaces; i++) {
- apns.push(apn);
- }
-
- return setDataApnSettings(apns);
-
-}
-
-function waitForDataState(clientId, connected) {
- let deferred = Promise.defer();
-
- let connection = connections[clientId];
- if (connection.data.connected === connected) {
- log("data connection for client " + clientId + " is now " +
- connection.data.connected);
- deferred.resolve();
- return;
- }
-
- return Promise.resolve()
- .then(() => waitForManagerEvent("datachange", clientId))
- .then(() => waitForDataState(clientId, connected));
-}
-
-function restoreTestEnvironment() {
- return Promise.resolve()
- .then(() => setEmulatorRoamingAndWait(false, currentDataDefaultId))
- .then(() => setDataRoamingSettings([]))
- .then(() => switchDataDefaultId(0))
- .then(() => muxModem(0));
-}
-
-function testEnableData() {
- log("Turn data on.");
-
- let connection = connections[currentDataDefaultId];
- is(connection.data.connected, false);
-
- return Promise.resolve()
- .then(() => setApnSettings())
- .then(() => setDataEnabledAndWait(true, currentDataDefaultId));
-}
-
-function testSwitchDefaultDataToSimTwo() {
- log("Switch data connection to sim 2.");
-
- is(currentDataDefaultId, 0);
- let connection = connections[currentDataDefaultId];
- is(connection.data.connected, true);
-
- return Promise.resolve()
- .then(() => switchDataDefaultId(1))
- .then(() => {
- is(currentDataDefaultId, 1);
- })
- .then(() => waitForDataState(currentDataDefaultId, true));
-}
-
-function testDisableDataRoamingWhileRoaming() {
- log("Disable data roaming setting while roaming.");
-
- let connection = connections[currentDataDefaultId];
- is(connection.data.connected, true);
- is(connection.data.roaming, false);
-
- return Promise.resolve()
- .then(() => setDataRoamingSettings([]))
- .then(() => muxModem(currentDataDefaultId))
- .then(() => setEmulatorRoamingAndWait(true, currentDataDefaultId))
- .then(() => waitForDataState(currentDataDefaultId, false));
-}
-
-function testEnableDataRoamingWhileRoaming() {
- log("Enable data roaming setting while roaming.");
-
- let connection = connections[currentDataDefaultId];
- is(connection.data.connected, false);
- is(connection.data.roaming, true);
-
- return Promise.resolve()
- .then(() => setDataRoamingSettings([currentDataDefaultId]))
- .then(() => waitForDataState(currentDataDefaultId, true));
-}
-
-function testDisableData() {
- log("Turn data off.");
-
- let connection = connections[currentDataDefaultId];
- is(connection.data.connected, true);
-
- return Promise.resolve()
- .then(() => setDataEnabledAndWait(false, currentDataDefaultId));
-}
-
-startDSDSTestCommon(function() {
- connections = workingFrame.contentWindow.navigator.mozMobileConnections;
- numOfRadioInterfaces = getNumOfRadioInterfaces();
-
- return testEnableData()
- .then(testSwitchDefaultDataToSimTwo)
- .then(testDisableDataRoamingWhileRoaming)
- .then(testEnableDataRoamingWhileRoaming)
- .then(testDisableData)
- .then(restoreTestEnvironment);
-}, ["settings-read", "settings-write", "settings-api-read", "settings-api-write"]);
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_call_forwarding.js
+++ /dev/null
@@ -1,104 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {
- action: MozMobileConnection.CALL_FORWARD_ACTION_REGISTRATION,
- reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
- number: "0912345678",
- timeSeconds: 5,
- // Currently gecko only support ICC_SERVICE_CLASS_VOICE.
- serviceClass: MozMobileConnection.ICC_SERVICE_CLASS_VOICE
- }, {
- action: MozMobileConnection.CALL_FORWARD_ACTION_ENABLE,
- reason: MozMobileConnection.CALL_FORWARD_REASON_NO_REPLY,
- number: "+886912345678",
- timeSeconds: 20,
- // Currently gecko only support ICC_SERVICE_CLASS_VOICE.
- serviceClass: MozMobileConnection.ICC_SERVICE_CLASS_VOICE
- }
-];
-
-function testSetCallForwardingOption(aOptions) {
- log("Test setting call forwarding to " + JSON.stringify(aOptions));
-
- let promises = [];
-
- // Check cfstatechange event.
- promises.push(waitForManagerEvent("cfstatechange").then(function(aEvent) {
- is(aEvent.action, aOptions.action, "check action");
- is(aEvent.reason, aOptions.reason, "check reason");
- is(aEvent.number, aOptions.number, "check number");
- is(aEvent.timeSeconds, aOptions.timeSeconds, "check timeSeconds");
- is(aEvent.serviceClass, aOptions.serviceClass, "check serviceClass");
- }));
- // Check DOMRequest's result.
- promises.push(setCallForwardingOption(aOptions).then(null, (aError) => {
- ok(false, "got '" + aError.name + "' error");
- }));
-
- return Promise.all(promises);
-}
-
-function testGetCallForwardingOption(aReason, aExpectedResult) {
- log("Test getting call forwarding for " + aReason);
-
- return getCallForwardingOption(aReason)
- .then(function resolve(aResults) {
- is(Array.isArray(aResults), true, "results should be an array");
-
- for (let i = 0; i < aResults.length; i++) {
- let result = aResults[i];
-
- // Only need to check the result containing the serviceClass that we are
- // interesting in.
- if (!(result.serviceClass & aExpectedResult.serviceClass)) {
- continue;
- }
-
- let expectedActive =
- aExpectedResult.action === MozMobileConnection.CALL_FORWARD_ACTION_ENABLE ||
- aExpectedResult.action === MozMobileConnection.CALL_FORWARD_ACTION_REGISTRATION;
- is(result.active, expectedActive, "check active");
- is(result.reason, aExpectedResult.reason, "check reason");
- is(result.number, aExpectedResult.number, "check number");
- is(result.timeSeconds, aExpectedResult.timeSeconds, "check timeSeconds");
- }
- }, function reject(aError) {
- ok(false, "got '" + aError.name + "' error");
- });
-}
-
-function clearAllCallForwardingSettings() {
- log("Clear all call forwarding settings");
-
- let promise = Promise.resolve();
- for (let reason = MozMobileConnection.CALL_FORWARD_REASON_UNCONDITIONAL;
- reason <= MozMobileConnection.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING;
- reason++) {
- let options = {
- reason: reason,
- action: MozMobileConnection.CALL_FORWARD_ACTION_ERASURE
- };
- promise =
- promise.then(() => setCallForwardingOption(options).then(null, () => {}));
- }
- return promise;
-}
-
-// Start tests
-startTestCommon(function() {
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => testSetCallForwardingOption(data))
- .then(() => testGetCallForwardingOption(data.reason, data));
- }
- // reset call forwarding settings.
- return promise.then(null, () => {})
- .then(() => clearAllCallForwardingSettings());
-});
-
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_call_forwarding_get_error.js
+++ /dev/null
@@ -1,45 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- // Currently emulator doesn't support CALL_FORWARD_REASON_ALL_CALL_FORWARDING
- // and CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING, so
- // we expect to get a 'GenericFailure' error here.
- {
- reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CALL_FORWARDING,
- errorMsg: "GenericFailure"
- }, {
- reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING,
- errorMsg: "GenericFailure"
- },
- // Test passing invalid reason
- {
- reason: 10 /* Invalid reason */,
- errorMsg: "InvalidParameter"
- }
-];
-
-function testGetCallForwardingOptionError(aReason, aErrorMsg) {
- log("Test getting call forwarding for " + aReason);
-
- return getCallForwardingOption(aReason)
- .then(function resolve() {
- ok(false, "getCallForwardingOption success");
- }, function reject(aError) {
- is(aError.name, aErrorMsg, "failed to getCallForwardingOption");
- });
-}
-
-// Start tests
-startTestCommon(function() {
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => testGetCallForwardingOptionError(data.reason,
- data.errorMsg));
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_call_forwarding_set_error.js
+++ /dev/null
@@ -1,74 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_NUMBER = "0912345678";
-const TEST_TIME_SECONDS = 5;
-const TEST_DATA = [
- // Currently emulator doesn't support CALL_FORWARD_REASON_ALL_CALL_FORWARDING
- // and CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING, so
- // we expect to get a 'GenericFailure' error here.
- {
- options: {
- action: MozMobileConnection.CALL_FORWARD_ACTION_DISABLE,
- reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CALL_FORWARDING,
- },
- errorMsg: "GenericFailure"
- }, {
- options: {
- action: MozMobileConnection.CALL_FORWARD_ACTION_ENABLE,
- reason: MozMobileConnection.CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING,
- },
- errorMsg: "GenericFailure"
- },
- // Test passing invalid action. We expect to get a 'InvalidParameter' error.
- {
- options: {
- // Set operation doesn't allow "query" action.
- action: MozMobileConnection.CALL_FORWARD_ACTION_QUERY_STATUS,
- reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
- },
- errorMsg: "InvalidParameter"
- }, {
- options: {
- action: 10 /* Invalid action */,
- reason: MozMobileConnection.CALL_FORWARD_REASON_MOBILE_BUSY,
- },
- errorMsg: "InvalidParameter"
- },
- // Test passing invalid reason. We expect to get a 'InvalidParameter' error.
- {
- options: {
- action: MozMobileConnection.CALL_FORWARD_ACTION_DISABLE,
- reason: 10 /*Invalid reason*/,
- },
- errorMsg: "InvalidParameter"
- }
-];
-
-function testSetCallForwardingOption(aOptions, aErrorMsg) {
- log("Test setting call forwarding to " + JSON.stringify(aOptions));
-
- aOptions.number = TEST_NUMBER;
- aOptions.timeSeconds = TEST_TIME_SECONDS;
-
- return setCallForwardingOption(aOptions)
- .then(function resolve() {
- ok(false, "setCallForwardingOption success");
- }, function reject(aError) {
- is(aError.name, aErrorMsg, "failed to setCallForwardingOption");
- });
-}
-
-// Start tests
-startTestCommon(function() {
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => testSetCallForwardingOption(data.options,
- data.errorMsg));
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_cell_Info_list.js
+++ /dev/null
@@ -1,25 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head_chrome.js";
-
-// Start test.
-startTestBase(function() {
- return getCellInfoList()
- .then((aResults) => {
- // Cell Info are hard-coded in hardware/ril/reference-ril/reference-ril.c.
- is(aResults.length, 1, "Check number of cell Info");
-
- let cell = aResults[0];
- is(cell.type, Ci.nsICellInfo.CELL_INFO_TYPE_GSM, "Check cell.type");
- is(cell.registered, true, "Check cell.registered");
-
- ok(cell instanceof Ci.nsIGsmCellInfo,
- "cell.constructor is " + cell.constructor);
-
- // The data hard-coded in hardware/ril/reference-ril/reference-ril.c
- // isn't correct (missing timeStampType), so we skip to check other
- // attributes first until we fix it.
- });
-});
\ No newline at end of file
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_clir.js
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function testSetCallingLineIdRestriction(aMode, aExpectedErrorMsg) {
- log("Test setting calling line id restriction mode to " + aMode);
-
- return setClir(aMode)
- .then(function resolve() {
- ok(!aExpectedErrorMsg, "setCallingLineIdRestriction success");
- }, function reject(aError) {
- is(aError.name, aExpectedErrorMsg,
- "failed to setCallingLineIdRestriction");
- });
-}
-
-// TODO: Bug 999374 - [B2G] [Emulator] support setClir and getClir.
-// Currently emulator doesn't support REQUEST_GET_CLIR, so we expect to
-// get a 'RequestNotSupported' error here.
-function testGetCallingLineIdRestriction() {
- log("Test getting calling line id restriction mode");
-
- return getClir()
- .then(function resolve() {
- ok(false, "getCallingLineIdRestriction should not success");
- }, function reject(aError) {
- is(aError.name, "RequestNotSupported",
- "failed to getCallingLineIdRestriction");
- });
-}
-
-// Start tests
-startTestCommon(function() {
- return Promise.resolve()
- // Test set calling line id restriction mode.
- // TODO: Bug 999374 - [B2G] [Emulator] support setClir and getClir.
- // Currently emulator doesn't support REQUEST_SET_CLIR, so we expect to get
- // a 'RequestNotSupported' error here.
- .then(() => testSetCallingLineIdRestriction(
- MozMobileConnection.CLIR_DEFAULT, "RequestNotSupported"))
- .then(() => testSetCallingLineIdRestriction(
- MozMobileConnection.CLIR_INVOCATION, "RequestNotSupported"))
- .then(() => testSetCallingLineIdRestriction(
- MozMobileConnection.CLIR_SUPPRESSION, "RequestNotSupported"))
-
- // Test passing an invalid mode.
- .then(() => testSetCallingLineIdRestriction(10 /* Invalid mode */,
- "InvalidParameter"))
-
- // Test get calling line id restriction mode.
- .then(() => testGetCallingLineIdRestriction());
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_clir_radio_off.js
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function testSetClirOnRadioOff(aMode) {
- log("testSetClirOnRadioOff (set to mode: " + aMode + ")");
- return Promise.resolve()
- .then(() => setClir(aMode))
- .then(() => {
- ok(false, "shouldn't resolve");
- }, (aError) => {
- is(aError.name, "RadioNotAvailable");
- });
-}
-
-function testGetClirOnRadioOff() {
- log("testGetClirOnRadioOff");
- return Promise.resolve()
- .then(() => getClir())
- .then(() => {
- ok(false, "shouldn't resolve");
- }, (aError) => {
- is(aError.name, "RadioNotAvailable");
- });
-}
-
-startTestCommon(function() {
- return setRadioEnabledAndWait(false)
- .then(() => testSetClirOnRadioOff(0))
- .then(() => testGetClirOnRadioOff())
- // Restore radio state.
- .then(() => setRadioEnabledAndWait(true),
- () => setRadioEnabledAndWait(true));
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_connections_array_uninitialized.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-startTestCommon(function() {
- let connections =
- workingFrame.contentWindow.navigator.mozMobileConnections;
-
- let num = getNumOfRadioInterfaces();
- is(connections.length, num, "ril.numRadioInterfaces");
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_data_connection.js
+++ /dev/null
@@ -1,111 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function checkOrWaitForDataState(connected) {
- if (mobileConnection.data.connected == connected) {
- log("data.connected is now " + mobileConnection.data.connected);
- return;
- }
-
- return waitForManagerEvent("datachange")
- .then(() => checkOrWaitForDataState(connected));
-}
-
-function verifyInitialState() {
- log("Verifying initial state.");
-
- // Data should be off and registration home before starting any test.
- return Promise.resolve()
- .then(function() {
- is(mobileConnection.voice.state, "registered", "voice.state");
- is(mobileConnection.data.state, "registered", "data.state");
- is(mobileConnection.voice.roaming, false, "voice.roaming");
- is(mobileConnection.data.roaming, false, "data.roaming");
- })
- .then(getDataEnabled)
- .then(function(aResult) {
- is(aResult, false, "Data must be off.")
- });
-}
-
-function testEnableData() {
- log("Turn data on.");
-
- return setDataEnabledAndWait(true);
-}
-
-function testUnregisterDataWhileDataEnabled() {
- log("Set data registration unregistered while data enabled.");
-
- // When data registration is unregistered, all data calls will be
- // automatically deactivated.
- return setEmulatorVoiceDataStateAndWait("data", "unregistered")
- .then(() => checkOrWaitForDataState(false));
-}
-
-function testRegisterDataWhileDataEnabled() {
- log("Set data registration home while data enabled.");
-
- // When data registration is registered, data call will be (re)activated by
- // gecko if ril.data.enabled is set to true.
- return setEmulatorVoiceDataStateAndWait("data", "home")
- .then(() => checkOrWaitForDataState(true));
-}
-
-function testDisableDataRoamingWhileRoaming() {
- log("Disable data roaming while roaming.");
-
- // After setting emulator state to roaming, data connection should be
- // disconnected due to data roaming setting set to off.
- return setEmulatorRoamingAndWait(true)
- .then(() => checkOrWaitForDataState(false));
-}
-
-function testEnableDataRoamingWhileRoaming() {
- log("Enable data roaming while roaming.");
-
- // Data should be re-connected as we enabled data roaming.
- return setDataRoamingEnabled(true)
- .then(() => checkOrWaitForDataState(true));
-}
-
-function testDisableData() {
- log("Turn data off.");
-
- return setDataEnabledAndWait(false);
-}
-
-startTestCommon(function() {
-
- let origApnSettings;
- return verifyInitialState()
- .then(() => getDataApnSettings())
- .then(value => {
- origApnSettings = value;
- })
- .then(() => {
- let apnSettings = [[{ "carrier": "T-Mobile US",
- "apn": "epc.tmobile.com",
- "mmsc": "http://mms.msg.eng.t-mobile.com/mms/wapenc",
- "types": ["default","supl","mms"] }]];
- return setDataApnSettings(apnSettings);
- })
- .then(() => testEnableData())
- .then(() => testUnregisterDataWhileDataEnabled())
- .then(() => testRegisterDataWhileDataEnabled())
- .then(() => testDisableDataRoamingWhileRoaming())
- .then(() => testEnableDataRoamingWhileRoaming())
- .then(() => testDisableData())
- // Restore test environment.
- .then(() => {
- if (origApnSettings) {
- return setDataApnSettings(origApnSettings);
- }
- })
- .then(() => setEmulatorRoamingAndWait(false))
- .then(() => setDataRoamingEnabled(false));
-
-}, ["settings-read", "settings-write", "settings-api-read", "settings-api-write"]);
\ No newline at end of file
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_data_ipv6.js
+++ /dev/null
@@ -1,130 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-/**
- * Test resulting IP address format with given APN settings.
- *
- * This test utility function performs following steps:
- *
- * 1) set "ril.data.apnSettings" to a given settings object,
- * 2) enable data connection and wait for a "datachange" event,
- * 3) check the IP address type of the active network info,
- * 4) disable data connection.
- *
- * Fulfill params: (none)
- * Reject params: (none)
- *
- * @param aApnSettings
- * An APN settings value.
- * @param aIsIPv6
- * A boolean value indicating whether we're expecting an IPv6 address.
- *
- * @return A deferred promise.
- */
-function doTest(aApnSettings, aHaveV4Address, aHaveV6Address) {
- return setDataApnSettings([])
- .then(() => setDataApnSettings(aApnSettings))
- .then(() => setDataEnabledAndWait(true))
- .then(function() {
- let nm = getNetworkManager();
- let networkInfo = nm.activeNetworkInfo;
- ok(networkInfo, "Active network info");
- log(" Interface: " + networkInfo.name);
-
- let ips = {}, prefixLengths = {};
- let num = networkInfo.getAddresses(ips, prefixLengths);
- log(" Num addresses: " + num);
- log(" Addresses: " + JSON.stringify(ips.value));
- log(" PrefixLengths: " + JSON.stringify(prefixLengths.value));
-
- if (aHaveV4Address) {
- ok(ips.value.reduce(function(aFound, aAddress) {
- return aFound || aAddress.indexOf(":") < 0;
- }, false), "IPv4 address");
- }
- if (aHaveV6Address) {
- ok(ips.value.reduce(function(aFound, aAddress) {
- return aFound || aAddress.indexOf(":") > 0;
- }, false), "IPv6 address");
- }
- })
- .then(() => setDataEnabledAndWait(false));
-}
-
-function doTestHome(aApnSettings, aProtocol) {
- log("Testing \"" + aProtocol + "\"@HOME... ");
-
- // aApnSettings is a double-array of per PDP context settings. The first
- // index is a DSDS service ID, and the second one is the index of pre-defined
- // PDP context settings of a specified radio interface. We use 0 for both as
- // default here.
- aApnSettings[0][0].protocol = aProtocol;
- delete aApnSettings[0][0].roaming_protocol;
-
- return doTest(aApnSettings,
- aProtocol === "IP" || aProtocol === "IPV4V6",
- aProtocol === "IPV4V6" || aProtocol === "IPV6");
-}
-
-function doTestRoaming(aApnSettings, aRoaminProtocol) {
- log("Testing \"" + aRoaminProtocol + "\"@ROMAING... ");
-
- // aApnSettings is a double-array of per PDP context settings. The first
- // index is a DSDS service ID, and the second one is the index of pre-defined
- // PDP context settings of a specified radio interface. We use 0 for both as
- // default here.
- delete aApnSettings[0][0].protocol;
- aApnSettings[0][0].roaming_protocol = aRoaminProtocol;
-
- return doTest(aApnSettings,
- aRoaminProtocol === "IP" || aRoaminProtocol === "IPV4V6",
- aRoaminProtocol === "IPV4V6" || aRoaminProtocol === "IPV6");
-}
-
-startTestCommon(function() {
- let origApnSettings;
-
- return setDataRoamingEnabled(true)
- .then(getDataApnSettings)
- .then(function(aResult) {
- // If already set, then save original APN settings.
- origApnSettings = JSON.parse(JSON.stringify(aResult));
- return aResult;
- }, function() {
- // Return our own default value.
- return [[{ "carrier": "T-Mobile US",
- "apn": "epc.tmobile.com",
- "mmsc": "http://mms.msg.eng.t-mobile.com/mms/wapenc",
- "types": ["default", "supl", "mms"] }]];
- })
-
- .then(function(aApnSettings) {
- return Promise.resolve()
-
- .then(() => doTestHome(aApnSettings, "NoSuchProtocol"))
- .then(() => doTestHome(aApnSettings, "IP"))
- // TODO: Bug 979137 - B2G Emulator: Support the IPV4V6
- //.then(() => doTestHome(aApnSettings, "IPV4V6"))
- .then(() => doTestHome(aApnSettings, "IPV6"))
-
- .then(() => setEmulatorRoamingAndWait(true))
-
- .then(() => doTestRoaming(aApnSettings, "NoSuchProtocol"))
- .then(() => doTestRoaming(aApnSettings, "IP"))
- // TODO: Bug 979137 - B2G Emulator: Support the IPV4V6
- //.then(() => doTestRoaming(aApnSettings, "IPV4V6"))
- .then(() => doTestRoaming(aApnSettings, "IPV6"))
-
- .then(() => setEmulatorRoamingAndWait(false));
- })
-
- .then(() => setDataRoamingEnabled(false))
- .then(function() {
- if (origApnSettings) {
- return setDataApnSettings(origApnSettings);
- }
- });
-}, ["settings-read", "settings-write", "settings-api-read", "settings-api-write"]);
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_data_location.js
+++ /dev/null
@@ -1,44 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function verifyDataCellLocationInfo(aLac, aCid) {
- let cell = mobileConnection.data.cell;
- ok(cell, "location available");
-
- is(cell.gsmLocationAreaCode, aLac, "data.cell.gsmLocationAreaCode");
- is(cell.gsmCellId, aCid, "data.cell.gsmCellId");
- is(cell.cdmaBaseStationId, -1, "data.cell.cdmaBaseStationId");
- is(cell.cdmaBaseStationLatitude, -2147483648,
- "data.cell.cdmaBaseStationLatitude");
- is(cell.cdmaBaseStationLongitude, -2147483648,
- "data.cell.cdmaBaseStationLongitude");
- is(cell.cdmaSystemId, -1, "data.cell.cdmaSystemId");
- is(cell.cdmaNetworkId, -1, "data.cell.cdmaNetworkId");
-}
-
-/* Test Data Cell Location Info Change */
-function testDataCellLocationUpdate(aLac, aCid) {
- // Set emulator's lac/cid and wait for 'ondatachange' event.
- log("Test cell location with lac=" + aLac + " and cid=" + aCid);
-
- return setEmulatorGsmLocationAndWait(aLac, aCid, false, true)
- .then(() => verifyDataCellLocationInfo(aLac, aCid));
-}
-
-startTestCommon(function() {
- return getEmulatorGsmLocation()
- .then(function(aResult) {
- log("Test initial data location info");
- verifyDataCellLocationInfo(aResult.lac, aResult.cid);
-
- return Promise.resolve()
- .then(() => testDataCellLocationUpdate(100, 100))
- .then(() => testDataCellLocationUpdate(2000, 2000))
-
- // Reset back to initial values.
- .then(() => testDataCellLocationUpdate(aResult.lac, aResult.cid));
- });
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_data_state.js
+++ /dev/null
@@ -1,142 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const INITIAL_STATES = {
- state: "registered",
- connected: false,
- emergencyCallsOnly: false,
- roaming: false,
- signalStrength: -99,
- relSignalStrength: 44,
-
- cell: {
- gsmLocationAreaCode: 0,
- gsmCellId: 0,
- cdmaBaseStationId: -1,
- cdmaBaseStationLatitude: -2147483648,
- cdmaBaseStationLongitude: -2147483648,
- cdmaSystemId: -1,
- cdmaNetworkId: -1,
- }
-};
-
-const TEST_DATA = [{
- // Test state becomes to "unregistered"
- state: "unregistered",
- expected: {
- state: "notSearching",
- connected: false,
- emergencyCallsOnly: true,
- roaming: false,
- signalStrength: null,
- relSignalStrength: null,
- cell: null
- }
- }, {
- // Test state becomes to "searching"
- state: "searching",
- expected: {
- state: "searching",
- connected: false,
- emergencyCallsOnly: true,
- roaming: false,
- signalStrength: null,
- relSignalStrength: null,
- cell: null
- }
- }, {
- // Test state becomes to "denied"
- state: "denied",
- expected: {
- state: "denied",
- connected: false,
- emergencyCallsOnly: true,
- roaming: false,
- signalStrength: null,
- relSignalStrength: null,
- cell: null
- }
- }, {
- // Test state becomes to "roaming"
- // Set emulator's data state to "roaming" won't change the operator's
- // long_name/short_name/mcc/mnc, so that the |data.roaming| will still
- // report false. Please see bug 787967.
- state: "roaming",
- expected: {
- state: "registered",
- connected: false,
- emergencyCallsOnly: false,
- roaming: false,
- signalStrength: -99,
- relSignalStrength: 44,
- cell: {
- gsmLocationAreaCode: 0,
- gsmCellId: 0
- }
- }
- }, {
- // Reset state to default value.
- state: "home",
- expected: {
- state: "registered",
- connected: false,
- emergencyCallsOnly: false,
- roaming: false,
- signalStrength: -99,
- relSignalStrength: 44,
- cell: {
- gsmLocationAreaCode: 0,
- gsmCellId: 0
- }
- }
- }
-];
-
-function compareTo(aPrefix, aFrom, aTo) {
- for (let field in aTo) {
- let fullName = aPrefix + field;
-
- let lhs = aFrom[field];
- let rhs = aTo[field];
- ok(true, "lhs=" + JSON.stringify(lhs) + ", rhs=" + JSON.stringify(rhs));
- if (typeof rhs !== "object") {
- is(lhs, rhs, fullName);
- } else if (rhs) {
- ok(lhs, fullName);
- compareTo(fullName + ".", lhs, rhs);
- } else {
- is(lhs, null, fullName);
- }
- }
-}
-
-function verifyDataInfo(aExpected) {
- compareTo("data.", mobileConnection.data, aExpected);
-}
-
-/* Test Data State Changed */
-function testDataStateUpdate(aNewState, aExpected) {
- log("Test data info with state='" + aNewState + "'");
-
- // Set emulator's lac/cid and wait for 'ondatachange' event.
- return setEmulatorVoiceDataStateAndWait("data", aNewState)
- .then(() => verifyDataInfo(aExpected));
-}
-
-startTestCommon(function() {
- log("Test initial data connection info");
-
- verifyDataInfo(INITIAL_STATES);
-
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let entry = TEST_DATA[i];
- promise =
- promise.then(testDataStateUpdate.bind(null, entry.state, entry.expected));
- }
-
- return promise;
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_icc_change.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-// The emulator's hard coded iccid value.
-const ICCID = "89014103211118510720";
-
-function setRadioEnabledAndWaitIccChange(aEnabled) {
- let promises = [];
- promises.push(waitForManagerEvent("iccchange"));
- promises.push(setRadioEnabled(aEnabled));
-
- return Promise.all(promises);
-}
-
-// Start tests
-startTestCommon(function() {
- is(mobileConnection.iccId, ICCID, "test initial iccId");
-
- return setRadioEnabledAndWaitIccChange(false)
- .then(() => {
- is(mobileConnection.iccId, null, "mobileConnection.iccId");
- })
-
- // Restore radio state.
- .then(() => setRadioEnabledAndWaitIccChange(true))
- .then(() => {
- is(mobileConnection.iccId, ICCID, "mobileConnection.iccId");
-
- // ICC object should be ready in mozIccManager.
- let icc = getMozIccByIccId(mobileConnection.iccId);
- ok(icc instanceof MozIcc, "icc should be an instance of MozIcc");
- is(icc.iccInfo.iccid, mobileConnection.iccId, "icc.iccInfo.iccid");
- });
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_last_known_network.js
+++ /dev/null
@@ -1,13 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-// Start tests
-startTestCommon(function() {
- // The emulator's hard coded operatoer's mcc and mnc codes.
- is(mobileConnection.lastKnownNetwork, "310-410");
- // The emulator's hard coded icc's mcc, mnc codes and spn.
- is(mobileConnection.lastKnownHomeNetwork, "310-410-Android");
-}, ["mobilenetwork"]);
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_neighboring_cell_ids.js
+++ /dev/null
@@ -1,18 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 30000;
-MARIONETTE_HEAD_JS = "head_chrome.js";
-
-// Start test.
-startTestBase(function() {
- // Emulator doesn't support REQUEST_GET_NEIGHBORING_CELL_IDS, so we expect to
- // get an 'RequestNotSupported' error here.
- return getNeighboringCellIds()
- .then(() => {
- ok(false, "should not success");
- }, (aErrorMsg) => {
- is(aErrorMsg, "RequestNotSupported",
- "Failed to getNeighboringCellIds: " + aErrorMsg);
- });
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_networks.js
+++ /dev/null
@@ -1,221 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-// getNetworks() can take some time..
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function isHomeNetwork(network) {
- is(network.longName, "Android");
- is(network.shortName, "Android");
- is(network.mcc, "310");
- is(network.mnc, "410");
-}
-
-function isRoamingNetwork(network) {
- is(network.longName, "TelKila");
- is(network.shortName, "TelKila");
- is(network.mcc, "310");
- is(network.mnc, "295");
-}
-
-function testConnectionInfo() {
- log("Validate initial states");
- let voice = mobileConnection.voice;
- is(voice.connected, true);
- is(voice.state, "registered");
- is(voice.emergencyCallsOnly, false);
- is(voice.roaming, false);
- isHomeNetwork(voice.network);
-
- let data = mobileConnection.data;
- // data.connected = true means there's an active data call which we
- // can't predict here.
- is(data.state, "registered");
- is(data.emergencyCallsOnly, false);
- is(data.roaming, false);
- isHomeNetwork(data.network);
-}
-
-function testGetNetworks() {
- log("Enumerating available networks");
- return getNetworks()
- .then(function resolve(aNetworks) {
- // The emulator RIL server should always return 2 networks:
- // {"longName":"Android","shortName":"Android","mcc":310,"mnc":410,"state":"available"}
- // {"longName":"TelKila","shortName":"TelKila","mcc":310,"mnc":295,"state":"available"}
- is(aNetworks.length, 2);
-
- let network1 = aNetworks[0];
- isHomeNetwork(network1);
- is(network1.state, "available");
-
- let network2 = aNetworks[1];
- isRoamingNetwork(network2);
- is(network2.state, "available");
-
- return aNetworks;
- });
-}
-
-function testSelectNetwork(aNetwork, aValidator) {
- log("Selecting network '" + aNetwork.longName + "' manually");
- isnot(aNetwork.longName, mobileConnection.voice.network.longName,
- "aNetwork.longName");
-
- return selectNetworkAndWait(aNetwork)
- .then(function() {
- is(mobileConnection.networkSelectionMode, "manual",
- "mobileConnection.networkSelectionMode");
- is(mobileConnection.voice.network.longName, aNetwork.longName,
- "mobileConnection.voice.network.longName");
-
- aValidator(mobileConnection.voice.network);
- });
-}
-
-function testSelectNetworkAutomatically(aHomeNetwork, aValidator) {
- log("Selecting network '" + aHomeNetwork.longName + "' automatically");
- isnot(aHomeNetwork.longName, mobileConnection.voice.network.longName,
- "aHomeNetwork.longName");
-
- return selectNetworkAutomaticallyAndWait()
- .then(function() {
- is(mobileConnection.networkSelectionMode, "automatic",
- "mobileConnection.networkSelectionMode");
- is(mobileConnection.voice.network.longName, aHomeNetwork.longName,
- "mobileConnection.voice.network.longName");
-
- aValidator(mobileConnection.voice.network);
- });
-}
-
-function throwsException(fn) {
- try {
- fn();
- ok(false, "function did not throw an exception: " + fn);
- } catch (e) {
- ok(true, "function successfully caught exception: " + e);
- }
-}
-
-function testSelectNetworkErrors(aNetworkToSelect, aAnotherNetwork) {
- throwsException(() => mobileConnection.selectNetwork(null));
- throwsException(() => mobileConnection.selectNetwork({}));
-
- isnot(aNetworkToSelect.longName, mobileConnection.voice.network.longName,
- "aNetworkToSelect.longName");
-
- let promises = [];
- promises.push(selectNetworkAndWait(aNetworkToSelect));
- // attempt to selectNetwork while one request has already been sent, we except
- // to get an error here.
- promises.push(selectNetwork(aAnotherNetwork)
- .then(function resolve() {
- ok(false, "should not success");
- }, function reject(aError) {
- is(aError.name, "AlreadySelectingANetwork", "got an error");
- }));
-
- return Promise.all(promises);
-}
-
-function testSelectExistingNetworkManual(aNetwork) {
- // When the current network is selected again, the DOMRequest's onsuccess
- // should be called, but the network shouldn't actually change
-
- log("Selecting '" + aNetwork.longName + "' manually (should already be selected)");
- is(aNetwork.longName, mobileConnection.voice.network.longName,
- "aNetwork.longName");
-
- function voiceChange() {
- let network = mobileConnection.voice.network;
- if (network.longName !== aNetwork.longName) {
- ok(false, "voicechange event emitted while selecting existing '" +
- aNetwork.longName + "' manually");
- }
- }
-
- mobileConnection.addEventListener("voicechange", voiceChange);
-
- return selectNetwork(aNetwork)
- .then(function resolve() {
- let deferred = Promise.defer();
-
- // Give the voicechange event another opportunity to fire
- setTimeout(function() {
- mobileConnection.removeEventListener("voicechange", voiceChange);
- deferred.resolve();
- }, 3000);
-
- return deferred.promise;
- }, function reject() {
- mobileConnection.removeEventListener("voicechange", voiceChange);
- ok(false, "selectNetwork fails");
- });
-}
-
-function testSelectExistingNetworkAuto(aHomeNetwork) {
- // Now try the same thing but using automatic selection
- log("Selecting '" + aHomeNetwork.longName + "' automatically (should already be selected)");
- is(aHomeNetwork.longName, mobileConnection.voice.network.longName,
- "aHomeNetwork.longName");
-
- function voiceChange() {
- let network = mobileConnection.voice.network;
- if (network.longName !== aHomeNetwork.longName) {
- ok(false, "voicechange event emitted while selecting existing '" +
- aHomeNetwork.longName + "' automatically");
- }
- }
-
- mobileConnection.addEventListener("voicechange", voiceChange);
-
- return selectNetworkAutomatically()
- .then(function resolve() {
- let deferred = Promise.defer();
-
- // Give the voicechange event another opportunity to fire
- setTimeout(function() {
- mobileConnection.removeEventListener("voicechange", voiceChange);
- deferred.resolve();
- }, 3000);
-
- return deferred.promise;
- }, function reject() {
- mobileConnection.removeEventListener("voicechange", voiceChange);
- ok(false, "selectNetwork fails");
- });
-}
-
-startTestCommon(function() {
- let promise = Promise.resolve();
- if (mobileConnection.networkSelectionMode != "automatic") {
- promise = promise.then(selectNetworkAutomatically);
- }
-
- return promise
- .then(() => testConnectionInfo())
- .then(() => testGetNetworks())
- .then(function(aNetworks) {
- let homeNetwork = aNetworks[0],
- roamingNetwork = aNetworks[1];
-
- // We're initially connected to home network, so let's connect to roaming
- // network first.
- return testSelectNetwork(roamingNetwork, isRoamingNetwork)
-
- // Then connect back to home network automatically.
- .then(() => testSelectNetworkAutomatically(homeNetwork, isHomeNetwork))
-
- // Then try connect to roaming network again.
- .then(() => testSelectNetworkErrors(roamingNetwork, homeNetwork))
-
- // Roaming network should has been selected, try select it again.
- .then(() => testSelectExistingNetworkManual(roamingNetwork))
-
- // Switch back to home network and try selecte it again.
- .then(() => selectNetworkAutomaticallyAndWait())
- .then(() => testSelectExistingNetworkAuto(homeNetwork));
- });
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_operator_names.js
+++ /dev/null
@@ -1,37 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function check(aLongName, aShortName) {
- let network = mobileConnection.voice.network;
-
- is(network.longName, aLongName, "network.longName");
- is(network.shortName, aShortName, "network.shortName");
- is(network.mcc, "310", "network.mcc");
- is(network.mnc, "410", "network.mnc");
-}
-
-function test(aLongName, aShortName) {
- log("Testing '" + aLongName + "', '" + aShortName + "':");
-
- return setEmulatorOperatorNamesAndWait("home", aLongName, aShortName,
- null, null, true, false)
- .then(() => check(aLongName, aShortName));
-}
-
-startTestCommon(function() {
- return getEmulatorOperatorNames()
- .then(function(aOperators) {
- return Promise.resolve()
-
- .then(() => test("Mozilla", "B2G"))
- .then(() => test("Mozilla", ""))
- .then(() => test("", "B2G"))
- .then(() => test("", ""))
-
- // Reset back to initial values.
- .then(() => test(aOperators[0].longName, aOperators[0].shortName));
- });
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_operator_names_plmnlist.js
+++ /dev/null
@@ -1,155 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_CELL_ID = 268435399; // The largest prime number that is smaller than
- // 0xFFFFFFF (DEC 268435455). The next one is
- // 268435459. This doesn't mean anything. ;)
- // See http://primes.utm.edu/lists/small/millions/
-
-function check(aLongName, aShortName, aMcc, aMnc, aLac, aCid) {
- let network = mobileConnection.voice.network;
- log(" Got longName '" + network.longName + "', shortName '" +
- network.shortName + "'");
-
- is(network.longName, aLongName, "network.longName");
- is(network.shortName, aShortName, "network.shortName");
- is(network.mcc, aMcc, "network.mcc");
- is(network.mnc, aMnc, "network.mnc");
-
- let cell = mobileConnection.voice.cell;
-
- is(cell.gsmLocationAreaCode, aLac, "cell.gsmLocationAreaCode");
- is(cell.gsmCellId, aCid, "cell.gsmCellId");
-}
-
-function test(aLongName, aShortName, aMcc, aMnc, aLac, aCid,
- aExpectedLongName, aExpectedShortName) {
- log("Testing mcc = " + aMcc + ", mnc = " + aMnc + ", lac = " + aLac + ":");
-
- return setEmulatorGsmLocationAndWait(aLac, aCid)
- .then(() => setEmulatorOperatorNamesAndWait("home", aLongName, aShortName,
- aMcc, aMnc, true, false))
- // aExpectedLongName, aExpectedShortName could be empty string.
- .then(() => check(aExpectedLongName == null ? aLongName : aExpectedLongName,
- aExpectedShortName == null ? aShortName : aExpectedShortName,
- aMcc, aMnc, aLac, aCid));
-}
-
-startTestCommon(function() {
- /**
- * In emulator we have pre-defined 7 EF_PNN (see 3GPP TS 31.102 clause 4.2.58)
- * sets:
- *
- * PNN 1: Full name: "Test1", Short name: "Test1"
- * PNN 2: Full name: "Test2", Short name: (none)
- * PNN 3: Full name: "Test3", Short name: (none)
- * PNN 4: Full name: "Test4", Short name: (none)
- * PNN 5: Full name: "Test5", Short name: (none)
- * PNN 6: Full name: "Test6", Short name: (none)
- * PNN 7: Full name: "Test7", Short name: (none)
- *
- * Also 7 EF_OPL (see 3GPP TS 31.102 clause 4.2.59) sets:
- *
- * MCC = 001, MNC = 01, START=0000, END=FFFE, PNN = 01,
- * MCC = 001, MNC = 02, START=0001, END=0010, PNN = 02,
- * MCC = 001, MNC = 03, START=0011, END=0011, PNN = 03,
- * MCC = 001, MNC = 001, START=0012, END=0012, PNN = 04,
- * MCC = 001, MNC = 1D, START=0000, END=FFFE, PNN = 05,
- * MCC = 001, MNC = 2DD, START=0000, END=FFFE, PNN = 06,
- * MCC = 001, MNC = DDD, START=0000, END=FFFE, PNN = 07,
- *
- * See https://github.com/mozilla-b2g/platform_external_qemu/blob/master/telephony/sim_card.c#L725
- */
- return getEmulatorOperatorNames()
- .then(function(aOperators) {
- let {longName: longName, shortName: shortName} = aOperators[0];
- let {mcc: mcc, mnc: mnc} = mobileConnection.voice.network;
- let {gsmLocationAreaCode: lac, gsmCellId: cid} = mobileConnection.voice.cell;
-
- // Use a cell ID that differs from current cid to ensure voicechange event
- // will be triggered.
- isnot(TEST_CELL_ID, cid, "A different test cell id than used currently.");
-
- // In following tests, we use different longName/shortName to ensure
- // network name is always re-calculated in RIL worker.
- return Promise.resolve()
-
- // If MCC/MNC doesn't match any, report given home network name.
- .then(() => test("Foo1", "Bar1", "123", "456", 0x0000, TEST_CELL_ID))
- .then(() => test("Foo2", "Bar2", "123", "456", 0x0001, TEST_CELL_ID))
- .then(() => test("Foo3", "Bar3", "123", "456", 0x0002, TEST_CELL_ID))
- .then(() => test("Foo4", "Bar4", "123", "456", 0x0010, TEST_CELL_ID))
- .then(() => test("Foo5", "Bar5", "123", "456", 0x0011, TEST_CELL_ID))
- .then(() => test("Foo6", "Bar6", "123", "456", 0xFFFE, TEST_CELL_ID))
-
- // Full ranged network. Report network name from PNN.
- .then(() => test("Foo1", "Bar1", "001", "01", 0x0000, TEST_CELL_ID,
- "Test1", "Test1"))
- .then(() => test("Foo2", "Bar2", "001", "01", 0x0001, TEST_CELL_ID,
- "Test1", "Test1"))
- .then(() => test("Foo3", "Bar3", "001", "01", 0xFFFE, TEST_CELL_ID,
- "Test1", "Test1"))
-
- // Ranged network. Report network name from PNN if lac is inside the
- // inclusive range 0x01..0x10.
- .then(() => test("Foo1", "Bar1", "001", "02", 0x0000, TEST_CELL_ID))
- .then(() => test("Foo2", "Bar2", "001", "02", 0x0001, TEST_CELL_ID,
- "Test2", ""))
- .then(() => test("Foo3", "Bar3", "001", "02", 0x0002, TEST_CELL_ID,
- "Test2", ""))
- .then(() => test("Foo4", "Bar4", "001", "02", 0x0010, TEST_CELL_ID,
- "Test2", ""))
- .then(() => test("Foo5", "Bar5", "001", "02", 0xFFFE, TEST_CELL_ID))
-
- // Single entry network. Report network name from PNN if lac matches.
- .then(() => test("Foo1", "Bar1", "001", "03", 0x0000, TEST_CELL_ID))
- .then(() => test("Foo2", "Bar2", "001", "03", 0x0011, TEST_CELL_ID,
- "Test3", ""))
- .then(() => test("Foo3", "Bar3", "001", "03", 0xFFFE, TEST_CELL_ID))
-
- // Test if we match MNC "01" and "001" correctly.
- .then(() => test("Foo1", "Bar1", "001", "001", 0x0012, TEST_CELL_ID,
- "Test4", ""))
-
- // Wild char test for MCC = 001, MNC = 1D cases.
- .then(() => test("Foo10", "Bar10", "001", "10", 0x0000, TEST_CELL_ID,
- "Test5", ""))
- .then(() => test("Foo11", "Bar11", "001", "11", 0x0001, TEST_CELL_ID,
- "Test5", ""))
- .then(() => test("Foo12", "Bar12", "001", "12", 0x0002, TEST_CELL_ID,
- "Test5", ""))
- .then(() => test("Foo13", "Bar13", "001", "13", 0x0003, TEST_CELL_ID,
- "Test5", ""))
- .then(() => test("Foo14", "Bar14", "001", "14", 0x0004, TEST_CELL_ID,
- "Test5", ""))
- .then(() => test("Foo15", "Bar15", "001", "15", 0x0005, TEST_CELL_ID,
- "Test5", ""))
- .then(() => test("Foo16", "Bar16", "001", "16", 0x0006, TEST_CELL_ID,
- "Test5", ""))
- .then(() => test("Foo17", "Bar17", "001", "17", 0x0007, TEST_CELL_ID,
- "Test5", ""))
- .then(() => test("Foo18", "Bar18", "001", "18", 0x0008, TEST_CELL_ID,
- "Test5", ""))
- .then(() => test("Foo19", "Bar19", "001", "19", 0x0009, TEST_CELL_ID,
- "Test5", ""))
- .then(() => test("Foo20", "Bar20", "001", "20", 0x000A, TEST_CELL_ID))
-
- // Wild chars test for MCC = 001, MNC = 2DD cases.
- .then(() => test("Foo0", "Bar0", "001", "200", 0x00C8, TEST_CELL_ID,
- "Test6", ""))
- .then(() => test("Foo1", "Bar1", "001", "299", 0x012B, TEST_CELL_ID,
- "Test6", ""))
-
- // Wild chars test for MCC = 001, MNC = DDD cases.
- .then(() => test("Foo300", "Bar300", "001", "300", 0x012C, TEST_CELL_ID,
- "Test7", ""))
- .then(() => test("Foo999", "Bar999", "001", "999", 0x03E7, TEST_CELL_ID,
- "Test7", ""))
-
- // Reset back to initial values.
- .then(() => test(longName, shortName, mcc, mnc, lac, cid));
- });
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_operator_names_roaming.js
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function check(aLongName, aShortName, aRoaming) {
- let voice = mobileConnection.voice;
- let network = voice.network;
-
- is(network.longName, aLongName, "network.longName");
- is(network.shortName, aShortName, "network.shortName");
- is(voice.roaming, aRoaming, "voice.roaming");
-}
-
-// See bug 797972 - B2G RIL: False roaming situation
-//
-// Steps to test:
-// 1. set roaming operator names
-// 2. set emulator roaming
-// 3. wait for onvoicechange event and test passing conditions
-// 4. set emulator roaming back to false
-// 5. wait for onvoicechange event again and callback
-function test(aLongName, aShortName, aRoaming) {
- log("Testing roaming check '" + aLongName + "', '" + aShortName + "':");
-
- return Promise.resolve()
-
- // We should not have voicechange here, but, yes, we do.
- .then(() => setEmulatorOperatorNamesAndWait("roaming", aLongName, aShortName,
- null, null, true, false))
-
- .then(() => setEmulatorVoiceDataStateAndWait("voice", "roaming"))
- .then(() => check(aLongName, aShortName, aRoaming))
- .then(() => setEmulatorVoiceDataStateAndWait("voice", "home"));
-}
-
-startTestCommon(function() {
- return getEmulatorOperatorNames()
- .then(function(aOperators) {
- let {longName: longName, shortName: shortName} = aOperators[0];
-
- return Promise.resolve()
-
- // If Either long name or short name of current registered operator
- // matches SPN("Android"), then the `roaming` attribute should be set
- // to false.
- .then(() => test(longName, shortName, false))
- .then(() => test(longName, shortName.toLowerCase(), false))
- .then(() => test(longName, "Bar", false))
- .then(() => test(longName.toLowerCase(), shortName, false))
- .then(() => test(longName.toLowerCase(), shortName.toLowerCase(), false))
- .then(() => test(longName.toLowerCase(), "Bar", false))
- .then(() => test("Foo", shortName, false))
- .then(() => test("Foo", shortName.toLowerCase(), false))
- .then(() => test("Foo", "Bar", true))
-
- // Reset roaming operator.
- .then(() => setEmulatorOperatorNamesAndWait("roaming",
- aOperators[1].longName,
- aOperators[1].shortName));
- });
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_preferred_network_type.js
+++ /dev/null
@@ -1,89 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- {
- preferredNetworkType: "gsm"
- }, {
- preferredNetworkType: "wcdma"
- }, {
- preferredNetworkType: "wcdma/gsm-auto"
- }, {
- preferredNetworkType: "cdma/evdo"
- }, {
- preferredNetworkType: "evdo"
- }, {
- preferredNetworkType: "cdma"
- }, {
- preferredNetworkType: "wcdma/gsm/cdma/evdo"
- },
- {
- preferredNetworkType: "wcdma/gsm" // Restore to default
- },
- // Currently emulator doesn't support lte network. So we expect to get a
- // 'ModeNotSupported' error here.
- {
- preferredNetworkType: "lte/cdma/evdo",
- expectedErrorMessage: "ModeNotSupported"
- }, {
- preferredNetworkType: "lte/wcdma/gsm",
- expectedErrorMessage: "ModeNotSupported"
- }, {
- preferredNetworkType: "lte/wcdma/gsm/cdma/evdo",
- expectedErrorMessage: "ModeNotSupported"
- }, {
- preferredNetworkType: "lte",
- expectedErrorMessage: "ModeNotSupported"
- }, {
- preferredNetworkType: "lte/wcdma",
- expectedErrorMessage: "ModeNotSupported"
- },
- // Test passing an invalid mode. We expect to get an exception here.
- {
- preferredNetworkType: "InvalidTypes",
- expectGotException: true
- }, {
- preferredNetworkType: null,
- expectGotException: true
- }
-];
-
-function verifyPreferredNetworkType(aExpectedType) {
- return getPreferredNetworkType()
- .then(function resolve(aType) {
- is(aType, aExpectedType, "getPreferredNetworkType success");
- }, function reject() {
- ok(false, "failed to getPreferredNetworkType");
- });
-}
-
-function setAndVerifyPreferredNetworkType(aType, aExpectedErrorMsg, aExpectGotException) {
- log("Test setting preferred network types to " + aType);
-
- try {
- return setPreferredNetworkType(aType)
- .then(function resolve() {
- ok(!aExpectedErrorMsg, "setPreferredNetworkType success");
- return verifyPreferredNetworkType(aType);
- }, function reject(aError) {
- is(aError.name, aExpectedErrorMsg, "failed to setPreferredNetworkType");
- });
- } catch (e) {
- ok(aExpectGotException, "caught an exception: " + e);
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => setAndVerifyPreferredNetworkType(data.preferredNetworkType,
- data.expectedErrorMessage,
- data.expectGotException));
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_preferred_network_type_radio_off.js
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function testSetPreferredNetworkTypeOnRadioOff(aType) {
- log("Test setPreferredNetworkType when radio is off");
- return setPreferredNetworkType(aType)
- .then(function resolve() {
- ok(false, "setPreferredNetworkType shouldn't success");
- }, function reject(aError) {
- is(aError.name, "RadioNotAvailable", "failed to setPreferredNetworkType");
- });
-}
-
-function testGetPreferredNetworkTypeOnRadioOff() {
- log("Test getPreferredNetworkType when radio is off");
- return getPreferredNetworkType(aType)
- .then(function resolve() {
- ok(false, "getPreferredNetworkType shouldn't success");
- }, function reject(aError) {
- is(aError.name, "RadioNotAvailable", "failed to getPreferredNetworkType");
- });
-}
-
-// Start test
-startTestCommon(function() {
- return setRadioEnabledAndWait(false)
- .then(() => testSetPreferredNetworkTypeOnRadioOff("gsm"))
- .then(() => testGetPreferredNetworkTypeOnRadioOff())
- // Restore radio state.
- .then(() => setRadioEnabledAndWait(true),
- () => setRadioEnabledAndWait(true));
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_roaming_preference.js
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [
- // TODO: Bug 896394 - B2G RIL: Add marionette test cases for CDMA roaming
- // preference.
- // Currently emulator run as GSM mode by default. So we expect to get a
- // 'RequestNotSupported' error here.
- {
- mode: "home",
- expectedErrorMessage: "RequestNotSupported"
- }, {
- mode: "affiliated",
- expectedErrorMessage: "RequestNotSupported"
- }, {
- mode: "any",
- expectedErrorMessage: "RequestNotSupported"
- },
- // Test passing an invalid mode. We expect to get an exception here.
- {
- mode: "InvalidMode",
- expectGotException: true
- }, {
- mode: null,
- expectGotException: true
- }
-];
-
-function testSetRoamingPreference(aMode, aExpectedErrorMsg, aExpectGotException) {
- log("Test setting roaming preference mode to " + aMode);
-
- try {
- return setRoamingPreference(aMode)
- .then(function resolve() {
- ok(!aExpectedErrorMsg, "setRoamingPreference success");
- }, function reject(aError) {
- is(aError.name, aExpectedErrorMsg, "failed to setRoamingPreference");
- });
- } catch (e) {
- ok(aExpectGotException, "caught an exception: " + e);
- }
-}
-
-// Start tests
-startTestCommon(function() {
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => testSetRoamingPreference(data.mode,
- data.expectedErrorMessage,
- data.expectGotException));
- }
- return promise;
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_set_radio.js
+++ /dev/null
@@ -1,69 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function testAutoRestoreRadioState(aEnabled, aServiceId) {
- return setRadioEnabledAndWait(aEnabled, aServiceId)
- .then(() => {
- let expectedSequence = aEnabled ? ["enabling", "enabled"] :
- ["disabling", "disabled"];
-
- let p1 = waitForManagerEvent("radiostatechange", aServiceId, function() {
- let mobileConn = getMozMobileConnectionByServiceId(aServiceId);
- let expectedRadioState = expectedSequence.shift();
- is(mobileConn.radioState, expectedRadioState, "Check radio state");
- return expectedSequence.length === 0;
- });
-
- let command = "modem radio " + (aEnabled ? "disable" : "enable");
- let p2 = runEmulatorCmdSafe(command);
-
- return Promise.all([p1, p2]);
- });
-}
-
-// Start tests
-startTestCommon(function() {
-
- let origApnSettings;
- return getDataApnSettings()
- .then(value => {
- origApnSettings = value;
- })
-
- // Test disabling/enabling radio power.
- .then(() => log("Test disabling/enabling radio power"))
- .then(() => setRadioEnabledAndWait(false))
- .then(() => setRadioEnabledAndWait(true))
-
- // Test auto-restore radio state
- .then(() => log("Test auto-restore radio state"))
- .then(() => testAutoRestoreRadioState(false))
- .then(() => testAutoRestoreRadioState(true))
-
- // Test disabling radio when data is connected.
- .then(() => log("Test disabling radio when data is connected"))
- .then(() => {
- let apnSettings = [[
- {"carrier":"T-Mobile US",
- "apn":"epc.tmobile.com",
- "mmsc":"http://mms.msg.eng.t-mobile.com/mms/wapenc",
- "types":["default","supl","mms"]}]];
- return setDataApnSettings(apnSettings);
- })
- .then(() => setDataEnabledAndWait(true))
- .then(() => setRadioEnabledAndWait(false))
- .then(() => {
- // Data should be disconnected.
- is(mobileConnection.data.connected, false);
- })
-
- // Restore test environment.
- .then(() => log("Restore test environment"))
- .then(() => setDataApnSettings(origApnSettings))
- .then(() => setDataEnabled(false))
- .then(() => setRadioEnabledAndWait(true));
-
-}, ["settings-read", "settings-write", "settings-api-read", "settings-api-write"]);
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_signal_strength.js
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-// Emulator uses rssi = 7 as default value.
-const DEFAULT_RSSI = 7;
-
-const TEST_DATA = [
- // All invalid case.
- {
- input: {
- rxlev: 99,
- rsrp: 65535,
- rssnr: 65535
- },
- expect: {
- signalStrength: null,
- relSignalStrength: null
- }
- },
- // Valid rxlev.
- {
- input: {
- rxlev: 12,
- rsrp: 65535,
- rssnr: 65535
- },
- expect: {
- signalStrength: null,
- relSignalStrength: 100
- }
- },
- // Valid rxlev with min value.
- {
- input: {
- rxlev: 0,
- rsrp: 65535,
- rssnr: 65535
- },
- expect: {
- signalStrength: null,
- relSignalStrength: 0
- }
- },
- // Valid rxlev with max value.
- {
- input: {
- rxlev: 63,
- rsrp: 65535,
- rssnr: 65535
- },
- expect: {
- signalStrength: null,
- relSignalStrength: 100
- }
- },
- // Valid rsrp.
- {
- input: {
- rxlev: 31,
- rsrp: 50,
- rssnr: 65535
- },
- expect: {
- signalStrength: 50,
- relSignalStrength: 100
- }
- },
- // Valid rssnr.
- {
- input: {
- rxlev: 31,
- rsrp: 65535,
- rssnr: 100
- },
- expect: {
- signalStrength: null,
- relSignalStrength: 81
- }
- },
- // Valid rsrp and rssnr.
- {
- input: {
- rxlev: 31,
- rsrp: 100,
- rssnr: 30
- },
- expect: {
- signalStrength: 100,
- relSignalStrength: 37
- }
- }
-];
-
-function testInitialSignalStrengthInfo() {
- log("Test initial signal strength info");
-
- let voice = mobileConnection.voice;
- // Android emulator initializes the signal strength to -99 dBm
- is(voice.signalStrength, -99, "check voice.signalStrength");
- is(voice.relSignalStrength, 44, "check voice.relSignalStrength");
-}
-
-function testLteSignalStrength(aInput, aExpect) {
- log("Test setting LTE signal strength to " + JSON.stringify(aInput));
-
- return setEmulatorLteSignalStrengthAndWait(aInput.rxlev, aInput.rsrp, aInput.rssnr)
- .then(() => {
- let voice = mobileConnection.voice;
- is(voice.signalStrength, aExpect.signalStrength,
- "check voice.signalStrength");
- is(voice.relSignalStrength, aExpect.relSignalStrength,
- "check voice.relSignalStrength");
- });
-}
-
-// Start tests
-startTestCommon(function() {
- // Test initial status
- testInitialSignalStrengthInfo();
-
- // Test Unsolicited Signal Strength Events for LTE
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let data = TEST_DATA[i];
- promise = promise.then(() => testLteSignalStrength(data.input,
- data.expect));
- }
-
- // Reset Signal Strength Info to default
- return promise.then(() => setEmulatorGsmSignalStrengthAndWait(DEFAULT_RSSI));
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_supported_network_types.js
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function getSupportedNetworkTypesFromSystemProperties(aClientId) {
- let key = "ro.moz.ril." + aClientId + ".network_types";
-
- return runEmulatorShellCmdSafe(["getprop", key])
- .then(function resolve(aResults) {
- let result = aResults[0];
- if (!result || result === "") {
- // Copied from GECKO_SUPPORTED_NETWORK_TYPES_DEFAULT in
- // dom/system/gonk/ril_consts.js.
- result = "wcdma,gsm";
- }
- return result.split(",");
- });
-}
-
-// Start test
-startTestCommon(function() {
- return Promise.resolve()
- // Get SupportedNetworkTypes from system properties.
- .then(() => getSupportedNetworkTypesFromSystemProperties(0))
- .then((testData) => {
- let supportedNetworkTypes = mobileConnection.supportedNetworkTypes;
- ok(Array.isArray(supportedNetworkTypes),
- "supportedNetworkTypes should be an array");
-
- is(testData.length, supportedNetworkTypes.length);
- for (let i = 0; i < testData.length; i++) {
- ok(supportedNetworkTypes.indexOf(testData[i]) >= 0,
- "Should support '" + testData[i] + "'");
- }
- });
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_voice_location.js
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- * http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-function verifyVoiceCellLocationInfo(aLac, aCid) {
- let cell = mobileConnection.voice.cell;
- ok(cell, "location available");
-
- is(cell.gsmLocationAreaCode, aLac, "check voice.cell.gsmLocationAreaCode");
- is(cell.gsmCellId, aCid, "check voice.cell.gsmCellId");
-
- // TODO: Since gecko doesn't reset these values below to their invalid values,
- // the tests below will fail after we once change to CDMA mode. Please refer
- // to Bug 1190274 for more information.
-
- /*
- is(cell.cdmaBaseStationId, -1, "check voice.cell.cdmaBaseStationId");
- is(cell.cdmaBaseStationLatitude, -2147483648,
- "check voice.cell.cdmaBaseStationLatitude");
- is(cell.cdmaBaseStationLongitude, -2147483648,
- "check voice.cell.cdmaBaseStationLongitude");
- is(cell.cdmaSystemId, -1, "check voice.cell.cdmaSystemId");
- is(cell.cdmaNetworkId, -1, "check voice.cell.cdmaNetworkId");
- */
-}
-
-/* Test Voice Cell Location Info Change */
-function testVoiceCellLocationUpdate(aLac, aCid) {
- // Set emulator's lac/cid and wait for 'onvoicechange' event.
- log("Test cell location with lac=" + aLac + " and cid=" + aCid);
-
- return setEmulatorGsmLocationAndWait(aLac, aCid, true, false)
- .then(() => verifyVoiceCellLocationInfo(aLac, aCid));
-}
-
-startTestCommon(function() {
- return getEmulatorGsmLocation()
- .then(function(aResult) {
- log("Test initial voice location info");
- verifyVoiceCellLocationInfo(aResult.lac, aResult.cid);
-
- return Promise.resolve()
- .then(() => testVoiceCellLocationUpdate(100, 100))
- .then(() => testVoiceCellLocationUpdate(2000, 2000))
-
- // Reset back to initial values.
- .then(() => testVoiceCellLocationUpdate(aResult.lac, aResult.cid));
- });
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_voice_privacy.js
+++ /dev/null
@@ -1,42 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-// TODO: Bug 999369 - B2G Emulator: Support voice privacy.
-// Currently emulator doesn't support
-// REQUEST_CDMA_SET_PREFERRED_VOICE_PRIVACY_MODE and run as gsm mode by default,
-// so we expect to get a 'RequestNotSupported' error here.
-function testSetVoicePrivacyMode(aEnabled) {
- log("Test setting voice privacy mode to " + aEnabled);
-
- return setVoicePrivacyMode(aEnabled)
- .then(function resolve() {
- ok(false, "setVoicePrivacyMode should not success");
- }, function reject(aError) {
- is(aError.name, "RequestNotSupported", "failed to setVoicePrivacyMode");
- });
-}
-
-// TODO: Bug 999369 - B2G Emulator: Support voice privacy.
-// Currently emulator doesn't support
-// RIL_REQUEST_CDMA_QUERY_PREFERRED_VOICE_PRIVACY_MODE and run as gsm mode by
-// default, so we expect to get a 'RequestNotSupported' error here.
-function testGetVoicePrivacyMode() {
- log("Test getting voice privacy mode");
-
- return getVoicePrivacyMode()
- .then(function resolve() {
- ok(false, "getVoicePrivacyMode should not success");
- }, function reject(aError) {
- is(aError.name, "RequestNotSupported", "failed to getVoicePrivacyMode");
- });
-}
-
-// Start tests
-startTestCommon(function() {
- return Promise.resolve()
- .then(() => testSetVoicePrivacyMode(true))
- .then(() => testGetVoicePrivacyMode());
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/marionette/test_mobile_voice_state.js
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Any copyright is dedicated to the Public Domain.
- http://creativecommons.org/publicdomain/zero/1.0/ */
-
-MARIONETTE_TIMEOUT = 60000;
-MARIONETTE_HEAD_JS = "head.js";
-
-const TEST_DATA = [{
- // Test state becomes to "unregistered"
- state: "unregistered",
- expected: {
- state: "notSearching",
- connected: false,
- emergencyCallsOnly: true,
- roaming: false,
- signalStrength: null,
- relSignalStrength: null,
- cell: null
- }
- }, {
- // Test state becomes to "searching"
- state: "searching",
- expected: {
- state: "searching",
- connected: false,
- emergencyCallsOnly: true,
- roaming: false,
- signalStrength: null,
- relSignalStrength: null,
- cell: null
- }
- }, {
- // Test state becomes to "denied"
- state: "denied",
- expected: {
- state: "denied",
- connected: false,
- emergencyCallsOnly: true,
- roaming: false,
- signalStrength: null,
- relSignalStrength: null,
- cell: null
- }
- }, {
- // Test state becomes to "roaming"
- state: "roaming",
- expected: {
- state: "registered",
- connected: true,
- emergencyCallsOnly: false,
- roaming: true,
- signalStrength: -99,
- relSignalStrength: 44,
- cell: {
- gsmLocationAreaCode: 0,
- gsmCellId: 0
- }
- }
- }, {
- // Reset state to default value.
- state: "home",
- expected: {
- state: "registered",
- connected: true,
- emergencyCallsOnly: false,
- roaming: false,
- signalStrength: -99,
- relSignalStrength: 44,
- cell: {
- gsmLocationAreaCode: 0,
- gsmCellId: 0
- }
- }
- }
-];
-
-function compareTo(aPrefix, aFrom, aTo) {
- for (let field in aTo) {
- let fullName = aPrefix + field;
-
- let lhs = aFrom[field];
- let rhs = aTo[field];
- ok(true, "lhs=" + JSON.stringify(lhs) + ", rhs=" + JSON.stringify(rhs));
- if (typeof rhs !== "object") {
- is(lhs, rhs, fullName);
- } else if (rhs) {
- ok(lhs, fullName);
- compareTo(fullName + ".", lhs, rhs);
- } else {
- is(lhs, null, fullName);
- }
- }
-}
-
-function verifyVoiceInfo(aExpected) {
- compareTo("voice.", mobileConnection.voice, aExpected);
-}
-
-/* Test Voice State Changed */
-function testVoiceStateUpdate(aNewState, aExpected) {
- log("Test voice info with state='" + aNewState + "'");
-
- // Set emulator's lac/cid and wait for 'onvoicechange' event.
- return setEmulatorVoiceDataStateAndWait("voice", aNewState)
- .then(() => verifyVoiceInfo(aExpected));
-}
-
-startTestCommon(function() {
- log("Test initial voice connection info");
-
- let promise = Promise.resolve();
- for (let i = 0; i < TEST_DATA.length; i++) {
- let entry = TEST_DATA[i];
- promise =
- promise.then(testVoiceStateUpdate.bind(null, entry.state, entry.expected));
- }
-
- return promise;
-});
deleted file mode 100644
--- a/dom/mobileconnection/tests/mochitest/mochitest.ini
+++ /dev/null
@@ -1,5 +0,0 @@
-[DEFAULT]
-skip-if = toolkit != "gonk"
-
-[test_mobileconnection_permission.html]
-[test_mobilenetwork_permission.html]
deleted file mode 100644
--- a/dom/mobileconnection/tests/mochitest/test_mobileconnection_permission.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test to mobileconnection permission</title>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-"use strict";
-
-if (!SpecialPowers.hasPermission("mobileconnection", document)) {
- // Add "mobileconnection" permission and propagate it by reloading the page.
- SpecialPowers.addPermission("mobileconnection", true, document);
- window.location.reload();
-} else if (SpecialPowers.hasPermission("mobilenetwork", document)) {
- // Remove "mobilenetwork" permission and propagate it by reloading the page.
- SpecialPowers.removePermission("mobilenetwork", document);
- window.location.reload();
-} else {
- // Start test.
- ok("mozMobileConnections" in navigator, "navigator.mozMobileConnections should be accessible for the content that has mobilenetwork permission.");
-
- var mobileConnection = navigator.mozMobileConnections[0];
-
- // Should not be accessible for the content that has mobileconnection permission.
- is("lastKnownNetwork" in mobileConnection, false, "lastKnownNetwork");
- is("lastKnownHomeNetwork" in mobileConnection, false, "lastKnownHomeNetwork");
-
- // Should be accessible for the content that has mobileconnection permission.
- is("voice" in mobileConnection, true, "voice");
- is("data" in mobileConnection, true, "data");
- is("iccId" in mobileConnection, true, "iccId");
- is("networkSelectionMode" in mobileConnection, true, "networkSelectionMode");
- is("radioState" in mobileConnection, true, "radioState");
- is("supportedNetworkTypes" in mobileConnection, true, "supportedNetworkTypes");
-
- is("getNetworks" in mobileConnection, true, "getNetworks");
- is("selectNetwork" in mobileConnection, true, "selectNetwork");
- is("selectNetworkAutomatically" in mobileConnection, true, "selectNetworkAutomatically");
- is("setPreferredNetworkType" in mobileConnection, true, "setPreferredNetworkType");
- is("getPreferredNetworkType" in mobileConnection, true, "getPreferredNetworkType");
- is("setRoamingPreference" in mobileConnection, true, "setRoamingPreference");
- is("getRoamingPreference" in mobileConnection, true, "getRoamingPreference");
- is("setVoicePrivacyMode" in mobileConnection, true, "setVoicePrivacyMode");
- is("getVoicePrivacyMode" in mobileConnection, true, "getVoicePrivacyMode");
- is("setCallForwardingOption" in mobileConnection, true, "setCallForwardingOption");
- is("getCallForwardingOption" in mobileConnection, true, "getCallForwardingOption");
- is("setCallBarringOption" in mobileConnection, true, "setCallBarringOption");
- is("getCallBarringOption" in mobileConnection, true, "getCallBarringOption");
- is("changeCallBarringPassword" in mobileConnection, true, "changeCallBarringPassword");
- is("setCallWaitingOption" in mobileConnection, true, "setCallWaitingOption");
- is("getCallWaitingOption" in mobileConnection, true, "getCallWaitingOption");
- is("setCallingLineIdRestriction" in mobileConnection, true, "setCallingLineIdRestriction");
- is("getCallingLineIdRestriction" in mobileConnection, true, "getCallingLineIdRestriction");
- is("exitEmergencyCbMode" in mobileConnection, true, "exitEmergencyCbMode");
- is("setRadioEnabled" in mobileConnection, true, "setRadioEnabled");
-}
-
-</script>
-</pre>
-</body>
-</html>
deleted file mode 100644
--- a/dom/mobileconnection/tests/mochitest/test_mobilenetwork_permission.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<head>
- <title>Test to mobilenetwork permission</title>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<p id="display"></p>
-<div id="content" style="display: none">
-</div>
-<pre id="test">
-<script type="application/javascript">
-
-"use strict";
-
-if (!SpecialPowers.hasPermission("mobilenetwork", document)) {
- // Add "moiblenetwork" permission and propagate it by reloading the page.
- SpecialPowers.addPermission("mobilenetwork", true, document);
- window.location.reload();
-} else if (SpecialPowers.hasPermission("mobileconnection", document)) {
- // Remove "mobileconnection" permission and propagate it by reloading the page.
- SpecialPowers.removePermission("mobileconnection", document);
- window.location.reload();
-} else {
- // Start test.
- ok("mozMobileConnections" in navigator, "navigator.mozMobileConnections should be accessible for the content that has mobilenetwork permission.");
-
- var mobileConnection = navigator.mozMobileConnections[0];
-
- // Should be accessible for the content that has mobilenetwork permission.
- is("lastKnownNetwork" in mobileConnection, true, "lastKnownNetwork");
- is("lastKnownHomeNetwork" in mobileConnection, true, "lastKnownHomeNetwork");
-
- // Should not be accessible for the content that has mobilenetwork permission.
- is("voice" in mobileConnection, false, "voice");
- is("data" in mobileConnection, false, "data");
- is("iccId" in mobileConnection, false, "iccId");
- is("networkSelectionMode" in mobileConnection, false, "networkSelectionMode");
- is("radioState" in mobileConnection, false, "radioState");
- is("supportedNetworkTypes" in mobileConnection, false, "supportedNetworkTypes");
-
- is("getNetworks" in mobileConnection, false, "getNetworks");
- is("selectNetwork" in mobileConnection, false, "selectNetwork");
- is("selectNetworkAutomatically" in mobileConnection, false, "selectNetworkAutomatically");
- is("setPreferredNetworkType" in mobileConnection, false, "setPreferredNetworkType");
- is("getPreferredNetworkType" in mobileConnection, false, "getPreferredNetworkType");
- is("setRoamingPreference" in mobileConnection, false, "setRoamingPreference");
- is("getRoamingPreference" in mobileConnection, false, "getRoamingPreference");
- is("setVoicePrivacyMode" in mobileConnection, false, "setVoicePrivacyMode");
- is("getVoicePrivacyMode" in mobileConnection, false, "getVoicePrivacyMode");
- is("setCallForwardingOption" in mobileConnection, false, "setCallForwardingOption");
- is("getCallForwardingOption" in mobileConnection, false, "getCallForwardingOption");
- is("setCallBarringOption" in mobileConnection, false, "setCallBarringOption");
- is("getCallBarringOption" in mobileConnection, false, "getCallBarringOption");
- is("changeCallBarringPassword" in mobileConnection, false, "changeCallBarringPassword");
- is("setCallWaitingOption" in mobileConnection, false, "setCallWaitingOption");
- is("getCallWaitingOption" in mobileConnection, false, "getCallWaitingOption");
- is("setCallingLineIdRestriction" in mobileConnection, false, "setCallingLineIdRestriction");
- is("getCallingLineIdRestriction" in mobileConnection, false, "getCallingLineIdRestriction");
- is("exitEmergencyCbMode" in mobileConnection, false, "exitEmergencyCbMode");
- is("setRadioEnabled" in mobileConnection, false, "setRadioEnabled");
-}
-
-</script>
-</pre>
-</body>
-</html>
--- a/dom/moz.build
+++ b/dom/moz.build
@@ -41,38 +41,35 @@ DIRS += [
'apps',
'base',
'archivereader',
'bindings',
'battery',
'browser-element',
'cache',
'canvas',
- 'contacts',
'crypto',
'phonenumberutils',
'devicestorage',
'encoding',
'events',
'fetch',
'filehandle',
'filesystem',
'flyweb',
'gamepad',
'geolocation',
'grid',
'html',
- 'icc',
'inputport',
'json',
'jsurl',
'asmjscache',
'mathml',
'media',
- 'mobileconnection',
'notification',
'offline',
'power',
'push',
'quota',
'security',
'settings',
'storage',
deleted file mode 100644
--- a/dom/permission/tests/mochitest-ril.ini
+++ /dev/null
@@ -1,3 +0,0 @@
-[test_cellbroadcast.html]
-[test_mobileconnection.html]
-[test_networkstats-manage.html]
deleted file mode 100644
--- a/dom/permission/tests/test_mobileconnection.html
+++ /dev/null
@@ -1,30 +0,0 @@
-<!DOCTYPE HTML>
-<html>
-<!--
-https://bugzilla.mozilla.org/show_bug.cgi?id=815105
--->
-<head>
- <meta charset="utf-8">
- <title>Test for Bug 815105 </title>
- <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
- <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
-</head>
-<body>
-<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=815105">Mozilla Bug 815105 </a>
-<p id="display"></p>
-<div id="content" style="display: none"></div>
-<pre id="test">
-<script type="application/javascript;version=1.8" src="file_framework.js"></script>
-<script type="application/javascript;version=1.8">
-var gData = [
- {
- perm: ["mobileconnection"],
- obj: "mozMobileConnections",
- webidl: "MozMobileConnectionArray",
- },
-]
-</script>
-</pre>
-</body>
-</html>
-
--- a/dom/system/NetworkGeolocationProvider.js
+++ b/dom/system/NetworkGeolocationProvider.js
@@ -27,17 +27,16 @@ var gLoggingEnabled = false;
This timeout value is also used when Wifi scanning is disabled (see
gWifiScanningEnabled). In this case, we use this timer to collect cell/ip
data and xhr it to the location server.
*/
var gLocationRequestTimeout = 5000;
var gWifiScanningEnabled = true;
-var gCellScanningEnabled = false;
function LOG(aMsg) {
if (gLoggingEnabled) {
aMsg = "*** WIFI GEO: " + aMsg + "\n";
Cc["@mozilla.org/consoleservice;1"].getService(Ci.nsIConsoleService).logStringMessage(aMsg);
dump(aMsg);
}
}
@@ -238,20 +237,16 @@ function WifiGeoPositionProvider() {
try {
gLocationRequestTimeout = Services.prefs.getIntPref("geo.wifi.timeToWaitBeforeSending");
} catch (e) {}
try {
gWifiScanningEnabled = Services.prefs.getBoolPref("geo.wifi.scan");
} catch (e) {}
- try {
- gCellScanningEnabled = Services.prefs.getBoolPref("geo.cell.scan");
- } catch (e) {}
-
this.wifiService = null;
this.timer = null;
this.started = false;
}
WifiGeoPositionProvider.prototype = {
classID: Components.ID("{77DA64D3-7458-4920-9491-86CC9914F904}"),
QueryInterface: XPCOMUtils.generateQI([Ci.nsIGeolocationProvider,
@@ -403,83 +398,26 @@ WifiGeoPositionProvider.prototype = {
this.sendLocationRequest(wifiData);
},
onError: function (code) {
LOG("wifi error: " + code);
this.sendLocationRequest(null);
},
- getMobileInfo: function() {
- LOG("getMobileInfo called");
- try {
- let radioService = Cc["@mozilla.org/ril;1"]
- .getService(Ci.nsIRadioInterfaceLayer);
- let service = Cc["@mozilla.org/mobileconnection/mobileconnectionservice;1"]
- .getService(Ci.nsIMobileConnectionService);
-
- let result = [];
- for (let i = 0; i < service.numItems; i++) {
- LOG("Looking for SIM in slot:" + i + " of " + service.numItems);
- let connection = service.getItemByServiceId(i);
- let voice = connection && connection.voice;
- let cell = voice && voice.cell;
- let type = voice && voice.type;
- let network = voice && voice.network;
-
- if (network && cell && type) {
- let radioTechFamily;
- switch (type) {
- case "gsm":
- case "gprs":
- case "edge":
- radioTechFamily = "gsm";
- break;
- case "umts":
- case "hsdpa":
- case "hsupa":
- case "hspa":
- case "hspa+":
- radioTechFamily = "wcdma";
- break;
- case "lte":
- radioTechFamily = "lte";
- break;
- // CDMA cases to be handled in bug 1010282
- };
- result.push({ radioType: radioTechFamily,
- mobileCountryCode: voice.network.mcc,
- mobileNetworkCode: voice.network.mnc,
- locationAreaCode: cell.gsmLocationAreaCode,
- cellId: cell.gsmCellId });
- }
- }
- return result;
- } catch (e) {
- return null;
- }
- },
-
notify: function (timer) {
this.sendLocationRequest(null);
},
sendLocationRequest: function (wifiData) {
let data = { cellTowers: undefined, wifiAccessPoints: undefined };
if (wifiData && wifiData.length >= 2) {
data.wifiAccessPoints = wifiData;
}
- if (gCellScanningEnabled) {
- let cellData = this.getMobileInfo();
- if (cellData && cellData.length > 0) {
- data.cellTowers = cellData;
- }
- }
-
let useCached = isCachedRequestMoreAccurateThanServerRequest(data.cellTowers,
data.wifiAccessPoints);
LOG("Use request cache:" + useCached + " reason:" + gDebugCacheReasoning);
if (useCached) {
gCachedRequest.location.timestamp = Date.now();
this.notifyListener("update", [gCachedRequest.location]);
deleted file mode 100644
--- a/dom/webidl/CFStateChangeEvent.webidl
+++ /dev/null
@@ -1,59 +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/.
- */
-
-[Pref="dom.mobileconnection.enabled",
- Constructor(DOMString type, optional CFStateChangeEventInit eventInitDict)]
-interface CFStateChangeEvent : Event
-{
- /**
- * Indicates what to do with the rule.
- *
- * One of the CALL_FORWARD_ACTION_* constants. It will be either disable (0),
- * enable (1), query status (2), registration (3), or erasure (4).
- *
- * @see 3GPP MozMobileConnection.CALL_FORWARD_ACTION_* values.
- * @see 3GPP TS 27.007 7.11 "mode".
- */
- readonly attribute unsigned short action;
-
- /**
- * Indicates the reason the call is being forwarded.
- *
- * One of the CALL_FORWARD_REASON_* constants. It will be either
- * unconditional (0), mobile busy (1), no reply (2), not reachable (3),
- * all call forwarding (4), or all conditional call forwarding (5).
- *
- * @see 3GPP MozMobileConnection.CALL_FORWARD_REASON_* values.
- * @see 3GPP TS 27.007 7.11 "reason".
- */
- readonly attribute unsigned short reason;
-
- /**
- * Phone number of forwarding address.
- */
- readonly attribute DOMString? number;
-
- /**
- * When "no reply" is enabled or queried, this gives the time in
- * seconds to wait before call is forwarded.
- */
- readonly attribute unsigned short timeSeconds;
-
- /**
- * Service for which the call forward is set up. It should be one of the
- * MozMobileConnection.ICC_SERVICE_CLASS_* values.
- */
- readonly attribute unsigned short serviceClass;
-};
-
-dictionary CFStateChangeEventInit : EventInit
-{
- unsigned short action = 0;
- unsigned short reason = 0;
- DOMString number = "";
- unsigned short timeSeconds = 0;
- unsigned short serviceClass = 0;
-};
deleted file mode 100644
--- a/dom/webidl/Contacts.webidl
+++ /dev/null
@@ -1,132 +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/.
- */
-
-dictionary ContactAddress {
- sequence<DOMString>? type;
- DOMString? streetAddress;
- DOMString? locality;
- DOMString? region;
- DOMString? postalCode;
- DOMString? countryName;
- boolean? pref;
-};
-
-dictionary ContactField {
- sequence<DOMString>? type;
- DOMString? value;
- boolean? pref;
-};
-
-dictionary ContactTelField : ContactField {
- DOMString? carrier;
-};
-
-dictionary ContactProperties {
- Date? bday;
- Date? anniversary;
-
- DOMString? sex;
- DOMString? genderIdentity;
-
- sequence<Blob>? photo;
-
- sequence<ContactAddress>? adr;
-
- sequence<ContactField>? email;
- sequence<ContactField>? url;
- sequence<ContactField>? impp;
-
- sequence<ContactTelField>? tel;
-
- sequence<DOMString>? name;
- sequence<DOMString>? honorificPrefix;
- sequence<DOMString>? givenName;
- sequence<DOMString>? phoneticGivenName;
- sequence<DOMString>? additionalName;
- sequence<DOMString>? familyName;
- sequence<DOMString>? phoneticFamilyName;
- sequence<DOMString>? honorificSuffix;
- sequence<DOMString>? nickname;
- sequence<DOMString>? category;
- sequence<DOMString>? org;
- sequence<DOMString>? jobTitle;
- sequence<DOMString>? note;
- sequence<DOMString>? key;
-};
-
-[Constructor(optional ContactProperties properties),
- JSImplementation="@mozilla.org/contact;1",
- ChromeOnly]
-interface mozContact {
- attribute DOMString id;
- readonly attribute Date? published;
- readonly attribute Date? updated;
-
- attribute Date? bday;
- attribute Date? anniversary;
-
- attribute DOMString? sex;
- attribute DOMString? genderIdentity;
-
- [Cached, Pure] attribute sequence<Blob>? photo;
-
- [Cached, Pure] attribute sequence<ContactAddress>? adr;
-
- [Cached, Pure] attribute sequence<ContactField>? email;
- [Cached, Pure] attribute sequence<ContactField>? url;
- [Cached, Pure] attribute sequence<ContactField>? impp;
-
- [Cached, Pure] attribute sequence<ContactTelField>? tel;
-
- [Cached, Pure] attribute sequence<DOMString>? name;
- [Cached, Pure] attribute sequence<DOMString>? honorificPrefix;
- [Cached, Pure] attribute sequence<DOMString>? givenName;
- [Cached, Pure] attribute sequence<DOMString>? phoneticGivenName;
- [Cached, Pure] attribute sequence<DOMString>? additionalName;
- [Cached, Pure] attribute sequence<DOMString>? familyName;
- [Cached, Pure] attribute sequence<DOMString>? phoneticFamilyName;
- [Cached, Pure] attribute sequence<DOMString>? honorificSuffix;
- [Cached, Pure] attribute sequence<DOMString>? nickname;
- [Cached, Pure] attribute sequence<DOMString>? category;
- [Cached, Pure] attribute sequence<DOMString>? org;
- [Cached, Pure] attribute sequence<DOMString>? jobTitle;
- [Cached, Pure] attribute sequence<DOMString>? note;
- [Cached, Pure] attribute sequence<DOMString>? key;
-
- void init(optional ContactProperties properties);
-
- [ChromeOnly]
- void setMetadata(DOMString id, Date? published, Date? updated);
-
- jsonifier;
-};
-
-dictionary ContactFindSortOptions {
- DOMString sortBy; // "givenName" or "familyName"
- DOMString sortOrder = "ascending"; // e.g. "descending"
-};
-
-dictionary ContactFindOptions : ContactFindSortOptions {
- DOMString filterValue; // e.g. "Tom"
- DOMString filterOp; // e.g. "startsWith"
- any filterBy; // e.g. ["givenName", "nickname"]
- unsigned long filterLimit = 0;
-};
-
-[NoInterfaceObject, NavigatorProperty="mozContacts",
- JSImplementation="@mozilla.org/contactManager;1",
- ChromeOnly]
-interface ContactManager : EventTarget {
- DOMRequest find(optional ContactFindOptions options);
- DOMCursor getAll(optional ContactFindSortOptions options);
- DOMRequest clear();
- DOMRequest save(mozContact contact);
- DOMRequest remove((mozContact or DOMString) contactOrId);
- DOMRequest getRevision();
- DOMRequest getCount();
-
- attribute EventHandler oncontactchange;
-};
deleted file mode 100644
--- a/dom/webidl/DataErrorEvent.webidl
+++ /dev/null
@@ -1,17 +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/.
- */
-
-[Pref="dom.mobileconnection.enabled",
- Constructor(DOMString type, optional DataErrorEventInit eventInitDict)]
-interface DataErrorEvent : Event
-{
- readonly attribute DOMString? message;
-};
-
-dictionary DataErrorEventInit : EventInit
-{
- DOMString message = "";
-};
deleted file mode 100644
--- a/dom/webidl/IccCardLockError.webidl
+++ /dev/null
@@ -1,11 +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/.
- */
-
-[Constructor(DOMString errorName, short retryCount),
- Pref="dom.icc.enabled",
- ChromeOnly]
-interface IccCardLockError : DOMError {
- readonly attribute short retryCount;
-};
deleted file mode 100644
--- a/dom/webidl/IccChangeEvent.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/.
- */
-
-[Pref="dom.icc.enabled",
- ChromeOnly,
- Constructor(DOMString type, optional IccChangeEventInit eventInitDict)]
-interface IccChangeEvent : Event
-{
- readonly attribute DOMString iccId;
-};
-
-dictionary IccChangeEventInit : EventInit
-{
- DOMString iccId = "";
-};
deleted file mode 100644
--- a/dom/webidl/MozClirModeEvent.webidl
+++ /dev/null
@@ -1,22 +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/.
- */
-
-[Pref="dom.mobileconnection.enabled",
- Constructor(DOMString type, optional MozClirModeEventInit eventInitDict)]
-interface MozClirModeEvent : Event
-{
- /**
- * Indicates the mode of the calling line id restriction (CLIR).
- *
- * @see MozMobileConnection.CLIR_* values.
- */
- readonly attribute unsigned long mode;
-};
-
-dictionary MozClirModeEventInit : EventInit
-{
- unsigned long mode = 0;
-};
deleted file mode 100644
--- a/dom/webidl/MozContactChangeEvent.webidl
+++ /dev/null
@@ -1,19 +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 MozContactChangeEventInit eventInitDict),
- ChromeOnly]
-interface MozContactChangeEvent : Event
-{
- readonly attribute DOMString? contactID;
- readonly attribute DOMString? reason;
-};
-
-dictionary MozContactChangeEventInit : EventInit
-{
- DOMString contactID = "";
- DOMString reason = "";
-};
deleted file mode 100644
--- a/dom/webidl/MozEmergencyCbModeEvent.webidl
+++ /dev/null
@@ -1,26 +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/.
- */
-
-[Pref="dom.mobileconnection.enabled",
- Constructor(DOMString type, optional MozEmergencyCbModeEventInit eventInitDict)]
-interface MozEmergencyCbModeEvent : Event
-{
- /**
- * Whether the mode is activated.
- */
- readonly attribute boolean active;
-
- /**
- * Automatically exit the mode after the timeoutMs ms.
- */
- readonly attribute unsigned long timeoutMs;
-};
-
-dictionary MozEmergencyCbModeEventInit : EventInit
-{
- boolean active = false;
- unsigned long timeoutMs = 0;
-};
deleted file mode 100644
--- a/dom/webidl/MozIcc.webidl
+++ /dev/null
@@ -1,368 +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/. */
-
-enum IccCardState
-{
- "unknown", // ICC card state is either not yet reported from modem or in an
- // unknown state.
- "ready",
- "pinRequired",
- "pukRequired",
- "permanentBlocked",
-
- /**
- * Personalization States
- */
- "personalizationInProgress",
- "personalizationReady",
-
- // SIM Personalization States.
- "networkLocked",
- "networkSubsetLocked",
- "corporateLocked",
- "serviceProviderLocked",
- "simPersonalizationLocked",
- "networkPukRequired",
- "networkSubsetPukRequired",
- "corporatePukRequired",
- "serviceProviderPukRequired",
- "simPersonalizationPukRequired",
-
- // RUIM Personalization States.
- "network1Locked",
- "network2Locked",
- "hrpdNetworkLocked",
- "ruimCorporateLocked",
- "ruimServiceProviderLocked",
- "ruimPersonalizationLocked",
- "network1PukRequired",
- "network2PukRequired",
- "hrpdNetworkPukRequired",
- "ruimCorporatePukRequired",
- "ruimServiceProviderPukRequired",
- "ruimPersonalizationPukRequired",
-
- /**
- * Additional States.
- */
- "illegal" // See Bug 916000. An owed pay card will be rejected by the network
- // and fall in this state.
-};
-
-enum IccLockType
-{
- "pin",
- "pin2",
- "puk",
- "puk2",
- "nck", // Network depersonalization -- network control key (NCK).
- "nsck", // Network subset depersonalization -- network subset control key (NSCK).
- "nck1", // Network type 1 depersonalization -- network type 1 control key (NCK1).
- "nck2", // Network type 2 depersonalization -- network type 2 control key (NCK2).
- "hnck", // HRPD network depersonalization -- HRPD network control key (HNCK).
- "cck", // Corporate depersonalization -- corporate control key (CCK).
- "spck", // Service provider depersonalization -- service provider control key (SPCK).
- "pck", // SIM depersonalization -- personalization control key (PCK).
- "rcck", // RUIM corporate depersonalization -- RUIM corporate control key (RCCK).
- "rspck", // RUIM service provider depersonalization -- RUIM service provider control key (RSPCK).
- "nckPuk", // Network PUK depersonalization -- network control key (NCK).
- "nsckPuk", // Network subset PUK depersonalization -- network subset control key (NSCK).
- "nck1Puk", // Network type 1 PUK depersonalization -- network type 1 control key (NCK1).
- "nck2Puk", // Network type 2 PUK depersonalization -- Network type 2 control key (NCK2).
- "hnckPuk", // HRPD network PUK depersonalization -- HRPD network control key (HNCK).
- "cckPuk", // Corporate PUK depersonalization -- corporate control key (CCK).
- "spckPuk", // Service provider PUK depersonalization -- service provider control key (SPCK).
- "pckPuk", // SIM PUK depersonalization -- personalization control key (PCK).
- "rcckPuk", // RUIM corporate PUK depersonalization -- RUIM corporate control key (RCCK).
- "rspckPuk", // RUIM service provider PUK depersonalization -- service provider control key (SPCK).
- "fdn"
-};
-
-enum IccContactType
-{
- "adn", // Abbreviated Dialling Number.
- "fdn", // Fixed Dialling Number.
- "sdn" // Service Dialling Number.
-};
-
-enum IccMvnoType
-{
- "imsi",
- "spn",
- "gid"
-};
-
-enum IccService
-{
- "fdn"
-};
-
-dictionary IccUnlockCardLockOptions
-{
- required IccLockType lockType;
-
- DOMString? pin = null; // Necessary for lock types: "pin", "pin2", "nck",
- // "nsck", "nck1", "nck2", "hnck", "cck", "spck",
- // "pck", "rcck", "rspck".
-
- DOMString? puk = null; // Necessary for lock types: "puk", "puk2", "nckPuk",
- // "nsckPuk", "nck1Puk", "nck2Puk", "hnckPuk", "cckPuk",
- // "spckPuk", "pckPuk", "rcckPuk", "rspckPuk".
-
- DOMString? newPin = null; // Necessary for lock types: "puk", "puk2".
-};
-
-dictionary IccSetCardLockOptions
-{
- required IccLockType lockType;
-
- DOMString? pin = null; // Necessary for lock types: "pin", "pin2"
-
- DOMString? pin2 = null; // Used for enabling/disabling operation.
- // Necessary for lock types: "fdn".
-
- DOMString? newPin = null; // Used for changing password operation.
- // Necessary for lock types: "pin", "pin2"
-
- boolean enabled; // Used for enabling/disabling operation.
- // Necessary for lock types: "pin", "fdn"
-};
-
-dictionary IccCardLockStatus
-{
- boolean enabled; // True when CardLock is enabled.
-};
-
-dictionary IccCardLockRetryCount
-{
- long retryCount; // The number of remaining retries. -1 if unkown.
-};
-
-[Pref="dom.icc.enabled",
- ChromeOnly]
-interface MozIcc : EventTarget
-{
- // Integrated Circuit Card Information.
-
- /**
- * Information stored in the device's ICC.
- *
- * Once the ICC becomes undetectable, iccinfochange event will be notified.
- * Also, the attribute is set to null and this MozIcc object becomes invalid.
- * Calling asynchronous functions raises exception then.
- */
- readonly attribute (MozIccInfo or MozGsmIccInfo or MozCdmaIccInfo)? iccInfo;
-
- /**
- * The 'iccinfochange' event is notified whenever the icc info object
- * changes.
- */
- attribute EventHandler oniccinfochange;
-
- // Integrated Circuit Card State.
-
- /**
- * Indicates the state of the device's ICC.
- *
- * Once the ICC becomes undetectable, cardstatechange event will be notified.
- * Also, the attribute is set to null and this MozIcc object becomes invalid.
- * Calling asynchronous functions raises exception then.
- */
- readonly attribute IccCardState? cardState;
-
- /**
- * The 'cardstatechange' event is notified when the 'cardState' attribute
- * changes value.
- */
- attribute EventHandler oncardstatechange;
-
- // Integrated Circuit Card STK.
-
- /**
- * Send the response back to ICC after an attempt to execute STK proactive
- * Command.
- *
- * @param command
- * Command received from ICC. See MozStkCommand.
- * @param response
- * The response that will be sent to ICC.
- * @see MozStkResponse for the detail of response.
- */
- [Throws]
- void sendStkResponse(any command, any response);
-
- /**
- * Send the "Menu Selection" envelope command to ICC for menu selection.
- *
- * @param itemIdentifier
- * The identifier of the item selected by user.
- * @param helpRequested
- * true if user requests to provide help information, false otherwise.
- */
- [Throws]
- void sendStkMenuSelection(unsigned short itemIdentifier,
- boolean helpRequested);
-
- /**
- * Send the "Timer Expiration" envelope command to ICC for TIMER MANAGEMENT.
- *
- * @param timer
- * The identifier and value for a timer.
- * timerId: Identifier of the timer that has expired.
- * timerValue: Different between the time when this command is issued
- * and when the timer was initially started.
- * @see MozStkTimer
- */
- [Throws]
- void sendStkTimerExpiration(any timer);
-
- /**
- * Send "Event Download" envelope command to ICC.
- * ICC will not respond with any data for this command.
- *
- * @param event
- * one of events below:
- * - MozStkLocationEvent
- * - MozStkCallEvent
- * - MozStkLanguageSelectionEvent
- * - MozStkGeneralEvent
- * - MozStkBrowserTerminationEvent
- */
- [Throws]
- void sendStkEventDownload(any event);
-
- /**
- * The 'stkcommand' event is notified whenever STK proactive command is
- * issued from ICC.
- */
- attribute EventHandler onstkcommand;
-
- /**
- * 'stksessionend' event is notified whenever STK session is terminated by
- * ICC.
- */
- attribute EventHandler onstksessionend;
-
- // Integrated Circuit Card Lock interfaces.
-
- /**
- * Find out about the status of an ICC lock (e.g. the PIN lock).
- *
- * @param lockType
- * Identifies the lock type.
- *
- * @return a DOMRequest.
- * The request's result will be an object containing
- * information about the specified lock's status.
- * e.g. {enabled: true}.
- * @see IccCardLockStatus.
- */
- [Throws]
- DOMRequest getCardLock(IccLockType lockType);
-
- /**
- * Unlock a card lock.
- *
- * @param info
- * An object containing the information necessary to unlock
- * the given lock.
- *
- * @return a DOMRequest.
- * The request's error will be an object containing the number of
- * remaining retries
- * @see IccCardLockError.
- */
- [Throws]
- DOMRequest unlockCardLock(optional IccUnlockCardLockOptions info);
-
- /**
- * Modify the state of a card lock.
- *
- * @param info
- * An object containing information about the lock and
- * how to modify its state.
- *
- * @return a DOMRequest.
- * The request's error will be an object containing the number of
- * remaining retries.
- * @see IccCardLockError.
- */
- [Throws]
- DOMRequest setCardLock(optional IccSetCardLockOptions info);
-
- /**
- * Retrieve the number of remaining tries for unlocking the card.
- *
- * @param lockType
- * Identifies the lock type.
- *
- * @return a DOMRequest.
- * The request's result will be an object containing the number of
- * remaining retries. e.g. {retryCount: 3}.
- * @see IccCardLockRetryCount.
- */
- [Throws]
- DOMRequest getCardLockRetryCount(IccLockType lockType);
-
- // Integrated Circuit Card Phonebook Interfaces.
-
- /**
- * Read ICC contacts.
- *
- * @param contactType
- * Identifies the contact type.
- *
- * @return a DOMRequest.
- */
- [Throws]
- DOMRequest readContacts(IccContactType contactType);
-
- /**
- * Update ICC Phonebook contact.
- *
- * @param contactType
- * Identifies the contact type.
- * @param contact
- * The contact will be updated in ICC.
- * @param pin2 [optional]
- * PIN2 is only required for "fdn".
- *
- * @return a DOMRequest.
- */
- [Throws]
- DOMRequest updateContact(IccContactType contactType,
- mozContact contact,
- optional DOMString? pin2 = null);
-
- // Integrated Circuit Card Helpers.
-
- /**
- * Verify whether the passed data (matchData) matches with some ICC's field
- * according to the mvno type (mvnoType).
- *
- * @param mvnoType
- * Mvno type to use to compare the match data.
- * @param matchData
- * Data to be compared with ICC's field.
- *
- * @return a DOMRequest.
- * The request's result will be a boolean indicating the matching
- * result.
- */
- [Throws]
- DOMRequest matchMvno(IccMvnoType mvnoType, DOMString matchData);
-
- /**
- * Retrieve the the availability of an icc service.
- *
- * @param service
- * Identifies the service type.
- *
- * @return a Promise
- * If succeeds, the promise is resolved with boolean indicating the
- * availability of the service. Otherwise, rejected with a DOMError.
- */
- [NewObject]
- Promise<boolean> getServiceState(IccService service);
-};
deleted file mode 100644
--- a/dom/webidl/MozIccInfo.webidl
+++ /dev/null
@@ -1,68 +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/. */
-
-enum IccType {"sim", "usim", "csim", "ruim"};
-
-[Pref="dom.icc.enabled",
- ChromeOnly]
-interface MozIccInfo {
- /**
- * Integrated Circuit Card Type.
- */
- readonly attribute IccType? iccType;
-
- /**
- * Integrated Circuit Card Identifier.
- */
- readonly attribute DOMString? iccid;
-
- /**
- * Mobile Country Code (MCC) of the subscriber's home network.
- */
- readonly attribute DOMString? mcc;
-
- /**
- * Mobile Network Code (MNC) of the subscriber's home network.
- */
- readonly attribute DOMString? mnc;
-
- /**
- * Service Provider Name (SPN) of the subscriber's home network.
- */
- readonly attribute DOMString? spn;
-
- /**
- * Network name must be a part of displayed carrier name.
- */
- readonly attribute boolean isDisplayNetworkNameRequired;
-
- /**
- * Service provider name must be a part of displayed carrier name.
- */
- readonly attribute boolean isDisplaySpnRequired;
-};
-
-[Pref="dom.icc.enabled",
- ChromeOnly]
-interface MozGsmIccInfo : MozIccInfo {
- /**
- * Mobile Station ISDN Number (MSISDN) of the subscriber, aka
- * his phone number.
- */
- readonly attribute DOMString? msisdn;
-};
-
-[Pref="dom.icc.enabled",
- ChromeOnly]
-interface MozCdmaIccInfo : MozIccInfo {
- /**
- * Mobile Directory Number (MDN) of the subscriber, aka his phone number.
- */
- readonly attribute DOMString? mdn;
-
- /**
- * Preferred Roaming List (PRL) version of the subscriber.
- */
- readonly attribute long prlVersion;
-};
deleted file mode 100644
--- a/dom/webidl/MozIccManager.webidl
+++ /dev/null
@@ -1,274 +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/. */
-
-[Pref="dom.icc.enabled",
- ChromeOnly]
-interface MozIccManager : EventTarget
-{
- /**
- * 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;
-
- /**
- * Browser launch mode.
- */
- const unsigned short STK_BROWSER_MODE_LAUNCH_IF_NOT_ALREADY_LAUNCHED = 0x00;
- const unsigned short STK_BROWSER_MODE_USING_EXISTING_BROWSER = 0x02;
- const unsigned short STK_BROWSER_MODE_USING_NEW_BROWSER = 0x03;
-
- /**
- * STK proactive commands.
- *
- * @see TS 11.14, clause 13.4
- */
- const unsigned short STK_CMD_REFRESH = 0x01;
- const unsigned short STK_CMD_POLL_INTERVAL = 0x03;
- const unsigned short STK_CMD_POLL_OFF = 0x04;
- const unsigned short STK_CMD_SET_UP_EVENT_LIST = 0x05;
- const unsigned short STK_CMD_SET_UP_CALL = 0x10;
- const unsigned short STK_CMD_SEND_SS = 0x11;
- const unsigned short STK_CMD_SEND_USSD = 0x12;
- const unsigned short STK_CMD_SEND_SMS = 0x13;
- const unsigned short STK_CMD_SEND_DTMF = 0x14;
- const unsigned short STK_CMD_LAUNCH_BROWSER = 0x15;
- const unsigned short STK_CMD_PLAY_TONE = 0x20;
- const unsigned short STK_CMD_DISPLAY_TEXT = 0x21;
- const unsigned short STK_CMD_GET_INKEY = 0x22;
- const unsigned short STK_CMD_GET_INPUT = 0x23;
- const unsigned short STK_CMD_SELECT_ITEM = 0x24;
- const unsigned short STK_CMD_SET_UP_MENU = 0x25;
- const unsigned short STK_CMD_PROVIDE_LOCAL_INFO = 0x26;
- const unsigned short STK_CMD_TIMER_MANAGEMENT = 0x27;
- const unsigned short STK_CMD_SET_UP_IDLE_MODE_TEXT = 0x28;
- const unsigned short STK_CMD_OPEN_CHANNEL = 0x40;
- const unsigned short STK_CMD_CLOSE_CHANNEL = 0x41;
- const unsigned short STK_CMD_RECEIVE_DATA = 0x42;
- const unsigned short STK_CMD_SEND_DATA = 0x43;
-
- /**
- * STK result code.
- *
- * @see TS 11.14, clause 12.12
- *
- * Results '0X' and '1X' indicate that the command has been performed.
- */
- /** Command performed successfully */
- const unsigned short STK_RESULT_OK = 0x00;
-
- /** Command performed with partial comprehension */
- const unsigned short STK_RESULT_PRFRMD_WITH_PARTIAL_COMPREHENSION = 0x01;
-
- /** Command performed, with missing information */
- const unsigned short STK_RESULT_PRFRMD_WITH_MISSING_INFO = 0x02;
-
- /** REFRESH performed with additional EFs read */
- const unsigned short STK_RESULT_PRFRMD_WITH_ADDITIONAL_EFS_READ = 0x03;
-
- /** Command performed successfully, but icon could not be displayed */
- const unsigned short STK_RESULT_PRFRMD_ICON_NOT_DISPLAYED = 0x04;
-
- /** Command performed successfully, limited service */
- const unsigned short STK_RESULT_PRFRMD_LIMITED_SERVICE = 0x06;
-
- /** Proactive UICC session terminated by the user */
- const unsigned short STK_RESULT_UICC_SESSION_TERM_BY_USER = 0x10;
-
- /** Backward move in the proactive UICC session requested by the user */
- const unsigned short STK_RESULT_BACKWARD_MOVE_BY_USER = 0x11;
-
- /** No response from user */
- const unsigned short STK_RESULT_NO_RESPONSE_FROM_USER = 0x12;
-
- /** Help information required by the user */
- const unsigned short STK_RESULT_HELP_INFO_REQUIRED = 0x13;
-
- /** USSD or SS transaction terminated by the user */
- const unsigned short STK_RESULT_USSD_SS_SESSION_TERM_BY_USER = 0x14;
-
- /**
- * Results '2X' indicate to the UICC that it may be worth re-trying the
- * command at a later opportunity.
- */
- /** Terminal currently unable to process command */
- const unsigned short STK_RESULT_TERMINAL_CRNTLY_UNABLE_TO_PROCESS = 0x20;
-
- /** Network currently unable to process command */
- const unsigned short STK_RESULT_NETWORK_CRNTLY_UNABLE_TO_PROCESS = 0x21;
-
- /** User did not accept the proactive command */
- const unsigned short STK_RESULT_USER_NOT_ACCEPT = 0x22;
-
- /** User cleared down call before connection or network release */
- const unsigned short STK_RESULT_USER_CLEAR_DOWN_CALL = 0x23;
-
- /** Action in contradiction with the current timer state */
- const unsigned short STK_RESULT_ACTION_CONTRADICTION_TIMER_STATE = 0x24;
-
- /** Launch browser generic error code */
- const unsigned short STK_RESULT_LAUNCH_BROWSER_ERROR = 0x26;
-
- /**
- * Results '3X' indicate that it is not worth the UICC re-trying with an
- * identical command, as it will only get the same response. However, the
- * decision to retry lies with the application.
- */
- /** Command beyond terminal's capabilities */
- const unsigned short STK_RESULT_BEYOND_TERMINAL_CAPABILITY = 0x30;
-
- /** Command type not understood by terminal */
- const unsigned short STK_RESULT_CMD_TYPE_NOT_UNDERSTOOD = 0x31;
-
- /** Command data not understood by terminal */
- const unsigned short STK_RESULT_CMD_DATA_NOT_UNDERSTOOD = 0x32;
-
- /** Command number not known by terminal */
- const unsigned short STK_RESULT_CMD_NUM_NOT_KNOWN = 0x33;
-
- /** SS return error */
- const unsigned short STK_RESULT_SS_RETURN_ERROR = 0x34;
-
- /** SMS RP-ERROR */
- const unsigned short STK_RESULT_SMS_RP_ERROR = 0x35;
-
- /** Error, required values are missing */
- const unsigned short STK_RESULT_REQUIRED_VALUES_MISSING = 0x36;
-
- /** USSD return error */
- const unsigned short STK_RESULT_USSD_RETURN_ERROR = 0x37;
-
- /** MultipleCard commands error */
- const unsigned short STK_RESULT_MULTI_CARDS_CMD_ERROR = 0x38;
-
- /**
- * Interaction with call control by USIM or MO short message control by
- * USIM, permanent problem.
- */
- const unsigned short STK_RESULT_USIM_CALL_CONTROL_PERMANENT = 0x39;
-
- /** Bearer independent protocol error */
- const unsigned short STK_RESULT_BIP_ERROR = 0x3a;
-
- /**
- * Additional information on result:
- *
- * TS 11.14, 12.12.1-11 and TS 31.111,8.12.1-13 defines additional infomation
- * for different categories such as SEND SS, ME problem, network problem, etc.
- *
- * Note: We define these information here by category when needed.
- */
-
- /**
- * 12.12.2 Additional information for ME problem:
- */
- const unsigned short STK_ADDITIONAL_INFO_ME_PROBLEM_SCREEN_IS_BUSY = 0x01;
-
- /**
- * STK event list.
- */
- const unsigned short STK_EVENT_TYPE_MT_CALL = 0x00;
- const unsigned short STK_EVENT_TYPE_CALL_CONNECTED = 0x01;
- const unsigned short STK_EVENT_TYPE_CALL_DISCONNECTED = 0x02;
- const unsigned short STK_EVENT_TYPE_LOCATION_STATUS = 0x03;
- const unsigned short STK_EVENT_TYPE_USER_ACTIVITY = 0x04;
- const unsigned short STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE = 0x05;
- const unsigned short STK_EVENT_TYPE_CARD_READER_STATUS = 0x06;
- const unsigned short STK_EVENT_TYPE_LANGUAGE_SELECTION = 0x07;
- const unsigned short STK_EVENT_TYPE_BROWSER_TERMINATION = 0x08;
- const unsigned short STK_EVENT_TYPE_DATA_AVAILABLE = 0x09;
- const unsigned short STK_EVENT_TYPE_CHANNEL_STATUS = 0x0a;
- const unsigned short STK_EVENT_TYPE_SINGLE_ACCESS_TECHNOLOGY_CHANGED = 0x0b;
- const unsigned short STK_EVENT_TYPE_DISPLAY_PARAMETER_CHANGED = 0x0c;
- const unsigned short STK_EVENT_TYPE_LOCAL_CONNECTION = 0x0d;
- const unsigned short STK_EVENT_TYPE_NETWORK_SEARCH_MODE_CHANGED = 0x0e;
- const unsigned short STK_EVENT_TYPE_BROWSING_STATUS = 0x0f;
- const unsigned short STK_EVENT_TYPE_FRAMES_INFORMATION_CHANGED = 0x10;
-
- /**
- * The service state of STK location status.
- */
- const unsigned short STK_SERVICE_STATE_NORMAL = 0x00;
- const unsigned short STK_SERVICE_STATE_LIMITED = 0x01;
- const unsigned short STK_SERVICE_STATE_UNAVAILABLE = 0x02;
-
- /**
- * Tone type.
- */
- const unsigned short STK_TONE_TYPE_DIAL_TONE = 0x01;
- const unsigned short STK_TONE_TYPE_CALLED_SUBSCRIBER_BUSY = 0x02;
- const unsigned short STK_TONE_TYPE_CONGESTION = 0x03;
- const unsigned short STK_TONE_TYPE_RADIO_PATH_ACK = 0x04;
- const unsigned short STK_TONE_TYPE_RADIO_PATH_NOT_AVAILABLE = 0x05;
- const unsigned short STK_TONE_TYPE_ERROR = 0x06;
- const unsigned short STK_TONE_TYPE_CALL_WAITING_TONE = 0x07;
- const unsigned short STK_TONE_TYPE_RINGING_TONE = 0x08;
- const unsigned short STK_TONE_TYPE_GENERAL_BEEP = 0x10;
- const unsigned short STK_TONE_TYPE_POSITIVE_ACK_TONE = 0x11;
- const unsigned short STK_TONE_TYPE_NEGATIVE_ACK_TONE = 0x12;
-
- /**
- * Time unit.
- */
- const unsigned short STK_TIME_UNIT_MINUTE = 0x00;
- const unsigned short STK_TIME_UNIT_SECOND = 0x01;
- const unsigned short STK_TIME_UNIT_TENTH_SECOND = 0x02;
-
- /**
- * Local Information list.
- *
- * @see TS 102.223, clause 8.6
- */
- const unsigned short STK_LOCAL_INFO_LOCATION_INFO = 0x00;
- const unsigned short STK_LOCAL_INFO_IMEI = 0x01;
- const unsigned short STK_LOCAL_INFO_DATE_TIME_ZONE = 0x03;
- const unsigned short STK_LOCAL_INFO_LANGUAGE = 0x04;
-
- /**
- * Timer management.
- */
- const unsigned short STK_TIMER_START = 0x00;
- const unsigned short STK_TIMER_DEACTIVATE = 0x01;
- const unsigned short STK_TIMER_GET_CURRENT_VALUE = 0x02;
-
- /**
- * Browser termination cause.
- */
- const unsigned short STK_BROWSER_TERMINATION_CAUSE_USER = 0x00;
- const unsigned short STK_BROWSER_TERMINATION_CAUSE_ERROR = 0x01;
-
- /**
- * Next Action Indicator.
- */
- const unsigned short STK_NEXT_ACTION_NULL = 0x00;
- const unsigned short STK_NEXT_ACTION_END_PROACTIVE_SESSION = 0x81;
-
- /**
- * Array of iccIds that are currently detected.
- */
- [Cached, Pure]
- readonly attribute sequence<DOMString> iccIds;
-
- /**
- * Get ICC object by iccId.
- *
- * @param iccId
- * The identifier of the ICC.
- *
- * @return see MozIcc.webidl for the detail.
- */
- MozIcc? getIccById(DOMString iccId);
-
- /**
- * 'oniccdetected' event is notified whenever a new ICC is detected.
- */
- attribute EventHandler oniccdetected;
-
- /**
- * 'oniccundetected' event is notified whenever an ICC becomes undetected.
- */
- attribute EventHandler oniccundetected;
-};
deleted file mode 100644
--- a/dom/webidl/MozMobileCellInfo.webidl
+++ /dev/null
@@ -1,67 +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/. */
-
-[Pref="dom.mobileconnection.enabled"]
-interface MozMobileCellInfo
-{
- /**
- * Mobile Location Area Code (LAC) for GSM/WCDMA networks.
- *
- * Possible ranges from 0x0000 to 0xffff.
- * -1 if the LAC is unknown.
- */
- readonly attribute long gsmLocationAreaCode;
-
- /**
- * Mobile Cell ID for GSM/WCDMA networks.
- *
- * Possible ranges from 0x00000000 to 0xffffffff.
- * -1 if the cell id is unknown.
- */
- readonly attribute long long gsmCellId;
-
- /**
- * Base Station ID for CDMA networks.
- *
- * Possible ranges from 0 to 65535.
- * -1 if the base station id is unknown.
- */
- readonly attribute long cdmaBaseStationId;
-
- /**
- * Base Station Latitude for CDMA networks.
- *
- * Possible ranges from -1296000 to 1296000.
- * -2147483648 if the latitude is unknown.
- *
- * @see 3GPP2 C.S0005-A v6.0.
- */
- readonly attribute long cdmaBaseStationLatitude;
-
- /**
- * Base Station Longitude for CDMA networks.
- *
- * Possible ranges from -2592000 to 2592000.
- * -2147483648 if the longitude is unknown.
- *
- * @see 3GPP2 C.S0005-A v6.0.
- */
- readonly attribute long cdmaBaseStationLongitude;
-
- /**
- * System ID for CDMA networks.
- *
- * Possible ranges from 0 to 32767.
- * -1 if the system id is unknown.
- */
- readonly attribute long cdmaSystemId;
-
- /**
- * Network ID for CDMA networks.
- *
- * Possible ranges from 0 to 65535.
- * -1 if the network id is unknown.
- */
- readonly attribute long cdmaNetworkId;
-};
deleted file mode 100644
--- a/dom/webidl/MozMobileConnection.webidl
+++ /dev/null
@@ -1,665 +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/. */
-
-enum MobileNetworkSelectionMode {"automatic", "manual"};
-enum MobileRadioState {"enabling", "enabled", "disabling", "disabled"};
-enum MobileNetworkType {"gsm", "wcdma", "cdma", "evdo", "lte"};
-enum MobilePreferredNetworkType {"wcdma/gsm", "gsm", "wcdma", "wcdma/gsm-auto",
- "cdma/evdo", "cdma", "evdo",
- "wcdma/gsm/cdma/evdo", "lte/cdma/evdo",
- "lte/wcdma/gsm", "lte/wcdma/gsm/cdma/evdo",
- "lte", "lte/wcdma"};
-enum MobileRoamingMode {"home", "affiliated", "any"};
-
-[Pref="dom.mobileconnection.enabled"]
-interface MozMobileConnection : EventTarget
-{
- const long ICC_SERVICE_CLASS_VOICE = 0x01; // (1 << 0)
- const long ICC_SERVICE_CLASS_DATA = 0x02; // (1 << 1)
- const long ICC_SERVICE_CLASS_FAX = 0x04; // (1 << 2)
- const long ICC_SERVICE_CLASS_SMS = 0x08; // (1 << 3)
- const long ICC_SERVICE_CLASS_DATA_SYNC = 0x10; // (1 << 4)
- const long ICC_SERVICE_CLASS_DATA_ASYNC = 0x20; // (1 << 5)
- const long ICC_SERVICE_CLASS_PACKET = 0x40; // (1 << 6)
- const long ICC_SERVICE_CLASS_PAD = 0x80; // (1 << 7)
- const long ICC_SERVICE_CLASS_MAX = 0x80; // (1 << 7)
-
- /**
- * Call forwarding action.
- *
- * @see 3GPP TS 27.007 7.11 "mode".
- */
- const long CALL_FORWARD_ACTION_DISABLE = 0;
- const long CALL_FORWARD_ACTION_ENABLE = 1;
- const long CALL_FORWARD_ACTION_QUERY_STATUS = 2;
- const long CALL_FORWARD_ACTION_REGISTRATION = 3;
- const long CALL_FORWARD_ACTION_ERASURE = 4;
-
- /**
- * Call forwarding reason.
- *
- * @see 3GPP TS 27.007 7.11 "reason".
- */
- const long CALL_FORWARD_REASON_UNCONDITIONAL = 0;
- const long CALL_FORWARD_REASON_MOBILE_BUSY = 1;
- const long CALL_FORWARD_REASON_NO_REPLY = 2;
- const long CALL_FORWARD_REASON_NOT_REACHABLE = 3;
- const long CALL_FORWARD_REASON_ALL_CALL_FORWARDING = 4;
- const long CALL_FORWARD_REASON_ALL_CONDITIONAL_CALL_FORWARDING = 5;
-
- /**
- * Call barring program.
- */
- const long CALL_BARRING_PROGRAM_ALL_OUTGOING = 0;
- const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL = 1;
- const long CALL_BARRING_PROGRAM_OUTGOING_INTERNATIONAL_EXCEPT_HOME = 2;
- const long CALL_BARRING_PROGRAM_ALL_INCOMING = 3;
- const long CALL_BARRING_PROGRAM_INCOMING_ROAMING = 4;
- const long CALL_BARRING_PROGRAM_ALL_SERVICE = 5;
- const long CALL_BARRING_PROGRAM_OUTGOING_SERVICE = 6;
- const long CALL_BARRING_PROGRAM_INCOMING_SERVICE = 7;
-
- /**
- * Calling line identification restriction constants.
- *
- * @see 3GPP TS 27.007 7.7 Defined values.
- */
- const long CLIR_DEFAULT = 0;
- const long CLIR_INVOCATION = 1;
- const long CLIR_SUPPRESSION = 2;
-
- /**
- * These two fields can be accessed by privileged applications with the
- * 'mobilenetwork' permission.
- */
- readonly attribute DOMString lastKnownNetwork;
- readonly attribute DOMString lastKnownHomeNetwork;
-
- /**
- * Information about the voice connection.
- */
- readonly attribute MozMobileConnectionInfo voice;
-
- /**
- * Information about the data connection.
- */
- readonly attribute MozMobileConnectionInfo data;
-
- /**
- * Integrated Circuit Card Identifier of the SIM this mobile connection
- * corresponds to.
- */
- readonly attribute DOMString? iccId;
-
- /**
- * The selection mode of the voice and data networks.
- */
- readonly attribute MobileNetworkSelectionMode? networkSelectionMode;
-
- /**
- * The current radio state.
- */
- readonly attribute MobileRadioState? radioState;
-
- /**
- * Array of network types that are supported by this radio.
- */
- [Cached, Pure]
- readonly attribute sequence<MobileNetworkType> supportedNetworkTypes;
-
- /**
- * Search for available networks.
- *
- * @return a DOMRequest.
- *
- * If successful, the request's onsuccess will be called. And the request's
- * result will be an array of MozMobileNetworkInfo.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported', or
- * 'GenericFailure'.
- */
- [Throws]
- DOMRequest getNetworks();
-
- /**
- * Manually selects the passed in network, overriding the radio's current
- * selection.
- *
- * @return a DOMRequest.
- *
- * If successful, the request's onsuccess will be called.
- * Note: If the network was actually changed by this request,
- * the 'voicechange' and 'datachange' events will also be fired.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest selectNetwork(MozMobileNetworkInfo network);
-
- /**
- * Tell the radio to automatically select a network.
- *
- * @return a DOMRequest.
- *
- * If successful, the request's onsuccess will be called.
- * Note: If the network was actually changed by this request, the
- * 'voicechange' and 'datachange' events will also be fired.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest selectNetworkAutomatically();
-
- /**
- * Set preferred network type.
- *
- * @param type
- * PreferredNetworkType indicates the desired preferred network type.
- *
- * @return a DOMRequest.
- *
- * If successful, the request's onsuccess will be called.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'InvalidParameter', 'ModeNotSupported', 'IllegalSIMorME', or
- * 'GenericFailure'.
- */
- [Throws]
- DOMRequest setPreferredNetworkType(MobilePreferredNetworkType type);
-
- /**
- * Query current preferred network type.
- *
- * @return a DOMRequest.
- *
- * If successful, the request's onsuccess will be called. And the request's
- * result will be a string indicating the current preferred network type.
- * The value will be either 'wcdma/gsm', 'gsm', 'wcdma', 'wcdma/gsm-auto',
- * 'cdma/evdo', 'cdma', 'evdo', 'wcdma/gsm/cdma/evdo', 'lte/cdma/evdo',
- * 'lte/wcdma/gsm', 'lte/wcdma/gsm/cdma/evdo', 'lte' or 'lte/wcdma'.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest getPreferredNetworkType();
-
- /**
- * Set roaming preference.
- *
- * @param mode
- * RoamingPreferenceMode indicates the desired roaming preference.
- *
- * @return a DOMRequest.
- *
- * If successful, the request's onsuccess will be called.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest setRoamingPreference(MobileRoamingMode mode);
-
- /**
- * Query current roaming preference.
- *
- * @return a DOMRequest.
- *
- * If successful, the request's onsuccess will be called. And the request's
- * result will be a string indicating the current roaming preference.
- * The value will be either 'home', 'affiliated', or 'any'.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest getRoamingPreference();
-
- /**
- * Set voice privacy preference.
- *
- * @param enabled
- * Boolean indicates the preferred voice privacy mode used in voice
- * scrambling in CDMA networks. 'True' means the enhanced voice security
- * is required.
- *
- * @return a DOMRequest.
- *
- * If successful, the request's onsuccess will be called.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest setVoicePrivacyMode(boolean enabled);
-
- /**
- * Query current voice privacy mode.
- *
- * @return a DOMRequest.
- *
- * If successful, the request's onsuccess will be called. And the request's
- * result will be a boolean indicating the current voice privacy mode.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest getVoicePrivacyMode();
-
- /**
- * Configures call forward options.
- *
- * @param options
- * An object containing the call forward rule to set.
- * @see MozCallForwardingOptions for the detail of options.
- *
- * @return a DOMRequest
- *
- * If successful, the request's onsuccess will be called.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest setCallForwardingOption(optional MozCallForwardingOptions options);
-
- /**
- * Queries current call forward options.
- *
- * @param reason
- * Indicates the reason the call is being forwarded. It shall be one of
- * the MozMobileConnection.CALL_FORWARD_REASON_* values.
- *
- * @return a DOMRequest
- *
- * If successful, the request's onsuccess will be called. And the request's
- * result will be an array of MozCallForwardingOptions.
- * @see MozCallForwardingOptions for the detail of result.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest getCallForwardingOption(unsigned short reason);
-
- /**
- * Configures call barring options.
- *
- * @param options
- * An object containing the call barring rule to set.
- * @see MozCallBarringOptions for the detail of options.
- *
- * @return a DOMRequest
- *
- * If successful, the request's onsuccess will be called.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest setCallBarringOption(optional MozCallBarringOptions options);
-
- /**
- * Queries current call barring status.
- *
- * @param options
- * An object containing the call barring rule to query. No need to
- * specify 'enabled' property.
- * @see MozCallBarringOptions for the detail of options.
- *
- * @return a DOMRequest
- *
- * If successful, the request's onsuccess will be called. And the request's
- * result will be an object of MozCallBarringOptions with correct 'enabled'
- * property indicating the status of this rule.
- * @see MozCallBarringOptions for the detail of result.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest getCallBarringOption(optional MozCallBarringOptions options);
-
- /**
- * Change call barring facility password.
- *
- * @param options
- * An object containing information about pin and newPin, and,
- * this object must have both "pin" and "newPin" attributes
- * to change the call barring facility password.
- * @see MozCallBarringOptions for the detail of options.
- *
- * Example:
- *
- * changeCallBarringPassword({pin: "...",
- * newPin: "..."});
- *
- * @return a DOMRequest.
- *
- * If successful, the request's onsuccess will be called.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest changeCallBarringPassword(optional MozCallBarringOptions options);
-
- /**
- * Configures call waiting options.
- *
- * @param enabled
- * Boolean indicates the desired call waiting status.
- *
- * @return a DOMRequest.
- *
- * If successful, the request's onsuccess will be called.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest setCallWaitingOption(boolean enabled);
-
- /**
- * Queries current call waiting options.
- *
- * @return a DOMRequest
- *
- * If successful, the request's onsuccess will be called. And the request's
- * result will be a boolean indicating the call waiting status.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest getCallWaitingOption();
-
- /**
- * Enables or disables the presentation of the calling line identity (CLI) to
- * the called party when originating a call.
- *
- * @param mode
- * It shall be one of the MozMobileConnection.CLIR_* values.
- *
- * @return a DOMRequest
- *
- * If successful, the request's onsuccess will be called.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'InvalidParameter', 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest setCallingLineIdRestriction(unsigned short mode);
-
- /**
- * Queries current CLIR status.
- *
- * @return a DOMRequest
- *
- * If successful, the request's onsuccess will be called. And the request's
- * result will be an object containing containing CLIR 'n' and 'm' parameter.
- * @see MozClirStatus for the detail of result.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest getCallingLineIdRestriction();
-
- /**
- * Exit emergency callback mode.
- *
- * @return a DOMRequest
- *
- * If successful, the request's onsuccess will be called.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'RadioNotAvailable', 'RequestNotSupported',
- * 'IllegalSIMorME', or 'GenericFailure'.
- */
- [Throws]
- DOMRequest exitEmergencyCbMode();
-
- /**
- * Set radio enabled/disabled.
- *
- * @param enabled
- * True to enable the radio.
- *
- * @return a DOMRequest
- *
- * If successful, the request's onsuccess will be called.
- *
- * Otherwise, the request's onerror will be called, and the request's error
- * will be either 'InvalidStateError', 'RadioNotAvailable',
- * 'IllegalSIMorME', or 'GenericFailure'.
- *
- * Note: Request is not available when radioState is null, 'enabling', or
- * 'disabling'. Calling the function in above conditions will receive
- * 'InvalidStateError' error.
- */
- [Throws]
- DOMRequest setRadioEnabled(boolean enabled);
-
- /**
- * The 'voicechange' event is notified whenever the voice connection object
- * changes.
- */
- attribute EventHandler onvoicechange;
-
- /**
- * The 'datachange' event is notified whenever the data connection object
- * changes values.
- */
- attribute EventHandler ondatachange;
-
- /**
- * The 'dataerror' event is notified whenever the data connection object
- * receives an error from the RIL.
- */
- attribute EventHandler ondataerror;
-
- /**
- * The 'oncfstatechange' event is notified whenever the call forwarding
- * state changes.
- */
- attribute EventHandler oncfstatechange;
-
- /**
- * The 'emergencycbmodechange' event is notified whenever the emergency
- * callback mode changes.
- */
- attribute EventHandler onemergencycbmodechange;
-
- /**
- * The 'onotastatuschange' event is notified whenever the ota provision status
- * changes.
- */
- attribute EventHandler onotastatuschange;
-
- /**
- * The 'oniccchange' event is notified whenever the iccid value
- * changes.
- */
- attribute EventHandler oniccchange;
-
- /**
- * The 'onradiostatechange' event is notified whenever the radio state
- * changes.
- */
- attribute EventHandler onradiostatechange;
-
- /**
- * The 'onclirmodechange' event is notified whenever the mode of the calling
- * line id restriction (CLIR) changes.
- */
- attribute EventHandler onclirmodechange;
-};
-
-dictionary MozCallForwardingOptions
-{
- /**
- * Call forwarding rule status.
- *
- * It will be either not active (false), or active (true).
- *
- * Note: Unused for setting call forwarding options. It reports
- * the status of the rule when getting how the rule is
- * configured.
- *
- * @see 3GPP TS 27.007 7.11 "status".
- */
- boolean? active;
-
- /**
- * Indicates what to do with the rule. It shall be one of the
- * MozMobileConnection.CALL_FORWARD_ACTION_* values.
- */
- unsigned short? action;
-
- /**
- * Indicates the reason the call is being forwarded. It shall be one of the
- * MozMobileConnection.CALL_FORWARD_REASON_* values.
- */
- unsigned short? reason;
-
- /**
- * Phone number of forwarding address.
- */
- DOMString? number;
-
- /**
- * When "no reply" is enabled or queried, this gives the time in
- * seconds to wait before call is forwarded.
- */
- unsigned short? timeSeconds;
-
- /**
- * Service for which the call forward is set up. It should be one of the
- * MozMobileConnection.ICC_SERVICE_CLASS_* values.
- */
- unsigned short? serviceClass;
-};
-
-dictionary MozCallBarringOptions
-{
- /**
- * Indicates the program the call is being barred. It shall be one of the
- * MozMobileConnection.CALL_BARRING_PROGRAM_* values.
- */
- unsigned short? program;
-
- /**
- * Enable or disable the call barring program.
- */
- boolean? enabled;
-
- /**
- * Barring password. Use "" if no password specified.
- */
- DOMString? password;
-
- /**
- * Service for which the call barring is set up. It shall be one of the
- * MozMobileConnection.ICC_SERVICE_CLASS_* values.
- */
- unsigned short? serviceClass;
-
- /**
- * Old call barring password.
- *
- * Note: Only used for changeCallBarringPassword().
- */
- // TODO: Combine this with |password| and rename |newPin| to |newPassword|.
- // But it needs to modify the gaia side as well, so we could consider
- // doing this in bug 987541.
- DOMString? pin;
-
- /**
- * New call barring password.
- *
- * Note: Only used for changeCallBarringPassword().
- */
- DOMString? newPin;
-};
-
-dictionary MozMMIResult
-{
- /**
- * Indicate whether the result is successful or not.
- */
- boolean success = true;
-
- /**
- * String key that identifies the service associated with the MMI code
- * request. The UI is supposed to handle the localization of the strings
- * associated with this string key.
- */
- DOMString serviceCode = "";
-
- /**
- * String key containing the status message of the associated MMI request or
- * the error message when the request fails.
-
- * The UI is supposed to handle the localization of the strings associated
- * with this string key.
- */
- DOMString statusMessage = "";
-
- /**
- * Some MMI requests like call forwarding or PIN/PIN2/PUK/PUK2 related
- * requests provide extra information along with the status message, this
- * information can be a number, an array of string keys or an array of
- * MozCallForwardingOptions.
- *
- * And it should be
- * (unsigned short or sequence<DOMString> or sequence<MozCallForwardingOptions>)
- * But we cannot yet use sequences as union member types (please see bug 767924)
- * ,so we use object here.
- */
- (unsigned short or object) additionalInformation;
-};
-
-dictionary MozClirStatus
-{
- /**
- * CLIR parameter 'n': parameter sets the adjustment for outgoing calls.
- *
- * It shall be one of the MozMobileConnection.CLIR_* values.
- */
- unsigned short n;
-
- /**
- * CLIR parameter 'm': parameter shows the subscriber CLIR service status in
- * the network.
- * (0) CLIR not provisioned.
- * (1) CLIR provisioned in permanent mode.
- * (2) unknown (e.g. no network, etc.).
- * (3) CLIR temporary mode presentation restricted.
- *
- * @see 3GPP TS 27.007 7.7 defined values.
- */
- unsigned short m;
-};
deleted file mode 100644
--- a/dom/webidl/MozMobileConnectionArray.webidl
+++ /dev/null
@@ -1,11 +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/.
- */
-
-[Pref="dom.mobileconnection.enabled"]
-interface MozMobileConnectionArray {
- getter MozMobileConnection? item(unsigned long index);
- readonly attribute unsigned long length;
-};
deleted file mode 100644
--- a/dom/webidl/MozMobileConnectionInfo.webidl
+++ /dev/null
@@ -1,66 +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/. */
-
-enum MobileConnectionState {"notSearching", "searching", "denied", "registered"};
-enum MobileConnectionType {"gsm", "gprs", "edge", "umts", "hsdpa", "hsupa",
- "hspa", "hspa+", "is95a", "is95b", "1xrtt", "evdo0",
- "evdoa", "evdob", "ehrpd", "lte"};
-
-[Pref="dom.mobileconnection.enabled"]
-interface MozMobileConnectionInfo
-{
- /**
- * State of the connection.
- */
- readonly attribute MobileConnectionState? state;
-
- /**
- * Indicates whether the connection is ready.
- *
- * Note: The meaning of "connection ready" for data and voice are different.
- * - Data: the "default" data connection is established or not.
- * - Voice: voice is registered to network or not.
- */
- readonly attribute boolean connected;
-
- /**
- * Indicates whether only emergency calls are possible.
- *
- * This flag is only relevant to voice connections and when 'connected' is
- * false.
- */
- readonly attribute boolean emergencyCallsOnly;
-
- /**
- * Indicates whether the connection is going through a foreign operator
- * (roaming) or not.
- */
- readonly attribute boolean roaming;
-
- /**
- * Network operator information.
- */
- readonly attribute MozMobileNetworkInfo? network;
-
- /**
- * Type of connection.
- */
- readonly attribute MobileConnectionType? type;
-
- /**
- * Signal strength in dBm, or null if no service is available.
- */
- readonly attribute long? signalStrength;
-
- /**
- * Signal strength, represented linearly as a number between 0 (weakest
- * signal) and 100 (full signal).
- */
- readonly attribute unsigned short? relSignalStrength;
-
- /**
- * Cell location information.
- */
- readonly attribute MozMobileCellInfo? cell;
-};
deleted file mode 100644
--- a/dom/webidl/MozMobileNetworkInfo.webidl
+++ /dev/null
@@ -1,34 +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/. */
-
-enum MobileNetworkState {"available", "connected", "forbidden"};
-
-[Pref="dom.mobileconnection.enabled"]
-interface MozMobileNetworkInfo
-{
- /**
- * Short name of the network operator.
- */
- readonly attribute DOMString? shortName;
-
- /**
- * Long name of the network operator.
- */
- readonly attribute DOMString? longName;
-
- /**
- * Mobile Country Code (MCC) of the network operator.
- */
- readonly attribute DOMString? mcc;
-
- /**
- * Mobile Network Code (MNC) of the network operator.
- */
- readonly attribute DOMString? mnc;
-
- /**
- * State of this network operator.
- */
- readonly attribute MobileNetworkState? state;
-};
deleted file mode 100644
--- a/dom/webidl/MozOtaStatusEvent.webidl
+++ /dev/null
@@ -1,33 +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/.
- */
-
-[Pref="dom.mobileconnection.enabled",
- Constructor(DOMString type, optional MozOtaStatusEventInit eventInitDict)]
-interface MozOtaStatusEvent : Event
-{
- /**
- * One of the following values:
- *
- * spl_unlocked
- * spc_retries_exceeded
- * a_key_exchanged
- * ssd_updated
- * nam_downloaded
- * mdn_downloaded
- * imsi_downloaded
- * prl_downloaded
- * committed
- * otapa_started
- * otapa_stopped
- * otapa_aborted
- */
- readonly attribute DOMString status;
-};
-
-dictionary MozOtaStatusEventInit : EventInit
-{
- DOMString status = "";
-};
deleted file mode 100644
--- a/dom/webidl/MozStkCommandEvent.webidl
+++ /dev/null
@@ -1,715 +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/.
- */
-
-enum IccImageCodingScheme { "basic", "color", "color-transparency" };
-
-dictionary MozStkIcon
-{
- /*
- * Width of the icon.
- */
- unsigned long width;
-
- /*
- * Height of the icon.
- */
- unsigned long height;
-
- /*
- * Image coding scheme of the icon.
- */
- IccImageCodingScheme codingScheme;
-
- /*
- * Array of pixels. Each pixel represents a color in the RGBA format made up
- * of four bytes, that is, the Red sample in the highest 8 bits, followed by
- * the Green sample, Blue sample and the Alpha sample in the lowest 8 bits.
- */
- sequence<unsigned long> pixels;
-};
-
-dictionary MozStkIconContainer
-{
- /**
- * Indicates how the icon is to be used.
- *
- * @see TS 11.14, clause 12.31, Icon Identifier.
- *
- * true: icon replaces the text string.
- * false: icon shall be displayed together with the text string.
- */
- boolean iconSelfExplanatory;
-
- /**
- * Icon(s) that replaces or accompanies the text string.
- *
- * @see TS 11.14, clause 12.31, Icon Identifier.
- *
- * Array of icons, basically of a same image, that may differ in size,
- * resolution or coding scheme. The first icon should be the default one.
- */
- sequence<MozStkIcon> icons;
-};
-
-[Pref="dom.icc.enabled",
- ChromeOnly,
- Constructor(DOMString type, optional MozStkCommandEventInit eventInitDict)]
-interface MozStkCommandEvent : Event
-{
- readonly attribute any command;
-};
-
-dictionary MozStkCommandEventInit : EventInit
-{
- any command = null;
-};
-
-dictionary MozStkTextMessage : MozStkIconContainer
-{
- /**
- * Text String.
- *
- * @see TS 11.14, clause 12.15, Text String.
- */
- DOMString text;
-
- /**
- * The length of time for which the ME shall display the dialog.
- */
- MozStkDuration duration;
-
- /**
- * Indicate this text message is high priority or normal priority.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, Display Text, bit 1.
- *
- * High priority text shall be displayed on the screen immediately, except if
- * there is a conflict of priority level of alerting such as incoming calls
- * or a low battery warning. In that situation, the resolution is left to
- * the terminal. If the command is rejected in spite of the high priority,
- * the terminal shall inform the ICC with resultCode is
- * MozIccManager.STK_RESULT_TERMINAL_CRNTLY_UNABLE_TO_PROCESS in MozStkResponse.
- *
- * true: high priority
- * false: normal priority
- */
- boolean isHighPriority;
-
- /**
- * Need to wait for user to clear message or not.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, Display Text, bit 8.
- *
- * If this attribute is true, but user doesn't give any input within a period
- * of time(said 30 secs), the terminal shall inform the ICC with resultCode
- * is MozIccManager.STK_RESULT_NO_RESPONSE_FROM_USER in MozStkResponse.
- *
- * true: Wait for user to clear message.
- * false: clear message after a delay.
- */
- boolean userClear;
-
- /**
- * Need to response immediately or not.
- *
- * @see TS 11.14, clause 12.43, Immediate response.
- *
- * When this attribute is true, the terminal shall immediately send
- * MozStkResponse with resultCode is OK.
- *
- * true: The terminal shall send response immediately.
- * false: otherwise.
- */
- boolean responseNeeded;
-};
-
-dictionary MozStkItem : MozStkIconContainer
-{
- /**
- * Identifier of item.
- *
- * The identifier is a single byte between '01' and 'FF'. Each item shall
- * have a unique identifier within an Item list.
- */
- unsigned short identifier;
-
- /**
- * Text string of item.
- */
- DOMString text;
-};
-
-dictionary MozStkMenu : MozStkIconContainer
-{
- /**
- * Array of MozStkItem.
- *
- * @see TS 11.14, clause 12.9
- */
- sequence<MozStkItem> items;
-
- /**
- * Presentation type, one of MozIccManager.STK_MENU_TYPE_*.
- */
- unsigned short presentationType;
-
- /**
- * Title of the menu.
- */
- DOMString title;
-
- /**
- * Default item identifier of the menu.
- */
- unsigned short defaultItem;
-
- /**
- * Help information available or not.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, SET UP MENU, bit 8.
- *
- * true: help information available.
- * false: no help information available.
- */
- boolean isHelpAvailable;
-
- /**
- * List of Next Action Indicators.
- * Each element should be one of MozIccManager.STK_CMD_*
- * or MozIccManager.STK_NEXT_ACTION_*
- * If it's MozIccManager.STK_NEXT_ACTION_NULL, the terminal should ignore this
- * action in corresponding item.
- *
- * @see TS 11.14, clause 12.24, Items Next Action Indicator.
- */
- sequence<unsigned short> nextActionList;
-};
-
-dictionary MozStkInput : MozStkIconContainer
-{
- /**
- * Text for the ME to display in conjunction with asking the user to respond.
- */
- DOMString text;
-
- /**
- * The length of time for which the ME shall display the dialog. This field
- * is used only for GET INKEY.
- *
- * @see TS 11.14, clause 11.8, duration, GET INKEY T.C 27.22.4.2.8.4.2
- */
- MozStkDuration duration;
-
- /**
- * Minimum length of response.
- */
- unsigned short minLength;
-
- /**
- * Maximum length of response.
- */
- unsigned short maxLength;
-
- /**
- * Text for the ME to display, corresponds to a default text string offered
- * by the ICC.
- */
- DOMString defaultText;
-
- /**
- * Input format.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 1.
- *
- * true: Alphabet set.
- * false: Digits only.
- */
- boolean isAlphabet;
-
- /**
- * Alphabet encoding.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 2.
- *
- * true: UCS2 alphabet.
- * false: default SMS alphabet.
- */
- boolean isUCS2;
-
- /**
- * Visibility of input.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 3.
- *
- * true: User input shall not be revealed in any way.
- * false: ME may echo user input on the display.
- */
- boolean hideInput;
-
- /**
- * Yes/No response is requested.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, GET INKEY, bit 3.
- *
- * true: Yes/No response is requested, and character sets
- * (Alphabet set and UCS2) are disabled.
- * false: Character sets (Alphabet set and UCS2) are enabled.
- */
- boolean isYesNoRequested;
-
- /**
- * User input in packed or unpacked format.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT, bit 4.
- *
- * true: User input to be in SMS packed format.
- * false: User input to be in unpacked format.
- */
- boolean isPacked;
-
- /**
- * Help information available or not.
- *
- * @see TS 11.14, clause 12.6, Command Qualifier, GET INPUT/GET INKEY, bit 8.
- *
- * true: help information available.
- * false: no help information available.
- */
- boolean isHelpAvailable;
-};
-
-dictionary MozStkBrowserSetting
-{
- /**
- * Confirm message to launch browser.
- */
- MozStkTextMessage confirmMessage;
-
- /**
- * The URL to be opened by browser.
- */
- DOMString url;
-
- /**
- * One of MozIccManager.STK_BROWSER_MODE_*.
- */
- unsigned short mode;
-};
-
-dictionary MozStkSetUpCall
-{
- /**
- * The Dialling number.
- */
- DOMString address;
-
- /**
- * The text message used in user confirmation phase.
- */
- MozStkTextMessage confirmMessage;
-
- /**
- * The text message used in call set up phase.
- */
- MozStkTextMessage callMessage;
-
- /**
- * The Optional maximum duration for the redial mechanism.
- * The time elapsed since the first call set-up attempt has exceeded the duration
- * requested by the UICC, the redial mechanism is terminated.
- */
- MozStkDuration duration;
-};
-
-dictionary MozStkSetUpEventList
-{
- /**
- * The list of events that needs to provide details to ICC when they happen.
- * When this valus is null, means an indication to remove the existing list
- * of events in ME.
- *
- * @see MozIccManager.STK_EVENT_TYPE_*
- */
- sequence<unsigned short> eventList;
-};
-
-dictionary MozStkLocationInfo
-{
- /**
- * Mobile Country Code (MCC) of the current serving operator.
- */
- DOMString mcc;
-
- /**
- * Mobile Network Code (MNC) of the current serving operator.
- */
- DOMString mnc;
-
- /**
- * Mobile Location Area Code (LAC) for the current serving operator.
- */
- unsigned short gsmLocationAreaCode;
-
- /**
- * Mobile Cell ID for the current serving operator.
- */
- unsigned long gsmCellId;
-};
-
-dictionary MozStkDuration
-{
- /**
- * Time unit used, should be one of MozIccManager.STK_TIME_UNIT_*.
- */
- unsigned short timeUnit;
-
- /**
- * The length of time required, expressed in timeUnit.
- */
- octet timeInterval;
-};
-
-dictionary MozStkPlayTone : MozStkIconContainer
-{
- /**
- * Text String.
- */
- DOMString text;
-
- /**
- * One of MozIccManager.STK_TONE_TYPE_*.
- */
- unsigned short tone;
-
- /**
- * The length of time for which the ME shall generate the tone.
- */
- MozStkDuration duration;
-
- /**
- * Need to vibrate or not.
- * true: vibrate alert, if available, with the tone.
- * false: use of vibrate alert is up to the ME.
- */
- boolean isVibrate;
-};
-
-dictionary MozStkProvideLocalInfo
-{
- /**
- * Indicate which local information is required.
- * It shall be one of following:
- * - MozIccManager.STK_LOCAL_INFO_LOCATION_INFO
- * - MozIccManager.STK_LOCAL_INFO_IMEI
- * - MozIccManager.STK_LOCAL_INFO_DATE_TIME_ZONE
- * - MozIccManager.STK_LOCAL_INFO_LANGUAGE
- */
- unsigned short localInfoType;
-};
-
-dictionary MozStkLocationEvent
-{
- /**
- * The type of this event.
- * It shall be MozIccManager.STK_EVENT_TYPE_LOCATION_STATUS;
- */
- unsigned short eventType;
-
- /**
- * Indicate current service state of the MS with one of the values listed
- * below:
- * - MozIccManager.STK_SERVICE_STATE_NORMAL
- * - MozIccManager.STK_SERVICE_STATE_LIMITED
- * - MozIccManager.STK_SERVICE_STATE_UNAVAILABLE
- */
- unsigned short locationStatus;
-
- /**
- * See MozStkLocationInfo.
- * This value shall only be provided if the locationStatus indicates
- * MozIccManager.STK_SERVICE_STATE_NORMAL.
- */
- MozStkLocationInfo locationInfo;
-};
-
-dictionary MozStkTimer
-{
- /**
- * Identifier of a timer.
- */
- octet timerId;
-
- /**
- * Length of time during which the timer has to run.
- * The resolution of a timer is 1 second.
- */
- unsigned long timerValue;
-
- /**
- * The action requested from UICC.
- * It shall be one of below:
- * - MozIccManager.STK_TIMER_START
- * - MozIccManager.STK_TIMER_DEACTIVATE
- * - MozIccManager.STK_TIMER_GET_CURRENT_VALUE
- */
- unsigned short timerAction;
-};
-
-dictionary MozStkBipMessage : MozStkIconContainer
-{
- /**
- * Text String
- */
- DOMString text;
-};
-
-dictionary MozStkCommand
-{
- /**
- * The number of command issued by ICC. And it is assigned
- * by ICC may take any hexadecimal value betweean '01' and 'FE'.
- *
- * @see TS 11.14, clause 6.5.1
- */
- unsigned short commandNumber;
-
- /**
- * One of MozIccManager.STK_CMD_*
- */
- unsigned short typeOfCommand;
-
- /**
- * Qualifiers specific to the command.
- */
- unsigned short commandQualifier;
-
- /**
- * options varies accrording to the typeOfCommand in MozStkCommand.
- *
- * When typeOfCommand is
- * - MozIccManager.STK_CMD_DISPLAY_TEXT
- * - MozIccManager.STK_CMD_SET_UP_IDLE_MODE_TEXT
- * - MozIccManager.STK_CMD_SEND_{SS|USSD|SMS|DTMF},
- * options is MozStkTextMessage.
- *
- * When typeOfCommand is
- * - MozIccManager.STK_CMD_SELECT_ITEM
- * - MozIccManager.STK_CMD_SET_UP_MENU
- * options is MozStkMenu.
- *
- * When typeOfCommand is
- * - MozIccManager.STK_CMD_GET_INKEY
- * - MozIccManager.STK_CMD_GET_INPUT,
- * options is MozStkInput.
- *
- * When typeOfCommand is
- * - MozIccManager.STK_CMD_LAUNCH_BROWSER
- * options is MozStkBrowserSetting.
- *
- * When typeOfCommand is
- * - MozIccManager.STK_CMD_SET_UP_CALL
- * options is MozStkSetUpCall.
- *
- * When typeOfCommand is
- * - MozIccManager.STK_CMD_SET_UP_EVENT_LIST
- * options is MozStkSetUpEventList.
- *
- * When typeOfCommand is
- * - MozIccManager.STK_CMD_PLAY_TONE
- * options is MozStkPlayTone.
- *
- * When typeOfCommand is
- * - MozIccManager.STK_CMD_POLL_INTERVAL
- * options is MozStkDuration.
- *
- * When typeOfCommand is
- * - MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO
- * options is MozStkProvideLocalInfo.
- *
- * When typeOfCommand is
- * - MozIccManager.STK_CMD_TIMER_MANAGEMENT
- * option is MozStkTimer
- *
- * When typeOfCommand is
- * - MozIccManager.STK_CMD_OPEN_CHANNEL
- * - MozIccManager.STK_CMD_CLOSE_CHANNEL
- * - MozIccManager.STK_CMD_SEND_DATA
- * - MozIccManager.STK_CMD_RECEIVE_DATA
- * options is MozStkBipMessage
- *
- * When typeOfCommand is
- * - MozIccManager.STK_CMD_POLL_OFF
- * options is null.
- *
- * When typeOfCommand is
- * - MozIccManager.STK_CMD_REFRESH
- * options is null.
- */
- any options;
-};
-
-dictionary MozStkResponse
-{
- /**
- * One of MozIccManager.STK_RESULT_*
- */
- unsigned short resultCode;
-
- /**
- * One of MozIccManager.STK_ADDITIONAL_INFO_*
- */
- unsigned short additionalInformation;
-
- /**
- * The identifier of the item selected by user.
- *
- * @see MozStkItem.identifier
- */
- unsigned short itemIdentifier;
-
- /**
- * User input.
- */
- DOMString input;
-
- /**
- * YES/NO response.
- *
- * @see MozStkInput.isYesNoRequested
- */
- boolean isYesNo;
-
- /**
- * User has confirmed or rejected the call during
- * MozIccManager.STK_CMD_CALL_SET_UP.
- *
- * @see RIL_REQUEST_STK_HANDLE_CALL_SETUP_REQUESTED_FROM_SIM
- *
- * true: Confirmed by User.
- * false: Rejected by User.
- */
- boolean hasConfirmed;
-
- /**
- * The response for MozIccManager.STK_CMD_PROVIDE_LOCAL_INFO
- */
- MozStkLocalInfo localInfo;
-
- /**
- * The response for MozIccManager.STK_CMD_TIMER_MANAGEMENT.
- * The 'timerValue' is needed if the action of
- * MozIccManager.STK_CMD_TIMER_MANAGEMENT is MozIccManager.STK_TIMER_DEACTIVATE
- * or MozIccManager.STK_TIMER_GET_CURRENT_VALUE.
- * It shall state the current value of a timer. And the resolution is 1 second.
- */
- MozStkTimer timer;
-};
-
-dictionary MozStkCallEvent
-{
- /**
- * The type of this event.
- * It shall be one of following:
- * - MozIccManager.STK_EVENT_TYPE_MT_CALL,
- * - MozIccManager.STK_EVENT_TYPE_CALL_CONNECTED,
- * - MozIccManager.STK_EVENT_TYPE_CALL_DISCONNECTED.
- */
- unsigned short eventType;
-
- /**
- * Remote party number.
- */
- DOMString number;
-
- /**
- * This field is available in MozIccManager.STK_EVENT_TYPE_CALL_CONNECTED and
- * MozIccManager.STK_EVENT_TYPE_CALL_DISCONNECTED events.
- * For the MozIccManager.STK_EVENT_TYPE_CALL_CONNECTED event, setting this to
- * true means the connection is answered by remote end, that is, this is an
- * outgoing call.
- * For the MozIccManager.STK_EVENT_TYPE_CALL_DISCONNECTED event, setting this
- * to true indicates the connection is hung up by remote.
- */
- boolean isIssuedByRemote;
-
- /**
- * This field is available in Call Disconnected event to indicate the cause
- * of disconnection. The cause string is passed to gaia through the error
- * listener of CallEvent. Null if there's no error.
- */
- DOMString error;
-};
-
-dictionary MozStkLocalInfo
-{
- /**
- * IMEI information
- */
- DOMString imei;
-
- /**
- * Location Information
- */
- MozStkLocationInfo locationInfo;
-
- /**
- * Date information
- */
- Date date;
-
- /**
- * Language Information
- *
- * @see ISO 639-1, Alpha-2 code
- */
- DOMString language;
-};
-
-dictionary MozStkLanguageSelectionEvent
-{
- /**
- * The type of this event.
- * It shall be MozIccManager.STK_EVENT_TYPE_LANGUAGE_SELECTION.
- */
- unsigned short eventType;
-
- /**
- * Language Information
- *
- * @see ISO 639-1, Alpha-2 code
- * "de" for German, "en" for English, "zh" for Chinese, etc.
- */
- DOMString language;
-};
-
-dictionary MozStkBrowserTerminationEvent
-{
- /**
- * The type of this event.
- * It shall be MozIccManager.STK_EVENT_TYPE_BROWSER_TERMINATION
- */
- unsigned short eventType;
-
- /**
- * This object shall contain the browser termination cause.
- * See TZ 102 223 8.51. It shall be one of following:
- * - MozIccManager.STK_BROWSER_TERMINATION_CAUSE_USER
- * - MozIccManager.STK_BROWSER_TERMINATION_CAUSE_ERROR
- */
- unsigned short terminationCause;
-};
-
-dictionary MozStkGeneralEvent
-{
- /**
- * The type of this event, MozStkGeneralEvent can be used for all Stk Event
- * requires no more parameter than event type, including
- * MozIccManager.STK_EVENT_TYPE_USER_ACTIVITY.
- * MozIccManager.STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE.
- * HCI Connectivity Event(Not defined in interface yet).
- */
- unsigned short eventType;
-};
--- a/dom/webidl/Navigator.webidl
+++ b/dom/webidl/Navigator.webidl
@@ -266,29 +266,16 @@ partial interface Navigator {
};
// NetworkInformation
partial interface Navigator {
[Throws, Pref="dom.netinfo.enabled"]
readonly attribute NetworkInformation connection;
};
-#ifdef MOZ_B2G_RIL
-partial interface Navigator {
- [Throws, Pref="dom.mobileconnection.enabled", ChromeOnly, UnsafeInPrerendering]
- readonly attribute MozMobileConnectionArray mozMobileConnections;
-};
-
-partial interface Navigator {
- [Throws, Pref="dom.icc.enabled", ChromeOnly,
- UnsafeInPrerendering]
- readonly attribute MozIccManager? mozIccManager;
-};
-#endif // MOZ_B2G_RIL
-
#ifdef MOZ_GAMEPAD
// https://dvcs.w3.org/hg/gamepad/raw-file/default/gamepad.html#navigator-interface-extension
partial interface Navigator {
[Throws, Pref="dom.gamepad.enabled"]
sequence<Gamepad?> getGamepads();
};
partial interface Navigator {
[Pref="dom.gamepad.test.enabled"]
--- a/dom/webidl/moz.build
+++ b/dom/webidl/moz.build
@@ -77,17 +77,16 @@ WEBIDL_FILES = [
'Client.webidl',
'Clients.webidl',
'ClipboardEvent.webidl',
'CommandEvent.webidl',
'Comment.webidl',
'CompositionEvent.webidl',
'Console.webidl',
'ConstantSourceNode.webidl',
- 'Contacts.webidl',
'ContainerBoxObject.webidl',
'ConvolverNode.webidl',
'Coordinates.webidl',
'CreateOfferRequest.webidl',
'Crypto.webidl',
'CSPDictionaries.webidl',
'CSPReport.webidl',
'CSS.webidl',
@@ -249,17 +248,16 @@ WEBIDL_FILES = [
'HTMLTableSectionElement.webidl',
'HTMLTemplateElement.webidl',
'HTMLTextAreaElement.webidl',
'HTMLTimeElement.webidl',
'HTMLTitleElement.webidl',
'HTMLTrackElement.webidl',
'HTMLUListElement.webidl',
'HTMLVideoElement.webidl',
- 'IccCardLockError.webidl',
'IDBCursor.webidl',
'IDBDatabase.webidl',
'IDBFactory.webidl',
'IDBFileHandle.webidl',
'IDBFileRequest.webidl',
'IDBIndex.webidl',
'IDBKeyRange.webidl',
'IDBMutableFile.webidl',
@@ -320,24 +318,16 @@ WEBIDL_FILES = [
'MenuBoxObject.webidl',
'MessageChannel.webidl',
'MessageEvent.webidl',
'MessagePort.webidl',
'MimeType.webidl',
'MimeTypeArray.webidl',
'MouseEvent.webidl',
'MouseScrollEvent.webidl',
- 'MozIcc.webidl',
- 'MozIccInfo.webidl',
- 'MozIccManager.webidl',
- 'MozMobileCellInfo.webidl',
- 'MozMobileConnection.webidl',
- 'MozMobileConnectionArray.webidl',
- 'MozMobileConnectionInfo.webidl',
- 'MozMobileNetworkInfo.webidl',
'MozPowerManager.webidl',
'MozSelfSupport.webidl',
'MozTetheringManager.webidl',
'MozTimeManager.webidl',
'MozWakeLock.webidl',
'MutationEvent.webidl',
'MutationObserver.webidl',
'NamedNodeMap.webidl',
@@ -708,40 +698,32 @@ else:
]
GENERATED_EVENTS_WEBIDL_FILES = [
'AddonEvent.webidl',
'AnimationPlaybackEvent.webidl',
'AutocompleteErrorEvent.webidl',
'BlobEvent.webidl',
'CaretStateChangedEvent.webidl',
- 'CFStateChangeEvent.webidl',
'CloseEvent.webidl',
- 'DataErrorEvent.webidl',
'DeviceLightEvent.webidl',
'DeviceOrientationEvent.webidl',
'DeviceProximityEvent.webidl',
'DeviceStorageAreaChangedEvent.webidl',
'DeviceStorageChangeEvent.webidl',
'DownloadEvent.webidl',
'ErrorEvent.webidl',
'FontFaceSetLoadEvent.webidl',
'HashChangeEvent.webidl',
'HiddenPluginEvent.webidl',
- 'IccChangeEvent.webidl',
'ImageCaptureErrorEvent.webidl',
'MediaStreamEvent.webidl',
'MediaStreamTrackEvent.webidl',
- 'MozClirModeEvent.webidl',
- 'MozContactChangeEvent.webidl',
- 'MozEmergencyCbModeEvent.webidl',
- 'MozOtaStatusEvent.webidl',
'MozSettingsEvent.webidl',
'MozSettingsTransactionEvent.webidl',
- 'MozStkCommandEvent.webidl',
'PageTransitionEvent.webidl',
'PerformanceEntryEvent.webidl',
'PluginCrashedEvent.webidl',
'PopStateEvent.webidl',
'PopupBlockedEvent.webidl',
'PresentationConnectionAvailableEvent.webidl',
'PresentationConnectionCloseEvent.webidl',
'ProgressEvent.webidl',
--- a/layout/build/nsLayoutModule.cpp
+++ b/layout/build/nsLayoutModule.cpp
@@ -181,18 +181,16 @@ NS_NewXULTreeBuilder(nsISupports* aOuter
static void Shutdown();
#include "nsGeolocation.h"
#include "nsDeviceSensors.h"
#include "mozilla/dom/nsContentSecurityManager.h"
#include "mozilla/dom/nsCSPService.h"
#include "mozilla/dom/nsCSPContext.h"
-#include "nsIIccService.h"
-#include "nsIMobileConnectionService.h"
#include "nsIPowerManagerService.h"
#include "nsIMediaManager.h"
#include "mozilla/dom/nsMixedContentBlocker.h"
#include "AudioChannelService.h"
#include "mozilla/net/WebSocketEventService.h"
#include "mozilla/dom/FlyWebService.h"
@@ -316,17 +314,16 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(AudioChan
NS_GENERIC_FACTORY_CONSTRUCTOR(nsDeviceSensors)
#ifndef MOZ_WIDGET_GONK
#if defined(ANDROID)
NS_GENERIC_FACTORY_CONSTRUCTOR(nsHapticFeedback)
#endif
#endif
NS_GENERIC_FACTORY_CONSTRUCTOR_INIT(ThirdPartyUtil, Init)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIIccService, NS_CreateIccService)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPowerManagerService,
PowerManagerService::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsITimeService,
TimeService::GetInstance)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIStreamingProtocolControllerService,
StreamingProtocolControllerService::GetInstance)
#ifdef MOZ_WIDGET_GONK
@@ -336,18 +333,16 @@ NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR
#endif
// Since the nsVolumeService constructor calls into nsIPowerManagerService,
// we need it to be constructed sometime after nsIPowerManagerService.
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsVolumeService,
nsVolumeService::GetSingleton)
#endif
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMediaManagerService,
MediaManager::GetInstance)
-NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIMobileConnectionService,
- NS_CreateMobileConnectionService)
NS_GENERIC_FACTORY_CONSTRUCTOR(PresentationDeviceManager)
NS_GENERIC_FACTORY_CONSTRUCTOR(TextInputProcessor)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(FakeInputPortService,
InputPortServiceFactory::CreateFakeInputPortService)
NS_GENERIC_FACTORY_CONSTRUCTOR(InputPortData)
NS_GENERIC_FACTORY_SINGLETON_CONSTRUCTOR(nsIPresentationService,
NS_CreatePresentationService)
NS_GENERIC_FACTORY_CONSTRUCTOR(PresentationTCPSessionTransport)
@@ -768,18 +763,16 @@ NS_DEFINE_NAMED_CID(NS_DEVICE_SENSORS_CI
NS_DEFINE_NAMED_CID(NS_HAPTICFEEDBACK_CID);
#endif
#endif
#ifndef DISABLE_MOZ_RIL_GEOLOC
#ifdef MOZ_WIDGET_GONK
NS_DEFINE_NAMED_CID(GONK_GPS_GEOLOCATION_PROVIDER_CID);
#endif
#endif
-NS_DEFINE_NAMED_CID(NS_MOBILE_CONNECTION_SERVICE_CID);
-NS_DEFINE_NAMED_CID(ICC_SERVICE_CID);
NS_DEFINE_NAMED_CID(NS_POWERMANAGERSERVICE_CID);
NS_DEFINE_NAMED_CID(OSFILECONSTANTSSERVICE_CID);
NS_DEFINE_NAMED_CID(UDPSOCKETCHILD_CID);
NS_DEFINE_NAMED_CID(NS_TIMESERVICE_CID);
NS_DEFINE_NAMED_CID(NS_MEDIASTREAMCONTROLLERSERVICE_CID);
NS_DEFINE_NAMED_CID(NS_MEDIAMANAGERSERVICE_CID);
#ifdef MOZ_WEBSPEECH_TEST_BACKEND
NS_DEFINE_NAMED_CID(NS_FAKE_SPEECH_RECOGNITION_SERVICE_CID);
@@ -1059,31 +1052,29 @@ static const mozilla::Module::CIDEntry k
{ &kNS_DEVICE_SENSORS_CID, false, nullptr, nsDeviceSensorsConstructor },
#ifndef MOZ_WIDGET_GONK
#if defined(ANDROID)
{ &kNS_HAPTICFEEDBACK_CID, false, nullptr, nsHapticFeedbackConstructor },
#endif
#endif
{ &kTHIRDPARTYUTIL_CID, false, nullptr, ThirdPartyUtilConstructor },
{ &kNS_STRUCTUREDCLONECONTAINER_CID, false, nullptr, nsStructuredCloneContainerConstructor },
- { &kICC_SERVICE_CID, false, nullptr, nsIIccServiceConstructor },
{ &kNS_POWERMANAGERSERVICE_CID, false, nullptr, nsIPowerManagerServiceConstructor, Module::ALLOW_IN_GPU_PROCESS },
{ &kOSFILECONSTANTSSERVICE_CID, true, nullptr, OSFileConstantsServiceConstructor },
{ &kUDPSOCKETCHILD_CID, false, nullptr, UDPSocketChildConstructor },
{ &kGECKO_MEDIA_PLUGIN_SERVICE_CID, true, nullptr, GeckoMediaPluginServiceConstructor },
{ &kNS_TIMESERVICE_CID, false, nullptr, nsITimeServiceConstructor },
{ &kNS_MEDIASTREAMCONTROLLERSERVICE_CID, false, nullptr, nsIStreamingProtocolControllerServiceConstructor },
#if defined(MOZ_WIDGET_GONK) && !defined(DISABLE_MOZ_RIL_GEOLOC)
{ &kGONK_GPS_GEOLOCATION_PROVIDER_CID, false, nullptr, nsIGeolocationProviderConstructor },
#endif
{ &kNS_MEDIAMANAGERSERVICE_CID, false, nullptr, nsIMediaManagerServiceConstructor },
#ifdef ACCESSIBILITY
{ &kNS_ACCESSIBILITY_SERVICE_CID, false, nullptr, CreateA11yService },
#endif
- { &kNS_MOBILE_CONNECTION_SERVICE_CID, false, NULL, nsIMobileConnectionServiceConstructor },
{ &kPRESENTATION_SERVICE_CID, false, nullptr, nsIPresentationServiceConstructor },
{ &kPRESENTATION_DEVICE_MANAGER_CID, false, nullptr, PresentationDeviceManagerConstructor },
{ &kPRESENTATION_TCP_SESSION_TRANSPORT_CID, false, nullptr, PresentationTCPSessionTransportConstructor },
{ &kTEXT_INPUT_PROCESSOR_CID, false, nullptr, TextInputProcessorConstructor },
{ &kFAKE_INPUTPORT_SERVICE_CID, false, nullptr, FakeInputPortServiceConstructor },
{ &kINPUTPORT_DATA_CID, false, nullptr, InputPortDataConstructor },
#ifdef MOZ_B2G
{ &kNS_HARDWARE_KEY_HANDLER_CID, false, nullptr, nsIHardwareKeyHandlerConstructor },
@@ -1209,32 +1200,30 @@ static const mozilla::Module::ContractID
{ NS_DEVICE_SENSORS_CONTRACTID, &kNS_DEVICE_SENSORS_CID },
#ifndef MOZ_WIDGET_GONK
#if defined(ANDROID)
{ "@mozilla.org/widget/hapticfeedback;1", &kNS_HAPTICFEEDBACK_CID },
#endif
#endif
{ THIRDPARTYUTIL_CONTRACTID, &kTHIRDPARTYUTIL_CID },
{ NS_STRUCTUREDCLONECONTAINER_CONTRACTID, &kNS_STRUCTUREDCLONECONTAINER_CID },
- { ICC_SERVICE_CONTRACTID, &kICC_SERVICE_CID },
{ POWERMANAGERSERVICE_CONTRACTID, &kNS_POWERMANAGERSERVICE_CID, Module::ALLOW_IN_GPU_PROCESS },
{ OSFILECONSTANTSSERVICE_CONTRACTID, &kOSFILECONSTANTSSERVICE_CID },
{ "@mozilla.org/udp-socket-child;1", &kUDPSOCKETCHILD_CID },
{ TIMESERVICE_CONTRACTID, &kNS_TIMESERVICE_CID },
{ MEDIASTREAMCONTROLLERSERVICE_CONTRACTID, &kNS_MEDIASTREAMCONTROLLERSERVICE_CID },
#if defined(MOZ_WIDGET_GONK) && !defined(DISABLE_MOZ_RIL_GEOLOC)
{ GONK_GPS_GEOLOCATION_PROVIDER_CONTRACTID, &kGONK_GPS_GEOLOCATION_PROVIDER_CID },
#endif
{ MEDIAMANAGERSERVICE_CONTRACTID, &kNS_MEDIAMANAGERSERVICE_CID },
#ifdef ACCESSIBILITY
{ "@mozilla.org/accessibilityService;1", &kNS_ACCESSIBILITY_SERVICE_CID },
{ "@mozilla.org/accessibleRetrieval;1", &kNS_ACCESSIBILITY_SERVICE_CID },
#endif
{ "@mozilla.org/gecko-media-plugin-service;1", &kGECKO_MEDIA_PLUGIN_SERVICE_CID },
- { NS_MOBILE_CONNECTION_SERVICE_CONTRACTID, &kNS_MOBILE_CONNECTION_SERVICE_CID },
{ PRESENTATION_SERVICE_CONTRACTID, &kPRESENTATION_SERVICE_CID },
{ PRESENTATION_DEVICE_MANAGER_CONTRACTID, &kPRESENTATION_DEVICE_MANAGER_CID },
{ PRESENTATION_TCP_SESSION_TRANSPORT_CONTRACTID, &kPRESENTATION_TCP_SESSION_TRANSPORT_CID },
{ "@mozilla.org/text-input-processor;1", &kTEXT_INPUT_PROCESSOR_CID },
{ FAKE_INPUTPORT_SERVICE_CONTRACTID, &kFAKE_INPUTPORT_SERVICE_CID },
{ INPUTPORT_DATA_CONTRACTID, &kINPUTPORT_DATA_CID },
#ifdef MOZ_B2G
{ NS_HARDWARE_KEY_HANDLER_CONTRACTID, &kNS_HARDWARE_KEY_HANDLER_CID },
--- a/modules/libpref/init/all.js
+++ b/modules/libpref/init/all.js
@@ -5017,23 +5017,16 @@ pref("dom.flyweb.enabled", false);
// ICC API
#ifdef MOZ_B2G_RIL
pref("dom.icc.enabled", true);
#else
pref("dom.icc.enabled", false);
#endif
-// Mobile Connection API
-#ifdef MOZ_B2G_RIL
-pref("dom.mobileconnection.enabled", true);
-#else
-pref("dom.mobileconnection.enabled", false);
-#endif
-
// Enable mapped array buffer by default.
pref("dom.mapped_arraybuffer.enabled", true);
// The tables used for Safebrowsing phishing and malware checks.
pref("urlclassifier.malwareTable", "goog-malware-shavar,goog-unwanted-shavar,test-malware-simple,test-unwanted-simple");
#ifdef MOZILLA_OFFICIAL
// In the official build, we are allowed to use google's private
--- a/testing/marionette/harness/marionette/tests/webapi-tests.ini
+++ b/testing/marionette/harness/marionette/tests/webapi-tests.ini
@@ -1,10 +1,8 @@
-[include:../../../../../dom/mobileconnection/tests/marionette/manifest.ini]
[include:../../../../../dom/system/gonk/tests/marionette/manifest.ini]
-[include:../../../../../dom/icc/tests/marionette/manifest.ini]
[include:../../../../../dom/system/tests/marionette/manifest.ini]
skip-if = android_version > '15' # Bug 1203072
[include:../../../../../dom/events/test/marionette/manifest.ini]
[include:../../../../../dom/wifi/test/marionette/manifest.ini]
[include:../../../../../dom/tethering/tests/marionette/manifest.ini]
skip-if = android_version > '15' # Bug 1203075
[include:../../../../../dom/network/tests/marionette/manifest.ini]