Changeset 63165 in webkit


Ignore:
Timestamp:
Jul 12, 2010 8:41:11 PM (14 years ago)
Author:
abarth@webkit.org
Message:

2010-07-12 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

HTML5 Parser: document.write after onload blows away document
https://bugs.webkit.org/show_bug.cgi?id=40745

Update test to expect new behavior.

  • http/tests/misc/write-while-waiting.html:

2010-07-12 Adam Barth <abarth@webkit.org>

Reviewed by Eric Seidel.

HTML5 Parser: document.write after onload blows away document
https://bugs.webkit.org/show_bug.cgi?id=40745

Rather than blowing away the document when we get a document.write call
after the document is closed, we new ignore the write. This
technically violates the spec (which requires us to blow away the
document), but blowing away the document breaks too many web sites.

Rather than this patch, we could go back to our old behavior (which was
to append the bytes just before EOF), but implementing this approach
(suggested by Henri) will let us gather data about whether his approach
is workable.

See also: http://www.w3.org/Bugs/Public/show_bug.cgi?id=9767

  • dom/Document.cpp: (WebCore::Document::write):
  • html/HTMLDocumentParser.cpp: (WebCore::HTMLDocumentParser::insert):
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r63163 r63165  
     12010-07-12  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        HTML5 Parser: document.write after onload blows away document
     6        https://bugs.webkit.org/show_bug.cgi?id=40745
     7
     8        Update test to expect new behavior.
     9
     10        * http/tests/misc/write-while-waiting.html:
     11
    1122010-07-12  Maciej Stachowiak  <mjs@apple.com>
    213
  • trunk/LayoutTests/http/tests/misc/write-while-waiting.html

    r61286 r63165  
    11<html>
    22<body>
    3 FAIL
     3PASS
    44<script>
    55if (window.layoutTestController)
    66    layoutTestController.dumpAsText();
    77
    8 setTimeout("document.write('PASS');document.close();", 100);
     8setTimeout("document.write('FAIL');document.close();", 100);
    99</script>
    1010<script src="resources/script-slow1.pl"></script>
  • trunk/WebCore/ChangeLog

    r63162 r63165  
     12010-07-12  Adam Barth  <abarth@webkit.org>
     2
     3        Reviewed by Eric Seidel.
     4
     5        HTML5 Parser: document.write after onload blows away document
     6        https://bugs.webkit.org/show_bug.cgi?id=40745
     7
     8        Rather than blowing away the document when we get a document.write call
     9        after the document is closed, we new ignore the write.  This
     10        technically violates the spec (which requires us to blow away the
     11        document), but blowing away the document breaks too many web sites.
     12
     13        Rather than this patch, we could go back to our old behavior (which was
     14        to append the bytes just before EOF), but implementing this approach
     15        (suggested by Henri) will let us gather data about whether his approach
     16        is workable.
     17
     18        See also: http://www.w3.org/Bugs/Public/show_bug.cgi?id=9767
     19
     20        * dom/Document.cpp:
     21        (WebCore::Document::write):
     22        * html/HTMLDocumentParser.cpp:
     23        (WebCore::HTMLDocumentParser::insert):
     24
    1252010-07-12  Tony Gentilcore  <tonyg@chromium.org>
    226
  • trunk/WebCore/dom/Document.cpp

    r62876 r63165  
    20172017#endif
    20182018
    2019     if (!m_parser || m_parser->finishWasCalled())
     2019    if (!m_parser)
    20202020        open(ownerDocument);
    20212021
  • trunk/WebCore/html/HTMLDocumentParser.cpp

    r63154 r63165  
    219219        return;
    220220
     221    if (m_scriptRunner && !m_scriptRunner->inScriptExecution() && m_input.haveSeenEndOfFile()) {
     222        // document.write was called without a current insertion point.
     223        // According to the spec, we're supposed to implicitly open the
     224        // document.  Unfortunately, that behavior isn't sufficiently compatible
     225        // with the web.  The working group is mulling over what exactly to
     226        // do.  In the meantime, we're going to try one of the potential
     227        // solutions, which is to ignore the write.
     228        // http://www.w3.org/Bugs/Public/show_bug.cgi?id=9767
     229        return;
     230    }
     231
    221232    {
    222233        NestingLevelIncrementer nestingLevelIncrementer(m_writeNestingLevel);
Note: See TracChangeset for help on using the changeset viewer.