[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

beidson at apple.com beidson at apple.com
Thu Apr 8 02:06:38 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 2118e9f3013fe94b7f02af40c1864a1c5b1a72fc
Author: beidson at apple.com <beidson at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Mar 2 18:33:56 2010 +0000

    REGRESSION(r51097) - Unable to log in to statefarm.com
    <rdar://problem/7672667> and https://bugs.webkit.org/show_bug.cgi?id=35556
    
    Reviewed by Sam Weinig.
    
    WebCore:
    
    Test: fast/loader/for-window-event-onload-scripts.html
    
    Match Gecko's rules for executing "for/event" scripts:
      -If there's only a 'for' attribute, execute it.
      -If there's only an 'event' attribute, execute it.
      -If there's a 'for=window' and 'event=onload', execute it.
      -If there's a 'for=window' and 'event=onload()', execute it.
      -If there's any other combination of both 'for' and 'event', don't execute it.
    
    * dom/ScriptElement.cpp:
    (WebCore::ScriptElementData::shouldExecuteAsJavaScript):
    * dom/ScriptElement.h:
    
    * html/HTMLScriptElement.cpp:
    (WebCore::HTMLScriptElement::eventAttributeValue):
    * html/HTMLScriptElement.h:
    
    * svg/SVGScriptElement.cpp:
    (WebCore::SVGScriptElement::eventAttributeValue):
    * svg/SVGScriptElement.h:
    
    Add the event attribute name:
    * html/HTMLAttributeNames.in:
    
    LayoutTests:
    
    * fast/loader/for-window-event-onload-scripts-expected.txt: Added.
    * fast/loader/for-window-event-onload-scripts.html: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@55414 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 288a6db..d406dcd 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2010-03-02  Brady Eidson  <beidson at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        REGRESSION(r51097) - Unable to log in to statefarm.com
+        <rdar://problem/7672667> and https://bugs.webkit.org/show_bug.cgi?id=35556
+
+        * fast/loader/for-window-event-onload-scripts-expected.txt: Added.
+        * fast/loader/for-window-event-onload-scripts.html: Added.
+
 2010-03-02  Chris Fleizach  <cfleizach at apple.com>
 
         Fixing layout test problems. No review.
diff --git a/LayoutTests/fast/loader/for-window-event-onload-scripts-expected.txt b/LayoutTests/fast/loader/for-window-event-onload-scripts-expected.txt
new file mode 100644
index 0000000..df5c47a
--- /dev/null
+++ b/LayoutTests/fast/loader/for-window-event-onload-scripts-expected.txt
@@ -0,0 +1,5 @@
+ALERT: This script SHOULD be run because it has both 'for=window' and 'event=onload'.
+ALERT: This script SHOULD be run because it has both 'for=window' and 'event=onload()'.
+ALERT: This script SHOULD be run because it only has a for attribute.
+ALERT: This script SHOULD be run because it only has an event attribute.
+
diff --git a/LayoutTests/fast/loader/for-window-event-onload-scripts.html b/LayoutTests/fast/loader/for-window-event-onload-scripts.html
new file mode 100644
index 0000000..cdb2e87
--- /dev/null
+++ b/LayoutTests/fast/loader/for-window-event-onload-scripts.html
@@ -0,0 +1,24 @@
+<script>
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+
+<script for="body" event="onload()">
+    alert("This script should NOT be run because 'for=body' and 'event=onload()' should not be run.");
+</script>
+
+<script for="window" event="onload">
+    alert("This script SHOULD be run because it has both 'for=window' and 'event=onload'.");
+</script>
+
+<script for="window" event="onload()">
+    alert("This script SHOULD be run because it has both 'for=window' and 'event=onload()'.");
+</script>
+
+<script for="FOO">
+    alert("This script SHOULD be run because it only has a for attribute.");
+</script>
+
+<script event="BAR">
+    alert("This script SHOULD be run because it only has an event attribute.");
+</script>
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 9261c4c..0528d87 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,35 @@
+2010-03-02  Brady Eidson  <beidson at apple.com>
+
+        Reviewed by Sam Weinig.
+
+        REGRESSION(r51097) - Unable to log in to statefarm.com
+        <rdar://problem/7672667> and https://bugs.webkit.org/show_bug.cgi?id=35556
+
+        Test: fast/loader/for-window-event-onload-scripts.html
+
+        Match Gecko's rules for executing "for/event" scripts:
+          -If there's only a 'for' attribute, execute it.
+          -If there's only an 'event' attribute, execute it.
+          -If there's a 'for=window' and 'event=onload', execute it.
+          -If there's a 'for=window' and 'event=onload()', execute it.
+          -If there's any other combination of both 'for' and 'event', don't execute it.
+
+        * dom/ScriptElement.cpp:
+        (WebCore::ScriptElementData::shouldExecuteAsJavaScript):
+        * dom/ScriptElement.h:
+
+        * html/HTMLScriptElement.cpp:
+        (WebCore::HTMLScriptElement::eventAttributeValue):
+        * html/HTMLScriptElement.h:
+
+        * svg/SVGScriptElement.cpp:
+        (WebCore::SVGScriptElement::eventAttributeValue):
+        * svg/SVGScriptElement.h:
+
+        Add the event attribute name:
+        * html/HTMLAttributeNames.in:
+
+
 2010-03-02  Simon Fraser  <simon.fraser at apple.com>
 
         Reviewed by Dan Bernstein.
diff --git a/WebCore/dom/ScriptElement.cpp b/WebCore/dom/ScriptElement.cpp
index 0a2efaa..2902a3f 100644
--- a/WebCore/dom/ScriptElement.cpp
+++ b/WebCore/dom/ScriptElement.cpp
@@ -246,7 +246,11 @@ bool ScriptElementData::shouldExecuteAsJavaScript() const
     // and we support the for syntax in script tags, this check can be removed and we should just
     // return 'true' here.
     String forAttribute = m_scriptElement->forAttributeValue();
-    return forAttribute.isEmpty();
+    String eventAttribute = m_scriptElement->eventAttributeValue();
+    if (forAttribute.isEmpty() || eventAttribute.isEmpty())
+        return true;
+    
+    return equalIgnoringCase(forAttribute, "window") && (equalIgnoringCase(eventAttribute, "onload") || equalIgnoringCase(eventAttribute, "onload()"));
 }
 
 String ScriptElementData::scriptCharset() const
diff --git a/WebCore/dom/ScriptElement.h b/WebCore/dom/ScriptElement.h
index 0aed5e8..fad6fe7 100644
--- a/WebCore/dom/ScriptElement.h
+++ b/WebCore/dom/ScriptElement.h
@@ -43,6 +43,7 @@ public:
     virtual String typeAttributeValue() const = 0;
     virtual String languageAttributeValue() const = 0;
     virtual String forAttributeValue() const = 0;
+    virtual String eventAttributeValue() const = 0;
 
     virtual void dispatchLoadEvent() = 0;
     virtual void dispatchErrorEvent() = 0;
diff --git a/WebCore/html/HTMLAttributeNames.in b/WebCore/html/HTMLAttributeNames.in
index ad13070..e85497d 100644
--- a/WebCore/html/HTMLAttributeNames.in
+++ b/WebCore/html/HTMLAttributeNames.in
@@ -88,6 +88,7 @@ disabled
 draggable
 enctype
 end
+event
 expanded
 face
 focused
diff --git a/WebCore/html/HTMLScriptElement.cpp b/WebCore/html/HTMLScriptElement.cpp
index 636c579..58c3b03 100644
--- a/WebCore/html/HTMLScriptElement.cpp
+++ b/WebCore/html/HTMLScriptElement.cpp
@@ -220,6 +220,11 @@ String HTMLScriptElement::forAttributeValue() const
     return getAttribute(forAttr).string();
 }
 
+String HTMLScriptElement::eventAttributeValue() const
+{
+    return getAttribute(eventAttr).string();
+}
+
 void HTMLScriptElement::dispatchLoadEvent()
 {
     ASSERT(!m_data.haveFiredLoadEvent());
diff --git a/WebCore/html/HTMLScriptElement.h b/WebCore/html/HTMLScriptElement.h
index 4d18beb..b6d683f 100644
--- a/WebCore/html/HTMLScriptElement.h
+++ b/WebCore/html/HTMLScriptElement.h
@@ -83,6 +83,7 @@ protected:
     virtual String typeAttributeValue() const;
     virtual String languageAttributeValue() const;
     virtual String forAttributeValue() const;
+    virtual String eventAttributeValue() const;
 
     virtual void dispatchLoadEvent();
     virtual void dispatchErrorEvent();
diff --git a/WebCore/svg/SVGScriptElement.cpp b/WebCore/svg/SVGScriptElement.cpp
index 299ab8d..a6d0f47 100644
--- a/WebCore/svg/SVGScriptElement.cpp
+++ b/WebCore/svg/SVGScriptElement.cpp
@@ -194,6 +194,11 @@ String SVGScriptElement::forAttributeValue() const
     return String();
 }
 
+String SVGScriptElement::eventAttributeValue() const
+{
+    return String();
+}
+
 void SVGScriptElement::dispatchLoadEvent()
 {
     bool externalResourcesRequired = externalResourcesRequiredBaseValue();
diff --git a/WebCore/svg/SVGScriptElement.h b/WebCore/svg/SVGScriptElement.h
index 396907c..623228c 100644
--- a/WebCore/svg/SVGScriptElement.h
+++ b/WebCore/svg/SVGScriptElement.h
@@ -66,6 +66,7 @@ namespace WebCore {
         virtual String typeAttributeValue() const;
         virtual String languageAttributeValue() const;
         virtual String forAttributeValue() const;
+        virtual String eventAttributeValue() const;
 
         virtual void dispatchLoadEvent();
         virtual void dispatchErrorEvent();

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list