Re: Overriding content window methods with chrome functions

2013-10-22 Thread Matthew Gertner
Turns out I was changing the method on a wrapper after all. Weird since I pass obj.wrappedJSObject into the function but I guess it gets wrapped again (maybe because I am passing it from one subscript context to another). ___ dev-platform mailing list d

Re: Overriding content window methods with chrome functions

2013-10-22 Thread Neil
Matthew Gertner wrote: What exactly do you mean by setting the window to have an app docShell? You mean load it into a browser with type = "chrome"? No, I meant an app frame, but Mark's reply led me to bug 799592 comment 1 where Shane Caraveo says that an app frame doesn't look like it would

Re: Overriding content window methods with chrome functions

2013-10-21 Thread Mark Hammond
On 22/10/2013 2:57 AM, Matthew Gertner wrote: On Monday, October 21, 2013 5:45:44 PM UTC+2, Neil wrote: Well, you could turn of that error; it's just a pref. Of course you would then decide whether to trap all the other DOMWindowClosing events to stop other random scripts from closing windows.

Re: Overriding content window methods with chrome functions

2013-10-21 Thread Matthew Gertner
On Monday, October 21, 2013 5:45:44 PM UTC+2, Neil wrote: > Well, you could turn of that error; it's just a pref. Of course you > would then decide whether to trap all the other DOMWindowClosing events > to stop other random scripts from closing windows. > > Alternatively, you could maybe lookin

Re: Overriding content window methods with chrome functions

2013-10-21 Thread Neil
Matthew Gertner wrote: FYI I load the content into a popup and I want it to be able to close the popup. So the real chrome function looks like: contentWindow.wrappedJSObject.close = function() { chromeWindow.close(); }; But as I said, the default close() method seems to be called instead and

Re: Overriding content window methods with chrome functions

2013-10-21 Thread Matthew Gertner
On Monday, October 21, 2013 4:40:08 PM UTC+2, Gijs Kruitbosch wrote: > Uh, I hope you meant: > > window.wrappedJSObject.close = function() { ... }; > (ie, no braces after close[()]) Sorry, yes of course. I typed that quickly but obviously the real code doesn't have parentheses after the functio

Re: Overriding content window methods with chrome functions

2013-10-21 Thread Gijs Kruitbosch
On 21/10/13 16:19 , Matthew Gertner wrote: I'm loading a page into a but I want the close() method to call a function defined in chrome. I tried the obvious: window.wrappedJSObject.close() = function() { ... }; However, the old close() method is still called (as far as I can tell). I guess I

Re: Overriding content window methods with chrome functions

2013-10-21 Thread Bobby Holley
On Mon, Oct 21, 2013 at 4:19 PM, Matthew Gertner wrote: > I'm loading a page into a but I want the close() > method to call a function defined in chrome. I tried the obvious: > > window.wrappedJSObject.close() = function() { ... }; > > However, the old close() method is still called (as far as I