Backed out 9 changesets (bug 1744025) for causing wpt failures on CheckedUnsafePtr.h CLOSED TREE

Backed out changeset 89dca4fc5940 (bug 1744025)
Backed out changeset 7aa395dcdbe4 (bug 1744025)
Backed out changeset 1580a4ea1a85 (bug 1744025)
Backed out changeset af171636a87f (bug 1744025)
Backed out changeset a5edfa1c9cd6 (bug 1744025)
Backed out changeset 8abd6ba69815 (bug 1744025)
Backed out changeset cfb822df5b3f (bug 1744025)
Backed out changeset 5598943a94fd (bug 1744025)
Backed out changeset 43186fbbf8b4 (bug 1744025)
This commit is contained in:
Norisz Fay 2021-12-15 18:46:01 +02:00
Родитель f9dcfd4d71
Коммит 5edb88e27a
35 изменённых файлов: 94 добавлений и 81 удалений

Просмотреть файл

@ -42,7 +42,7 @@
#include "mozilla/dom/UnionTypes.h"
#include "mozilla/dom/WindowBinding.h" // For IdleRequestCallback/Options
#include "mozilla/dom/WindowGlobalParent.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/ipc/GeckoChildProcessHost.h"
#include "mozilla/net/UrlClassifierFeatureFactory.h"
#include "IOActivityMonitor.h"

Просмотреть файл

@ -15,6 +15,7 @@
#include "mozilla/dom/ipc/StructuredCloneData.h"
#include "mozilla/dom/RefMessageBodyService.h"
#include "mozilla/dom/SharedMessageBody.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/WorkerRef.h"
#include "mozilla/dom/WorkerRunnable.h"

Просмотреть файл

@ -14,6 +14,7 @@
#include "mozilla/dom/DOMMozPromiseRequestHolder.h"
#include "mozilla/dom/MessagePortBinding.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerScope.h"
#include "nsIDUtils.h"
#include "nsIGlobalObject.h"

Просмотреть файл

@ -14,7 +14,7 @@
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/ServiceWorkerDescriptor.h"
#include "mozilla/dom/ServiceWorkerManager.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/ipc/BackgroundUtils.h"
#include "mozilla/SchedulerGroup.h"
#include "mozilla/StaticPrefs_privacy.h"

Просмотреть файл

@ -20,6 +20,7 @@
#include "mozilla/dom/MessageEvent.h"
#include "mozilla/dom/MessageEventBinding.h"
#include "mozilla/dom/Navigator.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/WorkerRef.h"
#include "mozilla/dom/ServiceWorker.h"

Просмотреть файл

@ -22,6 +22,7 @@
#include "mozilla/dom/ScriptSettings.h"
#include "mozilla/dom/StructuredCloneHolder.h"
#include "mozilla/dom/ToJSValue.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerRunnable.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/WorkletGlobalScope.h"

Просмотреть файл

@ -43,6 +43,7 @@
#include "InternalResponse.h"
#include "mozilla/dom/WorkerCommon.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerRef.h"
#include "mozilla/dom/WorkerRunnable.h"
#include "mozilla/dom/WorkerScope.h"
@ -1088,15 +1089,16 @@ nsresult ExtractByteStreamFromBody(const fetch::ResponseBodyInit& aBodyInit,
template <class Derived>
FetchBody<Derived>::FetchBody(nsIGlobalObject* aOwner)
: mOwner(aOwner),
mWorkerPrivate(nullptr),
mReadableStreamBody(nullptr),
mReadableStreamReader(nullptr),
mBodyUsed(false) {
MOZ_ASSERT(aOwner);
if (!NS_IsMainThread()) {
WorkerPrivate* wp = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(wp);
mMainThreadEventTarget = wp->MainThreadEventTarget();
mWorkerPrivate = GetCurrentThreadWorkerPrivate();
MOZ_ASSERT(mWorkerPrivate);
mMainThreadEventTarget = mWorkerPrivate->MainThreadEventTarget();
} else {
mMainThreadEventTarget = aOwner->EventTargetFor(TaskCategory::Other);
}

Просмотреть файл

@ -19,7 +19,6 @@
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/FetchStreamReader.h"
#include "mozilla/dom/RequestBinding.h"
#include "mozilla/dom/workerinternals/RuntimeService.h"
class nsIGlobalObject;
class nsIEventTarget;
@ -231,6 +230,9 @@ class FetchBody : public BodyStreamHolder, public AbortFollower {
protected:
nsCOMPtr<nsIGlobalObject> mOwner;
// Always set whenever the FetchBody is created on the worker thread.
WorkerPrivate* mWorkerPrivate;
// This is the ReadableStream exposed to content. It's underlying source is a
// BodyStream object.
JS::Heap<JSObject*> mReadableStreamBody;
@ -252,9 +254,9 @@ class FetchBody : public BodyStreamHolder, public AbortFollower {
void LockStream(JSContext* aCx, JS::HandleObject aStream, ErrorResult& aRv);
void AssertIsOnTargetThread() {
MOZ_ASSERT(NS_IsMainThread() == !GetCurrentThreadWorkerPrivate());
}
bool IsOnTargetThread() { return NS_IsMainThread() == !mWorkerPrivate; }
void AssertIsOnTargetThread() { MOZ_ASSERT(IsOnTargetThread()); }
// Only ever set once, always on target thread.
bool mBodyUsed;

Просмотреть файл

@ -12,6 +12,7 @@
#include "mozilla/dom/FileBlobImpl.h"
#include "mozilla/dom/StructuredCloneTags.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerScope.h"
#include "MainThreadUtils.h"
#include "jsapi.h"

Просмотреть файл

@ -22,6 +22,7 @@
#include "mozilla/dom/ErrorEvent.h"
#include "mozilla/dom/ErrorEventBinding.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/quota/ResultExtensions.h"
#include "mozilla/intl/LocaleCanonicalizer.h"
#include "mozilla/ipc/BackgroundChild.h"

Просмотреть файл

@ -31,6 +31,7 @@
#include "mozilla/dom/ServiceWorkerGlobalScopeBinding.h"
#include "mozilla/dom/ServiceWorkerManager.h"
#include "mozilla/dom/ServiceWorkerUtils.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerRunnable.h"
#include "mozilla/dom/WorkerScope.h"
#include "Navigator.h"

Просмотреть файл

@ -10,7 +10,6 @@
#include "mozilla/DOMEventTargetHelper.h"
#include "mozilla/UniquePtr.h"
#include "mozilla/dom/NotificationBinding.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "nsIObserver.h"
#include "nsISupports.h"
@ -30,6 +29,7 @@ class NotificationRef;
class WorkerNotificationObserver;
class Promise;
class StrongWorkerRef;
class WorkerPrivate;
/*
* Notifications on workers introduce some lifetime issues. The property we
@ -207,7 +207,7 @@ class Notification : public DOMEventTargetHelper,
// Initialized on the worker thread, never unset, and always used in
// a read-only capacity. Used on any thread.
CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate;
WorkerPrivate* mWorkerPrivate;
// Main thread only.
WorkerNotificationObserver* mObserver;

Просмотреть файл

@ -10,6 +10,7 @@
#include "mozilla/dom/PerformanceBinding.h"
#include "mozilla/dom/PerformanceEntryBinding.h"
#include "mozilla/dom/PerformanceObserverBinding.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/StaticPrefs_dom.h"
#include "nsIScriptError.h"

Просмотреть файл

@ -10,7 +10,7 @@
#include "PerformanceTiming.h"
#include "mozilla/dom/WorkerRef.h"
#include "mozilla/dom/WorkerRunnable.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/WorkerPrivate.h"
namespace mozilla::dom {

Просмотреть файл

@ -5,7 +5,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "PerformanceWorker.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/StaticPrefs_dom.h"
namespace mozilla::dom {

Просмотреть файл

@ -8,11 +8,12 @@
#define mozilla_dom_PerformanceWorker_h
#include "Performance.h"
#include "mozilla/dom/WorkerPrivate.h"
namespace mozilla {
namespace dom {
class WorkerPrivate;
class PerformanceWorker final : public Performance {
public:
explicit PerformanceWorker(WorkerPrivate* aWorkerPrivate);
@ -93,7 +94,7 @@ class PerformanceWorker final : public Performance {
}
private:
CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate;
WorkerPrivate* mWorkerPrivate;
};
} // namespace dom

Просмотреть файл

@ -16,6 +16,7 @@
#include "mozilla/dom/PushSubscriptionOptionsBinding.h"
#include "mozilla/dom/PushUtil.h"
#include "mozilla/dom/WorkerRunnable.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/Promise.h"

Просмотреть файл

@ -56,6 +56,7 @@
#include "mozilla/dom/SafeRefPtr.h"
#include "mozilla/dom/ServiceWorkerBinding.h"
#include "mozilla/dom/WorkerCommon.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerRef.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/ipc/IPCStreamUtils.h"

Просмотреть файл

@ -9,6 +9,7 @@
#include "mozilla/dom/Blob.h"
#include "mozilla/dom/BlobImpl.h"
#include "mozilla/dom/BlobURLProtocolHandler.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerRunnable.h"
#include "mozilla/dom/WorkerScope.h"

Просмотреть файл

@ -11,6 +11,7 @@
#include "mozilla/TimelineConsumers.h"
#include "mozilla/WorkerTimelineMarker.h"
#include "nsQueryObject.h"
#include "WorkerPrivate.h"
#include "WorkerScope.h"
namespace mozilla {

Просмотреть файл

@ -76,6 +76,7 @@
#include "WorkerDebuggerManager.h"
#include "WorkerError.h"
#include "WorkerLoadInfo.h"
#include "WorkerPrivate.h"
#include "WorkerRunnable.h"
#include "WorkerScope.h"
#include "WorkerThread.h"
@ -1184,7 +1185,7 @@ bool RuntimeService::RegisterWorker(WorkerPrivate& aWorkerPrivate) {
// From here on out we must call UnregisterWorker if something fails!
if (parent) {
if (!parent->AddChildWorker(aWorkerPrivate)) {
if (!parent->AddChildWorker(&aWorkerPrivate)) {
UnregisterWorker(aWorkerPrivate);
return false;
}
@ -1304,7 +1305,7 @@ void RuntimeService::UnregisterWorker(WorkerPrivate& aWorkerPrivate) {
// same time as us calling into the code here and would race with us.
if (parent) {
parent->RemoveChildWorker(aWorkerPrivate);
parent->RemoveChildWorker(&aWorkerPrivate);
} else if (aWorkerPrivate.IsSharedWorker()) {
AssertIsOnMainThread();

Просмотреть файл

@ -87,6 +87,7 @@
#include "mozilla/StaticPrefs_security.h"
#include "mozilla/UniquePtr.h"
#include "Principal.h"
#include "WorkerPrivate.h"
#include "WorkerRunnable.h"
#include "WorkerScope.h"

Просмотреть файл

@ -5,9 +5,9 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#include "WorkerCSPEventListener.h"
#include "WorkerPrivate.h"
#include "WorkerRef.h"
#include "WorkerRunnable.h"
#include "WorkerScope.h"
#include "mozilla/dom/SecurityPolicyViolationEvent.h"
#include "mozilla/dom/SecurityPolicyViolationEventBinding.h"
#include "mozilla/dom/WorkerRunnable.h"

Просмотреть файл

@ -4,6 +4,8 @@
* 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 "WorkerDebugger.h"
#include "mozilla/dom/BrowsingContext.h"
#include "mozilla/dom/MessageEvent.h"
#include "mozilla/dom/MessageEventBinding.h"
@ -16,9 +18,9 @@
#include "ScriptLoader.h"
#include "WorkerCommon.h"
#include "WorkerError.h"
#include "WorkerPrivate.h"
#include "WorkerRunnable.h"
#include "WorkerDebugger.h"
#include "WorkerScope.h"
#if defined(XP_WIN)
# include <processthreadsapi.h> // for GetCurrentProcessId()
#else
@ -546,10 +548,8 @@ RefPtr<PerformanceInfoPromise> WorkerDebugger::ReportPerformanceInfo() {
}
// We need to keep a ref on workerPrivate, passed to the promise,
// to make sure it's still aloive when collecting the info
// (and CheckedUnsafePtr does not convert directly to RefPtr).
WorkerPrivate* workerPtr = mWorkerPrivate;
RefPtr<WorkerPrivate> workerRef = workerPtr;
// to make sure it's still aloive when collecting the info.
RefPtr<WorkerPrivate> workerRef = mWorkerPrivate;
RefPtr<AbstractThread> mainThread = AbstractThread::MainThread();
return CollectMemoryInfo(top, mainThread)

Просмотреть файл

@ -8,7 +8,6 @@
#define mozilla_dom_workers_WorkerDebugger_h
#include "mozilla/PerformanceTypes.h"
#include "mozilla/dom/WorkerScope.h"
#include "nsCOMPtr.h"
#include "nsIWorkerDebugger.h"
@ -25,7 +24,7 @@ class WorkerDebugger : public nsIWorkerDebugger {
class ReportDebuggerErrorRunnable;
class PostDebuggerMessageRunnable;
CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate;
WorkerPrivate* mWorkerPrivate;
bool mIsInitialized;
nsTArray<nsCOMPtr<nsIWorkerDebuggerListener>> mListeners;

Просмотреть файл

@ -9,11 +9,12 @@
#include "nsISerialEventTarget.h"
#include "mozilla/Mutex.h"
#include "mozilla/dom/WorkerPrivate.h"
namespace mozilla {
namespace dom {
class WorkerPrivate;
class WorkerEventTarget final : public nsISerialEventTarget {
public:
// The WorkerEventTarget supports different dispatch behaviors:
@ -29,7 +30,7 @@ class WorkerEventTarget final : public nsISerialEventTarget {
private:
mozilla::Mutex mMutex;
CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate;
WorkerPrivate* mWorkerPrivate;
const Behavior mBehavior;
~WorkerEventTarget() = default;

Просмотреть файл

@ -11,6 +11,7 @@
#include "ErrorList.h"
#include "MainThreadUtils.h"
#include "RuntimeService.h"
#include "WorkerPrivate.h"
#include "WorkerRunnable.h"
#include "WorkerScope.h"
#include "mozilla/dom/LockManager.h"

Просмотреть файл

@ -51,7 +51,6 @@
#include "mozilla/dom/RemoteWorkerService.h"
#include "mozilla/dom/TimeoutHandler.h"
#include "mozilla/dom/WorkerBinding.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/JSExecutionManager.h"
#include "mozilla/dom/WindowContext.h"
#include "mozilla/extensions/ExtensionBrowser.h" // extensions::Create{AndDispatchInitWorkerContext,WorkerLoaded,WorkerDestroyed}Runnable
@ -3824,7 +3823,7 @@ bool WorkerPrivate::ModifyBusyCountFromWorker(bool aIncrease) {
return runnable->Dispatch();
}
bool WorkerPrivate::AddChildWorker(WorkerPrivate& aChildWorker) {
bool WorkerPrivate::AddChildWorker(WorkerPrivate* aChildWorker) {
auto data = mWorkerThreadAccessible.Access();
#ifdef DEBUG
@ -3839,20 +3838,20 @@ bool WorkerPrivate::AddChildWorker(WorkerPrivate& aChildWorker) {
}
#endif
NS_ASSERTION(!data->mChildWorkers.Contains(&aChildWorker),
NS_ASSERTION(!data->mChildWorkers.Contains(aChildWorker),
"Already know about this one!");
data->mChildWorkers.AppendElement(&aChildWorker);
data->mChildWorkers.AppendElement(aChildWorker);
return data->mChildWorkers.Length() == 1 ? ModifyBusyCountFromWorker(true)
: true;
}
void WorkerPrivate::RemoveChildWorker(WorkerPrivate& aChildWorker) {
void WorkerPrivate::RemoveChildWorker(WorkerPrivate* aChildWorker) {
auto data = mWorkerThreadAccessible.Access();
NS_ASSERTION(data->mChildWorkers.Contains(&aChildWorker),
NS_ASSERTION(data->mChildWorkers.Contains(aChildWorker),
"Didn't know about this one!");
data->mChildWorkers.RemoveElement(&aChildWorker);
data->mChildWorkers.RemoveElement(aChildWorker);
if (data->mChildWorkers.IsEmpty() && !ModifyBusyCountFromWorker(false)) {
NS_WARNING("Failed to modify busy count!");
@ -3922,7 +3921,7 @@ void WorkerPrivate::NotifyWorkerRefs(WorkerStatus aStatus) {
workerRef->Notify();
}
AutoTArray<CheckedUnsafePtr<WorkerPrivate>, 10> children;
AutoTArray<WorkerPrivate*, 10> children;
children.AppendElements(data->mChildWorkers);
for (uint32_t index = 0; index < children.Length(); index++) {
@ -5245,14 +5244,15 @@ WorkerGlobalScope* WorkerPrivate::GetOrCreateGlobalScope(JSContext* aCx) {
}
if (IsSharedWorker()) {
data->mScope =
new SharedWorkerGlobalScope(this, CreateClientSource(), WorkerName());
data->mScope = new SharedWorkerGlobalScope(
WrapNotNull(this), CreateClientSource(), WorkerName());
} else if (IsServiceWorker()) {
data->mScope = new ServiceWorkerGlobalScope(
this, CreateClientSource(), GetServiceWorkerRegistrationDescriptor());
data->mScope =
new ServiceWorkerGlobalScope(WrapNotNull(this), CreateClientSource(),
GetServiceWorkerRegistrationDescriptor());
} else {
data->mScope = new DedicatedWorkerGlobalScope(this, CreateClientSource(),
WorkerName());
data->mScope = new DedicatedWorkerGlobalScope(
WrapNotNull(this), CreateClientSource(), WorkerName());
}
JS::Rooted<JSObject*> global(aCx);
@ -5281,7 +5281,7 @@ WorkerDebuggerGlobalScope* WorkerPrivate::CreateDebuggerGlobalScope(
GetClientType(), HybridEventTarget(), NullPrincipalInfo());
data->mDebuggerScope =
new WorkerDebuggerGlobalScope(this, std::move(clientSource));
new WorkerDebuggerGlobalScope(WrapNotNull(this), std::move(clientSource));
JS::Rooted<JSObject*> global(aCx);
NS_ENSURE_TRUE(data->mDebuggerScope->WrapGlobalObject(aCx, &global), nullptr);

Просмотреть файл

@ -28,10 +28,10 @@
#include "mozilla/dom/ClientSource.h"
#include "mozilla/dom/FlippedOnce.h"
#include "mozilla/dom/RemoteWorkerChild.h"
#include "mozilla/dom/quota/CheckedUnsafePtr.h"
#include "mozilla/dom/Worker.h"
#include "mozilla/dom/WorkerCommon.h"
#include "mozilla/dom/WorkerLoadInfo.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/WorkerStatus.h"
#include "mozilla/dom/workerinternals/JSSettings.h"
#include "mozilla/dom/workerinternals/Queue.h"
@ -107,9 +107,7 @@ class SharedMutex {
nsString ComputeWorkerPrivateId();
class WorkerPrivate final
: public RelativeTimeline,
public SupportsCheckedUnsafePtr<CheckIf<DiagnosticAssertEnabled>> {
class WorkerPrivate final : public RelativeTimeline {
public:
struct LocationInfo {
nsCString mHref;
@ -263,9 +261,9 @@ class WorkerPrivate final
bool ModifyBusyCountFromWorker(bool aIncrease);
bool AddChildWorker(WorkerPrivate& aChildWorker);
bool AddChildWorker(WorkerPrivate* aChildWorker);
void RemoveChildWorker(WorkerPrivate& aChildWorker);
void RemoveChildWorker(WorkerPrivate* aChildWorker);
void PostMessageToParent(JSContext* aCx, JS::Handle<JS::Value> aMessage,
const Sequence<JSObject*>& aTransferable,
@ -583,9 +581,6 @@ class WorkerPrivate final
// worker [Dedicated|Shared|Service].
bool IsChromeWorker() const { return mIsChromeWorker; }
// TODO: Invariants require that the parent worker out-live any child
// worker, so WorkerPrivate* should be safe in the moment of calling.
// We would like to have stronger type-system annotated/enforced handling.
WorkerPrivate* GetParent() const { return mParent; }
bool IsFrozen() const {
@ -1157,9 +1152,7 @@ class WorkerPrivate final
SharedMutex mMutex;
mozilla::CondVar mCondVar;
// We cannot make this CheckedUnsafePtr<WorkerPrivate> as this would violate
// our static assert
MOZ_NON_OWNING_REF WorkerPrivate* const mParent;
WorkerPrivate* const mParent;
const nsString mScriptURL;
@ -1279,8 +1272,6 @@ class WorkerPrivate final
RefPtr<WorkerGlobalScope> mScope;
RefPtr<WorkerDebuggerGlobalScope> mDebuggerScope;
// We cannot make this CheckedUnsafePtr<WorkerPrivate> as this would violate
// our static assert
nsTArray<WorkerPrivate*> mChildWorkers;
nsTObserverArray<WorkerRef*> mWorkerRefs;
nsTArray<UniquePtr<TimeoutInfo>> mTimeouts;
@ -1351,9 +1342,7 @@ class WorkerPrivate final
~AutoPushEventLoopGlobal();
private:
// We cannot make this CheckedUnsafePtr<WorkerPrivate> as this would violate
// our static assert
MOZ_NON_OWNING_REF WorkerPrivate* mWorkerPrivate;
WorkerPrivate* mWorkerPrivate;
nsCOMPtr<nsIGlobalObject> mOldEventLoopGlobal;
};
friend class AutoPushEventLoopGlobal;
@ -1437,7 +1426,7 @@ class WorkerPrivate final
};
class AutoSyncLoopHolder {
CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate;
WorkerPrivate* mWorkerPrivate;
nsCOMPtr<nsIEventTarget> mTarget;
uint32_t mIndex;
@ -1460,12 +1449,12 @@ class AutoSyncLoopHolder {
}
bool Run() {
CheckedUnsafePtr<WorkerPrivate> keepAliveWP = mWorkerPrivate;
WorkerPrivate* workerPrivate = mWorkerPrivate;
mWorkerPrivate = nullptr;
keepAliveWP->AssertIsOnWorkerThread();
workerPrivate->AssertIsOnWorkerThread();
return keepAliveWP->RunCurrentSyncLoop();
return workerPrivate->RunCurrentSyncLoop();
}
nsIEventTarget* GetEventTarget() const {

Просмотреть файл

@ -6,6 +6,7 @@
#include "WorkerRunnable.h"
#include "WorkerPrivate.h"
#include "WorkerScope.h"
#include "js/RootingAPI.h"
#include "jsapi.h"

Просмотреть файл

@ -217,7 +217,8 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WorkerGlobalScopeBase)
NS_INTERFACE_MAP_END_INHERITING(DOMEventTargetHelper)
WorkerGlobalScopeBase::WorkerGlobalScopeBase(
WorkerPrivate* aWorkerPrivate, UniquePtr<ClientSource> aClientSource)
NotNull<WorkerPrivate*> aWorkerPrivate,
UniquePtr<ClientSource> aClientSource)
: mWorkerPrivate(aWorkerPrivate),
mClientSource(std::move(aClientSource)),
mSerialEventTarget(aWorkerPrivate->HybridEventTarget()) {
@ -779,9 +780,9 @@ NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED_0(DedicatedWorkerGlobalScope,
WorkerGlobalScope)
DedicatedWorkerGlobalScope::DedicatedWorkerGlobalScope(
WorkerPrivate* aWorkerPrivate, UniquePtr<ClientSource> aClientSource,
const nsString& aName)
: WorkerGlobalScope(std::move(aWorkerPrivate), std::move(aClientSource)),
NotNull<WorkerPrivate*> aWorkerPrivate,
UniquePtr<ClientSource> aClientSource, const nsString& aName)
: WorkerGlobalScope(aWorkerPrivate, std::move(aClientSource)),
NamedWorkerGlobalScopeMixin(aName) {}
bool DedicatedWorkerGlobalScope::WrapGlobalObject(
@ -953,9 +954,9 @@ void DedicatedWorkerGlobalScope::OnVsync(const VsyncEvent& aVsync) {
}
SharedWorkerGlobalScope::SharedWorkerGlobalScope(
WorkerPrivate* aWorkerPrivate, UniquePtr<ClientSource> aClientSource,
const nsString& aName)
: WorkerGlobalScope(std::move(aWorkerPrivate), std::move(aClientSource)),
NotNull<WorkerPrivate*> aWorkerPrivate,
UniquePtr<ClientSource> aClientSource, const nsString& aName)
: WorkerGlobalScope(aWorkerPrivate, std::move(aClientSource)),
NamedWorkerGlobalScopeMixin(aName) {}
bool SharedWorkerGlobalScope::WrapGlobalObject(
@ -987,9 +988,10 @@ NS_IMPL_ADDREF_INHERITED(ServiceWorkerGlobalScope, WorkerGlobalScope)
NS_IMPL_RELEASE_INHERITED(ServiceWorkerGlobalScope, WorkerGlobalScope)
ServiceWorkerGlobalScope::ServiceWorkerGlobalScope(
WorkerPrivate* aWorkerPrivate, UniquePtr<ClientSource> aClientSource,
NotNull<WorkerPrivate*> aWorkerPrivate,
UniquePtr<ClientSource> aClientSource,
const ServiceWorkerRegistrationDescriptor& aRegistrationDescriptor)
: WorkerGlobalScope(std::move(aWorkerPrivate), std::move(aClientSource)),
: WorkerGlobalScope(aWorkerPrivate, std::move(aClientSource)),
mScope(NS_ConvertUTF8toUTF16(aRegistrationDescriptor.Scope()))
// Eagerly create the registration because we will need to receive

Просмотреть файл

@ -20,7 +20,6 @@
#include "mozilla/dom/ImageBitmapBinding.h"
#include "mozilla/dom/ImageBitmapSource.h"
#include "mozilla/dom/SafeRefPtr.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "nsCOMPtr.h"
#include "nsCycleCollectionParticipant.h"
#include "nsIGlobalObject.h"
@ -94,7 +93,7 @@ class WorkerGlobalScopeBase : public DOMEventTargetHelper,
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(WorkerGlobalScopeBase,
DOMEventTargetHelper)
WorkerGlobalScopeBase(WorkerPrivate* aWorkerPrivate,
WorkerGlobalScopeBase(NotNull<WorkerPrivate*> aWorkerPrivate,
UniquePtr<ClientSource> aClientSource);
virtual bool WrapGlobalObject(JSContext* aCx,
@ -163,7 +162,7 @@ class WorkerGlobalScopeBase : public DOMEventTargetHelper,
protected:
~WorkerGlobalScopeBase();
CheckedUnsafePtr<WorkerPrivate> mWorkerPrivate;
const NotNull<WorkerPrivate*> mWorkerPrivate;
private:
RefPtr<Console> mConsole;
@ -345,7 +344,7 @@ class DedicatedWorkerGlobalScope final
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS_INHERITED(
DedicatedWorkerGlobalScope, WorkerGlobalScope)
DedicatedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate,
DedicatedWorkerGlobalScope(NotNull<WorkerPrivate*> aWorkerPrivate,
UniquePtr<ClientSource> aClientSource,
const nsString& aName);
@ -389,7 +388,7 @@ class SharedWorkerGlobalScope final
: public WorkerGlobalScope,
public workerinternals::NamedWorkerGlobalScopeMixin {
public:
SharedWorkerGlobalScope(WorkerPrivate* aWorkerPrivate,
SharedWorkerGlobalScope(NotNull<WorkerPrivate*> aWorkerPrivate,
UniquePtr<ClientSource> aClientSource,
const nsString& aName);
@ -411,7 +410,8 @@ class ServiceWorkerGlobalScope final : public WorkerGlobalScope {
WorkerGlobalScope)
ServiceWorkerGlobalScope(
WorkerPrivate* aWorkerPrivate, UniquePtr<ClientSource> aClientSource,
NotNull<WorkerPrivate*> aWorkerPrivate,
UniquePtr<ClientSource> aClientSource,
const ServiceWorkerRegistrationDescriptor& aRegistrationDescriptor);
bool WrapGlobalObject(JSContext* aCx,

Просмотреть файл

@ -30,6 +30,7 @@
#include "mozilla/dom/UnionConversions.h"
#include "mozilla/dom/URLSearchParams.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/WorkerRef.h"
#include "mozilla/dom/WorkerRunnable.h"
#include "mozilla/dom/XMLHttpRequestBinding.h"

Просмотреть файл

@ -14,7 +14,7 @@
#include "mozilla/dom/ClonedErrorHolderBinding.h"
#include "mozilla/dom/ExtensionBrowserBinding.h"
#include "mozilla/dom/FunctionBinding.h"
#include "mozilla/dom/WorkerScope.h"
#include "mozilla/dom/WorkerPrivate.h"
#include "mozilla/dom/SerializedStackHolder.h"
#include "mozilla/dom/ServiceWorkerInfo.h"
#include "mozilla/dom/ServiceWorkerManager.h"

Просмотреть файл

@ -8,7 +8,7 @@
#include "mozilla/dom/ExtensionBrowserBinding.h"
#include "mozilla/dom/ExtensionPortBinding.h" // ExtensionPortDescriptor
#include "mozilla/dom/WorkerScope.h" // GetWorkerPrivateFromContext
#include "mozilla/dom/WorkerPrivate.h" // GetWorkerPrivateFromContext
#include "mozilla/extensions/ExtensionAlarms.h"
#include "mozilla/extensions/ExtensionMockAPI.h"
#include "mozilla/extensions/ExtensionPort.h"