2015-05-03 22:32:37 +03:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-03-31 08:42:20 +04:00
|
|
|
/* 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/. */
|
2008-11-27 09:16:40 +03:00
|
|
|
|
2018-01-30 12:10:04 +03:00
|
|
|
#ifndef mozilla_dom_workers_WorkerCommon_h
|
|
|
|
#define mozilla_dom_workers_WorkerCommon_h
|
2008-11-27 09:16:40 +03:00
|
|
|
|
2020-11-23 19:12:34 +03:00
|
|
|
#include "js/TypeDecls.h"
|
2008-11-27 09:16:40 +03:00
|
|
|
|
2016-01-30 20:05:36 +03:00
|
|
|
class nsPIDOMWindowInner;
|
2015-02-12 12:50:05 +03:00
|
|
|
|
2022-05-09 23:41:20 +03:00
|
|
|
namespace mozilla::dom {
|
2018-01-30 12:12:04 +03:00
|
|
|
|
2018-01-31 10:24:08 +03:00
|
|
|
class WorkerPrivate;
|
|
|
|
|
2011-07-17 23:09:13 +04:00
|
|
|
// All of these are implemented in RuntimeService.cpp
|
2014-07-04 23:41:27 +04:00
|
|
|
|
2018-01-31 10:24:30 +03:00
|
|
|
WorkerPrivate* GetWorkerPrivateFromContext(JSContext* aCx);
|
|
|
|
|
|
|
|
WorkerPrivate* GetCurrentThreadWorkerPrivate();
|
|
|
|
|
2018-03-13 23:16:54 +03:00
|
|
|
bool IsCurrentThreadRunningWorker();
|
|
|
|
|
2018-01-31 10:24:30 +03:00
|
|
|
bool IsCurrentThreadRunningChromeWorker();
|
|
|
|
|
2018-02-05 21:55:07 +03:00
|
|
|
JSContext* GetCurrentWorkerThreadJSContext();
|
2018-01-31 10:24:30 +03:00
|
|
|
|
|
|
|
JSObject* GetCurrentThreadWorkerGlobal();
|
|
|
|
|
2019-03-25 12:26:48 +03:00
|
|
|
JSObject* GetCurrentThreadWorkerDebuggerGlobal();
|
|
|
|
|
2020-06-02 11:53:52 +03:00
|
|
|
void CancelWorkersForWindow(const nsPIDOMWindowInner& aWindow);
|
2011-07-17 23:09:13 +04:00
|
|
|
|
2020-06-02 11:53:52 +03:00
|
|
|
void FreezeWorkersForWindow(const nsPIDOMWindowInner& aWindow);
|
2011-07-17 23:09:13 +04:00
|
|
|
|
2020-06-02 11:53:52 +03:00
|
|
|
void ThawWorkersForWindow(const nsPIDOMWindowInner& aWindow);
|
2011-07-17 23:09:13 +04:00
|
|
|
|
2020-06-02 11:53:52 +03:00
|
|
|
void SuspendWorkersForWindow(const nsPIDOMWindowInner& aWindow);
|
2015-10-07 13:20:59 +03:00
|
|
|
|
2020-06-02 11:53:52 +03:00
|
|
|
void ResumeWorkersForWindow(const nsPIDOMWindowInner& aWindow);
|
2015-10-07 13:20:59 +03:00
|
|
|
|
2020-06-03 09:10:58 +03:00
|
|
|
void PropagateStorageAccessPermissionGrantedToWorkers(
|
2020-06-02 11:53:52 +03:00
|
|
|
const nsPIDOMWindowInner& aWindow);
|
2018-07-10 11:09:59 +03:00
|
|
|
|
2018-01-31 10:24:30 +03:00
|
|
|
// All of these are implemented in WorkerScope.cpp
|
2012-03-09 13:48:50 +04:00
|
|
|
|
2015-03-04 02:51:53 +03:00
|
|
|
bool IsWorkerGlobal(JSObject* global);
|
|
|
|
|
2018-02-05 21:55:07 +03:00
|
|
|
bool IsWorkerDebuggerGlobal(JSObject* global);
|
2015-03-04 02:51:53 +03:00
|
|
|
|
2018-02-05 21:55:07 +03:00
|
|
|
bool IsWorkerDebuggerSandbox(JSObject* object);
|
2015-03-31 13:22:40 +03:00
|
|
|
|
2022-05-09 23:41:20 +03:00
|
|
|
} // namespace mozilla::dom
|
2011-07-17 23:09:13 +04:00
|
|
|
|
2018-01-30 12:10:04 +03:00
|
|
|
#endif // mozilla_dom_workers_WorkerCommon_h
|