/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* vim: set ts=8 sts=2 et sw=2 tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "WorkerLoadInfo.h" #include "WorkerPrivate.h" #include "mozilla/dom/TabChild.h" #include "mozilla/ipc/BackgroundUtils.h" #include "mozilla/ipc/PBackgroundSharedTypes.h" #include "mozilla/LoadContext.h" #include "nsContentUtils.h" #include "nsIContentSecurityPolicy.h" #include "nsINetworkInterceptController.h" #include "nsIProtocolHandler.h" #include "nsITabChild.h" #include "nsNetUtil.h" namespace mozilla { using namespace ipc; namespace dom { namespace { class MainThreadReleaseRunnable final : public Runnable { nsTArray> mDoomed; nsCOMPtr mLoadGroupToCancel; public: MainThreadReleaseRunnable(nsTArray>& aDoomed, nsCOMPtr& aLoadGroupToCancel) : mozilla::Runnable("MainThreadReleaseRunnable") { mDoomed.SwapElements(aDoomed); mLoadGroupToCancel.swap(aLoadGroupToCancel); } NS_INLINE_DECL_REFCOUNTING_INHERITED(MainThreadReleaseRunnable, Runnable) NS_IMETHOD Run() override { if (mLoadGroupToCancel) { mLoadGroupToCancel->Cancel(NS_BINDING_ABORTED); mLoadGroupToCancel = nullptr; } mDoomed.Clear(); return NS_OK; } private: ~MainThreadReleaseRunnable() { } }; // Specialize this if there's some class that has multiple nsISupports bases. template struct ISupportsBaseInfo { typedef T ISupportsBase; }; template