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

<bugzilla version="5.0.4.1"
          urlbase="https://bugs.webkit.org/"
          
          maintainer="admin@webkit.org"
>

    <bug>
          <bug_id>11399</bug_id>
          
          <creation_ts>2006-10-24 06:47:12 -0700</creation_ts>
          <short_desc>window.eval runs in the global scope of the calling window</short_desc>
          <delta_ts>2008-04-07 09:44:25 -0700</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>1</classification_id>
          <classification>Unclassified</classification>
          <product>WebKit</product>
          <component>WebCore JavaScript</component>
          <version>419.x</version>
          <rep_platform>Mac (PowerPC)</rep_platform>
          <op_sys>OS X 10.4</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc>http://www.fredck.com/bugs/safari/window_eval/window_eval.html</bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords>InRadar</keywords>
          <priority>P2</priority>
          <bug_severity>Normal</bug_severity>
          <target_milestone>---</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter>webkit</reporter>
          <assigned_to name="Nobody">webkit-unassigned</assigned_to>
          <cc>ap</cc>
    
    <cc>koivisto</cc>
    
    <cc>mrowe</cc>
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>50837</commentid>
    <comment_count>0</comment_count>
    <who name="">webkit</who>
    <bug_when>2006-10-24 06:47:12 -0700</bug_when>
    <thetext>If you call the following code in a window loaded inside an IFRAME:

    window.parent.eval( &apos;var MyObject = new Object();&apos; )

... &quot;MyObject&quot; is created at the &quot;window&quot; global scope, not at &quot;window.parent&quot;.

The URL points to a simple test case. It works well with IE, Firefox and Opera.

Any temporary workaround to evaluate a script in a specific window is welcome.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>49649</commentid>
    <comment_count>1</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2006-10-25 20:05:05 -0700</bug_when>
    <thetext>Confirmed in 418.9 and ToT.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45750</commentid>
    <comment_count>2</comment_count>
    <who name="Alexey Proskuryakov">ap</who>
    <bug_when>2006-11-14 22:05:27 -0800</bug_when>
    <thetext>(In reply to comment #0)
&gt; Any temporary workaround to evaluate a script in a specific window is welcome.

Will document.write()&apos;ing it there work?

May be related to bugs 3791, 7783.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>45704</commentid>
    <comment_count>3</comment_count>
    <who name="">webkit</who>
    <bug_when>2006-11-15 15:47:08 -0800</bug_when>
    <thetext>document.write will not work because the parent document has already been loaded. So, when calling document.write, the document will be cleared and a new stream will be opened.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44948</commentid>
    <comment_count>4</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2006-11-20 21:02:40 -0800</bug_when>
    <thetext>A workaround that will work is to insert a script element via DOM manipulation.  See &lt;http://bdash.net.nz/files/bug-11399-1.html&gt; for an example of a document in an iframe evaluating a script in the context of its parent document.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>44954</commentid>
    <comment_count>5</comment_count>
    <who name="">webkit</who>
    <bug_when>2006-11-21 02:12:05 -0800</bug_when>
    <thetext>Nice move Mark... your workaround worked like a charm. I was too concentrated on making eval working.

I&apos;ll be committing the changes I&apos;ve made on FCKeditor today, so the next nightly (of FCKeditor) will finally load in Safari (420+) (See bug #9915). It will not work properly, but at least will load. Now we can continue debugging further.

Thanks for it.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>34584</commentid>
    <comment_count>6</comment_count>
    <who name="Mark Rowe (bdash)">mrowe</who>
    <bug_when>2007-01-16 19:02:06 -0800</bug_when>
    <thetext>&lt;rdar://problem/4928617&gt;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>9379</commentid>
    <comment_count>7</comment_count>
      <attachid>14669</attachid>
    <who name="Geoffrey Garen">ggaren</who>
    <bug_when>2007-05-22 16:55:26 -0700</bug_when>
    <thetext>Created attachment 14669
test case for eval scope

Firefox, IE, Opera, and Safari all disagree about this.

IE has no eval method in inner windows.

Firefox uses the inner window as the front of the scope chain, the variable object, but not &apos;this&apos;.

Opera uses the inner window as the front of the scope chain, the variable object, and &apos;this&apos;.

Safari uses the outer window as the front of the scope chain and &apos;this&apos;, and a separate object that is not the inner window as the variable object.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>4984</commentid>
    <comment_count>8</comment_count>
    <who name="David Kilzer (:ddkilzer)">ddkilzer</who>
    <bug_when>2007-07-11 21:34:12 -0700</bug_when>
    <thetext>See also: http://bugs.webkit.org/show_bug.cgi?id=12912#c6

</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>546</commentid>
    <comment_count>9</comment_count>
    <who name="Antti Koivisto">koivisto</who>
    <bug_when>2007-09-13 07:59:04 -0700</bug_when>
    <thetext>Fixed along with &lt;rdar://problem/5445058&gt;

Sending        JavaScriptCore/ChangeLog
Sending        JavaScriptCore/kjs/function.cpp
Sending        LayoutTests/ChangeLog
Sending        LayoutTests/fast/js/window-eval-context-expected.txt
Sending        LayoutTests/fast/js/window-eval-context.html
Transmitting file data .....
Committed revision 25535.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>76510</commentid>
    <comment_count>10</comment_count>
    <who name="Timothy Hatcher">timothy</who>
    <bug_when>2008-04-07 09:44:25 -0700</bug_when>
    <thetext>Removed the wworkaround we hand in the Inspector in r31683.</thetext>
  </long_desc>
      
          <attachment
              isobsolete="0"
              ispatch="0"
              isprivate="0"
          >
            <attachid>14669</attachid>
            <date>2007-05-22 16:55:26 -0700</date>
            <delta_ts>2007-05-22 16:55:26 -0700</delta_ts>
            <desc>test case for eval scope</desc>
            <filename>scratch-eval-code.html</filename>
            <type>text/html</type>
            <size>452</size>
            <attacher name="Geoffrey Garen">ggaren</attacher>
            
              <data encoding="base64">PHNjcmlwdD4KZnVuY3Rpb24gbG9nKHMpCnsKICAgIGRvY3VtZW50LmdldEVsZW1lbnRCeUlkKCJw
cmUiKS5hcHBlbmRDaGlsZChkb2N1bWVudC5jcmVhdGVUZXh0Tm9kZShzICsgIlxyXG4iKSk7Cn0K
CndpbmRvdy5vbmxvYWQgPSBmdW5jdGlvbigpCnsKICAgIGZyYW1lc1swXS5ldmFsKCJ0b3AubG9n
KHdpbmRvdyA9PT0gdG9wKSIpOwogICAgZnJhbWVzWzBdLmV2YWwoInRvcC5sb2coZG9jdW1lbnQg
PT09IHRvcC5kb2N1bWVudCkiKTsKICAgIGZyYW1lc1swXS5ldmFsKCJ0b3AubG9nKHRoaXMgPT09
IHRvcCkiKTsKICAgIGZyYW1lc1swXS5ldmFsKCJ2YXIgeCA9IDE7IHRvcC5sb2codG9wLngpOyB0
b3AubG9nKHgpOyIpOwogICAgbG9nKGZyYW1lc1swXS54KTsKfQo8L3NjcmlwdD4KCjxpZnJhbWUg
c3JjPSJkYXRhOnRleHQvaHRtbCwiPjwvaWZyYW1lPgo8cHJlIGlkPSJwcmUiPjwvcHJlPgo=
</data>

          </attachment>
      

    </bug>

</bugzilla>