Skip to content
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

feature: maybe it's time to rethink the possibility of porting to Safari #52

Open
2 of 8 tasks
dminca opened this issue Jan 6, 2021 · 26 comments
Open
2 of 8 tasks
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@dminca
Copy link

dminca commented Jan 6, 2021

Just asking if it's possible to make this wonderful extension available for Safari now, given the following article published by Apple Developers in regards to converting web extensions for Safari

https://developer.apple.com/news/?id=qiz0arxc

Prerequisites

  • I verified that this is not a filter issue
  • This is not a support issue or a question
  • I performed a cursory search of the issue tracker to avoid opening a duplicate issue
    • Your issue may already be reported.
  • I tried to reproduce the issue when...
    • uBlock Origin is the only extension
    • uBlock Origin with default lists/settings
    • using a new, unmodified browser profile
  • I am running the latest version of uBlock Origin
  • I checked the documentation to understand that the issue I report is not a normal behavior

Description

[Description of the bug or feature]

A specific URL where the issue occurs

[A specific URL is MANDATORY for issue happening on a web page, even if it happens "everywhere"]

Steps to Reproduce

  1. [First Step]
  2. [Second Step]
  3. [and so on...]

Expected behavior:

[What you expected to happen]

Actual behavior:

[What actually happened]

Your environment

  • uBlock Origin version:
  • Browser Name and version:
  • Operating System and version:
@uBlock-user uBlock-user added the invalid This doesn't seem right label Jan 6, 2021
@emikaadeo-git
Copy link

Hi,
maybe we can reconsider this with new experimental uBOLite MV3 API-based content blocker ?
Safari have support for MV3 extensions since version 15.4 https://webkit.org/blog/12445/new-webkit-features-in-safari-15-4/#safari-web-extensions

@gorhill
Copy link
Member

gorhill commented Sep 20, 2022

I don't have MacOS, this would have to be undertaken by a another volunteer developer.

Anyways, the implementation of declarativeNetRequest API on Safari is missing key capabilities for the current state of uBOL, it does not support conditions such as initiatorDomains, excludedInitiatorDomains, requestDomains, excludedRequestDomains. It also does not support action types redirect which will be needed once uBOL starts to use this capability.

Additionally, the Safari scripting API is also missing key capabilities, namely registeredContentScript, getRegisteredContentScript, unregisterContentScripts, updateContentScripts.

@emikaadeo-git
Copy link

@gorhill
Hi,
thanks for clarification.

@henryhchchc
Copy link

Just noticed that Apple added support for redirect 10 months ago as mentioned in https://webkit.org/blog/12193/release-notes-for-safari-technology-preview-139/

Added support for the redirect rule type in declarativeNetRequest, which requires host permissions to be granted for the host of the URL being redirected

I think this feature is available in Safari 16 but Apple haven't updated their documentation.

@abarisain
Copy link

It looks like safari 16.4, in beta, adds support for a lot of what is missing
image

That said, there is still this ridiculous requirement for it to be wrapped in an app, so someone will have to do that.

@wavded
Copy link

wavded commented Apr 3, 2023

Safari 16.4 is out of beta now, not sure how close this gets us.

@dminca
Copy link
Author

dminca commented Apr 3, 2023

I’ve posted on Mastodon to Jen and Jon from the WebKit team, let’s see if they’re considering the missing capabilities mentioned by Raymond https://mastodontech.de/@dminca/110135906549832299

@helvetiica
Copy link

Any updates for Safari 17 (macOS Sonoma)?

@gorhill gorhill transferred this issue from uBlockOrigin/uBlock-issues Jun 27, 2023
@gorhill
Copy link
Member

gorhill commented Jun 27, 2023

Transferring the issue to uBO Lite issues repo because if ever there is a port to Safari, that will be MV3 uBO Lite, not uBO, which requires MV2.

@gorhill gorhill reopened this Jun 27, 2023
@MasterKia MasterKia added enhancement New feature or request and removed invalid This doesn't seem right labels Jun 27, 2023
@Knaledge
Copy link

Knaledge commented Jul 5, 2023

Are there currently any other barriers to entry for restarting development of the Safari Extension for uBOL? Perhaps there is an opportunity to engage the broader community to alleviate some of those impediments (if there are any)

@stephenhawk8054
Copy link
Member

Are there currently any other barriers to entry for restarting development of the Safari Extension for uBOL?

Maybe the only barrier is someone willing to fork and develop it for Safari?

@hadig
Copy link

hadig commented Aug 23, 2023

Converting the firefox variant with the safari-web-extension-converter seems to work somehow out of the box on macOS Sonoma.
The dashboard is blank, but extension badge is updating blocked ads count.
Ad blocking seems to work, except youtube video ads.

@arjpar
Copy link

arjpar commented Sep 7, 2023

@hadig I'm also willing to work on porting UBO Lite with whatever code you have. Since UBO is such a highly used extension I'm sure there are others (even if few) that may be willing to work on porting it (UBO Lite) to Safari.

@khesed
Copy link

khesed commented Sep 8, 2023

Made a PR: #71

@aayushbhatia06
Copy link

I know uBlock team is famous for not taking donations (for all the right reasons I might add) but just wanted to say if another interested developer would like to develop but has monetary hurdles myself and a LOT of other Safari users would be happy to contribute.

@Webtapper
Copy link

Is there any update on this issue/suggestion?
And also want to re-iterate I would also gladly donate just for starting uBlock Origin for Safari development again :)

@arjpar
Copy link

arjpar commented Mar 9, 2024

@Webtapper There's no update that I know of. A PR was made and rejected because Safari's implementation of DNR (declarativeNetRequest) lacks some specific features that uBO-Lite on Chrome/(Firefox?) requires to function properly. There was no minimal viable product in the PR. I'd be more than happy to develop a port, without donations, but I need to check how much support for DNR the Safari team has added. The WebKit devs have moved the project to GitHub, and they're willing to engage with the developer community. I'm sure I/someone else can look at Safari's documentation for DNR and see what is missing/implemented for an MVP for Safari to come to fruition.

In the PR I mentioned above, @gorhill stated that specific APIs weren't supported by Safari's DNR implementation, and an investigation was/is needed to figure out which APIs are and are not supported.

Like I said above, I'd be more than happy to port uBO-Lite to safari, I just haven't had the time. The requirement for a Safari extension to also be published on the app store and fulfilling the requirements for that ($100 for a dev license) is also one thing that may put a strain on a port.

Hopefully this answered your question!

@stephenhawk8054
Copy link
Member

Just FYI that any volunteers who want to take a look can check the table comparison of Safari's MV3 ability here: https://github.com/uBlockOrigin/uBOL-home/wiki/Availability-of-MV3-APIs-used-by-uBOL

I think it's better to PR and complete the table with clear sources first to have a better picture of Safari's compatibility with uBOL.

@arjpar
Copy link

arjpar commented Mar 9, 2024

For/to all those concerned, I'll be starting work on a port here, and then eventually pushing upstream.

@arjpar
Copy link

arjpar commented Mar 9, 2024

so update: it will need work to get it to work on safari. i have the extension running, but its very buggy and actually breaks safari haha. it doesn't support "storage" or "type" keys in the manifest, which may prevent a mvp until apple adds those keys.

@gorhill
Copy link
Member

gorhill commented Mar 9, 2024

it doesn't support "storage" or "type" keys in the manifest

There is a manifest.json version for each platform, so having a specific one for Safari is fine:

For Edge, it's a patched version of Chromium manifest.json because the web-accessible-resources had to reside at the root of
the extension directory (patcher).

Once you have a proper Safari-compliant manifest.json, then it will be a matter of finding out which APIs are missing or behave differently in Safari.

@Webtapper
Copy link

Thanks @arjpar. I do not have the knowledge to help with any technical challenges here - but if we are at the stage of needing to raise $100 for the developer license I’d love to contribute as well. I’ll follow it here and appreciate your updates so far!!

@arjpar
Copy link

arjpar commented Apr 4, 2024

For those wondering, I'll be posting updates here

@arjpar
Copy link

arjpar commented Apr 17, 2024

Due to the issues explained here which explains the problems I've run into, a port of uBlock Origin Lite to Safari is currently not possible. It is, however, possible to make an excellent free & open source wide spectrum (ad blocker) content blocker for Safari using the relevant Safari-specific APIs and technologies for content blocking. But that is beyond the scope of my port, and it would not be a port of uBlock Origin Lite, it would be either a fork or a new project altogether. I don't have the time, effort, or knowledge of Apple ecosystem development to create such an extension. I welcome anyone who has those things to consider creating it if they want to. For the aforementioned reasons my Safari port of uBlock Origin Lite will cease development. (All the work I've been doing so far was locally) I doubt Apple will release the needed MV3 DNR APIs soon given that they have their own Safari specific ways of doing things. If they do eventually release those APIs and don't neuter them, I probably won't be working on a port, due to the previous reasons of not creating a new Safari ad block project - time, effort, and knowledge.

@MisutaaAsriel
Copy link

MisutaaAsriel commented Apr 17, 2024

Fair enough. You are correct in that Safari has its own APIs which serve similar purposes (and in some ways, I would argue have benefits over DNR APIs, but at the expense of cross-compatibility), so a Safari port would likely be its own thing at this point, which hybridizes compatible uBlock methods with Safari specific Content Blocking methods.

Likewise, whilst App Store distribution isn't necessary, the extension being unsigned or otherwise signed by an unrecognized signing authority would make distribution more cumbersome.

Thank you for at least trying and/or looking into it. As a Safari user looking to move away from AdGuard, the attempt was appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests