On Jan 22, 2008, at 6:48 AM, Ashish Agrawal wrote:
Hi David,
Hi Ashish,
i am working on the same problem with Ankush.
We tried your solution and it worked, but we have one additional
problem, WebFrame::windowObjectCleared() is triggered for each frame
refresh so our handler gets called each time.
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.
Before our handler is called, the frame gets destroyed and we see a
segmentation fault in our handler.
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.
Cheers
Davidc
Can you suggest any way by which prevent calling of our handler for
each frame refresh.
Thanks
Ashish
On Jan 19, 2008 6:05 PM, David Carson <[EMAIL PROTECTED]> wrote:
Ankush,
I have run into this same problem too, and I was pointed to
WebFrame::windowObjectCleared(). If you re-attach your handler in that
method, everything will work, including frames and iframes.
For Mac look at:
WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
WebKit/mac/WebCoreSupport/WebFrameBridge.mm
Windows:
WebKit/win/WebFrame.cpp
Gtk:
WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
Cheers
Davidc
On Fri, Jan 18, 2008 at 10:48 AM, <[EMAIL PROTECTED]> wrote:
>
> Hi Ankush,
>
> Not sure if this is exactly the right way to do this, or what your
looking
> for, but I think something like the following might work.
>
> KJS::Window* window = KJS::Window::retrieveWindow(frame);
> if (window) {
> ExecState* exec = window->interpreter()->globalExec();
> window->put( exec, "your object name here", your object here,
> KJS::DontDelete );
> }
>
> Thanks
> Joe
>
>
>
> -----Original Message-----
> From: ankush tiwari
> Sent: Jan 18, 2008 7:55 AM
> To: [email protected]
> Subject: [webkit-dev] Runtime JSObject
>
> Hi All,
>
> We are creating a run time JSObject "myImplementation" by using
the NPN
> framework (C binding) available in webkit. Currently we are facing
a problem
> that our object is not getting recognized when we navigate to a
new page.
>
> (Note: Our object is not released, its just not getting recognized
in the
> new page's interpreter context)
>
> We want to retain our object till the time the interpreter is
valid but we
> are not able to do so. We observed that for every script handler a
context
> is created and if we put our code in KJSProxy::evaluate and insert
our
> object every time its working fine.
>
> But this way we are creating too many unnecessary instances of our
object.
>
> Can someone suggest a better way for retaining the object
throughout the
> interpreters life cycle?
>
> Thanks,
> Ankush.
>
> _______________________________________________
> webkit-dev mailing list
> [email protected]
> http://lists.webkit.org/mailman/listinfo/webkit-dev
>
>
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-dev
_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-dev