Skip to content

Commit

Permalink
Suppress errors when a frame receives an extension message before ini…
Browse files Browse the repository at this point in the history
…tialization
  • Loading branch information
Qwokka committed Sep 23, 2023
1 parent 9d8d5df commit 373c690
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions content/cetus.js
Original file line number Diff line number Diff line change
Expand Up @@ -865,8 +865,16 @@ window.addEventListener("cetusMsgOut", function(msgRaw) {
if (typeof msgType !== "string") {
return;
}

const cetus = cetusInstances.get(msg.id);

let cetus;

try {
cetus = cetusInstances.get(msg.id);
} catch (e) {
// Since extension messages are sent to all frames, there's a good chance a frame will get a message without Cetus being
// initialized. In this case, we just drop the message
return;
}

if (typeof cetus === "undefined") {
return;
Expand Down

0 comments on commit 373c690

Please sign in to comment.