mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-07 18:04:46 +00:00
Bug 1835907, part 7 - Update DOM Cache API tests to remove most TCP-specific code, disable in xorigin - r=asuth
Differential Revision: https://phabricator.services.mozilla.com/D184827
This commit is contained in:
parent
19d759b0f0
commit
bdbf9706a8
11
dom/cache/test/mochitest/driver.js
vendored
11
dom/cache/test/mochitest/driver.js
vendored
@ -20,23 +20,12 @@ function runTests(testFile, order) {
|
||||
async function setupPrefs() {
|
||||
// Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
|
||||
// Acquire storage access permission here so that the Cache API is avaialable
|
||||
SpecialPowers.wrap(document).notifyUserGestureActivation();
|
||||
await SpecialPowers.addPermission(
|
||||
"storageAccessAPI",
|
||||
true,
|
||||
window.location.href
|
||||
);
|
||||
await SpecialPowers.wrap(document).requestStorageAccess();
|
||||
return SpecialPowers.pushPrefEnv({
|
||||
set: [
|
||||
["dom.caches.testing.enabled", true],
|
||||
["dom.serviceWorkers.enabled", true],
|
||||
["dom.serviceWorkers.testing.enabled", true],
|
||||
["dom.serviceWorkers.exemptFromPerDomainMax", true],
|
||||
[
|
||||
"privacy.partition.always_partition_third_party_non_cookie_storage",
|
||||
false,
|
||||
],
|
||||
],
|
||||
});
|
||||
}
|
||||
|
6
dom/cache/test/mochitest/mochitest.ini
vendored
6
dom/cache/test/mochitest/mochitest.ini
vendored
@ -27,6 +27,12 @@ support-files =
|
||||
empty.html
|
||||
idle_worker.js
|
||||
|
||||
# Disabled on xorigin because xorigin mode causes the tests to run in what
|
||||
# amounts to third-party iframes. We have separate tests for our behaviors
|
||||
# in that case (usually as "browser" tests) and do not want to complicate
|
||||
# these normal functionality tests.
|
||||
skip-if = xorigin
|
||||
|
||||
[test_cache.html]
|
||||
[test_cache_add.html]
|
||||
[test_cache_match_request.html]
|
||||
|
@ -89,15 +89,8 @@ SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.caches.testing.enabled", true],
|
||||
["dom.quotaManager.testing", true],
|
||||
["dom.storageManager.enabled", true],
|
||||
["privacy.partition.always_partition_third_party_non_cookie_storage", false]],
|
||||
}, async function() {
|
||||
// Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
|
||||
// Acquire storage access permission here so that the Cache API is avaialable
|
||||
SpecialPowers.wrap(document).notifyUserGestureActivation();
|
||||
await SpecialPowers.addPermission("storageAccessAPI", true, window.location.href);
|
||||
await SpecialPowers.wrap(document).requestStorageAccess();
|
||||
|
||||
["dom.storageManager.enabled", true]]
|
||||
}, function() {
|
||||
var name = "orphanedBodyOwner";
|
||||
var cache = null;
|
||||
var response = null;
|
||||
|
@ -61,16 +61,10 @@ function gc() {
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.caches.testing.enabled", true],
|
||||
["dom.quotaManager.testing", true],
|
||||
["privacy.partition.always_partition_third_party_non_cookie_storage", false]],
|
||||
}, async function() {
|
||||
// Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
|
||||
// Acquire storage access permission here so that the Cache API is avaialable
|
||||
SpecialPowers.wrap(document).notifyUserGestureActivation();
|
||||
await SpecialPowers.addPermission("storageAccessAPI", true, window.location.href);
|
||||
await SpecialPowers.wrap(document).requestStorageAccess();
|
||||
|
||||
"set": [["dom.caches.enabled", true],
|
||||
["dom.caches.testing.enabled", true],
|
||||
["dom.quotaManager.testing", true]],
|
||||
}, function() {
|
||||
var name = "toBeOrphaned";
|
||||
var cache = null;
|
||||
var initialUsage = 0;
|
||||
|
12
dom/cache/test/mochitest/test_cache_padding.html
vendored
12
dom/cache/test/mochitest/test_cache_padding.html
vendored
@ -85,9 +85,9 @@ function fetchOpaqueResponse(url) {
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.caches.testing.enabled", true],
|
||||
["dom.quotaManager.testing", true],
|
||||
["privacy.partition.always_partition_third_party_non_cookie_storage", false]],
|
||||
"set": [["dom.caches.enabled", true],
|
||||
["dom.caches.testing.enabled", true],
|
||||
["dom.quotaManager.testing", true]],
|
||||
}, async function() {
|
||||
// This test is mainly to verify we only generate different padding size for
|
||||
// the opaque response which is comming from netwrok.
|
||||
@ -100,12 +100,6 @@ SpecialPowers.pushPrefEnv({
|
||||
// Note: For the cloned and cached opaque response, the padding size shouldn't
|
||||
// be changed. Thus, it makes the attacker harder to get the padding size.
|
||||
|
||||
// Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
|
||||
// Acquire storage access permission here so that the Cache API is avaialable
|
||||
SpecialPowers.wrap(document).notifyUserGestureActivation();
|
||||
await SpecialPowers.addPermission("storageAccessAPI", true, window.location.href);
|
||||
await SpecialPowers.wrap(document).requestStorageAccess();
|
||||
|
||||
const name = "cachePadding";
|
||||
const other_name = "cachePaddingOther";
|
||||
const cors_base = "https://example.com/tests/dom/cache/test/mochitest/";
|
||||
|
14
dom/cache/test/mochitest/test_cache_shrink.html
vendored
14
dom/cache/test/mochitest/test_cache_shrink.html
vendored
@ -61,16 +61,10 @@ function gc() {
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.caches.testing.enabled", true],
|
||||
["dom.quotaManager.testing", true],
|
||||
["privacy.partition.always_partition_third_party_non_cookie_storage", false]],
|
||||
}, async function() {
|
||||
// Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
|
||||
// Acquire storage access permission here so that the Cache API is avaialable
|
||||
SpecialPowers.wrap(document).notifyUserGestureActivation();
|
||||
await SpecialPowers.addPermission("storageAccessAPI", true, window.location.href);
|
||||
await SpecialPowers.wrap(document).requestStorageAccess();
|
||||
|
||||
"set": [["dom.caches.enabled", true],
|
||||
["dom.caches.testing.enabled", true],
|
||||
["dom.quotaManager.testing", true],],
|
||||
}, function() {
|
||||
var name = "foo";
|
||||
var cache = null;
|
||||
var initialUsage = 0;
|
||||
|
@ -87,16 +87,10 @@ async function testCreateTonsOfFD() {
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.caches.testing.enabled", true],
|
||||
["dom.quotaManager.testing", true],
|
||||
["privacy.partition.always_partition_third_party_non_cookie_storage", false]],
|
||||
"set": [["dom.caches.enabled", true],
|
||||
["dom.caches.testing.enabled", true],
|
||||
["dom.quotaManager.testing", true]],
|
||||
}, async function() {
|
||||
// Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
|
||||
// Acquire storage access permission here so that the Cache API is avaialable
|
||||
SpecialPowers.wrap(document).notifyUserGestureActivation();
|
||||
await SpecialPowers.addPermission("storageAccessAPI", true, window.location.href);
|
||||
await SpecialPowers.wrap(document).requestStorageAccess();
|
||||
|
||||
await setupTestIframe();
|
||||
|
||||
info("Stage 1: Clean storage.");
|
||||
|
@ -81,16 +81,10 @@ async function waitForIOToComplete(cache, request) {
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SpecialPowers.pushPrefEnv({
|
||||
"set": [["dom.caches.testing.enabled", true],
|
||||
["dom.quotaManager.testing", true],
|
||||
["privacy.partition.always_partition_third_party_non_cookie_storage", false]],
|
||||
"set": [["dom.caches.enabled", true],
|
||||
["dom.caches.testing.enabled", true],
|
||||
["dom.quotaManager.testing", true]],
|
||||
}, async function() {
|
||||
// Bug 1746646: Make mochitests work with TCP enabled (cookieBehavior = 5)
|
||||
// Acquire storage access permission here so that the Cache API is avaialable
|
||||
SpecialPowers.wrap(document).notifyUserGestureActivation();
|
||||
await SpecialPowers.addPermission("storageAccessAPI", true, window.location.href);
|
||||
await SpecialPowers.wrap(document).requestStorageAccess();
|
||||
|
||||
const name = "cacheUpdateUsage";
|
||||
const url = "test_cache_add.js";
|
||||
const other_url = "test_cache_put.js";
|
||||
|
Loading…
Reference in New Issue
Block a user