[tbb-commits] [tor-browser] 11/43: Bug 1764515 Remove "media.block-midflight-redirects" pref. r=padenot, a=RyanVM

gitolite role git at cupani.torproject.org
Tue May 31 07:06:54 UTC 2022


This is an automated email from the git hooks/post-receive script.

pierov pushed a commit to branch tor-browser-91.10.0esr-11.0-1
in repository tor-browser.

commit ca3bd70600dceb6c210b99f8c12ecf6629c37e7c
Author: Karl Tomlinson <karlt+ at karlt.net>
AuthorDate: Wed Apr 13 23:15:15 2022 +0000

    Bug 1764515 Remove "media.block-midflight-redirects" pref. r=padenot, a=RyanVM
    
    The "media.block-midflight-redirects" was added to verify that test videos
    play without the blocking,
    https://hg.mozilla.org/integration/mozilla-inbound/rev/d8c358ea16eb
    but we have CORS for that.
    
    The behavior of the code is easier to follow without the different paths from
    the pref.
    
    Differential Revision: https://phabricator.services.mozilla.com/D143572
---
 dom/media/ChannelMediaDecoder.cpp                   |  3 +--
 dom/media/test/test_midflight_redirect_blocked.html | 19 +++++--------------
 2 files changed, 6 insertions(+), 16 deletions(-)

diff --git a/dom/media/ChannelMediaDecoder.cpp b/dom/media/ChannelMediaDecoder.cpp
index 7d3ad7922f244..20c871fd93757 100644
--- a/dom/media/ChannelMediaDecoder.cpp
+++ b/dom/media/ChannelMediaDecoder.cpp
@@ -139,8 +139,7 @@ void ChannelMediaDecoder::NotifyPrincipalChanged() {
     mInitialChannelPrincipalKnown = true;
     return;
   }
-  if (!mSameOriginMedia &&
-      Preferences::GetBool("media.block-midflight-redirects", true)) {
+  if (!mSameOriginMedia) {
     // Block mid-flight redirects to non CORS same origin destinations.
     // See bugs 1441153, 1443942.
     LOG("ChannnelMediaDecoder prohibited cross origin redirect blocked.");
diff --git a/dom/media/test/test_midflight_redirect_blocked.html b/dom/media/test/test_midflight_redirect_blocked.html
index 55b96ccd381f7..ea85673b45178 100644
--- a/dom/media/test/test_midflight_redirect_blocked.html
+++ b/dom/media/test/test_midflight_redirect_blocked.html
@@ -56,29 +56,20 @@
       let v = document.createElement("video");
       const testCases = gSmallTests.filter(t => v.canPlayType(t.type));
 
-      async function testMediaLoad(expectedToLoad, message, useCors) {
+      async function testMediaLoad(message, {useCors}) {
         for (let test of testCases) {
           let loaded = await testIfLoadsToMetadata(test, useCors);
-          is(loaded, expectedToLoad, test.name + " " + message);
+          is(loaded, useCors, test.name + " " + message);
         }
       }
 
       async function runTest() {
         try {
-          SimpleTest.info("Allowing midflight redirects...");
-          await SpecialPowers.pushPrefEnv({'set': [["media.block-midflight-redirects", false]]});
-
-          SimpleTest.info("Test that all media plays...");
-          await testMediaLoad(true, "expected to load", false);
-
-          SimpleTest.info("Blocking midflight redirects...");
-          await SpecialPowers.pushPrefEnv({'set': [["media.block-midflight-redirects", true]]});
-
-          SimpleTest.info("Test that all media no longer play...");
-          await testMediaLoad(false, "expected to be blocked", false);
+          SimpleTest.info("Test that all media do not play without CORS...");
+          await testMediaLoad("expected to be blocked", {useCors: false});
 
           SimpleTest.info("Test that all media play if CORS used...");
-          await testMediaLoad(true, "expected to play with CORS", true);
+          await testMediaLoad("expected to play with CORS", {useCors: true});
         } catch (e) {
           info("Exception " + e.message);
           ok(false, "Threw exception " + e.message);

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list