gecko-dev/toolkit/components/extensions/ext-c-extension.js
Rob Wu 72ac7d1f12 Bug 1287010 - Use schema-generated extension, split ext-extension.js r=billm
- This was the last non-schema-generated API in content scripts.

MozReview-Commit-ID: FaIOCHoircf

--HG--
extra : rebase_source : 7bab2249a7462a581e493f7aa937df45cb895107
2016-08-18 19:19:40 -07:00

25 lines
687 B
JavaScript

"use strict";
XPCOMUtils.defineLazyModuleGetter(this, "PrivateBrowsingUtils",
"resource://gre/modules/PrivateBrowsingUtils.jsm");
function extensionApiFactory(context) {
return {
extension: {
getURL(url) {
return context.extension.baseURI.resolve(url);
},
get lastError() {
return context.lastError;
},
get inIncognitoContext() {
return PrivateBrowsingUtils.isContentWindowPrivate(context.contentWindow);
},
},
};
}
extensions.registerSchemaAPI("extension", "addon_child", extensionApiFactory);
extensions.registerSchemaAPI("extension", "content_child", extensionApiFactory);