2008-05-07  Sam Weinig  <sam@webkit.org>

        Reviewed by Adele Peterson

        Update MessageEvent to match the latest version of the HTML5 spec,
        adding the lastEventId attribute.

        * dom/MessageEvent.cpp:
        (WebCore::MessageEvent::MessageEvent):
        (WebCore::MessageEvent::initMessageEvent):
        * dom/MessageEvent.h:
        (WebCore::MessageEvent::lastEventId):
        * dom/MessageEvent.idl:
        * page/DOMWindow.cpp:
        (WebCore::DOMWindow::postMessage):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@32968 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index dc7ec04..d1a1699 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,19 @@
+2008-05-07  Sam Weinig  <sam@webkit.org>
+
+        Reviewed by Adele Peterson
+
+        Update MessageEvent to match the latest version of the HTML5 spec,
+        adding the lastEventId attribute.
+
+        * dom/MessageEvent.cpp:
+        (WebCore::MessageEvent::MessageEvent):
+        (WebCore::MessageEvent::initMessageEvent):
+        * dom/MessageEvent.h:
+        (WebCore::MessageEvent::lastEventId):
+        * dom/MessageEvent.idl:
+        * page/DOMWindow.cpp:
+        (WebCore::DOMWindow::postMessage):
+
 2008-05-07  Stephanie Lewis <slewis@apple.com>
 
         Reviewed by Maciej.
diff --git a/WebCore/dom/MessageEvent.cpp b/WebCore/dom/MessageEvent.cpp
index a74dd23..383d3c0 100644
--- a/WebCore/dom/MessageEvent.cpp
+++ b/WebCore/dom/MessageEvent.cpp
@@ -41,10 +41,11 @@
 {
 }
 
-MessageEvent::MessageEvent(const String& data, const String& origin, DOMWindow* source)
+MessageEvent::MessageEvent(const String& data, const String& origin, const String& lastEventId, DOMWindow* source)
     : Event(messageEvent, false, true)
     , m_data(data)
     , m_origin(origin)
+    , m_lastEventId(lastEventId)
     , m_source(source)
 {
 }
@@ -53,7 +54,7 @@
 {
 }
 
-void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, DOMWindow* source)
+void MessageEvent::initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source)
 {
     if (dispatched())
         return;
@@ -62,6 +63,7 @@
     
     m_data = data;
     m_origin = origin;
+    m_lastEventId = lastEventId;
     m_source = source;
 }
 
diff --git a/WebCore/dom/MessageEvent.h b/WebCore/dom/MessageEvent.h
index f378951..6a3435f 100644
--- a/WebCore/dom/MessageEvent.h
+++ b/WebCore/dom/MessageEvent.h
@@ -39,13 +39,14 @@
     class MessageEvent : public Event {
     public:
         MessageEvent();
-        MessageEvent(const String& data, const String& origin, DOMWindow* source);
+        MessageEvent(const String& data, const String& origin, const String& lastEventId, DOMWindow* source);
         virtual ~MessageEvent();
 
-        void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, DOMWindow* source);
+        void initMessageEvent(const AtomicString& type, bool canBubble, bool cancelable, const String& data, const String& origin, const String& lastEventId, DOMWindow* source);
         
         const String& data() const { return m_data; }
         const String& origin() const { return m_origin; }
+        const String& lastEventId() const { return m_lastEventId; }
         DOMWindow* source() const { return m_source.get(); }
         
         virtual bool isMessageEvent() const;
@@ -53,6 +54,7 @@
     private:    
         String m_data;
         String m_origin;
+        String m_lastEventId;
         RefPtr<DOMWindow> m_source;
     };
 
diff --git a/WebCore/dom/MessageEvent.idl b/WebCore/dom/MessageEvent.idl
index 4bb0497..07af213 100644
--- a/WebCore/dom/MessageEvent.idl
+++ b/WebCore/dom/MessageEvent.idl
@@ -26,13 +26,17 @@
 
 module events {
 
-    interface [Conditional=CROSS_DOCUMENT_MESSAGING,GenerateConstructor] MessageEvent : Event {
+    interface [
+        Conditional=CROSS_DOCUMENT_MESSAGING,
+        GenerateConstructor
+    ] MessageEvent : Event {
 
         readonly attribute DOMString data;
         readonly attribute DOMString origin;
+        readonly attribute DOMString lastEventId;
         readonly attribute DOMWindow source;
         
-        void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in DOMWindow sourceArg);
+        void initMessageEvent(in DOMString typeArg, in boolean canBubbleArg, in boolean cancelableArg, in DOMString dataArg, in DOMString originArg, in DOMString lastEventIdArg, in DOMWindow sourceArg);
 
     };
 
diff --git a/WebCore/page/DOMWindow.cpp b/WebCore/page/DOMWindow.cpp
index 995eb1a..777d40a 100644
--- a/WebCore/page/DOMWindow.cpp
+++ b/WebCore/page/DOMWindow.cpp
@@ -374,7 +374,7 @@
     String sourceOrigin = sourceDocument->securityOrigin()->toString();
 
     // Schedule the message.
-    PostMessageTimer* timer = new PostMessageTimer(this, new MessageEvent(message, sourceOrigin, source), target.get());
+    PostMessageTimer* timer = new PostMessageTimer(this, new MessageEvent(message, sourceOrigin, "", source), target.get());
     timer->startOneShot(0);
 }