1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 /* This Source Code Form is subject to the terms of the Mozilla Public
4 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
5 * You can obtain one at http://mozilla.org/MPL/2.0/. */
7 #ifndef mozilla_dom_workers_WorkerCommon_h
8 #define mozilla_dom_workers_WorkerCommon_h
10 #include "js/TypeDecls.h"
12 class nsPIDOMWindowInner
;
14 namespace mozilla::dom
{
18 // All of these are implemented in RuntimeService.cpp
20 WorkerPrivate
* GetWorkerPrivateFromContext(JSContext
* aCx
);
22 WorkerPrivate
* GetCurrentThreadWorkerPrivate();
24 bool IsCurrentThreadRunningWorker();
26 bool IsCurrentThreadRunningChromeWorker();
28 JSContext
* GetCurrentWorkerThreadJSContext();
30 JSObject
* GetCurrentThreadWorkerGlobal();
32 JSObject
* GetCurrentThreadWorkerDebuggerGlobal();
34 void CancelWorkersForWindow(const nsPIDOMWindowInner
& aWindow
);
36 void FreezeWorkersForWindow(const nsPIDOMWindowInner
& aWindow
);
38 void ThawWorkersForWindow(const nsPIDOMWindowInner
& aWindow
);
40 void SuspendWorkersForWindow(const nsPIDOMWindowInner
& aWindow
);
42 void ResumeWorkersForWindow(const nsPIDOMWindowInner
& aWindow
);
44 void PropagateStorageAccessPermissionGrantedToWorkers(
45 const nsPIDOMWindowInner
& aWindow
);
47 // All of these are implemented in WorkerScope.cpp
49 bool IsWorkerGlobal(JSObject
* global
);
51 bool IsWorkerDebuggerGlobal(JSObject
* global
);
53 bool IsWorkerDebuggerSandbox(JSObject
* object
);
55 } // namespace mozilla::dom
57 #endif // mozilla_dom_workers_WorkerCommon_h