mirror of
https://github.com/garrytan/gstack.git
synced 2026-05-20 03:12:28 +08:00
refactor: selective catches in Chrome extension files
Convert empty catches and error-swallowing patterns across inspector.js, content.js, background.js, and sidepanel.js. DOM catches filter TypeError/DOMException, chrome API catches filter Extension context invalidated, network catches filter Failed to fetch. Unexpected errors now propagate. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -207,11 +207,11 @@ function captureBasicData(el) {
|
||||
source: sheet.href || 'inline',
|
||||
});
|
||||
}
|
||||
} catch { /* skip rules that can't be matched */ }
|
||||
} catch (e) { if (!(e instanceof TypeError) && !(e instanceof DOMException)) throw e; }
|
||||
}
|
||||
} catch { /* cross-origin sheet — silently skip */ }
|
||||
} catch (e) { if (!(e instanceof DOMException)) throw e; }
|
||||
}
|
||||
} catch { /* CSSOM not available */ }
|
||||
} catch (e) { if (!(e instanceof TypeError) && !(e instanceof DOMException)) throw e; }
|
||||
|
||||
return { computedStyles, boxModel, matchedRules };
|
||||
}
|
||||
@@ -219,7 +219,7 @@ function captureBasicData(el) {
|
||||
function basicBuildSelector(el) {
|
||||
if (el.id) {
|
||||
const sel = '#' + CSS.escape(el.id);
|
||||
try { if (document.querySelectorAll(sel).length === 1) return sel; } catch {}
|
||||
try { if (document.querySelectorAll(sel).length === 1) return sel; } catch (e) { if (!(e instanceof TypeError) && !(e instanceof DOMException)) throw e; }
|
||||
}
|
||||
const parts = [];
|
||||
let current = el;
|
||||
|
||||
Reference in New Issue
Block a user