Bug 1236686 - Remove nsIFetchEventDispatcher; r=jdm
This commit is contained in:
@@ -14181,55 +14181,8 @@ nsDocShell::ShouldPrepareForIntercept(nsIURI* aURI, bool aIsNonSubresourceReques
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
namespace {
|
||||
|
||||
class FetchEventDispatcher final : public nsIFetchEventDispatcher
|
||||
{
|
||||
public:
|
||||
FetchEventDispatcher(nsIInterceptedChannel* aChannel,
|
||||
nsIRunnable* aContinueRunnable)
|
||||
: mChannel(aChannel)
|
||||
, mContinueRunnable(aContinueRunnable)
|
||||
{
|
||||
}
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIFETCHEVENTDISPATCHER
|
||||
|
||||
private:
|
||||
~FetchEventDispatcher()
|
||||
{
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInterceptedChannel> mChannel;
|
||||
nsCOMPtr<nsIRunnable> mContinueRunnable;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(FetchEventDispatcher, nsIFetchEventDispatcher)
|
||||
|
||||
NS_IMETHODIMP
|
||||
FetchEventDispatcher::Dispatch()
|
||||
{
|
||||
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
|
||||
if (!swm) {
|
||||
mChannel->Cancel(NS_ERROR_INTERCEPTION_FAILED);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
ErrorResult error;
|
||||
swm->DispatchPreparedFetchEvent(mChannel, mContinueRunnable, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.StealNSResult();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDocShell::ChannelIntercepted(nsIInterceptedChannel* aChannel,
|
||||
nsIFetchEventDispatcher** aFetchDispatcher)
|
||||
nsDocShell::ChannelIntercepted(nsIInterceptedChannel* aChannel)
|
||||
{
|
||||
RefPtr<ServiceWorkerManager> swm = ServiceWorkerManager::GetInstance();
|
||||
if (!swm) {
|
||||
@@ -14266,18 +14219,12 @@ nsDocShell::ChannelIntercepted(nsIInterceptedChannel* aChannel,
|
||||
attrs.InheritFromDocShellToDoc(GetOriginAttributes(), uri);
|
||||
|
||||
ErrorResult error;
|
||||
nsCOMPtr<nsIRunnable> runnable =
|
||||
swm->PrepareFetchEvent(attrs, doc, mInterceptedDocumentId, aChannel,
|
||||
isReload, isSubresourceLoad, error);
|
||||
swm->DispatchFetchEvent(attrs, doc, mInterceptedDocumentId, aChannel,
|
||||
isReload, isSubresourceLoad, error);
|
||||
if (NS_WARN_IF(error.Failed())) {
|
||||
return error.StealNSResult();
|
||||
}
|
||||
|
||||
MOZ_ASSERT(runnable);
|
||||
RefPtr<FetchEventDispatcher> dispatcher =
|
||||
new FetchEventDispatcher(aChannel, runnable);
|
||||
dispatcher.forget(aFetchDispatcher);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user