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

dumi at chromium.org dumi at chromium.org
Wed Dec 22 11:40:03 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 086b676d4cb14f2c414a35d1796526547f013c74
Author: dumi at chromium.org <dumi at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Aug 3 09:04:08 2010 +0000

    WebCore: Turn all callbacks into ActiveDOMObjects and create callbacks in the correct context.
    https://bugs.webkit.org/show_bug.cgi?id=40112
    
    Reviewed by Adam Barth.
    
    Test: http/tests/storage/callbacks-are-called-in-correct-context.html
    
    * CMakeLists.txt: Added new files.
    * DerivedSources.make:
    * GNUmakefile.am:
    * WebCore.gypi:
    * WebCore.pro:
    * WebCore.vcproj/WebCore.vcproj:
    * WebCore.xcodeproj/project.pbxproj:
    
    * bindings/generic/ActiveDOMCallback.cpp: Added. The base class
    for all callbacks, that behaves like an ActiveDOMObject.
    (WebCore::DestroyOnContextThreadTask::create):
    (WebCore::DestroyOnContextThreadTask::performTask):
    (WebCore::DestroyOnContextThreadTask::DestroyOnContextThreadTask):
    (WebCore::ActiveDOMObjectCallbackImpl::ActiveDOMObjectCallbackImpl):
    (WebCore::ActiveDOMObjectCallbackImpl::contextDestroyed):
    (WebCore::ActiveDOMObjectCallbackImpl::canSuspend):
    (WebCore::ActiveDOMObjectCallbackImpl::suspend):
    (WebCore::ActiveDOMObjectCallbackImpl::resume):
    (WebCore::ActiveDOMObjectCallbackImpl::stop):
    (WebCore::ActiveDOMObjectCallbackImpl::canInvokeCallback):
    (WebCore::ActiveDOMObjectCallbackImpl::scriptExecutionContext):
    (WebCore::ActiveDOMObjectCallbackImpl::mutex):
    (WebCore::destroyOnContextThread):
    (WebCore::ActiveDOMCallback::ActiveDOMCallback):
    (WebCore::ActiveDOMCallback::~ActiveDOMCallback):
    (WebCore::ActiveDOMCallback::canInvokeCallback):
    (WebCore::ActiveDOMCallback::scriptExecutionContext):
    * bindings/generic/ActiveDOMCallback.h: Added.
    
    * bindings/js/JSCustomSQLStatementErrorCallback.cpp: Pass the
    right ScriptExecutionContext to the JSC callbacks.
    (WebCore::JSSQLStatementErrorCallback::handleEvent):
    * bindings/js/JSSQLTransactionCustom.cpp:
    (WebCore::JSSQLTransaction::executeSql):
    
    * bindings/scripts/CodeGeneratorJS.pm: Make all callbacks inherit
    from ActiveDOMCallback, and make them use the right
    ScriptExecutionContext.
    * bindings/scripts/CodeGeneratorV8.pm:
    
    * bindings/scripts/test/JS/JSTestCallback.cpp: Update the
    expectations for the code generated by CodeGenerator{JS|V8}.pm.
    (WebCore::JSTestCallback::JSTestCallback):
    (WebCore::JSTestCallback::~JSTestCallback):
    (WebCore::JSTestCallback::callbackWithClass1Param):
    (WebCore::JSTestCallback::callbackWithClass2Param):
    * bindings/scripts/test/JS/JSTestCallback.h:
    * bindings/scripts/test/V8/V8TestCallback.cpp:
    (WebCore::V8TestCallback::V8TestCallback):
    (WebCore::V8TestCallback::callbackWithClass1Param):
    (WebCore::V8TestCallback::callbackWithClass2Param):
    * bindings/scripts/test/V8/V8TestCallback.h:
    (WebCore::V8TestCallback::create):
    * bindings/scripts/test/V8/V8TestObj.cpp:
    (WebCore::TestObjInternal::methodWithCallbackArgCallback):
    (WebCore::TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback):
    (WebCore::TestObjInternal::methodWithCallbackAndOptionalArgCallback):
    
    * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp: Pass
    the right ScriptExecutionContext to the V8 callbacks.
    (WebCore::V8SQLStatementErrorCallback::handleEvent):
    * bindings/v8/custom/V8DOMWindowCustom.cpp:
    (WebCore::V8DOMWindow::openDatabaseCallback):
    * bindings/v8/custom/V8DatabaseCustom.cpp:
    (WebCore::V8Database::changeVersionCallback):
    (WebCore::createTransaction):
    * bindings/v8/custom/V8DatabaseSyncCustom.cpp:
    (WebCore::V8DatabaseSync::changeVersionCallback):
    (WebCore::createTransaction):
    * bindings/v8/custom/V8SQLTransactionCustom.cpp:
    (WebCore::V8SQLTransaction::executeSqlCallback):
    * bindings/v8/custom/V8WorkerContextCustom.cpp:
    (WebCore::V8WorkerContext::openDatabaseCallback):
    (WebCore::V8WorkerContext::openDatabaseSyncCallback):
    
    * dom/ActiveDOMObject.cpp: Simplify the code.
    (WebCore::ActiveDOMObject::ActiveDOMObject):
    (WebCore::ActiveDOMObject::~ActiveDOMObject):
    
    * storage/Database.cpp: CallbackClass::handleEvent() doesn't take
    a ScriptExecutionContext anymore.
    (WebCore::DatabaseCreationCallbackTask::performTask):
    * storage/DatabaseCallback.h:
    * storage/DatabaseSync.cpp:
    (WebCore::DatabaseSync::openDatabaseSync):
    * storage/EntryCallback.h:
    * storage/ErrorCallback.h:
    * storage/FileSystemCallback.h:
    * storage/MetadataCallback.h:
    * storage/SQLStatement.cpp:
    (WebCore::SQLStatement::performCallback):
    * storage/SQLStatementCallback.h:
    * storage/SQLStatementErrorCallback.h:
    * storage/SQLTransaction.cpp:
    (WebCore::SQLTransaction::deliverTransactionCallback):
    (WebCore::SQLTransaction::deliverTransactionErrorCallback):
    * storage/SQLTransactionCallback.h:
    * storage/SQLTransactionErrorCallback.h:
    * storage/SQLTransactionSync.cpp:
    (WebCore::SQLTransactionSync::execute):
    * storage/SQLTransactionSyncCallback.h:
    
    LayoutTests: Make sure all DB callbacks run in the correct context.
    https://bugs.webkit.org/show_bug.cgi?id=40112
    
    Reviewed by Adam Barth.
    
    * http/tests/storage: Added.
    * http/tests/storage/callbacks-are-called-in-correct-context-expected.txt: Added.
    * http/tests/storage/callbacks-are-called-in-correct-context.html: Added.
    * http/tests/storage/resources: Added.
    * http/tests/storage/resources/callbacks-are-called-in-correct-context-first-frame.html: Added.
    * http/tests/storage/resources/callbacks-are-called-in-correct-context-output-frame.html: Added.
    * http/tests/storage/resources/callbacks-are-called-in-correct-context-second-frame.html: Added.
    * http/tests/storage/resources/callbacks-are-called-in-correct-context-third-frame.html: Added.
    * http/tests/storage/resources/callbacks-are-called-in-correct-context.cgi: Added.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64537 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 8574eb0..1fd12ff 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,20 @@
+2010-08-03  Dumitru Daniliuc  <dumi at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Make sure all DB callbacks run in the correct context.
+        https://bugs.webkit.org/show_bug.cgi?id=40112
+
+        * http/tests/storage: Added.
+        * http/tests/storage/callbacks-are-called-in-correct-context-expected.txt: Added.
+        * http/tests/storage/callbacks-are-called-in-correct-context.html: Added.
+        * http/tests/storage/resources: Added.
+        * http/tests/storage/resources/callbacks-are-called-in-correct-context-first-frame.html: Added.
+        * http/tests/storage/resources/callbacks-are-called-in-correct-context-output-frame.html: Added.
+        * http/tests/storage/resources/callbacks-are-called-in-correct-context-second-frame.html: Added.
+        * http/tests/storage/resources/callbacks-are-called-in-correct-context-third-frame.html: Added.
+        * http/tests/storage/resources/callbacks-are-called-in-correct-context.cgi: Added.
+
 2010-08-03  Kent Tamura  <tkent at chromium.org>
 
         Unreviewed, test expectation update for DRT/Chromium.
diff --git a/LayoutTests/http/tests/storage/callbacks-are-called-in-correct-context-expected.txt b/LayoutTests/http/tests/storage/callbacks-are-called-in-correct-context-expected.txt
new file mode 100644
index 0000000..36e1582
--- /dev/null
+++ b/LayoutTests/http/tests/storage/callbacks-are-called-in-correct-context-expected.txt
@@ -0,0 +1,52 @@
+
+
+--------
+Frame: 'outputFrame'
+--------
+This test tests that all DB callbacks are called in the context they were created, rather than the context where the DB handle was created.
+PASS: The transaction callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The statement success callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The statement error callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The transaction error callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The transaction success callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The transaction callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The statement success callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The statement error callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The transaction error callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The transaction success callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The transaction callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The statement success callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The statement error callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The transaction error callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+PASS: The transaction success callback was called in the correct context.
+Referrer: http://127.0.0.1:8000/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
+
+
+--------
+Frame: 'firstFrame'
+--------
+
+
+--------
+Frame: 'secondFrame'
+--------
+
+
+--------
+Frame: 'thirdFrame'
+--------
+
diff --git a/LayoutTests/http/tests/storage/callbacks-are-called-in-correct-context.html b/LayoutTests/http/tests/storage/callbacks-are-called-in-correct-context.html
new file mode 100644
index 0000000..4234487
--- /dev/null
+++ b/LayoutTests/http/tests/storage/callbacks-are-called-in-correct-context.html
@@ -0,0 +1,22 @@
+<html>
+<head>
+<script>
+function setupAndRunFramesTest()
+{
+    if (window.layoutTestController) {
+        layoutTestController.dumpAsText();
+        layoutTestController.dumpChildFramesAsText();
+        layoutTestController.waitUntilDone();
+    }
+    top.frames[0].document.getElementById("console").innerText = "";
+    top.frames[1].runTest();
+}
+</script>
+</head>
+<frameset onload="setupAndRunFramesTest()">
+<frame name="outputFrame" src="resources/callbacks-are-called-in-correct-context-output-frame.html">
+<frame name="firstFrame" src="resources/callbacks-are-called-in-correct-context-first-frame.html">
+<frame name="secondFrame" src="resources/callbacks-are-called-in-correct-context-second-frame.html">
+<frame name="thirdFrame" src="resources/callbacks-are-called-in-correct-context-third-frame.html">
+</frameset>
+</html>
diff --git a/LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context-first-frame.html b/LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context-first-frame.html
new file mode 100644
index 0000000..ae49535
--- /dev/null
+++ b/LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context-first-frame.html
@@ -0,0 +1,30 @@
+<html>
+<head>
+<script>
+var db = openDatabase("CallbacksAreCalledInCorrectContextWorkerTest", "1.0", "", 1);
+
+function printReferrer()
+{
+    var req = new XMLHttpRequest();
+    req.open("GET", "callbacks-are-called-in-correct-context.cgi", false);
+    req.send(null);
+    top.frames[0].document.getElementById("console").innerText += "Referrer: " + req.responseText;
+}
+
+function logCallback(callbackType)
+{
+    top.frames[0].document.getElementById("console").innerText += "FAIL: The " + callbackType + " callback was called in the wrong context.\n"
+    printReferrer();
+}
+
+function runTest()
+{
+    // test that transaction callbacks defined in another frame are executed in the context of that frame
+    db.transaction(top.frames[2].failingTransactionCallback, top.frames[2].errorTransactionCallback);
+    db.transaction(function(tx) { }, null, top.frames[2].successTransactionCallback);
+}
+</script>
+</head>
+<body>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context-output-frame.html b/LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context-output-frame.html
new file mode 100644
index 0000000..95321bc
--- /dev/null
+++ b/LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context-output-frame.html
@@ -0,0 +1,10 @@
+<html>
+<head>
+</head>
+<body>
+This test tests that all DB callbacks are called in the context they were created, rather than the context where the DB handle was created.
+<pre id="console">
+FAILURE: test didn't run.
+</pre>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context-second-frame.html b/LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
new file mode 100644
index 0000000..dfe318a
--- /dev/null
+++ b/LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context-second-frame.html
@@ -0,0 +1,73 @@
+<html>
+<head>
+<script>
+var frame = 1;
+
+function printReferrer()
+{
+    var req = new XMLHttpRequest();
+    req.open("GET", "callbacks-are-called-in-correct-context.cgi", false);
+    req.send(null);
+    top.frames[0].document.getElementById("console").innerText += "Referrer: " + req.responseText + "\n";
+}
+
+function logCallback(callbackType)
+{
+    top.frames[0].document.getElementById("console").innerText += "PASS: The " + callbackType + " callback was called in the correct context.\n"
+    printReferrer();
+}
+
+function failingTransactionCallback(tx)
+{
+    logCallback("transaction");
+    tx.executeSql("CREATE TABLE IF NOT EXISTS Test (Foo INT)", [], successStatementCallback, null);
+    tx.executeSql("BAD SQL STATEMENT", [], null, errorStatementCallback);
+}
+
+function errorStatementCallback(tx, error)
+{
+    logCallback("statement error");
+    return true; // fail the transaction
+}
+
+function successStatementCallback(tx, data)
+{
+    logCallback("statement success");
+}
+
+function errorTransactionCallback(error)
+{
+    logCallback("transaction error");
+}
+
+function successTransactionCallback()
+{
+    logCallback("transaction success");
+    frame++;
+    switch (frame) {
+        case 2:
+            runTestInSecondFrame();
+            return;
+        case 3:
+            top.frames[3].runTestInThirdFrame();
+            return;
+        case 4:
+            if (window.layoutTestController)
+                layoutTestController.notifyDone();
+            return;
+        default:
+            throw "Bad 'frame' value: " + frame;
+    }
+}
+
+function runTestInSecondFrame()
+{
+    // test that all callbacks are executed in this context, even though 'db' is defined in another context
+    top.frames[1].db.transaction(failingTransactionCallback, errorTransactionCallback);
+    top.frames[1].db.transaction(function(tx) { }, null, successTransactionCallback);
+}
+</script>
+</head>
+<body>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context-third-frame.html b/LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context-third-frame.html
new file mode 100644
index 0000000..1ac851f
--- /dev/null
+++ b/LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context-third-frame.html
@@ -0,0 +1,28 @@
+<html>
+<head>
+<script>
+function printReferrer()
+{
+    var req = new XMLHttpRequest();
+    req.open("GET", "callbacks-are-called-in-correct-context.cgi", false);
+    req.send(null);
+    top.frames[0].document.getElementById("console").innerText += "Referrer: " + req.responseText;
+}
+
+function logCallback(callbackType)
+{
+    top.frames[0].document.getElementById("console").innerText += "FAIL: The " + callbackType + " callback was called in the wrong context.\n"
+    printReferrer();
+}
+
+function runTestInThirdFrame()
+{
+    // test that transaction callbacks defined in another frame are executed in the context of that frame
+    top.frames[1].db.transaction(top.frames[2].failingTransactionCallback, top.frames[2].errorTransactionCallback);
+    top.frames[1].db.transaction(function(tx) { }, null, top.frames[2].successTransactionCallback);
+}
+</script>
+</head>
+<body>
+</body>
+</html>
diff --git a/LayoutTests/http/tests/xmlhttprequest/resources/print-referer.cgi b/LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context.cgi
similarity index 100%
copy from LayoutTests/http/tests/xmlhttprequest/resources/print-referer.cgi
copy to LayoutTests/http/tests/storage/resources/callbacks-are-called-in-correct-context.cgi
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index e0a64af..3010346 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -73,6 +73,7 @@ SET(WebCore_INCLUDE_DIRECTORIES
 )
 
 SET(WebCore_IDL_INCLUDES
+    bindings/generic
     bindings/js
     css
     dom
@@ -561,6 +562,7 @@ SET(WebCore_SOURCES
 
     bindings/ScriptControllerBase.cpp
 
+    bindings/generic/ActiveDOMCallback.cpp
     bindings/generic/RuntimeEnabledFeatures.cpp
 
     bindings/js/DOMObjectHashTableMap.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8c5c6ea..c9f7740 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,114 @@
+2010-08-03  Dumitru Daniliuc  <dumi at chromium.org>
+
+        Reviewed by Adam Barth.
+
+        Turn all callbacks into ActiveDOMObjects and create callbacks in the correct context.
+        https://bugs.webkit.org/show_bug.cgi?id=40112
+
+        Test: http/tests/storage/callbacks-are-called-in-correct-context.html
+
+        * CMakeLists.txt: Added new files.
+        * DerivedSources.make:
+        * GNUmakefile.am:
+        * WebCore.gypi:
+        * WebCore.pro:
+        * WebCore.vcproj/WebCore.vcproj:
+        * WebCore.xcodeproj/project.pbxproj:
+
+        * bindings/generic/ActiveDOMCallback.cpp: Added. The base class
+        for all callbacks, that behaves like an ActiveDOMObject.
+        (WebCore::DestroyOnContextThreadTask::create):
+        (WebCore::DestroyOnContextThreadTask::performTask):
+        (WebCore::DestroyOnContextThreadTask::DestroyOnContextThreadTask):
+        (WebCore::ActiveDOMObjectCallbackImpl::ActiveDOMObjectCallbackImpl):
+        (WebCore::ActiveDOMObjectCallbackImpl::contextDestroyed):
+        (WebCore::ActiveDOMObjectCallbackImpl::canSuspend):
+        (WebCore::ActiveDOMObjectCallbackImpl::suspend):
+        (WebCore::ActiveDOMObjectCallbackImpl::resume):
+        (WebCore::ActiveDOMObjectCallbackImpl::stop):
+        (WebCore::ActiveDOMObjectCallbackImpl::canInvokeCallback):
+        (WebCore::ActiveDOMObjectCallbackImpl::scriptExecutionContext):
+        (WebCore::ActiveDOMObjectCallbackImpl::mutex):
+        (WebCore::destroyOnContextThread):
+        (WebCore::ActiveDOMCallback::ActiveDOMCallback):
+        (WebCore::ActiveDOMCallback::~ActiveDOMCallback):
+        (WebCore::ActiveDOMCallback::canInvokeCallback):
+        (WebCore::ActiveDOMCallback::scriptExecutionContext):
+        * bindings/generic/ActiveDOMCallback.h: Added.
+
+        * bindings/js/JSCustomSQLStatementErrorCallback.cpp: Pass the
+        right ScriptExecutionContext to the JSC callbacks.
+        (WebCore::JSSQLStatementErrorCallback::handleEvent):
+        * bindings/js/JSSQLTransactionCustom.cpp:
+        (WebCore::JSSQLTransaction::executeSql):
+
+        * bindings/scripts/CodeGeneratorJS.pm: Make all callbacks inherit
+        from ActiveDOMCallback, and make them use the right
+        ScriptExecutionContext.
+        * bindings/scripts/CodeGeneratorV8.pm:
+
+        * bindings/scripts/test/JS/JSTestCallback.cpp: Update the
+        expectations for the code generated by CodeGenerator{JS|V8}.pm.
+        (WebCore::JSTestCallback::JSTestCallback):
+        (WebCore::JSTestCallback::~JSTestCallback):
+        (WebCore::JSTestCallback::callbackWithClass1Param):
+        (WebCore::JSTestCallback::callbackWithClass2Param):
+        * bindings/scripts/test/JS/JSTestCallback.h:
+        * bindings/scripts/test/V8/V8TestCallback.cpp:
+        (WebCore::V8TestCallback::V8TestCallback):
+        (WebCore::V8TestCallback::callbackWithClass1Param):
+        (WebCore::V8TestCallback::callbackWithClass2Param):
+        * bindings/scripts/test/V8/V8TestCallback.h:
+        (WebCore::V8TestCallback::create):
+        * bindings/scripts/test/V8/V8TestObj.cpp:
+        (WebCore::TestObjInternal::methodWithCallbackArgCallback):
+        (WebCore::TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback):
+        (WebCore::TestObjInternal::methodWithCallbackAndOptionalArgCallback):
+
+        * bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp: Pass
+        the right ScriptExecutionContext to the V8 callbacks.
+        (WebCore::V8SQLStatementErrorCallback::handleEvent):
+        * bindings/v8/custom/V8DOMWindowCustom.cpp:
+        (WebCore::V8DOMWindow::openDatabaseCallback):
+        * bindings/v8/custom/V8DatabaseCustom.cpp:
+        (WebCore::V8Database::changeVersionCallback):
+        (WebCore::createTransaction):
+        * bindings/v8/custom/V8DatabaseSyncCustom.cpp:
+        (WebCore::V8DatabaseSync::changeVersionCallback):
+        (WebCore::createTransaction):
+        * bindings/v8/custom/V8SQLTransactionCustom.cpp:
+        (WebCore::V8SQLTransaction::executeSqlCallback):
+        * bindings/v8/custom/V8WorkerContextCustom.cpp:
+        (WebCore::V8WorkerContext::openDatabaseCallback):
+        (WebCore::V8WorkerContext::openDatabaseSyncCallback):
+
+        * dom/ActiveDOMObject.cpp: Simplify the code.
+        (WebCore::ActiveDOMObject::ActiveDOMObject):
+        (WebCore::ActiveDOMObject::~ActiveDOMObject):
+
+        * storage/Database.cpp: CallbackClass::handleEvent() doesn't take
+        a ScriptExecutionContext anymore.
+        (WebCore::DatabaseCreationCallbackTask::performTask):
+        * storage/DatabaseCallback.h:
+        * storage/DatabaseSync.cpp:
+        (WebCore::DatabaseSync::openDatabaseSync):
+        * storage/EntryCallback.h:
+        * storage/ErrorCallback.h:
+        * storage/FileSystemCallback.h:
+        * storage/MetadataCallback.h:
+        * storage/SQLStatement.cpp:
+        (WebCore::SQLStatement::performCallback):
+        * storage/SQLStatementCallback.h:
+        * storage/SQLStatementErrorCallback.h:
+        * storage/SQLTransaction.cpp:
+        (WebCore::SQLTransaction::deliverTransactionCallback):
+        (WebCore::SQLTransaction::deliverTransactionErrorCallback):
+        * storage/SQLTransactionCallback.h:
+        * storage/SQLTransactionErrorCallback.h:
+        * storage/SQLTransactionSync.cpp:
+        (WebCore::SQLTransactionSync::execute):
+        * storage/SQLTransactionSyncCallback.h:
+
 2010-08-02  Ilya Tikhonovsky  <loislo at chromium.org>
 
         Reviewed by Yury Semikhatsky.
diff --git a/WebCore/DerivedSources.make b/WebCore/DerivedSources.make
index a6f0c2d..d8a2269 100644
--- a/WebCore/DerivedSources.make
+++ b/WebCore/DerivedSources.make
@@ -28,6 +28,7 @@
 
 VPATH = \
     $(WebCore) \
+    $(WebCore)/bindings/generic \
     $(WebCore)/bindings/js \
     $(WebCore)/bindings/objc \
     $(WebCore)/css \
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index 885bd6c..71b4cc8 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -617,6 +617,8 @@ webcore_sources += \
 	WebCore/accessibility/AccessibilityTableHeaderContainer.h \
 	WebCore/accessibility/AccessibilityTableRow.cpp \
 	WebCore/accessibility/AccessibilityTableRow.h \
+	WebCore/bindings/generic/ActiveDOMCallback.cpp \
+	WebCore/bindings/generic/ActiveDOMCallback.h \
 	WebCore/bindings/generic/RuntimeEnabledFeatures.cpp \
 	WebCore/bindings/generic/RuntimeEnabledFeatures.h \
 	WebCore/bindings/js/CachedScriptSourceProvider.h \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 20482bb..92c3c4e 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -498,6 +498,8 @@
             'accessibility/win/AccessibilityObjectWin.cpp',
             'accessibility/win/AccessibilityObjectWrapperWin.h',
             'accessibility/wx/AccessibilityObjectWx.cpp',
+            'bindings/generic/ActiveDOMCallback.cpp',
+            'bindings/generic/ActiveDOMCallback.h',
             'bindings/generic/BindingDOMWindow.h',
             'bindings/generic/BindingSecurity.h',
             'bindings/generic/BindingSecurityBase.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index 03af4df..54bd3a3 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -276,6 +276,7 @@ SOURCES += \
     accessibility/AccessibilityTableHeaderContainer.cpp \    
     accessibility/AccessibilityTableRow.cpp \    
     accessibility/AXObjectCache.cpp \
+    bindings/generic/ActiveDOMCallback.cpp \
     bindings/generic/RuntimeEnabledFeatures.cpp \
     bindings/js/GCController.cpp \
     bindings/js/DOMObjectHashTableMap.cpp \
@@ -1081,6 +1082,7 @@ HEADERS += \
     accessibility/AccessibilityTableRow.h \
     accessibility/AXObjectCache.h \
     bindings/ScriptControllerBase.h \
+    bindings/generic/ActiveDOMCallback.h \
     bindings/js/CachedScriptSourceProvider.h \
     bindings/js/GCController.h \
     bindings/js/DOMObjectHashTableMap.h \
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 32220a0..7b3b499 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -40844,6 +40844,18 @@
 				RelativePath="..\bindings\ScriptControllerBase.h"
 				>
 			</File>
+ 			<Filter
+				Name="generic"
+				>
+				<File
+					RelativePath="..\bindings\generic\ActiveDOMCallback.h"
+					>
+				</File>
+				<File
+					RelativePath="..\bindings\generic\ActiveDOMCallback.cpp"
+					>
+				</File>
+			</Filter>
 			<Filter
 				Name="generic"
 				>
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 853d1ca..68ccca7 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -4353,6 +4353,8 @@
 		B5B5DC6A119BB3D5002A8790 /* AbstractDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = B5B5DC68119BB3D5002A8790 /* AbstractDatabase.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		B5C1123B102B6C4600096578 /* SQLTransactionCoordinator.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */; };
 		B5C1123C102B6C4600096578 /* SQLTransactionCoordinator.h in Headers */ = {isa = PBXBuildFile; fileRef = B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */; };
+		B5D31DFA11CF610B009F22B4 /* ActiveDOMCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B5D31DF811CF610B009F22B4 /* ActiveDOMCallback.cpp */; };
+		B5D31DFB11CF610B009F22B4 /* ActiveDOMCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B5D31DF911CF610B009F22B4 /* ActiveDOMCallback.h */; };
 		B5D3601A112F8B560048DEA8 /* DatabaseCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B5D36019112F8B560048DEA8 /* DatabaseCallback.h */; };
 		B71FE6DF11091CB300DAEF77 /* PrintContext.h in Headers */ = {isa = PBXBuildFile; fileRef = B776D43A1104525D00BEB0EC /* PrintContext.h */; settings = {ATTRIBUTES = (Private, ); }; };
 		B734B181119B9911006587BD /* FontTranscoder.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B734B180119B9911006587BD /* FontTranscoder.cpp */; };
@@ -10017,6 +10019,8 @@
 		B5B5DC68119BB3D5002A8790 /* AbstractDatabase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractDatabase.h; sourceTree = "<group>"; };
 		B5C11239102B6C4600096578 /* SQLTransactionCoordinator.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SQLTransactionCoordinator.cpp; sourceTree = "<group>"; };
 		B5C1123A102B6C4600096578 /* SQLTransactionCoordinator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLTransactionCoordinator.h; sourceTree = "<group>"; };
+		B5D31DF811CF610B009F22B4 /* ActiveDOMCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ActiveDOMCallback.cpp; path = generic/ActiveDOMCallback.cpp; sourceTree = "<group>"; };
+		B5D31DF911CF610B009F22B4 /* ActiveDOMCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ActiveDOMCallback.h; path = generic/ActiveDOMCallback.h; sourceTree = "<group>"; };
 		B5D36019112F8B560048DEA8 /* DatabaseCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DatabaseCallback.h; sourceTree = "<group>"; };
 		B734B180119B9911006587BD /* FontTranscoder.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FontTranscoder.cpp; path = transcoder/FontTranscoder.cpp; sourceTree = "<group>"; };
 		B734B182119B991D006587BD /* FontTranscoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontTranscoder.h; path = transcoder/FontTranscoder.h; sourceTree = "<group>"; };
@@ -15712,6 +15716,15 @@
 			name = cf;
 			sourceTree = "<group>";
 		};
+		B5D31DF711CF60E5009F22B4 /* generic */ = {
+			isa = PBXGroup;
+			children = (
+				B5D31DF811CF610B009F22B4 /* ActiveDOMCallback.cpp */,
+				B5D31DF911CF610B009F22B4 /* ActiveDOMCallback.h */,
+			);
+			name = generic;
+			sourceTree = "<group>";
+		};
 		B734B17F119B98DB006587BD /* transcoder */ = {
 			isa = PBXGroup;
 			children = (
@@ -15724,6 +15737,7 @@
 		BC1A3790097C6F970019F3D8 /* bindings */ = {
 			isa = PBXGroup;
 			children = (
+				B5D31DF711CF60E5009F22B4 /* generic */,
 				BC1A3793097C6FB10019F3D8 /* js */,
 				BC1A3794097C6FC40019F3D8 /* objc */,
 				93F8B3050A300FE100F61AB8 /* CodeGenerator.pm */,
@@ -17330,6 +17344,7 @@
 				29A812410FBB9C1D00510293 /* AccessibilityTableColumn.h in Headers */,
 				29A8123F0FBB9C1D00510293 /* AccessibilityTableHeaderContainer.h in Headers */,
 				29A812310FBB9C1D00510293 /* AccessibilityTableRow.h in Headers */,
+				B5D31DFB11CF610B009F22B4 /* ActiveDOMCallback.h in Headers */,
 				E1C4DE690EA75C1E0023CCD6 /* ActiveDOMObject.h in Headers */,
 				84D0C4061115F1EA0018AA34 /* AffineTransform.h in Headers */,
 				49E912AB0EFAC906009D0CAF /* Animation.h in Headers */,
@@ -20289,6 +20304,7 @@
 				29A812350FBB9C1D00510293 /* AccessibilityTableColumn.cpp in Sources */,
 				29A812400FBB9C1D00510293 /* AccessibilityTableHeaderContainer.cpp in Sources */,
 				29A812290FBB9C1D00510293 /* AccessibilityTableRow.cpp in Sources */,
+				B5D31DFA11CF610B009F22B4 /* ActiveDOMCallback.cpp in Sources */,
 				E1C4DE6E0EA75C650023CCD6 /* ActiveDOMObject.cpp in Sources */,
 				84D0C4041115F1D40018AA34 /* AffineTransform.cpp in Sources */,
 				49E912AA0EFAC906009D0CAF /* Animation.cpp in Sources */,
diff --git a/WebCore/bindings/generic/ActiveDOMCallback.cpp b/WebCore/bindings/generic/ActiveDOMCallback.cpp
new file mode 100644
index 0000000..2e69d10
--- /dev/null
+++ b/WebCore/bindings/generic/ActiveDOMCallback.cpp
@@ -0,0 +1,144 @@
+/*
+ * 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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 "ActiveDOMCallback.h"
+
+#include "ActiveDOMObject.h"
+#include "ScriptExecutionContext.h"
+#include <wtf/PassOwnPtr.h>
+#include <wtf/ThreadingPrimitives.h>
+
+namespace WebCore {
+
+static void destroyOnContextThread(PassOwnPtr<ActiveDOMObjectCallbackImpl>);
+
+class DestroyOnContextThreadTask : public ScriptExecutionContext::Task {
+public:
+    static PassOwnPtr<DestroyOnContextThreadTask> create(PassOwnPtr<ActiveDOMObjectCallbackImpl> impl)
+    {
+        return adoptPtr(new DestroyOnContextThreadTask(impl));
+    }
+
+    virtual void performTask(ScriptExecutionContext*)
+    {
+        destroyOnContextThread(m_impl.release());
+    }
+
+private:
+    DestroyOnContextThreadTask(PassOwnPtr<ActiveDOMObjectCallbackImpl> impl)
+        : m_impl(impl)
+    {
+    }
+
+    OwnPtr<ActiveDOMObjectCallbackImpl> m_impl;
+};
+
+// Instances of this class are accessed only on the context thread, so we don't need to use locks.
+class ActiveDOMObjectCallbackImpl : public ActiveDOMObject {
+public:
+    ActiveDOMObjectCallbackImpl(ScriptExecutionContext* context)
+        : ActiveDOMObject(context, this)
+        , m_suspended(false)
+        , m_stopped(false)
+    {
+    }
+
+    virtual void contextDestroyed()
+    {
+        MutexLocker locker(m_mutex);
+        ActiveDOMObject::contextDestroyed();
+    }
+    virtual bool canSuspend() const { return false; }
+    virtual void suspend()
+    {
+        MutexLocker locker(m_mutex);
+        m_suspended = true;
+    }
+    virtual void resume()
+    {
+        MutexLocker locker(m_mutex);
+        m_suspended = false;
+    }
+    virtual void stop()
+    {
+        MutexLocker locker(m_mutex);
+        m_stopped = true;
+    }
+    bool canInvokeCallback()
+    {
+        MutexLocker locker(m_mutex);
+        return (!m_suspended && !m_stopped);
+    }
+    ScriptExecutionContext* scriptExecutionContext()
+    {
+        MutexLocker locker(m_mutex);
+        return ActiveDOMObject::scriptExecutionContext();
+    }
+    Mutex& mutex() { return m_mutex; }
+
+private:
+    Mutex m_mutex;
+    bool m_suspended;
+    bool m_stopped;
+};
+
+static void destroyOnContextThread(PassOwnPtr<ActiveDOMObjectCallbackImpl> impl)
+{
+    OwnPtr<ActiveDOMObjectCallbackImpl> implOwnPtr = impl;
+
+    ScriptExecutionContext* context = implOwnPtr->scriptExecutionContext();
+    MutexLocker locker(implOwnPtr->mutex());
+    if (context && !context->isContextThread())
+        context->postTask(DestroyOnContextThreadTask::create(implOwnPtr.release()));
+}
+
+ActiveDOMCallback::ActiveDOMCallback(ScriptExecutionContext* context)
+    : m_impl(new ActiveDOMObjectCallbackImpl(context))
+{
+    ASSERT(context->isContextThread());
+}
+
+ActiveDOMCallback::~ActiveDOMCallback()
+{
+    destroyOnContextThread(m_impl.release());
+}
+
+bool ActiveDOMCallback::canInvokeCallback() const
+{
+    return m_impl->canInvokeCallback();
+}
+
+ScriptExecutionContext* ActiveDOMCallback::scriptExecutionContext() const
+{
+    return m_impl->scriptExecutionContext();
+}
+
+} // namespace WebCore
diff --git a/WebCore/bindings/generic/ActiveDOMCallback.h b/WebCore/bindings/generic/ActiveDOMCallback.h
new file mode 100644
index 0000000..2fe99ab
--- /dev/null
+++ b/WebCore/bindings/generic/ActiveDOMCallback.h
@@ -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:
+ *
+ *     * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *     * 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.
+ *     * Neither the name of Google Inc. 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 THE COPYRIGHT HOLDERS AND 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 THE COPYRIGHT
+ * OWNER OR 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 ActiveDOMCallback_h
+#define ActiveDOMCallback_h
+
+#include <wtf/OwnPtr.h>
+
+namespace WebCore {
+
+class ActiveDOMObjectCallbackImpl;
+class ScriptExecutionContext;
+
+// A class that allows callbacks to behave like ActiveDOMObjects, and also
+// be destroyed on the context thread or any other thread.
+class ActiveDOMCallback {
+public:
+    ActiveDOMCallback(ScriptExecutionContext* context);
+    ~ActiveDOMCallback();
+
+    bool canInvokeCallback() const;
+    ScriptExecutionContext* scriptExecutionContext() const;
+
+private:
+    // The ActiveDOMObject part of the callback.
+    OwnPtr<ActiveDOMObjectCallbackImpl> m_impl;
+};
+
+} // namespace WebCore
+
+#endif // ActiveDOMCallback_h
diff --git a/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp b/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
index 3026a33..69c8865 100644
--- a/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
+++ b/WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp
@@ -31,7 +31,6 @@
 
 #if ENABLE(DATABASE)
 
-#include "Frame.h"
 #include "JSSQLError.h"
 #include "JSSQLTransaction.h"
 #include "ScriptExecutionContext.h"
@@ -41,22 +40,19 @@ namespace WebCore {
 
 using namespace JSC;
 
-bool JSSQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLError* error)
+bool JSSQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLError* error)
 {
-    ASSERT(m_data);
-    ASSERT(context);
+    if (!m_data || !m_data->globalObject() || !canInvokeCallback())
+        return true;
 
     RefPtr<JSSQLStatementErrorCallback> protect(this);
 
     JSC::JSLock lock(SilenceAssertionsOnly);
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get());
-    if (!globalObject)
-        return true; // if we cannot invoke the callback, roll back the transaction
 
-    ExecState* exec = globalObject->globalExec();
+    ExecState* exec = m_data->globalObject()->globalExec();
     MarkedArgumentBuffer args;
-    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), transaction));
-    args.append(toJS(exec, deprecatedGlobalObjectForPrototype(exec), error));
+    args.append(toJS(exec, transaction));
+    args.append(toJS(exec, error));
 
     bool raisedException = false;
     JSValue result = m_data->invokeCallback(args, &raisedException);
diff --git a/WebCore/bindings/js/JSSQLTransactionCustom.cpp b/WebCore/bindings/js/JSSQLTransactionCustom.cpp
index 44ebb02..e32ea55 100644
--- a/WebCore/bindings/js/JSSQLTransactionCustom.cpp
+++ b/WebCore/bindings/js/JSSQLTransactionCustom.cpp
@@ -95,7 +95,7 @@ JSValue JSSQLTransaction::executeSql(ExecState* exec)
             return jsUndefined();
         }
 
-        callback = JSSQLStatementCallback::create(object, static_cast<JSDOMGlobalObject*>(exec->dynamicGlobalObject()));
+        callback = JSSQLStatementCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
     }
 
     RefPtr<SQLStatementErrorCallback> errorCallback;
@@ -106,7 +106,7 @@ JSValue JSSQLTransaction::executeSql(ExecState* exec)
             return jsUndefined();
         }
 
-        errorCallback = JSSQLStatementErrorCallback::create(object, static_cast<JSDOMGlobalObject*>(exec->dynamicGlobalObject()));
+        errorCallback = JSSQLStatementErrorCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
     }
 
     ExceptionCode ec = 0;
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 247430f..0f1878f 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -2084,12 +2084,13 @@ sub GenerateCallbackHeader
     # - Add default header template and header protection
     push(@headerContentHeader, GenerateHeaderContentHeader($dataNode));
 
+    $headerIncludes{"ActiveDOMCallback.h"} = 1;
     $headerIncludes{"$interfaceName.h"} = 1;
     $headerIncludes{"JSCallbackData.h"} = 1;
     $headerIncludes{"<wtf/Forward.h>"} = 1;
 
     push(@headerContent, "\nnamespace WebCore {\n\n");
-    push(@headerContent, "class $className : public $interfaceName {\n");
+    push(@headerContent, "class $className : public $interfaceName, public ActiveDOMCallback {\n");
     push(@headerContent, "public:\n");
 
     # The static create() method.
@@ -2112,10 +2113,13 @@ sub GenerateCallbackHeader
                 push(@headerContent, "    COMPILE_ASSERT(false)");
             }
 
-            push(@headerContent, "    virtual " . GetNativeType($function->signature->type) . " " . $function->signature->name . "(ScriptExecutionContext*");
+            push(@headerContent, "    virtual " . GetNativeType($function->signature->type) . " " . $function->signature->name . "(");
+
+            my @args = ();
             foreach my $param (@params) {
-                push(@headerContent, ", " . GetNativeType($param->type) . " " . $param->name);
+                push(@args, GetNativeType($param->type) . " " . $param->name);
             }
+            push(@headerContent, join(", ", @args));
 
             push(@headerContent, ");\n");
         }
@@ -2128,8 +2132,6 @@ sub GenerateCallbackHeader
 
     # Private members
     push(@headerContent, "    JSCallbackData* m_data;\n");
-    push(@headerContent, "    RefPtr<DOMWrapperWorld> m_isolatedWorld;\n");
-    push(@headerContent, "    ScriptExecutionContext* m_scriptExecutionContext;\n");
     push(@headerContent, "};\n\n");
 
     push(@headerContent, "} // namespace WebCore\n\n");
@@ -2159,19 +2161,21 @@ sub GenerateCallbackImplementation
 
     # Constructor
     push(@implContent, "${className}::${className}(JSObject* callback, JSDOMGlobalObject* globalObject)\n");
-    push(@implContent, "    : m_data(new JSCallbackData(callback, globalObject))\n");
-    push(@implContent, "    , m_isolatedWorld(globalObject->world())\n");
-    push(@implContent, "    , m_scriptExecutionContext(globalObject->scriptExecutionContext())\n");
+    push(@implContent, "    : ActiveDOMCallback(globalObject->scriptExecutionContext())\n");
+    push(@implContent, "    , m_data(new JSCallbackData(callback, globalObject))\n");
     push(@implContent, "{\n");
     push(@implContent, "}\n\n");
 
     # Destructor
     push(@implContent, "${className}::~${className}()\n");
     push(@implContent, "{\n");
-    push(@implContent, "    if (m_scriptExecutionContext->isContextThread())\n");
+    push(@implContent, "    ScriptExecutionContext* context = scriptExecutionContext();\n");
+    push(@implContent, "    // When the context is destroyed, all tasks with a reference to a callback\n");
+    push(@implContent, "    // should be deleted. So if the context is NULL, we are on the context thread.\n");
+    push(@implContent, "    if (!context || context->isContextThread())\n");
     push(@implContent, "        delete m_data;\n");
     push(@implContent, "    else\n");
-    push(@implContent, "        m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data));\n");
+    push(@implContent, "        context->postTask(DeleteCallbackDataTask::create(m_data));\n");
     push(@implContent, "#ifndef NDEBUG\n");
     push(@implContent, "    m_data = 0;\n");
     push(@implContent, "#endif\n");
@@ -2189,24 +2193,22 @@ sub GenerateCallbackImplementation
             }
 
             AddIncludesForType($function->signature->type);
-            push(@implContent, "\n" . GetNativeType($function->signature->type) . " ${className}::" . $function->signature->name . "(ScriptExecutionContext* context");
+            push(@implContent, "\n" . GetNativeType($function->signature->type) . " ${className}::" . $function->signature->name . "(");
 
+            my @args = ();
             foreach my $param (@params) {
                 AddIncludesForType($param->type, 1);
-                push(@implContent, ", " . GetNativeType($param->type) . " " . $param->name);
+                push(@args, GetNativeType($param->type) . " " . $param->name);
             }
-
+            push(@implContent, join(", ", @args));
             push(@implContent, ")\n");
 
             push(@implContent, "{\n");
-            push(@implContent, "    ASSERT(m_data);\n");
-            push(@implContent, "    ASSERT(context);\n\n");
+            push(@implContent, "    if (!canInvokeCallback())\n");
+            push(@implContent, "        return true;\n\n");
             push(@implContent, "    RefPtr<$className> protect(this);\n\n");
             push(@implContent, "    JSLock lock(SilenceAssertionsOnly);\n\n");
-            push(@implContent, "    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get());\n");
-            push(@implContent, "    if (!globalObject)\n");
-            push(@implContent, "        return true;\n\n");
-            push(@implContent, "    ExecState* exec = globalObject->globalExec();\n");
+            push(@implContent, "    ExecState* exec = m_data->globalObject()->globalExec();\n");
             push(@implContent, "    MarkedArgumentBuffer args;\n");
 
             foreach my $param (@params) {
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index c852f7b..1b91470 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -1189,11 +1189,7 @@ END
             $implIncludes{"ExceptionCode.h"} = 1;
             push(@implContentDecls, "    if (args.Length() <= $paramIndex || !args[$paramIndex]->IsObject())\n");
             push(@implContentDecls, "        return throwError(TYPE_MISMATCH_ERR);\n");
-            if ($parameter->type eq "VoidCallback") {
-                push(@implContentDecls, "    RefPtr<" . $parameter->type . "> $parameterName = " . $className . "::create(args[$paramIndex], getScriptExecutionContext());\n");
-            } else {
-                push(@implContentDecls, "    RefPtr<" . $parameter->type . "> $parameterName = " . $className . "::create(args[$paramIndex]);\n");
-            }
+            push(@implContentDecls, "    RefPtr<" . $parameter->type . "> $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n");
             $paramIndex++;
             next;
         }
@@ -2129,25 +2125,25 @@ sub GenerateCallbackHeader
     # - Add default header template
     push(@headerContent, GenerateHeaderContentHeader($dataNode));
 
-    if ("$interfaceName.h" lt "WorldContextHandle.h") {
-        push(@headerContent, "#include \"$interfaceName.h\"\n");
-        push(@headerContent, "#include \"WorldContextHandle.h\"\n");
-    } else {
-        push(@headerContent, "#include \"WorldContextHandle.h\"\n");
-        push(@headerContent, "#include \"$interfaceName.h\"\n");
-    }
-    push(@headerContent, "#include <v8.h>\n");
-    push(@headerContent, "#include <wtf/Forward.h>\n");
+    my @unsortedIncludes = ();
+    push(@unsortedIncludes, "#include \"ActiveDOMCallback.h\"");
+    push(@unsortedIncludes, "#include \"$interfaceName.h\"");
+    push(@unsortedIncludes, "#include \"WorldContextHandle.h\"");
+    push(@unsortedIncludes, "#include <v8.h>");
+    push(@unsortedIncludes, "#include <wtf/Forward.h>");
+    push(@headerContent, join("\n", sort @unsortedIncludes));
     
-    push(@headerContent, "\nnamespace WebCore {\n\n");
-    push(@headerContent, "class $className : public $interfaceName {\n");
+    push(@headerContent, "\n\nnamespace WebCore {\n\n");
+    push(@headerContent, "class ScriptExecutionContext;\n\n");
+    push(@headerContent, "class $className : public $interfaceName, public ActiveDOMCallback {\n");
 
     push(@headerContent, <<END);
 public:
-    static PassRefPtr<${className}> create(v8::Local<v8::Value> value)
+    static PassRefPtr<${className}> create(v8::Local<v8::Value> value, ScriptExecutionContext* context)
     {
         ASSERT(value->IsObject());
-        return adoptRef(new ${className}(value->ToObject()));
+        ASSERT(context);
+        return adoptRef(new ${className}(value->ToObject(), context));
     }
 
     virtual ~${className}();
@@ -2165,11 +2161,13 @@ END
                     push(@headerContent, "    COMPILE_ASSERT(false)");
             }
 
-            push(@headerContent, "    virtual " . GetNativeTypeForCallbacks($function->signature->type) . " " . $function->signature->name . "(ScriptExecutionContext*");
+            push(@headerContent, "    virtual " . GetNativeTypeForCallbacks($function->signature->type) . " " . $function->signature->name . "(");
+
+            my @args = ();
             foreach my $param (@params) {
-                push(@headerContent, ", " . GetNativeTypeForCallbacks($param->type) . " " . $param->name);
+                push(@args, GetNativeTypeForCallbacks($param->type) . " " . $param->name);
             }
-
+            push(@headerContent, join(", ", @args));
             push(@headerContent, ");\n");
         }
     }
@@ -2177,7 +2175,7 @@ END
     push(@headerContent, <<END);
 
 private:
-    ${className}(v8::Local<v8::Object>);
+    ${className}(v8::Local<v8::Object>, ScriptExecutionContext*);
 
     v8::Persistent<v8::Object> m_callback;
     WorldContextHandle m_worldContext;
@@ -2209,8 +2207,9 @@ sub GenerateCallbackImplementation
     push(@implContent, "#include <wtf/Assertions.h>\n\n");
     push(@implContent, "namespace WebCore {\n\n");
     push(@implContent, <<END);
-${className}::${className}(v8::Local<v8::Object> callback)
-    : m_callback(v8::Persistent<v8::Object>::New(callback))
+${className}::${className}(v8::Local<v8::Object> callback, ScriptExecutionContext* context)
+    : ActiveDOMCallback(context)
+    , m_callback(v8::Persistent<v8::Object>::New(callback))
     , m_worldContext(UseCurrentWorld)
 {
 }
@@ -2234,22 +2233,26 @@ END
             }
 
             AddIncludesForType($function->signature->type);
-            push(@implContent, "\n" . GetNativeTypeForCallbacks($function->signature->type) . " ${className}::" . $function->signature->name . "(ScriptExecutionContext* context");
+            push(@implContent, "\n" . GetNativeTypeForCallbacks($function->signature->type) . " ${className}::" . $function->signature->name . "(");
 
+            my @args = ();
             foreach my $param (@params) {
                 AddIncludesForType($param->type);
-                push(@implContent, ", " . GetNativeTypeForCallbacks($param->type) . " " . $param->name);
+                push(@args, GetNativeTypeForCallbacks($param->type) . " " . $param->name);
             }
+            push(@implContent, join(", ", @args));
 
             push(@implContent, ")\n");
             push(@implContent, "{\n");
+            push(@implContent, "    if (!canInvokeCallback())\n");
+            push(@implContent, "        return true;\n\n");
             push(@implContent, "    v8::HandleScope handleScope;\n\n");
-            push(@implContent, "    v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);\n");
+            push(@implContent, "    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);\n");
             push(@implContent, "    if (v8Context.IsEmpty())\n");
             push(@implContent, "        return true;\n\n");
             push(@implContent, "    v8::Context::Scope scope(v8Context);\n\n");
 
-            my @argvs = ();
+            @args = ();
             foreach my $param (@params) {
                 my $paramName = $param->name;
                 push(@implContent, "    v8::Handle<v8::Value> ${paramName}Handle = toV8(${paramName});\n");
@@ -2257,14 +2260,14 @@ END
                 push(@implContent, "        CRASH();\n");
                 push(@implContent, "        return true;\n");
                 push(@implContent, "    }\n");
-                push(@argvs, "        ${paramName}Handle");
+                push(@args, "        ${paramName}Handle");
             }
 
             push(@implContent, "\n    v8::Handle<v8::Value> argv[] = {\n");
-            push(@implContent, join(",\n", @argvs));
+            push(@implContent, join(",\n", @args));
             push(@implContent, "\n    };\n\n");
             push(@implContent, "    bool callbackReturnValue = false;\n");
-            push(@implContent, "    return !invokeCallback(m_callback, " . scalar(@params) . ", argv, callbackReturnValue, context);\n");
+            push(@implContent, "    return !invokeCallback(m_callback, " . scalar(@params) . ", argv, callbackReturnValue, scriptExecutionContext());\n");
             push(@implContent, "}\n");
         }
     }
diff --git a/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp b/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp
index 6f6b568..3bf2a8b 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp
+++ b/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp
@@ -35,9 +35,8 @@ using namespace JSC;
 namespace WebCore {
 
 JSTestCallback::JSTestCallback(JSObject* callback, JSDOMGlobalObject* globalObject)
-    : m_data(new JSCallbackData(callback, globalObject))
-    , m_isolatedWorld(globalObject->world())
-    , m_scriptExecutionContext(globalObject->scriptExecutionContext())
+    : ActiveDOMCallback(globalObject->scriptExecutionContext())
+    , m_data(new JSCallbackData(callback, globalObject))
 {
 }
 
@@ -46,7 +45,7 @@ JSTestCallback::~JSTestCallback()
     if (m_scriptExecutionContext->isContextThread())
         delete m_data;
     else
-        m_scriptExecutionContext->postTask(DeleteCallbackDataTask::create(m_data));
+        m_data->globalObject()->scriptExecutionContext()->postTask(DeleteCallbackDataTask::create(m_data));
 #ifndef NDEBUG
     m_data = 0;
 #endif
@@ -54,20 +53,16 @@ JSTestCallback::~JSTestCallback()
 
 // Functions
 
-bool JSTestCallback::callbackWithClass1Param(ScriptExecutionContext* context, Class1* class1Param)
+bool JSTestCallback::callbackWithClass1Param(Class1* class1Param)
 {
-    ASSERT(m_data);
-    ASSERT(context);
+    if (!canInvokeCallback())
+        return true;
 
     RefPtr<JSTestCallback> protect(this);
 
     JSLock lock(SilenceAssertionsOnly);
 
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get());
-    if (!globalObject)
-        return true;
-
-    ExecState* exec = globalObject->globalExec();
+    ExecState* exec = m_data->globalObject()->globalExec();
     MarkedArgumentBuffer args;
     args.append(toJS(exec, class1Param));
 
@@ -76,20 +71,16 @@ bool JSTestCallback::callbackWithClass1Param(ScriptExecutionContext* context, Cl
     return !raisedException;
 }
 
-bool JSTestCallback::callbackWithClass2Param(ScriptExecutionContext* context, Class2* class2Param, const String& strArg)
+bool JSTestCallback::callbackWithClass2Param(Class2* class2Param, const String& strArg)
 {
-    ASSERT(m_data);
-    ASSERT(context);
+    if (!canInvokeCallback())
+        return true;
 
     RefPtr<JSTestCallback> protect(this);
 
     JSLock lock(SilenceAssertionsOnly);
 
-    JSDOMGlobalObject* globalObject = toJSDOMGlobalObject(context, m_isolatedWorld.get());
-    if (!globalObject)
-        return true;
-
-    ExecState* exec = globalObject->globalExec();
+    ExecState* exec = m_data->globalObject()->globalExec();
     MarkedArgumentBuffer args;
     args.append(toJS(exec, class2Param));
     args.append(jsString(exec, strArg));
diff --git a/WebCore/bindings/scripts/test/JS/JSTestCallback.h b/WebCore/bindings/scripts/test/JS/JSTestCallback.h
index 47a5e95..ae91a6c 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestCallback.h
+++ b/WebCore/bindings/scripts/test/JS/JSTestCallback.h
@@ -23,13 +23,14 @@
 
 #if ENABLE(DATABASE)
 
+#include "ActiveDOMCallback.h"
 #include "JSCallbackData.h"
 #include "TestCallback.h"
 #include <wtf/Forward.h>
 
 namespace WebCore {
 
-class JSTestCallback : public TestCallback {
+class JSTestCallback : public TestCallback, public ActiveDOMCallback {
 public:
     static PassRefPtr<JSTestCallback> create(JSC::JSObject* callback, JSDOMGlobalObject* globalObject)
     {
@@ -39,17 +40,15 @@ public:
     virtual ~JSTestCallback();
 
     // Functions
-    virtual bool callbackWithClass1Param(ScriptExecutionContext*, Class1* class1Param);
-    virtual bool callbackWithClass2Param(ScriptExecutionContext*, Class2* class2Param, const String& strArg);
-    COMPILE_ASSERT(false)    virtual int callbackWithNonBoolReturnType(ScriptExecutionContext*, Class3* class3Param);
-    virtual int customCallback(ScriptExecutionContext*, Class5* class5Param, Class6* class6Param);
+    virtual bool callbackWithClass1Param(Class1* class1Param);
+    virtual bool callbackWithClass2Param(Class2* class2Param, const String& strArg);
+    COMPILE_ASSERT(false)    virtual int callbackWithNonBoolReturnType(Class3* class3Param);
+    virtual int customCallback(Class5* class5Param, Class6* class6Param);
 
 private:
     JSTestCallback(JSC::JSObject* callback, JSDOMGlobalObject*);
 
     JSCallbackData* m_data;
-    RefPtr<DOMWrapperWorld> m_isolatedWorld;
-    ScriptExecutionContext* m_scriptExecutionContext;
 };
 
 } // namespace WebCore
diff --git a/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
index eff4ebd..c286c24 100644
--- a/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
+++ b/WebCore/bindings/scripts/test/V8/V8TestCallback.cpp
@@ -34,8 +34,9 @@
 
 namespace WebCore {
 
-V8TestCallback::V8TestCallback(v8::Local<v8::Object> callback)
-    : m_callback(v8::Persistent<v8::Object>::New(callback))
+V8TestCallback::V8TestCallback(v8::Local<v8::Object> callback, ScriptExecutionContext* context)
+    : ActiveDOMCallback(context)
+    , m_callback(v8::Persistent<v8::Object>::New(callback))
     , m_worldContext(UseCurrentWorld)
 {
 }
@@ -47,11 +48,14 @@ V8TestCallback::~V8TestCallback()
 
 // Functions
 
-bool V8TestCallback::callbackWithClass1Param(ScriptExecutionContext* context, Class1* class1Param)
+bool V8TestCallback::callbackWithClass1Param(Class1* class1Param)
 {
+    if (!canInvokeCallback())
+        return true;
+
     v8::HandleScope handleScope;
 
-    v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);
+    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
     if (v8Context.IsEmpty())
         return true;
 
@@ -68,14 +72,17 @@ bool V8TestCallback::callbackWithClass1Param(ScriptExecutionContext* context, Cl
     };
 
     bool callbackReturnValue = false;
-    return !invokeCallback(m_callback, 1, argv, callbackReturnValue, context);
+    return !invokeCallback(m_callback, 1, argv, callbackReturnValue, scriptExecutionContext());
 }
 
-bool V8TestCallback::callbackWithClass2Param(ScriptExecutionContext* context, Class2* class2Param, const String& strArg)
+bool V8TestCallback::callbackWithClass2Param(Class2* class2Param, const String& strArg)
 {
+    if (!canInvokeCallback())
+        return true;
+
     v8::HandleScope handleScope;
 
-    v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);
+    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
     if (v8Context.IsEmpty())
         return true;
 
@@ -98,7 +105,7 @@ bool V8TestCallback::callbackWithClass2Param(ScriptExecutionContext* context, Cl
     };
 
     bool callbackReturnValue = false;
-    return !invokeCallback(m_callback, 2, argv, callbackReturnValue, context);
+    return !invokeCallback(m_callback, 2, argv, callbackReturnValue, scriptExecutionContext());
 }
 
 } // namespace WebCore
diff --git a/WebCore/bindings/scripts/test/V8/V8TestCallback.h b/WebCore/bindings/scripts/test/V8/V8TestCallback.h
index aed6b22..a105d75 100644
--- a/WebCore/bindings/scripts/test/V8/V8TestCallback.h
+++ b/WebCore/bindings/scripts/test/V8/V8TestCallback.h
@@ -23,6 +23,7 @@
 #ifndef V8TestCallback_h
 #define V8TestCallback_h
 
+#include "ActiveDOMCallback.h"
 #include "TestCallback.h"
 #include "WorldContextHandle.h"
 #include <v8.h>
@@ -30,24 +31,27 @@
 
 namespace WebCore {
 
-class V8TestCallback : public TestCallback {
+class ScriptExecutionContext;
+
+class V8TestCallback : public TestCallback, public ActiveDOMCallback {
 public:
-    static PassRefPtr<V8TestCallback> create(v8::Local<v8::Value> value)
+    static PassRefPtr<V8TestCallback> create(v8::Local<v8::Value> value, ScriptExecutionContext* context)
     {
         ASSERT(value->IsObject());
-        return adoptRef(new V8TestCallback(value->ToObject()));
+        ASSERT(context);
+        return adoptRef(new V8TestCallback(value->ToObject(), context));
     }
 
     virtual ~V8TestCallback();
 
     // Functions
-    virtual bool callbackWithClass1Param(ScriptExecutionContext*, Class1* class1Param);
-    virtual bool callbackWithClass2Param(ScriptExecutionContext*, Class2* class2Param, const String& strArg);
-    COMPILE_ASSERT(false)    virtual int callbackWithNonBoolReturnType(ScriptExecutionContext*, Class3* class3Param);
-    virtual int customCallback(ScriptExecutionContext*, Class5* class5Param, Class6* class6Param);
+    virtual bool callbackWithClass1Param(Class1* class1Param);
+    virtual bool callbackWithClass2Param(Class2* class2Param, const String& strArg);
+    COMPILE_ASSERT(false)    virtual int callbackWithNonBoolReturnType(Class3* class3Param);
+    virtual int customCallback(Class5* class5Param, Class6* class6Param);
 
 private:
-    V8TestCallback(v8::Local<v8::Object>);
+    V8TestCallback(v8::Local<v8::Object>, ScriptExecutionContext*);
 
     v8::Persistent<v8::Object> m_callback;
     WorldContextHandle m_worldContext;
diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
index 5584eaf..72f3c5f 100644
--- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
+++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
@@ -901,7 +901,7 @@ static v8::Handle<v8::Value> methodWithCallbackArgCallback(const v8::Arguments&
     TestObj* imp = V8TestObj::toNative(args.Holder());
     if (args.Length() <= 0 || !args[0]->IsObject())
         return throwError(TYPE_MISMATCH_ERR);
-    RefPtr<TestCallback> callback = V8TestCallback::create(args[0]);
+    RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
     imp->methodWithCallbackArg(callback);
     return v8::Handle<v8::Value>();
 }
@@ -913,7 +913,7 @@ static v8::Handle<v8::Value> methodWithNonCallbackArgAndCallbackArgCallback(cons
     int nonCallback = toInt32(args[0]);
     if (args.Length() <= 1 || !args[1]->IsObject())
         return throwError(TYPE_MISMATCH_ERR);
-    RefPtr<TestCallback> callback = V8TestCallback::create(args[1]);
+    RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext());
     imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
     return v8::Handle<v8::Value>();
 }
@@ -928,7 +928,7 @@ static v8::Handle<v8::Value> methodWithCallbackAndOptionalArgCallback(const v8::
     }
     if (args.Length() <= 0 || !args[0]->IsObject())
         return throwError(TYPE_MISMATCH_ERR);
-    RefPtr<TestCallback> callback = V8TestCallback::create(args[0]);
+    RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
     imp->methodWithCallbackAndOptionalArg(callback);
     return v8::Handle<v8::Value>();
 }
diff --git a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
index 6603344..17fca22 100644
--- a/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
+++ b/WebCore/bindings/v8/custom/V8CustomSQLStatementErrorCallback.cpp
@@ -43,11 +43,14 @@
 
 namespace WebCore {
 
-bool V8SQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, SQLTransaction* transaction, SQLError* error)
+bool V8SQLStatementErrorCallback::handleEvent(SQLTransaction* transaction, SQLError* error)
 {
+    if (!canInvokeCallback())
+        return true;
+
     v8::HandleScope handleScope;
 
-    v8::Handle<v8::Context> v8Context = toV8Context(context, m_worldContext);
+    v8::Handle<v8::Context> v8Context = toV8Context(scriptExecutionContext(), m_worldContext);
     if (v8Context.IsEmpty())
         return true;
 
@@ -65,15 +68,12 @@ bool V8SQLStatementErrorCallback::handleEvent(ScriptExecutionContext* context, S
         errorHandle
     };
 
-    // Protect the context until the callback returns.
-    RefPtr<ScriptExecutionContext> protector(context);
-
     bool callbackReturnValue = false;
     // Step 6: If the error callback returns false, then move on to the next
     // statement, if any, or onto the next overall step otherwise. Otherwise,
     // the error callback did not return false, or there was no error callback.
     // Jump to the last step in the overall steps.
-    return invokeCallback(m_callback, 2, argv, callbackReturnValue, context) || callbackReturnValue;
+    return invokeCallback(m_callback, 2, argv, callbackReturnValue, scriptExecutionContext()) || callbackReturnValue;
 }
 
 } // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
index d1e0701..b4fa74f 100644
--- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
@@ -806,12 +806,13 @@ v8::Handle<v8::Value> V8DOMWindow::openDatabaseCallback(const v8::Arguments& arg
     if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
         return v8::Undefined();
 
+    ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
     RefPtr<DatabaseCallback> creationCallback;
     if (args.Length() >= 5) {
         if (!args[4]->IsObject())
             return throwError(TYPE_MISMATCH_ERR);
 
-        creationCallback = V8DatabaseCallback::create(args[4]);
+        creationCallback = V8DatabaseCallback::create(args[4], scriptExecutionContext);
     }
 
     ExceptionCode ec = 0;
diff --git a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
index 31406fb..f8ea40c 100644
--- a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
@@ -65,7 +65,7 @@ v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& arg
         if (!args[2]->IsObject())
             return throwError(TYPE_MISMATCH_ERR);
 
-        callback = V8SQLTransactionCallback::create(args[2]);
+        callback = V8SQLTransactionCallback::create(args[2], scriptExecutionContext);
     }
 
     RefPtr<V8SQLTransactionErrorCallback> errorCallback;
@@ -73,7 +73,7 @@ v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& arg
         if (!args[3]->IsObject())
             return throwError(TYPE_MISMATCH_ERR);
 
-        errorCallback = V8SQLTransactionErrorCallback::create(args[3]);
+        errorCallback = V8SQLTransactionErrorCallback::create(args[3], scriptExecutionContext);
     }
 
     RefPtr<V8CustomVoidCallback> successCallback;
@@ -102,14 +102,14 @@ static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool r
     ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
     if (!scriptExecutionContext)
         return v8::Undefined();
-    RefPtr<V8SQLTransactionCallback> callback = V8SQLTransactionCallback::create(args[0]);
+    RefPtr<V8SQLTransactionCallback> callback = V8SQLTransactionCallback::create(args[0], scriptExecutionContext);
 
     RefPtr<V8SQLTransactionErrorCallback> errorCallback;
     if (args.Length() > 1 && !isUndefinedOrNull(args[1])) {
         if (!args[1]->IsObject())
             return throwError(TYPE_MISMATCH_ERR);
 
-        errorCallback = V8SQLTransactionErrorCallback::create(args[1]);
+        errorCallback = V8SQLTransactionErrorCallback::create(args[1], scriptExecutionContext);
     }
 
     RefPtr<V8CustomVoidCallback> successCallback;
diff --git a/WebCore/bindings/v8/custom/V8DatabaseSyncCustom.cpp b/WebCore/bindings/v8/custom/V8DatabaseSyncCustom.cpp
index 079f6e9..af72053 100644
--- a/WebCore/bindings/v8/custom/V8DatabaseSyncCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DatabaseSyncCustom.cpp
@@ -54,12 +54,13 @@ v8::Handle<v8::Value> V8DatabaseSync::changeVersionCallback(const v8::Arguments&
 
     DatabaseSync* database = V8DatabaseSync::toNative(args.Holder());
 
+    ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
     RefPtr<V8SQLTransactionSyncCallback> callback;
     if (args.Length() > 2 && !isUndefinedOrNull(args[2])) {
         if (!args[2]->IsObject())
             return throwError(TYPE_MISMATCH_ERR);
 
-        callback = V8SQLTransactionSyncCallback::create(args[2]);
+        callback = V8SQLTransactionSyncCallback::create(args[2], scriptExecutionContext);
     }
 
     ExceptionCode ec = 0;
@@ -79,7 +80,8 @@ static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool r
 
     DatabaseSync* database = V8DatabaseSync::toNative(args.Holder());
 
-    RefPtr<V8SQLTransactionSyncCallback> callback = V8SQLTransactionSyncCallback::create(args[0]);
+    ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
+    RefPtr<V8SQLTransactionSyncCallback> callback = V8SQLTransactionSyncCallback::create(args[0], scriptExecutionContext);
 
     ExceptionCode ec = 0;
     database->transaction(callback.release(), readOnly, ec);
diff --git a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
index e2a5070..e74be26 100644
--- a/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
@@ -90,22 +90,22 @@ v8::Handle<v8::Value> V8SQLTransaction::executeSqlCallback(const v8::Arguments&
 
     SQLTransaction* transaction = V8SQLTransaction::toNative(args.Holder());
 
-    ScriptExecutionContext* executionContext = getScriptExecutionContext();
-    if (!executionContext)
+    ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
+    if (!scriptExecutionContext)
         return v8::Undefined();
 
     RefPtr<SQLStatementCallback> callback;
     if (args.Length() > 2 && !isUndefinedOrNull(args[2])) {
         if (!args[2]->IsObject())
             return throwError(TYPE_MISMATCH_ERR);
-        callback = V8SQLStatementCallback::create(args[2]);
+        callback = V8SQLStatementCallback::create(args[2], scriptExecutionContext);
     }
 
     RefPtr<SQLStatementErrorCallback> errorCallback;
     if (args.Length() > 3 && !isUndefinedOrNull(args[3])) {
         if (!args[3]->IsObject())
             return throwError(TYPE_MISMATCH_ERR);
-        errorCallback = V8SQLStatementErrorCallback::create(args[3]);
+        errorCallback = V8SQLStatementErrorCallback::create(args[3], scriptExecutionContext);
     }
 
     ExceptionCode ec = 0;
diff --git a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp b/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
index f66ff3d..7633a2a 100644
--- a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
@@ -157,12 +157,13 @@ v8::Handle<v8::Value> V8WorkerContext::openDatabaseCallback(const v8::Arguments&
 
     WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
 
+    ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
     RefPtr<DatabaseCallback> creationCallback;
     if (args.Length() >= 5) {
         if (!args[4]->IsObject())
             return throwError(TYPE_MISMATCH_ERR);
 
-        creationCallback = V8DatabaseCallback::create(args[4]);
+        creationCallback = V8DatabaseCallback::create(args[4], scriptExecutionContext);
     }
 
     ExceptionCode ec = 0;
@@ -185,12 +186,13 @@ v8::Handle<v8::Value> V8WorkerContext::openDatabaseSyncCallback(const v8::Argume
 
     WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder());
 
+    ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
     RefPtr<DatabaseCallback> creationCallback;
     if (args.Length() >= 5) {
         if (!args[4]->IsObject())
             return throwError(TYPE_MISMATCH_ERR);
 
-        creationCallback = V8DatabaseCallback::create(args[4]);
+        creationCallback = V8DatabaseCallback::create(args[4], scriptExecutionContext);
     }
 
     ExceptionCode ec = 0;
diff --git a/WebCore/dom/ActiveDOMObject.cpp b/WebCore/dom/ActiveDOMObject.cpp
index 9d36065..31afe98 100644
--- a/WebCore/dom/ActiveDOMObject.cpp
+++ b/WebCore/dom/ActiveDOMObject.cpp
@@ -37,22 +37,14 @@ ActiveDOMObject::ActiveDOMObject(ScriptExecutionContext* scriptExecutionContext,
     : m_scriptExecutionContext(scriptExecutionContext)
     , m_pendingActivityCount(0)
 {
-#if ENABLE(WORKERS)
-    ASSERT((m_scriptExecutionContext->isDocument() && isMainThread())
-        || (m_scriptExecutionContext->isWorkerContext() && currentThread() == static_cast<WorkerContext*>(m_scriptExecutionContext)->thread()->threadID()));
-#endif
-
+    ASSERT(m_scriptExecutionContext->isContextThread());
     m_scriptExecutionContext->createdActiveDOMObject(this, upcastPointer);
 }
 
 ActiveDOMObject::~ActiveDOMObject()
 {
     if (m_scriptExecutionContext) {
-#if ENABLE(WORKERS)
-        ASSERT((m_scriptExecutionContext->isDocument() && isMainThread())
-            || (m_scriptExecutionContext->isWorkerContext() && currentThread() == static_cast<WorkerContext*>(m_scriptExecutionContext)->thread()->threadID()));
-#endif
-
+        ASSERT(m_scriptExecutionContext->isContextThread());
         m_scriptExecutionContext->destroyedActiveDOMObject(this);
     }
 }
diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp
index 69f5036..ff59dee 100644
--- a/WebCore/storage/Database.cpp
+++ b/WebCore/storage/Database.cpp
@@ -68,9 +68,9 @@ public:
         return new DatabaseCreationCallbackTask(database, creationCallback);
     }
 
-    virtual void performTask(ScriptExecutionContext* context)
+    virtual void performTask(ScriptExecutionContext*)
     {
-        m_creationCallback->handleEvent(context, m_database.get());
+        m_creationCallback->handleEvent(m_database.get());
     }
 
 private:
diff --git a/WebCore/storage/DatabaseCallback.h b/WebCore/storage/DatabaseCallback.h
index 9ece2a3..8ad56ed 100644
--- a/WebCore/storage/DatabaseCallback.h
+++ b/WebCore/storage/DatabaseCallback.h
@@ -39,13 +39,12 @@ namespace WebCore {
 
 class Database;
 class DatabaseSync;
-class ScriptExecutionContext;
 
 class DatabaseCallback : public ThreadSafeShared<DatabaseCallback> {
 public:
     virtual ~DatabaseCallback() { }
-    virtual bool handleEvent(ScriptExecutionContext*, Database*) = 0;
-    virtual bool handleEvent(ScriptExecutionContext*, DatabaseSync*) = 0;
+    virtual bool handleEvent(Database*) = 0;
+    virtual bool handleEvent(DatabaseSync*) = 0;
 };
 
 }
diff --git a/WebCore/storage/DatabaseSync.cpp b/WebCore/storage/DatabaseSync.cpp
index f64c27f..4c940dd 100644
--- a/WebCore/storage/DatabaseSync.cpp
+++ b/WebCore/storage/DatabaseSync.cpp
@@ -68,7 +68,7 @@ PassRefPtr<DatabaseSync> DatabaseSync::openDatabaseSync(ScriptExecutionContext*
     if (database->isNew() && creationCallback.get()) {
         database->m_expectedVersion = "";
         LOG(StorageAPI, "Invoking the creation callback for database %p\n", database.get());
-        creationCallback->handleEvent(context, database.get());
+        creationCallback->handleEvent(database.get());
     }
 
     return database;
diff --git a/WebCore/storage/EntryCallback.h b/WebCore/storage/EntryCallback.h
index 58aa34a..121bf07 100644
--- a/WebCore/storage/EntryCallback.h
+++ b/WebCore/storage/EntryCallback.h
@@ -43,7 +43,7 @@ class ScriptExecutionContext;
 class EntryCallback : public RefCounted<EntryCallback> {
 public:
     virtual ~EntryCallback() { }
-    virtual bool handleEvent(ScriptExecutionContext*, Entry*) = 0;
+    virtual bool handleEvent(Entry*) = 0;
 };
 
 } // namespace
diff --git a/WebCore/storage/ErrorCallback.h b/WebCore/storage/ErrorCallback.h
index 8cddbc7..91143e8 100644
--- a/WebCore/storage/ErrorCallback.h
+++ b/WebCore/storage/ErrorCallback.h
@@ -43,7 +43,7 @@ class ScriptExecutionContext;
 class ErrorCallback : public RefCounted<ErrorCallback> {
 public:
     virtual ~ErrorCallback() { }
-    virtual bool handleEvent(ScriptExecutionContext*, FileError*) = 0;
+    virtual bool handleEvent(FileError*) = 0;
 };
 
 } // namespace
diff --git a/WebCore/storage/FileSystemCallback.h b/WebCore/storage/FileSystemCallback.h
index a3bf34d..19f44df 100644
--- a/WebCore/storage/FileSystemCallback.h
+++ b/WebCore/storage/FileSystemCallback.h
@@ -43,7 +43,7 @@ class ScriptExecutionContext;
 class FileSystemCallback : public RefCounted<FileSystemCallback> {
 public:
     virtual ~FileSystemCallback() { }
-    virtual bool handleEvent(ScriptExecutionContext*, DOMFileSystem*) = 0;
+    virtual bool handleEvent(DOMFileSystem*) = 0;
 };
 
 } // namespace
diff --git a/WebCore/storage/MetadataCallback.h b/WebCore/storage/MetadataCallback.h
index 96e4c91..3d57400 100644
--- a/WebCore/storage/MetadataCallback.h
+++ b/WebCore/storage/MetadataCallback.h
@@ -43,7 +43,7 @@ class ScriptExecutionContext;
 class MetadataCallback : public RefCounted<MetadataCallback> {
 public:
     virtual ~MetadataCallback() { }
-    virtual bool handleEvent(ScriptExecutionContext*, Metadata*) = 0;
+    virtual bool handleEvent(Metadata*) = 0;
 };
 
 } // namespace
diff --git a/WebCore/storage/SQLStatement.cpp b/WebCore/storage/SQLStatement.cpp
index 9dd249a..3973157 100644
--- a/WebCore/storage/SQLStatement.cpp
+++ b/WebCore/storage/SQLStatement.cpp
@@ -170,9 +170,9 @@ bool SQLStatement::performCallback(SQLTransaction* transaction)
     // because then we need to jump to the transaction error callback.
     if (m_error) {
         ASSERT(m_statementErrorCallback);
-        callbackError = m_statementErrorCallback->handleEvent(transaction->database()->scriptExecutionContext(), transaction, m_error.get());
+        callbackError = m_statementErrorCallback->handleEvent(transaction, m_error.get());
     } else if (m_statementCallback)
-        callbackError = !m_statementCallback->handleEvent(transaction->database()->scriptExecutionContext(), transaction, m_resultSet.get());
+        callbackError = !m_statementCallback->handleEvent(transaction, m_resultSet.get());
 
     // Now release our callbacks, to break reference cycles.
     m_statementCallback = 0;
diff --git a/WebCore/storage/SQLStatementCallback.h b/WebCore/storage/SQLStatementCallback.h
index 4bb2e06..f86e29f 100644
--- a/WebCore/storage/SQLStatementCallback.h
+++ b/WebCore/storage/SQLStatementCallback.h
@@ -34,14 +34,13 @@
 
 namespace WebCore {
 
-class ScriptExecutionContext;
 class SQLTransaction;
 class SQLResultSet;
 
 class SQLStatementCallback : public ThreadSafeShared<SQLStatementCallback> {
 public:
     virtual ~SQLStatementCallback() { }
-    virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLResultSet*) = 0;
+    virtual bool handleEvent(SQLTransaction*, SQLResultSet*) = 0;
 };
 
 }
diff --git a/WebCore/storage/SQLStatementErrorCallback.h b/WebCore/storage/SQLStatementErrorCallback.h
index 7c45afd..acb8f64 100644
--- a/WebCore/storage/SQLStatementErrorCallback.h
+++ b/WebCore/storage/SQLStatementErrorCallback.h
@@ -35,14 +35,13 @@
 
 namespace WebCore {
 
-class ScriptExecutionContext;
 class SQLTransaction;
 class SQLError;
 
 class SQLStatementErrorCallback : public ThreadSafeShared<SQLStatementErrorCallback> {
 public:
     virtual ~SQLStatementErrorCallback() { }
-    virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*, SQLError*) = 0;
+    virtual bool handleEvent(SQLTransaction*, SQLError*) = 0;
 };
 
 }
diff --git a/WebCore/storage/SQLTransaction.cpp b/WebCore/storage/SQLTransaction.cpp
index 454ea63..c9f6609 100644
--- a/WebCore/storage/SQLTransaction.cpp
+++ b/WebCore/storage/SQLTransaction.cpp
@@ -295,7 +295,7 @@ void SQLTransaction::deliverTransactionCallback()
 
     if (m_callback) {
         m_executeSqlAllowed = true;
-        shouldDeliverErrorCallback = !m_callback->handleEvent(m_database->scriptExecutionContext(), this);
+        shouldDeliverErrorCallback = !m_callback->handleEvent(this);
         m_executeSqlAllowed = false;
         m_callback = 0;
     }
@@ -553,7 +553,7 @@ void SQLTransaction::deliverTransactionErrorCallback()
     // Transaction Step 12 - If exists, invoke error callback with the last
     // error to have occurred in this transaction.
     if (m_errorCallback) {
-        m_errorCallback->handleEvent(m_database->scriptExecutionContext(), m_transactionError.get());
+        m_errorCallback->handleEvent(m_transactionError.get());
         m_errorCallback = 0;
     }
 
diff --git a/WebCore/storage/SQLTransactionCallback.h b/WebCore/storage/SQLTransactionCallback.h
index 73123ee..aff6233 100644
--- a/WebCore/storage/SQLTransactionCallback.h
+++ b/WebCore/storage/SQLTransactionCallback.h
@@ -35,13 +35,12 @@
 
 namespace WebCore {
 
-class ScriptExecutionContext;
 class SQLTransaction;
 
 class SQLTransactionCallback : public ThreadSafeShared<SQLTransactionCallback> {
 public:
     virtual ~SQLTransactionCallback() { }
-    virtual bool handleEvent(ScriptExecutionContext*, SQLTransaction*) = 0;
+    virtual bool handleEvent(SQLTransaction*) = 0;
 };
 
 }
diff --git a/WebCore/storage/SQLTransactionErrorCallback.h b/WebCore/storage/SQLTransactionErrorCallback.h
index 71580eb..4095d6a 100644
--- a/WebCore/storage/SQLTransactionErrorCallback.h
+++ b/WebCore/storage/SQLTransactionErrorCallback.h
@@ -35,13 +35,12 @@
 
 namespace WebCore {
 
-class ScriptExecutionContext;
 class SQLError;
 
 class SQLTransactionErrorCallback : public ThreadSafeShared<SQLTransactionErrorCallback> {
 public:
     virtual ~SQLTransactionErrorCallback() { }
-    virtual bool handleEvent(ScriptExecutionContext*, SQLError*) = 0;
+    virtual bool handleEvent(SQLError*) = 0;
 };
 
 }
diff --git a/WebCore/storage/SQLTransactionSync.cpp b/WebCore/storage/SQLTransactionSync.cpp
index 883721c..e56d7b4 100644
--- a/WebCore/storage/SQLTransactionSync.cpp
+++ b/WebCore/storage/SQLTransactionSync.cpp
@@ -150,7 +150,7 @@ ExceptionCode SQLTransactionSync::begin()
 ExceptionCode SQLTransactionSync::execute()
 {
     ASSERT(m_database->scriptExecutionContext()->isContextThread());
-    if (!m_database->opened() || (m_callback && !m_callback->handleEvent(m_database->scriptExecutionContext(), this))) {
+    if (!m_database->opened() || (m_callback && !m_callback->handleEvent(this))) {
         m_callback = 0;
         return SQLException::UNKNOWN_ERR;
     }
diff --git a/WebCore/storage/SQLTransactionSyncCallback.h b/WebCore/storage/SQLTransactionSyncCallback.h
index 557db86..f22e62f 100644
--- a/WebCore/storage/SQLTransactionSyncCallback.h
+++ b/WebCore/storage/SQLTransactionSyncCallback.h
@@ -37,14 +37,13 @@
 
 namespace WebCore {
 
-class ScriptExecutionContext;
 class SQLTransactionSync;
 
 // Instances of this class should be created and used only on the worker's context thread.
 class SQLTransactionSyncCallback : public RefCounted<SQLTransactionSyncCallback> {
 public:
     virtual ~SQLTransactionSyncCallback() { }
-    virtual bool handleEvent(ScriptExecutionContext*, SQLTransactionSync*) = 0;
+    virtual bool handleEvent(SQLTransactionSync*) = 0;
 };
 
 }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list