<?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>23534</bug_id>
          
          <creation_ts>2013-10-16 16:29:18 +0000</creation_ts>
          <short_desc>freeze/seal/preventExtensions should throw for Nodes (and maybe any WebIDL interface)</short_desc>
          <delta_ts>2018-03-22 18:20:11 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebAppsWG</product>
          <component>WebIDL</component>
          <version>unspecified</version>
          <rep_platform>PC</rep_platform>
          <op_sys>All</op_sys>
          <bug_status>NEW</bug_status>
          <resolution></resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P2</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          <blocked>20567</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Bobby Holley (:bholley)">bobbyholley</reporter>
          <assigned_to name="Cameron McCormack">cam</assigned_to>
          <cc>annevk</cc>
    
    <cc>bruant.d</cc>
    
    <cc>bzbarsky</cc>
    
    <cc>mike</cc>
    
    <cc>public-script-coord</cc>
          
          <qa_contact>public-webapps-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>94849</commentid>
    <comment_count>0</comment_count>
    <who name="Bobby Holley (:bholley)">bobbyholley</who>
    <bug_when>2013-10-16 16:29:18 +0000</bug_when>
    <thetext>Freezing an object or calling preventExtensions theoretically means that the prototype is fixed. But there are cases in the DOM when we need to modify the prototype. In particular, this is the case for Nodes when adopted into the scope of a different global (see bug 20567).

jst and I think that we should just throw when trying to do any of these objects on any kind of WebIDL-defined object. Anne generally agrees, but there are some considerations about self-hosted DOMs to be considered.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94850</commentid>
    <comment_count>1</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2013-10-16 16:37:50 +0000</bug_when>
    <thetext>Domenic suggested an alternative: if changing the prototype throws because the object is extension-prevented, we could just bubble that exception from adopt.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>94851</commentid>
    <comment_count>2</comment_count>
    <who name="Bobby Holley (:bholley)">bobbyholley</who>
    <bug_when>2013-10-16 17:07:22 +0000</bug_when>
    <thetext>(In reply to Anne from comment #1)
&gt; Domenic suggested an alternative: if changing the prototype throws because
&gt; the object is extension-prevented, we could just bubble that exception from
&gt; adopt.

This could work. However, I&apos;m generally uneasy about it.

There are various places in internal Gecko algorithms where we need to munge the prototype - node reparenting, document.open, plugins, XBL, window navigation, etc. A lot of this is really delicate and sensitive code, and we can&apos;t afford to fail once we start. In the reparenting code, for example, we just crash if we encounter a failure partway through. We can&apos;t let script trigger that at will.

Theoretically, we could spec all the cases where this needs to happen, and carefully check this state before we get ourselves into one of those tights spots. But that&apos;s a pain, and a lot of effort to get right.

As an implementor, I&apos;d prefer to spec that this stuff just throws. This doesn&apos;t prevent someone from writing a DOM.js implementation that does something different in that case, because the web is very unlikely to start depending on things throwing. If that DOM.js implementation is viable modulo issues like this one, I&apos;m totally happy to respec to allow this kind of stuff. But I&apos;m not really wild about putting in engineering effort widening attack surface for unproven gains.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127374</commentid>
    <comment_count>3</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2016-09-13 12:09:07 +0000</bug_when>
    <thetext>Duplicate of bug 26490 I think?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127378</commentid>
    <comment_count>4</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2016-09-13 14:57:39 +0000</bug_when>
    <thetext>Not at all.  Bug 26490 is about the spec mechanism we use to prevent sealing/freezing for the objects we prevent it for.  This bug is about what objects we should prevent it for.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127379</commentid>
    <comment_count>5</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2016-09-13 15:01:15 +0000</bug_when>
    <thetext>Oh, that&apos;s still not decided upon? I thought we basically just disabled this for all platform objects...</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>127380</commentid>
    <comment_count>6</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2016-09-13 15:05:56 +0000</bug_when>
    <thetext>No, not at all.  Whyever would we do that?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>129109</commentid>
    <comment_count>7</comment_count>
    <who name="Anne">annevk</who>
    <bug_when>2018-03-22 18:20:11 +0000</bug_when>
    <thetext>I&apos;m no longer convinced we should pursue this.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>