+2011-10-03 Pavel Feldman <pfeldman@chromium.org>
+
+ Web Inspector: restore partial front-end compilability
+ https://bugs.webkit.org/show_bug.cgi?id=69221
+
+ Removed unused isWhitespace; introduced missing classes in Inspector.json;
+ generated externs for the protocol types along with the commands.
+
+ Reviewed by Yury Semikhatsky.
+
+ * inspector/Inspector.json:
+ * inspector/compile-front-end.sh:
+ * inspector/front-end/DOMAgent.js:
+ (WebInspector.DOMAgent):
+ (WebInspector.DOMAgent.prototype._dispatchWhenDocumentAvailable.onDocumentAvailable):
+ (WebInspector.DOMAgent.prototype._dispatchWhenDocumentAvailable):
+ * inspector/front-end/ElementsPanel.js:
+ (WebInspector.ElementsPanel.prototype.updateBreadcrumb):
+ * inspector/front-end/ElementsTreeOutline.js:
+ ():
+ * inspector/front-end/Object.js:
+ * inspector/front-end/Popover.js:
+ (WebInspector.PopoverHelper.prototype._mouseMove):
+ * inspector/front-end/View.js:
+ * inspector/front-end/externs.js:
+ (Array.prototype.remove):
+ * inspector/generate-protocol-externs:
+
2011-10-02 Kent Tamura <tkent@chromium.org>
method/enctype/formMethod/formEnctype properties should be limited to known values.
"type": "object",
"description": "Search result for resource.",
"properties": [
- { "name": "url", "type": "string", "description": "Resource URL." },
+ { "name": "url", "type": "string", "description": "Resource URL." },
{ "name": "frameId", "type": "string", "description": "Resource frame id." },
{ "name": "matchesCount", "type": "number", "description": "Number of matches in the resource content." }
],
"hidden": true
- }
+ },
+ {
+ "id": "Cookie",
+ "type": "object",
+ "description": "Cookie object",
+ "properties": [
+ { "name": "name", "type": "string", "description": "Cookie name." },
+ { "name": "value", "type": "string", "description": "Cookie value." },
+ { "name": "domain", "type": "string", "description": "Cookie domain." },
+ { "name": "path", "type": "string", "description": "Cookie path." },
+ { "name": "expires", "type": "integer", "description": "Cookie expires." },
+ { "name": "size", "type": "integer", "description": "Cookie size." },
+ { "name": "httpOnly", "type": "boolean", "description": "True if cookie is http-only." },
+ { "name": "secure", "type": "boolean", "description": "True if cookie is secure." },
+ { "name": "session", "type": "boolean", "description": "True in case of session cookie." }
+ ],
+ "hidden": true
+ },
],
"commands": [
{
"parameters": [
{ "name": "transactionId", "type": "integer" },
{ "name": "columnNames", "type": "array", "items": { "type": "string" } },
- { "name": "values", "type": "array", "items": { "type": "string or number" }}
+ { "name": "values", "type": "array", "items": { "type": "any" }}
]
},
{
{
"domain": "DOMStorage",
"hidden": true,
- "types": [],
+ "types": [
+ {
+ "id": "Entry",
+ "type": "object",
+ "description": "DOM Storage entry.",
+ "hidden": true,
+ "properties": [
+ { "name": "host", "type": "string", "description": "Domain name." },
+ { "name": "isLocalStorage", "type": "boolean", "description": "True for local storage." },
+ { "name": "id", "type": "number", "description": "Entry id for further reference." }
+ ]
+ },
+ ],
"commands": [
{
"name": "enable",
{ "name": "storageId", "type": "integer" }
],
"returns": [
- { "name": "entries", "type": "array", "items": { "$ref": "DOMStorageEntry"} }
+ { "name": "entries", "type": "array", "items": { "$ref": "Entry"} }
]
},
{
java -jar ~/closure/compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --warning_level VERBOSE --language_in ECMASCRIPT5 --accept_const_keyword \
--externs Source/WebCore/inspector/front-end/externs.js \
--externs Source/WebCore/inspector/front-end/protocol-externs.js \
- --module jsmodule_util:2 \
+ --module jsmodule_core:2 \
--js Source/WebCore/inspector/front-end/utilities.js \
--js Source/WebCore/inspector/front-end/treeoutline.js \
- --module jsmodule_host:1 \
- --js Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js \
- --module jsmodule_common:4:jsmodule_util,jsmodule_host \
- --js Source/WebCore/inspector/front-end/BinarySearch.js \
- --js Source/WebCore/inspector/front-end/Object.js \
+ --module jsmodule_env:3 \
--js Source/WebCore/inspector/front-end/Settings.js \
--js Source/WebCore/inspector/front-end/UserMetrics.js \
- --module jsmodule_sdk:15:jsmodule_common,jsmodule_host \
- --js Source/WebCore/inspector/front-end/DebuggerModel.js \
- --js Source/WebCore/inspector/front-end/BreakpointManager.js \
- --js Source/WebCore/inspector/front-end/ConsoleMessage.js \
- --js Source/WebCore/inspector/front-end/ConsoleModel.js \
- --js Source/WebCore/inspector/front-end/DebuggerPresentationModel.js \
- --js Source/WebCore/inspector/front-end/CookieParser.js \
+ --js Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js \
+ --module jsmodule_sdk:7:jsmodule_core,jsmodule_env \
+ --js Source/WebCore/inspector/front-end/BinarySearch.js \
--js Source/WebCore/inspector/front-end/DOMAgent.js \
- --js Source/WebCore/inspector/front-end/NetworkManager.js \
+ --js Source/WebCore/inspector/front-end/DebuggerModel.js \
+ --js Source/WebCore/inspector/front-end/Object.js \
--js Source/WebCore/inspector/front-end/Script.js \
- --js Source/WebCore/inspector/front-end/ScriptFormatter.js \
- --js Source/WebCore/inspector/front-end/SourceFile.js \
--js Source/WebCore/inspector/front-end/RemoteObject.js \
- --js Source/WebCore/inspector/front-end/Resource.js \
--js Source/WebCore/inspector/front-end/ResourceCategory.js \
- --js Source/WebCore/inspector/front-end/UISourceCode.js \
--module jsmodule_misc:10:jsmodule_sdk \
--js Source/WebCore/inspector/front-end/Checkbox.js \
--js Source/WebCore/inspector/front-end/ContextMenu.js \
/**
* @constructor
+ * @param {DOMAgent.Node} payload.
*/
WebInspector.DOMNode = function(doc, payload) {
this.ownerDocument = doc;
return descendant !== null && descendant.isAncestor(this);
},
- isWhitespace: function()
- {
- if (this.nodeType !== Node.TEXT_NODE)
- return false;
- if (!this.nodeValue.length)
- return true;
- return this.nodeValue.match(/^[\s\xA0]+$/);
- },
-
_setAttributesPayload: function(attrs)
{
this._attributes = [];
this._addAttribute(attrs[i], attrs[i + 1]);
},
+ /**
+ * @param {DOMAgent.Node} payload.
+ */
_insertChild: function(prev, payload)
{
var node = new WebInspector.DOMNode(this.ownerDocument, payload);
/**
* @extends {WebInspector.DOMNode}
* @constructor
+ * @param {DOMAgent.Node} payload.
*/
WebInspector.DOMDocument = function(domAgent, payload)
{
* @constructor
*/
WebInspector.DOMAgent = function() {
- this._idToDOMNode = null;
+ /** @type {Object|undefined} */
+ this._idToDOMNode = {};
this._document = null;
this._attributeLoadNodeIds = {};
InspectorBackend.registerDOMDispatcher(new WebInspector.DOMDispatcher(this));
}
WebInspector.DOMAgent.prototype = {
+ /**
+ * @param {function(WebInspector.DOMDocument)=} callback
+ */
requestDocument: function(callback)
{
if (this._document) {
}
},
- _dispatchWhenDocumentAvailable: function(action)
+ _dispatchWhenDocumentAvailable: function(func, arg, callback)
{
- var requestArguments = Array.prototype.slice.call(arguments, 1);
- var callbackWrapper;
+ if (callback)
+ callback = this._wrapClientCallback(callback);
- if (typeof requestArguments[requestArguments.length - 1] === "function") {
- var callback = requestArguments.pop();
- callbackWrapper = this._wrapClientCallback(callback);
- requestArguments.push(callbackWrapper);
- }
function onDocumentAvailable()
{
if (this._document)
- action.apply(null, requestArguments);
+ func.call(null, arg, callback);
else {
- if (callbackWrapper)
- callbackWrapper("No document");
+ if (callback)
+ callback("No document");
}
}
this.requestDocument(onDocumentAvailable.bind(this));
},
/**
- * @param {*} payload
+ * @param {DOMAgent.Node} payload.
*/
_setDocument: function(payload)
{
},
/**
- * @param {*} payload
+ * @param {DOMAgent.Node} payload.
*/
_setDetachedRoot: function(payload)
{
break;
case Node.TEXT_NODE:
- if (current.isWhitespace())
- crumbTitle = WebInspector.UIString("(whitespace)");
- else
- crumbTitle = WebInspector.UIString("(text)");
+ crumbTitle = WebInspector.UIString("(text)");
break
case Node.COMMENT_NODE:
break;
case Node.TEXT_NODE:
- if (node.isWhitespace())
- info.titleDOM.appendChild(document.createTextNode("(whitespace)"));
- else {
- if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "script") {
- var newNode = info.titleDOM.createChild("span", "webkit-html-text-node webkit-html-js-node");
- newNode.textContent = node.nodeValue();
-
- var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/javascript", true);
- javascriptSyntaxHighlighter.syntaxHighlightNode(newNode);
- } else if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "style") {
- var newNode = info.titleDOM.createChild("span", "webkit-html-text-node webkit-html-css-node");
- newNode.textContent = node.nodeValue();
-
- var cssSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/css", true);
- cssSyntaxHighlighter.syntaxHighlightNode(newNode);
- } else {
- info.titleDOM.appendChild(document.createTextNode("\""));
- var textNodeElement = info.titleDOM.createChild("span", "webkit-html-text-node");
- textNodeElement.textContent = node.nodeValue();
- info.titleDOM.appendChild(document.createTextNode("\""));
- }
+ if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "script") {
+ var newNode = info.titleDOM.createChild("span", "webkit-html-text-node webkit-html-js-node");
+ newNode.textContent = node.nodeValue();
+
+ var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/javascript", true);
+ javascriptSyntaxHighlighter.syntaxHighlightNode(newNode);
+ } else if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "style") {
+ var newNode = info.titleDOM.createChild("span", "webkit-html-text-node webkit-html-css-node");
+ newNode.textContent = node.nodeValue();
+
+ var cssSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/css", true);
+ cssSyntaxHighlighter.syntaxHighlightNode(newNode);
+ } else {
+ info.titleDOM.appendChild(document.createTextNode("\""));
+ var textNodeElement = info.titleDOM.createChild("span", "webkit-html-text-node");
+ textNodeElement.textContent = node.nodeValue();
+ info.titleDOM.appendChild(document.createTextNode("\""));
}
break;
return true;
},
+ /**
+ * @param {*=} eventData
+ */
dispatchEventToListeners: function(eventType, eventData)
{
if (!this._listeners || !this._listeners[eventType])
this._hidePopoverTimer = setTimeout(doHide, this._timeout / 2);
}
- this._handleMouseAction(event);
+ this._handleMouseAction(event, false);
},
_handleMouseAction: function(event, isMouseDown)
/**
* @constructor
+ * @extends {WebInspector.Object}
* @param {Element=} element
*/
WebInspector.View = function(element)
this.element.addStyleClass("visible");
},
+ /**
+ * @param {Element=} parentElement
+ */
show: function(parentElement)
{
this._visible = true;
JSON.stringify = function(str) {}
Element.prototype.scrollIntoViewIfNeeded = function() {}
+
+Array.prototype.remove = function(obj) {}
output_file = open(output_path, "w")
type_traits = {
+ "any": "*",
"string": "string",
"integer": "number",
"number": "number",
def param_type(domain_name, param):
if "type" in param:
- return type_traits[param["type"]]
+ if param["type"] == "array":
+ items = param["items"]
+ return "Array.<%s>" % param_type(domain_name, items)
+ else:
+ return type_traits[param["type"]]
if "$ref" in param:
type_id = full_qualified_type_id(domain_name, param["$ref"])
if type_id in ref_types:
- ref_type = ref_types[type_id]
- return type_traits[ref_type["type"]]
+ return ref_types[type_id]
else:
print "Type not found: " + type_id
return "!! Type not found: " + type_id
if "types" in domain:
for type in domain["types"]:
type_id = full_qualified_type_id(domain_name, type["id"])
- ref_types[type_id] = type;
+ ref_types[type_id] = "%sAgent.%s" % (domain_name, type["id"])
for domain in json_api:
domain_name = domain["domain"]
output_file.write("\n\n\nvar %sAgent = {};\n" % domain_name)
+ if "types" in domain:
+ for type in domain["types"]:
+ if type["type"] == "object":
+ output_file.write("\n/** @constructor */\n")
+ output_file.write("%sAgent.%s = function()\n{\n" % (domain_name, type["id"]))
+ if "properties" in type:
+ for property in type["properties"]:
+ suffix = ""
+ if ("optional" in property):
+ suffix = "|undefined"
+ output_file.write("/** @type {%s%s} */ this.%s;\n" % (param_type(domain_name, property), suffix, property["name"]))
+ output_file.write("}\n")
+ else:
+ output_file.write("\n/** @typedef {%s} */\n%sAgent.%s;\n" % (type_traits[type["type"]], domain_name, type["id"]))
+
+
if "commands" in domain:
for command in domain["commands"]:
output_file.write("\n/**\n")