[HN Gopher] Safari is adopting an extensions API similar to Fire...
       ___________________________________________________________________
        
       Safari is adopting an extensions API similar to Firefox's
       WebExtensions
        
       Author : skellertor
       Score  : 125 points
       Date   : 2020-06-23 15:00 UTC (8 hours ago)
        
 (HTM) web link (hacks.mozilla.org)
 (TXT) w3m dump (hacks.mozilla.org)
        
       | tester89 wrote:
       | What does this mean for Ad-blockers like UOrigin which were
       | removed after Apple disabled the API they used?
        
         | greenhatglack wrote:
         | Not much, lots of missing APIs currently to accurately port
         | uBlock to Safari, though not sure because it's incomplete or
         | omitted by design.
        
         | bluedays wrote:
         | I'm going to be downvoted for saying this but... ublock origin
         | actually does slow down rendering your webpage. I think that
         | it's sad that there seems to be so much pushback from vendors
         | in regards to options like ublock origin, but I have found
         | equally impressive results with system wide options like
         | adguard without it reducing the speed of pages rendering.
        
           | gorhill wrote:
           | uBlock Origin: https://www.debugbear.com/chrome-extension-
           | performance-looku...
           | 
           | I am skeptical system-wide blockers would slow down less,
           | especially considering the browser has to fire the network
           | requests no matter what, while in-browser blockers prevent
           | blocked network requests from being fired at all.
        
           | ivanche wrote:
           | Interesting, do you have any benchmarks proving this?
        
             | bluedays wrote:
             | I provided proof in a comment above yours. Let me know what
             | you think.
        
           | surround wrote:
           | Yes, I'm going to downvote you, but only because you
           | misunderstand how ad blocking works. uBlock _does_ marginally
           | slow down webpage render because it has to inject CSS rules
           | (cosmetic filters) to improve blocking quality. If you don't
           | want this feature, you can disable cosmetic filtering
           | entirely within uBlock's settings.
           | 
           | The problem with AdGuard is that they charge for system-wide
           | blocking which can be done for free with a hosts file or pi-
           | hole.
        
             | bluedays wrote:
             | You are being presumptuous about my knowledge in regards to
             | ad blocking. So I'll explain in further detail why I
             | personally use adblock, and why ublock is unnecessary.
             | 
             | First, the css rules are available on adguard as well. You
             | can actually review the documentation here:
             | https://kb.adguard.com/en/general/how-to-create-your-own-
             | ad-...
             | 
             | Second, adguard is free. There are certain premium
             | features, however. For instance, filtering ads outside of
             | your browser requires a premium license. However, if you
             | are comparing it to ublock this was already not a feature
             | that was available to you.
             | 
             | Of course, even that comes with an addendum, which is that
             | this is only something that you need to worry about on
             | mobile devices. Should you be using the desktop version you
             | will actually see that adguard is free and available here
             | on github: https://github.com/AdguardTeam/AdGuardHome
             | 
             | In regards to pi-hole. The cumbersome nature of pi-hole
             | makes it undesirable _for me_. There were many sites which
             | were blocked for inexplicable reasons the last time I used
             | a pi-hole and creating a whitelist for these sites requires
             | more work than is necessary. First you must navigate to the
             | portal, and then you must make changes to either the
             | whitelist, or remove a site from the blacklist depending
             | upon why the site is not accessible. It was not seamless
             | design. However, those that find this feature desirable
             | will find that adguard actually offers the same experience
             | with adguard home:
             | https://github.com/AdguardTeam/AdGuardHome
             | 
             | And as a matter of fact you will notice that there are
             | comparisons between ublock origin available on the github
             | page for your review. There are actually a number of
             | features which are missing from ublock which are simply not
             | possible with ublock origin. As for the accuracy of these
             | features you'll have to determine that on your own but you
             | can review them here: https://i.imgur.com/5fSLuHx.png
             | 
             | Also, ublock origin does not _marginally_ slow down a
             | webpage rendering. It _significantly_ slows down a webpage
             | rendering. As evidenced here:
             | 
             | With ublock origin: https://i.imgur.com/4NxOysN.png
             | 
             | without ublock origin: https://i.imgur.com/jIlof5e.png
             | 
             | That means that when you are running ublock origin your
             | browser is working at 87.85% capacity. Or in otherwords, a
             | 13.15% decrease in speed. To put this in real world terms
             | it would be similar to reducing the speed to 50mph* on a
             | road that was originally 60mph.
             | 
             | So feel free to keep using ublock origin. As a matter of
             | fact I also use it occasionally in a pinch. (It does, after
             | all, significantly speed up rendering of some webpages. I
             | find it especially useful on webmd.) However, for my daily
             | driver I find it to be a poor solution.
             | 
             | *Rounded down, the actual number is 52.11.
        
               | saagarjha wrote:
               | > That means that when you are running ublock origin your
               | browser is working at 87.85% capacity. Or in otherwords,
               | a 13.15% decrease in speed.
               | 
               | Not everyone is running Speedometer all day where there's
               | nothing to block.
        
               | bluedays wrote:
               | :| What?
        
               | surround wrote:
               | The point I was trying to make is that cosmetic filtering
               | slows down the browser, period. AdGuard is not more
               | efficient at applying CSS rules than uBlock.
        
               | gorhill wrote:
               | > That means that when you are running ublock origin your
               | browser is working at 87.85% capacity.
               | 
               | No it's not, at this point your are spreading FUD about
               | uBO.
               | 
               | This is a benchmark specialized for one thing, the
               | creation/deletion of DOM nodes, a completely unrealistic
               | scenario in the real world -- web sites do not repeatedly
               | create nodes just to have them deleted as soon as they
               | are inserted.
               | 
               | uBO's code which deals with the DOM represents a
               | _fraction_ of what uBO needs to do, and yet you
               | extrapolate the benchmark as if it represents _all_ the
               | work uBO does, leading to your nonsensical conclusion.
               | 
               | Here is how uBO compares to other comparable content
               | blockers with an actual real-world scenario, as per
               | recent debugbear benchmark[1] -- it's the least CPU
               | hungry of the bunch:
               | https://twitter.com/gorhill/status/1273263792785326085
               | 
               | Note that the above is a worst-case scenario for content
               | blockers, since this was about loading a page from
               | `example.com`, where nothing is blocked, consequently
               | where a content blocker acts only as an overhead.
               | 
               | * * *
               | 
               | [1] https://www.debugbear.com/blog/2020-chrome-extension-
               | perform...
        
             | stephenr wrote:
             | It's almost as if the browser should provide an method for
             | extensions to identify things to block, in a way that is
             | optimised for performance and privacy, rather than just
             | throwing even more JavaScript into the page.
        
               | jsjohnst wrote:
               | > It's almost as if the browser should provide an method
               | for extensions to identify things to block
               | 
               | Safari[0] has this and has had for a while now...
               | 
               | While maybe not as effective as uBlock Origin, I have
               | extensions I use that leverage that API on iOS and MacOS
               | that do a good enough job for my needs.
               | 
               | [0] https://developer.apple.com/documentation/safariservi
               | ces/cre...
        
               | aswan wrote:
               | Chrome has a beta extension API that does this: https://d
               | eveloper.chrome.com/extensions/declarativeNetReques...
               | 
               | However, this API could be used to optimize _some of_
               | (not all of) the networking filtering that uBO does.
               | Network filtering is distinct from cosmetic filtering,
               | the latter is what injects scripts into every page. The
               | uBO wiki has some nice documentation of the different
               | features, measurements of their overhead, etc. E.g.:
               | https://github.com/gorhill/uBlock/wiki/Doesn't-uBlock-
               | Origin...
        
               | stephenr wrote:
               | Does network filtering _not_ rely on JavaScript now?
        
               | aswan wrote:
               | The webRequest api uses javascript, but with code that
               | runs in the context of the extension, not code that is
               | injected into web pages. You can read a bit more here:
               | https://developer.mozilla.org/en-US/docs/Mozilla/Add-
               | ons/Web...
        
             | ameshkov wrote:
             | Let me please chime in. As AdGuard developer, I'd like to
             | comment on what you said and explain some details about how
             | it works.
             | 
             | First of all, AdGuard desktop and mobile apps are quite
             | different from hosts files or pi-hole. For instance,
             | they're also able to apply cosmetic rules. Also, and this
             | is really important on Android (unfortunately we can't do
             | that on iOS), AdGuard is able to apply different rules
             | depending on which app makes a request.
             | 
             | The common example is dealing Facebook Audience network. If
             | you need to block Facebook ads in third-party apps with Pi-
             | Hole, you'll have Facebook official apps broken as well.
             | With AG, you can keep the official FB app working and block
             | it in third-party apps at the same time.
             | 
             | Second, on every platform save for iOS, AdGuard filters
             | every network connection and not just DNS queries. There're
             | already multiple examples of apps (for instance, TikTok)
             | that switch to using DOH when they detect that there's DNS
             | filtering messing with their domains. Eventually, every
             | network-level blocker, pi-hole included, will have to
             | control all connections as DNS simply won't be enough.
             | 
             | Regarding Pi-Hole, we actually maintain a free and open
             | source alternative called AdGuard Home:
             | https://github.com/AdguardTeam/AdGuardHome
        
               | surround wrote:
               | > AdGuard desktop and mobile apps are quite different
               | from hosts files or pi-hole. For instance, they're also
               | able to apply cosmetic rules.
               | 
               | My understanding is that AdGuard desktop is equivalent to
               | hosts file + adblocking extension. Is that correct?
               | 
               | > AdGuard is able to apply different rules depending on
               | which app makes a request.
               | 
               | How is this possible without root?
               | 
               | > AdGuard filters every network connection and not just
               | DNS queries.
               | 
               | How can AdGuard filter secure connections (outside of the
               | browser)? Does AdGuard filter by IP address?
        
         | DavideNL wrote:
         | Apparently the uBO developer says still not possible:
         | 
         | https://reddit.com/r/uBlockOrigin/comments/hdz0bo/will_ubloc...
        
       | drenvuk wrote:
       | It's still gimped.
       | 
       | No blocking requests.
       | 
       | "Unlimited" storage (which is necessary for most non-trivial
       | extensions) is actually limited to 10MB.
       | 
       | You're stuck in Apple's app store which is equally as draconian
       | as Chrome's and Firefox's but now you have to pay $99/year.
       | 
       | No IndexedDB.
       | 
       | The extensions aren't usable on mobile.
       | 
       | I care little for Safari's users if I have to deal with all of
       | this.
        
         | danShumway wrote:
         | Agreed. This is a step in the right direction, but, "Firefox
         | works on Mac", is still the easiest, most straightforward
         | answer to anyone who's asking me, "how can I get a decent
         | adblocker for the web?"
         | 
         | Having a shared API matters for extensions primarily because it
         | makes it easier for a developer to say, "well, I might as well
         | throw that on the Apple store as well." But if Safari literally
         | can't do the things your extension needs it to do, then the API
         | is kind of a secondary concern.
        
           | stephenr wrote:
           | "Install one of the dozens of content blockers that work
           | across macOS and iOS" seems like a better answer than
           | "install a different browser".
        
             | danShumway wrote:
             | None of those content blockers work as well as uBlock
             | Origin. Maybe they work well enough for you, and that's
             | fine.
             | 
             | But if somebody asks me what the current state of
             | adblocking is and how they can get it, I'm not going to
             | pretend that Safari offers it.
        
               | ribosometronome wrote:
               | For the lay user, what's wrong with AdGuard's free
               | edition?
        
               | stephenr wrote:
               | Thanks so much for going into detail and not just "mine
               | is bettererer" like so many do.....
               | 
               | Oh wait.
        
             | foepys wrote:
             | Doesn't Apple's content blocking API limit the number of
             | rules at 50,000 rules per extension? uBlock Origin uses
             | 85,000 rules from EasyList alone. That's without country-
             | specific and privacy rules. I have about 180,000 active
             | rules at the moment.
        
               | saagarjha wrote:
               | That is correct. Many content blockers ship with multiple
               | extensions to try to get around this rule. (EasyList can
               | compress a bit, FWIW.)
        
         | kickscondor wrote:
         | I don't know. I mean, yes, I need 'blocked requests' and
         | 'unlimited storage' for my extension (http://fraidyc.at/).
         | However, at least I can give Safari users a taste of it - which
         | could either:
         | 
         | * draw them into fuller platforms for using it. (or)
         | 
         | * pressure safari to support more of the standard.
         | 
         | Stepping stones.
        
           | stephenr wrote:
           | I'd never heard of your extension before but IMO that is not
           | at all what I think of as a "browser extension" - it seems to
           | me that it's more using the browser as an application runtime
           | than actually providing more functionality for the current
           | page.
        
             | kickscondor wrote:
             | Well - you could look at it as extending the browser (into
             | a feed reader) rather than extending the current page.
        
         | smnthermes wrote:
         | > No blocking requests
         | 
         | Probably will happen in Firefox too, since Google controls W3C:
         | http://browserext.github.io/
        
           | drenvuk wrote:
           | I still don't understand why you're linking that. Can you be
           | more specific?
        
             | abrowne wrote:
             | Probably Chrome extension manifest version 3. See, eg
             | https://github.com/uBlockOrigin/uBlock-issues/issues/338
        
           | thayne wrote:
           | I hope not. there's no reason Firefox can't continue to
           | support it, even if it isn't standardized.
        
         | notatoad wrote:
         | >but now you have to pay $99/year.
         | 
         | to maintain an apple developer account you also need a mac or
         | iDevice with secure enclave, so even if these were actually
         | compatible with webextensions, you couldn't publish your
         | webextension for safari unless you were an apple user.
        
         | Jaxkr wrote:
         | Nobody really uses Safari except for on iPhones, and I suspect
         | I will drop dramatically as they're adding support for choosing
         | your own browser in iOS 14. Even among non-technical people I
         | know, nearly everyone replaces Safari with Chrome or FF. Even
         | my grandfather uses Chrome on his Mac and iPhone.
        
           | kitsunesoba wrote:
           | Third party browsers for iOS wrap the same WKWebView that
           | Safari uses. Safari isn't going away any time soon, even with
           | the ability to change default browser.
        
           | philistine wrote:
           | You use personal anecdote when we instead have dozens of
           | services that catalogue exactly how popular browsers are.
           | Look it up!
        
           | kjakm wrote:
           | >> Nobody really uses Safari except for on iPhones
           | 
           | Have you got _anything_ to back this up? I'm willing to bet
           | the majority of Mac users use Safari (given it's the default
           | browser). I use it and it's a lot less clunky than Chrome and
           | Firefox. I also repeatedly run into an attitude of "if my
           | users don't user Chrome then I don't care about their
           | experience" and find it very off putting.
        
             | MintelIE wrote:
             | I bet they don't. All the Mac Safari users I know also run
             | Firefox because Safari's ad blocking sucks.
             | 
             | I only know of a few Mac users of Chrome.
        
           | rimliu wrote:
           | I use Safari. Still the best and most memory efficient
           | experience.
        
           | acdha wrote:
           | Your "nobody" is not a representative sample: if you run a
           | general-purpose website, Safari will be something like 15-20%
           | of the total traffic which is more than most people are going
           | to write off as insignificant.
           | 
           | On iOS, even if they allow different browser apps they have
           | not apparently relaxed the restriction on the embedded
           | browser engine and that means Firefox or Chrome are different
           | UIs on top of a browser engine which is still Safari.
        
       | erdaniels wrote:
       | I really wanted to stick with Safari a little over two years ago
       | when I moved off of Google products. It was (is) snappy and
       | battery conversant. Beyond poor extension support, I realized the
       | absolutely most important features to me in a browser are
       | password, bookmark, and history synchronization. Since I use
       | Windows and macOS, Safari was out of the question (RIP Windows
       | edition of it). Thankfully in the last year Firefox has mad leaps
       | and bounds on performance and battery life consumption on macOS
       | (on Windows it is fantastic).
       | 
       | Also at the end of the day, you have what I believe is the most
       | unlimited ad-blocking experience on Firefox compared to Chrome,
       | Chromium, and Safari.
        
       | felixfbecker wrote:
       | As someone who works at a company with a web extension, one big
       | thing I care about is automated deployment. We have automated
       | releases with Chrome and Firefox (although it has to use
       | Puppeteer). The new Edgium recently wanted to get us to publish
       | but I found zero docs on potential automation so that's a
       | blocker. Wonder what process Safari has to offer here?
        
       | MBCook wrote:
       | Does this mean Safari may get the React or Redux extensions?
       | That's all I care about.
        
         | silviogutierrez wrote:
         | I'm hoping for that too. I really try to make Safari my daily
         | driver (performance, privacy, battery life). But the dev
         | experience is lacking.
         | 
         | Also the network tab is just... odd.
        
       | freediver wrote:
       | Apple had a great opportunity to natively support web extensions
       | in Safari. Instead they choose to do it through the app
       | extensions System. Meaning a developer needs to have and pay for
       | Apple dev account. They need to have a Mac to port and compile
       | it. They have to sign it. And then maintain it.
       | 
       | This will certainly affect adoption. Forcing an open standard
       | into a closed system seems intuitively wrong.
       | 
       | But at least kudos to Apple for recognizing the need for
       | webextensions support.
        
         | balladeer wrote:
         | At this point I think I should just switch to Firefox. It's
         | just that Firefox still (unfairly) lags behind in performance
         | because it's a Mac.
        
           | gabrielvincent wrote:
           | I think this is a worthy trade-off. The difference in
           | performance is not that big.
        
             | Synaesthesia wrote:
             | I still much prefer Safari so I spent like $2 on an ad-
             | blocker, not as good as ublock but my overall experience is
             | still the best IMO.
        
               | philistine wrote:
               | I did the same. It's strange to buy a Safari extension on
               | the App Store, but I bought stopthemadness and 1Blocker
               | and I've been satisfied for years.
        
           | kgermino wrote:
           | Why is Firefox slower on a Mac? I know Safari is (supposedly)
           | faster than a lot of the other options, but I haven't seen
           | anything about Apple slowing down other browsers on Macs[0].
           | 
           | [0] I know they force all browsers to use the same webkit
           | engine as Safari on mobile devices, and used to limit
           | competitors to an older slower version for "security reasons"
           | but AFAIK they don't slow down competitors on mobile anymore
           | and never have on Macs
        
             | quantummkv wrote:
             | It's not Apple that slows down Firefox on Mac. It's just
             | that Firefox cannot match the resources that apple and
             | google throw around on their browsers. Firefox has to be
             | economical on where their resources are directed towards.
             | And understandingly Macos specific optimizations not the
             | top priority.
        
               | MintelIE wrote:
               | They didn't have to rewrite everything in Rust thereby
               | harming performance to a large degree.
        
             | est31 wrote:
             | One component was Safari using unofficial APIs. But some of
             | these unofficial APIs have since been used by both Chrome
             | and Firefox as well.
        
           | miohtama wrote:
           | With Firefox ad blockers you get that performance back in
           | reduced download and CPU time spent in ad JavaScript.
        
           | ebg13 wrote:
           | Forget about performance. Firefox still lags horribly behind
           | in battery life.
        
             | dmix wrote:
             | Firefox natively suspends unused tabs which dramatically
             | improved my memory usage and battery life.
             | 
             | Chrome has a similar extension but it's nice having it
             | built in to the browser natively.
             | 
             | If anything you could argue that FF is behind Chrome
             | security-wise with their more limited sandboxing and some
             | other memory protections. But performance is largely a non-
             | issue.
        
             | fauigerzigerk wrote:
             | Not for me, because Firefox's reader view stops the entire
             | battery sucking JavaScript madness on the page I'm visiting
             | whereas Safari doesn't.
        
             | toyg wrote:
             | Everyone "lags behind" Safari in battery life on mac,
             | unsurprisingly: a mono-platform app can pull tricks that
             | multi-platform ones cannot.
             | 
             | When comparing apples to apples, Firefox imho is actually
             | lighter than Chrome on battery, at least on Macs.
        
         | reaperducer wrote:
         | I think it's worth looking at how Apple has gone about similar
         | changes in the past.
         | 
         | It dips its toe in the water. It then eases an ankle in. It
         | finally jumps in fully when it's ready to, and not before.
         | 
         | Along the way, the sort of developers who spend more time
         | posting on Twitter and HN than actually developing complain
         | about each of the first two steps being not enough, and when
         | the third comes moan about "monopoly" this and "lock-in" that.
         | 
         | Apple isn't going to make everyone happy. And it doesn't care
         | to. It brings what it feels its customers want. But it is
         | rarely rushed to something because it's cool or trendy. Apple
         | gets there when it is ready. The times when it has rushed, it's
         | botched the job. So I'm OK with Apple's measured approach.
         | 
         | If what Apple offers you today in Safari isn't what you want,
         | go Firefox.
        
       | AnonC wrote:
       | I don't have a lot of hopes that this will satisfy my needs. I
       | just want these extensions in Safari, to start with:
       | 
       | * uBlock Origin (confirmed as of now as not supported, and
       | unlikely to be supported in the future either, with content
       | blocking handled at the browser engine level)
       | 
       | * Privacy Possum or Privacy Badger
       | 
       | * Session Buddy or some good Session saving extension
        
         | baggachipz wrote:
         | Seriously. Not being able to block ads with Safari makes an
         | automatic no-go for me. Even if they make their own built-in ad
         | blocker, you can bet they'll let companies pay to become
         | "platinum sponsors". No thanks.
        
           | peruvian wrote:
           | I've been happy with Wipr on macOS and 1Blocker on iOS for
           | years. In fact I think you can just use 1Blocker in both
           | platforms now. Neither is as "good" as uBlock Origin but I
           | don't really care.
        
             | a2tech wrote:
             | I believe Wipr works on both iOS and macOS. I'm also a
             | happy Wipr user.
        
           | [deleted]
        
           | toyg wrote:
           | _> Not being able to block ads with Safari makes an automatic
           | no-go for me_
           | 
           | I actually turned it into a very specific use-case: when I
           | need to be tracked for cashback/referral purposes on big
           | purchases, I use Safari. Everything else goes on Firefox.
           | 
           | It's a bit ironic to use Apple software when I want _less_
           | privacy, after all their spiel.
        
           | olliej wrote:
           | The full app extension apis do let you do that (based on my
           | installed as blocker), there's just a bunch if restrictions
           | that apply to those extensions to prevent arbitrary content
           | manipulation (iirc).
        
         | newman314 wrote:
         | I've resisted upgrading to Catalina because of the missing
         | UBlock Origin support.
         | 
         | Does anyone know of a tool to migrate open Safari tabs to
         | Firefox?
        
           | rovr138 wrote:
           | You can bookmark open tabs to a folder.
           | 
           | On Firefox, Open All in Tabs
        
         | llacb47 wrote:
         | More info on uBlock Origin in safari:
         | https://reddit.com/r/uBlockOrigin/comments/hdz0bo/_/fvoc7wk/...
        
       ___________________________________________________________________
       (page generated 2020-06-23 23:00 UTC)