Backed out changeset 558e256fcb31 (bug 1759163) for causing mochitest failures on test_header_simple.html.

This commit is contained in:
Marian-Vasile Laza 2022-03-15 15:23:04 -07:00
Родитель 21901659f3
Коммит f0b42c159c
25 изменённых файлов: 105 добавлений и 166 удалений

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

@ -1625,10 +1625,6 @@ bool nsGlobalWindowInner::ShouldResistFingerprinting() const {
return nsIScriptGlobalObject::ShouldResistFingerprinting();
}
OriginTrials nsGlobalWindowInner::Trials() const {
return OriginTrials::FromWindow(this);
}
uint32_t nsGlobalWindowInner::GetPrincipalHashValue() const {
if (mDoc) {
return mDoc->NodePrincipal()->GetHashValue();

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

@ -251,7 +251,6 @@ class nsGlobalWindowInner final : public mozilla::dom::EventTarget,
// nsIGlobalObject
bool ShouldResistFingerprinting() const final;
uint32_t GetPrincipalHashValue() const final;
mozilla::OriginTrials Trials() const final;
JSObject* GetGlobalJSObject() final { return GetWrapper(); }
JSObject* GetGlobalJSObjectPreserveColor() const final {

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

@ -1698,11 +1698,6 @@ uint32_t nsGlobalWindowOuter::GetPrincipalHashValue() const {
return 0;
}
OriginTrials nsGlobalWindowOuter::Trials() const {
return mInnerWindow ? nsGlobalWindowInner::Cast(mInnerWindow)->Trials()
: OriginTrials();
}
nsresult nsGlobalWindowOuter::EnsureScriptEnvironment() {
if (GetWrapperPreserveColor()) {
return NS_OK;

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

@ -231,7 +231,6 @@ class nsGlobalWindowOuter final : public mozilla::dom::EventTarget,
// nsIGlobalObject
bool ShouldResistFingerprinting() const final;
uint32_t GetPrincipalHashValue() const final;
mozilla::OriginTrials Trials() const final;
// nsIGlobalJSObjectHolder
JSObject* GetGlobalJSObject() final { return GetWrapper(); }

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

@ -12,7 +12,6 @@
#include "mozilla/dom/ClientInfo.h"
#include "mozilla/dom/DispatcherTrait.h"
#include "mozilla/dom/ServiceWorkerDescriptor.h"
#include "mozilla/OriginTrials.h"
#include "nsHashKeys.h"
#include "nsISupports.h"
#include "nsStringFwd.h"
@ -197,9 +196,6 @@ class nsIGlobalObject : public nsISupports,
*/
virtual mozilla::StorageAccess GetStorageAccess();
// Returns the set of active origin trials for this global.
virtual mozilla::OriginTrials Trials() const = 0;
// Returns a pointer to this object as an inner window if this is one or
// nullptr otherwise.
nsPIDOMWindowInner* AsInnerWindow();

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

@ -20,7 +20,8 @@
#include "nsISupportsImpl.h"
#include "nsCycleCollectionParticipant.h"
namespace mozilla::dom {
namespace mozilla {
namespace dom {
class SimpleGlobalObject : public nsIGlobalObject, public nsWrapperCache {
public:
@ -66,10 +67,8 @@ class SimpleGlobalObject : public nsIGlobalObject, public nsWrapperCache {
return GetWrapperPreserveColor();
}
OriginTrials Trials() const override { return {}; }
JSObject* WrapObject(JSContext* cx,
JS::Handle<JSObject*> aGivenProto) override {
virtual JSObject* WrapObject(JSContext* cx,
JS::Handle<JSObject*> aGivenProto) override {
MOZ_CRASH("SimpleGlobalObject doesn't use DOM bindings!");
}
@ -83,6 +82,7 @@ class SimpleGlobalObject : public nsIGlobalObject, public nsWrapperCache {
const GlobalType mType;
};
} // namespace mozilla::dom
} // namespace dom
} // namespace mozilla
#endif /* mozilla_dom_SimpleGlobalObject_h__ */

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

@ -35,17 +35,15 @@ NS_IMPL_ADDREF_INHERITED(AudioWorkletGlobalScope, WorkletGlobalScope)
NS_IMPL_RELEASE_INHERITED(AudioWorkletGlobalScope, WorkletGlobalScope)
AudioWorkletGlobalScope::AudioWorkletGlobalScope(AudioWorkletImpl* aImpl)
: WorkletGlobalScope(aImpl) {}
AudioWorkletImpl* AudioWorkletGlobalScope::Impl() const {
return static_cast<AudioWorkletImpl*>(mImpl.get());
}
: WorkletGlobalScope(aImpl->GetAgentClusterId(),
aImpl->IsSharedMemoryAllowed()),
mImpl(aImpl) {}
bool AudioWorkletGlobalScope::WrapGlobalObject(
JSContext* aCx, JS::MutableHandle<JSObject*> aReflector) {
// |this| is being exposed to JS and content script will soon be running.
// The graph needs a handle on the JSContext so it can interrupt JS.
Impl()->DestinationTrack()->Graph()->NotifyJSContext(aCx);
mImpl->DestinationTrack()->Graph()->NotifyJSContext(aCx);
JS::RealmOptions options;
@ -191,8 +189,7 @@ void AudioWorkletGlobalScope::RegisterProcessor(
*/
NS_DispatchToMainThread(NS_NewRunnableFunction(
"AudioWorkletGlobalScope: parameter descriptors",
[impl = RefPtr{Impl()}, name = nsString(aName),
map = std::move(map)]() mutable {
[impl = mImpl, name = nsString(aName), map = std::move(map)]() mutable {
AudioNode* destinationNode =
impl->DestinationTrack()->Engine()->NodeMainThread();
if (!destinationNode) {
@ -202,8 +199,10 @@ void AudioWorkletGlobalScope::RegisterProcessor(
}));
}
WorkletImpl* AudioWorkletGlobalScope::Impl() const { return mImpl; }
uint64_t AudioWorkletGlobalScope::CurrentFrame() const {
AudioNodeTrack* destinationTrack = Impl()->DestinationTrack();
AudioNodeTrack* destinationTrack = mImpl->DestinationTrack();
GraphTime processedTime = destinationTrack->Graph()->ProcessedTime();
return destinationTrack->GraphTimeToTrackTime(processedTime);
}
@ -213,7 +212,7 @@ double AudioWorkletGlobalScope::CurrentTime() const {
}
float AudioWorkletGlobalScope::SampleRate() const {
return static_cast<float>(Impl()->DestinationTrack()->mSampleRate);
return static_cast<float>(mImpl->DestinationTrack()->mSampleRate);
}
AudioParamDescriptorMap AudioWorkletGlobalScope::DescriptorsFromJS(

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

@ -39,7 +39,7 @@ class AudioWorkletGlobalScope final : public WorkletGlobalScope {
AudioWorkletProcessorConstructor& aProcessorCtor,
ErrorResult& aRv);
AudioWorkletImpl* Impl() const;
WorkletImpl* Impl() const override;
uint64_t CurrentFrame() const;
@ -69,6 +69,8 @@ class AudioWorkletGlobalScope final : public WorkletGlobalScope {
JS::ForOfIterator* aIter,
ErrorResult& aRv);
const RefPtr<AudioWorkletImpl> mImpl;
typedef nsRefPtrHashtable<nsStringHashKey, AudioWorkletProcessorConstructor>
NodeNameToProcessorDefinitionMap;
NodeNameToProcessorDefinitionMap mNameToProcessorMap;

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

@ -159,9 +159,18 @@ bool OriginTrials::IsEnabled(JSContext* aCx, JSObject* aObject,
return true;
}
LOG("OriginTrials::IsEnabled(%d)\n", int(aTrial));
nsIGlobalObject* global = xpc::CurrentNativeGlobal(aCx);
MOZ_ASSERT(global);
return global && global->Trials().IsEnabled(aTrial);
if (dom::WorkletThread::IsOnWorkletThread()) {
// TODO: Worklet support, clean up the assumption below than not main thread
// means worker.
return false;
}
const OriginTrials trials =
NS_IsMainThread()
? FromWindow(xpc::WindowGlobalOrNull(js::UncheckedUnwrap(aObject)))
: dom::GetWorkerPrivateFromContext(aCx)->Trials();
return trials.IsEnabled(aTrial);
}
#undef LOG

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

@ -1,48 +1,23 @@
/* import-globals-from ../../../testing/mochitest/tests/SimpleTest/SimpleTest.js */
// This would be a bit nicer with `self`, but Worklet doesn't have that, so
// `globalThis` it is, see https://github.com/whatwg/html/issues/7696
function workerReply(port) {
port.postMessage({
testTrialInterfaceExposed: !!globalThis.TestTrialInterface,
});
port.postMessage({ testTrialInterfaceExposed: !!self.TestTrialInterface });
}
if (
globalThis.SharedWorkerGlobalScope &&
globalThis instanceof globalThis.SharedWorkerGlobalScope
self.SharedWorkerGlobalScope &&
self instanceof self.SharedWorkerGlobalScope
) {
globalThis.addEventListener("connect", function(e) {
self.addEventListener("connect", function(e) {
const port = e.ports[0];
workerReply(port);
});
} else if (
globalThis.WorkerGlobalScope &&
globalThis instanceof globalThis.WorkerGlobalScope
) {
workerReply(globalThis);
} else if (
globalThis.WorkletGlobalScope &&
globalThis instanceof globalThis.WorkletGlobalScope
) {
class Processor extends AudioWorkletProcessor {
constructor() {
super();
this.port.start();
workerReply(this.port);
}
process(inputs, outputs, parameters) {
// Do nothing, output silence
return true;
}
}
registerProcessor("test-processor", Processor);
} else if (self.WorkerGlobalScope && self instanceof self.WorkerGlobalScope) {
self.addEventListener("message", workerReply(self));
}
function assertTestTrialActive(shouldBeActive) {
add_task(async function() {
info("Main thread test: " + document.URL);
is(
!!navigator.testTrialGatedAttribute,
shouldBeActive,
@ -60,54 +35,48 @@ function assertTestTrialActive(shouldBeActive) {
);
}
function promiseWorkerWorkletMessage(target, context) {
info(`promiseWorkerWorkletMessage(${context})`);
return new Promise(resolve => {
target.addEventListener(
{
const worker = new Worker("common.js");
await new Promise(resolve => {
worker.addEventListener(
"message",
function(e) {
is(
e.data.testTrialInterfaceExposed,
shouldBeActive,
"Should work as expected in " + context
"Should work as expected in workers"
);
resolve();
},
{ once: true }
);
worker.postMessage("ping");
});
worker.terminate();
}
{
// We want a unique worker per page since the trial state depends on the
// creator document.
const worker = new SharedWorker("common.js", document.URL);
const promise = new Promise(resolve => {
worker.port.addEventListener(
"message",
function(e) {
is(
e.data.testTrialInterfaceExposed,
shouldBeActive,
"Should work as expected in shared workers"
);
info(`got ${context} message`);
resolve();
},
{ once: true }
);
});
}
{
info("Worker test");
const worker = new Worker("common.js");
await promiseWorkerWorkletMessage(worker, "worker");
worker.terminate();
}
{
info("SharedWorker test");
// We want a unique worker per page since the trial state depends on the
// creator document.
const worker = new SharedWorker("common.js", document.URL);
const promise = promiseWorkerWorkletMessage(worker.port, "shared worker");
worker.port.start();
await promise;
}
{
info("AudioWorklet test");
const audioContext = new AudioContext();
await audioContext.audioWorklet.addModule("common.js");
audioContext.resume();
const workletNode = new AudioWorkletNode(audioContext, "test-processor");
const promise = promiseWorkerWorkletMessage(workletNode.port, "worklet");
workletNode.port.start();
await promise;
await audioContext.close();
}
// FIXME(emilio): Add more tests.
// * Stuff hanging off Window or Document (bug 1757935).
});

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

@ -7,11 +7,8 @@ support-files =
common.js
# Test interfaces only exposed on DEBUG builds.
skip-if = !debug
# AudioWorklet requires secure context
scheme = https
[test_meta_simple.html]
[test_header_simple.html]
[test_trial_hidden.html]
[test_expired_token.html]
[test_wrong_origin.html]

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

@ -1,6 +1,6 @@
<!doctype html>
<!-- Created with: mktoken --origin 'https://example.com' --feature TestTrial --expiry '01 Jan 2000 01:00:00 +0100' --sign test-keys/test-ecdsa.pkcs8 -->
<meta http-equiv="origin-trial" content="A41+wSMhPQeR9B+AofdiFzheyZVF+gP4ubTNzrt6v8Qcjv68j1eINNFCxVe5/vdy4cO9dGDkwd9eizsib70RgAQAAABJeyJvcmlnaW4iOiJodHRwczovL2V4YW1wbGUuY29tIiwiZmVhdHVyZSI6IlRlc3RUcmlhbCIsImV4cGlyeSI6OTQ2Njg0ODAwfQ==">
<!-- Created with: mktoken --origin 'http://mochi.test:8888' --feature TestTrial --expiry 'Wed, 01 Jan 2000 01:00:00 +0100' --sign test-keys/test-ecdsa.pkcs8 -->
<meta http-equiv="origin-trial" content="A4GPgfKWSUlgUucdY2ESQAuu8pNiChJxAf+cf5KEe5O3OZNrHW4DuGdjzZShUhEwWZ3m30BaoBYnVSPCXNrQRSMAAABMeyJvcmlnaW4iOiJodHRwOi8vbW9jaGkudGVzdDo4ODg4IiwiZmVhdHVyZSI6IlRlc3RUcmlhbCIsImV4cGlyeSI6OTQ2Njg0ODAwfQ==">
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="common.js"></script>
<script>

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

@ -1 +1 @@
Origin-Trial: AyGdETIKWLLqe+chG57f74gZcjYSfbdYAapEq7DA49E6CmaYaPmaoXh/4tAe5XJJJdwwpFVal7hz/irC+Wvp1HgAAABLeyJvcmlnaW4iOiJodHRwczovL2V4YW1wbGUuY29tIiwiZmVhdHVyZSI6IlRlc3RUcmlhbCIsImV4cGlyeSI6MzI1MDM2ODAwMDB9
Origin-Trial: Ax+NsjHu0gB7huPad279C/p0ENAZR3R5lXAtKx0YTLbNsFFoYFFgDqxjCP10AHezcyyPrNS+uHHO72QdJM3eqMYAAABOeyJvcmlnaW4iOiJodHRwOi8vbW9jaGkudGVzdDo4ODg4IiwiZmVhdHVyZSI6IlRlc3RUcmlhbCIsImV4cGlyeSI6MzI1MDM2ODAwMDB9

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

@ -1,6 +1,6 @@
<!doctype html>
<!-- Created with: mktoken --origin 'https://example.com' --feature TestTrial --expiry 'Wed, 01 Jan 3000 01:00:00 +0100' --sign test-keys/test-ecdsa.pkcs8 -->
<meta http-equiv="origin-trial" content="AyGdETIKWLLqe+chG57f74gZcjYSfbdYAapEq7DA49E6CmaYaPmaoXh/4tAe5XJJJdwwpFVal7hz/irC+Wvp1HgAAABLeyJvcmlnaW4iOiJodHRwczovL2V4YW1wbGUuY29tIiwiZmVhdHVyZSI6IlRlc3RUcmlhbCIsImV4cGlyeSI6MzI1MDM2ODAwMDB9">
<!-- Created with: mktoken --origin 'http://mochi.test:8888' --feature TestTrial --expiry 'Wed, 01 Jan 3000 01:00:00 +0100' --sign test-keys/test-ecdsa.pkcs8 -->
<meta http-equiv="origin-trial" content="Ax+NsjHu0gB7huPad279C/p0ENAZR3R5lXAtKx0YTLbNsFFoYFFgDqxjCP10AHezcyyPrNS+uHHO72QdJM3eqMYAAABOeyJvcmlnaW4iOiJodHRwOi8vbW9jaGkudGVzdDo4ODg4IiwiZmVhdHVyZSI6IlRlc3RUcmlhbCIsImV4cGlyeSI6MzI1MDM2ODAwMDB9">
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="common.js"></script>
<script>

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

@ -1,8 +0,0 @@
<!doctype html>
<!-- Created with: mktoken --origin 'https://not-example.com' --feature TestTrial --expiry '01 Jan 3000 01:00:00 +0100' --sign test-keys/test-ecdsa.pkcs8 -->
<meta http-equiv="origin-trial" content="A1nUsa3CwtYj28syX2jYUogdrg+ZsjjNfAvmdg3SGybXxaJFbNq7i8AmY6Fo3OUe6Xvza3R0YYfaGTqM0TOU2OAAAABPeyJvcmlnaW4iOiJodHRwczovL25vdC1leGFtcGxlLmNvbSIsImZlYXR1cmUiOiJUZXN0VHJpYWwiLCJleHBpcnkiOjMyNTAzNjgwMDAwfQ==">
<script src="/tests/SimpleTest/SimpleTest.js"></script>
<script src="common.js"></script>
<script>
assertTestTrialActive(false);
</script>

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

@ -275,11 +275,6 @@ uint32_t WorkerGlobalScopeBase::GetPrincipalHashValue() const {
return mWorkerPrivate->GetPrincipalHashValue();
}
OriginTrials WorkerGlobalScopeBase::Trials() const {
mWorkerPrivate->AssertIsOnWorkerThread();
return mWorkerPrivate->Trials();
}
StorageAccess WorkerGlobalScopeBase::GetStorageAccess() {
mWorkerPrivate->AssertIsOnWorkerThread();
return mWorkerPrivate->StorageAccess();

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

@ -116,8 +116,6 @@ class WorkerGlobalScopeBase : public DOMEventTargetHelper,
uint32_t GetPrincipalHashValue() const final;
OriginTrials Trials() const final;
StorageAccess GetStorageAccess() final;
Maybe<ClientInfo> GetClientInfo() const final;

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

@ -38,8 +38,11 @@ NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(WorkletGlobalScope)
NS_INTERFACE_MAP_ENTRY(WorkletGlobalScope)
NS_INTERFACE_MAP_END
WorkletGlobalScope::WorkletGlobalScope(WorkletImpl* aImpl)
: mImpl(aImpl), mCreationTimeStamp(TimeStamp::Now()) {}
WorkletGlobalScope::WorkletGlobalScope(const Maybe<nsID>& aAgentClusterId,
bool aSharedMemoryAllowed)
: mCreationTimeStamp(TimeStamp::Now()),
mAgentClusterId(aAgentClusterId),
mSharedMemoryAllowed(aSharedMemoryAllowed) {}
WorkletGlobalScope::~WorkletGlobalScope() = default;
@ -65,16 +68,6 @@ already_AddRefed<Console> WorkletGlobalScope::GetConsole(JSContext* aCx,
return console.forget();
}
OriginTrials WorkletGlobalScope::Trials() const { return mImpl->Trials(); }
Maybe<nsID> WorkletGlobalScope::GetAgentClusterId() const {
return mImpl->GetAgentClusterId();
}
bool WorkletGlobalScope::IsSharedMemoryAllowed() const {
return mImpl->IsSharedMemoryAllowed();
}
void WorkletGlobalScope::Dump(const Optional<nsAString>& aString) const {
WorkletThread::AssertIsOnWorkletThread();

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

@ -38,7 +38,8 @@ class WorkletGlobalScope : public nsIGlobalObject, public nsWrapperCache {
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(WorkletGlobalScope)
WorkletGlobalScope(WorkletImpl*);
WorkletGlobalScope(const Maybe<nsID>& aAgentClusterId,
bool aSharedMemoryAllowed);
nsIGlobalObject* GetParentObject() const { return nullptr; }
@ -55,7 +56,7 @@ class WorkletGlobalScope : public nsIGlobalObject, public nsWrapperCache {
already_AddRefed<Console> GetConsole(JSContext* aCx, ErrorResult& aRv);
WorkletImpl* Impl() const { return mImpl.get(); }
virtual WorkletImpl* Impl() const = 0;
void Dump(const Optional<nsAString>& aString) const;
@ -65,17 +66,19 @@ class WorkletGlobalScope : public nsIGlobalObject, public nsWrapperCache {
return duration.ToMilliseconds();
}
OriginTrials Trials() const override;
Maybe<nsID> GetAgentClusterId() const override;
bool IsSharedMemoryAllowed() const override;
Maybe<nsID> GetAgentClusterId() const override { return mAgentClusterId; }
bool IsSharedMemoryAllowed() const override { return mSharedMemoryAllowed; }
protected:
~WorkletGlobalScope();
;
const RefPtr<WorkletImpl> mImpl;
private:
TimeStamp mCreationTimeStamp;
Maybe<nsID> mAgentClusterId;
RefPtr<Console> mConsole;
bool mSharedMemoryAllowed;
};
NS_DEFINE_STATIC_IID_ACCESSOR(WorkletGlobalScope, WORKLET_IID)

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

@ -41,8 +41,7 @@ WorkletImpl::WorkletImpl(nsPIDOMWindowInner* aWindow, nsIPrincipal* aPrincipal)
: mPrincipal(NullPrincipal::CreateWithInheritedAttributes(aPrincipal)),
mWorkletLoadInfo(aWindow),
mTerminated(false),
mFinishedOnExecutionThread(false),
mTrials(OriginTrials::FromWindow(nsGlobalWindowInner::Cast(aWindow))) {
mFinishedOnExecutionThread(false) {
Unused << NS_WARN_IF(
NS_FAILED(ipc::PrincipalToPrincipalInfo(mPrincipal, &mPrincipalInfo)));

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

@ -10,7 +10,6 @@
#include "MainThreadUtils.h"
#include "mozilla/Maybe.h"
#include "mozilla/OriginAttributes.h"
#include "mozilla/OriginTrials.h"
#include "mozilla/ipc/PBackgroundSharedTypes.h"
class nsPIDOMWindowInner;
@ -72,7 +71,6 @@ class WorkletImpl {
// Any thread.
const OriginTrials& Trials() const { return mTrials; }
const WorkletLoadInfo& LoadInfo() const { return mWorkletLoadInfo; }
const OriginAttributes& OriginAttributesRef() const {
return mPrincipalInfo.get_NullPrincipalInfo().attrs();
@ -117,8 +115,6 @@ class WorkletImpl {
Maybe<nsID> mAgentClusterId;
bool mSharedMemoryAllowed;
const OriginTrials mTrials;
};
} // namespace mozilla

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

@ -18,11 +18,11 @@
class XPCWrappedNative;
class BackstagePass final : public nsIGlobalObject,
public nsIScriptObjectPrincipal,
public nsIXPCScriptable,
public nsIClassInfo,
public nsSupportsWeakReference {
class BackstagePass : public nsIGlobalObject,
public nsIScriptObjectPrincipal,
public nsIXPCScriptable,
public nsIClassInfo,
public nsSupportsWeakReference {
public:
BackstagePass();
@ -30,13 +30,13 @@ class BackstagePass final : public nsIGlobalObject,
NS_DECL_NSIXPCSCRIPTABLE
NS_DECL_NSICLASSINFO
nsIPrincipal* GetPrincipal() override { return mPrincipal; }
virtual nsIPrincipal* GetPrincipal() override { return mPrincipal; }
nsIPrincipal* GetEffectiveStoragePrincipal() override { return mPrincipal; }
virtual nsIPrincipal* GetEffectiveStoragePrincipal() override {
return mPrincipal;
}
nsIPrincipal* PartitionedPrincipal() override { return mPrincipal; }
mozilla::OriginTrials Trials() const override { return {}; }
virtual nsIPrincipal* PartitionedPrincipal() override { return mPrincipal; }
JSObject* GetGlobalJSObject() override;
JSObject* GetGlobalJSObjectPreserveColor() const override;

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

@ -49,8 +49,6 @@ class SandboxPrivate : public nsIGlobalObject,
return static_cast<SandboxPrivate*>(sop);
}
mozilla::OriginTrials Trials() const final { return {}; }
nsIPrincipal* GetPrincipal() override { return mPrincipal; }
nsIPrincipal* GetEffectiveStoragePrincipal() override { return mPrincipal; }

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

@ -11,14 +11,13 @@
#include "mozilla/dom/FunctionBinding.h"
#include "PaintWorkletImpl.h"
namespace mozilla::dom {
namespace mozilla {
namespace dom {
PaintWorkletGlobalScope::PaintWorkletGlobalScope(PaintWorkletImpl* aImpl)
: WorkletGlobalScope(aImpl) {}
PaintWorkletImpl* PaintWorkletGlobalScope::Impl() const {
return static_cast<PaintWorkletImpl*>(mImpl.get());
}
: WorkletGlobalScope(aImpl->GetAgentClusterId(),
aImpl->IsSharedMemoryAllowed()),
mImpl(aImpl) {}
bool PaintWorkletGlobalScope::WrapGlobalObject(
JSContext* aCx, JS::MutableHandle<JSObject*> aReflector) {
@ -41,4 +40,7 @@ void PaintWorkletGlobalScope::RegisterPaint(const nsAString& aType,
// Nothing to do here, yet.
}
} // namespace mozilla::dom
WorkletImpl* PaintWorkletGlobalScope::Impl() const { return mImpl; }
} // namespace dom
} // namespace mozilla

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

@ -26,10 +26,12 @@ class PaintWorkletGlobalScope final : public WorkletGlobalScope {
void RegisterPaint(const nsAString& aType, VoidFunction& aProcessorCtor);
PaintWorkletImpl* Impl() const;
WorkletImpl* Impl() const override;
private:
~PaintWorkletGlobalScope() = default;
const RefPtr<PaintWorkletImpl> mImpl;
};
} // namespace dom