michael@0: function run_test() michael@0: { michael@0: do_get_profile(); michael@0: michael@0: if (!newCacheBackEndUsed()) { michael@0: do_check_true(true, "This test doesn't run when the old cache back end is used since the behavior is different"); michael@0: return; michael@0: } michael@0: michael@0: // Open for write, write but expect it to fail, since other callback will recreate (and doom) michael@0: // the first entry before it opens output stream (note: in case of problems the DOOMED flag michael@0: // can be removed, it is not the test failure when opening the output stream on recreated entry. michael@0: asyncOpenCacheEntry("http://nv/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NEW|DOOMED, "v1m", "v1d", function(entry) { michael@0: // Open for rewrite (don't validate), write different meta and data michael@0: asyncOpenCacheEntry("http://nv/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NOTVALID|RECREATE, "v2m", "v2d", function(entry) { michael@0: // And check... michael@0: asyncOpenCacheEntry("http://nv/", "disk", Ci.nsICacheStorage.OPEN_NORMALLY, null, michael@0: new OpenCallback(NORMAL, "v2m", "v2d", function(entry) { michael@0: finish_cache2_test(); michael@0: }) michael@0: ); michael@0: }) michael@0: ); michael@0: }) michael@0: ); michael@0: michael@0: do_test_pending(); michael@0: }