blob: fa959d22ef845cb3097bcbaa34986d32a5234e5b [file] [log] [blame]
importScripts("rt-utilities.sub.js");
addEventListener("message", function(event) {
if (!hasNecessaryPerformanceFeatures()) {
postMessage("error");
return;
}
performance.clearResourceTimings();
let promises = [];
if (event.data.n)
promises.push(loadResources(event.data.n));
if (event.data.sharedResourceURL);
promises.push(fetch(event.data.sharedResourceURL));
Promise.all(promises).then(function() {
let entries = performance.getEntriesByType("resource");
let serializedEntries = JSON.parse(JSON.stringify(entries));
postMessage(serializedEntries);
});
});