forked from mirrors/gecko-dev
And remove redundant `Promise.resolve()` because it is the default for async functions. setIcon is not supported on Android, so there was no need to change mobile/android/components/extensions/ext-pageAction.js. MozReview-Commit-ID: 94ebaJFxLAi --HG-- extra : rebase_source : 20466181501b264ba33fc8ab61fdf2bed20f9eef
26 lines
762 B
JavaScript
26 lines
762 B
JavaScript
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
|
|
/* vim: set sts=2 sw=2 et tw=80: */
|
|
"use strict";
|
|
|
|
Cu.import("resource://gre/modules/ExtensionUtils.jsm");
|
|
var {
|
|
IconDetails,
|
|
} = ExtensionUtils;
|
|
|
|
extensions.registerSchemaAPI("pageAction", "addon_child", context => {
|
|
return {
|
|
pageAction: {
|
|
setIcon: function(details) {
|
|
// This needs to run in the addon process because normalization requires
|
|
// the use of <canvas>.
|
|
let normalizedDetails = {
|
|
tabId: details.tabId,
|
|
path: IconDetails.normalize(details, context.extension, context),
|
|
};
|
|
return context.childManager.callParentAsyncFunction("pageAction.setIcon", [
|
|
normalizedDetails,
|
|
]);
|
|
},
|
|
},
|
|
};
|
|
});
|