Bug 917175 - 0003. DOM API implementation. r=mrbkap

This commit is contained in:
Chuck Lee 2014-04-28 15:50:11 +08:00
Родитель 4b667bd4e3
Коммит aa3e0358a1
2 изменённых файлов: 40 добавлений и 0 удалений

Просмотреть файл

@ -96,6 +96,7 @@ DOMWifiManager.prototype = {
"WifiManager:setStaticIpMode:Return:OK", "WifiManager:setStaticIpMode:Return:NO",
"WifiManager:importCert:Return:OK", "WifiManager:importCert:Return:NO",
"WifiManager:getImportedCerts:Return:OK", "WifiManager:getImportedCerts:Return:NO",
"WifiManager:deleteCert:Return:OK", "WifiManager:deleteCert:Return:NO",
"WifiManager:wifiDown", "WifiManager:wifiUp",
"WifiManager:onconnecting", "WifiManager:onassociate",
"WifiManager:onconnect", "WifiManager:ondisconnect",
@ -288,6 +289,14 @@ DOMWifiManager.prototype = {
Services.DOMRequest.fireError(request, msg.data);
break;
case "WifiManager:deleteCert:Return:OK":
Services.DOMRequest.fireSuccess(request, msg.data);
break;
case "WifiManager:deleteCert:Return:NO":
Services.DOMRequest.fireError(request, msg.data);
break;
case "WifiManager:wifiDown":
this._enabled = false;
this._currentNetwork = null;
@ -452,6 +461,15 @@ DOMWifiManager.prototype = {
return request;
},
deleteCert: function nsIDOMWifiManager_deleteCert(certNickname) {
var request = this.createRequest();
this._sendMessageForRequest("WifiManager:deleteCert",
{
certNickname: certNickname
}, request);
return request;
},
get enabled() {
return this._enabled;
},

Просмотреть файл

@ -1379,6 +1379,15 @@ var WifiManager = (function() {
caInfo.certNickname);
}
manager.deleteCert = function(caInfo, callback) {
var id = idgen++;
if (callback) {
controlCallbacks[id] = callback;
}
wifiCertService.deleteCert(id, caInfo.certNickname);
}
return manager;
})();
@ -1647,6 +1656,7 @@ function WifiWorker() {
"WifiManager:setStaticIpMode",
"WifiManager:importCert",
"WifiManager:getImportedCerts",
"WifiManager:deleteCert",
"child-process-shutdown"];
messages.forEach((function(msgName) {
@ -2605,6 +2615,9 @@ WifiWorker.prototype = {
case "WifiManager:getImportedCerts":
this.getImportedCerts(msg);
break;
case "WifiManager:deleteCert":
this.deleteCert(msg);
break;
case "WifiManager:getState": {
let i;
if ((i = this._domManagers.indexOf(msg.manager)) === -1) {
@ -3157,6 +3170,15 @@ WifiWorker.prototype = {
self._sendMessage(message, true, importedCerts, msg);
},
deleteCert: function deleteCert(msg) {
const message = "WifiManager:deleteCert:Return";
let self = this;
WifiManager.deleteCert(msg.data, function(data) {
self._sendMessage(message, data.status === 0, "Delete Cert failed", msg);
});
},
// This is a bit ugly, but works. In particular, this depends on the fact
// that RadioManager never actually tries to get the worker from us.
get worker() { throw "Not implemented"; },