Issue #2304 - Part 4 - Add xray support for the Error cause property. https://bugzilla.mozilla.org/show_bug.cgi?id=1679653

This commit is contained in:
Brian Smith 2026-03-07 01:17:18 -06:00 committed by OwnedByWuigi
commit 33c2fae0ba
3 changed files with 7 additions and 0 deletions

View file

@ -111,6 +111,7 @@ const char* const XPCJSContext::mStrings[] = {
"columnNumber", // IDX_COLUMNNUMBER
"stack", // IDX_STACK
"message", // IDX_MESSAGE
"cause", // IDX_CAUSE
"errors", // IDX_ERRORS
"lastIndex" // IDX_LASTINDEX
};

View file

@ -495,6 +495,7 @@ public:
IDX_COLUMNNUMBER ,
IDX_STACK ,
IDX_MESSAGE ,
IDX_CAUSE ,
IDX_ERRORS ,
IDX_LASTINDEX ,
IDX_TOTAL_COUNT // just a count of the above

View file

@ -609,6 +609,11 @@ JSXrayTraits::resolveOwnProperty(JSContext* cx, const Wrapper& jsWrapper,
return true;
}
// The optional .cause property can have any value.
if (id == GetJSIDByIndex(cx, XPCJSContext::IDX_CAUSE)) {
return getOwnPropertyFromWrapperIfSafe(cx, wrapper, id, desc);
}
if (key == JSProto_AggregateError &&
id == GetJSIDByIndex(cx, XPCJSContext::IDX_ERRORS)) {
return getOwnPropertyFromWrapperIfSafe(cx, wrapper, id, desc);