Changeset 65005 in webkit


Ignore:
Timestamp:
Aug 9, 2010 2:36:24 PM (14 years ago)
Author:
dumi@chromium.org
Message:

WebCore: Auto-generate most HTML5 DB bindings.
https://bugs.webkit.org/show_bug.cgi?id=43382

Reviewed by Adam Barth.

  • Android.jscbindings.mk: Remove {JS|V8}Database{Sync}Custom.cpp

and the custom implementations of openDatabase{Sync}().

  • Android.v8bindings.mk:
  • CMakeLists.txt:
  • GNUmakefile.am:
  • WebCore.gypi:
  • WebCore.pro:
  • WebCore.vcproj/WebCore.vcproj:
  • WebCore.xcodeproj/project.pbxproj:
  • bindings/js/JSBindingsAllInOne.cpp:
  • bindings/js/JSDOMWindowCustom.cpp:
  • bindings/js/JSDatabaseCustom.cpp: Removed.
  • bindings/js/JSDatabaseSyncCustom.cpp: Removed.
  • bindings/js/JSWorkerContextCustom.cpp:
  • bindings/v8/custom/V8DOMWindowCustom.cpp:
  • bindings/v8/custom/V8DatabaseCustom.cpp: Removed.
  • bindings/v8/custom/V8DatabaseSyncCustom.cpp: Removed.
  • bindings/v8/custom/V8WorkerContextCustom.cpp:
  • bindings/scripts/CodeGeneratorGObject.pm: Change the code generators

to check that each value can be converted to the respective
argument type.

  • bindings/scripts/CodeGeneratorJS.pm:
  • bindings/scripts/CodeGeneratorV8.pm:
  • bindings/scripts/test/JS/JSTestCallback.cpp:

(WebCore::JSTestCallback::~JSTestCallback):

  • bindings/scripts/test/JS/JSTestObj.cpp:

(WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
(WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgs):
(WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
(WebCore::jsTestObjPrototypeFunctionSerializedValue):
(WebCore::jsTestObjPrototypeFunctionIdbKey):
(WebCore::jsTestObjPrototypeFunctionCustomArgsAndException):
(WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndArg):
(WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg):
(WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture):
(WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD):
(WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
(WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
(WebCore::jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod3):
(WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):

  • bindings/scripts/test/V8/V8TestObj.cpp:

(WebCore::TestObjInternal::voidMethodWithArgsCallback):
(WebCore::TestObjInternal::intMethodWithArgsCallback):
(WebCore::TestObjInternal::objMethodWithArgsCallback):
(WebCore::TestObjInternal::methodThatRequiresAllArgsCallback):
(WebCore::TestObjInternal::methodThatRequiresAllArgsAndThrowsCallback):
(WebCore::TestObjInternal::idbKeyCallback):
(WebCore::TestObjInternal::customArgsAndExceptionCallback):
(WebCore::TestObjInternal::withDynamicFrameAndArgCallback):
(WebCore::TestObjInternal::withDynamicFrameAndOptionalArgCallback):
(WebCore::TestObjInternal::withDynamicFrameAndUserGestureCallback):
(WebCore::TestObjInternal::withDynamicFrameAndUserGestureASADCallback):
(WebCore::TestObjInternal::methodWithOptionalArgCallback):
(WebCore::TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback):
(WebCore::TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback):
(WebCore::TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback):
(WebCore::TestObjInternal::methodWithCallbackAndOptionalArgCallback):
(WebCore::TestObjInternal::overloadedMethod1Callback):
(WebCore::TestObjInternal::overloadedMethod2Callback):
(WebCore::TestObjInternal::overloadedMethod3Callback):
(WebCore::TestObjInternal::overloadedMethod4Callback):
(WebCore::):
(WebCore::ConfigureV8TestObjTemplate):

  • bindings/v8/custom/V8BindingMacros.h:
  • bindings/v8/V8Binding.h: Minor changes required to support the

auto-generated bindings.
(WebCore::V8Parameter::V8Parameter):

  • bindings/v8/custom/V8SQLTransactionCustom.cpp:

(WebCore::V8SQLTransaction::executeSqlCallback):

  • bindings/v8/custom/V8SQLTransactionSyncCustom.cpp:

(WebCore::V8SQLTransactionSync::executeSqlCallback):

  • page/DOMWindow.idl:
  • storage/Database.cpp:

(WebCore::Database::transaction):
(WebCore::Database::readTransaction):
(WebCore::Database::runTransaction):

  • storage/Database.h:
  • storage/Database.idl:
  • storage/DatabaseSync.cpp:

(WebCore::DatabaseSync::transaction):
(WebCore::DatabaseSync::readTransaction):
(WebCore::DatabaseSync::runTransaction):

  • storage/DatabaseSync.h:
  • storage/DatabaseSync.idl:
  • workers/WorkerContext.idl:

LayoutTests: Changing the expected error message for a test.
https://bugs.webkit.org/show_bug.cgi?id=43382

Reviewed by Adam Barth.

  • fast/workers/storage/open-database-inputs-sync-expected.txt:
Location:
trunk
Files:
4 deleted
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r64998 r65005  
     12010-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
    1102010-08-09  Zhenyao Mo  <zmo@google.com>
    211
  • trunk/LayoutTests/fast/workers/storage/open-database-inputs-sync-expected.txt

    r64840 r65005  
    11This test makes sure that openDatabaseSync() accepts only valid parameters.
    2 PASS: SYNTAX_ERR: DOM Exception 12
    3 PASS: SYNTAX_ERR: DOM Exception 12
     2PASS: Not enough arguments
     3PASS: Not enough arguments
    44PASS: undefined
    55PASS: undefined
  • trunk/WebCore/Android.jscbindings.mk

    r64845 r65005  
    9191        bindings/js/JSDataGridColumnListCustom.cpp \
    9292        bindings/js/JSDataGridDataSource.cpp \
    93         bindings/js/JSDatabaseCustom.cpp \
    9493        bindings/js/JSDedicatedWorkerContextCustom.cpp \
    9594        bindings/js/JSDesktopNotificationsCustom.cpp \
  • trunk/WebCore/Android.v8bindings.mk

    r64845 r65005  
    107107        bindings/v8/custom/V8DataGridColumnListCustom.cpp \
    108108        bindings/v8/custom/V8DatabaseCallback.cpp \
    109         bindings/v8/custom/V8DatabaseCustom.cpp \
    110109        bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp \
    111110        bindings/v8/custom/V8DeviceMotionEventCustom.cpp \
  • trunk/WebCore/CMakeLists.txt

    r64976 r65005  
    591591    bindings/js/JSCustomVoidCallback.cpp
    592592    bindings/js/JSCustomXPathNSResolver.cpp
    593     bindings/js/JSDatabaseCustom.cpp
    594     bindings/js/JSDatabaseCustom.cpp
    595     bindings/js/JSDatabaseSyncCustom.cpp
    596593    bindings/js/JSDataGridColumnListCustom.cpp
    597594    bindings/js/JSDataGridDataSource.cpp
  • trunk/WebCore/ChangeLog

    r65004 r65005  
     12010-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
    11042010-08-09  Adam Barth  <abarth@webkit.org>
    2105
  • trunk/WebCore/GNUmakefile.am

    r64976 r65005  
    27442744webcore_sources += \
    27452745        WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp \
    2746         WebCore/bindings/js/JSDatabaseCustom.cpp \
    2747         WebCore/bindings/js/JSDatabaseSyncCustom.cpp \
    27482746        WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp \
    27492747        WebCore/bindings/js/JSSQLTransactionCustom.cpp \
  • trunk/WebCore/WebCore.gypi

    r64949 r65005  
    544544            'bindings/js/JSCustomXPathNSResolver.cpp',
    545545            'bindings/js/JSCustomXPathNSResolver.h',
    546             'bindings/js/JSDatabaseCustom.cpp',
    547             'bindings/js/JSDatabaseSyncCustom.cpp',
    548546            'bindings/js/JSDataGridColumnListCustom.cpp',
    549547            'bindings/js/JSDataGridDataSource.cpp',
     
    743741            'bindings/v8/custom/V8CustomXPathNSResolver.cpp',
    744742            'bindings/v8/custom/V8CustomXPathNSResolver.h',
    745             'bindings/v8/custom/V8DatabaseCustom.cpp',
    746             'bindings/v8/custom/V8DatabaseSyncCustom.cpp',
    747743            'bindings/v8/custom/V8DataGridColumnListCustom.cpp',
    748744            'bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp',
  • trunk/WebCore/WebCore.pro

    r64976 r65005  
    24262426        storage/SQLTransactionSync.cpp \
    24272427        bindings/js/JSCustomSQLStatementErrorCallback.cpp \
    2428         bindings/js/JSDatabaseCustom.cpp \
    2429         bindings/js/JSDatabaseSyncCustom.cpp \
    24302428        bindings/js/JSSQLResultSetRowListCustom.cpp \
    24312429        bindings/js/JSSQLTransactionCustom.cpp \
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r64976 r65005  
    4218142181                                </File>
    4218242182                                <File
    42183                                         RelativePath="..\bindings\js\JSDatabaseCustom.cpp"
    42184                                         >
    42185                                         <FileConfiguration
    42186                                                 Name="Debug|Win32"
    42187                                                 ExcludedFromBuild="true"
    42188                                                 >
    42189                                                 <Tool
    42190                                                         Name="VCCLCompilerTool"
    42191                                                 />
    42192                                         </FileConfiguration>
    42193                                         <FileConfiguration
    42194                                                 Name="Release|Win32"
    42195                                                 ExcludedFromBuild="true"
    42196                                                 >
    42197                                                 <Tool
    42198                                                         Name="VCCLCompilerTool"
    42199                                                 />
    42200                                         </FileConfiguration>
    42201                                         <FileConfiguration
    42202                                                 Name="Debug_Internal|Win32"
    42203                                                 ExcludedFromBuild="true"
    42204                                                 >
    42205                                                 <Tool
    42206                                                         Name="VCCLCompilerTool"
    42207                                                 />
    42208                                         </FileConfiguration>
    42209                                         <FileConfiguration
    42210                                                 Name="Debug_Cairo|Win32"
    42211                                                 ExcludedFromBuild="true"
    42212                                                 >
    42213                                                 <Tool
    42214                                                         Name="VCCLCompilerTool"
    42215                                                 />
    42216                                         </FileConfiguration>
    42217                                         <FileConfiguration
    42218                                                 Name="Release_Cairo|Win32"
    42219                                                 ExcludedFromBuild="true"
    42220                                                 >
    42221                                                 <Tool
    42222                                                         Name="VCCLCompilerTool"
    42223                                                 />
    42224                                         </FileConfiguration>
    42225                                         <FileConfiguration
    42226                                                 Name="Debug_All|Win32"
    42227                                                 ExcludedFromBuild="true"
    42228                                                 >
    42229                                                 <Tool
    42230                                                         Name="VCCLCompilerTool"
    42231                                                 />
    42232                                         </FileConfiguration>
    42233                                 </File>
    42234                                 <File
    42235                                         RelativePath="..\bindings\js\JSDatabaseSyncCustom.cpp"
    42236                                         >
    42237                                         <FileConfiguration
    42238                                                 Name="Debug|Win32"
    42239                                                 ExcludedFromBuild="true"
    42240                                                 >
    42241                                                 <Tool
    42242                                                         Name="VCCLCompilerTool"
    42243                                                 />
    42244                                         </FileConfiguration>
    42245                                         <FileConfiguration
    42246                                                 Name="Release|Win32"
    42247                                                 ExcludedFromBuild="true"
    42248                                                 >
    42249                                                 <Tool
    42250                                                         Name="VCCLCompilerTool"
    42251                                                 />
    42252                                         </FileConfiguration>
    42253                                         <FileConfiguration
    42254                                                 Name="Debug_Internal|Win32"
    42255                                                 ExcludedFromBuild="true"
    42256                                                 >
    42257                                                 <Tool
    42258                                                         Name="VCCLCompilerTool"
    42259                                                 />
    42260                                         </FileConfiguration>
    42261                                         <FileConfiguration
    42262                                                 Name="Debug_Cairo|Win32"
    42263                                                 ExcludedFromBuild="true"
    42264                                                 >
    42265                                                 <Tool
    42266                                                         Name="VCCLCompilerTool"
    42267                                                 />
    42268                                         </FileConfiguration>
    42269                                         <FileConfiguration
    42270                                                 Name="Release_Cairo|Win32"
    42271                                                 ExcludedFromBuild="true"
    42272                                                 >
    42273                                                 <Tool
    42274                                                         Name="VCCLCompilerTool"
    42275                                                 />
    42276                                         </FileConfiguration>
    42277                                         <FileConfiguration
    42278                                                 Name="Debug_All|Win32"
    42279                                                 ExcludedFromBuild="true"
    42280                                                 >
    42281                                                 <Tool
    42282                                                         Name="VCCLCompilerTool"
    42283                                                 />
    42284                                         </FileConfiguration>
    42285                                 </File>
    42286                                 <File
    4228742183                                        RelativePath="..\bindings\js\JSDataGridColumnListCustom.cpp"
    4228842184                                        >
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r64996 r65005  
    43654365                B55D5AA4119131FC00BCC315 /* JSSQLTransactionSyncCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */; };
    43664366                B55D5AA5119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA3119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp */; };
    4367                 B55D5AA81191325000BCC315 /* JSDatabaseSyncCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */; };
    43684367                B55D5AA91191325000BCC315 /* JSSQLTransactionSyncCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA71191325000BCC315 /* JSSQLTransactionSyncCustom.cpp */; };
    43694368                B56EBA8511C9FF8100B04477 /* SQLException.h in Headers */ = {isa = PBXBuildFile; fileRef = B56EBA8311C9FF8100B04477 /* SQLException.h */; };
     
    48234822                BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */; };
    48244823                BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */; };
    4825                 BCCE58AC1061E8CF008FB35A /* JSDatabaseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */; };
    48264824                BCCFBAE80B5152ED0001F1D7 /* DocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */; settings = {ATTRIBUTES = (Private, ); }; };
    48274825                BCD0E0FA0E972C3500265DEA /* SecurityOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */; };
     
    1006610064                B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransactionSyncCallback.h; sourceTree = "<group>"; };
    1006710065                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>"; };
    1006910066                B55D5AA71191325000BCC315 /* JSSQLTransactionSyncCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionSyncCustom.cpp; sourceTree = "<group>"; };
    1007010067                B55D5ABB1191327200BCC315 /* DatabaseSync.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DatabaseSync.idl; sourceTree = "<group>"; };
     
    1056110558                BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLViewSourceDocument.h; sourceTree = "<group>"; };
    1056210559                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>"; };
    1056410560                BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DocumentParser.h; sourceTree = "<group>"; };
    1056510561                BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityOrigin.cpp; sourceTree = "<group>"; };
     
    1602716023                                BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */,
    1602816024                                BC20FB7E0C0E8E6C00D1447F /* JSCSSValueCustom.cpp */,
    16029                                 BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */,
    16030                                 B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */,
    1603116025                                BC77D1510FF19C730070887B /* JSDataGridColumnListCustom.cpp */,
    1603216026                                4162A453101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp */,
     
    2132121315                                1AE82F8F0CAAFA9D002237AE /* JSDatabase.cpp in Sources */,
    2132221316                                B59DD69A119029E5007E9684 /* JSDatabaseCallback.cpp in Sources */,
    21323                                 BCCE58AC1061E8CF008FB35A /* JSDatabaseCustom.cpp in Sources */,
    2132421317                                B58CEB6A11913607002A6790 /* JSDatabaseSync.cpp in Sources */,
    21325                                 B55D5AA81191325000BCC315 /* JSDatabaseSyncCustom.cpp in Sources */,
    2132621318                                BC77D1690FF19F560070887B /* JSDataGridColumn.cpp in Sources */,
    2132721319                                BC77D16B0FF19F560070887B /* JSDataGridColumnList.cpp in Sources */,
  • trunk/WebCore/bindings/js/JSBindingsAllInOne.cpp

    r64840 r65005  
    5858#include "JSDataGridColumnListCustom.cpp"
    5959#include "JSDataGridDataSource.cpp"
    60 #include "JSDatabaseCustom.cpp"
    61 #include "JSDatabaseSyncCustom.cpp"
    6260#include "JSDebugWrapperSet.cpp"
    6361#include "JSDedicatedWorkerContextCustom.cpp"
  • trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r64840 r65005  
    2323#include "AtomicString.h"
    2424#include "Chrome.h"
    25 #include "Database.h"
    2625#include "DOMWindow.h"
    2726#include "Document.h"
     
    3736#include "History.h"
    3837#include "JSAudioConstructor.h"
    39 #if ENABLE(DATABASE)
    40 #include "JSDatabase.h"
    41 #include "JSDatabaseCallback.h"
    42 #endif
    4338#include "JSDOMWindowShell.h"
    4439#include "JSEvent.h"
     
    10071002}
    10081003
    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 
    10521004DOMWindow* toDOMWindow(JSValue value)
    10531005{
  • trunk/WebCore/bindings/js/JSWorkerContextCustom.cpp

    r64840 r65005  
    3030#include "JSWorkerContext.h"
    3131
    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
    3932#include "ExceptionCode.h"
    4033#include "JSDOMBinding.h"
     
    154147#endif
    155148
    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 
    239149} // namespace WebCore
    240150
  • trunk/WebCore/bindings/scripts/CodeGeneratorGObject.pm

    r64840 r65005  
    209209    }
    210210
     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
    211219    return 0;
    212220}
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r64840 r65005  
    18541854                my $requiresAllArguments = $function->signature->extendedAttributes->{"RequiresAllArguments"};
    18551855                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--;
    18591860                        } else {
    1860                             push(@implContent, "        return JSValue::encode(jsUndefined());\n");
     1861                            last;
    18611862                        }
     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                    }
    18621870                }
    18631871
     
    19091917                    }
    19101918
     1919                    $implIncludes{"ExceptionCode.h"} = 1;
     1920                    $implIncludes{"JSDOMBinding.h"} = 1;
    19111921                    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"}) {
    19131925                            # Generate early call if there are enough parameters.
    19141926                            if (!$hasOptionalArguments) {
     
    19161928                                $hasOptionalArguments = 1;
    19171929                            }
    1918                             push(@implContent, "    if (argsCount < " . ($argsIndex + 1) . ") {\n");
     1930                            push(@implContent, "    if (argsCount <= $argsIndex) {\n");
    19191931                            GenerateImplementationFunctionCall($function, $functionString, $paramIndex, "    " x 2, $podType, $implClassName);
    19201932                            push(@implContent, "    }\n\n");
     
    19351947                            my $callbackClassName = GetCallbackClassName($parameter->type);
    19361948                            $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                            }
    19431965                        } else {
    19441966                            push(@implContent, "    " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($argsIndex)") . ";\n");
     
    19481970                            # was negative will be lost by the time we're inside the DOM.
    19491971                            if ($parameter->extendedAttributes->{"IsIndex"}) {
    1950                                 $implIncludes{"ExceptionCode.h"} = 1;
    19511972                                push(@implContent, "    if ($name < 0) {\n");
    19521973                                push(@implContent, "        setDOMException(exec, INDEX_SIZE_ERR);\n");
     
    19541975                                push(@implContent, "    }\n");
    19551976                            }
     1977
     1978                            # Check if the type conversion succeeded.
     1979                            push(@implContent, "    if (exec->hadException())\n");
     1980                            push(@implContent, "        return JSValue::encode(jsUndefined());\n");
    19561981                        }
    19571982
     
    21722197    push(@implContent, "    ScriptExecutionContext* context = scriptExecutionContext();\n");
    21732198    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");
    21752200    push(@implContent, "    if (!context || context->isContextThread())\n");
    21762201    push(@implContent, "        delete m_data;\n");
     
    23442369    return "$value.toNumber(exec)" if $type eq "double";
    23452370    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";
    23472373    return "static_cast<$type>($value.toInteger(exec))" if $type eq "long long" or $type eq "unsigned long long";
    23482374
  • trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r64840 r65005  
    11071107    my $requiresAllArguments = $function->signature->extendedAttributes->{"RequiresAllArguments"};
    11081108    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");
    11101118        if ($requiresAllArguments eq "Raise") {
    11111119            push(@implContentDecls, "        return throwError(\"Not enough arguments\", V8Proxy::SyntaxError);\n");
     
    11761184        my $parameterName = $parameter->name;
    11771185
    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"}) {
    11791189            # Generate early call if there are not enough parameters.
    11801190            push(@implContentDecls, "    if (args.Length() <= $paramIndex) {\n");
     
    11841194        }
    11851195
     1196        if (BasicTypeCanFailConversion($parameter)) {
     1197            push(@implContentDecls, "    bool ${parameterName}Ok;\n");
     1198        }
     1199
     1200        $implIncludes{"ExceptionCode.h"} = 1;
     1201        my $nativeType = GetNativeTypeFromSignature($parameter, $paramIndex);
    11861202        if ($parameter->extendedAttributes->{"Callback"}) {
    11871203            my $className = GetCallbackClassName($parameter->type);
    11881204            $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") {
    11981218            $implIncludes{"SerializedScriptValue.h"} = 1;
    11991219            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");
    12081221            push(@implContentDecls, "    if (${parameterName}DidThrow)\n");
    12091222            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            }
    12101238        } 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");
    12221242        }
    12231243
    12241244        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");
    12311249        }
    12321250
     
    28262844    return "$value->NumberValue()" if $type eq "SVGNumber";
    28272845
    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";
    28292848    return "toInt64($value)" if $type eq "unsigned long long" or $type eq "long long";
    28302849    return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "CompareHow";
     
    29562975
    29572976    foreach my $parameter (@{$function->parameters}) {
    2958         if ($parameter->extendedAttributes->{"Optional"}) {
     2977        if ($parameter->extendedAttributes->{"Optional"} || $parameter->extendedAttributes->{"Callback"}) {
    29592978            return 0;
    29602979        }
  • trunk/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp

    r64840 r65005  
    4343JSTestCallback::~JSTestCallback()
    4444{
    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())
    4649        delete m_data;
    4750    else
    48         m_data->globalObject()->scriptExecutionContext()->postTask(DeleteCallbackDataTask::create(m_data));
     51        context->postTask(DeleteCallbackDataTask::create(m_data));
    4952#ifndef NDEBUG
    5053    m_data = 0;
  • trunk/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r64840 r65005  
    2626#include "IDBBindingUtilities.h"
    2727#include "IDBKey.h"
     28#include "JSDOMBinding.h"
    2829#include "JSEventListener.h"
    2930#include "JSTestCallback.h"
     
    795796    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    796797    int intArg = exec->argument(0).toInt32(exec);
     798    if (exec->hadException())
     799        return JSValue::encode(jsUndefined());
    797800    const String& strArg = ustringToString(exec->argument(1).toString(exec));
     801    if (exec->hadException())
     802        return JSValue::encode(jsUndefined());
    798803    TestObj* objArg = toTestObj(exec->argument(2));
     804    if (exec->hadException())
     805        return JSValue::encode(jsUndefined());
    799806
    800807    imp->voidMethodWithArgs(intArg, strArg, objArg);
     
    823830    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    824831    int intArg = exec->argument(0).toInt32(exec);
     832    if (exec->hadException())
     833        return JSValue::encode(jsUndefined());
    825834    const String& strArg = ustringToString(exec->argument(1).toString(exec));
     835    if (exec->hadException())
     836        return JSValue::encode(jsUndefined());
    826837    TestObj* objArg = toTestObj(exec->argument(2));
     838    if (exec->hadException())
     839        return JSValue::encode(jsUndefined());
    827840
    828841
     
    852865    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    853866    int intArg = exec->argument(0).toInt32(exec);
     867    if (exec->hadException())
     868        return JSValue::encode(jsUndefined());
    854869    const String& strArg = ustringToString(exec->argument(1).toString(exec));
     870    if (exec->hadException())
     871        return JSValue::encode(jsUndefined());
    855872    TestObj* objArg = toTestObj(exec->argument(2));
     873    if (exec->hadException())
     874        return JSValue::encode(jsUndefined());
    856875
    857876
     
    870889        return JSValue::encode(jsUndefined());
    871890    const String& strArg = ustringToString(exec->argument(0).toString(exec));
     891    if (exec->hadException())
     892        return JSValue::encode(jsUndefined());
    872893    TestObj* objArg = toTestObj(exec->argument(1));
     894    if (exec->hadException())
     895        return JSValue::encode(jsUndefined());
    873896
    874897
     
    888911    ExceptionCode ec = 0;
    889912    const String& strArg = ustringToString(exec->argument(0).toString(exec));
     913    if (exec->hadException())
     914        return JSValue::encode(jsUndefined());
    890915    TestObj* objArg = toTestObj(exec->argument(1));
     916    if (exec->hadException())
     917        return JSValue::encode(jsUndefined());
    891918
    892919
     
    904931    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    905932    RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, exec->argument(0));
     933    if (exec->hadException())
     934        return JSValue::encode(jsUndefined());
    906935
    907936    imp->serializedValue(serializedArg);
     
    917946    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    918947    RefPtr<IDBKey> key = createIDBKeyFromValue(exec, exec->argument(0));
     948    if (exec->hadException())
     949        return JSValue::encode(jsUndefined());
    919950
    920951    imp->idbKey(key);
     
    964995    ScriptCallStack callStack(exec, 1);
    965996    log* intArg = tolog(exec->argument(0));
     997    if (exec->hadException())
     998        return JSValue::encode(jsUndefined());
    966999
    9671000    imp->customArgsAndException(intArg, &callStack, ec);
     
    10241057        return JSValue::encode(jsUndefined());
    10251058    int intArg = exec->argument(0).toInt32(exec);
     1059    if (exec->hadException())
     1060        return JSValue::encode(jsUndefined());
    10261061
    10271062    imp->withDynamicFrameAndArg(dynamicFrame, intArg);
     
    10401075        return JSValue::encode(jsUndefined());
    10411076    int intArg = exec->argument(0).toInt32(exec);
     1077    if (exec->hadException())
     1078        return JSValue::encode(jsUndefined());
    10421079
    10431080    int argsCount = exec->argumentCount();
    1044     if (argsCount < 2) {
     1081    if (argsCount <= 1) {
    10451082        imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg);
    10461083        return JSValue::encode(jsUndefined());
     
    10481085
    10491086    int optionalArg = exec->argument(1).toInt32(exec);
     1087    if (exec->hadException())
     1088        return JSValue::encode(jsUndefined());
    10501089
    10511090    imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg);
     
    10641103        return JSValue::encode(jsUndefined());
    10651104    int intArg = exec->argument(0).toInt32(exec);
     1105    if (exec->hadException())
     1106        return JSValue::encode(jsUndefined());
    10661107
    10671108    imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec));
     
    10801121        return JSValue::encode(jsUndefined());
    10811122    int intArg = exec->argument(0).toInt32(exec);
     1123    if (exec->hadException())
     1124        return JSValue::encode(jsUndefined());
    10821125
    10831126    int argsCount = exec->argumentCount();
    1084     if (argsCount < 2) {
     1127    if (argsCount <= 1) {
    10851128        imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg);
    10861129        return JSValue::encode(jsUndefined());
     
    10881131
    10891132    int optionalArg = exec->argument(1).toInt32(exec);
     1133    if (exec->hadException())
     1134        return JSValue::encode(jsUndefined());
    10901135
    10911136    imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec));
     
    11751220
    11761221    int argsCount = exec->argumentCount();
    1177     if (argsCount < 1) {
     1222    if (argsCount <= 0) {
    11781223        imp->methodWithOptionalArg();
    11791224        return JSValue::encode(jsUndefined());
     
    11811226
    11821227    int opt = exec->argument(0).toInt32(exec);
     1228    if (exec->hadException())
     1229        return JSValue::encode(jsUndefined());
    11831230
    11841231    imp->methodWithOptionalArg(opt);
     
    11941241    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    11951242    int nonOpt = exec->argument(0).toInt32(exec);
     1243    if (exec->hadException())
     1244        return JSValue::encode(jsUndefined());
    11961245
    11971246    int argsCount = exec->argumentCount();
    1198     if (argsCount < 2) {
     1247    if (argsCount <= 1) {
    11991248        imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
    12001249        return JSValue::encode(jsUndefined());
     
    12021251
    12031252    int opt = exec->argument(1).toInt32(exec);
     1253    if (exec->hadException())
     1254        return JSValue::encode(jsUndefined());
    12041255
    12051256    imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
     
    12151266    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    12161267    int nonOpt = exec->argument(0).toInt32(exec);
     1268    if (exec->hadException())
     1269        return JSValue::encode(jsUndefined());
    12171270
    12181271    int argsCount = exec->argumentCount();
    1219     if (argsCount < 2) {
     1272    if (argsCount <= 1) {
    12201273        imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
    12211274        return JSValue::encode(jsUndefined());
     
    12231276
    12241277    int opt1 = exec->argument(1).toInt32(exec);
     1278    if (exec->hadException())
     1279        return JSValue::encode(jsUndefined());
    12251280    int opt2 = exec->argument(2).toInt32(exec);
     1281    if (exec->hadException())
     1282        return JSValue::encode(jsUndefined());
    12261283
    12271284    imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
     
    12381295    if (exec->argumentCount() <= 0 || !exec->argument(0).isObject()) {
    12391296        setDOMException(exec, TYPE_MISMATCH_ERR);
    1240         return jsUndefined();
     1297        return JSValue::encode(jsUndefined());
    12411298    }
    12421299    RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
     
    12541311    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    12551312    int nonCallback = exec->argument(0).toInt32(exec);
     1313    if (exec->hadException())
     1314        return JSValue::encode(jsUndefined());
    12561315    if (exec->argumentCount() <= 1 || !exec->argument(1).isObject()) {
    12571316        setDOMException(exec, TYPE_MISMATCH_ERR);
    1258         return jsUndefined();
     1317        return JSValue::encode(jsUndefined());
    12591318    }
    12601319    RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(1)), castedThis->globalObject());
     
    12711330    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    12721331    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
     1345static 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
     1363static 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());
    12731373
    12741374    int argsCount = exec->argumentCount();
    1275     if (argsCount < 1) {
    1276         imp->methodWithCallbackAndOptionalArg();
     1375    if (argsCount <= 1) {
     1376        imp->overloadedMethod(objArg);
    12771377        return JSValue::encode(jsUndefined());
    12781378    }
    12791379
    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 
    13191380    int intArg = exec->argument(1).toInt32(exec);
     1381    if (exec->hadException())
     1382        return JSValue::encode(jsUndefined());
    13201383
    13211384    imp->overloadedMethod(objArg, intArg);
     
    13311394    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    13321395    const String& strArg = ustringToString(exec->argument(0).toString(exec));
     1396    if (exec->hadException())
     1397        return JSValue::encode(jsUndefined());
    13331398
    13341399    imp->overloadedMethod(strArg);
     
    13441409    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    13451410    int intArg = exec->argument(0).toInt32(exec);
     1411    if (exec->hadException())
     1412        return JSValue::encode(jsUndefined());
    13461413
    13471414    imp->overloadedMethod(intArg);
  • trunk/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r64840 r65005  
    3030#include "SerializedScriptValue.h"
    3131#include "V8Binding.h"
     32#include "V8BindingMacros.h"
    3233#include "V8BindingState.h"
    3334#include "V8DOMWrapper.h"
     
    557558    INC_STATS("DOM.TestObj.voidMethodWithArgs");
    558559    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);
    562563    imp->voidMethodWithArgs(intArg, strArg, objArg);
    563564    return v8::Handle<v8::Value>();
     
    575576    INC_STATS("DOM.TestObj.intMethodWithArgs");
    576577    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);
    580581    return v8::Integer::New(imp->intMethodWithArgs(intArg, strArg, objArg));
    581582}
     
    592593    INC_STATS("DOM.TestObj.objMethodWithArgs");
    593594    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);
    597598    return toV8(imp->objMethodWithArgs(intArg, strArg, objArg));
    598599}
     
    604605        return v8::Handle<v8::Value>();
    605606    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);
    608609    return toV8(imp->methodThatRequiresAllArgs(strArg, objArg));
    609610}
     
    617618    ExceptionCode ec = 0;
    618619    {
    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);
    621622    RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec);
    622623    if (UNLIKELY(ec))
     
    645646    INC_STATS("DOM.TestObj.idbKey");
    646647    TestObj* imp = V8TestObj::toNative(args.Holder());
    647     RefPtr<IDBKey> key = createIDBKeyFromValue(args[0]);
     648    EXCEPTION_BLOCK(RefPtr<IDBKey>, key, createIDBKeyFromValue(args[0]));
    648649    imp->idbKey(key);
    649650    return v8::Handle<v8::Value>();
     
    675676    if (!callStack)
    676677        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);
    678679    imp->customArgsAndException(intArg, callStack.get(), ec);
    679680    if (UNLIKELY(ec))
     
    723724    INC_STATS("DOM.TestObj.withDynamicFrameAndArg");
    724725    TestObj* imp = V8TestObj::toNative(args.Holder());
    725     int intArg = toInt32(args[0]);
     726    EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
    726727    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
    727728    if (!enteredFrame)
     
    735736    INC_STATS("DOM.TestObj.withDynamicFrameAndOptionalArg");
    736737    TestObj* imp = V8TestObj::toNative(args.Holder());
    737     int intArg = toInt32(args[0]);
     738    EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
    738739    if (args.Length() <= 1) {
    739740        Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
     
    743744        return v8::Handle<v8::Value>();
    744745    }
    745     int optionalArg = toInt32(args[1]);
     746    EXCEPTION_BLOCK(int, optionalArg, toInt32(args[1]));
    746747    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
    747748    if (!enteredFrame)
     
    755756    INC_STATS("DOM.TestObj.withDynamicFrameAndUserGesture");
    756757    TestObj* imp = V8TestObj::toNative(args.Holder());
    757     int intArg = toInt32(args[0]);
     758    EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
    758759    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
    759760    if (!enteredFrame)
     
    767768    INC_STATS("DOM.TestObj.withDynamicFrameAndUserGestureASAD");
    768769    TestObj* imp = V8TestObj::toNative(args.Holder());
    769     int intArg = toInt32(args[0]);
     770    EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
    770771    if (args.Length() <= 1) {
    771772        Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
     
    775776        return v8::Handle<v8::Value>();
    776777    }
    777     int optionalArg = toInt32(args[1]);
     778    EXCEPTION_BLOCK(int, optionalArg, toInt32(args[1]));
    778779    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
    779780    if (!enteredFrame)
     
    862863        return v8::Handle<v8::Value>();
    863864    }
    864     int opt = toInt32(args[0]);
     865    EXCEPTION_BLOCK(int, opt, toInt32(args[0]));
    865866    imp->methodWithOptionalArg(opt);
    866867    return v8::Handle<v8::Value>();
     
    871872    INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndOptionalArg");
    872873    TestObj* imp = V8TestObj::toNative(args.Holder());
    873     int nonOpt = toInt32(args[0]);
     874    EXCEPTION_BLOCK(int, nonOpt, toInt32(args[0]));
    874875    if (args.Length() <= 1) {
    875876        imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
    876877        return v8::Handle<v8::Value>();
    877878    }
    878     int opt = toInt32(args[1]);
     879    EXCEPTION_BLOCK(int, opt, toInt32(args[1]));
    879880    imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
    880881    return v8::Handle<v8::Value>();
     
    885886    INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndTwoOptionalArgs");
    886887    TestObj* imp = V8TestObj::toNative(args.Holder());
    887     int nonOpt = toInt32(args[0]);
     888    EXCEPTION_BLOCK(int, nonOpt, toInt32(args[0]));
    888889    if (args.Length() <= 1) {
    889890        imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
    890891        return v8::Handle<v8::Value>();
    891892    }
    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]));
    894895    imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
    895896    return v8::Handle<v8::Value>();
     
    911912    INC_STATS("DOM.TestObj.methodWithNonCallbackArgAndCallbackArg");
    912913    TestObj* imp = V8TestObj::toNative(args.Holder());
    913     int nonCallback = toInt32(args[0]);
     914    EXCEPTION_BLOCK(int, nonCallback, toInt32(args[0]));
    914915    if (args.Length() <= 1 || !args[1]->IsObject())
    915916        return throwError(TYPE_MISMATCH_ERR);
     
    923924    INC_STATS("DOM.TestObj.methodWithCallbackAndOptionalArg");
    924925    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    }
    932932    imp->methodWithCallbackAndOptionalArg(callback);
    933933    return v8::Handle<v8::Value>();
     
    938938    INC_STATS("DOM.TestObj.overloadedMethod1");
    939939    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]);
    942942    imp->overloadedMethod(objArg, strArg);
    943943    return v8::Handle<v8::Value>();
     
    948948    INC_STATS("DOM.TestObj.overloadedMethod2");
    949949    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);
    951951    if (args.Length() <= 1) {
    952952        imp->overloadedMethod(objArg);
    953953        return v8::Handle<v8::Value>();
    954954    }
    955     int intArg = toInt32(args[1]);
     955    EXCEPTION_BLOCK(int, intArg, toInt32(args[1]));
    956956    imp->overloadedMethod(objArg, intArg);
    957957    return v8::Handle<v8::Value>();
     
    962962    INC_STATS("DOM.TestObj.overloadedMethod3");
    963963    TestObj* imp = V8TestObj::toNative(args.Holder());
    964     V8Parameter<> strArg = args[0];
     964    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, strArg, args[0]);
    965965    imp->overloadedMethod(strArg);
    966966    return v8::Handle<v8::Value>();
     
    971971    INC_STATS("DOM.TestObj.overloadedMethod4");
    972972    TestObj* imp = V8TestObj::toNative(args.Holder());
    973     int intArg = toInt32(args[0]);
     973    EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
    974974    imp->overloadedMethod(intArg);
    975975    return v8::Handle<v8::Value>();
     
    10891089    {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
    10901090    {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
     1091    {"methodWithCallbackArg", TestObjInternal::methodWithCallbackArgCallback},
     1092    {"methodWithNonCallbackArgAndCallbackArg", TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback},
    10911093    {"methodWithCallbackAndOptionalArg", TestObjInternal::methodWithCallbackAndOptionalArgCallback},
    10921094    {"overloadedMethod", TestObjInternal::overloadedMethodCallback},
     
    11621164    v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv);
    11631165    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));
    11761166    batchConfigureConstants(desc, proto, TestObjConsts, sizeof(TestObjConsts) / sizeof(*TestObjConsts));
    11771167
  • trunk/WebCore/bindings/v8/V8Binding.h

    r64991 r65005  
    221221    class V8Parameter {
    222222    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) { }
    224224        operator String();
    225225        operator AtomicString();
  • trunk/WebCore/bindings/v8/custom/V8BindingMacros.h

    r62094 r65005  
    3838    }
    3939
    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;                                          \
    4849    }
  • trunk/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp

    r64991 r65005  
    3333
    3434#include "Chrome.h"
    35 #include "Database.h"
    3635#include "DOMTimer.h"
    3736#include "DOMWindow.h"
     
    5655#include "V8BindingState.h"
    5756#include "V8CustomEventListener.h"
    58 #include "V8Database.h"
    59 #include "V8DatabaseCallback.h"
    6057#include "V8GCForContextDispose.h"
    6158#include "V8HiddenPropertyName.h"
     
    658655}
    659656
    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 
    693657bool V8DOMWindow::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>)
    694658{
  • trunk/WebCore/bindings/v8/custom/V8SQLTransactionCustom.cpp

    r64537 r65005  
    5656        return throwError(SYNTAX_ERR);
    5757
    58     TO_WEBCORE_STRING_EXCEPTION_BLOCK(statement, args[0]);
     58    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, statement, args[0]);
    5959
    6060    Vector<SQLValue> sqlValues;
     
    8383                sqlValues.append(SQLValue(sqlValue));
    8484            } else {
    85                 TO_WEBCORE_STRING_EXCEPTION_BLOCK(sqlValue, value);
     85                STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, sqlValue, value);
    8686                sqlValues.append(SQLValue(sqlValue));
    8787            }
  • trunk/WebCore/bindings/v8/custom/V8SQLTransactionSyncCustom.cpp

    r63479 r65005  
    5656        return throwError(SYNTAX_ERR);
    5757
    58     TO_WEBCORE_STRING_EXCEPTION_BLOCK(statement, args[0]);
     58    STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, statement, args[0]);
    5959
    6060    Vector<SQLValue> sqlValues;
     
    8383                sqlValues.append(SQLValue(sqlValue));
    8484            } else {
    85                 TO_WEBCORE_STRING_EXCEPTION_BLOCK(sqlValue, value);
     85                STRING_TO_V8PARAMETER_EXCEPTION_BLOCK(V8Parameter<>, sqlValue, value);
    8686                sqlValues.append(SQLValue(sqlValue));
    8787            }
  • trunk/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp

    r64840 r65005  
    3434#include "V8WorkerContext.h"
    3535
    36 #if ENABLE(DATABASE)
    37 #include "Database.h"
    38 #include "V8Database.h"
    39 #include "V8DatabaseCallback.h"
    40 #include "V8DatabaseSync.h"
    41 #endif
    4236#include "DOMTimer.h"
    4337#include "ExceptionCode.h"
     
    144138}
    145139
    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 
    206140} // namespace WebCore
    207141
  • trunk/WebCore/page/DOMWindow.idl

    r64845 r65005  
    161161#endif   
    162162#if defined(ENABLE_DATABASE) && ENABLE_DATABASE
    163         [EnabledAtRuntime, Custom] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback 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)
    164164            raises(DOMException);
    165165#endif
  • trunk/WebCore/storage/Database.cpp

    r64840 r65005  
    271271}
    272272
    273 void Database::transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
    274                            PassRefPtr<VoidCallback> successCallback, bool readOnly)
     273void Database::transaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback)
     274{
     275    runTransaction(callback, errorCallback, successCallback, false);
     276}
     277
     278void Database::readTransaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback, PassRefPtr<VoidCallback> successCallback)
     279{
     280    runTransaction(callback, errorCallback, successCallback, true);
     281}
     282
     283void Database::runTransaction(PassRefPtr<SQLTransactionCallback> callback, PassRefPtr<SQLTransactionErrorCallback> errorCallback,
     284                              PassRefPtr<VoidCallback> successCallback, bool readOnly)
    275285{
    276286    m_transactionQueue.append(SQLTransaction::create(this, callback, errorCallback, successCallback, 0, readOnly));
  • trunk/WebCore/storage/Database.h

    r64840 r65005  
    6060    void changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionCallback>,
    6161                       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);
    6464
    6565    // Internal engine support
     
    9191    Database(ScriptExecutionContext*, const String& name, const String& expectedVersion,
    9292             const String& displayName, unsigned long estimatedSize);
     93    void runTransaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>,
     94                        PassRefPtr<VoidCallback> successCallback, bool readOnly);
    9395
    9496    bool openAndVerifyVersion(bool setVersionInNewDatabase, ExceptionCode&);
  • trunk/WebCore/storage/Database.idl

    r64840 r65005  
    3535    ] Database {
    3636        readonly attribute DOMString version;
    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);
     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);
    4040    };
    4141
  • trunk/WebCore/storage/DatabaseSync.cpp

    r64840 r65005  
    129129}
    130130
    131 void DatabaseSync::transaction(PassRefPtr<SQLTransactionSyncCallback> callback, bool readOnly, ExceptionCode& ec)
     131void DatabaseSync::transaction(PassRefPtr<SQLTransactionSyncCallback> callback, ExceptionCode& ec)
     132{
     133    runTransaction(callback, false, ec);
     134}
     135
     136void DatabaseSync::readTransaction(PassRefPtr<SQLTransactionSyncCallback> callback, ExceptionCode& ec)
     137{
     138    runTransaction(callback, true, ec);
     139}
     140
     141void DatabaseSync::runTransaction(PassRefPtr<SQLTransactionSyncCallback> callback, bool readOnly, ExceptionCode& ec)
    132142{
    133143    ASSERT(m_scriptExecutionContext->isContextThread());
  • trunk/WebCore/storage/DatabaseSync.h

    r64840 r65005  
    5757                                                     const String& displayName, unsigned long estimatedSize, PassRefPtr<DatabaseCallback>, ExceptionCode&);
    5858    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&);
    6061
    6162    virtual void markAsDeletedAndClose();
     
    6566    DatabaseSync(ScriptExecutionContext*, const String& name, const String& expectedVersion,
    6667                 const String& displayName, unsigned long estimatedSize);
     68    void runTransaction(PassRefPtr<SQLTransactionSyncCallback>, bool readOnly, ExceptionCode&);
    6769};
    6870
  • trunk/WebCore/storage/DatabaseSync.idl

    r64840 r65005  
    3737    ] DatabaseSync {
    3838        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);
    4242    };
    4343
  • trunk/WebCore/workers/WorkerContext.idl

    r64840 r65005  
    5151                 attribute [Replaceable] WorkerNavigator navigator;
    5252#if defined(ENABLE_DATABASE) && ENABLE_DATABASE
    53         [EnabledAtRuntime, Custom] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback 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)
    5454            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);
    5657#endif
    5758
Note: See TracChangeset for help on using the changeset viewer.