Changeset 159934 in webkit for trunk/Source/JavaScriptCore/jsc.cpp
- Timestamp:
- Dec 2, 2013, 8:38:58 AM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/jsc.cpp
r159064 r159934 109 109 static EncodedJSValue JSC_HOST_CALL functionRun(ExecState*); 110 110 static EncodedJSValue JSC_HOST_CALL functionLoad(ExecState*); 111 static EncodedJSValue JSC_HOST_CALL functionReadFile(ExecState*); 111 112 static EncodedJSValue JSC_HOST_CALL functionCheckSyntax(ExecState*); 112 113 static EncodedJSValue JSC_HOST_CALL functionReadline(ExecState*); … … 227 228 addFunction(vm, "run", functionRun, 1); 228 229 addFunction(vm, "load", functionLoad, 1); 230 addFunction(vm, "readFile", functionReadFile, 1); 229 231 addFunction(vm, "checkSyntax", functionCheckSyntax, 1); 230 232 addFunction(vm, "jscStack", functionJSCStack, 1); … … 420 422 exec->vm().throwException(exec, evaluationException); 421 423 return JSValue::encode(result); 424 } 425 426 EncodedJSValue JSC_HOST_CALL functionReadFile(ExecState* exec) 427 { 428 String fileName = exec->argument(0).toString(exec)->value(exec); 429 Vector<char> script; 430 if (!fillBufferWithContentsOfFile(fileName, script)) 431 return JSValue::encode(exec->vm().throwException(exec, createError(exec, "Could not open file."))); 432 433 return JSValue::encode(jsString(exec, stringFromUTF(script.data()))); 422 434 } 423 435
Note:
See TracChangeset
for help on using the changeset viewer.