-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
browser
polyfill cleanup, debugging improvements
#3615
Conversation
if (!("browser" in globalThis)) { | ||
// @ts-expect-error For debugging only | ||
globalThis.browser = browser; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This lets us finally use browser.*
APIs in the console.
pageScript
also has a similar jQuery global, so I thought I'd expose that too.
@@ -33,7 +32,7 @@ export async function ensureAuth( | |||
} | |||
|
|||
try { | |||
const token = await chromeP.identity.getAuthToken({ | |||
const token = await browser.identity.getAuthToken({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
chromeP
was only ever used because browser
lacked the types. I fixed this a while ago:
await browser.tabs.reload(browser.devtools.inspectedWindow.tabId); | ||
|
||
browser.runtime?.reload(); // Not guaranteed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we request the reload, browser.tabs
becomes unavailable, so the rest fails.
@@ -15,11 +15,10 @@ | |||
* along with this program. If not, see <http://www.gnu.org/licenses/>. | |||
*/ | |||
|
|||
const { tabId } = chrome.devtools.inspectedWindow; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was inexplicably providing a tabId
global type available in every file. 😰
Mysteries of TypeScript.
this.status = status; | ||
Object.setPrototypeOf(this, Error.prototype); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remnant of pre-class X extends Error
times
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small fixes I made along the way that didn't fit anywhere else. Details in the commits title and in the reviews