Add new CefV8StackTrace and CefV8StackFrame interfaces to support retrieval of the JavaScript stack trace for the currently active V8 context (issue #682).

git-svn-id: https://chromiumembedded.googlecode.com/svn/trunk@727 5089003a-bbd8-11dd-ad1f-f1f9622dbc98
This commit is contained in:
Marshall Greenblatt
2012-07-25 11:50:35 +00:00
parent 46b9f02fb5
commit ea6c91fbdb
8 changed files with 490 additions and 79 deletions

View File

@ -46,6 +46,7 @@
class CefV8Exception;
class CefV8Handler;
class CefV8StackFrame;
class CefV8Value;
@ -739,4 +740,84 @@ class CefV8Value : public virtual CefBase {
const CefV8ValueList& arguments) =0;
};
///
// Class representing a V8 stack trace. The methods of this class may only be
// called on the render process main thread.
///
/*--cef(source=library)--*/
class CefV8StackTrace : public virtual CefBase {
public:
///
// Returns the stack trace for the currently active context. |frame_limit| is
// the maximum number of frames that will be captured.
///
/*--cef()--*/
static CefRefPtr<CefV8StackTrace> GetCurrent(int frame_limit);
///
// Returns the number of stack frames.
///
/*--cef()--*/
virtual int GetFrameCount() =0;
///
// Returns the stack frame at the specified 0-based index.
///
/*--cef()--*/
virtual CefRefPtr<CefV8StackFrame> GetFrame(int index) =0;
};
///
// Class representing a V8 stack frame. The methods of this class may only be
// called on the render process main thread.
///
/*--cef(source=library)--*/
class CefV8StackFrame : public virtual CefBase {
public:
///
// Returns the name of the resource script that contains the function.
///
/*--cef()--*/
virtual CefString GetScriptName() =0;
///
// Returns the name of the resource script that contains the function or the
// sourceURL value if the script name is undefined and its source ends with
// a "//@ sourceURL=..." string.
///
/*--cef()--*/
virtual CefString GetScriptNameOrSourceURL() =0;
///
// Returns the name of the function.
///
/*--cef()--*/
virtual CefString GetFunctionName() =0;
///
// Returns the 1-based line number for the function call or 0 if unknown.
///
/*--cef()--*/
virtual int GetLineNumber() =0;
///
// Returns the 1-based column offset on the line for the function call or 0 if
// unknown.
///
/*--cef()--*/
virtual int GetColumn() =0;
///
// Returns true if the function was compiled using eval().
///
/*--cef()--*/
virtual bool IsEval() =0;
///
// Returns true if the function was called as a constructor via "new".
///
/*--cef()--*/
virtual bool IsConstructor() =0;
};
#endif // CEF_INCLUDE_CEF_V8_H_