Changeset 140329 in webkit


Ignore:
Timestamp:
Jan 21, 2013 6:16:07 AM (11 years ago)
Author:
aandrey@chromium.org
Message:

Web Inspector: modify generate_protocol_externs.py to generate JSON typedef's for @constructors
https://bugs.webkit.org/show_bug.cgi?id=107287

Reviewed by Pavel Feldman.

Source/WebCore:

Modify generate_protocol_externs.py to generate @typedefs instead of @constructors,

  • inspector/InjectedScriptCanvasModuleSource.js:

(.):

  • inspector/InjectedScriptSource.js:
  • inspector/compile-front-end.py:
  • inspector/generate_protocol_externs.py:

(param_type):

LayoutTests:

  • inspector/console/command-line-api-expected.txt:
Location:
trunk
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/LayoutTests/ChangeLog

    r140324 r140329  
     12013-01-21  Andrey Adaikin  <aandrey@chromium.org>
     2
     3        Web Inspector: modify generate_protocol_externs.py to generate JSON typedef's for @constructors
     4        https://bugs.webkit.org/show_bug.cgi?id=107287
     5
     6        Reviewed by Pavel Feldman.
     7
     8        * inspector/console/command-line-api-expected.txt:
     9
    1102013-01-21  Kent Tamura  <tkent@chromium.org>
    211
  • trunk/LayoutTests/inspector/console/command-line-api-expected.txt

    r135720 r140329  
    1 CONSOLE MESSAGE: line 1058: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
     1CONSOLE MESSAGE: line 1059: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
    22Tests that command line api works.
    33
  • trunk/Source/WebCore/ChangeLog

    r140325 r140329  
     12013-01-18  Andrey Adaikin  <aandrey@chromium.org>
     2
     3        Web Inspector: modify generate_protocol_externs.py to generate JSON typedef's for @constructors
     4        https://bugs.webkit.org/show_bug.cgi?id=107287
     5
     6        Reviewed by Pavel Feldman.
     7
     8        Modify generate_protocol_externs.py to generate @typedefs instead of @constructors,
     9
     10        * inspector/InjectedScriptCanvasModuleSource.js:
     11        (.):
     12        * inspector/InjectedScriptSource.js:
     13        * inspector/compile-front-end.py:
     14        * inspector/generate_protocol_externs.py:
     15        (param_type):
     16
    1172013-01-21  Oleg Smirnov  <oleg.smirnov@lge.com>
    218
  • trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js

    r140157 r140329  
    28572857
    28582858    /**
    2859      * @return {string}
     2859     * @return {CanvasAgent.TraceLogId}
    28602860     */
    28612861    captureFrame: function()
     
    28652865
    28662866    /**
    2867      * @return {string}
     2867     * @return {CanvasAgent.TraceLogId}
    28682868     */
    28692869    startCapturing: function()
     
    28742874    /**
    28752875     * @param {function(this:ResourceTrackingManager)} func
    2876      * @return {string}
     2876     * @return {CanvasAgent.TraceLogId}
    28772877     */
    28782878    _callStartCapturingFunction: function(func)
     
    28932893
    28942894    /**
    2895      * @param {string} id
     2895     * @param {CanvasAgent.TraceLogId} id
    28962896     */
    28972897    stopCapturing: function(id)
     
    29032903
    29042904    /**
    2905      * @param {string} id
     2905     * @param {CanvasAgent.TraceLogId} id
    29062906     */
    29072907    dropTraceLog: function(id)
     
    29132913
    29142914    /**
    2915      * @param {string} id
     2915     * @param {CanvasAgent.TraceLogId} id
    29162916     * @param {number=} startOffset
    2917      * @return {!Object|string}
     2917     * @return {!CanvasAgent.TraceLog|string}
    29182918     */
    29192919    traceLog: function(id, startOffset)
     
    29262926        var result = {
    29272927            id: id,
     2928            /** @type {Array.<CanvasAgent.Call>} */
    29282929            calls: [],
    29292930            alive: alive,
     
    29442945            if (call.functionName()) {
    29452946                traceLogItem.functionName = call.functionName();
    2946                 traceLogItem.arguments = call.args().map(this._createRemoteObject.bind(this));
     2947                traceLogItem.arguments = call.args().map(this._makeCallArgument.bind(this));
    29472948                if (call.result() !== undefined)
    2948                     traceLogItem.result = this._createRemoteObject(call.result());
     2949                    traceLogItem.result = this._makeCallArgument(call.result());
    29492950            } else {
    29502951                traceLogItem.property = call.args()[0];
    2951                 traceLogItem.value = this._createRemoteObject(call.args()[1]);
     2952                traceLogItem.value = this._makeCallArgument(call.args()[1]);
    29522953            }
    29532954            result.calls.push(traceLogItem);
     
    29582959    /**
    29592960     * @param {*} obj
    2960      * @return {Object}
    2961      */
    2962     _createRemoteObject: function(obj)
     2961     * @return {!CanvasAgent.CallArgument}
     2962     */
     2963    _makeCallArgument: function(obj)
    29632964    {
    29642965        if (obj instanceof ReplayableResource)
     
    29702971
    29712972    /**
    2972      * @param {string} traceLogId
     2973     * @param {CanvasAgent.TraceLogId} traceLogId
    29732974     * @param {number} stepNo
    2974      * @return {!Object|string}
     2975     * @return {!CanvasAgent.ResourceState|string}
    29752976     */
    29762977    replayTraceLog: function(traceLogId, stepNo)
     
    29912992
    29922993    /**
    2993      * @param {string} stringResourceId
    2994      * @return {!Object|string}
     2994     * @param {CanvasAgent.ResourceId} stringResourceId
     2995     * @return {!CanvasAgent.ResourceInfo|string}
    29952996     */
    29962997    resourceInfo: function(stringResourceId)
     
    30133014
    30143015    /**
    3015      * @param {string} traceLogId
    3016      * @param {string} stringResourceId
    3017      * @return {!Object|string}
     3016     * @param {CanvasAgent.TraceLogId} traceLogId
     3017     * @param {CanvasAgent.ResourceId} stringResourceId
     3018     * @return {!CanvasAgent.ResourceState|string}
    30183019     */
    30193020    resourceState: function(traceLogId, stringResourceId)
     
    30443045
    30453046    /**
    3046      * @return {string}
     3047     * @return {CanvasAgent.TraceLogId}
    30473048     */
    30483049    _makeTraceLogId: function()
     
    30533054    /**
    30543055     * @param {number} resourceId
    3055      * @return {string}
     3056     * @return {CanvasAgent.ResourceId}
    30563057     */
    30573058    _makeStringResourceId: function(resourceId)
     
    30613062
    30623063    /**
    3063      * @param {string} stringResourceId
     3064     * @param {CanvasAgent.ResourceId} stringResourceId
    30643065     * @param {string} description
    3065      * @return {!Object}
     3066     * @return {!CanvasAgent.ResourceInfo}
    30663067     */
    30673068    _makeResourceInfo: function(stringResourceId, description)
     
    30743075
    30753076    /**
    3076      * @param {string} stringResourceId
    3077      * @param {string} traceLogId
     3077     * @param {CanvasAgent.ResourceId} stringResourceId
     3078     * @param {CanvasAgent.TraceLogId} traceLogId
    30783079     * @param {string} imageURL
    3079      * @return {!Object}
     3080     * @return {!CanvasAgent.ResourceState}
    30803081     */
    30813082    _makeResourceState: function(stringResourceId, traceLogId, imageURL)
  • trunk/Source/WebCore/inspector/InjectedScriptSource.js

    r135720 r140329  
    112112     * @param {boolean} canAccessInspectedWindow
    113113     * @param {boolean} generatePreview
    114      * @return {Object}
     114     * @return {!RuntimeAgent.RemoteObject}
    115115     */
    116116    wrapObject: function(object, groupName, canAccessInspectedWindow, generatePreview)
     
    170170     * @param {boolean=} forceValueType
    171171     * @param {boolean=} generatePreview
    172      * @return {InjectedScript.RemoteObject}
     172     * @return {!RuntimeAgent.RemoteObject}
     173     * @suppress {checkTypes}
    173174     */
    174175    _wrapObject: function(object, objectGroupName, forceValueType, generatePreview)
     
    249250     * @param {string} objectId
    250251     * @param {boolean} ownProperties
    251      * @return {Array.<Object>|boolean}
     252     * @return {Array.<RuntimeAgent.PropertyDescriptor>|boolean}
    252253     */
    253254    getProperties: function(objectId, ownProperties)
     
    306307    /**
    307308     * @param {string} functionId
    308      * @return {Object|string}
     309     * @return {!DebuggerAgent.FunctionDetails|string}
    309310     */
    310311    getFunctionDetails: function(functionId)
     
    676677            return "null";
    677678
    678         var type = typeof obj;
    679679        if (this.isPrimitiveValue(obj))
    680680            return null;
     
    941941    /**
    942942     * @param {Object} callFrame
    943      * @return {Array.<Object>}
     943     * @return {!Array.<DebuggerAgent.Scope>}
    944944     */
    945945    _wrapScopeChain: function(callFrame)
     
    959959 * @param {*} scopeObject
    960960 * @param {string} groupId
    961  * @return {Object}
     961 * @return {!DebuggerAgent.Scope}
    962962 */
    963963InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeObject, groupId) {
     
    968968    const CATCH_SCOPE = 4;
    969969
     970    /** @type {!Object.<number, string>} */
    970971    var scopeTypeNames = {};
    971972    scopeTypeNames[GLOBAL_SCOPE] = "global";
  • trunk/Source/WebCore/inspector/compile-front-end.py

    r139978 r140329  
    422422    command = compiler_command
    423423    command += "    --externs " + inspector_path + "/" + "InjectedScriptExterns.js" + " \\\n"
     424    command += "    --externs " + protocol_externs_path + " \\\n"
    424425    command += "    --module " + jsmodule_name_prefix + "injected_script" + ":" + "1" + " \\\n"
    425426    command += "        --js " + inspector_path + "/" + "InjectedScriptSourceTmp.js" + " \\\n"
     
    433434    command = compiler_command
    434435    command += "    --externs " + inspector_path + "/" + "InjectedScriptExterns.js" + " \\\n"
     436    command += "    --externs " + protocol_externs_path + " \\\n"
    435437    command += "    --module " + jsmodule_name_prefix + "injected_script" + ":" + "1" + " \\\n"
    436438    command += "        --js " + inspector_path + "/" + "InjectedScriptCanvasModuleSourceTmp.js" + " \\\n"
  • trunk/Source/WebCore/inspector/front-end/DebuggerModel.js

    r138496 r140329  
    6464 * @constructor
    6565 * @implements {WebInspector.RawLocation}
    66  * @extends {DebuggerAgent.Location}
    6766 * @param {string} scriptId
    6867 * @param {number} lineNumber
  • trunk/Source/WebCore/inspector/generate_protocol_externs.py

    r119585 r140329  
    9292            for type in domain["types"]:
    9393                if type["type"] == "object":
    94                     output_file.write("\n/** @constructor */\n")
    95                     output_file.write("%sAgent.%s = function()\n{\n" % (domain_name, type["id"]))
     94                    typedef_args = []
    9695                    if "properties" in type:
    9796                        for property in type["properties"]:
     
    9998                            if ("optional" in property):
    10099                                suffix = "|undefined"
    101                             output_file.write("/** @type {%s%s} */ this.%s;\n" % (param_type(domain_name, property), suffix, property["name"]))
    102                     output_file.write("}\n")
     100                            typedef_args.append("%s:(%s%s)" % (property["name"], param_type(domain_name, property), suffix))
     101                    if (typedef_args):
     102                        output_file.write("\n/** @typedef {{%s}|null} */\n%sAgent.%s;\n" % (", ".join(typedef_args), domain_name, type["id"]))
     103                    else:
     104                        output_file.write("\n/** @typedef {Object} */\n%sAgent.%s;\n" % (domain_name, type["id"]))
    103105                elif type["type"] == "array":
    104106                    suffix = ""
Note: See TracChangeset for help on using the changeset viewer.