(realm, code)
| 80 | // Same as evalInRealm() but returns a Promise which will resolve when the |
| 81 | // function has actually. |
| 82 | async function evalInRealmAndWait(realm, code) { |
| 83 | const resolve = id(); |
| 84 | const waitOn = new Promise(r => { |
| 85 | realm[resolve] = r; |
| 86 | }); |
| 87 | evalInRealm(realm, code); |
| 88 | evalInRealm(realm, `${resolve}();`); |
| 89 | await waitOn; |
| 90 | } |
| 91 | |
| 92 | // The same as evalInRealmAndWait but returns the result of evaluating "code" as |
| 93 | // an expression. |
no test coverage detected