Closed Bug 759805 Opened 12 years ago Closed 8 years ago

nsICacheSession::AsyncOpenCacheEntry sometimes returns a failure code even after it has queued a call to the nsICacheListener

Categories

(Core :: Networking: Cache, defect)

defect
Not set
normal

Tracking

()

RESOLVED WONTFIX

People

(Reporter: briansmith, Unassigned)

Details

If nsICacheSession::AsyncOpenCacheEntry is going to eventually call one of the listener's callback methods, then it MUST return rv such that NS_SUCCEEDED(rv). Conversely, if nsICacheSession::AsyncOpenCacheEntry will NOT call one of the listener's callback methods, then it must return rv such that NS_FAILED(rv).

With my patches in bug 722034, I have run into a case where AsyncOpenCacheEntry is returning NS_ERROR_CACHE_KEY_NOT_FOUND in test dom/tests/mochitest/ajax/offline/test_changingManifest.html, and ALSO calling my listener's OnCacheEntryAvailable method.

The code for AsyncOpenCacheEntry is:

    nsresult rv;
    rv = nsCacheService::OpenCacheEntry(this,
                                        key,
                                        accessRequested,
                                        !noWait,
                                        listener,
                                        nsnull); // no result

    if (rv == NS_ERROR_CACHE_WAIT_FOR_VALIDATION) rv = NS_OK;
    return rv;

I guess nsCacheService::OpenCacheEntry has the same problem; it should not be returning a failure status if it has queued a request for the listener, so that the "if (rv == NS_ERROR_CACHE_WAIT_FOR_VALIDATION) rv = NS_OK;" statement is unnecessary.
dom/tests/mochitest/ajax/offline/test_overlap.html is another test that triggers this (intermittently?).
Whiteboard: [necko-backlog]
old cache bug
Status: NEW → RESOLVED
Closed: 8 years ago
Resolution: --- → WONTFIX
Whiteboard: [necko-backlog]
You need to log in before you can comment on or make changes to this bug.