Exemple #1
0
void Console::addMessage(MessageType type, MessageLevel level, ScriptCallStack* callStack, bool acceptNoArguments)
{
#if ENABLE(INSPECTOR)
    Page* page = this->page();
    if (!page)
        return;

    const ScriptCallFrame& lastCaller = callStack->at(0);

    if (!acceptNoArguments && !lastCaller.argumentCount())
        return;

    String message;
    if (getFirstArgumentAsString(callStack->state(), lastCaller, message))
        page->chrome()->client()->addMessageToConsole(JSMessageSource, type, level, message, lastCaller.lineNumber(), lastCaller.sourceURL().prettyURL());

    page->inspectorController()->addMessageToConsole(JSMessageSource, type, level, callStack);

    if (!Console::shouldPrintExceptions())
        return;

    printSourceURLAndLine(lastCaller.sourceURL().prettyURL(), 0);
    printMessageSourceAndLevelPrefix(JSMessageSource, level);

    for (unsigned i = 0; i < lastCaller.argumentCount(); ++i) {
        String argAsString;
        if (lastCaller.argumentAt(i).getString(callStack->state(), argAsString))
            printf(" %s", argAsString.utf8().data());
    }
    printf("\n");
#endif
}
Exemple #2
0
void Console::count(ScriptCallStack* callStack)
{
    Page* page = this->page();
    if (!page)
        return;

    const ScriptCallFrame& lastCaller = callStack->at(0);
    // Follow Firebug's behavior of counting with null and undefined title in
    // the same bucket as no argument
    String title;
    getFirstArgumentAsString(lastCaller, title);

    page->inspectorController()->count(title, lastCaller.lineNumber(), lastCaller.sourceURL().string());
}
Exemple #3
0
void Console::markTimeline(ScriptCallStack* callStack)
{
#if ENABLE(INSPECTOR)
    Page* page = this->page();
    if (!page)
        return;

    const ScriptCallFrame& lastCaller = callStack->at(0);
    String message;
    getFirstArgumentAsString(callStack->state(), lastCaller, message);

    page->inspectorController()->markTimeline(message);
#else
    UNUSED_PARAM(callStack);
#endif
}