Ignore:
Timestamp:
May 13, 2003, 2:19:57 PM (22 years ago)
Author:
mjs
Message:

JavaScriptCore:

Reviewed by Darin.

  • fixed 3254484 - Add a way to print JavaScript exceptions to the console via the debug menu
  • improved JavaScript error message format
  • kjs/error_object.cpp: (ErrorProtoFuncImp::call): Include line number in toString output.
  • kjs/internal.cpp: (Parser::parse): Remove redundant fprintf.
  • kjs/interpreter.cpp: (Interpreter::evaluate): Log if the flag is on. Include filename in log output. (Interpreter::shouldPrintExceptions): Check the global flag. (Interpreter::setShouldPrintExceptions): Set the global flag.
  • kjs/interpreter.h:
  • kjs/nodes.cpp: (Node::throwError): Add variants that include value and expression or label in format. (NewExprNode::evaluate): Improve error message. (FunctionCallNode::evaluate): Improve error message. (RelationalNode::evaluate): Improve error message. (ContinueNode::execute): Improve error message. (BreakNode::execute): Improve error message. (LabelNode::execute): Improve error message.
  • kjs/nodes.h:

WebCore:

Reviewed by Darin.

  • fixed 3254484 - Add a way to print JavaScript exceptions to the console via the debug menu
  • khtml/ecma/kjs_proxy.cpp: (KJSProxyImpl::evaluate): Pass the filename.
  • kwq/WebCoreJavaScript.h:
  • kwq/WebCoreJavaScript.mm: (+[WebCoreJavaScript shouldPrintExceptions]): Call through to JavaScriptCore. (+[WebCoreJavaScript setShouldPrintExceptions:]): Call through to JavaScriptCore.
  • khtml/ecma/kjs_events.cpp: (JSEventListener::handleEvent): Print exception if there is one.
  • khtml/ecma/kjs_window.cpp: (ScheduledAction::execute): Print exception in the function case.

WebKit:

Reviewed by Darin.

  • fixed 3254484 - Add a way to print JavaScript exceptions to the console via the debug menu
  • Misc.subproj/WebCoreStatistics.h:
  • Misc.subproj/WebCoreStatistics.m: (+[WebCoreStatistics shouldPrintExceptions]): Call through to WebCore. (+[WebCoreStatistics setShouldPrintExceptions:]): Call through to WebCore.

WebBrowser:

Reviewed by Darin.

  • fixed 3254484 - Add a way to print JavaScript exceptions to the console via the debug menu
  • Debug/DebugUtilities.m: (-[DebugUtilities createDebugMenu]): Include "Log JavaScript Exceptions" item. (-[BrowserDocument toggleLogJavaScriptExceptions:]): Call WebKit to do the toggle. (-[BrowserDocument validate_toggleLogJavaScriptExceptions:]): Set state properly.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/interpreter.cpp

    r4087 r4363  
    116116}
    117117
    118 Completion Interpreter::evaluate(const UString &code, const Value &thisV)
     118Completion Interpreter::evaluate(const UString &code, const Value &thisV, const UString &filename)
    119119{
    120120  Completion comp = rep->evaluate(code,thisV);
    121 #ifndef NDEBUG
    122   if (comp.complType() == Throw) {
     121
     122#if APPLE_CHANGES
     123  if (shouldPrintExceptions() && comp.complType() == Throw) {
    123124    lock();
    124125    ExecState *exec = rep->globalExec();
    125     printf("Uncaught exception: %s\n", comp.value().toObject(exec).toString(exec).ascii());
     126    char *f = strdup(filename.ascii());
     127    const char *message = comp.value().toObject(exec).toString(exec).ascii();
     128    printf("%s:%s\n", f, message);
     129    free(f);
    126130    unlock();
    127131  }
    128132#endif
     133
    129134  return comp;
    130135}
     
    313318#endif
    314319
     320#if APPLE_CHANGES
     321static bool printExceptions = false;
     322
     323bool Interpreter::shouldPrintExceptions()
     324{
     325  return printExceptions;
     326}
     327
     328void Interpreter::setShouldPrintExceptions(bool print)
     329{
     330  printExceptions = print;
     331}
     332#endif
     333
    315334void Interpreter::virtual_hook( int, void* )
    316335{ /*BASE::virtual_hook( id, data );*/ }
Note: See TracChangeset for help on using the changeset viewer.