From 0fd3dd2bfb5b1511f0c27d1b0d7da5ee82ce00d4 Mon Sep 17 00:00:00 2001 From: Ben Kelly Date: Thu, 2 Jul 2015 07:30:06 -0700 Subject: [PATCH] Bug 1178508 ServiceWorker scripts should never be intercepted. r=baku --- dom/workers/ScriptLoader.cpp | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/dom/workers/ScriptLoader.cpp b/dom/workers/ScriptLoader.cpp index 285ed1594f6d..32321cce6a62 100644 --- a/dom/workers/ScriptLoader.cpp +++ b/dom/workers/ScriptLoader.cpp @@ -10,6 +10,7 @@ #include "nsIContentPolicy.h" #include "nsIContentSecurityPolicy.h" #include "nsIHttpChannel.h" +#include "nsIHttpChannelInternal.h" #include "nsIInputStreamPump.h" #include "nsIIOService.h" #include "nsIProtocolHandler.h" @@ -870,6 +871,16 @@ private: return rv; } + // If we are loading a script for a ServiceWorker then we must not + // try to intercept it. If the interception matches the current + // ServiceWorker's scope then we could deadlock the load. + if (mWorkerPrivate->IsServiceWorker()) { + nsCOMPtr internal = do_QueryInterface(channel); + if (internal) { + internal->ForceNoIntercept(); + } + } + if (loadInfo.mCacheStatus != ScriptLoadInfo::ToBeCached) { rv = channel->AsyncOpen(loader, indexSupports); if (NS_WARN_IF(NS_FAILED(rv))) {