Patch for JS debugger

Koos Vriezen koos.vriezen at xs4all.nl
Sun Jun 2 14:26:39 BST 2002



On Sun, 2 Jun 2002, Harri Porten wrote:

> On Sat, 1 Jun 2002, Koos Vriezen wrote:
>
> > This is my second patch for the JS debugger in khtml.
> > To enable the debugger 'EnableJavaScriptDebug=true' should be set in
> > ~/.kde/share/config/konquerorrc under '[Java/JavaScript Settings]'.
>
> Please commit. If it works I can't comment much on it as I didn't inspect
> it anymore after Peter continued what I started ages ago.

Will do so if its stable again in my tree.

> I have one issue though: my original design goal was to let it be not
> compiled be default as I expect some slowdown that the average user won't
> like. That would mean not activating the KJS_DEBUGGER macro (your patch)
> and ifdef'ing the debugger related code in libkjs code as well. Hmmm.
> Compiling it into the ecma/* part probably doesn't make a speed
> difference.
>
> What do you think ? I'd rather see khtml developers compile with a switch
> or provide a libkjsd binary if end users are interested in the debugger.

IMO there is no speed difference, only an extra
'if (KJSDebugWin::instance())' check in KJSProxyImpl if
EnableJavaScriptDebug is not 'true'.

There are some issues, seen when debugging frames. For instance
kjs/internal.cpp:

int Parser::sid = 0;

ProgramNode *Parser::parse(const UChar *code, unsigned int length, int
*sourceId, int *errLine, UString *errMsg)
{
 .....
  Lexer::curr()->setCode(code, length);
  progNode = 0;
  sid++;
  if (sourceId)
    *sourceId = sid;
 ......
  ProgramNode *prog = progNode;
  progNode = 0;
  sid = -1;

Any idea why 'sid' is set to -1. Helps a lot to comment this out.

Also in khtml/html/htmltokenizer.cpp:

void HTMLTokenizer::parseSpecial(DOMStringIt &src)
{
    assert( textarea || title || !Entity );
    assert( !tag );
    assert( xmp+textarea+title+style+script == 1 );
    if (script)
        scriptStartLineno = lineno+src.lineCount();

this 'scriptStartLineno' is used for the baseline of the script inside a
HTML page and can be almost the end of the file, where it should be the
linenr of the <SCRIPT> tag.
Any ideas why baseLine is 'lineno+src.lineCount()'? Changing to
'src.lineCount()+1' seems to help.

Koos





More information about the kfm-devel mailing list