1/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2/* This Source Code Form is subject to the terms of the Mozilla Public 3 * License, v. 2.0. If a copy of the MPL was not distributed with this file, 4 * You can obtain one at http://mozilla.org/MPL/2.0/. 5 * 6 * The origin of this IDL file is 7 * https://w3c.github.io/reporting/#interface-reporting-observer 8 */ 9 10[Pref="dom.reporting.enabled", 11 Exposed=(Window,Worker)] 12interface ReportBody { 13 [Default] object toJSON 14(); 15}; 16 17[Pref="dom.reporting.enabled", 18 Exposed=(Window,Worker)] 19interface Report { 20 [Default] object toJSON 21(); 22 readonly attribute DOMString type; 23 readonly attribute DOMString url; 24 readonly attribute ReportBody? body; 25}; 26 27[Pref="dom.reporting.enabled", 28 Exposed=(Window,Worker)] 29interface ReportingObserver { 30 [Throws] 31 constructor(ReportingObserverCallback callback, optional ReportingObserverOptions options = {}); 32 void observe(); 33 void disconnect(); 34 ReportList takeRecords(); 35}; 36 37callback ReportingObserverCallback = void (sequence<Report> reports, ReportingObserver observer); 38 39dictionary ReportingObserverOptions { 40 sequence<DOMString> types; 41 boolean buffered = false; 42}; 43 44typedef sequence<Report> ReportList; 45 46[Pref="dom.reporting.enabled", 47 Exposed=Window] 48interface DeprecationReportBody : ReportBody { 49 readonly attribute DOMString id; 50 // The spec currently has Date, but that's not a type that exists in Web IDL. 51 // In any case, we always return null, so we just need _some_ nullable type 52 // here. 53 readonly attribute DOMTimeStamp? anticipatedRemoval; 54 readonly attribute DOMString message; 55 readonly attribute DOMString? sourceFile; 56 readonly attribute unsigned long? lineNumber; 57 readonly attribute unsigned long? columnNumber; 58}; 59 60[Deprecated="DeprecatedTestingInterface", 61 Pref="dom.reporting.testing.enabled", 62 Exposed=(Window,DedicatedWorker)] 63interface TestingDeprecatedInterface { 64 constructor(); 65 66 [Deprecated="DeprecatedTestingMethod"] 67 void deprecatedMethod(); 68 69 [Deprecated="DeprecatedTestingAttribute"] 70 readonly attribute boolean deprecatedAttribute; 71}; 72 73// Used internally to process the JSON 74[GenerateInit] 75dictionary ReportingHeaderValue { 76 sequence<ReportingItem> items; 77}; 78 79// Used internally to process the JSON 80dictionary ReportingItem { 81 // This is a long. 82 any max_age; 83 // This is a sequence of ReportingEndpoint. 84 any endpoints; 85 // This is a string. If missing, the value is 'default'. 86 any group; 87 boolean include_subdomains = false; 88}; 89 90// Used internally to process the JSON 91[GenerateInit] 92dictionary ReportingEndpoint { 93 // This is a string. 94 any url; 95 // This is an unsigned long. 96 any priority; 97 // This is an unsigned long. 98 any weight; 99}; 100