Skip to content
This repository was archived by the owner on Jan 31, 2025. It is now read-only.

Commit ac33652

Browse files
author
Daniel Brain
committed
Do not synchronously throw error in bridge sendMessage
1 parent 9bc7816 commit ac33652

File tree

2 files changed

+22
-10
lines changed

2 files changed

+22
-10
lines changed

src/bridge/child.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,17 @@ export function openTunnelToOpener() : ZalgoPromise<void> {
107107
return;
108108
}
109109

110-
receiveMessage({
111-
data: message,
112-
origin: this.origin,
113-
source: this.source
114-
});
110+
try {
111+
receiveMessage({
112+
data: message,
113+
origin: this.origin,
114+
source: this.source
115+
});
116+
} catch (err) {
117+
setTimeout(() => {
118+
throw err;
119+
}, 1);
120+
}
115121
}
116122

117123
}).then(({ source, origin, data }) => {

src/bridge/parent.js

+11-5
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,17 @@ function listenForRegister(source, domain) {
5959
return;
6060
}
6161

62-
receiveMessage({
63-
data: message,
64-
origin: winDetails.domain,
65-
source: winDetails.win
66-
});
62+
try {
63+
receiveMessage({
64+
data: message,
65+
origin: winDetails.domain,
66+
source: winDetails.win
67+
});
68+
} catch (err) {
69+
setTimeout(() => {
70+
throw err;
71+
}, 1);
72+
}
6773
}
6874
};
6975
});

0 commit comments

Comments
 (0)