Bug 432055: applicationCache.status is 0 through the update process, patch by dcamp@mozilla.com, r+sr=jst, a=schrep
authorgavin@gavinsharp.com
Thu, 08 May 2008 17:09:26 -0700
changeset 15074 a51060543787c3ba529efd2b96e664383b64d37e
parent 15073 88cbf650b48a74067d8b8d371e5167b1eabc213f
child 15075 fe51be10a4c6599dfb72dabb4135f1f963c73856
push idunknown
push userunknown
push dateunknown
reviewersschrep
bugs432055
milestone1.9pre
Bug 432055: applicationCache.status is 0 through the update process, patch by dcamp@mozilla.com, r+sr=jst, a=schrep
dom/tests/mochitest/ajax/offline/test_simpleManifest.html
uriloader/prefetch/nsOfflineCacheUpdate.cpp
--- a/dom/tests/mochitest/ajax/offline/test_simpleManifest.html
+++ b/dom/tests/mochitest/ajax/offline/test_simpleManifest.html
@@ -94,18 +94,23 @@ function manifestUpdated()
   gGotDownloading = false;
   applicationCache.update();
 }
 
 
 if (OfflineTest.setup()) {
   applicationCache.onerror = OfflineTest.failEvent;
 
-  applicationCache.onchecking = function() { gGotChecking = true; };
-  applicationCache.ondownloading = function() { gGotDownloading = true; };
+  applicationCache.onchecking = function() {
+    OfflineTest.is(applicationCache.status, 2, "CHECKING state while checking");
+    gGotChecking = true;
+  };
+  applicationCache.ondownloading = function() {
+    OfflineTest.is(applicationCache.status, 3, "DOWNLOADING state while checking")
+    gGotDownloading = true; };
   applicationCache.oncached = OfflineTest.priv(manifestUpdated);
 }
 
 SimpleTest.waitForExplicitFinish();
 
 </script>
 
 </head>
--- a/uriloader/prefetch/nsOfflineCacheUpdate.cpp
+++ b/uriloader/prefetch/nsOfflineCacheUpdate.cpp
@@ -1227,21 +1227,24 @@ nsOfflineCacheUpdate::GetUpdateDomain(ns
     return NS_OK;
 }
 
 NS_IMETHODIMP
 nsOfflineCacheUpdate::GetStatus(PRUint16 *aStatus)
 {
     switch (mState) {
     case STATE_CHECKING :
-        return nsIDOMOfflineResourceList::CHECKING;
+        *aStatus = nsIDOMOfflineResourceList::CHECKING;
+        return NS_OK;
     case STATE_DOWNLOADING :
-        return nsIDOMOfflineResourceList::DOWNLOADING;
+        *aStatus = nsIDOMOfflineResourceList::DOWNLOADING;
+        return NS_OK;
     default :
-        return nsIDOMOfflineResourceList::IDLE;
+        *aStatus = nsIDOMOfflineResourceList::IDLE;
+        return NS_OK;
     }
 
     return NS_ERROR_FAILURE;
 }
 
 NS_IMETHODIMP
 nsOfflineCacheUpdate::GetPartial(PRBool *aPartial)
 {