[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-10851-g50815da

jorlow at chromium.org jorlow at chromium.org
Wed Dec 22 18:16:46 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit bc913b3ce09d955a1a3be208c3075925063e1022
Author: jorlow at chromium.org <jorlow at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Dec 9 12:29:55 2010 +0000

    2010-12-07  Jeremy Orlow  <jorlow at chromium.org>
    
            Reviewed by Steve Block.
    
            IndexedDB returns the wrong exceptions
            https://bugs.webkit.org/show_bug.cgi?id=50632
    
            * storage/indexeddb/constants-expected.txt:
            * storage/indexeddb/constants.html:
            * storage/indexeddb/objectstore-removeobjectstore-expected.txt:
            * storage/indexeddb/objectstore-removeobjectstore.html:
    2010-12-07  Jeremy Orlow  <jorlow at chromium.org>
    
            Reviewed by Steve Block.
    
            IndexedDB returns the wrong exceptions
            https://bugs.webkit.org/show_bug.cgi?id=50632
    
            IndexedDB exceptions need to have an offset so they can
            be distinguished from DOM exceptions.  We also need to
            add strings for the various exceptions.  Lastly, make
            IDBDatabaseException use the common exception base class.
    
            * bindings/js/JSDOMBinding.cpp:
            (WebCore::setDOMException):
            * bindings/v8/V8Proxy.cpp:
            (WebCore::V8Proxy::setDOMException):
            * dom/ExceptionCode.cpp:
            (WebCore::getExceptionCodeDescription):
            * dom/ExceptionCode.h:
            * storage/IDBDatabaseError.h:
            (WebCore::IDBDatabaseError::code):
            * storage/IDBDatabaseException.h:
            (WebCore::IDBDatabaseException::create):
            (WebCore::IDBDatabaseException::ErrorCodeToExceptionCode):
            (WebCore::IDBDatabaseException::IDBDatabaseException):
            * storage/IDBDatabaseException.idl:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73605 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 083e2de..6bb06da 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,15 @@
+2010-12-07  Jeremy Orlow  <jorlow at chromium.org>
+
+        Reviewed by Steve Block.
+
+        IndexedDB returns the wrong exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=50632
+
+        * storage/indexeddb/constants-expected.txt:
+        * storage/indexeddb/constants.html:
+        * storage/indexeddb/objectstore-removeobjectstore-expected.txt:
+        * storage/indexeddb/objectstore-removeobjectstore.html:
+
 2010-12-09  Pavel Feldman  <pfeldman at chromium.org>
 
         Not reviewed. Rebaselined Chromium expectations.
diff --git a/LayoutTests/storage/indexeddb/constants-expected.txt b/LayoutTests/storage/indexeddb/constants-expected.txt
index ead0937..110a68d 100644
--- a/LayoutTests/storage/indexeddb/constants-expected.txt
+++ b/LayoutTests/storage/indexeddb/constants-expected.txt
@@ -4,16 +4,16 @@ On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE
 
 
 PASS webkitIDBDatabaseException.UNKNOWN_ERR is 1
-PASS webkitIDBDatabaseException.NON_TRANSIENT_ERR is 1
-PASS webkitIDBDatabaseException.NOT_FOUND_ERR is 2
-PASS webkitIDBDatabaseException.CONSTRAINT_ERR is 3
-PASS webkitIDBDatabaseException.DATA_ERR is 4
-PASS webkitIDBDatabaseException.NOT_ALLOWED_ERR is 5
-PASS webkitIDBDatabaseException.SERIAL_ERR is 11
-PASS webkitIDBDatabaseException.RECOVERABLE_ERR is 21
-PASS webkitIDBDatabaseException.TRANSIENT_ERR is 31
-PASS webkitIDBDatabaseException.TIMEOUT_ERR is 32
-PASS webkitIDBDatabaseException.DEADLOCK_ERR is 33
+PASS webkitIDBDatabaseException.NON_TRANSIENT_ERR is 2
+PASS webkitIDBDatabaseException.NOT_FOUND_ERR is 3
+PASS webkitIDBDatabaseException.CONSTRAINT_ERR is 4
+PASS webkitIDBDatabaseException.DATA_ERR is 5
+PASS webkitIDBDatabaseException.NOT_ALLOWED_ERR is 6
+PASS webkitIDBDatabaseException.SERIAL_ERR is 7
+PASS webkitIDBDatabaseException.RECOVERABLE_ERR is 8
+PASS webkitIDBDatabaseException.TRANSIENT_ERR is 9
+PASS webkitIDBDatabaseException.TIMEOUT_ERR is 10
+PASS webkitIDBDatabaseException.DEADLOCK_ERR is 11
 PASS webkitIDBRequest.LOADING is 1
 PASS webkitIDBRequest.DONE is 2
 PASS webkitIDBCursor.NEXT is 0
diff --git a/LayoutTests/storage/indexeddb/constants.html b/LayoutTests/storage/indexeddb/constants.html
index 7909e24..03af61b 100644
--- a/LayoutTests/storage/indexeddb/constants.html
+++ b/LayoutTests/storage/indexeddb/constants.html
@@ -17,16 +17,16 @@ if (window.layoutTestController)
 function test()
 {
     shouldBe("webkitIDBDatabaseException.UNKNOWN_ERR", "1");
-    shouldBe("webkitIDBDatabaseException.NON_TRANSIENT_ERR", "1");
-    shouldBe("webkitIDBDatabaseException.NOT_FOUND_ERR", "2");
-    shouldBe("webkitIDBDatabaseException.CONSTRAINT_ERR", "3");
-    shouldBe("webkitIDBDatabaseException.DATA_ERR", "4");
-    shouldBe("webkitIDBDatabaseException.NOT_ALLOWED_ERR", "5");
-    shouldBe("webkitIDBDatabaseException.SERIAL_ERR", "11");
-    shouldBe("webkitIDBDatabaseException.RECOVERABLE_ERR", "21");
-    shouldBe("webkitIDBDatabaseException.TRANSIENT_ERR", "31");
-    shouldBe("webkitIDBDatabaseException.TIMEOUT_ERR", "32");
-    shouldBe("webkitIDBDatabaseException.DEADLOCK_ERR", "33");
+    shouldBe("webkitIDBDatabaseException.NON_TRANSIENT_ERR", "2");
+    shouldBe("webkitIDBDatabaseException.NOT_FOUND_ERR", "3");
+    shouldBe("webkitIDBDatabaseException.CONSTRAINT_ERR", "4");
+    shouldBe("webkitIDBDatabaseException.DATA_ERR", "5");
+    shouldBe("webkitIDBDatabaseException.NOT_ALLOWED_ERR", "6");
+    shouldBe("webkitIDBDatabaseException.SERIAL_ERR", "7");
+    shouldBe("webkitIDBDatabaseException.RECOVERABLE_ERR", "8");
+    shouldBe("webkitIDBDatabaseException.TRANSIENT_ERR", "9");
+    shouldBe("webkitIDBDatabaseException.TIMEOUT_ERR", "10");
+    shouldBe("webkitIDBDatabaseException.DEADLOCK_ERR", "11");
 
     shouldBe("webkitIDBRequest.LOADING", "1");
     shouldBe("webkitIDBRequest.DONE", "2");
diff --git a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt
index 4e5e562..e45ff73 100644
--- a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt
+++ b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt
@@ -121,7 +121,7 @@ PASS 'onerror' in event.target is true
 PASS 'readyState' in event.target is true
 PASS event.target.readyState is event.target.DONE
 
-PASS event.code is 2
+PASS event.code is webkitIDBDatabaseException.NOT_FOUND_ERR
 PASS event.source.indexNames.contains('indexName') is false
 PASS successfullyParsed is true
 
diff --git a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
index 5f617ca..c531dcf 100644
--- a/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
+++ b/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
@@ -112,7 +112,7 @@ function getValueAgain()
 function verifyError()
 {
     verifyErrorEvent(event);
-    shouldBe("event.code", "2");
+    shouldBe("event.code", "webkitIDBDatabaseException.NOT_FOUND_ERR");
     shouldBeFalse("event.source.indexNames.contains('indexName')");
 
     done();
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 06b48b8..43e5bbc 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,30 @@
+2010-12-07  Jeremy Orlow  <jorlow at chromium.org>
+
+        Reviewed by Steve Block.
+
+        IndexedDB returns the wrong exceptions
+        https://bugs.webkit.org/show_bug.cgi?id=50632
+
+        IndexedDB exceptions need to have an offset so they can
+        be distinguished from DOM exceptions.  We also need to
+        add strings for the various exceptions.  Lastly, make
+        IDBDatabaseException use the common exception base class.
+
+        * bindings/js/JSDOMBinding.cpp:
+        (WebCore::setDOMException):
+        * bindings/v8/V8Proxy.cpp:
+        (WebCore::V8Proxy::setDOMException):
+        * dom/ExceptionCode.cpp:
+        (WebCore::getExceptionCodeDescription):
+        * dom/ExceptionCode.h:
+        * storage/IDBDatabaseError.h:
+        (WebCore::IDBDatabaseError::code):
+        * storage/IDBDatabaseException.h:
+        (WebCore::IDBDatabaseException::create):
+        (WebCore::IDBDatabaseException::ErrorCodeToExceptionCode):
+        (WebCore::IDBDatabaseException::IDBDatabaseException):
+        * storage/IDBDatabaseException.idl:
+
 2010-12-09  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
 
         Build fix for GTK+3. Use functions added for GTK+ 2.24 to get the
diff --git a/WebCore/bindings/js/JSDOMBinding.cpp b/WebCore/bindings/js/JSDOMBinding.cpp
index 0d94b44..cf0a16a 100644
--- a/WebCore/bindings/js/JSDOMBinding.cpp
+++ b/WebCore/bindings/js/JSDOMBinding.cpp
@@ -86,6 +86,11 @@
 #include "JSFileException.h"
 #endif
 
+#if ENABLE(INDEXED_DATABASE)
+#include "IDBDatabaseException.h"
+#include "JSIDBDatabaseException.h"
+#endif
+
 using namespace JSC;
 
 namespace WebCore {
@@ -650,6 +655,11 @@ void setDOMException(ExecState* exec, ExceptionCode ec)
             errorObject = toJS(exec, globalObject, FileException::create(description));
             break;
 #endif
+#if ENABLE(INDEXED_DATABASE)
+        case IDBDatabaseExceptionType:
+            errorObject = toJS(exec, globalObject, IDBDatabaseException::create(description));
+            break;
+#endif
     }
 
     ASSERT(errorObject);
diff --git a/WebCore/bindings/v8/V8Proxy.cpp b/WebCore/bindings/v8/V8Proxy.cpp
index 35da008..1c1f642 100644
--- a/WebCore/bindings/v8/V8Proxy.cpp
+++ b/WebCore/bindings/v8/V8Proxy.cpp
@@ -37,6 +37,7 @@
 #include "DocumentLoader.h"
 #include "Frame.h"
 #include "FrameLoaderClient.h"
+#include "IDBDatabaseException.h"
 #include "IDBFactoryBackendInterface.h"
 #include "IDBPendingTransactionMonitor.h"
 #include "InspectorInstrumentation.h"
@@ -64,6 +65,10 @@
 #include "WorkerContext.h"
 #include "WorkerContextExecutionProxy.h"
 
+#if ENABLE(INDEXED_DATABASE)
+#include "V8IDBDatabaseException.h"
+#endif
+
 #if ENABLE(SVG)
 #include "V8SVGException.h"
 #endif
@@ -673,6 +678,11 @@ void V8Proxy::setDOMException(int exceptionCode)
         exception = toV8(FileException::create(description));
         break;
 #endif
+#if ENABLE(INDEXED_DATABASE)
+    case IDBDatabaseExceptionType:
+        exception = toV8(IDBDatabaseException::create(description));
+        break;
+#endif
     default:
         ASSERT_NOT_REACHED();
     }
diff --git a/WebCore/dom/ExceptionCode.cpp b/WebCore/dom/ExceptionCode.cpp
index ad4fb6f..7e7e0c9 100644
--- a/WebCore/dom/ExceptionCode.cpp
+++ b/WebCore/dom/ExceptionCode.cpp
@@ -27,6 +27,7 @@
 #include "ExceptionCode.h"
 
 #include "EventException.h"
+#include "IDBDatabaseException.h"
 #include "RangeException.h"
 #include "XMLHttpRequestException.h"
 
@@ -209,6 +210,36 @@ static const char* const fileExceptionDescriptions[] = {
 };
 #endif
 
+#if ENABLE(INDEXED_DATABASE)
+static const char* const idbDatabaseExceptionNames[] = {
+    "UNKNOWN_ERR",
+    "NON_TRANSIENT_ERR",
+    "NOT_FOUND_ERR",
+    "CONSTRAINT_ERR",
+    "DATA_ERR",
+    "NOT_ALLOWED_ERR",
+    "SERIAL_ERR",
+    "RECOVERABLE_ERR",
+    "TRANSIENT_ERR",
+    "TIMEOUT_ERR",
+    "DEADLOCK_ERR"
+};
+
+static const char* const idbDatabaseExceptionDescriptions[] = {
+    "An unknown error occurred within Indexed Database.",
+    "NON_TRANSIENT_ERR", // FIXME: Write a better message if it's ever possible this is thrown.
+    "The name supplied does not match any existing item.",
+    "The request cannot be completed due to a failed constraint.",
+    "The data provided does not meet the requirements of the function.",
+    "This function is not allowed to be called in such a context.",
+    "The data supplied cannot be serialized according to the structured cloning algorithm.",
+    "RECOVERABLE_ERR", // FIXME: This isn't even used.
+    "TRANSIENT_ERR", // FIXME: This isn't even used.
+    "TIMEOUT_ERR", // This can't be thrown.
+    "DEADLOCK_ERR" // This can't be thrown.
+};
+#endif
+
 void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& description)
 {
     ASSERT(ec);
@@ -287,6 +318,16 @@ void getExceptionCodeDescription(ExceptionCode ec, ExceptionCodeDescription& des
         nameTableSize = WTF_ARRAY_LENGTH(fileExceptionNames);
         nameTableOffset = FileException::NOT_FOUND_ERR;
 #endif
+#if ENABLE(INDEXED_DATABASE)
+    } else if (code >= IDBDatabaseException::IDBDatabaseExceptionOffset && code <= IDBDatabaseException::IDBDatabaseExceptionMax) {
+        type = IDBDatabaseExceptionType;
+        typeName = "DOM IDBDatabase";
+        code -= IDBDatabaseException::IDBDatabaseExceptionOffset;
+        nameTable = idbDatabaseExceptionNames;
+        descriptionTable = idbDatabaseExceptionDescriptions;
+        nameTableSize = WTF_ARRAY_LENGTH(idbDatabaseExceptionNames);
+        nameTableOffset = IDBDatabaseException::UNKNOWN_ERR;
+#endif
     } else {
         type = DOMExceptionType;
         typeName = "DOM";
diff --git a/WebCore/dom/ExceptionCode.h b/WebCore/dom/ExceptionCode.h
index 6ea9f7d..dd976c7 100644
--- a/WebCore/dom/ExceptionCode.h
+++ b/WebCore/dom/ExceptionCode.h
@@ -84,6 +84,9 @@ namespace WebCore {
 #if ENABLE(BLOB) || ENABLE(FILE_SYSTEM)
         , FileExceptionType
 #endif
+#if ENABLE(INDEXED_DATABASE)
+        , IDBDatabaseExceptionType
+#endif
     };
 
 
diff --git a/WebCore/storage/IDBDatabaseError.h b/WebCore/storage/IDBDatabaseError.h
index c345ff9..68e8231 100644
--- a/WebCore/storage/IDBDatabaseError.h
+++ b/WebCore/storage/IDBDatabaseError.h
@@ -26,6 +26,7 @@
 #ifndef IDBDatabaseError_h
 #define IDBDatabaseError_h
 
+#include "IDBDatabaseException.h"
 #include "PlatformString.h"
 #include <wtf/PassRefPtr.h>
 #include <wtf/RefCounted.h>
@@ -42,7 +43,7 @@ public:
     }
     ~IDBDatabaseError() { }
 
-    unsigned short code() const { return m_code; }
+    unsigned short code() const { return m_code - IDBDatabaseException::IDBDatabaseExceptionOffset; }
     void setCode(unsigned short value) { m_code = value; }
     const String& message() const { return m_message; }
     void setMessage(const String& value) { m_message = value; }
diff --git a/WebCore/storage/IDBDatabaseException.h b/WebCore/storage/IDBDatabaseException.h
index 945773c..936b05a 100644
--- a/WebCore/storage/IDBDatabaseException.h
+++ b/WebCore/storage/IDBDatabaseException.h
@@ -26,46 +26,48 @@
 #ifndef IDBDatabaseException_h
 #define IDBDatabaseException_h
 
-#include "PlatformString.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-
 #if ENABLE(INDEXED_DATABASE)
 
+#include "ExceptionBase.h"
+
 namespace WebCore {
 
-class IDBDatabaseException : public RefCounted<IDBDatabaseException> {
+class IDBDatabaseException : public ExceptionBase {
 public:
-    static PassRefPtr<IDBDatabaseException> create()
+    static PassRefPtr<IDBDatabaseException> create(const ExceptionCodeDescription& description)
     {
-        return adoptRef(new IDBDatabaseException());
+        return adoptRef(new IDBDatabaseException(description));
     }
-    ~IDBDatabaseException() { }
 
-    enum ErrorCode {
-        UNKNOWN_ERR = 1,
-        NON_TRANSIENT_ERR = 1,
-        NOT_FOUND_ERR = 2,
-        CONSTRAINT_ERR = 3,
-        DATA_ERR = 4,
-        NOT_ALLOWED_ERR = 5,
-        SERIAL_ERR = 11,
-        RECOVERABLE_ERR = 21,
-        TRANSIENT_ERR = 31,
-        TIMEOUT_ERR = 32,
-        DEADLOCK_ERR = 33
+    static const int IDBDatabaseExceptionOffset = 1200;
+    static const int IDBDatabaseExceptionMax = 1299;
+
+    enum IDBDatabaseExceptionCode {
+        UNKNOWN_ERR = IDBDatabaseExceptionOffset + 1,
+        NON_TRANSIENT_ERR = IDBDatabaseExceptionOffset + 2,
+        NOT_FOUND_ERR = IDBDatabaseExceptionOffset + 3,
+        CONSTRAINT_ERR = IDBDatabaseExceptionOffset + 4,
+        DATA_ERR = IDBDatabaseExceptionOffset + 5,
+        NOT_ALLOWED_ERR = IDBDatabaseExceptionOffset + 6,
+        SERIAL_ERR = IDBDatabaseExceptionOffset + 7,
+        RECOVERABLE_ERR = IDBDatabaseExceptionOffset + 8,
+        TRANSIENT_ERR = IDBDatabaseExceptionOffset + 9,
+        TIMEOUT_ERR = IDBDatabaseExceptionOffset + 10,
+        DEADLOCK_ERR = IDBDatabaseExceptionOffset + 11
     };
-   
-    unsigned short code() const { return m_code; }
-    void setCode(unsigned short value) { m_code = value; }
-    String message() const { return m_message; }
-    void setMessage(const String& value) { m_message = value; }
 
-private:
-    IDBDatabaseException() { }
+    static int ErrorCodeToExceptionCode(int errorCode)
+    {
+        if (!errorCode)
+            return 0;
+        return errorCode + IDBDatabaseExceptionOffset;
+    }
 
-    unsigned short m_code;
-    String m_message;
+private:
+    IDBDatabaseException(const ExceptionCodeDescription& description)
+        : ExceptionBase(description)
+    {
+    }
 };
 
 } // namespace WebCore
diff --git a/WebCore/storage/IDBDatabaseException.idl b/WebCore/storage/IDBDatabaseException.idl
index 1f15fc0..a56f4c7 100644
--- a/WebCore/storage/IDBDatabaseException.idl
+++ b/WebCore/storage/IDBDatabaseException.idl
@@ -26,23 +26,30 @@
 module storage {
 
     interface [
-        Conditional=INDEXED_DATABASE
+        Conditional=INDEXED_DATABASE,
+        DontCheckEnums
     ] IDBDatabaseException {
-        // FIXME: These error codes conflict with others.
-        const unsigned short UNKNOWN_ERR = 1;
-        const unsigned short NON_TRANSIENT_ERR = 1;
-        const unsigned short NOT_FOUND_ERR = 2;
-        const unsigned short CONSTRAINT_ERR = 3;
-        const unsigned short DATA_ERR = 4;
-        const unsigned short NOT_ALLOWED_ERR = 5;
-        const unsigned short SERIAL_ERR = 11;
-        const unsigned short RECOVERABLE_ERR = 21;
-        const unsigned short TRANSIENT_ERR = 31;
-        const unsigned short TIMEOUT_ERR = 32;
-        const unsigned short DEADLOCK_ERR = 33;
 
-        attribute unsigned short code;
-        attribute DOMString message;
+        readonly attribute unsigned short   code;
+        readonly attribute DOMString        name;
+        readonly attribute DOMString        message;
+
+#if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT
+        // Override in a Mozilla compatible format
+        [DontEnum] DOMString toString();
+#endif
+
+        const unsigned short UNKNOWN_ERR = 1;
+        const unsigned short NON_TRANSIENT_ERR = 2;
+        const unsigned short NOT_FOUND_ERR = 3;
+        const unsigned short CONSTRAINT_ERR = 4;
+        const unsigned short DATA_ERR = 5;
+        const unsigned short NOT_ALLOWED_ERR = 6;
+        const unsigned short SERIAL_ERR = 7;
+        const unsigned short RECOVERABLE_ERR = 8;
+        const unsigned short TRANSIENT_ERR = 9;
+        const unsigned short TIMEOUT_ERR = 10;
+        const unsigned short DEADLOCK_ERR = 11;
     };
 
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list