News for hackers. Stuff that matters.
Re:Firefox’s Fight for the Future of the Web by radarsat1 on Sunday November 17, 2019 @06:48AM (#21557538)
How is it technically enforced though, I am curious. I mean, if I wrote an application that downloaded text files and rendered the text to the screen, I am sure that would be possible. If I wanted to add images to draw next to the text I am sure it is feasible. So how can one technically prohibit doing that? Implementation-wise, how is a web browser really that different from e.g. a video game?

Or is it only policy-enforced? Reviewers see something in an app that resembles a "browser" too much and take you down?

Re:Firefox’s Fight for the Future of the Web by capableweb on Sunday November 17, 2019 @06:53AM (#21557556)
My guess would be that it's policy-enforced and what Apple really has problems with is not browsers as a concept (dynamically loading and rendering data) but rather the execution engine that websites usually use (JavaScript) and seeing that as a too-large-to-review area where they want to avoid having vulnerabilities in applications published on App Store.

Or it's a anti-competitive move disguised as a "avoid vulnerabilities" but in reality they just really want to make sure iOS users keep using the one and only browser (Safari).

Re:Firefox’s Fight for the Future of the Web by marcthe12 on Sunday November 17, 2019 @07:54AM (#21557717)
Apple uses no Turing complete policy. So you also can't bundle a python or ruby interpreter in iOS. Its still anti-competitive but in a different area which is language and api. They are basically trying to push devs to use their native OS apis. PWA are also screwed up in Safari for a reason.
Re:Firefox’s Fight for the Future of the Web by Longhanks on Sunday November 17, 2019 @08:12AM (#21557776)
This is not true. There is for example the Pythonista IDE for iOS, which ships a full Python interpreter. https://omz-software.com/pythonista/
Re:Firefox’s Fight for the Future of the Web by labawi on Sunday November 17, 2019 @09:08AM (#21557947)
Is there an example of a non development/learning tool?
Re:Firefox’s Fight for the Future of the Web by vengefulduck on Sunday November 17, 2019 @01:09PM (#21559097)
If I remember correctly there’s an exception for learning and development tools.
Re:Firefox’s Fight for the Future of the Web by toxik on Sunday November 17, 2019 @08:09AM (#21557763)
That’s surely absurdly difficult to test, and provably impossible to prove the negative (i.e. my app is not Turing complete.) Is a calculator app not Turing complete? What about Google Sheets?
Re:Firefox’s Fight for the Future of the Web by danilocesar on Sunday November 17, 2019 @08:15AM (#21557787)
As long as it uses Apple's WebView, it's OK. This was the case for Firefox, they had to ditch Gecko in favor of using Apple's webview for iOS.
Re:Firefox’s Fight for the Future of the Web by dessant on Sunday November 17, 2019 @08:13AM (#21557781)
Kivy bundles Python in iOS apps, and the apps are accepted on the App Store. Do you have a link for this policy?
Re:Firefox’s Fight for the Future of the Web by saagarjha on Sunday November 17, 2019 @08:15AM (#21557789)
That likely falls under the “educational” exemption: https://developer.apple.com/app-store/review/guidelines/#sof...
Re:Firefox’s Fight for the Future of the Web by dessant on Sunday November 17, 2019 @08:18AM (#21557801)
That's unlikely, Kivy is also used for commercial apps. Bundling interpreters is allowed, but you must not use them to execute arbitrary code, unless you do it for educational purposes. Kivy doesn't load remote code, so it's not affected by this policy.
Re:Firefox’s Fight for the Future of the Web by saagarjha on Sunday November 17, 2019 @08:22AM (#21557811)
Then apps using it must ship all of their Python code in the app bundle to meet the App Store Review Guidelines.
Re:Firefox’s Fight for the Future of the Web by saagarjha on Sunday November 17, 2019 @08:08AM (#21557762)
> So you also can't bundle a python or ruby interpreter in iOS.

You can if it’s for educational purposes.

Re:Firefox’s Fight for the Future of the Web by beokop on Sunday November 17, 2019 @08:11AM (#21557771)
Pythonista is a full(-ish) offline Python IDE and has been on the App Store for years.
Re:Firefox’s Fight for the Future of the Web by JustSomeNobody on Sunday November 17, 2019 @07:06AM (#21557588)
interesting. But I can’t help but think by that logic Facebook should be too large to review.
Re:Firefox’s Fight for the Future of the Web by extropy on Sunday November 17, 2019 @07:35AM (#21557670)
Facebook does have code that dynamically compiles arbitrary input to machine code.

That's the part Apple is not allowing in third party apps.

Re:Firefox’s Fight for the Future of the Web by saagarjha on Sunday November 17, 2019 @08:09AM (#21557769)
> Facebook does have code that dynamically compiles arbitrary input to machine code.

Not outside of JavaScriptCore they don’t.

Re:Firefox’s Fight for the Future of the Web by sharpneli on Sunday November 17, 2019 @06:52AM (#21557553)
One cannot have writeable executable memory on iOS (apple can, we cannot).

Thus one cannot make a JIT compiler for js and thus pages are slow.

Game engines such as Unity use il2cpp to go from the C# stuff into C++ that can be statically compiled as running the C# as bytecode would be too slow without a jitter.

Re:Firefox’s Fight for the Future of the Web by radarsat1 on Sunday November 17, 2019 @06:56AM (#21557560)
Ah, so it is all about the javascript engine? Ok I can see how that might put up some major technical barriers, but still it should be technically feasible to have the firefox rendering engine make use of the iOS javascript engine, no? Maybe it's not worth the effort of course. I am just trying to get a feel for what the barriers are.
Re:Firefox’s Fight for the Future of the Web by sharpneli on Sunday November 17, 2019 @07:20AM (#21557622)
Not via public apis. So cannot be placed into app store.
Re:Firefox’s Fight for the Future of the Web by KonkeyDong69 on Sunday November 17, 2019 @07:34AM (#21557668)
In addition to what the other replies said, feel free to eyeball the code required to embed SpiderMonkey in Firefox at https://github.com/mozilla/gecko-dev/tree/master/dom/binding.... It's rather large and complex.
Re:Firefox’s Fight for the Future of the Web by padenot on Sunday November 17, 2019 @09:48AM (#21558090)
This is not at all the code to embed SpiderMonkey in Firefox, those are the bindings from DOM APIs to the implementation of those APIs in Firefox. Above that, calling into this layer, is another layer that transforms JS calls into C++ calls (roughly).

The interface between SpiderMonkey and the rest of Firefox is here: https://searchfox.org/mozilla-central/source/js/src/jsapi.h.

Re:Firefox’s Fight for the Future of the Web by vbezhenar on Sunday November 17, 2019 @07:22AM (#21557626)
I think that iOS JS engine is tied to WebView and it would be hard to re-use it with other rendering engine.
Re:Firefox’s Fight for the Future of the Web by saagarjha on Sunday November 17, 2019 @08:18AM (#21557802)
JavaScriptCore can be used can be used independently from the rest of WebKit, but I’d expect it to be slow.
Re:Firefox’s Fight for the Future of the Web by saagarjha on Sunday November 17, 2019 @08:17AM (#21557798)
> One cannot have writeable executable memory on iOS (apple can, we cannot).

Nitpick: you can but you cannot ship it via the App Store.

Re:Firefox’s Fight for the Future of the Web by shkkmo on Sunday November 17, 2019 @09:38AM (#21558046)
Apple as does not allow side-loading, so wouldn't a jailbreak be required?
Re:Firefox’s Fight for the Future of the Web by least on Sunday November 17, 2019 @10:45AM (#21558392)
Jailbreak, enterprise certificate, testflight, or a developer account would be required to sideload an app. You can technically sideload an app without a paid developer account, but the certificate only lasts seven days, at which point you'd have to reload the application.
Re:Firefox’s Fight for the Future of the Web by zzzcpan on Sunday November 17, 2019 @07:41AM (#21557684)
> One cannot have writeable executable memory on iOS (apple can, we cannot).

> Thus one cannot make a JIT compiler for js and thus pages are slow.

Lack of JIT doesn't slow down pages much. I believe the difference is so small that it might even be possible to be faster without JIT for most pages, especially on low power devices, it's only computation heavy pages that are going to suffer and even then it's not like you can't optimize common patterns statically ahead of time.

It doesn't mean that it's a good idea to invest into it, you are still under Apple's mercy and they clearly don't want competing browser engines.

Re:Firefox’s Fight for the Future of the Web by sharpneli on Sunday November 17, 2019 @08:17AM (#21557799)
If I have understood correctly (I’m a C++ graphics programmer. So don’t know too much about what’s flashy in the web world) V8 only jits. As in it can only produce machine code and there is not even an option to run it as an interpreter.
Re:Firefox’s Fight for the Future of the Web by saagarjha on Sunday November 17, 2019 @08:20AM (#21557806)
V8 has a high performance, JIT-less interpreter that disables TurboFan and relies exclusively on Ignition: https://v8.dev/blog/jitless
Re:Firefox’s Fight for the Future of the Web by chrisseaton on Sunday November 17, 2019 @09:15AM (#21557971)
> Lack of JIT doesn't slow down pages much.

So why do you think so many major companies invest such a huge amount of money in JS JITs? Google, Apple, Microsoft, Oracle, Mozilla all maintain JS JITs and spend what I guess is hundreds of millions of dollars a year on it.

Re:Firefox’s Fight for the Future of the Web by notacoward on Monday November 18, 2019 @08:31AM (#21564121)
A budget of $100M, with 50% devoted to salary and a median salary of $250K, would be 200 developers. I seriously doubt any of the companies you name are devoting even a quarter of that to JS JIT development. Yes, they each make significant investments, but let's not weaken the argument by indulging a penchant for hyperbole.
Re:Firefox’s Fight for the Future of the Web by chrisseaton on Monday November 18, 2019 @12:40PM (#21566289)
About 200 seems about right to me across all these companies. Have you worked on one of these teams?

> let's not weaken the argument by indulging a penchant for hyperbole

Please don’t be so dismissive and snide - there’s no need for that.

Re:Firefox’s Fight for the Future of the Web by notacoward on Monday November 18, 2019 @04:38PM (#21568384)
> About 200 seems about right to me across all these companies.

Then your initial estimate was way off, because you were suggesting multiple hundreds of millions and the average salary probably isn't that high.

> there’s no need for that

Honest argument wouldn't require such forceful correction.

Re:Firefox’s Fight for the Future of the Web by chrisseaton on Monday November 18, 2019 @05:41PM (#21568925)
I didn't say a hundred million per company.

> Honest argument wouldn't require such forceful correction.

Please try to tone it down.

Re:Firefox’s Fight for the Future of the Web by reubenmorais on Sunday November 17, 2019 @06:57AM (#21557563)
I don't know the details first hand, so take this with a grain of salt, but this is what I remember from talking to engineers who explored this possibility over the years:

You can't ship a native JIT (execute native code from the heap), I think it's enforced automatically by the App Store. So shipping your own JavaScript engine is out.

You can't download and interpret third-party code, I think this is enforced by human reviews, so shipping your own Web rendering stack is out.

You can use your own network stack with WebKit on top, which would let you offer some value to users like more advanced ad/tracker blocking.

Re:Firefox’s Fight for the Future of the Web by robin_reala on Sunday November 17, 2019 @07:27AM (#21557639)
This is exactly what Chrome on iOS did: they embedded their own networking stack, but reused WebKit and JSC.
Re:Firefox’s Fight for the Future of the Web by thekingofh on Monday November 18, 2019 @01:03PM (#21566502)
Thanks for the information. That part about disallowing third-party code interpreting is particularly painful to hear. They shut down any possibility of another browser. Could see that they do this for security reasons because a badly implemented interpreter could open up holes, but I'd imagine the sandbox is sufficient to allow at least interpreters.
Re:Firefox’s Fight for the Future of the Web by saagarjha on Sunday November 17, 2019 @08:14AM (#21557782)
Web content must be rendered through WebKit as per the App Store Review Guidelines (https://developer.apple.com/app-store/review/guidelines/). This is supposed to be enforced by App Store Review by inspection. In addition to this, there are technical reasons why your “browser” will be inferior to Apple’s web view performance-wise, mainly having to do with apps that generate code dynamically in-process needing entitlements that prevent submission to the review process.
Re:Firefox’s Fight for the Future of the Web by Yoric on Sunday November 17, 2019 @01:48PM (#21559312)
Policy-enforced.

Mozilla ported the true Firefox to iOS many, many years ago and Apple just rejected it from the store.