Skip to content

Commit

Permalink
Added support for the "quit" command/function provided by the Rhino s…
Browse files Browse the repository at this point in the history
…hell

before I started sub-classing it.  All env.js tests pass, and I have
manually confirmed that "quit();" now works when using env-js.jar as an
interactive shell.
  • Loading branch information
gleneivey committed Oct 15, 2009
1 parent 1b5d4de commit 6c1fd5d
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Binary file modified dist/env-js.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion dist/env.js
Expand Up @@ -8603,7 +8603,7 @@ XMLHttpRequest.prototype = {
$debug("parsing response text into xml document");
responseXML = $domparser.parseFromString(_this.responseText+"");
return responseXML;
} catch(e) {
} catch(e) {
$error('response XML does not apear to be well formed xml', e);
responseXML = $domparser.parseFromString("<html>"+
"<head/><body><p> parse error </p></body></html>");
Expand Down
2 changes: 1 addition & 1 deletion dist/env.rhino.js
Expand Up @@ -9260,7 +9260,7 @@ XMLHttpRequest.prototype = {
$debug("parsing response text into xml document");
responseXML = $domparser.parseFromString(_this.responseText+"");
return responseXML;
} catch(e) {
} catch(e) {
$error('response XML does not apear to be well formed xml', e);
responseXML = $domparser.parseFromString("<html>"+
"<head/><body><p> parse error </p></body></html>");
Expand Down
10 changes: 10 additions & 0 deletions rhino/src/org/mozilla/javascript/tools/envjs/Main.java
Expand Up @@ -15,6 +15,15 @@
public class Main extends org.mozilla.javascript.tools.shell.Main
{

private static class Quitter implements
org.mozilla.javascript.tools.shell.QuitAction
{
public void quit(org.mozilla.javascript.Context cx, int exitCode)
{
System.exit(exitCode);
}
}

static
{
// replace the generic Global object, instantiated in
Expand All @@ -31,5 +40,6 @@ public class Main extends org.mozilla.javascript.tools.shell.Main
// "Sharing Scopes" in
// https://developer.mozilla.org/En/Rhino_documentation/Scopes_and_Contexts
global = new Global(window);
global.initQuitAction(new Quitter());
}
}

0 comments on commit 6c1fd5d

Please sign in to comment.