WebCore:
authorddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 2 Jul 2006 11:39:43 +0000 (11:39 +0000)
committerddkilzer <ddkilzer@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 2 Jul 2006 11:39:43 +0000 (11:39 +0000)
        Reviewed by Darin.  Patch by Mitz.

        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9674
          REGRESSION (r15075): Blank or incomplete pages on digg.com

        Replaced the requestingScript state bit added in the fix for bug 9317
        with a m_requestingScript bool that is set before and restored
        after calling ref() on a CachedScript.

        Test: fast/tokenizer/nested-cached-scripts.html

        * html/HTMLTokenizer.cpp:
        (WebCore::HTMLTokenizer::HTMLTokenizer):
        (WebCore::HTMLTokenizer::begin):
        (WebCore::HTMLTokenizer::scriptHandler):
        (WebCore::HTMLTokenizer::notifyFinished):
        * html/HTMLTokenizer.h:
        (WebCore::HTMLTokenizer::State::):

LayoutTests:

        Reviewed by Darin.  Patch by Mitz.

        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9674
          REGRESSION (r15075): Blank or incomplete pages on digg.com

        * fast/tokenizer/nested-cached-scripts-expected.txt: Added.
        * fast/tokenizer/nested-cached-scripts.html: Added.
        * fast/tokenizer/resources/nested-1.js: Added.
        * fast/tokenizer/resources/nested-2.js: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/tokenizer/nested-cached-scripts-expected.txt [new file with mode: 0644]
LayoutTests/fast/tokenizer/nested-cached-scripts.html [new file with mode: 0644]
LayoutTests/fast/tokenizer/resources/nested-1.js [new file with mode: 0644]
LayoutTests/fast/tokenizer/resources/nested-2.js [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLTokenizer.cpp
WebCore/html/HTMLTokenizer.h

index c255946bc3570720fdb00faa87c531312075bcc8..c06241ee263b98a81bbcdcdbbf97fb6bef01d715 100644 (file)
@@ -1,3 +1,15 @@
+2006-07-02  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Darin.
+
+        - test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9674
+          REGRESSION (r15075): Blank or incomplete pages on digg.com
+
+        * fast/tokenizer/nested-cached-scripts-expected.txt: Added.
+        * fast/tokenizer/nested-cached-scripts.html: Added.
+        * fast/tokenizer/resources/nested-1.js: Added.
+        * fast/tokenizer/resources/nested-2.js: Added.
+
 2006-06-30  Mitz Pettel  <opendarwin.org@mitzpettel.com>
 
         Reviewed by Hyatt.
diff --git a/LayoutTests/fast/tokenizer/nested-cached-scripts-expected.txt b/LayoutTests/fast/tokenizer/nested-cached-scripts-expected.txt
new file mode 100644 (file)
index 0000000..620e098
--- /dev/null
@@ -0,0 +1,5 @@
+This is a regression test for http://bugzilla.opendarwin.org/show_bug.cgi?id=9674 REGRESSION (r15075): Blank or incomplete pages on digg.com.
+
+It should say “PASS” under the line.
+
+PASS
diff --git a/LayoutTests/fast/tokenizer/nested-cached-scripts.html b/LayoutTests/fast/tokenizer/nested-cached-scripts.html
new file mode 100644 (file)
index 0000000..640afa9
--- /dev/null
@@ -0,0 +1,30 @@
+<html>
+<head>
+    <title></title>
+    <script type="text/javascript">
+        if (window.layoutTestController)
+            layoutTestController.dumpAsText();
+        var caching = true;
+    </script>
+    <!-- cache the scripts -->
+    <script type="text/javascript" src="resources/nested-1.js"></script>
+    <script type="text/javascript" src="resources/nested-2.js"></script>
+    <script type="text/javascript">
+        caching = false;
+    </script>
+</head>
+<body>
+    <p>
+        This is a regression test for
+        <i><a href="http://bugzilla.opendarwin.org/show_bug.cgi?id=9674">http://bugzilla.opendarwin.org/show_bug.cgi?id=9674</a>
+        REGRESSION (r15075): Blank or incomplete pages on digg.com</i>.
+    </p>
+    <p>
+        It should say &ldquo;PASS&rdquo; under the line.
+    </p>
+    <hr>
+    <script type="text/javascript" src="resources/nested-1.js"></script>
+    <script type="text/javascript" src="resources/nested-1.js"></script>
+    PASS
+</body>
+</html>
diff --git a/LayoutTests/fast/tokenizer/resources/nested-1.js b/LayoutTests/fast/tokenizer/resources/nested-1.js
new file mode 100644 (file)
index 0000000..f34efb0
--- /dev/null
@@ -0,0 +1,3 @@
+if (!caching) {
+    document.write('<script type="text/javascript" src="resources/nested-2.js"></script>');
+}
diff --git a/LayoutTests/fast/tokenizer/resources/nested-2.js b/LayoutTests/fast/tokenizer/resources/nested-2.js
new file mode 100644 (file)
index 0000000..8b13789
--- /dev/null
@@ -0,0 +1 @@
+
index bd9a3d51e10e7a704ca452b50c6cb17f975c3fc1..99221f4023963bcdd5a591aa396a2c33eaddf61b 100644 (file)
@@ -1,3 +1,24 @@
+2006-07-02  Mitz Pettel  <opendarwin.org@mitzpettel.com>
+
+        Reviewed by Darin.
+
+        - fix http://bugzilla.opendarwin.org/show_bug.cgi?id=9674
+          REGRESSION (r15075): Blank or incomplete pages on digg.com
+
+        Replaced the requestingScript state bit added in the fix for bug 9317
+        with a m_requestingScript bool that is set before and restored
+        after calling ref() on a CachedScript.
+        
+        Test: fast/tokenizer/nested-cached-scripts.html
+
+        * html/HTMLTokenizer.cpp:
+        (WebCore::HTMLTokenizer::HTMLTokenizer):
+        (WebCore::HTMLTokenizer::begin):
+        (WebCore::HTMLTokenizer::scriptHandler):
+        (WebCore::HTMLTokenizer::notifyFinished):
+        * html/HTMLTokenizer.h:
+        (WebCore::HTMLTokenizer::State::):
+
 2006-07-01  David Kilzer  <ddkilzer@kilzer.net>
 
         Reviewed by NOBODY (build fix).
index 093b9c909ab711459581325824501f21d3b78807..4ee5220611021aa06b273578dc1566c2093d9d35 100644 (file)
@@ -128,6 +128,7 @@ HTMLTokenizer::HTMLTokenizer(HTMLDocument* doc)
     , scriptCodeMaxSize(0)
     , scriptCodeResync(0)
     , m_executingScript(0)
+    , m_requestingScript(false)
     , m_timer(this, &HTMLTokenizer::timerFired)
     , m_doc(doc)
     , parser(new HTMLParser(doc))
@@ -145,6 +146,7 @@ HTMLTokenizer::HTMLTokenizer(HTMLViewSourceDocument* doc)
     , scriptCodeMaxSize(0)
     , scriptCodeResync(0)
     , m_executingScript(0)
+    , m_requestingScript(false)
     , m_timer(this, &HTMLTokenizer::timerFired)
     , m_doc(doc)
     , parser(0)
@@ -161,6 +163,7 @@ HTMLTokenizer::HTMLTokenizer(DocumentFragment* frag)
     , scriptCodeMaxSize(0)
     , scriptCodeResync(0)
     , m_executingScript(0)
+    , m_requestingScript(false)
     , m_timer(this, &HTMLTokenizer::timerFired)
     , m_doc(frag->document())
     , inWrite(false)
@@ -198,6 +201,7 @@ void HTMLTokenizer::reset()
 void HTMLTokenizer::begin()
 {
     m_executingScript = 0;
+    m_requestingScript = false;
     m_state.setLoadingExtScript(false);
     reset();
     size = 254;
@@ -411,11 +415,12 @@ HTMLTokenizer::State HTMLTokenizer::scriptHandler(State state)
 
             // the ref() call below may call notifyFinished if the script is already in cache,
             // and that mucks with the state directly, so we must write it back to the object.
-            state.setRequestingScript(true);
             m_state = state;
+            bool savedRequestingScript = m_requestingScript;
+            m_requestingScript = true;
             cs->ref(this);
+            m_requestingScript = savedRequestingScript;
             state = m_state;
-            state.setRequestingScript(false);
             // will be 0 if script was already loaded and ref() executed it
             if (!pendingScripts.isEmpty())
                 state.setLoadingExtScript(true);
@@ -1707,10 +1712,10 @@ void HTMLTokenizer::notifyFinished(CachedObject*)
 #endif
         }
 
-        // 'requestingScript' is true when we are called synchronously from
+        // 'm_requestingScript' is true when we are called synchronously from
         // scriptHandler(). In that case scriptHandler() will take care
         // of pendingSrc.
-        if (!m_state.requestingScript()) {
+        if (!m_requestingScript) {
             SegmentedString rest = pendingSrc;
             pendingSrc.clear();
             write(rest, false);
index c653b63eefee77210d7b1374c21ad180b8d9f89d..11f35c8d7d6713691b5414f1066d645112a79288 100644 (file)
@@ -221,8 +221,6 @@ private:
         void setLoadingExtScript(bool v) { setBit(LoadingExtScript, v); }
         bool forceSynchronous() const { return testBit(ForceSynchronous); }
         void setForceSynchronous(bool v) { setBit(ForceSynchronous, v); }
-        bool requestingScript() const { return testBit(RequestingScript); }
-        void setRequestingScript(bool v) { setBit(RequestingScript, v); }
 
         bool inAnySpecial() const { return m_bits & (InScript | InStyle | InXmp | InTextArea | InTitle); }
         bool hasTagState() const { return m_bits & TagMask; }
@@ -252,7 +250,6 @@ private:
             AllowYield = 1 << 21,
             LoadingExtScript = 1 << 22,
             ForceSynchronous = 1 << 23,
-            RequestingScript = 1 << 24,
         };
     
         void setBit(StateBits bit, bool value) 
@@ -313,6 +310,8 @@ private:
     DeprecatedPtrQueue<CachedScript> pendingScripts;
     RefPtr<Node> scriptNode;
 
+    bool m_requestingScript;
+
     // if we found one broken comment, there are most likely others as well
     // store a flag to get rid of the O(n^2) behaviour in such a case.
     bool brokenComments;