We have an IE extension implemented as a browser helper object (BHO). We have a utility function written in C ++ that we add to the page window object so that other scripts on the page can use it to load local script files dynamically. However, in order to resolve relative paths to these local script files, we need to determine the path to the JavaScript file that calls our function:
myfunc()
written in C ++ and displayed on a JavaScript page- File: ///path/to/some/javascript.js
- (additional stack frames)
From the top frame, I want to get information that the script call myfunc()
is located in the file: ///path/to/some/javascript.js.
At first, I expected that we could just use the IActiveScriptDebug
interface to get the stack from our utility function. However, it is not possible to get the IActiveScript
interface from the IWebBrowser2
interface or a linked document (see Full Column for Multiple JS Frames in IE8 ).
The only thing I can think of is to register our own script debugging implementation, and myfunc()
break into the debugger. However, I am skeptical that this will work without asking the user if they want to break into the debugger.
Before doing more thorough tests of this approach, I would like to check if anyone has final information on whether this can work and / or can offer an alternative approach that will allow a function written in C ++ to get a stack trace from the scripting engine that called it.
source share