<?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>11839</bug_id>
          
          <creation_ts>2011-01-23 02:27:32 +0000</creation_ts>
          <short_desc>window.opener needs to be writable, not readonly (as it is in Gecko, Chrome, IE)</short_desc>
          <delta_ts>2011-08-04 05:15:40 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>HTML WG</product>
          <component>LC1 HTML5 spec</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/#the-window-object</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>P3</priority>
          <bug_severity>normal</bug_severity>
          <target_milestone>---</target_milestone>
          <dependson>11844</dependson>
          
          <everconfirmed>1</everconfirmed>
          <reporter>contributor</reporter>
          <assigned_to name="Ian &apos;Hixie&apos; Hickson">ian</assigned_to>
          <cc>bzbarsky</cc>
    
    <cc>cam</cc>
    
    <cc>erights</cc>
    
    <cc>hsteen</cc>
    
    <cc>ian</cc>
    
    <cc>mike</cc>
    
    <cc>mounir</cc>
    
    <cc>public-html-admin</cc>
    
    <cc>public-html-wg-issue-tracking</cc>
    
    <cc>w3c</cc>
    
    <cc>w3c</cc>
          
          <qa_contact name="HTML WG Bugzilla archive list">public-html-bugzilla</qa_contact>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>44624</commentid>
    <comment_count>0</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-01-23 02:27:32 +0000</bug_when>
    <thetext>Specification: http://www.whatwg.org/specs/web-apps/current-work/multipage/browsers.html
Section: http://www.whatwg.org/specs/web-apps/current-work/#the-window-object

Comment:
window.opener needs to be writable, not readonly

Posted from: 71.184.125.56</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44625</commentid>
    <comment_count>1</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-01-23 02:29:56 +0000</bug_when>
    <thetext>In particular, Gecko allows setting it to null, and web pages rely on this.  So does Safari, Chrome, Opera, and IE.  I haven&apos;t tested what other values it can be set to; Gecko doesn&apos;t allow any values other than null for unprivileged scripts.

Testcase:

  file1: &lt;div onclick=&quot;window.open(&apos;file2.html&apos;)&quot;&gt;click me&lt;/div&gt;

  file2: &lt;script&gt;
           alert(window.opener);
           window.opener = null;
           alert(window.opener);
         &lt;/script&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44626</commentid>
    <comment_count>2</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-01-23 02:37:42 +0000</bug_when>
    <thetext>Er, that test doesn&apos;t test what I want to test.  This one does:

file1.html: &lt;div onclick=&quot;window.open(&apos;file2.html&apos;)&quot;&gt;click me&lt;/div&gt;

file2.html: &lt;script&gt;
              alert(window.opener);
              window.opener = null;
              window.location.href = &quot;file3&quot;;
            &lt;/script&gt;

file3.html: &lt;script&gt;alert(window.opener);&lt;/script&gt;

This alerts &quot;[object DOMWindow]&quot; twice in Safari, &quot;[object DOMWindow]&quot; and then &quot;null&quot; in Chrome, &quot;[object Window]&quot; and then &quot;null&quot; in Gecko, &quot;[object Window]&quot; twice in Opera, &quot;[object]&quot; and &quot;null&quot; in IE.

So it looks like the property is just replaceable in Opera and Safari, but is both replaceable _and_ writable in Gecko, IE, and Chrome.

Cameron is cced because once this property is writable WebIDL needs to define what it means for a property to be both writable _and_ replaceable.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44737</commentid>
    <comment_count>3</comment_count>
    <who name="Adam Barth">w3c</who>
    <bug_when>2011-01-26 05:40:09 +0000</bug_when>
    <thetext>Yeah, this needs to be settable to null.  Browsers differ on whether the null value persists across navigations, as I recall.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44738</commentid>
    <comment_count>4</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-01-26 05:43:24 +0000</bug_when>
    <thetext>Well, it&apos;s settable to null for the current page given existing spec text (because it&apos;s replaceable, so writing to it shadows the property).

I suppose I could write a testcase that grabs the getter off the prototype after setting to null and calls it on the window, etc... but I&apos;m not sure browsers&apos; ES5 support is far enough along to make that sane.

So in the meantime, a simple way to tell apart replacement and assignment seems to be navigation.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44739</commentid>
    <comment_count>5</comment_count>
    <who name="Adam Barth">w3c</who>
    <bug_when>2011-01-26 05:51:22 +0000</bug_when>
    <thetext>My understanding is that opener resists being set to random values, but I could be mistaken.  It&apos;s been a while since I studied it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44740</commentid>
    <comment_count>6</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-01-26 05:54:48 +0000</bug_when>
    <thetext>Yeah, the only value it needs to allow setting to is null.  But that needs to persist across navigations, imo (which it does in Chrome, Gecko, and IE).</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45830</commentid>
    <comment_count>7</comment_count>
    <who name="Ian &apos;Hixie&apos; Hickson">ian</who>
    <bug_when>2011-02-18 22:45:52 +0000</bug_when>
    <thetext>EDITOR&apos;S RESPONSE: This is an Editor&apos;s Response to your comment. If you are satisfied with this response, please change the state of this bug to CLOSED. If you have additional information and would like the editor to reconsider, please reopen this bug. If you would like to escalate the issue to the full HTML Working Group, please add the TrackerRequest keyword to this bug, and suggest title and text for the tracker issue; or you may create a tracker issue yourself, if you are able to do so. For more details, see this document:
   http://dev.w3.org/html5/decision-policy/decision-policy.html

Status: Partially Accepted
Change Description: see diff given below
Rationale: Wow, there&apos;s little interop on this. WebKit lets you set it to anything, Firefox throws if you set it to a non-Window and ignores setting it to a Window, IE lets you set it to anything but changes it&apos;s value to an Error object...

Anyway I&apos;ve made it a mutable non-replaceable attribute except that the only value it can take is null, all other Window values are ignored and all other values cause a TypeError in WebIDL. nulls neuter the browsing context so that any Window objects in that browsing context, including past ones, will start returning null instead.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45831</commentid>
    <comment_count>8</comment_count>
    <who name="">contributor</who>
    <bug_when>2011-02-18 22:46:24 +0000</bug_when>
    <thetext>Checked in as WHATWG revision r5906.
Check-in comment: Change how window.opener works to allow it to be set to &apos;null&apos; and have that persist past page load.
http://html5.org/tools/web-apps-tracker?from=5905&amp;to=5906</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>46600</commentid>
    <comment_count>9</comment_count>
    <who name="Boris Zbarsky">bzbarsky</who>
    <bug_when>2011-03-10 02:15:21 +0000</bug_when>
    <thetext>How compatible is making this non-replaceable?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>53611</commentid>
    <comment_count>10</comment_count>
    <who name="Michael[tm] Smith">mike</who>
    <bug_when>2011-08-04 05:15:40 +0000</bug_when>
    <thetext>mass-move component to LC1</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>