mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1172629 - Use the caches global property from an iframe loaded after setting the pref in order to make the tests pass with the pref disabled; r=bkelly a=RyanVM
This commit is contained in:
parent
fe6d5a35cb
commit
1d3ef5533c
2
dom/cache/test/mochitest/empty.html
vendored
Normal file
2
dom/cache/test/mochitest/empty.html
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
<!DOCTYPE html>
|
||||
<!-- This is only used to give us access to the caches global after setting the pref. -->
|
1
dom/cache/test/mochitest/mochitest.ini
vendored
1
dom/cache/test/mochitest/mochitest.ini
vendored
@ -22,6 +22,7 @@ support-files =
|
||||
test_cache_put_reorder.js
|
||||
test_cache_https.js
|
||||
large_url_list.js
|
||||
empty.html
|
||||
|
||||
[test_cache.html]
|
||||
[test_cache_add.html]
|
||||
|
16
dom/cache/test/mochitest/test_cache_restart.html
vendored
16
dom/cache/test/mochitest/test_cache_restart.html
vendored
@ -9,6 +9,18 @@
|
||||
</head>
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
function setupTestIframe() {
|
||||
return new Promise(function(resolve) {
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "empty.html";
|
||||
iframe.onload = function() {
|
||||
window.caches = iframe.contentWindow.caches;
|
||||
resolve();
|
||||
};
|
||||
document.body.appendChild(iframe);
|
||||
});
|
||||
}
|
||||
|
||||
function resetStorage() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
@ -32,7 +44,9 @@ SpecialPowers.pushPrefEnv({
|
||||
var name = 'foo';
|
||||
var url = './test_cache_add.js';
|
||||
var cache;
|
||||
caches.open(name).then(function(c) {
|
||||
setupTestIframe().then(function() {
|
||||
return caches.open(name);
|
||||
}).then(function(c) {
|
||||
cache = c;
|
||||
return cache.add(url);
|
||||
}).then(function() {
|
||||
|
16
dom/cache/test/mochitest/test_cache_shrink.html
vendored
16
dom/cache/test/mochitest/test_cache_shrink.html
vendored
@ -10,6 +10,18 @@
|
||||
</head>
|
||||
<body>
|
||||
<script class="testbody" type="text/javascript">
|
||||
function setupTestIframe() {
|
||||
return new Promise(function(resolve) {
|
||||
var iframe = document.createElement("iframe");
|
||||
iframe.src = "empty.html";
|
||||
iframe.onload = function() {
|
||||
window.caches = iframe.contentWindow.caches;
|
||||
resolve();
|
||||
};
|
||||
document.body.appendChild(iframe);
|
||||
});
|
||||
}
|
||||
|
||||
function clearStorage() {
|
||||
return new Promise(function(resolve, reject) {
|
||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
||||
@ -73,7 +85,9 @@ SpecialPowers.pushPrefEnv({
|
||||
var endUsage = 0;
|
||||
// start from a fresh origin directory so other tests do not influence our
|
||||
// results
|
||||
clearStorage().then(function() {
|
||||
setupTestIframe().then(function() {
|
||||
return clearStorage();
|
||||
}).then(function() {
|
||||
return storageUsage();
|
||||
}).then(function(usage) {
|
||||
is(0, usage, 'disk usage should be zero to start');
|
||||
|
Loading…
Reference in New Issue
Block a user