webext-messenger 0.15.0-3 → 0.15.0-4
Sign up to get free protection for your applications and to get access to all the features.
@@ -1,4 +1,4 @@
|
|
1
|
-
import { isBackgroundPage, isContentScript } from "webext-detect-page";
|
1
|
+
import { isBackgroundPage, isContentScript, isExtensionContext, } from "webext-detect-page";
|
2
2
|
import { messenger } from "./sender.js";
|
3
3
|
import { registerMethods } from "./receiver.js";
|
4
4
|
import { debug } from "./shared.js";
|
@@ -53,8 +53,10 @@ function __getTabData() {
|
|
53
53
|
return { tabId: (_b = (_a = this.trace[0]) === null || _a === void 0 ? void 0 : _a.tab) === null || _b === void 0 ? void 0 : _b.id, frameId: (_c = this.trace[0]) === null || _c === void 0 ? void 0 : _c.frameId };
|
54
54
|
}
|
55
55
|
export function initPrivateApi() {
|
56
|
-
|
57
|
-
|
56
|
+
if (isExtensionContext()) {
|
57
|
+
// Any context can handler this message
|
58
|
+
registerMethods({ __getTabData });
|
59
|
+
}
|
58
60
|
if (isBackgroundPage()) {
|
59
61
|
thisTarget = { page: "background" };
|
60
62
|
}
|