Skip to content

Commit

Permalink
remove types
Browse files Browse the repository at this point in the history
  • Loading branch information
Casheeew committed Jan 6, 2024
1 parent fbd1a60 commit b81fd36
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
10 changes: 7 additions & 3 deletions ext/js/background/backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -2257,11 +2257,15 @@ export class Backend {
if (!(typeof details === 'object' && details !== null)) { continue; }
const error3 = /** @type {import('core').SerializableObject} */ (details).error;
if (typeof error3 !== 'string') { continue; }
switch (/** @type {import('backend').NetError} */ (error3)) {
switch (error3) {
case 'net::ERR_FAILED':
// This is potentially an error due to the extension not having enough URL privileges.
// The message logged to the console looks like this:
// Access to fetch at '<URL>' from origin 'chrome-extension://<ID>' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
return this._createAudioDownloadError('Audio download failed due to possible extension permissions error', 'audio-download-failed-permissions-error', errors);
case 'net::ERR_CERT_DATE_INVALID':
case 'Peer’s Certificate has expired.':
case 'net::ERR_CERT_DATE_INVALID': // Chrome
case 'Peer’s Certificate has expired.': // Firefox
// This error occurs when a server certificate expires.
return this._createAudioDownloadError('Audio download failed due to an expired server certificate', 'audio-download-failed-expired-server-certificate', errors);
}
}
Expand Down
9 changes: 0 additions & 9 deletions types/ext/backend.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,3 @@ export type TabInfo = {
};

export type FindTabsPredicate = (tabInfo: TabInfo) => boolean | Promise<boolean>;

/**
* An enum representing the fetch error thrown by Chrome or Firefox.
* - `net::ERR_FAILED` - Chrome error. This is potentially an error due to the extension not having enough URL privileges.
* The message logged to the console looks like this: ```Access to fetch at '\<URL\>' from origin 'chrome-extension://<ID>' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.```
* - `net::ERR_CERT_DATE_INVALID` - Chrome error.
* - `Peer’s Certificate has expired.` - Firefox error. This error occurs when a server certificate expires.
*/
export type NetError = 'net::ERR_FAILED' | 'net::ERR_CERT_DATE_INVALID' | 'Peer’s Certificate has expired.';

0 comments on commit b81fd36

Please sign in to comment.