<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div><div>On Jan 22, 2008, at 6:48 AM, Ashish Agrawal wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">Hi David,</blockquote><div>Hi Ashish,</div><br><blockquote type="cite"><br> <br> i am working on the same problem with Ankush.<br> <br> We tried your solution and it worked, but we have one additional<br> problem, WebFrame::windowObjectCleared() is triggered for each frame<br> refresh so our handler gets called each time. </blockquote><div><br class="webkit-block-placeholder"></div><div>Not sure how this is a problem as IIRC the JS interpreter is created new each time a frame is loaded, inc reloads. So you would need to reattach each time. In my code, I manage the list of attached handlers in this function, and just re-attach them at this point.&nbsp;</div><br><blockquote type="cite"><br> <br> Before our handler is called, the frame gets destroyed and we see a<br> segmentation fault in our handler.</blockquote><div>It is hard to tell what your handler is doing to cause the sigsegv, could it be running and trying to call into JS after the frame is destroyed? If this is the case, you could listen for the frame load events and stop running when a frame load occurs.</div><div><br class="webkit-block-placeholder"></div><div>Cheers</div><div>Davidc</div><br><blockquote type="cite"><br> <br> Can you suggest any way by which prevent calling of our handler for each frame refresh.<br> <br> Thanks<tt></tt><br> Ashish<tt></tt><br> <br> <br><br><div class="gmail_quote">On Jan 19, 2008 6:05 PM, David Carson &lt;<a href="mailto:dacarson@gmail.com">dacarson@gmail.com</a>&gt; wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> Ankush,<br>I have run into this same problem too, and I was pointed to<br>WebFrame::windowObjectCleared(). If you re-attach your handler in that<br>method, everything will work, including frames and iframes.<br><br>For Mac look at: <br>WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm<br>WebKit/mac/WebCoreSupport/WebFrameBridge.mm<br>Windows:<br>WebKit/win/WebFrame.cpp<br>Gtk:<br>WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp<br><br>Cheers<br>Davidc <br><div><div></div><div class="Wj3C7c"><br>On Fri, Jan 18, 2008 at 10:48 AM, &nbsp;&lt;<a href="mailto:jligman@mindspring.com">jligman@mindspring.com</a>&gt; wrote:<br>&gt;<br>&gt; Hi Ankush,<br>&gt;<br>&gt; Not sure if this is exactly the right way to do this, or what your looking <br>&gt; for, but I think something like the following might work.<br>&gt;<br>&gt; KJS::Window* window &nbsp;= KJS::Window::retrieveWindow(frame);<br>&gt; if (window) {<br>&gt; &nbsp; &nbsp; ExecState* exec = window-&gt;interpreter()-&gt;globalExec(); <br>&gt; &nbsp; &nbsp; window-&gt;put( exec, "your object name here", your object here,<br>&gt; KJS::DontDelete );<br>&gt; }<br>&gt;<br>&gt; Thanks<br>&gt; Joe<br>&gt;<br>&gt;<br>&gt;<br>&gt; -----Original Message-----<br> &gt; From: ankush tiwari<br>&gt; Sent: Jan 18, 2008 7:55 AM<br>&gt; To: <a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br>&gt; Subject: [webkit-dev] Runtime JSObject<br>&gt;<br>&gt; Hi All,<br> &gt;<br>&gt; We are creating a run time JSObject "myImplementation" by using the NPN<br>&gt; framework (C binding) available in webkit. Currently we are facing a problem<br>&gt; that our object is not getting recognized when we navigate to a new page. <br>&gt;<br>&gt; (Note: Our object is not released, its just not getting recognized in the<br>&gt; new page's interpreter context)<br>&gt;<br>&gt; We want to retain our object till the time the interpreter is valid but we <br>&gt; are not able to do so. We observed that for every script handler a context<br>&gt; is created and if we put our code in KJSProxy::evaluate and insert our<br>&gt; object every time its working fine.<br>&gt;<br>&gt; But this way we are creating too many unnecessary instances of our object. <br>&gt;<br>&gt; Can someone suggest a better way for retaining the object throughout the<br>&gt; interpreters life cycle?<br>&gt;<br>&gt; Thanks,<br>&gt; Ankush.<br>&gt;<br></div></div>&gt; _______________________________________________ <br>&gt; &nbsp;webkit-dev mailing list<br><div class="Ih2E3d">&gt; &nbsp;<a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org</a><br></div>&gt; &nbsp;<a href="http://lists.webkit.org/mailman/listinfo/webkit-dev" target="_blank"> http://lists.webkit.org/mailman/listinfo/webkit-dev</a><br>&gt;<br>&gt;<br>_______________________________________________<br>webkit-dev mailing list<br><div class="Ih2E3d"><a href="mailto:webkit-dev@lists.webkit.org">webkit-dev@lists.webkit.org </a><br></div><a href="http://lists.webkit.org/mailman/listinfo/webkit-dev" target="_blank">http://lists.webkit.org/mailman/listinfo/webkit-dev</a><br></blockquote></div><br></blockquote></div><br></div></body></html>