diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index eae632896218..bb2a03a0fc2d 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -9552,9 +9552,20 @@ nsDocShell::DoURILoad(nsIURI * aURI, if (mLoadType == LOAD_RELOAD_ALLOW_MIXED_CONTENT) { rv = SetMixedContentChannel(channel); NS_ENSURE_SUCCESS(rv, rv); - } else { - rv = SetMixedContentChannel(nullptr); - NS_ENSURE_SUCCESS(rv, rv); + } else if (mMixedContentChannel) { + /* + * If the user "Disables Protection on This Page", we call + * SetMixedContentChannel for the first time, otherwise + * mMixedContentChannel is still null. + * Later, if the new channel passes a same orign check, we remember the + * users decision by calling SetMixedContentChannel using the new channel. + * This way, the user does not have to click the disable protection button + * over and over for browsing the same site. + */ + rv = nsContentUtils::CheckSameOrigin(mMixedContentChannel, channel); + if (NS_FAILED(rv) || NS_FAILED(SetMixedContentChannel(channel))) { + SetMixedContentChannel(nullptr); + } } //hack