What’s new in Safari Web Extensions

RSS for tag

Discuss the WWDC22 Session What’s new in Safari Web Extensions

Posts under wwdc2022-10099 tag

5 Posts

Post

Replies

Boosts

Views

Activity

Safari web extension: DeclarativeNetRequest redirect rules
When using DeclarativeNetrequest, I get an error that "regexSubstitution" is not a valid action type. The full error message: "`redirect` is missing either a `url`, `extensionPath`, or `transform` key" Regex based conditions are supported, but regex substitution for the redirect action is not. Is this intended behaviour? Note: I'm calling the API as browser.declarativeNetRequest.updateDynamicRules({ addRules: [ { action: {redirect: {regexSubstitution: "https://www.somesite.com/\\1"}, type: "redirect"}, condition: {regexFilter: ".*?://test/(.*?)", resourceTypes: ["main_frame"]}, priority: 1, id: 1, } ]})
2
3
1.6k
Apr ’23
Safari Extension: Refused to connect to <site> because it does not appear in the connect-src directive of the Content Security Policy.
I'm trying to make a request using fetch to my api inside a safari extension background page. This is a manifest v3 extension converted from a chrome extension (which works). Inspecting the background page, I see an error message which reads Refused to connect to <site> because it does not appear in the connect-src directive of the Content Security Policy. I have tried setting a policy for default-src and connect-src in the extension_pages field of the content_security_policy key in the manifest.json file, but the error persists. How can I make a fetch request to an api in a background page?
4
2
2.3k
Apr ’23
Xcrun safari-web-extension-converter not being comprehensive enough
Dear Apple developers, First things first, on behalf of everyone, thank you for your immense hard work to make Safari a better browser every day. As a representative of multiple chrome extension businesses, we can’t wait to get on Safari to delight Apple users with their favourite extensions. We couldn’t be more happy to hear that xcrun safari-web-extension-converter will be able to convert our chrome extension to Safari for us until we realized that it’s no longer well supported as it keeps on showing that multiple manifest keys won’t be supported by the converter. Hence, we’re curious to know if the converter will be more comprehensive so that more chrome extensions can take the leap to Safari?
0
0
1.1k
Nov ’22
IOS Safari extensions losing connection in standalone (added to homescreen)
IOS Safari extensions loose connection when safari page gets saved as standalone on a mobile device. Create a sample IOS extension that has access to a standalone website such as (https://www.instagram.com) declared in manifest.json Write in content.js a functions that runs every 5 seconds & calls alert("checking") Go to (https://www.instagram.com) from the IOS safari stimulation & notice how the alert is getting reported every 5 second once you give the permission or enable it on instagram. Now add instagram.com as a homescreen & once you visit it you will realize that the alert is no longer coming despite user giving permission to run on (https://www.instagram.com). Why important to fix? Our users at beTimeful.com want to have mobile app to make their social media less addictive for themselves and their families to live a better life. However, we can only give them what they want once this petite bug gets fixed.
2
3
1.2k
Sep ’22
Web extension converter fails to accept valid manifest keys
Hi, I'm using the web extension converter (aptly named safari-web-extension-converter 😄) to try to convert a Firefox- or Chromium-based extension to work on Safari. When I run the program, I get the following output: Platform: macOS Language: Swift Warning: The following keys in your manifest.json are not supported by your current version of Safari. If these are critical to your extension, you should review your code to see if you need to make changes to support Safari: run_at browser_action webRequestBlocking version default_locale js matches manifest_version description options_ui <all_urls> scripts storage alarms webRequest web_accessible_resources name icons Of course, this doesn't make any sense. According to https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json (sorry, the Dev forums won't let me make a hyperlink to Mozilla...LOL), these keys are indeed valid for manifest V2 and should be supported by Safari. The compatibility chart also explicitly shows Safari supporting these keys(/APIs). The Apple Developer Docs page also doesn't mention these keys as being unsupported. Ultimately there's really no reason for the converter to be saying these blatant lies...smh. This error about unsupported manifest keys only brings up a few results on Google, as it seems this tool has been pretty neglected. As such, I suspect this is a problem with the converter. Any help, etc. would be appreciated — thanks!
1
1
1.2k
Aug ’22
Safari web extension: DeclarativeNetRequest redirect rules
When using DeclarativeNetrequest, I get an error that "regexSubstitution" is not a valid action type. The full error message: "`redirect` is missing either a `url`, `extensionPath`, or `transform` key" Regex based conditions are supported, but regex substitution for the redirect action is not. Is this intended behaviour? Note: I'm calling the API as browser.declarativeNetRequest.updateDynamicRules({ addRules: [ { action: {redirect: {regexSubstitution: "https://www.somesite.com/\\1"}, type: "redirect"}, condition: {regexFilter: ".*?://test/(.*?)", resourceTypes: ["main_frame"]}, priority: 1, id: 1, } ]})
Replies
2
Boosts
3
Views
1.6k
Activity
Apr ’23
Safari Extension: Refused to connect to <site> because it does not appear in the connect-src directive of the Content Security Policy.
I'm trying to make a request using fetch to my api inside a safari extension background page. This is a manifest v3 extension converted from a chrome extension (which works). Inspecting the background page, I see an error message which reads Refused to connect to <site> because it does not appear in the connect-src directive of the Content Security Policy. I have tried setting a policy for default-src and connect-src in the extension_pages field of the content_security_policy key in the manifest.json file, but the error persists. How can I make a fetch request to an api in a background page?
Replies
4
Boosts
2
Views
2.3k
Activity
Apr ’23
Xcrun safari-web-extension-converter not being comprehensive enough
Dear Apple developers, First things first, on behalf of everyone, thank you for your immense hard work to make Safari a better browser every day. As a representative of multiple chrome extension businesses, we can’t wait to get on Safari to delight Apple users with their favourite extensions. We couldn’t be more happy to hear that xcrun safari-web-extension-converter will be able to convert our chrome extension to Safari for us until we realized that it’s no longer well supported as it keeps on showing that multiple manifest keys won’t be supported by the converter. Hence, we’re curious to know if the converter will be more comprehensive so that more chrome extensions can take the leap to Safari?
Replies
0
Boosts
0
Views
1.1k
Activity
Nov ’22
IOS Safari extensions losing connection in standalone (added to homescreen)
IOS Safari extensions loose connection when safari page gets saved as standalone on a mobile device. Create a sample IOS extension that has access to a standalone website such as (https://www.instagram.com) declared in manifest.json Write in content.js a functions that runs every 5 seconds & calls alert("checking") Go to (https://www.instagram.com) from the IOS safari stimulation & notice how the alert is getting reported every 5 second once you give the permission or enable it on instagram. Now add instagram.com as a homescreen & once you visit it you will realize that the alert is no longer coming despite user giving permission to run on (https://www.instagram.com). Why important to fix? Our users at beTimeful.com want to have mobile app to make their social media less addictive for themselves and their families to live a better life. However, we can only give them what they want once this petite bug gets fixed.
Replies
2
Boosts
3
Views
1.2k
Activity
Sep ’22
Web extension converter fails to accept valid manifest keys
Hi, I'm using the web extension converter (aptly named safari-web-extension-converter 😄) to try to convert a Firefox- or Chromium-based extension to work on Safari. When I run the program, I get the following output: Platform: macOS Language: Swift Warning: The following keys in your manifest.json are not supported by your current version of Safari. If these are critical to your extension, you should review your code to see if you need to make changes to support Safari: run_at browser_action webRequestBlocking version default_locale js matches manifest_version description options_ui <all_urls> scripts storage alarms webRequest web_accessible_resources name icons Of course, this doesn't make any sense. According to https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/manifest.json (sorry, the Dev forums won't let me make a hyperlink to Mozilla...LOL), these keys are indeed valid for manifest V2 and should be supported by Safari. The compatibility chart also explicitly shows Safari supporting these keys(/APIs). The Apple Developer Docs page also doesn't mention these keys as being unsupported. Ultimately there's really no reason for the converter to be saying these blatant lies...smh. This error about unsupported manifest keys only brings up a few results on Google, as it seems this tool has been pretty neglected. As such, I suspect this is a problem with the converter. Any help, etc. would be appreciated — thanks!
Replies
1
Boosts
1
Views
1.2k
Activity
Aug ’22