Loading dom/base/nsContentUtils.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -2844,7 +2844,7 @@ bool nsContentUtils::ShouldResistFingerprinting_dangerous( } // Web extension principals are also excluded if (BasePrincipal::Cast(aPrincipal)->AddonPolicy()) { if (NS_IsMainThread() && BasePrincipal::Cast(aPrincipal)->AddonPolicy()) { MOZ_LOG(nsContentUtils::ResistFingerprintingLog(), LogLevel::Debug, ("Inside ShouldResistFingerprinting(nsIPrincipal*)" " and AddonPolicy said false")); Loading dom/media/webcodecs/VideoFrame.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1423,7 +1423,7 @@ JSObject* VideoFrame::WrapObject(JSContext* aCx, /* static */ bool VideoFrame::PrefEnabled(JSContext* aCx, JSObject* aObj) { return StaticPrefs::dom_media_webcodecs_enabled() || return nsRFPService::ExposeWebCodecsAPI(aCx, aObj) && StaticPrefs::dom_media_webcodecs_image_decoder_enabled(); } Loading dom/media/webcodecs/test/mochitest.toml +9 −0 Original line number Diff line number Diff line Loading @@ -16,4 +16,13 @@ scheme = "https" ["test_imageDecoder_desiredSize.html"] scheme = "https" ["test_rfp_api_disabling_disabled.html"] scheme = "https" ["test_rfp_api_disabling_enabled.html"] scheme = "https" ["test_rfp_api_disabling_exemption.html"] scheme = "https" ["test_videoFrame_mismatched_codedSize.html"] dom/media/webcodecs/test/test_rfp_api_disabling_disabled.html 0 → 100644 +67 −0 Original line number Diff line number Diff line <!DOCTYPE html> <html> <head> <title></title> <script src="/tests/SimpleTest/SimpleTest.js"></script> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> </head> <body> <script> const apis = [ "AudioData", "AudioDecoder", "AudioEncoder", "EncodedAudioChunk", "EncodedVideoChunk", "ImageDecoder", "ImageTrack", "ImageTrackList", "VideoColorSpace", "VideoDecoder", "VideoEncoder", "VideoFrame", ]; function enabledAPIs() { return apis.filter(api => typeof window[api] !== "undefined"); } function enabledAPIsWorker() { const code = ` onmessage = e => { const apis = ${JSON.stringify(apis)}; postMessage(apis.filter(api => typeof self[api] !== "undefined")); };`; const blob = new Blob([code], { type: "application/javascript" }); const worker = new Worker(URL.createObjectURL(blob)); return new Promise((resolve) => { worker.addEventListener("message", async (e) => { worker.terminate(); resolve(e.data); }); worker.postMessage({}); }); } add_setup(async () => { await SpecialPowers.pushPrefEnv({ set: [ ["dom.media.webcodecs.enabled", true], ["dom.media.webcodecs.image-decoder.enabled", true] ], }); }); add_task(async () => { is(enabledAPIs().length, apis.length, true, "All WebCodecs APIs should be enabled"); is( (await enabledAPIsWorker()).length, apis.length, "All WebCodecs APIs should be enabled in workers too" ); }); </script> </body> </html> dom/media/webcodecs/test/test_rfp_api_disabling_enabled.html 0 → 100644 +69 −0 Original line number Diff line number Diff line <!DOCTYPE html> <html> <head> <title></title> <script src="/tests/SimpleTest/SimpleTest.js"></script> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> </head> <body> <script> const apis = [ "AudioData", "AudioDecoder", "AudioEncoder", "EncodedAudioChunk", "EncodedVideoChunk", "ImageDecoder", "ImageTrack", "ImageTrackList", "VideoColorSpace", "VideoDecoder", "VideoEncoder", "VideoFrame", ]; function enabledAPIs() { return apis.filter(api => typeof window[api] !== "undefined"); } function enabledAPIsWorker() { const code = ` onmessage = e => { const apis = ${JSON.stringify(apis)}; postMessage(apis.filter(api => typeof self[api] !== "undefined")); };`; const blob = new Blob([code], { type: "application/javascript" }); const worker = new Worker(URL.createObjectURL(blob)); return new Promise((resolve) => { worker.addEventListener("message", async (e) => { worker.terminate(); resolve(e.data); }); worker.postMessage({}); }); } add_setup(async () => { await SpecialPowers.pushPrefEnv({ set: [ ["dom.media.webcodecs.enabled", true], ["dom.media.webcodecs.image-decoder.enabled", true], ["privacy.fingerprintingProtection", true], ["privacy.fingerprintingProtection.overrides", "-AllTargets,+WebCodecs"], ], }); }); add_task(async () => { is(enabledAPIs().length, 0, true, "All WebCodecs APIs should be disabled"); is( (await enabledAPIsWorker()).length, 0, "All WebCodecs APIs should be disabled in workers too" ); }); </script> </body> </html> Loading
dom/base/nsContentUtils.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -2844,7 +2844,7 @@ bool nsContentUtils::ShouldResistFingerprinting_dangerous( } // Web extension principals are also excluded if (BasePrincipal::Cast(aPrincipal)->AddonPolicy()) { if (NS_IsMainThread() && BasePrincipal::Cast(aPrincipal)->AddonPolicy()) { MOZ_LOG(nsContentUtils::ResistFingerprintingLog(), LogLevel::Debug, ("Inside ShouldResistFingerprinting(nsIPrincipal*)" " and AddonPolicy said false")); Loading
dom/media/webcodecs/VideoFrame.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -1423,7 +1423,7 @@ JSObject* VideoFrame::WrapObject(JSContext* aCx, /* static */ bool VideoFrame::PrefEnabled(JSContext* aCx, JSObject* aObj) { return StaticPrefs::dom_media_webcodecs_enabled() || return nsRFPService::ExposeWebCodecsAPI(aCx, aObj) && StaticPrefs::dom_media_webcodecs_image_decoder_enabled(); } Loading
dom/media/webcodecs/test/mochitest.toml +9 −0 Original line number Diff line number Diff line Loading @@ -16,4 +16,13 @@ scheme = "https" ["test_imageDecoder_desiredSize.html"] scheme = "https" ["test_rfp_api_disabling_disabled.html"] scheme = "https" ["test_rfp_api_disabling_enabled.html"] scheme = "https" ["test_rfp_api_disabling_exemption.html"] scheme = "https" ["test_videoFrame_mismatched_codedSize.html"]
dom/media/webcodecs/test/test_rfp_api_disabling_disabled.html 0 → 100644 +67 −0 Original line number Diff line number Diff line <!DOCTYPE html> <html> <head> <title></title> <script src="/tests/SimpleTest/SimpleTest.js"></script> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> </head> <body> <script> const apis = [ "AudioData", "AudioDecoder", "AudioEncoder", "EncodedAudioChunk", "EncodedVideoChunk", "ImageDecoder", "ImageTrack", "ImageTrackList", "VideoColorSpace", "VideoDecoder", "VideoEncoder", "VideoFrame", ]; function enabledAPIs() { return apis.filter(api => typeof window[api] !== "undefined"); } function enabledAPIsWorker() { const code = ` onmessage = e => { const apis = ${JSON.stringify(apis)}; postMessage(apis.filter(api => typeof self[api] !== "undefined")); };`; const blob = new Blob([code], { type: "application/javascript" }); const worker = new Worker(URL.createObjectURL(blob)); return new Promise((resolve) => { worker.addEventListener("message", async (e) => { worker.terminate(); resolve(e.data); }); worker.postMessage({}); }); } add_setup(async () => { await SpecialPowers.pushPrefEnv({ set: [ ["dom.media.webcodecs.enabled", true], ["dom.media.webcodecs.image-decoder.enabled", true] ], }); }); add_task(async () => { is(enabledAPIs().length, apis.length, true, "All WebCodecs APIs should be enabled"); is( (await enabledAPIsWorker()).length, apis.length, "All WebCodecs APIs should be enabled in workers too" ); }); </script> </body> </html>
dom/media/webcodecs/test/test_rfp_api_disabling_enabled.html 0 → 100644 +69 −0 Original line number Diff line number Diff line <!DOCTYPE html> <html> <head> <title></title> <script src="/tests/SimpleTest/SimpleTest.js"></script> <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" /> </head> <body> <script> const apis = [ "AudioData", "AudioDecoder", "AudioEncoder", "EncodedAudioChunk", "EncodedVideoChunk", "ImageDecoder", "ImageTrack", "ImageTrackList", "VideoColorSpace", "VideoDecoder", "VideoEncoder", "VideoFrame", ]; function enabledAPIs() { return apis.filter(api => typeof window[api] !== "undefined"); } function enabledAPIsWorker() { const code = ` onmessage = e => { const apis = ${JSON.stringify(apis)}; postMessage(apis.filter(api => typeof self[api] !== "undefined")); };`; const blob = new Blob([code], { type: "application/javascript" }); const worker = new Worker(URL.createObjectURL(blob)); return new Promise((resolve) => { worker.addEventListener("message", async (e) => { worker.terminate(); resolve(e.data); }); worker.postMessage({}); }); } add_setup(async () => { await SpecialPowers.pushPrefEnv({ set: [ ["dom.media.webcodecs.enabled", true], ["dom.media.webcodecs.image-decoder.enabled", true], ["privacy.fingerprintingProtection", true], ["privacy.fingerprintingProtection.overrides", "-AllTargets,+WebCodecs"], ], }); }); add_task(async () => { is(enabledAPIs().length, 0, true, "All WebCodecs APIs should be disabled"); is( (await enabledAPIsWorker()).length, 0, "All WebCodecs APIs should be disabled in workers too" ); }); </script> </body> </html>