Changeset 65005 in webkit
- Timestamp:
- Aug 9, 2010 2:36:24 PM (14 years ago)
- Location:
- trunk
- Files:
-
- 4 deleted
- 34 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r64998 r65005 1 2010-08-09 Dumitru Daniliuc <dumi@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Changing the expected error message for a test. 6 https://bugs.webkit.org/show_bug.cgi?id=43382 7 8 * fast/workers/storage/open-database-inputs-sync-expected.txt: 9 1 10 2010-08-09 Zhenyao Mo <zmo@google.com> 2 11 -
trunk/LayoutTests/fast/workers/storage/open-database-inputs-sync-expected.txt
r64840 r65005 1 1 This test makes sure that openDatabaseSync() accepts only valid parameters. 2 PASS: SYNTAX_ERR: DOM Exception 123 PASS: SYNTAX_ERR: DOM Exception 122 PASS: Not enough arguments 3 PASS: Not enough arguments 4 4 PASS: undefined 5 5 PASS: undefined -
trunk/WebCore/Android.jscbindings.mk
r64845 r65005 91 91 bindings/js/JSDataGridColumnListCustom.cpp \ 92 92 bindings/js/JSDataGridDataSource.cpp \ 93 bindings/js/JSDatabaseCustom.cpp \94 93 bindings/js/JSDedicatedWorkerContextCustom.cpp \ 95 94 bindings/js/JSDesktopNotificationsCustom.cpp \ -
trunk/WebCore/Android.v8bindings.mk
r64845 r65005 107 107 bindings/v8/custom/V8DataGridColumnListCustom.cpp \ 108 108 bindings/v8/custom/V8DatabaseCallback.cpp \ 109 bindings/v8/custom/V8DatabaseCustom.cpp \110 109 bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp \ 111 110 bindings/v8/custom/V8DeviceMotionEventCustom.cpp \ -
trunk/WebCore/CMakeLists.txt
r64976 r65005 591 591 bindings/js/JSCustomVoidCallback.cpp 592 592 bindings/js/JSCustomXPathNSResolver.cpp 593 bindings/js/JSDatabaseCustom.cpp594 bindings/js/JSDatabaseCustom.cpp595 bindings/js/JSDatabaseSyncCustom.cpp596 593 bindings/js/JSDataGridColumnListCustom.cpp 597 594 bindings/js/JSDataGridDataSource.cpp -
trunk/WebCore/ChangeLog
r65004 r65005 1 2010-08-09 Dumitru Daniliuc <dumi@chromium.org> 2 3 Reviewed by Adam Barth. 4 5 Auto-generate most HTML5 DB bindings. 6 https://bugs.webkit.org/show_bug.cgi?id=43382 7 8 * Android.jscbindings.mk: Remove {JS|V8}Database{Sync}Custom.cpp 9 and the custom implementations of openDatabase{Sync}(). 10 * Android.v8bindings.mk: 11 * CMakeLists.txt: 12 * GNUmakefile.am: 13 * WebCore.gypi: 14 * WebCore.pro: 15 * WebCore.vcproj/WebCore.vcproj: 16 * WebCore.xcodeproj/project.pbxproj: 17 * bindings/js/JSBindingsAllInOne.cpp: 18 * bindings/js/JSDOMWindowCustom.cpp: 19 * bindings/js/JSDatabaseCustom.cpp: Removed. 20 * bindings/js/JSDatabaseSyncCustom.cpp: Removed. 21 * bindings/js/JSWorkerContextCustom.cpp: 22 * bindings/v8/custom/V8DOMWindowCustom.cpp: 23 * bindings/v8/custom/V8DatabaseCustom.cpp: Removed. 24 * bindings/v8/custom/V8DatabaseSyncCustom.cpp: Removed. 25 * bindings/v8/custom/V8WorkerContextCustom.cpp: 26 27 * bindings/scripts/CodeGeneratorGObject.pm: Change the code generators 28 to check that each value can be converted to the respective 29 argument type. 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/V8/V8TestObj.cpp: 58 (WebCore::TestObjInternal::voidMethodWithArgsCallback): 59 (WebCore::TestObjInternal::intMethodWithArgsCallback): 60 (WebCore::TestObjInternal::objMethodWithArgsCallback): 61 (WebCore::TestObjInternal::methodThatRequiresAllArgsCallback): 62 (WebCore::TestObjInternal::methodThatRequiresAllArgsAndThrowsCallback): 63 (WebCore::TestObjInternal::idbKeyCallback): 64 (WebCore::TestObjInternal::customArgsAndExceptionCallback): 65 (WebCore::TestObjInternal::withDynamicFrameAndArgCallback): 66 (WebCore::TestObjInternal::withDynamicFrameAndOptionalArgCallback): 67 (WebCore::TestObjInternal::withDynamicFrameAndUserGestureCallback): 68 (WebCore::TestObjInternal::withDynamicFrameAndUserGestureASADCallback): 69 (WebCore::TestObjInternal::methodWithOptionalArgCallback): 70 (WebCore::TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback): 71 (WebCore::TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback): 72 (WebCore::TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback): 73 (WebCore::TestObjInternal::methodWithCallbackAndOptionalArgCallback): 74 (WebCore::TestObjInternal::overloadedMethod1Callback): 75 (WebCore::TestObjInternal::overloadedMethod2Callback): 76 (WebCore::TestObjInternal::overloadedMethod3Callback): 77 (WebCore::TestObjInternal::overloadedMethod4Callback): 78 (WebCore::): 79 (WebCore::ConfigureV8TestObjTemplate): 80 * bindings/v8/custom/V8BindingMacros.h: 81 82 * bindings/v8/V8Binding.h: Minor changes required to support the 83 auto-generated bindings. 84 (WebCore::V8Parameter::V8Parameter): 85 * bindings/v8/custom/V8SQLTransactionCustom.cpp: 86 (WebCore::V8SQLTransaction::executeSqlCallback): 87 * bindings/v8/custom/V8SQLTransactionSyncCustom.cpp: 88 (WebCore::V8SQLTransactionSync::executeSqlCallback): 89 * page/DOMWindow.idl: 90 * storage/Database.cpp: 91 (WebCore::Database::transaction): 92 (WebCore::Database::readTransaction): 93 (WebCore::Database::runTransaction): 94 * storage/Database.h: 95 * storage/Database.idl: 96 * storage/DatabaseSync.cpp: 97 (WebCore::DatabaseSync::transaction): 98 (WebCore::DatabaseSync::readTransaction): 99 (WebCore::DatabaseSync::runTransaction): 100 * storage/DatabaseSync.h: 101 * storage/DatabaseSync.idl: 102 * workers/WorkerContext.idl: 103 1 104 2010-08-09 Adam Barth <abarth@webkit.org> 2 105 -
trunk/WebCore/GNUmakefile.am
r64976 r65005 2744 2744 webcore_sources += \ 2745 2745 WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp \ 2746 WebCore/bindings/js/JSDatabaseCustom.cpp \2747 WebCore/bindings/js/JSDatabaseSyncCustom.cpp \2748 2746 WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp \ 2749 2747 WebCore/bindings/js/JSSQLTransactionCustom.cpp \ -
trunk/WebCore/WebCore.gypi
r64949 r65005 544 544 'bindings/js/JSCustomXPathNSResolver.cpp', 545 545 'bindings/js/JSCustomXPathNSResolver.h', 546 'bindings/js/JSDatabaseCustom.cpp',547 'bindings/js/JSDatabaseSyncCustom.cpp',548 546 'bindings/js/JSDataGridColumnListCustom.cpp', 549 547 'bindings/js/JSDataGridDataSource.cpp', … … 743 741 'bindings/v8/custom/V8CustomXPathNSResolver.cpp', 744 742 'bindings/v8/custom/V8CustomXPathNSResolver.h', 745 'bindings/v8/custom/V8DatabaseCustom.cpp',746 'bindings/v8/custom/V8DatabaseSyncCustom.cpp',747 743 'bindings/v8/custom/V8DataGridColumnListCustom.cpp', 748 744 'bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp', -
trunk/WebCore/WebCore.pro
r64976 r65005 2426 2426 storage/SQLTransactionSync.cpp \ 2427 2427 bindings/js/JSCustomSQLStatementErrorCallback.cpp \ 2428 bindings/js/JSDatabaseCustom.cpp \2429 bindings/js/JSDatabaseSyncCustom.cpp \2430 2428 bindings/js/JSSQLResultSetRowListCustom.cpp \ 2431 2429 bindings/js/JSSQLTransactionCustom.cpp \ -
trunk/WebCore/WebCore.vcproj/WebCore.vcproj
r64976 r65005 42181 42181 </File> 42182 42182 <File 42183 RelativePath="..\bindings\js\JSDatabaseCustom.cpp"42184 >42185 <FileConfiguration42186 Name="Debug|Win32"42187 ExcludedFromBuild="true"42188 >42189 <Tool42190 Name="VCCLCompilerTool"42191 />42192 </FileConfiguration>42193 <FileConfiguration42194 Name="Release|Win32"42195 ExcludedFromBuild="true"42196 >42197 <Tool42198 Name="VCCLCompilerTool"42199 />42200 </FileConfiguration>42201 <FileConfiguration42202 Name="Debug_Internal|Win32"42203 ExcludedFromBuild="true"42204 >42205 <Tool42206 Name="VCCLCompilerTool"42207 />42208 </FileConfiguration>42209 <FileConfiguration42210 Name="Debug_Cairo|Win32"42211 ExcludedFromBuild="true"42212 >42213 <Tool42214 Name="VCCLCompilerTool"42215 />42216 </FileConfiguration>42217 <FileConfiguration42218 Name="Release_Cairo|Win32"42219 ExcludedFromBuild="true"42220 >42221 <Tool42222 Name="VCCLCompilerTool"42223 />42224 </FileConfiguration>42225 <FileConfiguration42226 Name="Debug_All|Win32"42227 ExcludedFromBuild="true"42228 >42229 <Tool42230 Name="VCCLCompilerTool"42231 />42232 </FileConfiguration>42233 </File>42234 <File42235 RelativePath="..\bindings\js\JSDatabaseSyncCustom.cpp"42236 >42237 <FileConfiguration42238 Name="Debug|Win32"42239 ExcludedFromBuild="true"42240 >42241 <Tool42242 Name="VCCLCompilerTool"42243 />42244 </FileConfiguration>42245 <FileConfiguration42246 Name="Release|Win32"42247 ExcludedFromBuild="true"42248 >42249 <Tool42250 Name="VCCLCompilerTool"42251 />42252 </FileConfiguration>42253 <FileConfiguration42254 Name="Debug_Internal|Win32"42255 ExcludedFromBuild="true"42256 >42257 <Tool42258 Name="VCCLCompilerTool"42259 />42260 </FileConfiguration>42261 <FileConfiguration42262 Name="Debug_Cairo|Win32"42263 ExcludedFromBuild="true"42264 >42265 <Tool42266 Name="VCCLCompilerTool"42267 />42268 </FileConfiguration>42269 <FileConfiguration42270 Name="Release_Cairo|Win32"42271 ExcludedFromBuild="true"42272 >42273 <Tool42274 Name="VCCLCompilerTool"42275 />42276 </FileConfiguration>42277 <FileConfiguration42278 Name="Debug_All|Win32"42279 ExcludedFromBuild="true"42280 >42281 <Tool42282 Name="VCCLCompilerTool"42283 />42284 </FileConfiguration>42285 </File>42286 <File42287 42183 RelativePath="..\bindings\js\JSDataGridColumnListCustom.cpp" 42288 42184 > -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r64996 r65005 4365 4365 B55D5AA4119131FC00BCC315 /* JSSQLTransactionSyncCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */; }; 4366 4366 B55D5AA5119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA3119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp */; }; 4367 B55D5AA81191325000BCC315 /* JSDatabaseSyncCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */; };4368 4367 B55D5AA91191325000BCC315 /* JSSQLTransactionSyncCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA71191325000BCC315 /* JSSQLTransactionSyncCustom.cpp */; }; 4369 4368 B56EBA8511C9FF8100B04477 /* SQLException.h in Headers */ = {isa = PBXBuildFile; fileRef = B56EBA8311C9FF8100B04477 /* SQLException.h */; }; … … 4823 4822 BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */; }; 4824 4823 BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */; }; 4825 BCCE58AC1061E8CF008FB35A /* JSDatabaseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */; };4826 4824 BCCFBAE80B5152ED0001F1D7 /* DocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */; settings = {ATTRIBUTES = (Private, ); }; }; 4827 4825 BCD0E0FA0E972C3500265DEA /* SecurityOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */; }; … … 10066 10064 B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransactionSyncCallback.h; sourceTree = "<group>"; }; 10067 10065 B55D5AA3119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionSyncCallback.cpp; sourceTree = "<group>"; }; 10068 B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseSyncCustom.cpp; sourceTree = "<group>"; };10069 10066 B55D5AA71191325000BCC315 /* JSSQLTransactionSyncCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionSyncCustom.cpp; sourceTree = "<group>"; }; 10070 10067 B55D5ABB1191327200BCC315 /* DatabaseSync.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DatabaseSync.idl; sourceTree = "<group>"; }; … … 10561 10558 BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLViewSourceDocument.h; sourceTree = "<group>"; }; 10562 10559 BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLViewSourceDocument.cpp; sourceTree = "<group>"; }; 10563 BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseCustom.cpp; sourceTree = "<group>"; };10564 10560 BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DocumentParser.h; sourceTree = "<group>"; }; 10565 10561 BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityOrigin.cpp; sourceTree = "<group>"; }; … … 16027 16023 BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */, 16028 16024 BC20FB7E0C0E8E6C00D1447F /* JSCSSValueCustom.cpp */, 16029 BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */,16030 B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */,16031 16025 BC77D1510FF19C730070887B /* JSDataGridColumnListCustom.cpp */, 16032 16026 4162A453101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp */, … … 21321 21315 1AE82F8F0CAAFA9D002237AE /* JSDatabase.cpp in Sources */, 21322 21316 B59DD69A119029E5007E9684 /* JSDatabaseCallback.cpp in Sources */, 21323 BCCE58AC1061E8CF008FB35A /* JSDatabaseCustom.cpp in Sources */,21324 21317 B58CEB6A11913607002A6790 /* JSDatabaseSync.cpp in Sources */, 21325 B55D5AA81191325000BCC315 /* JSDatabaseSyncCustom.cpp in Sources */,21326 21318 BC77D1690FF19F560070887B /* JSDataGridColumn.cpp in Sources */, 21327 21319 BC77D16B0FF19F560070887B /* JSDataGridColumnList.cpp in Sources */, -
trunk/WebCore/bindings/js/JSBindingsAllInOne.cpp
r64840 r65005 58 58 #include "JSDataGridColumnListCustom.cpp" 59 59 #include "JSDataGridDataSource.cpp" 60 #include "JSDatabaseCustom.cpp"61 #include "JSDatabaseSyncCustom.cpp"62 60 #include "JSDebugWrapperSet.cpp" 63 61 #include "JSDedicatedWorkerContextCustom.cpp" -
trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp
r64840 r65005 23 23 #include "AtomicString.h" 24 24 #include "Chrome.h" 25 #include "Database.h"26 25 #include "DOMWindow.h" 27 26 #include "Document.h" … … 37 36 #include "History.h" 38 37 #include "JSAudioConstructor.h" 39 #if ENABLE(DATABASE)40 #include "JSDatabase.h"41 #include "JSDatabaseCallback.h"42 #endif43 38 #include "JSDOMWindowShell.h" 44 39 #include "JSEvent.h" … … 1007 1002 } 1008 1003 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 size1030 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 #endif1051 1052 1004 DOMWindow* toDOMWindow(JSValue value) 1053 1005 { -
trunk/WebCore/bindings/js/JSWorkerContextCustom.cpp
r64840 r65005 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 #endif39 32 #include "ExceptionCode.h" 40 33 #include "JSDOMBinding.h" … … 154 147 #endif 155 148 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 size177 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 size217 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 #endif238 239 149 } // namespace WebCore 240 150 -
trunk/WebCore/bindings/scripts/CodeGeneratorGObject.pm
r64840 r65005 209 209 } 210 210 211 # Skip functions that have ["Callback"] parameters, because this 212 # code generator doesn't know how to auto-generate callbacks. 213 foreach my $param (@{$function->parameters}) { 214 if ($param->extendedAttributes->{"Callback"}) { 215 return 1; 216 } 217 } 218 211 219 return 0; 212 220 } -
trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm
r64840 r65005 1854 1854 my $requiresAllArguments = $function->signature->extendedAttributes->{"RequiresAllArguments"}; 1855 1855 if ($requiresAllArguments) { 1856 push(@implContent, " if (exec->argumentCount() < $numParameters)\n"); 1857 if ($requiresAllArguments eq "Raise") { 1858 push(@implContent, " return throwVMError(exec, createSyntaxError(exec, \"Not enough arguments\"));\n"); 1856 my $numMandatoryParams = @{$function->parameters}; 1857 foreach my $param (reverse(@{$function->parameters})) { 1858 if ($param->extendedAttributes->{"Optional"}) { 1859 $numMandatoryParams--; 1859 1860 } else { 1860 push(@implContent, " return JSValue::encode(jsUndefined());\n");1861 last; 1861 1862 } 1863 } 1864 push(@implContent, " if (exec->argumentCount() < $numMandatoryParams)\n"); 1865 if ($requiresAllArguments eq "Raise") { 1866 push(@implContent, " return throwVMError(exec, createSyntaxError(exec, \"Not enough arguments\"));\n"); 1867 } else { 1868 push(@implContent, " return JSValue::encode(jsUndefined());\n"); 1869 } 1862 1870 } 1863 1871 … … 1909 1917 } 1910 1918 1919 $implIncludes{"ExceptionCode.h"} = 1; 1920 $implIncludes{"JSDOMBinding.h"} = 1; 1911 1921 foreach my $parameter (@{$function->parameters}) { 1912 if ($parameter->extendedAttributes->{"Optional"}) { 1922 # Optional callbacks should be treated differently, because they always have a default value (0), 1923 # and we can reduce the number of overloaded functions that take a different number of parameters. 1924 if ($parameter->extendedAttributes->{"Optional"} && !$parameter->extendedAttributes->{"Callback"}) { 1913 1925 # Generate early call if there are enough parameters. 1914 1926 if (!$hasOptionalArguments) { … … 1916 1928 $hasOptionalArguments = 1; 1917 1929 } 1918 push(@implContent, " if (argsCount < " . ($argsIndex + 1) . ") {\n");1930 push(@implContent, " if (argsCount <= $argsIndex) {\n"); 1919 1931 GenerateImplementationFunctionCall($function, $functionString, $paramIndex, " " x 2, $podType, $implClassName); 1920 1932 push(@implContent, " }\n\n"); … … 1935 1947 my $callbackClassName = GetCallbackClassName($parameter->type); 1936 1948 $implIncludes{"$callbackClassName.h"} = 1; 1937 $implIncludes{"ExceptionCode.h"} = 1; 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"); 1949 if ($parameter->extendedAttributes->{"Optional"}) { 1950 push(@implContent, " RefPtr<" . $parameter->type. "> $name;\n"); 1951 push(@implContent, " if (exec->argumentCount() > $argsIndex && !exec->argument($argsIndex).isNull() && !exec->argument($argsIndex).isUndefined()) {\n"); 1952 push(@implContent, " if (!exec->argument($argsIndex).isObject()) {\n"); 1953 push(@implContent, " setDOMException(exec, TYPE_MISMATCH_ERR);\n"); 1954 push(@implContent, " return JSValue::encode(jsUndefined());\n"); 1955 push(@implContent, " }\n"); 1956 push(@implContent, " $name = ${callbackClassName}::create(asObject(exec->argument($argsIndex)), castedThis->globalObject());\n"); 1957 push(@implContent, " }\n"); 1958 } else { 1959 push(@implContent, " if (exec->argumentCount() <= $argsIndex || !exec->argument($argsIndex).isObject()) {\n"); 1960 push(@implContent, " setDOMException(exec, TYPE_MISMATCH_ERR);\n"); 1961 push(@implContent, " return JSValue::encode(jsUndefined());\n"); 1962 push(@implContent, " }\n"); 1963 push(@implContent, " RefPtr<" . $parameter->type . "> $name = ${callbackClassName}::create(asObject(exec->argument($argsIndex)), castedThis->globalObject());\n"); 1964 } 1943 1965 } else { 1944 1966 push(@implContent, " " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($argsIndex)") . ";\n"); … … 1948 1970 # was negative will be lost by the time we're inside the DOM. 1949 1971 if ($parameter->extendedAttributes->{"IsIndex"}) { 1950 $implIncludes{"ExceptionCode.h"} = 1;1951 1972 push(@implContent, " if ($name < 0) {\n"); 1952 1973 push(@implContent, " setDOMException(exec, INDEX_SIZE_ERR);\n"); … … 1954 1975 push(@implContent, " }\n"); 1955 1976 } 1977 1978 # Check if the type conversion succeeded. 1979 push(@implContent, " if (exec->hadException())\n"); 1980 push(@implContent, " return JSValue::encode(jsUndefined());\n"); 1956 1981 } 1957 1982 … … 2172 2197 push(@implContent, " ScriptExecutionContext* context = scriptExecutionContext();\n"); 2173 2198 push(@implContent, " // When the context is destroyed, all tasks with a reference to a callback\n"); 2174 push(@implContent, " // should be deleted. So if the context is NULL, we are on the context thread.\n");2199 push(@implContent, " // should be deleted. So if the context is 0, we are on the context thread.\n"); 2175 2200 push(@implContent, " if (!context || context->isContextThread())\n"); 2176 2201 push(@implContent, " delete m_data;\n"); … … 2344 2369 return "$value.toNumber(exec)" if $type eq "double"; 2345 2370 return "$value.toFloat(exec)" if $type eq "float" or $type eq "SVGNumber"; 2346 return "$value.toInt32(exec)" if $type eq "unsigned long" or $type eq "long" or $type eq "unsigned short"; 2371 return "$value.toInt32(exec)" if $type eq "long"; 2372 return "$value.toUInt32(exec)" if $type eq "unsigned long" or $type eq "unsigned short"; 2347 2373 return "static_cast<$type>($value.toInteger(exec))" if $type eq "long long" or $type eq "unsigned long long"; 2348 2374 -
trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm
r64840 r65005 1107 1107 my $requiresAllArguments = $function->signature->extendedAttributes->{"RequiresAllArguments"}; 1108 1108 if ($requiresAllArguments) { 1109 push(@implContentDecls, " if (args.Length() < $numParameters)\n"); 1109 my $numMandatoryParams = @{$function->parameters}; 1110 foreach my $param (reverse(@{$function->parameters})) { 1111 if ($param->extendedAttributes->{"Optional"}) { 1112 $numMandatoryParams--; 1113 } else { 1114 last; 1115 } 1116 } 1117 push(@implContentDecls, " if (args.Length() < $numMandatoryParams)\n"); 1110 1118 if ($requiresAllArguments eq "Raise") { 1111 1119 push(@implContentDecls, " return throwError(\"Not enough arguments\", V8Proxy::SyntaxError);\n"); … … 1176 1184 my $parameterName = $parameter->name; 1177 1185 1178 if ($parameter->extendedAttributes->{"Optional"}) { 1186 # Optional callbacks should be treated differently, because they always have a default value (0), 1187 # and we can reduce the number of overloaded functions that take a different number of parameters. 1188 if ($parameter->extendedAttributes->{"Optional"} && !$parameter->extendedAttributes->{"Callback"}) { 1179 1189 # Generate early call if there are not enough parameters. 1180 1190 push(@implContentDecls, " if (args.Length() <= $paramIndex) {\n"); … … 1184 1194 } 1185 1195 1196 if (BasicTypeCanFailConversion($parameter)) { 1197 push(@implContentDecls, " bool ${parameterName}Ok;\n"); 1198 } 1199 1200 $implIncludes{"ExceptionCode.h"} = 1; 1201 my $nativeType = GetNativeTypeFromSignature($parameter, $paramIndex); 1186 1202 if ($parameter->extendedAttributes->{"Callback"}) { 1187 1203 my $className = GetCallbackClassName($parameter->type); 1188 1204 $implIncludes{"$className.h"} = 1; 1189 $implIncludes{"ExceptionCode.h"} = 1; 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"); 1193 $paramIndex++; 1194 next; 1195 } 1196 1197 if ($parameter->type eq "SerializedScriptValue") { 1205 if ($parameter->extendedAttributes->{"Optional"}) { 1206 push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName;\n"); 1207 push(@implContentDecls, " if (args.Length() > $paramIndex && !args[$paramIndex]->IsNull() && !args[$paramIndex]->IsUndefined()) {\n"); 1208 push(@implContentDecls, " if (!args[$paramIndex]->IsObject())\n"); 1209 push(@implContentDecls, " return throwError(TYPE_MISMATCH_ERR);\n"); 1210 push(@implContentDecls, " $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n"); 1211 push(@implContentDecls, " }\n"); 1212 } else { 1213 push(@implContentDecls, " if (args.Length() <= $paramIndex || !args[$paramIndex]->IsObject())\n"); 1214 push(@implContentDecls, " return throwError(TYPE_MISMATCH_ERR);\n"); 1215 push(@implContentDecls, " RefPtr<" . $parameter->type . "> $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n"); 1216 } 1217 } elsif ($parameter->type eq "SerializedScriptValue") { 1198 1218 $implIncludes{"SerializedScriptValue.h"} = 1; 1199 1219 push(@implContentDecls, " bool ${parameterName}DidThrow = false;\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"); 1220 push(@implContentDecls, " $nativeType $parameterName = SerializedScriptValue::create(args[$paramIndex], ${parameterName}DidThrow);\n"); 1208 1221 push(@implContentDecls, " if (${parameterName}DidThrow)\n"); 1209 1222 push(@implContentDecls, " return v8::Undefined();\n"); 1223 } elsif (TypeCanFailConversion($parameter)) { 1224 push(@implContentDecls, " $nativeType $parameterName = " . 1225 JSValueToNative($parameter, "args[$paramIndex]", BasicTypeCanFailConversion($parameter) ? "${parameterName}Ok" : undef) . ";\n"); 1226 push(@implContentDecls, " if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n"); 1227 push(@implContentDecls, " ec = TYPE_MISMATCH_ERR;\n"); 1228 push(@implContentDecls, " goto fail;\n"); 1229 push(@implContentDecls, " }\n"); 1230 } elsif ($nativeType =~ /^V8Parameter/) { 1231 my $value = JSValueToNative($parameter, "args[$paramIndex]", BasicTypeCanFailConversion($parameter) ? "${parameterName}Ok" : undef); 1232 if ($parameter->type eq "DOMString") { 1233 push(@implContentDecls, " STRING_TO_V8PARAMETER_EXCEPTION_BLOCK($nativeType, $parameterName, $value);\n"); 1234 } else { 1235 # Don't know how to properly check for conversion exceptions when $parameter->type is "DOMUserData" 1236 push(@implContentDecls, " $nativeType $parameterName = $value;\n"); 1237 } 1210 1238 } else { 1211 push(@implContentDecls, JSValueToNative($parameter, "args[$paramIndex]", 1212 BasicTypeCanFailConversion($parameter) ? "${parameterName}Ok" : undef) . ";\n"); 1213 } 1214 1215 if (TypeCanFailConversion($parameter)) { 1216 $implIncludes{"ExceptionCode.h"} = 1; 1217 push(@implContentDecls, 1218 " if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n" . 1219 " ec = TYPE_MISMATCH_ERR;\n" . 1220 " goto fail;\n" . 1221 " }\n"); 1239 $implIncludes{"V8BindingMacros.h"} = 1; 1240 push(@implContentDecls, " EXCEPTION_BLOCK($nativeType, $parameterName, " . 1241 JSValueToNative($parameter, "args[$paramIndex]", BasicTypeCanFailConversion($parameter) ? "${parameterName}Ok" : undef) . ");\n"); 1222 1242 } 1223 1243 1224 1244 if ($parameter->extendedAttributes->{"IsIndex"}) { 1225 $implIncludes{"ExceptionCode.h"} = 1; 1226 push(@implContentDecls, 1227 " if (UNLIKELY($parameterName < 0)) {\n" . 1228 " ec = INDEX_SIZE_ERR;\n" . 1229 " goto fail;\n" . 1230 " }\n"); 1245 push(@implContentDecls, " if (UNLIKELY($parameterName < 0)) {\n"); 1246 push(@implContentDecls, " ec = INDEX_SIZE_ERR;\n"); 1247 push(@implContentDecls, " goto fail;\n"); 1248 push(@implContentDecls, " }\n"); 1231 1249 } 1232 1250 … … 2826 2844 return "$value->NumberValue()" if $type eq "SVGNumber"; 2827 2845 2828 return "toInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short" or $type eq "long"; 2846 return "toInt32($value${maybeOkParam})" if $type eq "long"; 2847 return "toUInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short"; 2829 2848 return "toInt64($value)" if $type eq "unsigned long long" or $type eq "long long"; 2830 2849 return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "CompareHow"; … … 2956 2975 2957 2976 foreach my $parameter (@{$function->parameters}) { 2958 if ($parameter->extendedAttributes->{"Optional"} ) {2977 if ($parameter->extendedAttributes->{"Optional"} || $parameter->extendedAttributes->{"Callback"}) { 2959 2978 return 0; 2960 2979 } -
trunk/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp
r64840 r65005 43 43 JSTestCallback::~JSTestCallback() 44 44 { 45 if (m_scriptExecutionContext->isContextThread()) 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 0, we are on the context thread. 48 if (!context || context->isContextThread()) 46 49 delete m_data; 47 50 else 48 m_data->globalObject()->scriptExecutionContext()->postTask(DeleteCallbackDataTask::create(m_data));51 context->postTask(DeleteCallbackDataTask::create(m_data)); 49 52 #ifndef NDEBUG 50 53 m_data = 0; -
trunk/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r64840 r65005 26 26 #include "IDBBindingUtilities.h" 27 27 #include "IDBKey.h" 28 #include "JSDOMBinding.h" 28 29 #include "JSEventListener.h" 29 30 #include "JSTestCallback.h" … … 795 796 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 796 797 int intArg = exec->argument(0).toInt32(exec); 798 if (exec->hadException()) 799 return JSValue::encode(jsUndefined()); 797 800 const String& strArg = ustringToString(exec->argument(1).toString(exec)); 801 if (exec->hadException()) 802 return JSValue::encode(jsUndefined()); 798 803 TestObj* objArg = toTestObj(exec->argument(2)); 804 if (exec->hadException()) 805 return JSValue::encode(jsUndefined()); 799 806 800 807 imp->voidMethodWithArgs(intArg, strArg, objArg); … … 823 830 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 824 831 int intArg = exec->argument(0).toInt32(exec); 832 if (exec->hadException()) 833 return JSValue::encode(jsUndefined()); 825 834 const String& strArg = ustringToString(exec->argument(1).toString(exec)); 835 if (exec->hadException()) 836 return JSValue::encode(jsUndefined()); 826 837 TestObj* objArg = toTestObj(exec->argument(2)); 838 if (exec->hadException()) 839 return JSValue::encode(jsUndefined()); 827 840 828 841 … … 852 865 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 853 866 int intArg = exec->argument(0).toInt32(exec); 867 if (exec->hadException()) 868 return JSValue::encode(jsUndefined()); 854 869 const String& strArg = ustringToString(exec->argument(1).toString(exec)); 870 if (exec->hadException()) 871 return JSValue::encode(jsUndefined()); 855 872 TestObj* objArg = toTestObj(exec->argument(2)); 873 if (exec->hadException()) 874 return JSValue::encode(jsUndefined()); 856 875 857 876 … … 870 889 return JSValue::encode(jsUndefined()); 871 890 const String& strArg = ustringToString(exec->argument(0).toString(exec)); 891 if (exec->hadException()) 892 return JSValue::encode(jsUndefined()); 872 893 TestObj* objArg = toTestObj(exec->argument(1)); 894 if (exec->hadException()) 895 return JSValue::encode(jsUndefined()); 873 896 874 897 … … 888 911 ExceptionCode ec = 0; 889 912 const String& strArg = ustringToString(exec->argument(0).toString(exec)); 913 if (exec->hadException()) 914 return JSValue::encode(jsUndefined()); 890 915 TestObj* objArg = toTestObj(exec->argument(1)); 916 if (exec->hadException()) 917 return JSValue::encode(jsUndefined()); 891 918 892 919 … … 904 931 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 905 932 RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, exec->argument(0)); 933 if (exec->hadException()) 934 return JSValue::encode(jsUndefined()); 906 935 907 936 imp->serializedValue(serializedArg); … … 917 946 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 918 947 RefPtr<IDBKey> key = createIDBKeyFromValue(exec, exec->argument(0)); 948 if (exec->hadException()) 949 return JSValue::encode(jsUndefined()); 919 950 920 951 imp->idbKey(key); … … 964 995 ScriptCallStack callStack(exec, 1); 965 996 log* intArg = tolog(exec->argument(0)); 997 if (exec->hadException()) 998 return JSValue::encode(jsUndefined()); 966 999 967 1000 imp->customArgsAndException(intArg, &callStack, ec); … … 1024 1057 return JSValue::encode(jsUndefined()); 1025 1058 int intArg = exec->argument(0).toInt32(exec); 1059 if (exec->hadException()) 1060 return JSValue::encode(jsUndefined()); 1026 1061 1027 1062 imp->withDynamicFrameAndArg(dynamicFrame, intArg); … … 1040 1075 return JSValue::encode(jsUndefined()); 1041 1076 int intArg = exec->argument(0).toInt32(exec); 1077 if (exec->hadException()) 1078 return JSValue::encode(jsUndefined()); 1042 1079 1043 1080 int argsCount = exec->argumentCount(); 1044 if (argsCount < 2) {1081 if (argsCount <= 1) { 1045 1082 imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg); 1046 1083 return JSValue::encode(jsUndefined()); … … 1048 1085 1049 1086 int optionalArg = exec->argument(1).toInt32(exec); 1087 if (exec->hadException()) 1088 return JSValue::encode(jsUndefined()); 1050 1089 1051 1090 imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg); … … 1064 1103 return JSValue::encode(jsUndefined()); 1065 1104 int intArg = exec->argument(0).toInt32(exec); 1105 if (exec->hadException()) 1106 return JSValue::encode(jsUndefined()); 1066 1107 1067 1108 imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec)); … … 1080 1121 return JSValue::encode(jsUndefined()); 1081 1122 int intArg = exec->argument(0).toInt32(exec); 1123 if (exec->hadException()) 1124 return JSValue::encode(jsUndefined()); 1082 1125 1083 1126 int argsCount = exec->argumentCount(); 1084 if (argsCount < 2) {1127 if (argsCount <= 1) { 1085 1128 imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg); 1086 1129 return JSValue::encode(jsUndefined()); … … 1088 1131 1089 1132 int optionalArg = exec->argument(1).toInt32(exec); 1133 if (exec->hadException()) 1134 return JSValue::encode(jsUndefined()); 1090 1135 1091 1136 imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec)); … … 1175 1220 1176 1221 int argsCount = exec->argumentCount(); 1177 if (argsCount < 1) {1222 if (argsCount <= 0) { 1178 1223 imp->methodWithOptionalArg(); 1179 1224 return JSValue::encode(jsUndefined()); … … 1181 1226 1182 1227 int opt = exec->argument(0).toInt32(exec); 1228 if (exec->hadException()) 1229 return JSValue::encode(jsUndefined()); 1183 1230 1184 1231 imp->methodWithOptionalArg(opt); … … 1194 1241 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1195 1242 int nonOpt = exec->argument(0).toInt32(exec); 1243 if (exec->hadException()) 1244 return JSValue::encode(jsUndefined()); 1196 1245 1197 1246 int argsCount = exec->argumentCount(); 1198 if (argsCount < 2) {1247 if (argsCount <= 1) { 1199 1248 imp->methodWithNonOptionalArgAndOptionalArg(nonOpt); 1200 1249 return JSValue::encode(jsUndefined()); … … 1202 1251 1203 1252 int opt = exec->argument(1).toInt32(exec); 1253 if (exec->hadException()) 1254 return JSValue::encode(jsUndefined()); 1204 1255 1205 1256 imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); … … 1215 1266 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1216 1267 int nonOpt = exec->argument(0).toInt32(exec); 1268 if (exec->hadException()) 1269 return JSValue::encode(jsUndefined()); 1217 1270 1218 1271 int argsCount = exec->argumentCount(); 1219 if (argsCount < 2) {1272 if (argsCount <= 1) { 1220 1273 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt); 1221 1274 return JSValue::encode(jsUndefined()); … … 1223 1276 1224 1277 int opt1 = exec->argument(1).toInt32(exec); 1278 if (exec->hadException()) 1279 return JSValue::encode(jsUndefined()); 1225 1280 int opt2 = exec->argument(2).toInt32(exec); 1281 if (exec->hadException()) 1282 return JSValue::encode(jsUndefined()); 1226 1283 1227 1284 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); … … 1238 1295 if (exec->argumentCount() <= 0 || !exec->argument(0).isObject()) { 1239 1296 setDOMException(exec, TYPE_MISMATCH_ERR); 1240 return jsUndefined();1297 return JSValue::encode(jsUndefined()); 1241 1298 } 1242 1299 RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject()); … … 1254 1311 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1255 1312 int nonCallback = exec->argument(0).toInt32(exec); 1313 if (exec->hadException()) 1314 return JSValue::encode(jsUndefined()); 1256 1315 if (exec->argumentCount() <= 1 || !exec->argument(1).isObject()) { 1257 1316 setDOMException(exec, TYPE_MISMATCH_ERR); 1258 return jsUndefined();1317 return JSValue::encode(jsUndefined()); 1259 1318 } 1260 1319 RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(1)), castedThis->globalObject()); … … 1271 1330 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1272 1331 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1332 RefPtr<TestCallback> callback; 1333 if (exec->argumentCount() > 0 && !exec->argument(0).isNull() && !exec->argument(0).isUndefined()) { 1334 if (!exec->argument(0).isObject()) { 1335 setDOMException(exec, TYPE_MISMATCH_ERR); 1336 return JSValue::encode(jsUndefined()); 1337 } 1338 callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject()); 1339 } 1340 1341 imp->methodWithCallbackAndOptionalArg(callback); 1342 return JSValue::encode(jsUndefined()); 1343 } 1344 1345 static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec) 1346 { 1347 JSValue thisValue = exec->hostThisValue(); 1348 if (!thisValue.inherits(&JSTestObj::s_info)) 1349 return throwVMTypeError(exec); 1350 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1351 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1352 TestObj* objArg = toTestObj(exec->argument(0)); 1353 if (exec->hadException()) 1354 return JSValue::encode(jsUndefined()); 1355 const String& strArg = ustringToString(exec->argument(1).toString(exec)); 1356 if (exec->hadException()) 1357 return JSValue::encode(jsUndefined()); 1358 1359 imp->overloadedMethod(objArg, strArg); 1360 return JSValue::encode(jsUndefined()); 1361 } 1362 1363 static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec) 1364 { 1365 JSValue thisValue = exec->hostThisValue(); 1366 if (!thisValue.inherits(&JSTestObj::s_info)) 1367 return throwVMTypeError(exec); 1368 JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue)); 1369 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1370 TestObj* objArg = toTestObj(exec->argument(0)); 1371 if (exec->hadException()) 1372 return JSValue::encode(jsUndefined()); 1273 1373 1274 1374 int argsCount = exec->argumentCount(); 1275 if (argsCount < 1) {1276 imp-> methodWithCallbackAndOptionalArg();1375 if (argsCount <= 1) { 1376 imp->overloadedMethod(objArg); 1277 1377 return JSValue::encode(jsUndefined()); 1278 1378 } 1279 1379 1280 if (exec->argumentCount() <= 0 || !exec->argument(0).isObject()) {1281 setDOMException(exec, TYPE_MISMATCH_ERR);1282 return jsUndefined();1283 }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));1312 1313 int argsCount = exec->argumentCount();1314 if (argsCount < 2) {1315 imp->overloadedMethod(objArg);1316 return JSValue::encode(jsUndefined());1317 }1318 1319 1380 int intArg = exec->argument(1).toInt32(exec); 1381 if (exec->hadException()) 1382 return JSValue::encode(jsUndefined()); 1320 1383 1321 1384 imp->overloadedMethod(objArg, intArg); … … 1331 1394 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1332 1395 const String& strArg = ustringToString(exec->argument(0).toString(exec)); 1396 if (exec->hadException()) 1397 return JSValue::encode(jsUndefined()); 1333 1398 1334 1399 imp->overloadedMethod(strArg); … … 1344 1409 TestObj* imp = static_cast<TestObj*>(castedThis->impl()); 1345 1410 int intArg = exec->argument(0).toInt32(exec); 1411 if (exec->hadException()) 1412 return JSValue::encode(jsUndefined()); 1346 1413 1347 1414 imp->overloadedMethod(intArg); -
trunk/WebCore/bindings/scripts/test/V8/V8TestObj.cpp
r64840 r65005 30 30 #include "SerializedScriptValue.h" 31 31 #include "V8Binding.h" 32 #include "V8BindingMacros.h" 32 33 #include "V8BindingState.h" 33 34 #include "V8DOMWrapper.h" … … 557 558 INC_STATS("DOM.TestObj.voidMethodWithArgs"); 558 559 TestObj* imp = V8TestObj::toNative(args.Holder()); 559 int intArg = toInt32(args[0]);560 V8Parameter<> strArg = args[1];561 TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0;560 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 561 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, args[1]); 562 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0); 562 563 imp->voidMethodWithArgs(intArg, strArg, objArg); 563 564 return v8::Handle<v8::Value>(); … … 575 576 INC_STATS("DOM.TestObj.intMethodWithArgs"); 576 577 TestObj* imp = V8TestObj::toNative(args.Holder()); 577 int intArg = toInt32(args[0]);578 V8Parameter<> strArg = args[1];579 TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0;578 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 579 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, args[1]); 580 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0); 580 581 return v8::Integer::New(imp->intMethodWithArgs(intArg, strArg, objArg)); 581 582 } … … 592 593 INC_STATS("DOM.TestObj.objMethodWithArgs"); 593 594 TestObj* imp = V8TestObj::toNative(args.Holder()); 594 int intArg = toInt32(args[0]);595 V8Parameter<> strArg = args[1];596 TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0;595 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 596 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, args[1]); 597 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0); 597 598 return toV8(imp->objMethodWithArgs(intArg, strArg, objArg)); 598 599 } … … 604 605 return v8::Handle<v8::Value>(); 605 606 TestObj* imp = V8TestObj::toNative(args.Holder()); 606 V8Parameter<> strArg = args[0];607 TestObj* objArg = V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;607 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, args[0]); 608 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0); 608 609 return toV8(imp->methodThatRequiresAllArgs(strArg, objArg)); 609 610 } … … 617 618 ExceptionCode ec = 0; 618 619 { 619 V8Parameter<> strArg = args[0];620 TestObj* objArg = V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;620 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, args[0]); 621 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0); 621 622 RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec); 622 623 if (UNLIKELY(ec)) … … 645 646 INC_STATS("DOM.TestObj.idbKey"); 646 647 TestObj* imp = V8TestObj::toNative(args.Holder()); 647 RefPtr<IDBKey> key = createIDBKeyFromValue(args[0]);648 EXCEPTION_BLOCK(RefPtr<IDBKey>, key, createIDBKeyFromValue(args[0])); 648 649 imp->idbKey(key); 649 650 return v8::Handle<v8::Value>(); … … 675 676 if (!callStack) 676 677 return v8::Undefined(); 677 log* intArg = V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;678 EXCEPTION_BLOCK(log*, intArg, V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 678 679 imp->customArgsAndException(intArg, callStack.get(), ec); 679 680 if (UNLIKELY(ec)) … … 723 724 INC_STATS("DOM.TestObj.withDynamicFrameAndArg"); 724 725 TestObj* imp = V8TestObj::toNative(args.Holder()); 725 int intArg = toInt32(args[0]);726 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 726 727 Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); 727 728 if (!enteredFrame) … … 735 736 INC_STATS("DOM.TestObj.withDynamicFrameAndOptionalArg"); 736 737 TestObj* imp = V8TestObj::toNative(args.Holder()); 737 int intArg = toInt32(args[0]);738 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 738 739 if (args.Length() <= 1) { 739 740 Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); … … 743 744 return v8::Handle<v8::Value>(); 744 745 } 745 int optionalArg = toInt32(args[1]);746 EXCEPTION_BLOCK(int, optionalArg, toInt32(args[1])); 746 747 Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); 747 748 if (!enteredFrame) … … 755 756 INC_STATS("DOM.TestObj.withDynamicFrameAndUserGesture"); 756 757 TestObj* imp = V8TestObj::toNative(args.Holder()); 757 int intArg = toInt32(args[0]);758 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 758 759 Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); 759 760 if (!enteredFrame) … … 767 768 INC_STATS("DOM.TestObj.withDynamicFrameAndUserGestureASAD"); 768 769 TestObj* imp = V8TestObj::toNative(args.Holder()); 769 int intArg = toInt32(args[0]);770 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 770 771 if (args.Length() <= 1) { 771 772 Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); … … 775 776 return v8::Handle<v8::Value>(); 776 777 } 777 int optionalArg = toInt32(args[1]);778 EXCEPTION_BLOCK(int, optionalArg, toInt32(args[1])); 778 779 Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext(); 779 780 if (!enteredFrame) … … 862 863 return v8::Handle<v8::Value>(); 863 864 } 864 int opt = toInt32(args[0]);865 EXCEPTION_BLOCK(int, opt, toInt32(args[0])); 865 866 imp->methodWithOptionalArg(opt); 866 867 return v8::Handle<v8::Value>(); … … 871 872 INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndOptionalArg"); 872 873 TestObj* imp = V8TestObj::toNative(args.Holder()); 873 int nonOpt = toInt32(args[0]);874 EXCEPTION_BLOCK(int, nonOpt, toInt32(args[0])); 874 875 if (args.Length() <= 1) { 875 876 imp->methodWithNonOptionalArgAndOptionalArg(nonOpt); 876 877 return v8::Handle<v8::Value>(); 877 878 } 878 int opt = toInt32(args[1]);879 EXCEPTION_BLOCK(int, opt, toInt32(args[1])); 879 880 imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt); 880 881 return v8::Handle<v8::Value>(); … … 885 886 INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndTwoOptionalArgs"); 886 887 TestObj* imp = V8TestObj::toNative(args.Holder()); 887 int nonOpt = toInt32(args[0]);888 EXCEPTION_BLOCK(int, nonOpt, toInt32(args[0])); 888 889 if (args.Length() <= 1) { 889 890 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt); 890 891 return v8::Handle<v8::Value>(); 891 892 } 892 int opt1 = toInt32(args[1]);893 int opt2 = toInt32(args[2]);893 EXCEPTION_BLOCK(int, opt1, toInt32(args[1])); 894 EXCEPTION_BLOCK(int, opt2, toInt32(args[2])); 894 895 imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2); 895 896 return v8::Handle<v8::Value>(); … … 911 912 INC_STATS("DOM.TestObj.methodWithNonCallbackArgAndCallbackArg"); 912 913 TestObj* imp = V8TestObj::toNative(args.Holder()); 913 int nonCallback = toInt32(args[0]);914 EXCEPTION_BLOCK(int, nonCallback, toInt32(args[0])); 914 915 if (args.Length() <= 1 || !args[1]->IsObject()) 915 916 return throwError(TYPE_MISMATCH_ERR); … … 923 924 INC_STATS("DOM.TestObj.methodWithCallbackAndOptionalArg"); 924 925 TestObj* imp = V8TestObj::toNative(args.Holder()); 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()); 926 RefPtr<TestCallback> callback; 927 if (args.Length() > 0 && !args[0]->IsNull() && !args[0]->IsUndefined()) { 928 if (!args[0]->IsObject()) 929 return throwError(TYPE_MISMATCH_ERR); 930 callback = V8TestCallback::create(args[0], getScriptExecutionContext()); 931 } 932 932 imp->methodWithCallbackAndOptionalArg(callback); 933 933 return v8::Handle<v8::Value>(); … … 938 938 INC_STATS("DOM.TestObj.overloadedMethod1"); 939 939 TestObj* imp = V8TestObj::toNative(args.Holder()); 940 TestObj* objArg = V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;941 V8Parameter<> strArg = args[1];940 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 941 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, args[1]); 942 942 imp->overloadedMethod(objArg, strArg); 943 943 return v8::Handle<v8::Value>(); … … 948 948 INC_STATS("DOM.TestObj.overloadedMethod2"); 949 949 TestObj* imp = V8TestObj::toNative(args.Holder()); 950 TestObj* objArg = V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;950 EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0); 951 951 if (args.Length() <= 1) { 952 952 imp->overloadedMethod(objArg); 953 953 return v8::Handle<v8::Value>(); 954 954 } 955 int intArg = toInt32(args[1]);955 EXCEPTION_BLOCK(int, intArg, toInt32(args[1])); 956 956 imp->overloadedMethod(objArg, intArg); 957 957 return v8::Handle<v8::Value>(); … … 962 962 INC_STATS("DOM.TestObj.overloadedMethod3"); 963 963 TestObj* imp = V8TestObj::toNative(args.Holder()); 964 V8Parameter<> strArg = args[0];964 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, args[0]); 965 965 imp->overloadedMethod(strArg); 966 966 return v8::Handle<v8::Value>(); … … 971 971 INC_STATS("DOM.TestObj.overloadedMethod4"); 972 972 TestObj* imp = V8TestObj::toNative(args.Holder()); 973 int intArg = toInt32(args[0]);973 EXCEPTION_BLOCK(int, intArg, toInt32(args[0])); 974 974 imp->overloadedMethod(intArg); 975 975 return v8::Handle<v8::Value>(); … … 1089 1089 {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback}, 1090 1090 {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback}, 1091 {"methodWithCallbackArg", TestObjInternal::methodWithCallbackArgCallback}, 1092 {"methodWithNonCallbackArgAndCallbackArg", TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback}, 1091 1093 {"methodWithCallbackAndOptionalArg", TestObjInternal::methodWithCallbackAndOptionalArgCallback}, 1092 1094 {"overloadedMethod", TestObjInternal::overloadedMethodCallback}, … … 1162 1164 v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv); 1163 1165 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));1176 1166 batchConfigureConstants(desc, proto, TestObjConsts, sizeof(TestObjConsts) / sizeof(*TestObjConsts)); 1177 1167 -
trunk/WebCore/bindings/v8/V8Binding.h
r64991 r65005 221 221 class V8Parameter { 222 222 public: 223 V8Parameter (v8::Local<v8::Value> object) :m_v8Object(object) { }223 V8Parameter(v8::Local<v8::Value> object = v8::Local<v8::Value>()) : m_v8Object(object) { } 224 224 operator String(); 225 225 operator AtomicString(); -
trunk/WebCore/bindings/v8/custom/V8BindingMacros.h
r62094 r65005 38 38 } 39 39 40 #define TO_WEBCORE_STRING_EXCEPTION_BLOCK(var, value) \ 41 String var; \ 42 { \ 43 v8::TryCatch block; \ 44 v8::Handle<v8::String> v8String = (value)->ToString(); \ 45 if (block.HasCaught()) \ 46 return block.ReThrow(); \ 47 var = v8StringToWebCoreString<String>(v8String, DoNotExternalize); \ 40 #define STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(type, var, value) \ 41 type var; \ 42 { \ 43 v8::Local<v8::Value> v8Value = (value); \ 44 v8::TryCatch block; \ 45 (value)->ToString(); \ 46 if (block.HasCaught()) \ 47 return block.ReThrow(); \ 48 var = v8Value; \ 48 49 } -
trunk/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp
r64991 r65005 33 33 34 34 #include "Chrome.h" 35 #include "Database.h"36 35 #include "DOMTimer.h" 37 36 #include "DOMWindow.h" … … 56 55 #include "V8BindingState.h" 57 56 #include "V8CustomEventListener.h" 58 #include "V8Database.h"59 #include "V8DatabaseCallback.h"60 57 #include "V8GCForContextDispose.h" 61 58 #include "V8HiddenPropertyName.h" … … 658 655 } 659 656 660 #if ENABLE(DATABASE)661 v8::Handle<v8::Value> V8DOMWindow::openDatabaseCallback(const v8::Arguments& args)662 {663 INC_STATS("DOM.DOMWindow.openDatabase");664 if (args.Length() < 4)665 return throwError(SYNTAX_ERR);666 667 TO_WEBCORE_STRING_EXCEPTION_BLOCK(name, args[0]);668 TO_WEBCORE_STRING_EXCEPTION_BLOCK(version, args[1]);669 TO_WEBCORE_STRING_EXCEPTION_BLOCK(displayName, args[2]);670 EXCEPTION_BLOCK(unsigned long, estimatedSize, args[3]->Uint32Value());671 672 DOMWindow* imp = V8DOMWindow::toNative(args.Holder());673 if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))674 return v8::Undefined();675 676 ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();677 RefPtr<DatabaseCallback> creationCallback;678 if (args.Length() >= 5) {679 if (!args[4]->IsObject())680 return throwError(TYPE_MISMATCH_ERR);681 682 creationCallback = V8DatabaseCallback::create(args[4], scriptExecutionContext);683 }684 685 ExceptionCode ec = 0;686 v8::Handle<v8::Value> result = toV8(imp->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec));687 688 V8Proxy::setDOMException(ec);689 return result;690 }691 #endif // ENABLE(DATABASE)692 693 657 bool V8DOMWindow::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>) 694 658 { -
trunk/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp
r64537 r65005 56 56 return throwError(SYNTAX_ERR); 57 57 58 TO_WEBCORE_STRING_EXCEPTION_BLOCK(statement, args[0]);58 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, statement, args[0]); 59 59 60 60 Vector<SQLValue> sqlValues; … … 83 83 sqlValues.append(SQLValue(sqlValue)); 84 84 } else { 85 TO_WEBCORE_STRING_EXCEPTION_BLOCK(sqlValue, value);85 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, sqlValue, value); 86 86 sqlValues.append(SQLValue(sqlValue)); 87 87 } -
trunk/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp
r63479 r65005 56 56 return throwError(SYNTAX_ERR); 57 57 58 TO_WEBCORE_STRING_EXCEPTION_BLOCK(statement, args[0]);58 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, statement, args[0]); 59 59 60 60 Vector<SQLValue> sqlValues; … … 83 83 sqlValues.append(SQLValue(sqlValue)); 84 84 } else { 85 TO_WEBCORE_STRING_EXCEPTION_BLOCK(sqlValue, value);85 STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, sqlValue, value); 86 86 sqlValues.append(SQLValue(sqlValue)); 87 87 } -
trunk/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp
r64840 r65005 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 #endif42 36 #include "DOMTimer.h" 43 37 #include "ExceptionCode.h" … … 144 138 } 145 139 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 #endif205 206 140 } // namespace WebCore 207 141 -
trunk/WebCore/page/DOMWindow.idl
r64845 r65005 161 161 #endif 162 162 #if defined(ENABLE_DATABASE) && ENABLE_DATABASE 163 [EnabledAtRuntime, Custom] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, inDatabaseCallback creationCallback)163 [EnabledAtRuntime, RequiresAllArguments=Raise] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback) 164 164 raises(DOMException); 165 165 #endif -
trunk/WebCore/storage/Database.cpp
r64840 r65005 271 271 } 272 272 273 void Database::transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, 274 PassRefPtr<VoidCallback> successCallback, bool readOnly) 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) 275 285 { 276 286 m_transactionQueue.append(SQLTransaction::create(this, callback, errorCallback, successCallback, 0, readOnly)); -
trunk/WebCore/storage/Database.h
r64840 r65005 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>, 63 PassRefPtr<VoidCallback> successCallback, bool readOnly);62 void transaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback); 63 void readTransaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback); 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); 93 95 94 96 bool openAndVerifyVersion(bool setVersionInNewDatabase, ExceptionCode&); -
trunk/WebCore/storage/Database.idl
r64840 r65005 35 35 ] Database { 36 36 readonly attribute DOMString version; 37 [ Custom] void changeVersion(in DOMString oldVersion, in DOMString newVersion, in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, inVoidCallback successCallback);38 [ Custom] void transaction(in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, inVoidCallback successCallback);39 [ Custom] void readTransaction(in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, inVoidCallback successCallback);37 [RequiresAllArguments=Raise] void changeVersion(in DOMString oldVersion, in DOMString newVersion, in [Callback, Optional] SQLTransactionCallback callback, in [Callback, Optional] SQLTransactionErrorCallback errorCallback, in [Callback, Optional] VoidCallback successCallback); 38 [RequiresAllArguments=Raise] void transaction(in [Callback] SQLTransactionCallback callback, in [Callback, Optional] SQLTransactionErrorCallback errorCallback, in [Callback, Optional] VoidCallback successCallback); 39 [RequiresAllArguments=Raise] void readTransaction(in [Callback] SQLTransactionCallback callback, in [Callback, Optional] SQLTransactionErrorCallback errorCallback, in [Callback, Optional] VoidCallback successCallback); 40 40 }; 41 41 -
trunk/WebCore/storage/DatabaseSync.cpp
r64840 r65005 129 129 } 130 130 131 void DatabaseSync::transaction(PassRefPtr<SQLTransactionSyncCallback> callback, bool readOnly, ExceptionCode& ec) 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) 132 142 { 133 143 ASSERT(m_scriptExecutionContext->isContextThread()); -
trunk/WebCore/storage/DatabaseSync.h
r64840 r65005 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>, bool readOnly, ExceptionCode&); 59 void transaction(PassRefPtr<SQLTransactionSyncCallback>, ExceptionCode&); 60 void readTransaction(PassRefPtr<SQLTransactionSyncCallback>, ExceptionCode&); 60 61 61 62 virtual void markAsDeletedAndClose(); … … 65 66 DatabaseSync(ScriptExecutionContext*, const String& name, const String& expectedVersion, 66 67 const String& displayName, unsigned long estimatedSize); 68 void runTransaction(PassRefPtr<SQLTransactionSyncCallback>, bool readOnly, ExceptionCode&); 67 69 }; 68 70 -
trunk/WebCore/storage/DatabaseSync.idl
r64840 r65005 37 37 ] DatabaseSync { 38 38 readonly attribute DOMString version; 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);39 [RequiresAllArguments=Raise] void changeVersion(in DOMString oldVersion, in DOMString newVersion, in [Callback, Optional] SQLTransactionSyncCallback callback) raises(DOMException); 40 [RequiresAllArguments=Raise] void transaction(in [Callback] SQLTransactionSyncCallback callback) raises(DOMException); 41 [RequiresAllArguments=Raise] void readTransaction(in [Callback] SQLTransactionSyncCallback callback) raises(DOMException); 42 42 }; 43 43 -
trunk/WebCore/workers/WorkerContext.idl
r64840 r65005 51 51 attribute [Replaceable] WorkerNavigator navigator; 52 52 #if defined(ENABLE_DATABASE) && ENABLE_DATABASE 53 [EnabledAtRuntime, Custom] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, inDatabaseCallback creationCallback)53 [EnabledAtRuntime, RequiresAllArguments=Raise] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback) 54 54 raises(DOMException); 55 [EnabledAtRuntime, Custom] DatabaseSync openDatabaseSync(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback creationCallback); 55 [EnabledAtRuntime, RequiresAllArguments=Raise] DatabaseSync openDatabaseSync(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Callback, Optional] DatabaseCallback creationCallback) 56 raises(DOMException); 56 57 #endif 57 58
Note: See TracChangeset
for help on using the changeset viewer.