Skip to content

Commit

Permalink
Bug 1360328 - Dispatch a runnable to RecheckCaptivePortal instead of …
Browse files Browse the repository at this point in the history
…calling it immediately r=mcmanus

MozReview-Commit-ID: HUPJUtho7g8

--HG--
extra : rebase_source : 7e3d9c787569352a598e0efe3393a3d9c14a637a
  • Loading branch information
valenting committed May 8, 2017
1 parent 4bf96ca commit 28675dc
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions netwerk/base/nsIOService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,14 @@ nsresult
nsIOService::RecheckCaptivePortal()
{
MOZ_ASSERT(NS_IsMainThread(), "Must be called on the main thread");
if (mCaptivePortalService) {
mCaptivePortalService->RecheckCaptivePortal();
if (!mCaptivePortalService) {
return NS_OK;
}
return NS_OK;
nsCOMPtr<nsIRunnable> task =
NewRunnableMethod("nsIOService::RecheckCaptivePortal",
mCaptivePortalService,
&nsICaptivePortalService::RecheckCaptivePortal);
return NS_DispatchToMainThread(task);
}

nsresult
Expand Down Expand Up @@ -410,7 +414,7 @@ nsIOService::RecheckCaptivePortalIfLocalRedirect(nsIChannel* newChan)
PRNetAddrToNetAddr(&prAddr, &netAddr);
if (IsIPAddrLocal(&netAddr)) {
// Redirects to local IP addresses are probably captive portals
mCaptivePortalService->RecheckCaptivePortal();
RecheckCaptivePortal();
}

return NS_OK;
Expand Down

0 comments on commit 28675dc

Please sign in to comment.