[webkit-help] how to pre-register global binding?
Per Bothner
per.bothner at oracle.com
Wed Dec 21 01:01:04 PST 2011
Is there a recommended mechanism to register a binding to the
JavaScript interpreter, preferable before the page is loaded?
The goal is to implement a function which takes a name
(a String) and a JSValue and adds a property on the global (window)
object with the given name and value. Of course this is easy enough
to do in a running interpreter - for example using JSObjectSetProperty.
The trick is to pre-register the binding before the load starts, and
I don't know enough of interpreter initialization (for example
when the window object is created) to see a good place to do this.
I'm hoping someone who knows the code better can give a hint or two.
This can't be a new requirement. For example the old LiveConnect
would pre-register the name "java" to a magic object to enable
things like 'new java.util.ArrayList()'. We'd like to do something
similar, though for a Java-programmer-supplied name and value.
--
--Per Bothner
per.bothner at oracle.com per at bothner.com http://per.bothner.com/
More information about the webkit-help
mailing list