1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #include "mozilla/dom/ReportingUtils.h"
8 #include "mozilla/dom/ReportBody.h"
9 #include "mozilla/dom/ReportDeliver.h"
10 #include "mozilla/dom/Report.h"
11 #include "mozilla/ipc/BackgroundChild.h"
12 #include "mozilla/ipc/BackgroundUtils.h"
13 #include "mozilla/ipc/PBackgroundChild.h"
15 #include "nsIGlobalObject.h"
17 namespace mozilla::dom
{
20 void ReportingUtils::Report(nsIGlobalObject
* aGlobal
, nsAtom
* aType
,
21 const nsAString
& aGroupName
, const nsAString
& aURL
,
26 nsDependentAtomString
type(aType
);
28 RefPtr
<mozilla::dom::Report
> report
=
29 new mozilla::dom::Report(aGlobal
, type
, aURL
, aBody
);
30 aGlobal
->BroadcastReport(report
);
32 if (!NS_IsMainThread()) {
36 nsCOMPtr
<nsPIDOMWindowInner
> window
= do_QueryInterface(aGlobal
);
41 // Send the report to the server.
42 ReportDeliver::Record(window
, type
, aGroupName
, aURL
, aBody
);
45 } // namespace mozilla::dom