Changeset 65804 in webkit
- Timestamp:
- Aug 23, 2010 5:28:01 AM (14 years ago)
- Location:
- trunk/WebCore
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/WebCore/ChangeLog
r65803 r65804 1 2010-08-23 Sheriff Bot <webkit.review.bot@gmail.com> 2 3 Unreviewed, rolling out r65803. 4 http://trac.webkit.org/changeset/65803 5 https://bugs.webkit.org/show_bug.cgi?id=44416 6 7 windows build failed (Requested by loislo on #webkit). 8 9 * inspector/CodeGeneratorInspector.pm: 10 * inspector/Inspector.idl: 11 * inspector/InspectorController.cpp: 12 * inspector/InspectorController.h: 13 * inspector/InspectorFrontendClientLocal.cpp: 14 (WebCore::InspectorFrontendClientLocal::setAttachedWindow): 15 * inspector/InspectorValues.h: 16 * inspector/front-end/Callback.js: 17 (WebInspector.Callback.prototype.processResponse): 18 * inspector/front-end/inspector.js: 19 (WebInspector.dispatch.delayDispatch): 20 (WebInspector.dispatch): 21 (WebInspector_syncDispatch): 22 (WebInspector.dispatchMessageFromBackend): 23 (WebInspector.reportProtocolError): 24 1 25 2010-08-23 Ilya Tikhonovsky <loislo@chromium.org> 2 26 -
trunk/WebCore/inspector/CodeGeneratorInspector.pm
r65803 r65804 18 18 "forward" => "InspectorBackend", 19 19 "header" => "InspectorBackend.h", 20 " domainAccessor" => "m_inspectorController->inspectorBackend()",20 "handlerAccessor" => "m_inspectorController->inspectorBackend()", 21 21 }; 22 22 $typeTransform{"Controller"} = { 23 23 "forwardHeader" => "InspectorController.h", 24 " domainAccessor" => "m_inspectorController",24 "handlerAccessor" => "m_inspectorController", 25 25 }; 26 26 $typeTransform{"Debug"} = { 27 27 "forward" => "InspectorDebuggerAgent", 28 28 "header" => "InspectorDebuggerAgent.h", 29 " domainAccessor" => "m_inspectorController->debuggerAgent()",29 "handlerAccessor" => "m_inspectorController->debuggerAgent()", 30 30 }; 31 31 $typeTransform{"DOM"} = { 32 32 "forward" => "InspectorDOMAgent", 33 33 "header" => "InspectorDOMAgent.h", 34 " domainAccessor" => "m_inspectorController->domAgent()",34 "handlerAccessor" => "m_inspectorController->domAgent()", 35 35 }; 36 36 $typeTransform{"ApplicationCache"} = { 37 37 "forward" => "InspectorApplicationCacheAgent", 38 38 "header" => "InspectorApplicationCacheAgent.h", 39 " domainAccessor" => "m_inspectorController->applicationCacheAgent()",39 "handlerAccessor" => "m_inspectorController->applicationCacheAgent()", 40 40 }; 41 41 $typeTransform{"Profiler"} = { 42 42 "forward" => "InspectorProfilerAgent", 43 43 "header" => "InspectorProfilerAgent.h", 44 " domainAccessor" => "m_inspectorController->profilerAgent()",44 "handlerAccessor" => "m_inspectorController->profilerAgent()", 45 45 }; 46 46 $typeTransform{"Frontend"} = { … … 57 57 "forward" => "InspectorObject", 58 58 "header" => "InspectorValues.h", 59 " JSONType" => "Object"59 "accessorSuffix" => "Object" 60 60 }; 61 61 $typeTransform{"Array"} = { … … 65 65 "forward" => "InspectorArray", 66 66 "header" => "InspectorValues.h", 67 " JSONType" => "Array"67 "accessorSuffix" => "Array" 68 68 }; 69 69 $typeTransform{"Value"} = { … … 73 73 "forward" => "InspectorValue", 74 74 "header" => "InspectorValues.h", 75 " JSONType" => "Value"75 "accessorSuffix" => "Value" 76 76 }; 77 77 $typeTransform{"String"} = { … … 80 80 "forwardHeader" => "wtf/Forward.h", 81 81 "header" => "PlatformString.h", 82 " JSONType" => "String"82 "accessorSuffix" => "String" 83 83 }; 84 84 $typeTransform{"long"} = { … … 88 88 "forward" => "", 89 89 "header" => "", 90 " JSONType" => "Number"90 "accessorSuffix" => "Number" 91 91 }; 92 92 $typeTransform{"int"} = { … … 96 96 "forward" => "", 97 97 "header" => "", 98 " JSONType" => "Number",98 "accessorSuffix" => "Number", 99 99 }; 100 100 $typeTransform{"unsigned long"} = { … … 104 104 "forward" => "", 105 105 "header" => "", 106 " JSONType" => "Number"106 "accessorSuffix" => "Number" 107 107 }; 108 108 $typeTransform{"unsigned int"} = { … … 112 112 "forward" => "", 113 113 "header" => "", 114 " JSONType" => "Number"114 "accessorSuffix" => "Number" 115 115 }; 116 116 $typeTransform{"boolean"} = { … … 120 120 "forward" => "", 121 121 "header" => "", 122 " JSONType" => "Bool"122 "accessorSuffix" => "Bool" 123 123 }; 124 124 $typeTransform{"void"} = { … … 162 162 my @frontendConstantDefinitions; 163 163 my $frontendFooter; 164 165 my $callId = new domSignature(); # it is just structure for describing parameters from IDLStructure.pm. 166 $callId->type("long"); 167 $callId->name("callId"); 164 168 165 169 # Default constructor … … 219 223 $backendTypes{"InspectorClient"} = 1; 220 224 $backendTypes{"PassRefPtr"} = 1; 221 $backendTypes{"Object"} = 1; 222 225 $backendTypes{"Array"} = 1; 226 227 push(@backendMethodsImpl, generateBackendPrivateFunctions()); 223 228 push(@backendMethodsImpl, generateBackendMessageParser()); 224 229 generateFunctions($interface); … … 255 260 map($frontendTypes{$_->type} = 1, @argsFiltered); # register required types. 256 261 my $arguments = join(", ", map($typeTransform{$_->type}->{"param"} . " " . $_->name, @argsFiltered)); # prepare arguments for function signature. 262 my @pushArguments = map(" arguments->push" . $typeTransform{$_->type}->{"accessorSuffix"} . "(" . $_->name . ");", @argsFiltered); 257 263 258 264 my $signature = " void ${functionName}(${arguments});"; … … 263 269 push(@function, "void ${frontendClassName}::${functionName}(${arguments})"); 264 270 push(@function, "{"); 265 push(@function, " RefPtr<InspectorObject> ${functionName}Message = InspectorObject::create();"); 266 push(@function, " ${functionName}Message->setString(\"type\", \"event\");"); 267 push(@function, " ${functionName}Message->setString(\"event\", \"$functionName\");"); 268 push(@function, " RefPtr<InspectorObject> payloadDataObject = InspectorObject::create();"); 269 my @pushArguments = map(" payloadDataObject->set" . $typeTransform{$_->type}->{"JSONType"} . "(\"" . $_->name . "\", " . $_->name . ");", @argsFiltered); 271 push(@function, " RefPtr<InspectorArray> arguments = InspectorArray::create();"); 272 push(@function, " arguments->pushString(\"$functionName\");"); 270 273 push(@function, @pushArguments); 271 push(@function, " ${functionName}Message->setObject(\"data\", payloadDataObject);"); 272 push(@function, " m_inspectorClient->sendMessageToFrontend(${functionName}Message->toJSONString());"); 274 push(@function, " m_inspectorClient->sendMessageToFrontend(arguments->toJSONString());"); 273 275 274 276 push(@function, "}"); … … 278 280 } 279 281 282 sub generateBackendPrivateFunctions 283 { 284 my $privateFunctions = << "EOF"; 285 static String formatWrongArgumentsCountMessage(unsigned expected, unsigned actual) 286 { 287 return String::format("Wrong number of parameters: %d (expected: %d)", actual, expected); 288 } 289 290 static String formatWrongArgumentTypeMessage(unsigned position, const char* name, const char* expectedType) 291 { 292 return String::format("Failed to convert parameter %d (%s) to %s", position, name, expectedType); 293 } 294 EOF 295 return split("\n", $privateFunctions); 296 } 297 280 298 sub generateBackendFunction 281 299 { … … 288 306 289 307 map($backendTypes{$_->type} = 1, @{$function->parameters}); # register required types 290 my @inArgs = grep($_->direction eq "in" && !($_->name eq "callId"), @{$function->parameters});308 my @inArgs = grep($_->direction eq "in", @{$function->parameters}); 291 309 my @outArgs = grep($_->direction eq "out", @{$function->parameters}); 292 310 293 my $signature = " void ${functionName}( long callId, InspectorObject* requestMessageObject);";311 my $signature = " void ${functionName}(PassRefPtr<InspectorArray> args);"; 294 312 !$backendMethods{${signature}} || die "Duplicate function was detected for signature '$signature'."; 295 313 $backendMethods{${signature}} = $functionName; 296 314 297 315 my @function; 298 my $requestMessageObject = scalar(@inArgs) ? " requestMessageObject" : ""; 299 push(@function, "void ${backendClassName}::${functionName}(long callId, InspectorObject*$requestMessageObject)"); 316 push(@function, "void ${backendClassName}::${functionName}(PassRefPtr<InspectorArray> args)"); 300 317 push(@function, "{"); 301 push(@function, " RefPtr<InspectorArray> protocolErrors = InspectorArray::create();");318 push(@function, " long callId = 0;"); 302 319 push(@function, ""); 303 320 304 my $domain = $function->signature->extendedAttributes->{"handler"} || "Controller"; 305 my $domainAccessor = $typeTransform{$domain}->{"domainAccessor"}; 306 $backendTypes{$domain} = 1; 307 push(@function, " if (!$domainAccessor)"); 308 push(@function, " protocolErrors->pushString(String::format(\"Error: %s handler is not available.\", \"$domain\"));"); 321 my $expectedParametersCount = scalar(@inArgs); 322 my $expectedParametersCountWithMethodName = scalar(@inArgs) + 1; 323 push(@function, " if (args->length() != $expectedParametersCountWithMethodName) {"); 324 push(@function, " ASSERT_NOT_REACHED();"); 325 push(@function, " reportProtocolError(callId, ${functionName}Cmd, formatWrongArgumentsCountMessage(args->length() - 1, $expectedParametersCount));"); 326 push(@function, " return;"); 327 push(@function, " }"); 309 328 push(@function, ""); 310 329 311 if (scalar(@inArgs)) { 312 # declare variables for all 'in' args; 313 push(@function, map(" " . $typeTransform{$_->type}->{"variable"} . " " . $_->name . ";", @inArgs)); 314 330 my $i = 1; # zero element is the method name. 331 foreach my $parameter (@inArgs) { 332 my $type = $parameter->type; 333 my $argumentType = $typeTransform{$type}->{"variable"}; 334 push(@function, " $argumentType " . $parameter->name . ";") if !($parameter->name eq "callId"); 335 push(@function, " if (!args->get($i)->as" . $typeTransform{$type}->{"accessorSuffix"} . "(&" . $parameter->name . ")) {"); 336 push(@function, " ASSERT_NOT_REACHED();"); 337 push(@function, " reportProtocolError(callId, ${functionName}Cmd, formatWrongArgumentTypeMessage($i, \"" . $parameter->name . "\", \"$type\"));"); 338 push(@function, " return;"); 339 push(@function, " }"); 315 340 push(@function, ""); 316 push(@function, " RefPtr<InspectorObject> argumentsContainer;"); 317 push(@function, " if (!(argumentsContainer = requestMessageObject->getObject(\"arguments\"))) {"); 318 push(@function, " ASSERT_NOT_REACHED();"); 319 push(@function, " protocolErrors->pushString(String::format(\"Error: arguments object was not found.\"));"); 320 push(@function, " } else {"); 321 push(@function, " InspectorObject::const_iterator argumentsEndIterator = argumentsContainer->end();"); 322 323 foreach my $parameter (@inArgs) { 324 my $name = $parameter->name; 325 my $type = $parameter->type; 326 my $variableType = $typeTransform{$type}->{"variable"}; 327 my $JSONType = $typeTransform{$type}->{"JSONType"}; 328 329 push(@function, ""); 330 push(@function, " InspectorObject::const_iterator ${name}ValueIterator = argumentsContainer->find(\"$name\");"); 331 push(@function, " if (${name}ValueIterator == argumentsEndIterator) {"); 332 push(@function, " ASSERT_NOT_REACHED();"); 333 push(@function, " protocolErrors->pushString(String::format(\"Error: Argument '%s' with type '%s' was not found.\", \"$name\", \"$JSONType\"));"); 334 push(@function, " } else {"); 335 push(@function, " if (!${name}ValueIterator->second->as$JSONType(&$name)) {"); 336 push(@function, " ASSERT_NOT_REACHED();"); 337 push(@function, " protocolErrors->pushString(String::format(\"Error: Argument '%s' has wrong type. It should be '%s'.\", \"$name\", \"$JSONType\"));"); 338 push(@function, " }"); 339 push(@function, " }"); 340 } 341 push(@function, " }"); 342 } 341 ++$i; 342 } 343 344 my $handler = $function->signature->extendedAttributes->{"handler"} || "Controller"; 345 my $handlerAccessor = $typeTransform{$handler}->{"handlerAccessor"}; 346 $backendTypes{$handler} = 1; 347 push(@function, " if (!$handlerAccessor) {"); 348 push(@function, " reportProtocolError(callId, ${functionName}Cmd, \"Error: $handler handler is not available.\");"); 349 push(@function, " return;"); 350 push(@function, " }"); 351 push(@function, ""); 352 343 353 344 354 foreach (@outArgs) { # declare local variables for out arguments. 345 355 my $initializer = $typeTransform{$_->type}->{"defaultValue"} ? " = " . $typeTransform{$_->type}->{"defaultValue"} : ""; 346 push(@function, " " . $typeTransform{$_->type}->{"variable"} . " " . $_->name . "$initializer;"); 347 } 348 349 my $args = join(", ", (map($_->name, @inArgs), map("&" . $_->name, @outArgs))); 350 push(@function, " if (!protocolErrors->length())"); 351 push(@function, " $domainAccessor->$functionName($args);"); 352 push(@function, ""); 353 354 push(@function, " // use InspectorFrontend as a marker of WebInspector availability"); 355 push(@function, " if (callId && m_inspectorController->hasFrontend()) {"); 356 push(@function, " RefPtr<InspectorObject> responseMessage = InspectorObject::create();"); 357 push(@function, " responseMessage->setNumber(\"seq\", callId);"); 358 push(@function, " responseMessage->setString(\"type\", \"response\");"); 359 push(@function, " responseMessage->setString(\"domain\", \"$domain\");"); 360 push(@function, " responseMessage->setString(\"command\", \"$functionName\");"); 361 push(@function, " responseMessage->setBool(\"success\", !protocolErrors->length());"); 362 push(@function, ""); 363 push(@function, " if (protocolErrors->length())"); 364 push(@function, " responseMessage->setArray(\"errors\", protocolErrors);"); 365 if (scalar(@outArgs)) { 366 push(@function, " else {"); 367 push(@function, " RefPtr<InspectorObject> responseData = InspectorObject::create();"); 368 push(@function, map(" responseData->set" . $typeTransform{$_->type}->{"JSONType"} . "(\"" . $_->name . "\", " . $_->name . ");", @outArgs)); 369 push(@function, " responseMessage->setObject(\"data\", responseData);"); 370 push(@function, " }"); 371 } 372 push(@function, " m_inspectorController->inspectorClient()->sendMessageToFrontend(responseMessage->toJSONString());"); 373 push(@function, " }"); 374 375 356 push(@function, " " . $typeTransform{$_->type}->{"variable"} . " " . $_->name . "$initializer;"); 357 } 358 359 my $args = join(", ", (grep(!($_ eq "callId"), map($_->name, @inArgs)), map("&" . $_->name, @outArgs))); 360 push(@function, " $handlerAccessor->$functionName($args);"); 361 362 # The results of function call should be transfered back to frontend. 363 if (scalar(grep($_->name eq "callId", @inArgs))) { 364 my @pushArguments = map(" arguments->push" . $typeTransform{$_->type}->{"accessorSuffix"} . "(" . $_->name . ");", @outArgs); 365 366 push(@function, ""); 367 push(@function, " // use InspectorFrontend as a marker of WebInspector availability"); 368 push(@function, " if (m_inspectorController->hasFrontend()) {"); 369 push(@function, " RefPtr<InspectorArray> arguments = InspectorArray::create();"); 370 push(@function, " arguments->pushString(\"processResponse\");"); 371 push(@function, " arguments->pushNumber(callId);"); 372 push(@function, @pushArguments); 373 push(@function, " m_inspectorController->inspectorClient()->sendMessageToFrontend(arguments->toJSONString());"); 374 push(@function, " }"); 375 } 376 376 push(@function, "}"); 377 377 push(@function, ""); … … 385 385 void ${backendClassName}::reportProtocolError(const long callId, const String& method, const String& errorText) const 386 386 { 387 RefPtr<InspectorObject> message = InspectorObject::create(); 388 message->setNumber("seq", callId); 389 message->setString("type", "error"); 390 message->setString("domain", "inspectorProtocol"); 391 message->setString("command", method); 392 message->setBool("success", false); 393 RefPtr<InspectorArray> errors = InspectorArray::create(); 394 errors->pushString(errorText); 395 message->setArray("errors", errors); 396 m_inspectorController->inspectorClient()->sendMessageToFrontend(message->toJSONString()); 387 RefPtr<InspectorArray> arguments = InspectorArray::create(); 388 arguments->pushString("reportProtocolError"); 389 arguments->pushNumber(callId); 390 arguments->pushString(method); 391 arguments->pushString(errorText); 392 m_inspectorController->inspectorClient()->sendMessageToFrontend(arguments->toJSONString()); 397 393 } 398 394 EOF 399 395 return split("\n", $reportProtocolError); 400 396 } 401 402 397 403 398 sub generateBackendDispatcher … … 411 406 void ${backendClassName}::dispatch(const String& message) 412 407 { 413 typedef void (${backendClassName}::*CallHandler)( long callId, InspectorObject* messageObject);408 typedef void (${backendClassName}::*CallHandler)(PassRefPtr<InspectorArray> args); 414 409 typedef HashMap<String, CallHandler> DispatchMap; 415 410 DEFINE_STATIC_LOCAL(DispatchMap, dispatchMap, ); 416 long callId = 0;417 418 411 if (dispatchMap.isEmpty()) { 419 412 $mapEntries … … 423 416 if (!parsedMessage) { 424 417 ASSERT_NOT_REACHED(); 425 reportProtocolError( callId, "dispatch", "Error: Invalid message format. Message should be in JSON format.");418 reportProtocolError(0, "dispatch", "Error: Invalid message format. Message should be in JSON format."); 426 419 return; 427 420 } 428 421 429 RefPtr<Inspector Object> messageObject = parsedMessage->asObject();430 if (!message Object) {422 RefPtr<InspectorArray> messageArray = parsedMessage->asArray(); 423 if (!messageArray) { 431 424 ASSERT_NOT_REACHED(); 432 reportProtocolError( callId, "dispatch", "Error: Invalid message format. The message should be a JSONified object.");425 reportProtocolError(0, "dispatch", "Error: Invalid message format. The message should be a JSONified array of arguments."); 433 426 return; 434 427 } 435 428 436 RefPtr<InspectorValue> callIdValue = messageObject->get("seq"); 437 if (!callIdValue) { 429 if (!messageArray->length()) { 438 430 ASSERT_NOT_REACHED(); 439 reportProtocolError( callId, "dispatch", "Error: Invalid message format. 'seq' property was not found in the request.");431 reportProtocolError(0, "dispatch", "Error: Invalid message format. Empty message was received."); 440 432 return; 441 433 } 442 434 443 if (!callIdValue->asNumber(&callId)) { 435 String methodName; 436 if (!messageArray->get(0)->asString(&methodName)) { 444 437 ASSERT_NOT_REACHED(); 445 reportProtocolError( callId, "dispatch", "Error: Invalid message format. the type of 'seq' property should be number.");438 reportProtocolError(0, "dispatch", "Error: Invalid message format. The first element of the message should be method name."); 446 439 return; 447 440 } 448 441 449 RefPtr<InspectorValue> commandValue = messageObject->get("command"); 450 if (!commandValue) { 451 ASSERT_NOT_REACHED(); 452 reportProtocolError(callId, "dispatch", "Error: Invalid message format. 'command' property wasn't found."); 453 return; 454 } 455 456 String command; 457 if (!commandValue->asString(&command)) { 458 ASSERT_NOT_REACHED(); 459 reportProtocolError(callId, "dispatch", "Error: Invalid message format. The type of 'command' property should be string."); 460 return; 461 } 462 463 HashMap<String, CallHandler>::iterator it = dispatchMap.find(command); 442 HashMap<String, CallHandler>::iterator it = dispatchMap.find(methodName); 464 443 if (it == dispatchMap.end()) { 465 444 ASSERT_NOT_REACHED(); 466 reportProtocolError( callId, "dispatch", String::format("Error: Invalid command was received. '%s' wasn't found.", command.utf8().data()));445 reportProtocolError(0, "dispatch", String::format("Error: Invalid method name. '%s' wasn't found.", methodName.utf8().data())); 467 446 return; 468 447 } 469 448 470 ((*this).*it->second)( callId, messageObject.get());449 ((*this).*it->second)(messageArray); 471 450 } 472 451 EOF … … 482 461 if (!value) 483 462 return false; 484 485 RefPtr<InspectorObject> object = value->asObject(); 486 if (!object) 463 RefPtr<InspectorArray> array = value->asArray(); 464 if (!array) 487 465 return false; 488 466 489 RefPtr<InspectorValue> commandValue = object->get("command"); 490 if (!commandValue) 467 if (!array->length()) 491 468 return false; 492 493 return commandValue->asString(result); 494 } 495 469 return array->get(0)->asString(result); 470 } 496 471 EOF 497 472 return split("\n", $messageParserBody); … … 502 477 my $interface = shift; 503 478 my @backendFunctions = grep(!$_->signature->extendedAttributes->{"notify"}, @{$interface->functions}); 504 my @JSStubs; 505 506 foreach my $function (@backendFunctions) { 507 my $name = $function->signature->name; 508 my $domain = $function->signature->extendedAttributes->{"handler"}; 509 my $argumentNames = join(",", map("\"" . $_->name . "\": null", grep($_->direction eq "in", @{$function->parameters}))); 510 push(@JSStubs, " this._registerDelegate('{" . 511 "\"seq\": 0, " . 512 "\"type\": \"request\", " . 513 "\"domain\": \"$domain\", " . 514 "\"command\": \"$name\", " . 515 "\"arguments\": {$argumentNames}" . 516 "}');"); 517 } 479 my @JSStubs = map(" this._registerDelegate(\"" . $_->signature->name . "\");", @backendFunctions); 518 480 519 481 my $JSStubs = join("\n", @JSStubs); … … 527 489 528 490 WebInspector.InspectorBackendStub.prototype = { 529 _registerDelegate: function( commandInfo)491 _registerDelegate: function(methodName) 530 492 { 531 var commandObject = JSON.parse(commandInfo); 532 this[commandObject.command] = this.sendMessageToBackend.bind(this, commandInfo); 493 this[methodName] = this.sendMessageToBackend.bind(this, methodName); 533 494 }, 534 495 535 496 sendMessageToBackend: function() 536 497 { 537 var args = Array.prototype.slice.call(arguments); 538 var request = JSON.parse(args.shift()); 539 for (var key in request.arguments) { 540 if (key === "callId") 541 request.seq = args.shift(); 542 else 543 request.arguments[key] = args.shift(); 544 } 545 if (args.length === 1 && typeof args[0] === "function") 546 request.seq = WebInspector.Callback.wrap(args[0]); 547 548 var message = JSON.stringify(request); 498 var message = JSON.stringify(Array.prototype.slice.call(arguments)); 549 499 InspectorFrontendHost.sendMessageToBackend(message); 550 500 } -
trunk/WebCore/inspector/Inspector.idl
r65803 r65804 58 58 [notify] void searchingForNodeWasEnabled(); 59 59 [notify] void searchingForNodeWasDisabled(); 60 [notify] void setAttachedWindow(out boolean attached);61 60 [notify] void setChildNodes(out long parentId, out Array nodes); 62 61 [notify] void setDetachedRoot(out Object root); -
trunk/WebCore/inspector/InspectorController.cpp
r65803 r65804 421 421 } 422 422 423 void InspectorController::setAttachedWindow(bool attached)424 {425 if (!m_remoteFrontend) {426 ASSERT_NOT_REACHED();427 return;428 }429 m_remoteFrontend->setAttachedWindow(attached);430 }431 432 423 void InspectorController::inspectedWindowScriptObjectCleared(Frame* frame) 433 424 { -
trunk/WebCore/inspector/InspectorController.h
r65803 r65804 148 148 void setInspectorFrontendClient(PassOwnPtr<InspectorFrontendClient> client); 149 149 bool hasInspectorFrontendClient() const { return m_inspectorFrontendClient; } 150 void setAttachedWindow(bool attached);151 150 152 151 void inspectedWindowScriptObjectCleared(Frame*); -
trunk/WebCore/inspector/InspectorFrontendClientLocal.cpp
r65803 r65804 122 122 void InspectorFrontendClientLocal::setAttachedWindow(bool attached) 123 123 { 124 m_inspectorController->setAttachedWindow(attached); 124 ScriptObject webInspectorObj; 125 if (!ScriptGlobalObject::get(m_frontendScriptState, "WebInspector", webInspectorObj)) { 126 ASSERT_NOT_REACHED(); 127 return; 128 } 129 ScriptFunctionCall function(webInspectorObj, "dispatch"); 130 function.appendArgument("setAttachedWindow"); 131 function.appendArgument(attached); 132 function.call(); 125 133 } 126 134 -
trunk/WebCore/inspector/InspectorValues.h
r65803 r65804 177 177 void setArray(const String& name, PassRefPtr<InspectorArray>); 178 178 179 const_iterator find(const String& name) const;180 179 bool getBool(const String& name, bool* output) const; 181 180 bool getNumber(const String& name, double* output) const; … … 226 225 }; 227 226 228 inline InspectorObject::const_iterator InspectorObject::find(const String& name) const229 {230 return m_data.find(name);231 }232 233 227 inline void InspectorObject::setBool(const String& name, bool value) 234 228 { -
trunk/WebCore/inspector/front-end/Callback.js
r65803 r65804 43 43 }, 44 44 45 processResponse: function(callbackId, args)45 processResponse: function(callbackId, opt_vararg) 46 46 { 47 var args = Array.prototype.slice.call(arguments, 1); 47 48 var callback = this._callbacks[callbackId]; 48 49 callback.apply(null, args); -
trunk/WebCore/inspector/front-end/inspector.js
r65803 r65804 590 590 window.addEventListener("load", windowLoaded, false); 591 591 592 WebInspector.dispatch = function(message) { 592 WebInspector.dispatch = function() { 593 var methodName = arguments[0]; 594 var parameters = Array.prototype.slice.call(arguments, 1); 595 593 596 // We'd like to enforce asynchronous interaction between the inspector controller and the frontend. 594 597 // This is important to LayoutTests. 595 598 function delayDispatch() 596 599 { 597 WebInspector_syncDispatch(message); 600 if (!(methodName in WebInspector)) { 601 console.error("Attempted to dispatch unimplemented WebInspector method: %s", methodName); 602 return; 603 } 604 605 WebInspector[methodName].apply(WebInspector, parameters); 598 606 WebInspector.pendingDispatches--; 599 607 } … … 605 613 WebInspector_syncDispatch = function(message) 606 614 { 607 var messageObject = (typeof message === "string") ? JSON.parse(message) : message; 608 if (messageObject.type === "response" && !messageObject.success) { 609 WebInspector.removeResponseCallbackEntry(messageObject.seq) 610 WebInspector.reportProtocolError(messageObject); 611 return; 612 } 613 614 var arguments = []; 615 if (messageObject.data) 616 for (var key in messageObject.data) 617 arguments.push(messageObject.data[key]); 618 619 if (messageObject.type === "event") { 620 if (!messageObject.event in WebInspector) { 621 console.error("Attempted to dispatch unimplemented WebInspector method: %s", messageObject.event); 622 return; 623 } 624 WebInspector[messageObject.event].apply(WebInspector, arguments); 625 } 626 627 if (messageObject.type === "response") 628 WebInspector.processResponse(messageObject.seq, arguments); 629 } 630 631 WebInspector.dispatchMessageFromBackend = function(messageObject) 632 { 633 WebInspector.dispatch(messageObject); 634 } 635 636 WebInspector.reportProtocolError = function(messageObject) 637 { 638 console.error("Error: InspectorBackend." + messageObject.command + " failed."); 639 for (var error in messageObject.errors) 640 console.error(" " + error); 641 WebInspector.removeResponseCallbackEntry(messageObject.seq); 615 var args = JSON.parse(message); 616 var methodName = args[0]; 617 var parameters = args.slice(1); 618 WebInspector[methodName].apply(WebInspector, parameters); 619 } 620 621 WebInspector.dispatchMessageFromBackend = function(arguments) 622 { 623 WebInspector.dispatch.apply(this, arguments); 624 } 625 626 WebInspector.reportProtocolError = function(callId, methodName, errorText) 627 { 628 console.error("InspectorBackend." + methodName + " failed with error text: '" + errorText + "'"); 629 WebInspector.removeResponseCallbackEntry(callId); 642 630 } 643 631
Note: See TracChangeset
for help on using the changeset viewer.