Changeset 111005 in webkit
- Timestamp:
- Mar 16, 2012 7:43:13 AM (12 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r111004 r111005 1 2012-03-16 Peter Rybin <peter.rybin@gmail.com> 2 3 Web Inspector: TypeBuilder: Introduce OptOutput class for optional output parameters 4 https://bugs.webkit.org/show_bug.cgi?id=80789 5 6 Reviewed by Yury Semikhatsky. 7 8 OptOutput class is added for optional return parameters. 9 10 Strict mode added to Generator that makes all parameter types strict 11 and drop pre-set default values for return parameters. 12 13 Debugger and Page domain is switched to strict mode. 14 15 * inspector/CodeGeneratorInspector.py: 16 (CommandReturnPassModel.OptOutput): 17 (CommandReturnPassModel.OptOutput.__init__): 18 (CommandReturnPassModel.OptOutput.get_return_var_type): 19 (CommandReturnPassModel.OptOutput.get_output_argument_prefix): 20 (CommandReturnPassModel.OptOutput.get_output_to_raw_expression): 21 (CommandReturnPassModel.OptOutput.get_output_parameter_type): 22 (CommandReturnPassModel): 23 (CommandReturnPassModel.OptOutput.get_set_return_condition): 24 (TypeModel.Enum.get_optional.EnumOptional.get_command_return_pass_model): 25 (TypeModel.ValueType.ValueOptional.get_command_return_pass_model): 26 (OptOutput): 27 (Generator.process_event): 28 (Generator.process_command): 29 * inspector/ContentSearchUtils.cpp: 30 (WebCore::ContentSearchUtils::buildObjectForSearchMatch): 31 (WebCore::ContentSearchUtils::searchInTextByLines): 32 * inspector/ContentSearchUtils.h: 33 (ContentSearchUtils): 34 * inspector/InjectedScript.cpp: 35 (WebCore::InjectedScript::evaluate): 36 (WebCore::InjectedScript::callFunctionOn): 37 (WebCore::InjectedScript::evaluateOnCallFrame): 38 (WebCore::InjectedScript::makeEvalCall): 39 * inspector/InjectedScript.h: 40 (InjectedScript): 41 * inspector/InspectorDOMDebuggerAgent.cpp: 42 (WebCore::InspectorDOMDebuggerAgent::didInvalidateStyleAttr): 43 (WebCore::InspectorDOMDebuggerAgent::willInsertDOMNode): 44 (WebCore::InspectorDOMDebuggerAgent::willRemoveDOMNode): 45 (WebCore::InspectorDOMDebuggerAgent::willModifyDOMAttr): 46 (WebCore::InspectorDOMDebuggerAgent::pauseOnNativeEventIfNeeded): 47 (WebCore::InspectorDOMDebuggerAgent::willSendXMLHttpRequest): 48 * inspector/InspectorDebuggerAgent.cpp: 49 (WebCore::InspectorDebuggerAgent::setBreakpointByUrl): 50 (WebCore::InspectorDebuggerAgent::setBreakpoint): 51 (WebCore::InspectorDebuggerAgent::searchInContent): 52 (WebCore::InspectorDebuggerAgent::setScriptSource): 53 (WebCore::InspectorDebuggerAgent::getFunctionDetails): 54 (WebCore::InspectorDebuggerAgent::schedulePauseOnNextStatement): 55 (WebCore::InspectorDebuggerAgent::evaluateOnCallFrame): 56 (WebCore::InspectorDebuggerAgent::didPause): 57 (WebCore::InspectorDebuggerAgent::breakProgram): 58 (WebCore::InspectorDebuggerAgent::clearBreakDetails): 59 * inspector/InspectorDebuggerAgent.h: 60 (InspectorDebuggerAgent): 61 * inspector/InspectorPageAgent.cpp: 62 (WebCore::buildObjectForCookie): 63 (WebCore::buildArrayForCookies): 64 (WebCore::InspectorPageAgent::getCookies): 65 (WebCore::InspectorPageAgent::getResourceTree): 66 (WebCore::InspectorPageAgent::searchInResource): 67 (WebCore::InspectorPageAgent::searchInResources): 68 (WebCore::InspectorPageAgent::buildObjectForFrame): 69 (WebCore::InspectorPageAgent::buildObjectForFrameTree): 70 * inspector/InspectorPageAgent.h: 71 * inspector/InspectorRuntimeAgent.cpp: 72 (WebCore::InspectorRuntimeAgent::evaluate): 73 (WebCore::InspectorRuntimeAgent::callFunctionOn): 74 1 75 2012-03-16 Kentaro Hara <haraken@chromium.org> 2 76 -
trunk/Source/WebCore/inspector/CodeGeneratorInspector.py
r110854 r111005 59 59 TYPES_WITH_RUNTIME_CAST_SET = frozenset(["Runtime.RemoteObject", "Runtime.PropertyDescriptor", 60 60 "Debugger.FunctionDetails", "Debugger.CallFrame"]) 61 62 STRICT_ENABLED_DOMAINS = ["Debugger", "Page"] 61 63 62 64 … … 580 582 return None 581 583 584 class OptOutput: 585 def __init__(self, var_type): 586 self.var_type = var_type 587 588 def get_return_var_type(self): 589 return "TypeBuilder::OptOutput<%s>" % self.var_type 590 591 @staticmethod 592 def get_output_argument_prefix(): 593 return "&" 594 595 @staticmethod 596 def get_output_to_raw_expression(): 597 return "%s.getValue()" 598 599 def get_output_parameter_type(self): 600 return "TypeBuilder::OptOutput<%s>*" % self.var_type 601 602 @staticmethod 603 def get_set_return_condition(): 604 return "%s.isAssigned()" 605 582 606 583 607 class TypeModel: … … 618 642 @staticmethod 619 643 def get_command_return_pass_model(): 620 # FIXME: to be replaced with OptOutput model. 621 return CommandReturnPassModel.ByPointer(base_self.type_name) 644 return CommandReturnPassModel.OptOutput(base_self.type_name) 622 645 623 646 @staticmethod … … 669 692 670 693 def get_command_return_pass_model(self): 671 # FIXME: to be replaced with OptOutput model. 672 return CommandReturnPassModel.ByPointer(self.base.type_name) 694 return CommandReturnPassModel.OptOutput(self.base.type_name) 673 695 674 696 def get_input_param_type_text(self): … … 1698 1720 protocolErrors->pushString("${domainName} handler is not available."); 1699 1721 $methodOutCode 1722 $methodInCode 1723 RefPtr<InspectorObject> result = InspectorObject::create(); 1700 1724 ErrorString error; 1701 $methodInCode 1702 if (!protocolErrors->length()) 1725 if (!protocolErrors->length()) { 1703 1726 $agentField->$methodName(&error$agentCallParams); 1704 1727 1705 RefPtr<InspectorObject> result = InspectorObject::create(); 1706 ${responseCook} sendResponse(callId, result, String::format("Some arguments of method '%s' can't be processed", "$domainName.$methodName"), protocolErrors, error); 1728 if (!error.length()) { 1729 ${responseCook} } 1730 } 1731 sendResponse(callId, result, String::format("Some arguments of method '%s' can't be processed", "$domainName.$methodName"), protocolErrors, error); 1707 1732 } 1708 1733 """) … … 2115 2140 #include "InspectorValues.h" 2116 2141 #include <PlatformString.h> 2142 #include <wtf/Assertions.h> 2117 2143 #include <wtf/PassRefPtr.h> 2118 2144 … … 2120 2146 2121 2147 namespace TypeBuilder { 2148 2149 template<typename T> 2150 class OptOutput { 2151 public: 2152 OptOutput() : m_assigned(false) { } 2153 2154 void operator=(T value) 2155 { 2156 m_value = value; 2157 m_assigned = true; 2158 } 2159 2160 bool isAssigned() { return m_assigned; } 2161 2162 T getValue() 2163 { 2164 ASSERT(isAssigned()); 2165 return m_value; 2166 } 2167 2168 private: 2169 T m_value; 2170 bool m_assigned; 2171 2172 WTF_MAKE_NONCOPYABLE(OptOutput); 2173 }; 2174 2122 2175 2123 2176 // This class provides "Traits" type for the input type T. It is programmed using C++ template specialization … … 2511 2564 def process_event(json_event, domain_name, frontend_method_declaration_lines): 2512 2565 event_name = json_event["name"] 2566 2567 strict_mode = domain_name in STRICT_ENABLED_DOMAINS 2568 2513 2569 parameter_list = [] 2514 2570 method_line_list = [] … … 2537 2593 raw_type_model = raw_type_model.get_optional() 2538 2594 2539 annotated_type = get_annotated_type_text(raw_type_model.get_input_param_type_text(), type_model.get_input_param_type_text()) 2595 if strict_mode: 2596 # All types are strict. 2597 annotated_type = type_model.get_input_param_type_text() 2598 mode_type_binding = param_type_binding 2599 else: 2600 # All types are raw. 2601 annotated_type = get_annotated_type_text(raw_type_model.get_input_param_type_text(), type_model.get_input_param_type_text()) 2602 mode_type_binding = raw_type_binding 2540 2603 2541 2604 parameter_list.append("%s %s" % (annotated_type, parameter_name)) 2542 2605 2543 2606 setter_argument = raw_type_model.get_event_setter_expression_pattern() % parameter_name 2544 if raw_type_binding.get_setter_value_expression_pattern():2545 setter_argument = raw_type_binding.get_setter_value_expression_pattern() % setter_argument2607 if mode_type_binding.get_setter_value_expression_pattern(): 2608 setter_argument = mode_type_binding.get_setter_value_expression_pattern() % setter_argument 2546 2609 2547 2610 setter_code = " paramsObject->set%s(\"%s\", %s);\n" % (setter_type, parameter_name, setter_argument) … … 2566 2629 def process_command(json_command, domain_name, agent_field_name, agent_interface_name): 2567 2630 json_command_name = json_command["name"] 2631 2632 strict_mode = domain_name in STRICT_ENABLED_DOMAINS 2633 2568 2634 Generator.method_name_enum_list.append(" k%s_%sCmd," % (domain_name, json_command["name"])) 2569 2635 Generator.method_handler_list.append(" &InspectorBackendDispatcherImpl::%s_%s," % (domain_name, json_command_name)) … … 2654 2720 type_model = type_model.get_optional() 2655 2721 2656 raw_type_model = return_type_binding.get_type_model() 2657 if optional: 2658 raw_type_model = raw_type_model.get_optional() 2659 2660 code = " %s out_%s = %s;\n" % (raw_type.get_raw_type_model().get_command_return_pass_model().get_return_var_type(), json_return_name, initializer) 2661 param = ", %sout_%s" % (raw_type.get_output_pass_model().get_argument_prefix(), json_return_name) 2662 cook = " result->set%s(\"%s\", out_%s);\n" % (setter_type, json_return_name, json_return_name) 2663 if optional: 2664 # FIXME: support optional properly. Probably an additional output parameter should be in each case. 2665 # FIXME: refactor this condition; it's a hack now. 2666 var_type_text = raw_type.get_raw_type_model().get_command_return_pass_model().get_return_var_type() 2667 if var_type_text == "bool" or var_type_text.startswith("RefPtr<"): 2668 cook = (" if (out_%s)\n " % json_return_name) + cook 2669 else: 2670 cook = " // FIXME: support optional here.\n" + cook 2671 2672 annotated_type = get_annotated_type_text(raw_type.get_raw_type_model().get_command_return_pass_model().get_return_var_type() + raw_type.get_output_pass_model().get_parameter_type_suffix(), 2673 type_model.get_command_return_pass_model().get_output_parameter_type()) 2722 if strict_mode: 2723 # All types are strict. Values do not have default values. 2724 code = " %s out_%s;\n" % (type_model.get_command_return_pass_model().get_return_var_type(), json_return_name) 2725 param = ", %sout_%s" % (type_model.get_command_return_pass_model().get_output_argument_prefix(), json_return_name) 2726 var_name = "out_%s" % json_return_name 2727 setter_argument = type_model.get_command_return_pass_model().get_output_to_raw_expression() % var_name 2728 if return_type_binding.get_setter_value_expression_pattern(): 2729 setter_argument = return_type_binding.get_setter_value_expression_pattern() % setter_argument 2730 2731 cook = " result->set%s(\"%s\", %s);\n" % (setter_type, json_return_name, 2732 setter_argument) 2733 2734 set_condition_pattern = type_model.get_command_return_pass_model().get_set_return_condition() 2735 if set_condition_pattern: 2736 cook = (" if (%s)\n " % (set_condition_pattern % var_name)) + cook 2737 annotated_type = type_model.get_command_return_pass_model().get_output_parameter_type() 2738 else: 2739 # All types are raw. Values always have default values. 2740 raw_type_model = return_type_binding.get_type_model() 2741 if optional: 2742 raw_type_model = raw_type_model.get_optional() 2743 2744 code = " %s out_%s = %s;\n" % (raw_type.get_raw_type_model().get_command_return_pass_model().get_return_var_type(), json_return_name, initializer) 2745 param = ", %sout_%s" % (raw_type.get_output_pass_model().get_argument_prefix(), json_return_name) 2746 cook = " result->set%s(\"%s\", out_%s);\n" % (setter_type, json_return_name, json_return_name) 2747 if optional: 2748 # FIXME: support optional properly. Probably an additional output parameter should be in each case. 2749 # FIXME: refactor this condition; it's a hack now. 2750 var_type_text = raw_type.get_raw_type_model().get_command_return_pass_model().get_return_var_type() 2751 if var_type_text == "bool" or var_type_text.startswith("RefPtr<"): 2752 cook = (" if (out_%s)\n " % json_return_name) + cook 2753 else: 2754 cook = " // FIXME: support optional here.\n" + cook 2755 2756 annotated_type = get_annotated_type_text(raw_type.get_raw_type_model().get_command_return_pass_model().get_return_var_type() + raw_type.get_output_pass_model().get_parameter_type_suffix(), 2757 type_model.get_command_return_pass_model().get_output_parameter_type()) 2674 2758 2675 2759 param_name = "out_%s" % json_return_name … … 2687 2771 js_reply_list = "[%s]" % join(backend_js_reply_param_list, ", ") 2688 2772 2689 response_cook_text = " if (!protocolErrors->length() && !error.length()) {\n%s }\n" %join(response_cook_list, "")2773 response_cook_text = join(response_cook_list, "") 2690 2774 2691 2775 Generator.backend_method_implementation_list.append(Templates.backend_method.substitute(None, -
trunk/Source/WebCore/inspector/ContentSearchUtils.cpp
r110854 r111005 95 95 } 96 96 97 static PassRefPtr< InspectorObject> buildObjectForSearchMatch(int lineNumber, String lineContent)97 static PassRefPtr<TypeBuilder::Page::SearchMatch> buildObjectForSearchMatch(int lineNumber, String lineContent) 98 98 { 99 RefPtr<InspectorObject> result = InspectorObject::create(); 100 result->setNumber("lineNumber", lineNumber); 101 result->setString("lineContent", lineContent); 102 103 return result; 99 return TypeBuilder::Page::SearchMatch::create() 100 .setLineNumber(lineNumber) 101 .setLineContent(lineContent); 104 102 } 105 103 … … 129 127 } 130 128 131 PassRefPtr< InspectorArray> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex)129 PassRefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> > searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex) 132 130 { 133 RefPtr< InspectorArray> result = InspectorArray::create();131 RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> > result = TypeBuilder::Array<TypeBuilder::Page::SearchMatch>::create(); 134 132 135 133 RegularExpression regex = ContentSearchUtils::createSearchRegex(query, caseSensitive, isRegex); … … 137 135 138 136 for (Vector<pair<int, String> >::const_iterator it = matches.begin(); it != matches.end(); ++it) 139 result-> pushValue(buildObjectForSearchMatch(it->first, it->second));137 result->addItem(buildObjectForSearchMatch(it->first, it->second)); 140 138 141 139 return result; -
trunk/Source/WebCore/inspector/ContentSearchUtils.h
r110678 r111005 30 30 #define ContentSearchUtils_h 31 31 32 #include "InspectorTypeBuilder.h" 32 33 #include "PlatformString.h" 33 34 … … 43 44 RegularExpression createSearchRegex(const String& query, bool caseSensitive, bool isRegex); 44 45 int countRegularExpressionMatches(const RegularExpression&, const String&); 45 PassRefPtr< InspectorArray> searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex);46 PassRefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> > searchInTextByLines(const String& text, const String& query, const bool caseSensitive, const bool isRegex); 46 47 47 48 String findSourceURL(const String& content); -
trunk/Source/WebCore/inspector/InjectedScript.cpp
r110854 r111005 64 64 } 65 65 66 void InjectedScript::evaluate(ErrorString* errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, RefPtr<InspectorObject>* result, bool* wasThrown)66 void InjectedScript::evaluate(ErrorString* errorString, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, RefPtr<InspectorObject>* result, TypeBuilder::OptOutput<bool>* wasThrown) 67 67 { 68 68 ScriptFunctionCall function(m_injectedScriptObject, "evaluate"); … … 74 74 } 75 75 76 void InjectedScript::callFunctionOn(ErrorString* errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, RefPtr<InspectorObject>* result, bool* wasThrown)76 void InjectedScript::callFunctionOn(ErrorString* errorString, const String& objectId, const String& expression, const String& arguments, bool returnByValue, RefPtr<InspectorObject>* result, TypeBuilder::OptOutput<bool>* wasThrown) 77 77 { 78 78 ScriptFunctionCall function(m_injectedScriptObject, "callFunctionOn"); … … 84 84 } 85 85 86 void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const ScriptValue& callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, RefPtr<RemoteObject>* result, bool* wasThrown)86 void InjectedScript::evaluateOnCallFrame(ErrorString* errorString, const ScriptValue& callFrames, const String& callFrameId, const String& expression, const String& objectGroup, bool includeCommandLineAPI, bool returnByValue, RefPtr<RemoteObject>* result, TypeBuilder::OptOutput<bool>* wasThrown) 87 87 { 88 88 ScriptFunctionCall function(m_injectedScriptObject, "evaluateOnCallFrame"); … … 260 260 } 261 261 262 void InjectedScript::makeEvalCall(ErrorString* errorString, ScriptFunctionCall& function, RefPtr<InspectorObject>* objectResult, bool* wasThrown)262 void InjectedScript::makeEvalCall(ErrorString* errorString, ScriptFunctionCall& function, RefPtr<InspectorObject>* objectResult, TypeBuilder::OptOutput<bool>* wasThrown) 263 263 { 264 264 RefPtr<InspectorValue> result; -
trunk/Source/WebCore/inspector/InjectedScript.h
r110678 r111005 65 65 bool returnByValue, 66 66 RefPtr<InspectorObject>* result, 67 bool* wasThrown);67 TypeBuilder::OptOutput<bool>* wasThrown); 68 68 void callFunctionOn(ErrorString*, 69 69 const String& objectId, … … 72 72 bool returnByValue, 73 73 RefPtr<InspectorObject>* result, 74 bool* wasThrown);74 TypeBuilder::OptOutput<bool>* wasThrown); 75 75 void evaluateOnCallFrame(ErrorString*, 76 76 const ScriptValue& callFrames, … … 81 81 bool returnByValue, 82 82 RefPtr<TypeBuilder::Runtime::RemoteObject>* result, 83 bool* wasThrown);83 TypeBuilder::OptOutput<bool>* wasThrown); 84 84 void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>* result); 85 85 void getProperties(ErrorString*, const String& objectId, bool ownProperties, RefPtr<InspectorArray>* result); … … 106 106 ScriptValue callFunctionWithEvalEnabled(ScriptFunctionCall&, bool& hadException) const; 107 107 void makeCall(ScriptFunctionCall&, RefPtr<InspectorValue>* result); 108 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<InspectorObject>* result, bool* wasThrown);108 void makeEvalCall(ErrorString*, ScriptFunctionCall&, RefPtr<InspectorObject>* result, TypeBuilder::OptOutput<bool>* wasThrown); 109 109 ScriptValue nodeAsScriptValue(Node*); 110 110 -
trunk/Source/WebCore/inspector/InspectorDOMDebuggerAgent.cpp
r110854 r111005 39 39 #include "InspectorDOMAgent.h" 40 40 #include "InspectorDebuggerAgent.h" 41 #include "InspectorFrontend.h" 41 42 #include "InspectorInstrumentation.h" 42 43 #include "InspectorState.h" … … 57 58 static const char* const instrumentationEventCategoryType = "instrumentation:"; 58 59 59 static const char* const domNativeBreakpointType = "DOM";60 static const char* const eventListenerNativeBreakpointType = "EventListener";61 static const char* const xhrNativeBreakpointType = "XHR";62 63 60 const uint32_t inheritableDOMBreakpointTypesMask = (1 << SubtreeModified); 64 61 const int domBreakpointDerivedTypeShift = 16; … … 176 173 RefPtr<InspectorObject> eventData = InspectorObject::create(); 177 174 descriptionForDOMEvent(node, AttributeModified, false, eventData.get()); 178 m_debuggerAgent->breakProgram( domNativeBreakpointType, eventData.release());175 m_debuggerAgent->breakProgram(InspectorFrontend::Debugger::Reason::DOM, eventData.release()); 179 176 } 180 177 } … … 276 273 RefPtr<InspectorObject> eventData = InspectorObject::create(); 277 274 descriptionForDOMEvent(parent, SubtreeModified, true, eventData.get()); 278 m_debuggerAgent->breakProgram( domNativeBreakpointType, eventData.release());275 m_debuggerAgent->breakProgram(InspectorFrontend::Debugger::Reason::DOM, eventData.release()); 279 276 } 280 277 } … … 286 283 RefPtr<InspectorObject> eventData = InspectorObject::create(); 287 284 descriptionForDOMEvent(node, NodeRemoved, false, eventData.get()); 288 m_debuggerAgent->breakProgram( domNativeBreakpointType, eventData.release());285 m_debuggerAgent->breakProgram(InspectorFrontend::Debugger::Reason::DOM, eventData.release()); 289 286 } else if (parentNode && hasBreakpoint(parentNode, SubtreeModified)) { 290 287 RefPtr<InspectorObject> eventData = InspectorObject::create(); 291 288 descriptionForDOMEvent(node, SubtreeModified, false, eventData.get()); 292 m_debuggerAgent->breakProgram( domNativeBreakpointType, eventData.release());289 m_debuggerAgent->breakProgram(InspectorFrontend::Debugger::Reason::DOM, eventData.release()); 293 290 } 294 291 } … … 299 296 RefPtr<InspectorObject> eventData = InspectorObject::create(); 300 297 descriptionForDOMEvent(element, AttributeModified, false, eventData.get()); 301 m_debuggerAgent->breakProgram( domNativeBreakpointType, eventData.release());298 m_debuggerAgent->breakProgram(InspectorFrontend::Debugger::Reason::DOM, eventData.release()); 302 299 } 303 300 } … … 368 365 eventData->setString("eventName", fullEventName); 369 366 if (synchronous) 370 m_debuggerAgent->breakProgram( eventListenerNativeBreakpointType, eventData.release());367 m_debuggerAgent->breakProgram(InspectorFrontend::Debugger::Reason::EventListener, eventData.release()); 371 368 else 372 m_debuggerAgent->schedulePauseOnNextStatement( eventListenerNativeBreakpointType, eventData.release());369 m_debuggerAgent->schedulePauseOnNextStatement(InspectorFrontend::Debugger::Reason::EventListener, eventData.release()); 373 370 } 374 371 … … 418 415 eventData->setString("breakpointURL", breakpointURL); 419 416 eventData->setString("url", url); 420 m_debuggerAgent->breakProgram( xhrNativeBreakpointType, eventData.release());417 m_debuggerAgent->breakProgram(InspectorFrontend::Debugger::Reason::XHR, eventData.release()); 421 418 } 422 419 -
trunk/Source/WebCore/inspector/InspectorDebuggerAgent.cpp
r110854 r111005 216 216 } 217 217 218 void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const String* const optionalCondition, String* outBreakpointId, RefPtr<InspectorArray>& locationsRaw) 219 { 220 RefPtr<Array<TypeBuilder::Debugger::Location> > locations = Array<TypeBuilder::Debugger::Location>::create(); 221 locationsRaw = locations; 218 void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const String* const optionalCondition, TypeBuilder::Debugger::BreakpointId* outBreakpointId, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location> >& locations) 219 { 220 locations = Array<TypeBuilder::Debugger::Location>::create(); 222 221 if (!optionalURL == !optionalURLRegex) { 223 222 *errorString = "Either url or urlRegex must be specified."; … … 263 262 } 264 263 265 void InspectorDebuggerAgent::setBreakpoint(ErrorString* errorString, const RefPtr<InspectorObject>& location, const String* const optionalCondition, String* outBreakpointId, RefPtr<InspectorObject>& actualLocation)264 void InspectorDebuggerAgent::setBreakpoint(ErrorString* errorString, const RefPtr<InspectorObject>& location, const String* const optionalCondition, TypeBuilder::Debugger::BreakpointId* outBreakpointId, RefPtr<TypeBuilder::Debugger::Location>& actualLocation) 266 265 { 267 266 String scriptId; … … 355 354 } 356 355 357 void InspectorDebuggerAgent::searchInContent(ErrorString* error, const String& scriptId, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr< InspectorArray>& results)356 void InspectorDebuggerAgent::searchInContent(ErrorString* error, const String& scriptId, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<Array<WebCore::TypeBuilder::Page::SearchMatch> >& results) 358 357 { 359 358 bool isRegex = optionalIsRegex ? *optionalIsRegex : false; … … 367 366 } 368 367 369 void InspectorDebuggerAgent::setScriptSource(ErrorString* error, const String& scriptId, const String& newContent, const bool* const preview, RefPtr< InspectorArray>& newCallFrames, RefPtr<InspectorObject>& result)368 void InspectorDebuggerAgent::setScriptSource(ErrorString* error, const String& scriptId, const String& newContent, const bool* const preview, RefPtr<Array<TypeBuilder::Debugger::CallFrame> >& newCallFrames, RefPtr<InspectorObject>& result) 370 369 { 371 370 bool previewOnly = preview && *preview; … … 388 387 } 389 388 390 void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr< InspectorObject>& detailsRaw)389 void InspectorDebuggerAgent::getFunctionDetails(ErrorString* errorString, const String& functionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>& details) 391 390 { 392 391 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(functionId); … … 395 394 return; 396 395 } 397 RefPtr<FunctionDetails> details;398 396 injectedScript.getFunctionDetails(errorString, functionId, &details); 399 detailsRaw = details; 400 } 401 402 void InspectorDebuggerAgent::schedulePauseOnNextStatement(const String& breakReason, PassRefPtr<InspectorObject> data) 397 } 398 399 void InspectorDebuggerAgent::schedulePauseOnNextStatement(InspectorFrontend::Debugger::Reason::Enum breakReason, PassRefPtr<InspectorObject> data) 403 400 { 404 401 if (m_javaScriptPauseScheduled) … … 480 477 } 481 478 482 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const returnByValue, RefPtr< InspectorObject>& resultRaw, bool* wasThrown)479 void InspectorDebuggerAgent::evaluateOnCallFrame(ErrorString* errorString, const String& callFrameId, const String& expression, const String* const objectGroup, const bool* const includeCommandLineAPI, const bool* const returnByValue, RefPtr<TypeBuilder::Runtime::RemoteObject>& result, TypeBuilder::OptOutput<bool>* wasThrown) 483 480 { 484 481 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptForObjectId(callFrameId); … … 487 484 return; 488 485 } 489 RefPtr<RemoteObject> result;490 486 injectedScript.evaluateOnCallFrame(errorString, m_currentCallStack, callFrameId, expression, objectGroup ? *objectGroup : "", includeCommandLineAPI ? *includeCommandLineAPI : false, returnByValue ? *returnByValue : false, &result, wasThrown); 491 resultRaw = result;492 487 } 493 488 … … 573 568 InjectedScript injectedScript = m_injectedScriptManager->injectedScriptFor(scriptState); 574 569 if (!injectedScript.hasNoValue()) { 575 m_breakReason = "exception";570 m_breakReason = InspectorFrontend::Debugger::Reason::Exception; 576 571 m_breakAuxData = injectedScript.wrapObject(exception, "backtrace"); 577 572 } … … 595 590 } 596 591 597 void InspectorDebuggerAgent::breakProgram( const String&breakReason, PassRefPtr<InspectorObject> data)592 void InspectorDebuggerAgent::breakProgram(InspectorFrontend::Debugger::Reason::Enum breakReason, PassRefPtr<InspectorObject> data) 598 593 { 599 594 m_breakReason = breakReason; … … 624 619 void InspectorDebuggerAgent::clearBreakDetails() 625 620 { 626 m_breakReason = "other";621 m_breakReason = InspectorFrontend::Debugger::Reason::Other; 627 622 m_breakAuxData = 0; 628 623 } -
trunk/Source/WebCore/inspector/InspectorDebuggerAgent.h
r110678 r111005 83 83 virtual void setBreakpointsActive(ErrorString*, bool active); 84 84 85 virtual void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const String* optionalCondition, String* breakpointId, RefPtr<InspectorArray>& locations);86 virtual void setBreakpoint(ErrorString*, const RefPtr<InspectorObject>& location, const String* optionalCondition, String* breakpointId, RefPtr<InspectorObject>& actualLocation);85 virtual void setBreakpointByUrl(ErrorString*, int lineNumber, const String* optionalURL, const String* optionalURLRegex, const int* optionalColumnNumber, const String* optionalCondition, TypeBuilder::Debugger::BreakpointId*, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::Location> >& locations); 86 virtual void setBreakpoint(ErrorString*, const RefPtr<InspectorObject>& location, const String* optionalCondition, TypeBuilder::Debugger::BreakpointId*, RefPtr<TypeBuilder::Debugger::Location>& actualLocation); 87 87 virtual void removeBreakpoint(ErrorString*, const String& breakpointId); 88 88 virtual void continueToLocation(ErrorString*, const RefPtr<InspectorObject>& location); 89 89 90 virtual void searchInContent(ErrorString*, const String& scriptId, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr< InspectorArray>&);91 virtual void setScriptSource(ErrorString*, const String& scriptId, const String& newContent, const bool* preview, RefPtr< InspectorArray>& newCallFrames, RefPtr<InspectorObject>& result);90 virtual void searchInContent(ErrorString*, const String& scriptId, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> >&); 91 virtual void setScriptSource(ErrorString*, const String& scriptId, const String& newContent, const bool* preview, RefPtr<TypeBuilder::Array<TypeBuilder::Debugger::CallFrame> >& newCallFrames, RefPtr<InspectorObject>& result); 92 92 virtual void getScriptSource(ErrorString*, const String& scriptId, String* scriptSource); 93 virtual void getFunctionDetails(ErrorString*, const String& functionId, RefPtr< InspectorObject>& details);94 void schedulePauseOnNextStatement( const String&breakReason, PassRefPtr<InspectorObject> data);93 virtual void getFunctionDetails(ErrorString*, const String& functionId, RefPtr<TypeBuilder::Debugger::FunctionDetails>&); 94 void schedulePauseOnNextStatement(InspectorFrontend::Debugger::Reason::Enum breakReason, PassRefPtr<InspectorObject> data); 95 95 void cancelPauseOnNextStatement(); 96 void breakProgram( const String&breakReason, PassRefPtr<InspectorObject> data);96 void breakProgram(InspectorFrontend::Debugger::Reason::Enum breakReason, PassRefPtr<InspectorObject> data); 97 97 virtual void pause(ErrorString*); 98 98 virtual void resume(ErrorString*); … … 107 107 const bool* includeCommandLineAPI, 108 108 const bool* returnByValue, 109 RefPtr< InspectorObject>& result,110 bool* wasThrown);109 RefPtr<TypeBuilder::Runtime::RemoteObject>& result, 110 TypeBuilder::OptOutput<bool>* wasThrown); 111 111 112 112 class Listener { … … 157 157 BreakpointIdToDebugServerBreakpointIdsMap m_breakpointIdToDebugServerBreakpointIds; 158 158 String m_continueToLocationBreakpointId; 159 Stringm_breakReason;159 InspectorFrontend::Debugger::Reason::Enum m_breakReason; 160 160 RefPtr<InspectorObject> m_breakAuxData; 161 161 bool m_javaScriptPauseScheduled; -
trunk/Source/WebCore/inspector/InspectorPageAgent.cpp
r110854 r111005 396 396 } 397 397 398 static PassRefPtr<InspectorObject> buildObjectForCookie(const Cookie& cookie) 399 { 400 RefPtr<InspectorObject> value = InspectorObject::create(); 401 value->setString("name", cookie.name); 402 value->setString("value", cookie.value); 403 value->setString("domain", cookie.domain); 404 value->setString("path", cookie.path); 405 value->setNumber("expires", cookie.expires); 406 value->setNumber("size", (cookie.name.length() + cookie.value.length())); 407 value->setBoolean("httpOnly", cookie.httpOnly); 408 value->setBoolean("secure", cookie.secure); 409 value->setBoolean("session", cookie.session); 410 return value; 411 } 412 413 static PassRefPtr<InspectorArray> buildArrayForCookies(ListHashSet<Cookie>& cookiesList) 414 { 415 RefPtr<InspectorArray> cookies = InspectorArray::create(); 398 static PassRefPtr<TypeBuilder::Page::Cookie> buildObjectForCookie(const Cookie& cookie) 399 { 400 return TypeBuilder::Page::Cookie::create() 401 .setName(cookie.name) 402 .setValue(cookie.value) 403 .setDomain(cookie.domain) 404 .setPath(cookie.path) 405 .setExpires(cookie.expires) 406 .setSize((cookie.name.length() + cookie.value.length())) 407 .setHttpOnly(cookie.httpOnly) 408 .setSecure(cookie.secure) 409 .setSession(cookie.session); 410 } 411 412 static PassRefPtr<TypeBuilder::Array<TypeBuilder::Page::Cookie> > buildArrayForCookies(ListHashSet<Cookie>& cookiesList) 413 { 414 RefPtr<TypeBuilder::Array<TypeBuilder::Page::Cookie> > cookies = TypeBuilder::Array<TypeBuilder::Page::Cookie>::create(); 416 415 417 416 ListHashSet<Cookie>::iterator end = cookiesList.end(); 418 417 ListHashSet<Cookie>::iterator it = cookiesList.begin(); 419 418 for (int i = 0; it != end; ++it, i++) 420 cookies-> pushObject(buildObjectForCookie(*it));419 cookies->addItem(buildObjectForCookie(*it)); 421 420 422 421 return cookies; … … 467 466 } 468 467 469 void InspectorPageAgent::getCookies(ErrorString*, RefPtr< InspectorArray>& cookies, WTF::String* cookiesString)468 void InspectorPageAgent::getCookies(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Page::Cookie> >& cookies, WTF::String* cookiesString) 470 469 { 471 470 // If we can get raw cookies. … … 503 502 } 504 503 505 if (rawCookiesImplemented) 504 // FIXME: Do not return empty string/empty array. Make returns optional instead. https://bugs.webkit.org/show_bug.cgi?id=80855 505 if (rawCookiesImplemented) { 506 506 cookies = buildArrayForCookies(rawCookiesList); 507 else 507 *cookiesString = ""; 508 } else { 509 cookies = TypeBuilder::Array<TypeBuilder::Page::Cookie>::create(); 508 510 *cookiesString = stringCookiesList; 511 } 509 512 } 510 513 … … 522 525 } 523 526 524 void InspectorPageAgent::getResourceTree(ErrorString*, RefPtr< InspectorObject>& object)527 void InspectorPageAgent::getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page::FrameResourceTree>& object) 525 528 { 526 529 object = buildObjectForFrameTree(m_page->mainFrame()); … … 549 552 } 550 553 551 void InspectorPageAgent::searchInResource(ErrorString*, const String& frameId, const String& url, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr< InspectorArray>& results)552 { 553 results = InspectorArray::create();554 void InspectorPageAgent::searchInResource(ErrorString*, const String& frameId, const String& url, const String& query, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> >& results) 555 { 556 results = TypeBuilder::Array<TypeBuilder::Page::SearchMatch>::create(); 554 557 555 558 bool isRegex = optionalIsRegex ? *optionalIsRegex : false; … … 591 594 } 592 595 593 void InspectorPageAgent::searchInResources(ErrorString*, const String& text, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr< InspectorArray>& results)594 { 595 RefPtr< InspectorArray> searchResults = InspectorArray::create();596 void InspectorPageAgent::searchInResources(ErrorString*, const String& text, const bool* const optionalCaseSensitive, const bool* const optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchResult> >& results) 597 { 598 RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchResult> > searchResults = TypeBuilder::Array<TypeBuilder::Page::SearchResult>::create(); 596 599 597 600 bool isRegex = optionalIsRegex ? *optionalIsRegex : false; … … 818 821 } 819 822 820 PassRefPtr<InspectorObject> InspectorPageAgent::buildObjectForFrame(Frame* frame) 821 { 822 RefPtr<InspectorObject> frameObject = InspectorObject::create(); 823 frameObject->setString("id", frameId(frame)); 823 PassRefPtr<TypeBuilder::Page::Frame> InspectorPageAgent::buildObjectForFrame(Frame* frame) 824 { 825 RefPtr<TypeBuilder::Page::Frame> frameObject = TypeBuilder::Page::Frame::create() 826 .setId(frameId(frame)) 827 .setLoaderId(loaderId(frame->loader()->documentLoader())) 828 .setUrl(frame->document()->url().string()) 829 .setMimeType(frame->loader()->documentLoader()->responseMIMEType()); 824 830 if (frame->tree()->parent()) 825 frameObject->set String("parentId",frameId(frame->tree()->parent()));831 frameObject->setParentId(frameId(frame->tree()->parent())); 826 832 if (frame->ownerElement()) { 827 833 String name = frame->ownerElement()->getNameAttribute(); 828 834 if (name.isEmpty()) 829 835 name = frame->ownerElement()->getAttribute(HTMLNames::idAttr); 830 frameObject->setString("name", name); 831 } 832 frameObject->setString("url", frame->document()->url().string()); 833 frameObject->setString("loaderId", loaderId(frame->loader()->documentLoader())); 834 frameObject->setString("securityOrigin", frame->document()->securityOrigin()->toString()); 835 frameObject->setString("mimeType", frame->loader()->documentLoader()->responseMIMEType()); 836 frameObject->setName(name); 837 } 838 // FIXME: Make this field non-optional. https://bugs.webkit.org/show_bug.cgi?id=80857 839 frameObject->setSecurityOrigin(frame->document()->securityOrigin()->toString()); 836 840 837 841 return frameObject; 838 842 } 839 843 840 PassRefPtr<InspectorObject> InspectorPageAgent::buildObjectForFrameTree(Frame* frame) 841 { 842 RefPtr<InspectorObject> result = InspectorObject::create(); 844 PassRefPtr<TypeBuilder::Page::FrameResourceTree> InspectorPageAgent::buildObjectForFrameTree(Frame* frame) 845 { 843 846 RefPtr<InspectorObject> frameObject = buildObjectForFrame(frame); 844 result->setObject("frame", frameObject);845 846 847 RefPtr<InspectorArray> subresources = InspectorArray::create(); 847 result->setArray("resources", subresources); 848 RefPtr<TypeBuilder::Page::FrameResourceTree> result = TypeBuilder::Page::FrameResourceTree::create() 849 .setFrame(frameObject) 850 .setResources(subresources); 848 851 849 852 Vector<CachedResource*> allResources = cachedResourcesForFrame(frame); -
trunk/Source/WebCore/inspector/InspectorPageAgent.h
r110678 r111005 96 96 virtual void reload(ErrorString*, const bool* optionalIgnoreCache, const String* optionalScriptToEvaluateOnLoad); 97 97 virtual void navigate(ErrorString*, const String& url); 98 virtual void getCookies(ErrorString*, RefPtr< InspectorArray>& cookies, WTF::String* cookiesString);98 virtual void getCookies(ErrorString*, RefPtr<TypeBuilder::Array<TypeBuilder::Page::Cookie> >& cookies, WTF::String* cookiesString); 99 99 virtual void deleteCookie(ErrorString*, const String& cookieName, const String& domain); 100 virtual void getResourceTree(ErrorString*, RefPtr< InspectorObject>&);100 virtual void getResourceTree(ErrorString*, RefPtr<TypeBuilder::Page::FrameResourceTree>&); 101 101 virtual void getResourceContent(ErrorString*, const String& frameId, const String& url, String* content, bool* base64Encoded); 102 virtual void searchInResource(ErrorString*, const String& frameId, const String& url, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr< InspectorArray>&);103 virtual void searchInResources(ErrorString*, const String&, const bool* caseSensitive, const bool* isRegex, RefPtr< InspectorArray>&);102 virtual void searchInResource(ErrorString*, const String& frameId, const String& url, const String& query, const bool* optionalCaseSensitive, const bool* optionalIsRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchMatch> >&); 103 virtual void searchInResources(ErrorString*, const String&, const bool* caseSensitive, const bool* isRegex, RefPtr<TypeBuilder::Array<TypeBuilder::Page::SearchResult> >&); 104 104 virtual void setDocumentContent(ErrorString*, const String& frameId, const String& html); 105 105 virtual void setScreenSizeOverride(ErrorString*, int width, int height); … … 138 138 void clearFrameViewFixedLayout(); 139 139 140 PassRefPtr< InspectorObject> buildObjectForFrame(Frame*);141 PassRefPtr< InspectorObject> buildObjectForFrameTree(Frame*);140 PassRefPtr<TypeBuilder::Page::Frame> buildObjectForFrame(Frame*); 141 PassRefPtr<TypeBuilder::Page::FrameResourceTree> buildObjectForFrameTree(Frame*); 142 142 Page* m_page; 143 143 InjectedScriptManager* m_injectedScriptManager; -
trunk/Source/WebCore/inspector/InspectorRuntimeAgent.cpp
r110854 r111005 99 99 #endif 100 100 101 injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : "", asBool(includeCommandLineAPI), asBool(returnByValue), &result, wasThrown); 101 TypeBuilder::OptOutput<bool> wasThrownOpt; 102 injectedScript.evaluate(errorString, expression, objectGroup ? *objectGroup : "", asBool(includeCommandLineAPI), asBool(returnByValue), &result, &wasThrownOpt); 103 *wasThrown = wasThrownOpt.isAssigned() ? wasThrownOpt.getValue() : false; 102 104 103 105 #if ENABLE(JAVASCRIPT_DEBUGGER) … … 117 119 if (optionalArguments) 118 120 arguments = (*optionalArguments)->toJSONString(); 119 injectedScript.callFunctionOn(errorString, objectId, expression, arguments, asBool(returnByValue), &result, wasThrown); 121 122 TypeBuilder::OptOutput<bool> wasThrownOpt; 123 injectedScript.callFunctionOn(errorString, objectId, expression, arguments, asBool(returnByValue), &result, &wasThrownOpt); 124 *wasThrown = wasThrownOpt.isAssigned() ? wasThrownOpt.getValue() : false; 120 125 } 121 126
Note: See TracChangeset
for help on using the changeset viewer.