Title: [88187] trunk
Revision
88187
Author
[email protected]
Date
2011-06-06 14:15:45 -0700 (Mon, 06 Jun 2011)

Log Message

2011-06-06  Paul Kinlan  <[email protected]>

        Reviewed by Jeremy Orlow.

        Adds a test for firing popstate, using window.dispatchEvent.
        https://bugs.webkit.org/show_bug.cgi?id=62099

        * fast/events/fire-popstate-event-expected.txt: Added.
        * fast/events/fire-popstate-event.html: Added.
2011-06-06  Paul Kinlan  <[email protected]>

        Reviewed by Jeremy Orlow.

        Let developers call createEvent("PopStateEvent"), previously it wasn't
        exposed and threw an exeception.
        https://bugs.webkit.org/show_bug.cgi?id=62099

        * WebCore/dom/Document.cpp:
        * WebCore/dom/PopStateEvent.cpp:
        * WebCore/dom/PopStateEvent.h:

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (88186 => 88187)


--- trunk/LayoutTests/ChangeLog	2011-06-06 20:42:09 UTC (rev 88186)
+++ trunk/LayoutTests/ChangeLog	2011-06-06 21:15:45 UTC (rev 88187)
@@ -1,3 +1,13 @@
+2011-06-06  Paul Kinlan  <[email protected]>
+
+        Reviewed by Jeremy Orlow.
+
+        Adds a test for firing popstate, using window.dispatchEvent.
+        https://bugs.webkit.org/show_bug.cgi?id=62099
+
+        * fast/events/fire-popstate-event-expected.txt: Added.
+        * fast/events/fire-popstate-event.html: Added.
+
 2011-06-06  Jessie Berlin  <[email protected]>
 
         Update the Windows-specific results after r88020 in order to get the bots green.

Added: trunk/LayoutTests/fast/events/fire-popstate-event-expected.txt (0 => 88187)


--- trunk/LayoutTests/fast/events/fire-popstate-event-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/fast/events/fire-popstate-event-expected.txt	2011-06-06 21:15:45 UTC (rev 88187)
@@ -0,0 +1,10 @@
+Checks that the popstate event fires when dispatched via createEvent
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS Popstate state: (Success)
+PASS successfullyParsed is true
+
+TEST COMPLETE
+

Added: trunk/LayoutTests/fast/events/fire-popstate-event.html (0 => 88187)


--- trunk/LayoutTests/fast/events/fire-popstate-event.html	                        (rev 0)
+++ trunk/LayoutTests/fast/events/fire-popstate-event.html	2011-06-06 21:15:45 UTC (rev 88187)
@@ -0,0 +1,33 @@
+
+<html>
+<link rel="stylesheet" href=""
+<script src=""
+<body style="min-width: 5000px; min-height: 5000px">
+<p id="description"></p>
+<div id="console"></div>
+<script>
+description('Checks that the popstate event fires when dispatched via createEvent');
+
+_onpopstate_ = function(event)
+{
+    if(!!event.state && !!event.state.testValue) 
+    {
+        testPassed('Popstate state: (' + event.state.testValue +')');
+    }
+}
+
+_onload_ = function()
+{
+    var evt = document.createEvent("PopStateEvent");
+    evt.initPopStateEvent("popstate", false, false, { testValue: "Success"} );
+    window.dispatchEvent(evt);
+}
+
+setTimeout(finishJSTest, 500);
+
+var successfullyParsed = true;
+var jsTestIsAsync = true;
+</script>
+<script src=""
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (88186 => 88187)


--- trunk/Source/WebCore/ChangeLog	2011-06-06 20:42:09 UTC (rev 88186)
+++ trunk/Source/WebCore/ChangeLog	2011-06-06 21:15:45 UTC (rev 88187)
@@ -1,3 +1,15 @@
+2011-06-06  Paul Kinlan  <[email protected]>
+
+        Reviewed by Jeremy Orlow.
+
+        Let developers call createEvent("PopStateEvent"), previously it wasn't
+        exposed and threw an exeception. 
+        https://bugs.webkit.org/show_bug.cgi?id=62099
+
+        * WebCore/dom/Document.cpp:
+        * WebCore/dom/PopStateEvent.cpp:
+        * WebCore/dom/PopStateEvent.h:
+
 2011-06-03  Levi Weintraub  <[email protected]>
 
         Reviewed by Eric Seidel.

Modified: trunk/Source/WebCore/dom/Document.cpp (88186 => 88187)


--- trunk/Source/WebCore/dom/Document.cpp	2011-06-06 20:42:09 UTC (rev 88186)
+++ trunk/Source/WebCore/dom/Document.cpp	2011-06-06 21:15:45 UTC (rev 88187)
@@ -3465,6 +3465,8 @@
         event = OverflowEvent::create();
     else if (eventType == "PageTransitionEvent")
         event = PageTransitionEvent::create();
+    else if (eventType == "PopStateEvent")
+        event = PopStateEvent::create(); 
     else if (eventType == "ProgressEvent")
         event = ProgressEvent::create();
 #if ENABLE(DOM_STORAGE)

Modified: trunk/Source/WebCore/dom/PopStateEvent.cpp (88186 => 88187)


--- trunk/Source/WebCore/dom/PopStateEvent.cpp	2011-06-06 20:42:09 UTC (rev 88186)
+++ trunk/Source/WebCore/dom/PopStateEvent.cpp	2011-06-06 21:15:45 UTC (rev 88187)
@@ -31,6 +31,11 @@
 
 namespace WebCore {
 
+PopStateEvent::PopStateEvent()
+    : Event(eventNames().popstateEvent, false, true)
+{
+}
+
 PopStateEvent::PopStateEvent(PassRefPtr<SerializedScriptValue> stateObject)
     : Event(eventNames().popstateEvent, false, true)
     , m_stateObject(stateObject)
@@ -41,6 +46,16 @@
 {
 }
 
+PassRefPtr<PopStateEvent> PopStateEvent::create()
+{
+    return adoptRef(new PopStateEvent);
+}
+
+PassRefPtr<PopStateEvent> PopStateEvent::create(PassRefPtr<SerializedScriptValue> stateObject)
+{
+    return adoptRef(new PopStateEvent(stateObject));
+}
+
 void PopStateEvent::initPopStateEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue> stateObject)
 {
     if (dispatched())

Modified: trunk/Source/WebCore/dom/PopStateEvent.h (88186 => 88187)


--- trunk/Source/WebCore/dom/PopStateEvent.h	2011-06-06 20:42:09 UTC (rev 88186)
+++ trunk/Source/WebCore/dom/PopStateEvent.h	2011-06-06 21:15:45 UTC (rev 88187)
@@ -37,20 +37,16 @@
 class PopStateEvent : public Event {
 public:
     virtual ~PopStateEvent();
-
-    static PassRefPtr<PopStateEvent> create(PassRefPtr<SerializedScriptValue> stateObject)
-    {
-        return adoptRef(new PopStateEvent(stateObject));
-    }
-
+    static PassRefPtr<PopStateEvent> create();
+    static PassRefPtr<PopStateEvent> create(PassRefPtr<SerializedScriptValue>);
     void initPopStateEvent(const AtomicString& type, bool canBubble, bool cancelable, PassRefPtr<SerializedScriptValue>);
     bool isPopStateEvent() const { return true; }
 
     SerializedScriptValue* state() const { return m_stateObject.get(); }    
 
 private:
+    PopStateEvent();
     explicit PopStateEvent(PassRefPtr<SerializedScriptValue>);
-
     RefPtr<SerializedScriptValue> m_stateObject;
 };
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to