зеркало из https://github.com/mozilla/gecko-dev.git
Bug 914067 - Remove JSVAL_VOID from dom/; r=jst
This commit is contained in:
Родитель
d21e14d4d6
Коммит
b83d21c58c
|
@ -33,7 +33,7 @@ DOMCursor::Reset()
|
|||
MOZ_ASSERT(!mFinished);
|
||||
|
||||
// Reset the request state so we can FireSuccess() again.
|
||||
mResult = JSVAL_VOID;
|
||||
mResult.setUndefined();
|
||||
mDone = false;
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ DOMCursor::Continue(ErrorResult& aRv)
|
|||
MOZ_ASSERT(mCallback, "If you're creating your own cursor class with no callback, you should override Continue()");
|
||||
|
||||
// We need to have a result here because we must be in a 'success' state.
|
||||
if (mResult == JSVAL_VOID) {
|
||||
if (mResult.isUndefined()) {
|
||||
aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR);
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -25,7 +25,7 @@ using mozilla::AutoSafeJSContext;
|
|||
DOMRequest::DOMRequest(nsPIDOMWindow* aWindow)
|
||||
: DOMEventTargetHelper(aWindow->IsInnerWindow() ?
|
||||
aWindow : aWindow->GetCurrentInnerWindow())
|
||||
, mResult(JSVAL_VOID)
|
||||
, mResult(JS::UndefinedValue())
|
||||
, mDone(false)
|
||||
{
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(DOMRequest,
|
|||
DOMEventTargetHelper)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mError)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPromise)
|
||||
tmp->mResult = JSVAL_VOID;
|
||||
tmp->mResult.setUndefined();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_TRACE_BEGIN_INHERITED(DOMRequest,
|
||||
|
@ -111,7 +111,7 @@ DOMRequest::FireSuccess(JS::Handle<JS::Value> aResult)
|
|||
{
|
||||
NS_ASSERTION(!mDone, "mDone shouldn't have been set to true already!");
|
||||
NS_ASSERTION(!mError, "mError shouldn't have been set!");
|
||||
NS_ASSERTION(mResult == JSVAL_VOID, "mResult shouldn't have been set!");
|
||||
NS_ASSERTION(mResult.isUndefined(), "mResult shouldn't have been set!");
|
||||
|
||||
mDone = true;
|
||||
if (aResult.isGCThing()) {
|
||||
|
@ -131,7 +131,7 @@ DOMRequest::FireError(const nsAString& aError)
|
|||
{
|
||||
NS_ASSERTION(!mDone, "mDone shouldn't have been set to true already!");
|
||||
NS_ASSERTION(!mError, "mError shouldn't have been set!");
|
||||
NS_ASSERTION(mResult == JSVAL_VOID, "mResult shouldn't have been set!");
|
||||
NS_ASSERTION(mResult.isUndefined(), "mResult shouldn't have been set!");
|
||||
|
||||
mDone = true;
|
||||
mError = new DOMError(GetOwner(), aError);
|
||||
|
@ -148,7 +148,7 @@ DOMRequest::FireError(nsresult aError)
|
|||
{
|
||||
NS_ASSERTION(!mDone, "mDone shouldn't have been set to true already!");
|
||||
NS_ASSERTION(!mError, "mError shouldn't have been set!");
|
||||
NS_ASSERTION(mResult == JSVAL_VOID, "mResult shouldn't have been set!");
|
||||
NS_ASSERTION(mResult.isUndefined(), "mResult shouldn't have been set!");
|
||||
|
||||
mDone = true;
|
||||
mError = new DOMError(GetOwner(), aError);
|
||||
|
@ -165,7 +165,7 @@ DOMRequest::FireDetailedError(DOMError* aError)
|
|||
{
|
||||
NS_ASSERTION(!mDone, "mDone shouldn't have been set to true already!");
|
||||
NS_ASSERTION(!mError, "mError shouldn't have been set!");
|
||||
NS_ASSERTION(mResult == JSVAL_VOID, "mResult shouldn't have been set!");
|
||||
NS_ASSERTION(mResult.isUndefined(), "mResult shouldn't have been set!");
|
||||
NS_ASSERTION(aError, "No detailed error provided");
|
||||
|
||||
mDone = true;
|
||||
|
|
|
@ -58,7 +58,7 @@ public:
|
|||
|
||||
void GetResult(JSContext*, JS::MutableHandle<JS::Value> aRetval) const
|
||||
{
|
||||
NS_ASSERTION(mDone || mResult == JSVAL_VOID,
|
||||
NS_ASSERTION(mDone || mResult.isUndefined(),
|
||||
"Result should be undefined when pending");
|
||||
JS::ExposeValueToActiveJS(mResult);
|
||||
aRetval.set(mResult);
|
||||
|
|
|
@ -1075,7 +1075,7 @@ nsFrameMessageManager::ReceiveMessage(nsISupports* aTarget,
|
|||
thisValue.setObject(*object);
|
||||
}
|
||||
|
||||
JS::Rooted<JS::Value> rval(cx, JSVAL_VOID);
|
||||
JS::Rooted<JS::Value> rval(cx, JS::UndefinedValue());
|
||||
JS::Rooted<JS::Value> argv(cx, JS::ObjectValue(*param));
|
||||
|
||||
{
|
||||
|
|
|
@ -302,7 +302,7 @@ nsXMLHttpRequest::nsXMLHttpRequest()
|
|||
mIsAnon(false),
|
||||
mFirstStartRequestSeen(false),
|
||||
mInLoadProgressEvent(false),
|
||||
mResultJSON(JSVAL_VOID),
|
||||
mResultJSON(JS::UndefinedValue()),
|
||||
mResultArrayBuffer(nullptr),
|
||||
mIsMappedArrayBuffer(false),
|
||||
mXPCOMifier(nullptr)
|
||||
|
@ -324,7 +324,7 @@ nsXMLHttpRequest::~nsXMLHttpRequest()
|
|||
NS_ABORT_IF_FALSE(!(mState & XML_HTTP_REQUEST_SYNCLOOPING), "we rather crash than hang");
|
||||
mState &= ~XML_HTTP_REQUEST_SYNCLOOPING;
|
||||
|
||||
mResultJSON = JSVAL_VOID;
|
||||
mResultJSON.setUndefined();
|
||||
mResultArrayBuffer = nullptr;
|
||||
mozilla::DropJSObjects(this);
|
||||
}
|
||||
|
@ -429,7 +429,7 @@ nsXMLHttpRequest::ResetResponse()
|
|||
mBlobSet = nullptr;
|
||||
mResultArrayBuffer = nullptr;
|
||||
mArrayBufferBuilder.reset();
|
||||
mResultJSON = JSVAL_VOID;
|
||||
mResultJSON.setUndefined();
|
||||
mDataAvailable = 0;
|
||||
mLoadTransferred = 0;
|
||||
mResponseBodyDecodedPos = 0;
|
||||
|
@ -489,7 +489,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsXMLHttpRequest,
|
|||
nsXHREventTarget)
|
||||
tmp->mResultArrayBuffer = nullptr;
|
||||
tmp->mArrayBufferBuilder.reset();
|
||||
tmp->mResultJSON = JSVAL_VOID;
|
||||
tmp->mResultJSON.setUndefined();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mContext)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mChannel)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mResponseXML)
|
||||
|
|
|
@ -193,7 +193,7 @@ ErrorResult::ThrowJSException(JSContext* cx, JS::Handle<JS::Value> exn)
|
|||
// Make sure mJSException is initialized _before_ we try to root it. But
|
||||
// don't set it to exn yet, because we don't want to do that until after we
|
||||
// root.
|
||||
mJSException = JS::UndefinedValue();
|
||||
mJSException.setUndefined();
|
||||
if (!js::AddRawValueRoot(cx, &mJSException, "ErrorResult::mJSException")) {
|
||||
// Don't use NS_ERROR_DOM_JS_EXCEPTION, because that indicates we have
|
||||
// in fact rooted mJSException.
|
||||
|
|
|
@ -7877,7 +7877,7 @@ class CGGenericSetter(CGAbstractBindingMethod):
|
|||
if (!setter(cx, obj, self, JSJitSetterCallArgs(args))) {
|
||||
return false;
|
||||
}
|
||||
args.rval().set(JSVAL_VOID);
|
||||
args.rval().setUndefined();
|
||||
#ifdef DEBUG
|
||||
AssertReturnTypeMatchesJitinfo(info, args.rval());
|
||||
#endif
|
||||
|
|
|
@ -64,7 +64,7 @@ BluetoothReplyRunnable::Run()
|
|||
nsresult rv;
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
JS::Rooted<JS::Value> v(cx, JSVAL_VOID);
|
||||
JS::Rooted<JS::Value> v(cx, JS::UndefinedValue());
|
||||
|
||||
if (mReply->type() != BluetoothReply::TBluetoothReplySuccess) {
|
||||
rv = FireReply(v);
|
||||
|
|
|
@ -99,7 +99,7 @@ BluetoothReplyRunnable::Run()
|
|||
MOZ_ASSERT(mReply);
|
||||
|
||||
AutoSafeJSContext cx;
|
||||
JS::Rooted<JS::Value> v(cx, JSVAL_VOID);
|
||||
JS::Rooted<JS::Value> v(cx, JS::UndefinedValue());
|
||||
|
||||
nsresult rv;
|
||||
if (mReply->type() != BluetoothReply::TBluetoothReplySuccess) {
|
||||
|
|
|
@ -2270,10 +2270,10 @@ nsDOMDeviceStorageCursor::Continue(ErrorResult& aRv)
|
|||
return;
|
||||
}
|
||||
|
||||
if (mResult != JSVAL_VOID) {
|
||||
if (!mResult.isUndefined()) {
|
||||
// We call onsuccess multiple times. Clear the last
|
||||
// result.
|
||||
mResult = JSVAL_VOID;
|
||||
mResult.setUndefined();
|
||||
mDone = false;
|
||||
}
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace dom {
|
|||
NS_IMPL_CYCLE_COLLECTION_CLASS(MessageEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(MessageEvent, Event)
|
||||
tmp->mData = JSVAL_VOID;
|
||||
tmp->mData.setUndefined();
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mWindowSource)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPortSource)
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mPorts)
|
||||
|
@ -46,13 +46,13 @@ MessageEvent::MessageEvent(EventTarget* aOwner,
|
|||
nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent)
|
||||
: Event(aOwner, aPresContext, aEvent)
|
||||
, mData(JSVAL_VOID)
|
||||
, mData(JS::UndefinedValue())
|
||||
{
|
||||
}
|
||||
|
||||
MessageEvent::~MessageEvent()
|
||||
{
|
||||
mData = JSVAL_VOID;
|
||||
mData.setUndefined();
|
||||
DropJSObjects(this);
|
||||
}
|
||||
|
||||
|
|
|
@ -35,9 +35,9 @@ IDBCursor::IDBCursor(Type aType,
|
|||
, mSourceIndex(aBackgroundActor->GetIndex())
|
||||
, mTransaction(mRequest->GetTransaction())
|
||||
, mScriptOwner(mTransaction->Database()->GetScriptOwner())
|
||||
, mCachedKey(JSVAL_VOID)
|
||||
, mCachedPrimaryKey(JSVAL_VOID)
|
||||
, mCachedValue(JSVAL_VOID)
|
||||
, mCachedKey(JS::UndefinedValue())
|
||||
, mCachedPrimaryKey(JS::UndefinedValue())
|
||||
, mCachedValue(JS::UndefinedValue())
|
||||
, mKey(aKey)
|
||||
, mType(aType)
|
||||
, mDirection(aBackgroundActor->GetDirection())
|
||||
|
|
|
@ -48,7 +48,7 @@ GenerateRequest(IDBIndex* aIndex)
|
|||
|
||||
IDBIndex::IDBIndex(IDBObjectStore* aObjectStore, const IndexMetadata* aMetadata)
|
||||
: mObjectStore(aObjectStore)
|
||||
, mCachedKeyPath(JSVAL_VOID)
|
||||
, mCachedKeyPath(JS::UndefinedValue())
|
||||
, mMetadata(aMetadata)
|
||||
, mId(aMetadata->id())
|
||||
, mRooted(false)
|
||||
|
@ -63,7 +63,7 @@ IDBIndex::~IDBIndex()
|
|||
AssertIsOnOwningThread();
|
||||
|
||||
if (mRooted) {
|
||||
mCachedKeyPath = JSVAL_VOID;
|
||||
mCachedKeyPath.setUndefined();
|
||||
mozilla::DropJSObjects(this);
|
||||
}
|
||||
}
|
||||
|
@ -559,7 +559,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(IDBIndex)
|
|||
|
||||
// Don't unlink mObjectStore!
|
||||
|
||||
tmp->mCachedKeyPath = JSVAL_VOID;
|
||||
tmp->mCachedKeyPath.setUndefined();
|
||||
|
||||
if (tmp->mRooted) {
|
||||
mozilla::DropJSObjects(tmp);
|
||||
|
|
|
@ -44,8 +44,8 @@ IDBKeyRange::IDBKeyRange(nsISupports* aGlobal,
|
|||
bool aUpperOpen,
|
||||
bool aIsOnly)
|
||||
: mGlobal(aGlobal)
|
||||
, mCachedLowerVal(JSVAL_VOID)
|
||||
, mCachedUpperVal(JSVAL_VOID)
|
||||
, mCachedLowerVal(JS::UndefinedValue())
|
||||
, mCachedUpperVal(JS::UndefinedValue())
|
||||
, mLowerOpen(aLowerOpen)
|
||||
, mUpperOpen(aUpperOpen)
|
||||
, mIsOnly(aIsOnly)
|
||||
|
|
|
@ -856,7 +856,7 @@ const JSClass IDBObjectStore::sDummyPropJSClass = {
|
|||
IDBObjectStore::IDBObjectStore(IDBTransaction* aTransaction,
|
||||
const ObjectStoreSpec* aSpec)
|
||||
: mTransaction(aTransaction)
|
||||
, mCachedKeyPath(JSVAL_VOID)
|
||||
, mCachedKeyPath(JS::UndefinedValue())
|
||||
, mSpec(aSpec)
|
||||
, mId(aSpec->metadata().id())
|
||||
, mRooted(false)
|
||||
|
@ -871,7 +871,7 @@ IDBObjectStore::~IDBObjectStore()
|
|||
AssertIsOnOwningThread();
|
||||
|
||||
if (mRooted) {
|
||||
mCachedKeyPath = JSVAL_VOID;
|
||||
mCachedKeyPath.setUndefined();
|
||||
mozilla::DropJSObjects(this);
|
||||
}
|
||||
}
|
||||
|
@ -1487,7 +1487,7 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(IDBObjectStore)
|
|||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK(mIndexes);
|
||||
|
||||
tmp->mCachedKeyPath = JSVAL_VOID;
|
||||
tmp->mCachedKeyPath.setUndefined();
|
||||
|
||||
if (tmp->mRooted) {
|
||||
mozilla::DropJSObjects(tmp);
|
||||
|
|
|
@ -118,7 +118,7 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
|||
IDB_ENSURE_TRUE(ok, NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR);
|
||||
|
||||
// Treat explicitly undefined as an error.
|
||||
if (intermediate == JSVAL_VOID) {
|
||||
if (intermediate.isUndefined()) {
|
||||
return NS_ERROR_DOM_INDEXEDDB_DATA_ERR;
|
||||
}
|
||||
if (tokenizer.hasMoreTokens()) {
|
||||
|
@ -149,7 +149,7 @@ GetJSValFromKeyPathString(JSContext* aCx,
|
|||
// We have started inserting new objects or are about to just insert
|
||||
// the first one.
|
||||
|
||||
*aKeyJSVal = JSVAL_VOID;
|
||||
aKeyJSVal->setUndefined();
|
||||
|
||||
if (tokenizer.hasMoreTokens()) {
|
||||
// If we're not at the end, we need to add a dummy object to the
|
||||
|
|
|
@ -119,7 +119,7 @@ MobileConnectionInfo::Update(nsIMobileConnectionInfo* aInfo)
|
|||
|
||||
// Update mSignalStrength
|
||||
AutoJSContext cx;
|
||||
JS::Rooted<JS::Value> signalStrength(cx, JSVAL_VOID);
|
||||
JS::Rooted<JS::Value> signalStrength(cx, JS::UndefinedValue());
|
||||
aInfo->GetSignalStrength(&signalStrength);
|
||||
if (signalStrength.isNumber()) {
|
||||
mSignalStrength.SetValue(signalStrength.toNumber());
|
||||
|
@ -128,7 +128,7 @@ MobileConnectionInfo::Update(nsIMobileConnectionInfo* aInfo)
|
|||
}
|
||||
|
||||
// Update mRelSignalStrength
|
||||
JS::Rooted<JS::Value> relSignalStrength(cx, JSVAL_VOID);
|
||||
JS::Rooted<JS::Value> relSignalStrength(cx, JS::UndefinedValue());
|
||||
aInfo->GetRelSignalStrength(&relSignalStrength);
|
||||
if (relSignalStrength.isNumber()) {
|
||||
mRelSignalStrength.SetValue(relSignalStrength.toNumber());
|
||||
|
|
|
@ -496,7 +496,7 @@ NPVariantToJSVal(NPP npp, JSContext *cx, const NPVariant *variant)
|
|||
{
|
||||
switch (variant->type) {
|
||||
case NPVariantType_Void :
|
||||
return JSVAL_VOID;
|
||||
return JS::UndefinedValue();
|
||||
case NPVariantType_Null :
|
||||
return JSVAL_NULL;
|
||||
case NPVariantType_Bool :
|
||||
|
@ -546,7 +546,7 @@ NPVariantToJSVal(NPP npp, JSContext *cx, const NPVariant *variant)
|
|||
|
||||
NS_ERROR("Unable to convert NPVariant to jsval!");
|
||||
|
||||
return JSVAL_VOID;
|
||||
return JS::UndefinedValue();
|
||||
}
|
||||
|
||||
bool
|
||||
|
@ -555,7 +555,7 @@ JSValToNPVariant(NPP npp, JSContext *cx, JS::Value val, NPVariant *variant)
|
|||
NS_ASSERTION(npp, "Must have an NPP to wrap a jsval!");
|
||||
|
||||
if (val.isPrimitive()) {
|
||||
if (val == JSVAL_VOID) {
|
||||
if (val.isUndefined()) {
|
||||
VOID_TO_NPVARIANT(*variant);
|
||||
} else if (val.isNull()) {
|
||||
NULL_TO_NPVARIANT(*variant);
|
||||
|
@ -1724,7 +1724,7 @@ NPObjWrapper_Convert(JSContext *cx, JS::Handle<JSObject*> obj, JSType hint, JS::
|
|||
// called with no arguments. We work around this problem by giving plugins a
|
||||
// [[DefaultValue]] which uses only toString and not valueOf.
|
||||
|
||||
JS::Rooted<JS::Value> v(cx, JSVAL_VOID);
|
||||
JS::Rooted<JS::Value> v(cx, JS::UndefinedValue());
|
||||
if (!JS_GetProperty(cx, obj, "toString", &v))
|
||||
return false;
|
||||
if (!v.isPrimitive() && JS::IsCallable(v.toObjectOrNull())) {
|
||||
|
|
|
@ -244,7 +244,7 @@ private:
|
|||
void MaybeReportRejectedOnce() {
|
||||
MaybeReportRejected();
|
||||
RemoveFeature();
|
||||
mResult = JS::UndefinedValue();
|
||||
mResult.setUndefined();
|
||||
}
|
||||
|
||||
void MaybeResolveInternal(JSContext* aCx,
|
||||
|
|
|
@ -454,7 +454,7 @@ public:
|
|||
EventRunnable(Proxy* aProxy, bool aUploadEvent, const nsString& aType,
|
||||
bool aLengthComputable, uint64_t aLoaded, uint64_t aTotal)
|
||||
: MainThreadProxyRunnable(aProxy->mWorkerPrivate, aProxy), mType(aType),
|
||||
mResponse(JSVAL_VOID), mLoaded(aLoaded), mTotal(aTotal),
|
||||
mResponse(JS::UndefinedValue()), mLoaded(aLoaded), mTotal(aTotal),
|
||||
mEventStreamId(aProxy->mInnerEventStreamId), mStatus(0), mReadyState(0),
|
||||
mUploadEvent(aUploadEvent), mProgressEvent(true),
|
||||
mLengthComputable(aLengthComputable), mUseCachedArrayBufferResponse(false),
|
||||
|
@ -463,7 +463,7 @@ public:
|
|||
|
||||
EventRunnable(Proxy* aProxy, bool aUploadEvent, const nsString& aType)
|
||||
: MainThreadProxyRunnable(aProxy->mWorkerPrivate, aProxy), mType(aType),
|
||||
mResponse(JSVAL_VOID), mLoaded(0), mTotal(0),
|
||||
mResponse(JS::UndefinedValue()), mLoaded(0), mTotal(0),
|
||||
mEventStreamId(aProxy->mInnerEventStreamId), mStatus(0), mReadyState(0),
|
||||
mUploadEvent(aUploadEvent), mProgressEvent(false), mLengthComputable(0),
|
||||
mUseCachedArrayBufferResponse(false), mResponseTextResult(NS_OK),
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
nsresult mResponseResult;
|
||||
|
||||
StateData()
|
||||
: mStatus(0), mReadyState(0), mResponse(JSVAL_VOID),
|
||||
: mStatus(0), mReadyState(0), mResponse(JS::UndefinedValue()),
|
||||
mResponseTextResult(NS_OK), mStatusResult(NS_OK),
|
||||
mResponseResult(NS_OK)
|
||||
{ }
|
||||
|
|
Загрузка…
Ссылка в новой задаче