2004-10-19 Darin Adler <darin@apple.com>
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Oct 2004 19:01:15 +0000 (19:01 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 19 Oct 2004 19:01:15 +0000 (19:01 +0000)
        Reviewed by Maciej.

        - follow-on to my fix yesterday, which broke a layout test because I rolled out a fix that Maciej had done

        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::write): Need to check the actual queue of external
        scripts being loaded here. If the current code being run is the external script itself, then we don't want
        to defer parsing. But loadingExtScript has to stay true until after the script runs. The old code would
        assume that any time we're running a script there's no need to look at loadingExtScript, but that was also
        wrong since there can be a script loading in that case too. Layout tests check for both problems.

        * layout-tests/fast/tokenizer/external-script-document-write-expected.txt: Added.
        * layout-tests/fast/tokenizer/external-script-document-write.html: Added.
        * layout-tests/fast/tokenizer/resources/external-script-document-write.js: Added.

        * layout-tests/fast/tokenizer/004.html: Fixed line endings (were CR, should be LF).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@7857 268f45cc-cd09-0410-ab3c-d52691b4dbfc

LayoutTests/fast/tokenizer/external-script-document-write-expected.txt [new file with mode: 0644]
LayoutTests/fast/tokenizer/external-script-document-write.html [new file with mode: 0644]
LayoutTests/fast/tokenizer/resources/external-script-document-write.js [new file with mode: 0644]
WebCore/ChangeLog-2005-08-23
WebCore/khtml/html/htmltokenizer.cpp

diff --git a/LayoutTests/fast/tokenizer/external-script-document-write-expected.txt b/LayoutTests/fast/tokenizer/external-script-document-write-expected.txt
new file mode 100644 (file)
index 0000000..6c3070c
--- /dev/null
@@ -0,0 +1,8 @@
+layer at (0,0) size 800x600
+  RenderCanvas at (0,0) size 800x600
+layer at (0,0) size 800x34
+  RenderBlock {HTML} at (0,0) size 800x34
+    RenderBody {BODY} at (8,8) size 784x18
+      RenderInline {SPAN} at (0,0) size 0x0
+      RenderText {TEXT} at (0,0) size 226x18
+        text run at (0,0) width 226: "This should be a span: [object span]"
diff --git a/LayoutTests/fast/tokenizer/external-script-document-write.html b/LayoutTests/fast/tokenizer/external-script-document-write.html
new file mode 100644 (file)
index 0000000..42fbe90
--- /dev/null
@@ -0,0 +1 @@
+<script src="resources/external-script-document-write.js" type="text/javascript"></script>
diff --git a/LayoutTests/fast/tokenizer/resources/external-script-document-write.js b/LayoutTests/fast/tokenizer/resources/external-script-document-write.js
new file mode 100644 (file)
index 0000000..9ed8c16
--- /dev/null
@@ -0,0 +1,2 @@
+document.write('<span id="x"></span>');
+document.write("This should be a span: " + document.getElementById('x'));
index 2e15962ca484c2a32b6956bcd82603e53c7c0621..3d6df53811997234fa6b980089480699cf0fb958 100644 (file)
@@ -1,3 +1,21 @@
+ 2004-10-19  Darin Adler  <darin@apple.com>
+
+        Reviewed by Maciej.
+
+        - follow-on to my fix yesterday, which broke a layout test because I rolled out a fix that Maciej had done
+
+        * khtml/html/htmltokenizer.cpp: (khtml::HTMLTokenizer::write): Need to check the actual queue of external
+        scripts being loaded here. If the current code being run is the external script itself, then we don't want
+        to defer parsing. But loadingExtScript has to stay true until after the script runs. The old code would
+        assume that any time we're running a script there's no need to look at loadingExtScript, but that was also
+        wrong since there can be a script loading in that case too. Layout tests check for both problems.
+
+        * layout-tests/fast/tokenizer/external-script-document-write-expected.txt: Added.
+        * layout-tests/fast/tokenizer/external-script-document-write.html: Added.
+        * layout-tests/fast/tokenizer/resources/external-script-document-write.js: Added.
+
+        * layout-tests/fast/tokenizer/004.html: Fixed line endings (were CR, should be LF).
+
 2004-10-18  Darin Adler  <darin@apple.com>
 
         Reviewed by Dave Hyatt.
index 8c39399b0648e4b237a5deae439a27024489abd6..ec0205c17c8ea03d6da756243fc0ff53071ba17a 100644 (file)
@@ -1500,7 +1500,7 @@ void HTMLTokenizer::write(const TokenizerString &str, bool appendData)
     if ( !buffer )
         return;
 
-    if ( ( m_executingScript && appendData ) || ( !m_executingScript && loadingExtScript ) ) {
+    if ( ( m_executingScript && appendData ) || !cachedScript.isEmpty() ) {
         // don't parse; we will do this later
        if (currentPrependingSrc) {
            currentPrependingSrc->append(str);