Bug 767999: Actually use QuotaExceededErr. r=bent
authorKyle Huey <khuey@kylehuey.com>
Mon, 25 Jun 2012 12:15:18 -0700
changeset 112753 6e4fca267ad8034431b54317d283ddaa3d4073e7
parent 112752 e4e2536462b424ad65d4b6038c2d5c920ed5a781
child 112754 9494f28472a1a41c13503aa3a1e8a6705a62ecdb
push id1708
push userakeybl@mozilla.com
push dateMon, 19 Nov 2012 21:10:21 +0000
treeherdermozilla-beta@27b14fe50103 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbent
bugs767999
milestone16.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 767999: Actually use QuotaExceededErr. r=bent
content/base/src/nsINode.cpp
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");