Skip to content

Commit 69b531a

Browse files
danilsomsikovDevtools-frontend LUCI CQ
authored andcommitted
Handle errors when loading manifest icons.
Wrap the `loadResource` call in a try-catch block to gracefully handle cases where an icon cannot be loaded, returning `null` instead of throwing an error. Bug: 492211941 Change-Id: I050af476d0b54cc3582e871647484d2e977cabb8 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/7681550 Auto-Submit: Danil Somsikov <dsv@chromium.org> Reviewed-by: Simon Zünd <szuend@chromium.org> Commit-Queue: Simon Zünd <szuend@chromium.org>
1 parent ba3b144 commit 69b531a

1 file changed

Lines changed: 13 additions & 7 deletions

File tree

front_end/panels/application/AppManifestView.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1354,13 +1354,19 @@ export class AppManifestView extends Common.ObjectWrapper.eventMixin<EventTypes,
13541354
if (!frameId) {
13551355
throw new Error('no main frame found');
13561356
}
1357-
const {content} = await SDK.PageResourceLoader.PageResourceLoader.instance().loadResource(
1358-
url, {
1359-
target: this.target,
1360-
frameId,
1361-
initiatorUrl: this.target.inspectedURL(),
1362-
},
1363-
/* isBinary=*/ true);
1357+
let content;
1358+
try {
1359+
const response = await SDK.PageResourceLoader.PageResourceLoader.instance().loadResource(
1360+
url, {
1361+
target: this.target,
1362+
frameId,
1363+
initiatorUrl: this.target.inspectedURL(),
1364+
},
1365+
/* isBinary=*/ true);
1366+
content = response.content;
1367+
} catch {
1368+
return null;
1369+
}
13641370
// Just loading the image, not building UI.
13651371
/* eslint-disable @devtools/no-imperative-dom-api */
13661372
const image = document.createElement('img');

0 commit comments

Comments
 (0)