On 2009-01-18, at 22:54, Erik Walter wrote:

Then we wait until we get the didFinishDocumentLoad notification (which occurs after the document is loaded, but before the OnLoad() handlers are called in JavaScript).

As I mentioned in my previous message, the most appropriate time to register things with the context of a frame is typically immediately after the window object is cleared (- webView:didClearWindowObject:forFrame: on Mac OS X, window-object- cleared for Gtk, etc). It will always be called before any scripts are executed in the document. The same is not true of other callbacks. For instance, didFinishDocumentLoad is called when the document has been parsed, which is after inline script tags have been executed.

Then we register our object in the global context...


        Frame* coreFrame;
WebFrame* targetFrame; // Make sure to set this from the loading client
        coreFrame = core(targetFrame);

        JSContextRef scriptCtx;

        scriptCtx = toRef(coreFrame->script()->globalObject()->globalExec());
        
        JSObjectRef global = JSContextGetGlobalObject(scriptCtx);
        JSClassRef      fooClass = JSClassCreate(fooDef);
JSObjectRef fooScriptObject = JSObjectMake(scriptCtx, fooClass, NULL); JSObjectSetProperty(scriptCtx, global, jsStringRef("foo", fooScriptObject, kJSPropertyAttributeNone, 0);

WebCore types should not be used by clients of the WebKit API. The WebKit API provides methods to access the underlying context of a frame, and should be used instead.

- Mark

Attachment: smime.p7s
Description: S/MIME cryptographic signature

_______________________________________________
webkit-dev mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-dev

Reply via email to