зеркало из https://github.com/mozilla/pjs.git
Bug 573873: Make sure to propagate redirect notifications whenever we don't kill the redirect for plugins. r=jst sr=bz a=blocking2.0betaN+
This commit is contained in:
Родитель
a340167558
Коммит
032c95d881
|
@ -1520,6 +1520,8 @@ public:
|
||||||
static void ASCIIToUpper(nsAString& aStr);
|
static void ASCIIToUpper(nsAString& aStr);
|
||||||
static void ASCIIToUpper(const nsAString& aSource, nsAString& aDest);
|
static void ASCIIToUpper(const nsAString& aSource, nsAString& aDest);
|
||||||
|
|
||||||
|
// Returns NS_OK for same origin, error (NS_ERROR_DOM_BAD_URI) if not.
|
||||||
|
static nsresult CheckSameOrigin(nsIChannel *aOldChannel, nsIChannel *aNewChannel);
|
||||||
static nsIInterfaceRequestor* GetSameOriginChecker();
|
static nsIInterfaceRequestor* GetSameOriginChecker();
|
||||||
|
|
||||||
static nsIThreadJSContextStack* ThreadJSContextStack()
|
static nsIThreadJSContextStack* ThreadJSContextStack()
|
||||||
|
|
|
@ -73,10 +73,10 @@ public:
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentUtils, NS_ICONTENTUTILS_IID)
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentUtils, NS_ICONTENTUTILS_IID)
|
||||||
|
|
||||||
// {60083ad4-f7ed-488b-a706-bacb378fe1a5}
|
// {c7193287-3e3d-467f-b6da-47b914eb4c83}
|
||||||
#define NS_ICONTENTUTILS2_IID \
|
#define NS_ICONTENTUTILS2_IID \
|
||||||
{ 0x60083ad4, 0xf7ed, 0x488b, \
|
{ 0xc7193287, 0x3e3d, 0x467f, \
|
||||||
{ 0xa7, 0x06, 0xba, 0xcb, 0x37, 0x8f, 0xe1, 0xa5 } }
|
{ 0xb6, 0xda, 0x47, 0xb9, 0x14, 0xeb, 0x4c, 0x83 } }
|
||||||
|
|
||||||
class nsIContentUtils2 : public nsISupports
|
class nsIContentUtils2 : public nsISupports
|
||||||
{
|
{
|
||||||
|
@ -85,6 +85,8 @@ public:
|
||||||
NS_DECL_ISUPPORTS
|
NS_DECL_ISUPPORTS
|
||||||
|
|
||||||
virtual nsIInterfaceRequestor* GetSameOriginChecker();
|
virtual nsIInterfaceRequestor* GetSameOriginChecker();
|
||||||
|
// Returns NS_OK for same origin, error (NS_ERROR_DOM_BAD_URI) if not.
|
||||||
|
virtual nsresult CheckSameOrigin(nsIChannel *aOldChannel, nsIChannel *aNewChannel);
|
||||||
};
|
};
|
||||||
|
|
||||||
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentUtils2, NS_ICONTENTUTILS2_IID)
|
NS_DEFINE_STATIC_IID_ACCESSOR(nsIContentUtils2, NS_ICONTENTUTILS2_IID)
|
||||||
|
|
|
@ -5212,18 +5212,10 @@ nsContentUtils::GetSameOriginChecker()
|
||||||
return sSameOriginChecker;
|
return sSameOriginChecker;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* static */
|
||||||
NS_IMPL_ISUPPORTS2(nsSameOriginChecker,
|
nsresult
|
||||||
nsIChannelEventSink,
|
nsContentUtils::CheckSameOrigin(nsIChannel *aOldChannel, nsIChannel *aNewChannel)
|
||||||
nsIInterfaceRequestor)
|
|
||||||
|
|
||||||
NS_IMETHODIMP
|
|
||||||
nsSameOriginChecker::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
|
|
||||||
nsIChannel *aNewChannel,
|
|
||||||
PRUint32 aFlags,
|
|
||||||
nsIAsyncVerifyRedirectCallback *cb)
|
|
||||||
{
|
{
|
||||||
NS_PRECONDITION(aNewChannel, "Redirecting to null channel?");
|
|
||||||
if (!nsContentUtils::GetSecurityManager())
|
if (!nsContentUtils::GetSecurityManager())
|
||||||
return NS_ERROR_NOT_AVAILABLE;
|
return NS_ERROR_NOT_AVAILABLE;
|
||||||
|
|
||||||
|
@ -5243,11 +5235,27 @@ nsSameOriginChecker::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
|
||||||
rv = oldPrincipal->CheckMayLoad(newOriginalURI, PR_FALSE);
|
rv = oldPrincipal->CheckMayLoad(newOriginalURI, PR_FALSE);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (NS_FAILED(rv))
|
return rv;
|
||||||
return rv;
|
}
|
||||||
|
|
||||||
cb->OnRedirectVerifyCallback(NS_OK);
|
NS_IMPL_ISUPPORTS2(nsSameOriginChecker,
|
||||||
return NS_OK;
|
nsIChannelEventSink,
|
||||||
|
nsIInterfaceRequestor)
|
||||||
|
|
||||||
|
NS_IMETHODIMP
|
||||||
|
nsSameOriginChecker::AsyncOnChannelRedirect(nsIChannel *aOldChannel,
|
||||||
|
nsIChannel *aNewChannel,
|
||||||
|
PRUint32 aFlags,
|
||||||
|
nsIAsyncVerifyRedirectCallback *cb)
|
||||||
|
{
|
||||||
|
NS_PRECONDITION(aNewChannel, "Redirecting to null channel?");
|
||||||
|
|
||||||
|
nsresult rv = nsContentUtils::CheckSameOrigin(aOldChannel, aNewChannel);
|
||||||
|
if (NS_SUCCEEDED(rv)) {
|
||||||
|
cb->OnRedirectVerifyCallback(NS_OK);
|
||||||
|
}
|
||||||
|
|
||||||
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
NS_IMETHODIMP
|
NS_IMETHODIMP
|
||||||
|
@ -6518,3 +6526,9 @@ nsIContentUtils2::GetSameOriginChecker()
|
||||||
{
|
{
|
||||||
return nsContentUtils::GetSameOriginChecker();
|
return nsContentUtils::GetSameOriginChecker();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nsresult
|
||||||
|
nsIContentUtils2::CheckSameOrigin(nsIChannel *aOldChannel, nsIChannel *aNewChannel)
|
||||||
|
{
|
||||||
|
return nsContentUtils::CheckSameOrigin(aOldChannel, aNewChannel);
|
||||||
|
}
|
||||||
|
|
|
@ -1307,12 +1307,10 @@ nsPluginStreamListenerPeer::AsyncOnChannelRedirect(nsIChannel *oldChannel, nsICh
|
||||||
if (method.EqualsLiteral("POST")) {
|
if (method.EqualsLiteral("POST")) {
|
||||||
nsCOMPtr<nsIContentUtils2> contentUtils2 = do_GetService("@mozilla.org/content/contentutils2;1");
|
nsCOMPtr<nsIContentUtils2> contentUtils2 = do_GetService("@mozilla.org/content/contentutils2;1");
|
||||||
NS_ENSURE_TRUE(contentUtils2, NS_ERROR_FAILURE);
|
NS_ENSURE_TRUE(contentUtils2, NS_ERROR_FAILURE);
|
||||||
|
rv = contentUtils2->CheckSameOrigin(oldChannel, newChannel);
|
||||||
nsCOMPtr<nsIInterfaceRequestor> sameOriginChecker = contentUtils2->GetSameOriginChecker();
|
if (NS_FAILED(rv)) {
|
||||||
nsCOMPtr<nsIChannelEventSink> sameOriginChannelEventSink = do_GetInterface(sameOriginChecker);
|
return rv;
|
||||||
NS_ENSURE_TRUE(sameOriginChannelEventSink, NS_ERROR_FAILURE);
|
}
|
||||||
|
|
||||||
return sameOriginChannelEventSink->AsyncOnChannelRedirect(oldChannel, newChannel, flags, callback);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче