Skip to content

Commit

Permalink
perf_hooks: add initiatorType getter
Browse files Browse the repository at this point in the history
PR-URL: #43593
Refs: https://w3c.github.io/resource-timing/#dfn-initiator-type
Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
Reviewed-By: Stephen Belanger <admin@stephenbelanger.com>
Reviewed-By: Gerhard Stöbich <deb2001-github@yahoo.de>
  • Loading branch information
RafaelGSS authored and targos committed Jul 31, 2022
1 parent a649d01 commit 463f9a6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/internal/perf/resource_timing.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ class InternalPerformanceResourceTiming extends InternalPerformanceEntry {
return this[kTimingInfo].endTime - this[kTimingInfo].startTime;
}

get initiatorType() {
return this[kInitiatorType];
}

get workerStart() {
return this[kTimingInfo].finalServiceWorkerStartTime;
}
Expand Down
1 change: 1 addition & 0 deletions test/parallel/test-perf-hooks-resourcetiming.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ function createTimingInfo({
assert.ok(typeof resource.cacheMode === 'undefined', 'cacheMode does not have a getter');
assert.strictEqual(resource.startTime, timingInfo.startTime);
assert.strictEqual(resource.duration, 0);
assert.strictEqual(resource.initiatorType, initiatorType);
assert.strictEqual(resource.workerStart, 0);
assert.strictEqual(resource.redirectStart, 0);
assert.strictEqual(resource.redirectEnd, 0);
Expand Down

0 comments on commit 463f9a6

Please sign in to comment.