Bug 93702

Summary: jsc has no facility for loading files as data
Product: WebKit Reporter: Michael Herring <khakionion>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: RESOLVED DUPLICATE    
Severity: Normal CC: ap, barraclough, buildbot, dbates, eflews.bot, fpizlo, gyuyoung.kim, khakionion, oliver, philn, rniwa, xan.lopez
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
Patch
none
Patch
none
Patch msaboff: review-

Description Michael Herring 2012-08-10 02:13:03 PDT
Using the jsc command-line tool, I have noticed there is no way to load a file other than to evaluate it as JavaScript. It is useful to be able to load a file as text or data, so I have created a patch to add a loadFile(path) function to jsc. The only change is to jsc.cpp, and simply adds the ability to load a file and turn its contents into a JSC string value.
Comment 1 Michael Herring 2012-08-10 02:23:57 PDT
Created attachment 157688 [details]
Patch
Comment 2 Alexey Proskuryakov 2012-08-10 11:08:32 PDT
Would shell functionality help?

cat myfile.js | jsc
Comment 3 Michael Herring 2012-08-10 11:10:53 PDT
It wouldn't be relevant, at least not the example you present, since I don't want to eval or load JavaScript in any way. (Rather, it already does that, and I need something else.)

I want to load a file and turn the contents of it into a *string* variable. That's what this patch does.
Comment 4 Filip Pizlo 2012-08-13 15:46:05 PDT
Comment on attachment 157688 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=157688&action=review

> Source/JavaScriptCore/ChangeLog:8
> +        Added a loadFile function to jsc for file input when testin libraries written in JS.

Typo: testin -> testing
Comment 5 Michael Herring 2013-06-20 23:55:47 PDT
Created attachment 205152 [details]
Patch
Comment 6 Michael Herring 2013-06-20 23:57:07 PDT
Sorry for the insane delay on this. I've corrected the commit message, this should hopefully be ready to go in.
Comment 7 Build Bot 2013-06-20 23:58:37 PDT
Comment on attachment 205152 [details]
Patch

Attachment 205152 [details] did not pass mac-ews (mac):
Output: http://webkit-queues.appspot.com/results/918471
Comment 8 EFL EWS Bot 2013-06-20 23:58:54 PDT
Comment on attachment 205152 [details]
Patch

Attachment 205152 [details] did not pass efl-ews (efl):
Output: http://webkit-queues.appspot.com/results/857774
Comment 9 EFL EWS Bot 2013-06-21 00:00:20 PDT
Comment on attachment 205152 [details]
Patch

Attachment 205152 [details] did not pass efl-wk2-ews (efl-wk2):
Output: http://webkit-queues.appspot.com/results/884437
Comment 10 Early Warning System Bot 2013-06-21 00:01:09 PDT
Comment on attachment 205152 [details]
Patch

Attachment 205152 [details] did not pass qt-ews (qt):
Output: http://webkit-queues.appspot.com/results/876611
Comment 11 Early Warning System Bot 2013-06-21 00:01:29 PDT
Comment on attachment 205152 [details]
Patch

Attachment 205152 [details] did not pass qt-wk2-ews (qt-wk2):
Output: http://webkit-queues.appspot.com/results/876610
Comment 12 Michael Herring 2013-06-21 00:03:29 PDT
Created attachment 205154 [details]
Patch
Comment 13 Michael Herring 2013-06-21 00:03:58 PDT
Fixed a typo from an old data type identifier.
Comment 14 Michael Saboff 2013-10-31 14:27:04 PDT
Comment on attachment 205154 [details]
Patch

Looks good.  Please rebase this patch for the changes to throwing exceptions since the patch was originally posted and resubmit.
Comment 15 Daniel Bates 2015-12-23 09:58:00 PST

*** This bug has been marked as a duplicate of bug 125059 ***