2018-11-14 22:02:33 +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/. */
|
|
|
|
|
|
|
|
#include "mozilla/dom/ReportingUtils.h"
|
|
|
|
#include "mozilla/dom/ReportBody.h"
|
2018-12-01 23:26:09 +03:00
|
|
|
#include "mozilla/dom/ReportDeliver.h"
|
2018-11-14 22:02:33 +03:00
|
|
|
#include "mozilla/dom/Report.h"
|
2018-12-01 23:26:09 +03:00
|
|
|
#include "mozilla/ipc/BackgroundChild.h"
|
|
|
|
#include "mozilla/ipc/BackgroundUtils.h"
|
|
|
|
#include "mozilla/ipc/PBackgroundChild.h"
|
2018-11-14 22:02:33 +03:00
|
|
|
#include "nsAtom.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
2018-11-14 22:02:33 +03:00
|
|
|
|
|
|
|
namespace mozilla {
|
|
|
|
namespace dom {
|
|
|
|
|
|
|
|
/* static */ void ReportingUtils::Report(nsPIDOMWindowInner* aWindow,
|
2018-12-01 23:26:09 +03:00
|
|
|
nsAtom* aType,
|
|
|
|
const nsAString& aGroupName,
|
|
|
|
const nsAString& aURL,
|
2018-11-14 22:02:33 +03:00
|
|
|
ReportBody* aBody) {
|
2018-11-14 22:02:33 +03:00
|
|
|
MOZ_ASSERT(NS_IsMainThread());
|
|
|
|
MOZ_ASSERT(aWindow);
|
|
|
|
MOZ_ASSERT(aBody);
|
|
|
|
|
2018-12-01 23:26:09 +03:00
|
|
|
nsDependentAtomString type(aType);
|
|
|
|
|
|
|
|
RefPtr<mozilla::dom::Report> report =
|
|
|
|
new mozilla::dom::Report(aWindow, type, aURL, aBody);
|
2018-11-14 22:02:33 +03:00
|
|
|
aWindow->BroadcastReport(report);
|
2018-12-01 23:26:09 +03:00
|
|
|
|
|
|
|
// Send the report to the server.
|
|
|
|
ReportDeliver::Record(aWindow, type, aGroupName, aURL, aBody);
|
2018-11-14 22:02:33 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
} // namespace dom
|
|
|
|
} // namespace mozilla
|