From d8afc370b1983d5efb9163763eac37d7f0d617ce Mon Sep 17 00:00:00 2001 From: Chuck Lee Date: Wed, 30 Apr 2014 19:58:35 +0800 Subject: [PATCH] Bug 917102 - 0001. WebIDL changes. r=mrbkap, r=ehsan --- dom/webidl/MozWifiManager.webidl | 22 ++++++++++++++++++++ dom/webidl/WifiOptions.webidl | 14 +++++++++++++ dom/wifi/moz.build | 1 + dom/wifi/nsIWifiCertService.idl | 35 ++++++++++++++++++++++++++++++++ 4 files changed, 72 insertions(+) create mode 100644 dom/wifi/nsIWifiCertService.idl diff --git a/dom/webidl/MozWifiManager.webidl b/dom/webidl/MozWifiManager.webidl index 0791beabbbf5a..c2b09c1de429f 100644 --- a/dom/webidl/MozWifiManager.webidl +++ b/dom/webidl/MozWifiManager.webidl @@ -213,6 +213,28 @@ interface MozWifiManager : EventTarget { */ DOMRequest setHttpProxy(MozWifiNetwork network, any info); + /** + * Import a certificate file, only support CA certificate now. + * @param certBlob A Blob object containing raw data of certificate to be imported. + * Supported format: binary/base64 encoded DER certificates. + * (.der/.crt/.cer/.pem) + * Cause error if importing certificates already imported. + * @param certPassword Password of certificate. + * @param certNickname User assigned nickname for imported certificate. + * Nickname must be unique, it causes error on redundant nickname. + * onsuccess: We have successfully imported certificate. request.result is an + * object, containing information of imported CA: + * { + * nickname: Nickname of imported CA, String. + * usage: Supported usage of imported CA, Array of String, + * includes: "ServerCert". + * } + * onerror: We have failed to import certificate. + */ + DOMRequest importCert(Blob certBlob, + DOMString certPassword, + DOMString certNickname); + /** * Returns whether or not wifi is currently enabled. */ diff --git a/dom/webidl/WifiOptions.webidl b/dom/webidl/WifiOptions.webidl index d9ec2e360ee40..4f4f93c28b85f 100644 --- a/dom/webidl/WifiOptions.webidl +++ b/dom/webidl/WifiOptions.webidl @@ -56,3 +56,17 @@ dictionary WifiResultOptions long dns2 = 0; long server = 0; }; + + +/** + * This dictionary holds the callback parameter sent back from WifiCertService + * to WifiWorker, and should only be passed around in chrome process. + */ +dictionary WifiCertServiceResultOptions +{ + long id = 0; // request id in WifiWorker. + long status = 0; // error code of the request, 0 indicates success. + unsigned short usageFlag = 0; // usage flag of certificate, the flag is defined + // in nsIWifiCertService.idl + DOMString nickname = ""; // nickname of certificate of the request. +}; diff --git a/dom/wifi/moz.build b/dom/wifi/moz.build index d13e5a8098ad8..a361f4ff69dec 100644 --- a/dom/wifi/moz.build +++ b/dom/wifi/moz.build @@ -9,6 +9,7 @@ XPIDL_SOURCES += [ 'nsIDOMMozWifiP2pStatusChangeEvent.idl', 'nsIDOMMozWifiStatusChangeEvent.idl', 'nsIWifi.idl', + 'nsIWifiCertService.idl', 'nsIWifiService.idl', ] diff --git a/dom/wifi/nsIWifiCertService.idl b/dom/wifi/nsIWifiCertService.idl new file mode 100644 index 0000000000000..2056ab7bf7eb3 --- /dev/null +++ b/dom/wifi/nsIWifiCertService.idl @@ -0,0 +1,35 @@ +/* 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 nsIDOMBlob; +interface nsIWifiEventListener; + +[scriptable, uuid(49e8e04e-eb05-4c92-84a6-7af32310f0c3)] +interface nsIWifiCertService : nsISupports +{ + const unsigned short WIFI_CERT_USAGE_FLAG_SERVER = 0x01; + const unsigned short WIFI_CERT_USAGE_FLAG_USER = 0x02; + + void start(in nsIWifiEventListener listener); + void shutdown(); + + /** + * Import a certificate file. + * + * @param id + * Request ID. + * @param certBlob + * A Blob object containing raw data of certificate to be imported. + * @param certPassword + * Password of certificate. + * @param certNickname + * User assigned nickname for imported certificate. + */ + void importCert(in long id, + in nsIDOMBlob certBlob, + in DOMString certPassword, + in DOMString certNickname); +};