browser(firefox): reliably close the pipe (#3280)
This commit is contained in:
parent
573f580fa8
commit
d3a40be479
|
|
@ -1,2 +1,2 @@
|
|||
1149
|
||||
Changed: dgozman@gmail.com Mon Aug 3 15:21:45 PDT 2020
|
||||
1150
|
||||
Changed: dgozman@gmail.com Mon Aug 3 19:37:50 PDT 2020
|
||||
|
|
|
|||
|
|
@ -94,7 +94,11 @@ CommandLineHandler.prototype = {
|
|||
const browserHandler = new BrowserHandler(dispatcher.rootSession(), dispatcher, targetRegistry, () => {
|
||||
if (silent)
|
||||
Services.startup.exitLastWindowClosingSurvivalArea();
|
||||
pipe.stop();
|
||||
// Send response to the Browser.close, and then stop in the next microtask.
|
||||
Promise.resolve().then(() => {
|
||||
connection.onclose();
|
||||
pipe.stop();
|
||||
});
|
||||
});
|
||||
dispatcher.rootSession().registerHandler('Browser', browserHandler);
|
||||
loadFrameScript();
|
||||
|
|
|
|||
|
|
@ -128,12 +128,14 @@ nsresult nsRemoteDebuggingPipe::Stop() {
|
|||
#if defined(_WIN32)
|
||||
CancelIoEx(readHandle, nullptr);
|
||||
CloseHandle(readHandle);
|
||||
CloseHandle(writeHandle);
|
||||
#else
|
||||
shutdown(readFD, SHUT_RDWR);
|
||||
shutdown(writeFD, SHUT_RDWR);
|
||||
#endif
|
||||
mReaderThread->Shutdown();
|
||||
mReaderThread = nullptr;
|
||||
mWriterThread->AsyncShutdown();
|
||||
mWriterThread->Shutdown();
|
||||
mWriterThread = nullptr;
|
||||
return NS_OK;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -125,13 +125,13 @@ class BrowserHandler {
|
|||
}
|
||||
|
||||
async close() {
|
||||
this._onclose();
|
||||
let browserWindow = Services.wm.getMostRecentWindow(
|
||||
"navigator:browser"
|
||||
);
|
||||
if (browserWindow && browserWindow.gBrowserInit) {
|
||||
await browserWindow.gBrowserInit.idleTasksFinishedPromise;
|
||||
}
|
||||
this._onclose();
|
||||
Services.startup.quit(Ci.nsIAppStartup.eForceQuit);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue