<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://www.w3.org/Bugs/Public/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.4"
          urlbase="https://www.w3.org/Bugs/Public/"
          
          maintainer="sysbot+bugzilla@w3.org"
>

    <bug>
          <bug_id>20578</bug_id>
          
          <creation_ts>2013-01-06 16:36:49 +0000</creation_ts>
          <short_desc>Need to define the interaction of &quot;scripting is disabled/enabled&quot; with script execution in various cases</short_desc>
          <delta_ts>2013-06-06 19:41:43 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WHATWG</product>
          <component>HTML</component>
          <version>unspecified</version>
          <rep_platform>Other</rep_platform>
          <op_sys>other</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.whatwg.org/specs/web-apps/current-work/#concept-n-script</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>Unsorted</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>cam</cc>
    
    <cc>ehsan</cc>
    
    <cc>ian</cc>
    
    <cc>jschoenick</cc>
    
    <cc>mike</cc>
          
          <qa_contact>contributor</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>80958</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-01-06 16:36:49 +0000</bug_when>
    <thetext>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 &quot;scripting is disabled/enabled&quot; 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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80960</commentid>
    <comment_count>1</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-01-06 16:39:32 +0000</bug_when>
    <thetext>Right now, the only script execution in the spec that considers the &quot;scripting is enabled&quot; state seems to be execution of a &lt;script&gt; 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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80968</commentid>
    <comment_count>2</comment_count>
    <who name="Cameron McCormack">cam</who>
    <bug_when>2013-01-06 22:03:07 +0000</bug_when>
    <thetext>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).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>80969</commentid>
    <comment_count>3</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-01-06 22:18:34 +0000</bug_when>
    <thetext>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</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84051</commentid>
    <comment_count>4</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-03-06 22:49:15 +0000</bug_when>
    <thetext>The HTML spec doesn&apos;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 &quot;if scripting is disabled while a script is executing, the script should be terminated immediately&quot;.

Could you elaborate on what precisely you think the spec should say here?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84056</commentid>
    <comment_count>5</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-03-06 22:59:46 +0000</bug_when>
    <thetext>&gt; The HTML spec doesn&apos;t compile scripts when scripting is disabled

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

&gt; Once a script is compiled, if scripting is later disabled, the previously
&gt; compiled scripts still run

That&apos;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&apos;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&apos;s worth checking what other UAs do or plan to do, of course.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84141</commentid>
    <comment_count>6</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-03-08 22:09:33 +0000</bug_when>
    <thetext>Yeah, that makes more sense.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86253</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-04-15 23:00:46 +0000</bug_when>
    <thetext>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?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86257</commentid>
    <comment_count>8</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2013-04-15 23:19:40 +0000</bug_when>
    <thetext>Hmm.  We should probably not compile them if scripting is disabled to avoid confusing syntax errors if nothing else...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>86903</commentid>
    <comment_count>9</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2013-04-26 22:25:51 +0000</bug_when>
    <thetext>Fair enough.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>88839</commentid>
    <comment_count>10</comment_count>
    <who name="">contributor</who>
    <bug_when>2013-06-06 19:41:43 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r7917.
Check-in comment: Disabling scripting should actually disable scripting.
http://html5.org/tools/web-apps-tracker?from=7916&amp;to=7917</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>