This is an archived snapshot of W3C's public bugzilla bug tracker, decommissioned in April 2019. Please see the home page for more details.

Bug 20578 - Need to define the interaction of "scripting is disabled/enabled" with script execution in various cases
Summary: Need to define the interaction of "scripting is disabled/enabled" with script...
Status: RESOLVED FIXED
Alias: None
Product: WHATWG
Classification: Unclassified
Component: HTML (show other bugs)
Version: unspecified
Hardware: Other other
: P3 normal
Target Milestone: Unsorted
Assignee: Ian 'Hixie' Hickson
QA Contact: contributor
URL: http://www.whatwg.org/specs/web-apps/...
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-01-06 16:36 UTC by contributor
Modified: 2013-06-06 19:41 UTC (History)
6 users (show)

See Also:


Attachments

Description contributor 2013-01-06 16:36:49 UTC
Specification: http://www.whatwg.org/specs/web-apps/current-work/
Multipage: http://www.whatwg.org/C#concept-n-script
Complete: http://www.whatwg.org/c#concept-n-script

Comment:
Need to define the interaction of "scripting is disabled/enabled" with script
execution in various cases

Posted from: 173.48.81.109
User agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.8; rv:20.0) Gecko/20121217 Firefox/20.0
Comment 1 Boris Zbarsky 2013-01-06 16:39:32 UTC
Right now, the only script execution in the spec that considers the "scripting is enabled" state seems to be execution of a <script> element.  At least the following cases should probably also consider it:

1)  on* attributes.
2)  setTimeout and event handler execution (which raises the question of whether
    the relevant script enabled state is that of the Window or Node the
    timeout/handler is set on, or that of the Window the Function comes from).
3)  Event listener execution (same question here as #2).

And in general, any time a script entry point is involved... maybe part of this should live in WebIDL or something?
Comment 2 Cameron McCormack 2013-01-06 22:03:07 UTC
It feels to me like most of this should go in Scripting section of the HTML spec, but one thing we could have in Web IDL is a definition for the parenthesized part of your (2).
Comment 3 Boris Zbarsky 2013-01-06 22:18:34 UTC
We could, but it might turn out that we need different answers for #2 in different cases due to web compat issues...  See https://bugzilla.mozilla.org/show_bug.cgi?id=827035
Comment 4 Ian 'Hixie' Hickson 2013-03-06 22:49:15 UTC
The HTML spec doesn't compile scripts when scripting is disabled. Once a script is compiled, if scripting is later disabled, the previously compiled scripts still run, except that "if scripting is disabled while a script is executing, the script should be terminated immediately".

Could you elaborate on what precisely you think the spec should say here?
Comment 5 Boris Zbarsky 2013-03-06 22:59:46 UTC
> The HTML spec doesn't compile scripts when scripting is disabled

Hmm.  I didn't see where this was specified.  I now see it's at <http://www.whatwg.org/specs/web-apps/current-work/#create-a-script>, right?

> Once a script is compiled, if scripting is later disabled, the previously
> compiled scripts still run

That's the behavior Gecko has right now (e.g. for event listeners), and users hate it.  They want scripts to turn off when they turn off scripts.  So we're planning to switch behavior where we keep script-enabled state per global and for every script entry point we check whether the corresponding global has script enabled before calling it.

It's worth checking what other UAs do or plan to do, of course.
Comment 6 Ian 'Hixie' Hickson 2013-03-08 22:09:33 UTC
Yeah, that makes more sense.
Comment 7 Ian 'Hixie' Hickson 2013-04-15 23:00:46 UTC
Should we still act as if we compile scripts when scripting is disabled? So that when they re-enable scripting, things work? Or should that require a reload?
Comment 8 Boris Zbarsky 2013-04-15 23:19:40 UTC
Hmm.  We should probably not compile them if scripting is disabled to avoid confusing syntax errors if nothing else...
Comment 9 Ian 'Hixie' Hickson 2013-04-26 22:25:51 UTC
Fair enough.
Comment 10 contributor 2013-06-06 19:41:43 UTC
Checked in as WHATWG revision r7917.
Check-in comment: Disabling scripting should actually disable scripting.
http://html5.org/tools/web-apps-tracker?from=7916&to=7917