Bug 871323 - Remove enablePrivilege from offline tests. r=mayhemer

MozReview-Commit-ID: 7vshwGVAi6h

--HG--
extra : rebase_source : 3ebc74326439c813e5060d3e8929259eb00449b9
This commit is contained in:
Masatoshi Kimura 2017-01-26 23:32:19 +09:00
Родитель f3c9a45af9
Коммит 38f0250b45
4 изменённых файлов: 16 добавлений и 19 удалений

Просмотреть файл

@ -52,7 +52,8 @@ fetch: function(callback)
var self = this;
var cacheStorage = OfflineTest.getActiveStorage();
cacheStorage.asyncOpenURI(CommonUtils.makeURI(url), "", Ci.nsICacheStorage.OPEN_READONLY, this);
cacheStorage.asyncOpenURI(CommonUtils.makeURI(url), "", Ci.nsICacheStorage.OPEN_READONLY,
SpecialPowers.wrapCallbackObject(this));
}
};
@ -96,8 +97,6 @@ setupChild: function()
*/
setup: function()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
try {
this._allowedByDefault = SpecialPowers.getBoolPref("offline-apps.allow_by_default");
} catch (e) {}
@ -256,7 +255,7 @@ waitForAdd: function(url, onFinished) {
// Check every half second for ten seconds.
var numChecks = 20;
var waitForAddListener = {
var waitForAddListener = SpecialPowers.wrapCallbackObject({
onCacheEntryCheck: function() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; },
onCacheEntryAvailable: function(entry, isnew, applicationCache, status) {
if (entry) {
@ -272,7 +271,7 @@ waitForAdd: function(url, onFinished) {
setTimeout(OfflineTest.priv(waitFunc), 500);
}
};
});
var waitFunc = function() {
var cacheStorage = OfflineTest.getActiveStorage();
@ -380,7 +379,7 @@ _checkCache: function(cacheStorage, url, expectEntry, callback)
return;
}
var _checkCacheListener = {
var _checkCacheListener = SpecialPowers.wrapCallbackObject({
onCacheEntryCheck: function() { return Ci.nsICacheEntryOpenCallback.ENTRY_WANTED; },
onCacheEntryAvailable: function(entry, isnew, applicationCache, status) {
if (entry) {
@ -410,7 +409,7 @@ _checkCache: function(cacheStorage, url, expectEntry, callback)
}
if (callback) setTimeout(OfflineTest.priv(callback), 0);
}
};
});
cacheStorage.asyncOpenURI(CommonUtils.makeURI(url), "", Ci.nsICacheStorage.OPEN_READONLY, _checkCacheListener);
},

Просмотреть файл

@ -101,8 +101,6 @@ function finishTest()
function finalize()
{
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
var entries = [
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub-non-existing.html", false],
["http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/namespace1/sub/non-existing.html", false],

Просмотреть файл

@ -40,7 +40,7 @@ function finish() {
if (OfflineTest.setup()) {
obs.notifyObservers(updateService, "disk-space-watcher", "full");
var updateObserver = {
var updateObserver = SpecialPowers.wrapCallbackObject({
updateStateChanged: function (aUpdate, aState) {
switch(aState) {
case Ci.nsIOfflineCacheUpdateObserver.STATE_ERROR:
@ -68,7 +68,7 @@ if (OfflineTest.setup()) {
}
},
applicationCacheAvailable: function() {}
};
});
var manifest = "http://mochi.test:8888/tests/dom/tests/mochitest/ajax/offline/simpleManifest.cacheManifest";
var ioService = Cc["@mozilla.org/network/io-service;1"]

Просмотреть файл

@ -34,7 +34,7 @@ var systemPrincipal = SpecialPowers.Services.scriptSecurityManager.getSystemPrin
function manifestCached()
{
// Run first check for an update
updateService.checkForUpdate(manifestURI, systemPrincipal, {
updateService.checkForUpdate(manifestURI, systemPrincipal, SpecialPowers.wrapCallbackObject({
observe: function(subject, topic, data) {
OfflineTest.is(topic, "offline-cache-update-unavailable", "No update avail");
@ -42,13 +42,13 @@ function manifestCached()
OfflineTest.setSJSState(manifest, "second");
// Check we now get notification on update ready
updateService.checkForUpdate(manifestURI, systemPrincipal, {
updateService.checkForUpdate(manifestURI, systemPrincipal, SpecialPowers.wrapCallbackObject({
observe: function(subject, topic, data) {
OfflineTest.is(topic, "offline-cache-update-available", "Update avail (1)");
// Do the check again. We must get the same result. Double check is here
// to make sure we don't overwrite any data in the cache by the check it self.
updateService.checkForUpdate(manifestURI, systemPrincipal, {
updateService.checkForUpdate(manifestURI, systemPrincipal, SpecialPowers.wrapCallbackObject({
observe: function(subject, topic, data) {
OfflineTest.is(topic, "offline-cache-update-available", "Update avail (2)");
@ -56,23 +56,23 @@ function manifestCached()
applicationCache.onupdateready = OfflineTest.priv(manifestUpdated);
applicationCache.update();
}
});
}));
}
});
}));
}
});
}));
}
function manifestUpdated()
{
// Check for an update after manifest has been updated
updateService.checkForUpdate(manifestURI, systemPrincipal, {
updateService.checkForUpdate(manifestURI, systemPrincipal, SpecialPowers.wrapCallbackObject({
observe: function(subject, topic, data) {
OfflineTest.is(topic, "offline-cache-update-unavailable", "No update avail (2)");
OfflineTest.teardownAndFinish();
}
});
}));
}
if (OfflineTest.setup()) {