mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-29 11:57:32 +09:00
Issue #1877 - Resolve RELEASE_OR_BETA conditionals.
This commit is contained in:
parent
93c90e371b
commit
d4eac725fd
30 changed files with 75 additions and 144 deletions
|
|
@ -131,16 +131,24 @@ class ObjectOpResult
|
|||
Uninitialized = uintptr_t(-1)
|
||||
};
|
||||
|
||||
static const uintptr_t SoftFailBit = uintptr_t(1) << (sizeof(uintptr_t) * 8 - 1);
|
||||
|
||||
ObjectOpResult() : code_(Uninitialized) {}
|
||||
|
||||
/* Return true if succeed() was called. */
|
||||
/* Return true if succeed() or failSoft() was called. */
|
||||
bool ok() const {
|
||||
MOZ_ASSERT(code_ != Uninitialized);
|
||||
return code_ == OkCode;
|
||||
return code_ == OkCode || (code_ & SoftFailBit);
|
||||
}
|
||||
|
||||
explicit operator bool() const { return ok(); }
|
||||
|
||||
/* Return true if succeed() was called. */
|
||||
bool confirmOk() const {
|
||||
MOZ_ASSERT(code_ != Uninitialized);
|
||||
return code_ == OkCode;
|
||||
}
|
||||
|
||||
/* Set this ObjectOpResult to true and return true. */
|
||||
bool succeed() {
|
||||
code_ = OkCode;
|
||||
|
|
@ -160,10 +168,26 @@ class ObjectOpResult
|
|||
*/
|
||||
bool fail(uint32_t msg) {
|
||||
MOZ_ASSERT(msg != OkCode);
|
||||
MOZ_ASSERT((msg & SoftFailBit) == 0);
|
||||
code_ = msg;
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* DEPRECATED: This is a non-standard compatibility hack.
|
||||
*
|
||||
* Set this ObjectOpResult to true, but remembers an error code.
|
||||
* This is used for situations where we really want to fail,
|
||||
* but can't for legacy reasons.
|
||||
*
|
||||
* Always returns true, as a convenience.
|
||||
*/
|
||||
bool failSoft(uint32_t msg) {
|
||||
// The msg code is currently never extracted again.
|
||||
code_ = msg | SoftFailBit;
|
||||
return true;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool) failCantRedefineProp();
|
||||
JS_PUBLIC_API(bool) failReadOnly();
|
||||
JS_PUBLIC_API(bool) failGetterOnly();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue