JS engine in WebView

John C. Turnbull ozemale at ozemail.com.au
Thu May 9 20:40:07 PDT 2013


Thanks for the informative reply Richard :-)

Just out of interest and while we are on the topic, with the port to iOS
(and also to Android), what is going to happen to such components as
WebView?  I ask because I know that on iOS (at least) you are prohibited
from executing JavaScript using anything but the JS engine built into
Safari.  I imagine that Apple wouldn't be too happy about a browser embedded
inside a JavaFX node running JavaScript using the interpreter built into
WebKit.

Thanks,

John

-----Original Message-----
From: Richard Bair [mailto:richard.bair at oracle.com] 
Sent: Friday, 10 May 2013 13:25
To: John C. Turnbull
Cc: openjfx-dev at openjdk.java.net
Subject: Re: JS engine in WebView

Hi John,

On May 8, 2013, at 12:12 PM, John C. Turnbull <ozemale at ozemail.com.au>
wrote:

> I know that WebView uses WebKit but what actual JavaScript engine does it
use on Windows? I don't think WebKit forces you to use any particular
engine.

Well.. it goes like this. WebKit comes with JavaScriptCore by default, and
this is the JS engine that we use. It is pretty good. My understanding is
that JavaScriptCore (aka SquirrelFish aka Nitro) is the same JS engine used
by Safari[1]. When Chrome and Apple were both part of WebKit, one of the
abstraction layers that Google had put into WebKit was the ability to swap
out the JavaScript engine. When Google forked WebKit into Blink, the need
for the WebKit project to have an abstraction for a different JS VM
disappeared. As a consequence, the WebKit guys have been talking about
removing those abstractions such that you won't be able to swap out the JS
engine[2][3]. If/When that happens, it will be hard (or impossible) for us
to switch over to Nashorn for WebView. We aren't going to fork WebKit, so we
sort of have to follow along with what WebKit does.

> Will WebView eventually use Nashorn instead of what it's using currently!

Maybe, but maybe not for the reasons cited above. We will have to see how
this whole Apple / Google divorce plays out.

Richard

[1] http://trac.webkit.org/wiki/JavaScriptCore
[2]http://www.theregister.co.uk/2013/04/04/webkit_to_purge_chrome_code/
[3]https://lists.webkit.org/pipermail/webkit-dev/2013-April/024408.html

"Supporting V8 places a considerable burden on webkit, there are a number of
large, cumbersome and expensive abstractions required for to support
multiple JS engines (see the original discussions on the topic from many
years ago).

Additionally we will only be supporting JSC in WebKit2, so I don't think
anything could convince me at least that maintaining support for multiple JS
engines is good for the project." - Oliver Hunt=



More information about the openjfx-dev mailing list