Changeset 64840 in webkit
- Timestamp:
- Aug 6, 2010 5:59:31 AM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 added
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r64838 r64840 1 2010-08-06 Pavel Feldman <pfeldman@chromium.org> 2 3 Not reviewed. Rolling out 64835, 64836 and 64839. 4 5 * fast/workers/storage/open-database-inputs-sync-expected.txt: 6 * fast/workers/storage/resources/open-database-inputs-sync.js: 7 * storage/null-callbacks.html: 8 1 9 2010-08-06 Adam Barth <abarth@webkit.org> 2 10 -
trunk/LayoutTests/fast/workers/storage/open-database-inputs-sync-expected.txt
r64835 r64840 1 1 This test makes sure that openDatabaseSync() accepts only valid parameters. 2 PASS: TYPE_MISMATCH_ERR: DOM Exception 173 PASS: TYPE_MISMATCH_ERR: DOM Exception 172 PASS: SYNTAX_ERR: DOM Exception 12 3 PASS: SYNTAX_ERR: DOM Exception 12 4 4 PASS: undefined 5 5 PASS: undefined 6 6 PASS: undefined 7 PASS: calling openDatabaseSync() with a null creation callback succeeded.7 PASS: TYPE_MISMATCH_ERR: DOM Exception 17 8 8 PASS: openDatabaseSync() succeeded. 9 9 PASS: openDatabaseSync() succeeded. -
trunk/LayoutTests/fast/workers/storage/resources/open-database-inputs-sync.js
r64835 r64840 42 42 try { 43 43 db = openDatabaseSync("DBName", "DBVersion", "DBDescription", 1024, 0); 44 postMessage(" PASS: calling openDatabaseSync() with a null creation callback succeeded.");44 postMessage("FAIL: the fifth argument to openDatabaseSync() must be an object, if present."); 45 45 } catch (err) { 46 postMessage(" FAIL: " + err.message);46 postMessage("PASS: " + err.message); 47 47 } 48 48 -
trunk/LayoutTests/storage/null-callbacks.html
r64835 r64840 31 31 }, null, function() { finishTest(); }); 32 32 } catch(err) { 33 document.getElementById("console").innerHTML = "FAIL : " + err.message;33 document.getElementById("console").innerHTML = "FAIL"; 34 34 finishTest(); 35 35 } -
trunk/WebCore/Android.jscbindings.mk
r64835 r64840 91 91 bindings/js/JSDataGridColumnListCustom.cpp \ 92 92 bindings/js/JSDataGridDataSource.cpp \ 93 bindings/js/JSDatabaseCustom.cpp \ 93 94 bindings/js/JSDedicatedWorkerContextCustom.cpp \ 94 95 bindings/js/JSDesktopNotificationsCustom.cpp \ -
trunk/WebCore/Android.v8bindings.mk
r64835 r64840 107 107 bindings/v8/custom/V8DataGridColumnListCustom.cpp \ 108 108 bindings/v8/custom/V8DatabaseCallback.cpp \ 109 bindings/v8/custom/V8DatabaseCustom.cpp \ 109 110 bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp \ 110 111 bindings/v8/custom/V8DeviceOrientationEventCustom.cpp \ -
trunk/WebCore/CMakeLists.txt
r64835 r64840 590 590 bindings/js/JSCustomVoidCallback.cpp 591 591 bindings/js/JSCustomXPathNSResolver.cpp 592 bindings/js/JSDatabaseCustom.cpp 593 bindings/js/JSDatabaseCustom.cpp 594 bindings/js/JSDatabaseSyncCustom.cpp 592 595 bindings/js/JSDataGridColumnListCustom.cpp 593 596 bindings/js/JSDataGridDataSource.cpp -
trunk/WebCore/ChangeLog
r64839 r64840 1 2010-08-06 Pavel Feldman <pfeldman@chromium.org> 2 3 Not reviewed. Rolling out 64835, 64836 and 64839. 4 5 * Android.jscbindings.mk: 6 * Android.v8bindings.mk: 7 * CMakeLists.txt: 8 * GNUmakefile.am: 9 * WebCore.gypi: 10 * WebCore.pro: 11 * WebCore.vcproj/WebCore.vcproj: 12 * WebCore.xcodeproj/project.pbxproj: 13 * bindings/js/JSBindingsAllInOne.cpp: 14 * bindings/js/JSDOMWindowCustom.cpp: 15 (WebCore::JSDOMWindow::openDatabase): 16 * bindings/js/JSDatabaseCustom.cpp: Added. 17 (WebCore::JSDatabase::changeVersion): 18 (WebCore::createTransaction): 19 (WebCore::JSDatabase::transaction): 20 (WebCore::JSDatabase::readTransaction): 21 * bindings/js/JSDatabaseSyncCustom.cpp: Added. 22 (WebCore::JSDatabaseSync::changeVersion): 23 (WebCore::createTransaction): 24 (WebCore::JSDatabaseSync::transaction): 25 (WebCore::JSDatabaseSync::readTransaction): 26 * bindings/js/JSWorkerContextCustom.cpp: 27 (WebCore::JSWorkerContext::openDatabase): 28 (WebCore::JSWorkerContext::openDatabaseSync): 29 * bindings/scripts/CodeGeneratorGObject.pm: 30 * bindings/scripts/CodeGeneratorJS.pm: 31 * bindings/scripts/CodeGeneratorV8.pm: 32 * bindings/scripts/test/JS/JSTestCallback.cpp: 33 (WebCore::JSTestCallback::~JSTestCallback): 34 * bindings/scripts/test/JS/JSTestObj.cpp: 35 (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs): 36 (WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs): 37 (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs): 38 (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgs): 39 (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows): 40 (WebCore::jsTestObjPrototypeFunctionSerializedValue): 41 (WebCore::jsTestObjPrototypeFunctionIdbKey): 42 (WebCore::jsTestObjPrototypeFunctionCustomArgsAndException): 43 (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndArg): 44 (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg): 45 (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture): 46 (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD): 47 (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg): 48 (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg): 49 (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs): 50 (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg): 51 (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg): 52 (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg): 53 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1): 54 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2): 55 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3): 56 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4): 57 * bindings/scripts/test/TestObj.idl: 58 * bindings/scripts/test/V8/V8TestObj.cpp: 59 (WebCore::TestObjInternal::voidMethodWithArgsCallback): 60 (WebCore::TestObjInternal::intMethodWithArgsCallback): 61 (WebCore::TestObjInternal::objMethodWithArgsCallback): 62 (WebCore::TestObjInternal::methodThatRequiresAllArgsCallback): 63 (WebCore::TestObjInternal::methodThatRequiresAllArgsAndThrowsCallback): 64 (WebCore::TestObjInternal::serializedValueCallback): 65 (WebCore::TestObjInternal::idbKeyCallback): 66 (WebCore::TestObjInternal::customArgsAndExceptionCallback): 67 (WebCore::TestObjInternal::withDynamicFrameAndArgCallback): 68 (WebCore::TestObjInternal::withDynamicFrameAndOptionalArgCallback): 69 (WebCore::TestObjInternal::withDynamicFrameAndUserGestureCallback): 70 (WebCore::TestObjInternal::withDynamicFrameAndUserGestureASADCallback): 71 (WebCore::TestObjInternal::methodWithOptionalArgCallback): 72 (WebCore::TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback): 73 (WebCore::TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback): 74 (WebCore::TestObjInternal::methodWithCallbackArgCallback): 75 (WebCore::TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback): 76 (WebCore::TestObjInternal::methodWithCallbackAndOptionalArgCallback): 77 (WebCore::TestObjInternal::overloadedMethod1Callback): 78 (WebCore::TestObjInternal::overloadedMethod2Callback): 79 (WebCore::TestObjInternal::overloadedMethod3Callback): 80 (WebCore::TestObjInternal::overloadedMethod4Callback): 81 (WebCore::): 82 (WebCore::ConfigureV8TestObjTemplate): 83 * bindings/v8/V8Binding.h: 84 (WebCore::String): 85 (WebCore::AtomicString): 86 * bindings/v8/custom/V8DOMWindowCustom.cpp: 87 (WebCore::V8DOMWindow::openDatabaseCallback): 88 * bindings/v8/custom/V8DatabaseCustom.cpp: Added. 89 (WebCore::V8Database::changeVersionCallback): 90 (WebCore::createTransaction): 91 (WebCore::V8Database::transactionCallback): 92 (WebCore::V8Database::readTransactionCallback): 93 * bindings/v8/custom/V8DatabaseSyncCustom.cpp: Added. 94 (WebCore::V8DatabaseSync::changeVersionCallback): 95 (WebCore::createTransaction): 96 (WebCore::V8DatabaseSync::transactionCallback): 97 (WebCore::V8DatabaseSync::readTransactionCallback): 98 * bindings/v8/custom/V8WorkerContextCustom.cpp: 99 (WebCore::V8WorkerContext::openDatabaseCallback): 100 (WebCore::V8WorkerContext::openDatabaseSyncCallback): 101 * page/DOMWindow.idl: 102 * storage/Database.cpp: 103 (WebCore::Database::transaction): 104 * storage/Database.h: 105 * storage/Database.idl: 106 * storage/DatabaseSync.cpp: 107 (WebCore::DatabaseSync::transaction): 108 * storage/DatabaseSync.h: 109 * storage/DatabaseSync.idl: 110 * workers/WorkerContext.idl: 111 1 112 2010-08-06 Dumitru Daniliuc <dumi@chromium.org> 2 113 -
trunk/WebCore/GNUmakefile.am
r64835 r64840 2728 2728 webcore_sources += \ 2729 2729 WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp \ 2730 WebCore/bindings/js/JSDatabaseCustom.cpp \ 2731 WebCore/bindings/js/JSDatabaseSyncCustom.cpp \ 2730 2732 WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp \ 2731 2733 WebCore/bindings/js/JSSQLTransactionCustom.cpp \ -
trunk/WebCore/WebCore.gypi
r64835 r64840 543 543 'bindings/js/JSCustomXPathNSResolver.cpp', 544 544 'bindings/js/JSCustomXPathNSResolver.h', 545 'bindings/js/JSDatabaseCustom.cpp', 546 'bindings/js/JSDatabaseSyncCustom.cpp', 545 547 'bindings/js/JSDataGridColumnListCustom.cpp', 546 548 'bindings/js/JSDataGridDataSource.cpp', … … 739 741 'bindings/v8/custom/V8CustomXPathNSResolver.cpp', 740 742 'bindings/v8/custom/V8CustomXPathNSResolver.h', 743 'bindings/v8/custom/V8DatabaseCustom.cpp', 744 'bindings/v8/custom/V8DatabaseSyncCustom.cpp', 741 745 'bindings/v8/custom/V8DataGridColumnListCustom.cpp', 742 746 'bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp', -
trunk/WebCore/WebCore.pro
r64835 r64840 2413 2413 storage/SQLTransactionSync.cpp \ 2414 2414 bindings/js/JSCustomSQLStatementErrorCallback.cpp \ 2415 bindings/js/JSDatabaseCustom.cpp \ 2416 bindings/js/JSDatabaseSyncCustom.cpp \ 2415 2417 bindings/js/JSSQLResultSetRowListCustom.cpp \ 2416 2418 bindings/js/JSSQLTransactionCustom.cpp \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r64835 r64840 42081 42081 </File> 42082 42082 <File 42083 RelativePath="..\bindings\js\JSDatabaseCustom.cpp" 42084 > 42085 <FileConfiguration 42086 Name="Debug|Win32" 42087 ExcludedFromBuild="true" 42088 > 42089 <Tool 42090 Name="VCCLCompilerTool" 42091 /> 42092 </FileConfiguration> 42093 <FileConfiguration 42094 Name="Release|Win32" 42095 ExcludedFromBuild="true" 42096 > 42097 <Tool 42098 Name="VCCLCompilerTool" 42099 /> 42100 </FileConfiguration> 42101 <FileConfiguration 42102 Name="Debug_Internal|Win32" 42103 ExcludedFromBuild="true" 42104 > 42105 <Tool 42106 Name="VCCLCompilerTool" 42107 /> 42108 </FileConfiguration> 42109 <FileConfiguration 42110 Name="Debug_Cairo|Win32" 42111 ExcludedFromBuild="true" 42112 > 42113 <Tool 42114 Name="VCCLCompilerTool" 42115 /> 42116 </FileConfiguration> 42117 <FileConfiguration 42118 Name="Release_Cairo|Win32" 42119 ExcludedFromBuild="true" 42120 > 42121 <Tool 42122 Name="VCCLCompilerTool" 42123 /> 42124 </FileConfiguration> 42125 <FileConfiguration 42126 Name="Debug_All|Win32" 42127 ExcludedFromBuild="true" 42128 > 42129 <Tool 42130 Name="VCCLCompilerTool" 42131 /> 42132 </FileConfiguration> 42133 </File> 42134 <File 42135 RelativePath="..\bindings\js\JSDatabaseSyncCustom.cpp" 42136 > 42137 <FileConfiguration 42138 Name="Debug|Win32" 42139 ExcludedFromBuild="true" 42140 > 42141 <Tool 42142 Name="VCCLCompilerTool" 42143 /> 42144 </FileConfiguration> 42145 <FileConfiguration 42146 Name="Release|Win32" 42147 ExcludedFromBuild="true" 42148 > 42149 <Tool 42150 Name="VCCLCompilerTool" 42151 /> 42152 </FileConfiguration> 42153 <FileConfiguration 42154 Name="Debug_Internal|Win32" 42155 ExcludedFromBuild="true" 42156 > 42157 <Tool 42158 Name="VCCLCompilerTool" 42159 /> 42160 </FileConfiguration> 42161 <FileConfiguration 42162 Name="Debug_Cairo|Win32" 42163 ExcludedFromBuild="true" 42164 > 42165 <Tool 42166 Name="VCCLCompilerTool" 42167 /> 42168 </FileConfiguration> 42169 <FileConfiguration 42170 Name="Release_Cairo|Win32" 42171 ExcludedFromBuild="true" 42172 > 42173 <Tool 42174 Name="VCCLCompilerTool" 42175 /> 42176 </FileConfiguration> 42177 <FileConfiguration 42178 Name="Debug_All|Win32" 42179 ExcludedFromBuild="true" 42180 > 42181 <Tool 42182 Name="VCCLCompilerTool" 42183 /> 42184 </FileConfiguration> 42185 </File> 42186 <File 42083 42187 RelativePath="..\bindings\js\JSDataGridColumnListCustom.cpp" 42084 42188 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r64835 r64840 4337 4337 B55D5AA4119131FC00BCC315 /* JSSQLTransactionSyncCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */; }; 4338 4338 B55D5AA5119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA3119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp */; }; 4339 B55D5AA81191325000BCC315 /* JSDatabaseSyncCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */; }; 4339 4340 B55D5AA91191325000BCC315 /* JSSQLTransactionSyncCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA71191325000BCC315 /* JSSQLTransactionSyncCustom.cpp */; }; 4340 4341 B56EBA8511C9FF8100B04477 /* SQLException.h in Headers */ = {isa = PBXBuildFile; fileRef = B56EBA8311C9FF8100B04477 /* SQLException.h */; }; … … 4794 4795 BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */; }; 4795 4796 BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */; }; 4797 BCCE58AC1061E8CF008FB35A /* JSDatabaseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */; }; 4796 4798 BCCFBAE80B5152ED0001F1D7 /* DocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4797 4799 BCD0E0FA0E972C3500265DEA /* SecurityOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */; }; … … 10004 10006 B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransactionSyncCallback.h; sourceTree = "<group>"; }; 10005 10007 B55D5AA3119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionSyncCallback.cpp; sourceTree = "<group>"; }; 10008 B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseSyncCustom.cpp; sourceTree = "<group>"; }; 10006 10009 B55D5AA71191325000BCC315 /* JSSQLTransactionSyncCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionSyncCustom.cpp; sourceTree = "<group>"; }; 10007 10010 B55D5ABB1191327200BCC315 /* DatabaseSync.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DatabaseSync.idl; sourceTree = "<group>"; }; … … 10498 10501 BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLViewSourceDocument.h; sourceTree = "<group>"; }; 10499 10502 BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLViewSourceDocument.cpp; sourceTree = "<group>"; }; 10503 BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseCustom.cpp; sourceTree = "<group>"; }; 10500 10504 BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DocumentParser.h; sourceTree = "<group>"; }; 10501 10505 BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityOrigin.cpp; sourceTree = "<group>"; }; … … 15946 15950 BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */, 15947 15951 BC20FB7E0C0E8E6C00D1447F /* JSCSSValueCustom.cpp */, 15952 BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */, 15953 B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */, 15948 15954 BC77D1510FF19C730070887B /* JSDataGridColumnListCustom.cpp */, 15949 15955 4162A453101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp */, … … 21202 21208 1AE82F8F0CAAFA9D002237AE /* JSDatabase.cpp in Sources */, 21203 21209 B59DD69A119029E5007E9684 /* JSDatabaseCallback.cpp in Sources */, 21210 BCCE58AC1061E8CF008FB35A /* JSDatabaseCustom.cpp in Sources */, 21204 21211 B58CEB6A11913607002A6790 /* JSDatabaseSync.cpp in Sources */, 21212 B55D5AA81191325000BCC315 /* JSDatabaseSyncCustom.cpp in Sources */, 21205 21213 BC77D1690FF19F560070887B /* JSDataGridColumn.cpp in Sources */, 21206 21214 BC77D16B0FF19F560070887B /* JSDataGridColumnList.cpp in Sources */, -
trunk/WebCore/bindings/js/JSBindingsAllInOne.cpp
r64835 r64840 58 58 #include "JSDataGridColumnListCustom.cpp" 59 59 #include "JSDataGridDataSource.cpp" 60 #include "JSDatabaseCustom.cpp" 61 #include "JSDatabaseSyncCustom.cpp" 60 62 #include "JSDebugWrapperSet.cpp" 61 63 #include "JSDedicatedWorkerContextCustom.cpp" -
trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp
r64835 r64840 23 23 #include "AtomicString.h" 24 24 #include "Chrome.h" 25 #include "Database.h" 25 26 #include "DOMWindow.h" 26 27 #include "Document.h" … … 36 37 #include "History.h" 37 38 #include "JSAudioConstructor.h" 39 #if ENABLE(DATABASE) 40 #include "JSDatabase.h" 41 #include "JSDatabaseCallback.h" 42 #endif 38 43 #include "JSDOMWindowShell.h" 39 44 #include "JSEvent.h" … … 1002 1007 } 1003 1008 1009 #if ENABLE(DATABASE) 1010 JSValue JSDOMWindow::openDatabase(ExecState* exec) 1011 { 1012 if (!allowsAccessFrom(exec) || (exec->argumentCount() < 4)) { 1013 setDOMException(exec, SYNTAX_ERR); 1014 return jsUndefined(); 1015 } 1016 1017 String name = ustringToString(exec->argument(0).toString(exec)); 1018 if (exec->hadException()) 1019 return jsUndefined(); 1020 1021 String version = ustringToString(exec->argument(1).toString(exec)); 1022 if (exec->hadException()) 1023 return jsUndefined(); 1024 1025 String displayName = ustringToString(exec->argument(2).toString(exec)); 1026 if (exec->hadException()) 1027 return jsUndefined(); 1028 1029 // exec->argument(3) = estimated size 1030 unsigned long estimatedSize = exec->argument(3).toUInt32(exec); 1031 if (exec->hadException()) 1032 return jsUndefined(); 1033 1034 RefPtr<DatabaseCallback> creationCallback; 1035 if (exec->argumentCount() >= 5) { 1036 if (!exec->argument(4).isObject()) { 1037 setDOMException(exec, TYPE_MISMATCH_ERR); 1038 return jsUndefined(); 1039 } 1040 1041 creationCallback = JSDatabaseCallback::create(asObject(exec->argument(4)), globalObject()); 1042 } 1043 1044 ExceptionCode ec = 0; 1045 JSValue result = toJS(exec, globalObject(), WTF::getPtr(impl()->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec))); 1046 1047 setDOMException(exec, ec); 1048 return result; 1049 } 1050 #endif 1051 1004 1052 DOMWindow* toDOMWindow(JSValue value) 1005 1053 { -
trunk/WebCore/bindings/js/JSWorkerContextCustom.cpp
r64835 r64840 30 30 #include "JSWorkerContext.h" 31 31 32 #if ENABLE(DATABASE) 33 #include "Database.h" 34 #include "DatabaseSync.h" 35 #include "JSDatabase.h" 36 #include "JSDatabaseCallback.h" 37 #include "JSDatabaseSync.h" 38 #endif 32 39 #include "ExceptionCode.h" 33 40 #include "JSDOMBinding.h" … … 147 154 #endif 148 155 156 #if ENABLE(DATABASE) 157 JSValue JSWorkerContext::openDatabase(ExecState* exec) 158 { 159 if (exec->argumentCount() < 4) { 160 setDOMException(exec, SYNTAX_ERR); 161 return jsUndefined(); 162 } 163 164 String name = ustringToString(exec->argument(0).toString(exec)); 165 if (exec->hadException()) 166 return jsUndefined(); 167 168 String version = ustringToString(exec->argument(1).toString(exec)); 169 if (exec->hadException()) 170 return jsUndefined(); 171 172 String displayName = ustringToString(exec->argument(2).toString(exec)); 173 if (exec->hadException()) 174 return jsUndefined(); 175 176 // exec->argument(3) = estimated size 177 unsigned long estimatedSize = exec->argument(3).toUInt32(exec); 178 if (exec->hadException()) 179 return jsUndefined(); 180 181 RefPtr<DatabaseCallback> creationCallback; 182 if (exec->argumentCount() >= 5) { 183 if (!exec->argument(4).isObject()) { 184 setDOMException(exec, TYPE_MISMATCH_ERR); 185 return jsUndefined(); 186 } 187 188 creationCallback = JSDatabaseCallback::create(asObject(exec->argument(4)), globalObject()); 189 } 190 191 ExceptionCode ec = 0; 192 JSValue result = toJS(exec, globalObject(), WTF::getPtr(impl()->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec))); 193 setDOMException(exec, ec); 194 return result; 195 } 196 197 JSValue JSWorkerContext::openDatabaseSync(ExecState* exec) 198 { 199 if (exec->argumentCount() < 4) { 200 setDOMException(exec, SYNTAX_ERR); 201 return jsUndefined(); 202 } 203 204 String name = ustringToString(exec->argument(0).toString(exec)); 205 if (exec->hadException()) 206 return jsUndefined(); 207 208 String version = ustringToString(exec->argument(1).toString(exec)); 209 if (exec->hadException()) 210 return jsUndefined(); 211 212 String displayName = ustringToString(exec->argument(2).toString(exec)); 213 if (exec->hadException()) 214 return jsUndefined(); 215 216 // exec->argument(3) = estimated size 217 unsigned long estimatedSize = exec->argument(3).toUInt32(exec); 218 if (exec->hadException()) 219 return jsUndefined(); 220 221 RefPtr<DatabaseCallback> creationCallback; 222 if (exec->argumentCount() >= 5) { 223 if (!exec->argument(4).isObject()) { 224 setDOMException(exec, TYPE_MISMATCH_ERR); 225 return jsUndefined(); 226 } 227 228 creationCallback = JSDatabaseCallback::create(asObject(exec->argument(4)), globalObject()); 229 } 230 231 ExceptionCode ec = 0; 232 JSValue result = toJS(exec, globalObject(), WTF::getPtr(impl()->openDatabaseSync(name, version, displayName, estimatedSize, creationCallback.release(), ec))); 233 234 setDOMException(exec, ec); 235 return result; 236 } 237 #endif 238 149 239 } // namespace WebCore 150 240 -
trunk/WebCore/bindings/scripts/CodeGeneratorGObject.pm
r64839 r64840 209 209 } 210 210 211 # Skip functions that take ["Callback"] parameters, since this212 # code generator doesn't know yet how to auto-generate callbacks.213 foreach my $param (@{$function->parameters}) {214 if ($param->extendedAttributes->{"Callback"}) {215 return 1;216 }217 }218 219 211 return 0; 220 212 } -
trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm
r64836 r64840 1910 1910 1911 1911 foreach my $parameter (@{$function->parameters}) { 1912 push(@implContent, "\n");1913 1912 if ($parameter->extendedAttributes->{"Optional"}) { 1914 # Optional callbacks should be handled differently because: 1915 # - they always have a default value: 0 1916 # - it reduces the number of overloaded functions with different number of parameters 1917 if (!$parameter->extendedAttributes->{"Callback"}) { 1918 # Generate early call if there are enough parameters. 1919 if (!$hasOptionalArguments) { 1920 push(@implContent, " int argsCount = exec->argumentCount();\n"); 1921 $hasOptionalArguments = 1; 1922 } 1923 push(@implContent, " if (argsCount <= $argsIndex) {\n"); 1924 GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " " x 2, $podType, $implClassName); 1925 push(@implContent, " }\n"); 1913 # Generate early call if there are enough parameters. 1914 if (!$hasOptionalArguments) { 1915 push(@implContent, "\n int argsCount = exec->argumentCount();\n"); 1916 $hasOptionalArguments = 1; 1926 1917 } 1927 } else { 1928 $implIncludes{"ExceptionCode.h"} = 1; 1929 push(@implContent, " if (exec->argumentCount() <= $argsIndex) {\n"); 1930 push(@implContent, " setDOMException(exec, TYPE_MISMATCH_ERR);\n"); 1931 push(@implContent, " return JSValue::encode(jsUndefined());\n"); 1932 push(@implContent, " }\n"); 1918 push(@implContent, " if (argsCount < " . ($argsIndex + 1) . ") {\n"); 1919 GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " " x 2, $podType, $implClassName); 1920 push(@implContent, " }\n\n"); 1933 1921 } 1934 1922 … … 1948 1936 $implIncludes{"$callbackClassName.h"} = 1; 1949 1937 $implIncludes{"ExceptionCode.h"} = 1; 1950 if ($parameter->extendedAttributes->{"Optional"}) { 1951 push(@implContent, " RefPtr<" . $parameter->type . "> $name;\n"); 1952 push(@implContent, " if (exec->argumentCount() > $argsIndex && exec->argument($argsIndex).isObject()) {\n"); 1953 push(@implContent, " JSObject* object = exec->argument($argsIndex).getObject();\n"); 1954 push(@implContent, " if (!object) {\n"); 1955 push(@implContent, " setDOMException(exec, TYPE_MISMATCH_ERR);\n"); 1956 push(@implContent, " return JSValue::encode(jsUndefined());\n"); 1957 push(@implContent, " }\n"); 1958 push(@implContent, " $name = ${callbackClassName}::create(object, castedThis->globalObject());\n"); 1959 push(@implContent, " }\n"); 1960 } else { 1961 push(@implContent, " if (!exec->argument($argsIndex).isObject() || !exec->argument($argsIndex).getObject()) {\n"); 1962 push(@implContent, " setDOMException(exec, TYPE_MISMATCH_ERR);\n"); 1963 push(@implContent, " return JSValue::encode(jsUndefined());\n"); 1964 push(@implContent, " }\n"); 1965 push(@implContent, " RefPtr<" . $parameter->type . "> $name = " . $callbackClassName . "::create(exec->argument($argsIndex).getObject(), castedThis->globalObject());\n"); 1966 } 1938 push(@implContent, " if (exec->argumentCount() <= $argsIndex || !exec->argument($argsIndex).isObject()) {\n"); 1939 push(@implContent, " setDOMException(exec, TYPE_MISMATCH_ERR);\n"); 1940 push(@implContent, " return jsUndefined();\n"); 1941 push(@implContent, " }\n"); 1942 push(@implContent, " RefPtr<" . $parameter->type . "> $name = " . $callbackClassName . "::create(asObject(exec->argument($argsIndex)), castedThis->globalObject());\n"); 1967 1943 } else { 1968 1944 push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($argsIndex)") . ";\n"); … … 1978 1954 push(@implContent, " }\n"); 1979 1955 } 1980 }1981 1982 # Callback parameters have their special error checking code.1983 if (!$parameter->extendedAttributes->{"Callback"}) {1984 push(@implContent, " if (exec->hadException())\n");1985 push(@implContent, " return JSValue::encode(jsUndefined());\n");1986 1956 } 1987 1957 … … 2374 2344 return "$value.toNumber(exec)" if $type eq "double"; 2375 2345 return "$value.toFloat(exec)" if $type eq "float" or $type eq "SVGNumber"; 2376 return "$value.toInt32(exec)" if $type eq "long"; 2377 return "$value.toUInt32(exec)" if $type eq "unsigned long" or $type eq "unsigned short"; 2346 return "$value.toInt32(exec)" if $type eq "unsigned long" or $type eq "long" or $type eq "unsigned short"; 2378 2347 return "static_cast<$type>($value.toInteger(exec))" if $type eq "long long" or $type eq "unsigned long long"; 2379 2348 -
trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm
r64835 r64840 1177 1177 1178 1178 if ($parameter->extendedAttributes->{"Optional"}) { 1179 # Optional callbacks should be handled differently because: 1180 # - they always have a default value: 0 1181 # - it reduces the number of overloaded functions with different number of parameters 1182 if (!$parameter->extendedAttributes->{"Callback"}) { 1183 # Generate early call if there are not enough parameters. 1184 push(@implContentDecls, " if (args.Length() <= $paramIndex) {\n"); 1185 my $functionCall = GenerateFunctionCallString($function, $paramIndex, " " x 2, $implClassName); 1186 push(@implContentDecls, $functionCall); 1187 push(@implContentDecls, " }\n"); 1188 } 1189 } else { 1190 push(@implContentDecls, " if (args.Length() <= $paramIndex)\n"); 1191 push(@implContentDecls, " return throwError(TYPE_MISMATCH_ERR);\n"); 1192 } 1193 1194 if (BasicTypeCanFailConversion($parameter)) { 1195 push(@implContentDecls, " bool ${parameterName}Ok;\n"); 1196 } 1197 1198 my $nativeType = GetNativeTypeFromSignature($parameter, $paramIndex); 1179 # Generate early call if there are not enough parameters. 1180 push(@implContentDecls, " if (args.Length() <= $paramIndex) {\n"); 1181 my $functionCall = GenerateFunctionCallString($function, $paramIndex, " " x 2, $implClassName); 1182 push(@implContentDecls, $functionCall); 1183 push(@implContentDecls, " }\n"); 1184 } 1185 1199 1186 if ($parameter->extendedAttributes->{"Callback"}) { 1200 1187 my $className = GetCallbackClassName($parameter->type); 1201 1188 $implIncludes{"$className.h"} = 1; 1202 1189 $implIncludes{"ExceptionCode.h"} = 1; 1203 if ($parameter->extendedAttributes->{"Optional"}) { 1204 push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName;\n"); 1205 push(@implContentDecls, " if (args.Length() > $paramIndex && args[$paramIndex]->IsObject())\n"); 1206 push(@implContentDecls, " $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n"); 1207 } else { 1208 push(@implContentDecls, " if (!args[$paramIndex]->IsObject())\n"); 1209 push(@implContentDecls, " return throwError(TYPE_MISMATCH_ERR);\n"); 1210 push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n"); 1211 } 1190 push(@implContentDecls, " if (args.Length() <= $paramIndex || !args[$paramIndex]->IsObject())\n"); 1191 push(@implContentDecls, " return throwError(TYPE_MISMATCH_ERR);\n"); 1192 push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n"); 1212 1193 $paramIndex++; 1213 1194 next; 1214 } elsif ($parameter->type eq "SerializedScriptValue") { 1195 } 1196 1197 if ($parameter->type eq "SerializedScriptValue") { 1215 1198 $implIncludes{"SerializedScriptValue.h"} = 1; 1216 1199 push(@implContentDecls, " bool ${parameterName}DidThrow = false;\n"); 1217 push(@implContentDecls, " $nativeType $parameterName = SerializedScriptValue::create(args[$paramIndex], ${parameterName}DidThrow);\n"); 1200 } elsif (BasicTypeCanFailConversion($parameter)) { 1201 push(@implContentDecls, " bool ${parameterName}Ok;\n"); 1202 } 1203 1204 push(@implContentDecls, " " . GetNativeTypeFromSignature($parameter, $paramIndex) . " $parameterName = "); 1205 1206 if ($parameter->type eq "SerializedScriptValue") { 1207 push(@implContentDecls, "SerializedScriptValue::create(args[$paramIndex], ${parameterName}DidThrow);\n"); 1218 1208 push(@implContentDecls, " if (${parameterName}DidThrow)\n"); 1219 1209 push(@implContentDecls, " return v8::Undefined();\n"); 1220 } elsif (TypeCanFailConversion($parameter)) { 1210 } else { 1211 push(@implContentDecls, JSValueToNative($parameter, "args[$paramIndex]", 1212 BasicTypeCanFailConversion($parameter) ? "${parameterName}Ok" : undef) . ";\n"); 1213 } 1214 1215 if (TypeCanFailConversion($parameter)) { 1221 1216 $implIncludes{"ExceptionCode.h"} = 1; 1222 push(@implContentDecls, " $nativeType $parameterName = " . 1223 JSValueToNative($parameter, "args[$paramIndex]", 1224 BasicTypeCanFailConversion($parameter) ? "${parameterName}Ok" : undef) . ";\n"); 1225 push(@implContentDecls, " if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n"); 1226 push(@implContentDecls, " ec = TYPE_MISMATCH_ERR;\n"); 1227 push(@implContentDecls, " goto fail;\n"); 1228 push(@implContentDecls, " }\n"); 1229 } elsif ($nativeType =~ /^V8Parameter/) { 1230 # Exceptions are handled in V8Parameter's operators. 1231 push(@implContentDecls, " $nativeType $parameterName = " . 1232 JSValueToNative($parameter, "args[$paramIndex]", 1233 BasicTypeCanFailConversion($parameter) ? "{$parameterName}Ok" : undef) . ";\n"); 1234 } else { 1235 $implIncludes{"V8BindingMacros.h"} = 1; 1236 push(@implContentDecls, " EXCEPTION_BLOCK($nativeType, $parameterName, " . 1237 JSValueToNative($parameter, "args[$paramIndex]", 1238 BasicTypeCanFailConversion($parameter) ? "{$parameterName}Ok" : undef) . ");\n"); 1217 push(@implContentDecls, 1218 " if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n" . 1219 " ec = TYPE_MISMATCH_ERR;\n" . 1220 " goto fail;\n" . 1221 " }\n"); 1239 1222 } 1240 1223 1241 1224 if ($parameter->extendedAttributes->{"IsIndex"}) { 1242 1225 $implIncludes{"ExceptionCode.h"} = 1; 1243 push(@implContentDecls, " if (UNLIKELY($parameterName < 0)) {\n"); 1244 push(@implContentDecls, " ec = INDEX_SIZE_ERR;\n"); 1245 push(@implContentDecls, " goto fail;\n"); 1246 push(@implContentDecls, " }\n"); 1226 push(@implContentDecls, 1227 " if (UNLIKELY($parameterName < 0)) {\n" . 1228 " ec = INDEX_SIZE_ERR;\n" . 1229 " goto fail;\n" . 1230 " }\n"); 1247 1231 } 1248 1232 … … 2842 2826 return "$value->NumberValue()" if $type eq "SVGNumber"; 2843 2827 2844 return "toInt32($value${maybeOkParam})" if $type eq "long"; 2845 return "toUInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short"; 2828 return "toInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short" or $type eq "long"; 2846 2829 return "toInt64($value)" if $type eq "unsigned long long" or $type eq "long long"; 2847 2830 return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "CompareHow"; … … 2973 2956 2974 2957 foreach my $parameter (@{$function->parameters}) { 2975 if ($parameter->extendedAttributes->{"Optional"} || 2976 $parameter->extendedAttributes->{"Callback"}) { 2958 if ($parameter->extendedAttributes->{"Optional"}) { 2977 2959 return 0; 2978 2960 } -
trunk/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp
r64835 r64840 43 43 JSTestCallback::~JSTestCallback() 44 44 { 45 ScriptExecutionContext* context = scriptExecutionContext(); 46 // When the context is destroyed, all tasks with a reference to a callback 47 // should be deleted. So if the context is NULL, we are on the context thread. 48 if (!context || context->isContextThread()) 45 if (m_scriptExecutionContext->isContextThread()) 49 46 delete m_data; 50 47 else 51 context->postTask(DeleteCallbackDataTask::create(m_data));48 m_data->globalObject()->scriptExecutionContext()->postTask(DeleteCallbackDataTask::create(m_data)); 52 49 #ifndef NDEBUG 53 50 m_data = 0; -
trunk/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r64835 r64840 794 794 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 795 795 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 796 797 if (exec->argumentCount() <= 0) {798 setDOMException(exec, TYPE_MISMATCH_ERR);799 return JSValue::encode(jsUndefined());800 }801 796 int intArg = exec->argument(0).toInt32(exec); 802 if (exec->hadException())803 return JSValue::encode(jsUndefined());804 805 if (exec->argumentCount() <= 1) {806 setDOMException(exec, TYPE_MISMATCH_ERR);807 return JSValue::encode(jsUndefined());808 }809 797 const String& strArg = ustringToString(exec->argument(1).toString(exec)); 810 if (exec->hadException())811 return JSValue::encode(jsUndefined());812 813 if (exec->argumentCount() <= 2) {814 setDOMException(exec, TYPE_MISMATCH_ERR);815 return JSValue::encode(jsUndefined());816 }817 798 TestObj* objArg = toTestObj(exec->argument(2)); 818 if (exec->hadException())819 return JSValue::encode(jsUndefined());820 799 821 800 imp->voidMethodWithArgs(intArg, strArg, objArg); … … 843 822 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 844 823 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 845 846 if (exec->argumentCount() <= 0) {847 setDOMException(exec, TYPE_MISMATCH_ERR);848 return JSValue::encode(jsUndefined());849 }850 824 int intArg = exec->argument(0).toInt32(exec); 851 if (exec->hadException())852 return JSValue::encode(jsUndefined());853 854 if (exec->argumentCount() <= 1) {855 setDOMException(exec, TYPE_MISMATCH_ERR);856 return JSValue::encode(jsUndefined());857 }858 825 const String& strArg = ustringToString(exec->argument(1).toString(exec)); 859 if (exec->hadException())860 return JSValue::encode(jsUndefined());861 862 if (exec->argumentCount() <= 2) {863 setDOMException(exec, TYPE_MISMATCH_ERR);864 return JSValue::encode(jsUndefined());865 }866 826 TestObj* objArg = toTestObj(exec->argument(2)); 867 if (exec->hadException())868 return JSValue::encode(jsUndefined());869 827 870 828 … … 893 851 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 894 852 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 895 896 if (exec->argumentCount() <= 0) {897 setDOMException(exec, TYPE_MISMATCH_ERR);898 return JSValue::encode(jsUndefined());899 }900 853 int intArg = exec->argument(0).toInt32(exec); 901 if (exec->hadException())902 return JSValue::encode(jsUndefined());903 904 if (exec->argumentCount() <= 1) {905 setDOMException(exec, TYPE_MISMATCH_ERR);906 return JSValue::encode(jsUndefined());907 }908 854 const String& strArg = ustringToString(exec->argument(1).toString(exec)); 909 if (exec->hadException())910 return JSValue::encode(jsUndefined());911 912 if (exec->argumentCount() <= 2) {913 setDOMException(exec, TYPE_MISMATCH_ERR);914 return JSValue::encode(jsUndefined());915 }916 855 TestObj* objArg = toTestObj(exec->argument(2)); 917 if (exec->hadException())918 return JSValue::encode(jsUndefined());919 856 920 857 … … 932 869 if (exec->argumentCount() < 2) 933 870 return JSValue::encode(jsUndefined()); 934 935 if (exec->argumentCount() <= 0) {936 setDOMException(exec, TYPE_MISMATCH_ERR);937 return JSValue::encode(jsUndefined());938 }939 871 const String& strArg = ustringToString(exec->argument(0).toString(exec)); 940 if (exec->hadException())941 return JSValue::encode(jsUndefined());942 943 if (exec->argumentCount() <= 1) {944 setDOMException(exec, TYPE_MISMATCH_ERR);945 return JSValue::encode(jsUndefined());946 }947 872 TestObj* objArg = toTestObj(exec->argument(1)); 948 if (exec->hadException())949 return JSValue::encode(jsUndefined());950 873 951 874 … … 964 887 return throwVMError(exec, createSyntaxError(exec, "Not enough arguments")); 965 888 ExceptionCode ec = 0; 966 967 if (exec->argumentCount() <= 0) {968 setDOMException(exec, TYPE_MISMATCH_ERR);969 return JSValue::encode(jsUndefined());970 }971 889 const String& strArg = ustringToString(exec->argument(0).toString(exec)); 972 if (exec->hadException())973 return JSValue::encode(jsUndefined());974 975 if (exec->argumentCount() <= 1) {976 setDOMException(exec, TYPE_MISMATCH_ERR);977 return JSValue::encode(jsUndefined());978 }979 890 TestObj* objArg = toTestObj(exec->argument(1)); 980 if (exec->hadException())981 return JSValue::encode(jsUndefined());982 891 983 892 … … 994 903 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 995 904 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 996 997 if (exec->argumentCount() <= 0) {998 setDOMException(exec, TYPE_MISMATCH_ERR);999 return JSValue::encode(jsUndefined());1000 }1001 905 RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, exec->argument(0)); 1002 if (exec->hadException())1003 return JSValue::encode(jsUndefined());1004 906 1005 907 imp->serializedValue(serializedArg); … … 1014 916 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1015 917 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1016 1017 if (exec->argumentCount() <= 0) {1018 setDOMException(exec, TYPE_MISMATCH_ERR);1019 return JSValue::encode(jsUndefined());1020 }1021 918 RefPtr<IDBKey> key = createIDBKeyFromValue(exec, exec->argument(0)); 1022 if (exec->hadException())1023 return JSValue::encode(jsUndefined());1024 919 1025 920 imp->idbKey(key); … … 1068 963 ExceptionCode ec = 0; 1069 964 ScriptCallStack callStack(exec, 1); 1070 1071 if (exec->argumentCount() <= 0) {1072 setDOMException(exec, TYPE_MISMATCH_ERR);1073 return JSValue::encode(jsUndefined());1074 }1075 965 log* intArg = tolog(exec->argument(0)); 1076 if (exec->hadException())1077 return JSValue::encode(jsUndefined());1078 966 1079 967 imp->customArgsAndException(intArg, &callStack, ec); … … 1135 1023 if (!dynamicFrame) 1136 1024 return JSValue::encode(jsUndefined()); 1137 1138 if (exec->argumentCount() <= 0) {1139 setDOMException(exec, TYPE_MISMATCH_ERR);1140 return JSValue::encode(jsUndefined());1141 }1142 1025 int intArg = exec->argument(0).toInt32(exec); 1143 if (exec->hadException())1144 return JSValue::encode(jsUndefined());1145 1026 1146 1027 imp->withDynamicFrameAndArg(dynamicFrame, intArg); … … 1158 1039 if (!dynamicFrame) 1159 1040 return JSValue::encode(jsUndefined()); 1160 1161 if (exec->argumentCount() <= 0) { 1162 setDOMException(exec, TYPE_MISMATCH_ERR); 1041 int intArg = exec->argument(0).toInt32(exec); 1042 1043 int argsCount = exec->argumentCount(); 1044 if (argsCount < 2) { 1045 imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg); 1163 1046 return JSValue::encode(jsUndefined()); 1164 1047 } 1165 int intArg = exec->argument(0).toInt32(exec); 1166 if (exec->hadException()) 1167 return JSValue::encode(jsUndefined()); 1168 1169 int argsCount = exec->argumentCount(); 1170 if (argsCount <= 1) { 1171 imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg); 1172 return JSValue::encode(jsUndefined()); 1173 } 1048 1174 1049 int optionalArg = exec->argument(1).toInt32(exec); 1175 if (exec->hadException())1176 return JSValue::encode(jsUndefined());1177 1050 1178 1051 imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg); … … 1190 1063 if (!dynamicFrame) 1191 1064 return JSValue::encode(jsUndefined()); 1192 1193 if (exec->argumentCount() <= 0) {1194 setDOMException(exec, TYPE_MISMATCH_ERR);1195 return JSValue::encode(jsUndefined());1196 }1197 1065 int intArg = exec->argument(0).toInt32(exec); 1198 if (exec->hadException())1199 return JSValue::encode(jsUndefined());1200 1066 1201 1067 imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec)); … … 1213 1079 if (!dynamicFrame) 1214 1080 return JSValue::encode(jsUndefined()); 1215 1216 if (exec->argumentCount() <= 0) { 1217 setDOMException(exec, TYPE_MISMATCH_ERR); 1081 int intArg = exec->argument(0).toInt32(exec); 1082 1083 int argsCount = exec->argumentCount(); 1084 if (argsCount < 2) { 1085 imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg); 1218 1086 return JSValue::encode(jsUndefined()); 1219 1087 } 1220 int intArg = exec->argument(0).toInt32(exec); 1221 if (exec->hadException()) 1222 return JSValue::encode(jsUndefined()); 1223 1224 int argsCount = exec->argumentCount(); 1225 if (argsCount <= 1) { 1226 imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg); 1227 return JSValue::encode(jsUndefined()); 1228 } 1088 1229 1089 int optionalArg = exec->argument(1).toInt32(exec); 1230 if (exec->hadException())1231 return JSValue::encode(jsUndefined());1232 1090 1233 1091 imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec)); … … 1317 1175 1318 1176 int argsCount = exec->argumentCount(); 1319 if (argsCount < = 0) {1177 if (argsCount < 1) { 1320 1178 imp->methodWithOptionalArg(); 1321 1179 return JSValue::encode(jsUndefined()); 1322 1180 } 1181 1323 1182 int opt = exec->argument(0).toInt32(exec); 1324 if (exec->hadException())1325 return JSValue::encode(jsUndefined());1326 1183 1327 1184 imp->methodWithOptionalArg(opt); … … 1336 1193 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1337 1194 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1338 1339 if (exec->argumentCount() <= 0) { 1195 int nonOpt = exec->argument(0).toInt32(exec); 1196 1197 int argsCount = exec->argumentCount(); 1198 if (argsCount < 2) { 1199 imp->methodWithNonOptionalArgAndOptionalArg(nonOpt); 1200 return JSValue::encode(jsUndefined()); 1201 } 1202 1203 int opt = exec->argument(1).toInt32(exec); 1204 1205 imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); 1206 return JSValue::encode(jsUndefined()); 1207 } 1208 1209 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec) 1210 { 1211 JSValue thisValue = exec->hostThisValue(); 1212 if (!thisValue.inherits(&JSTestObj::s_info)) 1213 return throwVMTypeError(exec); 1214 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1215 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1216 int nonOpt = exec->argument(0).toInt32(exec); 1217 1218 int argsCount = exec->argumentCount(); 1219 if (argsCount < 2) { 1220 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt); 1221 return JSValue::encode(jsUndefined()); 1222 } 1223 1224 int opt1 = exec->argument(1).toInt32(exec); 1225 int opt2 = exec->argument(2).toInt32(exec); 1226 1227 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); 1228 return JSValue::encode(jsUndefined()); 1229 } 1230 1231 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(ExecState* exec) 1232 { 1233 JSValue thisValue = exec->hostThisValue(); 1234 if (!thisValue.inherits(&JSTestObj::s_info)) 1235 return throwVMTypeError(exec); 1236 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1237 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1238 if (exec->argumentCount() <= 0 || !exec->argument(0).isObject()) { 1340 1239 setDOMException(exec, TYPE_MISMATCH_ERR); 1341 return JSValue::encode(jsUndefined());1240 return jsUndefined(); 1342 1241 } 1343 int nonOpt = exec->argument(0).toInt32(exec); 1344 if (exec->hadException()) 1345 return JSValue::encode(jsUndefined()); 1242 RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject()); 1243 1244 imp->methodWithCallbackArg(callback); 1245 return JSValue::encode(jsUndefined()); 1246 } 1247 1248 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(ExecState* exec) 1249 { 1250 JSValue thisValue = exec->hostThisValue(); 1251 if (!thisValue.inherits(&JSTestObj::s_info)) 1252 return throwVMTypeError(exec); 1253 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1254 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1255 int nonCallback = exec->argument(0).toInt32(exec); 1256 if (exec->argumentCount() <= 1 || !exec->argument(1).isObject()) { 1257 setDOMException(exec, TYPE_MISMATCH_ERR); 1258 return jsUndefined(); 1259 } 1260 RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(1)), castedThis->globalObject()); 1261 1262 imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback); 1263 return JSValue::encode(jsUndefined()); 1264 } 1265 1266 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(ExecState* exec) 1267 { 1268 JSValue thisValue = exec->hostThisValue(); 1269 if (!thisValue.inherits(&JSTestObj::s_info)) 1270 return throwVMTypeError(exec); 1271 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1272 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1346 1273 1347 1274 int argsCount = exec->argumentCount(); 1348 if (argsCount < =1) {1349 imp->methodWith NonOptionalArgAndOptionalArg(nonOpt);1275 if (argsCount < 1) { 1276 imp->methodWithCallbackAndOptionalArg(); 1350 1277 return JSValue::encode(jsUndefined()); 1351 1278 } 1352 int opt = exec->argument(1).toInt32(exec); 1353 if (exec->hadException()) 1354 return JSValue::encode(jsUndefined()); 1355 1356 imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); 1357 return JSValue::encode(jsUndefined()); 1358 } 1359 1360 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec) 1361 { 1362 JSValue thisValue = exec->hostThisValue(); 1363 if (!thisValue.inherits(&JSTestObj::s_info)) 1364 return throwVMTypeError(exec); 1365 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1366 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1367 1368 if (exec->argumentCount() <= 0) { 1279 1280 if (exec->argumentCount() <= 0 || !exec->argument(0).isObject()) { 1369 1281 setDOMException(exec, TYPE_MISMATCH_ERR); 1370 return JSValue::encode(jsUndefined());1282 return jsUndefined(); 1371 1283 } 1372 int nonOpt = exec->argument(0).toInt32(exec); 1373 if (exec->hadException()) 1374 return JSValue::encode(jsUndefined()); 1284 RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject()); 1285 1286 imp->methodWithCallbackAndOptionalArg(callback); 1287 return JSValue::encode(jsUndefined()); 1288 } 1289 1290 static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) 1291 { 1292 JSValue thisValue = exec->hostThisValue(); 1293 if (!thisValue.inherits(&JSTestObj::s_info)) 1294 return throwVMTypeError(exec); 1295 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1296 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1297 TestObj* objArg = toTestObj(exec->argument(0)); 1298 const String& strArg = ustringToString(exec->argument(1).toString(exec)); 1299 1300 imp->overloadedMethod(objArg, strArg); 1301 return JSValue::encode(jsUndefined()); 1302 } 1303 1304 static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec) 1305 { 1306 JSValue thisValue = exec->hostThisValue(); 1307 if (!thisValue.inherits(&JSTestObj::s_info)) 1308 return throwVMTypeError(exec); 1309 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1310 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1311 TestObj* objArg = toTestObj(exec->argument(0)); 1375 1312 1376 1313 int argsCount = exec->argumentCount(); 1377 if (argsCount < = 1) {1378 imp-> methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);1314 if (argsCount < 2) { 1315 imp->overloadedMethod(objArg); 1379 1316 return JSValue::encode(jsUndefined()); 1380 1317 } 1381 int opt1 = exec->argument(1).toInt32(exec); 1382 if (exec->hadException()) 1383 return JSValue::encode(jsUndefined()); 1384 1385 if (argsCount <= 2) { 1386 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1); 1387 return JSValue::encode(jsUndefined()); 1388 } 1389 int opt2 = exec->argument(2).toInt32(exec); 1390 if (exec->hadException()) 1391 return JSValue::encode(jsUndefined()); 1392 1393 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); 1394 return JSValue::encode(jsUndefined()); 1395 } 1396 1397 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(ExecState* exec) 1398 { 1399 JSValue thisValue = exec->hostThisValue(); 1400 if (!thisValue.inherits(&JSTestObj::s_info)) 1401 return throwVMTypeError(exec); 1402 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1403 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1404 1405 if (exec->argumentCount() <= 0) { 1406 setDOMException(exec, TYPE_MISMATCH_ERR); 1407 return JSValue::encode(jsUndefined()); 1408 } 1409 if (!exec->argument(0).isObject() || !exec->argument(0).getObject()) { 1410 setDOMException(exec, TYPE_MISMATCH_ERR); 1411 return JSValue::encode(jsUndefined()); 1412 } 1413 RefPtr<TestCallback> callback = JSTestCallback::create(exec->argument(0).getObject(), castedThis->globalObject()); 1414 1415 imp->methodWithCallbackArg(callback); 1416 return JSValue::encode(jsUndefined()); 1417 } 1418 1419 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(ExecState* exec) 1420 { 1421 JSValue thisValue = exec->hostThisValue(); 1422 if (!thisValue.inherits(&JSTestObj::s_info)) 1423 return throwVMTypeError(exec); 1424 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1425 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1426 1427 if (exec->argumentCount() <= 0) { 1428 setDOMException(exec, TYPE_MISMATCH_ERR); 1429 return JSValue::encode(jsUndefined()); 1430 } 1431 int nonCallback = exec->argument(0).toInt32(exec); 1432 if (exec->hadException()) 1433 return JSValue::encode(jsUndefined()); 1434 1435 if (exec->argumentCount() <= 1) { 1436 setDOMException(exec, TYPE_MISMATCH_ERR); 1437 return JSValue::encode(jsUndefined()); 1438 } 1439 if (!exec->argument(1).isObject() || !exec->argument(1).getObject()) { 1440 setDOMException(exec, TYPE_MISMATCH_ERR); 1441 return JSValue::encode(jsUndefined()); 1442 } 1443 RefPtr<TestCallback> callback = JSTestCallback::create(exec->argument(1).getObject(), castedThis->globalObject()); 1444 1445 imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback); 1446 return JSValue::encode(jsUndefined()); 1447 } 1448 1449 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(ExecState* exec) 1450 { 1451 JSValue thisValue = exec->hostThisValue(); 1452 if (!thisValue.inherits(&JSTestObj::s_info)) 1453 return throwVMTypeError(exec); 1454 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1455 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1456 1457 RefPtr<TestCallback> callback; 1458 if (exec->argumentCount() > 0 && exec->argument(0).isObject()) { 1459 JSObject* object = exec->argument(0).getObject(); 1460 if (!object) { 1461 setDOMException(exec, TYPE_MISMATCH_ERR); 1462 return JSValue::encode(jsUndefined()); 1463 } 1464 callback = JSTestCallback::create(object, castedThis->globalObject()); 1465 } 1466 1467 imp->methodWithCallbackAndOptionalArg(callback); 1468 return JSValue::encode(jsUndefined()); 1469 } 1470 1471 static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) 1472 { 1473 JSValue thisValue = exec->hostThisValue(); 1474 if (!thisValue.inherits(&JSTestObj::s_info)) 1475 return throwVMTypeError(exec); 1476 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1477 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1478 1479 if (exec->argumentCount() <= 0) { 1480 setDOMException(exec, TYPE_MISMATCH_ERR); 1481 return JSValue::encode(jsUndefined()); 1482 } 1483 TestObj* objArg = toTestObj(exec->argument(0)); 1484 if (exec->hadException()) 1485 return JSValue::encode(jsUndefined()); 1486 1487 if (exec->argumentCount() <= 1) { 1488 setDOMException(exec, TYPE_MISMATCH_ERR); 1489 return JSValue::encode(jsUndefined()); 1490 } 1491 const String& strArg = ustringToString(exec->argument(1).toString(exec)); 1492 if (exec->hadException()) 1493 return JSValue::encode(jsUndefined()); 1494 1495 imp->overloadedMethod(objArg, strArg); 1496 return JSValue::encode(jsUndefined()); 1497 } 1498 1499 static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec) 1500 { 1501 JSValue thisValue = exec->hostThisValue(); 1502 if (!thisValue.inherits(&JSTestObj::s_info)) 1503 return throwVMTypeError(exec); 1504 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1505 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1506 1507 if (exec->argumentCount() <= 0) { 1508 setDOMException(exec, TYPE_MISMATCH_ERR); 1509 return JSValue::encode(jsUndefined()); 1510 } 1511 TestObj* objArg = toTestObj(exec->argument(0)); 1512 if (exec->hadException()) 1513 return JSValue::encode(jsUndefined()); 1514 1515 int argsCount = exec->argumentCount(); 1516 if (argsCount <= 1) { 1517 imp->overloadedMethod(objArg); 1518 return JSValue::encode(jsUndefined()); 1519 } 1318 1520 1319 int intArg = exec->argument(1).toInt32(exec); 1521 if (exec->hadException())1522 return JSValue::encode(jsUndefined());1523 1320 1524 1321 imp->overloadedMethod(objArg, intArg); … … 1533 1330 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1534 1331 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1535 1536 if (exec->argumentCount() <= 0) {1537 setDOMException(exec, TYPE_MISMATCH_ERR);1538 return JSValue::encode(jsUndefined());1539 }1540 1332 const String& strArg = ustringToString(exec->argument(0).toString(exec)); 1541 if (exec->hadException())1542 return JSValue::encode(jsUndefined());1543 1333 1544 1334 imp->overloadedMethod(strArg); … … 1553 1343 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1554 1344 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1555 1556 if (exec->argumentCount() <= 0) {1557 setDOMException(exec, TYPE_MISMATCH_ERR);1558 return JSValue::encode(jsUndefined());1559 }1560 1345 int intArg = exec->argument(0).toInt32(exec); 1561 if (exec->hadException())1562 return JSValue::encode(jsUndefined());1563 1346 1564 1347 imp->overloadedMethod(intArg); -
trunk/WebCore/bindings/scripts/test/TestObj.idl
r64835 r64840 113 113 void methodWithOptionalArg(in [Optional] long opt); 114 114 void methodWithNonOptionalArgAndOptionalArg(in long nonOpt, in [Optional] long opt); 115 void methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [Optional] long opt1, in [Optional]long opt2);115 void methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [Optional] long opt1, in long opt2); 116 116 117 117 #if defined(TESTING_V8) || defined(TESTING_JS) -
trunk/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r64835 r64840 30 30 #include "SerializedScriptValue.h" 31 31 #include "V8Binding.h" 32 #include "V8BindingMacros.h"33 32 #include "V8BindingState.h" 34 33 #include "V8DOMWrapper.h" … … 558 557 INC_STATS("DOM.TestObj.voidMethodWithArgs"); 559 558 TestObj* imp = V8TestObj::toNative(args.Holder()); 560 if (args.Length() <= 0) 561 return throwError(TYPE_MISMATCH_ERR); 562 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 563 if (args.Length() <= 1) 564 return throwError(TYPE_MISMATCH_ERR); 559 int intArg = toInt32(args[0]); 565 560 V8Parameter<> strArg = args[1]; 566 if (args.Length() <= 2) 567 return throwError(TYPE_MISMATCH_ERR); 568 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0); 561 TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0; 569 562 imp->voidMethodWithArgs(intArg, strArg, objArg); 570 563 return v8::Handle<v8::Value>(); … … 582 575 INC_STATS("DOM.TestObj.intMethodWithArgs"); 583 576 TestObj* imp = V8TestObj::toNative(args.Holder()); 584 if (args.Length() <= 0) 585 return throwError(TYPE_MISMATCH_ERR); 586 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 587 if (args.Length() <= 1) 588 return throwError(TYPE_MISMATCH_ERR); 577 int intArg = toInt32(args[0]); 589 578 V8Parameter<> strArg = args[1]; 590 if (args.Length() <= 2) 591 return throwError(TYPE_MISMATCH_ERR); 592 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0); 579 TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0; 593 580 return v8::Integer::New(imp->intMethodWithArgs(intArg, strArg, objArg)); 594 581 } … … 605 592 INC_STATS("DOM.TestObj.objMethodWithArgs"); 606 593 TestObj* imp = V8TestObj::toNative(args.Holder()); 607 if (args.Length() <= 0) 608 return throwError(TYPE_MISMATCH_ERR); 609 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 610 if (args.Length() <= 1) 611 return throwError(TYPE_MISMATCH_ERR); 594 int intArg = toInt32(args[0]); 612 595 V8Parameter<> strArg = args[1]; 613 if (args.Length() <= 2) 614 return throwError(TYPE_MISMATCH_ERR); 615 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0); 596 TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0; 616 597 return toV8(imp->objMethodWithArgs(intArg, strArg, objArg)); 617 598 } … … 623 604 return v8::Handle<v8::Value>(); 624 605 TestObj* imp = V8TestObj::toNative(args.Holder()); 625 if (args.Length() <= 0)626 return throwError(TYPE_MISMATCH_ERR);627 606 V8Parameter<> strArg = args[0]; 628 if (args.Length() <= 1) 629 return throwError(TYPE_MISMATCH_ERR); 630 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0); 607 TestObj* objArg = V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0; 631 608 return toV8(imp->methodThatRequiresAllArgs(strArg, objArg)); 632 609 } … … 640 617 ExceptionCode ec = 0; 641 618 { 642 if (args.Length() <= 0)643 return throwError(TYPE_MISMATCH_ERR);644 619 V8Parameter<> strArg = args[0]; 645 if (args.Length() <= 1) 646 return throwError(TYPE_MISMATCH_ERR); 647 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0); 620 TestObj* objArg = V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0; 648 621 RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec); 649 622 if (UNLIKELY(ec)) … … 660 633 INC_STATS("DOM.TestObj.serializedValue"); 661 634 TestObj* imp = V8TestObj::toNative(args.Holder()); 662 if (args.Length() <= 0)663 return throwError(TYPE_MISMATCH_ERR);664 635 bool serializedArgDidThrow = false; 665 636 RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(args[0], serializedArgDidThrow); … … 674 645 INC_STATS("DOM.TestObj.idbKey"); 675 646 TestObj* imp = V8TestObj::toNative(args.Holder()); 676 if (args.Length() <= 0) 677 return throwError(TYPE_MISMATCH_ERR); 678 EXCEPTION_BLOCK(RefPtr<IDBKey>, key, createIDBKeyFromValue(args[0])); 647 RefPtr<IDBKey> key = createIDBKeyFromValue(args[0]); 679 648 imp->idbKey(key); 680 649 return v8::Handle<v8::Value>(); … … 706 675 if (!callStack) 707 676 return v8::Undefined(); 708 if (args.Length() <= 0) 709 return throwError(TYPE_MISMATCH_ERR); 710 EXCEPTION_BLOCK(log*, intArg, V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 677 log* intArg = V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0; 711 678 imp->customArgsAndException(intArg, callStack.get(), ec); 712 679 if (UNLIKELY(ec)) … … 756 723 INC_STATS("DOM.TestObj.withDynamicFrameAndArg"); 757 724 TestObj* imp = V8TestObj::toNative(args.Holder()); 758 if (args.Length() <= 0) 759 return throwError(TYPE_MISMATCH_ERR); 760 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 725 int intArg = toInt32(args[0]); 761 726 Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); 762 727 if (!enteredFrame) … … 770 735 INC_STATS("DOM.TestObj.withDynamicFrameAndOptionalArg"); 771 736 TestObj* imp = V8TestObj::toNative(args.Holder()); 772 if (args.Length() <= 0) 773 return throwError(TYPE_MISMATCH_ERR); 774 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 737 int intArg = toInt32(args[0]); 775 738 if (args.Length() <= 1) { 776 739 Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); … … 780 743 return v8::Handle<v8::Value>(); 781 744 } 782 EXCEPTION_BLOCK(int, optionalArg, toInt32(args[1]));745 int optionalArg = toInt32(args[1]); 783 746 Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); 784 747 if (!enteredFrame) … … 792 755 INC_STATS("DOM.TestObj.withDynamicFrameAndUserGesture"); 793 756 TestObj* imp = V8TestObj::toNative(args.Holder()); 794 if (args.Length() <= 0) 795 return throwError(TYPE_MISMATCH_ERR); 796 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 757 int intArg = toInt32(args[0]); 797 758 Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); 798 759 if (!enteredFrame) … … 806 767 INC_STATS("DOM.TestObj.withDynamicFrameAndUserGestureASAD"); 807 768 TestObj* imp = V8TestObj::toNative(args.Holder()); 808 if (args.Length() <= 0) 809 return throwError(TYPE_MISMATCH_ERR); 810 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 769 int intArg = toInt32(args[0]); 811 770 if (args.Length() <= 1) { 812 771 Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); … … 816 775 return v8::Handle<v8::Value>(); 817 776 } 818 EXCEPTION_BLOCK(int, optionalArg, toInt32(args[1]));777 int optionalArg = toInt32(args[1]); 819 778 Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); 820 779 if (!enteredFrame) … … 903 862 return v8::Handle<v8::Value>(); 904 863 } 905 EXCEPTION_BLOCK(int, opt, toInt32(args[0]));864 int opt = toInt32(args[0]); 906 865 imp->methodWithOptionalArg(opt); 907 866 return v8::Handle<v8::Value>(); … … 912 871 INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndOptionalArg"); 913 872 TestObj* imp = V8TestObj::toNative(args.Holder()); 914 if (args.Length() <= 0) 915 return throwError(TYPE_MISMATCH_ERR); 916 EXCEPTION_BLOCK(int, nonOpt, toInt32(args[0])); 873 int nonOpt = toInt32(args[0]); 917 874 if (args.Length() <= 1) { 918 875 imp->methodWithNonOptionalArgAndOptionalArg(nonOpt); 919 876 return v8::Handle<v8::Value>(); 920 877 } 921 EXCEPTION_BLOCK(int, opt, toInt32(args[1]));878 int opt = toInt32(args[1]); 922 879 imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); 923 880 return v8::Handle<v8::Value>(); … … 928 885 INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndTwoOptionalArgs"); 929 886 TestObj* imp = V8TestObj::toNative(args.Holder()); 930 if (args.Length() <= 0) 931 return throwError(TYPE_MISMATCH_ERR); 932 EXCEPTION_BLOCK(int, nonOpt, toInt32(args[0])); 887 int nonOpt = toInt32(args[0]); 933 888 if (args.Length() <= 1) { 934 889 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt); 935 890 return v8::Handle<v8::Value>(); 936 891 } 937 EXCEPTION_BLOCK(int, opt1, toInt32(args[1])); 938 if (args.Length() <= 2) { 939 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1); 940 return v8::Handle<v8::Value>(); 941 } 942 EXCEPTION_BLOCK(int, opt2, toInt32(args[2])); 892 int opt1 = toInt32(args[1]); 893 int opt2 = toInt32(args[2]); 943 894 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); 944 895 return v8::Handle<v8::Value>(); … … 949 900 INC_STATS("DOM.TestObj.methodWithCallbackArg"); 950 901 TestObj* imp = V8TestObj::toNative(args.Holder()); 951 if (args.Length() <= 0) 952 return throwError(TYPE_MISMATCH_ERR); 953 if (!args[0]->IsObject()) 902 if (args.Length() <= 0 || !args[0]->IsObject()) 954 903 return throwError(TYPE_MISMATCH_ERR); 955 904 RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext()); … … 962 911 INC_STATS("DOM.TestObj.methodWithNonCallbackArgAndCallbackArg"); 963 912 TestObj* imp = V8TestObj::toNative(args.Holder()); 964 if (args.Length() <= 0) 965 return throwError(TYPE_MISMATCH_ERR); 966 EXCEPTION_BLOCK(int, nonCallback, toInt32(args[0])); 967 if (args.Length() <= 1) 968 return throwError(TYPE_MISMATCH_ERR); 969 if (!args[1]->IsObject()) 913 int nonCallback = toInt32(args[0]); 914 if (args.Length() <= 1 || !args[1]->IsObject()) 970 915 return throwError(TYPE_MISMATCH_ERR); 971 916 RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext()); … … 978 923 INC_STATS("DOM.TestObj.methodWithCallbackAndOptionalArg"); 979 924 TestObj* imp = V8TestObj::toNative(args.Holder()); 980 RefPtr<TestCallback> callback; 981 if (args.Length() > 0 && args[0]->IsObject()) 982 callback = V8TestCallback::create(args[0], getScriptExecutionContext()); 925 if (args.Length() <= 0) { 926 imp->methodWithCallbackAndOptionalArg(); 927 return v8::Handle<v8::Value>(); 928 } 929 if (args.Length() <= 0 || !args[0]->IsObject()) 930 return throwError(TYPE_MISMATCH_ERR); 931 RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext()); 983 932 imp->methodWithCallbackAndOptionalArg(callback); 984 933 return v8::Handle<v8::Value>(); … … 989 938 INC_STATS("DOM.TestObj.overloadedMethod1"); 990 939 TestObj* imp = V8TestObj::toNative(args.Holder()); 991 if (args.Length() <= 0) 992 return throwError(TYPE_MISMATCH_ERR); 993 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 994 if (args.Length() <= 1) 995 return throwError(TYPE_MISMATCH_ERR); 940 TestObj* objArg = V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0; 996 941 V8Parameter<> strArg = args[1]; 997 942 imp->overloadedMethod(objArg, strArg); … … 1003 948 INC_STATS("DOM.TestObj.overloadedMethod2"); 1004 949 TestObj* imp = V8TestObj::toNative(args.Holder()); 1005 if (args.Length() <= 0) 1006 return throwError(TYPE_MISMATCH_ERR); 1007 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 950 TestObj* objArg = V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0; 1008 951 if (args.Length() <= 1) { 1009 952 imp->overloadedMethod(objArg); 1010 953 return v8::Handle<v8::Value>(); 1011 954 } 1012 EXCEPTION_BLOCK(int, intArg, toInt32(args[1]));955 int intArg = toInt32(args[1]); 1013 956 imp->overloadedMethod(objArg, intArg); 1014 957 return v8::Handle<v8::Value>(); … … 1019 962 INC_STATS("DOM.TestObj.overloadedMethod3"); 1020 963 TestObj* imp = V8TestObj::toNative(args.Holder()); 1021 if (args.Length() <= 0)1022 return throwError(TYPE_MISMATCH_ERR);1023 964 V8Parameter<> strArg = args[0]; 1024 965 imp->overloadedMethod(strArg); … … 1030 971 INC_STATS("DOM.TestObj.overloadedMethod4"); 1031 972 TestObj* imp = V8TestObj::toNative(args.Holder()); 1032 if (args.Length() <= 0) 1033 return throwError(TYPE_MISMATCH_ERR); 1034 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 973 int intArg = toInt32(args[0]); 1035 974 imp->overloadedMethod(intArg); 1036 975 return v8::Handle<v8::Value>(); … … 1150 1089 {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback}, 1151 1090 {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback}, 1152 {"methodWithCallbackArg", TestObjInternal::methodWithCallbackArgCallback},1153 {"methodWithNonCallbackArgAndCallbackArg", TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback},1154 1091 {"methodWithCallbackAndOptionalArg", TestObjInternal::methodWithCallbackAndOptionalArgCallback}, 1155 1092 {"overloadedMethod", TestObjInternal::overloadedMethodCallback}, … … 1225 1162 v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv); 1226 1163 proto->Set(v8::String::New("customArgsAndException"), v8::FunctionTemplate::New(TestObjInternal::customArgsAndExceptionCallback, v8::Handle<v8::Value>(), customArgsAndExceptionSignature)); 1164 1165 // Custom Signature 'methodWithCallbackArg' 1166 const int methodWithCallbackArgArgc = 1; 1167 v8::Handle<v8::FunctionTemplate> methodWithCallbackArgArgv[methodWithCallbackArgArgc] = { V8TestCallback::GetRawTemplate() }; 1168 v8::Handle<v8::Signature> methodWithCallbackArgSignature = v8::Signature::New(desc, methodWithCallbackArgArgc, methodWithCallbackArgArgv); 1169 proto->Set(v8::String::New("methodWithCallbackArg"), v8::FunctionTemplate::New(TestObjInternal::methodWithCallbackArgCallback, v8::Handle<v8::Value>(), methodWithCallbackArgSignature)); 1170 1171 // Custom Signature 'methodWithNonCallbackArgAndCallbackArg' 1172 const int methodWithNonCallbackArgAndCallbackArgArgc = 2; 1173 v8::Handle<v8::FunctionTemplate> methodWithNonCallbackArgAndCallbackArgArgv[methodWithNonCallbackArgAndCallbackArgArgc] = { v8::Handle<v8::FunctionTemplate>(), V8TestCallback::GetRawTemplate() }; 1174 v8::Handle<v8::Signature> methodWithNonCallbackArgAndCallbackArgSignature = v8::Signature::New(desc, methodWithNonCallbackArgAndCallbackArgArgc, methodWithNonCallbackArgAndCallbackArgArgv); 1175 proto->Set(v8::String::New("methodWithNonCallbackArgAndCallbackArg"), v8::FunctionTemplate::New(TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback, v8::Handle<v8::Value>(), methodWithNonCallbackArgAndCallbackArgSignature)); 1227 1176 batchConfigureConstants(desc, proto, TestObjConsts, sizeof(TestObjConsts) / sizeof(*TestObjConsts)); 1228 1177 -
trunk/WebCore/bindings/v8/V8Binding.h
r64835 r64840 34 34 #include "AtomicString.h" 35 35 #include "BindingSecurity.h" 36 #include "ExceptionCode.h"37 36 #include "MathExtras.h" 38 37 #include "PlatformString.h" 39 38 #include "V8DOMWrapper.h" 40 #include "V8Proxy.h"41 39 42 40 #include <v8.h> … … 228 226 }; 229 227 230 template<> inline V8Parameter<DefaultMode>::operator String() 231 { 232 String result; 233 v8::TryCatch block; 234 result = toWebCoreString(m_v8Object); 235 if (block.HasCaught()) { 236 V8Proxy::setDOMException(TYPE_MISMATCH_ERR); 237 return String(); 238 } 239 return result; 240 } 241 template<> inline V8Parameter<WithNullCheck>::operator String() 242 { 243 String result; 244 v8::TryCatch block; 245 result = toWebCoreStringWithNullCheck(m_v8Object); 246 if (block.HasCaught()) { 247 V8Proxy::setDOMException(TYPE_MISMATCH_ERR); 248 return String(); 249 } 250 return result; 251 } 252 template<> inline V8Parameter<WithUndefinedOrNullCheck>::operator String() 253 { 254 String result; 255 v8::TryCatch block; 256 result = toWebCoreStringWithNullOrUndefinedCheck(m_v8Object); 257 if (block.HasCaught()) { 258 V8Proxy::setDOMException(TYPE_MISMATCH_ERR); 259 return String(); 260 } 261 return result; 262 } 263 264 template<> inline V8Parameter<DefaultMode>::operator AtomicString() 265 { 266 AtomicString result; 267 v8::TryCatch block; 268 result = v8ValueToAtomicWebCoreString(m_v8Object); 269 if (block.HasCaught()) { 270 V8Proxy::setDOMException(TYPE_MISMATCH_ERR); 271 return AtomicString(); 272 } 273 return result; 274 } 275 template<> inline V8Parameter<WithNullCheck>::operator AtomicString() 276 { 277 AtomicString result; 278 v8::TryCatch block; 279 result = toAtomicWebCoreStringWithNullCheck(m_v8Object); 280 if (block.HasCaught()) { 281 V8Proxy::setDOMException(TYPE_MISMATCH_ERR); 282 return AtomicString(); 283 } 284 return result; 285 } 286 template<> inline V8Parameter<WithUndefinedOrNullCheck>::operator AtomicString() 287 { 288 AtomicString result; 289 v8::TryCatch block; 290 result = toAtomicWebCoreStringWithNullCheck(m_v8Object); 291 if (block.HasCaught()) { 292 V8Proxy::setDOMException(TYPE_MISMATCH_ERR); 293 return AtomicString(); 294 } 295 return result; 296 } 228 template<> inline V8Parameter<DefaultMode>::operator String() { return toWebCoreString(m_v8Object); } 229 template<> inline V8Parameter<WithNullCheck>::operator String() { return toWebCoreStringWithNullCheck(m_v8Object); } 230 template<> inline V8Parameter<WithUndefinedOrNullCheck>::operator String() { return toWebCoreStringWithNullOrUndefinedCheck(m_v8Object); } 231 232 template<> inline V8Parameter<DefaultMode>::operator AtomicString() { return v8ValueToAtomicWebCoreString(m_v8Object); } 233 template<> inline V8Parameter<WithNullCheck>::operator AtomicString() { return toAtomicWebCoreStringWithNullCheck(m_v8Object); } 234 template<> inline V8Parameter<WithUndefinedOrNullCheck>::operator AtomicString() { return toAtomicWebCoreStringWithNullCheck(m_v8Object); } 297 235 298 236 } // namespace WebCore -
trunk/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
r64835 r64840 33 33 34 34 #include "Chrome.h" 35 #include "Database.h" 35 36 #include "DOMTimer.h" 36 37 #include "DOMWindow.h" … … 55 56 #include "V8BindingState.h" 56 57 #include "V8CustomEventListener.h" 58 #include "V8Database.h" 59 #include "V8DatabaseCallback.h" 57 60 #include "V8GCForContextDispose.h" 58 61 #include "V8HiddenPropertyName.h" … … 788 791 } 789 792 793 #if ENABLE(DATABASE) 794 v8::Handle<v8::Value> V8DOMWindow::openDatabaseCallback(const v8::Arguments& args) 795 { 796 INC_STATS("DOM.DOMWindow.openDatabase"); 797 if (args.Length() < 4) 798 return throwError(SYNTAX_ERR); 799 800 TO_WEBCORE_STRING_EXCEPTION_BLOCK(name, args[0]); 801 TO_WEBCORE_STRING_EXCEPTION_BLOCK(version, args[1]); 802 TO_WEBCORE_STRING_EXCEPTION_BLOCK(displayName, args[2]); 803 EXCEPTION_BLOCK(unsigned long, estimatedSize, args[3]->Uint32Value()); 804 805 DOMWindow* imp = V8DOMWindow::toNative(args.Holder()); 806 if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true)) 807 return v8::Undefined(); 808 809 ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext(); 810 RefPtr<DatabaseCallback> creationCallback; 811 if (args.Length() >= 5) { 812 if (!args[4]->IsObject()) 813 return throwError(TYPE_MISMATCH_ERR); 814 815 creationCallback = V8DatabaseCallback::create(args[4], scriptExecutionContext); 816 } 817 818 ExceptionCode ec = 0; 819 v8::Handle<v8::Value> result = toV8(imp->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec)); 820 821 V8Proxy::setDOMException(ec); 822 return result; 823 } 824 #endif // ENABLE(DATABASE) 825 790 826 bool V8DOMWindow::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>) 791 827 { -
trunk/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
r64835 r64840 34 34 #include "V8WorkerContext.h" 35 35 36 #if ENABLE(DATABASE) 37 #include "Database.h" 38 #include "V8Database.h" 39 #include "V8DatabaseCallback.h" 40 #include "V8DatabaseSync.h" 41 #endif 36 42 #include "DOMTimer.h" 37 43 #include "ExceptionCode.h" … … 138 144 } 139 145 146 #if ENABLE(DATABASE) 147 v8::Handle<v8::Value> V8WorkerContext::openDatabaseCallback(const v8::Arguments& args) 148 { 149 INC_STATS("DOM.V8WorkerContext.openDatabase()"); 150 if (args.Length() < 4) 151 return throwError(SYNTAX_ERR); 152 153 TO_WEBCORE_STRING_EXCEPTION_BLOCK(name, args[0]); 154 TO_WEBCORE_STRING_EXCEPTION_BLOCK(version, args[1]); 155 TO_WEBCORE_STRING_EXCEPTION_BLOCK(displayName, args[2]); 156 EXCEPTION_BLOCK(unsigned long, estimatedSize, args[3]->Uint32Value()); 157 158 WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder()); 159 160 ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext(); 161 RefPtr<DatabaseCallback> creationCallback; 162 if (args.Length() >= 5) { 163 if (!args[4]->IsObject()) 164 return throwError(TYPE_MISMATCH_ERR); 165 166 creationCallback = V8DatabaseCallback::create(args[4], scriptExecutionContext); 167 } 168 169 ExceptionCode ec = 0; 170 v8::Handle<v8::Value> result = toV8(workerContext->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec)); 171 172 V8Proxy::setDOMException(ec); 173 return result; 174 } 175 176 v8::Handle<v8::Value> V8WorkerContext::openDatabaseSyncCallback(const v8::Arguments& args) 177 { 178 INC_STATS("DOM.V8WorkerContext.openDatabaseSync()"); 179 if (args.Length() < 4) 180 return throwError(SYNTAX_ERR); 181 182 TO_WEBCORE_STRING_EXCEPTION_BLOCK(name, args[0]); 183 TO_WEBCORE_STRING_EXCEPTION_BLOCK(version, args[1]); 184 TO_WEBCORE_STRING_EXCEPTION_BLOCK(displayName, args[2]); 185 EXCEPTION_BLOCK(unsigned long, estimatedSize, args[3]->Uint32Value()); 186 187 WorkerContext* workerContext = V8WorkerContext::toNative(args.Holder()); 188 189 ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext(); 190 RefPtr<DatabaseCallback> creationCallback; 191 if (args.Length() >= 5) { 192 if (!args[4]->IsObject()) 193 return throwError(TYPE_MISMATCH_ERR); 194 195 creationCallback = V8DatabaseCallback::create(args[4], scriptExecutionContext); 196 } 197 198 ExceptionCode ec = 0; 199 v8::Handle<v8::Value> result = toV8(workerContext->openDatabaseSync(name, version, displayName, estimatedSize, creationCallback.release(), ec)); 200 201 V8Proxy::setDOMException(ec); 202 return result; 203 } 204 #endif 205 140 206 } // namespace WebCore 141 207 -
trunk/WebCore/page/DOMWindow.idl
r64835 r64840 161 161 #endif 162 162 #if defined(ENABLE_DATABASE) && ENABLE_DATABASE 163 [EnabledAtRuntime ] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Optional, Callback]DatabaseCallback creationCallback)163 [EnabledAtRuntime, Custom] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback creationCallback) 164 164 raises(DOMException); 165 165 #endif -
trunk/WebCore/storage/Database.cpp
r64835 r64840 271 271 } 272 272 273 void Database::transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback) 274 { 275 runTransaction(callback, errorCallback, successCallback, false); 276 } 277 278 void Database::readTransaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback) 279 { 280 runTransaction(callback, errorCallback, successCallback, true); 281 } 282 283 void Database::runTransaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, 284 PassRefPtr<VoidCallback> successCallback, bool readOnly) 273 void Database::transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, 274 PassRefPtr<VoidCallback> successCallback, bool readOnly) 285 275 { 286 276 m_transactionQueue.append(SQLTransaction::create(this, callback, errorCallback, successCallback, 0, readOnly)); -
trunk/WebCore/storage/Database.h
r64835 r64840 60 60 void changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionCallback>, 61 61 PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback); 62 void transaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);63 void readTransaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);62 void transaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, 63 PassRefPtr<VoidCallback> successCallback, bool readOnly); 64 64 65 65 // Internal engine support … … 91 91 Database(ScriptExecutionContext*, const String& name, const String& expectedVersion, 92 92 const String& displayName, unsigned long estimatedSize); 93 void runTransaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>,94 PassRefPtr<VoidCallback> successCallback, bool readOnly);95 93 96 94 bool openAndVerifyVersion(bool setVersionInNewDatabase, ExceptionCode&); -
trunk/WebCore/storage/Database.idl
r64835 r64840 35 35 ] Database { 36 36 readonly attribute DOMString version; 37 void changeVersion(in DOMString oldVersion, in DOMString newVersion, in [Optional, Callback] SQLTransactionCallback callback, in [Optional, Callback] SQLTransactionErrorCallback errorCallback, in [Optional, Callback]VoidCallback successCallback);38 void transaction(in [Callback] SQLTransactionCallback callback, in [Optional, Callback] SQLTransactionErrorCallback errorCallback, in [Optional, Callback]VoidCallback successCallback);39 void readTransaction(in [Callback] SQLTransactionCallback callback, in [Optional, Callback] SQLTransactionErrorCallback errorCallback, in [Optional, Callback]VoidCallback successCallback);37 [Custom] void changeVersion(in DOMString oldVersion, in DOMString newVersion, in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, in VoidCallback successCallback); 38 [Custom] void transaction(in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, in VoidCallback successCallback); 39 [Custom] void readTransaction(in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, in VoidCallback successCallback); 40 40 }; 41 41 -
trunk/WebCore/storage/DatabaseSync.cpp
r64835 r64840 129 129 } 130 130 131 void DatabaseSync::transaction(PassRefPtr<SQLTransactionSyncCallback> callback, ExceptionCode& ec) 132 { 133 runTransaction(callback, false, ec); 134 } 135 136 void DatabaseSync::readTransaction(PassRefPtr<SQLTransactionSyncCallback> callback, ExceptionCode& ec) 137 { 138 runTransaction(callback, true, ec); 139 } 140 141 void DatabaseSync::runTransaction(PassRefPtr<SQLTransactionSyncCallback> callback, bool readOnly, ExceptionCode& ec) 131 void DatabaseSync::transaction(PassRefPtr<SQLTransactionSyncCallback> callback, bool readOnly, ExceptionCode& ec) 142 132 { 143 133 ASSERT(m_scriptExecutionContext->isContextThread()); -
trunk/WebCore/storage/DatabaseSync.h
r64835 r64840 57 57 const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback>, ExceptionCode&); 58 58 void changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionSyncCallback>, ExceptionCode&); 59 void transaction(PassRefPtr<SQLTransactionSyncCallback>, ExceptionCode&); 60 void readTransaction(PassRefPtr<SQLTransactionSyncCallback>, ExceptionCode&); 59 void transaction(PassRefPtr<SQLTransactionSyncCallback>, bool readOnly, ExceptionCode&); 61 60 62 61 virtual void markAsDeletedAndClose(); … … 66 65 DatabaseSync(ScriptExecutionContext*, const String& name, const String& expectedVersion, 67 66 const String& displayName, unsigned long estimatedSize); 68 void runTransaction(PassRefPtr<SQLTransactionSyncCallback>, bool readOnly, ExceptionCode&);69 67 }; 70 68 -
trunk/WebCore/storage/DatabaseSync.idl
r64835 r64840 37 37 ] DatabaseSync { 38 38 readonly attribute DOMString version; 39 void changeVersion(in DOMString oldVersion, in DOMString newVersion, in [Callback, Optional] SQLTransactionSyncCallback callback) raises(DOMException);40 void transaction(in [Callback] SQLTransactionSyncCallback callback) raises(DOMException);41 void readTransaction(in [Callback] SQLTransactionSyncCallback callback) raises(DOMException);39 [Custom] void changeVersion(in DOMString oldVersion, in DOMString newVersion, in SQLTransactionSyncCallback callback); 40 [Custom] void transaction(in SQLTransactionSyncCallback callback); 41 [Custom] void readTransaction(in SQLTransactionSyncCallback callback); 42 42 }; 43 43 -
trunk/WebCore/workers/WorkerContext.idl
r64835 r64840 51 51 attribute [Replaceable] WorkerNavigator navigator; 52 52 #if defined(ENABLE_DATABASE) && ENABLE_DATABASE 53 [EnabledAtRuntime ] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Optional, Callback]DatabaseCallback creationCallback)53 [EnabledAtRuntime, Custom] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback creationCallback) 54 54 raises(DOMException); 55 [EnabledAtRuntime] DatabaseSync openDatabaseSync(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Optional, Callback] DatabaseCallback creationCallback) 56 raises(DOMException); 55 [EnabledAtRuntime, Custom] DatabaseSync openDatabaseSync(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback creationCallback); 57 56 #endif 58 57
Note: See TracChangeset
for help on using the changeset viewer.