aboutsummaryrefslogtreecommitdiff
path: root/ext/js/yomichan.js
diff options
context:
space:
mode:
authorDarius Jahandarie <djahandarie@gmail.com>2023-10-01 09:14:48 +0000
committerGitHub <noreply@github.com>2023-10-01 09:14:48 +0000
commit8430fce21912ad08ddeaa3714c6feb0c2cc01c10 (patch)
tree7d9726e0941ad4360b7e8f70cd40f5076c101ed5 /ext/js/yomichan.js
parenta7f119e5e70b2b9d61c5dca351ec2e36c9b6d00e (diff)
parent841d49c7f97678b4873ea198b91419687d137849 (diff)
Merge pull request #259 from praschke/chrome-death-fix
Fix Chrome death, by creating both cross-frame ports in the background
Diffstat (limited to 'ext/js/yomichan.js')
-rw-r--r--ext/js/yomichan.js24
1 files changed, 3 insertions, 21 deletions
diff --git a/ext/js/yomichan.js b/ext/js/yomichan.js
index 6eea952e..5a55b3ea 100644
--- a/ext/js/yomichan.js
+++ b/ext/js/yomichan.js
@@ -129,12 +129,12 @@ class Yomichan extends EventDispatcher {
if (!isBackground) {
this._api = new API(this);
- this._crossFrame = new CrossFrameAPI();
- this._crossFrame.prepare();
-
this.sendMessage({action: 'requestBackendReadySignal'});
await this._isBackendReadyPromise;
+ this._crossFrame = new CrossFrameAPI();
+ await this._crossFrame.prepare();
+
log.on('log', this._onForwardLog.bind(this));
}
}
@@ -172,24 +172,6 @@ class Yomichan extends EventDispatcher {
}
}
- /**
- * Runs `chrome.runtime.connect()` with additional exception handling events.
- * @param {...*} args The arguments to be passed to `chrome.runtime.connect()`.
- * @returns {Port} The resulting port.
- * @throws {Error} Errors thrown by `chrome.runtime.connect()` are re-thrown.
- */
- connect(...args) {
- try {
- return chrome.runtime.connect(...args);
- } catch (e) {
- this.triggerExtensionUnloaded();
- throw e;
- }
- }
-
- /**
- * Runs chrome.runtime.connect() with additional exception handling events.
- */
triggerExtensionUnloaded() {
this._isExtensionUnloaded = true;
if (this._isTriggeringExtensionUnloaded) { return; }