Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

bugs ahoy in parser/htmldocument.js

#151

I'm just putting this in for the record. I have a patch momentarily.

in parser/htmldocument.js

__extend__(HTMLDocument.prototype,{
    open : function(){
        //console.log('opening doc for write.');                                                                 
        this._open = true;
        this._writebuffer = [];
    },
    close : function(){
        //console.log('closing doc.');                                                                           
        if(this._open){
            HTMLParser.parseDocument(this._writebuffer.join('\n'), this);
            this._open = false;
            this._writebuffer = null;
            //console.log('finished writing doc.');                                                              
        }
    },
    write: function(htmlstring) {
        //console.log('writing doc.');                                                                           
        if (this._open) {
            this._writebuffer = [htmlstring];
        }
    },
    writeln: function(htmlstring) {
        if (this.open) {
            this._writebuffer.push(htmlstring);
        }
    }

Bugs ahoy!

  • writeln Uses wrong test. Should be this._open
  • writeln Should append '\n' to writebuffer
  • writeln and write should implicitly call open if not done already
  • write erases the writebuffer on each call
  • close joins with newline, should be join with empty string

What's funny is that the bugs cancel each other out which is why unless you used plain 'write' you'd never notice.

Reported by nickg · April 13th, 2010 @ 05:10 PM

State: resolved
Milestone: none
Assigned to: nickg nickg

Activity

  1. nickg
    nickg
    • State changed from open to resolved

    fixed!

    April 13th, 2010 @ 05:34 PM

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.