browsertime 21.5.1 → 21.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Browsertime changelog (we do [semantic versioning](https://semver.org))
2
2
 
3
+ ## 21.5.2 - 2024-03-12
4
+ ### Fixed
5
+ * Another bug fix: Getting Long Animation Frame (loaf) was broken [#2099](https://github.com/sitespeedio/browsertime/pull/2099).
6
+
3
7
  ## 21.5.1 - 2024-03-12
4
8
  ### Fixed
5
9
  * There was a bug in how we collect CPU power from Firefox and add it to the statistics. Fixed in [#2098](https://github.com/sitespeedio/browsertime/pull/2098).
@@ -1,36 +1,38 @@
1
- (function() {
2
- // See https://developer.chrome.com/docs/web-platform/long-animation-frames
3
- if (PerformanceObserver.supportedEntryTypes.includes('long-animation-frame')) {
4
-
1
+ (function () {
2
+ // See https://developer.chrome.com/docs/web-platform/long-animation-frames
3
+ if (
4
+ PerformanceObserver.supportedEntryTypes.includes('long-animation-frame')
5
+ ) {
5
6
  const MAX_LOAFS_TO_CONSIDER = 10;
6
7
  const relevantLoadEntries = [];
7
- const observer = new PerformanceObserver(list => {
8
- let longestBlockingLoAFs = [].concat(list.getEntries()).sort(
9
- (a, b) => b.blockingDuration - a.blockingDuration
10
- ).slice(0, MAX_LOAFS_TO_CONSIDER);
8
+ const observer = new PerformanceObserver(list => {});
9
+ observer.observe({type: 'long-animation-frame', buffered: true});
10
+ const entries = observer.takeRecords();
11
11
 
12
- // re-package
13
- for (let entry of longestBlockingLoAFs) {
14
- const info = {};
15
- info.blockingDuration = entry.blockingDuration;
16
- info.duration = entry.duration;
17
- info.styleAndLayoutStart = entry.styleAndLayoutStart;
18
- info.renderStart = entry.renderStart;
19
- info.scripts = [];
20
- for (let script of entry.scripts) {
21
- const s = {};
22
- s.forcedStyleAndLayoutDuration = script.forcedStyleAndLayoutDuration;
23
- s.invoker = script.invoker;
24
- s.invokerType = script.invokerType;
25
- s.sourceFunctionName = script.sourceFunctionName;
26
- s.sourceURL = script.sourceURL;
27
- info.scripts.push(s);
28
- }
29
- relevantLoadEntries.push(info);
30
- }
31
- return relevantLoadEntries;
32
- });
33
- observer.observe({ type: 'long-animation-frame', buffered: true });
12
+ let longestBlockingLoAFs = []
13
+ .concat(entries)
14
+ .sort((a, b) => b.blockingDuration - a.blockingDuration)
15
+ .slice(0, MAX_LOAFS_TO_CONSIDER);
16
+
17
+ // re-package
18
+ for (let entry of longestBlockingLoAFs) {
19
+ const info = {};
20
+ info.blockingDuration = entry.blockingDuration;
21
+ info.duration = entry.duration;
22
+ info.styleAndLayoutStart = entry.styleAndLayoutStart;
23
+ info.renderStart = entry.renderStart;
24
+ info.scripts = [];
25
+ for (let script of entry.scripts) {
26
+ const s = {};
27
+ s.forcedStyleAndLayoutDuration = script.forcedStyleAndLayoutDuration;
28
+ s.invoker = script.invoker;
29
+ s.invokerType = script.invokerType;
30
+ s.sourceFunctionName = script.sourceFunctionName;
31
+ s.sourceURL = script.sourceURL;
32
+ info.scripts.push(s);
33
+ }
34
+ relevantLoadEntries.push(info);
34
35
  }
36
+ return relevantLoadEntries;
37
+ }
35
38
  })();
36
-
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "browsertime",
3
3
  "description": "Get performance metrics from your web page using Browsertime.",
4
- "version": "21.5.1",
4
+ "version": "21.5.2",
5
5
  "bin": "./bin/browsertime.js",
6
6
  "type": "module",
7
7
  "types": "./types/scripting.d.ts",