зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1244764 P2 Make dom/cache mochitests pass with new add()/addAll() behavior. r=ehsan
This commit is contained in:
Родитель
1de96897ae
Коммит
a0dffad2f8
|
@ -1,13 +1,14 @@
|
|||
var url = 'index.html';
|
||||
self.addEventListener('message', (message) => {
|
||||
caches.open('acache').then((cache) => {
|
||||
if(message.data == 'write') {
|
||||
cache.add('aurl').then(() => {
|
||||
cache.add(url).then(() => {
|
||||
message.source.postMessage({
|
||||
type: 'written'
|
||||
});
|
||||
});
|
||||
} else if (message.data == 'read') {
|
||||
cache.match('aurl').then((result) => {
|
||||
cache.match(url).then((result) => {
|
||||
message.source.postMessage({
|
||||
type: 'done',
|
||||
cached: !!result
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var singleUrl = './test_cache_add.js';
|
||||
var urlList = [
|
||||
'./helloworld.txt',
|
||||
'./foobar.txt',
|
||||
'./empty.html',
|
||||
'./frame.html',
|
||||
'./test_cache.js'
|
||||
];
|
||||
var cache;
|
||||
|
|
|
@ -4,10 +4,18 @@ var urlBase = 'https://example.com/tests/dom/cache/test/mochitest';
|
|||
var url1 = urlBase + '/test_cache.js';
|
||||
var url2 = urlBase + '/test_cache_add.js';
|
||||
|
||||
function addOpaque(cache, url) {
|
||||
return fetch(new Request(url, { mode: 'no-cors' })).then(function(response) {
|
||||
return cache.put(url, response);
|
||||
});
|
||||
}
|
||||
|
||||
caches.open(name).then(function(c) {
|
||||
cache = c;
|
||||
return cache.addAll([new Request(url1, { mode: 'no-cors' }),
|
||||
new Request(url2, { mode: 'no-cors' })]);
|
||||
return Promise.all([
|
||||
addOpaque(cache, url1),
|
||||
addOpaque(cache, url2)
|
||||
]);
|
||||
}).then(function() {
|
||||
return cache.delete(url1);
|
||||
}).then(function(result) {
|
||||
|
|
|
@ -71,7 +71,7 @@ SpecialPowers.pushPrefEnv({
|
|||
var fullUsage = 0;
|
||||
var resetUsage = 0;
|
||||
var endUsage = 0;
|
||||
var url = 'cache_add.js';
|
||||
var url = 'test_cache_add.js';
|
||||
|
||||
// start from a fresh origin directory so other tests do not influence our
|
||||
// results
|
||||
|
|
|
@ -70,7 +70,7 @@ SpecialPowers.pushPrefEnv({
|
|||
var fullUsage = 0;
|
||||
var resetUsage = 0;
|
||||
var endUsage = 0;
|
||||
var url = 'cache_add.js';
|
||||
var url = 'test_cache_add.js';
|
||||
|
||||
// start from a fresh origin directory so other tests do not influence our
|
||||
// results
|
||||
|
|
Загрузка…
Ссылка в новой задаче