зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1119026 - Respect skip serviceworker flag. r=baku,bkelly
--HG-- extra : rebase_source : 569b51af36fd8c19b59c5d01b88dadddc84d4153
This commit is contained in:
Родитель
bf76a3c4e1
Коммит
ebb4d89793
|
@ -241,6 +241,11 @@ FetchRequest(nsIGlobalObject* aGlobal, const RequestOrUSVString& aInput,
|
|||
} else {
|
||||
WorkerPrivate* worker = GetCurrentThreadWorkerPrivate();
|
||||
MOZ_ASSERT(worker);
|
||||
|
||||
if (worker->IsServiceWorker()) {
|
||||
r->SetSkipServiceWorker();
|
||||
}
|
||||
|
||||
nsRefPtr<MainThreadFetchRunnable> run = new MainThreadFetchRunnable(worker, p, r);
|
||||
if (NS_FAILED(NS_DispatchToMainThread(run))) {
|
||||
NS_WARNING("MainThreadFetchRunnable dispatch failed!");
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
#include "nsIInputStream.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIHttpChannel.h"
|
||||
#include "nsIHttpChannelInternal.h"
|
||||
#include "nsIHttpHeaderVisitor.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIThreadRetargetableRequest.h"
|
||||
|
@ -450,6 +451,14 @@ FetchDriver::HttpFetch(bool aCORSFlag, bool aCORSPreflightFlag, bool aAuthentica
|
|||
}
|
||||
}
|
||||
|
||||
// Set skip serviceworker flag.
|
||||
// While the spec also gates on the client being a ServiceWorker, we can't
|
||||
// infer that here. Instead we rely on callers to set the flag correctly.
|
||||
if (mRequest->SkipServiceWorker()) {
|
||||
nsCOMPtr<nsIHttpChannelInternal> internalChan = do_QueryInterface(httpChan);
|
||||
internalChan->ForceNoIntercept();
|
||||
}
|
||||
|
||||
// Set up a CORS proxy that will handle the various requirements of the CORS
|
||||
// protocol. It handles the preflight cache and CORS response headers.
|
||||
// If the request is allowed, it will start our original request
|
||||
|
|
|
@ -179,6 +179,18 @@ public:
|
|||
mReferrer.Assign(aReferrer);
|
||||
}
|
||||
|
||||
bool
|
||||
SkipServiceWorker() const
|
||||
{
|
||||
return mSkipServiceWorker;
|
||||
}
|
||||
|
||||
void
|
||||
SetSkipServiceWorker()
|
||||
{
|
||||
mSkipServiceWorker = true;
|
||||
}
|
||||
|
||||
bool
|
||||
IsSynchronous() const
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче