Ignore:
Timestamp:
Jun 25, 2019, 11:36:29 AM (6 years ago)
Author:
Joseph Pecoraro
Message:

Web Inspector: Implement console.timeLog
https://bugs.webkit.org/show_bug.cgi?id=199184

Reviewed by Devin Rousso.

Source/JavaScriptCore:

  • inspector/JSGlobalObjectConsoleClient.cpp:

(Inspector::JSGlobalObjectConsoleClient::timeLog):

  • inspector/JSGlobalObjectConsoleClient.h:
  • inspector/agents/InspectorConsoleAgent.cpp:

(Inspector::InspectorConsoleAgent::logTiming):
(Inspector::InspectorConsoleAgent::stopTiming):

  • inspector/agents/InspectorConsoleAgent.h:
  • runtime/ConsoleClient.h:
  • runtime/ConsoleObject.cpp:

(JSC::ConsoleObject::finishCreation):
(JSC::consoleProtoFuncTimeLog):

Source/WebCore:

Updated existing tests.

  • inspector/InspectorInstrumentation.cpp:

(WebCore::InspectorInstrumentation::logConsoleTimingImpl):

  • inspector/InspectorInstrumentation.h:

(WebCore::InspectorInstrumentation::logConsoleTiming):

  • page/PageConsoleClient.cpp:

(WebCore::PageConsoleClient::timeLog):

  • page/PageConsoleClient.h:
  • workers/WorkerConsoleClient.cpp:

(WebCore::WorkerConsoleClient::timeLog):

  • workers/WorkerConsoleClient.h:
  • worklets/WorkletConsoleClient.cpp:

(WebCore::WorkletConsoleClient::timeLog):

  • worklets/WorkletConsoleClient.h:

Source/WebInspectorUI:

  • UserInterface/Views/ConsoleMessageView.js:

(WI.ConsoleMessageView.prototype._appendMessageTextAndArguments):
Time messages (like timeLog) do not include their messageText
in their parameters list. So to behave more like normal logs
build a parameter list that includes it at the front.

LayoutTests:

  • inspector/console/console-time-expected.txt:
  • inspector/console/console-time.html:

Add new timeLog tests.

  • js/console-expected.txt:

New timeLog method.

  • platform/gtk/TestExpectations:
  • platform/mac/TestExpectations:

Unskip test.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/ConsoleObject.cpp

    r242992 r246798  
    5353static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTakeHeapSnapshot(ExecState*);
    5454static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTime(ExecState*);
     55static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeLog(ExecState*);
    5556static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState*);
    5657static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeStamp(ExecState*);
     
    9394    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("profileEnd", consoleProtoFuncProfileEnd, static_cast<unsigned>(PropertyAttribute::None), 0);
    9495    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("time", consoleProtoFuncTime, static_cast<unsigned>(PropertyAttribute::None), 0);
     96    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("timeLog", consoleProtoFuncTimeLog, static_cast<unsigned>(PropertyAttribute::None), 0);
    9597    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("timeEnd", consoleProtoFuncTimeEnd, static_cast<unsigned>(PropertyAttribute::None), 0);
    9698    JSC_NATIVE_FUNCTION_WITHOUT_TRANSITION("timeStamp", consoleProtoFuncTimeStamp, static_cast<unsigned>(PropertyAttribute::None), 0);
     
    314316}
    315317
    316 static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState* exec)
     318static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeLog(ExecState* exec)
    317319{
    318320    VM& vm = exec->vm();
     
    330332    }
    331333
     334    client->timeLog(exec, title, Inspector::createScriptArguments(exec, 1));
     335    return JSValue::encode(jsUndefined());
     336}
     337
     338static EncodedJSValue JSC_HOST_CALL consoleProtoFuncTimeEnd(ExecState* exec)
     339{
     340    VM& vm = exec->vm();
     341    auto scope = DECLARE_THROW_SCOPE(vm);
     342    ConsoleClient* client = exec->lexicalGlobalObject()->consoleClient();
     343    if (!client)
     344        return JSValue::encode(jsUndefined());
     345
     346    String title;
     347    if (exec->argumentCount() < 1)
     348        title =  "default"_s;
     349    else {
     350        title = valueOrDefaultLabelString(exec, exec->argument(0));
     351        RETURN_IF_EXCEPTION(scope, encodedJSValue());
     352    }
     353
    332354    client->timeEnd(exec, title);
    333355    return JSValue::encode(jsUndefined());
Note: See TracChangeset for help on using the changeset viewer.