Back to index

lightning-sunbird  0.9+nobinonly
jsdIDebuggerService.idl
Go to the documentation of this file.
00001 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
00002  *
00003  * ***** BEGIN LICENSE BLOCK *****
00004  * Version: MPL 1.1/GPL 2.0/LGPL 2.1
00005  *
00006  * The contents of this file are subject to the Mozilla Public License Version
00007  * 1.1 (the "License"); you may not use this file except in compliance with
00008  * the License. You may obtain a copy of the License at
00009  * http://www.mozilla.org/MPL/
00010  *
00011  * Software distributed under the License is distributed on an "AS IS" basis,
00012  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
00013  * for the specific language governing rights and limitations under the
00014  * License.
00015  *
00016  * The Original Code is mozilla.org code.
00017  *
00018  * The Initial Developer of the Original Code is
00019  * Netscape Communications Corporation.
00020  * Portions created by the Initial Developer are Copyright (C) 1998
00021  * the Initial Developer. All Rights Reserved.
00022  *
00023  * Contributor(s):
00024  *   Robert Ginda, <rginda@netscape.com>
00025  *
00026  * Alternatively, the contents of this file may be used under the terms of
00027  * either the GNU General Public License Version 2 or later (the "GPL"), or
00028  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
00029  * in which case the provisions of the GPL or the LGPL are applicable instead
00030  * of those above. If you wish to allow use of your version of this file only
00031  * under the terms of either the GPL or the LGPL, and not to allow others to
00032  * use your version of this file under the terms of the MPL, indicate your
00033  * decision by deleting the provisions above and replace them with the notice
00034  * and other provisions required by the GPL or the LGPL. If you do not delete
00035  * the provisions above, a recipient may use your version of this file under
00036  * the terms of any one of the MPL, the GPL or the LGPL.
00037  *
00038  * ***** END LICENSE BLOCK ***** */
00039     
00040 #include "nsISupports.idl"
00041 
00042 %{ C++
00043 #include "jsdebug.h"
00044 #include "nsAString.h"
00045 %}
00046     
00047 [ptr] native JSDContext(JSDContext);
00048 [ptr] native JSDObject(JSDObject);
00049 [ptr] native JSDProperty(JSDProperty);
00050 [ptr] native JSDScript(JSDScript);
00051 [ptr] native JSDStackFrameInfo(JSDStackFrameInfo);
00052 [ptr] native JSDThreadState(JSDThreadState);
00053 [ptr] native JSDValue(JSDValue);
00054 [ptr] native JSRuntime(JSRuntime);
00055 [ptr] native JSContext(JSContext);
00056 
00057 /* interfaces we declare in this file */
00058 interface jsdIDebuggerService;
00059 interface jsdIFilter;
00060 interface jsdINestCallback;
00061 interface jsdIFilterEnumerator;
00062 interface jsdIContextEnumerator;
00063 interface jsdIScriptEnumerator;
00064 interface jsdIScriptHook;
00065 interface jsdIErrorHook;
00066 interface jsdIExecutionHook;
00067 interface jsdICallHook;
00068 interface jsdIEphemeral;
00069 interface jsdIPC;
00070 interface jsdIContext;
00071 interface jsdIStackFrame;
00072 interface jsdIScript;
00073 interface jsdIValue;
00074 interface jsdIObject;
00075 interface jsdIProperty;
00076 
00081 [scriptable, uuid(9dd9006a-4e5e-4a80-ac3d-007fb7335ca4)]
00082 interface jsdIDebuggerService : nsISupports
00083 {
00085     [noscript] readonly attribute JSDContext        JSDContext;
00086 
00090     attribute jsdIErrorHook     errorHook;
00094     attribute jsdIScriptHook    scriptHook;
00098     attribute jsdIExecutionHook breakpointHook;
00102     attribute jsdIExecutionHook debuggerHook;
00106     attribute jsdIExecutionHook debugHook;
00110     attribute jsdIExecutionHook interruptHook;
00114     attribute jsdIExecutionHook throwHook;
00118     attribute jsdICallHook topLevelHook;
00122     attribute jsdICallHook functionHook;
00123 
00124 
00133     const long VERSION_1_0     = 100;
00134     const long VERSION_1_1     = 110;
00135     const long VERSION_1_2     = 120;
00136     const long VERSION_1_3     = 130;
00137     const long VERSION_1_4     = 140;
00138     const long VERSION_1_5     = 150;
00139     const long VERSION_DEFAULT = 0;
00140     const long VERSION_UNKNOWN = -1;
00141 
00150     const unsigned long ENABLE_NATIVE_FRAMES     = 0x01;
00156     const unsigned long PROFILE_WHEN_SET         = 0x02;
00162     const unsigned long DEBUG_WHEN_SET           = 0x04;
00166     const unsigned long COLLECT_PROFILE_DATA     = 0x08;
00171     const unsigned long HIDE_DISABLED_FRAMES     = 0x10;
00188     const unsigned long MASK_TOP_FRAME_ONLY     = 0x20;
00193     const unsigned long DISABLE_OBJECT_TRACE = 0x40;
00194     
00198     attribute unsigned long flags;
00199     
00203     readonly attribute unsigned long implementationMajor;
00207     readonly attribute unsigned long implementationMinor;
00211     readonly attribute string implementationString;
00212     
00217     attribute boolean initAtStartup;
00218 
00224     readonly attribute boolean isOn;
00225 
00231     void on ();
00238     [noscript] void onForRuntime (in JSRuntime rt);
00245     void off ();
00246 
00252     readonly attribute unsigned long pauseDepth;
00262     unsigned long pause();
00268     unsigned long unPause();
00269     
00273     void GC();
00274     
00278     void clearProfileData();
00279     
00293     void insertFilter (in jsdIFilter filter, in jsdIFilter after);
00297     void appendFilter (in jsdIFilter filter);
00307     void removeFilter (in jsdIFilter filter);
00315     void swapFilters (in jsdIFilter filter_a, in jsdIFilter filter_b);
00324     void enumerateFilters (in jsdIFilterEnumerator enumerator);
00331     void refreshFilters ();
00335     void clearFilters();
00336 
00340     void enumerateContexts (in jsdIContextEnumerator enumerator);
00341     
00350     void enumerateScripts (in jsdIScriptEnumerator enumerator);
00354     void clearAllBreakpoints ();
00355 
00362     jsdIValue wrapValue (/*in jsvalue value*/);
00363     
00364     /* XXX these two routines are candidates for refactoring.  The only problem
00365      * is that it is not clear where and how they should land.
00366      */
00367 
00376     unsigned long enterNestedEventLoop (in jsdINestCallback callback);
00384     unsigned long exitNestedEventLoop ();
00385 };
00386 
00387 /* callback interfaces */
00388 
00394 [scriptable, uuid(05593438-1b83-4517-864f-3cea3d37a266)]
00395 interface jsdIFilter : nsISupports
00396 {
00402     const unsigned long FLAG_RESERVED_MASK = 0xFF;
00406     const unsigned long FLAG_ENABLED       = 0x01;
00411     const unsigned long FLAG_PASS          = 0x02;
00412 
00416     attribute unsigned long flags;
00417     
00426     attribute nsISupports globalObject;
00427     
00438     attribute string urlPattern;
00439 
00445     attribute unsigned long startLine;
00446 
00452     attribute unsigned long endLine;
00453 };
00454 
00458 [scriptable, uuid(88bea60f-9b5d-4b39-b08b-1c3a278782c6)]
00459 interface jsdINestCallback : nsISupports
00460 {
00466     void onNest ();
00467 };
00468 
00472 [scriptable, uuid(54382875-ed12-4f90-9a63-1f0498d0a3f2)]
00473 interface jsdIFilterEnumerator : nsISupports
00474 {
00479     void enumerateFilter (in jsdIFilter filter);
00480 };
00481 
00485 [scriptable, uuid(4c2f706e-1dd2-11b2-9ebc-85a06e948830)]
00486 interface jsdIScriptEnumerator : nsISupports
00487 {
00492     void enumerateScript (in jsdIScript script);
00493 };
00494 
00498 [scriptable, uuid(912e342a-1dd2-11b2-b09f-cf3af38c15f0)]
00499 interface jsdIContextEnumerator : nsISupports
00500 {
00505     void enumerateContext (in jsdIContext executionContext);
00506 };
00507 
00511 [scriptable, uuid(ae89a7e2-1dd1-11b2-8c2f-af82086291a5)]
00512 interface jsdIScriptHook : nsISupports
00513 {
00517     void onScriptCreated (in jsdIScript script);
00522     void onScriptDestroyed (in jsdIScript script);
00523 };
00524 
00529 [scriptable, uuid(f102caf6-1dd1-11b2-bd43-c1dbacb95a98)]
00530 interface jsdICallHook : nsISupports
00531 {
00540     const unsigned long TYPE_TOPLEVEL_START  = 0;
00544     const unsigned long TYPE_TOPLEVEL_END    = 1;
00548     const unsigned long TYPE_FUNCTION_CALL   = 2;
00552     const unsigned long TYPE_FUNCTION_RETURN = 3;
00553     
00558     void onCall (in jsdIStackFrame frame, in unsigned long type);
00559 };
00560 
00561 [scriptable, uuid(b7dd3c1c-1dd1-11b2-83eb-8a857d199e0f)]
00562 interface jsdIErrorHook : nsISupports
00563 {
00572     const unsigned long REPORT_ERROR     = 0x00;
00576     const unsigned long REPORT_WARNING   = 0x01;
00580     const unsigned long REPORT_EXCEPTION = 0x02;
00584     const unsigned long REPORT_STRICT    = 0x04;
00585 
00590     boolean onError (in string message, in string fileName,
00591                      in unsigned long line, in unsigned long pos,
00592                      in unsigned long flags, in unsigned long errnum,
00593                      in jsdIValue exc);
00594 };
00595 
00601 [scriptable, uuid(9a7b6ad0-1dd1-11b2-a789-fcfae96356a2)]
00602 interface jsdIExecutionHook : nsISupports
00603 {
00611     const unsigned long TYPE_INTERRUPTED      = 0;
00615     const unsigned long TYPE_BREAKPOINT       = 1;
00619     const unsigned long TYPE_DEBUG_REQUESTED  = 2;
00623     const unsigned long TYPE_DEBUGGER_KEYWORD = 3;
00627     const unsigned long TYPE_THROW            = 4;
00628 
00639     const unsigned long RETURN_HOOK_ERROR     = 0;
00647     const unsigned long RETURN_CONTINUE       = 1;
00651     const unsigned long RETURN_ABORT          = 2;
00655     const unsigned long RETURN_RET_WITH_VAL   = 3;
00659     const unsigned long RETURN_THROW_WITH_VAL = 4;
00663     const unsigned long RETURN_CONTINUE_THROW = 5;
00664 
00675     unsigned long onExecute (in jsdIStackFrame frame, 
00676                              in unsigned long type, inout jsdIValue val);
00677 };
00678 
00684 [scriptable, uuid(46f1e23e-1dd2-11b2-9ceb-8285f2e95e69)]
00685 interface jsdIEphemeral : nsISupports
00686 {
00691     readonly attribute boolean isValid;
00695     [noscript] void invalidate(); 
00696 };    
00697 
00698 /* handle objects */
00699 
00704 [scriptable, uuid(a2dd25a4-1dd1-11b2-bda6-ed525acd4c35)]
00705 interface jsdIContext : jsdIEphemeral
00706 {
00707     /* Internal use only. */
00708     [noscript] readonly attribute JSContext   JSContext;
00709 
00717     const long OPT_STRICT      = 0x01;
00721     const long OPT_WERR        = 0x02;
00726     const long OPT_VAROBJFIX   = 0x04;
00731     const long OPT_ISUPPORTS   = 0x08;
00735     attribute unsigned long          options;
00736 
00742     attribute long                   version;
00743 
00747     readonly attribute unsigned long tag;
00748 
00752     readonly attribute nsISupports   privateData;
00753     
00757     readonly attribute nsISupports   wrappedContext;
00758 
00762     readonly attribute jsdIValue     globalObject;
00763 
00770     attribute boolean                scriptsEnabled;
00771 };
00772 
00780 [scriptable, uuid(b6d50784-1dd1-11b2-a932-882246c6fe45)]
00781 interface jsdIStackFrame : jsdIEphemeral
00782 {
00784     [noscript] readonly attribute JSDContext        JSDContext;
00786     [noscript] readonly attribute JSDThreadState    JSDThreadState;
00788     [noscript] readonly attribute JSDStackFrameInfo JSDStackFrameInfo;
00789    
00793     readonly attribute boolean isNative;
00798     readonly attribute boolean isDebugger;
00802     readonly attribute boolean isConstructing;
00803 
00807     readonly attribute jsdIStackFrame callingFrame;
00811     readonly attribute jsdIContext    executionContext;
00815     readonly attribute string         functionName;
00819     readonly attribute jsdIScript     script;
00823     readonly attribute unsigned long  pc;
00827     readonly attribute unsigned long  line;
00831     readonly attribute jsdIValue      callee;
00835     readonly attribute jsdIValue      scope;
00839     readonly attribute jsdIValue      thisValue;
00848     boolean eval (in AString bytes, in string fileName,
00849                   in unsigned long line, out jsdIValue result);
00850     
00851 };
00852 
00857 [scriptable, uuid(a38f65ca-1dd1-11b2-95d5-ff2947e9c920)]
00858 interface jsdIScript : jsdIEphemeral
00859 {
00861     [noscript] readonly attribute JSDContext JSDContext;
00863     [noscript] readonly attribute JSDScript  JSDScript;
00864     
00870     readonly attribute long          version;
00871 
00876     readonly attribute unsigned long tag;
00877 
00887     const unsigned long FLAG_PROFILE = 0x01;
00892     const unsigned long FLAG_DEBUG   = 0x02;
00893     
00897     attribute unsigned long flags;
00898 
00905     readonly attribute string        fileName;
00913     readonly attribute string        functionName;
00917     readonly attribute jsdIValue     functionObject;
00921     readonly attribute AString functionSource;
00928     readonly attribute unsigned long baseLineNumber;
00935     readonly attribute unsigned long lineExtent;
00936 
00940     readonly attribute unsigned long callCount;
00944     readonly attribute unsigned long maxRecurseDepth;
00948     readonly attribute double minExecutionTime;
00952     readonly attribute double maxExecutionTime;
00956     readonly attribute double totalExecutionTime;
00961     readonly attribute double minOwnExecutionTime;
00966     readonly attribute double maxOwnExecutionTime;
00971     readonly attribute double totalOwnExecutionTime;
00972     
00976     void clearProfileData();
00977     
00978     const unsigned long PCMAP_SOURCETEXT  = 1; /* map to actual source text    */
00979     const unsigned long PCMAP_PRETTYPRINT = 2; /* map to pretty printed source */
00980 
00985     unsigned long pcToLine (in unsigned long pc, in unsigned long pcmap);
00990     unsigned long lineToPc (in unsigned long line, in unsigned long pcmap);
00996     boolean isLineExecutable (in unsigned long line, in unsigned long pcmap);
01000     void setBreakpoint (in unsigned long pc);
01004     void clearBreakpoint (in unsigned long pc);
01008     void clearAllBreakpoints ();
01009 };
01010 
01017 [scriptable, uuid(b7964304-1dd1-11b2-ba20-cf4205772e9d)]
01018 interface jsdIValue : jsdIEphemeral
01019 {
01021     [noscript] readonly attribute JSDContext JSDContext;
01023     [noscript] readonly attribute JSDValue   JSDValue;
01024 
01028     readonly attribute boolean isNative;
01034     readonly attribute boolean isNumber;
01038     readonly attribute boolean isPrimitive;
01039     
01041     const unsigned long TYPE_BOOLEAN  = 0;
01043     const unsigned long TYPE_DOUBLE   = 1;
01045     const unsigned long TYPE_INT      = 2;
01047     const unsigned long TYPE_FUNCTION = 3;
01049     const unsigned long TYPE_NULL     = 4;
01051     const unsigned long TYPE_OBJECT   = 5;
01053     const unsigned long TYPE_STRING   = 6;
01055     const unsigned long TYPE_VOID     = 7;
01056     
01060     readonly attribute unsigned long jsType;
01065     readonly attribute jsdIValue     jsPrototype;
01070     readonly attribute jsdIValue     jsParent;
01075     readonly attribute string        jsClassName;
01080     readonly attribute jsdIValue     jsConstructor;
01085     readonly attribute string        jsFunctionName;
01086     
01090     readonly attribute boolean    booleanValue;
01094     readonly attribute double     doubleValue;
01098     readonly attribute long       intValue;
01102     readonly attribute jsdIObject objectValue;
01106     readonly attribute string     stringValue;
01107 
01112     readonly attribute long propertyCount;
01113     
01120     void getProperties ([array, size_is(length)] out jsdIProperty propArray,
01121                         out unsigned long length);
01129     jsdIProperty getProperty (in string name);
01130 
01136     void refresh();
01137 
01145     void getWrappedValue();
01146 };
01147 
01157 [scriptable, uuid(d500e8b8-1dd1-11b2-89a1-cdf55d91cbbd)]
01158 interface jsdIObject : nsISupports
01159 {
01161     [noscript] readonly attribute JSDContext JSDContext;
01163     [noscript] readonly attribute JSDObject  JSDObject;
01164 
01169     readonly attribute string        creatorURL;
01173     readonly attribute unsigned long creatorLine;
01178     readonly attribute string        constructorURL;
01182     readonly attribute unsigned long constructorLine;
01186     readonly attribute jsdIValue     value;
01187 };
01188 
01193 [scriptable, uuid(b8816e56-1dd1-11b2-81dc-8ba99a833d9e)]
01194 interface jsdIProperty : jsdIEphemeral
01195 {
01197     [noscript] readonly attribute JSDContext  JSDContext;
01199     [noscript] readonly attribute JSDProperty JSDProperty;
01200 
01206     const unsigned long FLAG_ENUMERATE = 0x01;
01208     const unsigned long FLAG_READONLY  = 0x02;
01210     const unsigned long FLAG_PERMANENT = 0x04;
01212     const unsigned long FLAG_ALIAS     = 0x08;
01214     const unsigned long FLAG_ARGUMENT  = 0x10;
01216     const unsigned long FLAG_VARIABLE  = 0x20;
01218     const unsigned long FLAG_EXCEPTION = 0x40;
01220     const unsigned long FLAG_ERROR     = 0x80;
01222     const unsigned long FLAG_HINTED    = 0x800;
01223 
01225     readonly attribute unsigned long flags;
01227     readonly attribute jsdIValue     alias;
01229     readonly attribute jsdIValue     name;
01231     readonly attribute jsdIValue     value;
01233     readonly attribute unsigned long varArgSlot;
01234 
01235 };
01236 
01237 /*
01238 [scriptable, uuid(a47adad2-1dd1-11b2-b9e9-8e67a47beca5)]
01239 interface jsdISourceText : nsISupports
01240 {};
01241 
01242 [scriptable, uuid(b6d1c006-1dd1-11b2-b9d8-b4d1ccfb74d8)]
01243 interface jsdIThreadState : nsISupports
01244 {
01245     [noscript] readonly attribute JSDContext     JSDContext;
01246     [noscript] readonly attribute JSDThreadState JSDThreadState;
01247     
01248     readonly attribute unsigned long  frameCount;
01249     readonly attribute jsdIStackFrame topFrame;
01250     
01251     attribute jsdIValue pendingException;
01252 };
01253 
01254 */
01255