source: webkit/trunk/JavaScriptCore/kjs/debugger.cpp@ 15026

Last change on this file since 15026 was 15026, checked in by thatcher, 19 years ago

JavaScriptCore:

Reviewed by Darin.

Bug 9574: Drosera should show inline scripts within the original HTML
http://bugzilla.opendarwin.org/show_bug.cgi?id=9574

Pass the starting line number and error message to the debugger.

  • kjs/debugger.cpp: (Debugger::sourceParsed):
  • kjs/debugger.h:
  • kjs/function.cpp: (KJS::GlobalFuncImp::callAsFunction):
  • kjs/function_object.cpp: (FunctionObjectImp::construct):
  • kjs/interpreter.cpp: (KJS::Interpreter::evaluate):

WebCore:

Reviewed by Darin.

Bug 9574: Drosera should show inline scripts within the original HTML
http://bugzilla.opendarwin.org/show_bug.cgi?id=9574

  • Pass the starting line number and error message to the debugger.
  • Call parsedSource even if there was a script parse error so the debugger can show the parse error.
  • Pass NSURL objects to the ObjC delegate for the script URLs.
  • bridge/mac/WebCoreScriptDebugger.h:
  • bridge/mac/WebCoreScriptDebugger.mm: (toNSURL): (WebCoreScriptDebuggerImp::sourceParsed):

WebKit:

Reviewed by Darin.

Bug 9574: Drosera should show inline scripts within the original HTML
http://bugzilla.opendarwin.org/show_bug.cgi?id=9574

  • Adds a new version of the didParseSource delegate callback with base line number.
  • Adds a new delegate callback for when a script fails to parse.
  • These new callbacks use NSURLs for the url parameter.
  • Adds a new script listener callback to notify when the main resource loads.
  • Adds a WebScriptErrorDomian and other keys for use with NSError.
  • DefaultDelegates/WebDefaultScriptDebugDelegate.m: (-[WebDefaultScriptDebugDelegate webView:didParseSource:baseLineNumber:fromURL:sourceId:forWebFrame:]): (-[WebDefaultScriptDebugDelegate webView:failedToParseSource:baseLineNumber:fromURL:withError:forWebFrame:]):
  • DefaultDelegates/WebScriptDebugServer.h:
  • DefaultDelegates/WebScriptDebugServer.m: (-[WebScriptDebugServer webView:didLoadMainResourceForDataSource:]): (-[WebScriptDebugServer webView:didParseSource:baseLineNumber:fromURL:sourceId:forWebFrame:]): (-[WebScriptDebugServer webView:failedToParseSource:baseLineNumber:fromURL:withError:forWebFrame:]):
  • DefaultDelegates/WebScriptDebugServerPrivate.h:
  • WebKit.exp:
  • WebView/WebDataSource.m: (-[WebDataSource _setPrimaryLoadComplete:]):
  • WebView/WebScriptDebugDelegate.h:
  • WebView/WebScriptDebugDelegate.m: (-[WebScriptCallFrame parsedSource:fromURL:sourceId:startLine:errorLine:errorMessage:]):

WebKitTools:

Reviewed by Darin.

Bug 9574: Drosera should show inline scripts within the original HTML
http://bugzilla.opendarwin.org/show_bug.cgi?id=9574

Refactor the JavaScript code to have a distinction between files
and scripts. Show the script in the context of the HTML file if
it's URL is the same as the frame's main resource. At the time of
the disParseScript callback the main resource might not be completely
loaded, but Drosera needs to show whatever we have at the time. Once
the main resource is finished, update the file source and reload the file.

  • Drosera/DebuggerDocument.m: (-[DebuggerDocument pause]): (-[DebuggerDocument webView:didLoadMainResourceForDataSource:]): (-[DebuggerDocument webView:didParseSource:baseLineNumber:fromURL:sourceId:forWebFrame:]): (-[DebuggerDocument webView:failedToParseSource:baseLineNumber:fromURL:withError:forWebFrame:]):
  • Drosera/debugger.css:
  • Drosera/debugger.js:
  • Property svn:eol-style set to native
File size: 3.1 KB
Line 
1// -*- c-basic-offset: 2 -*-
2/*
3 * This file is part of the KDE libraries
4 * Copyright (C) 1999-2001 Harri Porten ([email protected])
5 * Copyright (C) 2001 Peter Kelly ([email protected])
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
16 *
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 *
21 */
22
23#include "config.h"
24#include "debugger.h"
25#include "ustring.h"
26
27#include "internal.h"
28
29using namespace KJS;
30
31// ------------------------------ Debugger -------------------------------------
32
33namespace KJS {
34 struct AttachedInterpreter
35 {
36 public:
37 AttachedInterpreter(Interpreter *i, AttachedInterpreter *ai) : interp(i), next(ai) { ++Debugger::debuggersPresent; }
38 ~AttachedInterpreter() { --Debugger::debuggersPresent; }
39 Interpreter *interp;
40 AttachedInterpreter *next;
41 };
42
43}
44
45int Debugger::debuggersPresent = 0;
46
47Debugger::Debugger()
48{
49 rep = new DebuggerImp();
50}
51
52Debugger::~Debugger()
53{
54 detach(0);
55 delete rep;
56}
57
58void Debugger::attach(Interpreter* interp)
59{
60 Debugger *other = interp->debugger();
61 if (other == this)
62 return;
63 if (other)
64 other->detach(interp);
65 interp->setDebugger(this);
66 rep->interps = new AttachedInterpreter(interp, rep->interps);
67}
68
69void Debugger::detach(Interpreter* interp)
70{
71 // iterate the addresses where AttachedInterpreter pointers are stored
72 // so we can unlink items from the list
73 AttachedInterpreter **p = &rep->interps;
74 AttachedInterpreter *q;
75 while ((q = *p)) {
76 if (!interp || q->interp == interp) {
77 *p = q->next;
78 q->interp->setDebugger(0);
79 delete q;
80 } else
81 p = &q->next;
82 }
83}
84
85bool Debugger::sourceParsed(ExecState */*exec*/, int /*sourceId*/, const UString &/*sourceURL*/,
86 const UString &/*source*/, int /*startingLineNumber*/, int /*errorLine*/, const UString & /*errorMsg*/)
87{
88 return true;
89}
90
91bool Debugger::sourceUnused(ExecState */*exec*/, int /*sourceId*/)
92{
93 return true;
94}
95
96bool Debugger::exception(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
97 JSObject */*exceptionObj*/)
98{
99 return true;
100}
101
102bool Debugger::atStatement(ExecState */*exec*/, int /*sourceId*/, int /*firstLine*/,
103 int /*lastLine*/)
104{
105 return true;
106}
107
108bool Debugger::callEvent(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
109 JSObject */*function*/, const List &/*args*/)
110{
111 return true;
112}
113
114bool Debugger::returnEvent(ExecState */*exec*/, int /*sourceId*/, int /*lineno*/,
115 JSObject */*function*/)
116{
117 return true;
118}
119
Note: See TracBrowser for help on using the repository browser.