File tree 1 file changed +17
-3
lines changed
1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change 1
1
<!DOCTYPE html>
2
2
<!--
3
3
Copyright (c) 2015-present, Facebook, Inc.
4
-
4
+
5
5
This source code is licensed under the MIT license found in the
6
6
LICENSE file in the root directory of this source tree.
7
7
-->
112
112
function connectToDebuggerProxy ( ) {
113
113
const ws = new WebSocket ( 'ws://' + window . location . host + '/debugger-proxy?role=debugger&name=Chrome' ) ;
114
114
let worker ;
115
+ let queuedMessages = [ ] ;
116
+ let appExecuted = false ;
115
117
116
118
function createJSRuntime ( ) {
117
119
// This worker will run the application JavaScript code,
181
183
...object ,
182
184
url : await getBlobUrl ( object . url ) ,
183
185
} ) ;
186
+ appExecuted = true ;
187
+ // Flush any messages queued up and clear them
188
+ for ( const message of queuedMessages ) {
189
+ worker . postMessage ( message ) ;
190
+ }
191
+ queuedMessages = [ ] ;
184
192
} else {
185
- // Otherwise, pass through to the worker.
186
- worker . postMessage ( object ) ;
193
+ // Otherwise, pass through to the worker provided the
194
+ // application script has been executed. If not add
195
+ // it to a queue until it has been executed.
196
+ if ( appExecuted ) {
197
+ worker . postMessage ( object ) ;
198
+ } else {
199
+ queuedMessages . push ( object ) ;
200
+ }
187
201
}
188
202
} ;
189
203
You can’t perform that action at this time.
0 commit comments