Bug 615923 - mochitests-2: intermittent "test_fallback.html | Exited with code 1 during test run" (ASSERTION: XPConnect is being called on a scope without a 'Components' property!); (Bv1) offlineTests.js: Fully fix finish(), 1 s/dump(/ok(false,/, Fix some nits.

r=honzab a=(test only).
This commit is contained in:
Serge Gautherie 2010-12-08 01:00:19 +01:00
Родитель d6c06c1acf
Коммит f08ce70c39
1 изменённых файлов: 12 добавлений и 6 удалений

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

@ -80,8 +80,13 @@ setupChild: function()
return true; return true;
}, },
// Setup the tests. This will reload the current page in a new window /**
// if necessary. * Setup the tests. This will reload the current page in a new window
* if necessary.
*
* @return boolean Whether this window is the slave window
* to actually run the test in.
*/
setup: function() setup: function()
{ {
netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");
@ -100,7 +105,7 @@ setup: function()
.getService(Ci.nsIIOService) .getService(Ci.nsIIOService)
.newURI(window.location.href, null, null); .newURI(window.location.href, null, null);
if (pm.testPermission(uri, "offline-app") != 0) { if (pm.testPermission(uri, "offline-app") != 0) {
dump("Previous test failed to clear offline-app permission! Expect failures.\n"); ok(false, "Previous test failed to clear offline-app permission! Expect failures.");
} }
pm.add(uri, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION); pm.add(uri, "offline-app", Ci.nsIPermissionManager.ALLOW_ACTION);
@ -143,7 +148,7 @@ finish: function()
{ {
if (this._masterWindow) { if (this._masterWindow) {
// Slave window: pass control back to master window, close itself. // Slave window: pass control back to master window, close itself.
SimpleTest.executeSoon(this._masterWindow.OfflineTest.finish); this._masterWindow.SimpleTest.executeSoon(this._masterWindow.OfflineTest.finish);
window.close(); window.close();
} else { } else {
// Master window: finish test. // Master window: finish test.
@ -197,7 +202,7 @@ waitForAdd: function(url, onFinished) {
var cacheSession = OfflineTest.getActiveSession(); var cacheSession = OfflineTest.getActiveSession();
var entry; var entry;
try { try {
var entry = cacheSession.openCacheEntry(url, Ci.nsICache.ACCESS_READ, false); entry = cacheSession.openCacheEntry(url, Ci.nsICache.ACCESS_READ, false);
} catch (e) { } catch (e) {
} }
@ -235,7 +240,8 @@ getActiveCache: function()
getActiveSession: function() getActiveSession: function()
{ {
var cache = this.getActiveCache(); var cache = this.getActiveCache();
if (!cache) return null; if (!cache)
return null;
var cacheService = Cc["@mozilla.org/network/cache-service;1"] var cacheService = Cc["@mozilla.org/network/cache-service;1"]
.getService(Ci.nsICacheService); .getService(Ci.nsICacheService);