Bug 1057973 - Part 2: QueryInterface(Ci.nsIRilNetworkInterface) before accessing serviceId property. r=vyang

This commit is contained in:
Bevis Tseng 2014-08-28 10:54:39 +08:00
parent 42e1632096
commit 79d5c38d10

View File

@ -279,12 +279,9 @@ NetworkManager.prototype = {
getNetworkId: function(network) {
let id = "device";
#ifdef MOZ_B2G_RIL
if (this.isNetworkTypeMobile(network.type)) {
if (!(network instanceof Ci.nsIRilNetworkInterface)) {
throw Components.Exception("Mobile network not an nsIRilNetworkInterface",
Cr.NS_ERROR_INVALID_ARG);
}
id = "ril" + network.serviceId;
if (network instanceof Ci.nsIRilNetworkInterface) {
let rilNetwork = network.QueryInterface(Ci.nsIRilNetworkInterface);
id = "ril" + rilNetwork.serviceId;
}
#endif
@ -796,9 +793,11 @@ NetworkManager.prototype = {
for each (let network in this.networkInterfaces) {
if (network.type == type) {
#ifdef MOZ_B2G_RIL
if (serviceId != undefined && this.isNetworkTypeMobile(network.type) &&
network.serviceId != serviceId) {
continue;
if (network instanceof Ci.nsIRilNetworkInterface) {
let rilNetwork = network.QueryInterface(Ci.nsIRilNetworkInterface);
if (rilNetwork.serviceId != serviceId) {
continue;
}
}
#endif
return network;