Title: [140329] trunk
Revision
140329
Author
[email protected]
Date
2013-01-21 06:16:07 -0800 (Mon, 21 Jan 2013)

Log 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:

Modified Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (140328 => 140329)


--- trunk/LayoutTests/ChangeLog	2013-01-21 14:11:14 UTC (rev 140328)
+++ trunk/LayoutTests/ChangeLog	2013-01-21 14:16:07 UTC (rev 140329)
@@ -1,3 +1,12 @@
+2013-01-21  Andrey Adaikin  <[email protected]>
+
+        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.
+
+        * inspector/console/command-line-api-expected.txt:
+
 2013-01-21  Kent Tamura  <[email protected]>
 
         INPUT_MULTIPLE_FIELDS_UI: should not dispatch 'input' events if the element value is not updated

Modified: trunk/LayoutTests/inspector/console/command-line-api-expected.txt (140328 => 140329)


--- trunk/LayoutTests/inspector/console/command-line-api-expected.txt	2013-01-21 14:11:14 UTC (rev 140328)
+++ trunk/LayoutTests/inspector/console/command-line-api-expected.txt	2013-01-21 14:16:07 UTC (rev 140329)
@@ -1,4 +1,4 @@
-CONSOLE MESSAGE: line 1058: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
+CONSOLE MESSAGE: line 1059: The console function $() has changed from $=getElementById(id) to $=querySelector(selector). You might try $("#%s")
 Tests that command line api works.
 
 

Modified: trunk/Source/WebCore/ChangeLog (140328 => 140329)


--- trunk/Source/WebCore/ChangeLog	2013-01-21 14:11:14 UTC (rev 140328)
+++ trunk/Source/WebCore/ChangeLog	2013-01-21 14:16:07 UTC (rev 140329)
@@ -1,3 +1,19 @@
+2013-01-18  Andrey Adaikin  <[email protected]>
+
+        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.
+
+        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):
+
 2013-01-21  Oleg Smirnov  <[email protected]>
 
         [Gtk] [Cairo] Memory leak when is WebView destroy.

Modified: trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js (140328 => 140329)


--- trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js	2013-01-21 14:11:14 UTC (rev 140328)
+++ trunk/Source/WebCore/inspector/InjectedScriptCanvasModuleSource.js	2013-01-21 14:16:07 UTC (rev 140329)
@@ -2856,7 +2856,7 @@
     },
 
     /**
-     * @return {string}
+     * @return {CanvasAgent.TraceLogId}
      */
     captureFrame: function()
     {
@@ -2864,7 +2864,7 @@
     },
 
     /**
-     * @return {string}
+     * @return {CanvasAgent.TraceLogId}
      */
     startCapturing: function()
     {
@@ -2873,7 +2873,7 @@
 
     /**
      * @param {function(this:ResourceTrackingManager)} func
-     * @return {string}
+     * @return {CanvasAgent.TraceLogId}
      */
     _callStartCapturingFunction: function(func)
     {
@@ -2892,7 +2892,7 @@
     },
 
     /**
-     * @param {string} id
+     * @param {CanvasAgent.TraceLogId} id
      */
     stopCapturing: function(id)
     {
@@ -2902,7 +2902,7 @@
     },
 
     /**
-     * @param {string} id
+     * @param {CanvasAgent.TraceLogId} id
      */
     dropTraceLog: function(id)
     {
@@ -2912,9 +2912,9 @@
     },
 
     /**
-     * @param {string} id
+     * @param {CanvasAgent.TraceLogId} id
      * @param {number=} startOffset
-     * @return {!Object|string}
+     * @return {!CanvasAgent.TraceLog|string}
      */
     traceLog: function(id, startOffset)
     {
@@ -2925,6 +2925,7 @@
         var alive = this._manager.capturing() && this._manager.lastTraceLog() === traceLog;
         var result = {
             id: id,
+            /** @type {Array.<CanvasAgent.Call>} */
             calls: [],
             alive: alive,
             startOffset: startOffset
@@ -2943,12 +2944,12 @@
             };
             if (call.functionName()) {
                 traceLogItem.functionName = call.functionName();
-                traceLogItem.arguments = call.args().map(this._createRemoteObject.bind(this));
+                traceLogItem.arguments = call.args().map(this._makeCallArgument.bind(this));
                 if (call.result() !== undefined)
-                    traceLogItem.result = this._createRemoteObject(call.result());
+                    traceLogItem.result = this._makeCallArgument(call.result());
             } else {
                 traceLogItem.property = call.args()[0];
-                traceLogItem.value = this._createRemoteObject(call.args()[1]);
+                traceLogItem.value = this._makeCallArgument(call.args()[1]);
             }
             result.calls.push(traceLogItem);
         }
@@ -2957,9 +2958,9 @@
 
     /**
      * @param {*} obj
-     * @return {Object}
+     * @return {!CanvasAgent.CallArgument}
      */
-    _createRemoteObject: function(obj)
+    _makeCallArgument: function(obj)
     {
         if (obj instanceof ReplayableResource)
             var description = obj.description();
@@ -2969,9 +2970,9 @@
     },
 
     /**
-     * @param {string} traceLogId
+     * @param {CanvasAgent.TraceLogId} traceLogId
      * @param {number} stepNo
-     * @return {!Object|string}
+     * @return {!CanvasAgent.ResourceState|string}
      */
     replayTraceLog: function(traceLogId, stepNo)
     {
@@ -2990,8 +2991,8 @@
     },
 
     /**
-     * @param {string} stringResourceId
-     * @return {!Object|string}
+     * @param {CanvasAgent.ResourceId} stringResourceId
+     * @return {!CanvasAgent.ResourceInfo|string}
      */
     resourceInfo: function(stringResourceId)
     {
@@ -3012,9 +3013,9 @@
     },
 
     /**
-     * @param {string} traceLogId
-     * @param {string} stringResourceId
-     * @return {!Object|string}
+     * @param {CanvasAgent.TraceLogId} traceLogId
+     * @param {CanvasAgent.ResourceId} stringResourceId
+     * @return {!CanvasAgent.ResourceState|string}
      */
     resourceState: function(traceLogId, stringResourceId)
     {
@@ -3043,7 +3044,7 @@
     },
 
     /**
-     * @return {string}
+     * @return {CanvasAgent.TraceLogId}
      */
     _makeTraceLogId: function()
     {
@@ -3052,7 +3053,7 @@
 
     /**
      * @param {number} resourceId
-     * @return {string}
+     * @return {CanvasAgent.ResourceId}
      */
     _makeStringResourceId: function(resourceId)
     {
@@ -3060,9 +3061,9 @@
     },
 
     /**
-     * @param {string} stringResourceId
+     * @param {CanvasAgent.ResourceId} stringResourceId
      * @param {string} description
-     * @return {!Object}
+     * @return {!CanvasAgent.ResourceInfo}
      */
     _makeResourceInfo: function(stringResourceId, description)
     {
@@ -3073,10 +3074,10 @@
     },
 
     /**
-     * @param {string} stringResourceId
-     * @param {string} traceLogId
+     * @param {CanvasAgent.ResourceId} stringResourceId
+     * @param {CanvasAgent.TraceLogId} traceLogId
      * @param {string} imageURL
-     * @return {!Object}
+     * @return {!CanvasAgent.ResourceState}
      */
     _makeResourceState: function(stringResourceId, traceLogId, imageURL)
     {

Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (140328 => 140329)


--- trunk/Source/WebCore/inspector/InjectedScriptSource.js	2013-01-21 14:11:14 UTC (rev 140328)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js	2013-01-21 14:16:07 UTC (rev 140329)
@@ -111,7 +111,7 @@
      * @param {string} groupName
      * @param {boolean} canAccessInspectedWindow
      * @param {boolean} generatePreview
-     * @return {Object}
+     * @return {!RuntimeAgent.RemoteObject}
      */
     wrapObject: function(object, groupName, canAccessInspectedWindow, generatePreview)
     {
@@ -169,7 +169,8 @@
      * @param {string=} objectGroupName
      * @param {boolean=} forceValueType
      * @param {boolean=} generatePreview
-     * @return {InjectedScript.RemoteObject}
+     * @return {!RuntimeAgent.RemoteObject}
+     * @suppress {checkTypes}
      */
     _wrapObject: function(object, objectGroupName, forceValueType, generatePreview)
     {
@@ -248,7 +249,7 @@
     /**
      * @param {string} objectId
      * @param {boolean} ownProperties
-     * @return {Array.<Object>|boolean}
+     * @return {Array.<RuntimeAgent.PropertyDescriptor>|boolean}
      */
     getProperties: function(objectId, ownProperties)
     {
@@ -305,7 +306,7 @@
 
     /**
      * @param {string} functionId
-     * @return {Object|string}
+     * @return {!DebuggerAgent.FunctionDetails|string}
      */
     getFunctionDetails: function(functionId)
     {
@@ -675,7 +676,6 @@
         if (obj === null)
             return "null";
 
-        var type = typeof obj;
         if (this.isPrimitiveValue(obj))
             return null;
 
@@ -940,7 +940,7 @@
 InjectedScript.CallFrameProxy.prototype = {
     /**
      * @param {Object} callFrame
-     * @return {Array.<Object>}
+     * @return {!Array.<DebuggerAgent.Scope>}
      */
     _wrapScopeChain: function(callFrame)
     {
@@ -958,7 +958,7 @@
  * @param {number} scopeTypeCode
  * @param {*} scopeObject
  * @param {string} groupId
- * @return {Object}
+ * @return {!DebuggerAgent.Scope}
  */
 InjectedScript.CallFrameProxy._createScopeJson = function(scopeTypeCode, scopeObject, groupId) {
     const GLOBAL_SCOPE = 0;
@@ -967,6 +967,7 @@
     const CLOSURE_SCOPE = 3;
     const CATCH_SCOPE = 4;
 
+    /** @type {!Object.<number, string>} */
     var scopeTypeNames = {};
     scopeTypeNames[GLOBAL_SCOPE] = "global";
     scopeTypeNames[LOCAL_SCOPE] = "local";

Modified: trunk/Source/WebCore/inspector/compile-front-end.py (140328 => 140329)


--- trunk/Source/WebCore/inspector/compile-front-end.py	2013-01-21 14:11:14 UTC (rev 140328)
+++ trunk/Source/WebCore/inspector/compile-front-end.py	2013-01-21 14:16:07 UTC (rev 140329)
@@ -421,6 +421,7 @@
     os.system("cat  " + inspector_path + "/" + "InjectedScriptSource.js" + " >> " + inspector_path + "/" + "InjectedScriptSourceTmp.js")
     command = compiler_command
     command += "    --externs " + inspector_path + "/" + "InjectedScriptExterns.js" + " \\\n"
+    command += "    --externs " + protocol_externs_path + " \\\n"
     command += "    --module " + jsmodule_name_prefix + "injected_script" + ":" + "1" + " \\\n"
     command += "        --js " + inspector_path + "/" + "InjectedScriptSourceTmp.js" + " \\\n"
     command += "\n"
@@ -432,6 +433,7 @@
     os.system("cat  " + inspector_path + "/" + "InjectedScriptCanvasModuleSource.js" + " >> " + inspector_path + "/" + "InjectedScriptCanvasModuleSourceTmp.js")
     command = compiler_command
     command += "    --externs " + inspector_path + "/" + "InjectedScriptExterns.js" + " \\\n"
+    command += "    --externs " + protocol_externs_path + " \\\n"
     command += "    --module " + jsmodule_name_prefix + "injected_script" + ":" + "1" + " \\\n"
     command += "        --js " + inspector_path + "/" + "InjectedScriptCanvasModuleSourceTmp.js" + " \\\n"
     command += "\n"

Modified: trunk/Source/WebCore/inspector/front-end/DebuggerModel.js (140328 => 140329)


--- trunk/Source/WebCore/inspector/front-end/DebuggerModel.js	2013-01-21 14:11:14 UTC (rev 140328)
+++ trunk/Source/WebCore/inspector/front-end/DebuggerModel.js	2013-01-21 14:16:07 UTC (rev 140329)
@@ -63,7 +63,6 @@
 /**
  * @constructor
  * @implements {WebInspector.RawLocation}
- * @extends {DebuggerAgent.Location}
  * @param {string} scriptId
  * @param {number} lineNumber
  * @param {number} columnNumber

Modified: trunk/Source/WebCore/inspector/generate_protocol_externs.py (140328 => 140329)


--- trunk/Source/WebCore/inspector/generate_protocol_externs.py	2013-01-21 14:11:14 UTC (rev 140328)
+++ trunk/Source/WebCore/inspector/generate_protocol_externs.py	2013-01-21 14:16:07 UTC (rev 140329)
@@ -91,15 +91,17 @@
         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"]))
+                    typedef_args = []
                     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")
+                            typedef_args.append("%s:(%s%s)" % (property["name"], param_type(domain_name, property), suffix))
+                    if (typedef_args):
+                        output_file.write("\n/** @typedef {{%s}|null} */\n%sAgent.%s;\n" % (", ".join(typedef_args), domain_name, type["id"]))
+                    else:
+                        output_file.write("\n/** @typedef {Object} */\n%sAgent.%s;\n" % (domain_name, type["id"]))
                 elif type["type"] == "array":
                     suffix = ""
                     if ("optional" in property):
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to