Bug 1287007 - Move extension.getViews to child
MozReview-Commit-ID: SG2pmulzaP
--- a/toolkit/components/extensions/ext-c-extension.js
+++ b/toolkit/components/extensions/ext-c-extension.js
@@ -18,8 +18,36 @@ function extensionApiFactory(context) {
return PrivateBrowsingUtils.isContentWindowPrivate(context.contentWindow);
},
},
};
}
extensions.registerSchemaAPI("extension", "addon_child", extensionApiFactory);
extensions.registerSchemaAPI("extension", "content_child", extensionApiFactory);
+extensions.registerSchemaAPI("extension", "addon_child", context => {
+ return {
+ extension: {
+ getViews: function(fetchProperties) {
+ let result = Cu.cloneInto([], context.cloneScope);
+
+ for (let view of context.extension.views) {
+ if (!view.active) {
+ continue;
+ }
+ if (fetchProperties !== null) {
+ if (fetchProperties.type !== null && view.viewType != fetchProperties.type) {
+ continue;
+ }
+
+ if (fetchProperties.windowId !== null && view.windowId != fetchProperties.windowId) {
+ continue;
+ }
+ }
+
+ result.push(view.contentWindow);
+ }
+
+ return result;
+ },
+ },
+ };
+});
--- a/toolkit/components/extensions/ext-extension.js
+++ b/toolkit/components/extensions/ext-extension.js
@@ -1,39 +1,14 @@
"use strict";
extensions.registerSchemaAPI("extension", "addon_parent", context => {
- let {extension} = context;
return {
extension: {
- getViews: function(fetchProperties) {
- let result = Cu.cloneInto([], context.cloneScope);
-
- for (let view of extension.views) {
- if (!view.active) {
- continue;
- }
- if (fetchProperties !== null) {
- if (fetchProperties.type !== null && view.viewType != fetchProperties.type) {
- continue;
- }
-
- if (fetchProperties.windowId !== null && view.windowId != fetchProperties.windowId) {
- continue;
- }
- }
-
- result.push(view.contentWindow);
- }
-
- return result;
- },
-
get lastError() {
- // TODO(robwu): See comment about lastError in ext-runtime.js
return context.lastError;
},
isAllowedIncognitoAccess() {
return Promise.resolve(true);
},
isAllowedFileSchemeAccess() {