fune/browser/components/extensions/ext-c-browserAction.js
Rob Wu fcb710d311 Bug 1287007 - Move part of browserAction and pageAction to child r=billm
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
2016-09-11 04:18:35 -07:00

26 lines
771 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("browserAction", "addon_child", context => {
return {
browserAction: {
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("browserAction.setIcon", [
normalizedDetails,
]);
},
},
};
});