Post

Replies

Boosts

Views

Activity

Safari Web Extensions: tabs.onRemoved unexpectedly thrown on url changed.
I have noticed that tabs.onRemoved works differently in Safari 18 comparing to other browsers and Safari 17. Open a tab e.g. apple.com Take note of the active tab id using this code: browser.tabs.query({currentWindow: true, active: true}, (x) => console.log(x[0].id)) Add a listener on onRemoved: browser.tabs.onRemoved.addListener(console.log) on the active tab, navigate to e.g. https://developer.mozilla.org Take note of the active tab id again (using the same tabs.query). Expect: there should be no console.log of onRemoved. the active tab id stays the same. Actual: there is a console.log of onRemoved. the active tab id is changed. Please help. If this is a bug introduced in Safari 18, it would break a lot of JS Web extensions.
1
0
359
Oct ’24
Safari Web Extensions: storage.local.get unexpectedly returns undefined
I have noticed that storage.local.get API works differently in Safari 18 compare to other browsers and Safari 17. browser.storage.local.set({abc: 123}) browser.storage.local.get(console.log) // {abc: 123} browser.storage.local.get({abc: null}, console.log) // expect {abc: 123} but got undefined instead. According to MDN, storage.local.get should work with an object with object names as keys and the default value as value. According to Safari 18 Release notes, this may be related to a fix: 'Fixed getting an empty key from storage. (99440265) (FB11427769)'.
2
1
415
Oct ’24
runtime.onMessageExternal API doesn't work
According to Assessing Your Safari Web Extension’s Browser Compatibility and https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/runtime/onMessageExternal, runtime.onMessageExternal API should work in Safari 14. However, the reality is different. Scenario: having two web extensions; say A (with runtime.id = '123'), and B (with runtime.id = 'xyz'). go to the Web Inspector of B and run this: chrome.runtime.onMessageExternal.addListener((message, sender, sendResponse) => {console.log(${sender.id})}) This should make B wait for an external message. go to the Web Inspector of A and run this: chrome.runtime.sendMessage('xyz', {message: 'whatever'}) Expect: '123' is printed on the Web Inspector of B This works perfectly fine on Chrome. Actual: Nothing on the Web Inspector of B Got a Promise on the Web Inspector of A -- {result: undefined, status: "resolved"} Please confirm this is a bug and please fix.
1
0
899
Jun ’21
The tabs.onUpdated extension API is not fully supported.
According to https://developer.apple.com/documentation/safariservices/safari_web_extensions/assessing_your_safari_web_extension_s_browser_compatibility, tabs.onUpdated should be fully supported. However, I have noticed that the changeInfo only contains 'status'. This is insufficient because it does not give enough information what has actually changed on a tab. For example, 'url' is expected to be in the changeInfo if tab's URL has changed. See https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/API/tabs/onUpdated#changeInfo. Note: already submitted a feedback to Safari via apple standard feedback channel. Don't know what will happen with that as I have never heard anything back from Apple. Coming from Microsoft platform, I find Apple awkwardly unreachable. And they don't provide enough information on their documentation. Do you guys share the same feelings? or it's just me.
3
0
1.6k
Dec ’20
OAuth Redirect URL in (the new) Safari Web Extension
I am porting my chrome extension to Safari. The extension requires the user to sign-in and I use the OAuth code flow, which requires a redirect url. In Chrome, I can use chrome.runtime.getURL('/mypage.html') as a redirect url because in chrome the extension id is never changed. In Safari, however, the extension id keeps changing in every (xcode) build. This is similar to the behaviour of Firefox but in Firefox, I can use browser.identity.getRedirectURL(). Although not reachable, it guarantees to stay the same. As in Safari, there is NO browser.identity and safari-web-extension:// is blocked by Safari, what url can I use as a redirect URL?
5
0
3.7k
Dec ’20