Skip to content

Commit

Permalink
Web Inspector: generate protocol externs API for the front-end compil…
Browse files Browse the repository at this point in the history
…ation.

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

Reviewed by Tony Gentilcore.

Source/WebCore:

* inspector/Inspector.json:
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::setAttributesText):
* inspector/InspectorDOMAgent.h:
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::InspectorDebuggerAgent::setBreakpointByUrl):
* inspector/InspectorDebuggerAgent.h:
* inspector/compile-front-end.sh: Added.
* inspector/front-end/DOMAgent.js:
(WebInspector.DOMNode.prototype.setAttribute):
* inspector/front-end/DebuggerModel.js:
(WebInspector.DebuggerModel.prototype.setBreakpoint):
* inspector/front-end/externs.js: Added.
(console.warn):

LayoutTests:

* inspector/debugger/debugger-set-breakpoint-regex.html:

Canonical link: https://commits.webkit.org/82563@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@93586 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
pavelfeldman committed Aug 23, 2011
1 parent 19958e3 commit c92394f
Show file tree
Hide file tree
Showing 12 changed files with 113 additions and 10 deletions.
9 changes: 9 additions & 0 deletions LayoutTests/ChangeLog
@@ -1,3 +1,12 @@
2011-08-22 Pavel Feldman <pfeldman@google.com>

Web Inspector: generate protocol externs API for the front-end compilation.
https://bugs.webkit.org/show_bug.cgi?id=66677

Reviewed by Tony Gentilcore.

* inspector/debugger/debugger-set-breakpoint-regex.html:

2011-08-23 Csaba Osztrogonác <ossy@webkit.org>

Unreviewed gardening. Remove Windows style new lines from the test introduced in r93521.
Expand Down
Expand Up @@ -31,7 +31,7 @@
{
var url = "debugger-set-breakpoint.js";
var urlRegex = "debugger-set-breakpoint.*";
DebuggerAgent.setBreakpointByUrl(url, urlRegex, 1, step2);
DebuggerAgent.setBreakpointByUrl(1, url, urlRegex, step2);

function step2(result)
{
Expand Down
22 changes: 22 additions & 0 deletions Source/WebCore/ChangeLog
@@ -1,3 +1,25 @@
2011-08-22 Pavel Feldman <pfeldman@google.com>

Web Inspector: generate protocol externs API for the front-end compilation.
https://bugs.webkit.org/show_bug.cgi?id=66677

Reviewed by Tony Gentilcore.

* inspector/Inspector.json:
* inspector/InspectorDOMAgent.cpp:
(WebCore::InspectorDOMAgent::setAttributesText):
* inspector/InspectorDOMAgent.h:
* inspector/InspectorDebuggerAgent.cpp:
(WebCore::InspectorDebuggerAgent::setBreakpointByUrl):
* inspector/InspectorDebuggerAgent.h:
* inspector/compile-front-end.sh: Added.
* inspector/front-end/DOMAgent.js:
(WebInspector.DOMNode.prototype.setAttribute):
* inspector/front-end/DebuggerModel.js:
(WebInspector.DebuggerModel.prototype.setBreakpoint):
* inspector/front-end/externs.js: Added.
(console.warn):

2011-08-22 Pavel Feldman <pfeldman@google.com>

Web Inspector: Prepare utilities.js for compilation.
Expand Down
6 changes: 3 additions & 3 deletions Source/WebCore/inspector/Inspector.json
Expand Up @@ -949,8 +949,8 @@
"name": "setAttributesText",
"parameters": [
{ "name": "nodeId", "$ref": "NodeId", "description": "Id of the element to set attributes for." },
{ "name": "name", "type": "string", "optional": true, "description": "Attribute name to replace with new attributes derived from text in case text parsed successfully." },
{ "name": "text", "type": "string", "description": "Text with a number of attributes. Will parse this text using HTML parser." }
{ "name": "text", "type": "string", "description": "Text with a number of attributes. Will parse this text using HTML parser." },
{ "name": "name", "type": "string", "optional": true, "description": "Attribute name to replace with new attributes derived from text in case text parsed successfully." }
],
"description": "Sets attributes on element with given id. This method is useful when user edits some existing attribute value and types in several attribute name/value pairs."
},
Expand Down Expand Up @@ -1544,9 +1544,9 @@
{
"name": "setBreakpointByUrl",
"parameters": [
{ "name": "lineNumber", "type": "integer", "description": "Line number to set breakpoint at." },
{ "name": "url", "type": "string", "optional": true, "description": "URL of the resources to set breakpoint on." },
{ "name": "urlRegex", "type": "string", "optional": true, "description": "Regex pattern for the URLs of the resources to set breakpoints on. Either <code>url</code> or <code>urlRegex</code> must be specified." },
{ "name": "lineNumber", "type": "integer", "description": "Line number to set breakpoint at." },
{ "name": "columnNumber", "type": "integer", "optional": true, "description": "Offset in the line to set breakpoint at." },
{ "name": "condition", "type": "string", "optional": true, "description": "Expression to use as a breakpoint condition. When specified, debugger will only stop on the breakpoint if this expression evaluates to true." }
],
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/inspector/InspectorDOMAgent.cpp
Expand Up @@ -585,7 +585,7 @@ void InspectorDOMAgent::setAttributeValue(ErrorString* errorString, int elementI
*errorString = "Internal error: could not set attribute value.";
}

void InspectorDOMAgent::setAttributesText(ErrorString* errorString, int elementId, const String* const name, const String& text)
void InspectorDOMAgent::setAttributesText(ErrorString* errorString, int elementId, const String& text, const String* const name)
{
Element* element = assertElement(errorString, elementId);
if (!element)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/inspector/InspectorDOMAgent.h
Expand Up @@ -117,7 +117,7 @@ class InspectorDOMAgent {
void getDocument(ErrorString*, RefPtr<InspectorObject>* root);
void requestChildNodes(ErrorString*, int nodeId);
void setAttributeValue(ErrorString*, int elementId, const String& name, const String& value);
void setAttributesText(ErrorString*, int elementId, const String* const name, const String& text);
void setAttributesText(ErrorString*, int elementId, const String& text, const String* const name);
void removeAttribute(ErrorString*, int elementId, const String& name);
void removeNode(ErrorString*, int nodeId);
void setNodeName(ErrorString*, int nodeId, const String& name, int* newId);
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/inspector/InspectorDebuggerAgent.cpp
Expand Up @@ -181,7 +181,7 @@ static bool matches(const String& url, const String& pattern, bool isRegex)
return url == pattern;
}

void InspectorDebuggerAgent::setBreakpointByUrl(ErrorString* errorString, const String* const optionalURL, const String* const optionalURLRegex, int lineNumber, const int* const optionalColumnNumber, const String* const optionalCondition, String* outBreakpointId, RefPtr<InspectorArray>* locations)
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>* locations)
{
if (!optionalURL == !optionalURLRegex) {
*errorString = "Either url or urlRegex must be specified.";
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/inspector/InspectorDebuggerAgent.h
Expand Up @@ -82,7 +82,7 @@ class InspectorDebuggerAgent : public ScriptDebugListener {
// Part of the protocol.
void setBreakpointsActive(ErrorString*, bool active);

void setBreakpointByUrl(ErrorString*, const String* const optionalURL, const String* const optionalURLRegex, int lineNumber, const int* const optionalColumnNumber, const String* const optionalCondition, String* breakpointId, RefPtr<InspectorArray>* locations);
void setBreakpointByUrl(ErrorString*, int lineNumber, const String* const optionalURL, const String* const optionalURLRegex, const int* const optionalColumnNumber, const String* const optionalCondition, String* breakpointId, RefPtr<InspectorArray>* locations);
void setBreakpoint(ErrorString*, PassRefPtr<InspectorObject> location, const String* const optionalCondition, String* breakpointId, RefPtr<InspectorObject>* actualLocation);
void removeBreakpoint(ErrorString*, const String& breakpointId);
void continueToLocation(ErrorString*, PassRefPtr<InspectorObject> location);
Expand Down
37 changes: 37 additions & 0 deletions Source/WebCore/inspector/compile-front-end.sh
@@ -0,0 +1,37 @@
#!/bin/sh
# Copyright (C) 2011 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above
# copyright notice, this list of conditions and the following disclaimer
# in the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Google Inc. nor the names of its
# contributors may be used to endorse or promote products derived from
# this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
# Compiles WebKit Web Inspector front-end.

python Source/WebCore/inspector/generate-protocol-externs -o Source/WebCore/inspector/front-end/protocol-externs.js Source/WebCore/inspector/Inspector.json
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 \
--js Source/WebCore/inspector/front-end/utilities.js \
--js Source/WebCore/inspector/front-end/treeoutline.js
2 changes: 1 addition & 1 deletion Source/WebCore/inspector/front-end/DOMAgent.js
Expand Up @@ -129,7 +129,7 @@ WebInspector.DOMNode.prototype = {

setAttribute: function(name, text, callback)
{
DOMAgent.setAttributesText(this.id, name, text, callback);
DOMAgent.setAttributesText(this.id, text, name, callback);
},

setAttributeValue: function(name, value, callback)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/inspector/front-end/DebuggerModel.js
Expand Up @@ -98,7 +98,7 @@ WebInspector.DebuggerModel.prototype = {
if (callback)
callback(error ? null : breakpointId, locations);
}
DebuggerAgent.setBreakpointByUrl(url, undefined, lineNumber, columnNumber, condition, didSetBreakpoint.bind(this));
DebuggerAgent.setBreakpointByUrl(lineNumber, url, undefined, columnNumber, condition, didSetBreakpoint.bind(this));
WebInspector.userMetrics.ScriptsBreakpointSet.record();
},

Expand Down
35 changes: 35 additions & 0 deletions Source/WebCore/inspector/front-end/externs.js
@@ -0,0 +1,35 @@
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* * Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
* * Neither the name of Google Inc. nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

var console = {}
console.warn = function(message) {}

var WebInspector = {}
var InspectorBackend = {}

0 comments on commit c92394f

Please sign in to comment.