SavedFrame stacks should generally be captured, allocated, and live within the compartment that is being observed or debugged. Usually this is a content compartment.
JS::CaptureCurrentStack declared in
saveStack, accessible via
Including and Excluding Chrome Frames
Consider the following
SavedFrame stack. Arrows represent links from child to parent frame,
content.js is from a compartment with content principals, and
chrome.js is from a compartment with chrome principals.
function A from content.js | V function B from chrome.js | V function C from content.js
The content compartment will ever have one view of this stack:
A -> C.
However, a chrome compartment has a choice: it can either take the same view that the content compartment has (
A -> C), or it can view all stack frames, including the frames from chrome compartments (
A -> B -> C). To view everything, use an
XrayWrapper. This is the default wrapper. To see the stack as the content compartment sees it, waive the xray wrapper with
const contentViewOfStack = Components.utils.waiveXrays(someStack);
Accessor Properties of the
- The source URL for this stack frame, as a string.
- The line number for this stack frame.
- The column number for this stack frame.
- Either SpiderMonkeyâ€™s inferred name for this stack frameâ€™s function, or
- If this stack frame is the
asyncParentof other stack frames, then this is a string representing the type of asynchronous call by which this frame invoked its children. For example, if this frameâ€™s children are calls to handlers for a promise this frame created, this frameâ€™s
"Promise". If the asynchronous call was started in a descendant frame to which the requester of the property does not have access, this will be the generic string
"Async". If this is not an asynchronous call point, this will be
- If this stack frame was called as a result of an asynchronous operation, for example if the function referenced by this frame is a promise handler, this property points to the stack frame responsible for the asynchronous call, for example where the promise was created. If the frame responsible for the call is not accessible to the caller, this points to the youngest accessible ancestor of the real frame, if any. In all other cases, this is
- This stack frameâ€™s caller, or
nullif this is the oldest frame on the stack. In this case, there might be an
Function Properties of the
- Return this frame and its parents formatted as a human readable stack trace string.
- Generated from file: