[webkit-dev] Extending JS context for all WebFrames

Ross Lillie ross.lillie at motorola.com
Thu Mar 12 15:51:01 PDT 2009

Thanks Geoff,

But I think I¹m still faced with the same problem.  If I want ALL pages
associated with all possible WebViews to have access to my external
objects/properties, does this still not require me to reinitialize the
global object (via the context reference) at each page load?  What I¹m
trying to accomplish is to have my extended global object be the default
object for all webview/page lists.

It¹s 6pm and my brain hurts.  Thanks for any help/insight you can provide.

Confused in Schaumburg,
Ross Lillie

On 3/12/09 5:37 PM, "Geoffrey Garen" <ggaren at apple.com> wrote:

> Hi Ross.
>> While I can grab the JSGlobalContext reference from a WebView's mainFrame,
>> and subsequently use the public JS APIs to extend the underlying JS global
>> object, I believe that subsequent WebView allocations will cause the
>> underlying JSGlobalObject to be reinitialized forcing me to 're-extend' the
>> object using the public APIs.
> It's a page load, not a WebView allocation, that clears the data in a
> JSGlobalContext.
> Here is the delegate callback you need: ­
> webView:didClearWindowObject:forFrame:
> <http://developer.apple.com/documentation/Cocoa/Reference/WebKit/Protocols/Web
> FrameLoadDelegate_Protocol/Reference/Reference.html%23//apple_ref/occ/instm/NS
> Object/webView:didClearWindowObject:forFrame:>
> Cheers,
> Geoff

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-dev/attachments/20090312/1eff7446/attachment.html>

More information about the webkit-dev mailing list