[Project_owners] Re: XPCNativeWrapper()

Michael Vincent van Rantwijk some at universum.org
Sun May 15 17:38:31 EDT 2005


Philip Chee wrote:
> On 22/04/2005 22:13, Neil wrote:
> 
>>Michael Vincent van Rantwijk wrote:
>>
>>
>>>Can I (and should I??) use XPCNativeWrapper() in a component, and if 
>>>yes, how?
> 
> 
>>It's not easy to import the script into a component, but you could use 
>>lookupMethod instead:
>>Components.lookupMethod(aWindow, "open").call(aWindow, url, name, features);
> 
> 
> You can look at the source for XPCNativeWrapper which uses, amongst others,
> Components.lookupMethod,
> 
> or you can just do as we do and incorporate Jesse's version of XPCNativeWrapper:
> <http://mavra.perilith.com/~luser/content/native.js>
> 
> E.g. a function from Jesse:
> 
> Phil

First of all thanks for your reply/help.

Now, here is a single line as example;

aWindow.Window.prototype.__mozilla__open = aWindow.Window.prototype.open;

which I changed into:

aWindow.Window.prototype.__mozilla__open = 
Components.lookupMethod(aWindow, 'open');

to make it work in Mozilla 1.7.[7/8] but now I wonder if I should use:

Components.lookupMethod(untrustedObject, propName).call(untrustedObject, 
value);

for 'aWindow.Window.prototype.__mozilla__open' and if so, how?

Michael.


More information about the Project_owners mailing list