Title: [117611] trunk
Revision
117611
Author
[email protected]
Date
2012-05-18 12:12:27 -0700 (Fri, 18 May 2012)

Log Message

Script elements inserted while fragment parsing should have their "already started" flag set.
https://bugs.webkit.org/show_bug.cgi?id=86376

Patch by Pablo Flouret <[email protected]> on 2012-05-18
Reviewed by Ryosuke Niwa.

Source/WebCore:

Step 3 of:
http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#scriptTag

Test: fast/parser/script-already-started-flag-in-fragment-parsing-mode.html

* html/HTMLScriptElement.cpp:
(WebCore::HTMLScriptElement::create):
* html/HTMLScriptElement.h:
(HTMLScriptElement):
* html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::insertScriptElement):

LayoutTests:

* fast/parser/script-already-started-flag-in-fragment-parsing-mode-expected.txt: Added.
* fast/parser/script-already-started-flag-in-fragment-parsing-mode.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (117610 => 117611)


--- trunk/LayoutTests/ChangeLog	2012-05-18 18:42:11 UTC (rev 117610)
+++ trunk/LayoutTests/ChangeLog	2012-05-18 19:12:27 UTC (rev 117611)
@@ -1,3 +1,13 @@
+2012-05-18  Pablo Flouret  <[email protected]>
+
+        Script elements inserted while fragment parsing should have their "already started" flag set.
+        https://bugs.webkit.org/show_bug.cgi?id=86376
+
+        Reviewed by Ryosuke Niwa.
+
+        * fast/parser/script-already-started-flag-in-fragment-parsing-mode-expected.txt: Added.
+        * fast/parser/script-already-started-flag-in-fragment-parsing-mode.html: Added.
+
 2012-05-18  Shezan Baig  <[email protected]>
 
         Expose FrameSelection::absoluteCaretBounds via window.internals

Added: trunk/LayoutTests/fast/parser/script-already-started-flag-in-fragment-parsing-mode-expected.txt (0 => 117611)


--- trunk/LayoutTests/fast/parser/script-already-started-flag-in-fragment-parsing-mode-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/parser/script-already-started-flag-in-fragment-parsing-mode-expected.txt	2012-05-18 19:12:27 UTC (rev 117611)
@@ -0,0 +1,5 @@
+Test that scripts inserted while parsing an html fragment have the "already started" flag set, and that it's copied over if the node is cloned.
+
+PASS
+
+

Added: trunk/LayoutTests/fast/parser/script-already-started-flag-in-fragment-parsing-mode.html (0 => 117611)


--- trunk/LayoutTests/fast/parser/script-already-started-flag-in-fragment-parsing-mode.html	                        (rev 0)
+++ trunk/LayoutTests/fast/parser/script-already-started-flag-in-fragment-parsing-mode.html	2012-05-18 19:12:27 UTC (rev 117611)
@@ -0,0 +1,20 @@
+<!DOCTYPE html>
+<html>
+<body>
+<p>
+    Test that scripts inserted while parsing an html fragment have the "already started" flag set,
+    and that it's copied over if the node is cloned.
+</p>
+
+<p id=result>
+    PASS
+<p>
+<div></div>
+<script>
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+    var d = document.querySelector("div")
+    d.innerHTML = "<script>document.querySelector('#result').textContent = 'FAIL'</" + "script>";
+    document.body.appendChild(d.querySelector("script").cloneNode(true));
+</script>
+</body>

Modified: trunk/Source/WebCore/ChangeLog (117610 => 117611)


--- trunk/Source/WebCore/ChangeLog	2012-05-18 18:42:11 UTC (rev 117610)
+++ trunk/Source/WebCore/ChangeLog	2012-05-18 19:12:27 UTC (rev 117611)
@@ -1,3 +1,22 @@
+2012-05-18  Pablo Flouret  <[email protected]>
+
+        Script elements inserted while fragment parsing should have their "already started" flag set.
+        https://bugs.webkit.org/show_bug.cgi?id=86376
+
+        Reviewed by Ryosuke Niwa.
+
+        Step 3 of:
+        http://www.whatwg.org/specs/web-apps/current-work/multipage/tree-construction.html#scriptTag
+
+        Test: fast/parser/script-already-started-flag-in-fragment-parsing-mode.html
+
+        * html/HTMLScriptElement.cpp:
+        (WebCore::HTMLScriptElement::create):
+        * html/HTMLScriptElement.h:
+        (HTMLScriptElement):
+        * html/parser/HTMLConstructionSite.cpp:
+        (WebCore::HTMLConstructionSite::insertScriptElement):
+
 2012-05-18  Shezan Baig  <[email protected]>
 
         Expose FrameSelection::absoluteCaretBounds via window.internals

Modified: trunk/Source/WebCore/html/HTMLScriptElement.cpp (117610 => 117611)


--- trunk/Source/WebCore/html/HTMLScriptElement.cpp	2012-05-18 18:42:11 UTC (rev 117610)
+++ trunk/Source/WebCore/html/HTMLScriptElement.cpp	2012-05-18 19:12:27 UTC (rev 117611)
@@ -42,9 +42,9 @@
     ASSERT(hasTagName(scriptTag));
 }
 
-PassRefPtr<HTMLScriptElement> HTMLScriptElement::create(const QualifiedName& tagName, Document* document, bool wasInsertedByParser)
+PassRefPtr<HTMLScriptElement> HTMLScriptElement::create(const QualifiedName& tagName, Document* document, bool wasInsertedByParser, bool alreadyStarted)
 {
-    return adoptRef(new HTMLScriptElement(tagName, document, wasInsertedByParser, false));
+    return adoptRef(new HTMLScriptElement(tagName, document, wasInsertedByParser, alreadyStarted));
 }
 
 bool HTMLScriptElement::isURLAttribute(const Attribute& attribute) const

Modified: trunk/Source/WebCore/html/HTMLScriptElement.h (117610 => 117611)


--- trunk/Source/WebCore/html/HTMLScriptElement.h	2012-05-18 18:42:11 UTC (rev 117610)
+++ trunk/Source/WebCore/html/HTMLScriptElement.h	2012-05-18 19:12:27 UTC (rev 117611)
@@ -31,7 +31,7 @@
 
 class HTMLScriptElement : public HTMLElement, public ScriptElement {
 public:
-    static PassRefPtr<HTMLScriptElement> create(const QualifiedName&, Document*, bool wasInsertedByParser);
+    static PassRefPtr<HTMLScriptElement> create(const QualifiedName&, Document*, bool wasInsertedByParser, bool alreadyStarted = false);
 
     String text() const { return scriptContent(); }
     void setText(const String&);

Modified: trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp (117610 => 117611)


--- trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp	2012-05-18 18:42:11 UTC (rev 117610)
+++ trunk/Source/WebCore/html/parser/HTMLConstructionSite.cpp	2012-05-18 19:12:27 UTC (rev 117611)
@@ -335,7 +335,7 @@
 
 void HTMLConstructionSite::insertScriptElement(AtomicHTMLToken& token)
 {
-    RefPtr<HTMLScriptElement> element = HTMLScriptElement::create(scriptTag, currentNode()->document(), true);
+    RefPtr<HTMLScriptElement> element = HTMLScriptElement::create(scriptTag, currentNode()->document(), true, m_isParsingFragment);
     if (m_fragmentScriptingPermission == FragmentScriptingAllowed)
         element->parserSetAttributes(token.attributes(), m_fragmentScriptingPermission);
     attachLater(currentNode(), element);
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to