diff --git a/dom/base/ScriptSettings.cpp b/dom/base/ScriptSettings.cpp index 53c3e23d3050..a8eb721f9923 100644 --- a/dom/base/ScriptSettings.cpp +++ b/dom/base/ScriptSettings.cpp @@ -851,28 +851,6 @@ AutoJSContext::operator JSContext*() const return mCx; } -ThreadsafeAutoJSContext::ThreadsafeAutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL) -{ - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - - if (NS_IsMainThread()) { - mCx = nullptr; - mAutoJSContext.emplace(); - } else { - mCx = mozilla::dom::workers::GetCurrentThreadJSContext(); - mRequest.emplace(mCx); - } -} - -ThreadsafeAutoJSContext::operator JSContext*() const -{ - if (mCx) { - return mCx; - } else { - return *mAutoJSContext; - } -} - AutoSafeJSContext::AutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL) : AutoJSAPI() { diff --git a/dom/base/ScriptSettings.h b/dom/base/ScriptSettings.h index 7506cf4014df..cb0e05a8a427 100644 --- a/dom/base/ScriptSettings.h +++ b/dom/base/ScriptSettings.h @@ -444,22 +444,6 @@ protected: MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -/** - * Use ThreadsafeAutoJSContext when you want an AutoJSContext but might be - * running on a worker thread. - */ -class MOZ_RAII ThreadsafeAutoJSContext { -public: - explicit ThreadsafeAutoJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM); - operator JSContext*() const; - -private: - JSContext* mCx; // Used on workers. Null means mainthread. - Maybe mRequest; // Used on workers. - Maybe mAutoJSContext; // Used on main thread. - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER -}; - /** * AutoSafeJSContext is similar to AutoJSContext but will only return the safe * JS context. That means it will never call nsContentUtils::GetCurrentJSContext().