зеркало из https://github.com/mozilla/gecko-dev.git
Backed out changeset f7054968c36b (bug 1165395) for B2G debug crashes.
CLOSED TREE
This commit is contained in:
Родитель
bb5a648426
Коммит
a022f9015f
|
@ -33,4 +33,3 @@ support-files =
|
||||||
[test_cache_requestCache.html]
|
[test_cache_requestCache.html]
|
||||||
[test_cache_delete.html]
|
[test_cache_delete.html]
|
||||||
[test_cache_put_reorder.html]
|
[test_cache_put_reorder.html]
|
||||||
[test_cache_restart.html]
|
|
||||||
|
|
|
@ -1,61 +0,0 @@
|
||||||
<!-- Any copyright is dedicated to the Public Domain.
|
|
||||||
- http://creativecommons.org/publicdomain/zero/1.0/ -->
|
|
||||||
<!DOCTYPE HTML>
|
|
||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Test Cache with QuotaManager Restart</title>
|
|
||||||
<script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
|
||||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<script class="testbody" type="text/javascript">
|
|
||||||
function resetStorage() {
|
|
||||||
return new Promise(function(resolve, reject) {
|
|
||||||
var principal = SpecialPowers.wrap(document).nodePrincipal;
|
|
||||||
var appId, inBrowser;
|
|
||||||
var nsIPrincipal = SpecialPowers.Components.interfaces.nsIPrincipal;
|
|
||||||
if (principal.appId != nsIPrincipal.UNKNOWN_APP_ID &&
|
|
||||||
principal.appId != nsIPrincipal.NO_APP_ID) {
|
|
||||||
appId = principal.appId;
|
|
||||||
inBrowser = principal.isInBrowserElement;
|
|
||||||
}
|
|
||||||
SpecialPowers.resetStorageForURI(document.documentURI, resolve, appId,
|
|
||||||
inBrowser);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
SimpleTest.waitForExplicitFinish();
|
|
||||||
SpecialPowers.pushPrefEnv({
|
|
||||||
"set": [["dom.caches.enabled", true],
|
|
||||||
["dom.quotaManager.testing", true]],
|
|
||||||
}, function() {
|
|
||||||
var name = 'foo';
|
|
||||||
var url = './test_cache_add.js';
|
|
||||||
var cache;
|
|
||||||
caches.open(name).then(function(c) {
|
|
||||||
cache = c;
|
|
||||||
return cache.add(url);
|
|
||||||
}).then(function() {
|
|
||||||
return resetStorage();
|
|
||||||
}).then(function() {
|
|
||||||
return cache.match(url).then(function(resp) {
|
|
||||||
ok(false, 'old cache reference should not work after reset');
|
|
||||||
}).catch(function(err) {
|
|
||||||
ok(true, 'old cache reference should not work after reset');
|
|
||||||
});
|
|
||||||
}).then(function() {
|
|
||||||
return caches.open(name);
|
|
||||||
}).then(function(c) {
|
|
||||||
cache = c;
|
|
||||||
return cache.match(url);
|
|
||||||
}).then(function(resp) {
|
|
||||||
ok(!!resp, 'cache should work after QM reset');
|
|
||||||
return caches.delete(name);
|
|
||||||
}).then(function(success) {
|
|
||||||
ok(success, 'cache should be deleted');
|
|
||||||
SimpleTest.finish();
|
|
||||||
});
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
|
@ -497,7 +497,7 @@ SpecialPowersObserverAPI.prototype = {
|
||||||
let msg = aMessage.data;
|
let msg = aMessage.data;
|
||||||
let op = msg.op;
|
let op = msg.op;
|
||||||
|
|
||||||
if (op != 'clear' && op != 'getUsage' && op != 'reset') {
|
if (op != 'clear' && op != 'getUsage') {
|
||||||
throw new SpecialPowersError('Invalid operation for SPQuotaManager');
|
throw new SpecialPowersError('Invalid operation for SPQuotaManager');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -511,8 +511,6 @@ SpecialPowersObserverAPI.prototype = {
|
||||||
} else {
|
} else {
|
||||||
qm.clearStoragesForURI(uri);
|
qm.clearStoragesForURI(uri);
|
||||||
}
|
}
|
||||||
} else if (op == 'reset') {
|
|
||||||
qm.reset();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// We always use the getUsageForURI callback even if we're clearing
|
// We always use the getUsageForURI callback even if we're clearing
|
||||||
|
|
|
@ -1889,13 +1889,6 @@ SpecialPowersAPI.prototype = {
|
||||||
this._quotaManagerRequest('getUsage', uri, appId, inBrowser, callback);
|
this._quotaManagerRequest('getUsage', uri, appId, inBrowser, callback);
|
||||||
},
|
},
|
||||||
|
|
||||||
// Technically this restarts the QuotaManager for all URIs, but we need
|
|
||||||
// a specific one to perform the synchronized callback when the reset is
|
|
||||||
// complete.
|
|
||||||
resetStorageForURI: function(uri, callback, appId, inBrowser) {
|
|
||||||
this._quotaManagerRequest('reset', uri, appId, inBrowser, callback);
|
|
||||||
},
|
|
||||||
|
|
||||||
_quotaManagerRequest: function(op, uri, appId, inBrowser, callback) {
|
_quotaManagerRequest: function(op, uri, appId, inBrowser, callback) {
|
||||||
const messageTopic = "SPQuotaManager";
|
const messageTopic = "SPQuotaManager";
|
||||||
|
|
||||||
|
|
Загрузка…
Ссылка в новой задаче