Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(994)

Unified Diff: Source/core/inspector/CodeGeneratorInspector.py

Issue 1129473003: DevTools: respond with error when Debugger command is sent to disabled debugger agent (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Addressed comments, added checks in DOMDebugger Created 5 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/inspector/CodeGeneratorInspector.py
diff --git a/Source/core/inspector/CodeGeneratorInspector.py b/Source/core/inspector/CodeGeneratorInspector.py
index 1a146147a8006de2bb5eced699a3dce424fc9e0e..fe67667372595308c19b3eb6856ebdb7031a8676 100755
--- a/Source/core/inspector/CodeGeneratorInspector.py
+++ b/Source/core/inspector/CodeGeneratorInspector.py
@@ -56,6 +56,8 @@ TYPES_WITH_OPEN_FIELD_LIST_SET = frozenset([
# InspectorResourceAgent needs to update mime-type.
"Network.Response"])
+DOMAINS_WITH_ENABLEMENT_CHECK = frozenset(["DOMDebugger", "Debugger"])
+
cmdline_parser = optparse.OptionParser()
cmdline_parser.add_option("--output_dir")
@@ -1652,6 +1654,8 @@ class Generator:
if "commands" in json_domain:
for json_command in json_domain["commands"]:
Generator.process_command(json_command, domain_name, agent_field_name, agent_interface_name)
+ if domain_name in DOMAINS_WITH_ENABLEMENT_CHECK:
+ Generator.backend_agent_interface_list.append("\n virtual bool checkEnabled(ErrorString*) = 0;\n")
Generator.backend_agent_interface_list.append("\n protected:\n")
Generator.backend_agent_interface_list.append(" virtual ~%s() { }\n" % agent_interface_name)
Generator.backend_agent_interface_list.append(" };\n\n")
@@ -1719,6 +1723,12 @@ class Generator:
method_out_code = ""
agent_call_param_list = ["&error"]
agent_call_params_declaration_list = [" ErrorString error;"]
+ agent_enablement_check = ""
+ if domain_name in DOMAINS_WITH_ENABLEMENT_CHECK and json_command["name"] != "enable":
+ agent_enablement_check = " if (!m_" + agent_field_name + "->checkEnabled(&error)) {\n"
+ agent_enablement_check += " reportProtocolError(callId, ServerError, error);\n"
pfeldman 2015/05/05 14:00:13 - This is not a server error, this is rather illeg
+ agent_enablement_check += " return;\n"
+ agent_enablement_check += " }\n"
send_response_call_params_list = ["error"]
request_message_param = ""
normal_response_cook_text = ""
@@ -1875,6 +1885,7 @@ class Generator:
methodCode="".join([method_in_code, method_out_code]),
agentCallParamsDeclaration="\n".join(agent_call_params_declaration_list),
agentCallParams=", ".join(agent_call_param_list),
+ agentEnablementCheck=agent_enablement_check,
requestMessageObject=request_message_param,
responseCook=normal_response_cook_text,
sendResponseCallParams=", ".join(send_response_call_params_list),
« no previous file with comments | « Source/bindings/core/v8/ScriptDebugServer.cpp ('k') | Source/core/inspector/CodeGeneratorInspectorStrings.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698