Bug 127435

Summary: Basic framework for a modern jsc CLI
Product: WebKit Reporter: Mark Hahnenberg <mhahnenberg>
Component: JavaScriptCoreAssignee: Mark Hahnenberg <mhahnenberg>
Status: RESOLVED FIXED    
Severity: Normal CC: commit-queue, ggaren
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: Unspecified   
OS: Unspecified   
Bug Depends on: 127488    
Bug Blocks: 127432    
Attachments:
Description Flags
Patch none

Description Mark Hahnenberg 2014-01-22 11:11:51 PST
The most basic components of a modern jsc command line interface consist of the following:

- A simple REPL to enter commands and receive results
- The ability to define a module (which consists of various internal methods as well as a set of externally visible methods)
- The ability to load other modules at runtime
- The ability to interact with the underlying platform to perform various "privileged" functions (e.g. opening files, printing to the stdout, etc.)

The basic architecture will look something like the following:
- If the tool is run in REPL mode (i.e. no command line arguments), it will start the REPL on the main thread and start a secondary thread with a run loop to handle various inputs from the REPL thread.
- If the tool is given a script to run, it will evaluate that script (and any scripts that it might transitively load) within the run loop on the main thread.
Comment 1 Mark Hahnenberg 2014-01-22 13:03:36 PST
Created attachment 221896 [details]
Patch
Comment 2 Oliver Hunt 2014-01-22 13:16:34 PST
Comment on attachment 221896 [details]
Patch

the existing jsc prompt supports multiline input which this does not appear to :(
Comment 3 Mark Hahnenberg 2014-01-22 13:35:07 PST
(In reply to comment #2)
> (From update of attachment 221896 [details])
> the existing jsc prompt supports multiline input which this does not appear to :(

I'll file a bug for it. This will probably never replace the old jsc since other platforms can't compile Objective-C.
Comment 4 Mark Hahnenberg 2014-01-22 13:48:53 PST
(In reply to comment #3)
> (In reply to comment #2)
> > (From update of attachment 221896 [details] [details])
> > the existing jsc prompt supports multiline input which this does not appear to :(
> 
> I'll file a bug for it. This will probably never replace the old jsc since other platforms can't compile Objective-C.

I sort of skipped a sentence there. I meant to also say that this will probably not replace jsc on our own platforms for some time until the new jsc-cli reaches feature parity with the old jsc. In addition, the old jsc will probably stick around indefinitely anyways due to the absence of Objective-C on other platforms.
Comment 5 Geoffrey Garen 2014-01-22 22:36:37 PST
Comment on attachment 221896 [details]
Patch

rs=me
Comment 6 Mark Hahnenberg 2014-01-23 08:39:50 PST
(In reply to comment #2)
> (From update of attachment 221896 [details])
> the existing jsc prompt supports multiline input which this does not appear to :(

I filed bug 127484 to track this.
Comment 7 WebKit Commit Bot 2014-01-23 09:04:33 PST
Comment on attachment 221896 [details]
Patch

Clearing flags on attachment: 221896

Committed r162612: <http://trac.webkit.org/changeset/162612>
Comment 8 WebKit Commit Bot 2014-01-23 09:04:36 PST
All reviewed patches have been landed.  Closing bug.
Comment 9 WebKit Commit Bot 2014-01-23 09:12:22 PST
Re-opened since this is blocked by bug 127488
Comment 10 Mark Hahnenberg 2014-01-23 09:21:48 PST
Had to roll it back out because I forgot that EWS doesn't test changes to the Tools directory, and thus this patch broke several platforms.
Comment 11 Mark Hahnenberg 2014-02-12 14:49:26 PST
Committed r163991: <http://trac.webkit.org/changeset/163991>