mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1199049 - Part 11: Make it impossible to start CORS preflights from outside of Necko; r=jduell,ckerschb,sicking
This commit is contained in:
parent
7d7e51e295
commit
cd8364d48a
@ -1290,13 +1290,13 @@ nsCORSListenerProxy::RemoveFromCorsPreflightCache(nsIURI* aURI,
|
||||
}
|
||||
|
||||
nsresult
|
||||
NS_StartCORSPreflight(nsIChannel* aRequestChannel,
|
||||
nsIStreamListener* aListener,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsICorsPreflightCallback* aCallback,
|
||||
bool aWithCredentials,
|
||||
nsTArray<nsCString>& aUnsafeHeaders,
|
||||
nsIChannel** aPreflightChannel)
|
||||
nsCORSListenerProxy::StartCORSPreflight(nsIChannel* aRequestChannel,
|
||||
nsIStreamListener* aListener,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsICorsPreflightCallback* aCallback,
|
||||
bool aWithCredentials,
|
||||
nsTArray<nsCString>& aUnsafeHeaders,
|
||||
nsIChannel** aPreflightChannel)
|
||||
{
|
||||
*aPreflightChannel = nullptr;
|
||||
|
||||
|
@ -24,18 +24,10 @@ class nsIPrincipal;
|
||||
class nsINetworkInterceptController;
|
||||
class nsICorsPreflightCallback;
|
||||
|
||||
nsresult
|
||||
NS_StartCORSPreflight(nsIChannel* aRequestChannel,
|
||||
nsIStreamListener* aListener,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsICorsPreflightCallback* aCallback,
|
||||
bool aWithCredentials,
|
||||
nsTArray<nsCString>& aACUnsafeHeaders,
|
||||
nsIChannel** aPreflightChannel);
|
||||
|
||||
namespace mozilla {
|
||||
namespace net {
|
||||
class HttpChannelParent;
|
||||
class nsHttpChannel;
|
||||
}
|
||||
}
|
||||
|
||||
@ -55,11 +47,6 @@ public:
|
||||
nsCORSListenerProxy(nsIStreamListener* aOuter,
|
||||
nsIPrincipal* aRequestingPrincipal,
|
||||
bool aWithCredentials);
|
||||
nsCORSListenerProxy(nsIStreamListener* aOuter,
|
||||
nsIPrincipal* aRequestingPrincipal,
|
||||
bool aWithCredentials,
|
||||
const nsCString& aPreflightMethod,
|
||||
const nsTArray<nsCString>& aPreflightHeaders);
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIREQUESTOBSERVER
|
||||
@ -81,10 +68,26 @@ public:
|
||||
private:
|
||||
// Only HttpChannelParent can call RemoveFromCorsPreflightCache
|
||||
friend class mozilla::net::HttpChannelParent;
|
||||
// Only nsHttpChannel can invoke CORS preflights
|
||||
friend class mozilla::net::nsHttpChannel;
|
||||
|
||||
static void RemoveFromCorsPreflightCache(nsIURI* aURI,
|
||||
nsIPrincipal* aRequestingPrincipal);
|
||||
|
||||
nsCORSListenerProxy(nsIStreamListener* aOuter,
|
||||
nsIPrincipal* aRequestingPrincipal,
|
||||
bool aWithCredentials,
|
||||
const nsCString& aPreflightMethod,
|
||||
const nsTArray<nsCString>& aPreflightHeaders);
|
||||
|
||||
static nsresult StartCORSPreflight(nsIChannel* aRequestChannel,
|
||||
nsIStreamListener* aListener,
|
||||
nsIPrincipal* aPrincipal,
|
||||
nsICorsPreflightCallback* aCallback,
|
||||
bool aWithCredentials,
|
||||
nsTArray<nsCString>& aACUnsafeHeaders,
|
||||
nsIChannel** aPreflightChannel);
|
||||
|
||||
~nsCORSListenerProxy();
|
||||
|
||||
nsresult UpdateChannel(nsIChannel* aChannel, DataURIHandling aAllowDataURI);
|
||||
|
@ -453,10 +453,12 @@ nsHttpChannel::ContinueConnect()
|
||||
if (!mIsCorsPreflightDone && mRequireCORSPreflight &&
|
||||
mInterceptCache != INTERCEPTED) {
|
||||
nsCOMPtr<nsIChannel> preflightChannel;
|
||||
nsresult rv = NS_StartCORSPreflight(this, mListener,
|
||||
mPreflightPrincipal, this,
|
||||
mWithCredentials, mUnsafeHeaders,
|
||||
getter_AddRefs(preflightChannel));
|
||||
nsresult rv =
|
||||
nsCORSListenerProxy::StartCORSPreflight(this, mListener,
|
||||
mPreflightPrincipal, this,
|
||||
mWithCredentials,
|
||||
mUnsafeHeaders,
|
||||
getter_AddRefs(preflightChannel));
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user