Changeset 206090 in webkit
- Timestamp:
- Sep 19, 2016 2:00:38 AM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r206076 r206090 1 2016-09-19 Nael Ouedraogo <nael.ouedraogo@crf.canon.fr> 2 3 JSDOMBindings' toArguments() should return a more descriptive object 4 https://bugs.webkit.org/show_bug.cgi?id=161793 5 6 Reviewed by Youenn Fablet. 7 8 Replace std::pair with new VariadicHelperResult class with more 9 readable members names. 10 11 No additional tests required. 12 13 * bindings/js/JSDOMBinding.h: 14 (WebCore::VariadicHelper::Result::Result): 15 * bindings/scripts/CodeGeneratorJS.pm: 16 (GenerateParametersCheck): 17 * bindings/scripts/test/JS/JSTestObj.cpp: 18 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod12): 19 (WebCore::jsTestObjPrototypeFunctionVariadicStringMethod): 20 (WebCore::jsTestObjPrototypeFunctionVariadicDoubleMethod): 21 (WebCore::jsTestObjPrototypeFunctionVariadicNodeMethod): 22 1 23 2016-09-18 Alex Christensen <achristensen@webkit.org> 2 24 -
trunk/Source/WebCore/bindings/js/JSDOMBinding.h
r205953 r206090 357 357 using Item = typename VariadicHelperBase<JSClass, DOMClass>::Item; 358 358 using Container = Vector<Item>; 359 using Result = typename std::pair<size_t, Optional<Container>>; 359 360 struct Result { 361 Result(size_t argumentIndex, Optional<Container>&& arguments) 362 : argumentIndex(argumentIndex) 363 , arguments(WTFMove(arguments)) 364 { 365 } 366 size_t argumentIndex; 367 Optional<Container> arguments; 368 }; 360 369 }; 361 370 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r206011 r206090 4011 4011 } 4012 4012 else { 4013 push(@$outputArray, " if (!$name. second)\n");4014 push(@$outputArray, " return throwArgumentTypeError(*state, throwScope, $name. first, \"$name\", \"$visibleInterfaceName\", $quotedFunctionName, \"$type\");\n");4015 } 4016 $value = "WTFMove( *$name.second)";4013 push(@$outputArray, " if (!$name.arguments)\n"); 4014 push(@$outputArray, " return throwArgumentTypeError(*state, throwScope, $name.argumentIndex, \"$name\", \"$visibleInterfaceName\", $quotedFunctionName, \"$type\");\n"); 4015 } 4016 $value = "WTFMove($name.arguments.value())"; 4017 4017 4018 4018 } elsif ($codeGenerator->IsEnumType($type)) { -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r206011 r206090 6552 6552 auto& impl = castedThis->wrapped(); 6553 6553 auto blobArgs = toArguments<VariadicHelper<JSBlob, Blob>>(*state, 0); 6554 if (!blobArgs. second)6555 return throwArgumentTypeError(*state, throwScope, blobArgs. first, "blobArgs", "TestObject", "overloadedMethod", "Blob");6556 impl.overloadedMethod(WTFMove( *blobArgs.second));6554 if (!blobArgs.arguments) 6555 return throwArgumentTypeError(*state, throwScope, blobArgs.argumentIndex, "blobArgs", "TestObject", "overloadedMethod", "Blob"); 6556 impl.overloadedMethod(WTFMove(blobArgs.arguments.value())); 6557 6557 return JSValue::encode(jsUndefined()); 6558 6558 } … … 7087 7087 if (UNLIKELY(throwScope.exception())) 7088 7088 return JSValue::encode(jsUndefined()); 7089 impl.variadicStringMethod(WTFMove(head), WTFMove( *tail.second));7089 impl.variadicStringMethod(WTFMove(head), WTFMove(tail.arguments.value())); 7090 7090 return JSValue::encode(jsUndefined()); 7091 7091 } … … 7110 7110 if (UNLIKELY(throwScope.exception())) 7111 7111 return JSValue::encode(jsUndefined()); 7112 impl.variadicDoubleMethod(WTFMove(head), WTFMove( *tail.second));7112 impl.variadicDoubleMethod(WTFMove(head), WTFMove(tail.arguments.value())); 7113 7113 return JSValue::encode(jsUndefined()); 7114 7114 } … … 7131 7131 return throwArgumentTypeError(*state, throwScope, 0, "head", "TestObject", "variadicNodeMethod", "Node"); 7132 7132 auto tail = toArguments<VariadicHelper<JSNode, Node>>(*state, 1); 7133 if (!tail. second)7134 return throwArgumentTypeError(*state, throwScope, tail. first, "tail", "TestObject", "variadicNodeMethod", "Node");7135 impl.variadicNodeMethod(*head, WTFMove( *tail.second));7133 if (!tail.arguments) 7134 return throwArgumentTypeError(*state, throwScope, tail.argumentIndex, "tail", "TestObject", "variadicNodeMethod", "Node"); 7135 impl.variadicNodeMethod(*head, WTFMove(tail.arguments.value())); 7136 7136 return JSValue::encode(jsUndefined()); 7137 7137 }
Note: See TracChangeset
for help on using the changeset viewer.