Commit ae227297 authored by joepeck@webkit.org's avatar joepeck@webkit.org

Web Inspector: We should regenerate InspectorBackendCommands.js for Legacy Inspector.json versions

https://bugs.webkit.org/show_bug.cgi?id=120242

Reviewed by NOBODY (OOPS!).

Source/WebCore:

- Update the Inspector.json CodeGenerator to include an output_js_dir.
- Cleanup multiple trailing newlines in some of the generated files.
- Provide a way to not verify runtime casts, needed for Legacy inputs.

* CMakeLists.txt:
* DerivedSources.make:
* DerivedSources.pri:
* GNUmakefile.am:
* inspector/CodeGeneratorInspector.py:
(resolve_all_types):
(SmartOutput.close):

Source/WebInspectorUI:

- Include the iOS 6.0 Inspector.json which maps to Legacy/6.0/InspectorBackendCommands.js.
- Provide a helper script to regenerate the backend commands file for trunk and Versions.
- Regenerated file now includes enums and other minor changes.

* Scripts/update-InspectorBackendCommands.rb: Added.
* UserInterface/InspectorBackendCommands.js:
* UserInterface/Legacy/6.0/InspectorBackendCommands.js:
* Versions/Inspector-iOS-6.0.json: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154651 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 132bec82
......@@ -2998,7 +2998,7 @@ add_custom_command(
OUTPUT ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorBackendDispatcher.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorBackendDispatcher.h ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorFrontend.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorFrontend.h ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorTypeBuilder.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorTypeBuilder.h
MAIN_DEPENDENCY inspector/Inspector.json
DEPENDS ${WEBCORE_DIR}/inspector/CodeGeneratorInspector.py
COMMAND ${PYTHON_EXECUTABLE} ${WEBCORE_DIR}/inspector/CodeGeneratorInspector.py ${WEBCORE_DIR}/inspector/Inspector.json --output_h_dir "${DERIVED_SOURCES_WEBCORE_DIR}" --output_cpp_dir "${DERIVED_SOURCES_WEBCORE_DIR}" --write_always
COMMAND ${PYTHON_EXECUTABLE} ${WEBCORE_DIR}/inspector/CodeGeneratorInspector.py ${WEBCORE_DIR}/inspector/Inspector.json --output_h_dir "${DERIVED_SOURCES_WEBCORE_DIR}" --output_cpp_dir "${DERIVED_SOURCES_WEBCORE_DIR}" --output_js_dir "${DERIVED_SOURCES_WEBCORE_DIR}" --write_always
VERBATIM)
list(APPEND WebCore_SOURCES ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorBackendDispatcher.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorFrontend.cpp ${DERIVED_SOURCES_WEBCORE_DIR}/InspectorTypeBuilder.cpp)
......
2013-08-26 Joseph Pecoraro <pecoraro@apple.com>
Web Inspector: We should regenerate InspectorBackendCommands.js for Legacy Inspector.json versions
https://bugs.webkit.org/show_bug.cgi?id=120242
Reviewed by Timothy Hatcher.
- Update the Inspector.json CodeGenerator to include an output_js_dir.
- Cleanup multiple trailing newlines in some of the generated files.
- Provide a way to not verify runtime casts, needed for Legacy inputs.
* CMakeLists.txt:
* DerivedSources.make:
* DerivedSources.pri:
* GNUmakefile.am:
* inspector/CodeGeneratorInspector.py:
(resolve_all_types):
(SmartOutput.close):
2013-08-26 Sam Weinig <sam@webkit.org>
AlternativeTextController should hold onto Frame as a reference
......@@ -1021,7 +1021,7 @@ all : InspectorFrontend.h
INSPECTOR_GENERATOR_SCRIPTS = inspector/CodeGeneratorInspector.py
InspectorFrontend.h : Inspector.json $(INSPECTOR_GENERATOR_SCRIPTS)
python $(WebCore)/inspector/CodeGeneratorInspector.py $(WebCore)/inspector/Inspector.json --output_h_dir . --output_cpp_dir .
python $(WebCore)/inspector/CodeGeneratorInspector.py $(WebCore)/inspector/Inspector.json --output_h_dir . --output_cpp_dir . --output_js_dir .
all : InspectorOverlayPage.h
......
......@@ -812,7 +812,7 @@ GENERATORS += inspectorValidate
inspectorJSON.output = InspectorFrontend.cpp InspectorBackendDispatcher.cpp InspectorTypeBuilder.cpp
inspectorJSON.input = INSPECTOR_JSON
inspectorJSON.script = $$PWD/inspector/CodeGeneratorInspector.py
inspectorJSON.commands = python $$inspectorJSON.script $$PWD/inspector/Inspector.json --output_h_dir ${QMAKE_FUNC_FILE_OUT_PATH} --output_cpp_dir ${QMAKE_FUNC_FILE_OUT_PATH}
inspectorJSON.commands = python $$inspectorJSON.script $$PWD/inspector/Inspector.json --output_h_dir ${QMAKE_FUNC_FILE_OUT_PATH} --output_cpp_dir ${QMAKE_FUNC_FILE_OUT_PATH} --output_js_dir ${QMAKE_FUNC_FILE_OUT_PATH}
inspectorJSON.depends = $$inspectorJSON.script
GENERATORS += inspectorJSON
......
......@@ -329,7 +329,7 @@ DerivedSources/WebCore/InspectorProtocolVersion.h : $(WebCore)/inspector/Inspect
$(AM_V_GEN)$(PYTHON) $(WebCore)/inspector/generate-inspector-protocol-version -o $(GENSOURCES_WEBCORE)/InspectorProtocolVersion.h $(WebCore)/inspector/Inspector.json
DerivedSources/WebCore/InspectorBackendDispatcher.cpp: $(WebCore)/inspector/Inspector.json $(WebCore)/inspector/CodeGeneratorInspector.py
$(AM_V_GEN)$(PYTHON) $(WebCore)/inspector/CodeGeneratorInspector.py $< --output_h_dir $(GENSOURCES_WEBCORE) --output_cpp_dir $(GENSOURCES_WEBCORE)
$(AM_V_GEN)$(PYTHON) $(WebCore)/inspector/CodeGeneratorInspector.py $< --output_h_dir $(GENSOURCES_WEBCORE) --output_cpp_dir $(GENSOURCES_WEBCORE) --output_js_dir $(GENSOURCES_WEBCORE)
DerivedSources/WebCore/InspectorTypeBuilder.h: DerivedSources/WebCore/InspectorTypeBuilder.cpp
DerivedSources/WebCore/InspectorTypeBuilder.cpp: DerivedSources/WebCore/InspectorFrontend.h
DerivedSources/WebCore/InspectorFrontend.h: DerivedSources/WebCore/InspectorFrontend.cpp
......
......@@ -76,7 +76,9 @@ EXACTLY_INT_SUPPORTED = False
cmdline_parser = optparse.OptionParser()
cmdline_parser.add_option("--output_h_dir")
cmdline_parser.add_option("--output_cpp_dir")
cmdline_parser.add_option("--output_js_dir")
cmdline_parser.add_option("--write_always", action="store_true")
cmdline_parser.add_option("--no_verification", action="store_true")
try:
arg_options, arg_values = cmdline_parser.parse_args()
......@@ -85,16 +87,20 @@ try:
input_json_filename = arg_values[0]
output_header_dirname = arg_options.output_h_dir
output_cpp_dirname = arg_options.output_cpp_dir
output_js_dirname = arg_options.output_js_dir
write_always = arg_options.write_always
verification = not arg_options.no_verification
if not output_header_dirname:
raise Exception("Output .h directory must be specified")
if not output_cpp_dirname:
raise Exception("Output .cpp directory must be specified")
if not output_js_dirname:
raise Exception("Output .js directory must be specified")
except Exception:
# Work with python 2 and 3 http://docs.python.org/py3k/howto/pyporting.html
exc = sys.exc_info()[1]
sys.stderr.write("Failed to parse command-line arguments: %s\n\n" % exc)
sys.stderr.write("Usage: <script> Inspector.json --output_h_dir <output_header_dir> --output_cpp_dir <output_cpp_dir> [--write_always]\n")
sys.stderr.write("Usage: <script> Inspector.json --output_h_dir <output_header_dir> --output_cpp_dir <output_cpp_dir> --output_js_dir <output_js_dir> [--write_always] [--no_verification]\n")
exit(1)
......@@ -1786,8 +1792,9 @@ def resolve_all_types():
if request and not request.is_acknowledged():
raise Exception("Failed to generate runtimeCast in " + full_type_name)
for full_type_name in runtime_cast_generate_requests:
raise Exception("Failed to generate runtimeCast. Type " + full_type_name + " not found")
if verification:
for full_type_name in runtime_cast_generate_requests:
raise Exception("Failed to generate runtimeCast. Type " + full_type_name + " not found")
return ForwardListener
......@@ -2335,6 +2342,7 @@ class SmartOutput:
def close(self):
text_changed = True
self.output_ = self.output_.rstrip() + "\n"
try:
read_file = open(self.file_name_, "r")
......@@ -2362,7 +2370,7 @@ frontend_cpp_file = SmartOutput(output_cpp_dirname + "/InspectorFrontend.cpp")
typebuilder_h_file = SmartOutput(output_header_dirname + "/InspectorTypeBuilder.h")
typebuilder_cpp_file = SmartOutput(output_cpp_dirname + "/InspectorTypeBuilder.cpp")
backend_js_file = SmartOutput(output_cpp_dirname + "/InspectorBackendCommands.js")
backend_js_file = SmartOutput(output_js_dirname + "/InspectorBackendCommands.js")
backend_h_file.write(Templates.backend_h.substitute(None,
......
2013-08-26 Joseph Pecoraro <pecoraro@apple.com>
Web Inspector: We should regenerate InspectorBackendCommands.js for Legacy Inspector.json versions
https://bugs.webkit.org/show_bug.cgi?id=120242
Reviewed by Timothy Hatcher.
- Include the iOS 6.0 Inspector.json which maps to Legacy/6.0/InspectorBackendCommands.js.
- Provide a helper script to regenerate the backend commands file for trunk and Versions.
- Regenerated file now includes enums and other minor changes.
* Scripts/update-InspectorBackendCommands.rb: Added.
* UserInterface/InspectorBackendCommands.js:
* UserInterface/Legacy/6.0/InspectorBackendCommands.js:
* Versions/Inspector-iOS-6.0.json: Added.
2013-08-24 Joseph Pecoraro <pecoraro@apple.com>
Web Inspector: Breakpoints in the editors gutter should have a contextmenu
......
#!/usr/bin/ruby
require 'fileutils'
require 'tmpdir'
if ARGV.size != 0
puts "usage: #{File.basename $0}"
exit 1
end
WEB_INSPECTOR_PATH = File.expand_path File.join(File.dirname(__FILE__), "..")
WEBCORE_PATH = File.expand_path File.join(File.dirname(__FILE__), "..", "..", "WebCore")
$code_generator_path = File.join WEBCORE_PATH, "inspector", "CodeGeneratorInspector.py"
$inspector_json_path = File.join WEBCORE_PATH, "inspector", "Inspector.json"
$versions_directory_path = File.join WEB_INSPECTOR_PATH, "Versions"
$web_inspector_user_interface_path = File.join WEB_INSPECTOR_PATH, "UserInterface"
$backend_commands_filename = "InspectorBackendCommands.js"
class Task
def initialize(input_json_path, output_directory_path, verification)
@input_json_path = input_json_path
@output_directory_path = output_directory_path
@verification = verification
end
def run
display_input = File.basename @input_json_path
display_output = File.join @output_directory_path.gsub(/^.*?\/UserInterface/, "UserInterface"), $backend_commands_filename
puts "#{display_input} -> #{display_output}"
Dir.mktmpdir do |tmpdir|
cmd = "#{$code_generator_path} '#{@input_json_path}' --output_h_dir '#{tmpdir}' --output_cpp_dir '#{tmpdir}' --output_js_dir '#{tmpdir}' --write_always"
cmd += " --no_verification" if !@verification
%x{ #{cmd} }
if $?.exitstatus != 0
puts "ERROR: Error Code (#{$?.exitstatus}) Evaluating: #{cmd}"
exit 1
end
generated_path = File.join tmpdir, $backend_commands_filename
if !File.exists?(generated_path)
puts "ERROR: Generated file does not exist at expected path."
exit 1
end
FileUtils.mkdir_p @output_directory_path
FileUtils.cp generated_path, @output_directory_path
end
end
end
def all_tasks
tasks = []
tasks << Task.new($inspector_json_path, $web_inspector_user_interface_path, true)
had_error = false
Dir.glob(File.join($versions_directory_path, "*.json")).each do |version_path|
match = File.basename(version_path).match(/^Inspector(.*?)\-([^-]+?)\.json$/)
if match
output_path = File.join $web_inspector_user_interface_path, "Legacy", match[2]
tasks << Task.new(version_path, output_path, false)
else
puts "ERROR: Version file (#{version_path}) did not the template Inspector<ANYTHING>-<VERSION>.js"
had_error = true
end
end
exit 1 if had_error
tasks
end
def main
all_tasks.each { |task| task.run }
end
main
// File is generated by WebCore/WebCore/inspector/CodeGeneratorInspector.py
// File is generated by Source/WebCore/inspector/CodeGeneratorInspector.py
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
......
// File is generated by WebCore/WebCore/inspector/CodeGeneratorInspector.py
// File is generated by Source/WebCore/inspector/CodeGeneratorInspector.py
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
......@@ -20,6 +20,7 @@ InspectorBackend.registerCommand("Memory.getDOMNodeCount", [], ["domGroups", "st
// Page.
InspectorBackend.registerPageDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Page");
InspectorBackend.registerEnum("Page.ResourceType", {Document: "Document", Stylesheet: "Stylesheet", Image: "Image", Font: "Font", Script: "Script", XHR: "XHR", WebSocket: "WebSocket", Other: "Other"});
InspectorBackend.registerEvent("Page.domContentEventFired", ["timestamp"]);
InspectorBackend.registerEvent("Page.loadEventFired", ["timestamp"]);
InspectorBackend.registerEvent("Page.frameNavigated", ["frame"]);
......@@ -44,6 +45,9 @@ InspectorBackend.registerCommand("Page.getScriptExecutionStatus", [], ["result"]
InspectorBackend.registerCommand("Page.setScriptExecutionDisabled", [{"name": "value", "type": "boolean", "optional": false}], []);
// Runtime.
InspectorBackend.registerRuntimeDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Runtime");
InspectorBackend.registerEnum("Runtime.RemoteObjectType", {Object: "object", Function: "function", Undefined: "undefined", String: "string", Number: "number", Boolean: "boolean"});
InspectorBackend.registerEnum("Runtime.RemoteObjectSubtype", {Array: "array", Null: "null", Node: "node", Regexp: "regexp", Date: "date"});
InspectorBackend.registerCommand("Runtime.evaluate", [{"name": "expression", "type": "string", "optional": false}, {"name": "objectGroup", "type": "string", "optional": true}, {"name": "includeCommandLineAPI", "type": "boolean", "optional": true}, {"name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true}, {"name": "frameId", "type": "string", "optional": true}, {"name": "returnByValue", "type": "boolean", "optional": true}], ["result", "wasThrown"]);
InspectorBackend.registerCommand("Runtime.callFunctionOn", [{"name": "objectId", "type": "string", "optional": false}, {"name": "functionDeclaration", "type": "string", "optional": false}, {"name": "arguments", "type": "object", "optional": true}, {"name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true}, {"name": "returnByValue", "type": "boolean", "optional": true}], ["result", "wasThrown"]);
InspectorBackend.registerCommand("Runtime.getProperties", [{"name": "objectId", "type": "string", "optional": false}, {"name": "ownProperties", "type": "boolean", "optional": true}], ["result"]);
......@@ -53,6 +57,9 @@ InspectorBackend.registerCommand("Runtime.run", [], []);
// Console.
InspectorBackend.registerConsoleDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Console");
InspectorBackend.registerEnum("Console.ConsoleMessageSource", {HTML: "html", WML: "wml", XML: "xml", Javascript: "javascript", Network: "network", ConsoleAPI: "console-api", Other: "other"});
InspectorBackend.registerEnum("Console.ConsoleMessageLevel", {Tip: "tip", Log: "log", Warning: "warning", Error: "error", Debug: "debug"});
InspectorBackend.registerEnum("Console.ConsoleMessageType", {Log: "log", Dir: "dir", DirXML: "dirxml", Trace: "trace", StartGroup: "startGroup", StartGroupCollapsed: "startGroupCollapsed", EndGroup: "endGroup", Assert: "assert"});
InspectorBackend.registerEvent("Console.messageAdded", ["message"]);
InspectorBackend.registerEvent("Console.messageRepeatCountUpdated", ["count"]);
InspectorBackend.registerEvent("Console.messagesCleared", []);
......@@ -65,6 +72,7 @@ InspectorBackend.registerCommand("Console.addInspectedHeapObject", [{"name": "he
// Network.
InspectorBackend.registerNetworkDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Network");
InspectorBackend.registerEnum("Network.InitiatorType", {Parser: "parser", Script: "script", Other: "other"});
InspectorBackend.registerEvent("Network.requestWillBeSent", ["requestId", "frameId", "loaderId", "documentURL", "request", "timestamp", "initiator", "redirectResponse"]);
InspectorBackend.registerEvent("Network.requestServedFromCache", ["requestId"]);
InspectorBackend.registerEvent("Network.responseReceived", ["requestId", "frameId", "loaderId", "timestamp", "type", "response"]);
......@@ -102,6 +110,7 @@ InspectorBackend.registerCommand("Database.executeSQL", [{"name": "databaseId",
// IndexedDB.
InspectorBackend.registerIndexedDBDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "IndexedDB");
InspectorBackend.registerEnum("IndexedDB.KeyType", {Number: "number", String: "string", Date: "date", Array: "array"});
InspectorBackend.registerEvent("IndexedDB.databaseNamesLoaded", ["requestId", "securityOriginWithDatabaseNames"]);
InspectorBackend.registerEvent("IndexedDB.databaseLoaded", ["requestId", "databaseWithObjectStores"]);
InspectorBackend.registerEvent("IndexedDB.objectStoreDataLoaded", ["requestId", "objectStoreDataEntries", "hasMore"]);
......@@ -182,6 +191,9 @@ InspectorBackend.registerCommand("DOM.markUndoableState", [], []);
// CSS.
InspectorBackend.registerCSSDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "CSS");
InspectorBackend.registerEnum("CSS.CSSRuleOrigin", {User: "user", UserAgent: "user-agent", Inspector: "inspector", Regular: "regular"});
InspectorBackend.registerEnum("CSS.CSSPropertyStatus", {Active: "active", Inactive: "inactive", Disabled: "disabled", Style: "style"});
InspectorBackend.registerEnum("CSS.CSSMediaSource", {MediaRule: "mediaRule", ImportRule: "importRule", LinkedSheet: "linkedSheet", InlineSheet: "inlineSheet"});
InspectorBackend.registerEvent("CSS.mediaQueryResultChanged", []);
InspectorBackend.registerEvent("CSS.styleSheetChanged", ["styleSheetId"]);
InspectorBackend.registerCommand("CSS.enable", [], []);
......@@ -207,10 +219,10 @@ InspectorBackend.registerEvent("Timeline.eventRecorded", ["record"]);
InspectorBackend.registerCommand("Timeline.start", [{"name": "maxCallStackDepth", "type": "number", "optional": true}], []);
InspectorBackend.registerCommand("Timeline.stop", [], []);
InspectorBackend.registerCommand("Timeline.setIncludeMemoryDetails", [{"name": "enabled", "type": "boolean", "optional": false}], []);
InspectorBackend.registerCommand("Timeline.supportsFrameInstrumentation", [], ["result"]);
// Debugger.
InspectorBackend.registerDebuggerDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Debugger");
InspectorBackend.registerEnum("Debugger.ScopeType", {Global: "global", Local: "local", With: "with", Closure: "closure", Catch: "catch"});
InspectorBackend.registerEvent("Debugger.globalObjectCleared", []);
InspectorBackend.registerEvent("Debugger.scriptParsed", ["scriptId", "url", "startLine", "startColumn", "endLine", "endColumn", "isContentScript", "sourceMapURL"]);
InspectorBackend.registerEvent("Debugger.scriptFailedToParse", ["url", "scriptSource", "startLine", "errorLine", "errorMessage"]);
......@@ -240,6 +252,7 @@ InspectorBackend.registerCommand("Debugger.setPauseOnExceptions", [{"name": "sta
InspectorBackend.registerCommand("Debugger.evaluateOnCallFrame", [{"name": "callFrameId", "type": "string", "optional": false}, {"name": "expression", "type": "string", "optional": false}, {"name": "objectGroup", "type": "string", "optional": true}, {"name": "includeCommandLineAPI", "type": "boolean", "optional": true}, {"name": "doNotPauseOnExceptionsAndMuteConsole", "type": "boolean", "optional": true}, {"name": "returnByValue", "type": "boolean", "optional": true}], ["result", "wasThrown"]);
// DOMDebugger.
InspectorBackend.registerEnum("DOMDebugger.DOMBreakpointType", {SubtreeModified: "subtree-modified", AttributeModified: "attribute-modified", NodeRemoved: "node-removed"});
InspectorBackend.registerCommand("DOMDebugger.setDOMBreakpoint", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "type", "type": "string", "optional": false}], []);
InspectorBackend.registerCommand("DOMDebugger.removeDOMBreakpoint", [{"name": "nodeId", "type": "number", "optional": false}, {"name": "type", "type": "string", "optional": false}], []);
InspectorBackend.registerCommand("DOMDebugger.setEventListenerBreakpoint", [{"name": "eventName", "type": "string", "optional": false}], []);
......@@ -251,6 +264,7 @@ InspectorBackend.registerCommand("DOMDebugger.removeXHRBreakpoint", [{"name": "u
// Profiler.
InspectorBackend.registerProfilerDispatcher = InspectorBackend.registerDomainDispatcher.bind(InspectorBackend, "Profiler");
InspectorBackend.registerEnum("Profiler.ProfileHeaderTypeId", {CPU: "CPU", CSS: "CSS", HEAP: "HEAP"});
InspectorBackend.registerEvent("Profiler.addProfileHeader", ["header"]);
InspectorBackend.registerEvent("Profiler.addHeapSnapshotChunk", ["uid", "chunk"]);
InspectorBackend.registerEvent("Profiler.finishHeapSnapshot", ["uid"]);
......
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment