Changeset 64840 in webkit


Ignore:
Timestamp:
Aug 6, 2010 5:59:31 AM (14 years ago)
Author:
pfeldman@chromium.org
Message:

2010-08-06 Pavel Feldman <pfeldman@chromium.org>

Not reviewed. Rolling out 64835, 64836 and 64839.

Location:
trunk
Files:
4 added
34 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r64838 r64840  
     12010-08-06  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Not reviewed. Rolling out 64835, 64836 and 64839.
     4
     5        * fast/workers/storage/open-database-inputs-sync-expected.txt:
     6        * fast/workers/storage/resources/open-database-inputs-sync.js:
     7        * storage/null-callbacks.html:
     8
    192010-08-06  Adam Barth  <abarth@webkit.org>
    210
  • trunk/LayoutTests/fast/workers/storage/open-database-inputs-sync-expected.txt

    r64835 r64840  
    11This test makes sure that openDatabaseSync() accepts only valid parameters.
    2 PASS: TYPE_MISMATCH_ERR: DOM Exception 17
    3 PASS: TYPE_MISMATCH_ERR: DOM Exception 17
     2PASS: SYNTAX_ERR: DOM Exception 12
     3PASS: SYNTAX_ERR: DOM Exception 12
    44PASS: undefined
    55PASS: undefined
    66PASS: undefined
    7 PASS: calling openDatabaseSync() with a null creation callback succeeded.
     7PASS: TYPE_MISMATCH_ERR: DOM Exception 17
    88PASS: openDatabaseSync() succeeded.
    99PASS: openDatabaseSync() succeeded.
  • trunk/LayoutTests/fast/workers/storage/resources/open-database-inputs-sync.js

    r64835 r64840  
    4242try {
    4343    db = openDatabaseSync("DBName", "DBVersion", "DBDescription", 1024, 0);
    44     postMessage("PASS: calling openDatabaseSync() with a null creation callback succeeded.");
     44    postMessage("FAIL: the fifth argument to openDatabaseSync() must be an object, if present.");
    4545} catch (err) {
    46     postMessage("FAIL: " + err.message);
     46    postMessage("PASS: " + err.message);
    4747}
    4848
  • trunk/LayoutTests/storage/null-callbacks.html

    r64835 r64840  
    3131        }, null, function() { finishTest(); });
    3232    } catch(err) {
    33         document.getElementById("console").innerHTML = "FAIL: " + err.message;
     33        document.getElementById("console").innerHTML = "FAIL";
    3434        finishTest();
    3535    }
  • trunk/WebCore/Android.jscbindings.mk

    r64835 r64840  
    9191        bindings/js/JSDataGridColumnListCustom.cpp \
    9292        bindings/js/JSDataGridDataSource.cpp \
     93        bindings/js/JSDatabaseCustom.cpp \
    9394        bindings/js/JSDedicatedWorkerContextCustom.cpp \
    9495        bindings/js/JSDesktopNotificationsCustom.cpp \
  • trunk/WebCore/Android.v8bindings.mk

    r64835 r64840  
    107107        bindings/v8/custom/V8DataGridColumnListCustom.cpp \
    108108        bindings/v8/custom/V8DatabaseCallback.cpp \
     109        bindings/v8/custom/V8DatabaseCustom.cpp \
    109110        bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp \
    110111        bindings/v8/custom/V8DeviceOrientationEventCustom.cpp \
  • trunk/WebCore/CMakeLists.txt

    r64835 r64840  
    590590    bindings/js/JSCustomVoidCallback.cpp
    591591    bindings/js/JSCustomXPathNSResolver.cpp
     592    bindings/js/JSDatabaseCustom.cpp
     593    bindings/js/JSDatabaseCustom.cpp
     594    bindings/js/JSDatabaseSyncCustom.cpp
    592595    bindings/js/JSDataGridColumnListCustom.cpp
    593596    bindings/js/JSDataGridDataSource.cpp
  • trunk/WebCore/ChangeLog

    r64839 r64840  
     12010-08-06  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Not reviewed. Rolling out 64835, 64836 and 64839.
     4
     5        * Android.jscbindings.mk:
     6        * Android.v8bindings.mk:
     7        * CMakeLists.txt:
     8        * GNUmakefile.am:
     9        * WebCore.gypi:
     10        * WebCore.pro:
     11        * WebCore.vcproj/WebCore.vcproj:
     12        * WebCore.xcodeproj/project.pbxproj:
     13        * bindings/js/JSBindingsAllInOne.cpp:
     14        * bindings/js/JSDOMWindowCustom.cpp:
     15        (WebCore::JSDOMWindow::openDatabase):
     16        * bindings/js/JSDatabaseCustom.cpp: Added.
     17        (WebCore::JSDatabase::changeVersion):
     18        (WebCore::createTransaction):
     19        (WebCore::JSDatabase::transaction):
     20        (WebCore::JSDatabase::readTransaction):
     21        * bindings/js/JSDatabaseSyncCustom.cpp: Added.
     22        (WebCore::JSDatabaseSync::changeVersion):
     23        (WebCore::createTransaction):
     24        (WebCore::JSDatabaseSync::transaction):
     25        (WebCore::JSDatabaseSync::readTransaction):
     26        * bindings/js/JSWorkerContextCustom.cpp:
     27        (WebCore::JSWorkerContext::openDatabase):
     28        (WebCore::JSWorkerContext::openDatabaseSync):
     29        * bindings/scripts/CodeGeneratorGObject.pm:
     30        * bindings/scripts/CodeGeneratorJS.pm:
     31        * bindings/scripts/CodeGeneratorV8.pm:
     32        * bindings/scripts/test/JS/JSTestCallback.cpp:
     33        (WebCore::JSTestCallback::~JSTestCallback):
     34        * bindings/scripts/test/JS/JSTestObj.cpp:
     35        (WebCore::jsTestObjPrototypeFunctionVoidMethodWithArgs):
     36        (WebCore::jsTestObjPrototypeFunctionIntMethodWithArgs):
     37        (WebCore::jsTestObjPrototypeFunctionObjMethodWithArgs):
     38        (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgs):
     39        (WebCore::jsTestObjPrototypeFunctionMethodThatRequiresAllArgsAndThrows):
     40        (WebCore::jsTestObjPrototypeFunctionSerializedValue):
     41        (WebCore::jsTestObjPrototypeFunctionIdbKey):
     42        (WebCore::jsTestObjPrototypeFunctionCustomArgsAndException):
     43        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndArg):
     44        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndOptionalArg):
     45        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGesture):
     46        (WebCore::jsTestObjPrototypeFunctionWithDynamicFrameAndUserGestureASAD):
     47        (WebCore::jsTestObjPrototypeFunctionMethodWithOptionalArg):
     48        (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndOptionalArg):
     49        (WebCore::jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs):
     50        (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg):
     51        (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
     52        (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg):
     53        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod1):
     54        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod2):
     55        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod3):
     56        (WebCore::jsTestObjPrototypeFunctionOverloadedMethod4):
     57        * bindings/scripts/test/TestObj.idl:
     58        * bindings/scripts/test/V8/V8TestObj.cpp:
     59        (WebCore::TestObjInternal::voidMethodWithArgsCallback):
     60        (WebCore::TestObjInternal::intMethodWithArgsCallback):
     61        (WebCore::TestObjInternal::objMethodWithArgsCallback):
     62        (WebCore::TestObjInternal::methodThatRequiresAllArgsCallback):
     63        (WebCore::TestObjInternal::methodThatRequiresAllArgsAndThrowsCallback):
     64        (WebCore::TestObjInternal::serializedValueCallback):
     65        (WebCore::TestObjInternal::idbKeyCallback):
     66        (WebCore::TestObjInternal::customArgsAndExceptionCallback):
     67        (WebCore::TestObjInternal::withDynamicFrameAndArgCallback):
     68        (WebCore::TestObjInternal::withDynamicFrameAndOptionalArgCallback):
     69        (WebCore::TestObjInternal::withDynamicFrameAndUserGestureCallback):
     70        (WebCore::TestObjInternal::withDynamicFrameAndUserGestureASADCallback):
     71        (WebCore::TestObjInternal::methodWithOptionalArgCallback):
     72        (WebCore::TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback):
     73        (WebCore::TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback):
     74        (WebCore::TestObjInternal::methodWithCallbackArgCallback):
     75        (WebCore::TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback):
     76        (WebCore::TestObjInternal::methodWithCallbackAndOptionalArgCallback):
     77        (WebCore::TestObjInternal::overloadedMethod1Callback):
     78        (WebCore::TestObjInternal::overloadedMethod2Callback):
     79        (WebCore::TestObjInternal::overloadedMethod3Callback):
     80        (WebCore::TestObjInternal::overloadedMethod4Callback):
     81        (WebCore::):
     82        (WebCore::ConfigureV8TestObjTemplate):
     83        * bindings/v8/V8Binding.h:
     84        (WebCore::String):
     85        (WebCore::AtomicString):
     86        * bindings/v8/custom/V8DOMWindowCustom.cpp:
     87        (WebCore::V8DOMWindow::openDatabaseCallback):
     88        * bindings/v8/custom/V8DatabaseCustom.cpp: Added.
     89        (WebCore::V8Database::changeVersionCallback):
     90        (WebCore::createTransaction):
     91        (WebCore::V8Database::transactionCallback):
     92        (WebCore::V8Database::readTransactionCallback):
     93        * bindings/v8/custom/V8DatabaseSyncCustom.cpp: Added.
     94        (WebCore::V8DatabaseSync::changeVersionCallback):
     95        (WebCore::createTransaction):
     96        (WebCore::V8DatabaseSync::transactionCallback):
     97        (WebCore::V8DatabaseSync::readTransactionCallback):
     98        * bindings/v8/custom/V8WorkerContextCustom.cpp:
     99        (WebCore::V8WorkerContext::openDatabaseCallback):
     100        (WebCore::V8WorkerContext::openDatabaseSyncCallback):
     101        * page/DOMWindow.idl:
     102        * storage/Database.cpp:
     103        (WebCore::Database::transaction):
     104        * storage/Database.h:
     105        * storage/Database.idl:
     106        * storage/DatabaseSync.cpp:
     107        (WebCore::DatabaseSync::transaction):
     108        * storage/DatabaseSync.h:
     109        * storage/DatabaseSync.idl:
     110        * workers/WorkerContext.idl:
     111
    11122010-08-06  Dumitru Daniliuc  <dumi@chromium.org>
    2113
  • trunk/WebCore/GNUmakefile.am

    r64835 r64840  
    27282728webcore_sources += \
    27292729        WebCore/bindings/js/JSCustomSQLStatementErrorCallback.cpp \
     2730        WebCore/bindings/js/JSDatabaseCustom.cpp \
     2731        WebCore/bindings/js/JSDatabaseSyncCustom.cpp \
    27302732        WebCore/bindings/js/JSSQLResultSetRowListCustom.cpp \
    27312733        WebCore/bindings/js/JSSQLTransactionCustom.cpp \
  • trunk/WebCore/WebCore.gypi

    r64835 r64840  
    543543            'bindings/js/JSCustomXPathNSResolver.cpp',
    544544            'bindings/js/JSCustomXPathNSResolver.h',
     545            'bindings/js/JSDatabaseCustom.cpp',
     546            'bindings/js/JSDatabaseSyncCustom.cpp',
    545547            'bindings/js/JSDataGridColumnListCustom.cpp',
    546548            'bindings/js/JSDataGridDataSource.cpp',
     
    739741            'bindings/v8/custom/V8CustomXPathNSResolver.cpp',
    740742            'bindings/v8/custom/V8CustomXPathNSResolver.h',
     743            'bindings/v8/custom/V8DatabaseCustom.cpp',
     744            'bindings/v8/custom/V8DatabaseSyncCustom.cpp',
    741745            'bindings/v8/custom/V8DataGridColumnListCustom.cpp',
    742746            'bindings/v8/custom/V8DedicatedWorkerContextCustom.cpp',
  • trunk/WebCore/WebCore.pro

    r64835 r64840  
    24132413        storage/SQLTransactionSync.cpp \
    24142414        bindings/js/JSCustomSQLStatementErrorCallback.cpp \
     2415        bindings/js/JSDatabaseCustom.cpp \
     2416        bindings/js/JSDatabaseSyncCustom.cpp \
    24152417        bindings/js/JSSQLResultSetRowListCustom.cpp \
    24162418        bindings/js/JSSQLTransactionCustom.cpp \
  • trunk/WebCore/WebCore.vcproj/WebCore.vcproj

    r64835 r64840  
    4208142081                                </File>
    4208242082                                <File
     42083                                        RelativePath="..\bindings\js\JSDatabaseCustom.cpp"
     42084                                        >
     42085                                        <FileConfiguration
     42086                                                Name="Debug|Win32"
     42087                                                ExcludedFromBuild="true"
     42088                                                >
     42089                                                <Tool
     42090                                                        Name="VCCLCompilerTool"
     42091                                                />
     42092                                        </FileConfiguration>
     42093                                        <FileConfiguration
     42094                                                Name="Release|Win32"
     42095                                                ExcludedFromBuild="true"
     42096                                                >
     42097                                                <Tool
     42098                                                        Name="VCCLCompilerTool"
     42099                                                />
     42100                                        </FileConfiguration>
     42101                                        <FileConfiguration
     42102                                                Name="Debug_Internal|Win32"
     42103                                                ExcludedFromBuild="true"
     42104                                                >
     42105                                                <Tool
     42106                                                        Name="VCCLCompilerTool"
     42107                                                />
     42108                                        </FileConfiguration>
     42109                                        <FileConfiguration
     42110                                                Name="Debug_Cairo|Win32"
     42111                                                ExcludedFromBuild="true"
     42112                                                >
     42113                                                <Tool
     42114                                                        Name="VCCLCompilerTool"
     42115                                                />
     42116                                        </FileConfiguration>
     42117                                        <FileConfiguration
     42118                                                Name="Release_Cairo|Win32"
     42119                                                ExcludedFromBuild="true"
     42120                                                >
     42121                                                <Tool
     42122                                                        Name="VCCLCompilerTool"
     42123                                                />
     42124                                        </FileConfiguration>
     42125                                        <FileConfiguration
     42126                                                Name="Debug_All|Win32"
     42127                                                ExcludedFromBuild="true"
     42128                                                >
     42129                                                <Tool
     42130                                                        Name="VCCLCompilerTool"
     42131                                                />
     42132                                        </FileConfiguration>
     42133                                </File>
     42134                                <File
     42135                                        RelativePath="..\bindings\js\JSDatabaseSyncCustom.cpp"
     42136                                        >
     42137                                        <FileConfiguration
     42138                                                Name="Debug|Win32"
     42139                                                ExcludedFromBuild="true"
     42140                                                >
     42141                                                <Tool
     42142                                                        Name="VCCLCompilerTool"
     42143                                                />
     42144                                        </FileConfiguration>
     42145                                        <FileConfiguration
     42146                                                Name="Release|Win32"
     42147                                                ExcludedFromBuild="true"
     42148                                                >
     42149                                                <Tool
     42150                                                        Name="VCCLCompilerTool"
     42151                                                />
     42152                                        </FileConfiguration>
     42153                                        <FileConfiguration
     42154                                                Name="Debug_Internal|Win32"
     42155                                                ExcludedFromBuild="true"
     42156                                                >
     42157                                                <Tool
     42158                                                        Name="VCCLCompilerTool"
     42159                                                />
     42160                                        </FileConfiguration>
     42161                                        <FileConfiguration
     42162                                                Name="Debug_Cairo|Win32"
     42163                                                ExcludedFromBuild="true"
     42164                                                >
     42165                                                <Tool
     42166                                                        Name="VCCLCompilerTool"
     42167                                                />
     42168                                        </FileConfiguration>
     42169                                        <FileConfiguration
     42170                                                Name="Release_Cairo|Win32"
     42171                                                ExcludedFromBuild="true"
     42172                                                >
     42173                                                <Tool
     42174                                                        Name="VCCLCompilerTool"
     42175                                                />
     42176                                        </FileConfiguration>
     42177                                        <FileConfiguration
     42178                                                Name="Debug_All|Win32"
     42179                                                ExcludedFromBuild="true"
     42180                                                >
     42181                                                <Tool
     42182                                                        Name="VCCLCompilerTool"
     42183                                                />
     42184                                        </FileConfiguration>
     42185                                </File>
     42186                                <File
    4208342187                                        RelativePath="..\bindings\js\JSDataGridColumnListCustom.cpp"
    4208442188                                        >
  • trunk/WebCore/WebCore.xcodeproj/project.pbxproj

    r64835 r64840  
    43374337                B55D5AA4119131FC00BCC315 /* JSSQLTransactionSyncCallback.h in Headers */ = {isa = PBXBuildFile; fileRef = B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */; };
    43384338                B55D5AA5119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA3119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp */; };
     4339                B55D5AA81191325000BCC315 /* JSDatabaseSyncCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */; };
    43394340                B55D5AA91191325000BCC315 /* JSSQLTransactionSyncCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B55D5AA71191325000BCC315 /* JSSQLTransactionSyncCustom.cpp */; };
    43404341                B56EBA8511C9FF8100B04477 /* SQLException.h in Headers */ = {isa = PBXBuildFile; fileRef = B56EBA8311C9FF8100B04477 /* SQLException.h */; };
     
    47944795                BCCD74DC0A4C8D35005FDA6D /* HTMLViewSourceDocument.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */; };
    47954796                BCCD74E50A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */; };
     4797                BCCE58AC1061E8CF008FB35A /* JSDatabaseCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */; };
    47964798                BCCFBAE80B5152ED0001F1D7 /* DocumentParser.h in Headers */ = {isa = PBXBuildFile; fileRef = BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */; settings = {ATTRIBUTES = (Private, ); }; };
    47974799                BCD0E0FA0E972C3500265DEA /* SecurityOrigin.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */; };
     
    1000410006                B55D5AA2119131FC00BCC315 /* JSSQLTransactionSyncCallback.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSSQLTransactionSyncCallback.h; sourceTree = "<group>"; };
    1000510007                B55D5AA3119131FC00BCC315 /* JSSQLTransactionSyncCallback.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionSyncCallback.cpp; sourceTree = "<group>"; };
     10008                B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseSyncCustom.cpp; sourceTree = "<group>"; };
    1000610009                B55D5AA71191325000BCC315 /* JSSQLTransactionSyncCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSSQLTransactionSyncCustom.cpp; sourceTree = "<group>"; };
    1000710010                B55D5ABB1191327200BCC315 /* DatabaseSync.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DatabaseSync.idl; sourceTree = "<group>"; };
     
    1049810501                BCCD74DB0A4C8D35005FDA6D /* HTMLViewSourceDocument.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = HTMLViewSourceDocument.h; sourceTree = "<group>"; };
    1049910502                BCCD74E40A4C8DDF005FDA6D /* HTMLViewSourceDocument.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = HTMLViewSourceDocument.cpp; sourceTree = "<group>"; };
     10503                BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSDatabaseCustom.cpp; sourceTree = "<group>"; };
    1050010504                BCCFBAE70B5152ED0001F1D7 /* DocumentParser.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DocumentParser.h; sourceTree = "<group>"; };
    1050110505                BCD0E0F70E972C3500265DEA /* SecurityOrigin.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SecurityOrigin.cpp; sourceTree = "<group>"; };
     
    1594615950                                BC5825F20C0B89380053F1B5 /* JSCSSStyleDeclarationCustom.cpp */,
    1594715951                                BC20FB7E0C0E8E6C00D1447F /* JSCSSValueCustom.cpp */,
     15952                                BCCE58AB1061E8CF008FB35A /* JSDatabaseCustom.cpp */,
     15953                                B55D5AA61191325000BCC315 /* JSDatabaseSyncCustom.cpp */,
    1594815954                                BC77D1510FF19C730070887B /* JSDataGridColumnListCustom.cpp */,
    1594915955                                4162A453101145E300DFF3ED /* JSDedicatedWorkerContextCustom.cpp */,
     
    2120221208                                1AE82F8F0CAAFA9D002237AE /* JSDatabase.cpp in Sources */,
    2120321209                                B59DD69A119029E5007E9684 /* JSDatabaseCallback.cpp in Sources */,
     21210                                BCCE58AC1061E8CF008FB35A /* JSDatabaseCustom.cpp in Sources */,
    2120421211                                B58CEB6A11913607002A6790 /* JSDatabaseSync.cpp in Sources */,
     21212                                B55D5AA81191325000BCC315 /* JSDatabaseSyncCustom.cpp in Sources */,
    2120521213                                BC77D1690FF19F560070887B /* JSDataGridColumn.cpp in Sources */,
    2120621214                                BC77D16B0FF19F560070887B /* JSDataGridColumnList.cpp in Sources */,
  • trunk/WebCore/bindings/js/JSBindingsAllInOne.cpp

    r64835 r64840  
    5858#include "JSDataGridColumnListCustom.cpp"
    5959#include "JSDataGridDataSource.cpp"
     60#include "JSDatabaseCustom.cpp"
     61#include "JSDatabaseSyncCustom.cpp"
    6062#include "JSDebugWrapperSet.cpp"
    6163#include "JSDedicatedWorkerContextCustom.cpp"
  • trunk/WebCore/bindings/js/JSDOMWindowCustom.cpp

    r64835 r64840  
    2323#include "AtomicString.h"
    2424#include "Chrome.h"
     25#include "Database.h"
    2526#include "DOMWindow.h"
    2627#include "Document.h"
     
    3637#include "History.h"
    3738#include "JSAudioConstructor.h"
     39#if ENABLE(DATABASE)
     40#include "JSDatabase.h"
     41#include "JSDatabaseCallback.h"
     42#endif
    3843#include "JSDOMWindowShell.h"
    3944#include "JSEvent.h"
     
    10021007}
    10031008
     1009#if ENABLE(DATABASE)
     1010JSValue 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
    10041052DOMWindow* toDOMWindow(JSValue value)
    10051053{
  • trunk/WebCore/bindings/js/JSWorkerContextCustom.cpp

    r64835 r64840  
    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
    3239#include "ExceptionCode.h"
    3340#include "JSDOMBinding.h"
     
    147154#endif
    148155
     156#if ENABLE(DATABASE)
     157JSValue 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 
     197JSValue 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
    149239} // namespace WebCore
    150240
  • trunk/WebCore/bindings/scripts/CodeGeneratorGObject.pm

    r64839 r64840  
    209209    }
    210210
    211     # Skip functions that take ["Callback"] parameters, since this
    212     # code generator doesn't know yet how to auto-generate callbacks.
    213     foreach my $param (@{$function->parameters}) {
    214         if ($param->extendedAttributes->{"Callback"}) {
    215             return 1;
    216         }
    217     }
    218 
    219211    return 0;
    220212}
  • trunk/WebCore/bindings/scripts/CodeGeneratorJS.pm

    r64836 r64840  
    19101910
    19111911                    foreach my $parameter (@{$function->parameters}) {
    1912                         push(@implContent, "\n");
    19131912                        if ($parameter->extendedAttributes->{"Optional"}) {
    1914                             # Optional callbacks should be handled differently because:
    1915                             # - they always have a default value: 0
    1916                             # - it reduces the number of overloaded functions with different number of parameters
    1917                             if (!$parameter->extendedAttributes->{"Callback"}) {
    1918                                 # Generate early call if there are enough parameters.
    1919                                 if (!$hasOptionalArguments) {
    1920                                     push(@implContent, "    int argsCount = exec->argumentCount();\n");
    1921                                     $hasOptionalArguments = 1;
    1922                                 }
    1923                                 push(@implContent, "    if (argsCount <= $argsIndex) {\n");
    1924                                 GenerateImplementationFunctionCall($function, $functionString, $paramIndex, "    " x 2, $podType, $implClassName);
    1925                                 push(@implContent, "    }\n");
     1913                            # Generate early call if there are enough parameters.
     1914                            if (!$hasOptionalArguments) {
     1915                                push(@implContent, "\n    int argsCount = exec->argumentCount();\n");
     1916                                $hasOptionalArguments = 1;
    19261917                            }
    1927                         } else {
    1928                             $implIncludes{"ExceptionCode.h"} = 1;
    1929                             push(@implContent, "    if (exec->argumentCount() <= $argsIndex) {\n");
    1930                             push(@implContent, "        setDOMException(exec, TYPE_MISMATCH_ERR);\n");
    1931                             push(@implContent, "        return JSValue::encode(jsUndefined());\n");
    1932                             push(@implContent, "    }\n");
     1918                            push(@implContent, "    if (argsCount < " . ($argsIndex + 1) . ") {\n");
     1919                            GenerateImplementationFunctionCall($function, $functionString, $paramIndex, "    " x 2, $podType, $implClassName);
     1920                            push(@implContent, "    }\n\n");
    19331921                        }
    19341922
     
    19481936                            $implIncludes{"$callbackClassName.h"} = 1;
    19491937                            $implIncludes{"ExceptionCode.h"} = 1;
    1950                             if ($parameter->extendedAttributes->{"Optional"}) {
    1951                                 push(@implContent, "    RefPtr<" . $parameter->type . "> $name;\n");
    1952                                 push(@implContent, "    if (exec->argumentCount() > $argsIndex && exec->argument($argsIndex).isObject()) {\n");
    1953                                 push(@implContent, "        JSObject* object = exec->argument($argsIndex).getObject();\n");
    1954                                 push(@implContent, "        if (!object) {\n");
    1955                                 push(@implContent, "            setDOMException(exec, TYPE_MISMATCH_ERR);\n");
    1956                                 push(@implContent, "            return JSValue::encode(jsUndefined());\n");
    1957                                 push(@implContent, "        }\n");
    1958                                 push(@implContent, "        $name = ${callbackClassName}::create(object, castedThis->globalObject());\n");
    1959                                 push(@implContent, "    }\n");
    1960                             } else {
    1961                                 push(@implContent, "    if (!exec->argument($argsIndex).isObject() || !exec->argument($argsIndex).getObject()) {\n");
    1962                                 push(@implContent, "        setDOMException(exec, TYPE_MISMATCH_ERR);\n");
    1963                                 push(@implContent, "        return JSValue::encode(jsUndefined());\n");
    1964                                 push(@implContent, "    }\n");
    1965                                 push(@implContent, "    RefPtr<" . $parameter->type . "> $name = " . $callbackClassName . "::create(exec->argument($argsIndex).getObject(), castedThis->globalObject());\n");
    1966                             }
     1938                            push(@implContent, "    if (exec->argumentCount() <= $argsIndex || !exec->argument($argsIndex).isObject()) {\n");
     1939                            push(@implContent, "        setDOMException(exec, TYPE_MISMATCH_ERR);\n");
     1940                            push(@implContent, "        return jsUndefined();\n");
     1941                            push(@implContent, "    }\n");
     1942                            push(@implContent, "    RefPtr<" . $parameter->type . "> $name = " . $callbackClassName . "::create(asObject(exec->argument($argsIndex)), castedThis->globalObject());\n");
    19671943                        } else {
    19681944                            push(@implContent, "    " . GetNativeTypeFromSignature($parameter) . " $name = " . JSValueToNative($parameter, "exec->argument($argsIndex)") . ";\n");
     
    19781954                                push(@implContent, "    }\n");
    19791955                            }
    1980                         }
    1981 
    1982                         # Callback parameters have their special error checking code.
    1983                         if (!$parameter->extendedAttributes->{"Callback"}) {
    1984                             push(@implContent, "    if (exec->hadException())\n");
    1985                             push(@implContent, "        return JSValue::encode(jsUndefined());\n");
    19861956                        }
    19871957
     
    23742344    return "$value.toNumber(exec)" if $type eq "double";
    23752345    return "$value.toFloat(exec)" if $type eq "float" or $type eq "SVGNumber";
    2376     return "$value.toInt32(exec)" if $type eq "long";
    2377     return "$value.toUInt32(exec)" if $type eq "unsigned long" or $type eq "unsigned short";
     2346    return "$value.toInt32(exec)" if $type eq "unsigned long" or $type eq "long" or $type eq "unsigned short";
    23782347    return "static_cast<$type>($value.toInteger(exec))" if $type eq "long long" or $type eq "unsigned long long";
    23792348
  • trunk/WebCore/bindings/scripts/CodeGeneratorV8.pm

    r64835 r64840  
    11771177
    11781178        if ($parameter->extendedAttributes->{"Optional"}) {
    1179             # Optional callbacks should be handled differently because:
    1180             # - they always have a default value: 0
    1181             # - it reduces the number of overloaded functions with different number of parameters
    1182             if (!$parameter->extendedAttributes->{"Callback"}) {
    1183                 # Generate early call if there are not enough parameters.
    1184                 push(@implContentDecls, "    if (args.Length() <= $paramIndex) {\n");
    1185                 my $functionCall = GenerateFunctionCallString($function, $paramIndex, "    " x 2, $implClassName);
    1186                 push(@implContentDecls, $functionCall);
    1187                 push(@implContentDecls, "    }\n");
    1188             }
    1189         } else {
    1190           push(@implContentDecls, "    if (args.Length() <= $paramIndex)\n");
    1191           push(@implContentDecls, "        return throwError(TYPE_MISMATCH_ERR);\n");
    1192         }
    1193 
    1194         if (BasicTypeCanFailConversion($parameter)) {
    1195             push(@implContentDecls, "    bool ${parameterName}Ok;\n");
    1196         }
    1197 
    1198         my $nativeType = GetNativeTypeFromSignature($parameter, $paramIndex);
     1179            # Generate early call if there are not enough parameters.
     1180            push(@implContentDecls, "    if (args.Length() <= $paramIndex) {\n");
     1181            my $functionCall = GenerateFunctionCallString($function, $paramIndex, "    " x 2, $implClassName);
     1182            push(@implContentDecls, $functionCall);
     1183            push(@implContentDecls, "    }\n");
     1184        }
     1185
    11991186        if ($parameter->extendedAttributes->{"Callback"}) {
    12001187            my $className = GetCallbackClassName($parameter->type);
    12011188            $implIncludes{"$className.h"} = 1;
    12021189            $implIncludes{"ExceptionCode.h"} = 1;
    1203             if ($parameter->extendedAttributes->{"Optional"}) {
    1204                 push(@implContentDecls, "    RefPtr<" . $parameter->type . "> $parameterName;\n");
    1205                 push(@implContentDecls, "    if (args.Length() > $paramIndex && args[$paramIndex]->IsObject())\n");
    1206                 push(@implContentDecls, "        $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n");
    1207             } else {
    1208                 push(@implContentDecls, "    if (!args[$paramIndex]->IsObject())\n");
    1209                 push(@implContentDecls, "        return throwError(TYPE_MISMATCH_ERR);\n");
    1210                 push(@implContentDecls, "    RefPtr<" . $parameter->type . "> $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n");
    1211             }
     1190            push(@implContentDecls, "    if (args.Length() <= $paramIndex || !args[$paramIndex]->IsObject())\n");
     1191            push(@implContentDecls, "        return throwError(TYPE_MISMATCH_ERR);\n");
     1192            push(@implContentDecls, "    RefPtr<" . $parameter->type . "> $parameterName = ${className}::create(args[$paramIndex], getScriptExecutionContext());\n");
    12121193            $paramIndex++;
    12131194            next;
    1214         } elsif ($parameter->type eq "SerializedScriptValue") {
     1195        }
     1196
     1197        if ($parameter->type eq "SerializedScriptValue") {
    12151198            $implIncludes{"SerializedScriptValue.h"} = 1;
    12161199            push(@implContentDecls, "    bool ${parameterName}DidThrow = false;\n");
    1217             push(@implContentDecls, "    $nativeType $parameterName = SerializedScriptValue::create(args[$paramIndex], ${parameterName}DidThrow);\n");
     1200        } elsif (BasicTypeCanFailConversion($parameter)) {
     1201            push(@implContentDecls, "    bool ${parameterName}Ok;\n");
     1202        }
     1203
     1204        push(@implContentDecls, "    " . GetNativeTypeFromSignature($parameter, $paramIndex) . " $parameterName = ");
     1205
     1206        if ($parameter->type eq "SerializedScriptValue") {
     1207            push(@implContentDecls, "SerializedScriptValue::create(args[$paramIndex], ${parameterName}DidThrow);\n");
    12181208            push(@implContentDecls, "    if (${parameterName}DidThrow)\n");
    12191209            push(@implContentDecls, "        return v8::Undefined();\n");
    1220         } elsif (TypeCanFailConversion($parameter)) {
     1210        } else {
     1211            push(@implContentDecls, JSValueToNative($parameter, "args[$paramIndex]",
     1212                                                    BasicTypeCanFailConversion($parameter) ?  "${parameterName}Ok" : undef) . ";\n");
     1213        }
     1214
     1215        if (TypeCanFailConversion($parameter)) {
    12211216            $implIncludes{"ExceptionCode.h"} = 1;
    1222             push(@implContentDecls, "    $nativeType $parameterName = " .
    1223                  JSValueToNative($parameter, "args[$paramIndex]",
    1224                                  BasicTypeCanFailConversion($parameter) ? "${parameterName}Ok" : undef) . ";\n");
    1225             push(@implContentDecls, "    if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n");
    1226             push(@implContentDecls, "        ec = TYPE_MISMATCH_ERR;\n");
    1227             push(@implContentDecls, "        goto fail;\n");
    1228             push(@implContentDecls, "    }\n");
    1229         } elsif ($nativeType =~ /^V8Parameter/) {
    1230             # Exceptions are handled in V8Parameter's operators.
    1231             push(@implContentDecls, "    $nativeType $parameterName = " .
    1232                  JSValueToNative($parameter, "args[$paramIndex]",
    1233                                  BasicTypeCanFailConversion($parameter) ? "{$parameterName}Ok" : undef) . ";\n");
    1234         } else {
    1235             $implIncludes{"V8BindingMacros.h"} = 1;
    1236             push(@implContentDecls, "    EXCEPTION_BLOCK($nativeType, $parameterName, " .
    1237                  JSValueToNative($parameter, "args[$paramIndex]",
    1238                                  BasicTypeCanFailConversion($parameter) ? "{$parameterName}Ok" : undef) . ");\n");
     1217            push(@implContentDecls,
     1218"    if (UNLIKELY(!$parameterName" . (BasicTypeCanFailConversion($parameter) ? "Ok" : "") . ")) {\n" .
     1219"        ec = TYPE_MISMATCH_ERR;\n" .
     1220"        goto fail;\n" .
     1221"    }\n");
    12391222        }
    12401223
    12411224        if ($parameter->extendedAttributes->{"IsIndex"}) {
    12421225            $implIncludes{"ExceptionCode.h"} = 1;
    1243             push(@implContentDecls, "    if (UNLIKELY($parameterName < 0)) {\n");
    1244             push(@implContentDecls, "        ec = INDEX_SIZE_ERR;\n");
    1245             push(@implContentDecls, "        goto fail;\n");
    1246             push(@implContentDecls, "    }\n");
     1226            push(@implContentDecls,
     1227"    if (UNLIKELY($parameterName < 0)) {\n" .
     1228"        ec = INDEX_SIZE_ERR;\n" .
     1229"        goto fail;\n" .
     1230"    }\n");
    12471231        }
    12481232
     
    28422826    return "$value->NumberValue()" if $type eq "SVGNumber";
    28432827
    2844     return "toInt32($value${maybeOkParam})" if $type eq "long";
    2845     return "toUInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short";
     2828    return "toInt32($value${maybeOkParam})" if $type eq "unsigned long" or $type eq "unsigned short" or $type eq "long";
    28462829    return "toInt64($value)" if $type eq "unsigned long long" or $type eq "long long";
    28472830    return "static_cast<Range::CompareHow>($value->Int32Value())" if $type eq "CompareHow";
     
    29732956
    29742957    foreach my $parameter (@{$function->parameters}) {
    2975         if ($parameter->extendedAttributes->{"Optional"} ||
    2976             $parameter->extendedAttributes->{"Callback"}) {
     2958        if ($parameter->extendedAttributes->{"Optional"}) {
    29772959            return 0;
    29782960        }
  • trunk/WebCore/bindings/scripts/test/JS/JSTestCallback.cpp

    r64835 r64840  
    4343JSTestCallback::~JSTestCallback()
    4444{
    45     ScriptExecutionContext* context = scriptExecutionContext();
    46     // When the context is destroyed, all tasks with a reference to a callback
    47     // should be deleted. So if the context is NULL, we are on the context thread.
    48     if (!context || context->isContextThread())
     45    if (m_scriptExecutionContext->isContextThread())
    4946        delete m_data;
    5047    else
    51         context->postTask(DeleteCallbackDataTask::create(m_data));
     48        m_data->globalObject()->scriptExecutionContext()->postTask(DeleteCallbackDataTask::create(m_data));
    5249#ifndef NDEBUG
    5350    m_data = 0;
  • trunk/WebCore/bindings/scripts/test/JS/JSTestObj.cpp

    r64835 r64840  
    794794    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    795795    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    796 
    797     if (exec->argumentCount() <= 0) {
    798         setDOMException(exec, TYPE_MISMATCH_ERR);
    799         return JSValue::encode(jsUndefined());
    800     }
    801796    int intArg = exec->argument(0).toInt32(exec);
    802     if (exec->hadException())
    803         return JSValue::encode(jsUndefined());
    804 
    805     if (exec->argumentCount() <= 1) {
    806         setDOMException(exec, TYPE_MISMATCH_ERR);
    807         return JSValue::encode(jsUndefined());
    808     }
    809797    const String& strArg = ustringToString(exec->argument(1).toString(exec));
    810     if (exec->hadException())
    811         return JSValue::encode(jsUndefined());
    812 
    813     if (exec->argumentCount() <= 2) {
    814         setDOMException(exec, TYPE_MISMATCH_ERR);
    815         return JSValue::encode(jsUndefined());
    816     }
    817798    TestObj* objArg = toTestObj(exec->argument(2));
    818     if (exec->hadException())
    819         return JSValue::encode(jsUndefined());
    820799
    821800    imp->voidMethodWithArgs(intArg, strArg, objArg);
     
    843822    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    844823    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    845 
    846     if (exec->argumentCount() <= 0) {
    847         setDOMException(exec, TYPE_MISMATCH_ERR);
    848         return JSValue::encode(jsUndefined());
    849     }
    850824    int intArg = exec->argument(0).toInt32(exec);
    851     if (exec->hadException())
    852         return JSValue::encode(jsUndefined());
    853 
    854     if (exec->argumentCount() <= 1) {
    855         setDOMException(exec, TYPE_MISMATCH_ERR);
    856         return JSValue::encode(jsUndefined());
    857     }
    858825    const String& strArg = ustringToString(exec->argument(1).toString(exec));
    859     if (exec->hadException())
    860         return JSValue::encode(jsUndefined());
    861 
    862     if (exec->argumentCount() <= 2) {
    863         setDOMException(exec, TYPE_MISMATCH_ERR);
    864         return JSValue::encode(jsUndefined());
    865     }
    866826    TestObj* objArg = toTestObj(exec->argument(2));
    867     if (exec->hadException())
    868         return JSValue::encode(jsUndefined());
    869827
    870828
     
    893851    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    894852    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    895 
    896     if (exec->argumentCount() <= 0) {
    897         setDOMException(exec, TYPE_MISMATCH_ERR);
    898         return JSValue::encode(jsUndefined());
    899     }
    900853    int intArg = exec->argument(0).toInt32(exec);
    901     if (exec->hadException())
    902         return JSValue::encode(jsUndefined());
    903 
    904     if (exec->argumentCount() <= 1) {
    905         setDOMException(exec, TYPE_MISMATCH_ERR);
    906         return JSValue::encode(jsUndefined());
    907     }
    908854    const String& strArg = ustringToString(exec->argument(1).toString(exec));
    909     if (exec->hadException())
    910         return JSValue::encode(jsUndefined());
    911 
    912     if (exec->argumentCount() <= 2) {
    913         setDOMException(exec, TYPE_MISMATCH_ERR);
    914         return JSValue::encode(jsUndefined());
    915     }
    916855    TestObj* objArg = toTestObj(exec->argument(2));
    917     if (exec->hadException())
    918         return JSValue::encode(jsUndefined());
    919856
    920857
     
    932869    if (exec->argumentCount() < 2)
    933870        return JSValue::encode(jsUndefined());
    934 
    935     if (exec->argumentCount() <= 0) {
    936         setDOMException(exec, TYPE_MISMATCH_ERR);
    937         return JSValue::encode(jsUndefined());
    938     }
    939871    const String& strArg = ustringToString(exec->argument(0).toString(exec));
    940     if (exec->hadException())
    941         return JSValue::encode(jsUndefined());
    942 
    943     if (exec->argumentCount() <= 1) {
    944         setDOMException(exec, TYPE_MISMATCH_ERR);
    945         return JSValue::encode(jsUndefined());
    946     }
    947872    TestObj* objArg = toTestObj(exec->argument(1));
    948     if (exec->hadException())
    949         return JSValue::encode(jsUndefined());
    950873
    951874
     
    964887        return throwVMError(exec, createSyntaxError(exec, "Not enough arguments"));
    965888    ExceptionCode ec = 0;
    966 
    967     if (exec->argumentCount() <= 0) {
    968         setDOMException(exec, TYPE_MISMATCH_ERR);
    969         return JSValue::encode(jsUndefined());
    970     }
    971889    const String& strArg = ustringToString(exec->argument(0).toString(exec));
    972     if (exec->hadException())
    973         return JSValue::encode(jsUndefined());
    974 
    975     if (exec->argumentCount() <= 1) {
    976         setDOMException(exec, TYPE_MISMATCH_ERR);
    977         return JSValue::encode(jsUndefined());
    978     }
    979890    TestObj* objArg = toTestObj(exec->argument(1));
    980     if (exec->hadException())
    981         return JSValue::encode(jsUndefined());
    982891
    983892
     
    994903    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    995904    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    996 
    997     if (exec->argumentCount() <= 0) {
    998         setDOMException(exec, TYPE_MISMATCH_ERR);
    999         return JSValue::encode(jsUndefined());
    1000     }
    1001905    RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(exec, exec->argument(0));
    1002     if (exec->hadException())
    1003         return JSValue::encode(jsUndefined());
    1004906
    1005907    imp->serializedValue(serializedArg);
     
    1014916    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    1015917    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    1016 
    1017     if (exec->argumentCount() <= 0) {
    1018         setDOMException(exec, TYPE_MISMATCH_ERR);
    1019         return JSValue::encode(jsUndefined());
    1020     }
    1021918    RefPtr<IDBKey> key = createIDBKeyFromValue(exec, exec->argument(0));
    1022     if (exec->hadException())
    1023         return JSValue::encode(jsUndefined());
    1024919
    1025920    imp->idbKey(key);
     
    1068963    ExceptionCode ec = 0;
    1069964    ScriptCallStack callStack(exec, 1);
    1070 
    1071     if (exec->argumentCount() <= 0) {
    1072         setDOMException(exec, TYPE_MISMATCH_ERR);
    1073         return JSValue::encode(jsUndefined());
    1074     }
    1075965    log* intArg = tolog(exec->argument(0));
    1076     if (exec->hadException())
    1077         return JSValue::encode(jsUndefined());
    1078966
    1079967    imp->customArgsAndException(intArg, &callStack, ec);
     
    11351023    if (!dynamicFrame)
    11361024        return JSValue::encode(jsUndefined());
    1137 
    1138     if (exec->argumentCount() <= 0) {
    1139         setDOMException(exec, TYPE_MISMATCH_ERR);
    1140         return JSValue::encode(jsUndefined());
    1141     }
    11421025    int intArg = exec->argument(0).toInt32(exec);
    1143     if (exec->hadException())
    1144         return JSValue::encode(jsUndefined());
    11451026
    11461027    imp->withDynamicFrameAndArg(dynamicFrame, intArg);
     
    11581039    if (!dynamicFrame)
    11591040        return JSValue::encode(jsUndefined());
    1160 
    1161     if (exec->argumentCount() <= 0) {
    1162         setDOMException(exec, TYPE_MISMATCH_ERR);
     1041    int intArg = exec->argument(0).toInt32(exec);
     1042
     1043    int argsCount = exec->argumentCount();
     1044    if (argsCount < 2) {
     1045        imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg);
    11631046        return JSValue::encode(jsUndefined());
    11641047    }
    1165     int intArg = exec->argument(0).toInt32(exec);
    1166     if (exec->hadException())
    1167         return JSValue::encode(jsUndefined());
    1168 
    1169     int argsCount = exec->argumentCount();
    1170     if (argsCount <= 1) {
    1171         imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg);
    1172         return JSValue::encode(jsUndefined());
    1173     }
     1048
    11741049    int optionalArg = exec->argument(1).toInt32(exec);
    1175     if (exec->hadException())
    1176         return JSValue::encode(jsUndefined());
    11771050
    11781051    imp->withDynamicFrameAndOptionalArg(dynamicFrame, intArg, optionalArg);
     
    11901063    if (!dynamicFrame)
    11911064        return JSValue::encode(jsUndefined());
    1192 
    1193     if (exec->argumentCount() <= 0) {
    1194         setDOMException(exec, TYPE_MISMATCH_ERR);
    1195         return JSValue::encode(jsUndefined());
    1196     }
    11971065    int intArg = exec->argument(0).toInt32(exec);
    1198     if (exec->hadException())
    1199         return JSValue::encode(jsUndefined());
    12001066
    12011067    imp->withDynamicFrameAndUserGesture(dynamicFrame, intArg, processingUserGesture(exec));
     
    12131079    if (!dynamicFrame)
    12141080        return JSValue::encode(jsUndefined());
    1215 
    1216     if (exec->argumentCount() <= 0) {
    1217         setDOMException(exec, TYPE_MISMATCH_ERR);
     1081    int intArg = exec->argument(0).toInt32(exec);
     1082
     1083    int argsCount = exec->argumentCount();
     1084    if (argsCount < 2) {
     1085        imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg);
    12181086        return JSValue::encode(jsUndefined());
    12191087    }
    1220     int intArg = exec->argument(0).toInt32(exec);
    1221     if (exec->hadException())
    1222         return JSValue::encode(jsUndefined());
    1223 
    1224     int argsCount = exec->argumentCount();
    1225     if (argsCount <= 1) {
    1226         imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg);
    1227         return JSValue::encode(jsUndefined());
    1228     }
     1088
    12291089    int optionalArg = exec->argument(1).toInt32(exec);
    1230     if (exec->hadException())
    1231         return JSValue::encode(jsUndefined());
    12321090
    12331091    imp->withDynamicFrameAndUserGestureASAD(dynamicFrame, intArg, optionalArg, processingUserGesture(exec));
     
    13171175
    13181176    int argsCount = exec->argumentCount();
    1319     if (argsCount <= 0) {
     1177    if (argsCount < 1) {
    13201178        imp->methodWithOptionalArg();
    13211179        return JSValue::encode(jsUndefined());
    13221180    }
     1181
    13231182    int opt = exec->argument(0).toInt32(exec);
    1324     if (exec->hadException())
    1325         return JSValue::encode(jsUndefined());
    13261183
    13271184    imp->methodWithOptionalArg(opt);
     
    13361193    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    13371194    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    1338 
    1339     if (exec->argumentCount() <= 0) {
     1195    int nonOpt = exec->argument(0).toInt32(exec);
     1196
     1197    int argsCount = exec->argumentCount();
     1198    if (argsCount < 2) {
     1199        imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
     1200        return JSValue::encode(jsUndefined());
     1201    }
     1202
     1203    int opt = exec->argument(1).toInt32(exec);
     1204
     1205    imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
     1206    return JSValue::encode(jsUndefined());
     1207}
     1208
     1209EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec)
     1210{
     1211    JSValue thisValue = exec->hostThisValue();
     1212    if (!thisValue.inherits(&JSTestObj::s_info))
     1213        return throwVMTypeError(exec);
     1214    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
     1215    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
     1216    int nonOpt = exec->argument(0).toInt32(exec);
     1217
     1218    int argsCount = exec->argumentCount();
     1219    if (argsCount < 2) {
     1220        imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
     1221        return JSValue::encode(jsUndefined());
     1222    }
     1223
     1224    int opt1 = exec->argument(1).toInt32(exec);
     1225    int opt2 = exec->argument(2).toInt32(exec);
     1226
     1227    imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
     1228    return JSValue::encode(jsUndefined());
     1229}
     1230
     1231EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(ExecState* exec)
     1232{
     1233    JSValue thisValue = exec->hostThisValue();
     1234    if (!thisValue.inherits(&JSTestObj::s_info))
     1235        return throwVMTypeError(exec);
     1236    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
     1237    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
     1238    if (exec->argumentCount() <= 0 || !exec->argument(0).isObject()) {
    13401239        setDOMException(exec, TYPE_MISMATCH_ERR);
    1341         return JSValue::encode(jsUndefined());
     1240        return jsUndefined();
    13421241    }
    1343     int nonOpt = exec->argument(0).toInt32(exec);
    1344     if (exec->hadException())
    1345         return JSValue::encode(jsUndefined());
     1242    RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
     1243
     1244    imp->methodWithCallbackArg(callback);
     1245    return JSValue::encode(jsUndefined());
     1246}
     1247
     1248EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(ExecState* exec)
     1249{
     1250    JSValue thisValue = exec->hostThisValue();
     1251    if (!thisValue.inherits(&JSTestObj::s_info))
     1252        return throwVMTypeError(exec);
     1253    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
     1254    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
     1255    int nonCallback = exec->argument(0).toInt32(exec);
     1256    if (exec->argumentCount() <= 1 || !exec->argument(1).isObject()) {
     1257        setDOMException(exec, TYPE_MISMATCH_ERR);
     1258        return jsUndefined();
     1259    }
     1260    RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(1)), castedThis->globalObject());
     1261
     1262    imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
     1263    return JSValue::encode(jsUndefined());
     1264}
     1265
     1266EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(ExecState* exec)
     1267{
     1268    JSValue thisValue = exec->hostThisValue();
     1269    if (!thisValue.inherits(&JSTestObj::s_info))
     1270        return throwVMTypeError(exec);
     1271    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
     1272    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    13461273
    13471274    int argsCount = exec->argumentCount();
    1348     if (argsCount <= 1) {
    1349         imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
     1275    if (argsCount < 1) {
     1276        imp->methodWithCallbackAndOptionalArg();
    13501277        return JSValue::encode(jsUndefined());
    13511278    }
    1352     int opt = exec->argument(1).toInt32(exec);
    1353     if (exec->hadException())
    1354         return JSValue::encode(jsUndefined());
    1355 
    1356     imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
    1357     return JSValue::encode(jsUndefined());
    1358 }
    1359 
    1360 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonOptionalArgAndTwoOptionalArgs(ExecState* exec)
    1361 {
    1362     JSValue thisValue = exec->hostThisValue();
    1363     if (!thisValue.inherits(&JSTestObj::s_info))
    1364         return throwVMTypeError(exec);
    1365     JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    1366     TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    1367 
    1368     if (exec->argumentCount() <= 0) {
     1279
     1280    if (exec->argumentCount() <= 0 || !exec->argument(0).isObject()) {
    13691281        setDOMException(exec, TYPE_MISMATCH_ERR);
    1370         return JSValue::encode(jsUndefined());
     1282        return jsUndefined();
    13711283    }
    1372     int nonOpt = exec->argument(0).toInt32(exec);
    1373     if (exec->hadException())
    1374         return JSValue::encode(jsUndefined());
     1284    RefPtr<TestCallback> callback = JSTestCallback::create(asObject(exec->argument(0)), castedThis->globalObject());
     1285
     1286    imp->methodWithCallbackAndOptionalArg(callback);
     1287    return JSValue::encode(jsUndefined());
     1288}
     1289
     1290static 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
     1304static 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));
    13751312
    13761313    int argsCount = exec->argumentCount();
    1377     if (argsCount <= 1) {
    1378         imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
     1314    if (argsCount < 2) {
     1315        imp->overloadedMethod(objArg);
    13791316        return JSValue::encode(jsUndefined());
    13801317    }
    1381     int opt1 = exec->argument(1).toInt32(exec);
    1382     if (exec->hadException())
    1383         return JSValue::encode(jsUndefined());
    1384 
    1385     if (argsCount <= 2) {
    1386         imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1);
    1387         return JSValue::encode(jsUndefined());
    1388     }
    1389     int opt2 = exec->argument(2).toInt32(exec);
    1390     if (exec->hadException())
    1391         return JSValue::encode(jsUndefined());
    1392 
    1393     imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
    1394     return JSValue::encode(jsUndefined());
    1395 }
    1396 
    1397 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(ExecState* exec)
    1398 {
    1399     JSValue thisValue = exec->hostThisValue();
    1400     if (!thisValue.inherits(&JSTestObj::s_info))
    1401         return throwVMTypeError(exec);
    1402     JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    1403     TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    1404 
    1405     if (exec->argumentCount() <= 0) {
    1406         setDOMException(exec, TYPE_MISMATCH_ERR);
    1407         return JSValue::encode(jsUndefined());
    1408     }
    1409     if (!exec->argument(0).isObject() || !exec->argument(0).getObject()) {
    1410         setDOMException(exec, TYPE_MISMATCH_ERR);
    1411         return JSValue::encode(jsUndefined());
    1412     }
    1413     RefPtr<TestCallback> callback = JSTestCallback::create(exec->argument(0).getObject(), castedThis->globalObject());
    1414 
    1415     imp->methodWithCallbackArg(callback);
    1416     return JSValue::encode(jsUndefined());
    1417 }
    1418 
    1419 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(ExecState* exec)
    1420 {
    1421     JSValue thisValue = exec->hostThisValue();
    1422     if (!thisValue.inherits(&JSTestObj::s_info))
    1423         return throwVMTypeError(exec);
    1424     JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    1425     TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    1426 
    1427     if (exec->argumentCount() <= 0) {
    1428         setDOMException(exec, TYPE_MISMATCH_ERR);
    1429         return JSValue::encode(jsUndefined());
    1430     }
    1431     int nonCallback = exec->argument(0).toInt32(exec);
    1432     if (exec->hadException())
    1433         return JSValue::encode(jsUndefined());
    1434 
    1435     if (exec->argumentCount() <= 1) {
    1436         setDOMException(exec, TYPE_MISMATCH_ERR);
    1437         return JSValue::encode(jsUndefined());
    1438     }
    1439     if (!exec->argument(1).isObject() || !exec->argument(1).getObject()) {
    1440         setDOMException(exec, TYPE_MISMATCH_ERR);
    1441         return JSValue::encode(jsUndefined());
    1442     }
    1443     RefPtr<TestCallback> callback = JSTestCallback::create(exec->argument(1).getObject(), castedThis->globalObject());
    1444 
    1445     imp->methodWithNonCallbackArgAndCallbackArg(nonCallback, callback);
    1446     return JSValue::encode(jsUndefined());
    1447 }
    1448 
    1449 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackAndOptionalArg(ExecState* exec)
    1450 {
    1451     JSValue thisValue = exec->hostThisValue();
    1452     if (!thisValue.inherits(&JSTestObj::s_info))
    1453         return throwVMTypeError(exec);
    1454     JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    1455     TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    1456 
    1457     RefPtr<TestCallback> callback;
    1458     if (exec->argumentCount() > 0 && exec->argument(0).isObject()) {
    1459         JSObject* object = exec->argument(0).getObject();
    1460         if (!object) {
    1461             setDOMException(exec, TYPE_MISMATCH_ERR);
    1462             return JSValue::encode(jsUndefined());
    1463         }
    1464         callback = JSTestCallback::create(object, castedThis->globalObject());
    1465     }
    1466 
    1467     imp->methodWithCallbackAndOptionalArg(callback);
    1468     return JSValue::encode(jsUndefined());
    1469 }
    1470 
    1471 static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod1(ExecState* exec)
    1472 {
    1473     JSValue thisValue = exec->hostThisValue();
    1474     if (!thisValue.inherits(&JSTestObj::s_info))
    1475         return throwVMTypeError(exec);
    1476     JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    1477     TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    1478 
    1479     if (exec->argumentCount() <= 0) {
    1480         setDOMException(exec, TYPE_MISMATCH_ERR);
    1481         return JSValue::encode(jsUndefined());
    1482     }
    1483     TestObj* objArg = toTestObj(exec->argument(0));
    1484     if (exec->hadException())
    1485         return JSValue::encode(jsUndefined());
    1486 
    1487     if (exec->argumentCount() <= 1) {
    1488         setDOMException(exec, TYPE_MISMATCH_ERR);
    1489         return JSValue::encode(jsUndefined());
    1490     }
    1491     const String& strArg = ustringToString(exec->argument(1).toString(exec));
    1492     if (exec->hadException())
    1493         return JSValue::encode(jsUndefined());
    1494 
    1495     imp->overloadedMethod(objArg, strArg);
    1496     return JSValue::encode(jsUndefined());
    1497 }
    1498 
    1499 static EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionOverloadedMethod2(ExecState* exec)
    1500 {
    1501     JSValue thisValue = exec->hostThisValue();
    1502     if (!thisValue.inherits(&JSTestObj::s_info))
    1503         return throwVMTypeError(exec);
    1504     JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    1505     TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    1506 
    1507     if (exec->argumentCount() <= 0) {
    1508         setDOMException(exec, TYPE_MISMATCH_ERR);
    1509         return JSValue::encode(jsUndefined());
    1510     }
    1511     TestObj* objArg = toTestObj(exec->argument(0));
    1512     if (exec->hadException())
    1513         return JSValue::encode(jsUndefined());
    1514 
    1515     int argsCount = exec->argumentCount();
    1516     if (argsCount <= 1) {
    1517         imp->overloadedMethod(objArg);
    1518         return JSValue::encode(jsUndefined());
    1519     }
     1318
    15201319    int intArg = exec->argument(1).toInt32(exec);
    1521     if (exec->hadException())
    1522         return JSValue::encode(jsUndefined());
    15231320
    15241321    imp->overloadedMethod(objArg, intArg);
     
    15331330    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    15341331    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    1535 
    1536     if (exec->argumentCount() <= 0) {
    1537         setDOMException(exec, TYPE_MISMATCH_ERR);
    1538         return JSValue::encode(jsUndefined());
    1539     }
    15401332    const String& strArg = ustringToString(exec->argument(0).toString(exec));
    1541     if (exec->hadException())
    1542         return JSValue::encode(jsUndefined());
    15431333
    15441334    imp->overloadedMethod(strArg);
     
    15531343    JSTestObj* castedThis = static_cast<JSTestObj*>(asObject(thisValue));
    15541344    TestObj* imp = static_cast<TestObj*>(castedThis->impl());
    1555 
    1556     if (exec->argumentCount() <= 0) {
    1557         setDOMException(exec, TYPE_MISMATCH_ERR);
    1558         return JSValue::encode(jsUndefined());
    1559     }
    15601345    int intArg = exec->argument(0).toInt32(exec);
    1561     if (exec->hadException())
    1562         return JSValue::encode(jsUndefined());
    15631346
    15641347    imp->overloadedMethod(intArg);
  • trunk/WebCore/bindings/scripts/test/TestObj.idl

    r64835 r64840  
    113113        void    methodWithOptionalArg(in [Optional] long opt);
    114114        void    methodWithNonOptionalArgAndOptionalArg(in long nonOpt, in [Optional] long opt);
    115         void    methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [Optional] long opt1, in [Optional] long opt2);
     115        void    methodWithNonOptionalArgAndTwoOptionalArgs(in long nonOpt, in [Optional] long opt1, in long opt2);
    116116
    117117#if defined(TESTING_V8) || defined(TESTING_JS)
  • trunk/WebCore/bindings/scripts/test/V8/V8TestObj.cpp

    r64835 r64840  
    3030#include "SerializedScriptValue.h"
    3131#include "V8Binding.h"
    32 #include "V8BindingMacros.h"
    3332#include "V8BindingState.h"
    3433#include "V8DOMWrapper.h"
     
    558557    INC_STATS("DOM.TestObj.voidMethodWithArgs");
    559558    TestObj* imp = V8TestObj::toNative(args.Holder());
    560     if (args.Length() <= 0)
    561         return throwError(TYPE_MISMATCH_ERR);
    562     EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
    563     if (args.Length() <= 1)
    564         return throwError(TYPE_MISMATCH_ERR);
     559    int intArg = toInt32(args[0]);
    565560    V8Parameter<> strArg = args[1];
    566     if (args.Length() <= 2)
    567         return throwError(TYPE_MISMATCH_ERR);
    568     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0);
     561    TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0;
    569562    imp->voidMethodWithArgs(intArg, strArg, objArg);
    570563    return v8::Handle<v8::Value>();
     
    582575    INC_STATS("DOM.TestObj.intMethodWithArgs");
    583576    TestObj* imp = V8TestObj::toNative(args.Holder());
    584     if (args.Length() <= 0)
    585         return throwError(TYPE_MISMATCH_ERR);
    586     EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
    587     if (args.Length() <= 1)
    588         return throwError(TYPE_MISMATCH_ERR);
     577    int intArg = toInt32(args[0]);
    589578    V8Parameter<> strArg = args[1];
    590     if (args.Length() <= 2)
    591         return throwError(TYPE_MISMATCH_ERR);
    592     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0);
     579    TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0;
    593580    return v8::Integer::New(imp->intMethodWithArgs(intArg, strArg, objArg));
    594581}
     
    605592    INC_STATS("DOM.TestObj.objMethodWithArgs");
    606593    TestObj* imp = V8TestObj::toNative(args.Holder());
    607     if (args.Length() <= 0)
    608         return throwError(TYPE_MISMATCH_ERR);
    609     EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
    610     if (args.Length() <= 1)
    611         return throwError(TYPE_MISMATCH_ERR);
     594    int intArg = toInt32(args[0]);
    612595    V8Parameter<> strArg = args[1];
    613     if (args.Length() <= 2)
    614         return throwError(TYPE_MISMATCH_ERR);
    615     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0);
     596    TestObj* objArg = V8TestObj::HasInstance(args[2]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[2])) : 0;
    616597    return toV8(imp->objMethodWithArgs(intArg, strArg, objArg));
    617598}
     
    623604        return v8::Handle<v8::Value>();
    624605    TestObj* imp = V8TestObj::toNative(args.Holder());
    625     if (args.Length() <= 0)
    626         return throwError(TYPE_MISMATCH_ERR);
    627606    V8Parameter<> strArg = args[0];
    628     if (args.Length() <= 1)
    629         return throwError(TYPE_MISMATCH_ERR);
    630     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0);
     607    TestObj* objArg = V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
    631608    return toV8(imp->methodThatRequiresAllArgs(strArg, objArg));
    632609}
     
    640617    ExceptionCode ec = 0;
    641618    {
    642     if (args.Length() <= 0)
    643         return throwError(TYPE_MISMATCH_ERR);
    644619    V8Parameter<> strArg = args[0];
    645     if (args.Length() <= 1)
    646         return throwError(TYPE_MISMATCH_ERR);
    647     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0);
     620    TestObj* objArg = V8TestObj::HasInstance(args[1]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[1])) : 0;
    648621    RefPtr<TestObj> result = imp->methodThatRequiresAllArgsAndThrows(strArg, objArg, ec);
    649622    if (UNLIKELY(ec))
     
    660633    INC_STATS("DOM.TestObj.serializedValue");
    661634    TestObj* imp = V8TestObj::toNative(args.Holder());
    662     if (args.Length() <= 0)
    663         return throwError(TYPE_MISMATCH_ERR);
    664635    bool serializedArgDidThrow = false;
    665636    RefPtr<SerializedScriptValue> serializedArg = SerializedScriptValue::create(args[0], serializedArgDidThrow);
     
    674645    INC_STATS("DOM.TestObj.idbKey");
    675646    TestObj* imp = V8TestObj::toNative(args.Holder());
    676     if (args.Length() <= 0)
    677         return throwError(TYPE_MISMATCH_ERR);
    678     EXCEPTION_BLOCK(RefPtr<IDBKey>, key, createIDBKeyFromValue(args[0]));
     647    RefPtr<IDBKey> key = createIDBKeyFromValue(args[0]);
    679648    imp->idbKey(key);
    680649    return v8::Handle<v8::Value>();
     
    706675    if (!callStack)
    707676        return v8::Undefined();
    708     if (args.Length() <= 0)
    709         return throwError(TYPE_MISMATCH_ERR);
    710     EXCEPTION_BLOCK(log*, intArg, V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
     677    log* intArg = V8log::HasInstance(args[0]) ? V8log::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    711678    imp->customArgsAndException(intArg, callStack.get(), ec);
    712679    if (UNLIKELY(ec))
     
    756723    INC_STATS("DOM.TestObj.withDynamicFrameAndArg");
    757724    TestObj* imp = V8TestObj::toNative(args.Holder());
    758     if (args.Length() <= 0)
    759         return throwError(TYPE_MISMATCH_ERR);
    760     EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
     725    int intArg = toInt32(args[0]);
    761726    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
    762727    if (!enteredFrame)
     
    770735    INC_STATS("DOM.TestObj.withDynamicFrameAndOptionalArg");
    771736    TestObj* imp = V8TestObj::toNative(args.Holder());
    772     if (args.Length() <= 0)
    773         return throwError(TYPE_MISMATCH_ERR);
    774     EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
     737    int intArg = toInt32(args[0]);
    775738    if (args.Length() <= 1) {
    776739        Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
     
    780743        return v8::Handle<v8::Value>();
    781744    }
    782     EXCEPTION_BLOCK(int, optionalArg, toInt32(args[1]));
     745    int optionalArg = toInt32(args[1]);
    783746    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
    784747    if (!enteredFrame)
     
    792755    INC_STATS("DOM.TestObj.withDynamicFrameAndUserGesture");
    793756    TestObj* imp = V8TestObj::toNative(args.Holder());
    794     if (args.Length() <= 0)
    795         return throwError(TYPE_MISMATCH_ERR);
    796     EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
     757    int intArg = toInt32(args[0]);
    797758    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
    798759    if (!enteredFrame)
     
    806767    INC_STATS("DOM.TestObj.withDynamicFrameAndUserGestureASAD");
    807768    TestObj* imp = V8TestObj::toNative(args.Holder());
    808     if (args.Length() <= 0)
    809         return throwError(TYPE_MISMATCH_ERR);
    810     EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
     769    int intArg = toInt32(args[0]);
    811770    if (args.Length() <= 1) {
    812771        Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
     
    816775        return v8::Handle<v8::Value>();
    817776    }
    818     EXCEPTION_BLOCK(int, optionalArg, toInt32(args[1]));
     777    int optionalArg = toInt32(args[1]);
    819778    Frame* enteredFrame = V8Proxy::retrieveFrameForEnteredContext();
    820779    if (!enteredFrame)
     
    903862        return v8::Handle<v8::Value>();
    904863    }
    905     EXCEPTION_BLOCK(int, opt, toInt32(args[0]));
     864    int opt = toInt32(args[0]);
    906865    imp->methodWithOptionalArg(opt);
    907866    return v8::Handle<v8::Value>();
     
    912871    INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndOptionalArg");
    913872    TestObj* imp = V8TestObj::toNative(args.Holder());
    914     if (args.Length() <= 0)
    915         return throwError(TYPE_MISMATCH_ERR);
    916     EXCEPTION_BLOCK(int, nonOpt, toInt32(args[0]));
     873    int nonOpt = toInt32(args[0]);
    917874    if (args.Length() <= 1) {
    918875        imp->methodWithNonOptionalArgAndOptionalArg(nonOpt);
    919876        return v8::Handle<v8::Value>();
    920877    }
    921     EXCEPTION_BLOCK(int, opt, toInt32(args[1]));
     878    int opt = toInt32(args[1]);
    922879    imp->methodWithNonOptionalArgAndOptionalArg(nonOpt, opt);
    923880    return v8::Handle<v8::Value>();
     
    928885    INC_STATS("DOM.TestObj.methodWithNonOptionalArgAndTwoOptionalArgs");
    929886    TestObj* imp = V8TestObj::toNative(args.Holder());
    930     if (args.Length() <= 0)
    931         return throwError(TYPE_MISMATCH_ERR);
    932     EXCEPTION_BLOCK(int, nonOpt, toInt32(args[0]));
     887    int nonOpt = toInt32(args[0]);
    933888    if (args.Length() <= 1) {
    934889        imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt);
    935890        return v8::Handle<v8::Value>();
    936891    }
    937     EXCEPTION_BLOCK(int, opt1, toInt32(args[1]));
    938     if (args.Length() <= 2) {
    939         imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1);
    940         return v8::Handle<v8::Value>();
    941     }
    942     EXCEPTION_BLOCK(int, opt2, toInt32(args[2]));
     892    int opt1 = toInt32(args[1]);
     893    int opt2 = toInt32(args[2]);
    943894    imp->methodWithNonOptionalArgAndTwoOptionalArgs(nonOpt, opt1, opt2);
    944895    return v8::Handle<v8::Value>();
     
    949900    INC_STATS("DOM.TestObj.methodWithCallbackArg");
    950901    TestObj* imp = V8TestObj::toNative(args.Holder());
    951     if (args.Length() <= 0)
    952         return throwError(TYPE_MISMATCH_ERR);
    953     if (!args[0]->IsObject())
     902    if (args.Length() <= 0 || !args[0]->IsObject())
    954903        return throwError(TYPE_MISMATCH_ERR);
    955904    RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
     
    962911    INC_STATS("DOM.TestObj.methodWithNonCallbackArgAndCallbackArg");
    963912    TestObj* imp = V8TestObj::toNative(args.Holder());
    964     if (args.Length() <= 0)
    965         return throwError(TYPE_MISMATCH_ERR);
    966     EXCEPTION_BLOCK(int, nonCallback, toInt32(args[0]));
    967     if (args.Length() <= 1)
    968         return throwError(TYPE_MISMATCH_ERR);
    969     if (!args[1]->IsObject())
     913    int nonCallback = toInt32(args[0]);
     914    if (args.Length() <= 1 || !args[1]->IsObject())
    970915        return throwError(TYPE_MISMATCH_ERR);
    971916    RefPtr<TestCallback> callback = V8TestCallback::create(args[1], getScriptExecutionContext());
     
    978923    INC_STATS("DOM.TestObj.methodWithCallbackAndOptionalArg");
    979924    TestObj* imp = V8TestObj::toNative(args.Holder());
    980     RefPtr<TestCallback> callback;
    981     if (args.Length() > 0 && args[0]->IsObject())
    982         callback = V8TestCallback::create(args[0], getScriptExecutionContext());
     925    if (args.Length() <= 0) {
     926        imp->methodWithCallbackAndOptionalArg();
     927        return v8::Handle<v8::Value>();
     928    }
     929    if (args.Length() <= 0 || !args[0]->IsObject())
     930        return throwError(TYPE_MISMATCH_ERR);
     931    RefPtr<TestCallback> callback = V8TestCallback::create(args[0], getScriptExecutionContext());
    983932    imp->methodWithCallbackAndOptionalArg(callback);
    984933    return v8::Handle<v8::Value>();
     
    989938    INC_STATS("DOM.TestObj.overloadedMethod1");
    990939    TestObj* imp = V8TestObj::toNative(args.Holder());
    991     if (args.Length() <= 0)
    992         return throwError(TYPE_MISMATCH_ERR);
    993     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
    994     if (args.Length() <= 1)
    995         return throwError(TYPE_MISMATCH_ERR);
     940    TestObj* objArg = V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    996941    V8Parameter<> strArg = args[1];
    997942    imp->overloadedMethod(objArg, strArg);
     
    1003948    INC_STATS("DOM.TestObj.overloadedMethod2");
    1004949    TestObj* imp = V8TestObj::toNative(args.Holder());
    1005     if (args.Length() <= 0)
    1006         return throwError(TYPE_MISMATCH_ERR);
    1007     EXCEPTION_BLOCK(TestObj*, objArg, V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0);
     950    TestObj* objArg = V8TestObj::HasInstance(args[0]) ? V8TestObj::toNative(v8::Handle<v8::Object>::Cast(args[0])) : 0;
    1008951    if (args.Length() <= 1) {
    1009952        imp->overloadedMethod(objArg);
    1010953        return v8::Handle<v8::Value>();
    1011954    }
    1012     EXCEPTION_BLOCK(int, intArg, toInt32(args[1]));
     955    int intArg = toInt32(args[1]);
    1013956    imp->overloadedMethod(objArg, intArg);
    1014957    return v8::Handle<v8::Value>();
     
    1019962    INC_STATS("DOM.TestObj.overloadedMethod3");
    1020963    TestObj* imp = V8TestObj::toNative(args.Holder());
    1021     if (args.Length() <= 0)
    1022         return throwError(TYPE_MISMATCH_ERR);
    1023964    V8Parameter<> strArg = args[0];
    1024965    imp->overloadedMethod(strArg);
     
    1030971    INC_STATS("DOM.TestObj.overloadedMethod4");
    1031972    TestObj* imp = V8TestObj::toNative(args.Holder());
    1032     if (args.Length() <= 0)
    1033         return throwError(TYPE_MISMATCH_ERR);
    1034     EXCEPTION_BLOCK(int, intArg, toInt32(args[0]));
     973    int intArg = toInt32(args[0]);
    1035974    imp->overloadedMethod(intArg);
    1036975    return v8::Handle<v8::Value>();
     
    11501089    {"methodWithNonOptionalArgAndOptionalArg", TestObjInternal::methodWithNonOptionalArgAndOptionalArgCallback},
    11511090    {"methodWithNonOptionalArgAndTwoOptionalArgs", TestObjInternal::methodWithNonOptionalArgAndTwoOptionalArgsCallback},
    1152     {"methodWithCallbackArg", TestObjInternal::methodWithCallbackArgCallback},
    1153     {"methodWithNonCallbackArgAndCallbackArg", TestObjInternal::methodWithNonCallbackArgAndCallbackArgCallback},
    11541091    {"methodWithCallbackAndOptionalArg", TestObjInternal::methodWithCallbackAndOptionalArgCallback},
    11551092    {"overloadedMethod", TestObjInternal::overloadedMethodCallback},
     
    12251162    v8::Handle<v8::Signature> customArgsAndExceptionSignature = v8::Signature::New(desc, customArgsAndExceptionArgc, customArgsAndExceptionArgv);
    12261163    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));
    12271176    batchConfigureConstants(desc, proto, TestObjConsts, sizeof(TestObjConsts) / sizeof(*TestObjConsts));
    12281177
  • trunk/WebCore/bindings/v8/V8Binding.h

    r64835 r64840  
    3434#include "AtomicString.h"
    3535#include "BindingSecurity.h"
    36 #include "ExceptionCode.h"
    3736#include "MathExtras.h"
    3837#include "PlatformString.h"
    3938#include "V8DOMWrapper.h"
    40 #include "V8Proxy.h"
    4139
    4240#include <v8.h>
     
    228226    };
    229227   
    230     template<> inline V8Parameter<DefaultMode>::operator String()
    231     {
    232         String result;
    233         v8::TryCatch block;
    234         result = toWebCoreString(m_v8Object);
    235         if (block.HasCaught()) {
    236             V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
    237             return String();
    238         }
    239         return result;
    240     }
    241     template<> inline V8Parameter<WithNullCheck>::operator String()
    242     {
    243         String result;
    244         v8::TryCatch block;
    245         result = toWebCoreStringWithNullCheck(m_v8Object);
    246         if (block.HasCaught()) {
    247             V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
    248             return String();
    249         }
    250         return result;
    251     }
    252     template<> inline V8Parameter<WithUndefinedOrNullCheck>::operator String()
    253     {
    254         String result;
    255         v8::TryCatch block;
    256         result = toWebCoreStringWithNullOrUndefinedCheck(m_v8Object);
    257         if (block.HasCaught()) {
    258             V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
    259             return String();
    260         }
    261         return result;
    262     }
    263 
    264     template<> inline V8Parameter<DefaultMode>::operator AtomicString()
    265     {
    266         AtomicString result;
    267         v8::TryCatch block;
    268         result = v8ValueToAtomicWebCoreString(m_v8Object);
    269         if (block.HasCaught()) {
    270             V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
    271             return AtomicString();
    272         }
    273         return result;
    274     }
    275     template<> inline V8Parameter<WithNullCheck>::operator AtomicString()
    276     {
    277         AtomicString result;
    278         v8::TryCatch block;
    279         result = toAtomicWebCoreStringWithNullCheck(m_v8Object);
    280         if (block.HasCaught()) {
    281             V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
    282             return AtomicString();
    283         }
    284         return result;
    285     }
    286     template<> inline V8Parameter<WithUndefinedOrNullCheck>::operator AtomicString()
    287     {
    288         AtomicString result;
    289         v8::TryCatch block;
    290         result = toAtomicWebCoreStringWithNullCheck(m_v8Object);
    291         if (block.HasCaught()) {
    292             V8Proxy::setDOMException(TYPE_MISMATCH_ERR);
    293             return AtomicString();
    294         }
    295         return result;
    296     }
     228    template<> inline V8Parameter<DefaultMode>::operator String() { return toWebCoreString(m_v8Object); }
     229    template<> inline V8Parameter<WithNullCheck>::operator String() { return toWebCoreStringWithNullCheck(m_v8Object); }
     230    template<> inline V8Parameter<WithUndefinedOrNullCheck>::operator String() { return toWebCoreStringWithNullOrUndefinedCheck(m_v8Object); }
     231
     232    template<> inline V8Parameter<DefaultMode>::operator AtomicString() { return v8ValueToAtomicWebCoreString(m_v8Object); }
     233    template<> inline V8Parameter<WithNullCheck>::operator AtomicString() { return toAtomicWebCoreStringWithNullCheck(m_v8Object); }
     234    template<> inline V8Parameter<WithUndefinedOrNullCheck>::operator AtomicString() { return toAtomicWebCoreStringWithNullCheck(m_v8Object); }
    297235
    298236} // namespace WebCore
  • trunk/WebCore/bindings/v8/custom/V8DOMWindowCustom.cpp

    r64835 r64840  
    3333
    3434#include "Chrome.h"
     35#include "Database.h"
    3536#include "DOMTimer.h"
    3637#include "DOMWindow.h"
     
    5556#include "V8BindingState.h"
    5657#include "V8CustomEventListener.h"
     58#include "V8Database.h"
     59#include "V8DatabaseCallback.h"
    5760#include "V8GCForContextDispose.h"
    5861#include "V8HiddenPropertyName.h"
     
    788791}
    789792
     793#if ENABLE(DATABASE)
     794v8::Handle<v8::Value> V8DOMWindow::openDatabaseCallback(const v8::Arguments& args)
     795{
     796    INC_STATS("DOM.DOMWindow.openDatabase");
     797    if (args.Length() < 4)
     798        return throwError(SYNTAX_ERR);
     799
     800    TO_WEBCORE_STRING_EXCEPTION_BLOCK(name, args[0]);
     801    TO_WEBCORE_STRING_EXCEPTION_BLOCK(version, args[1]);
     802    TO_WEBCORE_STRING_EXCEPTION_BLOCK(displayName, args[2]);
     803    EXCEPTION_BLOCK(unsigned long, estimatedSize, args[3]->Uint32Value());
     804
     805    DOMWindow* imp = V8DOMWindow::toNative(args.Holder());
     806    if (!V8BindingSecurity::canAccessFrame(V8BindingState::Only(), imp->frame(), true))
     807        return v8::Undefined();
     808
     809    ScriptExecutionContext* scriptExecutionContext = getScriptExecutionContext();
     810    RefPtr<DatabaseCallback> creationCallback;
     811    if (args.Length() >= 5) {
     812        if (!args[4]->IsObject())
     813            return throwError(TYPE_MISMATCH_ERR);
     814
     815        creationCallback = V8DatabaseCallback::create(args[4], scriptExecutionContext);
     816    }
     817
     818    ExceptionCode ec = 0;
     819    v8::Handle<v8::Value> result = toV8(imp->openDatabase(name, version, displayName, estimatedSize, creationCallback.release(), ec));
     820
     821    V8Proxy::setDOMException(ec);
     822    return result;
     823}
     824#endif // ENABLE(DATABASE)
     825
    790826bool V8DOMWindow::namedSecurityCheck(v8::Local<v8::Object> host, v8::Local<v8::Value> key, v8::AccessType type, v8::Local<v8::Value>)
    791827{
  • trunk/WebCore/bindings/v8/custom/V8WorkerContextCustom.cpp

    r64835 r64840  
    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
    3642#include "DOMTimer.h"
    3743#include "ExceptionCode.h"
     
    138144}
    139145
     146#if ENABLE(DATABASE)
     147v8::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
     176v8::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
    140206} // namespace WebCore
    141207
  • trunk/WebCore/page/DOMWindow.idl

    r64835 r64840  
    161161#endif   
    162162#if defined(ENABLE_DATABASE) && ENABLE_DATABASE
    163         [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Optional, Callback] DatabaseCallback creationCallback)
     163        [EnabledAtRuntime, Custom] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback creationCallback)
    164164            raises(DOMException);
    165165#endif
  • trunk/WebCore/storage/Database.cpp

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

    r64835 r64840  
    6060    void changeVersion(const String& oldVersion, const String& newVersion, PassRefPtr<SQLTransactionCallback>,
    6161                       PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
    62     void transaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
    63     void readTransaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>, PassRefPtr<VoidCallback> successCallback);
     62    void transaction(PassRefPtr<SQLTransactionCallback>, PassRefPtr<SQLTransactionErrorCallback>,
     63                     PassRefPtr<VoidCallback> successCallback, bool readOnly);
    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);
    9593
    9694    bool openAndVerifyVersion(bool setVersionInNewDatabase, ExceptionCode&);
  • trunk/WebCore/storage/Database.idl

    r64835 r64840  
    3535    ] Database {
    3636        readonly attribute DOMString version;
    37         void changeVersion(in DOMString oldVersion, in DOMString newVersion, in [Optional, Callback] SQLTransactionCallback callback, in [Optional, Callback] SQLTransactionErrorCallback errorCallback, in [Optional, Callback] VoidCallback successCallback);
    38         void transaction(in [Callback] SQLTransactionCallback callback, in [Optional, Callback] SQLTransactionErrorCallback errorCallback, in [Optional, Callback] VoidCallback successCallback);
    39         void readTransaction(in [Callback] SQLTransactionCallback callback, in [Optional, Callback] SQLTransactionErrorCallback errorCallback, in [Optional, Callback] VoidCallback successCallback);
     37        [Custom] void changeVersion(in DOMString oldVersion, in DOMString newVersion, in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, in VoidCallback successCallback);
     38        [Custom] void transaction(in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, in VoidCallback successCallback);
     39        [Custom] void readTransaction(in SQLTransactionCallback callback, in SQLTransactionErrorCallback errorCallback, in VoidCallback successCallback);
    4040    };
    4141
  • trunk/WebCore/storage/DatabaseSync.cpp

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

    r64835 r64840  
    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>, ExceptionCode&);
    60     void readTransaction(PassRefPtr<SQLTransactionSyncCallback>, ExceptionCode&);
     59    void transaction(PassRefPtr<SQLTransactionSyncCallback>, bool readOnly, ExceptionCode&);
    6160
    6261    virtual void markAsDeletedAndClose();
     
    6665    DatabaseSync(ScriptExecutionContext*, const String& name, const String& expectedVersion,
    6766                 const String& displayName, unsigned long estimatedSize);
    68     void runTransaction(PassRefPtr<SQLTransactionSyncCallback>, bool readOnly, ExceptionCode&);
    6967};
    7068
  • trunk/WebCore/storage/DatabaseSync.idl

    r64835 r64840  
    3737    ] DatabaseSync {
    3838        readonly attribute DOMString version;
    39         void changeVersion(in DOMString oldVersion, in DOMString newVersion, in [Callback, Optional] SQLTransactionSyncCallback callback) raises(DOMException);
    40         void transaction(in [Callback] SQLTransactionSyncCallback callback) raises(DOMException);
    41         void readTransaction(in [Callback] SQLTransactionSyncCallback callback) raises(DOMException);
     39        [Custom] void changeVersion(in DOMString oldVersion, in DOMString newVersion, in SQLTransactionSyncCallback callback);
     40        [Custom] void transaction(in SQLTransactionSyncCallback callback);
     41        [Custom] void readTransaction(in SQLTransactionSyncCallback callback);
    4242    };
    4343
  • trunk/WebCore/workers/WorkerContext.idl

    r64835 r64840  
    5151                 attribute [Replaceable] WorkerNavigator navigator;
    5252#if defined(ENABLE_DATABASE) && ENABLE_DATABASE
    53         [EnabledAtRuntime] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Optional, Callback] DatabaseCallback creationCallback)
     53        [EnabledAtRuntime, Custom] Database openDatabase(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback creationCallback)
    5454            raises(DOMException);
    55         [EnabledAtRuntime] DatabaseSync openDatabaseSync(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in [Optional, Callback] DatabaseCallback creationCallback)
    56             raises(DOMException);
     55        [EnabledAtRuntime, Custom] DatabaseSync openDatabaseSync(in DOMString name, in DOMString version, in DOMString displayName, in unsigned long estimatedSize, in DatabaseCallback creationCallback);
    5756#endif
    5857
Note: See TracChangeset for help on using the changeset viewer.