Changeset 92104 in webkit
- Timestamp:
- Aug 1, 2011 1:13:55 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r92101 r92104 1 2011-07-28 Pavel Feldman <pfeldman@google.com> 2 3 Web Inspector: [protocol] methods where all parameters are optional should not require empty params object. 4 https://bugs.webkit.org/show_bug.cgi?id=65331 5 6 Reviewed by Yury Semikhatsky. 7 8 * inspector/report-protocol-errors-expected.txt: 9 1 10 2011-07-31 Adam Barth <abarth@webkit.org> 2 11 -
trunk/LayoutTests/inspector/report-API-errors-expected.txt
r83171 r92104 1 1 Tests that InspectorBackendStub is catching incorrect arguments. 2 2 3 Protocol Error: Invalid type of argument 'enabled' for method 'ConsoleAgent.setMonitoringXHREnabled' call. It shouldbe 'boolean' but it is 'number'.4 Protocol Error: Invalid number of arguments for method 'ConsoleAgent.setMonitoringXHREnabled' call. It shouldhave the next arguments '{"enabled":{"optional":false,"type":"boolean"}}'.5 Protocol Error: Optional callback argument for method 'ConsoleAgent.setMonitoringXHREnabled' call shouldbe a function but its type is 'string'.3 Protocol Error: Invalid type of argument 'enabled' for method 'ConsoleAgent.setMonitoringXHREnabled' call. It must be 'boolean' but it is 'number'. 4 Protocol Error: Invalid number of arguments for method 'ConsoleAgent.setMonitoringXHREnabled' call. It must have the next arguments '{"enabled":{"optional":false,"type":"boolean"}}'. 5 Protocol Error: Optional callback argument for method 'ConsoleAgent.setMonitoringXHREnabled' call must be a function but its type is 'string'. 6 6 Protocol Error: the message is for non-existing domain 'wrongDomain' 7 7 Protocol Error: Attempted to dispatch an unimplemented method 'Inspector.something-strange' -
trunk/LayoutTests/inspector/report-protocol-errors-expected.txt
r90110 r92104 4 4 error : { 5 5 code : -32700 6 message : "Message shouldbe in JSON format"6 message : "Message must be in JSON format" 7 7 } 8 8 id : null 9 9 } 10 10 error.code: -32700 11 error.getMessage(): Message shouldbe in JSON format12 error.toString(): Parse error(-32700): Message shouldbe in JSON format.11 error.getMessage(): Message must be in JSON format 12 error.toString(): Parse error(-32700): Message must be in JSON format. 13 13 ------------------------------------------------------- 14 14 { … … 26 26 error : { 27 27 code : -32600 28 message : "The type of 'id' property shouldbe number"28 message : "The type of 'id' property must be number" 29 29 } 30 30 id : null 31 31 } 32 32 error.code: -32600 33 error.getMessage(): The type of 'id' property shouldbe number34 error.toString(): Invalid Request(-32600): The type of 'id' property shouldbe number.33 error.getMessage(): The type of 'id' property must be number 34 error.toString(): Invalid Request(-32600): The type of 'id' property must be number. 35 35 ------------------------------------------------------- 36 36 { 37 37 error : { 38 38 code : -32600 39 message : "The type of 'method' property shouldbe string"39 message : "The type of 'method' property must be string" 40 40 } 41 41 id : 1 42 42 } 43 43 error.code: -32600 44 error.getMessage(): The type of 'method' property shouldbe string45 error.toString(): Invalid Request(-32600): The type of 'method' property shouldbe string.44 error.getMessage(): The type of 'method' property must be string 45 error.toString(): Invalid Request(-32600): The type of 'method' property must be string. 46 46 ------------------------------------------------------- 47 47 { … … 72 72 message : "Some arguments of method 'Page.getResourceContent' can't be processed" 73 73 data : [ 74 "'params' property with type 'object' was not found." 74 "'params' object must contain required parameter 'frameId' with type 'String'." 75 "'params' object must contain required parameter 'url' with type 'String'." 75 76 ] 76 77 } … … 79 80 error.code: -32602 80 81 error.getMessage(): Some arguments of method 'Page.getResourceContent' can't be processed 81 error.toString(): Invalid params(-32602): Some arguments of method 'Page.getResourceContent' can't be processed. 'params' property with type 'object' was not found. 82 ------------------------------------------------------- 83 { 84 error : { 85 code : -32602 86 message : "Some arguments of method 'Page.getResourceContent' can't be processed" 87 data : [ 88 "'params' property with type 'object' was not found." 82 error.toString(): Invalid params(-32602): Some arguments of method 'Page.getResourceContent' can't be processed. 'params' object must contain required parameter 'frameId' with type 'String'. 'params' object must contain required parameter 'url' with type 'String'. 83 ------------------------------------------------------- 84 { 85 error : { 86 code : -32602 87 message : "Some arguments of method 'Page.getResourceContent' can't be processed" 88 data : [ 89 "'params' object must contain required parameter 'frameId' with type 'String'." 90 "'params' object must contain required parameter 'url' with type 'String'." 89 91 ] 90 92 } … … 93 95 error.code: -32602 94 96 error.getMessage(): Some arguments of method 'Page.getResourceContent' can't be processed 95 error.toString(): Invalid params(-32602): Some arguments of method 'Page.getResourceContent' can't be processed. 'params' property with type 'object' was not found.97 error.toString(): Invalid params(-32602): Some arguments of method 'Page.getResourceContent' can't be processed. 'params' object must contain required parameter 'frameId' with type 'String'. 'params' object must contain required parameter 'url' with type 'String'. 96 98 ------------------------------------------------------- 97 99 { -
trunk/Source/WebCore/ChangeLog
r92103 r92104 1 2011-07-28 Pavel Feldman <pfeldman@google.com> 2 3 Web Inspector: [protocol] methods where all parameters are optional should not require empty params object. 4 https://bugs.webkit.org/show_bug.cgi?id=65331 5 6 Reviewed by Yury Semikhatsky. 7 8 * inspector/CodeGeneratorInspector.pm: 9 (generateBackendFunction): 10 (generateArgumentGetters): 11 1 12 2011-08-01 Adam Barth <abarth@webkit.org> 2 13 -
trunk/Source/WebCore/inspector/CodeGeneratorInspector.pm
r90558 r92104 457 457 my $indent = ""; 458 458 if (scalar(@inArgs)) { 459 push(@function, " if (RefPtr<InspectorObject> paramsContainer = requestMessageObject->getObject(\"params\")) {");460 push(@function, " 461 push(@function, " 459 push(@function, " RefPtr<InspectorObject> paramsContainer = requestMessageObject->getObject(\"params\");"); 460 push(@function, " InspectorObject* paramsContainerPtr = paramsContainer.get();"); 461 push(@function, " InspectorArray* protocolErrorsPtr = protocolErrors.get();"); 462 462 463 463 foreach my $parameter (@inArgs) { … … 467 467 my $optionalFlagArgument = "0"; 468 468 if ($parameter->extendedAttributes->{"optional"}) { 469 push(@function, " 469 push(@function, " bool ${name}_valueFound = false;"); 470 470 $optionalFlagArgument = "&${name}_valueFound"; 471 471 } 472 push(@function, " 472 push(@function, " " . typeTraits($type, "variable") . " in_$name = get$typeString(paramsContainerPtr, \"$name\", $optionalFlagArgument, protocolErrorsPtr);"); 473 473 } 474 474 push(@function, ""); … … 483 483 map("&out_" . $_->name, @outArgs))); 484 484 485 push(@function, "$indent if (!protocolErrors->length())"); 486 push(@function, "$indent $domainAccessor->$functionName($args);"); 487 if (scalar(@inArgs)) { 488 push(@function, " } else"); 489 push(@function, " protocolErrors->pushString(\"'params' property with type 'object' was not found.\");"); 490 } 485 push(@function, $indent . "if (!protocolErrors->length())"); 486 push(@function, $indent . " $domainAccessor->$functionName($args);"); 491 487 push(@function, ""); 492 488 push(@function, " RefPtr<InspectorObject> result = InspectorObject::create();"); … … 591 587 $return InspectorBackendDispatcher::get$typeString(InspectorObject* object, const String& name, bool* valueFound, InspectorArray* protocolErrors) 592 588 { 593 ASSERT(object);594 589 ASSERT(protocolErrors); 595 590 … … 598 593 599 594 $variable value = $defaultValue; 595 596 if (!object) { 597 if (!valueFound) { 598 // Required parameter in missing params container. 599 protocolErrors->pushString(String::format("'params' object must contain required parameter '\%s' with type '$json'.", name.utf8().data())); 600 } 601 return value; 602 } 603 600 604 InspectorObject::const_iterator end = object->end(); 601 605 InspectorObject::const_iterator valueIterator = object->find(name); … … 608 612 609 613 if (!valueIterator->second->as$json(&value)) 610 protocolErrors->pushString(String::format("Parameter '\%s' has wrong type. It shouldbe '$json'.", name.utf8().data()));614 protocolErrors->pushString(String::format("Parameter '\%s' has wrong type. It must be '$json'.", name.utf8().data())); 611 615 else 612 616 if (valueFound) … … 645 649 RefPtr<InspectorValue> parsedMessage = InspectorValue::parseJSON(message); 646 650 if (!parsedMessage) { 647 reportProtocolError(0, ParseError, "Message shouldbe in JSON format");651 reportProtocolError(0, ParseError, "Message must be in JSON format"); 648 652 return; 649 653 } … … 651 655 RefPtr<InspectorObject> messageObject = parsedMessage->asObject(); 652 656 if (!messageObject) { 653 reportProtocolError(0, InvalidRequest, "Message shouldbe a JSONified object");657 reportProtocolError(0, InvalidRequest, "Message must be a JSONified object"); 654 658 return; 655 659 } … … 662 666 663 667 if (!callIdValue->asNumber(&callId)) { 664 reportProtocolError(0, InvalidRequest, "The type of 'id' property shouldbe number");668 reportProtocolError(0, InvalidRequest, "The type of 'id' property must be number"); 665 669 return; 666 670 } … … 674 678 String method; 675 679 if (!methodValue->asString(&method)) { 676 reportProtocolError(&callId, InvalidRequest, "The type of 'method' property shouldbe string");680 reportProtocolError(&callId, InvalidRequest, "The type of 'method' property must be string"); 677 681 return; 678 682 } … … 793 797 var agentMethod = domainAndMethod[0] + "Agent." + domainAndMethod[1]; 794 798 799 var hasParams = false; 795 800 if (request.params) { 796 801 for (var key in request.params) { … … 799 804 800 805 if (args.length === 0 && !optionalFlag) { 801 console.error("Protocol Error: Invalid number of arguments for method '" + agentMethod + "' call. It shouldhave the next arguments '" + JSON.stringify(request.params) + "'.");806 console.error("Protocol Error: Invalid number of arguments for method '" + agentMethod + "' call. It must have the next arguments '" + JSON.stringify(request.params) + "'."); 802 807 return; 803 808 } … … 810 815 811 816 if (typeof value !== typeName) { 812 console.error("Protocol Error: Invalid type of argument '" + key + "' for method '" + agentMethod + "' call. It shouldbe '" + typeName + "' but it is '" + typeof value + "'.");817 console.error("Protocol Error: Invalid type of argument '" + key + "' for method '" + agentMethod + "' call. It must be '" + typeName + "' but it is '" + typeof value + "'."); 813 818 return; 814 819 } 815 820 816 821 request.params[key] = value; 822 hasParams = true; 817 823 } 824 if (!hasParams) 825 delete request.params; 818 826 } 819 827 820 828 if (args.length === 1 && !callback) { 821 829 if (typeof args[0] !== "undefined") { 822 console.error("Protocol Error: Optional callback argument for method '" + agentMethod + "' call shouldbe a function but its type is '" + typeof args[0] + "'.");830 console.error("Protocol Error: Optional callback argument for method '" + agentMethod + "' call must be a function but its type is '" + typeof args[0] + "'."); 823 831 return; 824 832 }
Note: See TracChangeset
for help on using the changeset viewer.