Changeset 96485 in webkit


Ignore:
Timestamp:
Oct 3, 2011 2:16:12 AM (13 years ago)
Author:
pfeldman@chromium.org
Message:

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.

Patch by Pavel Feldman <pfeldman@chromium.org> on 2011-10-03
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:
Location:
trunk/Source/WebCore
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r96484 r96485  
     12011-10-03  Pavel Feldman  <pfeldman@chromium.org>
     2
     3        Web Inspector: restore partial front-end compilability
     4        https://bugs.webkit.org/show_bug.cgi?id=69221
     5
     6        Removed unused isWhitespace; introduced missing classes in Inspector.json;
     7        generated externs for the protocol types along with the commands.
     8
     9        Reviewed by Yury Semikhatsky.
     10
     11        * inspector/Inspector.json:
     12        * inspector/compile-front-end.sh:
     13        * inspector/front-end/DOMAgent.js:
     14        (WebInspector.DOMAgent):
     15        (WebInspector.DOMAgent.prototype._dispatchWhenDocumentAvailable.onDocumentAvailable):
     16        (WebInspector.DOMAgent.prototype._dispatchWhenDocumentAvailable):
     17        * inspector/front-end/ElementsPanel.js:
     18        (WebInspector.ElementsPanel.prototype.updateBreadcrumb):
     19        * inspector/front-end/ElementsTreeOutline.js:
     20        ():
     21        * inspector/front-end/Object.js:
     22        * inspector/front-end/Popover.js:
     23        (WebInspector.PopoverHelper.prototype._mouseMove):
     24        * inspector/front-end/View.js:
     25        * inspector/front-end/externs.js:
     26        (Array.prototype.remove):
     27        * inspector/generate-protocol-externs:
     28
    1292011-10-02  Kent Tamura  <tkent@chromium.org>
    230
  • trunk/Source/WebCore/inspector/Inspector.json

    r96398 r96485  
    119119                "description": "Search result for resource.",
    120120                "properties": [
    121                         { "name": "url", "type": "string", "description": "Resource URL." },
     121                    { "name": "url", "type": "string", "description": "Resource URL." },
    122122                    { "name": "frameId", "type": "string", "description": "Resource frame id." },
    123123                    { "name": "matchesCount", "type": "number", "description": "Number of matches in the resource content." }
    124124                ],
    125125                "hidden": true
    126             }
     126            },
     127            {
     128                "id": "Cookie",
     129                "type": "object",
     130                "description": "Cookie object",
     131                "properties": [
     132                    { "name": "name", "type": "string", "description": "Cookie name." },
     133                    { "name": "value", "type": "string", "description": "Cookie value." },
     134                    { "name": "domain", "type": "string", "description": "Cookie domain." },
     135                    { "name": "path", "type": "string", "description": "Cookie path." },
     136                    { "name": "expires", "type": "integer", "description": "Cookie expires." },
     137                    { "name": "size", "type": "integer", "description": "Cookie size." },
     138                    { "name": "httpOnly", "type": "boolean", "description": "True if cookie is http-only." },
     139                    { "name": "secure", "type": "boolean", "description": "True if cookie is secure." },
     140                    { "name": "session", "type": "boolean", "description": "True in case of session cookie." }
     141                ],
     142                "hidden": true
     143            },
    127144        ],
    128145        "commands": [
     
    775792                    { "name": "transactionId", "type": "integer" },
    776793                    { "name": "columnNames", "type": "array", "items": { "type": "string" } },
    777                     { "name": "values", "type": "array", "items": { "type": "string or number" }}
     794                    { "name": "values", "type": "array", "items": { "type": "any" }}
    778795                ]
    779796            },
     
    790807        "domain": "DOMStorage",
    791808        "hidden": true,
    792         "types": [],
     809        "types": [
     810            {
     811                "id": "Entry",
     812                "type": "object",
     813                "description": "DOM Storage entry.",
     814                "hidden": true,
     815                "properties": [
     816                    { "name": "host", "type": "string", "description": "Domain name." },
     817                    { "name": "isLocalStorage", "type": "boolean", "description": "True for local storage." },
     818                    { "name": "id", "type": "number", "description": "Entry id for further reference." }
     819                ]
     820            },
     821        ],
    793822        "commands": [
    794823            {
     
    806835                ],
    807836                "returns": [
    808                     { "name": "entries", "type": "array", "items": { "$ref": "DOMStorageEntry"} }
     837                    { "name": "entries", "type": "array", "items": { "$ref": "Entry"} }
    809838                ]
    810839            },
  • trunk/Source/WebCore/inspector/compile-front-end.sh

    r93769 r96485  
    3535    --externs Source/WebCore/inspector/front-end/externs.js \
    3636    --externs Source/WebCore/inspector/front-end/protocol-externs.js \
    37     --module jsmodule_util:2 \
     37    --module jsmodule_core:2 \
    3838        --js Source/WebCore/inspector/front-end/utilities.js \
    3939        --js Source/WebCore/inspector/front-end/treeoutline.js \
    40     --module jsmodule_host:1 \
    41         --js Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js \
    42     --module jsmodule_common:4:jsmodule_util,jsmodule_host \
    43         --js Source/WebCore/inspector/front-end/BinarySearch.js \
    44         --js Source/WebCore/inspector/front-end/Object.js \
     40    --module jsmodule_env:3 \
    4541        --js Source/WebCore/inspector/front-end/Settings.js \
    4642        --js Source/WebCore/inspector/front-end/UserMetrics.js \
    47     --module jsmodule_sdk:15:jsmodule_common,jsmodule_host \
     43        --js Source/WebCore/inspector/front-end/InspectorFrontendHostStub.js \
     44    --module jsmodule_sdk:7:jsmodule_core,jsmodule_env \
     45        --js Source/WebCore/inspector/front-end/BinarySearch.js \
     46        --js Source/WebCore/inspector/front-end/DOMAgent.js \
    4847        --js Source/WebCore/inspector/front-end/DebuggerModel.js \
    49         --js Source/WebCore/inspector/front-end/BreakpointManager.js \
    50         --js Source/WebCore/inspector/front-end/ConsoleMessage.js \
    51         --js Source/WebCore/inspector/front-end/ConsoleModel.js \
    52         --js Source/WebCore/inspector/front-end/DebuggerPresentationModel.js \
    53         --js Source/WebCore/inspector/front-end/CookieParser.js \
    54         --js Source/WebCore/inspector/front-end/DOMAgent.js \
    55         --js Source/WebCore/inspector/front-end/NetworkManager.js \
     48        --js Source/WebCore/inspector/front-end/Object.js \
    5649        --js Source/WebCore/inspector/front-end/Script.js \
    57         --js Source/WebCore/inspector/front-end/ScriptFormatter.js \
    58         --js Source/WebCore/inspector/front-end/SourceFile.js \
    5950        --js Source/WebCore/inspector/front-end/RemoteObject.js \
    60         --js Source/WebCore/inspector/front-end/Resource.js \
    6151        --js Source/WebCore/inspector/front-end/ResourceCategory.js \
    62         --js Source/WebCore/inspector/front-end/UISourceCode.js \
    6352    --module jsmodule_misc:10:jsmodule_sdk \
    6453        --js Source/WebCore/inspector/front-end/Checkbox.js \
  • trunk/Source/WebCore/inspector/front-end/DOMAgent.js

    r96106 r96485  
    3232/**
    3333 * @constructor
     34 * @param {DOMAgent.Node} payload.
    3435 */
    3536WebInspector.DOMNode = function(doc, payload) {
     
    259260    },
    260261
    261     isWhitespace: function()
    262     {
    263         if (this.nodeType !== Node.TEXT_NODE)
    264             return false;
    265         if (!this.nodeValue.length)
    266             return true;
    267         return this.nodeValue.match(/^[\s\xA0]+$/);
    268     },
    269 
    270262    _setAttributesPayload: function(attrs)
    271263    {
     
    276268    },
    277269
     270    /**
     271     * @param {DOMAgent.Node} payload.
     272     */
    278273    _insertChild: function(prev, payload)
    279274    {
     
    376371 * @extends {WebInspector.DOMNode}
    377372 * @constructor
     373 * @param {DOMAgent.Node} payload.
    378374 */
    379375WebInspector.DOMDocument = function(domAgent, payload)
     
    391387 */
    392388WebInspector.DOMAgent = function() {
    393     this._idToDOMNode = null;
     389    /** @type {Object|undefined} */
     390    this._idToDOMNode = {};
    394391    this._document = null;
    395392    this._attributeLoadNodeIds = {};
     
    410407
    411408WebInspector.DOMAgent.prototype = {
     409    /**
     410     * @param {function(WebInspector.DOMDocument)=} callback
     411     */
    412412    requestDocument: function(callback)
    413413    {
     
    463463    },
    464464
    465     _dispatchWhenDocumentAvailable: function(action)
    466     {
    467         var requestArguments = Array.prototype.slice.call(arguments, 1);
    468         var callbackWrapper;
    469 
    470         if (typeof requestArguments[requestArguments.length - 1] === "function") {
    471             var callback = requestArguments.pop();
    472             callbackWrapper = this._wrapClientCallback(callback);
    473             requestArguments.push(callbackWrapper);
    474         }
     465    _dispatchWhenDocumentAvailable: function(func, arg, callback)
     466    {
     467        if (callback)
     468            callback = this._wrapClientCallback(callback);
     469
    475470        function onDocumentAvailable()
    476471        {
    477472            if (this._document)
    478                 action.apply(null, requestArguments);
     473                func.call(null, arg, callback);
    479474            else {
    480                 if (callbackWrapper)
    481                     callbackWrapper("No document");
     475                if (callback)
     476                    callback("No document");
    482477            }
    483478        }
     
    552547
    553548    /**
    554      * @param {*} payload
     549     * @param {DOMAgent.Node} payload.
    555550     */
    556551    _setDocument: function(payload)
     
    568563
    569564    /**
    570      * @param {*} payload
     565     * @param {DOMAgent.Node} payload.
    571566     */
    572567    _setDetachedRoot: function(payload)
  • trunk/Source/WebCore/inspector/front-end/ElementsPanel.js

    r96106 r96485  
    632632
    633633                case Node.TEXT_NODE:
    634                     if (current.isWhitespace())
    635                         crumbTitle = WebInspector.UIString("(whitespace)");
    636                     else
    637                         crumbTitle = WebInspector.UIString("(text)");
     634                    crumbTitle = WebInspector.UIString("(text)");
    638635                    break
    639636
  • trunk/Source/WebCore/inspector/front-end/ElementsTreeOutline.js

    r94754 r96485  
    14751475
    14761476            case Node.TEXT_NODE:
    1477                 if (node.isWhitespace())
    1478                     info.titleDOM.appendChild(document.createTextNode("(whitespace)"));
    1479                 else {
    1480                     if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "script") {
    1481                         var newNode = info.titleDOM.createChild("span", "webkit-html-text-node webkit-html-js-node");
    1482                         newNode.textContent = node.nodeValue();
    1483 
    1484                         var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/javascript", true);
    1485                         javascriptSyntaxHighlighter.syntaxHighlightNode(newNode);
    1486                     } else if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "style") {
    1487                         var newNode = info.titleDOM.createChild("span", "webkit-html-text-node webkit-html-css-node");
    1488                         newNode.textContent = node.nodeValue();
    1489 
    1490                         var cssSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/css", true);
    1491                         cssSyntaxHighlighter.syntaxHighlightNode(newNode);
    1492                     } else {
    1493                         info.titleDOM.appendChild(document.createTextNode("\""));
    1494                         var textNodeElement = info.titleDOM.createChild("span", "webkit-html-text-node");
    1495                         textNodeElement.textContent = node.nodeValue();
    1496                         info.titleDOM.appendChild(document.createTextNode("\""));
    1497                     }
     1477                if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "script") {
     1478                    var newNode = info.titleDOM.createChild("span", "webkit-html-text-node webkit-html-js-node");
     1479                    newNode.textContent = node.nodeValue();
     1480
     1481                    var javascriptSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/javascript", true);
     1482                    javascriptSyntaxHighlighter.syntaxHighlightNode(newNode);
     1483                } else if (node.parentNode && node.parentNode.nodeName().toLowerCase() === "style") {
     1484                    var newNode = info.titleDOM.createChild("span", "webkit-html-text-node webkit-html-css-node");
     1485                    newNode.textContent = node.nodeValue();
     1486
     1487                    var cssSyntaxHighlighter = new WebInspector.DOMSyntaxHighlighter("text/css", true);
     1488                    cssSyntaxHighlighter.syntaxHighlightNode(newNode);
     1489                } else {
     1490                    info.titleDOM.appendChild(document.createTextNode("\""));
     1491                    var textNodeElement = info.titleDOM.createChild("span", "webkit-html-text-node");
     1492                    textNodeElement.textContent = node.nodeValue();
     1493                    info.titleDOM.appendChild(document.createTextNode("\""));
    14981494                }
    14991495                break;
  • trunk/Source/WebCore/inspector/front-end/Object.js

    r93701 r96485  
    6868    },
    6969
     70    /**
     71     * @param {*=} eventData
     72     */
    7073    dispatchEventToListeners: function(eventType, eventData)
    7174    {
  • trunk/Source/WebCore/inspector/front-end/Popover.js

    r94665 r96485  
    227227        }
    228228
    229         this._handleMouseAction(event);
     229        this._handleMouseAction(event, false);
    230230    },
    231231
  • trunk/Source/WebCore/inspector/front-end/View.js

    r94754 r96485  
    2727/**
    2828 * @constructor
     29 * @extends {WebInspector.Object}
    2930 * @param {Element=} element
    3031 */
     
    6970    },
    7071
     72    /**
     73     * @param {Element=} parentElement
     74     */
    7175    show: function(parentElement)
    7276    {
  • trunk/Source/WebCore/inspector/front-end/externs.js

    r93769 r96485  
    7070
    7171Element.prototype.scrollIntoViewIfNeeded = function() {}
     72
     73Array.prototype.remove = function(obj) {}
  • trunk/Source/WebCore/inspector/generate-protocol-externs

    r96320 r96485  
    4848
    4949type_traits = {
     50    "any": "*",
    5051    "string": "string",
    5152    "integer": "number",
     
    6667def param_type(domain_name, param):
    6768    if "type" in param:
    68         return type_traits[param["type"]]
     69        if param["type"] == "array":
     70            items = param["items"]
     71            return "Array.<%s>" % param_type(domain_name, items)
     72        else:
     73            return type_traits[param["type"]]
    6974    if "$ref" in param:
    7075        type_id = full_qualified_type_id(domain_name, param["$ref"])
    7176        if type_id in ref_types:
    72             ref_type = ref_types[type_id]
    73             return type_traits[ref_type["type"]]
     77            return ref_types[type_id]
    7478        else:
    7579            print "Type not found: " + type_id
     
    8185        for type in domain["types"]:
    8286            type_id = full_qualified_type_id(domain_name, type["id"])
    83             ref_types[type_id] = type;
     87            ref_types[type_id] = "%sAgent.%s" % (domain_name, type["id"])
    8488
    8589for domain in json_api:
    8690    domain_name = domain["domain"]
    8791    output_file.write("\n\n\nvar %sAgent = {};\n" % domain_name)
     92    if "types" in domain:
     93        for type in domain["types"]:
     94            if type["type"] == "object":
     95                output_file.write("\n/** @constructor */\n")
     96                output_file.write("%sAgent.%s = function()\n{\n" % (domain_name, type["id"]))
     97                if "properties" in type:
     98                    for property in type["properties"]:
     99                        suffix = ""
     100                        if ("optional" in property):
     101                            suffix = "|undefined"
     102                        output_file.write("/** @type {%s%s} */ this.%s;\n" % (param_type(domain_name, property), suffix, property["name"]))
     103                output_file.write("}\n")
     104            else:
     105                output_file.write("\n/** @typedef {%s} */\n%sAgent.%s;\n" % (type_traits[type["type"]], domain_name, type["id"]))
     106               
     107
    88108    if "commands" in domain:
    89109        for command in domain["commands"]:
Note: See TracChangeset for help on using the changeset viewer.