Changeset 205328 in webkit


Ignore:
Timestamp:
Sep 1, 2016 6:01:29 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

jsc: provide printErr()
https://bugs.webkit.org/show_bug.cgi?id=161513

Patch by JF Bastien <jfbastien@apple.com> on 2016-09-01
Reviewed by Mark Lam.

  • jsc.cpp:

(GlobalObject::finishCreation):
(printInternal): renamed from functionPrint, add error checking
(functionPrintStdOut): punt to printInternal
(functionPrintStdErr): punt to printInternal
(functionPrint): Deleted.

Location:
trunk/Source/JavaScriptCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r205324 r205328  
     12016-09-01  JF Bastien  <jfbastien@apple.com>
     2
     3        jsc: provide printErr()
     4        https://bugs.webkit.org/show_bug.cgi?id=161513
     5
     6        Reviewed by Mark Lam.
     7
     8        * jsc.cpp:
     9        (GlobalObject::finishCreation):
     10        (printInternal): renamed from functionPrint, add error checking
     11        (functionPrintStdOut): punt to printInternal
     12        (functionPrintStdErr): punt to printInternal
     13        (functionPrint): Deleted.
     14
    1152016-09-01  Mark Lam  <mark.lam@apple.com>
    216
  • trunk/Source/JavaScriptCore/jsc.cpp

    r205278 r205328  
    579579static EncodedJSValue JSC_HOST_CALL functionGetHiddenValue(ExecState*);
    580580static EncodedJSValue JSC_HOST_CALL functionSetHiddenValue(ExecState*);
    581 static EncodedJSValue JSC_HOST_CALL functionPrint(ExecState*);
     581static EncodedJSValue JSC_HOST_CALL functionPrintStdOut(ExecState*);
     582static EncodedJSValue JSC_HOST_CALL functionPrintStdErr(ExecState*);
    582583static EncodedJSValue JSC_HOST_CALL functionDebug(ExecState*);
    583584static EncodedJSValue JSC_HOST_CALL functionDescribe(ExecState*);
     
    780781        addFunction(vm, "describe", functionDescribe, 1);
    781782        addFunction(vm, "describeArray", functionDescribeArray, 1);
    782         addFunction(vm, "print", functionPrint, 1);
     783        addFunction(vm, "print", functionPrintStdOut, 1);
     784        addFunction(vm, "printErr", functionPrintStdErr, 1);
    783785        addFunction(vm, "quit", functionQuit, 0);
    784786        addFunction(vm, "abort", functionAbort, 0);
     
    11531155
    11541156
    1155 EncodedJSValue JSC_HOST_CALL functionPrint(ExecState* exec)
     1157static EncodedJSValue printInternal(ExecState* exec, FILE* out)
    11561158{
    11571159    if (test262AsyncTest) {
     
    11641166    for (unsigned i = 0; i < exec->argumentCount(); ++i) {
    11651167        if (i)
    1166             putchar(' ');
    1167 
    1168         printf("%s", exec->uncheckedArgument(i).toString(exec)->view(exec).get().utf8().data());
    1169     }
    1170 
    1171     putchar('\n');
    1172     fflush(stdout);
     1168            if (EOF == fputc(' ', out))
     1169                goto fail;
     1170
     1171        if (fprintf(out, "%s", exec->uncheckedArgument(i).toString(exec)->view(exec).get().utf8().data()) < 0)
     1172            goto fail;
     1173    }
     1174
     1175    fputc('\n', out);
     1176fail:
     1177    fflush(out);
    11731178    return JSValue::encode(jsUndefined());
    11741179}
     1180
     1181EncodedJSValue JSC_HOST_CALL functionPrintStdOut(ExecState* exec) { return printInternal(exec, stdout); }
     1182EncodedJSValue JSC_HOST_CALL functionPrintStdErr(ExecState* exec) { return printInternal(exec, stderr); }
    11751183
    11761184#ifndef NDEBUG
Note: See TracChangeset for help on using the changeset viewer.