[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

rniwa at webkit.org rniwa at webkit.org
Wed Dec 22 15:43:38 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 87d7a2a178f743bf1066f33be85bcdaeeedcdb37
Author: rniwa at webkit.org <rniwa at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 11 07:37:47 2010 +0000

    2010-11-10  Ryosuke Niwa  <rniwa at webkit.org>
    
            Reviewed by Adam Barth.
    
            [HTML5] 10.2.8.4 Scripts that modify the page as it is being parsed
            https://bugs.webkit.org/show_bug.cgi?id=49364
    
            Fixed HTMLScriptRunner's executeScript to use the ScriptController of the frame to which script element belongs
            as supposed to that of the frame associated with the HTMLScriptRunner.
    
            See also: http://www.whatwg.org/specs/web-apps/current-work/#scripts-that-modify-the-page-as-it-is-being-parsed
    
            Test: fast/parser/script-modify-page-outer.html
    
            * html/parser/HTMLScriptRunner.cpp:
            (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): Calls executeScript.
            (WebCore::HTMLScriptRunner::executeScript): Uses the correct ScriptController instance.
            (WebCore::HTMLScriptRunner::runScript): Call executeScript.
            * html/parser/HTMLScriptRunner.h:
    2010-11-10  Ryosuke Niwa  <rniwa at webkit.org>
    
            Reviewed by Adam Barth.
    
            [HTML5] 10.2.8.4 Scripts that modify the page as it is being parsed
            https://bugs.webkit.org/show_bug.cgi?id=49364
    
            Added a test to ensure moving the script element to the parent document as it is being parsed
            changes the script's global object to the parent document's window object.
    
            See also: http://www.whatwg.org/specs/web-apps/current-work/#scripts-that-modify-the-page-as-it-is-being-parsed
    
            * fast/parser/move-during-parsing-expected.txt:
            * fast/parser/resources/script-modify-page-inner.html: Added.
            * fast/parser/script-modify-page-outer-expected.txt: Added.
            * fast/parser/script-modify-page-outer.html: Added.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@71797 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index efc40aa..911d512 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2010-11-10  Ryosuke Niwa  <rniwa at webkit.org>
+
+        Reviewed by Adam Barth.
+
+        [HTML5] 10.2.8.4 Scripts that modify the page as it is being parsed
+        https://bugs.webkit.org/show_bug.cgi?id=49364
+
+        Added a test to ensure moving the script element to the parent document as it is being parsed
+        changes the script's global object to the parent document's window object.
+
+        See also: http://www.whatwg.org/specs/web-apps/current-work/#scripts-that-modify-the-page-as-it-is-being-parsed
+
+        * fast/parser/move-during-parsing-expected.txt:
+        * fast/parser/resources/script-modify-page-inner.html: Added.
+        * fast/parser/script-modify-page-outer-expected.txt: Added.
+        * fast/parser/script-modify-page-outer.html: Added.
+
 2010-11-10  Fumitoshi Ukai  <ukai at chromium.org>
 
         Unreviewed, updating Chromium expectations.
diff --git a/LayoutTests/fast/parser/move-during-parsing-expected.txt b/LayoutTests/fast/parser/move-during-parsing-expected.txt
index a7d97d3..4861609 100644
--- a/LayoutTests/fast/parser/move-during-parsing-expected.txt
+++ b/LayoutTests/fast/parser/move-during-parsing-expected.txt
@@ -1,4 +1,4 @@
-ALERT: parser/resources/move-during-parsing-iframe.html
+ALERT: parser/move-during-parsing.html
 
 This text should not show inside the iframe. It should show inside the parent. Furthermore, there should be text saying "Middle of Page" and then "End of Page" below (also in the parent).
 
diff --git a/LayoutTests/fast/parser/resources/script-modify-page-inner.html b/LayoutTests/fast/parser/resources/script-modify-page-inner.html
new file mode 100644
index 0000000..991e2e6
--- /dev/null
+++ b/LayoutTests/fast/parser/resources/script-modify-page-inner.html
@@ -0,0 +1,19 @@
+<!DOCTYPE html>
+<html>
+<body>
+<div>
+<script>
+if (parent.document.adoptNode)
+  parent.document.body.appendChild(parent.document.adoptNode(document.getElementsByTagName("div")[0]));
+else
+  parent.document.body.appendChild(document.getElementsByTagName("div")[0]);
+</script>
+<script>
+alert('should be outer: ' + document.URL.match(/parser.*/));
+</script>
+</div>
+<script>
+alert('should be inner: ' + document.URL.match(/parser.*/));
+</script>
+</body>
+</html>
diff --git a/LayoutTests/fast/parser/script-modify-page-outer-expected.txt b/LayoutTests/fast/parser/script-modify-page-outer-expected.txt
new file mode 100644
index 0000000..79eb31c
--- /dev/null
+++ b/LayoutTests/fast/parser/script-modify-page-outer-expected.txt
@@ -0,0 +1,4 @@
+ALERT: should be outer: parser/script-modify-page-outer.html
+ALERT: should be inner: parser/resources/script-modify-page-inner.html
+
+DONE
diff --git a/LayoutTests/fast/parser/script-modify-page-outer.html b/LayoutTests/fast/parser/script-modify-page-outer.html
new file mode 100644
index 0000000..d85adee
--- /dev/null
+++ b/LayoutTests/fast/parser/script-modify-page-outer.html
@@ -0,0 +1,12 @@
+<!DOCTYPE html>
+<html>
+<script>
+
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+
+</script>
+<body onload="document.body.appendChild(document.createTextNode('DONE'));">
+<iframe src="resources/script-modify-page-inner.html"></iframe>
+</body>
+</html>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index d5fa5bf..7b27aae 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,23 @@
+2010-11-10  Ryosuke Niwa  <rniwa at webkit.org>
+
+        Reviewed by Adam Barth.
+
+        [HTML5] 10.2.8.4 Scripts that modify the page as it is being parsed
+        https://bugs.webkit.org/show_bug.cgi?id=49364
+
+        Fixed HTMLScriptRunner's executeScript to use the ScriptController of the frame to which script element belongs
+        as supposed to that of the frame associated with the HTMLScriptRunner.
+
+        See also: http://www.whatwg.org/specs/web-apps/current-work/#scripts-that-modify-the-page-as-it-is-being-parsed
+
+        Test: fast/parser/script-modify-page-outer.html
+
+        * html/parser/HTMLScriptRunner.cpp:
+        (WebCore::HTMLScriptRunner::executePendingScriptAndDispatchEvent): Calls executeScript.
+        (WebCore::HTMLScriptRunner::executeScript): Uses the correct ScriptController instance.
+        (WebCore::HTMLScriptRunner::runScript): Call executeScript.
+        * html/parser/HTMLScriptRunner.h:
+
 2010-11-10  Dan Bernstein  <mitz at apple.com>
 
         Style fix I said I’d make then forgot to make.
diff --git a/WebCore/html/parser/HTMLScriptRunner.cpp b/WebCore/html/parser/HTMLScriptRunner.cpp
index 61f673a..d8a96c1 100644
--- a/WebCore/html/parser/HTMLScriptRunner.cpp
+++ b/WebCore/html/parser/HTMLScriptRunner.cpp
@@ -140,20 +140,22 @@ void HTMLScriptRunner::executePendingScriptAndDispatchEvent(PendingScript& pendi
         if (errorOccurred)
             scriptElement->dispatchEvent(createScriptErrorEvent());
         else {
-            executeScript(sourceCode);
+            executeScript(scriptElement.get(), sourceCode);
             scriptElement->dispatchEvent(createScriptLoadEvent());
         }
     }
     ASSERT(!m_scriptNestingLevel);
 }
 
-void HTMLScriptRunner::executeScript(const ScriptSourceCode& sourceCode) const
+void HTMLScriptRunner::executeScript(Element* element, const ScriptSourceCode& sourceCode) const
 {
-    ASSERT(m_document);
+    ASSERT(element);
+    ASSERT(element->document());
     ASSERT(isExecutingScript());
-    if (!m_document->frame())
+    Frame* frame = element->document()->frame();
+    if (!frame)
         return;
-    m_document->frame()->script()->executeScript(sourceCode);
+    frame->script()->executeScript(sourceCode);
 }
 
 void HTMLScriptRunner::watchForLoad(PendingScript& pendingScript)
@@ -318,7 +320,7 @@ void HTMLScriptRunner::runScript(Element* script, const TextPosition1& scriptSta
             // ASSERT(document()->haveStylesheetsLoaded());
             ASSERT(isExecutingScript());
             ScriptSourceCode sourceCode(script->textContent(), documentURLForScriptExecution(m_document), scriptStartPosition);
-            executeScript(sourceCode);
+            executeScript(script, sourceCode);
         }
     }
 }
diff --git a/WebCore/html/parser/HTMLScriptRunner.h b/WebCore/html/parser/HTMLScriptRunner.h
index 2df295f..df41828 100644
--- a/WebCore/html/parser/HTMLScriptRunner.h
+++ b/WebCore/html/parser/HTMLScriptRunner.h
@@ -69,7 +69,7 @@ private:
 
     void executeParsingBlockingScript();
     void executePendingScriptAndDispatchEvent(PendingScript&);
-    void executeScript(const ScriptSourceCode&) const;
+    void executeScript(Element*, const ScriptSourceCode&) const;
     bool haveParsingBlockingScript() const;
     bool executeParsingBlockingScripts();
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list