(core) Fix CustomWidget nbrowser test

Summary:
 - test/nbrowser/CustomFilter keeps randomly fail on my local dev
 - it failed with `Cannot read property of null (reading 'postMessage`)` at line below:
 `this._rpc.setSendMessage(msg => this._iframe?.contentWindow!.postMessage(msg, '*'));`
 - I understand it was trying to send message before even the iframe was properly mounted
 - telling rpc to wait for the other end to send ready() successfully differ send message until everything's mounted.

Test Plan:  - should not break anything and test/nbrowser/CustomFilter should stop failing

Reviewers: jarek

Reviewed By: jarek

Subscribers: jarek

Differential Revision: https://phab.getgrist.com/D3510
pull/214/head
Cyprien P 2 years ago
parent 51ff72c15e
commit 808aacdc52

@ -68,6 +68,9 @@ export class WidgetFrame extends DisposableWithEvents {
// Build RPC object and connect it to iframe.
this._rpc = new Rpc({});
// queue until iframe's content emit ready() message
this._rpc.queueOutgoingUntilReadyMessage();
// Register outgoing message handler.
this._rpc.setSendMessage(msg => this._iframe?.contentWindow!.postMessage(msg, '*'));

Loading…
Cancel
Save