Skip to content

Commit

Permalink
fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
jpuri committed Oct 28, 2022
1 parent c4723f9 commit 1864752
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions app/scripts/contentscript.js
Original file line number Diff line number Diff line change
Expand Up @@ -262,10 +262,10 @@ const setupPageStreams = () => {
};

// The field below is used to ensure that replay is done only once for each restart.
let REPLAY_ENABLED = false;
let METAMASK_EXTENSION_CONNECT_SENT = false;

const setupExtensionStreams = () => {
REPLAY_ENABLED = true;
METAMASK_EXTENSION_CONNECT_SENT = true;
extensionPort = browser.runtime.connect({ name: CONTENT_SCRIPT });
extensionStream = new PortStream(extensionPort);
extensionStream.on('data', extensionStreamMessageListener);
Expand Down Expand Up @@ -474,11 +474,11 @@ function logStreamDisconnectWarning(remoteLabel, error) {
*/
function extensionStreamMessageListener(msg) {
if (
REPLAY_ENABLED &&
METAMASK_EXTENSION_CONNECT_SENT &&
isManifestV3 &&
msg.data.method === 'metamask_chainChanged'
) {
REPLAY_ENABLED = false;
METAMASK_EXTENSION_CONNECT_SENT = false;
window.postMessage(
{
target: INPAGE, // the post-message-stream "target"
Expand All @@ -487,7 +487,7 @@ function extensionStreamMessageListener(msg) {
name: PROVIDER, // the obj-multiplex channel name
data: {
jsonrpc: '2.0',
method: 'METAMASK_EXTENSION_STREAM_CONNECT',
method: 'METAMASK_EXTENSION_CONNECT_CAN_RETRY',
},
},
},
Expand Down

0 comments on commit 1864752

Please sign in to comment.