<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Feb 3, 2014, at 9:04 AM, Honey <<a href="mailto:honeysaini88@gmail.com">honeysaini88@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><meta http-equiv="content-type" content="text/html; charset=utf-8"><div dir="auto"><div style="-webkit-text-size-adjust: auto;">I have exposed a function setObject() through webkit idl. Suppose i have a javascript class like</div><div style="-webkit-text-size-adjust: auto;"><span class="kwd" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;"><br></span></div><div style="-webkit-text-size-adjust: auto;"><span class="kwd" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">function</span><span class="pln" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;"> </span><span class="typ" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">Player</span><span class="pln" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">()</span><span class="pln" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;"> </span><span class="pun" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">{</span><span class="pln" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">var</span><span class="pln" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;"> speed </span><span class="pun" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;"> </span><span class="lit" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">5</span><span class="pun" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">var</span><span class="pln" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;"> x </span><span class="pun" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;"> </span><span class="lit" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">50</span><span class="pun" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">;</span><span class="pln" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">
</span><span class="kwd" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">var</span><span class="pln" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;"> y </span><span class="pun" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">=</span><span class="pln" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;"> </span><span class="lit" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">50</span><span class="pun" style="background-color: rgba(255, 255, 255, 0); margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">;}</span></div></div></blockquote><div><br></div><div>I presume you meant:</div><div><br></div><div>function Player() { this.speed = 5; this.x = 50; this.y = 50; }</div><div><br></div><div>Since your original code means that the variables speed, x, and y are local and therefore dead at the point where you call setObject().</div><br><blockquote type="cite"><div dir="auto"><div><pre class="default prettyprint prettyprinted" style="margin-top: 0px; margin-bottom: 10px; padding: 5px; border: 0px; vertical-align: baseline; overflow: auto; width: auto; max-height: 600px; word-wrap: normal;"><code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; white-space: normal; -webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);"><font face="UICTFontTextStyleBody"><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">var p = new Player();</span></font></code></pre><pre class="default prettyprint prettyprinted" style="margin-top: 0px; margin-bottom: 10px; padding: 5px; border: 0px; vertical-align: baseline; overflow: auto; width: auto; max-height: 600px; word-wrap: normal;"><span style="font-family: UICTFontTextStyleBody; background-color: rgba(255, 255, 255, 0); white-space: normal; -webkit-text-size-adjust: auto;">setObject(p);</span></pre><pre class="default prettyprint prettyprinted" style="margin-top: 0px; margin-bottom: 10px; padding: 5px; border: 0px; vertical-align: baseline; overflow: auto; width: auto; max-height: 600px; word-wrap: normal;"><code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; white-space: normal; -webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);"><font face="UICTFontTextStyleBody"><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;"><br></span></font></code></pre><pre class="default prettyprint prettyprinted" style="margin-top: 0px; margin-bottom: 10px; padding: 5px; border: 0px; vertical-align: baseline; overflow: auto; width: auto; max-height: 600px; word-wrap: normal;"><code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; white-space: normal; -webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);"><font face="UICTFontTextStyleBody"><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">In webkit, i am getting the p as JSValue object. I want to retrieve the value of x through this JSValue object. how can i do that?</span></font></code></pre></div></div></blockquote><div><br></div><div>JSValue has this API:</div><div><br></div><div> JSValue::get(ExecState*, PropertyName)</div><div><br></div><div>So, jf you have "JSValue p" then you can do something like:</div><div><br></div><div> JSValue x = p.get(exec, Identifier(exec, "x"))</div><div><br></div><div>Where "exec" is an ExecState* or CallFrame* that you have lying around. If you're in the C++ code for your setObject(), then presumably someone is passing you one of those things, somehow.</div><div><br></div><div>-Filip</div><div><br></div><br><blockquote type="cite"><div dir="auto"><div><pre class="default prettyprint prettyprinted" style="margin-top: 0px; margin-bottom: 10px; padding: 5px; border: 0px; vertical-align: baseline; overflow: auto; width: auto; max-height: 600px; word-wrap: normal;"><code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; white-space: normal; -webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);"><font face="UICTFontTextStyleBody"><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;">any help would be appreciated..</span></font></code></pre><pre class="default prettyprint prettyprinted" style="margin-top: 0px; margin-bottom: 10px; padding: 5px; border: 0px; vertical-align: baseline; overflow: auto; width: auto; max-height: 600px; word-wrap: normal;"><code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; white-space: normal; -webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);"><font face="UICTFontTextStyleBody"><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;"><br></span></font></code></pre><pre class="default prettyprint prettyprinted" style="margin-top: 0px; margin-bottom: 10px; padding: 5px; border: 0px; vertical-align: baseline; overflow: auto; width: auto; max-height: 600px; word-wrap: normal;"><code style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline; white-space: normal; -webkit-text-size-adjust: auto; background-color: rgba(255, 255, 255, 0);"><font face="UICTFontTextStyleBody"><span class="pun" style="margin: 0px; padding: 0px; border: 0px; vertical-align: baseline;"><br></span></font></code></pre><span style="-webkit-text-size-adjust: auto;">Sent from my iPad</span></div></div>_______________________________________________<br>webkit-dev mailing list<br><a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br>https://lists.webkit.org/mailman/listinfo/webkit-dev<br></blockquote></div><br></body></html>