[webkit-dev] GlobalScript in WebKit

Michael Davidson mpd at google.com
Tue Dec 1 10:44:39 PST 2009


Truthfully, the current situation with Gmail tearoffs is way, way worse in
terms of versioning. We use the Closure Compiler for our JS, which means
that a tearoff window opened from the main window might not be able to get
necessary data from the main window! (Even for slow tearoffs we get some
data from the main window.)

Gmail (and I'd imagine most sophisticated apps) has a notion of version that
the client understands. The situation with SharedScript would be analogous
to how Chrome auto-updates - you'd just have to shut the app down to get the
new version.

We plan on mitigating this by using AppCache to preload new versions of the
script so that the reload is fast, but overall I don't think this is a big
problem.

Michael


On Tue, Dec 1, 2009 at 10:41 AM, Charles Reis <creis at chromium.org> wrote:

> One question about version conflicts and how they might get worse; sorry if
> it's already been addressed.  What happens if a user has an old version of
> an application like Gmail open and then tries to open a new window to the
> app, after developers have added new features?  I presume the new window is
> stuck talking to the old version of the SharedScript?
>
> Version conflicts are obviously already possible (without SharedScripts) if
> an old application opens a new window and tries to talk to it.  Today,
> though, it's at least mostly safe to have a week-old copy of an app open and
> then load a separate, newer version in a different window.  (I'm doing that
> right now with Gmail.)  With SharedScripts in place, it seems like either
> (1) the new version of the app would have to detect the old SharedScript and
> deal with it or (2) the user would continue to see errors until he reloaded
> all the open app windows to get the new version.  And would reloading be
> sufficient, or would he have to close all the app windows to make the
> SharedScript go away?
>
> Basically, SharedScripts make multiple windows more dependent on each
> other.  There's a lot of benefits to that, though it could also make
> problems like version conflicts more common.  Have there been any thoughts
> on ways to address this, or should it be left to web developers?  (I didn't
> see anything in the design doc.)
>
> Charlie
>
>
> On Tue, Dec 1, 2009 at 9:33 AM, Drew Wilson <atwilson at google.com> wrote:
>
>> On Tue, Dec 1, 2009 at 9:15 AM, Michael Davidson <mpd at google.com> wrote:
>>
>>>
>>>
>>> A third improvement: When we adopt the HTML5 notification API for showing
>>> users new mail or incoming chat notifications we will only show one
>>> notification regardless of the number of Gmail tabs that are open. Today
>>> each window would have to show a notification. That one just occurred to me,
>>> I'm sure we can come up with others.
>>>
>>> Michael
>>>
>>
>> FWIW, we've been pushing developers to use SharedWorkers to manage their
>> notifications for exactly this reason. It's fairly trivial to do so, since
>> notifications are fundamentally an async API anyway. But agreed that
>> SharedScript would also work for this.
>>
>> -atw
>>
>>
>>>
>>>   - Maciej
>>>>
>>>>
>>>> I sense that there's some pushback due to a Google property requesting a
>>>> feature that Google engineers are trying to get into the browser, but I
>>>> think that Gmail is emblematic of all large web apps. Shared workers have
>>>> their place, but that place is not sharing the UI code for large apps.
>>>>
>>>> I saw a comment that forcing multiple windows of one application into
>>>> the same process is undesirable. I disagree. Gmail is not a CPU-bound
>>>> application. We believe that the savings of having one JS heap, one request
>>>> queue, one data store, etc. would outweigh the benefits of process
>>>> isolation.
>>>>
>>>> 3) Should SharedScript be added to WebKit?
>>>>
>>>> I'm not a WebKit developer, so I'm not as qualified to comment. However,
>>>> I believe that SharedScript is a feature that many apps would use. We tried
>>>> to come up with a representative set of examples in the spec. We're happy to
>>>> come up with more. I don't believe that SharedWorkers will solve those
>>>> scenarios. I doubt that developers inside or outside of Google will move to
>>>> a totally async programming model.
>>>>
>>>> Sorry that this initial mail is also a little scattered. I'll try to
>>>> stay on top of the conversation as it progresses, and will hopefully be able
>>>> to provide a perspective from the trenches of web development.
>>>>
>>>> Michael
>>>>
>>>>
>>>> On Mon, Nov 30, 2009 at 6:16 PM, Drew Wilson <atwilson at google.com>wrote:
>>>>
>>>>> Following up, I think this highlights the distinct set of use cases
>>>>> that shared workers and shared script address:
>>>>>
>>>>> SharedWorkers are a great platform for when you have a single database
>>>>> that is shared across multiple instances of your web app, and you want to
>>>>> coordinate updates to that database. I can imagine sharing a single
>>>>> connection to the server, etc via SharedWorkers.
>>>>>
>>>>> SharedScripts are a good platform for when you want to share data/code
>>>>> (for example, the immense body of Javascript used to implement the Gmail UI)
>>>>> across multiple windows. I can't speak to whether passing a hidden iframe
>>>>> between windows as was suggested in the other thread would address this use
>>>>> case sufficiently.
>>>>>
>>>>> -atw
>>>>>
>>>>>
>>>>> On Mon, Nov 30, 2009 at 6:11 PM, Drew Wilson <atwilson at google.com>wrote:
>>>>>
>>>>>> I believe that the offline gmail team uses the Gears flavor of shared
>>>>>> workers and is planning to migrate to the HTML5 version once DB access is
>>>>>> supported from within worker context in shipping browsers.
>>>>>>
>>>>>> So I guess that Gmail would be a candidate app that has asked for
>>>>>> both.
>>>>>>
>>>>>> -atw
>>>>>>
>>>>>>
>>>>>> On Mon, Nov 30, 2009 at 6:08 PM, Maciej Stachowiak <mjs at apple.com>wrote:
>>>>>>
>>>>>>>
>>>>>>> On Nov 30, 2009, at 3:43 PM, Dmitry Titov wrote:
>>>>>>>
>>>>>>>  I don't think it's correct to say that SharedWorkers are not useful
>>>>>>>> and "we need a SharedScript instead". They are different things and can
>>>>>>>> address different use cases. For example, SharedWorker is great to make sure
>>>>>>>> there is only one 'app instance' running - exactly because it is shared
>>>>>>>> inter-process, it can be used as a "inter-process synchronization primitive"
>>>>>>>> to control how many app instances are opened. SharedScript is a container
>>>>>>>> for data and code shared between pages that comprise a "web application" and
>>>>>>>> normally run in the same process. As in native apps, whether or not multiple
>>>>>>>> instances of the app can run at the same time depends on the author of the
>>>>>>>> app, and can be done either way.
>>>>>>>>
>>>>>>>
>>>>>>> Are there any Web apps at Google or elsewhere currently using
>>>>>>> SharedWorker? Would any of them still use it if they could switch to
>>>>>>> SharedScript? Has any app team specifically requested support for *both*
>>>>>>> SharedWorker *and* SharedScript? (Serious questions, since the justification
>>>>>>> for SharedScript is largely based on Web developer feedback.)
>>>>>>>
>>>>>>> Note: if SharedScript was really globally shared it could be used to
>>>>>>> implement shared workers - simply have the SharedScript manage the per-app
>>>>>>> Workers.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Maciej
>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> webkit-dev mailing list
>>>>>>> webkit-dev at lists.webkit.org
>>>>>>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> webkit-dev mailing list
>>>>> webkit-dev at lists.webkit.org
>>>>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>>>>
>>>>>
>>>> _______________________________________________
>>>> webkit-dev mailing list
>>>> webkit-dev at lists.webkit.org
>>>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>>>
>>>>
>>>>
>>>
>>
>> _______________________________________________
>> webkit-dev mailing list
>> webkit-dev at lists.webkit.org
>> http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev
>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20091201/ddecb3d7/attachment.html>


More information about the webkit-dev mailing list