because debugger.onError() is only called when jsd.onDebug is triggered, and that happens, for example, when you set preference, extensions.firebug-service.showStackTrace true
The reason is that jsd.onError does not provide a stack and providing the stack via onDebug costs some time, so I made it an option, allowing users to avoid the overhead. jjb On Mar 16, 4:56 pm, Joe <[email protected]> wrote: > Ok > > so why I dont get error in: > onError: function(context, frame, error) { alert('error'); }, > when there is a error in xul like this: > <label value="Press me!" onclick="eval(alert(o))"/> //Error: o is not > defined > > Here is my complete code: > <?xml version="1.0"?> > <?xml-stylesheet href="chrome://global/skin/" type="text/css"?> > <window id="yourwindow" xmlns="http://www.mozilla.org/keymaster/ > gatekeeper/there.is.only.xul"> > > <script type="text/javascript"> > <![CDATA[ > var db = { > init: function() { > this.wrappedJSObject = this; > }, > onJSDActivate: function(jsd) { }, > onJSDDeactivate: function(jsd) { }, > onStop: function(context, frame, type, rv) { }, > onResume: function(context) { }, > onThrow: function(context, frame, rv) { }, > onError: function(context, frame, error) { alert('error'); }, > onEventScriptCreated: function(context, frame, url) { }, > onTopLevelScriptCreated: function(context, frame, url) { }, > onEvalScriptCreated: function(context, frame, url) { }, > onFunctionConstructor: function(context, frame, ctor_script, url) > { },}; > > My_debugger = db; > My_debugger.init(); > var fbs = Components.classes["@joehewitt.com/firebug;1"].getService > ().wrappedJSObject; > fbs.registerClient(My_debugger); > fbs.registerDebugger(My_debugger); > ]]> > </script> > <label value="Put your XUL here!" onclick="eval(alert(o))"/> > </window> > > On Mar 17, 2:12 am, johnjbarton <[email protected]> wrote: > > > yea, something like that. > > > On Mar 16, 3:13 pm, Joe <[email protected]> wrote: > > > > Sorry but I dont get the idea, do you mean something like this: > > > > //supply a 'debugger' object > > > var db = { > > > init: function() { > > > this.wrappedJSObject = this; > > > }, > > > onJSDActivate: function(jsd) { }, > > > onJSDDeactivate: function(jsd) { }, > > > onStop: function(context, frame, type, rv) { }, > > > onResume: function(context) { }, > > > onThrow: function(context, frame, rv) { }, > > > onError: function(context, frame, error) { alert('error'); }, > > > onEventScriptCreated: function(context, frame, url) { }, > > > onTopLevelScriptCreated: function(context, frame, url) { }, > > > onEvalScriptCreated: function(context, frame, url) { }, > > > onFunctionConstructor: function(context, frame, ctor_script, url) > > > { }, > > > > }; > > > > My_debugger = db; > > > My_debugger.init(); > > > var fbs = Components.classes["@joehewitt.com/firebug;1"].getService > > > ().wrappedJSObject; > > > fbs.registerClient(My_debugger); > > > fbs.registerDebugger(My_debugger); > > > > On Mar 17, 12:00 am, johnjbarton <[email protected]> wrote: > > > > > No, you don't redefine fbs functions, but rather you supply a > > > > 'debugger' object that implements call back functions for the debug > > > > events. > > > > See debugger.js > > > > ....fbs.registerClient(this); // once per XUL window, tells you when > > > > jsd turns on/off > > > > ..... fbs.registerDebugger(this); // when you are ready for callbacks > > > > > jjb > > > > > On Mar 16, 11:11 am, Joe <[email protected]> wrote: > > > > > > OK, Thanks for reply > > > > > I try to add fsb to my extension: > > > > > > var fbs = Components.classes["@joehewitt.com/firebug;1"] > > > > > .getService().wrappedJSObject; > > > > > > fbs.onError: function(frame, error) { > > > > > dump('error'); > > > > > > } > > > > > > Is it ok to get error ? Am I missing something, for example how to > > > > > initialize,... > > > > > > On Mar 16, 5:25 pm, johnjbarton <[email protected]> wrote: > > > > > > > Sure its possible, that's what Firebug does. If you look at the code > > > > > > for 'debugger.js' you can control firebug-service the way it does. > > > > > > > jjb > > > > > > > On Mar 16, 2:21 am, Joe <[email protected]> wrote: > > > > > > > > Hi > > > > > > > > Is it possible to add firebug-service.js to chrome://component > > > > > > > folder > > > > > > > of extension and use it as a debugger > > > > > > > > I want to stop some code at "debugger;" keyword then put a button > > > > > > > to > > > > > > > resume it > > > > > > > > Any help would be appreciated- Hide quoted text - > > > > > > > - Show quoted text -- Hide quoted text - > > > > > - Show quoted text -- Hide quoted text - > > > - Show quoted text - --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Firebug" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/firebug?hl=en -~----------~----~----~----~------~----~------~--~---
