From b199482a4641a153dec7fb079ba2656399e97350 Mon Sep 17 00:00:00 2001
From: "Emmanuel Romero Ruiz (from Dev Box)" The ProfilerTrace Dictionary
Inspired by the V8 trace event format
and Gecko profile format,
this representation is designed to be easily and efficiently serializable.
-
+ enum ProfilerMarker { "script", "gc", "style", "layout", "paint", "other" };
+
dictionary ProfilerSample {
required DOMHighResTimeStamp timestamp;
unsigned long long stackId;
+ ProfilerMarker? marker;
};
timestamp MUST return the value it was initialized to.
stackId MUST return the value it was initialized to.
+marker MUST return the value it was initialized to, if present. The availability of markers depends on the context's cross-origin isolation status.
+
+ In cross-origin isolated contexts, all marker types are available. In non-isolated contexts, only style and layout markers are exposed for security reasons.
+
+ To filter a marker given a ProfilerMarker marker and an environment settings object settings, perform the following steps: +
+"style" or "layout", return marker.
+ The filter a marker algorithm produces the observable behavior that in non-cross-origin-isolated contexts, only the style and layout markers appear on ProfilerSample; the script, gc, paint, and other markers are suppressed. User agents MAY offer opt-in mechanisms (for example, an origin-trial token or a document policy) that widen the set returned by filter a marker for a specific environment settings object; such opt-ins MUST NOT expose markers cross-origin.
+
To get a stack ID given an execution context stack bound to stack, perform the following steps:
undefined.
enum ProfilerMarker { "script", "gc", "style", "layout", "paint", "other" };
@@ -316,9 +334,9 @@ The ProfilerSample Dictionary
timestamp MUST return the value it was initialized to.
stackId MUST return the value it was initialized to.
-marker MUST return the value it was initialized to, if present. The availability of markers depends on the context's cross-origin isolation status.
+marker MUST return the value it was initialized to by the take a sample algorithm, or be absent if no marker was set. The set of marker values that may be exposed is governed by the filter a marker algorithm.
- In cross-origin isolated contexts, all marker types are available. In non-isolated contexts, only style and layout markers are exposed for security reasons.
+ In cross-origin isolated contexts the filter a marker algorithm returns every value in the ProfilerMarker enumeration. In non-isolated contexts it returns only style and layout, so any other marker is suppressed (the marker attribute is absent on the corresponding ProfilerSample).
+ To capture a marker given an environment settings object settings, perform the following steps: +
+
+ The mapping from a user agent's internal activity to a ProfilerMarker value is intentionally implementation-defined, as engine architectures differ. As non-normative guidance, a user agent is expected to report script while executing author script, gc during garbage collection, style while recalculating computed style, layout while computing box geometry (i.e. reflow), and paint while rasterizing or compositing document content. The other marker is used for user-agent work that does not fall into one of the preceding categories. When no category applies (for example, when the agent is idle), the capture a marker algorithm returns null and the marker attribute is left absent on the resulting ProfilerSample.
+
To filter a marker given a ProfilerMarker marker and an environment settings object settings, perform the following steps:
- The filter a marker algorithm produces the observable behavior that in non-cross-origin-isolated contexts, only the style and layout markers appear on ProfilerSample; the script, gc, paint, and other markers are suppressed. User agents MAY offer opt-in mechanisms (for example, an origin-trial token or a document policy) that widen the set returned by filter a marker for a specific environment settings object; such opt-ins MUST NOT expose markers cross-origin.
+ The filter a marker algorithm produces the observable behavior that in non-cross-origin-isolated contexts, only the style and layout markers appear on ProfilerSample; the script, gc, paint, and other markers are suppressed. See Conditional marker exposure for the rationale behind this behavior. User agents MAY offer opt-in mechanisms (for example, an origin-trial token or a document policy) that widen the set returned by filter a marker for a specific environment settings object; such opt-ins MUST NOT expose markers cross-origin.
To get a stack ID given an execution context stack bound to stack, perform the following steps: @@ -447,7 +454,7 @@
Cross-origin execution contexts should not be observable by the API through the realm check in the take a sample algorithm. Cross-origin iframes and other execution contexts that share an agent with a profiler will therefore not have their execution observable through this API.
@@ -461,6 +468,15 @@
+ The filter a marker algorithm exposes the script, gc, paint, and other markers only when the profiler's environment settings object has its cross-origin isolated capability set to true. These markers can reflect engine work that is not necessarily attributable to a single origin — for example, garbage collection and script compilation are typically process-wide, and painting may composite content from cross-origin frames. Exposing their timing without isolation could therefore contribute to a cross-origin side channel of the kind that cross-origin isolation is designed to mitigate. Gating them behind cross-origin isolation ensures the surrounding context is already separated from cross-origin data before this timing becomes observable.
+
+ The style and layout markers are exposed without cross-origin isolation because the timing they reveal is already same-origin observable. A document can already synchronously trigger, and time, its own style and layout work using existing APIs that force a reflow, such as getBoundingClientRect() or getComputedStyle(). These markers therefore expose no timing information that a same-origin document could not already obtain, and — like every sample — they remain subject to the restrictions in Cross-origin execution, so they never attribute work to a cross-origin execution context.
+