[whatwg] Script loading and execution order for importScripts
jonas at sicking.cc
Sun Mar 8 09:46:30 PDT 2009
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
> 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
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?
More information about the whatwg