>From my previous post I try to pause some JS codes using "debugger;" keyword
After some try here is my code: --------------------------------------------- <?xml version="1.0"?> <!DOCTYPE window SYSTEM "chrome://chatzilla/locale/chatzilla.dtd"> <?xul-overlay href="chrome://global/content/globalOverlay.xul"?> <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/ there.is.only.xul" id="main-window" orient="vertical" onclose="onClose();"> <script> <![CDATA[ netscape.security.PrivilegeManager.enablePrivilege ('UniversalXPConnect'); dump ("Start Debugging\n"); var scriptHook = { onScriptCreated: function scripthook (script) { }, onScriptDestroyed: function scripthook (script) { } }; var errorHook = { onError: function(message, fileName, lineNo, pos, flags, errnum, exc){ dump( "message: " + message + " Line: " + lineNo + "\n"); } }; var jsd = Components.classes["@mozilla.org/js/jsd/debugger- service;1"] .getService(Components.interfaces.jsdIDebuggerService); jsd.scriptHook = scriptHook; jsd.errorHook = errorHook; jsd.debuggerHook = { onExecute: function(frame, type, rv) { try { dump("pause\n"); jsd.enterNestedEventLoop({onNest: function() { }}); } catch (exc) { /*Just ignore*/ } } }; jsd.on(); function end_pause() { netscape.security.PrivilegeManager.enablePrivilege ('UniversalXPConnect'); jsd.exitNestedEventLoop(); } function doEval() { eval(document.getElementById("input-box").value); } ]]> </script> <textbox id="input-box" style="width:100%" multiline="true" value="debugger;"/> <button label = "Execute" oncommand="doEval();" /> <button label = "Resume" oncommand="end_pause();" /> </window> --------------------------------------------- It can now stop code on "debugger;" Am I using right method to pause ? My main problem is with "jsd.exitNestedEventLoop();" Here is the error: message: uncaught exception: [Exception... "Component returned failure code: 0x8 0004005 (NS_ERROR_FAILURE) [jsdIDebuggerService.exitNestedEventLoop]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: file:///C:/Users/...xul :: end_pause :: line 37" data: no] Line: 0 I cant figure out how to prevent it, Can anybody help please Thanks --~--~---------~--~----~------------~-------~--~----~ 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 -~----------~----~----~----~------~----~------~--~---
