/* -*- 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/BasePrincipal.h" #include "mozilla/dom/nsCSPUtils.h" #include "mozilla/dom/BrowserChild.h" #include "mozilla/dom/ReferrerInfo.h" #include "mozilla/ipc/BackgroundUtils.h" #include "mozilla/ipc/PBackgroundSharedTypes.h" #include "mozilla/LoadContext.h" #include "mozilla/StorageAccess.h" #include "mozilla/StoragePrincipalHelper.h" #include "nsContentUtils.h" #include "nsIContentSecurityPolicy.h" #include "nsICookieJarSettings.h" #include "nsINetworkInterceptController.h" #include "nsIProtocolHandler.h" #include "nsIReferrerInfo.h" #include "nsIBrowserChild.h" #include "nsScriptSecurityManager.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(std::move(aDoomed)), mLoadGroupToCancel(std::move(aLoadGroupToCancel)) {} NS_INLINE_DECL_REFCOUNTING_INHERITED(MainThreadReleaseRunnable, Runnable) NS_IMETHOD Run() override { if (mLoadGroupToCancel) { mLoadGroupToCancel->CancelWithReason( NS_BINDING_ABORTED, "WorkerLoadInfo::MainThreadReleaseRunnable"_ns); mLoadGroupToCancel = nullptr; } mDoomed.Clear(); return NS_OK; } private: ~MainThreadReleaseRunnable() = default; }; // Specialize this if there's some class that has multiple nsISupports bases. template struct ISupportsBaseInfo { using ISupportsBase = T; }; template