Merge mozilla-central and b2g-inbound

This commit is contained in:
Ed Morley 2014-08-12 17:54:47 +01:00
commit 0bd1cb7a32
24 changed files with 296 additions and 167 deletions

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="02f778766521b84da0ca3e575bfe35c37f46803d"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="fbcb01fe39cc2eed7b2860f05908521e4936a70a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="02f778766521b84da0ca3e575bfe35c37f46803d"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="fbcb01fe39cc2eed7b2860f05908521e4936a70a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="7945ca73e687be5edbc7b928dc7fe3a208242144">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="02f778766521b84da0ca3e575bfe35c37f46803d"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="fbcb01fe39cc2eed7b2860f05908521e4936a70a"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="02f778766521b84da0ca3e575bfe35c37f46803d"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="fbcb01fe39cc2eed7b2860f05908521e4936a70a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="cd88d860656c31c7da7bb310d6a160d0011b0961"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="02f778766521b84da0ca3e575bfe35c37f46803d"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="fbcb01fe39cc2eed7b2860f05908521e4936a70a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "f99184595c66043518af436b6b09bf02c4d0cd4f",
"revision": "eb0333099b931335af738d24ef1a48f01de0be1a",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="02f778766521b84da0ca3e575bfe35c37f46803d"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="fbcb01fe39cc2eed7b2860f05908521e4936a70a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="02f778766521b84da0ca3e575bfe35c37f46803d"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="fbcb01fe39cc2eed7b2860f05908521e4936a70a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="02f778766521b84da0ca3e575bfe35c37f46803d"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="fbcb01fe39cc2eed7b2860f05908521e4936a70a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="562d357b72279a9e35d4af5aeecc8e1ffa2f44f1"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="71f5a35e3bc1801847413cff1f14fc3b5cd991ca"/>

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="02f778766521b84da0ca3e575bfe35c37f46803d"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="fbcb01fe39cc2eed7b2860f05908521e4936a70a"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="3bb61a27cd2941b2ba9b616a11aaa44269210396"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="891e5069c0ad330d8191bf8c7b879c814258c89f"/>

View File

@ -1542,9 +1542,82 @@ Navigator::GetFeature(const nsAString& aName, ErrorResult& aRv)
}
}
p->MaybeResolve(JS::UndefinedHandleValue);
return p.forget();
}
already_AddRefed<Promise>
Navigator::HasFeature(const nsAString& aName, ErrorResult& aRv)
{
nsCOMPtr<nsIGlobalObject> go = do_QueryInterface(mWindow);
nsRefPtr<Promise> p = Promise::Create(go, aRv);
if (aRv.Failed()) {
return nullptr;
}
NS_NAMED_LITERAL_STRING(apiWindowPrefix, "api.window.");
if (StringBeginsWith(aName, apiWindowPrefix)) {
const nsAString& featureName = Substring(aName, apiWindowPrefix.Length());
// Temporary hardcoded entry points due to technical constraints
if (featureName.EqualsLiteral("Navigator.mozTCPSocket")) {
p->MaybeResolve(Preferences::GetBool("dom.mozTCPSocket.enabled"));
return p.forget();
}
if (featureName.EqualsLiteral("Navigator.mozMobileConnections") ||
featureName.EqualsLiteral("MozMobileNetworkInfo")) {
p->MaybeResolve(Preferences::GetBool("dom.mobileconnection.enabled"));
return p.forget();
}
if (featureName.EqualsLiteral("Navigator.mozInputMethod")) {
p->MaybeResolve(Preferences::GetBool("dom.mozInputMethod.enabled"));
return p.forget();
}
if (featureName.EqualsLiteral("Navigator.mozContacts")) {
p->MaybeResolve(true);
return p.forget();
}
if (featureName.EqualsLiteral("Navigator.getDeviceStorage")) {
p->MaybeResolve(Preferences::GetBool("device.storage.enabled"));
return p.forget();
}
if (featureName.EqualsLiteral("Navigator.mozNetworkStats")) {
p->MaybeResolve(Preferences::GetBool("dom.mozNetworkStats.enabled"));
return p.forget();
}
if (featureName.EqualsLiteral("Navigator.push")) {
p->MaybeResolve(Preferences::GetBool("services.push.enabled"));
return p.forget();
}
if (featureName.EqualsLiteral("Navigator.mozAlarms")) {
p->MaybeResolve(Preferences::GetBool("dom.mozAlarms.enabled"));
return p.forget();
}
if (featureName.EqualsLiteral("Navigator.mozCameras")) {
p->MaybeResolve(true);
return p.forget();
}
#ifdef MOZ_B2G
if (featureName.EqualsLiteral("Navigator.getMobileIdAssertion")) {
p->MaybeResolve(true);
return p.forget();
}
#endif
if (featureName.EqualsLiteral("XMLHttpRequest.mozSystem")) {
p->MaybeResolve(true);
return p.forget();
}
if (IsFeatureDetectible(featureName)) {
p->MaybeResolve(true);
} else {
@ -1559,7 +1632,6 @@ Navigator::GetFeature(const nsAString& aName, ErrorResult& aRv)
return p.forget();
}
PowerManager*
Navigator::GetMozPower(ErrorResult& aRv)
{
@ -2371,7 +2443,8 @@ Navigator::HasMobileIdSupport(JSContext* aCx, JSObject* aGlobal)
uint32_t permission = nsIPermissionManager::UNKNOWN_ACTION;
permMgr->TestPermissionFromPrincipal(principal, "mobileid", &permission);
return permission != nsIPermissionManager::UNKNOWN_ACTION;
return permission == nsIPermissionManager::PROMPT_ACTION ||
permission == nsIPermissionManager::ALLOW_ACTION;
}
#endif

View File

@ -172,6 +172,9 @@ public:
already_AddRefed<Promise> GetFeature(const nsAString& aName,
ErrorResult& aRv);
already_AddRefed<Promise> HasFeature(const nsAString &aName,
ErrorResult& aRv);
bool Vibrate(uint32_t aDuration);
bool Vibrate(const nsTArray<uint32_t>& aDuration);
uint32_t MaxTouchPoints();

View File

@ -43,6 +43,7 @@ skip-if = buildapp == 'mulet' || buildapp == 'b2g' || toolkit == 'android' || e1
[test_gsp-standards.html]
[test_getFeature_with_perm.html]
[test_getFeature_without_perm.html]
[test_hasFeature.html]
[test_history_document_open.html]
[test_history_state_null.html]
[test_Image_constructor.html]

View File

@ -0,0 +1,78 @@
<!DOCTYPE HTML>
<html>
<!--
https://bugzilla.mozilla.org/show_bug.cgi?id=1009645
-->
<head>
<meta charset="utf-8">
<title>Test for Bug 1009645</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=1009645">Mozilla Bug 1009645</a>
<script type="application/javascript">
function testAPIs() {
function pref(name) {
try {
return SpecialPowers.getBoolPref(name);
} catch (e) {
return false;
}
}
var b2gOnly = (function() {
var isAndroid = !!navigator.userAgent.contains("Android");
var isB2g = !isAndroid && /Mobile|Tablet/.test(navigator.userAgent);
return isB2g ? true : undefined;
})();
var APIEndPoints = [
{ name: "MozMobileNetworkInfo", enabled: pref("dom.mobileconnection.enabled") },
// { name: "Navigator.mozBluetooth", enabled: b2gOnly }, // conditional on MOZ_B2G_BT, tricky to test
{ name: "Navigator.mozContacts", enabled: pref("dom.mozContacts.enabled") },
{ name: "Navigator.getDeviceStorage", enabled: pref("device.storage.enabled") },
{ name: "Navigator.addIdleObserver", enabled: true },
{ name: "Navigator.mozNetworkStats", enabled: pref("dom.mozNetworkStats.enabled") },
{ name: "Navigator.push", enabled: pref("services.push.enabled") },
// { name: "Navigator.mozTime", enabled: b2gOnly }, // conditional on MOZ_TIME_MANAGER, tricky to test
// { name: "Navigator.mozFMRadio", enabled: b2gOnly }, // conditional on MOZ_B2G_FM, tricky to test
{ name: "Navigator.mozCameras", enabled: true },
{ name: "Navigator.mozAlarms", enabled: pref("dom.mozAlarms.enabled") },
{ name: "Navigator.mozTCPSocket", enabled: pref("dom.mozTCPSocket.enabled") },
{ name: "Navigator.mozInputMethod", enabled: pref("dom.mozInputMethod.enabled") },
{ name: "Navigator.mozMobileConnections", enabled: pref("dom.mobileconnection.enabled") },
{ name: "Navigator.getMobileIdAssertion", enabled: b2gOnly },
{ name: "XMLHttpRequest.mozSystem", enabled: true }
];
var promises = [];
APIEndPoints.forEach(function(v) {
promises.push(navigator.hasFeature("api.window." + v.name));
});
Promise.all(promises).then(function(values) {
for (var i = 0; i < values.length; ++i) {
ise(values[i], APIEndPoints[i].enabled,
"Endpoint " + APIEndPoints[i].name + " resolved with the correct value. " +
"If this is failing because you're changing how an API is exposed, you " +
"must contact the Marketplace team to let them know about the change.");
}
SimpleTest.finish();
}, function() {
ok(false, "The Promise should not be rejected");
SimpleTest.finish();
});
}
SpecialPowers.pushPermissions([
{type: "feature-detection", allow: true, context: document}
], function() {
ok('hasFeature' in navigator, "navigator.hasFeature should exist");
testAPIs();
});
SimpleTest.waitForExplicitFinish();
</script>
</body>
</html>

View File

@ -447,17 +447,27 @@ class Descriptor(DescriptorProvider):
if permissionsIndex is not None:
self.checkPermissionsIndicesForMembers[m.identifier.name] = permissionsIndex
self.featureDetectibleThings = set()
if self.interface.getExtendedAttribute("FeatureDetectible") is not None:
if self.interface.getNavigatorProperty():
self.featureDetectibleThings.add("Navigator.%s" % self.interface.getNavigatorProperty())
else:
assert(self.interface.ctor() is not None)
self.featureDetectibleThings.add(self.interface.identifier.name)
def isTestInterface(iface):
return (iface.identifier.name in ["TestInterface",
"TestJSImplInterface",
"TestRenamedInterface"])
for m in self.interface.members:
if m.getExtendedAttribute("FeatureDetectible") is not None:
self.featureDetectibleThings.add("%s.%s" % (self.interface.identifier.name, m.identifier.name))
self.featureDetectibleThings = set()
if not isTestInterface(self.interface):
if (self.interface.getExtendedAttribute("CheckPermissions") or
self.interface.getExtendedAttribute("AvailableIn") == "PrivilegedApps"):
if self.interface.getNavigatorProperty():
self.featureDetectibleThings.add("Navigator.%s" % self.interface.getNavigatorProperty())
else:
iface = self.interface.identifier.name
self.featureDetectibleThings.add(iface)
for m in self.interface.members:
self.featureDetectibleThings.add("%s.%s" % (iface, m.identifier.name))
for m in self.interface.members:
if (m.getExtendedAttribute("CheckPermissions") or
m.getExtendedAttribute("AvailableIn") == "PrivilegedApps"):
self.featureDetectibleThings.add("%s.%s" % (self.interface.identifier.name, m.identifier.name))
# Build the prototype chain.
self.prototypeChain = []

View File

@ -669,22 +669,6 @@ class IDLInterface(IDLObjectWithScope):
[self.location])
assert not parent or isinstance(parent, IDLInterface)
if self.getExtendedAttribute("FeatureDetectible"):
if not (self.getExtendedAttribute("Func") or
self.getExtendedAttribute("AvailableIn") or
self.getExtendedAttribute("CheckPermissions")):
raise WebIDLError("[FeatureDetectible] is only allowed in combination "
"with [Func], [AvailableIn] or [CheckPermissions]",
[self.location])
if self.getExtendedAttribute("Pref"):
raise WebIDLError("[FeatureDetectible] must not be specified "
"in combination with [Pref]",
[self.location])
if not self.hasInterfaceObject():
raise WebIDLError("[FeatureDetectible] not allowed on interface "
"with [NoInterfaceObject]",
[self.location])
self.parent = parent
assert iter(self.members)
@ -1207,8 +1191,7 @@ class IDLInterface(IDLObjectWithScope):
identifier == "OverrideBuiltins" or
identifier == "ChromeOnly" or
identifier == "Unforgeable" or
identifier == "LegacyEventInit" or
identifier == "FeatureDetectible"):
identifier == "LegacyEventInit"):
# Known extended attributes that do not take values
if not attr.noArguments():
raise WebIDLError("[%s] must take no arguments" % identifier,
@ -3174,18 +3157,6 @@ class IDLAttribute(IDLInterfaceMember):
raise WebIDLError("An attribute with [SameObject] must have an "
"interface type as its type", [self.location])
if self.getExtendedAttribute("FeatureDetectible"):
if not (self.getExtendedAttribute("Func") or
self.getExtendedAttribute("AvailableIn") or
self.getExtendedAttribute("CheckPermissions")):
raise WebIDLError("[FeatureDetectible] is only allowed in combination "
"with [Func], [AvailableIn] or [CheckPermissions]",
[self.location])
if self.getExtendedAttribute("Pref"):
raise WebIDLError("[FeatureDetectible] must not be specified "
"in combination with [Pref]",
[self.location])
def validate(self):
IDLInterfaceMember.validate(self)
@ -3324,8 +3295,7 @@ class IDLAttribute(IDLInterfaceMember):
identifier == "Frozen" or
identifier == "AvailableIn" or
identifier == "NewObject" or
identifier == "CheckPermissions" or
identifier == "FeatureDetectible"):
identifier == "CheckPermissions"):
# Known attributes that we don't need to do anything with here
pass
else:
@ -3730,18 +3700,6 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
def finish(self, scope):
IDLInterfaceMember.finish(self, scope)
if self.getExtendedAttribute("FeatureDetectible"):
if not (self.getExtendedAttribute("Func") or
self.getExtendedAttribute("AvailableIn") or
self.getExtendedAttribute("CheckPermissions")):
raise WebIDLError("[FeatureDetectible] is only allowed in combination "
"with [Func], [AvailableIn] or [CheckPermissions]",
[self.location])
if self.getExtendedAttribute("Pref"):
raise WebIDLError("[FeatureDetectible] must not be specified "
"in combination with [Pref]",
[self.location])
overloadWithPromiseReturnType = None
overloadWithoutPromiseReturnType = None
for overload in self._overloads:
@ -3922,8 +3880,7 @@ class IDLMethod(IDLInterfaceMember, IDLScope):
convertExposedAttrToGlobalNameSet(attr, self._exposureGlobalNames)
elif (identifier == "Pure" or
identifier == "CrossOriginCallable" or
identifier == "WebGLHandlesContextLoss" or
identifier == "FeatureDetectible"):
identifier == "WebGLHandlesContextLoss"):
# Known no-argument attributes.
if not attr.noArguments():
raise WebIDLError("[%s] must take no arguments" % identifier,

View File

@ -342,8 +342,9 @@ private:
#ifdef MOZ_WIDGET_GONK
nsString mLastStatus;
nsString mLastStorageStatus;
void DispatchStatusChangeEvent(nsAString& aStatus);
void DispatchStorageStatusChangeEvent(nsAString& aVolumeStatus);
void DispatchStorageStatusChangeEvent(nsAString& aStorageStatus);
#endif
// nsIDOMDeviceStorage.type

View File

@ -4161,13 +4161,19 @@ nsDOMDeviceStorage::DispatchStatusChangeEvent(nsAString& aStatus)
}
void
nsDOMDeviceStorage::DispatchStorageStatusChangeEvent(nsAString& aVolumeStatus)
nsDOMDeviceStorage::DispatchStorageStatusChangeEvent(nsAString& aStorageStatus)
{
if (aStorageStatus == mLastStorageStatus) {
// We've already sent this status, don't bother sending it again.
return;
}
mLastStorageStatus = aStorageStatus;
DeviceStorageChangeEventInit init;
init.mBubbles = true;
init.mCancelable = false;
init.mPath = mStorageName;
init.mReason = aVolumeStatus;
init.mReason = aStorageStatus;
nsRefPtr<DeviceStorageChangeEvent> event =
DeviceStorageChangeEvent::Constructor(this, NS_LITERAL_STRING("storage-state-change"),

View File

@ -36,7 +36,6 @@ function verifier(success, failure) {
var gData = [
{
perm: ["idle"],
settings: [["dom.idle-observers-api.enabled", true]],
verifier: verifier.toSource(),
}
]

View File

@ -1589,8 +1589,7 @@ RilObject.prototype = {
return;
}
if (this.voiceRegistrationState.emergencyCallsOnly ||
options.isDialEmergency) {
if (this.voiceRegistrationState.emergencyCallsOnly) {
onerror(RIL_CALL_FAILCAUSE_TO_GECKO_CALL_ERROR[CALL_FAIL_UNOBTAINABLE_NUMBER]);
return;
}
@ -1615,6 +1614,7 @@ RilObject.prototype = {
}
options.request = REQUEST_DIAL;
options.isEmergency = false;
this.sendDialRequest(options);
},
@ -1637,6 +1637,8 @@ RilObject.prototype = {
options.request = RILQUIRKS_REQUEST_USE_DIAL_EMERGENCY_CALL ?
REQUEST_DIAL_EMERGENCY_CALL : REQUEST_DIAL;
options.isEmergency = true;
if (this.radioState == GECKO_RADIOSTATE_OFF) {
if (DEBUG) {
this.context.debug("Automatically enable radio for an emergency call.");
@ -4109,10 +4111,6 @@ RilObject.prototype = {
newCall.isOutgoing = true;
}
if (newCall.isEmergency === undefined) {
newCall.isEmergency = false;
}
// Set flag for conference.
newCall.isConference = newCall.isMpty ? true : false;

View File

@ -23,7 +23,7 @@ const GONK_TELEPHONYSERVICE_CONTRACTID =
const GONK_TELEPHONYSERVICE_CID =
Components.ID("{67d26434-d063-4d28-9f48-5b3189788155}");
const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
const NS_XPCOM_SHUTDOWN_OBSERVER_ID = "xpcom-shutdown";
const NS_PREFBRANCH_PREFCHANGE_TOPIC_ID = "nsPref:changed";
@ -41,6 +41,7 @@ const CDMA_SECOND_CALL_INDEX = 2;
const DIAL_ERROR_INVALID_STATE_ERROR = "InvalidStateError";
const DIAL_ERROR_OTHER_CONNECTION_IN_USE = "OtherConnectionInUse";
const DIAL_ERROR_BAD_NUMBER = RIL.GECKO_CALL_ERROR_BAD_NUMBER;
const AUDIO_STATE_NO_CALL = 0;
const AUDIO_STATE_INCOMING = 1;
@ -428,112 +429,119 @@ TelephonyService.prototype = {
return hasConference ? numCalls + 1 : numCalls;
},
_addCdmaChildCall: function(aClientId, aNumber, aParentId) {
let childCall = {
callIndex: CDMA_SECOND_CALL_INDEX,
state: RIL.CALL_STATE_DIALING,
number: aNumber,
isOutgoing: true,
isEmergency: false,
isConference: false,
isSwitchable: false,
isMergeable: true,
parentId: aParentId
};
// Manual update call state according to the request response.
this.notifyCallStateChanged(aClientId, childCall);
childCall.state = RIL.CALL_STATE_ACTIVE;
this.notifyCallStateChanged(aClientId, childCall);
let parentCall = this._currentCalls[aClientId][childCall.parentId];
parentCall.childId = CDMA_SECOND_CALL_INDEX;
parentCall.state = RIL.CALL_STATE_HOLDING;
parentCall.isSwitchable = false;
parentCall.isMergeable = true;
this.notifyCallStateChanged(aClientId, parentCall);
},
isDialing: false,
dial: function(aClientId, aNumber, aIsEmergency, aTelephonyCallback) {
if (DEBUG) debug("Dialing " + (aIsEmergency ? "emergency " : "") + aNumber);
dial: function(aClientId, aNumber, aIsDialEmergency, aCallback) {
if (DEBUG) debug("Dialing " + (aIsDialEmergency ? "emergency " : "") + aNumber);
if (this.isDialing) {
if (DEBUG) debug("Error: Already has a dialing call.");
aTelephonyCallback.notifyDialError(DIAL_ERROR_INVALID_STATE_ERROR);
aCallback.notifyDialError(DIAL_ERROR_INVALID_STATE_ERROR);
return;
}
// Select a proper clientId for dialEmergency.
if (aIsEmergency) {
aClientId = gRadioInterfaceLayer.getClientIdForEmergencyCall() ;
if (aClientId === -1) {
if (DEBUG) debug("Error: No client is avaialble for emergency call.");
aTelephonyCallback.notifyDialError(DIAL_ERROR_INVALID_STATE_ERROR);
return;
}
}
// For DSDS, if there is aleady a call on SIM 'aClientId', we cannot place
// any new call on other SIM.
if (this._hasCallsOnOtherClient(aClientId)) {
if (DEBUG) debug("Error: Already has a call on other sim.");
aTelephonyCallback.notifyDialError(DIAL_ERROR_OTHER_CONNECTION_IN_USE);
aCallback.notifyDialError(DIAL_ERROR_OTHER_CONNECTION_IN_USE);
return;
}
// We can only have at most two calls on the same line (client).
if (this._numCallsOnLine(aClientId) >= 2) {
if (DEBUG) debug("Error: Has more than 2 calls on line.");
aTelephonyCallback.notifyDialError(DIAL_ERROR_INVALID_STATE_ERROR);
aCallback.notifyDialError(DIAL_ERROR_INVALID_STATE_ERROR);
return;
}
// We don't try to be too clever here, as the phone is probably in the
// locked state. Let's just check if it's a number without normalizing
if (!aIsEmergency) {
if (!aIsDialEmergency) {
aNumber = gPhoneNumberUtils.normalize(aNumber);
}
// Validate the number.
// Note: isPlainPhoneNumber also accepts USSD and SS numbers
if (!gPhoneNumberUtils.isPlainPhoneNumber(aNumber)) {
// Note: isPlainPhoneNumber also accepts USSD and SS numbers
if (DEBUG) debug("Number '" + aNumber + "' is not viable. Drop.");
let errorMsg = RIL.RIL_CALL_FAILCAUSE_TO_GECKO_CALL_ERROR[RIL.CALL_FAIL_UNOBTAINABLE_NUMBER];
aTelephonyCallback.notifyDialError(errorMsg);
if (DEBUG) debug("Error: Number '" + aNumber + "' is not viable. Drop.");
aCallback.notifyDialError(DIAL_ERROR_BAD_NUMBER);
return;
}
function onCdmaDialSuccess(aCallIndex) {
let indexes = Object.keys(this._currentCalls[aClientId]);
if (indexes.length == 0) {
aTelephonyCallback.notifyDialSuccess(aCallIndex);
if (this._isEmergencyNumber(aNumber)) {
// Select a proper clientId for dialEmergency.
aClientId = gRadioInterfaceLayer.getClientIdForEmergencyCall() ;
if (aClientId === -1) {
if (DEBUG) debug("Error: No client is avaialble for emergency call.");
aCallback.notifyDialError(DIAL_ERROR_INVALID_STATE_ERROR);
return;
}
// RIL doesn't hold the 2nd call. We create one by ourselves.
let childCall = {
callIndex: CDMA_SECOND_CALL_INDEX,
state: RIL.CALL_STATE_DIALING,
number: aNumber,
isOutgoing: true,
isEmergency: false,
isConference: false,
isSwitchable: false,
isMergeable: true,
parentId: indexes[0]
};
aTelephonyCallback.notifyDialSuccess(CDMA_SECOND_CALL_INDEX);
this._dialInternal(aClientId, "dialEmergencyNumber", aNumber, aCallback);
} else {
// Shouldn't dial a non-emergency number by dialEmergency.
if (aIsDialEmergency) {
if (DEBUG) debug("Error: dialEmergency with a non-emergency number");
aCallback.notifyDialError(DIAL_ERROR_BAD_NUMBER);
return;
}
// Manual update call state according to the request response.
this.notifyCallStateChanged(aClientId, childCall);
this._dialInternal(aClientId, "dialNonEmergencyNumber", aNumber, aCallback);
}
},
childCall.state = RIL.CALL_STATE_ACTIVE;
this.notifyCallStateChanged(aClientId, childCall);
let parentCall = this._currentCalls[aClientId][childCall.parentId];
parentCall.childId = CDMA_SECOND_CALL_INDEX;
parentCall.state = RIL.CALL_STATE_HOLDING;
parentCall.isSwitchable = false;
parentCall.isMergeable = true;
this.notifyCallStateChanged(aClientId, parentCall);
};
let isEmergencyNumber = this._isEmergencyNumber(aNumber);
let msg = isEmergencyNumber ?
"dialEmergencyNumber" :
"dialNonEmergencyNumber";
_dialInternal: function(aClientId, aMsg, aNumber, aCallback) {
this.isDialing = true;
this._getClient(aClientId).sendWorkerMessage(msg, {
number: aNumber,
isEmergency: isEmergencyNumber,
isDialEmergency: aIsEmergency
}, (function(response) {
this._getClient(aClientId).sendWorkerMessage(aMsg,
{number: aNumber},
(function(response) {
this.isDialing = false;
if (!response.success) {
aTelephonyCallback.notifyDialError(response.errorMsg);
aCallback.notifyDialError(response.errorMsg);
return false;
}
if (response.isCdma) {
onCdmaDialSuccess.call(this, response.callIndex);
if (!response.isCdma) {
aCallback.notifyDialSuccess(response.callIndex);
} else {
aTelephonyCallback.notifyDialSuccess(response.callIndex);
let currentCallId = Object.keys(this._currentCalls[aClientId])[0];
if (currentCallId === undefined) {
aCallback.notifyDialSuccess(response.callIndex);
} else {
// RIL doesn't hold the 2nd call. We create one by ourselves.
aCallback.notifyDialSuccess(CDMA_SECOND_CALL_INDEX);
this._addCdmaChildCall(aClientId, aNumber, currentCallId);
}
}
return false;
}).bind(this));
},
@ -615,7 +623,7 @@ TelephonyService.prototype = {
this.notifyCallStateChanged(aClientId, call);
}
this.notifyConferenceCallStateChanged(RIL.CALL_STATE_ACTIVE);
};
}
this._getClient(aClientId).sendWorkerMessage("conferenceCall", null,
(function(response) {
@ -660,7 +668,7 @@ TelephonyService.prototype = {
let childCall = this._currentCalls[aClientId][childId];
this.notifyCallDisconnected(aClientId, childCall);
};
}
this._getClient(aClientId).sendWorkerMessage("separateCall", {
callIndex: aCallIndex
@ -825,28 +833,25 @@ TelephonyService.prototype = {
aCall.clientId = aClientId;
this._updateActiveCall(aCall);
function pick(arg, defaultValue) {
return typeof arg !== 'undefined' ? arg : defaultValue;
}
let call = this._currentCalls[aClientId][aCall.callIndex];
if (call) {
call.state = aCall.state;
call.isConference = aCall.isConference;
call.isEmergency = aCall.isEmergency;
call.isSwitchable = aCall.isSwitchable != null ?
aCall.isSwitchable : call.isSwitchable;
call.isMergeable = aCall.isMergeable != null ?
aCall.isMergeable : call.isMergeable;
call.isEmergency = pick(aCall.isEmergency, call.isEmergency);
call.isSwitchable = pick(aCall.isSwitchable, call.isSwitchable);
call.isMergeable = pick(aCall.isMergeable, call.isMergeable);
} else {
call = aCall;
call.isSwitchable = aCall.isSwitchable != null ?
aCall.isSwitchable : true;
call.isMergeable = aCall.isMergeable != null ?
aCall.isMergeable : true;
call.numberPresentation = aCall.numberPresentation != null ?
aCall.numberPresentation : nsITelephonyService.CALL_PRESENTATION_ALLOWED;
call.name = aCall.name != null ?
aCall.name : "";
call.namePresentation = aCall.namePresentation != null ?
aCall.namePresentation : nsITelephonyService.CALL_PRESENTATION_ALLOWED;
call.isEmergency = pick(aCall.isEmergency, this._isEmergencyNumber(aCall.number));
call.isSwitchable = pick(aCall.isSwitchable, true);
call.isMergeable = pick(aCall.isMergeable, true);
call.name = pick(aCall.name, "");
call.numberPresentaation = pick(aCall.numberPresentation, nsITelephonyService.CALL_PRESENTATION_ALLOWED);
call.namePresentaation = pick(aCall.namePresentation, nsITelephonyService.CALL_PRESENTATION_ALLOWED);
this._currentCalls[aClientId][aCall.callIndex] = call;
}

View File

@ -86,6 +86,9 @@ interface NavigatorStorageUtils {
interface NavigatorFeatures {
[CheckPermissions="feature-detection", Throws]
Promise<any> getFeature(DOMString name);
[CheckPermissions="feature-detection", Throws]
Promise<any> hasFeature(DOMString name);
};
// Things that definitely need to be in the spec and and are not for some
@ -195,13 +198,13 @@ partial interface Navigator {
/**
* Navigator requests to add an idle observer to the existing window.
*/
[Throws, CheckPermissions="idle", Pref="dom.idle-observers-api.enabled"]
[Throws, CheckPermissions="idle"]
void addIdleObserver(MozIdleObserver aIdleObserver);
/**
* Navigator requests to remove an idle observer from the existing window.
*/
[Throws, CheckPermissions="idle", Pref="dom.idle-observers-api.enabled"]
[Throws, CheckPermissions="idle"]
void removeIdleObserver(MozIdleObserver aIdleObserver);
/**

View File

@ -7,7 +7,6 @@
[CheckPermissions="resourcestats-manage",
Pref="dom.resource_stats.enabled",
AvailableIn="CertifiedApps",
// FeatureDetectible, // This should be specified after Bug 1009645 is resolved.
JSImplementation="@mozilla.org/networkStatsData;1"]
interface NetworkStatsData
{
@ -19,7 +18,6 @@ interface NetworkStatsData
[CheckPermissions="resourcestats-manage",
Pref="dom.resource_stats.enabled",
AvailableIn="CertifiedApps",
// FeatureDetectible, // This should be specified after Bug 1009645 is resolved.
JSImplementation="@mozilla.org/powerStatsData;1"]
interface PowerStatsData
{
@ -30,7 +28,6 @@ interface PowerStatsData
[CheckPermissions="resourcestats-manage",
Pref="dom.resource_stats.enabled",
AvailableIn="CertifiedApps",
// FeatureDetectible, // This should be specified after Bug 1009645 is resolved.
JSImplementation="@mozilla.org/resourceStats;1"]
interface ResourceStats
{

View File

@ -73,7 +73,6 @@ dictionary ResourceStatsAlarmOptions
[CheckPermissions="resourcestats-manage",
Pref="dom.resource_stats.enabled",
AvailableIn="CertifiedApps",
// FeatureDetectible, // This should be specified after Bug 1009645 is resolved.
JSImplementation="@mozilla.org/resourceStatsAlarm;1"]
interface ResourceStatsAlarm
{
@ -117,7 +116,6 @@ interface ResourceStatsAlarm
Pref="dom.resource_stats.enabled",
Constructor(ResourceType type),
AvailableIn="CertifiedApps",
// FeatureDetectible, // This should be specified after Bug 1009645 is resolved.
JSImplementation="@mozilla.org/resourceStatsManager;1"]
interface ResourceStatsManager
{