Bug 767999: Actually use QuotaExceededErr. r=bent
authorKyle Huey <khuey@kylehuey.com>
Mon, 25 Jun 2012 12:15:18 -0700
changeset 97562 5c07a681371d46d1bc86af397b6d712fdd870e2b
parent 97561 4f832cefc08e6c55a7dded3a26baeb1678479387
child 97640 74e503bfa5755aa239dbaf2ba34fbd2e097fef21
child 97685 6cb0f670716839a09bbe8f925424dc3be1f48dae
push id22985
push userkhuey@mozilla.com
push dateMon, 25 Jun 2012 19:16:27 +0000
treeherdermozilla-central@5c07a681371d [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs767999
milestone16.0a1
first release with
nightly linux32
5c07a681371d / 16.0a1 / 20120626030539 / files
nightly linux64
5c07a681371d / 16.0a1 / 20120626030539 / files
nightly mac
5c07a681371d / 16.0a1 / 20120626030539 / files
nightly win32
5c07a681371d / 16.0a1 / 20120626030539 / files
nightly win64
5c07a681371d / 16.0a1 / 20120626030539 / files
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
releases
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 767999: Actually use QuotaExceededErr. r=bent
dom/indexedDB/IDBTransaction.cpp
dom/indexedDB/test/browser_quotaPromptDeny.js
--- a/dom/indexedDB/IDBTransaction.cpp
+++ b/dom/indexedDB/IDBTransaction.cpp
@@ -852,22 +852,28 @@ CommitHelper::Run()
     }
 
     if (!mAbortCode && NS_FAILED(WriteAutoIncrementCounts())) {
       mAbortCode = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
     }
 
     if (!mAbortCode) {
       NS_NAMED_LITERAL_CSTRING(release, "COMMIT TRANSACTION");
-      if (NS_SUCCEEDED(mConnection->ExecuteSimpleSQL(release))) {
+      nsresult rv = mConnection->ExecuteSimpleSQL(release);
+      if (NS_SUCCEEDED(rv)) {
         if (mUpdateFileRefcountFunction) {
           mUpdateFileRefcountFunction->UpdateFileInfos();
         }
         CommitAutoIncrementCounts();
       }
+      else if (rv == NS_ERROR_FILE_NO_DEVICE_SPACE) {
+        // mozstorage translates SQLITE_FULL to NS_ERROR_FILE_NO_DEVICE_SPACE,
+        // which we know better as NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR.
+        mAbortCode = NS_ERROR_DOM_INDEXEDDB_QUOTA_ERR;
+      }
       else {
         mAbortCode = NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR;
       }
     }
 
     if (mAbortCode) {
       RevertAutoIncrementCounts();
       NS_NAMED_LITERAL_CSTRING(rollback, "ROLLBACK TRANSACTION");
--- a/dom/indexedDB/test/browser_quotaPromptDeny.js
+++ b/dom/indexedDB/test/browser_quotaPromptDeny.js
@@ -32,17 +32,17 @@ function test1()
     setFinishedCallback(function(result) {
       is(result, "ready", "Got 'ready' result");
 
       setFinishedCallback(function(result) {
         if (!seenPopupCount) {
           is(result, "complete", "Got 'complete' result");
         }
         else {
-          is(result, "abort UnknownError", "Got 'abort' result");
+          is(result, "abort QuotaExceededError", "Got 'abort' result");
         }
 
         if (addMoreTest1Count >= seenPopupCount + 5) {
           setFinishedCallback(function(result) {
             is(result, "finished", "Got 'finished' result");
             is(getPermission(testPageURL, "indexedDB-unlimited"),
                Components.interfaces.nsIPermissionManager.DENY_ACTION,
                "Correct permission set");
@@ -103,17 +103,17 @@ function test2()
         ok(!seenPopup, "No popup");
         is(getPermission(testPageURL, "indexedDB-unlimited"),
            Components.interfaces.nsIPermissionManager.DENY_ACTION,
            "Correct permission set");
 
         if (addMoreCount > addMoreTest1Count + 5) {
           setFinishedCallback(function(result) {
             is(result, "finished", "Got 'finished' result");
-            is(lastResult, "abort UnknownError", "Aborted as expected");
+            is(lastResult, "abort QuotaExceededError", "Aborted as expected");
             ok(!seenPopup, "No popup");
             is(getPermission(testPageURL, "indexedDB-unlimited"),
                Components.interfaces.nsIPermissionManager.DENY_ACTION,
                "Correct permission set");
 
             gBrowser.removeCurrentTab();
             unregisterAllPopupEventHandlers();
             removePermission(testPageURL, "indexedDB");