W3C home > Mailing lists > Public > whatwg@whatwg.org > March 2009

[whatwg] Script loading and execution order for importScripts

From: Jonas Sicking <jonas@sicking.cc>
Date: Sun, 8 Mar 2009 09:46:30 -0700
Message-ID: <63df84f0903080946q209c899ag85ae4012121a6fa6@mail.gmail.com>
On Sat, Mar 7, 2009 at 10:04 PM, Oliver Hunt <oliver at apple.com> wrote:
>
> Why do you think it's important not to have side effects for syntax
> errors but don't think it's important to not have side effects for
> run-time errors? Given that we simply can't fix the latter, I don't
> see any advantage to users to attempt to fix the former.
>
> I really don't think optimizing for the case when something has gone
> wrong is the way to go. That is an extremely rare case in a deployed
> application, and so optimizing for performance feels much more
> important to users.
>
> Also considering how applications are likely to handle these errors,
> I.e. full abort and tell user that an unrecoverable error has
> occurred, it doesn't really matter if there have been side effects or
> not.
>
> The primary situation i'm imagining could happen is one script starts
> manipulating a client side database onload (maybe ?a?conscious?decision to
> do db work while waiting for io), then the next script fails to load due to
> (say) a network failure, then your left with side effects they may not be
> reasonably recoverable. ?Arguably this design should be considered flawed
> anyway, but people tend to test under ideal conditions more often than not.
> ?The counter argument is that protecting developers from their own
> foolishness is not a goal.

In this scenario there is no need to do syntax checking on all scripts
before executing them though, as the random-failure is introduced in
the network layer. So if all scripts successfully load there is no
reason to start running.

But in general I think the scenario you're describing is fairly
unlikely. It seems more likely that pages are importing libraries and
such and do database manipulations from functions called from the main
page.

Put it this way, is the scenario you are describing a problem today
where several <script> tags will cause the first one to execute even
if the second has a network problem?

/ Jonas
Received on Sunday, 8 March 2009 09:46:30 GMT

This archive was generated by hypermail 2.2.0+W3C-0.50 : Wednesday, 30 January 2013 18:47:49 GMT