desktop: the notification plugin's refused is_permission_granted probe at page load (macOS, Linux; the webview has no plugin API) is no longer logged as a start error in webview.log
This commit is contained in:
parent
7901beee1e
commit
2e66aa42b6
3 changed files with 23 additions and 1 deletions
|
|
@ -52,12 +52,20 @@ export function report(where: string, e: unknown, componentStack?: string | null
|
|||
return r;
|
||||
}
|
||||
|
||||
/**
|
||||
* tauri-plugin-notification's init script asks for the notification permission when the page loads (macOS, Linux).
|
||||
* The webview has no plugin API by design (capabilities/main.json), so the call is refused: expected, never reported.
|
||||
*/
|
||||
export function ignoredRejection(e: unknown): boolean {
|
||||
return /plugin:notification\|is_permission_granted not allowed/.test(errorMessage(e));
|
||||
}
|
||||
|
||||
/** window.onerror and unhandled promise rejections, after React took over from public/boot.js. */
|
||||
export function installGlobalHandlers(): void {
|
||||
// public/boot.js stops logging on its own from here
|
||||
(window as { __storeboundCrashHandlers?: boolean }).__storeboundCrashHandlers = true;
|
||||
window.addEventListener('error', ev => { report('window.onerror', ev.error ?? ev.message); });
|
||||
window.addEventListener('unhandledrejection', ev => { report('unhandledrejection', ev.reason, null, 'warn'); });
|
||||
window.addEventListener('unhandledrejection', ev => { if (!ignoredRejection(ev.reason)) report('unhandledrejection', ev.reason, null, 'warn'); });
|
||||
}
|
||||
|
||||
/** Clipboard first, then the old selection way (the webview may refuse clipboard access). True when copied. */
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue