Title: [117961] trunk/Source/WebCore
Revision
117961
Author
[email protected]
Date
2012-05-22 06:07:14 -0700 (Tue, 22 May 2012)

Log Message

Web Inspector: annotate InjectedScriptSource.js for closure compiler
https://bugs.webkit.org/show_bug.cgi?id=87120

Reviewed by Pavel Feldman.

Annotated InjectedScriptSource.js for closure compiler. Replaced call of undefined
_isPrimitiveValue function with isPrimitiveValue.

* inspector/InjectedScriptExterns.js: Added. External APIs used in InjectedScriptSource.js
(console.log):
(InjectedScriptHost.prototype.storageId):
(InjectedScriptHost.prototype.functionDetails):
(InjectedScriptHost.prototype.isHTMLAllCollection):
(InjectedScriptHost.prototype.internalConstructorName):
(InjectedScriptHost.prototype.copyText):
(InjectedScriptHost.prototype.clearConsoleMessages):
(InjectedScriptHost.prototype.inspectedObject):
(InjectedScriptHost.prototype.databaseId):
(InjectedScriptHost.prototype.inspect):
(InjectedScriptHost.prototype.type):
(InjectedScriptHost.prototype.getEventListeners):
(_javascript_CallFrame.prototype.scopeType):
* inspector/InjectedScriptSource.js:

Modified Paths

Added Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (117960 => 117961)


--- trunk/Source/WebCore/ChangeLog	2012-05-22 13:03:33 UTC (rev 117960)
+++ trunk/Source/WebCore/ChangeLog	2012-05-22 13:07:14 UTC (rev 117961)
@@ -1,3 +1,29 @@
+2012-05-22  Yury Semikhatsky  <[email protected]>
+
+        Web Inspector: annotate InjectedScriptSource.js for closure compiler
+        https://bugs.webkit.org/show_bug.cgi?id=87120
+
+        Reviewed by Pavel Feldman.
+
+        Annotated InjectedScriptSource.js for closure compiler. Replaced call of undefined
+        _isPrimitiveValue function with isPrimitiveValue.
+
+        * inspector/InjectedScriptExterns.js: Added. External APIs used in InjectedScriptSource.js
+        (console.log):
+        (InjectedScriptHost.prototype.storageId):
+        (InjectedScriptHost.prototype.functionDetails):
+        (InjectedScriptHost.prototype.isHTMLAllCollection):
+        (InjectedScriptHost.prototype.internalConstructorName):
+        (InjectedScriptHost.prototype.copyText):
+        (InjectedScriptHost.prototype.clearConsoleMessages):
+        (InjectedScriptHost.prototype.inspectedObject):
+        (InjectedScriptHost.prototype.databaseId):
+        (InjectedScriptHost.prototype.inspect):
+        (InjectedScriptHost.prototype.type):
+        (InjectedScriptHost.prototype.getEventListeners):
+        (_javascript_CallFrame.prototype.scopeType):
+        * inspector/InjectedScriptSource.js:
+
 2012-05-22  Ian Vollick  <[email protected]>
 
         [chromium] Speed up CCLayerTreeHostTestTickAnimationWhileBackgrounded

Added: trunk/Source/WebCore/inspector/InjectedScriptExterns.js (0 => 117961)


--- trunk/Source/WebCore/inspector/InjectedScriptExterns.js	                        (rev 0)
+++ trunk/Source/WebCore/inspector/InjectedScriptExterns.js	2012-05-22 13:07:14 UTC (rev 117961)
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2012 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.
+ */
+
+// WebKit Web Facing API
+var console = { }
+/** @param {...*} vararg */
+console.log = function(vararg) { }
+
+/**
+ * @constructor
+ */
+function InjectedScriptHost() { }
+InjectedScriptHost.prototype.storageId = function(object) { }
+/**
+ * @param {Function} func
+ */
+InjectedScriptHost.prototype.functionDetails = function(func) { }
+/**
+ * @param {*} object
+ */
+InjectedScriptHost.prototype.isHTMLAllCollection = function(object) { }
+/**
+ * @param {*} object
+ */
+InjectedScriptHost.prototype.internalConstructorName = function(object) { }
+/**
+ * @param {*} object
+ */
+InjectedScriptHost.prototype.copyText = function(object) { }
+InjectedScriptHost.prototype.clearConsoleMessages = function() { }
+/**
+ * @param {number} index
+ */
+InjectedScriptHost.prototype.inspectedObject = function(index) { }
+/**
+ * @param {*} object
+ */
+InjectedScriptHost.prototype.databaseId = function(object) { }
+/**
+ * @param {*} object
+ * @param {Object} hints
+ */
+InjectedScriptHost.prototype.inspect = function(object, hints) { }
+/**
+ * @param {*} object
+ */
+InjectedScriptHost.prototype.type = function(object) { }
+/**
+ * @param {*} object
+ */
+InjectedScriptHost.prototype.getEventListeners = function(object) { }
+
+
+/**
+ * @constructor
+ */
+function _javascript_CallFrame()
+{
+    /** @type {number} */
+    this.sourceID;
+    /** @type {number} */
+    this.line;
+    /** @type {number} */
+    this.column;
+    /** @type {*} */
+    this.thisObject;
+}
+
+/**
+ * @param {number} index
+ */
+_javascript_CallFrame.prototype.scopeType = function(index) { }
+
+
+var InspectorBackend = { };
Property changes on: trunk/Source/WebCore/inspector/InjectedScriptExterns.js
___________________________________________________________________

Added: svn:eol-style

Modified: trunk/Source/WebCore/inspector/InjectedScriptSource.js (117960 => 117961)


--- trunk/Source/WebCore/inspector/InjectedScriptSource.js	2012-05-22 13:03:33 UTC (rev 117960)
+++ trunk/Source/WebCore/inspector/InjectedScriptSource.js	2012-05-22 13:07:14 UTC (rev 117961)
@@ -26,22 +26,14 @@
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
+/**
+ * @param {InjectedScriptHost} InjectedScriptHost
+ */
 (function (InjectedScriptHost, inspectedWindow, injectedScriptId) {
 
-function bind(thisObject, memberFunction)
-{
-    var func = memberFunction;
-    var args = Array.prototype.slice.call(arguments, 2);
-    function bound()
-    {
-        return func.apply(thisObject, args.concat(Array.prototype.slice.call(arguments, 0)));
-    }
-    bound.toString = function() {
-        return "bound: " + func;
-    };
-    return bound;
-}
-
+/**
+ * @constructor
+ */
 var InjectedScript = function()
 {
     this._lastBoundObjectId = 1;
@@ -71,7 +63,7 @@
 
         var result = {};
         result.type = typeof object;
-        if (this._isPrimitiveValue(object))
+        if (this.isPrimitiveValue(object))
             result.value = object;
         else
             result.description = this._toString(object);
@@ -224,7 +216,7 @@
     {
         var descriptors = [];
         var nameProcessed = {};
-        nameProcessed.__proto__ = null;
+        nameProcessed["__proto__"] = null;
         for (var o = object; this._isDefined(o); o = o.__proto__) {
             var names = Object.getOwnPropertyNames(o);
             for (var i = 0; i < names.length; ++i) {
@@ -278,7 +270,7 @@
             var resolvedArgs = [];
             args = eval(args);
             for (var i = 0; i < args.length; ++i) {
-                var objectId = args[i].objectId;
+                objectId = args[i].objectId;
                 if (objectId) {
                     var parsedArgId = this._parseObjectId(objectId);
                     if (!parsedArgId || parsedArgId.injectedScriptId !== injectedScriptId)
@@ -372,7 +364,7 @@
     _callFrameForId: function(topCallFrame, callFrameId)
     {
         var parsedCallFrameId = eval("(" + callFrameId + ")");
-        var ordinal = parsedCallFrameId.ordinal;
+        var ordinal = parsedCallFrameId["ordinal"];
         var callFrame = topCallFrame;
         while (--ordinal >= 0 && callFrame)
             callFrame = callFrame.caller;
@@ -482,6 +474,12 @@
 
 var injectedScript = new InjectedScript();
 
+/**
+ * @constructor
+ * @param {*} object
+ * @param {string=} objectGroupName
+ * @param {boolean=} forceValueType
+ */
 InjectedScript.RemoteObject = function(object, objectGroupName, forceValueType)
 {
     this.type = typeof object;
@@ -508,6 +506,10 @@
     this.description = injectedScript._describe(object);
 }
 
+/**
+ * @constructor
+ * @param {number} ordinal
+ */
 InjectedScript.CallFrameProxy = function(ordinal, callFrame)
 {
     this.callFrameId = "{\"ordinal\":" + ordinal + ",\"injectedScriptId\":" + injectedScriptId + "}";
@@ -548,6 +550,9 @@
     }
 }
 
+/**
+ * @constructor
+ */
 function CommandLineAPI(commandLineAPIImpl, callFrame)
 {
     function inScopeVariables(member)
@@ -568,7 +573,7 @@
         if (member in inspectedWindow || inScopeVariables(member))
             continue;
 
-        this[member] = bind(commandLineAPIImpl, commandLineAPIImpl[member]);
+        this[member] = commandLineAPIImpl[member].bind(commandLineAPIImpl);
     }
 
     for (var i = 0; i < 5; ++i) {
@@ -576,7 +581,7 @@
         if (member in inspectedWindow || inScopeVariables(member))
             continue;
 
-        this.__defineGetter__("$" + i, bind(commandLineAPIImpl, commandLineAPIImpl._inspectedObject, i));
+        this.__defineGetter__("$" + i, commandLineAPIImpl._inspectedObject.bind(commandLineAPIImpl, i));
     }
 }
 
@@ -585,6 +590,9 @@
     "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear", "getEventListeners"
 ];
 
+/**
+ * @constructor
+ */
 function CommandLineAPIImpl()
 {
 }

Modified: trunk/Source/WebCore/inspector/compile-front-end.sh (117960 => 117961)


--- trunk/Source/WebCore/inspector/compile-front-end.sh	2012-05-22 13:03:33 UTC (rev 117960)
+++ trunk/Source/WebCore/inspector/compile-front-end.sh	2012-05-22 13:07:14 UTC (rev 117961)
@@ -32,3 +32,12 @@
 python Source/WebCore/inspector/generate-protocol-externs -o Source/WebCore/inspector/front-end/protocol-externs.js Source/WebCore/inspector/Inspector.json
 python Source/WebCore/inspector/compile-front-end.py
 
+echo "Compiling InjectedScriptSource.js..."
+java -jar ~/closure/compiler.jar\
+    --summary_detail_level 3\
+    --compilation_level SIMPLE_OPTIMIZATIONS\
+    --warning_level VERBOSE\
+    --language_in ECMASCRIPT5\
+    --accept_const_keyword\
+    --js Source/WebCore/inspector/InjectedScriptSource.js\
+    --externs Source/WebCore/inspector/InjectedScriptExterns.js
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to