I might be wrong but when the JavaScript runs as a plugin it has access to
these things but when you write code inside the browsers you can't access
interact with it the same way and thus can't do debugging type operations.
Dougal

---
Dougal Matthews - @d0ugal
http://www.dougalmatthews.com/




2009/3/16 Joe <[email protected]>

>
> Hi
>
> I am trying to implement a ideal pause function in JavaScript under
> Mozilla environment.
> Here is my strategy:
> Put some breakpoints (debugger;) in Script then using "@mozilla.org/js/
> jsd/debugger-service;1"; service to pause script and after some events
> fire then continue Script
>
> I tried to figure out how firebug handle breakpoints but there isnt
> any documentation on the web
> Here is my XUL code which can handle debugger:
> ---------------------------------------------------------------------
> <?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[
>
>          const jsdIExecutionHook = Components.interfaces.jsdIExecutionHook;
>
>          dump ("Debugging starts\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");
>                   }
>          };
>
>      netscape.security.PrivilegeManager.enablePrivilege
> ('UniversalXPConnect');
>      const JSD_CTRID = "@mozilla.org/js/jsd/debugger-service;1";
>      const jsdIDebuggerService =
> Components.interfaces.jsdIDebuggerService;
>
>      var jsds = Components.classes[JSD_CTRID].getService
> (jsdIDebuggerService);
>      jsds.scriptHook = scriptHook;
>      jsds.errorHook = errorHook;
>          jsds.debuggerHook = { onExecute: function(frame, type, rv){
>            dump('Pause by debugger key word');
>                return jsdIExecutionHook.RETURN_CONTINUE;
>          } };
>      jsds.enumerateScripts ( { enumerateScript: function(script) { /
> *dump('enumerateScript\n');*/} });
>
>      jsds.on();
>
>      function onClose () {
>        netscape.security.PrivilegeManager.enablePrivilege
> ('UniversalXPConnect');
>        jsds.off();
>      }
>      function onKeyPress (e) {
>         if (e.keyCode == 13)
>            doEval();
>      }
>      function doEval() {
>         var ex;
>         try {
>           var rv = eval(document.getElementById("input-box").value);
>           document.getElementById("output-box").value = rv;
>         } catch (ex) {
>           document.getElementById("output-box").value =
>             "Caught exception: " + String(ex);
>         }
>         finally { }
>      }
>    ]]>
>  </script>
>
>  <textbox id="input-box" style="width:100%" multiline="true"/>
>  <button label = "Execute" oncommand="doEval();" />
>  <textbox id="output-box" style="width:100%" readonly="true"/>
> </window>
> ---------------------------------------------------------------------
>
> Now my problem is how to continue code when it is on the pause ?
> Maybe some functions arent complete but I cant figure out more, so
> please help me to complete it
>
> P.S: to try pause just paste this code in first textbox:
> debbuger;
> alert('some text here')
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to