mirror of
https://github.com/status-im/react-native.git
synced 2025-01-14 03:26:07 +00:00
Fixed concurrency issue in remote debugger
Reviewed By: rafeca Differential Revision: D8316215 fbshipit-source-id: 70b5000a9bf09897bb9b9d505bfc5dcc7c4c3a41
This commit is contained in:
parent
a52d84d7e1
commit
e5aa5b7c50
@ -1,7 +1,7 @@
|
||||
<!DOCTYPE html>
|
||||
<!--
|
||||
Copyright (c) 2015-present, Facebook, Inc.
|
||||
|
||||
|
||||
This source code is licensed under the MIT license found in the
|
||||
LICENSE file in the root directory of this source tree.
|
||||
-->
|
||||
@ -112,6 +112,8 @@
|
||||
function connectToDebuggerProxy() {
|
||||
const ws = new WebSocket('ws://' + window.location.host + '/debugger-proxy?role=debugger&name=Chrome');
|
||||
let worker;
|
||||
let queuedMessages = [];
|
||||
let appExecuted = false;
|
||||
|
||||
function createJSRuntime() {
|
||||
// This worker will run the application JavaScript code,
|
||||
@ -181,9 +183,21 @@
|
||||
...object,
|
||||
url: await getBlobUrl(object.url),
|
||||
});
|
||||
appExecuted = true;
|
||||
// Flush any messages queued up and clear them
|
||||
for (const message of queuedMessages) {
|
||||
worker.postMessage(message);
|
||||
}
|
||||
queuedMessages = [];
|
||||
} else {
|
||||
// Otherwise, pass through to the worker.
|
||||
worker.postMessage(object);
|
||||
// Otherwise, pass through to the worker provided the
|
||||
// application script has been executed. If not add
|
||||
// it to a queue until it has been executed.
|
||||
if (appExecuted) {
|
||||
worker.postMessage(object);
|
||||
} else {
|
||||
queuedMessages.push(object);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user