author Robert O'Callahan <>
Fri, 10 Jan 2014 16:03:25 +1300
changeset 163449 35dddd51e275f6a296a79bfaea84db81b3c6ffb2
parent 161581 content/events/src/nsDOMMessageEvent.h@cd380f3e389e9baf72f34b7027ca80c17f3b2dbc
permissions -rw-r--r--
Bug 946065. Part 5: Move content/events to dom/ and flatten away 'src' directory. r=Ms2ger

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at */

#ifndef nsDOMMessageEvent_h__
#define nsDOMMessageEvent_h__

#include "nsIDOMMessageEvent.h"
#include "nsDOMEvent.h"
#include "nsCycleCollectionParticipant.h"

namespace mozilla {
namespace dom {
class MessageEventInit;
class MessagePort;
class MessagePortBase;
class MessagePortList;
class OwningWindowProxyOrMessagePort;

 * Implements the MessageEvent event, used for cross-document messaging and
 * server-sent events.
 * See for
 * further details.
class nsDOMMessageEvent : public nsDOMEvent,
                          public nsIDOMMessageEvent
  nsDOMMessageEvent(mozilla::dom::EventTarget* aOwner,
                    nsPresContext* aPresContext,
                    mozilla::WidgetEvent* aEvent);



  // Forward to base class

  virtual JSObject* WrapObject(JSContext* aCx,
                               JS::Handle<JSObject*> aScope) MOZ_OVERRIDE;

  JS::Value GetData(JSContext* aCx, mozilla::ErrorResult& aRv);

  void GetSource(Nullable<mozilla::dom::OwningWindowProxyOrMessagePort>& aValue) const;

  mozilla::dom::MessagePortList* GetPorts()
    return mPorts;

  void SetPorts(mozilla::dom::MessagePortList* aPorts);

  static already_AddRefed<nsDOMMessageEvent>
  Constructor(const mozilla::dom::GlobalObject& aGlobal, JSContext* aCx,
              const nsAString& aType,
              const mozilla::dom::MessageEventInit& aEventInit,
              mozilla::ErrorResult& aRv);

  JS::Heap<JS::Value> mData;
  nsString mOrigin;
  nsString mLastEventId;
  nsCOMPtr<nsIDOMWindow> mWindowSource;
  nsRefPtr<mozilla::dom::MessagePortBase> mPortSource;
  nsRefPtr<mozilla::dom::MessagePortList> mPorts;

#endif // nsDOMMessageEvent_h__