Changeset 73605 in webkit
- Timestamp:
- Dec 9, 2010 4:29:55 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 13 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r73601 r73605 1 2010-12-07 Jeremy Orlow <jorlow@chromium.org> 2 3 Reviewed by Steve Block. 4 5 IndexedDB returns the wrong exceptions 6 https://bugs.webkit.org/show_bug.cgi?id=50632 7 8 * storage/indexeddb/constants-expected.txt: 9 * storage/indexeddb/constants.html: 10 * storage/indexeddb/objectstore-removeobjectstore-expected.txt: 11 * storage/indexeddb/objectstore-removeobjectstore.html: 12 1 13 2010-12-09 Pavel Feldman <pfeldman@chromium.org> 2 14 -
trunk/LayoutTests/storage/indexeddb/constants-expected.txt
r72767 r73605 5 5 6 6 PASS webkitIDBDatabaseException.UNKNOWN_ERR is 1 7 PASS webkitIDBDatabaseException.NON_TRANSIENT_ERR is 18 PASS webkitIDBDatabaseException.NOT_FOUND_ERR is 29 PASS webkitIDBDatabaseException.CONSTRAINT_ERR is 310 PASS webkitIDBDatabaseException.DATA_ERR is 411 PASS webkitIDBDatabaseException.NOT_ALLOWED_ERR is 512 PASS webkitIDBDatabaseException.SERIAL_ERR is 1113 PASS webkitIDBDatabaseException.RECOVERABLE_ERR is 2114 PASS webkitIDBDatabaseException.TRANSIENT_ERR is 3115 PASS webkitIDBDatabaseException.TIMEOUT_ERR is 3216 PASS webkitIDBDatabaseException.DEADLOCK_ERR is 337 PASS webkitIDBDatabaseException.NON_TRANSIENT_ERR is 2 8 PASS webkitIDBDatabaseException.NOT_FOUND_ERR is 3 9 PASS webkitIDBDatabaseException.CONSTRAINT_ERR is 4 10 PASS webkitIDBDatabaseException.DATA_ERR is 5 11 PASS webkitIDBDatabaseException.NOT_ALLOWED_ERR is 6 12 PASS webkitIDBDatabaseException.SERIAL_ERR is 7 13 PASS webkitIDBDatabaseException.RECOVERABLE_ERR is 8 14 PASS webkitIDBDatabaseException.TRANSIENT_ERR is 9 15 PASS webkitIDBDatabaseException.TIMEOUT_ERR is 10 16 PASS webkitIDBDatabaseException.DEADLOCK_ERR is 11 17 17 PASS webkitIDBRequest.LOADING is 1 18 18 PASS webkitIDBRequest.DONE is 2 -
trunk/LayoutTests/storage/indexeddb/constants.html
r72767 r73605 18 18 { 19 19 shouldBe("webkitIDBDatabaseException.UNKNOWN_ERR", "1"); 20 shouldBe("webkitIDBDatabaseException.NON_TRANSIENT_ERR", " 1");21 shouldBe("webkitIDBDatabaseException.NOT_FOUND_ERR", " 2");22 shouldBe("webkitIDBDatabaseException.CONSTRAINT_ERR", " 3");23 shouldBe("webkitIDBDatabaseException.DATA_ERR", " 4");24 shouldBe("webkitIDBDatabaseException.NOT_ALLOWED_ERR", " 5");25 shouldBe("webkitIDBDatabaseException.SERIAL_ERR", " 11");26 shouldBe("webkitIDBDatabaseException.RECOVERABLE_ERR", " 21");27 shouldBe("webkitIDBDatabaseException.TRANSIENT_ERR", " 31");28 shouldBe("webkitIDBDatabaseException.TIMEOUT_ERR", " 32");29 shouldBe("webkitIDBDatabaseException.DEADLOCK_ERR", " 33");20 shouldBe("webkitIDBDatabaseException.NON_TRANSIENT_ERR", "2"); 21 shouldBe("webkitIDBDatabaseException.NOT_FOUND_ERR", "3"); 22 shouldBe("webkitIDBDatabaseException.CONSTRAINT_ERR", "4"); 23 shouldBe("webkitIDBDatabaseException.DATA_ERR", "5"); 24 shouldBe("webkitIDBDatabaseException.NOT_ALLOWED_ERR", "6"); 25 shouldBe("webkitIDBDatabaseException.SERIAL_ERR", "7"); 26 shouldBe("webkitIDBDatabaseException.RECOVERABLE_ERR", "8"); 27 shouldBe("webkitIDBDatabaseException.TRANSIENT_ERR", "9"); 28 shouldBe("webkitIDBDatabaseException.TIMEOUT_ERR", "10"); 29 shouldBe("webkitIDBDatabaseException.DEADLOCK_ERR", "11"); 30 30 31 31 shouldBe("webkitIDBRequest.LOADING", "1"); -
trunk/LayoutTests/storage/indexeddb/objectstore-removeobjectstore-expected.txt
r72771 r73605 122 122 PASS event.target.readyState is event.target.DONE 123 123 124 PASS event.code is 2124 PASS event.code is webkitIDBDatabaseException.NOT_FOUND_ERR 125 125 PASS event.source.indexNames.contains('indexName') is false 126 126 PASS successfullyParsed is true -
trunk/LayoutTests/storage/indexeddb/objectstore-removeobjectstore.html
r72771 r73605 113 113 { 114 114 verifyErrorEvent(event); 115 shouldBe("event.code", " 2");115 shouldBe("event.code", "webkitIDBDatabaseException.NOT_FOUND_ERR"); 116 116 shouldBeFalse("event.source.indexNames.contains('indexName')"); 117 117 -
trunk/WebCore/ChangeLog
r73603 r73605 1 2010-12-07 Jeremy Orlow <jorlow@chromium.org> 2 3 Reviewed by Steve Block. 4 5 IndexedDB returns the wrong exceptions 6 https://bugs.webkit.org/show_bug.cgi?id=50632 7 8 IndexedDB exceptions need to have an offset so they can 9 be distinguished from DOM exceptions. We also need to 10 add strings for the various exceptions. Lastly, make 11 IDBDatabaseException use the common exception base class. 12 13 * bindings/js/JSDOMBinding.cpp: 14 (WebCore::setDOMException): 15 * bindings/v8/V8Proxy.cpp: 16 (WebCore::V8Proxy::setDOMException): 17 * dom/ExceptionCode.cpp: 18 (WebCore::getExceptionCodeDescription): 19 * dom/ExceptionCode.h: 20 * storage/IDBDatabaseError.h: 21 (WebCore::IDBDatabaseError::code): 22 * storage/IDBDatabaseException.h: 23 (WebCore::IDBDatabaseException::create): 24 (WebCore::IDBDatabaseException::ErrorCodeToExceptionCode): 25 (WebCore::IDBDatabaseException::IDBDatabaseException): 26 * storage/IDBDatabaseException.idl: 27 1 28 2010-12-09 Gustavo Noronha Silva <gustavo.noronha@collabora.co.uk> 2 29 -
trunk/WebCore/bindings/js/JSDOMBinding.cpp
r73532 r73605 85 85 #include "FileException.h" 86 86 #include "JSFileException.h" 87 #endif 88 89 #if ENABLE(INDEXED_DATABASE) 90 #include "IDBDatabaseException.h" 91 #include "JSIDBDatabaseException.h" 87 92 #endif 88 93 … … 651 656 break; 652 657 #endif 658 #if ENABLE(INDEXED_DATABASE) 659 case IDBDatabaseExceptionType: 660 errorObject = toJS(exec, globalObject, IDBDatabaseException::create(description)); 661 break; 662 #endif 653 663 } 654 664 -
trunk/WebCore/bindings/v8/V8Proxy.cpp
r72387 r73605 38 38 #include "Frame.h" 39 39 #include "FrameLoaderClient.h" 40 #include "IDBDatabaseException.h" 40 41 #include "IDBFactoryBackendInterface.h" 41 42 #include "IDBPendingTransactionMonitor.h" … … 65 66 #include "WorkerContextExecutionProxy.h" 66 67 68 #if ENABLE(INDEXED_DATABASE) 69 #include "V8IDBDatabaseException.h" 70 #endif 71 67 72 #if ENABLE(SVG) 68 73 #include "V8SVGException.h" … … 674 679 break; 675 680 #endif 681 #if ENABLE(INDEXED_DATABASE) 682 case IDBDatabaseExceptionType: 683 exception = toV8(IDBDatabaseException::create(description)); 684 break; 685 #endif 676 686 default: 677 687 ASSERT_NOT_REACHED(); -
trunk/WebCore/dom/ExceptionCode.cpp
r72500 r73605 28 28 29 29 #include "EventException.h" 30 #include "IDBDatabaseException.h" 30 31 #include "RangeException.h" 31 32 #include "XMLHttpRequestException.h" … … 207 208 "The path supplied exists, but was not an entry of requested type.", 208 209 "An attempt was made to create a file or directory where an element already exists." 210 }; 211 #endif 212 213 #if ENABLE(INDEXED_DATABASE) 214 static const char* const idbDatabaseExceptionNames[] = { 215 "UNKNOWN_ERR", 216 "NON_TRANSIENT_ERR", 217 "NOT_FOUND_ERR", 218 "CONSTRAINT_ERR", 219 "DATA_ERR", 220 "NOT_ALLOWED_ERR", 221 "SERIAL_ERR", 222 "RECOVERABLE_ERR", 223 "TRANSIENT_ERR", 224 "TIMEOUT_ERR", 225 "DEADLOCK_ERR" 226 }; 227 228 static const char* const idbDatabaseExceptionDescriptions[] = { 229 "An unknown error occurred within Indexed Database.", 230 "NON_TRANSIENT_ERR", // FIXME: Write a better message if it's ever possible this is thrown. 231 "The name supplied does not match any existing item.", 232 "The request cannot be completed due to a failed constraint.", 233 "The data provided does not meet the requirements of the function.", 234 "This function is not allowed to be called in such a context.", 235 "The data supplied cannot be serialized according to the structured cloning algorithm.", 236 "RECOVERABLE_ERR", // FIXME: This isn't even used. 237 "TRANSIENT_ERR", // FIXME: This isn't even used. 238 "TIMEOUT_ERR", // This can't be thrown. 239 "DEADLOCK_ERR" // This can't be thrown. 209 240 }; 210 241 #endif … … 288 319 nameTableOffset = FileException::NOT_FOUND_ERR; 289 320 #endif 321 #if ENABLE(INDEXED_DATABASE) 322 } else if (code >= IDBDatabaseException::IDBDatabaseExceptionOffset && code <= IDBDatabaseException::IDBDatabaseExceptionMax) { 323 type = IDBDatabaseExceptionType; 324 typeName = "DOM IDBDatabase"; 325 code -= IDBDatabaseException::IDBDatabaseExceptionOffset; 326 nameTable = idbDatabaseExceptionNames; 327 descriptionTable = idbDatabaseExceptionDescriptions; 328 nameTableSize = WTF_ARRAY_LENGTH(idbDatabaseExceptionNames); 329 nameTableOffset = IDBDatabaseException::UNKNOWN_ERR; 330 #endif 290 331 } else { 291 332 type = DOMExceptionType; -
trunk/WebCore/dom/ExceptionCode.h
r70438 r73605 85 85 , FileExceptionType 86 86 #endif 87 #if ENABLE(INDEXED_DATABASE) 88 , IDBDatabaseExceptionType 89 #endif 87 90 }; 88 91 -
trunk/WebCore/storage/IDBDatabaseError.h
r60357 r73605 27 27 #define IDBDatabaseError_h 28 28 29 #include "IDBDatabaseException.h" 29 30 #include "PlatformString.h" 30 31 #include <wtf/PassRefPtr.h> … … 43 44 ~IDBDatabaseError() { } 44 45 45 unsigned short code() const { return m_code ; }46 unsigned short code() const { return m_code - IDBDatabaseException::IDBDatabaseExceptionOffset; } 46 47 void setCode(unsigned short value) { m_code = value; } 47 48 const String& message() const { return m_message; } -
trunk/WebCore/storage/IDBDatabaseException.h
r70531 r73605 27 27 #define IDBDatabaseException_h 28 28 29 #include "PlatformString.h" 30 #include <wtf/PassRefPtr.h> 31 #include <wtf/RefCounted.h> 29 #if ENABLE(INDEXED_DATABASE) 32 30 33 #i f ENABLE(INDEXED_DATABASE)31 #include "ExceptionBase.h" 34 32 35 33 namespace WebCore { 36 34 37 class IDBDatabaseException : public RefCounted<IDBDatabaseException>{35 class IDBDatabaseException : public ExceptionBase { 38 36 public: 39 static PassRefPtr<IDBDatabaseException> create( )37 static PassRefPtr<IDBDatabaseException> create(const ExceptionCodeDescription& description) 40 38 { 41 return adoptRef(new IDBDatabaseException( ));39 return adoptRef(new IDBDatabaseException(description)); 42 40 } 43 ~IDBDatabaseException() { }44 41 45 enum ErrorCode { 46 UNKNOWN_ERR = 1, 47 NON_TRANSIENT_ERR = 1, 48 NOT_FOUND_ERR = 2, 49 CONSTRAINT_ERR = 3, 50 DATA_ERR = 4, 51 NOT_ALLOWED_ERR = 5, 52 SERIAL_ERR = 11, 53 RECOVERABLE_ERR = 21, 54 TRANSIENT_ERR = 31, 55 TIMEOUT_ERR = 32, 56 DEADLOCK_ERR = 33 42 static const int IDBDatabaseExceptionOffset = 1200; 43 static const int IDBDatabaseExceptionMax = 1299; 44 45 enum IDBDatabaseExceptionCode { 46 UNKNOWN_ERR = IDBDatabaseExceptionOffset + 1, 47 NON_TRANSIENT_ERR = IDBDatabaseExceptionOffset + 2, 48 NOT_FOUND_ERR = IDBDatabaseExceptionOffset + 3, 49 CONSTRAINT_ERR = IDBDatabaseExceptionOffset + 4, 50 DATA_ERR = IDBDatabaseExceptionOffset + 5, 51 NOT_ALLOWED_ERR = IDBDatabaseExceptionOffset + 6, 52 SERIAL_ERR = IDBDatabaseExceptionOffset + 7, 53 RECOVERABLE_ERR = IDBDatabaseExceptionOffset + 8, 54 TRANSIENT_ERR = IDBDatabaseExceptionOffset + 9, 55 TIMEOUT_ERR = IDBDatabaseExceptionOffset + 10, 56 DEADLOCK_ERR = IDBDatabaseExceptionOffset + 11 57 57 }; 58 59 unsigned short code() const { return m_code; } 60 void setCode(unsigned short value) { m_code = value; } 61 String message() const { return m_message; } 62 void setMessage(const String& value) { m_message = value; } 58 59 static int ErrorCodeToExceptionCode(int errorCode) 60 { 61 if (!errorCode) 62 return 0; 63 return errorCode + IDBDatabaseExceptionOffset; 64 } 63 65 64 66 private: 65 IDBDatabaseException( ) { }66 67 unsigned short m_code;68 String m_message;67 IDBDatabaseException(const ExceptionCodeDescription& description) 68 : ExceptionBase(description) 69 { 70 } 69 71 }; 70 72 -
trunk/WebCore/storage/IDBDatabaseException.idl
r70531 r73605 27 27 28 28 interface [ 29 Conditional=INDEXED_DATABASE 29 Conditional=INDEXED_DATABASE, 30 DontCheckEnums 30 31 ] IDBDatabaseException { 31 // FIXME: These error codes conflict with others. 32 33 readonly attribute unsigned short code; 34 readonly attribute DOMString name; 35 readonly attribute DOMString message; 36 37 #if defined(LANGUAGE_JAVASCRIPT) && LANGUAGE_JAVASCRIPT 38 // Override in a Mozilla compatible format 39 [DontEnum] DOMString toString(); 40 #endif 41 32 42 const unsigned short UNKNOWN_ERR = 1; 33 const unsigned short NON_TRANSIENT_ERR = 1; 34 const unsigned short NOT_FOUND_ERR = 2; 35 const unsigned short CONSTRAINT_ERR = 3; 36 const unsigned short DATA_ERR = 4; 37 const unsigned short NOT_ALLOWED_ERR = 5; 38 const unsigned short SERIAL_ERR = 11; 39 const unsigned short RECOVERABLE_ERR = 21; 40 const unsigned short TRANSIENT_ERR = 31; 41 const unsigned short TIMEOUT_ERR = 32; 42 const unsigned short DEADLOCK_ERR = 33; 43 44 attribute unsigned short code; 45 attribute DOMString message; 43 const unsigned short NON_TRANSIENT_ERR = 2; 44 const unsigned short NOT_FOUND_ERR = 3; 45 const unsigned short CONSTRAINT_ERR = 4; 46 const unsigned short DATA_ERR = 5; 47 const unsigned short NOT_ALLOWED_ERR = 6; 48 const unsigned short SERIAL_ERR = 7; 49 const unsigned short RECOVERABLE_ERR = 8; 50 const unsigned short TRANSIENT_ERR = 9; 51 const unsigned short TIMEOUT_ERR = 10; 52 const unsigned short DEADLOCK_ERR = 11; 46 53 }; 47 54
Note: See TracChangeset
for help on using the changeset viewer.