Bug 1492036 - Reporting API - part 2 - WebIDL for DeprecationReportBody, r=smaug

This commit is contained in:
Andrea Marchesini 2018-11-14 20:02:32 +01:00
Родитель 5a9c35f647
Коммит b840bc9f3b
6 изменённых файлов: 155 добавлений и 41 удалений

Просмотреть файл

@ -0,0 +1,76 @@
/* -*- 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/DeprecationReportBody.h"
#include "mozilla/dom/ReportingBinding.h"
namespace mozilla {
namespace dom {
DeprecationReportBody::DeprecationReportBody(nsPIDOMWindowInner* aWindow,
const nsAString& aId,
Nullable<Date> aDate,
const nsAString& aMessage,
const nsAString& aSourceFile,
Nullable<uint32_t> aLineNumber,
Nullable<uint32_t> aColumnNumber)
: ReportBody(aWindow)
, mId(aId)
, mDate(aDate)
, mMessage(aMessage)
, mSourceFile(aSourceFile)
, mLineNumber(aLineNumber)
, mColumnNumber(aColumnNumber)
{
MOZ_ASSERT(aWindow);
}
DeprecationReportBody::~DeprecationReportBody() = default;
JSObject*
DeprecationReportBody::WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto)
{
return DeprecationReportBody_Binding::Wrap(aCx, this, aGivenProto);
}
void
DeprecationReportBody::GetId(nsAString& aId) const
{
aId = mId;
}
Nullable<Date>
DeprecationReportBody::GetAnticipatedRemoval() const
{
return mDate;
}
void
DeprecationReportBody::GetMessage(nsAString& aMessage) const
{
aMessage = mMessage;
}
void
DeprecationReportBody::GetSourceFile(nsAString& aSourceFile) const
{
aSourceFile = mSourceFile;
}
Nullable<uint32_t>
DeprecationReportBody::GetLineNumber() const
{
return mLineNumber;
}
Nullable<uint32_t>
DeprecationReportBody::GetColumnNumber() const
{
return mColumnNumber;
}
} // dom namespace
} // mozilla namespace

Просмотреть файл

@ -0,0 +1,62 @@
/* -*- 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_DeprecationReportBody_h
#define mozilla_dom_DeprecationReportBody_h
#include "mozilla/dom/ReportBody.h"
#include "mozilla/dom/Date.h"
namespace mozilla {
namespace dom {
class DeprecationReportBody final : public ReportBody
{
public:
DeprecationReportBody(nsPIDOMWindowInner* aWindow,
const nsAString& aId,
Nullable<Date> aDate,
const nsAString& aMessage,
const nsAString& aSourceFile,
Nullable<uint32_t> aLineNumber,
Nullable<uint32_t> aColumnNumber);
JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
void
GetId(nsAString& aId) const;
Nullable<Date>
GetAnticipatedRemoval() const;
void
GetMessage(nsAString& aMessage) const;
void
GetSourceFile(nsAString& aSourceFile) const;
Nullable<uint32_t>
GetLineNumber() const;
Nullable<uint32_t>
GetColumnNumber() const;
private:
~DeprecationReportBody();
const nsString mId;
const Nullable<Date> mDate;
const nsString mMessage;
const nsString mSourceFile;
const Nullable<uint32_t> mLineNumber;
const Nullable<uint32_t> mColumnNumber;
};
} // dom namespace
} // mozilla namespace
#endif // mozilla_dom_DeprecationReportBody_h

Просмотреть файл

@ -17,8 +17,8 @@ class nsPIDOMWindowInner;
namespace mozilla {
namespace dom {
class ReportBody final : public nsISupports
, public nsWrapperCache
class ReportBody : public nsISupports
, public nsWrapperCache
{
public:
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
@ -26,7 +26,7 @@ public:
explicit ReportBody(nsPIDOMWindowInner* aWindow);
JSObject*
virtual JSObject*
WrapObject(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override;
nsPIDOMWindowInner*
@ -35,8 +35,8 @@ public:
return mWindow;
}
private:
~ReportBody();
protected:
virtual ~ReportBody();
nsCOMPtr<nsPIDOMWindowInner> mWindow;
};

Просмотреть файл

@ -5,12 +5,14 @@
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
EXPORTS.mozilla.dom = [
'DeprecationReportBody.h',
'Report.h',
'ReportBody.h',
'ReportingObserver.h',
]
UNIFIED_SOURCES += [
'DeprecationReportBody.cpp',
'Report.cpp',
'ReportBody.cpp',
'ReportingObserver.cpp',

Просмотреть файл

@ -34,3 +34,13 @@ dictionary ReportingObserverOptions {
};
typedef sequence<Report> ReportList;
[Func="mozilla::dom::DOMPrefs::dom_reporting_enabled"]
interface DeprecationReportBody : ReportBody {
readonly attribute DOMString id;
readonly attribute Date? anticipatedRemoval;
readonly attribute DOMString message;
readonly attribute DOMString? sourceFile;
readonly attribute unsigned long? lineNumber;
readonly attribute unsigned long? columnNumber;
};

Просмотреть файл

@ -1,43 +1,16 @@
[idlharness.window.html]
[DeprecationReportBody interface object length]
expected: FAIL
[DeprecationReportBody interface: existence and properties of interface prototype object's "constructor" property]
expected: FAIL
[DeprecationReportBody interface: attribute lineNumber]
expected: FAIL
[DeprecationReportBody interface object name]
expected: FAIL
[DeprecationReportBody interface: attribute anticipatedRemoval]
expected: FAIL
[CrashReportBody interface: existence and properties of interface prototype object]
expected: FAIL
[CrashReportBody interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[DeprecationReportBody interface: existence and properties of interface prototype object]
expected: FAIL
[DeprecationReportBody interface: attribute message]
expected: FAIL
[CrashReportBody interface: attribute reason]
expected: FAIL
[DeprecationReportBody interface: attribute columnNumber]
expected: FAIL
[InterventionReportBody interface: attribute lineNumber]
expected: FAIL
[DeprecationReportBody interface: existence and properties of interface prototype object's @@unscopables property]
expected: FAIL
[InterventionReportBody interface: attribute id]
expected: FAIL
@ -59,15 +32,9 @@
[InterventionReportBody interface object length]
expected: FAIL
[DeprecationReportBody interface: attribute sourceFile]
expected: FAIL
[CrashReportBody interface object length]
expected: FAIL
[DeprecationReportBody interface: attribute id]
expected: FAIL
[CrashReportBody interface: attribute crashId]
expected: FAIL
@ -86,9 +53,6 @@
[InterventionReportBody interface: attribute message]
expected: FAIL
[DeprecationReportBody interface: existence and properties of interface object]
expected: FAIL
[InterventionReportBody interface: attribute sourceFile]
expected: FAIL