[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc
pfeldman at chromium.org
pfeldman at chromium.org
Wed Dec 22 11:46:36 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 4106775a1f7d17779e6b15f80b48bad4d01362c4
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Aug 6 12:59:31 2010 +0000
2010-08-06 Pavel Feldman <pfeldman at chromium.org>
Not reviewed. Rolling out 64835, 64836 and 64839.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64840 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 75a5f10..8e74885 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,11 @@
+2010-08-06 Pavel Feldman <pfeldman at chromium.org>
+
+ Not reviewed. Rolling out 64835, 64836 and 64839.
+
+ * fast/workers/storage/open-database-inputs-sync-expected.txt:
+ * fast/workers/storage/resources/open-database-inputs-sync.js:
+ * storage/null-callbacks.html:
+
2010-08-06 Adam Barth <abarth at webkit.org>
Reviewed by Darin Adler.
diff --git a/LayoutTests/fast/workers/storage/open-database-inputs-sync-expected.txt b/LayoutTests/fast/workers/storage/open-database-inputs-sync-expected.txt
index a1f80c5..866c846 100644
--- a/LayoutTests/fast/workers/storage/open-database-inputs-sync-expected.txt
+++ b/LayoutTests/fast/workers/storage/open-database-inputs-sync-expected.txt
@@ -1,10 +1,10 @@
This test makes sure that openDatabaseSync() accepts only valid parameters.
-PASS: TYPE_MISMATCH_ERR: DOM Exception 17
-PASS: TYPE_MISMATCH_ERR: DOM Exception 17
+PASS: SYNTAX_ERR: DOM Exception 12
+PASS: SYNTAX_ERR: DOM Exception 12
PASS: undefined
PASS: undefined
PASS: undefined
-PASS: calling openDatabaseSync() with a null creation callback succeeded.
+PASS: TYPE_MISMATCH_ERR: DOM Exception 17
PASS: openDatabaseSync() succeeded.
PASS: openDatabaseSync() succeeded.
PASS: calling openDatabaseSync() with a creation callback succeeded.
diff --git a/LayoutTests/fast/workers/storage/resources/open-database-inputs-sync.js b/LayoutTests/fast/workers/storage/resources/open-database-inputs-sync.js
index 18e7ec2..1e0495a 100644
--- a/LayoutTests/fast/workers/storage/resources/open-database-inputs-sync.js
+++ b/LayoutTests/fast/workers/storage/resources/open-database-inputs-sync.js
@@ -41,9 +41,9 @@ try {
try {
db = openDatabaseSync("DBName", "DBVersion", "DBDescription", 1024, 0);
- postMessage("PASS: calling openDatabaseSync() with a null creation callback succeeded.");
+ postMessage("FAIL: the fifth argument to openDatabaseSync() must be an object, if present.");
} catch (err) {
- postMessage("FAIL: " + err.message);
+ postMessage("PASS: " + err.message);
}
try {
diff --git a/LayoutTests/storage/null-callbacks.html b/LayoutTests/storage/null-callbacks.html
index 01257a4..4ca0e1c 100644
--- a/LayoutTests/storage/null-callbacks.html
+++ b/LayoutTests/storage/null-callbacks.html
@@ -30,7 +30,7 @@ function runTest()
tx.executeSql("INSERT INTO Test VALUES (?)", [5]);
}, null, function() { finishTest(); });
} catch(err) {
- document.getElementById("console").innerHTML = "FAIL: " + err.message;
+ document.getElementById("console").innerHTML = "FAIL";
finishTest();
}
}
diff --git a/WebCore/Android.jscbindings.mk b/WebCore/Android.jscbindings.mk
index 2452557..01b5a16 100644
--- a/WebCore/Android.jscbindings.mk
+++ b/WebCore/Android.jscbindings.mk
@@ -90,6 +90,7 @@ LOCAL_SRC_FILES += \
bindings/js/JSDatabaseCallback.cpp \
bindings/js/JSDataGridColumnListCustom.cpp \
bindings/js/JSDataGridDataSource.cpp \
+ bindings/js/JSDatabaseCustom.cpp \
bindings/js/JSDedicatedWorkerContextCustom.cpp \
bindings/js/JSDesktopNotificationsCustom.cpp \
bindings/js/JSDeviceOrientationEventCustom.cpp \
diff --git a/WebCore/Android.v8bindings.mk b/WebCore/Android.v8bindings.mk
index 871be3e..b36beab 100644
--- a/WebCore/Android.v8bindings.mk
+++ b/WebCore/Android.v8bindings.mk
@@ -106,6 +106,7 @@ LOCAL_SRC_FILES += \
bindings/v8/custom/V8DOMWindowCustom.cpp \
bindings/v8/custom/V8DataGridColumnListCustom.cpp \
bindings/v8/custom/V8DatabaseCallback.cpp \
+ bindings/v8/custom/V8DatabaseCustom.cpp \
bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp \
bindings/v8/custom/V8DeviceOrientationEventCustom.cpp \
bindings/v8/custom/V8DocumentCustom.cpp \
diff --git a/WebCore/CMakeLists.txt b/WebCore/CMakeLists.txt
index 2de00e1..bf1a052 100644
--- a/WebCore/CMakeLists.txt
+++ b/WebCore/CMakeLists.txt
@@ -589,6 +589,9 @@ SET(WebCore_SOURCES
bindings/js/JSCustomSQLStatementErrorCallback.cpp
bindings/js/JSCustomVoidCallback.cpp
bindings/js/JSCustomXPathNSResolver.cpp
+ bindings/js/JSDatabaseCustom.cpp
+ bindings/js/JSDatabaseCustom.cpp
+ bindings/js/JSDatabaseSyncCustom.cpp
bindings/js/JSDataGridColumnListCustom.cpp
bindings/js/JSDataGridDataSource.cpp
bindings/js/JSDebugWrapperSet.cpp
diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index e301e38..c1f2265 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,114 @@
+2010-08-06 Pavel Feldman <pfeldman at chromium.org>
+
+ Not reviewed. Rolling out 64835, 64836 and 64839.
+
+ * Android.jscbindings.mk:
+ * Android.v8bindings.mk:
+ * CMakeLists.txt:
+ * GNUmakefile.am:
+ * WebCore.gypi:
+ * WebCore.pro:
+ * WebCore.vcproj/WebCore.vcproj:
+ * WebCore.xcodeproj/project.pbxproj:
+ * bindings/js/JSBindingsAllInOne.cpp:
+ * bindings/js/JSDOMWindowCustom.cpp:
+ (WebCore::JSDOMWindow::openDatabase):
+ * bindings/js/JSDatabaseCustom.cpp: Added.
+ (WebCore::JSDatabase::changeVersion):
+ (WebCore::createTransaction):
+ (WebCore::JSDatabase::transaction):
+ (WebCore::JSDatabase::readTransaction):
+ * bindings/js/JSDatabaseSyncCustom.cpp: Added.
+ (WebCore::JSDatabaseSync::changeVersion):
+ (WebCore::createTransaction):
+ (WebCore::JSDatabaseSync::transaction):
+ (WebCore::JSDatabaseSync::readTransaction):
+ * bindings/js/JSWorkerContextCustom.cpp:
+ (WebCore::JSWorkerContext::openDatabase):
+ (WebCore::JSWorkerContext::openDatabaseSync):
+ * bindings/scripts/CodeGeneratorGObject.pm:
+ * bindings/scripts/CodeGeneratorJS.pm:
+ * bindings/scripts/CodeGeneratorV8.pm:
+ * bindings/scripts/test/JS/JSTestCallback.cpp:
+ (WebCore::JSTestCallback::~JSTestCallback):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
+ (WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs):
+ (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
+ (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgs):
+ (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
+ (WebCore::jsTestObjPrototypeFunctionSerializedValue):
+ (WebCore::jsTestObjPrototypeFunctionIdbKey):
+ (WebCore::jsTestObjPrototypeFunctionCustomArgsAndException):
+ (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndArg):
+ (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg):
+ (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture):
+ (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg):
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3):
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
+ * bindings/scripts/test/TestObj.idl:
+ * bindings/scripts/test/V8/V8TestObj.cpp:
+ (WebCore::TestObjInternal::voidMethodWithArgsCallback):
+ (WebCore::TestObjInternal::intMethodWithArgsCallback):
+ (WebCore::TestObjInternal::objMethodWithArgsCallback):
+ (WebCore::TestObjInternal::methodThatRequiresAllArgsCallback):
+ (WebCore::TestObjInternal::methodThatRequiresAllArgsAndThrowsCallback):
+ (WebCore::TestObjInternal::serializedValueCallback):
+ (WebCore::TestObjInternal::idbKeyCallback):
+ (WebCore::TestObjInternal::customArgsAndExceptionCallback):
+ (WebCore::TestObjInternal::withDynamicFrameAndArgCallback):
+ (WebCore::TestObjInternal::withDynamicFrameAndOptionalArgCallback):
+ (WebCore::TestObjInternal::withDynamicFrameAndUserGestureCallback):
+ (WebCore::TestObjInternal::withDynamicFrameAndUserGestureASADCallback):
+ (WebCore::TestObjInternal::methodWithOptionalArgCallback):
+ (WebCore::TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback):
+ (WebCore::TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback):
+ (WebCore::TestObjInternal::methodWithCallbackArgCallback):
+ (WebCore::TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback):
+ (WebCore::TestObjInternal::methodWithCallbackAndOptionalArgCallback):
+ (WebCore::TestObjInternal::overloadedMethod1Callback):
+ (WebCore::TestObjInternal::overloadedMethod2Callback):
+ (WebCore::TestObjInternal::overloadedMethod3Callback):
+ (WebCore::TestObjInternal::overloadedMethod4Callback):
+ (WebCore::):
+ (WebCore::ConfigureV8TestObjTemplate):
+ * bindings/v8/V8Binding.h:
+ (WebCore::String):
+ (WebCore::AtomicString):
+ * bindings/v8/custom/V8DOMWindowCustom.cpp:
+ (WebCore::V8DOMWindow::openDatabaseCallback):
+ * bindings/v8/custom/V8DatabaseCustom.cpp: Added.
+ (WebCore::V8Database::changeVersionCallback):
+ (WebCore::createTransaction):
+ (WebCore::V8Database::transactionCallback):
+ (WebCore::V8Database::readTransactionCallback):
+ * bindings/v8/custom/V8DatabaseSyncCustom.cpp: Added.
+ (WebCore::V8DatabaseSync::changeVersionCallback):
+ (WebCore::createTransaction):
+ (WebCore::V8DatabaseSync::transactionCallback):
+ (WebCore::V8DatabaseSync::readTransactionCallback):
+ * bindings/v8/custom/V8WorkerContextCustom.cpp:
+ (WebCore::V8WorkerContext::openDatabaseCallback):
+ (WebCore::V8WorkerContext::openDatabaseSyncCallback):
+ * page/DOMWindow.idl:
+ * storage/Database.cpp:
+ (WebCore::Database::transaction):
+ * storage/Database.h:
+ * storage/Database.idl:
+ * storage/DatabaseSync.cpp:
+ (WebCore::DatabaseSync::transaction):
+ * storage/DatabaseSync.h:
+ * storage/DatabaseSync.idl:
+ * workers/WorkerContext.idl:
+
2010-08-06 Dumitru Daniliuc <dumi at chromium.org>
Unreviewed, fix the "GTK Linux 64-bit Debug" bot.
diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am
index fa338e3..b2a3e53 100644
--- a/WebCore/GNUmakefile.am
+++ b/WebCore/GNUmakefile.am
@@ -2727,6 +2727,8 @@ webcore_built_sources += \
webcore_sources += \
WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp \
+ WebCore/bindings/js/JSDatabaseCustom.cpp \
+ WebCore/bindings/js/JSDatabaseSyncCustom.cpp \
WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp \
WebCore/bindings/js/JSSQLTransactionCustom.cpp \
WebCore/bindings/js/JSSQLTransactionSyncCustom.cpp \
diff --git a/WebCore/WebCore.gypi b/WebCore/WebCore.gypi
index 607926a..4e35085 100644
--- a/WebCore/WebCore.gypi
+++ b/WebCore/WebCore.gypi
@@ -542,6 +542,8 @@
'bindings/js/JSCustomVoidCallback.h',
'bindings/js/JSCustomXPathNSResolver.cpp',
'bindings/js/JSCustomXPathNSResolver.h',
+ 'bindings/js/JSDatabaseCustom.cpp',
+ 'bindings/js/JSDatabaseSyncCustom.cpp',
'bindings/js/JSDataGridColumnListCustom.cpp',
'bindings/js/JSDataGridDataSource.cpp',
'bindings/js/JSDataGridDataSource.h',
@@ -738,6 +740,8 @@
'bindings/v8/custom/V8CustomVoidCallback.h',
'bindings/v8/custom/V8CustomXPathNSResolver.cpp',
'bindings/v8/custom/V8CustomXPathNSResolver.h',
+ 'bindings/v8/custom/V8DatabaseCustom.cpp',
+ 'bindings/v8/custom/V8DatabaseSyncCustom.cpp',
'bindings/v8/custom/V8DataGridColumnListCustom.cpp',
'bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp',
'bindings/v8/custom/V8DeviceOrientationEventCustom.cpp',
diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro
index c50d8ee..2a841a5 100644
--- a/WebCore/WebCore.pro
+++ b/WebCore/WebCore.pro
@@ -2412,6 +2412,8 @@ contains(DEFINES, ENABLE_DATABASE=1) {
storage/SQLTransactionCoordinator.cpp \
storage/SQLTransactionSync.cpp \
bindings/js/JSCustomSQLStatementErrorCallback.cpp \
+ bindings/js/JSDatabaseCustom.cpp \
+ bindings/js/JSDatabaseSyncCustom.cpp \
bindings/js/JSSQLResultSetRowListCustom.cpp \
bindings/js/JSSQLTransactionCustom.cpp \
bindings/js/JSSQLTransactionSyncCustom.cpp
diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj
index 23b1cec..78d5264 100644
--- a/WebCore/WebCore.vcproj/WebCore.vcproj
+++ b/WebCore/WebCore.vcproj/WebCore.vcproj
@@ -42080,6 +42080,110 @@
>
</File>
<File
+ RelativePath="..\bindings\js\JSDatabaseCustom.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\bindings\js\JSDatabaseSyncCustom.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release_Cairo|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_All|Win32"
+ ExcludedFromBuild="true"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ />
+ </FileConfiguration>
+ </File>
+ <File
RelativePath="..\bindings\js\JSDataGridColumnListCustom.cpp"
>
<FileConfiguration
diff --git a/WebCore/WebCore.xcodeproj/project.pbxproj b/WebCore/WebCore.xcodeproj/project.pbxproj
index 3ab2a96..687b5c5 100644
--- a/WebCore/WebCore.xcodeproj/project.pbxproj
+++ b/WebCore/WebCore.xcodeproj/project.pbxproj
@@ -4336,6 +4336,7 @@
B550B52611DC68A800923885 /* SQLStatementSync.h in Headers */ = {isa = PBXBuildFile; fileRef = B550B52211DC68A800923885 /* SQLStatementSync.h */; };
B55D5AA4119131FC00BCC315 /* JSSQLTransactionSyncCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */; };
B55D5AA5119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA3119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp */; };
+ B55D5AA81191325000BCC315 /* JSDatabaseSyncCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */; };
B55D5AA91191325000BCC315 /* JSSQLTransactionSyncCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA71191325000BCC315 /* JSSQLTransactionSyncCustom.cpp */; };
B56EBA8511C9FF8100B04477 /* SQLException.h in Headers */ = {isa = PBXBuildFile; fileRef = B56EBA8311C9FF8100B04477 /* SQLException.h */; };
B58CEB6911913607002A6790 /* JSDatabaseSync.h in Headers */ = {isa = PBXBuildFile; fileRef = B58CEB6711913607002A6790 /* JSDatabaseSync.h */; };
@@ -4793,6 +4794,7 @@
BCCBE7B50E07166900EAFA8E /* CSSVariableDependentValue.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCBE7B40E07166900EAFA8E /* CSSVariableDependentValue.cpp */; };
BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */; };
BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */; };
+ BCCE58AC1061E8CF008FB35A /* JSDatabaseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */; };
BCCFBAE80B5152ED0001F1D7 /* DocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */; settings = {ATTRIBUTES = (Private, ); }; };
BCD0E0FA0E972C3500265DEA /* SecurityOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */; };
BCD0E0FB0E972C3500265DEA /* SecurityOrigin.h in Headers */ = {isa = PBXBuildFile; fileRef = BCD0E0F80E972C3500265DEA /* SecurityOrigin.h */; settings = {ATTRIBUTES = (Private, ); }; };
@@ -10003,6 +10005,7 @@
B550B52211DC68A800923885 /* SQLStatementSync.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SQLStatementSync.h; sourceTree = "<group>"; };
B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransactionSyncCallback.h; sourceTree = "<group>"; };
B55D5AA3119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionSyncCallback.cpp; sourceTree = "<group>"; };
+ B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseSyncCustom.cpp; sourceTree = "<group>"; };
B55D5AA71191325000BCC315 /* JSSQLTransactionSyncCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionSyncCustom.cpp; sourceTree = "<group>"; };
B55D5ABB1191327200BCC315 /* DatabaseSync.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DatabaseSync.idl; sourceTree = "<group>"; };
B55D5ABC1191327200BCC315 /* SQLTransactionSync.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = SQLTransactionSync.idl; sourceTree = "<group>"; };
@@ -10497,6 +10500,7 @@
BCCBE7B40E07166900EAFA8E /* CSSVariableDependentValue.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSVariableDependentValue.cpp; sourceTree = "<group>"; };
BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLViewSourceDocument.h; sourceTree = "<group>"; };
BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLViewSourceDocument.cpp; sourceTree = "<group>"; };
+ BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseCustom.cpp; sourceTree = "<group>"; };
BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DocumentParser.h; sourceTree = "<group>"; };
BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityOrigin.cpp; sourceTree = "<group>"; };
BCD0E0F80E972C3500265DEA /* SecurityOrigin.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SecurityOrigin.h; sourceTree = "<group>"; };
@@ -15945,6 +15949,8 @@
9392262E10321084006E7D5D /* JSCSSRuleListCustom.cpp */,
BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */,
BC20FB7E0C0E8E6C00D1447F /* JSCSSValueCustom.cpp */,
+ BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */,
+ B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */,
BC77D1510FF19C730070887B /* JSDataGridColumnListCustom.cpp */,
4162A453101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp */,
33503CBF10179C1A003B47E1 /* JSDesktopNotificationsCustom.cpp */,
@@ -21201,7 +21207,9 @@
E10B93C30B73C291003ED890 /* JSCustomXPathNSResolver.cpp in Sources */,
1AE82F8F0CAAFA9D002237AE /* JSDatabase.cpp in Sources */,
B59DD69A119029E5007E9684 /* JSDatabaseCallback.cpp in Sources */,
+ BCCE58AC1061E8CF008FB35A /* JSDatabaseCustom.cpp in Sources */,
B58CEB6A11913607002A6790 /* JSDatabaseSync.cpp in Sources */,
+ B55D5AA81191325000BCC315 /* JSDatabaseSyncCustom.cpp in Sources */,
BC77D1690FF19F560070887B /* JSDataGridColumn.cpp in Sources */,
BC77D16B0FF19F560070887B /* JSDataGridColumnList.cpp in Sources */,
BC77D1520FF19C730070887B /* JSDataGridColumnListCustom.cpp in Sources */,
diff --git a/WebCore/bindings/js/JSBindingsAllInOne.cpp b/WebCore/bindings/js/JSBindingsAllInOne.cpp
index 922e449..bcec369 100644
--- a/WebCore/bindings/js/JSBindingsAllInOne.cpp
+++ b/WebCore/bindings/js/JSBindingsAllInOne.cpp
@@ -57,6 +57,8 @@
#include "JSDOMWrapper.cpp"
#include "JSDataGridColumnListCustom.cpp"
#include "JSDataGridDataSource.cpp"
+#include "JSDatabaseCustom.cpp"
+#include "JSDatabaseSyncCustom.cpp"
#include "JSDebugWrapperSet.cpp"
#include "JSDedicatedWorkerContextCustom.cpp"
#include "JSDesktopNotificationsCustom.cpp"
diff --git a/WebCore/bindings/js/JSDOMWindowCustom.cpp b/WebCore/bindings/js/JSDOMWindowCustom.cpp
index 252ea93..30d79b3 100644
--- a/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -22,6 +22,7 @@
#include "AtomicString.h"
#include "Chrome.h"
+#include "Database.h"
#include "DOMWindow.h"
#include "Document.h"
#include "ExceptionCode.h"
@@ -35,6 +36,10 @@
#include "HTMLDocument.h"
#include "History.h"
#include "JSAudioConstructor.h"
+#if ENABLE(DATABASE)
+#include "JSDatabase.h"
+#include "JSDatabaseCallback.h"
+#endif
#include "JSDOMWindowShell.h"
#include "JSEvent.h"
#include "JSEventListener.h"
@@ -1001,6 +1006,49 @@ JSValue JSDOMWindow::removeEventListener(ExecState* exec)
return jsUndefined();
}
+#if ENABLE(DATABASE)
+JSValue JSDOMWindow::openDatabase(ExecState* exec)
+{
+ if (!allowsAccessFrom(exec) || (exec->argumentCount() < 4)) {
+ setDOMException(exec, SYNTAX_ERR);
+ return jsUndefined();
+ }
+
+ String name = ustringToString(exec->argument(0).toString(exec));
+ if (exec->hadException())
+ return jsUndefined();
+
+ String version = ustringToString(exec->argument(1).toString(exec));
+ if (exec->hadException())
+ return jsUndefined();
+
+ String displayName = ustringToString(exec->argument(2).toString(exec));
+ if (exec->hadException())
+ return jsUndefined();
+
+ // exec->argument(3) = estimated size
+ unsigned long estimatedSize = exec->argument(3).toUInt32(exec);
+ if (exec->hadException())
+ return jsUndefined();
+
+ RefPtr<DatabaseCallback> creationCallback;
+ if (exec->argumentCount() >= 5) {
+ if (!exec->argument(4).isObject()) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+
+ creationCallback = JSDatabaseCallback::create(asObject(exec->argument(4)), globalObject());
+ }
+
+ ExceptionCode ec = 0;
+ JSValue result = toJS(exec, globalObject(), WTF::getPtr(impl()->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec)));
+
+ setDOMException(exec, ec);
+ return result;
+}
+#endif
+
DOMWindow* toDOMWindow(JSValue value)
{
if (!value.isObject())
diff --git a/WebCore/bindings/js/JSDatabaseCustom.cpp b/WebCore/bindings/js/JSDatabaseCustom.cpp
new file mode 100644
index 0000000..6733320
--- /dev/null
+++ b/WebCore/bindings/js/JSDatabaseCustom.cpp
@@ -0,0 +1,146 @@
+/*
+ * Copyright (C) 2007 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSDatabase.h"
+
+#if ENABLE(DATABASE)
+
+#include "DOMWindow.h"
+#include "Database.h"
+#include "Document.h"
+#include "ExceptionCode.h"
+#include "JSSQLTransactionCallback.h"
+#include "JSSQLTransactionErrorCallback.h"
+#include "JSCustomVoidCallback.h"
+#include "JSDOMWindowCustom.h"
+#include "PlatformString.h"
+#include "SQLValue.h"
+#include <runtime/JSArray.h>
+
+namespace WebCore {
+
+using namespace JSC;
+
+JSValue JSDatabase::changeVersion(ExecState* exec)
+{
+ String oldVersion = ustringToString(exec->argument(0).toString(exec));
+ if (exec->hadException())
+ return jsUndefined();
+
+ String newVersion = ustringToString(exec->argument(1).toString(exec));
+ if (exec->hadException())
+ return jsUndefined();
+
+ RefPtr<SQLTransactionCallback> callback;
+ if (exec->argumentCount() > 2 && !exec->argument(2).isNull()) {
+ JSObject* object = exec->argument(2).getObject();
+ if (!object) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+
+ callback = JSSQLTransactionCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
+ }
+
+ RefPtr<SQLTransactionErrorCallback> errorCallback;
+ if (exec->argumentCount() > 3 && !exec->argument(3).isNull()) {
+ JSObject* object = exec->argument(3).getObject();
+ if (!object) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+
+ errorCallback = JSSQLTransactionErrorCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
+ }
+
+ RefPtr<VoidCallback> successCallback;
+ if (exec->argumentCount() > 4 && !exec->argument(4).isNull()) {
+ JSObject* object = exec->argument(4).getObject();
+ if (!object) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+
+ successCallback = JSCustomVoidCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
+ }
+
+ m_impl->changeVersion(oldVersion, newVersion, callback.release(), errorCallback.release(), successCallback.release());
+
+ return jsUndefined();
+}
+
+static JSValue createTransaction(ExecState* exec, Database* database, JSDOMGlobalObject* globalObject, bool readOnly)
+{
+ JSObject* object = exec->argument(0).getObject();
+
+ if (!object) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+
+ RefPtr<SQLTransactionCallback> callback(JSSQLTransactionCallback::create(object, globalObject));
+ RefPtr<SQLTransactionErrorCallback> errorCallback;
+ if (exec->argumentCount() > 1 && !exec->argument(1).isNull()) {
+ object = exec->argument(1).getObject();
+ if (!object) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+
+ errorCallback = JSSQLTransactionErrorCallback::create(object, globalObject);
+ }
+
+ RefPtr<VoidCallback> successCallback;
+ if (exec->argumentCount() > 2 && !exec->argument(2).isNull()) {
+ object = exec->argument(2).getObject();
+ if (!object) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+
+ successCallback = JSCustomVoidCallback::create(object, globalObject);
+ }
+
+ database->transaction(callback.release(), errorCallback.release(), successCallback.release(), readOnly);
+ return jsUndefined();
+}
+
+JSValue JSDatabase::transaction(ExecState* exec)
+{
+ return createTransaction(exec, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), false);
+}
+
+JSValue JSDatabase::readTransaction(ExecState* exec)
+{
+ return createTransaction(exec, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), true);
+}
+
+}
+
+#endif // ENABLE(DATABASE)
diff --git a/WebCore/bindings/js/JSDatabaseSyncCustom.cpp b/WebCore/bindings/js/JSDatabaseSyncCustom.cpp
new file mode 100644
index 0000000..f929658
--- /dev/null
+++ b/WebCore/bindings/js/JSDatabaseSyncCustom.cpp
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2010 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
+ * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
+ * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
+ * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
+ * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
+ * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
+ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+#include "JSDatabaseSync.h"
+
+#if ENABLE(DATABASE)
+
+#include "DatabaseSync.h"
+#include "ExceptionCode.h"
+#include "JSSQLTransactionSyncCallback.h"
+#include "PlatformString.h"
+#include "SQLValue.h"
+#include <runtime/JSArray.h>
+
+namespace WebCore {
+
+using namespace JSC;
+
+JSValue JSDatabaseSync::changeVersion(ExecState* exec)
+{
+ String oldVersion = ustringToString(exec->argument(0).toString(exec));
+ if (exec->hadException())
+ return jsUndefined();
+
+ String newVersion = ustringToString(exec->argument(1).toString(exec));
+ if (exec->hadException())
+ return jsUndefined();
+
+ RefPtr<SQLTransactionSyncCallback> callback;
+ if (exec->argumentCount() > 2 && !exec->argument(2).isNull()) {
+ JSObject* object = exec->argument(2).getObject();
+ if (!object) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+
+ callback = JSSQLTransactionSyncCallback::create(object, static_cast<JSDOMGlobalObject*>(globalObject()));
+ }
+
+ ExceptionCode ec = 0;
+ m_impl->changeVersion(oldVersion, newVersion, callback.release(), ec);
+ setDOMException(exec, ec);
+
+ return jsUndefined();
+}
+
+static JSValue createTransaction(ExecState* exec, DatabaseSync* database, JSDOMGlobalObject* globalObject, bool readOnly)
+{
+ JSObject* object = exec->argument(0).getObject();
+ if (!object) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+
+ RefPtr<SQLTransactionSyncCallback> callback(JSSQLTransactionSyncCallback::create(object, globalObject));
+
+ ExceptionCode ec = 0;
+ database->transaction(callback.release(), readOnly, ec);
+ setDOMException(exec, ec);
+
+ return jsUndefined();
+}
+
+JSValue JSDatabaseSync::transaction(ExecState* exec)
+{
+ return createTransaction(exec, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), false);
+}
+
+JSValue JSDatabaseSync::readTransaction(ExecState* exec)
+{
+ return createTransaction(exec, m_impl.get(), static_cast<JSDOMGlobalObject*>(globalObject()), true);
+}
+
+}
+
+#endif // ENABLE(DATABASE)
diff --git a/WebCore/bindings/js/JSWorkerContextCustom.cpp b/WebCore/bindings/js/JSWorkerContextCustom.cpp
index b8885cf..b443f90 100644
--- a/WebCore/bindings/js/JSWorkerContextCustom.cpp
+++ b/WebCore/bindings/js/JSWorkerContextCustom.cpp
@@ -29,6 +29,13 @@
#include "JSWorkerContext.h"
+#if ENABLE(DATABASE)
+#include "Database.h"
+#include "DatabaseSync.h"
+#include "JSDatabase.h"
+#include "JSDatabaseCallback.h"
+#include "JSDatabaseSync.h"
+#endif
#include "ExceptionCode.h"
#include "JSDOMBinding.h"
#include "JSDOMGlobalObject.h"
@@ -146,6 +153,89 @@ JSValue JSWorkerContext::messageChannel(ExecState* exec) const
}
#endif
+#if ENABLE(DATABASE)
+JSValue JSWorkerContext::openDatabase(ExecState* exec)
+{
+ if (exec->argumentCount() < 4) {
+ setDOMException(exec, SYNTAX_ERR);
+ return jsUndefined();
+ }
+
+ String name = ustringToString(exec->argument(0).toString(exec));
+ if (exec->hadException())
+ return jsUndefined();
+
+ String version = ustringToString(exec->argument(1).toString(exec));
+ if (exec->hadException())
+ return jsUndefined();
+
+ String displayName = ustringToString(exec->argument(2).toString(exec));
+ if (exec->hadException())
+ return jsUndefined();
+
+ // exec->argument(3) = estimated size
+ unsigned long estimatedSize = exec->argument(3).toUInt32(exec);
+ if (exec->hadException())
+ return jsUndefined();
+
+ RefPtr<DatabaseCallback> creationCallback;
+ if (exec->argumentCount() >= 5) {
+ if (!exec->argument(4).isObject()) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+
+ creationCallback = JSDatabaseCallback::create(asObject(exec->argument(4)), globalObject());
+ }
+
+ ExceptionCode ec = 0;
+ JSValue result = toJS(exec, globalObject(), WTF::getPtr(impl()->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec)));
+ setDOMException(exec, ec);
+ return result;
+}
+
+JSValue JSWorkerContext::openDatabaseSync(ExecState* exec)
+{
+ if (exec->argumentCount() < 4) {
+ setDOMException(exec, SYNTAX_ERR);
+ return jsUndefined();
+ }
+
+ String name = ustringToString(exec->argument(0).toString(exec));
+ if (exec->hadException())
+ return jsUndefined();
+
+ String version = ustringToString(exec->argument(1).toString(exec));
+ if (exec->hadException())
+ return jsUndefined();
+
+ String displayName = ustringToString(exec->argument(2).toString(exec));
+ if (exec->hadException())
+ return jsUndefined();
+
+ // exec->argument(3) = estimated size
+ unsigned long estimatedSize = exec->argument(3).toUInt32(exec);
+ if (exec->hadException())
+ return jsUndefined();
+
+ RefPtr<DatabaseCallback> creationCallback;
+ if (exec->argumentCount() >= 5) {
+ if (!exec->argument(4).isObject()) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+
+ creationCallback = JSDatabaseCallback::create(asObject(exec->argument(4)), globalObject());
+ }
+
+ ExceptionCode ec = 0;
+ JSValue result = toJS(exec, globalObject(), WTF::getPtr(impl()->openDatabaseSync(name, version, displayName, estimatedSize, creationCallback.release(), ec)));
+
+ setDOMException(exec, ec);
+ return result;
+}
+#endif
+
} // namespace WebCore
#endif // ENABLE(WORKERS)
diff --git a/WebCore/bindings/scripts/CodeGeneratorGObject.pm b/WebCore/bindings/scripts/CodeGeneratorGObject.pm
index 651a9cf..f6a9419 100644
--- a/WebCore/bindings/scripts/CodeGeneratorGObject.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorGObject.pm
@@ -208,14 +208,6 @@ sub SkipFunction {
return 1;
}
- # Skip functions that take ["Callback"] parameters, since this
- # code generator doesn't know yet how to auto-generate callbacks.
- foreach my $param (@{$function->parameters}) {
- if ($param->extendedAttributes->{"Callback"}) {
- return 1;
- }
- }
-
return 0;
}
diff --git a/WebCore/bindings/scripts/CodeGeneratorJS.pm b/WebCore/bindings/scripts/CodeGeneratorJS.pm
index cfecfbd..33820d8 100644
--- a/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -1909,27 +1909,15 @@ sub GenerateImplementation
}
foreach my $parameter (@{$function->parameters}) {
- push(@implContent, "\n");
if ($parameter->extendedAttributes->{"Optional"}) {
- # Optional callbacks should be handled differently because:
- # - they always have a default value: 0
- # - it reduces the number of overloaded functions with different number of parameters
- if (!$parameter->extendedAttributes->{"Callback"}) {
- # Generate early call if there are enough parameters.
- if (!$hasOptionalArguments) {
- push(@implContent, " int argsCount = exec->argumentCount();\n");
- $hasOptionalArguments = 1;
- }
- push(@implContent, " if (argsCount <= $argsIndex) {\n");
- GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " " x 2, $podType, $implClassName);
- push(@implContent, " }\n");
+ # Generate early call if there are enough parameters.
+ if (!$hasOptionalArguments) {
+ push(@implContent, "\n int argsCount = exec->argumentCount();\n");
+ $hasOptionalArguments = 1;
}
- } else {
- $implIncludes{"ExceptionCode.h"} = 1;
- push(@implContent, " if (exec->argumentCount() <= $argsIndex) {\n");
- push(@implContent, " setDOMException(exec, TYPE_MISMATCH_ERR);\n");
- push(@implContent, " return JSValue::encode(jsUndefined());\n");
- push(@implContent, " }\n");
+ push(@implContent, " if (argsCount < " . ($argsIndex + 1) . ") {\n");
+ GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " " x 2, $podType, $implClassName);
+ push(@implContent, " }\n\n");
}
my $name = $parameter->name;
@@ -1947,23 +1935,11 @@ sub GenerateImplementation
my $callbackClassName = GetCallbackClassName($parameter->type);
$implIncludes{"$callbackClassName.h"} = 1;
$implIncludes{"ExceptionCode.h"} = 1;
- if ($parameter->extendedAttributes->{"Optional"}) {
- push(@implContent, " RefPtr<" . $parameter->type . "> $name;\n");
- push(@implContent, " if (exec->argumentCount() > $argsIndex && exec->argument($argsIndex).isObject()) {\n");
- push(@implContent, " JSObject* object = exec->argument($argsIndex).getObject();\n");
- push(@implContent, " if (!object) {\n");
- push(@implContent, " setDOMException(exec, TYPE_MISMATCH_ERR);\n");
- push(@implContent, " return JSValue::encode(jsUndefined());\n");
- push(@implContent, " }\n");
- push(@implContent, " $name = ${callbackClassName}::create(object, castedThis->globalObject());\n");
- push(@implContent, " }\n");
- } else {
- push(@implContent, " if (!exec->argument($argsIndex).isObject() || !exec->argument($argsIndex).getObject()) {\n");
- push(@implContent, " setDOMException(exec, TYPE_MISMATCH_ERR);\n");
- push(@implContent, " return JSValue::encode(jsUndefined());\n");
- push(@implContent, " }\n");
- push(@implContent, " RefPtr<" . $parameter->type . "> $name = " . $callbackClassName . "::create(exec->argument($argsIndex).getObject(), castedThis->globalObject());\n");
- }
+ push(@implContent, " if (exec->argumentCount() <= $argsIndex || !exec->argument($argsIndex).isObject()) {\n");
+ push(@implContent, " setDOMException(exec, TYPE_MISMATCH_ERR);\n");
+ push(@implContent, " return jsUndefined();\n");
+ push(@implContent, " }\n");
+ push(@implContent, " RefPtr<" . $parameter->type . "> $name = " . $callbackClassName . "::create(asObject(exec->argument($argsIndex)), castedThis->globalObject());\n");
} else {
push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($argsIndex)") . ";\n");
@@ -1979,12 +1955,6 @@ sub GenerateImplementation
}
}
- # Callback parameters have their special error checking code.
- if (!$parameter->extendedAttributes->{"Callback"}) {
- push(@implContent, " if (exec->hadException())\n");
- push(@implContent, " return JSValue::encode(jsUndefined());\n");
- }
-
$functionString .= ", " if $paramIndex;
if ($parameter->type eq "NodeFilter") {
@@ -2373,8 +2343,7 @@ sub JSValueToNative
return "$value.toBoolean(exec)" if $type eq "boolean";
return "$value.toNumber(exec)" if $type eq "double";
return "$value.toFloat(exec)" if $type eq "float" or $type eq "SVGNumber";
- return "$value.toInt32(exec)" if $type eq "long";
- return "$value.toUInt32(exec)" if $type eq "unsigned long" or $type eq "unsigned short";
+ return "$value.toInt32(exec)" if $type eq "unsigned long" or $type eq "long" or $type eq "unsigned short";
return "static_cast<$type>($value.toInteger(exec))" if $type eq "long long" or $type eq "unsigned long long";
return "valueToDate(exec, $value)" if $type eq "Date";
diff --git a/WebCore/bindings/scripts/CodeGeneratorV8.pm b/WebCore/bindings/scripts/CodeGeneratorV8.pm
index 3b7da37..1b91470 100644
--- a/WebCore/bindings/scripts/CodeGeneratorV8.pm
+++ b/WebCore/bindings/scripts/CodeGeneratorV8.pm
@@ -1176,74 +1176,58 @@ END
my $parameterName = $parameter->name;
if ($parameter->extendedAttributes->{"Optional"}) {
- # Optional callbacks should be handled differently because:
- # - they always have a default value: 0
- # - it reduces the number of overloaded functions with different number of parameters
- if (!$parameter->extendedAttributes->{"Callback"}) {
- # Generate early call if there are not enough parameters.
- push(@implContentDecls, " if (args.Length() <= $paramIndex) {\n");
- my $functionCall = GenerateFunctionCallString($function, $paramIndex, " " x 2, $implClassName);
- push(@implContentDecls, $functionCall);
- push(@implContentDecls, " }\n");
- }
- } else {
- push(@implContentDecls, " if (args.Length() <= $paramIndex)\n");
- push(@implContentDecls, " return throwError(TYPE_MISMATCH_ERR);\n");
- }
-
- if (BasicTypeCanFailConversion($parameter)) {
- push(@implContentDecls, " bool ${parameterName}Ok;\n");
+ # Generate early call if there are not enough parameters.
+ push(@implContentDecls, " if (args.Length() <= $paramIndex) {\n");
+ my $functionCall = GenerateFunctionCallString($function, $paramIndex, " " x 2, $implClassName);
+ push(@implContentDecls, $functionCall);
+ push(@implContentDecls, " }\n");
}
- my $nativeType = GetNativeTypeFromSignature($parameter, $paramIndex);
if ($parameter->extendedAttributes->{"Callback"}) {
my $className = GetCallbackClassName($parameter->type);
$implIncludes{"$className.h"} = 1;
$implIncludes{"ExceptionCode.h"} = 1;
- if ($parameter->extendedAttributes->{"Optional"}) {
- push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName;\n");
- push(@implContentDecls, " if (args.Length() > $paramIndex && args[$paramIndex]->IsObject())\n");
- push(@implContentDecls, " $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n");
- } else {
- push(@implContentDecls, " if (!args[$paramIndex]->IsObject())\n");
- push(@implContentDecls, " return throwError(TYPE_MISMATCH_ERR);\n");
- push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n");
- }
+ push(@implContentDecls, " if (args.Length() <= $paramIndex || !args[$paramIndex]->IsObject())\n");
+ push(@implContentDecls, " return throwError(TYPE_MISMATCH_ERR);\n");
+ push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n");
$paramIndex++;
next;
- } elsif ($parameter->type eq "SerializedScriptValue") {
+ }
+
+ if ($parameter->type eq "SerializedScriptValue") {
$implIncludes{"SerializedScriptValue.h"} = 1;
push(@implContentDecls, " bool ${parameterName}DidThrow = false;\n");
- push(@implContentDecls, " $nativeType $parameterName = SerializedScriptValue::create(args[$paramIndex], ${parameterName}DidThrow);\n");
+ } elsif (BasicTypeCanFailConversion($parameter)) {
+ push(@implContentDecls, " bool ${parameterName}Ok;\n");
+ }
+
+ push(@implContentDecls, " " . GetNativeTypeFromSignature($parameter, $paramIndex) . " $parameterName = ");
+
+ if ($parameter->type eq "SerializedScriptValue") {
+ push(@implContentDecls, "SerializedScriptValue::create(args[$paramIndex], ${parameterName}DidThrow);\n");
push(@implContentDecls, " if (${parameterName}DidThrow)\n");
push(@implContentDecls, " return v8::Undefined();\n");
- } elsif (TypeCanFailConversion($parameter)) {
- $implIncludes{"ExceptionCode.h"} = 1;
- push(@implContentDecls, " $nativeType $parameterName = " .
- JSValueToNative($parameter, "args[$paramIndex]",
- BasicTypeCanFailConversion($parameter) ? "${parameterName}Ok" : undef) . ";\n");
- push(@implContentDecls, " if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n");
- push(@implContentDecls, " ec = TYPE_MISMATCH_ERR;\n");
- push(@implContentDecls, " goto fail;\n");
- push(@implContentDecls, " }\n");
- } elsif ($nativeType =~ /^V8Parameter/) {
- # Exceptions are handled in V8Parameter's operators.
- push(@implContentDecls, " $nativeType $parameterName = " .
- JSValueToNative($parameter, "args[$paramIndex]",
- BasicTypeCanFailConversion($parameter) ? "{$parameterName}Ok" : undef) . ";\n");
} else {
- $implIncludes{"V8BindingMacros.h"} = 1;
- push(@implContentDecls, " EXCEPTION_BLOCK($nativeType, $parameterName, " .
- JSValueToNative($parameter, "args[$paramIndex]",
- BasicTypeCanFailConversion($parameter) ? "{$parameterName}Ok" : undef) . ");\n");
+ push(@implContentDecls, JSValueToNative($parameter, "args[$paramIndex]",
+ BasicTypeCanFailConversion($parameter) ? "${parameterName}Ok" : undef) . ";\n");
+ }
+
+ if (TypeCanFailConversion($parameter)) {
+ $implIncludes{"ExceptionCode.h"} = 1;
+ push(@implContentDecls,
+" if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n" .
+" ec = TYPE_MISMATCH_ERR;\n" .
+" goto fail;\n" .
+" }\n");
}
if ($parameter->extendedAttributes->{"IsIndex"}) {
$implIncludes{"ExceptionCode.h"} = 1;
- push(@implContentDecls, " if (UNLIKELY($parameterName < 0)) {\n");
- push(@implContentDecls, " ec = INDEX_SIZE_ERR;\n");
- push(@implContentDecls, " goto fail;\n");
- push(@implContentDecls, " }\n");
+ push(@implContentDecls,
+" if (UNLIKELY($parameterName < 0)) {\n" .
+" ec = INDEX_SIZE_ERR;\n" .
+" goto fail;\n" .
+" }\n");
}
$paramIndex++;
@@ -2841,8 +2825,7 @@ sub JSValueToNative
return "static_cast<$type>($value->NumberValue())" if $type eq "float" or $type eq "double";
return "$value->NumberValue()" if $type eq "SVGNumber";
- return "toInt32($value${maybeOkParam})" if $type eq "long";
- return "toUInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short";
+ return "toInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short" or $type eq "long";
return "toInt64($value)" if $type eq "unsigned long long" or $type eq "long long";
return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "CompareHow";
return "static_cast<SVGPaint::SVGPaintType>($value->ToInt32()->Int32Value())" if $type eq "SVGPaintType";
@@ -2972,8 +2955,7 @@ sub RequiresCustomSignature
}
foreach my $parameter (@{$function->parameters}) {
- if ($parameter->extendedAttributes->{"Optional"} ||
- $parameter->extendedAttributes->{"Callback"}) {
+ if ($parameter->extendedAttributes->{"Optional"}) {
return 0;
}
}
diff --git a/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp b/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp
index 23c2cf0..3bf2a8b 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp
+++ b/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp
@@ -42,13 +42,10 @@ JSTestCallback::JSTestCallback(JSObject* callback, JSDOMGlobalObject* globalObje
JSTestCallback::~JSTestCallback()
{
- ScriptExecutionContext* context = scriptExecutionContext();
- // When the context is destroyed, all tasks with a reference to a callback
- // should be deleted. So if the context is NULL, we are on the context thread.
- if (!context || context->isContextThread())
+ if (m_scriptExecutionContext->isContextThread())
delete m_data;
else
- context->postTask(DeleteCallbackDataTask::create(m_data));
+ m_data->globalObject()->scriptExecutionContext()->postTask(DeleteCallbackDataTask::create(m_data));
#ifndef NDEBUG
m_data = 0;
#endif
diff --git a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
index 4eaae22..9c11bde 100644
--- a/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
+++ b/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
@@ -793,30 +793,9 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionVoidMethodWithArgs(ExecSt
return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
int intArg = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 1) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
const String& strArg = ustringToString(exec->argument(1).toString(exec));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 2) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
TestObj* objArg = toTestObj(exec->argument(2));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->voidMethodWithArgs(intArg, strArg, objArg);
return JSValue::encode(jsUndefined());
@@ -842,30 +821,9 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIntMethodWithArgs(ExecSta
return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
int intArg = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 1) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
const String& strArg = ustringToString(exec->argument(1).toString(exec));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 2) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
TestObj* objArg = toTestObj(exec->argument(2));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
JSC::JSValue result = jsNumber(exec, imp->intMethodWithArgs(intArg, strArg, objArg));
@@ -892,30 +850,9 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionObjMethodWithArgs(ExecSta
return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
int intArg = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 1) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
const String& strArg = ustringToString(exec->argument(1).toString(exec));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 2) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
TestObj* objArg = toTestObj(exec->argument(2));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->objMethodWithArgs(intArg, strArg, objArg)));
@@ -931,22 +868,8 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
if (exec->argumentCount() < 2)
return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
const String& strArg = ustringToString(exec->argument(0).toString(exec));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 1) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
TestObj* objArg = toTestObj(exec->argument(1));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgs(strArg, objArg)));
@@ -963,22 +886,8 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodThatRequiresAllArgs
if (exec->argumentCount() < 2)
return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
ExceptionCode ec = 0;
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
const String& strArg = ustringToString(exec->argument(0).toString(exec));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 1) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
TestObj* objArg = toTestObj(exec->argument(1));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
JSC::JSValue result = toJS(exec, castedThis->globalObject(), WTF::getPtr(imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec)));
@@ -993,14 +902,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionSerializedValue(ExecState
return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, exec->argument(0));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->serializedValue(serializedArg);
return JSValue::encode(jsUndefined());
@@ -1013,14 +915,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionIdbKey(ExecState* exec)
return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
RefPtr<IDBKey> key = createIDBKeyFromValue(exec, exec->argument(0));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->idbKey(key);
return JSValue::encode(jsUndefined());
@@ -1067,14 +962,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionCustomArgsAndException(Ex
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
ExceptionCode ec = 0;
ScriptCallStack callStack(exec, 1);
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
log* intArg = tolog(exec->argument(0));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->customArgsAndException(intArg, &callStack, ec);
setDOMException(exec, ec);
@@ -1134,14 +1022,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndArg(Ex
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
int intArg = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->withDynamicFrameAndArg(dynamicFrame, intArg);
return JSValue::encode(jsUndefined());
@@ -1157,23 +1038,15 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndOption
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
int intArg = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
int argsCount = exec->argumentCount();
- if (argsCount <= 1) {
+ if (argsCount < 2) {
imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg);
return JSValue::encode(jsUndefined());
}
+
int optionalArg = exec->argument(1).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg);
return JSValue::encode(jsUndefined());
@@ -1189,14 +1062,7 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGe
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
int intArg = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec));
return JSValue::encode(jsUndefined());
@@ -1212,23 +1078,15 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionWithDynamicFrameAndUserGe
Frame* dynamicFrame = toDynamicFrame(exec);
if (!dynamicFrame)
return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
int intArg = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
int argsCount = exec->argumentCount();
- if (argsCount <= 1) {
+ if (argsCount < 2) {
imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg);
return JSValue::encode(jsUndefined());
}
+
int optionalArg = exec->argument(1).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec));
return JSValue::encode(jsUndefined());
@@ -1316,13 +1174,12 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArg(Exe
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
int argsCount = exec->argumentCount();
- if (argsCount <= 0) {
+ if (argsCount < 1) {
imp->methodWithOptionalArg();
return JSValue::encode(jsUndefined());
}
+
int opt = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->methodWithOptionalArg(opt);
return JSValue::encode(jsUndefined());
@@ -1335,23 +1192,15 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA
return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
int nonOpt = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
int argsCount = exec->argumentCount();
- if (argsCount <= 1) {
+ if (argsCount < 2) {
imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
return JSValue::encode(jsUndefined());
}
+
int opt = exec->argument(1).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
return JSValue::encode(jsUndefined());
@@ -1364,31 +1213,16 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgA
return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
int nonOpt = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
int argsCount = exec->argumentCount();
- if (argsCount <= 1) {
+ if (argsCount < 2) {
imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
return JSValue::encode(jsUndefined());
}
- int opt1 = exec->argument(1).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
- if (argsCount <= 2) {
- imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1);
- return JSValue::encode(jsUndefined());
- }
+ int opt1 = exec->argument(1).toInt32(exec);
int opt2 = exec->argument(2).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
return JSValue::encode(jsUndefined());
@@ -1401,16 +1235,11 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(Exe
return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
-
- if (exec->argumentCount() <= 0) {
+ if (exec->argumentCount() <= 0 || !exec->argument(0).isObject()) {
setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
+ return jsUndefined();
}
- if (!exec->argument(0).isObject() || !exec->argument(0).getObject()) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
- RefPtr<TestCallback> callback = JSTestCallback::create(exec->argument(0).getObject(), castedThis->globalObject());
+ RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
imp->methodWithCallbackArg(callback);
return JSValue::encode(jsUndefined());
@@ -1423,24 +1252,12 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgA
return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
int nonCallback = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 1) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
- if (!exec->argument(1).isObject() || !exec->argument(1).getObject()) {
+ if (exec->argumentCount() <= 1 || !exec->argument(1).isObject()) {
setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
+ return jsUndefined();
}
- RefPtr<TestCallback> callback = JSTestCallback::create(exec->argument(1).getObject(), castedThis->globalObject());
+ RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(1)), castedThis->globalObject());
imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
return JSValue::encode(jsUndefined());
@@ -1454,16 +1271,18 @@ EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOpti
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
- RefPtr<TestCallback> callback;
- if (exec->argumentCount() > 0 && exec->argument(0).isObject()) {
- JSObject* object = exec->argument(0).getObject();
- if (!object) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
- callback = JSTestCallback::create(object, castedThis->globalObject());
+ int argsCount = exec->argumentCount();
+ if (argsCount < 1) {
+ imp->methodWithCallbackAndOptionalArg();
+ return JSValue::encode(jsUndefined());
}
+ if (exec->argumentCount() <= 0 || !exec->argument(0).isObject()) {
+ setDOMException(exec, TYPE_MISMATCH_ERR);
+ return jsUndefined();
+ }
+ RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
+
imp->methodWithCallbackAndOptionalArg(callback);
return JSValue::encode(jsUndefined());
}
@@ -1475,22 +1294,8 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(
return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
TestObj* objArg = toTestObj(exec->argument(0));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
-
- if (exec->argumentCount() <= 1) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
const String& strArg = ustringToString(exec->argument(1).toString(exec));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->overloadedMethod(objArg, strArg);
return JSValue::encode(jsUndefined());
@@ -1503,23 +1308,15 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(
return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
TestObj* objArg = toTestObj(exec->argument(0));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
int argsCount = exec->argumentCount();
- if (argsCount <= 1) {
+ if (argsCount < 2) {
imp->overloadedMethod(objArg);
return JSValue::encode(jsUndefined());
}
+
int intArg = exec->argument(1).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->overloadedMethod(objArg, intArg);
return JSValue::encode(jsUndefined());
@@ -1532,14 +1329,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod3(
return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
const String& strArg = ustringToString(exec->argument(0).toString(exec));
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->overloadedMethod(strArg);
return JSValue::encode(jsUndefined());
@@ -1552,14 +1342,7 @@ static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod4(
return throwVMTypeError(exec);
JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
TestObj* imp = static_cast<TestObj*>(castedThis->impl());
-
- if (exec->argumentCount() <= 0) {
- setDOMException(exec, TYPE_MISMATCH_ERR);
- return JSValue::encode(jsUndefined());
- }
int intArg = exec->argument(0).toInt32(exec);
- if (exec->hadException())
- return JSValue::encode(jsUndefined());
imp->overloadedMethod(intArg);
return JSValue::encode(jsUndefined());
diff --git a/WebCore/bindings/scripts/test/TestObj.idl b/WebCore/bindings/scripts/test/TestObj.idl
index 5579eb0..a2bc89d 100644
--- a/WebCore/bindings/scripts/test/TestObj.idl
+++ b/WebCore/bindings/scripts/test/TestObj.idl
@@ -112,7 +112,7 @@ module test {
// 'Optional' extended attribute
void methodWithOptionalArg(in [Optional] long opt);
void methodWithNonOptionalArgAndOptionalArg(in long nonOpt, in [Optional] long opt);
- void methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [Optional] long opt1, in [Optional] long opt2);
+ void methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [Optional] long opt1, in long opt2);
#if defined(TESTING_V8) || defined(TESTING_JS)
// 'Callback' extended attribute
diff --git a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
index d0659af..72f3c5f 100644
--- a/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
+++ b/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
@@ -29,7 +29,6 @@
#include "ScriptCallStack.h"
#include "SerializedScriptValue.h"
#include "V8Binding.h"
-#include "V8BindingMacros.h"
#include "V8BindingState.h"
#include "V8DOMWrapper.h"
#include "V8IsolatedContext.h"
@@ -557,15 +556,9 @@ static v8::Handle<v8::Value> voidMethodWithArgsCallback(const v8::Arguments& arg
{
INC_STATS("DOM.TestObj.voidMethodWithArgs");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
- if (args.Length() <= 1)
- return throwError(TYPE_MISMATCH_ERR);
+ int intArg = toInt32(args[0]);
V8Parameter<> strArg = args[1];
- if (args.Length() <= 2)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0);
+ TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0;
imp->voidMethodWithArgs(intArg, strArg, objArg);
return v8::Handle<v8::Value>();
}
@@ -581,15 +574,9 @@ static v8::Handle<v8::Value> intMethodWithArgsCallback(const v8::Arguments& args
{
INC_STATS("DOM.TestObj.intMethodWithArgs");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
- if (args.Length() <= 1)
- return throwError(TYPE_MISMATCH_ERR);
+ int intArg = toInt32(args[0]);
V8Parameter<> strArg = args[1];
- if (args.Length() <= 2)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0);
+ TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0;
return v8::Integer::New(imp->intMethodWithArgs(intArg, strArg, objArg));
}
@@ -604,15 +591,9 @@ static v8::Handle<v8::Value> objMethodWithArgsCallback(const v8::Arguments& args
{
INC_STATS("DOM.TestObj.objMethodWithArgs");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
- if (args.Length() <= 1)
- return throwError(TYPE_MISMATCH_ERR);
+ int intArg = toInt32(args[0]);
V8Parameter<> strArg = args[1];
- if (args.Length() <= 2)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0);
+ TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0;
return toV8(imp->objMethodWithArgs(intArg, strArg, objArg));
}
@@ -622,12 +603,8 @@ static v8::Handle<v8::Value> methodThatRequiresAllArgsCallback(const v8::Argumen
if (args.Length() < 2)
return v8::Handle<v8::Value>();
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
V8Parameter<> strArg = args[0];
- if (args.Length() <= 1)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0);
+ TestObj* objArg = V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
return toV8(imp->methodThatRequiresAllArgs(strArg, objArg));
}
@@ -639,12 +616,8 @@ static v8::Handle<v8::Value> methodThatRequiresAllArgsAndThrowsCallback(const v8
TestObj* imp = V8TestObj::toNative(args.Holder());
ExceptionCode ec = 0;
{
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
V8Parameter<> strArg = args[0];
- if (args.Length() <= 1)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0);
+ TestObj* objArg = V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec);
if (UNLIKELY(ec))
goto fail;
@@ -659,8 +632,6 @@ static v8::Handle<v8::Value> serializedValueCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TestObj.serializedValue");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
bool serializedArgDidThrow = false;
RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(args[0], serializedArgDidThrow);
if (serializedArgDidThrow)
@@ -673,9 +644,7 @@ static v8::Handle<v8::Value> idbKeyCallback(const v8::Arguments& args)
{
INC_STATS("DOM.TestObj.idbKey");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(RefPtr<IDBKey>, key, createIDBKeyFromValue(args[0]));
+ RefPtr<IDBKey> key = createIDBKeyFromValue(args[0]);
imp->idbKey(key);
return v8::Handle<v8::Value>();
}
@@ -705,9 +674,7 @@ static v8::Handle<v8::Value> customArgsAndExceptionCallback(const v8::Arguments&
OwnPtr<ScriptCallStack> callStack(ScriptCallStack::create(args, 1));
if (!callStack)
return v8::Undefined();
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(log*, intArg, V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
+ log* intArg = V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
imp->customArgsAndException(intArg, callStack.get(), ec);
if (UNLIKELY(ec))
goto fail;
@@ -755,9 +722,7 @@ static v8::Handle<v8::Value> withDynamicFrameAndArgCallback(const v8::Arguments&
{
INC_STATS("DOM.TestObj.withDynamicFrameAndArg");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
+ int intArg = toInt32(args[0]);
Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
if (!enteredFrame)
return v8::Undefined();
@@ -769,9 +734,7 @@ static v8::Handle<v8::Value> withDynamicFrameAndOptionalArgCallback(const v8::Ar
{
INC_STATS("DOM.TestObj.withDynamicFrameAndOptionalArg");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
+ int intArg = toInt32(args[0]);
if (args.Length() <= 1) {
Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
if (!enteredFrame)
@@ -779,7 +742,7 @@ static v8::Handle<v8::Value> withDynamicFrameAndOptionalArgCallback(const v8::Ar
imp->withDynamicFrameAndOptionalArg(enteredFrame, intArg);
return v8::Handle<v8::Value>();
}
- EXCEPTION_BLOCK(int, optionalArg, toInt32(args[1]));
+ int optionalArg = toInt32(args[1]);
Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
if (!enteredFrame)
return v8::Undefined();
@@ -791,9 +754,7 @@ static v8::Handle<v8::Value> withDynamicFrameAndUserGestureCallback(const v8::Ar
{
INC_STATS("DOM.TestObj.withDynamicFrameAndUserGesture");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
+ int intArg = toInt32(args[0]);
Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
if (!enteredFrame)
return v8::Undefined();
@@ -805,9 +766,7 @@ static v8::Handle<v8::Value> withDynamicFrameAndUserGestureASADCallback(const v8
{
INC_STATS("DOM.TestObj.withDynamicFrameAndUserGestureASAD");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
+ int intArg = toInt32(args[0]);
if (args.Length() <= 1) {
Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
if (!enteredFrame)
@@ -815,7 +774,7 @@ static v8::Handle<v8::Value> withDynamicFrameAndUserGestureASADCallback(const v8
imp->withDynamicFrameAndUserGestureASAD(enteredFrame, intArg, processingUserGesture());
return v8::Handle<v8::Value>();
}
- EXCEPTION_BLOCK(int, optionalArg, toInt32(args[1]));
+ int optionalArg = toInt32(args[1]);
Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
if (!enteredFrame)
return v8::Undefined();
@@ -902,7 +861,7 @@ static v8::Handle<v8::Value> methodWithOptionalArgCallback(const v8::Arguments&
imp->methodWithOptionalArg();
return v8::Handle<v8::Value>();
}
- EXCEPTION_BLOCK(int, opt, toInt32(args[0]));
+ int opt = toInt32(args[0]);
imp->methodWithOptionalArg(opt);
return v8::Handle<v8::Value>();
}
@@ -911,14 +870,12 @@ static v8::Handle<v8::Value> methodWithNonOptionalArgAndOptionalArgCallback(cons
{
INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndOptionalArg");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(int, nonOpt, toInt32(args[0]));
+ int nonOpt = toInt32(args[0]);
if (args.Length() <= 1) {
imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
return v8::Handle<v8::Value>();
}
- EXCEPTION_BLOCK(int, opt, toInt32(args[1]));
+ int opt = toInt32(args[1]);
imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
return v8::Handle<v8::Value>();
}
@@ -927,19 +884,13 @@ static v8::Handle<v8::Value> methodWithNonOptionalArgAndTwoOptionalArgsCallback(
{
INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndTwoOptionalArgs");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(int, nonOpt, toInt32(args[0]));
+ int nonOpt = toInt32(args[0]);
if (args.Length() <= 1) {
imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
return v8::Handle<v8::Value>();
}
- EXCEPTION_BLOCK(int, opt1, toInt32(args[1]));
- if (args.Length() <= 2) {
- imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1);
- return v8::Handle<v8::Value>();
- }
- EXCEPTION_BLOCK(int, opt2, toInt32(args[2]));
+ int opt1 = toInt32(args[1]);
+ int opt2 = toInt32(args[2]);
imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
return v8::Handle<v8::Value>();
}
@@ -948,9 +899,7 @@ static v8::Handle<v8::Value> methodWithCallbackArgCallback(const v8::Arguments&
{
INC_STATS("DOM.TestObj.methodWithCallbackArg");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- if (!args[0]->IsObject())
+ if (args.Length() <= 0 || !args[0]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
imp->methodWithCallbackArg(callback);
@@ -961,12 +910,8 @@ static v8::Handle<v8::Value> methodWithNonCallbackArgAndCallbackArgCallback(cons
{
INC_STATS("DOM.TestObj.methodWithNonCallbackArgAndCallbackArg");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(int, nonCallback, toInt32(args[0]));
- if (args.Length() <= 1)
- return throwError(TYPE_MISMATCH_ERR);
- if (!args[1]->IsObject())
+ int nonCallback = toInt32(args[0]);
+ if (args.Length() <= 1 || !args[1]->IsObject())
return throwError(TYPE_MISMATCH_ERR);
RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext());
imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
@@ -977,9 +922,13 @@ static v8::Handle<v8::Value> methodWithCallbackAndOptionalArgCallback(const v8::
{
INC_STATS("DOM.TestObj.methodWithCallbackAndOptionalArg");
TestObj* imp = V8TestObj::toNative(args.Holder());
- RefPtr<TestCallback> callback;
- if (args.Length() > 0 && args[0]->IsObject())
- callback = V8TestCallback::create(args[0], getScriptExecutionContext());
+ if (args.Length() <= 0) {
+ imp->methodWithCallbackAndOptionalArg();
+ return v8::Handle<v8::Value>();
+ }
+ if (args.Length() <= 0 || !args[0]->IsObject())
+ return throwError(TYPE_MISMATCH_ERR);
+ RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
imp->methodWithCallbackAndOptionalArg(callback);
return v8::Handle<v8::Value>();
}
@@ -988,11 +937,7 @@ static v8::Handle<v8::Value> overloadedMethod1Callback(const v8::Arguments& args
{
INC_STATS("DOM.TestObj.overloadedMethod1");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
- if (args.Length() <= 1)
- return throwError(TYPE_MISMATCH_ERR);
+ TestObj* objArg = V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
V8Parameter<> strArg = args[1];
imp->overloadedMethod(objArg, strArg);
return v8::Handle<v8::Value>();
@@ -1002,14 +947,12 @@ static v8::Handle<v8::Value> overloadedMethod2Callback(const v8::Arguments& args
{
INC_STATS("DOM.TestObj.overloadedMethod2");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
+ TestObj* objArg = V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
if (args.Length() <= 1) {
imp->overloadedMethod(objArg);
return v8::Handle<v8::Value>();
}
- EXCEPTION_BLOCK(int, intArg, toInt32(args[1]));
+ int intArg = toInt32(args[1]);
imp->overloadedMethod(objArg, intArg);
return v8::Handle<v8::Value>();
}
@@ -1018,8 +961,6 @@ static v8::Handle<v8::Value> overloadedMethod3Callback(const v8::Arguments& args
{
INC_STATS("DOM.TestObj.overloadedMethod3");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
V8Parameter<> strArg = args[0];
imp->overloadedMethod(strArg);
return v8::Handle<v8::Value>();
@@ -1029,9 +970,7 @@ static v8::Handle<v8::Value> overloadedMethod4Callback(const v8::Arguments& args
{
INC_STATS("DOM.TestObj.overloadedMethod4");
TestObj* imp = V8TestObj::toNative(args.Holder());
- if (args.Length() <= 0)
- return throwError(TYPE_MISMATCH_ERR);
- EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
+ int intArg = toInt32(args[0]);
imp->overloadedMethod(intArg);
return v8::Handle<v8::Value>();
}
@@ -1149,8 +1088,6 @@ static const BatchedCallback TestObjCallbacks[] = {
{"methodWithOptionalArg", TestObjInternal::methodWithOptionalArgCallback},
{"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
{"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
- {"methodWithCallbackArg", TestObjInternal::methodWithCallbackArgCallback},
- {"methodWithNonCallbackArgAndCallbackArg", TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback},
{"methodWithCallbackAndOptionalArg", TestObjInternal::methodWithCallbackAndOptionalArgCallback},
{"overloadedMethod", TestObjInternal::overloadedMethodCallback},
};
@@ -1224,6 +1161,18 @@ static v8::Persistent<v8::FunctionTemplate> ConfigureV8TestObjTemplate(v8::Persi
v8::Handle<v8::FunctionTemplate> customArgsAndExceptionArgv[customArgsAndExceptionArgc] = { V8log::GetRawTemplate() };
v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv);
proto->Set(v8::String::New("customArgsAndException"), v8::FunctionTemplate::New(TestObjInternal::customArgsAndExceptionCallback, v8::Handle<v8::Value>(), customArgsAndExceptionSignature));
+
+ // Custom Signature 'methodWithCallbackArg'
+ const int methodWithCallbackArgArgc = 1;
+ v8::Handle<v8::FunctionTemplate> methodWithCallbackArgArgv[methodWithCallbackArgArgc] = { V8TestCallback::GetRawTemplate() };
+ v8::Handle<v8::Signature> methodWithCallbackArgSignature = v8::Signature::New(desc, methodWithCallbackArgArgc, methodWithCallbackArgArgv);
+ proto->Set(v8::String::New("methodWithCallbackArg"), v8::FunctionTemplate::New(TestObjInternal::methodWithCallbackArgCallback, v8::Handle<v8::Value>(), methodWithCallbackArgSignature));
+
+ // Custom Signature 'methodWithNonCallbackArgAndCallbackArg'
+ const int methodWithNonCallbackArgAndCallbackArgArgc = 2;
+ v8::Handle<v8::FunctionTemplate> methodWithNonCallbackArgAndCallbackArgArgv[methodWithNonCallbackArgAndCallbackArgArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestCallback::GetRawTemplate() };
+ v8::Handle<v8::Signature> methodWithNonCallbackArgAndCallbackArgSignature = v8::Signature::New(desc, methodWithNonCallbackArgAndCallbackArgArgc, methodWithNonCallbackArgAndCallbackArgArgv);
+ proto->Set(v8::String::New("methodWithNonCallbackArgAndCallbackArg"), v8::FunctionTemplate::New(TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback, v8::Handle<v8::Value>(), methodWithNonCallbackArgAndCallbackArgSignature));
batchConfigureConstants(desc, proto, TestObjConsts, sizeof(TestObjConsts) / sizeof(*TestObjConsts));
// Custom toString template
diff --git a/WebCore/bindings/v8/V8Binding.h b/WebCore/bindings/v8/V8Binding.h
index 2b82924..a15ece1 100644
--- a/WebCore/bindings/v8/V8Binding.h
+++ b/WebCore/bindings/v8/V8Binding.h
@@ -33,11 +33,9 @@
#include "AtomicString.h"
#include "BindingSecurity.h"
-#include "ExceptionCode.h"
#include "MathExtras.h"
#include "PlatformString.h"
#include "V8DOMWrapper.h"
-#include "V8Proxy.h"
#include <v8.h>
@@ -227,73 +225,13 @@ namespace WebCore {
v8::Local<v8::Value> m_v8Object;
};
- template<> inline V8Parameter<DefaultMode>::operator String()
- {
- String result;
- v8::TryCatch block;
- result = toWebCoreString(m_v8Object);
- if (block.HasCaught()) {
- V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
- return String();
- }
- return result;
- }
- template<> inline V8Parameter<WithNullCheck>::operator String()
- {
- String result;
- v8::TryCatch block;
- result = toWebCoreStringWithNullCheck(m_v8Object);
- if (block.HasCaught()) {
- V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
- return String();
- }
- return result;
- }
- template<> inline V8Parameter<WithUndefinedOrNullCheck>::operator String()
- {
- String result;
- v8::TryCatch block;
- result = toWebCoreStringWithNullOrUndefinedCheck(m_v8Object);
- if (block.HasCaught()) {
- V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
- return String();
- }
- return result;
- }
+ template<> inline V8Parameter<DefaultMode>::operator String() { return toWebCoreString(m_v8Object); }
+ template<> inline V8Parameter<WithNullCheck>::operator String() { return toWebCoreStringWithNullCheck(m_v8Object); }
+ template<> inline V8Parameter<WithUndefinedOrNullCheck>::operator String() { return toWebCoreStringWithNullOrUndefinedCheck(m_v8Object); }
- template<> inline V8Parameter<DefaultMode>::operator AtomicString()
- {
- AtomicString result;
- v8::TryCatch block;
- result = v8ValueToAtomicWebCoreString(m_v8Object);
- if (block.HasCaught()) {
- V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
- return AtomicString();
- }
- return result;
- }
- template<> inline V8Parameter<WithNullCheck>::operator AtomicString()
- {
- AtomicString result;
- v8::TryCatch block;
- result = toAtomicWebCoreStringWithNullCheck(m_v8Object);
- if (block.HasCaught()) {
- V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
- return AtomicString();
- }
- return result;
- }
- template<> inline V8Parameter<WithUndefinedOrNullCheck>::operator AtomicString()
- {
- AtomicString result;
- v8::TryCatch block;
- result = toAtomicWebCoreStringWithNullCheck(m_v8Object);
- if (block.HasCaught()) {
- V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
- return AtomicString();
- }
- return result;
- }
+ template<> inline V8Parameter<DefaultMode>::operator AtomicString() { return v8ValueToAtomicWebCoreString(m_v8Object); }
+ template<> inline V8Parameter<WithNullCheck>::operator AtomicString() { return toAtomicWebCoreStringWithNullCheck(m_v8Object); }
+ template<> inline V8Parameter<WithUndefinedOrNullCheck>::operator AtomicString() { return toAtomicWebCoreStringWithNullCheck(m_v8Object); }
} // namespace WebCore
diff --git a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
index e16d253..b4fa74f 100644
--- a/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
@@ -32,6 +32,7 @@
#include "V8DOMWindow.h"
#include "Chrome.h"
+#include "Database.h"
#include "DOMTimer.h"
#include "DOMWindow.h"
#include "ExceptionCode.h"
@@ -54,6 +55,8 @@
#include "V8BindingMacros.h"
#include "V8BindingState.h"
#include "V8CustomEventListener.h"
+#include "V8Database.h"
+#include "V8DatabaseCallback.h"
#include "V8GCForContextDispose.h"
#include "V8HiddenPropertyName.h"
#include "V8HTMLAudioElementConstructor.h"
@@ -787,6 +790,39 @@ v8::Handle<v8::Value> V8DOMWindow::setIntervalCallback(const v8::Arguments& args
return WindowSetTimeoutImpl(args, false);
}
+#if ENABLE(DATABASE)
+v8::Handle<v8::Value> V8DOMWindow::openDatabaseCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.DOMWindow.openDatabase");
+ if (args.Length() < 4)
+ return throwError(SYNTAX_ERR);
+
+ TO_WEBCORE_STRING_EXCEPTION_BLOCK(name, args[0]);
+ TO_WEBCORE_STRING_EXCEPTION_BLOCK(version, args[1]);
+ TO_WEBCORE_STRING_EXCEPTION_BLOCK(displayName, args[2]);
+ EXCEPTION_BLOCK(unsigned long, estimatedSize, args[3]->Uint32Value());
+
+ DOMWindow* imp = V8DOMWindow::toNative(args.Holder());
+ 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], scriptExecutionContext);
+ }
+
+ ExceptionCode ec = 0;
+ v8::Handle<v8::Value> result = toV8(imp->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec));
+
+ V8Proxy::setDOMException(ec);
+ return result;
+}
+#endif // ENABLE(DATABASE)
+
bool V8DOMWindow::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>)
{
v8::Handle<v8::Object> window = V8DOMWrapper::lookupDOMWrapper(V8DOMWindow::GetTemplate(), host);
diff --git a/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
new file mode 100644
index 0000000..f8ea40c
--- /dev/null
+++ b/WebCore/bindings/v8/custom/V8DatabaseCustom.cpp
@@ -0,0 +1,141 @@
+/*
+ * Copyright (C) 2009 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"
+
+#if ENABLE(DATABASE)
+#include "V8Database.h"
+
+#include "Database.h"
+#include "ExceptionCode.h"
+#include "V8Binding.h"
+#include "V8BindingMacros.h"
+#include "V8SQLTransactionCallback.h"
+#include "V8SQLTransactionErrorCallback.h"
+#include "V8CustomVoidCallback.h"
+#include "V8Proxy.h"
+
+namespace WebCore {
+
+v8::Handle<v8::Value> V8Database::changeVersionCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.Database.changeVersion()");
+
+ if (args.Length() < 2)
+ return throwError(SYNTAX_ERR);
+
+ TO_WEBCORE_STRING_EXCEPTION_BLOCK(oldVersion, args[0]);
+ TO_WEBCORE_STRING_EXCEPTION_BLOCK(newVersion, args[1]);
+
+ Database* database = V8Database::toNative(args.Holder());
+
+ ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
+ if (!scriptExecutionContext)
+ return v8::Undefined();
+
+ RefPtr<V8SQLTransactionCallback> callback;
+ if (args.Length() > 2 && !isUndefinedOrNull(args[2])) {
+ if (!args[2]->IsObject())
+ return throwError(TYPE_MISMATCH_ERR);
+
+ callback = V8SQLTransactionCallback::create(args[2], scriptExecutionContext);
+ }
+
+ RefPtr<V8SQLTransactionErrorCallback> errorCallback;
+ if (args.Length() > 3 && !isUndefinedOrNull(args[3])) {
+ if (!args[3]->IsObject())
+ return throwError(TYPE_MISMATCH_ERR);
+
+ errorCallback = V8SQLTransactionErrorCallback::create(args[3], scriptExecutionContext);
+ }
+
+ RefPtr<V8CustomVoidCallback> successCallback;
+ if (args.Length() > 4 && !isUndefinedOrNull(args[4])) {
+ if (!args[4]->IsObject())
+ return throwError(TYPE_MISMATCH_ERR);
+
+ successCallback = V8CustomVoidCallback::create(args[4], scriptExecutionContext);
+ }
+
+ database->changeVersion(oldVersion, newVersion, callback.release(), errorCallback.release(), successCallback.release());
+
+ return v8::Undefined();
+}
+
+static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool readOnly)
+{
+ if (!args.Length())
+ return throwError(SYNTAX_ERR);
+
+ if (!args[0]->IsObject())
+ return throwError(TYPE_MISMATCH_ERR);
+
+ Database* database = V8Database::toNative(args.Holder());
+
+ ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
+ if (!scriptExecutionContext)
+ return v8::Undefined();
+ 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], scriptExecutionContext);
+ }
+
+ RefPtr<V8CustomVoidCallback> successCallback;
+ if (args.Length() > 2 && !isUndefinedOrNull(args[2])) {
+ if (!args[2]->IsObject())
+ return throwError(TYPE_MISMATCH_ERR);
+
+ successCallback = V8CustomVoidCallback::create(args[2], scriptExecutionContext);
+ }
+
+ database->transaction(callback.release(), errorCallback.release(), successCallback.release(), readOnly);
+ return v8::Undefined();
+}
+
+v8::Handle<v8::Value> V8Database::transactionCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.Database.transaction()");
+ return createTransaction(args, false);
+}
+
+v8::Handle<v8::Value> V8Database::readTransactionCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.Database.readTransaction()");
+ return createTransaction(args, true);
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/bindings/v8/custom/V8DatabaseSyncCustom.cpp b/WebCore/bindings/v8/custom/V8DatabaseSyncCustom.cpp
new file mode 100644
index 0000000..af72053
--- /dev/null
+++ b/WebCore/bindings/v8/custom/V8DatabaseSyncCustom.cpp
@@ -0,0 +1,107 @@
+/*
+ * 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"
+
+#if ENABLE(DATABASE)
+#include "V8DatabaseSync.h"
+
+#include "DatabaseSync.h"
+#include "ExceptionCode.h"
+#include "V8Binding.h"
+#include "V8BindingMacros.h"
+#include "V8Proxy.h"
+#include "V8SQLTransactionSyncCallback.h"
+
+namespace WebCore {
+
+v8::Handle<v8::Value> V8DatabaseSync::changeVersionCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.DatabaseSync.changeVersion()");
+
+ if (args.Length() < 2)
+ return throwError(SYNTAX_ERR);
+
+ TO_WEBCORE_STRING_EXCEPTION_BLOCK(oldVersion, args[0]);
+ TO_WEBCORE_STRING_EXCEPTION_BLOCK(newVersion, args[1]);
+
+ 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], scriptExecutionContext);
+ }
+
+ ExceptionCode ec = 0;
+ database->changeVersion(oldVersion, newVersion, callback.release(), ec);
+ V8Proxy::setDOMException(ec);
+
+ return v8::Undefined();
+}
+
+static v8::Handle<v8::Value> createTransaction(const v8::Arguments& args, bool readOnly)
+{
+ if (!args.Length())
+ return throwError(SYNTAX_ERR);
+
+ if (!args[0]->IsObject())
+ return throwError(TYPE_MISMATCH_ERR);
+
+ DatabaseSync* database = V8DatabaseSync::toNative(args.Holder());
+
+ ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
+ RefPtr<V8SQLTransactionSyncCallback> callback = V8SQLTransactionSyncCallback::create(args[0], scriptExecutionContext);
+
+ ExceptionCode ec = 0;
+ database->transaction(callback.release(), readOnly, ec);
+ V8Proxy::setDOMException(ec);
+
+ return v8::Undefined();
+}
+
+v8::Handle<v8::Value> V8DatabaseSync::transactionCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.DatabaseSync.transaction()");
+ return createTransaction(args, false);
+}
+
+v8::Handle<v8::Value> V8DatabaseSync::readTransactionCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.DatabaseSync.readTransaction()");
+ return createTransaction(args, true);
+}
+
+} // namespace WebCore
+
+#endif
diff --git a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp b/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
index 823ca28..7633a2a 100644
--- a/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
+++ b/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
@@ -33,6 +33,12 @@
#if ENABLE(WORKERS)
#include "V8WorkerContext.h"
+#if ENABLE(DATABASE)
+#include "Database.h"
+#include "V8Database.h"
+#include "V8DatabaseCallback.h"
+#include "V8DatabaseSync.h"
+#endif
#include "DOMTimer.h"
#include "ExceptionCode.h"
#include "ScheduledAction.h"
@@ -137,6 +143,66 @@ v8::Handle<v8::Value> toV8(WorkerContext* impl)
return global;
}
+#if ENABLE(DATABASE)
+v8::Handle<v8::Value> V8WorkerContext::openDatabaseCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.V8WorkerContext.openDatabase()");
+ if (args.Length() < 4)
+ return throwError(SYNTAX_ERR);
+
+ TO_WEBCORE_STRING_EXCEPTION_BLOCK(name, args[0]);
+ TO_WEBCORE_STRING_EXCEPTION_BLOCK(version, args[1]);
+ TO_WEBCORE_STRING_EXCEPTION_BLOCK(displayName, args[2]);
+ EXCEPTION_BLOCK(unsigned long, estimatedSize, args[3]->Uint32Value());
+
+ 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], scriptExecutionContext);
+ }
+
+ ExceptionCode ec = 0;
+ v8::Handle<v8::Value> result = toV8(workerContext->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec));
+
+ V8Proxy::setDOMException(ec);
+ return result;
+}
+
+v8::Handle<v8::Value> V8WorkerContext::openDatabaseSyncCallback(const v8::Arguments& args)
+{
+ INC_STATS("DOM.V8WorkerContext.openDatabaseSync()");
+ if (args.Length() < 4)
+ return throwError(SYNTAX_ERR);
+
+ TO_WEBCORE_STRING_EXCEPTION_BLOCK(name, args[0]);
+ TO_WEBCORE_STRING_EXCEPTION_BLOCK(version, args[1]);
+ TO_WEBCORE_STRING_EXCEPTION_BLOCK(displayName, args[2]);
+ EXCEPTION_BLOCK(unsigned long, estimatedSize, args[3]->Uint32Value());
+
+ 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], scriptExecutionContext);
+ }
+
+ ExceptionCode ec = 0;
+ v8::Handle<v8::Value> result = toV8(workerContext->openDatabaseSync(name, version, displayName, estimatedSize, creationCallback.release(), ec));
+
+ V8Proxy::setDOMException(ec);
+ return result;
+}
+#endif
+
} // namespace WebCore
#endif // ENABLE(WORKERS)
diff --git a/WebCore/page/DOMWindow.idl b/WebCore/page/DOMWindow.idl
index 5c2a3a6..dc1c323 100644
--- a/WebCore/page/DOMWindow.idl
+++ b/WebCore/page/DOMWindow.idl
@@ -160,7 +160,7 @@ module window {
readonly attribute [EnabledAtRuntime] DOMApplicationCache applicationCache;
#endif
#if defined(ENABLE_DATABASE) && ENABLE_DATABASE
- [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Optional, Callback] DatabaseCallback creationCallback)
+ [EnabledAtRuntime, Custom] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback creationCallback)
raises(DOMException);
#endif
#if defined(ENABLE_DOM_STORAGE) && ENABLE_DOM_STORAGE
diff --git a/WebCore/storage/Database.cpp b/WebCore/storage/Database.cpp
index 9550083..2d60acb 100644
--- a/WebCore/storage/Database.cpp
+++ b/WebCore/storage/Database.cpp
@@ -270,18 +270,8 @@ void Database::changeVersion(const String& oldVersion, const String& newVersion,
scheduleTransaction();
}
-void Database::transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback)
-{
- runTransaction(callback, errorCallback, successCallback, false);
-}
-
-void Database::readTransaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback)
-{
- runTransaction(callback, errorCallback, successCallback, true);
-}
-
-void Database::runTransaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
- PassRefPtr<VoidCallback> successCallback, bool readOnly)
+void Database::transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
+ PassRefPtr<VoidCallback> successCallback, bool readOnly)
{
m_transactionQueue.append(SQLTransaction::create(this, callback, errorCallback, successCallback, 0, readOnly));
MutexLocker locker(m_transactionInProgressMutex);
diff --git a/WebCore/storage/Database.h b/WebCore/storage/Database.h
index 47001a4..e8482a7 100644
--- a/WebCore/storage/Database.h
+++ b/WebCore/storage/Database.h
@@ -59,8 +59,8 @@ public:
virtual String version() const;
void changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionCallback>,
PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
- void transaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
- void readTransaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
+ void transaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>,
+ PassRefPtr<VoidCallback> successCallback, bool readOnly);
// Internal engine support
Vector<String> tableNames();
@@ -90,8 +90,6 @@ private:
Database(ScriptExecutionContext*, const String& name, const String& expectedVersion,
const String& displayName, unsigned long estimatedSize);
- void runTransaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>,
- PassRefPtr<VoidCallback> successCallback, bool readOnly);
bool openAndVerifyVersion(bool setVersionInNewDatabase, ExceptionCode&);
virtual bool performOpenAndVerify(bool setVersionInNewDatabase, ExceptionCode&);
diff --git a/WebCore/storage/Database.idl b/WebCore/storage/Database.idl
index 9f70aed..ab79c97 100644
--- a/WebCore/storage/Database.idl
+++ b/WebCore/storage/Database.idl
@@ -34,9 +34,9 @@ module storage {
NoStaticTables
] Database {
readonly attribute DOMString version;
- void changeVersion(in DOMString oldVersion, in DOMString newVersion, in [Optional, Callback] SQLTransactionCallback callback, in [Optional, Callback] SQLTransactionErrorCallback errorCallback, in [Optional, Callback] VoidCallback successCallback);
- void transaction(in [Callback] SQLTransactionCallback callback, in [Optional, Callback] SQLTransactionErrorCallback errorCallback, in [Optional, Callback] VoidCallback successCallback);
- void readTransaction(in [Callback] SQLTransactionCallback callback, in [Optional, Callback] SQLTransactionErrorCallback errorCallback, in [Optional, Callback] VoidCallback successCallback);
+ [Custom] void changeVersion(in DOMString oldVersion, in DOMString newVersion, in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, in VoidCallback successCallback);
+ [Custom] void transaction(in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, in VoidCallback successCallback);
+ [Custom] void readTransaction(in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, in VoidCallback successCallback);
};
}
diff --git a/WebCore/storage/DatabaseSync.cpp b/WebCore/storage/DatabaseSync.cpp
index 817fdcc..4c940dd 100644
--- a/WebCore/storage/DatabaseSync.cpp
+++ b/WebCore/storage/DatabaseSync.cpp
@@ -128,17 +128,7 @@ void DatabaseSync::changeVersion(const String& oldVersion, const String& newVers
setExpectedVersion(newVersion);
}
-void DatabaseSync::transaction(PassRefPtr<SQLTransactionSyncCallback> callback, ExceptionCode& ec)
-{
- runTransaction(callback, false, ec);
-}
-
-void DatabaseSync::readTransaction(PassRefPtr<SQLTransactionSyncCallback> callback, ExceptionCode& ec)
-{
- runTransaction(callback, true, ec);
-}
-
-void DatabaseSync::runTransaction(PassRefPtr<SQLTransactionSyncCallback> callback, bool readOnly, ExceptionCode& ec)
+void DatabaseSync::transaction(PassRefPtr<SQLTransactionSyncCallback> callback, bool readOnly, ExceptionCode& ec)
{
ASSERT(m_scriptExecutionContext->isContextThread());
diff --git a/WebCore/storage/DatabaseSync.h b/WebCore/storage/DatabaseSync.h
index 6563b23..2019f85 100644
--- a/WebCore/storage/DatabaseSync.h
+++ b/WebCore/storage/DatabaseSync.h
@@ -56,8 +56,7 @@ public:
static PassRefPtr<DatabaseSync> openDatabaseSync(ScriptExecutionContext*, const String& name, const String& expectedVersion,
const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback>, ExceptionCode&);
void changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionSyncCallback>, ExceptionCode&);
- void transaction(PassRefPtr<SQLTransactionSyncCallback>, ExceptionCode&);
- void readTransaction(PassRefPtr<SQLTransactionSyncCallback>, ExceptionCode&);
+ void transaction(PassRefPtr<SQLTransactionSyncCallback>, bool readOnly, ExceptionCode&);
virtual void markAsDeletedAndClose();
virtual void closeImmediately();
@@ -65,7 +64,6 @@ public:
private:
DatabaseSync(ScriptExecutionContext*, const String& name, const String& expectedVersion,
const String& displayName, unsigned long estimatedSize);
- void runTransaction(PassRefPtr<SQLTransactionSyncCallback>, bool readOnly, ExceptionCode&);
};
} // namespace WebCore
diff --git a/WebCore/storage/DatabaseSync.idl b/WebCore/storage/DatabaseSync.idl
index ff30b38..30adf38 100644
--- a/WebCore/storage/DatabaseSync.idl
+++ b/WebCore/storage/DatabaseSync.idl
@@ -36,9 +36,9 @@ module storage {
NoStaticTables
] DatabaseSync {
readonly attribute DOMString version;
- void changeVersion(in DOMString oldVersion, in DOMString newVersion, in [Callback, Optional] SQLTransactionSyncCallback callback) raises(DOMException);
- void transaction(in [Callback] SQLTransactionSyncCallback callback) raises(DOMException);
- void readTransaction(in [Callback] SQLTransactionSyncCallback callback) raises(DOMException);
+ [Custom] void changeVersion(in DOMString oldVersion, in DOMString newVersion, in SQLTransactionSyncCallback callback);
+ [Custom] void transaction(in SQLTransactionSyncCallback callback);
+ [Custom] void readTransaction(in SQLTransactionSyncCallback callback);
};
}
diff --git a/WebCore/workers/WorkerContext.idl b/WebCore/workers/WorkerContext.idl
index c5afe5c..902c985 100644
--- a/WebCore/workers/WorkerContext.idl
+++ b/WebCore/workers/WorkerContext.idl
@@ -50,10 +50,9 @@ module threads {
[Custom] void importScripts(/*[Variadic] in DOMString urls */);
attribute [Replaceable] WorkerNavigator navigator;
#if defined(ENABLE_DATABASE) && ENABLE_DATABASE
- [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Optional, Callback] DatabaseCallback creationCallback)
- raises(DOMException);
- [EnabledAtRuntime] DatabaseSync openDatabaseSync(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Optional, Callback] DatabaseCallback creationCallback)
+ [EnabledAtRuntime, Custom] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback creationCallback)
raises(DOMException);
+ [EnabledAtRuntime, Custom] DatabaseSync openDatabaseSync(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback creationCallback);
#endif
// Timers
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list