mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-08 08:48:39 +09:00
Issue #2304 - Part 5 - Add cause property when a cause is present. I thought this was just to check whether it should be added, but is necessary.
This commit is contained in:
parent
33c2fae0ba
commit
18eaf39766
1 changed files with 9 additions and 0 deletions
|
|
@ -469,6 +469,15 @@ js::ErrorObject::init(JSContext* cx, Handle<ErrorObject*> obj, JSExnType type,
|
|||
MOZ_ASSERT(messageShape->slot() == MESSAGE_SLOT);
|
||||
}
|
||||
|
||||
// Similar to the .message property, .cause is present only in some error
|
||||
// objects -- |new Error("f", {cause: cause})| -- but not in other --
|
||||
// |Error.prototype|, |new Error()|, |new Error("f")|.
|
||||
if (cause.isSome()) {
|
||||
if (!obj->addDataProperty(cx, cx->names().cause, CAUSE_SLOT, 0)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
MOZ_ASSERT(obj->lookupPure(NameToId(cx->names().fileName))->slot() == FILENAME_SLOT);
|
||||
MOZ_ASSERT(obj->lookupPure(NameToId(cx->names().lineNumber))->slot() == LINENUMBER_SLOT);
|
||||
MOZ_ASSERT(obj->lookupPure(NameToId(cx->names().columnNumber))->slot() ==
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue