From 99240722e466a5bf7b94901bda2e16b671eec939 Mon Sep 17 00:00:00 2001 From: Andreas Farre Date: Wed, 10 May 2023 14:35:52 +0000 Subject: [PATCH] Bug 1823877 - Part 2: Adjust tests to account for parent filtered responses. r=sefeng,smaug Differential Revision: https://phabricator.services.mozilla.com/D174768 --- dom/serviceworkers/test/fetch/fetch_tests.js | 17 +-- dom/serviceworkers/test/fetch/index.html | 8 +- dom/serviceworkers/test/mochitest-common.ini | 4 - dom/serviceworkers/test/test_fetch_event.html | 4 +- .../test/test_fetch_event_no_orb.html | 76 ------------- .../test_fetch_event_with_thirdpartypref.html | 4 +- ...etch_event_with_thirdpartypref_no_orb.html | 91 ---------------- .../mochitest/fetch/fetch_test_framework.js | 95 ++++++---------- .../mochitest/fetch/nested_worker_wrapper.js | 7 +- dom/tests/mochitest/fetch/test_fetch_cors.js | 93 +++++----------- dom/tests/mochitest/fetch/test_response.js | 102 +++++------------- dom/workers/test/bug1063538.sjs | 4 +- .../tentative/content-range.sub.any.js.ini | 10 ++ .../tentative/known-mime-type.sub.any.js.ini | 38 +++++++ .../orb/tentative/nosniff.sub.any.js.ini | 23 ++++ .../fetch/orb/tentative/status.sub.any.js.ini | 17 +++ 16 files changed, 185 insertions(+), 408 deletions(-) delete mode 100644 dom/serviceworkers/test/test_fetch_event_no_orb.html delete mode 100644 dom/serviceworkers/test/test_fetch_event_with_thirdpartypref_no_orb.html create mode 100644 testing/web-platform/meta/fetch/orb/tentative/content-range.sub.any.js.ini create mode 100644 testing/web-platform/meta/fetch/orb/tentative/known-mime-type.sub.any.js.ini diff --git a/dom/serviceworkers/test/fetch/fetch_tests.js b/dom/serviceworkers/test/fetch/fetch_tests.js index 636ea7ebe9ad..bbe55c3a359b 100644 --- a/dom/serviceworkers/test/fetch/fetch_tests.js +++ b/dom/serviceworkers/test/fetch/fetch_tests.js @@ -453,10 +453,6 @@ fetch( { mode: "no-cors" } ).then( function(res) { - my_ok( - !new URLSearchParams(location.search).has("orbEnabled"), - "no-cors Fetch request with invalid javascript content should be blocked if ORB is enabled" - ); my_ok(res.type == "opaque", "Response type should be opaque"); my_ok(res.status == 0, "Status should be 0"); res.text().then(function(body) { @@ -465,10 +461,7 @@ fetch( }); }, function(e) { - my_ok( - new URLSearchParams(location.search).has("orbEnabled"), - "no-cors Fetch request with invalid javascript content should not be blocked if ORB disabled" - ); + my_ok(false, "no-cors Fetch failed"); finish(); } ); @@ -494,10 +487,6 @@ fetch("opaque-on-same-origin").then( expectAsyncResult(); fetch("http://example.com/opaque-no-cors", { mode: "no-cors" }).then( function(res) { - my_ok( - !new URLSearchParams(location.search).has("orbEnabled"), - "intercepted opaque response for no-cors request with invalid javascript content should be blocked when ORB is enabled." - ); my_ok( res.type == "opaque", "intercepted opaque response for no-cors request should have type opaque." @@ -506,8 +495,8 @@ fetch("http://example.com/opaque-no-cors", { mode: "no-cors" }).then( }, function(e) { my_ok( - new URLSearchParams(location.search).has("orbEnabled"), - "intercepted opaque response for no-cors request wth invalid javascript content should not be blocked when ORB is disabled." + false, + "intercepted opaque response for no-cors request should pass." ); finish(); } diff --git a/dom/serviceworkers/test/fetch/index.html b/dom/serviceworkers/test/fetch/index.html index 7de62c323009..693810c6fc0d 100644 --- a/dom/serviceworkers/test/fetch/index.html +++ b/dom/serviceworkers/test/fetch/index.html @@ -172,13 +172,7 @@ }; gExpected++; - - var fetch_worker_script_url = 'fetch_worker_script.js'; - const params = new URLSearchParams(window.location.search); - if (params.has("orbEnabled")) { - fetch_worker_script_url += "?orbEnabled"; - } - var worker = new Worker(fetch_worker_script_url); + var worker = new Worker('fetch_worker_script.js'); worker.onmessage = function(e) { if (e.data == "finish") { finish(); diff --git a/dom/serviceworkers/test/mochitest-common.ini b/dom/serviceworkers/test/mochitest-common.ini index a2542e9a6589..377c36e825e5 100644 --- a/dom/serviceworkers/test/mochitest-common.ini +++ b/dom/serviceworkers/test/mochitest-common.ini @@ -249,12 +249,8 @@ skip-if = skip-if = (os == "win" && processor == "aarch64") #bug 1535784 [test_fetch_event.html] skip-if = debug # Bug 1262224 -[test_fetch_event_no_orb.html] -skip-if = debug # Bug 1262224 [test_fetch_event_with_thirdpartypref.html] skip-if = debug # Bug 1262224 -[test_fetch_event_with_thirdpartypref_no_orb.html] -skip-if = debug # Bug 1262224 [test_fetch_integrity.html] skip-if = serviceworker_e10s support-files = console_monitor.js diff --git a/dom/serviceworkers/test/test_fetch_event.html b/dom/serviceworkers/test/test_fetch_event.html index db5a149271fe..5227f6ae3430 100644 --- a/dom/serviceworkers/test/test_fetch_event.html +++ b/dom/serviceworkers/test/test_fetch_event.html @@ -47,7 +47,7 @@ } }); - var w = window.open("fetch/index.html?orbEnabled"); + var w = window.open("fetch/index.html"); return p; } @@ -68,8 +68,6 @@ ["dom.serviceWorkers.exemptFromPerDomainMax", true], ["dom.serviceWorkers.enabled", true], ["dom.serviceWorkers.testing.enabled", true], - ["browser.opaqueResponseBlocking", true], - ["browser.opaqueResponseBlocking.javascriptValidator", true] ]}, runTest); diff --git a/dom/serviceworkers/test/test_fetch_event_no_orb.html b/dom/serviceworkers/test/test_fetch_event_no_orb.html deleted file mode 100644 index fa1edaf99bbc..000000000000 --- a/dom/serviceworkers/test/test_fetch_event_no_orb.html +++ /dev/null @@ -1,76 +0,0 @@ - - - - - Bug 94048 - test install event. - - - - -

- -

-
-
-
-
-
diff --git a/dom/serviceworkers/test/test_fetch_event_with_thirdpartypref.html b/dom/serviceworkers/test/test_fetch_event_with_thirdpartypref.html
index 46d28f75fee1..53552e03c3fd 100644
--- a/dom/serviceworkers/test/test_fetch_event_with_thirdpartypref.html
+++ b/dom/serviceworkers/test/test_fetch_event_with_thirdpartypref.html
@@ -59,7 +59,7 @@
       }
     });
 
-    var w = window.open("fetch/index.html?orbEnabled");
+    var w = window.open("fetch/index.html");
     return p;
   }
 
@@ -83,8 +83,6 @@
     ["dom.serviceWorkers.enabled", true],
     ["dom.serviceWorkers.testing.enabled", true],
     ["network.cookie.cookieBehavior", COOKIE_BEHAVIOR_REJECTFOREIGN],
-    ["browser.opaqueResponseBlocking", true],
-    ["browser.opaqueResponseBlocking.javascriptValidator", true]
   ]}, runTest);
 
 
diff --git a/dom/serviceworkers/test/test_fetch_event_with_thirdpartypref_no_orb.html b/dom/serviceworkers/test/test_fetch_event_with_thirdpartypref_no_orb.html
deleted file mode 100644
index 4c75693cd98c..000000000000
--- a/dom/serviceworkers/test/test_fetch_event_with_thirdpartypref_no_orb.html
+++ /dev/null
@@ -1,91 +0,0 @@
-
-
-
-
-  Bug 94048 - test install event.
-  
-  
-
-
-

- -

-
-
-
-
-
diff --git a/dom/tests/mochitest/fetch/fetch_test_framework.js b/dom/tests/mochitest/fetch/fetch_test_framework.js
index 12dbe9bdf897..91f1a7bf5d31 100644
--- a/dom/tests/mochitest/fetch/fetch_test_framework.js
+++ b/dom/tests/mochitest/fetch/fetch_test_framework.js
@@ -1,11 +1,9 @@
 function testScript(script) {
-  function makeWrapperUrl(wrapper, orbEnabled) {
-    let url = wrapper + "?script=" + script;
-    if (orbEnabled) {
-      url += "&orbEnabled";
-    }
-    return url;
+  function makeWrapperUrl(wrapper) {
+    return wrapper + "?script=" + script;
   }
+  let workerWrapperUrl = makeWrapperUrl("worker_wrapper.js");
+
   // The framework runs the entire test in many different configurations.
   // On slow platforms and builds this can make the tests likely to
   // timeout while they are still running.  Lengthen the timeout to
@@ -54,11 +52,9 @@ function testScript(script) {
     });
   }
 
-  function nestedWorkerTest(orbEnabled) {
+  function nestedWorkerTest() {
     return new Promise(function(resolve, reject) {
-      var worker = new Worker(
-        makeWrapperUrl("nested_worker_wrapper.js", orbEnabled)
-      );
+      var worker = new Worker(makeWrapperUrl("nested_worker_wrapper.js"));
       worker.onmessage = function(event) {
         if (event.data.context != "NestedWorker") {
           return;
@@ -141,57 +137,32 @@ function testScript(script) {
   // We have to run the window, worker and service worker tests sequentially
   // since some tests set and compare cookies and running in parallel can lead
   // to conflicting values.
-  function run(orbEnabled) {
-    const shouldFinishTest = !orbEnabled;
-    return setupPrefs()
-      .then(function() {
-        // No need to set ORB pref for windowTest because windowTest will
-        // do it by itself since it can access SpecialPowers.
-        return windowTest();
-      })
-      .then(function() {
-        return SpecialPowers.pushPrefEnv({
-          set: [
-            ["browser.opaqueResponseBlocking", orbEnabled],
-            ["browser.opaqueResponseBlocking.javascriptValidator", orbEnabled],
-          ],
-        });
-      })
-      .then(function() {
-        return workerTest();
-      })
-      .then(function() {
-        return nestedWorkerTest(orbEnabled);
-      })
-      .then(function() {
-        return serviceWorkerTest();
-      })
-      .catch(function(e) {
-        ok(false, "Some test failed in " + script);
-        info(e);
-        info(e.message);
-        return Promise.resolve();
-      })
-      .then(function() {
-        try {
-          if (parent && parent.finishTest) {
-            if (shouldFinishTest) {
-              parent.finishTest();
-            }
-            return;
-          }
-        } catch {}
-        if (shouldFinishTest) {
-          SimpleTest.finish();
+  setupPrefs()
+    .then(function() {
+      return windowTest();
+    })
+    .then(function() {
+      return workerTest();
+    })
+    .then(function() {
+      return nestedWorkerTest();
+    })
+    .then(function() {
+      return serviceWorkerTest();
+    })
+    .catch(function(e) {
+      ok(false, "Some test failed in " + script);
+      info(e);
+      info(e.message);
+      return Promise.resolve();
+    })
+    .then(function() {
+      try {
+        if (parent && parent.finishTest) {
+          parent.finishTest();
+          return;
         }
-      });
-  }
-
-  let orbEnabled = true;
-  let workerWrapperUrl = makeWrapperUrl("worker_wrapper.js", orbEnabled);
-  run(orbEnabled).then(function() {
-    orbEnabled = false;
-    workerWrapperUrl = makeWrapperUrl("worker_wrapper.js", orbEnabled);
-    run(orbEnabled);
-  });
+      } catch {}
+      SimpleTest.finish();
+    });
 }
diff --git a/dom/tests/mochitest/fetch/nested_worker_wrapper.js b/dom/tests/mochitest/fetch/nested_worker_wrapper.js
index 67e46250947e..9080f5ac9df4 100644
--- a/dom/tests/mochitest/fetch/nested_worker_wrapper.js
+++ b/dom/tests/mochitest/fetch/nested_worker_wrapper.js
@@ -1,10 +1,5 @@
 function getScriptUrl() {
-  const params = new URL(location.href).searchParams;
-  let scriptUrl = params.get("script");
-  if (params.has("orbEnabled")) {
-    scriptUrl += "&orbEnabled";
-  }
-  return scriptUrl;
+  return new URL(location.href).searchParams.get("script");
 }
 
 // Hold the nested worker alive until this parent worker closes.
diff --git a/dom/tests/mochitest/fetch/test_fetch_cors.js b/dom/tests/mochitest/fetch/test_fetch_cors.js
index aace6087fb73..c1f86539fd04 100644
--- a/dom/tests/mochitest/fetch/test_fetch_cors.js
+++ b/dom/tests/mochitest/fetch/test_fetch_cors.js
@@ -80,7 +80,7 @@ function testNoCorsCtor() {
 
 var corsServerPath =
   "/tests/dom/security/test/cors/file_CrossSiteXHR_server.sjs?";
-function testModeNoCors(withoutORB) {
+function testModeNoCors() {
   // Fetch spec, section 4, step 4, response tainting should be set opaque, so
   // that fetching leads to an opaque filtered response in step 8.
   var r = new Request("http://example.com" + corsServerPath + "status=200", {
@@ -88,20 +88,13 @@ function testModeNoCors(withoutORB) {
   });
   return fetch(r).then(
     function(res) {
-      ok(
-        withoutORB,
-        "no-cors Request fetch with invalid javascript content should be blocked when ORB is enabled"
-      );
       ok(
         isOpaqueResponse(res),
         "no-cors Request fetch should result in opaque response"
       );
     },
     function(e) {
-      ok(
-        !withoutORB,
-        "no-cors Request fetch with invalid javascript content should not be blocked when ORB is not enabled"
-      );
+      ok(false, "no-cors Request fetch should not error");
     }
   );
 }
@@ -1204,45 +1197,44 @@ function testCrossOriginCredentials() {
   return finalPromise;
 }
 
-function testModeNoCorsCredentials(withoutORB) {
+function testModeNoCorsCredentials() {
   var cookieStr = "type=chocolatechip";
   var tests = [
     {
       // Initialize by setting a cookie.
-      pass: withoutORB,
+      pass: 1,
       setCookie: cookieStr,
       withCred: "include",
-      bypassORB: true,
     },
     {
-      pass: withoutORB,
+      pass: 1,
       noCookie: 1,
       withCred: "omit",
     },
     {
-      pass: withoutORB,
+      pass: 1,
       noCookie: 1,
       withCred: "same-origin",
     },
     {
-      pass: withoutORB,
+      pass: 1,
       cookie: cookieStr,
       withCred: "include",
     },
     {
-      pass: withoutORB,
+      pass: 1,
       cookie: cookieStr,
       withCred: "omit",
       status: 500,
     },
     {
-      pass: withoutORB,
+      pass: 1,
       cookie: cookieStr,
       withCred: "same-origin",
       status: 500,
     },
     {
-      pass: withoutORB,
+      pass: 1,
       noCookie: 1,
       withCred: "include",
       status: 500,
@@ -1291,13 +1283,16 @@ function testModeNoCorsCredentials(withoutORB) {
       status,
       "wrong status in test for " + JSON.stringify(test)
     );
+
     return unfiltered.text().then(function(v) {
-      if (status === 200) {
-        is(
-          v,
-          "hello pass\n",
-          "wrong text in test for " + JSON.stringify(test)
-        );
+      if (test.status === 200) {
+        const expected =
+          SpecialPowers.getIntPref(
+            "browser.opaqueResponseBlocking.filterFetchResponse"
+          ) > 0
+            ? ""
+            : "hello pass\n";
+        is(v, expected, "wrong text in test for " + JSON.stringify(test));
       }
     });
   }
@@ -1712,29 +1707,25 @@ function testCORSRedirects() {
   return Promise.all(fetches);
 }
 
-function testNoCORSRedirects(withoutORB) {
+function testNoCORSRedirects() {
   var origin = "http://mochi.test:8888";
 
   var tests = [
+    { pass: 1, method: "GET", hops: [{ server: "http://example.com" }] },
     {
-      pass: withoutORB,
-      method: "GET",
-      hops: [{ server: "http://example.com" }],
-    },
-    {
-      pass: withoutORB,
+      pass: 1,
       method: "GET",
       hops: [{ server: origin }, { server: "http://example.com" }],
     },
     {
-      pass: withoutORB,
+      pass: 1,
       method: "GET",
       // Must use a simple header due to no-cors header restrictions.
       headers: { "accept-language": "en-us" },
       hops: [{ server: origin }, { server: "http://example.com" }],
     },
     {
-      pass: withoutORB,
+      pass: 1,
       method: "GET",
       hops: [
         { server: origin },
@@ -1743,7 +1734,7 @@ function testNoCORSRedirects(withoutORB) {
       ],
     },
     {
-      pass: withoutORB,
+      pass: 1,
       method: "POST",
       body: "upload body here",
       hops: [{ server: origin }, { server: "http://example.com" }],
@@ -1880,41 +1871,13 @@ function runTest() {
 
   return promise
     .then(testModeSameOrigin)
+    .then(testModeNoCors)
     .then(testModeCors)
     .then(testSameOriginCredentials)
     .then(testCrossOriginCredentials)
+    .then(testModeNoCorsCredentials)
     .then(testCORSRedirects)
-    .then(function() {
-      return SpecialPowers.pushPrefEnv({
-        set: [["browser.opaqueResponseBlocking", false]],
-      });
-    })
-    .then(() => {
-      return testModeNoCorsCredentials(1); // Without ORB
-    })
-    .then(function() {
-      return testModeNoCors(1); // Without ORB
-    })
-    .then(function() {
-      return testNoCORSRedirects(1); // Without ORB
-    })
-    .then(function() {
-      return SpecialPowers.pushPrefEnv({
-        set: [
-          ["browser.opaqueResponseBlocking", true],
-          ["browser.opaqueResponseBlocking.javascriptValidator", true],
-        ],
-      });
-    })
-    .then(() => {
-      return testModeNoCorsCredentials(0); // With ORB
-    })
-    .then(function() {
-      return testModeNoCors(0); // With ORB
-    })
-    .then(() => {
-      return testNoCORSRedirects(0); // With ORB
-    })
+    .then(testNoCORSRedirects)
     .then(testReferrer);
   // Put more promise based tests here.
 }
diff --git a/dom/tests/mochitest/fetch/test_response.js b/dom/tests/mochitest/fetch/test_response.js
index 06bed6ef2f89..80ed1fb996bd 100644
--- a/dom/tests/mochitest/fetch/test_response.js
+++ b/dom/tests/mochitest/fetch/test_response.js
@@ -97,59 +97,35 @@ function testClone() {
     });
 }
 
-function testCloneUnfiltered(orbEnabled) {
+function testCloneUnfiltered() {
   var url =
     "http://example.com/tests/dom/security/test/cors/file_CrossSiteXHR_server.sjs?status=200";
+  return fetch(url, { mode: "no-cors" }).then(function(response) {
+    // By default the chrome-only function should not be available.
+    is(response.type, "opaque", "response should be opaque");
+    is(
+      response.cloneUnfiltered,
+      undefined,
+      "response.cloneUnfiltered should be undefined"
+    );
 
-  // Due to the test step and the fact this script is imported by worker,
-  // so we had to do some extra parsing to get whether orbEnabled has
-  // been provided.
-  // location.search could be something like: ?script=test_response.js?orbEnabled
-  var isORBEnabled;
-  if (orbEnabled !== undefined) {
-    // Window Context
-    isORBEnabled = orbEnabled;
-  } else {
-    // Worker Context
-    const params = new URLSearchParams(location.search);
-    isORBEnabled = params.has("orbEnabled");
-  }
+    // When the test is run in a worker context we can't actually try to use
+    // the chrome-only function.  SpecialPowers is not defined.
+    if (typeof SpecialPowers !== "object") {
+      return;
+    }
 
-  return fetch(url, { mode: "no-cors" })
-    .then(function(response) {
-      // By default the chrome-only function should not be available.
-      ok(!isORBEnabled, "This request should be blocked when ORB is enabled");
-      is(response.type, "opaque", "response should be opaque");
-      is(
-        response.cloneUnfiltered,
-        undefined,
-        "response.cloneUnfiltered should be undefined"
-      );
-
-      // When the test is run in a worker context we can't actually try to use
-      // the chrome-only function.  SpecialPowers is not defined.
-      if (typeof SpecialPowers !== "object") {
-        return;
-      }
-
-      // With a chrome code, however, should be able to get an unfiltered response.
-      var chromeResponse = SpecialPowers.wrap(response);
-      is(
-        typeof chromeResponse.cloneUnfiltered,
-        "function",
-        "chromeResponse.cloneFiltered should be a function"
-      );
-      var unfiltered = chromeResponse.cloneUnfiltered();
-      is(unfiltered.type, "default", "unfiltered response should be default");
-      is(unfiltered.status, 200, "unfiltered response should have 200 status");
-    })
-    .catch(function(e) {
-      ok(
-        isORBEnabled,
-        "This request should not be blocked when ORB is disabled"
-      );
-      is(e.name, "TypeError", "ORB should throw TypeError");
-    });
+    // With a chrome code, however, should be able to get an unfiltered response.
+    var chromeResponse = SpecialPowers.wrap(response);
+    is(
+      typeof chromeResponse.cloneUnfiltered,
+      "function",
+      "chromeResponse.cloneFiltered should be a function"
+    );
+    var unfiltered = chromeResponse.cloneUnfiltered();
+    is(unfiltered.type, "default", "unfiltered response should be default");
+    is(unfiltered.status, 200, "unfiltered response should have 200 status");
+  });
 }
 
 function testError() {
@@ -360,33 +336,7 @@ function runTest() {
       .then(testBodyUsed)
       .then(testBodyExtraction)
       .then(testClone)
-      .then(async function() {
-        const inWindowContext = typeof SpecialPowers === "object";
-        // We want to use SpecialPowers to flip the prefs directly
-        // if we are in window context.
-        if (inWindowContext) {
-          return SpecialPowers.pushPrefEnv({
-            set: [
-              ["browser.opaqueResponseBlocking", true],
-              ["browser.opaqueResponseBlocking.javascriptValidator", true],
-            ],
-          })
-            .then(function() {
-              return testCloneUnfiltered(true);
-            })
-            .then(function() {
-              return SpecialPowers.pushPrefEnv({
-                set: [["browser.opaqueResponseBlocking", false]],
-              });
-            })
-            .then(function() {
-              return testCloneUnfiltered(false);
-            });
-        }
-        // Worker Context uses query strings to determine the
-        // status of ORB.
-        return testCloneUnfiltered();
-      })
+      .then(testCloneUnfiltered)
       // Put more promise based tests here.
       .catch(function(e) {
         dump("### ### " + e + "\n");
diff --git a/dom/workers/test/bug1063538.sjs b/dom/workers/test/bug1063538.sjs
index da866049fd20..96d94e91e1bb 100644
--- a/dom/workers/test/bug1063538.sjs
+++ b/dom/workers/test/bug1063538.sjs
@@ -1,4 +1,6 @@
-let { setTimeout } = ChromeUtils.import("resource://gre/modules/Timer.jsm");
+const { setTimeout } = ChromeUtils.importESModule(
+  "resource://gre/modules/Timer.sys.mjs"
+);
 
 function handleRequest(request, response) {
   response.processAsync();
diff --git a/testing/web-platform/meta/fetch/orb/tentative/content-range.sub.any.js.ini b/testing/web-platform/meta/fetch/orb/tentative/content-range.sub.any.js.ini
new file mode 100644
index 000000000000..482e8226a2c4
--- /dev/null
+++ b/testing/web-platform/meta/fetch/orb/tentative/content-range.sub.any.js.ini
@@ -0,0 +1,10 @@
+[content-range.sub.any.html]
+  prefs: [browser.opaqueResponseBlocking:true,
+          browser.opaqueResponseBlocking.filterFetchResponse:2]
+  [ORB should block opaque range of image/png not starting at zero, that isn't subsequent]
+    expected: FAIL
+
+
+[content-range.sub.any.worker.html]
+  [ORB should block opaque range of image/png not starting at zero, that isn't subsequent]
+    expected: FAIL
diff --git a/testing/web-platform/meta/fetch/orb/tentative/known-mime-type.sub.any.js.ini b/testing/web-platform/meta/fetch/orb/tentative/known-mime-type.sub.any.js.ini
new file mode 100644
index 000000000000..e21d50de713a
--- /dev/null
+++ b/testing/web-platform/meta/fetch/orb/tentative/known-mime-type.sub.any.js.ini
@@ -0,0 +1,38 @@
+[known-mime-type.sub.any.html]
+  prefs: [browser.opaqueResponseBlocking:true,
+          browser.opaqueResponseBlocking.filterFetchResponse:2]
+
+  [ORB should block opaque font/ttf]
+    expected: FAIL
+
+  [ORB should block opaque text/plain]
+    expected: FAIL
+
+  [ORB should block opaque application/json (non-empty)]
+    expected: FAIL
+
+  [ORB should block opaque application/json (empty)]
+    expected: FAIL
+
+  [ORB should block opaque application/json which contains non ascii characters]
+    expected: FAIL
+
+
+[known-mime-type.sub.any.worker.html]
+  prefs: [browser.opaqueResponseBlocking:true,
+          browser.opaqueResponseBlocking.filterFetchResponse:2]
+
+  [ORB should block opaque font/ttf]
+    expected: FAIL
+
+  [ORB should block opaque text/plain]
+    expected: FAIL
+
+  [ORB should block opaque application/json (non-empty)]
+    expected: FAIL
+
+  [ORB should block opaque application/json (empty)]
+    expected: FAIL
+
+  [ORB should block opaque application/json which contains non ascii characters]
+    expected: FAIL
diff --git a/testing/web-platform/meta/fetch/orb/tentative/nosniff.sub.any.js.ini b/testing/web-platform/meta/fetch/orb/tentative/nosniff.sub.any.js.ini
index cad2466270bd..08328fba3ec8 100644
--- a/testing/web-platform/meta/fetch/orb/tentative/nosniff.sub.any.js.ini
+++ b/testing/web-platform/meta/fetch/orb/tentative/nosniff.sub.any.js.ini
@@ -1,7 +1,30 @@
 [nosniff.sub.any.html]
+  prefs: [browser.opaqueResponseBlocking:true,
+          browser.opaqueResponseBlocking.filterFetchResponse:2]
+
   expected:
     if (os == "android") and fission: [OK, TIMEOUT]
+  [ORB should block opaque text/plain with nosniff]
+    expected: FAIL
+
+  [ORB should block opaque-response-blocklisted MIME type with nosniff]
+    expected: FAIL
+
+  [ORB should block opaque response with empty Content-Type and nosniff]
+    expected: FAIL
+
 
 [nosniff.sub.any.worker.html]
+  prefs: [browser.opaqueResponseBlocking:true,
+          browser.opaqueResponseBlocking.filterFetchResponse:2]
+
   expected:
     if (os == "android") and fission: [OK, TIMEOUT]
+  [ORB should block opaque text/plain with nosniff]
+    expected: FAIL
+
+  [ORB should block opaque-response-blocklisted MIME type with nosniff]
+    expected: FAIL
+
+  [ORB should block opaque response with empty Content-Type and nosniff]
+    expected: FAIL
diff --git a/testing/web-platform/meta/fetch/orb/tentative/status.sub.any.js.ini b/testing/web-platform/meta/fetch/orb/tentative/status.sub.any.js.ini
index 5e6d65cd8b6f..60b0794d77cf 100644
--- a/testing/web-platform/meta/fetch/orb/tentative/status.sub.any.js.ini
+++ b/testing/web-platform/meta/fetch/orb/tentative/status.sub.any.js.ini
@@ -1,7 +1,24 @@
 [status.sub.any.html]
+  prefs: [browser.opaqueResponseBlocking:true,
+          browser.opaqueResponseBlocking.filterFetchResponse:2]
+
   expected:
     if (os == "android") and fission: [OK, TIMEOUT]
+  [ORB should block opaque-response-blocklisted MIME type with status 206]
+    expected: FAIL
+
+  [ORB should block opaque response with non-ok status]
+    expected: FAIL
+
 
 [status.sub.any.worker.html]
+  prefs: [browser.opaqueResponseBlocking:true,
+          browser.opaqueResponseBlocking.filterFetchResponse:2]
+
   expected:
     if (os == "android") and fission: [OK, TIMEOUT]
+  [ORB should block opaque-response-blocklisted MIME type with status 206]
+    expected: FAIL
+
+  [ORB should block opaque response with non-ok status]
+    expected: FAIL