aboutsummaryrefslogtreecommitdiff
path: root/src/content/Application.ts
diff options
context:
space:
mode:
authorShin'ya Ueoka <ueokande@i-beam.org>2021-09-26 11:54:11 +0900
committerGitHub <noreply@github.com>2021-09-26 11:54:11 +0900
commit9154972485c24a5a90782cef17f75b3a79a13774 (patch)
tree4bc3d608f498176f50a74ca7fc03d2d501ac7920 /src/content/Application.ts
parentcbf4b37bd0d5ba277d6400ed460d6a086ae1d7bb (diff)
parent91d4712e676782bb58fd7eb03fdc1f85111fca04 (diff)
Merge pull request #1264 from ueokande/fix-establish-connection-issue
Search a content from frames successfully loaded
Diffstat (limited to 'src/content/Application.ts')
-rw-r--r--src/content/Application.ts16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/content/Application.ts b/src/content/Application.ts
index a12c3c6..6b881fe 100644
--- a/src/content/Application.ts
+++ b/src/content/Application.ts
@@ -41,7 +41,21 @@ export default class Application {
if (window.self === window.top) {
this.routeMasterComponents();
}
- return this.routeCommonComponents();
+ this.routeCommonComponents();
+ // Make sure the background script sends a message to the content script by
+ // establishing a connection. If the background script tries to send a
+ // message to a frame on which cannot run the content script, it fails with
+ // a message "Could not establish connection."
+ //
+ // The port is never used, and the messages are delivered via
+ // `browser.tabs.sendMessage` API because sending a message via port cannot
+ // receive returned value.
+ //
+ // /* on background script */
+ // port.sendMessage({ type: "do something" }); <- returns void
+ //
+ browser.runtime.connect(undefined, { name: "vimvixen-find" });
+ return Promise.resolve();
}
private routeMasterComponents() {