Changeset 192839 in webkit
- Timestamp:
- Nov 30, 2015 3:57:31 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 18 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r192838 r192839 1 2015-11-30 Darin Adler <darin@apple.com> 2 3 Use Optional instead of isNull out argument for nullable getters 4 https://bugs.webkit.org/show_bug.cgi?id=151676 5 6 Reviewed by Anders Carlsson. 7 8 No behavior change, just cleaner code. 9 10 * Modules/geolocation/Coordinates.cpp: 11 (WebCore::Coordinates::altitude): Return an Optional. 12 (WebCore::Coordinates::altitudeAccuracy): Ditto. 13 (WebCore::Coordinates::heading): Ditto. 14 (WebCore::Coordinates::speed): Ditto. 15 * Modules/geolocation/Coordinates.h: Ditto. 16 17 * Modules/indexeddb/IDBVersionChangeEvent.cpp: 18 (WebCore::IDBVersionChangeEvent::create): Added. The code before was calling 19 through to Event::create, which is clearly not what was wanted. Also removed 20 unneeded explicit destructor. 21 * Modules/indexeddb/IDBVersionChangeEvent.h: Changed return type of newVersion 22 to Optional and updated for above change. 23 24 * Modules/indexeddb/client/IDBVersionChangeEventImpl.cpp: 25 (WebCore::IDBClient::IDBVersionChangeEvent::newVersion): Changed to return 26 an Optional. 27 * Modules/indexeddb/client/IDBVersionChangeEventImpl.h: Removed unused 28 default argument values; the event type one, at least, was clearly incorrect. 29 Made more things private, got rid of unneeded destructor, marked class final 30 instead of marking all functions final. 31 32 * Modules/indexeddb/legacy/LegacyVersionChangeEvent.cpp: 33 (WebCore::LegacyVersionChangeEvent::newVersion): Same as above. 34 * Modules/indexeddb/legacy/LegacyVersionChangeEvent.h: Ditto. 35 36 * Modules/mediastream/MediaTrackConstraints.cpp: 37 (WebCore::MediaTrackConstraints::optional): Removed bogus bool value. If we 38 come back to finish later we will have to implement optional return values 39 for arrays in the JavaScript bindings generator, which should be straightforward. 40 * Modules/mediastream/MediaTrackConstraints.h: Ditto. 41 42 * bindings/js/JSDOMBinding.h: 43 (WebCore::toNullableJSNumber): Added. This function template is used for 44 return values that are nullable numbers. 45 46 * bindings/scripts/CodeGeneratorGObject.pm: 47 (GenerateFunction): Replaced some existing bogus code to handle nullables with 48 new equally-bogus code that should be no worse and will compile. 49 50 * bindings/scripts/CodeGeneratorJS.pm: 51 (GenerateImplementation): Removed old support for nullables. 52 (NativeToJSValue): Added new support for nullable numbers. 53 54 * bindings/scripts/CodeGeneratorObjC.pm: 55 (GenerateImplementation): Removed support for nullables. We almost certainly 56 won't need it for Objective-C bindings. 57 58 * bindings/scripts/test/GObject/WebKitDOMTestObj.cpp: Updated. 59 * bindings/scripts/test/JS/JSTestObj.cpp: Updated. 60 * bindings/scripts/test/ObjC/DOMTestObj.mm: Updated. 61 1 62 2015-11-30 Wenson Hsieh <wenson_hsieh@apple.com> 2 63 -
trunk/Source/WebCore/Modules/geolocation/Coordinates.cpp
r146585 r192839 29 29 namespace WebCore { 30 30 31 double Coordinates::altitude(bool& isNull) const31 Optional<double> Coordinates::altitude() const 32 32 { 33 if (m_canProvideAltitude) 34 return m_altitude; 35 36 isNull = true; 37 return 0; 33 if (!m_canProvideAltitude) 34 return Nullopt; 35 return m_altitude; 38 36 } 39 37 40 double Coordinates::altitudeAccuracy(bool& isNull) const38 Optional<double> Coordinates::altitudeAccuracy() const 41 39 { 42 if (m_canProvideAltitudeAccuracy) 43 return m_altitudeAccuracy; 44 45 isNull = true; 46 return 0; 40 if (!m_canProvideAltitudeAccuracy) 41 return Nullopt; 42 return m_altitudeAccuracy; 47 43 } 48 44 49 double Coordinates::heading(bool& isNull) const45 Optional<double> Coordinates::heading() const 50 46 { 51 if (m_canProvideHeading) 52 return m_heading; 53 54 isNull = true; 55 return 0; 47 if (!m_canProvideHeading) 48 return Nullopt; 49 return m_heading; 56 50 } 57 51 58 double Coordinates::speed(bool& isNull) const52 Optional<double> Coordinates::speed() const 59 53 { 60 if (m_canProvideSpeed) 61 return m_speed; 62 63 isNull = true; 64 return 0; 54 if (!m_canProvideSpeed) 55 return Nullopt; 56 return m_speed; 65 57 } 66 58 -
trunk/Source/WebCore/Modules/geolocation/Coordinates.h
r177733 r192839 28 28 29 29 #include "Event.h" 30 #include <wtf/Optional.h> 30 31 #include <wtf/RefCounted.h> 31 32 … … 43 44 double latitude() const { return m_latitude; } 44 45 double longitude() const { return m_longitude; } 45 double altitude(bool& isNull) const;46 Optional<double> altitude() const; 46 47 double accuracy() const { return m_accuracy; } 47 double altitudeAccuracy(bool& isNull) const;48 double heading(bool& isNull) const;49 double speed(bool& isNull) const;48 Optional<double> altitudeAccuracy() const; 49 Optional<double> heading() const; 50 Optional<double> speed() const; 50 51 51 52 private: -
trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.cpp
r189746 r192839 29 29 #if ENABLE(INDEXED_DATABASE) 30 30 31 #include "EventNames.h" 32 #include "IDBVersionChangeEventImpl.h" 33 31 34 namespace WebCore { 32 35 … … 36 39 } 37 40 41 Ref<IDBVersionChangeEvent> IDBVersionChangeEvent::create() 42 { 43 // FIXME: This is called only by document.createEvent. I don't see how it's valuable to create an event with 44 // read-only oldVersion attribute of 0 and newVersion of null; preserving that behavior for now. 45 return IDBClient::IDBVersionChangeEvent::create(0, 0, eventNames().versionchangeEvent); 46 } 47 38 48 } // namespace WebCore 39 49 -
trunk/Source/WebCore/Modules/indexeddb/IDBVersionChangeEvent.h
r192698 r192839 30 30 31 31 #include "Event.h" 32 #include <wtf/PassRefPtr.h> 33 #include <wtf/RefPtr.h> 34 #include <wtf/text/WTFString.h> 32 #include <wtf/Optional.h> 35 33 36 34 namespace WebCore { … … 38 36 class IDBVersionChangeEvent : public Event { 39 37 public: 40 virtual ~IDBVersionChangeEvent() { }38 static Ref<IDBVersionChangeEvent> create(); 41 39 42 40 virtual uint64_t oldVersion() const = 0; 43 virtual uint64_t newVersion(bool& isNull) const = 0;41 virtual Optional<uint64_t> newVersion() const = 0; 44 42 45 43 protected: 46 IDBVersionChangeEvent(const AtomicString&);44 explicit IDBVersionChangeEvent(const AtomicString& type); 47 45 }; 48 46 -
trunk/Source/WebCore/Modules/indexeddb/client/IDBVersionChangeEventImpl.cpp
r192698 r192839 39 39 } 40 40 41 uint64_t IDBVersionChangeEvent::newVersion(bool& isNull) const41 Optional<uint64_t> IDBVersionChangeEvent::newVersion() const 42 42 { 43 isNull = !m_newVersion; 43 if (!m_newVersion) 44 return Nullopt; 44 45 return m_newVersion; 45 46 } -
trunk/Source/WebCore/Modules/indexeddb/client/IDBVersionChangeEventImpl.h
r192698 r192839 34 34 namespace IDBClient { 35 35 36 class IDBVersionChangeEvent : public WebCore::IDBVersionChangeEvent {36 class IDBVersionChangeEvent final : public WebCore::IDBVersionChangeEvent { 37 37 public: 38 static Ref<IDBVersionChangeEvent> create(uint64_t oldVersion = 0, uint64_t newVersion = 0, const AtomicString& eventType = AtomicString())38 static Ref<IDBVersionChangeEvent> create(uint64_t oldVersion, uint64_t newVersion, const AtomicString& eventType) 39 39 { 40 40 return adoptRef(*new IDBVersionChangeEvent(oldVersion, newVersion, eventType)); 41 41 } 42 42 43 virtual uint64_t oldVersion() const override final { return m_oldVersion; }44 virtual uint64_t newVersion(bool& isNull) const override final;45 46 virtual EventInterface eventInterface() const override final;47 48 43 private: 49 44 IDBVersionChangeEvent(uint64_t oldVersion, uint64_t newVersion, const AtomicString& eventType); 50 45 51 uint64_t m_oldVersion { 0 }; 52 uint64_t m_newVersion { 0 }; 46 virtual uint64_t oldVersion() const override { return m_oldVersion; } 47 virtual Optional<uint64_t> newVersion() const override; 48 virtual EventInterface eventInterface() const override; 49 50 uint64_t m_oldVersion; 51 uint64_t m_newVersion; 53 52 }; 54 53 -
trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyVersionChangeEvent.cpp
r192698 r192839 38 38 } 39 39 40 LegacyVersionChangeEvent::~LegacyVersionChangeEvent() 40 Optional<uint64_t> LegacyVersionChangeEvent::newVersion() const 41 41 { 42 }43 44 uint64_t LegacyVersionChangeEvent::newVersion(bool& isNull) const45 {46 isNull = false;47 42 return m_newVersion; 48 43 } -
trunk/Source/WebCore/Modules/indexeddb/legacy/LegacyVersionChangeEvent.h
r192698 r192839 34 34 namespace WebCore { 35 35 36 class LegacyVersionChangeEvent : public IDBVersionChangeEvent {36 class LegacyVersionChangeEvent final : public IDBVersionChangeEvent { 37 37 public: 38 static Ref<LegacyVersionChangeEvent> create(unsigned long long oldVersion = 0, unsigned long long newVersion = 0, const AtomicString& eventType = AtomicString())38 static Ref<LegacyVersionChangeEvent> create(unsigned long long oldVersion, unsigned long long newVersion, const AtomicString& eventType) 39 39 { 40 40 return adoptRef(*new LegacyVersionChangeEvent(oldVersion, newVersion, eventType)); 41 41 } 42 42 43 virtual ~LegacyVersionChangeEvent();44 45 virtual uint64_t oldVersion() const override final { return m_oldVersion; }46 virtual uint64_t newVersion(bool& isNull) const override final;47 48 virtual EventInterface eventInterface() const override final;49 50 43 private: 51 44 LegacyVersionChangeEvent(unsigned long long oldVersion, unsigned long long newVersion, const AtomicString& eventType); 45 46 virtual uint64_t oldVersion() const override { return m_oldVersion; } 47 virtual Optional<uint64_t> newVersion() const override; 48 virtual EventInterface eventInterface() const override; 52 49 53 50 uint64_t m_oldVersion; -
trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.cpp
r190030 r192839 49 49 } 50 50 51 Vector<PassRefPtr<MediaTrackConstraint>> MediaTrackConstraints::optional( bool) const51 Vector<PassRefPtr<MediaTrackConstraint>> MediaTrackConstraints::optional() const 52 52 { 53 53 // https://bugs.webkit.org/show_bug.cgi?id=121954 -
trunk/Source/WebCore/Modules/mediastream/MediaTrackConstraints.h
r190030 r192839 45 45 static Ref<MediaTrackConstraints> create(PassRefPtr<MediaConstraintsImpl>); 46 46 47 Vector<PassRefPtr<MediaTrackConstraint>> optional( bool) const;47 Vector<PassRefPtr<MediaTrackConstraint>> optional() const; 48 48 MediaTrackConstraintSet* mandatory() const; 49 49 -
trunk/Source/WebCore/bindings/js/JSDOMBinding.h
r191543 r192839 52 52 #include <wtf/Vector.h> 53 53 54 // FIXME: We could make this file a lot easier to read by putting all function declarations at the top, 55 // and function definitions below, even for template and inline functions. 56 54 57 namespace JSC { 55 58 class HashEntry; … … 284 287 285 288 JSC::JSValue createDOMException(JSC::ExecState*, ExceptionCode); 289 286 290 // Convert a DOM implementation exception code into a JavaScript exception in the execution state. 287 291 WEBCORE_EXPORT void setDOMException(JSC::ExecState*, ExceptionCode); … … 305 309 String valueToStringWithNullCheck(JSC::ExecState*, JSC::JSValue); // null if the value is null 306 310 String valueToStringWithUndefinedOrNullCheck(JSC::ExecState*, JSC::JSValue); // null if the value is null or undefined 311 312 template<typename T> JSC::JSValue toNullableJSNumber(Optional<T>); // null if the optional is null 307 313 308 314 inline int32_t finiteInt32Value(JSC::JSValue value, JSC::ExecState* exec, bool& okay) … … 351 357 WEBCORE_EXPORT uint64_t toUInt64(JSC::ExecState*, JSC::JSValue, IntegerConversionConfiguration); 352 358 353 // Returns a Date inst nace for the specified value, or NaN if the date is not a number.359 // Returns a Date instance for the specified value, or NaN if the date is not a number. 354 360 JSC::JSValue jsDateOrNaN(JSC::ExecState*, double); 361 355 362 // Returns a Date instance for the specified value, or null if the value is NaN or infinity. 356 363 JSC::JSValue jsDateOrNull(JSC::ExecState*, double); 364 357 365 // NaN if the value can't be converted to a date. 358 366 double valueToDate(JSC::ExecState*, JSC::JSValue); … … 686 694 JSC::JSObject::put(&object, &exec, JSC::Identifier::fromString(&exec, name), value, propertySlot); 687 695 } 688 696 697 template<typename T> inline JSC::JSValue toNullableJSNumber(Optional<T> optionalNumber) 698 { 699 return optionalNumber ? JSC::jsNumber(optionalNumber.value()) : JSC::jsNull(); 700 } 701 689 702 } // namespace WebCore 690 703 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorGObject.pm
r191841 r192839 576 576 push(@txtGetProps, " case ${propEnum}:\n"); 577 577 578 # FIXME: Should we return a default value when isNull == true?579 580 578 my $postConvertFunction = ""; 581 579 if ($gtype eq "string") { … … 1240 1238 } else { 1241 1239 $assign = "${returnType} result = "; 1240 if ($function->signature->isNullable) { 1241 # FIXME: Returning 0 is probably not right for all nullable attribute values. 1242 # We may want to handle this the way we do in the Objective-C bindings: not 1243 # handle it at all, and not expose any nullables. 1244 $assignPost = ".valueOr(0)"; 1245 } 1242 1246 } 1243 1247 … … 1246 1250 $assignPost = "->toString())"; 1247 1251 } 1248 }1249 1250 # FIXME: Should we return a default value when isNull == true?1251 if ($function->signature->isNullable) {1252 push(@cBody, " bool isNull = false;\n");1253 push(@callImplParams, "isNull");1254 1252 } 1255 1253 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r192750 r192839 2279 2279 my $name = $attribute->signature->name; 2280 2280 my $type = $attribute->signature->type; 2281 # Nullable wrapper types do not need any special handling as the implementation can return a null pointer.2282 my $isNullable = $attribute->signature->isNullable && !$codeGenerator->IsWrapperType($type);2283 2281 $codeGenerator->AssertNotSequenceType($type); 2284 2282 my $getFunctionName = GetAttributeGetterName($interfaceName, $className, $interface, $attribute); … … 2412 2410 } 2413 2411 } elsif (!$attribute->signature->extendedAttributes->{"GetterRaisesException"}) { 2414 push(@implContent, " bool isNull = false;\n") if $isNullable;2415 2416 2412 my $cacheIndex = 0; 2417 2413 if ($attribute->signature->extendedAttributes->{"CachedAttribute"}) { … … 2436 2432 } else { 2437 2433 my ($functionName, @arguments) = $codeGenerator->GetterExpression(\%implIncludes, $interfaceName, $attribute); 2438 push(@arguments, "isNull") if $isNullable;2439 2434 if ($attribute->signature->extendedAttributes->{"ImplementedBy"}) { 2440 2435 my $implementedBy = $attribute->signature->extendedAttributes->{"ImplementedBy"}; … … 2457 2452 push(@implContent, " JSValue result = $jsType;\n"); 2458 2453 } 2459 2460 if ($isNullable) {2461 push(@implContent, " if (isNull)\n");2462 push(@implContent, " return JSValue::encode(jsNull());\n");2463 }2464 2454 } 2465 2455 … … 2468 2458 2469 2459 } else { 2470 if ($isNullable) {2471 push(@implContent, " bool isNull = false;\n");2472 unshift(@arguments, "isNull");2473 }2474 2475 2460 unshift(@arguments, GenerateCallWith($attribute->signature->extendedAttributes->{"CallWith"}, \@implContent, "JSValue::encode(jsUndefined())")); 2476 2461 … … 2484 2469 2485 2470 push(@implContent, " setDOMException(state, ec);\n"); 2486 2487 if ($isNullable) {2488 push(@implContent, " if (isNull)\n");2489 push(@implContent, " return JSValue::encode(jsNull());\n");2490 }2491 2471 2492 2472 push(@implContent, " return JSValue::encode(result);\n"); … … 4162 4142 } 4163 4143 4164 if ($signature->extendedAttributes->{"Reflect"} and ($type eq "unsigned long" or $type eq "unsigned short")) {4165 $value =~ s/getUnsignedIntegralAttribute/getIntegralAttribute/g;4166 return "jsNumber(std::max(0, " . $value . "))";4167 }4168 4169 4144 if ($codeGenerator->IsPrimitiveType($type) or $type eq "DOMTimeStamp") { 4170 return "jsNumber($value)"; 4145 # We could instead overload a function to work with optional as well as non-optional numbers, but this 4146 # is slightly better because it guarantees we will fail to compile if the IDL file doesn't match the C++. 4147 my $function = $signature->isNullable ? "toNullableJSNumber" : "jsNumber"; 4148 if ($signature->extendedAttributes->{"Reflect"} and ($type eq "unsigned long" or $type eq "unsigned short")) { 4149 $value =~ s/getUnsignedIntegralAttribute/getIntegralAttribute/g; 4150 return "$function(std::max(0, " . $value . "))"; 4151 } 4152 return "$function($value)"; 4171 4153 } 4172 4154 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorObjC.pm
r192750 r192839 106 106 # Constants 107 107 my $shouldUseCGColor = defined $ENV{PLATFORM_NAME} && $ENV{PLATFORM_NAME} ne "macosx"; 108 my $nullableInit = "bool isNull = false;";109 108 my $exceptionInit = "WebCore::ExceptionCode ec = 0;"; 110 109 my $jsContextSetter = "WebCore::JSMainThreadNullState state;"; … … 1361 1360 } 1362 1361 1362 # It would be easy to add nullable support here if we ever need it, but we probably never 1363 # will since we are unlikely to add Objective-C bindings that require it in the future. 1364 # In particular, we'd have to decide what return type to use for "number or null". 1365 1363 1366 my $getterContent; 1364 if ($hasGetterException || $attribute->signature->isNullable) {1367 if ($hasGetterException) { 1365 1368 $getterContent = $getterContentHead; 1366 1369 my $getterWithoutAttributes = $getterContentHead =~ /\($|, $/ ? "ec" : ", ec"; 1367 if ($attribute->signature->isNullable) {1368 $getterContent .= $getterWithoutAttributes ? "isNull" : ", isNull";1369 $getterWithoutAttributes = 0;1370 }1371 1370 if ($hasGetterException) { 1372 1371 $getterContent .= $getterWithoutAttributes ? "ec" : ", ec"; … … 1383 1382 push(@implContent, " $jsContextSetter\n"); 1384 1383 push(@implContent, @customGetterContent); 1385 1386 # FIXME: Should we return a default value when isNull == true?1387 if ($attribute->signature->isNullable) {1388 push(@implContents, " $nullableInit\n");1389 }1390 1384 1391 1385 if ($hasGetterException) { -
trunk/Source/WebCore/bindings/scripts/test/GObject/WebKitDOMTestObj.cpp
r190039 r192839 2416 2416 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), 0); 2417 2417 WebCore::TestObj* item = WebKit::core(self); 2418 bool isNull = false; 2419 gdouble result = item->nullableDoubleAttribute(isNull); 2418 gdouble result = item->nullableDoubleAttribute().valueOr(0); 2420 2419 return result; 2421 2420 } … … 2426 2425 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), 0); 2427 2426 WebCore::TestObj* item = WebKit::core(self); 2428 bool isNull = false; 2429 glong result = item->nullableLongAttribute(isNull); 2427 glong result = item->nullableLongAttribute().valueOr(0); 2430 2428 return result; 2431 2429 } … … 2436 2434 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), FALSE); 2437 2435 WebCore::TestObj* item = WebKit::core(self); 2438 bool isNull = false; 2439 gboolean result = item->nullableBooleanAttribute(isNull); 2436 gboolean result = item->nullableBooleanAttribute().valueOr(0); 2440 2437 return result; 2441 2438 } … … 2446 2443 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), 0); 2447 2444 WebCore::TestObj* item = WebKit::core(self); 2448 bool isNull = false; 2449 gchar* result = convertToUTF8String(item->nullableStringAttribute(isNull)); 2445 gchar* result = convertToUTF8String(item->nullableStringAttribute()); 2450 2446 return result; 2451 2447 } … … 2456 2452 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), 0); 2457 2453 WebCore::TestObj* item = WebKit::core(self); 2458 bool isNull = false; 2459 glong result = item->nullableLongSettableAttribute(isNull); 2454 glong result = item->nullableLongSettableAttribute().valueOr(0); 2460 2455 return result; 2461 2456 } … … 2475 2470 g_return_val_if_fail(!error || !*error, 0); 2476 2471 WebCore::TestObj* item = WebKit::core(self); 2477 bool isNull = false;2478 2472 WebCore::ExceptionCode ec = 0; 2479 glong result = item->nullableStringValue( isNull, ec);2473 glong result = item->nullableStringValue(ec).valueOr(0); 2480 2474 if (ec) { 2481 2475 WebCore::ExceptionCodeDescription ecdesc(ec); … … 2516 2510 g_return_val_if_fail(WEBKIT_DOM_IS_TEST_OBJ(self), 0); 2517 2511 WebCore::TestObj* item = WebKit::core(self); 2518 bool isNull = false; 2519 RefPtr<WebCore::TestNode> gobjectResult = WTF::getPtr(item->putForwardsNullableAttribute(isNull)); 2512 RefPtr<WebCore::TestNode> gobjectResult = WTF::getPtr(item->putForwardsNullableAttribute()); 2520 2513 return WebKit::kit(gobjectResult.get()); 2521 2514 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r191887 r192839 1825 1825 return throwGetterTypeError(*state, "TestObj", "nullableDoubleAttribute"); 1826 1826 } 1827 bool isNull = false; 1828 auto& impl = castedThis->wrapped(); 1829 JSValue result = jsNumber(impl.nullableDoubleAttribute(isNull)); 1830 if (isNull) 1831 return JSValue::encode(jsNull()); 1827 auto& impl = castedThis->wrapped(); 1828 JSValue result = toNullableJSNumber(impl.nullableDoubleAttribute()); 1832 1829 return JSValue::encode(result); 1833 1830 } … … 1845 1842 return throwGetterTypeError(*state, "TestObj", "nullableLongAttribute"); 1846 1843 } 1847 bool isNull = false; 1848 auto& impl = castedThis->wrapped(); 1849 JSValue result = jsNumber(impl.nullableLongAttribute(isNull)); 1850 if (isNull) 1851 return JSValue::encode(jsNull()); 1844 auto& impl = castedThis->wrapped(); 1845 JSValue result = toNullableJSNumber(impl.nullableLongAttribute()); 1852 1846 return JSValue::encode(result); 1853 1847 } … … 1865 1859 return throwGetterTypeError(*state, "TestObj", "nullableBooleanAttribute"); 1866 1860 } 1867 bool isNull = false; 1868 auto& impl = castedThis->wrapped(); 1869 JSValue result = jsBoolean(impl.nullableBooleanAttribute(isNull)); 1870 if (isNull) 1871 return JSValue::encode(jsNull()); 1861 auto& impl = castedThis->wrapped(); 1862 JSValue result = jsBoolean(impl.nullableBooleanAttribute()); 1872 1863 return JSValue::encode(result); 1873 1864 } … … 1885 1876 return throwGetterTypeError(*state, "TestObj", "nullableStringAttribute"); 1886 1877 } 1887 bool isNull = false; 1888 auto& impl = castedThis->wrapped(); 1889 JSValue result = jsStringWithCache(state, impl.nullableStringAttribute(isNull)); 1890 if (isNull) 1891 return JSValue::encode(jsNull()); 1878 auto& impl = castedThis->wrapped(); 1879 JSValue result = jsStringWithCache(state, impl.nullableStringAttribute()); 1892 1880 return JSValue::encode(result); 1893 1881 } … … 1905 1893 return throwGetterTypeError(*state, "TestObj", "nullableLongSettableAttribute"); 1906 1894 } 1907 bool isNull = false; 1908 auto& impl = castedThis->wrapped(); 1909 JSValue result = jsNumber(impl.nullableLongSettableAttribute(isNull)); 1910 if (isNull) 1911 return JSValue::encode(jsNull()); 1895 auto& impl = castedThis->wrapped(); 1896 JSValue result = toNullableJSNumber(impl.nullableLongSettableAttribute()); 1912 1897 return JSValue::encode(result); 1913 1898 } … … 1926 1911 } 1927 1912 ExceptionCode ec = 0; 1928 bool isNull = false; 1929 auto& impl = castedThis->wrapped(); 1930 JSValue result = jsNumber(impl.nullableStringValue(isNull, ec)); 1913 auto& impl = castedThis->wrapped(); 1914 JSValue result = toNullableJSNumber(impl.nullableStringValue(ec)); 1931 1915 setDOMException(state, ec); 1932 if (isNull)1933 return JSValue::encode(jsNull());1934 1916 return JSValue::encode(result); 1935 1917 } -
trunk/Source/WebCore/bindings/scripts/test/ObjC/DOMTestObj.mm
r190620 r192839 801 801 { 802 802 WebCore::JSMainThreadNullState state; 803 return IMPL->nullableDoubleAttribute( isNull);803 return IMPL->nullableDoubleAttribute(); 804 804 } 805 805 … … 807 807 { 808 808 WebCore::JSMainThreadNullState state; 809 return IMPL->nullableLongAttribute( isNull);809 return IMPL->nullableLongAttribute(); 810 810 } 811 811 … … 813 813 { 814 814 WebCore::JSMainThreadNullState state; 815 return IMPL->nullableBooleanAttribute( isNull);815 return IMPL->nullableBooleanAttribute(); 816 816 } 817 817 … … 819 819 { 820 820 WebCore::JSMainThreadNullState state; 821 return IMPL->nullableStringAttribute( isNull);821 return IMPL->nullableStringAttribute(); 822 822 } 823 823 … … 825 825 { 826 826 WebCore::JSMainThreadNullState state; 827 return IMPL->nullableLongSettableAttribute( isNull);827 return IMPL->nullableLongSettableAttribute(); 828 828 } 829 829 … … 838 838 WebCore::JSMainThreadNullState state; 839 839 WebCore::ExceptionCode ec = 0; 840 int result = IMPL->nullableStringValue( isNull,ec);840 int result = IMPL->nullableStringValue(ec); 841 841 WebCore::raiseOnDOMError(ec); 842 842 return result; … … 864 864 { 865 865 WebCore::JSMainThreadNullState state; 866 return kit(WTF::getPtr(IMPL->putForwardsNullableAttribute( isNull)));866 return kit(WTF::getPtr(IMPL->putForwardsNullableAttribute())); 867 867 } 868 868
Note: See TracChangeset
for help on using the changeset viewer.