-
-
Notifications
You must be signed in to change notification settings - Fork 329
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Chrome CLI Runner to facilitate an async exit.
* We now load a headless chrome platform ONLY if Chrome CLIRunner is being used * We inhibit a default exit from CDP interface if Kernel#exit hasn't been called (and opal-platform has been loaded) * We modify Kernel#exit to run a special alert message to communicate with Chrome CDP interface (we would have sent an exception, but it doesn't bubble in the async mess - perhaps it will once we migrate to PromiseV2) Thanks to Brandon Gastelo for spotting this bug. Ref: opal-rspec#89
- Loading branch information
Showing
4 changed files
with
27 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,15 @@ | ||
%x{ | ||
// Inhibit the default exit behavior | ||
window.OPAL_EXIT_CODE = "noexit"; | ||
Opal.exit = function(code) { | ||
// You can't exit from the browser. | ||
// The first call to Opal.exit should save an exit code. | ||
// All next invocations must be ignored. | ||
// Then we send an event to Chrome CDP Interface that we are finished | ||
if (typeof(window.OPAL_EXIT_CODE) === "undefined") { | ||
if (window.OPAL_EXIT_CODE === "noexit") { | ||
window.OPAL_EXIT_CODE = code; | ||
window.alert("opalheadlesschromeexit"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters