зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset 00bb04b8c9a0 (bug 1255040) for failures in browser_webapi.js
MozReview-Commit-ID: 1qKiUTNw4fV
This commit is contained in:
Родитель
402c072ef3
Коммит
0982c581ea
|
@ -3,9 +3,8 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
*/
|
||||
|
||||
/* We need a JSImplementation but cannot get one without a contract ID.
|
||||
Since Addon and AddonInstall are only ever created from JS they don't need
|
||||
real contract IDs. */
|
||||
/* We need a JSImplementation but cannot get one without a contract ID. Since
|
||||
This object is only ever created from JS we don't need a real contract ID. */
|
||||
[ChromeOnly, JSImplementation="dummy"]
|
||||
interface Addon {
|
||||
// The add-on's ID.
|
||||
|
@ -24,27 +23,6 @@ interface Addon {
|
|||
readonly attribute boolean isEnabled;
|
||||
// If the add-on is currently active in the browser.
|
||||
readonly attribute boolean isActive;
|
||||
|
||||
Promise<boolean> uninstall();
|
||||
};
|
||||
|
||||
[ChromeOnly, JSImplementation="dummy"]
|
||||
interface AddonInstall : EventTarget {
|
||||
// One of the STATE_* symbols from AddonManager.jsm
|
||||
readonly attribute DOMString state;
|
||||
// One of the ERROR_* symbols from AddonManager.jsm, or null
|
||||
readonly attribute DOMString? error;
|
||||
// How many bytes have been downloaded
|
||||
readonly attribute long long progress;
|
||||
// How many total bytes will need to be downloaded or -1 if unknown
|
||||
readonly attribute long long maxProgress;
|
||||
|
||||
Promise<void> install();
|
||||
Promise<void> cancel();
|
||||
};
|
||||
|
||||
dictionary addonInstallOptions {
|
||||
required DOMString url;
|
||||
};
|
||||
|
||||
[HeaderFile="mozilla/AddonManagerWebAPI.h",
|
||||
|
@ -60,13 +38,4 @@ interface AddonManager {
|
|||
* @return A promise. It will resolve to an Addon if the add-on is installed.
|
||||
*/
|
||||
Promise<Addon> getAddonByID(DOMString id);
|
||||
|
||||
/**
|
||||
* Creates an AddonInstall object for a given URL.
|
||||
*
|
||||
* @param options
|
||||
* Only one supported option: 'url', the URL of the addon to install.
|
||||
* @return A promise that resolves to an instance of AddonInstall.
|
||||
*/
|
||||
Promise<AddonInstall> createInstall(optional addonInstallOptions options);
|
||||
};
|
||||
|
|
|
@ -55,16 +55,11 @@ const APIBroker = {
|
|||
|
||||
APIBroker.init();
|
||||
|
||||
function Addon(win, properties) {
|
||||
function Addon(properties) {
|
||||
// We trust the webidl binding to broker access to our properties.
|
||||
for (let key of Object.keys(properties)) {
|
||||
this[key] = properties[key];
|
||||
}
|
||||
|
||||
this.uninstall = function() {
|
||||
let err = new win.Error("not yet implemented");
|
||||
return win.Promise.reject(err);
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -102,14 +97,9 @@ WebAPI.prototype = {
|
|||
|
||||
getAddonByID: WebAPITask(function*(id) {
|
||||
let addonInfo = yield APIBroker.sendRequest("getAddonByID", id);
|
||||
return addonInfo ? new Addon(this.window, addonInfo) : null;
|
||||
return addonInfo ? new Addon(addonInfo) : null;
|
||||
}),
|
||||
|
||||
createInstall() {
|
||||
let err = new this.window.Error("not yet implemented");
|
||||
return this.window.Promise.reject(err);
|
||||
},
|
||||
|
||||
classID: Components.ID("{8866d8e3-4ea5-48b7-a891-13ba0ac15235}"),
|
||||
contractID: "@mozilla.org/addon-web-api/manager;1",
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupports, Ci.nsIDOMGlobalPropertyInitializer])
|
||||
|
|
Загрузка…
Ссылка в новой задаче