Performance.webidl (3622B)
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/hr-time/#sec-performance 8 * https://w3c.github.io/navigation-timing/#extensions-to-the-performance-interface 9 * https://w3c.github.io/performance-timeline/#extensions-to-the-performance-interface 10 * https://w3c.github.io/resource-timing/#sec-extensions-performance-interface 11 * https://w3c.github.io/user-timing/#extensions-performance-interface 12 * 13 * Copyright © 2015 W3C® (MIT, ERCIM, Keio, Beihang). 14 * W3C liability, trademark and document use rules apply. 15 */ 16 17 // DOMTimeStamp is deprecated, use EpochTimeStamp instead. 18 typedef unsigned long long DOMTimeStamp; 19 typedef unsigned long long EpochTimeStamp; 20 typedef double DOMHighResTimeStamp; 21 typedef sequence <PerformanceEntry> PerformanceEntryList; 22 23 // https://w3c.github.io/hr-time/#sec-performance 24 [Exposed=(Window,Worker)] 25 interface Performance : EventTarget { 26 [DependsOn=DeviceState, Affects=Nothing] 27 DOMHighResTimeStamp now(); 28 29 [Constant] 30 readonly attribute DOMHighResTimeStamp timeOrigin; 31 32 [Default] object toJSON(); 33 }; 34 35 // https://w3c.github.io/navigation-timing/#extensions-to-the-performance-interface 36 [Exposed=Window] 37 partial interface Performance { 38 [Constant] 39 readonly attribute PerformanceTiming timing; 40 [Constant] 41 readonly attribute PerformanceNavigation navigation; 42 }; 43 44 // https://w3c.github.io/performance-timeline/#extensions-to-the-performance-interface 45 [Exposed=(Window,Worker)] 46 partial interface Performance { 47 PerformanceEntryList getEntries(); 48 PerformanceEntryList getEntriesByType(DOMString entryType); 49 PerformanceEntryList getEntriesByName(DOMString name, optional DOMString 50 entryType); 51 }; 52 53 // https://w3c.github.io/resource-timing/#sec-extensions-performance-interface 54 [Exposed=(Window,Worker)] 55 partial interface Performance { 56 undefined clearResourceTimings(); 57 undefined setResourceTimingBufferSize(unsigned long maxSize); 58 attribute EventHandler onresourcetimingbufferfull; 59 }; 60 61 // GC microbenchmarks, pref-guarded, not for general use (bug 1125412) 62 [Exposed=Window] 63 partial interface Performance { 64 [Pref="dom.enable_memory_stats"] 65 readonly attribute object mozMemory; 66 }; 67 68 // https://w3c.github.io/user-timing/#extensions-performance-interface 69 dictionary PerformanceMarkOptions { 70 any detail; 71 DOMHighResTimeStamp startTime; 72 }; 73 74 // https://w3c.github.io/user-timing/#extensions-performance-interface 75 dictionary PerformanceMeasureOptions { 76 any detail; 77 (DOMString or DOMHighResTimeStamp) start; 78 DOMHighResTimeStamp duration; 79 (DOMString or DOMHighResTimeStamp) end; 80 }; 81 82 // https://w3c.github.io/user-timing/#extensions-performance-interface 83 [Exposed=(Window,Worker)] 84 partial interface Performance { 85 [Throws] 86 PerformanceMark mark(DOMString markName, optional PerformanceMarkOptions markOptions = {}); 87 undefined clearMarks(optional DOMString markName); 88 [Throws] 89 PerformanceMeasure measure(DOMString measureName, optional (DOMString or PerformanceMeasureOptions) startOrMeasureOptions = {}, optional DOMString endMark); 90 undefined clearMeasures(optional DOMString measureName); 91 }; 92 93 [Exposed=Window] 94 partial interface Performance { 95 [Pref="dom.enable_event_timing", SameObject] 96 readonly attribute EventCounts eventCounts; 97 98 [Pref="dom.performance.event_timing.enable_interactionid"] 99 readonly attribute unsigned long long interactionCount; 100 };