2015-06-17 13:44:27 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
|
|
|
/* 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 http://mozilla.org/MPL/2.0/. */
|
|
|
|
|
|
|
|
#ifndef mozilla_dom_PostMessageEvent_h
|
|
|
|
#define mozilla_dom_PostMessageEvent_h
|
|
|
|
|
2015-07-22 21:37:18 +03:00
|
|
|
#include "mozilla/dom/StructuredCloneHelper.h"
|
2015-06-17 13:44:27 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2015-07-29 03:52:52 +03:00
|
|
|
#include "mozilla/nsRefPtr.h"
|
2015-06-17 13:44:27 +03:00
|
|
|
#include "nsTArray.h"
|
2015-07-01 16:56:00 +03:00
|
|
|
#include "nsThreadUtils.h"
|
2015-06-17 13:44:27 +03:00
|
|
|
|
|
|
|
class nsGlobalWindow;
|
|
|
|
class nsIPrincipal;
|
2015-07-01 16:56:00 +03:00
|
|
|
class nsPIDOMWindow;
|
2015-06-17 13:44:27 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class used to represent events generated by calls to Window.postMessage,
|
|
|
|
* which asynchronously creates and dispatches events.
|
|
|
|
*/
|
|
|
|
class PostMessageEvent final : public nsRunnable
|
2015-07-22 21:37:18 +03:00
|
|
|
, public StructuredCloneHelper
|
2015-06-17 13:44:27 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
|
|
|
|
PostMessageEvent(nsGlobalWindow* aSource,
|
|
|
|
const nsAString& aCallerOrigin,
|
|
|
|
nsGlobalWindow* aTargetWindow,
|
|
|
|
nsIPrincipal* aProvidedPrincipal,
|
|
|
|
bool aTrustedCaller);
|
|
|
|
|
|
|
|
private:
|
|
|
|
~PostMessageEvent();
|
|
|
|
|
|
|
|
nsRefPtr<nsGlobalWindow> mSource;
|
|
|
|
nsString mCallerOrigin;
|
|
|
|
nsRefPtr<nsGlobalWindow> mTargetWindow;
|
|
|
|
nsCOMPtr<nsIPrincipal> mProvidedPrincipal;
|
|
|
|
bool mTrustedCaller;
|
|
|
|
};
|
|
|
|
|
2015-07-13 18:25:42 +03:00
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|
2015-06-17 13:44:27 +03:00
|
|
|
|
|
|
|
#endif // mozilla_dom_PostMessageEvent_h
|