<?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>18048</bug_id>
          
          <creation_ts>2008-03-24 14:14:06 -0700</creation_ts>
          <short_desc>The &quot;thisObject&quot; parameter to JSEvaluateScript is not used properly</short_desc>
          <delta_ts>2008-03-24 19:27:59 -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>JavaScriptCore</component>
          <version>525.x (Safari 3.1)</version>
          <rep_platform>Mac</rep_platform>
          <op_sys>OS X 10.5</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</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>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Scott Thompson">easco</reporter>
          <assigned_to name="Sam Weinig">sam</assigned_to>
          
          

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>75005</commentid>
    <comment_count>0</comment_count>
    <who name="Scott Thompson">easco</who>
    <bug_when>2008-03-24 14:14:06 -0700</bug_when>
    <thetext>I created some code that tried to use JSEvaluateScript to pass a script to an object.  My expectation was that the script would be evaluated in the context of the object passed into the &quot;thisObject&quot; parameter, but I found that the script is always evaluated in the global context.

For example, I tried to do something like

JSObjectRef myDocumentObject = GetObjectRefForDocument(&lt;some document here&gt;);
JSEvaluateScript(jsContext, myScript, myDocumentObject, ... other args ...);

I wanted to pass the script:

this.addDocumentElement()

but that came up with a type error.  I had to use:

this.documents[0].addDocumentElement()

Which says to me that the script was evaluated in my global context, and not the context of my document object.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>75041</commentid>
    <comment_count>1</comment_count>
    <who name="Sam Weinig">sam</who>
    <bug_when>2008-03-24 19:27:59 -0700</bug_when>
    <thetext>Fix landed in r31267.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>