- Revision
- 131967
- Author
- [email protected]
- Date
- 2012-10-19 17:55:33 -0700 (Fri, 19 Oct 2012)
Log Message
IndexedDB: Hidden indexing events are visible to script via bubbling/capture
https://bugs.webkit.org/show_bug.cgi?id=96566
Reviewed by Tony Chang.
Source/WebCore:
Stop propagation of error events fired at internal indexing requests as a result of
aborting, as they should not be visible to scripts.
Test: storage/indexeddb/index-population.html
* Modules/indexeddb/IDBObjectStore.cpp:
(WebCore::IDBObjectStore::createIndex):
* Modules/indexeddb/IDBRequest.cpp:
(WebCore::IDBRequest::IDBRequest):
(WebCore::IDBRequest::dispatchEvent):
* Modules/indexeddb/IDBRequest.h:
(WebCore::IDBRequest::preventPropagation):
(IDBRequest):
LayoutTests:
Listen for unexpected events in both capture and bubble phases.
* storage/indexeddb/resources/index-population.js:
(deleteSuccess):
(doSetVersion1):
(setVersion2):
Modified Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (131966 => 131967)
--- trunk/LayoutTests/ChangeLog 2012-10-20 00:36:41 UTC (rev 131966)
+++ trunk/LayoutTests/ChangeLog 2012-10-20 00:55:33 UTC (rev 131967)
@@ -1,3 +1,17 @@
+2012-10-19 Joshua Bell <[email protected]>
+
+ IndexedDB: Hidden indexing events are visible to script via bubbling/capture
+ https://bugs.webkit.org/show_bug.cgi?id=96566
+
+ Reviewed by Tony Chang.
+
+ Listen for unexpected events in both capture and bubble phases.
+
+ * storage/indexeddb/resources/index-population.js:
+ (deleteSuccess):
+ (doSetVersion1):
+ (setVersion2):
+
2012-10-19 Simon Fraser <[email protected]>
Fix a hang when combining tile cache layers with preserve-3d or reflections
Modified: trunk/LayoutTests/storage/indexeddb/resources/index-population.js (131966 => 131967)
--- trunk/LayoutTests/storage/indexeddb/resources/index-population.js 2012-10-20 00:36:41 UTC (rev 131966)
+++ trunk/LayoutTests/storage/indexeddb/resources/index-population.js 2012-10-20 00:55:33 UTC (rev 131967)
@@ -18,6 +18,7 @@
{
request = evalAndLog("indexedDB.open('index-population')");
request._onsuccess_ = doSetVersion1;
+ request._onblocked_ = unexpectedBlockedCallback;
request._onerror_ = unexpectedErrorCallback;
}
@@ -28,6 +29,7 @@
self.db = evalAndLog("db = event.target.result");
request = evalAndLog("request = db.setVersion('version 1')");
request._onsuccess_ = setVersion1;
+ request._onblocked_ = unexpectedBlockedCallback;
request._onerror_ = unexpectedErrorCallback;
}
@@ -69,6 +71,13 @@
transaction2 = evalAndLog("transaction = request.result");
transaction2._onabort_ = setVersion2Abort;
transaction2._oncomplete_ = unexpectedCompleteCallback;
+
+ var capturePhase = true;
+ transaction2.addEventListener("error", unexpectedErrorCallback, !capturePhase);
+ transaction2.addEventListener("error", unexpectedErrorCallback, capturePhase);
+ db.addEventListener("error", unexpectedErrorCallback, !capturePhase);
+ db.addEventListener("error", unexpectedErrorCallback, capturePhase);
+
store = evalAndLog("store = db.createObjectStore('store2')");
evalAndLog("store.put({data: 'a', indexKey: 10}, 1)");
evalAndLog("store.put({data: 'b', indexKey: 20}, 2)");
Modified: trunk/Source/WebCore/ChangeLog (131966 => 131967)
--- trunk/Source/WebCore/ChangeLog 2012-10-20 00:36:41 UTC (rev 131966)
+++ trunk/Source/WebCore/ChangeLog 2012-10-20 00:55:33 UTC (rev 131967)
@@ -1,3 +1,24 @@
+2012-10-19 Joshua Bell <[email protected]>
+
+ IndexedDB: Hidden indexing events are visible to script via bubbling/capture
+ https://bugs.webkit.org/show_bug.cgi?id=96566
+
+ Reviewed by Tony Chang.
+
+ Stop propagation of error events fired at internal indexing requests as a result of
+ aborting, as they should not be visible to scripts.
+
+ Test: storage/indexeddb/index-population.html
+
+ * Modules/indexeddb/IDBObjectStore.cpp:
+ (WebCore::IDBObjectStore::createIndex):
+ * Modules/indexeddb/IDBRequest.cpp:
+ (WebCore::IDBRequest::IDBRequest):
+ (WebCore::IDBRequest::dispatchEvent):
+ * Modules/indexeddb/IDBRequest.h:
+ (WebCore::IDBRequest::preventPropagation):
+ (IDBRequest):
+
2012-10-19 Simon Fraser <[email protected]>
Remove .get() calls in assertions as suggested by Darin Adler.
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp (131966 => 131967)
--- trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp 2012-10-20 00:36:41 UTC (rev 131966)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBObjectStore.cpp 2012-10-20 00:55:33 UTC (rev 131967)
@@ -422,6 +422,7 @@
ASSERT(!ec);
if (ec)
return 0;
+ indexRequest->preventPropagation();
// This is kept alive by being the success handler of the request, which is in turn kept alive by the owning transaction.
RefPtr<IndexPopulator> indexPopulator = IndexPopulator::create(m_backend, m_transaction->backend(), indexRequest, metadata);
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp (131966 => 131967)
--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp 2012-10-20 00:36:41 UTC (rev 131966)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.cpp 2012-10-20 00:55:33 UTC (rev 131967)
@@ -75,6 +75,7 @@
, m_cursorFinished(false)
, m_pendingCursor(0)
, m_didFireUpgradeNeededEvent(false)
+ , m_preventPropagation(false)
{
if (m_transaction) {
m_transaction->registerRequest(this);
@@ -458,7 +459,7 @@
Vector<RefPtr<EventTarget> > targets;
targets.append(this);
- if (m_transaction) {
+ if (m_transaction && !m_preventPropagation) {
targets.append(m_transaction);
// If there ever are events that are associated with a database but
// that do not have a transaction, then this will not work and we need
Modified: trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h (131966 => 131967)
--- trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h 2012-10-20 00:36:41 UTC (rev 131966)
+++ trunk/Source/WebCore/Modules/indexeddb/IDBRequest.h 2012-10-20 00:55:33 UTC (rev 131967)
@@ -61,6 +61,7 @@
String webkitErrorMessage(ExceptionCode&) const;
PassRefPtr<IDBAny> source() const;
PassRefPtr<IDBTransaction> transaction() const;
+ void preventPropagation() { m_preventPropagation = true; }
// Defined in the IDL
enum ReadyState {
@@ -151,6 +152,7 @@
RefPtr<IDBKey> m_cursorPrimaryKey;
ScriptValue m_cursorValue;
bool m_didFireUpgradeNeededEvent;
+ bool m_preventPropagation;
EventTargetData m_eventTargetData;
};