[Webkit-unassigned] [Bug 38146] New: document.write is not synchronous

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Mon Apr 26 15:52:40 PDT 2010


https://bugs.webkit.org/show_bug.cgi?id=38146

           Summary: document.write is not synchronous
           Product: WebKit
           Version: 528+ (Nightly build)
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: InRadar
          Severity: Normal
          Priority: P2
         Component: HTML DOM
        AssignedTo: webkit-unassigned at lists.webkit.org
        ReportedBy: joepeck at webkit.org


HTML5 describes document.write as:
http://www.whatwg.org/specs/web-apps/current-work/multipage/apis-in-html-documents.html#document.write()

Part 5 describes processing the characters one at a time until reaching the
insertion point. This is not 100% followed by WebKit. WebKit can break early in
the HTMLTokenizer and put the remaining work on a timer. This may result in
incorrect results if running DOM operations immediately after a document.write.

This is difficult to test. The only idea I have had is processing a very large
string to hit the 500ms limit. This is not future proof, as there could always
be a CPU fast enough to complete the write() in less than the time limit. Also,
a large enough string may hang the browser.

Is it desired that we follow the spec here?

Other Browsers:

  Firefox 3.6 is synchronous or hangs.
  Chrome 5.0.342.9 is synchronous or hangs.
  Safari 4.0.4 is like WebKit and breaks after a long enough time.

Example of Issue:

  var doc = document.implementation.createHTMLDocument();
  doc.write( sufficientlyLongString );
  doc.getElementsByTagName("*").length; // DOM Operation may have undefined
results

WebKit will eventually complete the parsing, but it just fills in the DOM in
the background. There is no way to know when it is complete.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list