Skip to content

Commit af5fab9

Browse files
authored
Fix to do callback when parsing account info failed in loadInfo (#394)
1 parent 46c390a commit af5fab9

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/js/content.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,10 +101,11 @@ function loadInfo(cb) {
101101
const script = document.createElement('script');
102102
script.src = brw.runtime.getURL('/js/war/attach_target.js');
103103
script.onload = function() {
104-
const json = document.getElementById('AESR_info').dataset.content;
105-
if (!json) return;
106-
accountInfo = JSON.parse(json);
107-
accountInfo.prism = session.prismModeEnabled;
104+
try {
105+
const json = document.getElementById('AESR_info').dataset.content;
106+
accountInfo = JSON.parse(json);
107+
accountInfo.prism = session.prismModeEnabled;
108+
} catch {}
108109
cb(accountInfo);
109110
this.remove();
110111
};

0 commit comments

Comments
 (0)