From 50bbfcb0223c7fa2a646da5a1c5c9453df3722b4 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Thu, 23 Jan 2014 20:14:35 +0000 Subject: [PATCH] Bug 931887 - Use swap() instead forget() in LoadInfo, r=bent --- dom/workers/WorkerPrivate.h | 28 +++++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/dom/workers/WorkerPrivate.h b/dom/workers/WorkerPrivate.h index bca93dd6ca21..0f277a9993cc 100644 --- a/dom/workers/WorkerPrivate.h +++ b/dom/workers/WorkerPrivate.h @@ -159,13 +159,27 @@ public: void StealFrom(LoadInfo& aOther) { - mBaseURI = aOther.mBaseURI.forget(); - mResolvedScriptURI = aOther.mResolvedScriptURI.forget(); - mPrincipal = aOther.mPrincipal.forget(); - mScriptContext = aOther.mScriptContext.forget(); - mWindow = aOther.mWindow.forget(); - mCSP = aOther.mCSP.forget(); - mChannel = aOther.mChannel.forget(); + MOZ_ASSERT(!mBaseURI); + aOther.mBaseURI.swap(mBaseURI); + + MOZ_ASSERT(!mResolvedScriptURI); + aOther.mResolvedScriptURI.swap(mResolvedScriptURI); + + MOZ_ASSERT(!mPrincipal); + aOther.mPrincipal.swap(mPrincipal); + + MOZ_ASSERT(!mScriptContext); + aOther.mScriptContext.swap(mScriptContext); + + MOZ_ASSERT(!mWindow); + aOther.mWindow.swap(mWindow); + + MOZ_ASSERT(!mCSP); + aOther.mCSP.swap(mCSP); + + MOZ_ASSERT(!mChannel); + aOther.mChannel.swap(mChannel); + mDomain = aOther.mDomain; mEvalAllowed = aOther.mEvalAllowed; mReportCSPViolations = aOther.mReportCSPViolations;