Changeset 199970 in webkit
- Timestamp:
- Apr 24, 2016 5:27:30 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r199969 r199970 1 2016-04-24 Chris Dumez <cdumez@apple.com> 2 3 Autogenerated IDBFactory.open() does the wrong thing if you pass an explicit 'undefined' as the second argument 4 https://bugs.webkit.org/show_bug.cgi?id=156939 5 6 Reviewed by Darin Adler. 7 8 Update / rebaseline existing test now that passing undefined as second parameter to 9 IDBFactory.open() no longer throws. 10 11 * storage/indexeddb/intversion-bad-parameters-expected.txt: 12 * storage/indexeddb/intversion-bad-parameters-private-expected.txt: 13 * storage/indexeddb/resources/intversion-bad-parameters.js: 14 (deleteSuccess): 15 1 16 2016-04-23 Chris Dumez <cdumez@apple.com> 2 17 -
trunk/LayoutTests/imported/w3c/ChangeLog
r199969 r199970 1 2016-04-24 Chris Dumez <cdumez@apple.com> 2 3 Autogenerated IDBFactory.open() does the wrong thing if you pass an explicit 'undefined' as the second argument 4 https://bugs.webkit.org/show_bug.cgi?id=156939 5 6 Reviewed by Darin Adler. 7 8 Re-sync tests from upstream b1818929. 9 10 * IndexedDB-private-browsing/idbfactory_open9-expected.txt: 11 * IndexedDB-private-browsing/idbfactory_open9.html: 12 * web-platform-tests/IndexedDB/idbfactory_open9-expected.txt: 13 * web-platform-tests/IndexedDB/idbfactory_open9.htm: 14 1 15 2016-04-23 Chris Dumez <cdumez@apple.com> 2 16 -
trunk/LayoutTests/imported/w3c/IndexedDB-private-browsing/idbfactory_open9-expected.txt
r198394 r199970 10 10 PASS Calling open() with version argument -Infinity should throw TypeError. 11 11 PASS Calling open() with version argument "foo" should throw TypeError. 12 PASS Calling open() with version argument undefined should throw TypeError.13 12 PASS Calling open() with version argument null should throw TypeError. 14 13 PASS Calling open() with version argument false should throw TypeError. … … 18 17 PASS Calling open() with version argument 1.5 should not throw. 19 18 PASS Calling open() with version argument 9007199254740991 should not throw. 19 PASS Calling open() with version argument undefined should not throw. 20 20 -
trunk/LayoutTests/imported/w3c/IndexedDB-private-browsing/idbfactory_open9.html
r198394 r199970 3 3 <script src="../../../resources/testharness.js"></script> 4 4 <script src="../../../resources/testharnessreport.js"></script> 5 <script src=support.js></script>6 5 7 6 <script> … … 27 26 should_throw(-Infinity) 28 27 should_throw("foo") 29 should_throw(undefined)30 28 should_throw(null) 31 29 should_throw(false) … … 47 45 /* Valid */ 48 46 49 function should_work(val ) {47 function should_work(val, expected_version) { 50 48 var name = format_value(val); 51 var t = async_test("Calling open() with version argument " + name + " should not throw.") 52 var rq = createdb(t, val) 53 rq.onupgradeneeded = function() { 54 t.done() 55 } 49 var dbname = 'test-db-does-not-exist'; 50 async_test(function(t) { 51 window.indexedDB.deleteDatabase(dbname); 52 var rq = window.indexedDB.open(dbname, val); 53 rq.onupgradeneeded = t.step_func(function() { 54 var db = rq.result; 55 assert_equals(db.version, expected_version, 'version'); 56 rq.transaction.abort(); 57 }); 58 rq.onsuccess = t.unreached_func("open should fail"); 59 rq.onerror = t.step_func(function() { 60 t.done() 61 }); 62 }, "Calling open() with version argument " + name + " should not throw.") 56 63 } 57 64 58 should_work(1.5) 59 should_work(Number.MAX_SAFE_INTEGER) // 0x20000000000000 - 1 65 should_work(1.5, 1) 66 should_work(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER) // 0x20000000000000 - 1 67 should_work(undefined, 1) 60 68 61 69 </script> -
trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory_open9-expected.txt
r198394 r199970 10 10 PASS Calling open() with version argument -Infinity should throw TypeError. 11 11 PASS Calling open() with version argument "foo" should throw TypeError. 12 PASS Calling open() with version argument undefined should throw TypeError.13 12 PASS Calling open() with version argument null should throw TypeError. 14 13 PASS Calling open() with version argument false should throw TypeError. … … 18 17 PASS Calling open() with version argument 1.5 should not throw. 19 18 PASS Calling open() with version argument 9007199254740991 should not throw. 19 PASS Calling open() with version argument undefined should not throw. 20 20 -
trunk/LayoutTests/imported/w3c/web-platform-tests/IndexedDB/idbfactory_open9.htm
r198394 r199970 1 1 <!DOCTYPE html> 2 2 <title>IDBFactory.open() - errors in version argument</title> 3 <script src="../../../resources/testharness.js"></script> 4 <script src="../../../resources/testharnessreport.js"></script> 5 <script src=support.js></script> 3 <script src=/resources/testharness.js></script> 4 <script src=/resources/testharnessreport.js></script> 6 5 7 6 <script> 8 var date = Date();9 7 function should_throw(val, name) { 10 8 if (!name) { … … 13 11 test(function() { 14 12 assert_throws(new TypeError(), function() { 15 window.indexedDB.open('test' + date, val);13 window.indexedDB.open('test', val); 16 14 }); 17 15 }, "Calling open() with version argument " + name + " should throw TypeError.") … … 28 26 should_throw(-Infinity) 29 27 should_throw("foo") 30 should_throw(undefined)31 28 should_throw(null) 32 29 should_throw(false) … … 48 45 /* Valid */ 49 46 50 function should_work(val) { 51 47 function should_work(val, expected_version) { 52 48 var name = format_value(val); 53 var t = async_test("Calling open() with version argument " + name + " should not throw.") 54 var rq = createdb(t, val + date) 55 rq.onupgradeneeded = function() { 56 t.done() 57 } 49 var dbname = 'test-db-does-not-exist'; 50 async_test(function(t) { 51 window.indexedDB.deleteDatabase(dbname); 52 var rq = window.indexedDB.open(dbname, val); 53 rq.onupgradeneeded = t.step_func(function() { 54 var db = rq.result; 55 assert_equals(db.version, expected_version, 'version'); 56 rq.transaction.abort(); 57 }); 58 rq.onsuccess = t.unreached_func("open should fail"); 59 rq.onerror = t.step_func(function() { 60 t.done() 61 }); 62 }, "Calling open() with version argument " + name + " should not throw.") 58 63 } 59 64 60 should_work(1.5) 61 should_work(Number.MAX_SAFE_INTEGER) // 0x20000000000000 - 1 65 should_work(1.5, 1) 66 should_work(Number.MAX_SAFE_INTEGER, Number.MAX_SAFE_INTEGER) // 0x20000000000000 - 1 67 should_work(undefined, 1) 62 68 63 69 </script> -
trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters-expected.txt
r199797 r199970 36 36 PASS Exception was thrown. 37 37 PASS indexedDB.open(dbname, null) threw TypeError: IDBFactory.open() called with a version of 0 38 Expecting TypeError exception from indexedDB.open(dbname, undefined) 39 PASS Exception was thrown. 40 PASS indexedDB.open(dbname, undefined) threw TypeError: Value NaN is outside the range [0, 9007199254740991] 38 PASS indexedDB.open(dbname, undefined) did not throw exception. 41 39 PASS successfullyParsed is true 42 40 -
trunk/LayoutTests/storage/indexeddb/intversion-bad-parameters-private-expected.txt
r199797 r199970 36 36 PASS Exception was thrown. 37 37 PASS indexedDB.open(dbname, null) threw TypeError: IDBFactory.open() called with a version of 0 38 Expecting TypeError exception from indexedDB.open(dbname, undefined) 39 PASS Exception was thrown. 40 PASS indexedDB.open(dbname, undefined) threw TypeError: Value NaN is outside the range [0, 9007199254740991] 38 PASS indexedDB.open(dbname, undefined) did not throw exception. 41 39 PASS successfullyParsed is true 42 40 -
trunk/LayoutTests/storage/indexeddb/resources/intversion-bad-parameters.js
r163963 r199970 27 27 evalAndExpectExceptionClass("indexedDB.open(dbname, 0x20000000000000)", "TypeError"); 28 28 evalAndExpectExceptionClass("indexedDB.open(dbname, null)", "TypeError"); 29 evalAndExpectExceptionClass("indexedDB.open(dbname, undefined)", "TypeError");29 shouldNotThrow("indexedDB.open(dbname, undefined)"); 30 30 finishJSTest(); 31 31 } -
trunk/Source/WebCore/ChangeLog
r199969 r199970 1 2016-04-24 Chris Dumez <cdumez@apple.com> 2 3 Autogenerated IDBFactory.open() does the wrong thing if you pass an explicit 'undefined' as the second argument 4 https://bugs.webkit.org/show_bug.cgi?id=156939 5 6 Reviewed by Darin Adler. 7 8 As per WebIDL, if undefined is passed by JS for an optional parameter then 9 we should use its default value if it has one, or use the special value 10 "missing": 11 http://heycam.github.io/webidl/#es-overloads (step 10.4) 12 13 Our bindings generator was already mapping undefined to the parameter's 14 default value when present. However, it was missing the notion of 15 "missing" value when there no default value. This patch adds supports 16 for its by passing Optional<>(Nullopt) to the implementation in such 17 case. This means that the implementation will need to use WTF::Optional<> 18 type for parameters that do not have a default value. Thankfully though, 19 in most cases, we will be able to specify a default value in the IDL 20 so cases where we will need to use WTF::Optional<> will actually be 21 rare. 22 23 To avoid having to do too much refactoring in this patch, the support 24 for WTF::Optional is currently blacklisted for most IDL types. I will 25 gradually stop blacklisting each type in follow-up patches, as I either: 26 - Add default parameter values in our IDL (preferred) 27 - Use WTF::Optional<> in our implementation (when we cannot specify a 28 default value). 29 30 This patch fixes a bug with IDBFactory.open()'s second parameter (version) 31 for which undefined should not throw and indicate that the version 32 should not be changed. We now use WTF::Optional in the implementation to 33 distinguish this case and not throw. 34 35 No new tests, existing tests were updated / rebaselined. 36 37 * Modules/indexeddb/IDBFactory.cpp: 38 (WebCore::IDBFactory::open): 39 (WebCore::IDBFactory::openInternal): Deleted. 40 * Modules/indexeddb/IDBFactory.h: 41 * bindings/scripts/CodeGeneratorJS.pm: 42 (ShouldUseWTFOptionalForParameterType): 43 (GenerateParametersCheck): 44 * fileapi/Blob.idl: 45 * inspector/InspectorIndexedDBAgent.cpp: 46 1 47 2016-04-23 Chris Dumez <cdumez@apple.com> 2 48 -
trunk/Source/WebCore/Modules/indexeddb/IDBFactory.cpp
r199882 r199970 77 77 } 78 78 79 RefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext& context, const String& name, ExceptionCodeWithMessage& ec)79 RefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext& context, const String& name, Optional<unsigned long long> version, ExceptionCodeWithMessage& ec) 80 80 { 81 81 LOG(IndexedDB, "IDBFactory::open"); 82 82 83 return openInternal(context, name, 0, ec); 84 } 85 86 RefPtr<IDBOpenDBRequest> IDBFactory::open(ScriptExecutionContext& context, const String& name, unsigned long long version, ExceptionCodeWithMessage& ec) 87 { 88 LOG(IndexedDB, "IDBFactory::open"); 89 90 if (!version) { 83 if (version && !version.value()) { 91 84 ec.code = TypeError; 92 85 ec.message = ASCIILiteral("IDBFactory.open() called with a version of 0"); … … 94 87 } 95 88 96 return openInternal(context, name, version , ec);89 return openInternal(context, name, version.valueOr(0), ec); 97 90 } 98 91 -
trunk/Source/WebCore/Modules/indexeddb/IDBFactory.h
r199835 r199970 54 54 ~IDBFactory(); 55 55 56 RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, ExceptionCodeWithMessage&); 57 RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, unsigned long long version, ExceptionCodeWithMessage&); 56 RefPtr<IDBOpenDBRequest> open(ScriptExecutionContext&, const String& name, Optional<unsigned long long> version, ExceptionCodeWithMessage&); 58 57 RefPtr<IDBOpenDBRequest> deleteDatabase(ScriptExecutionContext&, const String& name, ExceptionCodeWithMessage&); 59 58 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r199969 r199970 3371 3371 } 3372 3372 3373 sub CanUseWTFOptionalForParameterType 3374 { 3375 my $type = shift; 3376 3377 # FIXME: We should progressively stop blacklisting each type below 3378 # and eventually get rid of this function entirely. 3379 return 0 if $codeGenerator->IsEnumType($type); 3380 return 0 if $codeGenerator->IsTypedArrayType($type); 3381 return 0 if $codeGenerator->IsWrapperType($type); 3382 return 0 if $type eq "DOMString"; 3383 return 0 if $type eq "Dictionary"; 3384 return 0 if $type eq "any"; 3385 return 0 if $type eq "boolean"; 3386 return 0 if $type eq "float"; 3387 return 0 if $type eq "long"; 3388 return 0 if $type eq "unrestricted float"; 3389 return 0 if $type eq "unrestricted double"; 3390 return 0 if $type eq "unsigned long"; 3391 return 0 if $type eq "unsigned short"; 3392 3393 return 1; 3394 } 3395 3373 3396 sub GenerateParametersCheck 3374 3397 { … … 3420 3443 # Optional Dictionary arguments always considered to have default of empty dictionary. 3421 3444 my $optional = $parameter->isOptional; 3422 if ($optional && !defined($parameter->default) && $argType ne "Dictionary" && !$codeGenerator->IsCallbackInterface($argType)) {3445 if ($optional && !defined($parameter->default) && !CanUseWTFOptionalForParameterType($parameter->type) && $argType ne "Dictionary" && !$codeGenerator->IsCallbackInterface($argType)) { 3423 3446 # Generate early call if there are enough parameters. 3424 3447 if (!$hasOptionalArguments) { … … 3577 3600 my $outer; 3578 3601 my $inner; 3602 my $nativeType = GetNativeTypeFromSignature($parameter); 3603 3579 3604 if ($optional && defined($parameter->default)) { 3580 3605 my $defaultValue = $parameter->default; … … 3593 3618 $defaultValue = "nullptr" if $defaultValue eq "null"; 3594 3619 $defaultValue = "PNaN" if $defaultValue eq "NaN"; 3595 $defaultValue = GetNativeTypeFromSignature($parameter) . "()" if $defaultValue eq "[]";3620 $defaultValue = "$nativeType()" if $defaultValue eq "[]"; 3596 3621 } 3597 3622 3623 $outer = "state->argument($argsIndex).isUndefined() ? $defaultValue : "; 3624 $inner = "state->uncheckedArgument($argsIndex)"; 3625 } elsif ($optional && !defined($parameter->default) && CanUseWTFOptionalForParameterType($parameter->type)) { 3626 # Use WTF::Optional<>() for optional parameters that are missing or undefined and that do not have 3627 # a default value in the IDL. 3628 my $defaultValue = "Optional<$nativeType>()"; 3629 $nativeType = "Optional<$nativeType>"; 3598 3630 $outer = "state->argument($argsIndex).isUndefined() ? $defaultValue : "; 3599 3631 $inner = "state->uncheckedArgument($argsIndex)"; … … 3602 3634 $inner = "state->argument($argsIndex)"; 3603 3635 } 3604 push(@$outputArray, " " . GetNativeTypeFromSignature($parameter) . "$name = $outer" . JSValueToNative($parameter, $inner, $function->signature->extendedAttributes->{"Conditional"}) . ";\n");3636 push(@$outputArray, " $nativeType $name = $outer" . JSValueToNative($parameter, $inner, $function->signature->extendedAttributes->{"Conditional"}) . ";\n"); 3605 3637 } 3606 3638 -
trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
r199969 r199970 1649 1649 } 1650 1650 1651 void webkit_dom_test_obj_method_with_optional_long_long(WebKitDOMTestObj* self, gint64 number) 1652 { 1653 WebCore::JSMainThreadNullState state; 1654 g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); 1655 WebCore::TestObj* item = WebKit::core(self); 1656 item->methodWithOptionalLongLong(number); 1657 } 1658 1659 void webkit_dom_test_obj_method_with_optional_long_long_is_zero(WebKitDOMTestObj* self, gint64 number) 1660 { 1661 WebCore::JSMainThreadNullState state; 1662 g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); 1663 WebCore::TestObj* item = WebKit::core(self); 1664 item->methodWithOptionalLongLongIsZero(number); 1665 } 1666 1667 void webkit_dom_test_obj_method_with_optional_unsigned_long_long(WebKitDOMTestObj* self, guint64 number) 1668 { 1669 WebCore::JSMainThreadNullState state; 1670 g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); 1671 WebCore::TestObj* item = WebKit::core(self); 1672 item->methodWithOptionalUnsignedLongLong(number); 1673 } 1674 1675 void webkit_dom_test_obj_method_with_optional_unsigned_long_long_is_zero(WebKitDOMTestObj* self, guint64 number) 1676 { 1677 WebCore::JSMainThreadNullState state; 1678 g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); 1679 WebCore::TestObj* item = WebKit::core(self); 1680 item->methodWithOptionalUnsignedLongLongIsZero(number); 1681 } 1682 1683 void webkit_dom_test_obj_method_with_optional_array(WebKitDOMTestObj* self, const gchar* array) 1684 { 1685 WebCore::JSMainThreadNullState state; 1686 g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); 1687 g_return_if_fail(WEBKIT_DOM_IS_DOM_STRING[](array)); 1688 WebCore::TestObj* item = WebKit::core(self); 1689 WebCore::DOMString[]* convertedArray = WebKit::core(array); 1690 item->methodWithOptionalArray(convertedArray); 1691 } 1692 1693 void webkit_dom_test_obj_method_with_optional_array_is_empty(WebKitDOMTestObj* self, const gchar* array) 1694 { 1695 WebCore::JSMainThreadNullState state; 1696 g_return_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self)); 1697 g_return_if_fail(WEBKIT_DOM_IS_DOM_STRING[](array)); 1698 WebCore::TestObj* item = WebKit::core(self); 1699 WebCore::DOMString[]* convertedArray = WebKit::core(array); 1700 item->methodWithOptionalArrayIsEmpty(convertedArray); 1701 } 1702 1651 1703 gchar* webkit_dom_test_obj_conditional_method1(WebKitDOMTestObj* self) 1652 1704 { -
trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.h
r199969 r199970 610 610 611 611 /** 612 * webkit_dom_test_obj_method_with_optional_long_long: 613 * @self: A #WebKitDOMTestObj 614 * @number: A #gint64 615 * 616 * Stability: Unstable 617 **/ 618 WEBKIT_API void 619 webkit_dom_test_obj_method_with_optional_long_long(WebKitDOMTestObj* self, gint64 number); 620 621 /** 622 * webkit_dom_test_obj_method_with_optional_long_long_is_zero: 623 * @self: A #WebKitDOMTestObj 624 * @number: A #gint64 625 * 626 * Stability: Unstable 627 **/ 628 WEBKIT_API void 629 webkit_dom_test_obj_method_with_optional_long_long_is_zero(WebKitDOMTestObj* self, gint64 number); 630 631 /** 632 * webkit_dom_test_obj_method_with_optional_unsigned_long_long: 633 * @self: A #WebKitDOMTestObj 634 * @number: A #guint64 635 * 636 * Stability: Unstable 637 **/ 638 WEBKIT_API void 639 webkit_dom_test_obj_method_with_optional_unsigned_long_long(WebKitDOMTestObj* self, guint64 number); 640 641 /** 642 * webkit_dom_test_obj_method_with_optional_unsigned_long_long_is_zero: 643 * @self: A #WebKitDOMTestObj 644 * @number: A #guint64 645 * 646 * Stability: Unstable 647 **/ 648 WEBKIT_API void 649 webkit_dom_test_obj_method_with_optional_unsigned_long_long_is_zero(WebKitDOMTestObj* self, guint64 number); 650 651 /** 652 * webkit_dom_test_obj_method_with_optional_array: 653 * @self: A #WebKitDOMTestObj 654 * @array: A #gchar 655 * 656 * Stability: Unstable 657 **/ 658 WEBKIT_API void 659 webkit_dom_test_obj_method_with_optional_array(WebKitDOMTestObj* self, const gchar* array); 660 661 /** 662 * webkit_dom_test_obj_method_with_optional_array_is_empty: 663 * @self: A #WebKitDOMTestObj 664 * @array: A #gchar 665 * 666 * Stability: Unstable 667 **/ 668 WEBKIT_API void 669 webkit_dom_test_obj_method_with_optional_array_is_empty(WebKitDOMTestObj* self, const gchar* array); 670 671 /** 612 672 * webkit_dom_test_obj_conditional_method1: 613 673 * @self: A #WebKitDOMTestObj -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r199969 r199970 149 149 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN(JSC::ExecState*); 150 150 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalSequence(JSC::ExecState*); 151 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalLongLong(JSC::ExecState*); 152 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalLongLongIsZero(JSC::ExecState*); 153 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLong(JSC::ExecState*); 154 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZero(JSC::ExecState*); 155 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArray(JSC::ExecState*); 156 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArrayIsEmpty(JSC::ExecState*); 151 157 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(JSC::ExecState*); 152 158 JSC::EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg(JSC::ExecState*); … … 708 714 { "methodWithOptionalFloatIsNaN", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalFloatIsNaN), (intptr_t) (0) } }, 709 715 { "methodWithOptionalSequence", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalSequence), (intptr_t) (0) } }, 716 { "methodWithOptionalLongLong", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalLongLong), (intptr_t) (0) } }, 717 { "methodWithOptionalLongLongIsZero", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalLongLongIsZero), (intptr_t) (0) } }, 718 { "methodWithOptionalUnsignedLongLong", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLong), (intptr_t) (0) } }, 719 { "methodWithOptionalUnsignedLongLongIsZero", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZero), (intptr_t) (0) } }, 720 { "methodWithOptionalArray", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArray), (intptr_t) (0) } }, 721 { "methodWithOptionalArrayIsEmpty", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithOptionalArrayIsEmpty), (intptr_t) (0) } }, 710 722 { "methodWithCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithCallbackArg), (intptr_t) (1) } }, 711 723 { "methodWithNonCallbackArgAndCallbackArg", JSC::Function, NoIntrinsic, { (intptr_t)static_cast<NativeFunction>(jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg), (intptr_t) (2) } }, … … 4242 4254 } 4243 4255 4256 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalLongLong(ExecState* state) 4257 { 4258 JSValue thisValue = state->thisValue(); 4259 auto castedThis = jsDynamicCast<JSTestObj*>(thisValue); 4260 if (UNLIKELY(!castedThis)) 4261 return throwThisTypeError(*state, "TestObj", "methodWithOptionalLongLong"); 4262 ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); 4263 auto& impl = castedThis->wrapped(); 4264 Optional<long long> number = state->argument(0).isUndefined() ? Optional<long long>() : toInt64(state, state->uncheckedArgument(0), NormalConversion); 4265 if (UNLIKELY(state->hadException())) 4266 return JSValue::encode(jsUndefined()); 4267 impl.methodWithOptionalLongLong(number); 4268 return JSValue::encode(jsUndefined()); 4269 } 4270 4271 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalLongLongIsZero(ExecState* state) 4272 { 4273 JSValue thisValue = state->thisValue(); 4274 auto castedThis = jsDynamicCast<JSTestObj*>(thisValue); 4275 if (UNLIKELY(!castedThis)) 4276 return throwThisTypeError(*state, "TestObj", "methodWithOptionalLongLongIsZero"); 4277 ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); 4278 auto& impl = castedThis->wrapped(); 4279 long long number = state->argument(0).isUndefined() ? 0 : toInt64(state, state->uncheckedArgument(0), NormalConversion); 4280 if (UNLIKELY(state->hadException())) 4281 return JSValue::encode(jsUndefined()); 4282 impl.methodWithOptionalLongLongIsZero(number); 4283 return JSValue::encode(jsUndefined()); 4284 } 4285 4286 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLong(ExecState* state) 4287 { 4288 JSValue thisValue = state->thisValue(); 4289 auto castedThis = jsDynamicCast<JSTestObj*>(thisValue); 4290 if (UNLIKELY(!castedThis)) 4291 return throwThisTypeError(*state, "TestObj", "methodWithOptionalUnsignedLongLong"); 4292 ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); 4293 auto& impl = castedThis->wrapped(); 4294 Optional<unsigned long long> number = state->argument(0).isUndefined() ? Optional<unsigned long long>() : toUInt64(state, state->uncheckedArgument(0), NormalConversion); 4295 if (UNLIKELY(state->hadException())) 4296 return JSValue::encode(jsUndefined()); 4297 impl.methodWithOptionalUnsignedLongLong(number); 4298 return JSValue::encode(jsUndefined()); 4299 } 4300 4301 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalUnsignedLongLongIsZero(ExecState* state) 4302 { 4303 JSValue thisValue = state->thisValue(); 4304 auto castedThis = jsDynamicCast<JSTestObj*>(thisValue); 4305 if (UNLIKELY(!castedThis)) 4306 return throwThisTypeError(*state, "TestObj", "methodWithOptionalUnsignedLongLongIsZero"); 4307 ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); 4308 auto& impl = castedThis->wrapped(); 4309 unsigned long long number = state->argument(0).isUndefined() ? 0 : toUInt64(state, state->uncheckedArgument(0), NormalConversion); 4310 if (UNLIKELY(state->hadException())) 4311 return JSValue::encode(jsUndefined()); 4312 impl.methodWithOptionalUnsignedLongLongIsZero(number); 4313 return JSValue::encode(jsUndefined()); 4314 } 4315 4316 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArray(ExecState* state) 4317 { 4318 JSValue thisValue = state->thisValue(); 4319 auto castedThis = jsDynamicCast<JSTestObj*>(thisValue); 4320 if (UNLIKELY(!castedThis)) 4321 return throwThisTypeError(*state, "TestObj", "methodWithOptionalArray"); 4322 ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); 4323 auto& impl = castedThis->wrapped(); 4324 Optional<Vector<String>> array = state->argument(0).isUndefined() ? Optional<Vector<String>>() : toNativeArray<String>(state, state->uncheckedArgument(0)); 4325 if (UNLIKELY(state->hadException())) 4326 return JSValue::encode(jsUndefined()); 4327 impl.methodWithOptionalArray(array); 4328 return JSValue::encode(jsUndefined()); 4329 } 4330 4331 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithOptionalArrayIsEmpty(ExecState* state) 4332 { 4333 JSValue thisValue = state->thisValue(); 4334 auto castedThis = jsDynamicCast<JSTestObj*>(thisValue); 4335 if (UNLIKELY(!castedThis)) 4336 return throwThisTypeError(*state, "TestObj", "methodWithOptionalArrayIsEmpty"); 4337 ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestObj::info()); 4338 auto& impl = castedThis->wrapped(); 4339 Vector<String> array = state->argument(0).isUndefined() ? Vector<String>() : toNativeArray<String>(state, state->uncheckedArgument(0)); 4340 if (UNLIKELY(state->hadException())) 4341 return JSValue::encode(jsUndefined()); 4342 impl.methodWithOptionalArrayIsEmpty(array); 4343 return JSValue::encode(jsUndefined()); 4344 } 4345 4244 4346 EncodedJSValue JSC_HOST_CALL jsTestObjPrototypeFunctionMethodWithCallbackArg(ExecState* state) 4245 4347 { -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp
r199265 r199970 464 464 ASSERT_GC_OBJECT_INHERITS(castedThis, JSTestTypedefs::info()); 465 465 auto& impl = castedThis->wrapped(); 466 467 size_t argsCount = state->argumentCount(); 468 if (argsCount <= 0) { 469 impl.func(); 470 return JSValue::encode(jsUndefined()); 471 } 472 473 Vector<int> x = toNativeArray<int>(state, state->argument(0)); 466 Vector<int> x = state->argument(0).isUndefined() ? Vector<int>() : toNativeArray<int>(state, state->uncheckedArgument(0)); 474 467 if (UNLIKELY(state->hadException())) 475 468 return JSValue::encode(jsUndefined()); … … 570 563 if (!std::isnan(arg1NativeValue)) 571 564 arg1 = clampTo<unsigned long long>(arg1NativeValue); 572 573 574 size_t argsCount = state->argumentCount();575 if (argsCount <= 1) {576 impl.funcWithClamp(arg1);577 return JSValue::encode(jsUndefined());578 }579 565 580 566 unsigned long long arg2 = 0; -
trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.h
r199969 r199970 185 185 - (void)methodWithOptionalDoubleIsNaN:(double)number; 186 186 - (void)methodWithOptionalFloatIsNaN:(float)number; 187 - (void)methodWithOptionalLongLong:(long long)number; 188 - (void)methodWithOptionalLongLongIsZero:(long long)number; 189 - (void)methodWithOptionalUnsignedLongLong:(unsigned long long)number; 190 - (void)methodWithOptionalUnsignedLongLongIsZero:(unsigned long long)number; 187 191 - (void)classMethod; 188 192 - (int)classMethodWithOptional:(int)arg; -
trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
r199969 r199970 1317 1317 } 1318 1318 1319 - (void)methodWithOptionalLongLong:(long long)number 1320 { 1321 WebCore::JSMainThreadNullState state; 1322 IMPL->methodWithOptionalLongLong(number); 1323 } 1324 1325 - (void)methodWithOptionalLongLongIsZero:(long long)number 1326 { 1327 WebCore::JSMainThreadNullState state; 1328 IMPL->methodWithOptionalLongLongIsZero(number); 1329 } 1330 1331 - (void)methodWithOptionalUnsignedLongLong:(unsigned long long)number 1332 { 1333 WebCore::JSMainThreadNullState state; 1334 IMPL->methodWithOptionalUnsignedLongLong(number); 1335 } 1336 1337 - (void)methodWithOptionalUnsignedLongLongIsZero:(unsigned long long)number 1338 { 1339 WebCore::JSMainThreadNullState state; 1340 IMPL->methodWithOptionalUnsignedLongLongIsZero(number); 1341 } 1342 1319 1343 1320 1344 #if ENABLE(Condition1) -
trunk/Source/WebCore/bindings/scripts/test/TestObj.idl
r199969 r199970 190 190 void methodWithOptionalFloatIsNaN(optional unrestricted float number = NaN); 191 191 void methodWithOptionalSequence(optional sequence<DOMString> sequence = []); 192 void methodWithOptionalLongLong(optional long long number); 193 void methodWithOptionalLongLongIsZero(optional long long number = 0); 194 void methodWithOptionalUnsignedLongLong(optional unsigned long long number); 195 void methodWithOptionalUnsignedLongLongIsZero(optional unsigned long long number = 0); 196 void methodWithOptionalArray(optional DOMString[] array); 197 void methodWithOptionalArrayIsEmpty(optional DOMString[] array = []); 192 198 193 199 #if defined(TESTING_JS) -
trunk/Source/WebCore/bindings/scripts/test/TestTypedefs.idl
r168302 r199970 41 41 static readonly attribute T TestSubObj; 42 42 43 [StrictTypeChecking] void func(optional ARRAY_OF_LONGS x );43 [StrictTypeChecking] void func(optional ARRAY_OF_LONGS x = []); 44 44 45 45 void setShadow(DOUBLE width, DOUBLE height, unrestricted float blur, [StrictTypeChecking] optional STRING color, optional DOUBLE alpha); -
trunk/Source/WebCore/fileapi/Blob.idl
r199587 r199970 40 40 41 41 #if !defined(LANGUAGE_OBJECTIVE_C) 42 Blob slice(optional long long start , optional long long end, optional DOMString? contentType);42 Blob slice(optional long long start = 0, optional long long end = 0x7FFFFFFFFFFFFFFF, optional DOMString? contentType = null); 43 43 #endif 44 44 }; -
trunk/Source/WebCore/inspector/InspectorIndexedDBAgent.cpp
r199797 r199970 214 214 } 215 215 216 RefPtr<IDBOpenDBRequest> idbOpenDBRequest = idbFactory->open(*context(), databaseName, ec);216 RefPtr<IDBOpenDBRequest> idbOpenDBRequest = idbFactory->open(*context(), databaseName, Nullopt, ec); 217 217 if (ec.code) { 218 218 requestCallback().sendFailure("Could not open database.");
Note: See TracChangeset
for help on using the changeset viewer.