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
|
|
|
|
|
2017-10-26 12:40:12 +03:00
|
|
|
#include "mozilla/dom/Event.h"
|
2015-09-30 15:22:08 +03:00
|
|
|
#include "mozilla/dom/StructuredCloneHolder.h"
|
2015-06-17 13:44:27 +03:00
|
|
|
#include "nsCOMPtr.h"
|
2015-10-18 08:24:48 +03:00
|
|
|
#include "mozilla/RefPtr.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
|
|
|
|
2017-11-04 01:25:38 +03:00
|
|
|
class nsGlobalWindowOuter;
|
|
|
|
class nsGlobalWindowInner;
|
2016-04-11 19:02:35 +03:00
|
|
|
class nsIDocument;
|
2015-06-17 13:44:27 +03:00
|
|
|
class nsIPrincipal;
|
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Class used to represent events generated by calls to Window.postMessage,
|
|
|
|
* which asynchronously creates and dispatches events.
|
|
|
|
*/
|
2016-04-26 03:23:21 +03:00
|
|
|
class PostMessageEvent final : public Runnable
|
2015-09-30 15:22:08 +03:00
|
|
|
, public StructuredCloneHolder
|
2015-06-17 13:44:27 +03:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
NS_DECL_NSIRUNNABLE
|
|
|
|
|
2017-11-04 01:25:38 +03:00
|
|
|
PostMessageEvent(nsGlobalWindowOuter* aSource,
|
2015-06-17 13:44:27 +03:00
|
|
|
const nsAString& aCallerOrigin,
|
2017-11-04 01:25:38 +03:00
|
|
|
nsGlobalWindowOuter* aTargetWindow,
|
2015-06-17 13:44:27 +03:00
|
|
|
nsIPrincipal* aProvidedPrincipal,
|
2018-10-29 18:26:30 +03:00
|
|
|
nsIDocument* aSourceDocument);
|
2015-06-17 13:44:27 +03:00
|
|
|
|
|
|
|
private:
|
|
|
|
~PostMessageEvent();
|
|
|
|
|
2017-09-13 06:59:06 +03:00
|
|
|
void
|
2017-11-04 01:25:38 +03:00
|
|
|
Dispatch(nsGlobalWindowInner* aTargetWindow, Event* aEvent);
|
2017-09-13 06:59:06 +03:00
|
|
|
|
|
|
|
void
|
2017-11-04 01:25:38 +03:00
|
|
|
DispatchError(JSContext* aCx, nsGlobalWindowInner* aTargetWindow,
|
2017-09-13 06:59:06 +03:00
|
|
|
mozilla::dom::EventTarget* aEventTarget);
|
|
|
|
|
2017-11-04 01:25:38 +03:00
|
|
|
RefPtr<nsGlobalWindowOuter> mSource;
|
2015-06-17 13:44:27 +03:00
|
|
|
nsString mCallerOrigin;
|
2017-11-04 01:25:38 +03:00
|
|
|
RefPtr<nsGlobalWindowOuter> mTargetWindow;
|
2015-06-17 13:44:27 +03:00
|
|
|
nsCOMPtr<nsIPrincipal> mProvidedPrincipal;
|
2016-01-30 00:32:01 +03:00
|
|
|
nsCOMPtr<nsIDocument> mSourceDocument;
|
2015-06-17 13:44:27 +03:00
|
|
|
};
|
|
|
|
|
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
|