| File: | root/firefox-clang/obj-x86_64-pc-linux-gnu/netwerk/base/./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp |
| Warning: | line 266, column 5 Value stored to 'rv' is never read |
Press '?' to see keyboard shortcuts
Keyboard shortcuts:
| 1 | /* This Source Code Form is subject to the terms of the Mozilla Public |
| 2 | * License, v. 2.0. If a copy of the MPL was not distributed with this |
| 3 | * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ |
| 4 | |
| 5 | #include "nsAsyncRedirectVerifyHelper.h" |
| 6 | |
| 7 | #include "mozilla/Logging.h" |
| 8 | #include "mozilla/SpinEventLoopUntil.h" |
| 9 | #include "nsIAsyncVerifyRedirectCallback.h" |
| 10 | #include "nsIChannel.h" |
| 11 | #include "nsIHttpChannelInternal.h" |
| 12 | #include "nsILoadInfo.h" |
| 13 | #include "nsIOService.h" |
| 14 | #include "nsNetUtil.h" |
| 15 | #include "nsThreadUtils.h" |
| 16 | |
| 17 | namespace mozilla { |
| 18 | namespace net { |
| 19 | |
| 20 | static LazyLogModule gRedirectLog("nsRedirect"); |
| 21 | #undef LOG |
| 22 | #define LOG(args)do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, MOZ_LOG_EXPAND_ARGS args); } } while (0) MOZ_LOG(gRedirectLog, LogLevel::Debug, args)do { const ::mozilla::LogModule* moz_real_module = gRedirectLog ; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , LogLevel::Debug)), 0))) { mozilla::detail::log_print(moz_real_module , LogLevel::Debug, MOZ_LOG_EXPAND_ARGS args); } } while (0) |
| 23 | |
| 24 | NS_IMPL_ISUPPORTS(nsAsyncRedirectVerifyHelper, nsIAsyncVerifyRedirectCallback,MozExternalRefCountType nsAsyncRedirectVerifyHelper::AddRef(void ) { static_assert(!std::is_destructible_v<nsAsyncRedirectVerifyHelper >, "Reference-counted class " "nsAsyncRedirectVerifyHelper" " should not have a public destructor. " "Make this class's destructor non-public" ); do { static_assert( mozilla::detail::AssertionConditionType <decltype(int32_t(mRefCnt) >= 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(int32_t(mRefCnt) >= 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("int32_t(mRefCnt) >= 0" " (" "illegal refcnt" ")", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 25); AnnotateMozCrashReason("MOZ_ASSERT" "(" "int32_t(mRefCnt) >= 0" ") (" "illegal refcnt" ")"); do { MOZ_CrashSequence(__null, 25 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); do { static_assert( mozilla::detail::AssertionConditionType <decltype("nsAsyncRedirectVerifyHelper" != nullptr)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!("nsAsyncRedirectVerifyHelper" != nullptr))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("\"nsAsyncRedirectVerifyHelper\" != nullptr" " (" "Must specify a name" ")", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 25); AnnotateMozCrashReason("MOZ_ASSERT" "(" "\"nsAsyncRedirectVerifyHelper\" != nullptr" ") (" "Must specify a name" ")"); do { MOZ_CrashSequence(__null , 25); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); if (!mRefCnt.isThreadSafe) _mOwningThread.AssertOwnership ("nsAsyncRedirectVerifyHelper" " not thread-safe"); nsrefcnt count = ++mRefCnt; NS_LogAddRef((this), (count), ("nsAsyncRedirectVerifyHelper" ), (uint32_t)(sizeof(*this))); return count; } MozExternalRefCountType nsAsyncRedirectVerifyHelper::Release(void) { do { static_assert ( mozilla::detail::AssertionConditionType<decltype(int32_t (mRefCnt) > 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(int32_t(mRefCnt) > 0))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("int32_t(mRefCnt) > 0" " (" "dup release" ")", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 25); AnnotateMozCrashReason("MOZ_ASSERT" "(" "int32_t(mRefCnt) > 0" ") (" "dup release" ")"); do { MOZ_CrashSequence(__null, 25) ; __attribute__((nomerge)) ::abort(); } while (false); } } while (false); do { static_assert( mozilla::detail::AssertionConditionType <decltype("nsAsyncRedirectVerifyHelper" != nullptr)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!("nsAsyncRedirectVerifyHelper" != nullptr))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("\"nsAsyncRedirectVerifyHelper\" != nullptr" " (" "Must specify a name" ")", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 25); AnnotateMozCrashReason("MOZ_ASSERT" "(" "\"nsAsyncRedirectVerifyHelper\" != nullptr" ") (" "Must specify a name" ")"); do { MOZ_CrashSequence(__null , 25); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); if (!mRefCnt.isThreadSafe) _mOwningThread.AssertOwnership ("nsAsyncRedirectVerifyHelper" " not thread-safe"); const char * const nametmp = "nsAsyncRedirectVerifyHelper"; nsrefcnt count = --mRefCnt; NS_LogRelease((this), (count), (nametmp)); if ( count == 0) { mRefCnt = 1; delete (this); return 0; } return count ; } nsresult nsAsyncRedirectVerifyHelper::QueryInterface(const nsIID& aIID, void** aInstancePtr) { do { if (!(aInstancePtr )) { NS_DebugBreak(NS_DEBUG_ASSERTION, "QueryInterface requires a non-NULL destination!" , "aInstancePtr", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 25); MOZ_PretendNoReturn(); } } while (0); nsresult rv = NS_ERROR_FAILURE ; static_assert(3 > 0, "Need more arguments to NS_INTERFACE_TABLE" ); static const QITableEntry table[] = { {&mozilla::detail ::kImplementedIID<nsAsyncRedirectVerifyHelper, nsIAsyncVerifyRedirectCallback >, int32_t( reinterpret_cast<char*>(static_cast<nsIAsyncVerifyRedirectCallback *>((nsAsyncRedirectVerifyHelper*)0x1000)) - reinterpret_cast <char*>((nsAsyncRedirectVerifyHelper*)0x1000))}, {& mozilla::detail::kImplementedIID<nsAsyncRedirectVerifyHelper , nsIRunnable>, int32_t( reinterpret_cast<char*>(static_cast <nsIRunnable*>((nsAsyncRedirectVerifyHelper*)0x1000)) - reinterpret_cast<char*>((nsAsyncRedirectVerifyHelper*) 0x1000))}, {&mozilla::detail::kImplementedIID<nsAsyncRedirectVerifyHelper , nsINamed>, int32_t( reinterpret_cast<char*>(static_cast <nsINamed*>((nsAsyncRedirectVerifyHelper*)0x1000)) - reinterpret_cast <char*>((nsAsyncRedirectVerifyHelper*)0x1000))}, {& mozilla::detail::kImplementedIID<nsAsyncRedirectVerifyHelper , nsISupports>, int32_t(reinterpret_cast<char*>(static_cast <nsISupports*>( static_cast<nsIAsyncVerifyRedirectCallback *>((nsAsyncRedirectVerifyHelper*)0x1000))) - reinterpret_cast <char*>((nsAsyncRedirectVerifyHelper*)0x1000))}, { nullptr , 0 } } ; static_assert(std::size(table) > 1, "need at least 1 interface" ); rv = NS_TableDrivenQI(static_cast<void*>(this), aIID , aInstancePtr, table); return rv; } |
| 25 | nsIRunnable, nsINamed)MozExternalRefCountType nsAsyncRedirectVerifyHelper::AddRef(void ) { static_assert(!std::is_destructible_v<nsAsyncRedirectVerifyHelper >, "Reference-counted class " "nsAsyncRedirectVerifyHelper" " should not have a public destructor. " "Make this class's destructor non-public" ); do { static_assert( mozilla::detail::AssertionConditionType <decltype(int32_t(mRefCnt) >= 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(int32_t(mRefCnt) >= 0))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("int32_t(mRefCnt) >= 0" " (" "illegal refcnt" ")", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 25); AnnotateMozCrashReason("MOZ_ASSERT" "(" "int32_t(mRefCnt) >= 0" ") (" "illegal refcnt" ")"); do { MOZ_CrashSequence(__null, 25 ); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); do { static_assert( mozilla::detail::AssertionConditionType <decltype("nsAsyncRedirectVerifyHelper" != nullptr)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!("nsAsyncRedirectVerifyHelper" != nullptr))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("\"nsAsyncRedirectVerifyHelper\" != nullptr" " (" "Must specify a name" ")", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 25); AnnotateMozCrashReason("MOZ_ASSERT" "(" "\"nsAsyncRedirectVerifyHelper\" != nullptr" ") (" "Must specify a name" ")"); do { MOZ_CrashSequence(__null , 25); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); if (!mRefCnt.isThreadSafe) _mOwningThread.AssertOwnership ("nsAsyncRedirectVerifyHelper" " not thread-safe"); nsrefcnt count = ++mRefCnt; NS_LogAddRef((this), (count), ("nsAsyncRedirectVerifyHelper" ), (uint32_t)(sizeof(*this))); return count; } MozExternalRefCountType nsAsyncRedirectVerifyHelper::Release(void) { do { static_assert ( mozilla::detail::AssertionConditionType<decltype(int32_t (mRefCnt) > 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(int32_t(mRefCnt) > 0))), 0 ))) { do { } while (false); MOZ_ReportAssertionFailure("int32_t(mRefCnt) > 0" " (" "dup release" ")", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 25); AnnotateMozCrashReason("MOZ_ASSERT" "(" "int32_t(mRefCnt) > 0" ") (" "dup release" ")"); do { MOZ_CrashSequence(__null, 25) ; __attribute__((nomerge)) ::abort(); } while (false); } } while (false); do { static_assert( mozilla::detail::AssertionConditionType <decltype("nsAsyncRedirectVerifyHelper" != nullptr)>::isValid , "invalid assertion condition"); if ((__builtin_expect(!!(!( !!("nsAsyncRedirectVerifyHelper" != nullptr))), 0))) { do { } while (false); MOZ_ReportAssertionFailure("\"nsAsyncRedirectVerifyHelper\" != nullptr" " (" "Must specify a name" ")", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 25); AnnotateMozCrashReason("MOZ_ASSERT" "(" "\"nsAsyncRedirectVerifyHelper\" != nullptr" ") (" "Must specify a name" ")"); do { MOZ_CrashSequence(__null , 25); __attribute__((nomerge)) ::abort(); } while (false); } } while (false); if (!mRefCnt.isThreadSafe) _mOwningThread.AssertOwnership ("nsAsyncRedirectVerifyHelper" " not thread-safe"); const char * const nametmp = "nsAsyncRedirectVerifyHelper"; nsrefcnt count = --mRefCnt; NS_LogRelease((this), (count), (nametmp)); if ( count == 0) { mRefCnt = 1; delete (this); return 0; } return count ; } nsresult nsAsyncRedirectVerifyHelper::QueryInterface(const nsIID& aIID, void** aInstancePtr) { do { if (!(aInstancePtr )) { NS_DebugBreak(NS_DEBUG_ASSERTION, "QueryInterface requires a non-NULL destination!" , "aInstancePtr", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 25); MOZ_PretendNoReturn(); } } while (0); nsresult rv = NS_ERROR_FAILURE ; static_assert(3 > 0, "Need more arguments to NS_INTERFACE_TABLE" ); static const QITableEntry table[] = { {&mozilla::detail ::kImplementedIID<nsAsyncRedirectVerifyHelper, nsIAsyncVerifyRedirectCallback >, int32_t( reinterpret_cast<char*>(static_cast<nsIAsyncVerifyRedirectCallback *>((nsAsyncRedirectVerifyHelper*)0x1000)) - reinterpret_cast <char*>((nsAsyncRedirectVerifyHelper*)0x1000))}, {& mozilla::detail::kImplementedIID<nsAsyncRedirectVerifyHelper , nsIRunnable>, int32_t( reinterpret_cast<char*>(static_cast <nsIRunnable*>((nsAsyncRedirectVerifyHelper*)0x1000)) - reinterpret_cast<char*>((nsAsyncRedirectVerifyHelper*) 0x1000))}, {&mozilla::detail::kImplementedIID<nsAsyncRedirectVerifyHelper , nsINamed>, int32_t( reinterpret_cast<char*>(static_cast <nsINamed*>((nsAsyncRedirectVerifyHelper*)0x1000)) - reinterpret_cast <char*>((nsAsyncRedirectVerifyHelper*)0x1000))}, {& mozilla::detail::kImplementedIID<nsAsyncRedirectVerifyHelper , nsISupports>, int32_t(reinterpret_cast<char*>(static_cast <nsISupports*>( static_cast<nsIAsyncVerifyRedirectCallback *>((nsAsyncRedirectVerifyHelper*)0x1000))) - reinterpret_cast <char*>((nsAsyncRedirectVerifyHelper*)0x1000))}, { nullptr , 0 } } ; static_assert(std::size(table) > 1, "need at least 1 interface" ); rv = NS_TableDrivenQI(static_cast<void*>(this), aIID , aInstancePtr, table); return rv; } |
| 26 | |
| 27 | class nsAsyncVerifyRedirectCallbackEvent : public Runnable { |
| 28 | public: |
| 29 | nsAsyncVerifyRedirectCallbackEvent(nsIAsyncVerifyRedirectCallback* cb, |
| 30 | nsresult result) |
| 31 | : Runnable("nsAsyncVerifyRedirectCallbackEvent"), |
| 32 | mCallback(cb), |
| 33 | mResult(result) {} |
| 34 | |
| 35 | NS_IMETHODvirtual nsresult Run() override { |
| 36 | LOG(do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncVerifyRedirectCallbackEvent::Run() " "callback to %p with result %" "x", mCallback.get(), static_cast <uint32_t>(mResult)); } } while (0) |
| 37 | ("nsAsyncVerifyRedirectCallbackEvent::Run() "do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncVerifyRedirectCallbackEvent::Run() " "callback to %p with result %" "x", mCallback.get(), static_cast <uint32_t>(mResult)); } } while (0) |
| 38 | "callback to %p with result %" PRIx32,do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncVerifyRedirectCallbackEvent::Run() " "callback to %p with result %" "x", mCallback.get(), static_cast <uint32_t>(mResult)); } } while (0) |
| 39 | mCallback.get(), static_cast<uint32_t>(mResult)))do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncVerifyRedirectCallbackEvent::Run() " "callback to %p with result %" "x", mCallback.get(), static_cast <uint32_t>(mResult)); } } while (0); |
| 40 | (void)mCallback->OnRedirectVerifyCallback(mResult); |
| 41 | return NS_OK; |
| 42 | } |
| 43 | |
| 44 | private: |
| 45 | nsCOMPtr<nsIAsyncVerifyRedirectCallback> mCallback; |
| 46 | nsresult mResult; |
| 47 | }; |
| 48 | |
| 49 | nsAsyncRedirectVerifyHelper::~nsAsyncRedirectVerifyHelper() { |
| 50 | NS_ASSERTION(NS_FAILED(mResult) || mExpectedCallbacks == 0,do { if (!(((bool)(__builtin_expect(!!(NS_FAILED_impl(mResult )), 0))) || mExpectedCallbacks == 0)) { NS_DebugBreak(NS_DEBUG_ASSERTION , "Did not receive all required callbacks!", "NS_FAILED(mResult) || mExpectedCallbacks == 0" , "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp", 51 ); MOZ_PretendNoReturn(); } } while (0) |
| 51 | "Did not receive all required callbacks!")do { if (!(((bool)(__builtin_expect(!!(NS_FAILED_impl(mResult )), 0))) || mExpectedCallbacks == 0)) { NS_DebugBreak(NS_DEBUG_ASSERTION , "Did not receive all required callbacks!", "NS_FAILED(mResult) || mExpectedCallbacks == 0" , "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp", 51 ); MOZ_PretendNoReturn(); } } while (0); |
| 52 | } |
| 53 | |
| 54 | nsresult nsAsyncRedirectVerifyHelper::Init( |
| 55 | nsIChannel* oldChan, nsIChannel* newChan, uint32_t flags, |
| 56 | nsIEventTarget* mainThreadEventTarget, bool synchronize) { |
| 57 | LOG(do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::Init() " "oldChan=%p newChan=%p", oldChan, newChan); } } while (0) |
| 58 | ("nsAsyncRedirectVerifyHelper::Init() "do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::Init() " "oldChan=%p newChan=%p", oldChan, newChan); } } while (0) |
| 59 | "oldChan=%p newChan=%p",do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::Init() " "oldChan=%p newChan=%p", oldChan, newChan); } } while (0) |
| 60 | oldChan, newChan))do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::Init() " "oldChan=%p newChan=%p", oldChan, newChan); } } while (0); |
| 61 | mOldChan = oldChan; |
| 62 | mNewChan = newChan; |
| 63 | mFlags = flags; |
| 64 | mCallbackEventTarget = NS_IsMainThread() && mainThreadEventTarget |
| 65 | ? mainThreadEventTarget |
| 66 | : GetCurrentSerialEventTarget(); |
| 67 | |
| 68 | if (!(flags & (nsIChannelEventSink::REDIRECT_INTERNAL | |
| 69 | nsIChannelEventSink::REDIRECT_STS_UPGRADE | |
| 70 | nsIChannelEventSink::REDIRECT_TRANSPARENT))) { |
| 71 | nsCOMPtr<nsILoadInfo> loadInfo = oldChan->LoadInfo(); |
| 72 | if (loadInfo->GetDontFollowRedirects()) { |
| 73 | ExplicitCallback(NS_BINDING_ABORTED); |
| 74 | return NS_OK; |
| 75 | } |
| 76 | } |
| 77 | |
| 78 | if (synchronize) mWaitingForRedirectCallback = true; |
| 79 | |
| 80 | nsCOMPtr<nsIRunnable> runnable = this; |
| 81 | nsresult rv; |
| 82 | rv = mainThreadEventTarget |
| 83 | ? mainThreadEventTarget->Dispatch(runnable.forget()) |
| 84 | : GetMainThreadSerialEventTarget()->Dispatch(runnable.forget()); |
| 85 | NS_ENSURE_SUCCESS(rv, rv)do { nsresult __rv = rv; if (((bool)(__builtin_expect(!!(NS_FAILED_impl (__rv)), 0)))) { const char* name = mozilla::GetStaticErrorName (__rv); mozilla::SmprintfPointer msg = mozilla::Smprintf( "NS_ENSURE_SUCCESS(%s, %s) failed with " "result 0x%" "X" "%s%s%s", "rv", "rv", static_cast<uint32_t >(__rv), name ? " (" : "", name ? name : "", name ? ")" : "" ); NS_DebugBreak(NS_DEBUG_WARNING, msg.get(), nullptr, "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 85); return rv; } } while (false); |
| 86 | |
| 87 | if (synchronize) { |
| 88 | if (!SpinEventLoopUntil("nsAsyncRedirectVerifyHelper::Init"_ns, |
| 89 | [&]() { return !mWaitingForRedirectCallback; })) { |
| 90 | return NS_ERROR_UNEXPECTED; |
| 91 | } |
| 92 | } |
| 93 | |
| 94 | return NS_OK; |
| 95 | } |
| 96 | |
| 97 | NS_IMETHODIMPnsresult |
| 98 | nsAsyncRedirectVerifyHelper::OnRedirectVerifyCallback(nsresult result) { |
| 99 | LOG(do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::OnRedirectVerifyCallback() " "result=%" "x" " expectedCBs=%u mResult=%" "x", static_cast< uint32_t>(result), mExpectedCallbacks, static_cast<uint32_t >(mResult)); } } while (0) |
| 100 | ("nsAsyncRedirectVerifyHelper::OnRedirectVerifyCallback() "do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::OnRedirectVerifyCallback() " "result=%" "x" " expectedCBs=%u mResult=%" "x", static_cast< uint32_t>(result), mExpectedCallbacks, static_cast<uint32_t >(mResult)); } } while (0) |
| 101 | "result=%" PRIx32 " expectedCBs=%u mResult=%" PRIx32,do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::OnRedirectVerifyCallback() " "result=%" "x" " expectedCBs=%u mResult=%" "x", static_cast< uint32_t>(result), mExpectedCallbacks, static_cast<uint32_t >(mResult)); } } while (0) |
| 102 | static_cast<uint32_t>(result), mExpectedCallbacks,do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::OnRedirectVerifyCallback() " "result=%" "x" " expectedCBs=%u mResult=%" "x", static_cast< uint32_t>(result), mExpectedCallbacks, static_cast<uint32_t >(mResult)); } } while (0) |
| 103 | static_cast<uint32_t>(mResult)))do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::OnRedirectVerifyCallback() " "result=%" "x" " expectedCBs=%u mResult=%" "x", static_cast< uint32_t>(result), mExpectedCallbacks, static_cast<uint32_t >(mResult)); } } while (0); |
| 104 | |
| 105 | MOZ_DIAGNOSTIC_ASSERT(do { static_assert( mozilla::detail::AssertionConditionType< decltype(mExpectedCallbacks > 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(mExpectedCallbacks > 0))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("mExpectedCallbacks > 0" " (" "OnRedirectVerifyCallback called more times than expected" ")", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 107); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "mExpectedCallbacks > 0" ") (" "OnRedirectVerifyCallback called more times than expected" ")"); do { MOZ_CrashSequence(__null, 107); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 106 | mExpectedCallbacks > 0,do { static_assert( mozilla::detail::AssertionConditionType< decltype(mExpectedCallbacks > 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(mExpectedCallbacks > 0))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("mExpectedCallbacks > 0" " (" "OnRedirectVerifyCallback called more times than expected" ")", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 107); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "mExpectedCallbacks > 0" ") (" "OnRedirectVerifyCallback called more times than expected" ")"); do { MOZ_CrashSequence(__null, 107); __attribute__((nomerge )) ::abort(); } while (false); } } while (false) |
| 107 | "OnRedirectVerifyCallback called more times than expected")do { static_assert( mozilla::detail::AssertionConditionType< decltype(mExpectedCallbacks > 0)>::isValid, "invalid assertion condition" ); if ((__builtin_expect(!!(!(!!(mExpectedCallbacks > 0))) , 0))) { do { } while (false); MOZ_ReportAssertionFailure("mExpectedCallbacks > 0" " (" "OnRedirectVerifyCallback called more times than expected" ")", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 107); AnnotateMozCrashReason("MOZ_DIAGNOSTIC_ASSERT" "(" "mExpectedCallbacks > 0" ") (" "OnRedirectVerifyCallback called more times than expected" ")"); do { MOZ_CrashSequence(__null, 107); __attribute__((nomerge )) ::abort(); } while (false); } } while (false); |
| 108 | if (mExpectedCallbacks <= 0) { |
| 109 | return NS_ERROR_UNEXPECTED; |
| 110 | } |
| 111 | |
| 112 | --mExpectedCallbacks; |
| 113 | |
| 114 | // If response indicates failure we may call back immediately |
| 115 | if (NS_FAILED(result)((bool)(__builtin_expect(!!(NS_FAILED_impl(result)), 0)))) { |
| 116 | // We chose to store the first failure-value (as opposed to the last) |
| 117 | if (NS_SUCCEEDED(mResult)((bool)(__builtin_expect(!!(!NS_FAILED_impl(mResult)), 1)))) mResult = result; |
| 118 | |
| 119 | // If InitCallback() has been called, just invoke the callback and |
| 120 | // return. Otherwise it will be invoked from InitCallback() |
| 121 | if (mCallbackInitiated) { |
| 122 | ExplicitCallback(mResult); |
| 123 | return NS_OK; |
| 124 | } |
| 125 | } |
| 126 | |
| 127 | // If the expected-counter is in balance and InitCallback() was called, all |
| 128 | // sinks have agreed that the redirect is ok and we can invoke our callback |
| 129 | if (mCallbackInitiated && mExpectedCallbacks == 0) { |
| 130 | ExplicitCallback(mResult); |
| 131 | } |
| 132 | |
| 133 | return NS_OK; |
| 134 | } |
| 135 | |
| 136 | nsresult nsAsyncRedirectVerifyHelper::DelegateOnChannelRedirect( |
| 137 | nsIChannelEventSink* sink, nsIChannel* oldChannel, nsIChannel* newChannel, |
| 138 | uint32_t flags) { |
| 139 | LOG(do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::DelegateOnChannelRedirect() " "sink=%p expectedCBs=%u mResult=%" "x", sink, mExpectedCallbacks , static_cast<uint32_t>(mResult)); } } while (0) |
| 140 | ("nsAsyncRedirectVerifyHelper::DelegateOnChannelRedirect() "do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::DelegateOnChannelRedirect() " "sink=%p expectedCBs=%u mResult=%" "x", sink, mExpectedCallbacks , static_cast<uint32_t>(mResult)); } } while (0) |
| 141 | "sink=%p expectedCBs=%u mResult=%" PRIx32,do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::DelegateOnChannelRedirect() " "sink=%p expectedCBs=%u mResult=%" "x", sink, mExpectedCallbacks , static_cast<uint32_t>(mResult)); } } while (0) |
| 142 | sink, mExpectedCallbacks, static_cast<uint32_t>(mResult)))do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::DelegateOnChannelRedirect() " "sink=%p expectedCBs=%u mResult=%" "x", sink, mExpectedCallbacks , static_cast<uint32_t>(mResult)); } } while (0); |
| 143 | |
| 144 | ++mExpectedCallbacks; |
| 145 | |
| 146 | if (IsOldChannelCanceled()) { |
| 147 | LOG(do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, " old channel has been canceled, cancel the redirect by " "emulating OnRedirectVerifyCallback..."); } } while (0) |
| 148 | (" old channel has been canceled, cancel the redirect by "do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, " old channel has been canceled, cancel the redirect by " "emulating OnRedirectVerifyCallback..."); } } while (0) |
| 149 | "emulating OnRedirectVerifyCallback..."))do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, " old channel has been canceled, cancel the redirect by " "emulating OnRedirectVerifyCallback..."); } } while (0); |
| 150 | (void)OnRedirectVerifyCallback(NS_BINDING_ABORTED); |
| 151 | return NS_BINDING_ABORTED; |
| 152 | } |
| 153 | |
| 154 | nsresult rv = |
| 155 | sink->AsyncOnChannelRedirect(oldChannel, newChannel, flags, this); |
| 156 | |
| 157 | LOG((" result=%" PRIx32 " expectedCBs=%u", static_cast<uint32_t>(rv),do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, " result=%" "x" " expectedCBs=%u" , static_cast<uint32_t>(rv), mExpectedCallbacks); } } while (0) |
| 158 | mExpectedCallbacks))do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, " result=%" "x" " expectedCBs=%u" , static_cast<uint32_t>(rv), mExpectedCallbacks); } } while (0); |
| 159 | |
| 160 | // If the sink returns failure from this call the redirect is vetoed. We |
| 161 | // emulate a callback from the sink in this case in order to perform all |
| 162 | // the necessary logic. |
| 163 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 164 | LOG((" emulating OnRedirectVerifyCallback..."))do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, " emulating OnRedirectVerifyCallback..." ); } } while (0); |
| 165 | (void)OnRedirectVerifyCallback(rv); |
| 166 | } |
| 167 | |
| 168 | return rv; // Return the actual status since our caller may need it |
| 169 | } |
| 170 | |
| 171 | void nsAsyncRedirectVerifyHelper::ExplicitCallback(nsresult result) { |
| 172 | LOG(do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "result=%" "x" " expectedCBs=%u mCallbackInitiated=%u mResult=%" "x", static_cast<uint32_t>(result), mExpectedCallbacks , mCallbackInitiated, static_cast<uint32_t>(mResult)); } } while (0) |
| 173 | ("nsAsyncRedirectVerifyHelper::ExplicitCallback() "do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "result=%" "x" " expectedCBs=%u mCallbackInitiated=%u mResult=%" "x", static_cast<uint32_t>(result), mExpectedCallbacks , mCallbackInitiated, static_cast<uint32_t>(mResult)); } } while (0) |
| 174 | "result=%" PRIx32do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "result=%" "x" " expectedCBs=%u mCallbackInitiated=%u mResult=%" "x", static_cast<uint32_t>(result), mExpectedCallbacks , mCallbackInitiated, static_cast<uint32_t>(mResult)); } } while (0) |
| 175 | " expectedCBs=%u mCallbackInitiated=%u mResult=%" PRIx32,do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "result=%" "x" " expectedCBs=%u mCallbackInitiated=%u mResult=%" "x", static_cast<uint32_t>(result), mExpectedCallbacks , mCallbackInitiated, static_cast<uint32_t>(mResult)); } } while (0) |
| 176 | static_cast<uint32_t>(result), mExpectedCallbacks, mCallbackInitiated,do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "result=%" "x" " expectedCBs=%u mCallbackInitiated=%u mResult=%" "x", static_cast<uint32_t>(result), mExpectedCallbacks , mCallbackInitiated, static_cast<uint32_t>(mResult)); } } while (0) |
| 177 | static_cast<uint32_t>(mResult)))do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "result=%" "x" " expectedCBs=%u mCallbackInitiated=%u mResult=%" "x", static_cast<uint32_t>(result), mExpectedCallbacks , mCallbackInitiated, static_cast<uint32_t>(mResult)); } } while (0); |
| 178 | |
| 179 | nsCOMPtr<nsIAsyncVerifyRedirectCallback> callback( |
| 180 | do_QueryInterface(mOldChan)); |
| 181 | |
| 182 | if (!callback || !mCallbackEventTarget) { |
| 183 | LOG(do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "callback=%p mCallbackEventTarget=%p", callback.get(), mCallbackEventTarget .get()); } } while (0) |
| 184 | ("nsAsyncRedirectVerifyHelper::ExplicitCallback() "do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "callback=%p mCallbackEventTarget=%p", callback.get(), mCallbackEventTarget .get()); } } while (0) |
| 185 | "callback=%p mCallbackEventTarget=%p",do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "callback=%p mCallbackEventTarget=%p", callback.get(), mCallbackEventTarget .get()); } } while (0) |
| 186 | callback.get(), mCallbackEventTarget.get()))do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "callback=%p mCallbackEventTarget=%p", callback.get(), mCallbackEventTarget .get()); } } while (0); |
| 187 | return; |
| 188 | } |
| 189 | |
| 190 | mCallbackInitiated = false; // reset to ensure only one callback |
| 191 | mWaitingForRedirectCallback = false; |
| 192 | |
| 193 | // Now, dispatch the callback on the event-target which called Init() |
| 194 | nsCOMPtr<nsIRunnable> event = |
| 195 | new nsAsyncVerifyRedirectCallbackEvent(callback, result); |
| 196 | if (!event) { |
| 197 | NS_WARNING(NS_DebugBreak(NS_DEBUG_WARNING, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "failed creating callback event!", nullptr, "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 199) |
| 198 | "nsAsyncRedirectVerifyHelper::ExplicitCallback() "NS_DebugBreak(NS_DEBUG_WARNING, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "failed creating callback event!", nullptr, "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 199) |
| 199 | "failed creating callback event!")NS_DebugBreak(NS_DEBUG_WARNING, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "failed creating callback event!", nullptr, "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 199); |
| 200 | return; |
| 201 | } |
| 202 | nsresult rv = mCallbackEventTarget->Dispatch(event, NS_DISPATCH_NORMALnsIEventTarget::DISPATCH_NORMAL); |
| 203 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 204 | NS_WARNING(NS_DebugBreak(NS_DEBUG_WARNING, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "failed dispatching callback event!", nullptr, "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 206) |
| 205 | "nsAsyncRedirectVerifyHelper::ExplicitCallback() "NS_DebugBreak(NS_DEBUG_WARNING, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "failed dispatching callback event!", nullptr, "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 206) |
| 206 | "failed dispatching callback event!")NS_DebugBreak(NS_DEBUG_WARNING, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "failed dispatching callback event!", nullptr, "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 206); |
| 207 | } else { |
| 208 | LOG(do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "dispatched callback event=%p", event.get()); } } while (0) |
| 209 | ("nsAsyncRedirectVerifyHelper::ExplicitCallback() "do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "dispatched callback event=%p", event.get()); } } while (0) |
| 210 | "dispatched callback event=%p",do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "dispatched callback event=%p", event.get()); } } while (0) |
| 211 | event.get()))do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::ExplicitCallback() " "dispatched callback event=%p", event.get()); } } while (0); |
| 212 | } |
| 213 | } |
| 214 | |
| 215 | void nsAsyncRedirectVerifyHelper::InitCallback() { |
| 216 | LOG(do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::InitCallback() " "expectedCBs=%d mResult=%" "x", mExpectedCallbacks, static_cast <uint32_t>(mResult)); } } while (0) |
| 217 | ("nsAsyncRedirectVerifyHelper::InitCallback() "do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::InitCallback() " "expectedCBs=%d mResult=%" "x", mExpectedCallbacks, static_cast <uint32_t>(mResult)); } } while (0) |
| 218 | "expectedCBs=%d mResult=%" PRIx32,do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::InitCallback() " "expectedCBs=%d mResult=%" "x", mExpectedCallbacks, static_cast <uint32_t>(mResult)); } } while (0) |
| 219 | mExpectedCallbacks, static_cast<uint32_t>(mResult)))do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::InitCallback() " "expectedCBs=%d mResult=%" "x", mExpectedCallbacks, static_cast <uint32_t>(mResult)); } } while (0); |
| 220 | |
| 221 | mCallbackInitiated = true; |
| 222 | |
| 223 | // Invoke the callback if we are done |
| 224 | if (mExpectedCallbacks == 0) ExplicitCallback(mResult); |
| 225 | } |
| 226 | |
| 227 | NS_IMETHODIMPnsresult |
| 228 | nsAsyncRedirectVerifyHelper::GetName(nsACString& aName) { |
| 229 | aName.AssignLiteral("nsAsyncRedirectVerifyHelper"); |
| 230 | return NS_OK; |
| 231 | } |
| 232 | |
| 233 | NS_IMETHODIMPnsresult |
| 234 | nsAsyncRedirectVerifyHelper::Run() { |
| 235 | /* If the channel got canceled after it fired AsyncOnChannelRedirect |
| 236 | * and before we got here, mostly because docloader load has been canceled, |
| 237 | * we must completely ignore this notification and prevent any further |
| 238 | * notification. |
| 239 | */ |
| 240 | if (IsOldChannelCanceled()) { |
| 241 | ExplicitCallback(NS_BINDING_ABORTED); |
| 242 | return NS_OK; |
| 243 | } |
| 244 | |
| 245 | // If transparent, avoid notifying the observers. |
| 246 | if (mFlags & nsIChannelEventSink::REDIRECT_TRANSPARENT) { |
| 247 | ExplicitCallback(NS_OK); |
| 248 | return NS_OK; |
| 249 | } |
| 250 | |
| 251 | // First, the global observer |
| 252 | NS_ASSERTION(gIOService, "Must have an IO service at this point")do { if (!(gIOService)) { NS_DebugBreak(NS_DEBUG_ASSERTION, "Must have an IO service at this point" , "gIOService", "./../../../netwerk/base/nsAsyncRedirectVerifyHelper.cpp" , 252); MOZ_PretendNoReturn(); } } while (0); |
| 253 | LOG(("nsAsyncRedirectVerifyHelper::Run() calling gIOService..."))do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::Run() calling gIOService..." ); } } while (0); |
| 254 | nsresult rv = |
| 255 | gIOService->AsyncOnChannelRedirect(mOldChan, mNewChan, mFlags, this); |
| 256 | if (NS_FAILED(rv)((bool)(__builtin_expect(!!(NS_FAILED_impl(rv)), 0)))) { |
| 257 | ExplicitCallback(rv); |
| 258 | return NS_OK; |
| 259 | } |
| 260 | |
| 261 | // Now, the per-channel observers |
| 262 | nsCOMPtr<nsIChannelEventSink> sink; |
| 263 | NS_QueryNotificationCallbacks(mOldChan, sink); |
| 264 | if (sink) { |
| 265 | LOG(("nsAsyncRedirectVerifyHelper::Run() calling sink..."))do { const ::mozilla::LogModule* moz_real_module = gIDLog; if ((__builtin_expect(!!(mozilla::detail::log_test(moz_real_module , mozilla::LogLevel::Debug)), 0))) { mozilla::detail::log_print (moz_real_module, mozilla::LogLevel::Debug, "nsAsyncRedirectVerifyHelper::Run() calling sink..." ); } } while (0); |
| 266 | rv = DelegateOnChannelRedirect(sink, mOldChan, mNewChan, mFlags); |
Value stored to 'rv' is never read | |
| 267 | } |
| 268 | |
| 269 | // All invocations to AsyncOnChannelRedirect has been done - call |
| 270 | // InitCallback() to flag this |
| 271 | InitCallback(); |
| 272 | return NS_OK; |
| 273 | } |
| 274 | |
| 275 | bool nsAsyncRedirectVerifyHelper::IsOldChannelCanceled() { |
| 276 | if (!mOldChan) { |
| 277 | return false; |
| 278 | } |
| 279 | bool canceled; |
| 280 | nsresult rv = mOldChan->GetCanceled(&canceled); |
| 281 | return NS_SUCCEEDED(rv)((bool)(__builtin_expect(!!(!NS_FAILED_impl(rv)), 1))) && canceled; |
| 282 | } |
| 283 | |
| 284 | } // namespace net |
| 285 | } // namespace mozilla |