![]() being stepped through uint charPosition = 0 ĭdt.GetPositionOfContext(debugDocumentContext, Find out the location of the chunk of code is currently ![]() IDebugDocumentText ddt = debugDocument as IDebugDocumentText ![]() The DebugDocumentText lets us get at the document text TagDebugStackFrameDescriptor tmpDebugStackFrameDescriptor breakpoint, then find the stack depth if (fileName != lastFile || functionName != lastFunction) If we are not in the same file and function as previous Prpt.EnumStackFrames( out enumDebugStackFrames) ĮnumDebugStackFrames.RemoteNext(1, out debugStackFrameDescriptor,ĭ(0,ĭ( out debugCodeContext) ĭebugCodeContext.GetDocumentContext( out debugDocumentContext) ĭebugDocumentContext.GetDocument( out debugDocument) ĭebugDocument.GetName(tagDOCUMENTNAMETYPE.DOCUMENTNAMETYPE_URL, Get the function name from the first stack frame IDebugDocumentContext debugDocumentContext TagDebugStackFrameDescriptor debugStackFrameDescriptor IEnumDebugStackFrames enumDebugStackFrames Various interfaces and structs used for active script debugging Properties of the current breakpoint which we will be fetching string fileName This is the callback code that gets executed when a breakpoint occurs: // Called on breakpoint, which is for each statement in the target app public void onHandleBreakPoint(IRemoteDebugApplicationThread prpt, I received a call back when the breakpoint occurred and then logged all the information about the current statement including the filename, the function name, the current stack depth, the line number, and of course the current chunk of JavaScript that was being executed. As soon as I attached the debugger I requested a breakpoint. DOH!įrom there on it was pretty plain sailing. I eventually discovered that it had actually worked the first time and that subsequent attempts to connect were failing because there was already a debugger attached. I could not connect to Internet Explorer. So I generated an IL file corrected it and regenerated the assembly.įor a long time when I first used the API it did not seem to be working. Having generated to the Interop assembly I found I needed to make some corrections. Eventually I found one in an old version of the Internet explorer SDK. NET I needed a type library in order to generate a COM Interop assembly. There were a smattering of articles on the web but none did exactly what I wanted. Unfortunately it’s been a long time since anyone has used that it API. In the end I discovered that the Active Scripting API was what I needed. But which debugger the API? There are so many to choose from. A debugger API seemed like the obvious way to go. ![]() I wanted to actually hook into Internet explorer somehow. There are plenty of library routines that let you instrument your code, but I wanted something different. In this case I wanted to see every line of JavaScript code that was being executed inside Internet explorer. Sometimes I get the germ of an idea and I won’t let go until I have implemented it. You can download the Microsoft Script Debugger, which will install it, here. If you get an error starting it up, it is likely you do not have Microsoft’s Active Scripting Debug API installed. Run it, select the Internet Explorer instance you are interested in, and you’ll be able to see all JavaScript it executes. You can download the free TraceJS program here.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |