2008-05-07 Stephanie Lewis <slewis@apple.com>
authorslewis@apple.com <slewis@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 May 2008 01:05:19 +0000 (01:05 +0000)
committerslewis@apple.com <slewis@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 May 2008 01:05:19 +0000 (01:05 +0000)
        Reviewed by Maciej.

        remove non-functioning code.  If onunload should be fired from these nodes then
        a WindowEventListener needs to be set.  However, Firefox and IE also do not
        fire onunload events for these cases.

        Test: fast/events/onunload-not-on-body.html

        * html/HTMLFrameElementBase.cpp:
        (WebCore::HTMLFrameElementBase::parseMappedAttribute):
        * html/HTMLObjectElement.cpp
        (WebCore::HTMLObjectElement::parseMappedAttribute):

        Test onunload attr on a frame does not call onunload, but that an onunload attr on the body of
        a frame does.  Also test that onunloads on object elements are not called.

        * fast/events/onunload-not-on-body-expected.txt: Added.
        * fast/events/onunload-not-on-body.html: Added.

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

LayoutTests/ChangeLog
LayoutTests/fast/events/onunload-not-on-body-expected.txt [new file with mode: 0644]
LayoutTests/fast/events/onunload-not-on-body.html [new file with mode: 0644]
WebCore/ChangeLog
WebCore/html/HTMLFrameElementBase.cpp
WebCore/html/HTMLObjectElement.cpp

index e9cb4bc..c77827d 100644 (file)
@@ -1,3 +1,13 @@
+2008-05-07  Stephanie Lewis  <slewis@apple.com>
+
+        Reviewed by Maciej.
+
+        Test onunload attr on a frame does not call onunload, but that an onunload attr on the body of
+        a frame does.  Also test that onunloads on object elements are not called.
+
+        * fast/events/onunload-not-on-body-expected.txt: Added.
+        * fast/events/onunload-not-on-body.html: Added.
+
 2008-05-07  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by John Sullivan.
diff --git a/LayoutTests/fast/events/onunload-not-on-body-expected.txt b/LayoutTests/fast/events/onunload-not-on-body-expected.txt
new file mode 100644 (file)
index 0000000..27f1993
--- /dev/null
@@ -0,0 +1,4 @@
+ALERT: unload
+you should only see one unload alert appear.
+ALERT: unload
+you should only see one unload alert appear.
diff --git a/LayoutTests/fast/events/onunload-not-on-body.html b/LayoutTests/fast/events/onunload-not-on-body.html
new file mode 100644 (file)
index 0000000..397d80f
--- /dev/null
@@ -0,0 +1,25 @@
+<html>
+<head>
+<script>
+if (window.layoutTestController) {
+    layoutTestController.dumpAsText();
+    layoutTestController.waitUntilDone();
+}
+
+function load()
+{
+    location = "data:text/html,you should only see one unload alert appear.<script>if (window.layoutTestController) layoutTestController.notifyDone(); </" + "script>";
+}
+
+function unload()
+{
+    alert("unload");
+}
+</script>
+</head>
+<frameset onload="load()">
+     <frame src="data:text/html,<p>loaded frame 0</p>" onunload="unload()" ></frame>
+     <frame src="data:text/html,<script>function unload(){ alert('unload'); }</script><body><p>loaded frame 1</p><object data='resources/greenbox.png' onunload='unload()'></object></body>" ></frame>
+     <frame src="data:text/html,<script>function unload(){ alert('unload'); }</script><body onunload='unload()'><p>loaded frame 2</p></body>" ></frame>
+</frameset>
+</html>
index 25725a7..dc7ec04 100644 (file)
@@ -1,3 +1,18 @@
+2008-05-07  Stephanie Lewis <slewis@apple.com>
+
+        Reviewed by Maciej.
+
+        remove non-functioning code.  If onunload should be fired from these nodes then
+        a WindowEventListener needs to be set.  However, Firefox and IE also do not
+        fire onunload events for these cases.
+
+        Test: fast/events/onunload-not-on-body.html 
+        
+        * html/HTMLFrameElementBase.cpp:
+        (WebCore::HTMLFrameElementBase::parseMappedAttribute):
+        * html/HTMLObjectElement.cpp
+        (WebCore::HTMLObjectElement::parseMappedAttribute):
+
 2008-05-07  Dan Bernstein  <mitz@apple.com>
 
         Reviewed by John Sullivan.
index 639a178..051492c 100644 (file)
@@ -145,8 +145,6 @@ void HTMLFrameElementBase::parseMappedAttribute(MappedAttribute *attr)
     } else if (attr->name() == onbeforeunloadAttr) {
         // FIXME: should <frame> elements have beforeunload handlers?
         setHTMLEventListener(beforeunloadEvent, attr);
-    } else if (attr->name() == onunloadAttr) {
-        setHTMLEventListener(unloadEvent, attr);
     } else
         HTMLFrameOwnerElement::parseMappedAttribute(attr);
 }
index 7a5b84f..70a7520 100644 (file)
@@ -117,8 +117,6 @@ void HTMLObjectElement::parseMappedAttribute(MappedAttribute *attr)
           m_needWidgetUpdate = true;
     } else if (attr->name() == onloadAttr) {
         setHTMLEventListener(loadEvent, attr);
-    } else if (attr->name() == onunloadAttr) {
-        setHTMLEventListener(unloadEvent, attr);
     } else if (attr->name() == nameAttr) {
         const AtomicString& newName = attr->value();
         if (isDocNamedItem() && inDocument() && document()->isHTMLDocument()) {