Skip to content

Commit ff32207

Browse files
authored
chrome-extension: do not fail if damagedRects property is not available (#11)
* chrome-extension: do not fail if damagedRects property is not available The ContainerTiming performance entry damagedRects property is a proposal for the future, and is not available, at least, in the initial patch sent for review upstream. Check if the property is available, and if not, do not show the damaged rects overlay. * chrome-extension: improve the extension description
1 parent bb4ed42 commit ff32207

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

chrome-extension/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "container-timing",
33
"version": "0.1.0",
4-
"description": "My Chrome Extension",
4+
"description": "ContainerTiming Chrome demo extension",
55
"private": true,
66
"scripts": {
77
"watch": "node ./build.mjs --watch",

chrome-extension/src/content.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,9 @@ function startPerformanceObserve(elm) {
2828
console.log("Container timing entries from " + href)
2929
list.getEntries().forEach((list) => {
3030
clearRects();
31-
showRectsOnScreen(list.damagedRects);
31+
if (list?.damagedRects) {
32+
showRectsOnScreen(list.damagedRects);
33+
}
3234
showBoundingRect(list.intersectionRect);
3335
clearRects(true)
3436
})

0 commit comments

Comments
 (0)