Weirdly, in Safari desktop 17.4.1 (19618.1.15.11.14), if you destructure const { getURL } = browser.runtime; the getURL variable will contain a version of the function that can be executed, but returns undefined for every string value I tested.
I don't actually know if this a bug or an execution detail per se. Probably a bug? When I log browser.runtime I see:
So it seems like, in Safari's implementation, getURL() is not a direct property of runtime. I assume this isn't fundamentally the issue—you can destructure inherited methods, right? I never played with this—but, I dunno, maybe some runtime binding is missing, whatever, this is not my area of expertise. Also this is technically through browser-polyfill but I think the result was the same when I tried const { getURL } = browser.runtime; vs chrome.runtime.getURL so that shouldn't matter.
Anyway, this PR removes this pattern and restores functionality in Safari. We don't support or publish to Safari, so this only helps people who install it themselves.
I mostly wanted to make the PR to refer to in case I ever get around to bug reporting this to Safari.
Description
Weirdly, in Safari desktop 17.4.1 (19618.1.15.11.14), if you destructure
const { getURL } = browser.runtime;
the getURL variable will contain a version of the function that can be executed, but returnsundefined
for every string value I tested.I don't actually know if this a bug or an execution detail per se. Probably a bug? When I log
browser.runtime
I see:So it seems like, in Safari's implementation, getURL() is not a direct property of
runtime
. I assume this isn't fundamentally the issue—you can destructure inherited methods, right? I never played with this—but, I dunno, maybe some runtime binding is missing, whatever, this is not my area of expertise. Also this is technically through browser-polyfill but I think the result was the same when I triedconst { getURL } = browser.runtime;
vschrome.runtime.getURL
so that shouldn't matter.Anyway, this PR removes this pattern and restores functionality in Safari. We don't support or publish to Safari, so this only helps people who install it themselves.
I mostly wanted to make the PR to refer to in case I ever get around to bug reporting this to Safari.
Testing steps