[Webkit-unassigned] [Bug 64572] Initial implementation of calling WebScriptObject::callWebScriptMethod() via COM

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue Aug 16 12:42:25 PDT 2011


https://bugs.webkit.org/show_bug.cgi?id=64572





--- Comment #19 from Adam Roben (:aroben) <aroben at apple.com>  2011-08-16 12:42:25 PST ---
To further expand on this:

The basic technique is to add your hooks to the window object inside didClearWindowObject. One clean way to do this is to add a single object as a property on the window object, and have that object have all the hooks hanging off of it. That allows you to write code like this in JavaScript:

window.apiHooks.hookFunction(someData);

(As in all JavaScript, you can omit "window.".)

So, inside didClearWindowObject, you'd create a JSClassRef that has all the hook functions as staticFunctions, then create a JSObjectRef using that JSClassRef, then use JSObjectSetProperty(context, windowObject, "apiHooks", apiHooksObject, attributes, &exception) to add the hooks object to the window. Since didClearWindowObject is called before any JavaScript code can run in the page, your JavaScript code can just assume that the apiHooks object is present.

-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.



More information about the webkit-unassigned mailing list