2010-05-14 Jeremy Orlow <jorlow@chromium.org>
Reviewed by Nate Chapin.
Finish up IndexedDB events
https://bugs.webkit.org/show_bug.cgi?id=39117
Add the beginnings of a test for IndexedDB. It currently fails, but we'll
update this (and/or add other tests) as things start passing.
Disable it on all !Chromium platforms since none of them compile it
in. (Note that Chromium keeps it behind a runtime flag at the moment,
despite compiling it in...so don't worry.)
This also makes evalAndLog return the result of the evaluation. I think
this was just an oversight when I originally added it, and it's going to
come in useful for these tests.
* fast/js/resources/js-test-pre.js:
(evalAndLog):
* platform/gtk/Skipped:
* platform/mac-leopard/Skipped:
* platform/mac-snowleopard/Skipped:
* platform/mac-tiger/Skipped:
* platform/mac/Skipped:
* platform/qt/Skipped:
* platform/win/Skipped:
* storage/indexeddb/basics-expected.txt: Added.
* storage/indexeddb/basics.html: Added.
* storage/indexeddb/script-tests/TEMPLATE.html: Copied from LayoutTests/storage/domstorage/script-tests/TEMPLATE.html.
* storage/indexeddb/script-tests/basics.js: Added.
(eventShared):
(successFunction):
(errorFunction):
(test):
2010-05-14 Jeremy Orlow <jorlow@chromium.org>
Reviewed by Nate Chapin.
Finish up IndexedDB events
https://bugs.webkit.org/show_bug.cgi?id=39117
Implement the indexed database event interfaces as proposed by Mozilla.
Refactor the run time type detection code that was in IDBRequest into its own
class named IDBAny. Use this new class within the new event classes and
IDBResults.
Test: storage/indexeddb/basics.html
* DerivedSources.cpp:
* DerivedSources.make:
* GNUmakefile.am:
* WebCore.gyp/WebCore.gyp:
* WebCore.gypi:
* WebCore.pri:
* WebCore.pro:
* WebCore.vcproj/WebCore.vcproj:
* WebCore.xcodeproj/project.pbxproj:
* bindings/js/JSEventCustom.cpp:
(WebCore::toJS):
* bindings/js/JSEventTarget.cpp:
(WebCore::toJS):
* bindings/js/JSIDBAnyCustom.cpp: Added.
(WebCore::toJS):
* bindings/js/JSIDBRequestCustom.cpp: Removed.
* bindings/v8/custom/V8EventCustom.cpp:
(WebCore::toV8):
* bindings/v8/custom/V8IDBAnyCustom.cpp: Added.
(WebCore::toV8):
* bindings/v8/custom/V8IDBRequestCustom.cpp: Removed.
* dom/Event.cpp:
(WebCore::Event::isIDBErrorEvent):
(WebCore::Event::isIDBSuccessEvent):
* dom/Event.h:
* storage/IDBAny.cpp: Added.
(WebCore::IDBAny::create):
(WebCore::IDBAny::IDBAny):
(WebCore::IDBAny::~IDBAny):
(WebCore::IDBAny::idbDatabaseRequest):
(WebCore::IDBAny::indexedDatabaseRequest):
(WebCore::IDBAny::serializedScriptValue):
(WebCore::IDBAny::set):
* storage/IDBAny.h: Added.
(WebCore::IDBAny::):
(WebCore::IDBAny::type):
* storage/IDBAny.idl: Added.
* storage/IDBErrorEvent.cpp: Added.
(WebCore::IDBErrorEvent::create):
(WebCore::IDBErrorEvent::IDBErrorEvent):
(WebCore::IDBErrorEvent::~IDBErrorEvent):
* storage/IDBErrorEvent.h: Added.
(WebCore::IDBErrorEvent::code):
(WebCore::IDBErrorEvent::message):
(WebCore::IDBErrorEvent::isIDBErrorEvent):
* storage/IDBErrorEvent.idl: Added.
* storage/IDBEvent.cpp: Added.
(WebCore::IDBEvent::IDBEvent):
(WebCore::IDBEvent::~IDBEvent):
(WebCore::IDBEvent::source):
* storage/IDBEvent.h: Added.
* storage/IDBEvent.idl: Added.
* storage/IDBRequest.cpp:
(WebCore::IDBRequest::IDBRequest):
(WebCore::IDBRequest::onSuccess):
(WebCore::IDBRequest::timerFired):
(WebCore::IDBRequest::onEventCommon):
* storage/IDBRequest.h:
(WebCore::IDBRequest::create):
(WebCore::IDBRequest::result):
* storage/IDBRequest.idl:
* storage/IDBSuccessEvent.cpp: Added.
(WebCore::IDBSuccessEvent::create):
(WebCore::IDBSuccessEvent::IDBSuccessEvent):
(WebCore::IDBSuccessEvent::~IDBSuccessEvent):
(WebCore::IDBSuccessEvent::result):
* storage/IDBSuccessEvent.h: Added.
(WebCore::IDBSuccessEvent::isIDBSuccessEvent):
* storage/IDBSuccessEvent.idl: Added.
* storage/IndexedDatabaseImpl.cpp:
(WebCore::IndexedDatabaseImpl::open):
* storage/IndexedDatabaseRequest.cpp:
(WebCore::IndexedDatabaseRequest::IndexedDatabaseRequest):
(WebCore::IndexedDatabaseRequest::open):
* storage/IndexedDatabaseRequest.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@59602 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index a3f2547..a89c548 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,39 @@
+2010-05-14 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ Finish up IndexedDB events
+ https://bugs.webkit.org/show_bug.cgi?id=39117
+
+ Add the beginnings of a test for IndexedDB. It currently fails, but we'll
+ update this (and/or add other tests) as things start passing.
+
+ Disable it on all !Chromium platforms since none of them compile it
+ in. (Note that Chromium keeps it behind a runtime flag at the moment,
+ despite compiling it in...so don't worry.)
+
+ This also makes evalAndLog return the result of the evaluation. I think
+ this was just an oversight when I originally added it, and it's going to
+ come in useful for these tests.
+
+ * fast/js/resources/js-test-pre.js:
+ (evalAndLog):
+ * platform/gtk/Skipped:
+ * platform/mac-leopard/Skipped:
+ * platform/mac-snowleopard/Skipped:
+ * platform/mac-tiger/Skipped:
+ * platform/mac/Skipped:
+ * platform/qt/Skipped:
+ * platform/win/Skipped:
+ * storage/indexeddb/basics-expected.txt: Added.
+ * storage/indexeddb/basics.html: Added.
+ * storage/indexeddb/script-tests/TEMPLATE.html: Copied from LayoutTests/storage/domstorage/script-tests/TEMPLATE.html.
+ * storage/indexeddb/script-tests/basics.js: Added.
+ (eventShared):
+ (successFunction):
+ (errorFunction):
+ (test):
+
2010-05-17 Yury Semikhatsky <yurys@chromium.org>
Unreviewed. Update Chromium test expectations.
diff --git a/LayoutTests/fast/js/resources/js-test-pre.js b/LayoutTests/fast/js/resources/js-test-pre.js
index ecf5fd0..6647798 100644
--- a/LayoutTests/fast/js/resources/js-test-pre.js
+++ b/LayoutTests/fast/js/resources/js-test-pre.js
@@ -90,6 +90,7 @@
} catch (e) {
testFailed(_a + " threw exception " + e);
}
+ return _av;
}
function shouldBe(_a, _b)
diff --git a/LayoutTests/platform/gtk/Skipped b/LayoutTests/platform/gtk/Skipped
index 026e7b9..47f4b54 100644
--- a/LayoutTests/platform/gtk/Skipped
+++ b/LayoutTests/platform/gtk/Skipped
@@ -5923,3 +5923,6 @@
# Need to dump context menu items on eventSender.contextClick(true).
# https://bugs.webkit.org/show_bug.cgi?id=39102
editing/spelling/context-menu-suggestions.html
+
+# IndexedDB is not yet enabled.
+storage/indexeddb
diff --git a/LayoutTests/platform/mac-leopard/Skipped b/LayoutTests/platform/mac-leopard/Skipped
index 205eb44..bb404c0 100644
--- a/LayoutTests/platform/mac-leopard/Skipped
+++ b/LayoutTests/platform/mac-leopard/Skipped
@@ -67,3 +67,6 @@
# https://bugs.webkit.org/show_bug.cgi?id=38000 - r58107 causes video-play-stall and video-play-stall-seek to fail
http/tests/media/video-play-stall.html
http/tests/media/video-play-stall-seek.html
+
+# IndexedDB is not yet enabled.
+storage/indexeddb
diff --git a/LayoutTests/platform/mac-snowleopard/Skipped b/LayoutTests/platform/mac-snowleopard/Skipped
index 19214cc..4137617 100644
--- a/LayoutTests/platform/mac-snowleopard/Skipped
+++ b/LayoutTests/platform/mac-snowleopard/Skipped
@@ -130,3 +130,6 @@
# Test fails on Snow Leopard in DRT but passes when run manually and passes on Leopard. The test itself might need
# tweaking to deal with scrolling differences between Leopard and SL. https://bugs.webkit.org/show_bug.cgi?id=38416
fast/repaint/fixed-move-after-keyboard-scroll.html
+
+# IndexedDB is not yet enabled.
+storage/indexeddb
diff --git a/LayoutTests/platform/mac-tiger/Skipped b/LayoutTests/platform/mac-tiger/Skipped
index b9f19e7..f7e2dfe 100644
--- a/LayoutTests/platform/mac-tiger/Skipped
+++ b/LayoutTests/platform/mac-tiger/Skipped
@@ -177,3 +177,6 @@
# Python 2.5 is required to run websocket tests
websocket/tests
+
+# IndexedDB is not yet enabled.
+storage/indexeddb
diff --git a/LayoutTests/platform/mac/Skipped b/LayoutTests/platform/mac/Skipped
index 7e70007..c42068d 100644
--- a/LayoutTests/platform/mac/Skipped
+++ b/LayoutTests/platform/mac/Skipped
@@ -185,3 +185,6 @@
# EventSendingController does not send events on areas outside the WebView.
scrollbars/scrollbar-click-does-not-blur-content.html
+
+# IndexedDB is not yet enabled.
+storage/indexeddb
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index ef685dc..0884388 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -5094,3 +5094,6 @@
# Need to dump context menu items on eventSender.contextClick(true).
# https://bugs.webkit.org/show_bug.cgi?id=39103
editing/spelling/context-menu-suggestions.html
+
+# IndexedDB is not yet enabled.
+storage/indexeddb
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index 7251aac..bdd44d6 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -880,3 +880,6 @@
# Need to dump context menu items on eventSender.contextClick(true). TODO: add bug number
# https://bugs.webkit.org/show_bug.cgi?id=39104
editing/spelling/context-menu-suggestions.html
+
+# IndexedDB is not yet enabled.
+storage/indexeddb
diff --git a/LayoutTests/storage/indexeddb/basics-expected.txt b/LayoutTests/storage/indexeddb/basics-expected.txt
new file mode 100644
index 0000000..8a11f6c
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/basics-expected.txt
@@ -0,0 +1,34 @@
+Test the basics of IndexedDB.
+
+On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE".
+
+
+PASS 'indexedDB' in window is true
+PASS 'open' in indexedDB is true
+indexedDB.open('name', 'description', true /* allow modification */)
+PASS 'onsuccess' in result is true
+PASS 'onerror' in result is true
+PASS 'abort' in result is true
+PASS 'readyState' in result is true
+
+An event should fire shortly...
+
+FAIL Error function called: (0) Not implemented
+
+PASS 'source' in event is true
+PASS 'open' in event.source is true
+
+FAIL 'result' in event should be true. Was false.
+FAIL 'code' in event should be false. Was true.
+FAIL 'message' in event should be false. Was true.
+
+PASS 'onsuccess' in event.target is true
+PASS 'onerror' in event.target is true
+PASS 'abort' in event.target is true
+PASS 'readyState' in event.target is true
+PASS event.target.readyState is event.target.DONE
+
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
diff --git a/LayoutTests/storage/indexeddb/basics.html b/LayoutTests/storage/indexeddb/basics.html
new file mode 100644
index 0000000..cca9674
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/basics.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="script-tests/basics.js"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/script-tests/TEMPLATE.html b/LayoutTests/storage/indexeddb/script-tests/TEMPLATE.html
new file mode 100644
index 0000000..239a794
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/script-tests/TEMPLATE.html
@@ -0,0 +1,12 @@
+<html>
+<head>
+<link rel="stylesheet" href="../../fast/js/resources/js-test-style.css">
+<script src="../../fast/js/resources/js-test-pre.js"></script>
+<script src="../../fast/js/resources/js-test-post-function.js"></script>
+</head>
+<body>
+<p id="description"></p>
+<div id="console"></div>
+<script src="YOUR_JS_FILE_HERE"></script>
+</body>
+</html>
diff --git a/LayoutTests/storage/indexeddb/script-tests/basics.js b/LayoutTests/storage/indexeddb/script-tests/basics.js
new file mode 100644
index 0000000..307196a
--- /dev/null
+++ b/LayoutTests/storage/indexeddb/script-tests/basics.js
@@ -0,0 +1,61 @@
+description("Test the basics of IndexedDB.");
+
+if (window.layoutTestController) {
+ layoutTestController.dumpAsText();
+ layoutTestController.waitUntilDone();
+}
+
+
+function eventShared()
+{
+ debug("");
+ shouldBeTrue("'source' in event");
+ shouldBeTrue("'open' in event.source");
+ debug("");
+ shouldBeTrue("'result' in event");
+ shouldBeFalse("'code' in event");
+ shouldBeFalse("'message' in event");
+ debug("");
+ shouldBeTrue("'onsuccess' in event.target");
+ shouldBeTrue("'onerror' in event.target");
+ shouldBeTrue("'abort' in event.target");
+ shouldBeTrue("'readyState' in event.target");
+ shouldBe("event.target.readyState", "event.target.DONE");
+ debug("");
+ window.successfullyParsed = true;
+ isSuccessfullyParsed();
+ if (window.layoutTestController)
+ layoutTestController.notifyDone()
+}
+
+function successFunction()
+{
+ debug("Success function called");
+ eventShared();
+}
+
+function errorFunction()
+{
+ testFailed("Error function called: (" + event.code + ") " + event.message);
+ eventShared();
+}
+
+function test()
+{
+ shouldBeTrue("'indexedDB' in window");
+ shouldBeTrue("'open' in indexedDB");
+
+ result = evalAndLog("indexedDB.open('name', 'description', true /* allow modification */)");
+ shouldBeTrue("'onsuccess' in result");
+ shouldBeTrue("'onerror' in result");
+ shouldBeTrue("'abort' in result");
+ shouldBeTrue("'readyState' in result");
+ result.onsuccess = successFunction;
+ result.onerror = errorFunction;
+ debug("");
+ debug("An event should fire shortly...");
+ debug("");
+}
+
+test();
+
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 2a175f2..4150181 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,93 @@
+2010-05-14 Jeremy Orlow <jorlow@chromium.org>
+
+ Reviewed by Nate Chapin.
+
+ Finish up IndexedDB events
+ https://bugs.webkit.org/show_bug.cgi?id=39117
+
+ Implement the indexed database event interfaces as proposed by Mozilla.
+ Refactor the run time type detection code that was in IDBRequest into its own
+ class named IDBAny. Use this new class within the new event classes and
+ IDBResults.
+
+ Test: storage/indexeddb/basics.html
+
+ * DerivedSources.cpp:
+ * DerivedSources.make:
+ * GNUmakefile.am:
+ * WebCore.gyp/WebCore.gyp:
+ * WebCore.gypi:
+ * WebCore.pri:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSEventCustom.cpp:
+ (WebCore::toJS):
+ * bindings/js/JSEventTarget.cpp:
+ (WebCore::toJS):
+ * bindings/js/JSIDBAnyCustom.cpp: Added.
+ (WebCore::toJS):
+ * bindings/js/JSIDBRequestCustom.cpp: Removed.
+ * bindings/v8/custom/V8EventCustom.cpp:
+ (WebCore::toV8):
+ * bindings/v8/custom/V8IDBAnyCustom.cpp: Added.
+ (WebCore::toV8):
+ * bindings/v8/custom/V8IDBRequestCustom.cpp: Removed.
+ * dom/Event.cpp:
+ (WebCore::Event::isIDBErrorEvent):
+ (WebCore::Event::isIDBSuccessEvent):
+ * dom/Event.h:
+ * storage/IDBAny.cpp: Added.
+ (WebCore::IDBAny::create):
+ (WebCore::IDBAny::IDBAny):
+ (WebCore::IDBAny::~IDBAny):
+ (WebCore::IDBAny::idbDatabaseRequest):
+ (WebCore::IDBAny::indexedDatabaseRequest):
+ (WebCore::IDBAny::serializedScriptValue):
+ (WebCore::IDBAny::set):
+ * storage/IDBAny.h: Added.
+ (WebCore::IDBAny::):
+ (WebCore::IDBAny::type):
+ * storage/IDBAny.idl: Added.
+ * storage/IDBErrorEvent.cpp: Added.
+ (WebCore::IDBErrorEvent::create):
+ (WebCore::IDBErrorEvent::IDBErrorEvent):
+ (WebCore::IDBErrorEvent::~IDBErrorEvent):
+ * storage/IDBErrorEvent.h: Added.
+ (WebCore::IDBErrorEvent::code):
+ (WebCore::IDBErrorEvent::message):
+ (WebCore::IDBErrorEvent::isIDBErrorEvent):
+ * storage/IDBErrorEvent.idl: Added.
+ * storage/IDBEvent.cpp: Added.
+ (WebCore::IDBEvent::IDBEvent):
+ (WebCore::IDBEvent::~IDBEvent):
+ (WebCore::IDBEvent::source):
+ * storage/IDBEvent.h: Added.
+ * storage/IDBEvent.idl: Added.
+ * storage/IDBRequest.cpp:
+ (WebCore::IDBRequest::IDBRequest):
+ (WebCore::IDBRequest::onSuccess):
+ (WebCore::IDBRequest::timerFired):
+ (WebCore::IDBRequest::onEventCommon):
+ * storage/IDBRequest.h:
+ (WebCore::IDBRequest::create):
+ (WebCore::IDBRequest::result):
+ * storage/IDBRequest.idl:
+ * storage/IDBSuccessEvent.cpp: Added.
+ (WebCore::IDBSuccessEvent::create):
+ (WebCore::IDBSuccessEvent::IDBSuccessEvent):
+ (WebCore::IDBSuccessEvent::~IDBSuccessEvent):
+ (WebCore::IDBSuccessEvent::result):
+ * storage/IDBSuccessEvent.h: Added.
+ (WebCore::IDBSuccessEvent::isIDBSuccessEvent):
+ * storage/IDBSuccessEvent.idl: Added.
+ * storage/IndexedDatabaseImpl.cpp:
+ (WebCore::IndexedDatabaseImpl::open):
+ * storage/IndexedDatabaseRequest.cpp:
+ (WebCore::IndexedDatabaseRequest::IndexedDatabaseRequest):
+ (WebCore::IndexedDatabaseRequest::open):
+ * storage/IndexedDatabaseRequest.h:
+
2010-05-16 Chris Jerdonek <cjerdonek@webkit.org>
Unreviewed.
diff --git a/WebCore/DerivedSources.cpp b/WebCore/DerivedSources.cpp
index a47007c..38f9e10 100644
--- a/WebCore/DerivedSources.cpp
+++ b/WebCore/DerivedSources.cpp
@@ -166,10 +166,14 @@
#include "JSHTMLTitleElement.cpp"
#include "JSHTMLUListElement.cpp"
#include "JSHTMLVideoElement.cpp"
+#include "JSIDBAny.cpp"
#include "JSIDBDatabaseError.cpp"
#include "JSIDBDatabaseException.cpp"
#include "JSIDBDatabaseRequest.cpp"
+#include "JSIDBErrorEvent.cpp"
+#include "JSIDBEvent.cpp"
#include "JSIDBRequest.cpp"
+#include "JSIDBSuccessEvent.cpp"
#include "JSImageData.cpp"
#include "JSIndexedDatabaseRequest.cpp"
#include "JSJavaScriptCallFrame.cpp"
diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make
index fe319fc..814db0b 100644
--- a/WebCore/DerivedSources.make
+++ b/WebCore/DerivedSources.make
@@ -209,10 +209,14 @@
HTMLUListElement \
HTMLVideoElement \
History \
+ IDBAny \
IDBDatabaseError \
IDBDatabaseException \
IDBDatabaseRequest \
+ IDBErrorEvent \
+ IDBEvent \
IDBRequest \
+ IDBSuccessEvent \
ImageData \
IndexedDatabaseRequest \
InjectedScriptHost \
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 973df43..dc03c52 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2436,10 +2436,14 @@
FEATURE_DEFINES += ENABLE_INDEXED_DATABASE=1
IDL_BINDINGS += \
+ WebCore/storage/IDBDAny.idl \
WebCore/storage/IDBDatabaseError.idl \
WebCore/storage/IDBDatabaseException.idl \
WebCore/storage/IDBDatabaseRequest.idl \
+ WebCore/storage/IDBErrorEvent.idl \
+ WebCore/storage/IDBEvent.idl \
WebCore/storage/IDBRequest.idl \
+ WebCore/storage/IDBSuccessEvent.idl \
WebCore/storage/IndexedDatabaseRequest.idl
webcore_cppflags += \
@@ -2447,6 +2451,8 @@
webcore_sources += \
WebCore/bindings/js/JSIDBRequestCustom.cpp \
+ WebCore/storage/IDBAny.cpp \
+ WebCore/storage/IDBAny.h \
WebCore/storage/IDBCallbacks.cpp \
WebCore/storage/IDBCallbacks.h \
WebCore/storage/IDBDatabase.cpp \
@@ -2455,8 +2461,14 @@
WebCore/storage/IDBDatabaseException.h \
WebCore/storage/IDBDatabaseRequest.cpp \
WebCore/storage/IDBDatabaseRequest.h \
+ WebCore/storage/IDBErrorEvent.cpp \
+ WebCore/storage/IDBErrorEvent.h \
+ WebCore/storage/IDBEvent.cpp \
+ WebCore/storage/IDBEvent.h \
WebCore/storage/IDBRequest.cpp \
WebCore/storage/IDBRequest.h \
+ WebCore/storage/IDBSuccessEvent.cpp \
+ WebCore/storage/IDBSuccessEvent.h \
WebCore/storage/IndexedDatabase.cpp \
WebCore/storage/IndexedDatabase.h \
WebCore/storage/IndexedDatabaseImpl.cpp \
diff --git a/WebCore/WebCore.gyp/WebCore.gyp b/WebCore/WebCore.gyp/WebCore.gyp
index adf6d94..7634765 100644
--- a/WebCore/WebCore.gyp/WebCore.gyp
+++ b/WebCore/WebCore.gyp/WebCore.gyp
@@ -577,6 +577,7 @@
'--include', '../notifications',
'--include', '../page',
'--include', '../plugins',
+ '--include', '../storage',
'--include', '../svg',
'--include', '../websockets',
'--include', '../workers',
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 8f944c5..91d7eda 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -219,13 +219,17 @@
'plugins/MimeTypeArray.idl',
'plugins/Plugin.idl',
'plugins/PluginArray.idl',
+ 'storage/IDBAny.idl',
'storage/Database.idl',
'storage/DatabaseCallback.idl',
'storage/DatabaseSync.idl',
'storage/IDBDatabaseError.idl',
'storage/IDBDatabaseException.idl',
'storage/IDBDatabaseRequest.idl',
+ 'storage/IDBErrorEvent.idl',
+ 'storage/IDBEvent.idl',
'storage/IDBRequest.idl',
+ 'storage/IDBSuccessEvent.idl',
'storage/IndexedDatabaseRequest.idl',
'storage/SQLError.idl',
'storage/SQLResultSet.idl',
@@ -754,7 +758,7 @@
'bindings/v8/custom/V8HTMLPlugInElementCustom.cpp',
'bindings/v8/custom/V8HTMLSelectElementCustom.cpp',
'bindings/v8/custom/V8HTMLSelectElementCustom.h',
- 'bindings/v8/custom/V8IDBRequestCustom.cpp',
+ 'bindings/v8/custom/V8IDBAnyCustom.cpp',
'bindings/v8/custom/V8InjectedScriptHostCustom.cpp',
'bindings/v8/custom/V8InspectorFrontendHostCustom.cpp',
'bindings/v8/custom/V8JavaScriptCallFrameCustom.cpp',
@@ -3327,6 +3331,8 @@
'storage/DatabaseTracker.cpp',
'storage/DatabaseTracker.h',
'storage/DatabaseTrackerClient.h',
+ 'storage/IDBAny.cpp',
+ 'storage/IDBAny.h',
'storage/IDBCallbacks.h',
'storage/IDBDatabase.h',
'storage/IDBDatabase.cpp',
@@ -3334,8 +3340,14 @@
'storage/IDBDatabaseException.h',
'storage/IDBDatabaseRequest.cpp',
'storage/IDBDatabaseRequest.h',
+ 'storage/IDBEvent.cpp',
+ 'storage/IDBEvent.h',
+ 'storage/IDBErrorEvent.cpp',
+ 'storage/IDBErrorEvent.h',
'storage/IDBRequest.cpp',
'storage/IDBRequest.h',
+ 'storage/IDBSuccessEvent.cpp',
+ 'storage/IDBSuccessEvent.h',
'storage/IndexedDatabase.cpp',
'storage/IndexedDatabase.h',
'storage/IndexedDatabaseImpl.cpp',
diff --git a/WebCore/WebCore.pri b/WebCore/WebCore.pri
index ed956db..4da1aa8 100644
--- a/WebCore/WebCore.pri
+++ b/WebCore/WebCore.pri
@@ -442,10 +442,14 @@
storage/Database.idl \
storage/DatabaseCallback.idl \
storage/DatabaseSync.idl \
+ storage/IDBAny.idl \
storage/IDBDatabaseError.idl \
storage/IDBDatabaseException.idl \
storage/IDBDatabaseRequest.idl \
+ storage/IDBErrorEvent.idl \
+ storage/IDBEvent.idl \
storage/IDBRequest.idl \
+ storage/IDBSuccessEvent.idl \
storage/IndexedDatabaseRequest.idl \
storage/Storage.idl \
storage/StorageEvent.idl \
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index d336355..933081a 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -2319,21 +2319,29 @@
contains(DEFINES, ENABLE_INDEXED_DATABASE=1) {
HEADERS += \
+ storage/IDBAny.h \
storage/IDBCallbacks.h \
storage/IDBDatabase.h \
storage/IDBDatabaseError.h \
storage/IDBDatabaseException.h \
storage/IDBDatabaseRequest.h \
+ storage/IDBErrorEvent.h \
+ storage/IDBEvent.h \
storage/IDBRequest.h \
+ storage/IDBSuccessEvent.h \
storage/IndexedDatabase.h \
storage/IndexedDatabaseImpl.h \
storage/IndexedDatabaseRequest.h
SOURCES += \
- bindings/js/JSIDBRequestCustom.cpp \
+ bindings/js/JSIDBAnyCustom.cpp \
+ storage/IDBAny.cpp \
storage/IDBDatabase.cpp \
storage/IDBDatabaseRequest.cpp \
+ storage/IDBErrorEvent.cpp \
+ storage/IDBEvent.cpp \
storage/IDBRequest.cpp \
+ storage/IDBSuccessEvent.cpp \
storage/IndexedDatabase.cpp \
storage/IndexedDatabaseImpl.cpp \
storage/IndexedDatabaseRequest.cpp
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 03bfd6e..d9302a9 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -37960,6 +37960,118 @@
>
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBAny.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBAny.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabase.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabase.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBDatabaseError.cpp"
>
<FileConfiguration
@@ -38128,6 +38240,118 @@
>
</File>
<File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBErrorEvent.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBErrorEvent.h"
+ >
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBEvent.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBEvent.h"
+ >
+ </File>
+ <File
RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBRequest.cpp"
>
<FileConfiguration
@@ -38184,7 +38408,63 @@
>
</File>
<File
- RelativePath="..\bindings\js\JSIDBRequestCustom.cpp"
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBSuccessEvent.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="$(WebKitOutputDir)\obj\$(ProjectName)\DerivedSources\JSIDBSuccessEvent.h"
+ >
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSIDBAnyCustom.cpp"
>
<FileConfiguration
Name="Debug|Win32"
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 04d9924..edbe995 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -4778,7 +4778,23 @@
C5198F5E1192ECFD002B74A6 /* IndexedDatabaseRequest.h in Headers */ = {isa = PBXBuildFile; fileRef = C5198F4A1192ECFD002B74A6 /* IndexedDatabaseRequest.h */; };
C55E38BF10040D5D00A56BDB /* StorageNamespaceImpl.h in Headers */ = {isa = PBXBuildFile; fileRef = C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */; };
C55E38C010040D5D00A56BDB /* StorageNamespaceImpl.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */; };
- C5956678119324C600FDCE47 /* JSIDBRequestCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5956677119324C600FDCE47 /* JSIDBRequestCustom.cpp */; };
+ C56C914E119D849800DE4CD9 /* JSIDBAnyCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C56C914D119D849800DE4CD9 /* JSIDBAnyCustom.cpp */; };
+ C56C9152119D84CB00DE4CD9 /* IDBAny.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C56C914F119D84CB00DE4CD9 /* IDBAny.cpp */; };
+ C56C9153119D84CB00DE4CD9 /* IDBAny.h in Headers */ = {isa = PBXBuildFile; fileRef = C56C9150119D84CB00DE4CD9 /* IDBAny.h */; };
+ C56C915F119D84E600DE4CD9 /* IDBErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C56C9159119D84E600DE4CD9 /* IDBErrorEvent.cpp */; };
+ C56C9160119D84E600DE4CD9 /* IDBErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C56C915A119D84E600DE4CD9 /* IDBErrorEvent.h */; };
+ C56C9162119D84E600DE4CD9 /* IDBEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C56C915C119D84E600DE4CD9 /* IDBEvent.cpp */; };
+ C56C9163119D84E600DE4CD9 /* IDBEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C56C915D119D84E600DE4CD9 /* IDBEvent.h */; };
+ C56C9168119D84FF00DE4CD9 /* IDBSuccessEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C56C9165119D84FF00DE4CD9 /* IDBSuccessEvent.cpp */; };
+ C56C9169119D84FF00DE4CD9 /* IDBSuccessEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C56C9166119D84FF00DE4CD9 /* IDBSuccessEvent.h */; };
+ C56C919A119D915300DE4CD9 /* JSIDBAny.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C56C9198119D915300DE4CD9 /* JSIDBAny.cpp */; };
+ C56C919B119D915300DE4CD9 /* JSIDBAny.h in Headers */ = {isa = PBXBuildFile; fileRef = C56C9199119D915300DE4CD9 /* JSIDBAny.h */; };
+ C56C91A0119D918100DE4CD9 /* JSIDBErrorEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C56C919C119D918100DE4CD9 /* JSIDBErrorEvent.cpp */; };
+ C56C91A1119D918100DE4CD9 /* JSIDBErrorEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C56C919D119D918100DE4CD9 /* JSIDBErrorEvent.h */; };
+ C56C91A2119D918100DE4CD9 /* JSIDBEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C56C919E119D918100DE4CD9 /* JSIDBEvent.cpp */; };
+ C56C91A3119D918100DE4CD9 /* JSIDBEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C56C919F119D918100DE4CD9 /* JSIDBEvent.h */; };
+ C56C91A6119D918700DE4CD9 /* JSIDBSuccessEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C56C91A4119D918700DE4CD9 /* JSIDBSuccessEvent.cpp */; };
+ C56C91A7119D918700DE4CD9 /* JSIDBSuccessEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = C56C91A5119D918700DE4CD9 /* JSIDBSuccessEvent.h */; };
C5D4AA7A116BAFB60069CA93 /* GlyphMetricsMap.h in Headers */ = {isa = PBXBuildFile; fileRef = C5D4AA78116BAFB60069CA93 /* GlyphMetricsMap.h */; settings = {ATTRIBUTES = (Private, ); }; };
C5E9B67710697E1300C7BB1A /* StorageEventDispatcher.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C5E9B67610697E1300C7BB1A /* StorageEventDispatcher.cpp */; };
C5EBDD84105EDDEC0056816F /* StorageEventDispatcher.h in Headers */ = {isa = PBXBuildFile; fileRef = C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */; };
@@ -10251,7 +10267,27 @@
C5198F4B1192ECFD002B74A6 /* IndexedDatabaseRequest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IndexedDatabaseRequest.idl; sourceTree = "<group>"; };
C55E38BB10040D5D00A56BDB /* StorageNamespaceImpl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageNamespaceImpl.h; sourceTree = "<group>"; };
C55E38BC10040D5D00A56BDB /* StorageNamespaceImpl.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageNamespaceImpl.cpp; sourceTree = "<group>"; };
- C5956677119324C600FDCE47 /* JSIDBRequestCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBRequestCustom.cpp; sourceTree = "<group>"; };
+ C56C914D119D849800DE4CD9 /* JSIDBAnyCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBAnyCustom.cpp; sourceTree = "<group>"; };
+ C56C914F119D84CB00DE4CD9 /* IDBAny.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBAny.cpp; sourceTree = "<group>"; };
+ C56C9150119D84CB00DE4CD9 /* IDBAny.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBAny.h; sourceTree = "<group>"; };
+ C56C9151119D84CB00DE4CD9 /* IDBAny.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBAny.idl; sourceTree = "<group>"; };
+ C56C9159119D84E600DE4CD9 /* IDBErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBErrorEvent.cpp; sourceTree = "<group>"; };
+ C56C915A119D84E600DE4CD9 /* IDBErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBErrorEvent.h; sourceTree = "<group>"; };
+ C56C915B119D84E600DE4CD9 /* IDBErrorEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBErrorEvent.idl; sourceTree = "<group>"; };
+ C56C915C119D84E600DE4CD9 /* IDBEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBEvent.cpp; sourceTree = "<group>"; };
+ C56C915D119D84E600DE4CD9 /* IDBEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBEvent.h; sourceTree = "<group>"; };
+ C56C915E119D84E600DE4CD9 /* IDBEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBEvent.idl; sourceTree = "<group>"; };
+ C56C9165119D84FF00DE4CD9 /* IDBSuccessEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IDBSuccessEvent.cpp; sourceTree = "<group>"; };
+ C56C9166119D84FF00DE4CD9 /* IDBSuccessEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IDBSuccessEvent.h; sourceTree = "<group>"; };
+ C56C9167119D84FF00DE4CD9 /* IDBSuccessEvent.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = IDBSuccessEvent.idl; sourceTree = "<group>"; };
+ C56C9198119D915300DE4CD9 /* JSIDBAny.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBAny.cpp; sourceTree = "<group>"; };
+ C56C9199119D915300DE4CD9 /* JSIDBAny.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBAny.h; sourceTree = "<group>"; };
+ C56C919C119D918100DE4CD9 /* JSIDBErrorEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBErrorEvent.cpp; sourceTree = "<group>"; };
+ C56C919D119D918100DE4CD9 /* JSIDBErrorEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBErrorEvent.h; sourceTree = "<group>"; };
+ C56C919E119D918100DE4CD9 /* JSIDBEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBEvent.cpp; sourceTree = "<group>"; };
+ C56C919F119D918100DE4CD9 /* JSIDBEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBEvent.h; sourceTree = "<group>"; };
+ C56C91A4119D918700DE4CD9 /* JSIDBSuccessEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSIDBSuccessEvent.cpp; sourceTree = "<group>"; };
+ C56C91A5119D918700DE4CD9 /* JSIDBSuccessEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSIDBSuccessEvent.h; sourceTree = "<group>"; };
C5D4AA78116BAFB60069CA93 /* GlyphMetricsMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GlyphMetricsMap.h; sourceTree = "<group>"; };
C5E9B67610697E1300C7BB1A /* StorageEventDispatcher.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StorageEventDispatcher.cpp; sourceTree = "<group>"; };
C5EBDD81105EDDEC0056816F /* StorageEventDispatcher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StorageEventDispatcher.h; sourceTree = "<group>"; };
@@ -10918,6 +10954,9 @@
1AD51A130CB59CD300953D11 /* DatabaseTracker.cpp */,
1AD51A120CB59CD300953D11 /* DatabaseTracker.h */,
51FAFE330CECBF2D00BB3F24 /* DatabaseTrackerClient.h */,
+ C56C914F119D84CB00DE4CD9 /* IDBAny.cpp */,
+ C56C9150119D84CB00DE4CD9 /* IDBAny.h */,
+ C56C9151119D84CB00DE4CD9 /* IDBAny.idl */,
C5198F381192ECFD002B74A6 /* IDBCallbacks.h */,
C5198F391192ECFD002B74A6 /* IDBDatabase.cpp */,
C5198F3A1192ECFD002B74A6 /* IDBDatabase.h */,
@@ -10928,9 +10967,18 @@
C5198F3F1192ECFD002B74A6 /* IDBDatabaseRequest.cpp */,
C5198F401192ECFD002B74A6 /* IDBDatabaseRequest.h */,
C5198F411192ECFD002B74A6 /* IDBDatabaseRequest.idl */,
+ C56C9159119D84E600DE4CD9 /* IDBErrorEvent.cpp */,
+ C56C915A119D84E600DE4CD9 /* IDBErrorEvent.h */,
+ C56C915B119D84E600DE4CD9 /* IDBErrorEvent.idl */,
+ C56C915C119D84E600DE4CD9 /* IDBEvent.cpp */,
+ C56C915D119D84E600DE4CD9 /* IDBEvent.h */,
+ C56C915E119D84E600DE4CD9 /* IDBEvent.idl */,
C5198F421192ECFD002B74A6 /* IDBRequest.cpp */,
C5198F431192ECFD002B74A6 /* IDBRequest.h */,
C5198F441192ECFD002B74A6 /* IDBRequest.idl */,
+ C56C9165119D84FF00DE4CD9 /* IDBSuccessEvent.cpp */,
+ C56C9166119D84FF00DE4CD9 /* IDBSuccessEvent.h */,
+ C56C9167119D84FF00DE4CD9 /* IDBSuccessEvent.idl */,
C5198F451192ECFD002B74A6 /* IndexedDatabase.cpp */,
C5198F461192ECFD002B74A6 /* IndexedDatabase.h */,
C5198F471192ECFD002B74A6 /* IndexedDatabaseImpl.cpp */,
@@ -14255,14 +14303,22 @@
children = (
1AE82F8D0CAAFA9D002237AE /* JSDatabase.cpp */,
1AE82F8E0CAAFA9D002237AE /* JSDatabase.h */,
+ C56C9198119D915300DE4CD9 /* JSIDBAny.cpp */,
+ C56C9199119D915300DE4CD9 /* JSIDBAny.h */,
C5F4F3FE119306AC00FDFADD /* JSIDBDatabaseError.cpp */,
C5F4F3FF119306AC00FDFADD /* JSIDBDatabaseError.h */,
C5F4F400119306AC00FDFADD /* JSIDBDatabaseException.cpp */,
C5F4F401119306AC00FDFADD /* JSIDBDatabaseException.h */,
C5F4F402119306AC00FDFADD /* JSIDBDatabaseRequest.cpp */,
C5F4F403119306AC00FDFADD /* JSIDBDatabaseRequest.h */,
+ C56C919C119D918100DE4CD9 /* JSIDBErrorEvent.cpp */,
+ C56C919D119D918100DE4CD9 /* JSIDBErrorEvent.h */,
+ C56C919E119D918100DE4CD9 /* JSIDBEvent.cpp */,
+ C56C919F119D918100DE4CD9 /* JSIDBEvent.h */,
C5F4F404119306AC00FDFADD /* JSIDBRequest.cpp */,
C5F4F405119306AC00FDFADD /* JSIDBRequest.h */,
+ C56C91A4119D918700DE4CD9 /* JSIDBSuccessEvent.cpp */,
+ C56C91A5119D918700DE4CD9 /* JSIDBSuccessEvent.h */,
C5F4F40E119306C000FDFADD /* JSIndexedDatabaseRequest.cpp */,
C5F4F40F119306C000FDFADD /* JSIndexedDatabaseRequest.h */,
514C76350CE9225E007EF3CD /* JSSQLError.cpp */,
@@ -15287,7 +15343,7 @@
448AD27A0A4813790023D179 /* JSHTMLOptionsCollectionCustom.cpp */,
BC17F9650B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp */,
AB4CB4EA0B8BDA3D009F40B0 /* JSHTMLSelectElementCustom.h */,
- C5956677119324C600FDCE47 /* JSIDBRequestCustom.cpp */,
+ C56C914D119D849800DE4CD9 /* JSIDBAnyCustom.cpp */,
A7D0318D0E93540300E24ACD /* JSImageDataCustom.cpp */,
7A0E76D410BF050700A0276E /* JSInjectedScriptHostCustom.cpp */,
7A74ECBC101839DA00BF939E /* JSInspectorFrontendHostCustom.cpp */,
@@ -19187,6 +19243,14 @@
A454424F119B3687009BE912 /* RenderMeter.h in Headers */,
B5B5DC6A119BB3D5002A8790 /* AbstractDatabase.h in Headers */,
4FD8D0F3119C718B002FA825 /* ScriptGCEvent.h in Headers */,
+ C56C9153119D84CB00DE4CD9 /* IDBAny.h in Headers */,
+ C56C9160119D84E600DE4CD9 /* IDBErrorEvent.h in Headers */,
+ C56C9163119D84E600DE4CD9 /* IDBEvent.h in Headers */,
+ C56C9169119D84FF00DE4CD9 /* IDBSuccessEvent.h in Headers */,
+ C56C919B119D915300DE4CD9 /* JSIDBAny.h in Headers */,
+ C56C91A1119D918100DE4CD9 /* JSIDBErrorEvent.h in Headers */,
+ C56C91A3119D918100DE4CD9 /* JSIDBEvent.h in Headers */,
+ C56C91A7119D918700DE4CD9 /* JSIDBSuccessEvent.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -21451,7 +21515,6 @@
C5F4F40A119306AC00FDFADD /* JSIDBDatabaseRequest.cpp in Sources */,
C5F4F40C119306AC00FDFADD /* JSIDBRequest.cpp in Sources */,
C5F4F410119306C000FDFADD /* JSIndexedDatabaseRequest.cpp in Sources */,
- C5956678119324C600FDCE47 /* JSIDBRequestCustom.cpp in Sources */,
2E94F43B119207DA00B7F75D /* JSFileReader.cpp in Sources */,
2E94F4501192096400B7F75D /* FileReader.cpp in Sources */,
E440A2D51191A50B000820B0 /* SVGFELighting.cpp in Sources */,
@@ -21459,6 +21522,15 @@
A454424E119B3687009BE912 /* RenderMeter.cpp in Sources */,
B5B5DC69119BB3D5002A8790 /* AbstractDatabase.cpp in Sources */,
4FD8D0F2119C718B002FA825 /* ScriptGCEvent.cpp in Sources */,
+ C56C914E119D849800DE4CD9 /* JSIDBAnyCustom.cpp in Sources */,
+ C56C9152119D84CB00DE4CD9 /* IDBAny.cpp in Sources */,
+ C56C915F119D84E600DE4CD9 /* IDBErrorEvent.cpp in Sources */,
+ C56C9162119D84E600DE4CD9 /* IDBEvent.cpp in Sources */,
+ C56C9168119D84FF00DE4CD9 /* IDBSuccessEvent.cpp in Sources */,
+ C56C919A119D915300DE4CD9 /* JSIDBAny.cpp in Sources */,
+ C56C91A0119D918100DE4CD9 /* JSIDBErrorEvent.cpp in Sources */,
+ C56C91A2119D918100DE4CD9 /* JSIDBEvent.cpp in Sources */,
+ C56C91A6119D918700DE4CD9 /* JSIDBSuccessEvent.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
diff --git a/WebCore/bindings/js/JSEventCustom.cpp b/WebCore/bindings/js/JSEventCustom.cpp
index 6686d7a..fd46faa 100644
--- a/WebCore/bindings/js/JSEventCustom.cpp
+++ b/WebCore/bindings/js/JSEventCustom.cpp
@@ -38,6 +38,8 @@
#include "JSCustomEvent.h"
#include "JSCompositionEvent.h"
#include "JSErrorEvent.h"
+#include "JSIDBErrorEvent.h"
+#include "JSIDBSuccessEvent.h"
#include "JSKeyboardEvent.h"
#include "JSMessageEvent.h"
#include "JSMouseEvent.h"
@@ -54,6 +56,8 @@
#include "JSXMLHttpRequestProgressEvent.h"
#include "BeforeLoadEvent.h"
#include "ErrorEvent.h"
+#include "IDBErrorEvent.h"
+#include "IDBSuccessEvent.h"
#include "KeyboardEvent.h"
#include "MessageEvent.h"
#include "MouseEvent.h"
@@ -145,6 +149,12 @@
else if (event->isStorageEvent())
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, StorageEvent, event);
#endif
+#if ENABLE(INDEXED_DATABASE)
+ else if (event->isIDBErrorEvent())
+ wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, IDBErrorEvent, event);
+ else if (event->isIDBSuccessEvent())
+ wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, IDBSuccessEvent, event);
+#endif
else if (event->isWebKitAnimationEvent())
wrapper = CREATE_DOM_OBJECT_WRAPPER(exec, globalObject, WebKitAnimationEvent, event);
else if (event->isWebKitTransitionEvent())
diff --git a/WebCore/bindings/js/JSEventTarget.cpp b/WebCore/bindings/js/JSEventTarget.cpp
index 948889b..c5fce64 100644
--- a/WebCore/bindings/js/JSEventTarget.cpp
+++ b/WebCore/bindings/js/JSEventTarget.cpp
@@ -78,6 +78,11 @@
#include "Notification.h"
#endif
+#if ENABLE(INDEXED_DATABASE)
+#include "IDBRequest.h"
+#include "JSIDBRequest.h"
+#endif
+
#if ENABLE(WEB_SOCKETS)
#include "JSWebSocket.h"
#include "WebSocket.h"
@@ -149,6 +154,11 @@
return toJS(exec, notification);
#endif
+#if ENABLE(INDEXED_DATABASE)
+ if (IDBRequest* idbRequest = target->toIDBRequest())
+ return toJS(exec, idbRequest);
+#endif
+
#if ENABLE(WEB_SOCKETS)
if (WebSocket* webSocket = target->toWebSocket())
return toJS(exec, webSocket);
diff --git a/WebCore/bindings/js/JSIDBRequestCustom.cpp b/WebCore/bindings/js/JSIDBAnyCustom.cpp
similarity index 74%
rename from WebCore/bindings/js/JSIDBRequestCustom.cpp
rename to WebCore/bindings/js/JSIDBAnyCustom.cpp
index c4f9744..f7674b8 100644
--- a/WebCore/bindings/js/JSIDBRequestCustom.cpp
+++ b/WebCore/bindings/js/JSIDBAnyCustom.cpp
@@ -32,27 +32,33 @@
#if ENABLE(INDEXED_DATABASE)
-#include "JSIDBRequest.h"
+#include "JSIDBAny.h"
+#include "IDBAny.h"
#include "IDBDatabaseRequest.h"
-#include "IDBRequest.h"
+#include "IndexedDatabaseRequest.h"
#include "JSIDBDatabaseRequest.h"
+#include "JSIndexedDatabaseRequest.h"
#include "SerializedScriptValue.h"
using namespace JSC;
namespace WebCore {
-JSValue JSIDBRequest::result(ExecState* exec) const
+JSValue toJS(ExecState* exec, JSDOMGlobalObject* globalObject, IDBAny* idbAny)
{
- IDBRequest* idbRequest = static_cast<IDBRequest*>(impl());
- switch (idbRequest->resultType()) {
- case IDBRequest::UNDEFINED:
+ if (!idbAny)
+ return jsNull();
+
+ switch (idbAny->type()) {
+ case IDBAny::UndefinedType:
return jsUndefined();
- case IDBRequest::IDBDATABASE:
- return toJS(exec, globalObject(), idbRequest->idbDatabaseResult());
- case IDBRequest::SERIALIZEDSCRIPTVALUE:
- return idbRequest->serializedScriptValueResult()->deserialize(exec, globalObject());
+ case IDBAny::IDBDatabaseRequestType:
+ return toJS(exec, globalObject, idbAny->idbDatabaseRequest());
+ case IDBAny::IndexedDatabaseRequestType:
+ return toJS(exec, globalObject, idbAny->indexedDatabaseRequest());
+ case IDBAny::SerializedScriptValueType:
+ return idbAny->serializedScriptValue()->deserialize(exec, globalObject);
}
ASSERT_NOT_REACHED();
diff --git a/WebCore/bindings/v8/custom/V8EventCustom.cpp b/WebCore/bindings/v8/custom/V8EventCustom.cpp
index b2728ec..8a1a339 100644
--- a/WebCore/bindings/v8/custom/V8EventCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8EventCustom.cpp
@@ -1,5 +1,5 @@
/*
- * Copyright (C) 2007-2009 Google Inc. All rights reserved.
+ * Copyright (C) 2010 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
@@ -41,6 +41,8 @@
#include "V8CompositionEvent.h"
#include "V8CustomEvent.h"
#include "V8ErrorEvent.h"
+#include "V8IDBErrorEvent.h"
+#include "V8IDBSuccessEvent.h"
#include "V8KeyboardEvent.h"
#include "V8MessageEvent.h"
#include "V8MouseEvent.h"
@@ -143,6 +145,12 @@
if (impl->isStorageEvent())
return toV8(static_cast<StorageEvent*>(impl));
#endif
+#if ENABLE(INDEXED_DATABASE)
+ if (impl->isIDBErrorEvent())
+ return toV8(static_cast<IDBErrorEvent*>(impl));
+ if (impl->isIDBSuccessEvent())
+ return toV8(static_cast<IDBSuccessEvent*>(impl));
+#endif
if (impl->isBeforeLoadEvent())
return toV8(static_cast<BeforeLoadEvent*>(impl));
if (impl->isCustomEvent())
diff --git a/WebCore/bindings/v8/custom/V8IDBRequestCustom.cpp b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
similarity index 77%
rename from WebCore/bindings/v8/custom/V8IDBRequestCustom.cpp
rename to WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
index beffb69..2e20e82 100644
--- a/WebCore/bindings/v8/custom/V8IDBRequestCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8IDBAnyCustom.cpp
@@ -32,33 +32,34 @@
#if ENABLE(INDEXED_DATABASE)
-#include "V8IDBRequest.h"
+#include "V8IDBAny.h"
#include "SerializedScriptValue.h"
#include "V8IDBDatabaseRequest.h"
-#include "V8Proxy.h"
+#include "V8IndexedDatabaseRequest.h"
namespace WebCore {
-v8::Handle<v8::Value> V8IDBRequest::resultAccessorGetter(v8::Local<v8::String> name, const v8::AccessorInfo& info)
+v8::Handle<v8::Value> toV8(IDBAny* impl)
{
- INC_STATS("DOM.IDBRequest.result");
+ if (!impl)
+ return v8::Null();
- IDBRequest* idbRequest = V8IDBRequest::toNative(info.Holder());
- switch (idbRequest->resultType()) {
- case IDBRequest::UNDEFINED:
+ switch (impl->type()) {
+ case IDBAny::UndefinedType:
return v8::Undefined();
- case IDBRequest::IDBDATABASE:
- return toV8(idbRequest->idbDatabaseResult());
- case IDBRequest::SERIALIZEDSCRIPTVALUE:
- return idbRequest->serializedScriptValueResult()->deserialize();
+ case IDBAny::IDBDatabaseRequestType:
+ return toV8(impl->idbDatabaseRequest());
+ case IDBAny::IndexedDatabaseRequestType:
+ return toV8(impl->indexedDatabaseRequest());
+ case IDBAny::SerializedScriptValueType:
+ return impl->serializedScriptValue()->deserialize();
}
ASSERT_NOT_REACHED();
return v8::Undefined();
}
-} // namespace WebCore
-
#endif // ENABLE(INDEXED_DATABASE)
+} // namespace WebCore
diff --git a/WebCore/dom/Event.cpp b/WebCore/dom/Event.cpp
index 506d945..876f8a8 100644
--- a/WebCore/dom/Event.cpp
+++ b/WebCore/dom/Event.cpp
@@ -186,6 +186,18 @@
}
#endif
+#if ENABLE(INDEXED_DATABASE)
+bool Event::isIDBErrorEvent() const
+{
+ return false;
+}
+
+bool Event::isIDBSuccessEvent() const
+{
+ return false;
+}
+#endif
+
#if ENABLE(WORKERS)
bool Event::isErrorEvent() const
{
diff --git a/WebCore/dom/Event.h b/WebCore/dom/Event.h
index 00b3341..fbcdc94 100644
--- a/WebCore/dom/Event.h
+++ b/WebCore/dom/Event.h
@@ -129,6 +129,10 @@
#if ENABLE(DOM_STORAGE)
virtual bool isStorageEvent() const;
#endif
+#if ENABLE(INDEXED_DATABASE)
+ virtual bool isIDBErrorEvent() const;
+ virtual bool isIDBSuccessEvent() const;
+#endif
#if ENABLE(WORKERS)
virtual bool isErrorEvent() const;
#endif
diff --git a/WebCore/storage/IDBAny.cpp b/WebCore/storage/IDBAny.cpp
new file mode 100644
index 0000000..17a8007
--- /dev/null
+++ b/WebCore/storage/IDBAny.cpp
@@ -0,0 +1,98 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBAny.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBDatabaseRequest.h"
+#include "IndexedDatabaseRequest.h"
+#include "SerializedScriptValue.h"
+
+namespace WebCore {
+
+PassRefPtr<IDBAny> IDBAny::create()
+{
+ return adoptRef(new IDBAny());
+}
+
+IDBAny::IDBAny()
+ : m_type(UndefinedType)
+{
+}
+
+IDBAny::~IDBAny()
+{
+}
+
+PassRefPtr<IDBDatabaseRequest> IDBAny::idbDatabaseRequest()
+{
+ ASSERT(m_type == IDBDatabaseRequestType);
+ return m_idbDatabaseRequest;
+}
+
+PassRefPtr<IndexedDatabaseRequest> IDBAny::indexedDatabaseRequest()
+{
+ ASSERT(m_type == IndexedDatabaseRequestType);
+ return m_indexedDatabaseRequest;
+}
+
+PassRefPtr<SerializedScriptValue> IDBAny::serializedScriptValue()
+{
+ ASSERT(m_type == SerializedScriptValueType);
+ return m_serializedScriptValue;
+}
+
+void IDBAny::set(PassRefPtr<IDBDatabaseRequest> value)
+{
+ m_type = IDBDatabaseRequestType;
+ m_idbDatabaseRequest = value;
+ m_indexedDatabaseRequest = 0;
+ m_serializedScriptValue = 0;
+}
+
+void IDBAny::set(PassRefPtr<IndexedDatabaseRequest> value)
+{
+ m_type = IndexedDatabaseRequestType;
+ m_idbDatabaseRequest = 0;
+ m_indexedDatabaseRequest = value;
+ m_serializedScriptValue = 0;
+}
+
+void IDBAny::set(PassRefPtr<SerializedScriptValue> value)
+{
+ m_type = SerializedScriptValueType;
+ m_idbDatabaseRequest = 0;
+ m_indexedDatabaseRequest = 0;
+ m_serializedScriptValue = value;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/storage/IDBAny.h b/WebCore/storage/IDBAny.h
new file mode 100644
index 0000000..56c57e2
--- /dev/null
+++ b/WebCore/storage/IDBAny.h
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IDBAny_h
+#define IDBAny_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class IDBDatabaseRequest;
+class IndexedDatabaseRequest;
+class SerializedScriptValue;
+
+class IDBAny : public RefCounted<IDBAny> {
+public:
+ static PassRefPtr<IDBAny> create();
+ ~IDBAny();
+
+ enum Type {
+ UndefinedType = 0,
+ IDBDatabaseRequestType,
+ IndexedDatabaseRequestType,
+ SerializedScriptValueType
+ };
+
+ Type type() const { return m_type; }
+
+ PassRefPtr<IDBDatabaseRequest> idbDatabaseRequest();
+ PassRefPtr<IndexedDatabaseRequest> indexedDatabaseRequest();
+ PassRefPtr<SerializedScriptValue> serializedScriptValue();
+
+ void set(PassRefPtr<IDBDatabaseRequest>);
+ void set(PassRefPtr<IndexedDatabaseRequest>);
+ void set(PassRefPtr<SerializedScriptValue>);
+
+private:
+ IDBAny();
+
+ Type m_type;
+
+ // Only one of the following should ever be in use at any given time.
+ RefPtr<IDBDatabaseRequest> m_idbDatabaseRequest;
+ RefPtr<IndexedDatabaseRequest> m_indexedDatabaseRequest;
+ RefPtr<SerializedScriptValue> m_serializedScriptValue;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // IDBAny_h
diff --git a/WebCore/storage/IDBAny.idl b/WebCore/storage/IDBAny.idl
new file mode 100644
index 0000000..59da1c7
--- /dev/null
+++ b/WebCore/storage/IDBAny.idl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module storage {
+
+ interface [
+ Conditional=INDEXED_DATABASE,
+ CustomToJS
+ ] IDBAny {
+ // This space is intentionally left blank.
+ };
+}
diff --git a/WebCore/storage/IDBErrorEvent.cpp b/WebCore/storage/IDBErrorEvent.cpp
new file mode 100644
index 0000000..cba980d
--- /dev/null
+++ b/WebCore/storage/IDBErrorEvent.cpp
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBErrorEvent.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "EventNames.h"
+#include "IDBAny.h"
+#include "IDBDatabaseError.h"
+
+namespace WebCore {
+
+PassRefPtr<IDBErrorEvent> IDBErrorEvent::create(PassRefPtr<IDBAny> source, const IDBDatabaseError& error)
+{
+ return adoptRef(new IDBErrorEvent(source, error));
+}
+
+IDBErrorEvent::IDBErrorEvent(PassRefPtr<IDBAny> source, const IDBDatabaseError& error)
+ : IDBEvent(eventNames().errorEvent, source)
+ , m_code(error.code())
+ , m_message(error.message())
+{
+}
+
+IDBErrorEvent::~IDBErrorEvent()
+{
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/storage/IDBErrorEvent.h b/WebCore/storage/IDBErrorEvent.h
new file mode 100644
index 0000000..648da8b
--- /dev/null
+++ b/WebCore/storage/IDBErrorEvent.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IDBErrorEvent_h
+#define IDBErrorEvent_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBEvent.h"
+#include "PlatformString.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class IDBAny;
+class IDBDatabaseError;
+
+class IDBErrorEvent : public IDBEvent {
+public:
+ static PassRefPtr<IDBErrorEvent> create(PassRefPtr<IDBAny> source, const IDBDatabaseError&);
+ // FIXME: Need to allow creation of these events from JS.
+ virtual ~IDBErrorEvent();
+
+ unsigned short code() const { return m_code; }
+ String message() { return m_message; }
+
+ virtual bool isIDBErrorEvent() const { return true; }
+
+private:
+ IDBErrorEvent(PassRefPtr<IDBAny> source, const IDBDatabaseError&);
+
+ unsigned short m_code;
+ String m_message;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // IDBEvent_h
diff --git a/WebCore/storage/IDBErrorEvent.idl b/WebCore/storage/IDBErrorEvent.idl
new file mode 100644
index 0000000..5c58f6f
--- /dev/null
+++ b/WebCore/storage/IDBErrorEvent.idl
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module storage {
+
+ interface [
+ Conditional=INDEXED_DATABASE
+ ] IDBErrorEvent : IDBEvent {
+ readonly attribute unsigned short code;
+ readonly attribute DOMString message;
+ };
+}
diff --git a/WebCore/storage/IDBEvent.cpp b/WebCore/storage/IDBEvent.cpp
new file mode 100644
index 0000000..f9f6060
--- /dev/null
+++ b/WebCore/storage/IDBEvent.cpp
@@ -0,0 +1,55 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBEvent.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBAny.h"
+
+namespace WebCore {
+
+IDBEvent::IDBEvent(const AtomicString& type, PassRefPtr<IDBAny> source)
+ : Event(type, false, false)
+ , m_source(source)
+{
+}
+
+IDBEvent::~IDBEvent()
+{
+}
+
+PassRefPtr<IDBAny> IDBEvent::source()
+{
+ return m_source;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/storage/IDBEvent.h b/WebCore/storage/IDBEvent.h
new file mode 100644
index 0000000..c44e449
--- /dev/null
+++ b/WebCore/storage/IDBEvent.h
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IDBEvent_h
+#define IDBEvent_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "Event.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class IDBAny;
+
+class IDBEvent : public Event {
+public:
+ virtual ~IDBEvent();
+
+ PassRefPtr<IDBAny> source();
+
+protected:
+ IDBEvent(const AtomicString& type, PassRefPtr<IDBAny> source);
+
+private:
+ RefPtr<IDBAny> m_source;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // IDBEvent_h
diff --git a/WebCore/storage/IDBEvent.idl b/WebCore/storage/IDBEvent.idl
new file mode 100644
index 0000000..4dd552e
--- /dev/null
+++ b/WebCore/storage/IDBEvent.idl
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module storage {
+
+ interface [
+ Conditional=INDEXED_DATABASE
+ ] IDBEvent : Event {
+ readonly attribute IDBAny source;
+ };
+}
diff --git a/WebCore/storage/IDBRequest.cpp b/WebCore/storage/IDBRequest.cpp
index 3bfb91c..4206ff6 100644
--- a/WebCore/storage/IDBRequest.cpp
+++ b/WebCore/storage/IDBRequest.cpp
@@ -27,23 +27,25 @@
*/
#include "config.h"
+#include "IDBRequest.h"
#if ENABLE(INDEXED_DATABASE)
-#include "IDBRequest.h"
-
#include "Event.h"
#include "EventException.h"
#include "EventListener.h"
#include "EventNames.h"
#include "IDBDatabaseRequest.h"
+#include "IDBErrorEvent.h"
+#include "IDBSuccessEvent.h"
#include "ScriptExecutionContext.h"
namespace WebCore {
-IDBRequest::IDBRequest(ScriptExecutionContext* context)
+IDBRequest::IDBRequest(ScriptExecutionContext* context, PassRefPtr<IDBAny> source)
: ActiveDOMObject(context, this)
- , m_resultType(UNDEFINED)
+ , m_source(source)
+ , m_result(IDBAny::create())
, m_timer(this, &IDBRequest::timerFired)
, m_stopped(false)
, m_aborted(false)
@@ -57,20 +59,6 @@
abort();
}
-
-PassRefPtr<IDBDatabaseRequest> IDBRequest::idbDatabaseResult()
-{
- ASSERT(m_resultType == IDBDATABASE);
- return m_idbDatabaseResult;
-}
-
-
-PassRefPtr<SerializedScriptValue> IDBRequest::serializedScriptValueResult()
-{
- ASSERT(m_resultType == SERIALIZEDSCRIPTVALUE);
- return m_serializedScriptValueResult;
-}
-
void IDBRequest::onError(PassRefPtr<IDBDatabaseError> error)
{
onEventCommon();
@@ -80,15 +68,13 @@
void IDBRequest::onSuccess(PassRefPtr<IDBDatabase> idbDatabase)
{
onEventCommon();
- m_resultType = IDBDATABASE;
- m_idbDatabaseResult = IDBDatabaseRequest::create(idbDatabase);
+ m_result->set(IDBDatabaseRequest::create(idbDatabase));
}
void IDBRequest::onSuccess(PassRefPtr<SerializedScriptValue> serializedScriptValue)
{
onEventCommon();
- m_resultType = SERIALIZEDSCRIPTVALUE;
- m_serializedScriptValueResult = serializedScriptValue;
+ m_result->set(serializedScriptValue);
}
void IDBRequest::abort()
@@ -144,18 +130,18 @@
RefPtr<IDBRequest> selfRef = m_selfRef.release();
if (m_error) {
- ASSERT(m_resultType == UNDEFINED);
- dispatchEvent(Event::create(eventNames().errorEvent, false, false));
+ ASSERT(m_result->type() == IDBAny::UndefinedType);
+ dispatchEvent(IDBErrorEvent::create(m_source, *m_error));
} else {
- ASSERT(m_resultType != UNDEFINED);
- dispatchEvent(Event::create(eventNames().successEvent, false, false));
+ ASSERT(m_result->type() != IDBAny::UndefinedType);
+ dispatchEvent(IDBSuccessEvent::create(m_source, m_result));
}
}
void IDBRequest::onEventCommon()
{
ASSERT(m_readyState < DONE);
- ASSERT(m_resultType == UNDEFINED);
+ ASSERT(m_result->type() == IDBAny::UndefinedType);
ASSERT(!m_error);
ASSERT(!m_selfRef);
ASSERT(!m_timer.isActive());
diff --git a/WebCore/storage/IDBRequest.h b/WebCore/storage/IDBRequest.h
index 48fde49..0c37c96 100644
--- a/WebCore/storage/IDBRequest.h
+++ b/WebCore/storage/IDBRequest.h
@@ -35,6 +35,7 @@
#include "EventListener.h"
#include "EventNames.h"
#include "EventTarget.h"
+#include "IDBAny.h"
#include "IDBCallbacks.h"
#include "Timer.h"
@@ -44,20 +45,9 @@
class IDBRequest : public IDBCallbacks, public EventTarget, public ActiveDOMObject {
public:
- static PassRefPtr<IDBRequest> create(ScriptExecutionContext* context) { return adoptRef(new IDBRequest(context)); }
+ static PassRefPtr<IDBRequest> create(ScriptExecutionContext* context, PassRefPtr<IDBAny> source) { return adoptRef(new IDBRequest(context, source)); }
virtual ~IDBRequest();
- // The result attribute of this class can represent many different WebCore types.
- enum ResultType {
- UNDEFINED = 0,
- IDBDATABASE,
- SERIALIZEDSCRIPTVALUE
- };
- ResultType resultType() const { return m_resultType; }
- PassRefPtr<IDBDatabaseRequest> idbDatabaseResult();
- PassRefPtr<SerializedScriptValue> serializedScriptValueResult();
- // FIXME: Have one such getter for each possible result type.
-
// Defined in the IDL
void abort();
enum ReadyState {
@@ -67,6 +57,7 @@
};
unsigned short readyState() const { return m_readyState; }
PassRefPtr<IDBDatabaseError> error() const { return m_error; }
+ PassRefPtr<IDBAny> result() { return m_result; }
DEFINE_ATTRIBUTE_EVENT_LISTENER(success);
DEFINE_ATTRIBUTE_EVENT_LISTENER(error);
@@ -89,7 +80,7 @@
using RefCounted<IDBCallbacks>::deref;
private:
- IDBRequest(ScriptExecutionContext*);
+ IDBRequest(ScriptExecutionContext*, PassRefPtr<IDBAny> source);
void timerFired(Timer<IDBRequest>*);
void onEventCommon();
@@ -100,10 +91,9 @@
virtual EventTargetData* eventTargetData();
virtual EventTargetData* ensureEventTargetData();
- ResultType m_resultType;
- // Only one of the following should ever be in use at any given time. m_resultType defines which one.
- RefPtr<IDBDatabaseRequest> m_idbDatabaseResult;
- RefPtr<SerializedScriptValue> m_serializedScriptValueResult;
+ RefPtr<IDBAny> m_source;
+
+ RefPtr<IDBAny> m_result;
RefPtr<IDBDatabaseError> m_error;
// Used to fire events asynchronously.
diff --git a/WebCore/storage/IDBRequest.idl b/WebCore/storage/IDBRequest.idl
index 11a19ab..9d7e0e4 100644
--- a/WebCore/storage/IDBRequest.idl
+++ b/WebCore/storage/IDBRequest.idl
@@ -42,7 +42,7 @@
// Possible results
readonly attribute IDBDatabaseError error;
- readonly attribute [Custom] any result;
+ readonly attribute IDBAny result;
// Events
attribute EventListener onsuccess;
diff --git a/WebCore/storage/IDBSuccessEvent.cpp b/WebCore/storage/IDBSuccessEvent.cpp
new file mode 100644
index 0000000..9660eef
--- /dev/null
+++ b/WebCore/storage/IDBSuccessEvent.cpp
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "IDBSuccessEvent.h"
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "EventNames.h"
+#include "IDBAny.h"
+
+namespace WebCore {
+
+PassRefPtr<IDBSuccessEvent> IDBSuccessEvent::create(PassRefPtr<IDBAny> source, PassRefPtr<IDBAny> result)
+{
+ return adoptRef(new IDBSuccessEvent(source, result));
+}
+
+IDBSuccessEvent::IDBSuccessEvent(PassRefPtr<IDBAny> source, PassRefPtr<IDBAny> result)
+ : IDBEvent(eventNames().errorEvent, source)
+ , m_result(result)
+{
+}
+
+IDBSuccessEvent::~IDBSuccessEvent()
+{
+}
+
+PassRefPtr<IDBAny> IDBSuccessEvent::result()
+{
+ return m_result;
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/storage/IDBSuccessEvent.h b/WebCore/storage/IDBSuccessEvent.h
new file mode 100644
index 0000000..5be660a
--- /dev/null
+++ b/WebCore/storage/IDBSuccessEvent.h
@@ -0,0 +1,62 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef IDBSuccessEvent_h
+#define IDBSuccessEvent_h
+
+#if ENABLE(INDEXED_DATABASE)
+
+#include "IDBEvent.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+class IDBAny;
+
+class IDBSuccessEvent : public IDBEvent {
+public:
+ static PassRefPtr<IDBSuccessEvent> create(PassRefPtr<IDBAny> source, PassRefPtr<IDBAny> result);
+ // FIXME: Need to allow creation of these events from JS.
+ virtual ~IDBSuccessEvent();
+
+ PassRefPtr<IDBAny> result();
+
+ virtual bool isIDBSuccessEvent() const { return true; }
+
+private:
+ IDBSuccessEvent(PassRefPtr<IDBAny> source, PassRefPtr<IDBAny> result);
+
+ RefPtr<IDBAny> m_result;
+};
+
+} // namespace WebCore
+
+#endif // ENABLE(INDEXED_DATABASE)
+
+#endif // IDBEvent_h
diff --git a/WebCore/storage/IDBSuccessEvent.idl b/WebCore/storage/IDBSuccessEvent.idl
new file mode 100644
index 0000000..b4ea7d2
--- /dev/null
+++ b/WebCore/storage/IDBSuccessEvent.idl
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module storage {
+
+ interface [
+ Conditional=INDEXED_DATABASE
+ ] IDBSuccessEvent : IDBEvent {
+ readonly attribute IDBAny result;
+ };
+}
diff --git a/WebCore/storage/IndexedDatabaseImpl.cpp b/WebCore/storage/IndexedDatabaseImpl.cpp
index 856433e..b3051c9 100644
--- a/WebCore/storage/IndexedDatabaseImpl.cpp
+++ b/WebCore/storage/IndexedDatabaseImpl.cpp
@@ -50,13 +50,13 @@
{
}
-void IndexedDatabaseImpl::open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks>, Frame*, ExceptionCode&)
+void IndexedDatabaseImpl::open(const String& name, const String& description, bool modifyDatabase, PassRefPtr<IDBCallbacks> callbacks, Frame*, ExceptionCode&)
{
+ // FIXME: Write for realz.
UNUSED_PARAM(name);
UNUSED_PARAM(description);
UNUSED_PARAM(modifyDatabase);
- // FIXME: Write.
- ASSERT_NOT_REACHED();
+ callbacks->onError(IDBDatabaseError::create(0, "Not implemented"));
}
} // namespace WebCore
diff --git a/WebCore/storage/IndexedDatabaseRequest.cpp b/WebCore/storage/IndexedDatabaseRequest.cpp
index 3747042..2210a8d 100644
--- a/WebCore/storage/IndexedDatabaseRequest.cpp
+++ b/WebCore/storage/IndexedDatabaseRequest.cpp
@@ -43,6 +43,8 @@
: m_indexedDatabase(indexedDatabase)
, m_frame(frame)
{
+ m_this = IDBAny::create();
+ m_this->set(this);
}
IndexedDatabaseRequest::~IndexedDatabaseRequest()
@@ -51,7 +53,7 @@
PassRefPtr<IDBRequest> IndexedDatabaseRequest::open(const String& name, const String& description, bool modifyDatabase, ExceptionCode& exception)
{
- RefPtr<IDBRequest> request = IDBRequest::create(m_frame->document());
+ RefPtr<IDBRequest> request = IDBRequest::create(m_frame->document(), m_this);
m_indexedDatabase->open(name, description, modifyDatabase, request, m_frame, exception);
return request;
}
diff --git a/WebCore/storage/IndexedDatabaseRequest.h b/WebCore/storage/IndexedDatabaseRequest.h
index be5e5c8..0b59790 100644
--- a/WebCore/storage/IndexedDatabaseRequest.h
+++ b/WebCore/storage/IndexedDatabaseRequest.h
@@ -39,8 +39,9 @@
namespace WebCore {
-class IndexedDatabase;
class Frame;
+class IDBAny;
+class IndexedDatabase;
class IndexedDatabaseRequest : public RefCounted<IndexedDatabaseRequest> {
public:
@@ -57,7 +58,8 @@
private:
IndexedDatabaseRequest(IndexedDatabase*, Frame*);
- PassRefPtr<IndexedDatabase> m_indexedDatabase;
+ RefPtr<IndexedDatabase> m_indexedDatabase;
+ RefPtr<IDBAny> m_this;
Frame* m_frame;
};