зеркало из https://github.com/mozilla/gecko-dev.git
26 строки
566 B
JavaScript
26 строки
566 B
JavaScript
"use strict";
|
|
|
|
this.backgroundPage = class extends ExtensionAPI {
|
|
getAPI(context) {
|
|
function getBackgroundPage() {
|
|
for (let view of context.extension.views) {
|
|
if (view.viewType == "background" && context.principal.subsumes(view.principal)) {
|
|
return view.contentWindow;
|
|
}
|
|
}
|
|
return null;
|
|
}
|
|
return {
|
|
extension: {
|
|
getBackgroundPage,
|
|
},
|
|
|
|
runtime: {
|
|
getBackgroundPage() {
|
|
return context.cloneScope.Promise.resolve(getBackgroundPage());
|
|
},
|
|
},
|
|
};
|
|
}
|
|
};
|