Web Inspector: annotate DOMAgent, Debugger(Presentation)Model with types.
authorpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Oct 2011 17:03:03 +0000 (17:03 +0000)
committerpfeldman@chromium.org <pfeldman@chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 10 Oct 2011 17:03:03 +0000 (17:03 +0000)
https://bugs.webkit.org/show_bug.cgi?id=69726

Reviewed by Yury Semikhatsky.

Source/WebCore:

* inspector/compile-front-end.sh:
* inspector/front-end/ApplicationCacheItemsView.js:
(WebInspector.ApplicationCacheItemsView):
* inspector/front-end/AuditsPanel.js:
(WebInspector.AuditsPanel):
* inspector/front-end/BreakpointManager.js:
(WebInspector.BreakpointManager.prototype._breakpointResolved):
* inspector/front-end/CSSStyleModel.js:
* inspector/front-end/CompilerSourceMapping.js:
(WebInspector.CompilerSourceMapping.prototype.compiledLocationToSourceLocation):
(WebInspector.CompilerSourceMapping.prototype.sourceLocationToCompiledLocation):
(WebInspector.CompilerSourceMapping.prototype.sources):
* inspector/front-end/ConsoleView.js:
(WebInspector.ConsoleView.prototype._completions.evaluated):
(WebInspector.ConsoleView.prototype._completions.receivedPropertyNamesFromEval):
(WebInspector.ConsoleView.prototype.evalInInspectedWindow):
* inspector/front-end/CookieItemsView.js:
(WebInspector.CookieItemsView):
* inspector/front-end/DOMAgent.js:
(WebInspector.DOMNode.prototype.isXMLNode):
(WebInspector.DOMDocument):
(WebInspector.DOMAgent.prototype._dispatchWhenDocumentAvailable.onDocumentAvailable):
(WebInspector.DOMAgent.prototype._dispatchWhenDocumentAvailable):
(WebInspector.DOMDispatcher.prototype.characterDataModified):
(WebInspector.DOMDispatcher.prototype.childNodeCountUpdated):
(WebInspector.DOMDispatcher.prototype.childNodeInserted):
(WebInspector.DOMDispatcher.prototype.childNodeRemoved):
* inspector/front-end/DOMStorageItemsView.js:
(WebInspector.DOMStorageItemsView):
* inspector/front-end/DatabaseTableView.js:
(WebInspector.DatabaseTableView):
* inspector/front-end/DebuggerModel.js:
(WebInspector.DebuggerModel):
(WebInspector.DebuggerPausedDetails):
(WebInspector.DebuggerModel.prototype.reset):
(WebInspector.DebuggerModel.prototype.get callFrames):
(WebInspector.DebuggerModel.prototype._pausedScript):
(WebInspector.DebuggerModel.prototype._resumedScript):
(WebInspector.DebuggerModel.prototype._parsedScriptSource):
(WebInspector.DebuggerModel.prototype._failedToParseScriptSource):
(WebInspector.DebuggerDispatcher.prototype.scriptParsed):
(WebInspector.DebuggerDispatcher.prototype.breakpointResolved):
* inspector/front-end/DebuggerPresentationModel.js:
(WebInspector.DebuggerPresentationModel.prototype._parsedScriptSource):
(WebInspector.DebuggerPresentationModel.prototype._failedToParseScriptSource):
(WebInspector.DebuggerPresentationModel.prototype._sourceMappingUpdated):
(WebInspector.DebuggerPresentationModel.prototype._updateBreakpointsAfterLiveEdit):
(WebInspector.DebuggerPresentationModel.prototype._consoleMessageAdded):
(WebInspector.DebuggerPresentationModel.prototype._createPresentationMessage):
(WebInspector.PresentationConsoleMessage):
(WebInspector.PresentationCallFrame.prototype.evaluate):
(WebInspector.DebuggerPresentationModel.Linkifier.prototype._updateSourceAnchors):
* inspector/front-end/ElementsPanel.js:
(WebInspector.ElementsPanel):
(WebInspector.ElementsPanel.prototype._documentUpdated.selectLastSelectedNode):
(WebInspector.ElementsPanel.prototype._documentUpdated):
* inspector/front-end/NetworkPanel.js:
* inspector/front-end/Object.js:
(WebInspector.Object.prototype.dispatchEventToListeners):
(WebInspector.Event):
(WebInspector.Event.prototype.stopPropagation):
(WebInspector.Event.prototype.preventDefault):
* inspector/front-end/RawSourceCode.js:
(WebInspector.RawSourceCode.SourceMapping):
(WebInspector.RawSourceCode.SourceMapping.prototype.rawLocationToUILocation):
(WebInspector.RawSourceCode.SourceMapping.prototype.uiLocationToRawLocation):
(WebInspector.RawSourceCode.PlainSourceMapping.prototype.rawLocationToUILocation):
(WebInspector.RawSourceCode.PlainSourceMapping.prototype.uiLocationToRawLocation):
(WebInspector.RawSourceCode.FormattedSourceMapping.prototype.rawLocationToUILocation):
(WebInspector.RawSourceCode.CompilerSourceMapping.prototype.rawLocationToUILocation):
(WebInspector.RawSourceCode.CompilerSourceMapping.prototype.uiLocationToRawLocation):
* inspector/front-end/Script.js:
(WebInspector.Script):
(WebInspector.Script.prototype.requestSource):
(WebInspector.Script.prototype.searchInContent):
(WebInspector.Script.prototype.editSource):
* inspector/front-end/ScriptsPanel.js:
(WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame):
* inspector/front-end/TimelinePanel.js:
(WebInspector.TimelinePanel.prototype._createStatusbarButtons):
* inspector/front-end/UISourceCode.js:
(WebInspector.UISourceCode):
(WebInspector.ContentProvider.SearchMatch):
* inspector/front-end/WatchExpressionsSidebarPane.js:
(WebInspector.WatchExpressionsSection.prototype.update):
* inspector/front-end/externs.js:
* inspector/generate-protocol-externs:

LayoutTests:

* inspector/debugger/raw-source-code.html:

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@97067 268f45cc-cd09-0410-ab3c-d52691b4dbfc

27 files changed:
LayoutTests/ChangeLog
LayoutTests/inspector/debugger/raw-source-code.html
Source/WebCore/ChangeLog
Source/WebCore/inspector/compile-front-end.sh
Source/WebCore/inspector/front-end/ApplicationCacheItemsView.js
Source/WebCore/inspector/front-end/AuditsPanel.js
Source/WebCore/inspector/front-end/BreakpointManager.js
Source/WebCore/inspector/front-end/CSSStyleModel.js
Source/WebCore/inspector/front-end/CompilerSourceMapping.js
Source/WebCore/inspector/front-end/ConsoleView.js
Source/WebCore/inspector/front-end/CookieItemsView.js
Source/WebCore/inspector/front-end/DOMAgent.js
Source/WebCore/inspector/front-end/DOMStorageItemsView.js
Source/WebCore/inspector/front-end/DatabaseTableView.js
Source/WebCore/inspector/front-end/DebuggerModel.js
Source/WebCore/inspector/front-end/DebuggerPresentationModel.js
Source/WebCore/inspector/front-end/ElementsPanel.js
Source/WebCore/inspector/front-end/NetworkPanel.js
Source/WebCore/inspector/front-end/Object.js
Source/WebCore/inspector/front-end/RawSourceCode.js
Source/WebCore/inspector/front-end/Script.js
Source/WebCore/inspector/front-end/ScriptsPanel.js
Source/WebCore/inspector/front-end/TimelinePanel.js
Source/WebCore/inspector/front-end/UISourceCode.js
Source/WebCore/inspector/front-end/WatchExpressionsSidebarPane.js
Source/WebCore/inspector/front-end/externs.js
Source/WebCore/inspector/generate-protocol-externs

index 3c1ffddd18e934b612f4b6b493816a4df01766c9..f73bf1558ef54dadd60bbd29c5c657027ef316f2 100644 (file)
@@ -1,3 +1,12 @@
+2011-10-10  Pavel Feldman  <pfeldman@google.com>
+
+        Web Inspector: annotate DOMAgent, Debugger(Presentation)Model with types.
+        https://bugs.webkit.org/show_bug.cgi?id=69726
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/debugger/raw-source-code.html:
+
 2011-10-10  Ilya Tikhonovsky  <loislo@chromium.org>
 
         Unreviewed fix for the test. The amount of used memory was calculated incorrectly.
index b1128d3f1525c71652c84dc6729e22df4f7830aa..182e38fa25518267b1d4e2ae72489033b8eaa634 100644 (file)
@@ -11,7 +11,7 @@ function test()
         var lineCount = source.lineEndings().length;
         var endLine = startLine + lineCount - 1;
         var endColumn = lineCount === 1 ? startColumn + source.length : source.length - source.lineEndings()[lineCount - 2];
-        var script = new WebInspector.Script(null, url, startLine, startColumn, endLine, endColumn, undefined, undefined, isContentScript);
+        var script = new WebInspector.Script(null, url, startLine, startColumn, endLine, endColumn, isContentScript);
         script.requestSource = function(callback) { callback(source); };
         return script;
     }
index 33585fdaa29d97aafd929bec22944cd132966f81..99560fc8716e7c4edf9948883548c47a2177389e 100644 (file)
@@ -1,3 +1,98 @@
+2011-10-10  Pavel Feldman  <pfeldman@google.com>
+
+        Web Inspector: annotate DOMAgent, Debugger(Presentation)Model with types.
+        https://bugs.webkit.org/show_bug.cgi?id=69726
+
+        Reviewed by Yury Semikhatsky.
+
+        * inspector/compile-front-end.sh:
+        * inspector/front-end/ApplicationCacheItemsView.js:
+        (WebInspector.ApplicationCacheItemsView):
+        * inspector/front-end/AuditsPanel.js:
+        (WebInspector.AuditsPanel):
+        * inspector/front-end/BreakpointManager.js:
+        (WebInspector.BreakpointManager.prototype._breakpointResolved):
+        * inspector/front-end/CSSStyleModel.js:
+        * inspector/front-end/CompilerSourceMapping.js:
+        (WebInspector.CompilerSourceMapping.prototype.compiledLocationToSourceLocation):
+        (WebInspector.CompilerSourceMapping.prototype.sourceLocationToCompiledLocation):
+        (WebInspector.CompilerSourceMapping.prototype.sources):
+        * inspector/front-end/ConsoleView.js:
+        (WebInspector.ConsoleView.prototype._completions.evaluated):
+        (WebInspector.ConsoleView.prototype._completions.receivedPropertyNamesFromEval):
+        (WebInspector.ConsoleView.prototype.evalInInspectedWindow):
+        * inspector/front-end/CookieItemsView.js:
+        (WebInspector.CookieItemsView):
+        * inspector/front-end/DOMAgent.js:
+        (WebInspector.DOMNode.prototype.isXMLNode):
+        (WebInspector.DOMDocument):
+        (WebInspector.DOMAgent.prototype._dispatchWhenDocumentAvailable.onDocumentAvailable):
+        (WebInspector.DOMAgent.prototype._dispatchWhenDocumentAvailable):
+        (WebInspector.DOMDispatcher.prototype.characterDataModified):
+        (WebInspector.DOMDispatcher.prototype.childNodeCountUpdated):
+        (WebInspector.DOMDispatcher.prototype.childNodeInserted):
+        (WebInspector.DOMDispatcher.prototype.childNodeRemoved):
+        * inspector/front-end/DOMStorageItemsView.js:
+        (WebInspector.DOMStorageItemsView):
+        * inspector/front-end/DatabaseTableView.js:
+        (WebInspector.DatabaseTableView):
+        * inspector/front-end/DebuggerModel.js:
+        (WebInspector.DebuggerModel):
+        (WebInspector.DebuggerPausedDetails):
+        (WebInspector.DebuggerModel.prototype.reset):
+        (WebInspector.DebuggerModel.prototype.get callFrames):
+        (WebInspector.DebuggerModel.prototype._pausedScript):
+        (WebInspector.DebuggerModel.prototype._resumedScript):
+        (WebInspector.DebuggerModel.prototype._parsedScriptSource):
+        (WebInspector.DebuggerModel.prototype._failedToParseScriptSource):
+        (WebInspector.DebuggerDispatcher.prototype.scriptParsed):
+        (WebInspector.DebuggerDispatcher.prototype.breakpointResolved):
+        * inspector/front-end/DebuggerPresentationModel.js:
+        (WebInspector.DebuggerPresentationModel.prototype._parsedScriptSource):
+        (WebInspector.DebuggerPresentationModel.prototype._failedToParseScriptSource):
+        (WebInspector.DebuggerPresentationModel.prototype._sourceMappingUpdated):
+        (WebInspector.DebuggerPresentationModel.prototype._updateBreakpointsAfterLiveEdit):
+        (WebInspector.DebuggerPresentationModel.prototype._consoleMessageAdded):
+        (WebInspector.DebuggerPresentationModel.prototype._createPresentationMessage):
+        (WebInspector.PresentationConsoleMessage):
+        (WebInspector.PresentationCallFrame.prototype.evaluate):
+        (WebInspector.DebuggerPresentationModel.Linkifier.prototype._updateSourceAnchors):
+        * inspector/front-end/ElementsPanel.js:
+        (WebInspector.ElementsPanel):
+        (WebInspector.ElementsPanel.prototype._documentUpdated.selectLastSelectedNode):
+        (WebInspector.ElementsPanel.prototype._documentUpdated):
+        * inspector/front-end/NetworkPanel.js:
+        * inspector/front-end/Object.js:
+        (WebInspector.Object.prototype.dispatchEventToListeners):
+        (WebInspector.Event):
+        (WebInspector.Event.prototype.stopPropagation):
+        (WebInspector.Event.prototype.preventDefault):
+        * inspector/front-end/RawSourceCode.js:
+        (WebInspector.RawSourceCode.SourceMapping):
+        (WebInspector.RawSourceCode.SourceMapping.prototype.rawLocationToUILocation):
+        (WebInspector.RawSourceCode.SourceMapping.prototype.uiLocationToRawLocation):
+        (WebInspector.RawSourceCode.PlainSourceMapping.prototype.rawLocationToUILocation):
+        (WebInspector.RawSourceCode.PlainSourceMapping.prototype.uiLocationToRawLocation):
+        (WebInspector.RawSourceCode.FormattedSourceMapping.prototype.rawLocationToUILocation):
+        (WebInspector.RawSourceCode.CompilerSourceMapping.prototype.rawLocationToUILocation):
+        (WebInspector.RawSourceCode.CompilerSourceMapping.prototype.uiLocationToRawLocation):
+        * inspector/front-end/Script.js:
+        (WebInspector.Script):
+        (WebInspector.Script.prototype.requestSource):
+        (WebInspector.Script.prototype.searchInContent):
+        (WebInspector.Script.prototype.editSource):
+        * inspector/front-end/ScriptsPanel.js:
+        (WebInspector.ScriptsPanel.prototype.evaluateInSelectedCallFrame):
+        * inspector/front-end/TimelinePanel.js:
+        (WebInspector.TimelinePanel.prototype._createStatusbarButtons):
+        * inspector/front-end/UISourceCode.js:
+        (WebInspector.UISourceCode):
+        (WebInspector.ContentProvider.SearchMatch):
+        * inspector/front-end/WatchExpressionsSidebarPane.js:
+        (WebInspector.WatchExpressionsSection.prototype.update):
+        * inspector/front-end/externs.js:
+        * inspector/generate-protocol-externs:
+
 2011-10-10  Ilya Tikhonovsky  <loislo@chromium.org>
 
         Web Inspector: Linkifier.reset throw an exception if it is called after reset of debuggerPresentationModel.
index 9eb6cb52135d8d984fe4863fa83a336374469af4..f9186c5cc5dc6bd238b83a9bcbc428b71ae7b8e8 100755 (executable)
@@ -107,7 +107,7 @@ java -jar ~/closure/compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --warn
         --js Source/WebCore/inspector/front-end/UIUtils.js \
         --js Source/WebCore/inspector/front-end/View.js \
         --js Source/WebCore/inspector/front-end/WelcomeView.js \
-    --module jsmodule_components:18:jsmodule_sdk,jsmodule_ui \
+    --module jsmodule_components:15:jsmodule_sdk,jsmodule_ui \
         --js Source/WebCore/inspector/front-end/ConsoleMessage.js \
         --js Source/WebCore/inspector/front-end/BreakpointsSidebarPane.js \
         --js Source/WebCore/inspector/front-end/DOMBreakpointsSidebarPane.js \
@@ -118,9 +118,6 @@ java -jar ~/closure/compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --warn
         --js Source/WebCore/inspector/front-end/JavaScriptContextManager.js \
         --js Source/WebCore/inspector/front-end/ObjectPopoverHelper.js \
         --js Source/WebCore/inspector/front-end/ObjectPropertiesSection.js \
-        --js Source/WebCore/inspector/front-end/SourceCSSTokenizer.js \
-        --js Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js \
-        --js Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js \
         --js Source/WebCore/inspector/front-end/SourceFrame.js \
         --js Source/WebCore/inspector/front-end/SourceTokenizer.js \
         --js Source/WebCore/inspector/front-end/TimelineAgent.js \
@@ -171,7 +168,11 @@ java -jar ~/closure/compiler.jar --compilation_level SIMPLE_OPTIMIZATIONS --warn
         --js Source/WebCore/inspector/front-end/AuditResultView.js \
         --js Source/WebCore/inspector/front-end/AuditRules.js \
         --js Source/WebCore/inspector/front-end/AuditsPanel.js
-    
+#     --module jsmodule_tokenizers:3:jsmodule_components \
+#        --js Source/WebCore/inspector/front-end/SourceCSSTokenizer.js \
+#        --js Source/WebCore/inspector/front-end/SourceHTMLTokenizer.js \
+#        --js Source/WebCore/inspector/front-end/SourceJavaScriptTokenizer.js \
+
 
 # To be compiled...
 # 
index 82c6a18bff47e340dc5392dfa01e9116d7639882..8ccc88b64b9b19ac8534a747297f55b4fa0beafa 100644 (file)
@@ -37,11 +37,11 @@ WebInspector.ApplicationCacheItemsView = function(treeElement, appcacheDomain)
     // FIXME: Needs better tooltip. (Localized)
     this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item");
     this.deleteButton.visible = false;
-    this.deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
+    this.deleteButton.addEventListener("click", this._deleteButtonClicked, this);
 
     // FIXME: Needs better tooltip. (Localized)
     this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
-    this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
+    this.refreshButton.addEventListener("click", this._refreshButtonClicked, this);
 
     if (Preferences.onlineDetectionEnabled) {
         this.connectivityIcon = document.createElement("img");
index 6e8fc91c0c7c0b44fd72b66d0c803eb736cc2c71..cc142f0bc76ef6a3462b95f3d7e2e5ac18aefd32 100644 (file)
@@ -50,7 +50,7 @@ WebInspector.AuditsPanel = function()
     this.auditResultsTreeElement.expand();
 
     this.clearResultsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear audit results."), "clear-status-bar-item");
-    this.clearResultsButton.addEventListener("click", this._clearButtonClicked.bind(this), false);
+    this.clearResultsButton.addEventListener("click", this._clearButtonClicked, this);
 
     this.viewsContainerElement = document.createElement("div");
     this.viewsContainerElement.id = "audit-views";
index c8498fe4816133c7b869e7af4865f3636c79f233..2f57b5867d2499f29cd65a2a3b5e81257b328630 100644 (file)
 
 /**
  * @constructor
+ * @param {WebInspector.Setting} breakpointStorage
+ * @param {function(WebInspector.Breakpoint)} breakpointAddedDelegate
+ * @param {function(WebInspector.Breakpoint)} breakpointRemovedDelegate
+ * @param {WebInspector.DebuggerModel} debuggerModel
  */
 WebInspector.BreakpointManager = function(breakpointStorage, breakpointAddedDelegate, breakpointRemovedDelegate, debuggerModel)
 {
     this._breakpointStorage = breakpointStorage;
     this._breakpointAddedDelegate = breakpointAddedDelegate;
     this._breakpointRemovedDelegate = breakpointRemovedDelegate;
+    /**
+     * @type {Object.<string, Object.<string,WebInspector.Breakpoint>>}
+     */
     this._breakpointsByUILocation = {};
 
     this._debuggerModel = debuggerModel;
+
+    /**
+     * @type {Object.<DebuggerAgent.BreakpointId, WebInspector.Breakpoint>}
+     */
     this._breakpointsByDebuggerId = {};
     this._debuggerModel.addEventListener(WebInspector.DebuggerModel.Events.BreakpointResolved, this._breakpointResolved, this);
 
@@ -51,6 +62,9 @@ WebInspector.BreakpointManager = function(breakpointStorage, breakpointAddedDele
 }
 
 WebInspector.BreakpointManager.prototype = {
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     */
     uiSourceCodeAdded: function(uiSourceCode)
     {
         var breakpoints = this._breakpoints(uiSourceCode.id);
@@ -63,11 +77,20 @@ WebInspector.BreakpointManager.prototype = {
         }
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     */
     breakpointsForUISourceCode: function(uiSourceCode)
     {
         return this._breakpoints(uiSourceCode.id);
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     * @param {string} condition
+     * @param {boolean} enabled
+     */
     setBreakpoint: function(uiSourceCode, lineNumber, condition, enabled)
     {
         if (this._breakpoint(uiSourceCode.id, lineNumber))
@@ -80,6 +103,10 @@ WebInspector.BreakpointManager.prototype = {
         this._materializeBreakpoint(breakpoint, uiSourceCode.rawSourceCode.sourceMapping, uiSourceCode);
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     */
     removeBreakpoint: function(uiSourceCode, lineNumber)
     {
         var breakpoint = this._breakpoint(uiSourceCode.id, lineNumber);
@@ -89,6 +116,11 @@ WebInspector.BreakpointManager.prototype = {
         this._removeBreakpointFromDebugger(breakpoint);
     },
 
+    /**
+     * @param {WebInspector.Breakpoint} breakpoint
+     * @param {WebInspector.RawSourceCode.SourceMapping} sourceMapping
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     */
     _materializeBreakpoint: function(breakpoint, sourceMapping, uiSourceCode)
     {
         if (!breakpoint.enabled || breakpoint._materialized)
@@ -99,6 +131,9 @@ WebInspector.BreakpointManager.prototype = {
         this._setBreakpointInDebugger(breakpoint, rawLocation);
     },
 
+    /**
+     * @param {WebInspector.Breakpoint} breakpoint
+     */
     _breakpointDebuggerLocationChanged: function(breakpoint)
     {
         if (!breakpoint.uiSourceCode)
@@ -111,6 +146,9 @@ WebInspector.BreakpointManager.prototype = {
             this._removeBreakpointFromDebugger(breakpoint);
     },
 
+    /**
+     * @param {WebInspector.Breakpoint} breakpoint
+     */
     _addBreakpointToUI: function(breakpoint)
     {
         console.assert(!this._breakpoint(breakpoint.uiSourceCodeId, breakpoint.lineNumber));
@@ -119,6 +157,9 @@ WebInspector.BreakpointManager.prototype = {
         this._breakpointAddedDelegate(breakpoint);
     },
 
+    /**
+     * @param {WebInspector.Breakpoint} breakpoint
+     */
     _deleteBreakpointFromUI: function(breakpoint)
     {
         console.assert(this._breakpoint(breakpoint.uiSourceCodeId, breakpoint.lineNumber) === breakpoint);
@@ -127,6 +168,10 @@ WebInspector.BreakpointManager.prototype = {
         this._breakpointRemovedDelegate(breakpoint);
     },
 
+    /**
+     * @param {WebInspector.Breakpoint} breakpoint
+     * @param {number} lineNumber
+     */
     _moveBreakpointInUI: function(breakpoint, lineNumber)
     {
         this._deleteBreakpointFromUI(breakpoint);
@@ -137,6 +182,9 @@ WebInspector.BreakpointManager.prototype = {
         return true;
     },
 
+    /**
+     * @param {string} uiSourceCodeId
+     */
     _breakpoints: function(uiSourceCodeId)
     {
         if (!this._breakpointsByUILocation[uiSourceCodeId])
@@ -144,11 +192,18 @@ WebInspector.BreakpointManager.prototype = {
         return this._breakpointsByUILocation[uiSourceCodeId];
     },
 
+    /**
+     * @param {string} uiSourceCodeId
+     * @param {number} lineNumber
+     */
     _breakpoint: function(uiSourceCodeId, lineNumber)
     {
         return this._breakpoints(uiSourceCodeId)[lineNumber];
     },
 
+    /**
+     * @param {function(WebInspector.Breakpoint)} handler
+     */
     _forEachBreakpoint: function(handler)
     {
         for (var uiSourceCodeId in this._breakpointsByUILocation) {
@@ -158,8 +213,17 @@ WebInspector.BreakpointManager.prototype = {
         }
     },
 
+    /**
+     * @param {WebInspector.Breakpoint} breakpoint
+     * @param {DebuggerAgent.Location} rawLocation
+     */
     _setBreakpointInDebugger: function(breakpoint, rawLocation)
     {
+        /**
+         * @this {WebInspector.BreakpointManager}
+         * @param {DebuggerAgent.BreakpointId} breakpointId
+         * @param {Array.<DebuggerAgent.Location>} locations
+         */
         function didSetBreakpoint(breakpointId, locations)
         {
             if (breakpoint === this._breakpoint(breakpoint.uiSourceCodeId, breakpoint.lineNumber)) {
@@ -182,6 +246,9 @@ WebInspector.BreakpointManager.prototype = {
         this._debuggerModel.setBreakpointByScriptLocation(rawLocation, breakpoint.condition, didSetBreakpoint.bind(this));
     },
 
+    /**
+     * @param {WebInspector.Breakpoint} breakpoint
+     */
     _removeBreakpointFromDebugger: function(breakpoint)
     {
         if (!("_debuggerId" in breakpoint))
@@ -192,16 +259,23 @@ WebInspector.BreakpointManager.prototype = {
         delete breakpoint._debuggerLocation;
     },
 
+    /**
+     * @param {WebInspector.Event} event
+     */
     _breakpointResolved: function(event)
     {
-        var breakpoint = this._breakpointsByDebuggerId[event.data.breakpointId];
-        breakpoint._debuggerLocation = event.data.location;
+        var breakpoint = this._breakpointsByDebuggerId[event.data["breakpointId"]];
+        breakpoint._debuggerLocation = event.data["location"];
         this._breakpointDebuggerLocationChanged(breakpoint);
     },
 
     _saveBreakpoints: function()
     {
         var serializedBreakpoints = [];
+        /**
+         * @this {WebInspector.BreakpointManager}
+         * @param {WebInspector.Breakpoint} breakpoint
+         */
         function serializePersistent(breakpoint)
         {
             if (breakpoint.persistent)
@@ -213,6 +287,10 @@ WebInspector.BreakpointManager.prototype = {
 
     reset: function()
     {
+        /**
+         * @this {WebInspector.BreakpointManager}
+         * @param {WebInspector.Breakpoint} breakpoint
+         */
         function resetBreakpoint(breakpoint)
         {
             this._removeBreakpointFromDebugger(breakpoint);
@@ -223,6 +301,10 @@ WebInspector.BreakpointManager.prototype = {
 
     debuggerReset: function()
     {
+        /**
+         * @this {WebInspector.BreakpointManager}
+         * @param {WebInspector.Breakpoint} breakpoint
+         */
         function resetOrDeleteBreakpoint(breakpoint)
         {
             if (breakpoint.persistent) {
@@ -249,6 +331,11 @@ WebInspector.BreakpointManager.prototype = {
 
 /**
  * @constructor
+ * @param {string} uiSourceCodeId
+ * @param {number} lineNumber
+ * @param {string} condition
+ * @param {boolean} enabled
+ * @param {boolean} persistent
  */
 WebInspector.Breakpoint = function(uiSourceCodeId, lineNumber, condition, enabled, persistent)
 {
@@ -260,6 +347,9 @@ WebInspector.Breakpoint = function(uiSourceCodeId, lineNumber, condition, enable
 }
 
 WebInspector.Breakpoint.prototype = {
+    /**
+     * @return {Object}
+     */
     serialize: function()
     {
         var serializedBreakpoint = {};
@@ -271,6 +361,10 @@ WebInspector.Breakpoint.prototype = {
     }
 }
 
+/**
+ * @param {Object} serializedBreakpoint
+ * @return {WebInspector.Breakpoint}
+ */
 WebInspector.Breakpoint.deserialize = function(serializedBreakpoint)
 {
     return new WebInspector.Breakpoint(
index 01a8741878e95f1cb4124f01c91660b38278a71f..89fcd86bf63e304aa5e5d3ce0477d0029c473e52 100644 (file)
@@ -46,7 +46,7 @@ WebInspector.CSSStyleModel.parseRuleArrayPayload = function(ruleArray)
 }
 
 WebInspector.CSSStyleModel.Events = {
-    StyleSheetChanged: 0
+    StyleSheetChanged: "StyleSheetChanged"
 }
 
 WebInspector.CSSStyleModel.prototype = {
index 13fa1f3a36e18ef9a5eaad7f0bafb0db2b40fc9a..00f2974e15ac68a4904972fcdd3ea838e17d885d 100644 (file)
  */
 
 /**
- * @constructor
+ * @interface
  */
 WebInspector.CompilerSourceMapping = function()
 {
 }
 
 WebInspector.CompilerSourceMapping.prototype = {
-    compiledLocationToSourceLocation: function(lineNumber, columnNumber)
-    {
-        // Should be implemented by subclasses.
-    },
-
-    sourceLocationToCompiledLocation: function(sourceURL, lineNumber, columnNumber)
-    {
-        // Should be implemented by subclasses.
-    },
-
-    sources: function()
-    {
-        // Should be implemented by subclasses.
-    }
+    /**
+     * @param {number} lineNumber
+     * @param {number} columnNumber
+     * @return {Object}
+     */
+    compiledLocationToSourceLocation: function(lineNumber, columnNumber) { },
+
+    /**
+     * @param {string} sourceURL
+     * @param {number} lineNumber
+     * @param {number} columnNumber
+     * @return {Object}
+     */
+    sourceLocationToCompiledLocation: function(sourceURL, lineNumber, columnNumber) { },
+
+    /**
+     * @return {Array.<string>}
+     */
+    sources: function() { }
 }
 
 /**
@@ -64,7 +69,7 @@ WebInspector.ClosureCompilerSourceMappingPayload = function()
 /**
  * Implements Source Map V3 consumer. See http://code.google.com/p/closure-compiler/wiki/SourceMaps
  * for format description.
- * @extends {WebInspector.CompilerSourceMapping}
+ * @implements {WebInspector.CompilerSourceMapping}
  * @constructor
  * @param {WebInspector.ClosureCompilerSourceMappingPayload} mappingPayload
  */
@@ -86,6 +91,11 @@ WebInspector.ClosureCompilerSourceMapping = function(mappingPayload)
 }
 
 WebInspector.ClosureCompilerSourceMapping.prototype = {
+    /**
+     * @param {number} lineNumber
+     * @param {number} columnNumber
+     * @return {Object}
+     */
     compiledLocationToSourceLocation: function(lineNumber, columnNumber)
     {
         var mapping = this._findMapping(lineNumber, columnNumber);
@@ -102,6 +112,9 @@ WebInspector.ClosureCompilerSourceMapping.prototype = {
         }
     },
 
+    /**
+     * @return {Array.<string>}
+     */
     sources: function()
     {
         return this._sources;
index 3b11e735d5651a27464eb711763a39c90f07a7a2..84d011107f9a6b4886f6fbe398efce93662441bb 100644 (file)
@@ -42,7 +42,7 @@ WebInspector.ConsoleView = function(hideContextSelector)
     this.messages = [];
 
     this._clearConsoleButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear console log."), "clear-status-bar-item");
-    this._clearConsoleButton.addEventListener("click", this._requestClearMessages.bind(this), false);
+    this._clearConsoleButton.addEventListener("click", this._requestClearMessages, this);
 
     this._contextSelectElement = document.createElement("select");
     this._contextSelectElement.id = "console-context";
@@ -365,7 +365,7 @@ WebInspector.ConsoleView.prototype = {
         if (!expressionString && WebInspector.panels.scripts.paused)
             WebInspector.panels.scripts.getSelectedCallFrameVariables(receivedPropertyNames.bind(this));
         else
-            this.evalInInspectedWindow(expressionString, "completion", true, true, undefined, evaluated.bind(this));
+            this.evalInInspectedWindow(expressionString, "completion", true, true, false, evaluated.bind(this));
 
         function evaluated(result, wasThrown)
         {
@@ -401,10 +401,10 @@ WebInspector.ConsoleView.prototype = {
             if (result.type === "object" || result.type === "function")
                 result.callFunctionJSON(getCompletions, receivedPropertyNames.bind(this));
             else if (result.type === "string" || result.type === "number" || result.type === "boolean")
-                this.evalInInspectedWindow("(" + getCompletions + ")(\"" + result.type + "\")", "completion", undefined, true, true, receivedPropertyNamesFromEval.bind(this));
+                this.evalInInspectedWindow("(" + getCompletions + ")(\"" + result.type + "\")", "completion", false, true, true, receivedPropertyNamesFromEval.bind(this));
         }
 
-        function receivedPropertyNamesFromEval(result, wasThrown)
+        function receivedPropertyNamesFromEval(notRelevant, wasThrown, result)
         {
             if (result && !wasThrown)
                 receivedPropertyNames.call(this, result.value);
@@ -564,6 +564,14 @@ WebInspector.ConsoleView.prototype = {
         }
     },
 
+    /**
+     * @param {string} expression
+     * @param {string} objectGroup
+     * @param {boolean} includeCommandLineAPI
+     * @param {boolean} doNotPauseOnExceptions
+     * @param {boolean} returnByValue
+     * @param {function(?WebInspector.RemoteObject, boolean, RuntimeAgent.RemoteObject=)} callback
+     */
     evalInInspectedWindow: function(expression, objectGroup, includeCommandLineAPI, doNotPauseOnExceptions, returnByValue, callback)
     {
         if (WebInspector.panels.scripts.paused) {
@@ -580,12 +588,12 @@ WebInspector.ConsoleView.prototype = {
         {
             if (error) {
                 console.error(error);
-                callback(null);
+                callback(null, false);
                 return;
             }
 
-            if (returnByValue && !wasThrown)
-                callback(result, wasThrown);
+            if (returnByValue)
+                callback(null, wasThrown, wasThrown ? null : result);
             else
                 callback(WebInspector.RemoteObject.fromPayload(result), wasThrown);
         }
@@ -623,7 +631,7 @@ WebInspector.ConsoleView.prototype = {
 
             this._appendConsoleMessage(new WebInspector.ConsoleCommandResult(result, wasThrown, commandMessage, this._linkifier));
         }
-        this.evalInInspectedWindow(str, "console", true, undefined, undefined, printResult.bind(this));
+        this.evalInInspectedWindow(str, "console", true, false, false, printResult.bind(this));
 
         WebInspector.userMetrics.ConsoleEvaluated.record();
     },
index 0cbf6ea89056c8841504b008f8977dab619d6ac2..bea83645720c6eb3eeb1288624f7afbcedd06b1c 100644 (file)
@@ -39,10 +39,10 @@ WebInspector.CookieItemsView = function(treeElement, cookieDomain)
 
     this._deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item");
     this._deleteButton.visible = false;
-    this._deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
+    this._deleteButton.addEventListener("click", this._deleteButtonClicked, this);
 
     this._refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
-    this._refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
+    this._refreshButton.addEventListener("click", this._refreshButtonClicked, this);
 
     this._treeElement = treeElement;
     this._cookieDomain = cookieDomain;
index 1f2f9ed99f5ec472a84df0d992c980de928b01ca..5e7b1d7ebcad6d81ccf9eed1cdc28072b5ad3ef0 100644 (file)
@@ -31,6 +31,7 @@
 
 /**
  * @constructor
+ * @param {WebInspector.DOMDocument} doc
  * @param {DOMAgent.Node} payload
  */
 WebInspector.DOMNode = function(doc, payload) {
@@ -85,72 +86,122 @@ WebInspector.DOMNode = function(doc, payload) {
 }
 
 WebInspector.DOMNode.prototype = {
+    /**
+     * @return {boolean}
+     */
     hasAttributes: function()
     {
         return this._attributes.length > 0;
     },
 
+    /**
+     * @return {boolean}
+     */
     hasChildNodes: function()
     {
         return this._childNodeCount > 0;
     },
 
+    /**
+     * @return {number}
+     */
     nodeType: function()
     {
         return this._nodeType;
     },
 
+    /**
+     * @return {string}
+     */
     nodeName: function()
     {
         return this._nodeName;
     },
 
+    /**
+     * @return {string}
+     */
     nodeNameInCorrectCase: function()
     {
         return this.isXMLNode() ? this.nodeName() : this.nodeName().toLowerCase();
     },
 
+    /**
+     * @param {string} name
+     * @param {function()=} callback
+     */
     setNodeName: function(name, callback)
     {
         DOMAgent.setNodeName(this.id, name, callback);
     },
 
+    /**
+     * @return {string}
+     */
     localName: function()
     {
         return this._localName;
     },
 
+    /**
+     * @return {string}
+     */
     nodeValue: function()
     {
         return this._nodeValue;
     },
 
+    /**
+     * @param {string} value
+     * @param {function(?Protocol.Error)=} callback
+     */
     setNodeValue: function(value, callback)
     {
         DOMAgent.setNodeValue(this.id, value, callback);
     },
 
+    /**
+     * @param {string} name
+     * @return {string}
+     */
     getAttribute: function(name)
     {
         var attr = this._attributesMap[name];
         return attr ? attr.value : undefined;
     },
 
+    /**
+     * @param {string} name
+     * @param {string} text
+     * @param {function()=} callback
+     */
     setAttribute: function(name, text, callback)
     {
         DOMAgent.setAttributesAsText(this.id, text, name, callback);
     },
 
+    /**
+     * @param {string} name
+     * @param {string} value
+     * @param {function()=} callback
+     */
     setAttributeValue: function(name, value, callback)
     {
         DOMAgent.setAttributeValue(this.id, name, value, callback);
     },
 
+    /**
+     * @return {Object}
+     */
     attributes: function()
     {
         return this._attributes;
     },
 
+    /**
+     * @param {string} name
+     * @param {function()=} callback
+     */
     removeAttribute: function(name, callback)
     {
         function mycallback(error, success)
@@ -171,6 +222,9 @@ WebInspector.DOMNode.prototype = {
         DOMAgent.removeAttribute(this.id, name, mycallback.bind(this));
     },
 
+    /**
+     * @param {function(Array.<WebInspector.DOMNode>)=} callback
+     */
     getChildNodes: function(callback)
     {
         if (this.children) {
@@ -179,6 +233,10 @@ WebInspector.DOMNode.prototype = {
             return;
         }
 
+        /**
+         * @this {WebInspector.DOMNode}
+         * @param {?Protocol.Error} error
+         */
         function mycallback(error) {
             if (!error && callback)
                 callback(this.children);
@@ -186,31 +244,50 @@ WebInspector.DOMNode.prototype = {
         DOMAgent.requestChildNodes(this.id, mycallback.bind(this));
     },
 
+    /**
+     * @param {function(?Protocol.Error)=} callback
+     */
     getOuterHTML: function(callback)
     {
         DOMAgent.getOuterHTML(this.id, callback);
     },
 
+    /**
+     * @param {string} html
+     * @param {function(?Protocol.Error)=} callback
+     */
     setOuterHTML: function(html, callback)
     {
         DOMAgent.setOuterHTML(this.id, html, callback);
     },
 
+    /**
+     * @param {function(?Protocol.Error)=} callback
+     */
     removeNode: function(callback)
     {
         DOMAgent.removeNode(this.id, callback);
     },
 
+    /**
+     * @param {function(?Protocol.Error)=} callback
+     */
     copyNode: function(callback)
     {
         DOMAgent.copyNode(this.id, callback);
     },
 
+    /**
+     * @param {function(?Protocol.Error)=} callback
+     */
     eventListeners: function(callback)
     {
         DOMAgent.getEventListenersForNode(this.id, callback);
     },
 
+    /**
+     * @return {string}
+     */
     path: function()
     {
         var path = [];
@@ -223,6 +300,10 @@ WebInspector.DOMNode.prototype = {
         return path.join(",");
     },
 
+    /**
+     * @param {boolean} justSelector
+     * @return {string}
+     */
     appropriateSelectorFor: function(justSelector)
     {
         var lowerCaseName = this.localName() || this.nodeName().toLowerCase();
@@ -245,6 +326,10 @@ WebInspector.DOMNode.prototype = {
         return lowerCaseName;
     },
 
+    /**
+     * @param {WebInspector.DOMNode} node
+     * @return {boolean}
+     */
     isAncestor: function(node)
     {
         if (!node)
@@ -259,11 +344,18 @@ WebInspector.DOMNode.prototype = {
         return false;
     },
 
+    /**
+     * @param {WebInspector.DOMNode} descendant
+     * @return {boolean}
+     */
     isDescendant: function(descendant)
     {
         return descendant !== null && descendant.isAncestor(this);
     },
 
+    /**
+     * @param {Array.<string>} attrs
+     */
     _setAttributesPayload: function(attrs)
     {
         this._attributes = [];
@@ -273,7 +365,9 @@ WebInspector.DOMNode.prototype = {
     },
 
     /**
+     * @param {WebInspector.DOMNode} prev
      * @param {DOMAgent.Node} payload
+     * @return {WebInspector.DOMNode}
      */
     _insertChild: function(prev, payload)
     {
@@ -290,6 +384,9 @@ WebInspector.DOMNode.prototype = {
         return node;
     },
 
+    /**
+     * @param {WebInspector.DOMNode} node
+     */
     _removeChild: function(node)
     {
         this.children.splice(this.children.indexOf(node), 1);
@@ -297,6 +394,9 @@ WebInspector.DOMNode.prototype = {
         this._renumber();
     },
 
+    /**
+     * @param {Array.<DOMAgent.Node>} payloads
+     */
     _setChildrenPayload: function(payloads)
     {
         this.children = [];
@@ -327,6 +427,10 @@ WebInspector.DOMNode.prototype = {
         }
     },
 
+    /**
+     * @param {string} name
+     * @param {string} value
+     */
     _addAttribute: function(name, value)
     {
         var attr = {
@@ -338,6 +442,10 @@ WebInspector.DOMNode.prototype = {
         this._attributes.push(attr);
     },
 
+    /**
+     * @param {string} name
+     * @param {string} value
+     */
     _setAttribute: function(name, value)
     {
         var attr = this._attributesMap[name];
@@ -347,6 +455,9 @@ WebInspector.DOMNode.prototype = {
             this._addAttribute(name, value);
     },
 
+    /**
+     * @param {string} name
+     */
     _removeAttribute: function(name)
     {
         var attr = this._attributesMap[name];
@@ -356,6 +467,9 @@ WebInspector.DOMNode.prototype = {
         }
     },
 
+    /**
+     * @return {WebInspector.DOMNode}
+     */
     ownerDocumentElement: function()
     {
         // document element is the child of the document / frame owner node that has documentURL property.
@@ -366,25 +480,39 @@ WebInspector.DOMNode.prototype = {
         return node;
     },
 
+    /**
+     * @param {WebInspector.DOMNode} targetNode
+     * @param {?WebInspector.DOMNode} anchorNode
+     * @param {function(?Protocol.Error)=} callback
+     */
     moveTo: function(targetNode, anchorNode, callback)
     {
         DOMAgent.moveTo(this.id, targetNode.id, anchorNode ? anchorNode.id : undefined, callback);
     },
 
+    /**
+     * @return {boolean}
+     */
     isXMLNode: function()
     {
-        return this.ownerDocument && !!this.ownerDocument.xmlVersion;
+        return !!this.ownerDocument && !!this.ownerDocument.xmlVersion;
     }
 }
 
 /**
  * @extends {WebInspector.DOMNode}
  * @constructor
+ * @param {WebInspector.DOMAgent} domAgent
  * @param {DOMAgent.Node} payload
  */
 WebInspector.DOMDocument = function(domAgent, payload)
 {
     WebInspector.DOMNode.call(this, this, payload);
+
+    /**
+     * @type {string} Document nodes always have documentURL
+     */
+    this.documentURL;
     this._listeners = {};
     this._domAgent = domAgent;
 }
@@ -434,6 +562,11 @@ WebInspector.DOMAgent.prototype = {
 
         this._pendingDocumentRequestCallbacks = [callback];
 
+        /**
+         * @this {WebInspector.DOMAgent}
+         * @param {?Protocol.Error} error
+         * @param {DOMAgent.Node} root
+         */
         function onDocumentAvailable(error, root)
         {
             if (!error)
@@ -450,16 +583,28 @@ WebInspector.DOMAgent.prototype = {
         DOMAgent.getDocument(onDocumentAvailable.bind(this));
     },
 
+    /**
+     * @param {RuntimeAgent.RemoteObjectId} objectId
+     * @param {function()=} callback
+     */
     pushNodeToFrontend: function(objectId, callback)
     {
         this._dispatchWhenDocumentAvailable(DOMAgent.requestNode.bind(DOMAgent), objectId, callback);
     },
 
+    /**
+     * @param {string} path
+     * @param {function(?WebInspector.DOMNode)=} callback
+     */
     pushNodeByPathToFrontend: function(path, callback)
     {
         this._dispatchWhenDocumentAvailable(DOMAgent.pushNodeByPathToFrontend.bind(DOMAgent), path, callback);
     },
 
+    /**
+     * @param {function(*)=} callback
+     * @return {function(?Protocol.Error,*=)|undefined}
+     */
     _wrapClientCallback: function(callback)
     {
         if (!callback)
@@ -472,23 +617,32 @@ WebInspector.DOMAgent.prototype = {
         }
     },
 
+    /**
+     * @param {function(*, function()=)} func
+     * @param {*} arg
+     * @param {function()=} callback
+     */
     _dispatchWhenDocumentAvailable: function(func, arg, callback)
     {
-        if (callback)
-            callback = this._wrapClientCallback(callback);
+        var callbackWrapper = this._wrapClientCallback(callback);
 
         function onDocumentAvailable()
         {
             if (this._document)
-                func.call(null, arg, callback);
+                func.call(null, arg, callbackWrapper);
             else {
-                if (callback)
-                    callback("No document");
+                if (callbackWrapper)
+                    callbackWrapper("No document");
             }
         }
         this.requestDocument(onDocumentAvailable.bind(this));
     },
 
+    /**
+     * @param {DOMAgent.NodeId} nodeId
+     * @param {string} name
+     * @param {string} value
+     */
     _attributeModified: function(nodeId, name, value)
     {
         var node = this._idToDOMNode[nodeId];
@@ -498,6 +652,10 @@ WebInspector.DOMAgent.prototype = {
         this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrModified, { node: node, name: name });
     },
 
+    /**
+     * @param {DOMAgent.NodeId} nodeId
+     * @param {string} name
+     */
     _attributeRemoved: function(nodeId, name)
     {
         var node = this._idToDOMNode[nodeId];
@@ -507,6 +665,9 @@ WebInspector.DOMAgent.prototype = {
         this.dispatchEventToListeners(WebInspector.DOMAgent.Events.AttrRemoved, { node: node, name: name });
     },
 
+    /**
+     * @param {Array.<DOMAgent.NodeId>} nodeIds
+     */
     _inlineStyleInvalidated: function(nodeIds)
     {
         for (var i = 0; i < nodeIds.length; ++i)
@@ -518,6 +679,11 @@ WebInspector.DOMAgent.prototype = {
 
     _loadNodeAttributes: function()
     {
+        /**
+         * @this {WebInspector.DOMAgent}
+         * @param {DOMAgent.NodeId} nodeId
+         * @param {Array.<string>} attributes
+         */
         function callback(nodeId, attributes)
         {
             if (!attributes)
@@ -537,6 +703,10 @@ WebInspector.DOMAgent.prototype = {
         this._attributeLoadNodeIds = {};
     },
 
+    /**
+     * @param {DOMAgent.NodeId} nodeId
+     * @param {string} newValue
+     */
     _characterDataModified: function(nodeId, newValue)
     {
         var node = this._idToDOMNode[nodeId];
@@ -544,6 +714,10 @@ WebInspector.DOMAgent.prototype = {
         this.dispatchEventToListeners(WebInspector.DOMAgent.Events.CharacterDataModified, node);
     },
 
+    /**
+     * @param {DOMAgent.NodeId} nodeId
+     * @return {WebInspector.DOMNode|undefined}
+     */
     nodeForId: function(nodeId)
     {
         return this._idToDOMNode[nodeId];
@@ -580,6 +754,10 @@ WebInspector.DOMAgent.prototype = {
         this._idToDOMNode[payload.nodeId] = root;
     },
 
+    /**
+     * @param {DOMAgent.NodeId} parentId
+     * @param {Array.<DOMAgent.Node>} payloads
+     */
     _setChildNodes: function(parentId, payloads)
     {
         if (!parentId && payloads.length) {
@@ -592,6 +770,9 @@ WebInspector.DOMAgent.prototype = {
         this._bindNodes(parent.children);
     },
 
+    /**
+     * @param {Array.<WebInspector.DOMNode>} children
+     */
     _bindNodes: function(children)
     {
         for (var i = 0; i < children.length; ++i) {
@@ -602,6 +783,10 @@ WebInspector.DOMAgent.prototype = {
         }
     },
 
+    /**
+     * @param {DOMAgent.NodeId} nodeId
+     * @param {number} newValue
+     */
     _childNodeCountUpdated: function(nodeId, newValue)
     {
         var node = this._idToDOMNode[nodeId];
@@ -609,6 +794,11 @@ WebInspector.DOMAgent.prototype = {
         this.dispatchEventToListeners(WebInspector.DOMAgent.Events.ChildNodeCountUpdated, node);
     },
 
+    /**
+     * @param {DOMAgent.NodeId} parentId
+     * @param {DOMAgent.NodeId} prevId
+     * @param {DOMAgent.Node} payload
+     */
     _childNodeInserted: function(parentId, prevId, payload)
     {
         var parent = this._idToDOMNode[parentId];
@@ -618,6 +808,10 @@ WebInspector.DOMAgent.prototype = {
         this.dispatchEventToListeners(WebInspector.DOMAgent.Events.NodeInserted, node);
     },
 
+    /**
+     * @param {DOMAgent.NodeId} parentId
+     * @param {DOMAgent.NodeId} nodeId
+     */
     _childNodeRemoved: function(parentId, nodeId)
     {
         var parent = this._idToDOMNode[parentId];
@@ -638,6 +832,8 @@ WebInspector.DOMAgent.prototype = {
     },
 
     /**
+     * @param {string} query
+     * @param {function(Array.<DOMAgent.Node>)} searchResultCollector
      * @param {boolean=} searchSynchronously
      */
     performSearch: function(query, searchResultCollector, searchSynchronously)
@@ -652,11 +848,21 @@ WebInspector.DOMAgent.prototype = {
         DOMAgent.cancelSearch();
     },
 
+    /**
+     * @param {DOMAgent.NodeId} nodeId
+     * @param {string} selectors
+     * @param {function(*)=} callback
+     */
     querySelector: function(nodeId, selectors, callback)
     {
         DOMAgent.querySelector(nodeId, selectors, this._wrapClientCallback(callback));
     },
 
+    /**
+     * @param {DOMAgent.NodeId} nodeId
+     * @param {string} selectors
+     * @param {function(*)=} callback
+     */
     querySelectorAll: function(nodeId, selectors, callback)
     {
         DOMAgent.querySelectorAll(nodeId, selectors, this._wrapClientCallback(callback));
@@ -685,12 +891,19 @@ WebInspector.DOMAgent.prototype = {
         this.highlightDOMNode(0);
     },
 
+    /**
+     * @param {?DOMAgent.NodeId} nodeId
+     */
     highlightDOMNodeForTwoSeconds: function(nodeId)
     {
         this.highlightDOMNode(nodeId);
         this._hideDOMNodeHighlightTimeout = setTimeout(this.hideDOMNodeHighlight.bind(this), 2000);
     },
 
+    /**
+     * @param {boolean} enabled
+     * @param {function()=} callback
+     */
     setInspectModeEnabled: function(enabled, callback)
     {
         DOMAgent.setInspectModeEnabled(enabled, this._buildHighlightConfig(), callback);
@@ -724,6 +937,7 @@ WebInspector.DOMAgent.prototype.__proto__ = WebInspector.Object.prototype;
 /**
  * @constructor
  * @implements {DOMAgent.Dispatcher}
+ * @param {WebInspector.DOMAgent} domAgent
  */
 WebInspector.DOMDispatcher = function(domAgent)
 {
@@ -736,46 +950,82 @@ WebInspector.DOMDispatcher.prototype = {
         this._domAgent._documentUpdated();
     },
 
+    /**
+     * @param {DOMAgent.NodeId} nodeId
+     * @param {string} name
+     * @param {string} value
+     */
     attributeModified: function(nodeId, name, value)
     {
         this._domAgent._attributeModified(nodeId, name, value);
     },
 
+    /**
+     * @param {DOMAgent.NodeId} nodeId
+     * @param {string} name
+     */
     attributeRemoved: function(nodeId, name)
     {
         this._domAgent._attributeRemoved(nodeId, name);
     },
 
+    /**
+     * @param {Array.<DOMAgent.NodeId>} nodeIds
+     */
     inlineStyleInvalidated: function(nodeIds)
     {
         this._domAgent._inlineStyleInvalidated(nodeIds);
     },
 
-    characterDataModified: function(nodeId, newValue)
+    /**
+     * @param {DOMAgent.NodeId} nodeId
+     * @param {string} characterData
+     */
+    characterDataModified: function(nodeId, characterData)
     {
-        this._domAgent._characterDataModified(nodeId, newValue);
+        this._domAgent._characterDataModified(nodeId, characterData);
     },
 
+    /**
+     * @param {DOMAgent.NodeId} parentId
+     * @param {Array.<DOMAgent.Node>} payloads
+     */
     setChildNodes: function(parentId, payloads)
     {
         this._domAgent._setChildNodes(parentId, payloads);
     },
 
-    childNodeCountUpdated: function(nodeId, newValue)
+    /**
+     * @param {DOMAgent.NodeId} nodeId
+     * @param {number} childNodeCount
+     */
+    childNodeCountUpdated: function(nodeId, childNodeCount)
     {
-        this._domAgent._childNodeCountUpdated(nodeId, newValue);
+        this._domAgent._childNodeCountUpdated(nodeId, childNodeCount);
     },
 
-    childNodeInserted: function(parentId, prevId, payload)
+    /**
+     * @param {DOMAgent.NodeId} parentNodeId
+     * @param {DOMAgent.NodeId} previousNodeId
+     * @param {DOMAgent.Node} payload
+     */
+    childNodeInserted: function(parentNodeId, previousNodeId, payload)
     {
-        this._domAgent._childNodeInserted(parentId, prevId, payload);
+        this._domAgent._childNodeInserted(parentNodeId, previousNodeId, payload);
     },
 
-    childNodeRemoved: function(parentId, nodeId)
+    /**
+     * @param {DOMAgent.NodeId} parentNodeId
+     * @param {DOMAgent.NodeId} nodeId
+     */
+    childNodeRemoved: function(parentNodeId, nodeId)
     {
-        this._domAgent._childNodeRemoved(parentId, nodeId);
+        this._domAgent._childNodeRemoved(parentNodeId, nodeId);
     },
 
+    /**
+     * @param {Array.<DOMAgent.NodeId>} nodeIds
+     */
     searchResults: function(nodeIds)
     {
         if (this._domAgent._searchResultCollector)
index 88e9a0495304e81f48c39d330e575d07412f5a54..15b4c1b01d23fb96f95139620ea90e3b9e3a7894 100644 (file)
@@ -38,10 +38,10 @@ WebInspector.DOMStorageItemsView = function(domStorage)
 
     this.deleteButton = new WebInspector.StatusBarButton(WebInspector.UIString("Delete"), "delete-storage-status-bar-item");
     this.deleteButton.visible = false;
-    this.deleteButton.addEventListener("click", this._deleteButtonClicked.bind(this), false);
+    this.deleteButton.addEventListener("click", this._deleteButtonClicked, this);
 
     this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
-    this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
+    this.refreshButton.addEventListener("click", this._refreshButtonClicked, this);
 }
 
 WebInspector.DOMStorageItemsView.prototype = {
index bad6137dcddf07720d6cd4fa7d61046d69a423d0..18a5cac6423cdb3ee0b01472c322113dcba97afa 100644 (file)
@@ -38,7 +38,7 @@ WebInspector.DatabaseTableView = function(database, tableName)
     this.element.addStyleClass("table");
 
     this.refreshButton = new WebInspector.StatusBarButton(WebInspector.UIString("Refresh"), "refresh-storage-status-bar-item");
-    this.refreshButton.addEventListener("click", this._refreshButtonClicked.bind(this), false);
+    this.refreshButton.addEventListener("click", this._refreshButtonClicked, this);
 }
 
 WebInspector.DatabaseTableView.prototype = {
index fb7e8476602032d629b3969e15fb92d4b650ff11..0fbafd8d8ae4c4dec95c46a04cf6b51abe344df2 100644 (file)
  */
 WebInspector.DebuggerModel = function()
 {
-    this._debuggerPausedDetails = {};
+    this._debuggerPausedDetails = null;
+    /**
+     * @type {Object.<string, WebInspector.Script>}
+     */
     this._scripts = {};
 
     InspectorBackend.registerDebuggerDispatcher(new WebInspector.DebuggerDispatcher(this));
 }
 
+/**
+ * @constructor
+ * @param {Array.<DebuggerAgent.CallFrame>} callFrames
+ * @param {string} reason
+ * @param {*} auxData
+ */
+WebInspector.DebuggerPausedDetails = function(callFrames, reason, auxData)
+{
+    this.callFrames = callFrames;
+    this.reason = reason;
+    this.auxData = auxData;
+}
+
 /**
  * @constructor
  */
@@ -87,11 +103,19 @@ WebInspector.DebuggerModel.prototype = {
         this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerWasDisabled);
     },
 
+    /**
+     * @param {DebuggerAgent.Location} location
+     */
     continueToLocation: function(location)
     {
         DebuggerAgent.continueToLocation(location);
     },
 
+    /**
+     * @param {DebuggerAgent.Location} location
+     * @param {string} condition
+     * @param {function()} callback
+     */
     setBreakpointByScriptLocation: function(location, condition, callback)
     {
         var script = this.scriptForSourceID(location.scriptId);
@@ -101,6 +125,13 @@ WebInspector.DebuggerModel.prototype = {
             this.setBreakpointBySourceId(location, condition, callback);
     },
 
+    /**
+     * @param {string} url
+     * @param {number} lineNumber
+     * @param {number=} columnNumber
+     * @param {string=} condition
+     * @param {function(?DebuggerAgent.BreakpointId, Array.<DebuggerAgent.Location>)=} callback
+     */
     setBreakpoint: function(url, lineNumber, columnNumber, condition, callback)
     {
         // Adjust column if needed.
@@ -112,6 +143,12 @@ WebInspector.DebuggerModel.prototype = {
         }
         columnNumber = Math.max(columnNumber, minColumnNumber);
 
+        /**
+         * @this {WebInspector.DebuggerModel}
+         * @param {?Protocol.Error} error
+         * @param {DebuggerAgent.BreakpointId} breakpointId
+         * @param {Array.<DebuggerAgent.Location>} locations
+         */
         function didSetBreakpoint(error, breakpointId, locations)
         {
             if (callback)
@@ -121,8 +158,19 @@ WebInspector.DebuggerModel.prototype = {
         WebInspector.userMetrics.ScriptsBreakpointSet.record();
     },
 
+    /**
+     * @param {DebuggerAgent.Location} location
+     * @param {string} condition
+     * @param {function(?DebuggerAgent.BreakpointId, Array.<DebuggerAgent.Location>)=} callback
+     */
     setBreakpointBySourceId: function(location, condition, callback)
     {
+        /**
+         * @this {WebInspector.DebuggerModel}
+         * @param {?Protocol.Error} error
+         * @param {DebuggerAgent.BreakpointId} breakpointId
+         * @param {DebuggerAgent.Location} actualLocation
+         */
         function didSetBreakpoint(error, breakpointId, actualLocation)
         {
             if (callback)
@@ -132,11 +180,19 @@ WebInspector.DebuggerModel.prototype = {
         WebInspector.userMetrics.ScriptsBreakpointSet.record();
     },
 
+    /**
+     * @param {DebuggerAgent.BreakpointId} breakpointId
+     * @param {function(?Protocol.Error)=} callback
+     */
     removeBreakpoint: function(breakpointId, callback)
     {
         DebuggerAgent.removeBreakpoint(breakpointId, callback);
     },
 
+    /**
+     * @param {DebuggerAgent.BreakpointId} breakpointId
+     * @param {DebuggerAgent.Location} location
+     */
     _breakpointResolved: function(breakpointId, location)
     {
         this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.BreakpointResolved, {breakpointId: breakpointId, location: location});
@@ -144,26 +200,39 @@ WebInspector.DebuggerModel.prototype = {
 
     reset: function()
     {
-        this._debuggerPausedDetails = {};
+        this._debuggerPausedDetails = null;
         this._scripts = {};
         this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.Reset);
     },
 
+    /**
+     * @return {Object.<string, WebInspector.Script>}
+     */
     get scripts()
     {
         return this._scripts;
     },
 
+    /**
+     * @param {DebuggerAgent.ScriptId} scriptId
+     * @return {WebInspector.Script|undefined}
+     */
     scriptForSourceID: function(scriptId)
     {
         return this._scripts[scriptId];
     },
 
+    /**
+     * @param {string} url
+     */
     scriptsForURL: function(url)
     {
         return this.queryScripts(function(s) { return s.sourceURL === url; });
     },
 
+    /**
+     * @param {function(WebInspector.Script):boolean} filter
+     */
     queryScripts: function(filter)
     {
         var scripts = [];
@@ -175,11 +244,23 @@ WebInspector.DebuggerModel.prototype = {
         return scripts;
     },
 
+    /**
+     * @param {DebuggerAgent.ScriptId} scriptId
+     * @param {string} newSource
+     * @param {function(?Protocol.Error)} callback
+     */
     setScriptSource: function(scriptId, newSource, callback)
     {
         this._scripts[scriptId].editSource(newSource, this._didEditScriptSource.bind(this, scriptId, newSource, callback));
     },
 
+    /**
+     * @param {DebuggerAgent.ScriptId} scriptId
+     * @param {string} newSource
+     * @param {function(?Protocol.Error)} callback
+     * @param {?Protocol.Error} error
+     * @param {Array.<DebuggerAgent.CallFrame>} callFrames
+     */
     _didEditScriptSource: function(scriptId, newSource, callback, error, callFrames)
     {
         if (!error && callFrames && callFrames.length)
@@ -187,39 +268,65 @@ WebInspector.DebuggerModel.prototype = {
         callback(error);
     },
 
+    /**
+     * @return {Array.<DebuggerAgent.CallFrame>} 
+     */
     get callFrames()
     {
-        return this._debuggerPausedDetails.callFrames;
+        return this._debuggerPausedDetails ? this._debuggerPausedDetails.callFrames : null;
     },
 
+    /**
+     * @return {?WebInspector.DebuggerPausedDetails} 
+     */
     get debuggerPausedDetails()
     {
         return this._debuggerPausedDetails;
     },
 
+    /**
+     * @param {Array.<DebuggerAgent.CallFrame>} callFrames
+     * @param {string} reason
+     * @param {*} auxData
+     */
     _pausedScript: function(callFrames, reason, auxData)
     {
-        var details = { callFrames: callFrames, reason: reason, auxData: auxData };
-        this._debuggerPausedDetails = details;
-        this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerPaused, details);
+        this._debuggerPausedDetails = new WebInspector.DebuggerPausedDetails(callFrames, reason, auxData);
+        this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerPaused, this._debuggerPausedDetails);
     },
 
     _resumedScript: function()
     {
-        this._debuggerPausedDetails = {};
+        this._debuggerPausedDetails = null;
         this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.DebuggerResumed);
     },
 
+    /**
+     * @param {DebuggerAgent.ScriptId} scriptId
+     * @param {string} sourceURL
+     * @param {number} startLine
+     * @param {number} startColumn
+     * @param {number} endLine
+     * @param {number} endColumn
+     * @param {boolean} isContentScript
+     */
     _parsedScriptSource: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript)
     {
-        var script = new WebInspector.Script(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, undefined, undefined, isContentScript);
+        var script = new WebInspector.Script(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript);
         this._scripts[scriptId] = script;
         this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.ParsedScriptSource, script);
     },
 
+    /**
+     * @param {string} sourceURL
+     * @param {string} source
+     * @param {number} startingLine
+     * @param {number} errorLine
+     * @param {string} errorMessage
+     */
     _failedToParseScriptSource: function(sourceURL, source, startingLine, errorLine, errorMessage)
     {
-        var script = new WebInspector.Script(null, sourceURL, startingLine, 0, 0, 0, errorLine, errorMessage, undefined);
+        var script = new WebInspector.Script(null, sourceURL, startingLine, 0, 0, 0, false);
         this.dispatchEventToListeners(WebInspector.DebuggerModel.Events.FailedToParseScriptSource, script);
     }
 }
@@ -235,6 +342,7 @@ WebInspector.DebuggerEventTypes = {
 /**
  * @constructor
  * @implements {DebuggerAgent.Dispatcher}
+ * @param {WebInspector.DebuggerModel} debuggerModel
  */
 WebInspector.DebuggerDispatcher = function(debuggerModel)
 {
@@ -242,6 +350,11 @@ WebInspector.DebuggerDispatcher = function(debuggerModel)
 }
 
 WebInspector.DebuggerDispatcher.prototype = {
+    /**
+     * @param {Array.<DebuggerAgent.CallFrame>} callFrames
+     * @param {string} reason
+     * @param {*} auxData
+     */
     paused: function(callFrames, reason, auxData)
     {
         this._debuggerModel._pausedScript(callFrames, reason, auxData);
@@ -262,19 +375,39 @@ WebInspector.DebuggerDispatcher.prototype = {
         this._debuggerModel._debuggerWasDisabled();
     },
 
+    /**
+     * @param {DebuggerAgent.ScriptId} scriptId
+     * @param {string} sourceURL
+     * @param {number} startLine
+     * @param {number} startColumn
+     * @param {number} endLine
+     * @param {number} endColumn
+     * @param {boolean=} isContentScript
+     */
     scriptParsed: function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript)
     {
-        this._debuggerModel._parsedScriptSource(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript);
+        this._debuggerModel._parsedScriptSource(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, !!isContentScript);
     },
 
+    /**
+     * @param {string} sourceURL
+     * @param {string} source
+     * @param {number} startingLine
+     * @param {number} errorLine
+     * @param {string} errorMessage
+     */
     scriptFailedToParse: function(sourceURL, source, startingLine, errorLine, errorMessage)
     {
         this._debuggerModel._failedToParseScriptSource(sourceURL, source, startingLine, errorLine, errorMessage);
     },
 
-    breakpointResolved: function(breakpointId, scriptId, lineNumber, columnNumber)
+    /**
+    * @param {DebuggerAgent.BreakpointId} breakpointId
+    * @param {DebuggerAgent.Location} location
+     */
+    breakpointResolved: function(breakpointId, location)
     {
-        this._debuggerModel._breakpointResolved(breakpointId, scriptId, lineNumber, columnNumber);
+        this._debuggerModel._breakpointResolved(breakpointId, location);
     }
 }
 
index 389a3ed73acee16c6505f9f90b7bd7dfb61eabe1..b0e37f02c321da6b31fec69b5d03d7a8f0f6600e 100644 (file)
@@ -73,6 +73,10 @@ WebInspector.DebuggerPresentationModel.prototype = {
         return new WebInspector.DebuggerPresentationModel.Linkifier(this);
     },
 
+    /**
+     * @param {WebInspector.PresentationCallFrame} callFrame
+     * @return {WebInspector.Placard}
+     */
     createPlacard: function(callFrame)
     {
         var title = callFrame._callFrame.functionName || WebInspector.UIString("(anonymous function)");
@@ -91,16 +95,27 @@ WebInspector.DebuggerPresentationModel.prototype = {
         return placard;
     },
 
+    /**
+     * @param {WebInspector.Event} event
+     */
     _parsedScriptSource: function(event)
     {
-        this._addScript(event.data);
+        var script = /** @type {WebInspector.Script} */ event.data;
+        this._addScript(script);
     },
 
+    /**
+     * @param {WebInspector.Event} event
+     */
     _failedToParseScriptSource: function(event)
     {
-        this._addScript(event.data);
+        var script = /** @type {WebInspector.Script} */ event.data;
+        this._addScript(script);
     },
 
+    /**
+     * @param {WebInspector.Script} script
+     */
     _addScript: function(script)
     {
         var rawSourceCodeId = this._createRawSourceCodeId(script);
@@ -120,13 +135,20 @@ WebInspector.DebuggerPresentationModel.prototype = {
         rawSourceCode.addEventListener(WebInspector.RawSourceCode.Events.SourceMappingUpdated, this._sourceMappingUpdated, this);
     },
 
+    /**
+     * @param {WebInspector.Event} event
+     */
     _sourceMappingUpdated: function(event)
     {
-        var rawSourceCode = event.target;
-        var oldSourceMapping = event.data.oldSourceMapping;
+        var rawSourceCode = /** @type {WebInspector.RawSourceCode} */ event.target;
+        var oldSourceMapping = /** @type {WebInspector.RawSourceCode.SourceMapping} */ event.data["oldSourceMapping"];
         this._updateSourceMapping(rawSourceCode, oldSourceMapping);
     },
 
+    /**
+     * @param {WebInspector.RawSourceCode} rawSourceCode
+     * @param {WebInspector.RawSourceCode.SourceMapping} oldSourceMapping
+     */
     _updateSourceMapping: function(rawSourceCode, oldSourceMapping)
     {
         if (oldSourceMapping) {
@@ -154,6 +176,9 @@ WebInspector.DebuggerPresentationModel.prototype = {
         }
     },
 
+    /**
+     * @param {WebInspector.RawSourceCode} rawSourceCode
+     */
     _restoreBreakpoints: function(rawSourceCode)
     {
         var uiSourceCodeList = rawSourceCode.sourceMapping.uiSourceCodeList();
@@ -167,6 +192,9 @@ WebInspector.DebuggerPresentationModel.prototype = {
 
     },
 
+    /**
+     * @param {WebInspector.RawSourceCode} rawSourceCode
+     */
     _restoreConsoleMessages: function(rawSourceCode)
     {
         var messages = rawSourceCode.messages;
@@ -174,6 +202,10 @@ WebInspector.DebuggerPresentationModel.prototype = {
             messages[i]._presentationMessage = this._createPresentationMessage(messages[i], rawSourceCode.sourceMapping);
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @return {boolean}
+     */
     canEditScriptSource: function(uiSourceCode)
     {
         if (!Preferences.canEditScriptSource || this._formatSource)
@@ -183,11 +215,20 @@ WebInspector.DebuggerPresentationModel.prototype = {
         return script && !script.lineOffset && !script.columnOffset;
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {string} newSource
+     * @param {function(?Protocol.Error)} callback
+     */
     setScriptSource: function(uiSourceCode, newSource, callback)
     {
         var rawSourceCode = uiSourceCode.rawSourceCode;
         var script = this._scriptForRawSourceCode(rawSourceCode);
 
+        /**
+         * @this {WebInspector.DebuggerPresentationModel}
+         * @param {?Protocol.Error} error
+         */
         function didEditScriptSource(error)
         {
             callback(error);
@@ -206,6 +247,11 @@ WebInspector.DebuggerPresentationModel.prototype = {
         WebInspector.debuggerModel.setScriptSource(script.scriptId, newSource, didEditScriptSource.bind(this));
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {string} oldSource
+     * @param {string} newSource
+     */
     _updateBreakpointsAfterLiveEdit: function(uiSourceCode, oldSource, newSource)
     {
         var breakpoints = this._breakpointManager.breakpointsForUISourceCode(uiSourceCode);
@@ -215,7 +261,7 @@ WebInspector.DebuggerPresentationModel.prototype = {
         for (var lineNumber in breakpoints) {
             var breakpoint = breakpoints[lineNumber];
 
-            this.removeBreakpoint(uiSourceCode, lineNumber);
+            this.removeBreakpoint(uiSourceCode, parseInt(lineNumber, 10));
 
             var newLineNumber = diff.left[lineNumber].row;
             if (newLineNumber === undefined) {
@@ -236,6 +282,9 @@ WebInspector.DebuggerPresentationModel.prototype = {
         }
     },
 
+    /**
+     * @param {boolean} formatSource
+     */
     setFormatSource: function(formatSource)
     {
         if (this._formatSource === formatSource)
@@ -250,9 +299,12 @@ WebInspector.DebuggerPresentationModel.prototype = {
             this._debuggerPaused();
     },
 
+    /**
+     * @param {WebInspector.Event} event
+     */
     _consoleMessageAdded: function(event)
     {
-        var message = event.data;
+        var message = /** @type {WebInspector.ConsoleMessage} */ event.data;
         if (!message.url || !message.isErrorOrWarning() || !message.message)
             return;
 
@@ -267,16 +319,18 @@ WebInspector.DebuggerPresentationModel.prototype = {
         }
     },
 
+    /**
+     * @param {WebInspector.ConsoleMessage} message
+     * @param {WebInspector.RawSourceCode.SourceMapping} sourceMapping
+     * @return {WebInspector.PresentationConsoleMessage}
+     */
     _createPresentationMessage: function(message, sourceMapping)
     {
         // FIXME(62725): stack trace line/column numbers are one-based.
         var lineNumber = message.stackTrace ? message.stackTrace[0].lineNumber - 1 : message.line - 1;
         var columnNumber = message.stackTrace ? message.stackTrace[0].columnNumber - 1 : 0;
-        var uiLocation = sourceMapping.rawLocationToUILocation({ lineNumber: lineNumber, columnNumber: columnNumber });
-        var presentationMessage = {};
-        presentationMessage.uiSourceCode = uiLocation.uiSourceCode;
-        presentationMessage.lineNumber = uiLocation.lineNumber;
-        presentationMessage.originalMessage = message;
+        var uiLocation = sourceMapping.rawLocationToUILocation(/** @type {DebuggerAgent.Location} */ { lineNumber: lineNumber, columnNumber: columnNumber });
+        var presentationMessage = new WebInspector.PresentationConsoleMessage(uiLocation.uiSourceCode, uiLocation.lineNumber, message);
         return presentationMessage;
     },
 
@@ -287,6 +341,10 @@ WebInspector.DebuggerPresentationModel.prototype = {
         this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.ConsoleMessagesCleared);
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     */
     continueToLine: function(uiSourceCode, lineNumber)
     {
         // FIXME: use RawSourceCode.uiLocationToRawLocation.
@@ -294,6 +352,10 @@ WebInspector.DebuggerPresentationModel.prototype = {
         WebInspector.debuggerModel.continueToLocation(rawLocation);
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @return {Array.<WebInspector.Breakpoint>}
+     */
     breakpointsForUISourceCode: function(uiSourceCode)
     {
         var breakpointsMap = this._breakpointManager.breakpointsForUISourceCode(uiSourceCode);
@@ -303,6 +365,10 @@ WebInspector.DebuggerPresentationModel.prototype = {
         return breakpointsList;
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @return {Array.<WebInspector.ConsoleMessage>}
+     */
     messagesForUISourceCode: function(uiSourceCode)
     {
         var rawSourceCode = uiSourceCode.rawSourceCode;
@@ -312,11 +378,22 @@ WebInspector.DebuggerPresentationModel.prototype = {
         return messages;
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     * @param {string} condition
+     * @param {boolean} enabled
+     */
     setBreakpoint: function(uiSourceCode, lineNumber, condition, enabled)
     {
         this._breakpointManager.setBreakpoint(uiSourceCode, lineNumber, condition, enabled);
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     * @param {boolean} enabled
+     */
     setBreakpointEnabled: function(uiSourceCode, lineNumber, enabled)
     {
         var breakpoint = this.findBreakpoint(uiSourceCode, lineNumber);
@@ -326,28 +403,49 @@ WebInspector.DebuggerPresentationModel.prototype = {
         this._breakpointManager.setBreakpoint(uiSourceCode, lineNumber, breakpoint.condition, enabled);
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     * @param {string} condition
+     * @param {boolean} enabled
+     */
     updateBreakpoint: function(uiSourceCode, lineNumber, condition, enabled)
     {
         this._breakpointManager.removeBreakpoint(uiSourceCode, lineNumber);
         this._breakpointManager.setBreakpoint(uiSourceCode, lineNumber, condition, enabled);
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     */
     removeBreakpoint: function(uiSourceCode, lineNumber)
     {
         this._breakpointManager.removeBreakpoint(uiSourceCode, lineNumber);
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     * @return {WebInspector.Breakpoint|undefined}
+     */
     findBreakpoint: function(uiSourceCode, lineNumber)
     {
         return this._breakpointManager.breakpointsForUISourceCode(uiSourceCode)[lineNumber];
     },
 
+    /**
+     * @param {WebInspector.Breakpoint} breakpoint
+     */
     _breakpointAdded: function(breakpoint)
     {
         if (breakpoint.uiSourceCode)
             this.dispatchEventToListeners(WebInspector.DebuggerPresentationModel.Events.BreakpointAdded, breakpoint);
     },
 
+    /**
+     * @param {WebInspector.Breakpoint} breakpoint
+     */
     _breakpointRemoved: function(breakpoint)
     {
         if (breakpoint.uiSourceCode)
@@ -400,6 +498,9 @@ WebInspector.DebuggerPresentationModel.prototype = {
         return this._selectedCallFrame;
     },
 
+    /**
+     * @param {WebInspector.Event} event
+     */
     _dispatchExecutionLineChanged: function(event)
     {
         var rawLocation = this._selectedCallFrame._callFrame.location;
@@ -423,8 +524,16 @@ WebInspector.DebuggerPresentationModel.prototype = {
         return this._rawSourceCode[this._createRawSourceCodeId(script)];
     },
 
+    /**
+     * @param {WebInspector.RawSourceCode} rawSourceCode
+     */
     _scriptForRawSourceCode: function(rawSourceCode)
     {
+        /**
+         * @this {WebInspector.DebuggerPresentationModel}
+         * @param {WebInspector.Script} script
+         * @return {boolean}
+         */
         function filter(script)
         {
             return this._createRawSourceCodeId(script) === rawSourceCode.id;
@@ -432,6 +541,9 @@ WebInspector.DebuggerPresentationModel.prototype = {
         return WebInspector.debuggerModel.queryScripts(filter.bind(this))[0];
     },
 
+    /**
+     * @param {WebInspector.Script} script
+     */
     _createRawSourceCodeId: function(script)
     {
         return script.sourceURL || script.scriptId;
@@ -459,6 +571,23 @@ WebInspector.DebuggerPresentationModel.prototype.__proto__ = WebInspector.Object
 
 /**
  * @constructor
+ * @param {WebInspector.UISourceCode} uiSourceCode
+ * @param {number} lineNumber
+ * @param {WebInspector.ConsoleMessage} originalMessage
+ */
+WebInspector.PresentationConsoleMessage = function(uiSourceCode, lineNumber, originalMessage)
+{
+    this.uiSourceCode = uiSourceCode;
+    this.lineNumber = lineNumber;
+    this.originalMessage = originalMessage;
+}
+
+/**
+ * @constructor
+ * @param {DebuggerAgent.CallFrame} callFrame
+ * @param {number} index
+ * @param {WebInspector.DebuggerPresentationModel} model
+ * @param {WebInspector.RawSourceCode} rawSourceCode
  */
 WebInspector.PresentationCallFrame = function(callFrame, index, model, rawSourceCode)
 {
@@ -469,49 +598,76 @@ WebInspector.PresentationCallFrame = function(callFrame, index, model, rawSource
 }
 
 WebInspector.PresentationCallFrame.prototype = {
+    /**
+     * @return {string}
+     */
     get type()
     {
         return this._callFrame.type;
     },
 
+    /**
+     * @return {Array.<DebuggerAgent.Scope>}
+     */
     get scopeChain()
     {
         return this._callFrame.scopeChain;
     },
 
+    /**
+     * @return {RuntimeAgent.RemoteObject}
+     */
     get this()
     {
         return this._callFrame.this;
     },
 
+    /**
+     * @return {number}
+     */
     get index()
     {
         return this._index;
     },
 
+    /**
+     * @return {WebInspector.RawSourceCode}
+     */
     get rawSourceCode()
     {
         return this._rawSourceCode;
     },
 
+    /**
+     * @param {string} code
+     * @param {string} objectGroup
+     * @param {boolean} includeCommandLineAPI
+     * @param {boolean} returnByValue
+     * @param {function(?RuntimeAgent.RemoteObject, boolean)=} callback
+     */
     evaluate: function(code, objectGroup, includeCommandLineAPI, returnByValue, callback)
     {
+        /**
+         * @this {WebInspector.PresentationCallFrame}
+         * @param {?Protocol.Error} error
+         * @param {RuntimeAgent.RemoteObject} result
+         * @param {boolean} wasThrown
+         */
         function didEvaluateOnCallFrame(error, result, wasThrown)
         {
             if (error) {
                 console.error(error);
-                callback(null);
+                callback(null, false);
                 return;
             }
-
-            if (returnByValue && !wasThrown)
-                callback(result, wasThrown);
-            else
-                callback(WebInspector.RemoteObject.fromPayload(result), wasThrown);
+            callback(result, wasThrown);
         }
         DebuggerAgent.evaluateOnCallFrame(this._callFrame.callFrameId, code, objectGroup, includeCommandLineAPI, returnByValue, didEvaluateOnCallFrame.bind(this));
     },
 
+    /**
+     * @param {function(WebInspector.UILocation)} callback
+     */
     uiLocation: function(callback)
     {
         function sourceMappingReady()
@@ -529,6 +685,7 @@ WebInspector.PresentationCallFrame.prototype = {
 /**
  * @constructor
  * @implements {WebInspector.ResourceDomainModelBinding}
+ * @param {WebInspector.DebuggerPresentationModel} model
  */
 WebInspector.DebuggerPresentationModelResourceBinding = function(model)
 {
@@ -537,6 +694,9 @@ WebInspector.DebuggerPresentationModelResourceBinding = function(model)
 }
 
 WebInspector.DebuggerPresentationModelResourceBinding.prototype = {
+    /**
+     * @param {WebInspector.Resource} resource
+     */
     canSetContent: function(resource)
     {
         var rawSourceCode = this._presentationModel._rawSourceCodeForScriptWithURL(resource.url)
@@ -545,6 +705,12 @@ WebInspector.DebuggerPresentationModelResourceBinding.prototype = {
         return this._presentationModel.canEditScriptSource(rawSourceCode.sourceMapping.uiSourceCodeList()[0]);
     },
 
+    /**
+     * @param {WebInspector.Resource} resource
+     * @param {string} content
+     * @param {boolean} majorChange
+     * @param {function(?Protocol.Error)} userCallback
+     */
     setContent: function(resource, content, majorChange, userCallback)
     {
         if (!majorChange)
@@ -559,8 +725,18 @@ WebInspector.DebuggerPresentationModelResourceBinding.prototype = {
         resource.requestContent(this._setContentWithInitialContent.bind(this, rawSourceCode.sourceMapping.uiSourceCodeList()[0], content, userCallback));
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {string} content
+     * @param {function(?Protocol.Error)} userCallback
+     * @param {string} oldContent
+     */
     _setContentWithInitialContent: function(uiSourceCode, content, userCallback, oldContent)
     {
+        /**
+         * @this {WebInspector.DebuggerPresentationModelResourceBinding}
+         * @param {?Protocol.Error} error
+         */
         function callback(error)
         {
             if (userCallback)
@@ -574,6 +750,7 @@ WebInspector.DebuggerPresentationModelResourceBinding.prototype = {
 
 /**
  * @constructor
+ * @param {WebInspector.DebuggerPresentationModel} model
  */
 WebInspector.DebuggerPresentationModel.Linkifier = function(model)
 {
@@ -582,6 +759,12 @@ WebInspector.DebuggerPresentationModel.Linkifier = function(model)
 }
 
 WebInspector.DebuggerPresentationModel.Linkifier.prototype = {
+    /**
+     * @param {string} sourceURL
+     * @param {number=} lineNumber
+     * @param {number=} columnNumber
+     * @param {string=} classes
+     */
     linkifyLocation: function(sourceURL, lineNumber, columnNumber, classes)
     {
         var linkText = WebInspector.formatLinkText(sourceURL, lineNumber);
@@ -617,14 +800,21 @@ WebInspector.DebuggerPresentationModel.Linkifier.prototype = {
         this._anchorsForRawSourceCode = {};
     },
 
+    /**
+     * @param {WebInspector.Event} event
+     */
     _updateSourceAnchors: function(event)
     {
-        var rawSourceCode = event.target;
+        var rawSourceCode = /** @type {WebInspector.RawSourceCode} */ event.target;
         var anchors = this._anchorsForRawSourceCode[rawSourceCode.id];
         for (var i = 0; i < anchors.length; ++i)
             this._updateAnchor(rawSourceCode, anchors[i]);
     },
 
+    /**
+     * @param {WebInspector.RawSourceCode} rawSourceCode
+     * @param {Element} anchor
+     */
     _updateAnchor: function(rawSourceCode, anchor)
     {
         var uiLocation = rawSourceCode.sourceMapping.rawLocationToUILocation(anchor.rawLocation);
index 133b2dbf70a15bcb220466384b55075a0af32875..f960dd96ff042db7bfc6147139b2994de0344ed3 100644 (file)
@@ -91,7 +91,7 @@ WebInspector.ElementsPanel = function()
     this.sidebarResizeElement.addEventListener("mousedown", this.rightSidebarResizerDragStart.bind(this), false);
 
     this.nodeSearchButton = new WebInspector.StatusBarButton(WebInspector.UIString("Select an element in the page to inspect it."), "node-search-status-bar-item");
-    this.nodeSearchButton.addEventListener("click", this.toggleSearchingForNode.bind(this), false);
+    this.nodeSearchButton.addEventListener("click", this.toggleSearchingForNode, this);
 
     this.element.appendChild(this.contentElement);
     this.element.appendChild(this.sidebarElement);
@@ -194,6 +194,7 @@ WebInspector.ElementsPanel.prototype = {
             this.sidebarPanes.domBreakpoints.restoreBreakpoints();
 
         /**
+         * @this {WebInspector.ElementsPanel}
          * @param {WebInspector.DOMNode=} candidateFocusNode
          */
         function selectNode(candidateFocusNode)
@@ -215,7 +216,7 @@ WebInspector.ElementsPanel.prototype = {
                 // Focused node has been explicitly set while reaching out for the last selected node.
                 return;
             }
-            var node = nodeId ? WebInspector.domAgent.nodeForId(nodeId) : 0;
+            var node = nodeId ? WebInspector.domAgent.nodeForId(nodeId) : null;
             selectNode.call(this, node);
         }
 
@@ -389,6 +390,9 @@ WebInspector.ElementsPanel.prototype = {
         return this.treeOutline.selectedDOMNode();
     },
 
+    /**
+     * @param {boolean=} focus
+     */
     selectDOMNode: function(node, focus)
     {
         this.treeOutline.selectDOMNode(node, focus);
index 8f42f046dfa95bbb72816054dd16ad24350febbb..1bd4cc355ef3f15710678bdc766c1cd755e53974 100644 (file)
@@ -624,14 +624,14 @@ WebInspector.NetworkLogView.prototype = {
     _createStatusbarButtons: function()
     {
         this._preserveLogToggle = new WebInspector.StatusBarButton(WebInspector.UIString("Preserve Log upon Navigation"), "record-profile-status-bar-item");
-        this._preserveLogToggle.addEventListener("click", this._onPreserveLogClicked.bind(this), false);
+        this._preserveLogToggle.addEventListener("click", this._onPreserveLogClicked, this);
 
         this._clearButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear"), "clear-status-bar-item");
-        this._clearButton.addEventListener("click", this._reset.bind(this), false);
+        this._clearButton.addEventListener("click", this._reset, this);
 
         this._largerResourcesButton = new WebInspector.StatusBarButton(WebInspector.UIString("Use small resource rows."), "network-larger-resources-status-bar-item");
         this._largerResourcesButton.toggled = WebInspector.settings.resourcesLargeRows.get();
-        this._largerResourcesButton.addEventListener("click", this._toggleLargerResources.bind(this), false);
+        this._largerResourcesButton.addEventListener("click", this._toggleLargerResources, this);
     },
 
     _onLoadEventFired: function(event)
index 7b0795e345525c340fa5746dacf3ad511a07f720..627dccddf2a0edc66fc46895b8733921a225aad6 100644 (file)
@@ -30,6 +30,11 @@ WebInspector.Object = function() {
 }
 
 WebInspector.Object.prototype = {
+    /**
+     * @param {string} eventType
+     * @param {function(WebInspector.Event)} listener
+     * @param {Object=} thisObject
+     */
     addEventListener: function(eventType, listener, thisObject)
     {
         if (!this._listeners)
@@ -39,6 +44,11 @@ WebInspector.Object.prototype = {
         this._listeners[eventType].push({ thisObject: thisObject, listener: listener });
     },
 
+    /**
+     * @param {string} eventType
+     * @param {function(WebInspector.Event)} listener
+     * @param {Object=} thisObject
+     */
     removeEventListener: function(eventType, listener, thisObject)
     {
         if (!this._listeners || !this._listeners[eventType])
@@ -60,6 +70,10 @@ WebInspector.Object.prototype = {
         delete this._listeners;
     },
 
+    /**
+     * @param {string} eventType
+     * @return {boolean}
+     */
     hasEventListeners: function(eventType)
     {
         if (!this._listeners || !this._listeners[eventType])
@@ -68,6 +82,7 @@ WebInspector.Object.prototype = {
     },
 
     /**
+     * @param {string} eventType
      * @param {*=} eventData
      */
     dispatchEventToListeners: function(eventType, eventData)
@@ -75,26 +90,11 @@ WebInspector.Object.prototype = {
         if (!this._listeners || !this._listeners[eventType])
             return;
 
-        var stoppedPropagation = false;
-
-        function stopPropagation()
-        {
-            stoppedPropagation = true;
-        }
-
-        function preventDefault()
-        {
-            this.defaultPrevented = true;
-        }
-
-        var event = {target: this, type: eventType, data: eventData, defaultPrevented: false};
-        event.stopPropagation = stopPropagation;
-        event.preventDefault = preventDefault;
-
+        var event = new WebInspector.Event(this, eventType, eventData);
         var listeners = this._listeners[eventType].slice(0);
         for (var i = 0; i < listeners.length; ++i) {
             listeners[i].listener.call(listeners[i].thisObject, event);
-            if (stoppedPropagation)
+            if (event._stoppedPropagation)
                 break;
         }
 
@@ -102,4 +102,31 @@ WebInspector.Object.prototype = {
     }
 }
 
+/**
+ * @constructor
+ * @param {WebInspector.Object} target
+ * @param {string} type
+ * @param {*=} data
+ */
+WebInspector.Event = function(target, type, data)
+{
+    this.target = target;
+    this.type = type;
+    this.data = data;
+    this.defaultPrevented = false;
+    this._stoppedPropagation = false;
+}
+
+WebInspector.Event.prototype = {
+    stopPropagation: function()
+    {
+        this._stoppedPropagation = true;
+    },
+
+    preventDefault: function()
+    {
+        this.defaultPrevented = true;
+    }
+}
+
 WebInspector.notifications = new WebInspector.Object();
index 1f3756ecea62a9ed25f04d08c9c06783ee8b8c91..f395b43dae51de54515b756c9c53e98bd39d8560 100644 (file)
 /**
  * @constructor
  * @extends {WebInspector.Object}
+ * @param {string} id
+ * @param {WebInspector.Script} script
+ * @param {WebInspector.Resource} resource
+ * @param {WebInspector.ScriptFormatter} formatter
+ * @param {boolean} formatted
  */
 WebInspector.RawSourceCode = function(id, script, resource, formatter, formatted)
 {
@@ -59,17 +64,26 @@ WebInspector.RawSourceCode.Events = {
 }
 
 WebInspector.RawSourceCode.prototype = {
+    /**
+     * @param {WebInspector.Script} script
+     */
     addScript: function(script)
     {
         this._scripts.push(script);
         this._hasNewScripts = true;
     },
 
+    /**
+     * @return {WebInspector.RawSourceCode.SourceMapping}
+     */
     get sourceMapping()
     {
         return this._sourceMapping;
     },
 
+    /**
+     * @param {boolean} formatted
+     */
     setFormatted: function(formatted)
     {
         if (this._formatted === formatted)
@@ -78,6 +92,9 @@ WebInspector.RawSourceCode.prototype = {
         this._updateSourceMapping();
     },
 
+    /**
+     * @param {number} provider Should assign proper type upon first use
+     */
     setCompilerSourceMappingProvider: function(provider)
     {
         if (provider)
@@ -94,6 +111,11 @@ WebInspector.RawSourceCode.prototype = {
         this._updateSourceMapping();
     },
 
+    /**
+     * @param {number} lineNumber
+     * @param {number} columnNumber
+     * @return {WebInspector.Script}
+     */
     _scriptForRawLocation: function(lineNumber, columnNumber)
     {
         var closestScript = this._scripts[0];
@@ -108,6 +130,9 @@ WebInspector.RawSourceCode.prototype = {
         return closestScript;
     },
 
+    /**
+     * @param {WebInspector.Script} script
+     */
     forceUpdateSourceMapping: function(script)
     {
         if (!this._useTemporaryContent || !this._hasNewScripts)
@@ -127,6 +152,10 @@ WebInspector.RawSourceCode.prototype = {
 
         this._createSourceMapping(didCreateSourceMapping.bind(this));
 
+        /**
+         * @this {WebInspector.RawSourceCode}
+         * @param {WebInspector.RawSourceCode.SourceMapping} sourceMapping
+         */
         function didCreateSourceMapping(sourceMapping)
         {
             this._updatingSourceMapping = false;
@@ -146,9 +175,16 @@ WebInspector.RawSourceCode.prototype = {
         return new WebInspector.ConcatenatedScriptsContentProvider(this._scripts);
     },
 
+    /**
+     * @param {function(WebInspector.RawSourceCode.SourceMapping)} callback
+     */
     _createSourceMapping: function(callback)
     {
         if (this._compilerSourceMappingProvider) {
+            /**
+             * @this {WebInspector.RawSourceCode}
+             * @param {WebInspector.CompilerSourceMapping} compilerSourceMapping
+             */
             function didLoadSourceMapping(compilerSourceMapping)
             {
                 var uiSourceCodeList = [];
@@ -174,8 +210,18 @@ WebInspector.RawSourceCode.prototype = {
             return;
         }
 
+        /**
+         * @this {WebInspector.RawSourceCode}
+         * @param {string} mimeType
+         * @param {string} content
+         */
         function didRequestContent(mimeType, content)
         {
+            /**
+             * @this {WebInspector.RawSourceCode}
+             * @param {string} formattedContent
+             * @param {WebInspector.FormattedSourceMapping} mapping
+             */
             function didFormatContent(formattedContent, mapping)
             {
                 var contentProvider = new WebInspector.StaticContentProvider(mimeType, formattedContent)
@@ -188,6 +234,9 @@ WebInspector.RawSourceCode.prototype = {
         originalContentProvider.requestContent(didRequestContent.bind(this));
     },
 
+    /**
+     * @param {WebInspector.RawSourceCode.SourceMapping} sourceMapping
+     */
     _saveSourceMapping: function(sourceMapping)
     {
         var oldSourceMapping;
@@ -200,9 +249,33 @@ WebInspector.RawSourceCode.prototype = {
 
 WebInspector.RawSourceCode.prototype.__proto__ = WebInspector.Object.prototype;
 
+/**
+ * @interface
+ */
+WebInspector.RawSourceCode.SourceMapping = function()
+{
+}
+
+WebInspector.RawSourceCode.SourceMapping.prototype = {
+    /**
+     * @param {DebuggerAgent.Location} rawLocation
+     * @return {WebInspector.UILocation}
+     */
+    rawLocationToUILocation: function(rawLocation) { },
+
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     * @return {DebuggerAgent.Location}
+     */
+    uiLocationToRawLocation: function(uiSourceCode, lineNumber) { }
+}
 
 /**
  * @constructor
+ * @implements {WebInspector.RawSourceCode.SourceMapping}
+ * @param {WebInspector.RawSourceCode} rawSourceCode
+ * @param {WebInspector.UISourceCode} uiSourceCode
  */
 WebInspector.RawSourceCode.PlainSourceMapping = function(rawSourceCode, uiSourceCode)
 {
@@ -211,19 +284,31 @@ WebInspector.RawSourceCode.PlainSourceMapping = function(rawSourceCode, uiSource
 }
 
 WebInspector.RawSourceCode.PlainSourceMapping.prototype = {
+    /**
+     * @param {DebuggerAgent.Location} rawLocation
+     * @return {WebInspector.UILocation}
+     */
     rawLocationToUILocation: function(rawLocation)
     {
-        return new WebInspector.UILocation(this._uiSourceCodeList[0], rawLocation.lineNumber, rawLocation.columnNumber);
+        return new WebInspector.UILocation(this._uiSourceCodeList[0], rawLocation.lineNumber, rawLocation.columnNumber || 0);
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     * @return {DebuggerAgent.Location}
+     */
     uiLocationToRawLocation: function(uiSourceCode, lineNumber)
     {
         console.assert(uiSourceCode === this._uiSourceCodeList[0]);
         var rawLocation = { lineNumber: lineNumber, columnNumber: 0 };
         rawLocation.scriptId = this._rawSourceCode._scriptForRawLocation(rawLocation.lineNumber, rawLocation.columnNumber).scriptId;
-        return rawLocation;
+        return /** @type {DebuggerAgent.Location} */ rawLocation;
     },
 
+    /**
+     * @return {Array.<WebInspector.UISourceCode>}
+     */
     uiSourceCodeList: function()
     {
         return this._uiSourceCodeList;
@@ -232,6 +317,10 @@ WebInspector.RawSourceCode.PlainSourceMapping.prototype = {
 
 /**
  * @constructor
+ * @implements {WebInspector.RawSourceCode.SourceMapping}
+ * @param {WebInspector.RawSourceCode} rawSourceCode
+ * @param {WebInspector.UISourceCode} uiSourceCode
+ * @param {WebInspector.FormattedSourceMapping} mapping
  */
 WebInspector.RawSourceCode.FormattedSourceMapping = function(rawSourceCode, uiSourceCode, mapping)
 {
@@ -241,12 +330,20 @@ WebInspector.RawSourceCode.FormattedSourceMapping = function(rawSourceCode, uiSo
 }
 
 WebInspector.RawSourceCode.FormattedSourceMapping.prototype = {
+    /**
+     * @param {DebuggerAgent.Location} rawLocation
+     */
     rawLocationToUILocation: function(rawLocation)
     {
         var location = this._mapping.originalToFormatted(rawLocation);
-        return new WebInspector.UILocation(this._uiSourceCodeList[0], location.lineNumber, location.columnNumber);
+        return new WebInspector.UILocation(this._uiSourceCodeList[0], location.lineNumber, location.columnNumber || 0);
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     * @return {DebuggerAgent.Location}
+     */
     uiLocationToRawLocation: function(uiSourceCode, lineNumber)
     {
         console.assert(uiSourceCode === this._uiSourceCodeList[0]);
@@ -255,6 +352,9 @@ WebInspector.RawSourceCode.FormattedSourceMapping.prototype = {
         return rawLocation;
     },
 
+    /**
+     * @return {Array.<WebInspector.UISourceCode>}
+     */
     uiSourceCodeList: function()
     {
         return this._uiSourceCodeList;
@@ -263,6 +363,10 @@ WebInspector.RawSourceCode.FormattedSourceMapping.prototype = {
 
 /**
  * @constructor
+ * @implements {WebInspector.RawSourceCode.SourceMapping}
+ * @param {WebInspector.RawSourceCode} rawSourceCode
+ * @param {Array.<WebInspector.UISourceCode>} uiSourceCodeList
+ * @param {WebInspector.CompilerSourceMapping} mapping
  */
 WebInspector.RawSourceCode.CompilerSourceMapping = function(rawSourceCode, uiSourceCodeList, mapping)
 {
@@ -275,20 +379,31 @@ WebInspector.RawSourceCode.CompilerSourceMapping = function(rawSourceCode, uiSou
 }
 
 WebInspector.RawSourceCode.CompilerSourceMapping.prototype = {
+    /**
+     * @param {DebuggerAgent.Location} rawLocation
+     */
     rawLocationToUILocation: function(rawLocation)
     {
-        var location = this._mapping.compiledLocationToSourceLocation(rawLocation.lineNumber, rawLocation.columnNumber);
+        var location = this._mapping.compiledLocationToSourceLocation(rawLocation.lineNumber, rawLocation.columnNumber || 0);
         var uiSourceCode = this._uiSourceCodeByURL[location.sourceURL];
         return new WebInspector.UILocation(uiSourceCode, location.lineNumber, location.columnNumber);
     },
 
+    /**
+     * @param {WebInspector.UISourceCode} uiSourceCode
+     * @param {number} lineNumber
+     * @return {DebuggerAgent.Location}
+     */
     uiLocationToRawLocation: function(uiSourceCode, lineNumber)
     {
-        var rawLocation = this._mapping.sourceLocationToCompiledLocation(uiSourceCode.url, lineNumber);
+        var rawLocation = this._mapping.sourceLocationToCompiledLocation(uiSourceCode.url, lineNumber, 0);
         rawLocation.scriptId = this._rawSourceCode._scriptForRawLocation(rawLocation.lineNumber, rawLocation.columnNumber).scriptId;
-        return rawLocation;
+        return /** @type {DebuggerAgent.Location} */ rawLocation;
     },
 
+    /**
+     * @return {Array.<WebInspector.UISourceCode>}
+     */
     get uiSourceCodeList()
     {
         return this._uiSourceCodeList;
@@ -297,6 +412,9 @@ WebInspector.RawSourceCode.CompilerSourceMapping.prototype = {
 
 /**
  * @constructor
+ * @param {WebInspector.UISourceCode} uiSourceCode
+ * @param {number} lineNumber
+ * @param {number} columnNumber
  */
 WebInspector.UILocation = function(uiSourceCode, lineNumber, columnNumber)
 {
index 8e857fac5bdb71d8dd4eeb7e2f8c270b51a2f8d0..93ad881288457fc7ca67e2b780ba67a5d6744e14 100644 (file)
 
 /**
  * @constructor
+ * @param {?string} scriptId
+ * @param {string} sourceURL
+ * @param {number} startLine
+ * @param {number} startColumn
+ * @param {number} endLine
+ * @param {number} endColumn
+ * @param {boolean} isContentScript
  */
-WebInspector.Script = function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, errorLine, errorMessage, isContentScript)
+WebInspector.Script = function(scriptId, sourceURL, startLine, startColumn, endLine, endColumn, isContentScript)
 {
     this.scriptId = scriptId;
     this.sourceURL = sourceURL;
@@ -34,12 +41,13 @@ WebInspector.Script = function(scriptId, sourceURL, startLine, startColumn, endL
     this.columnOffset = startColumn;
     this.endLine = endLine;
     this.endColumn = endColumn;
-    this.errorLine = errorLine;
-    this.errorMessage = errorMessage;
     this.isContentScript = isContentScript;
 }
 
 WebInspector.Script.prototype = {
+    /**
+     * @param {function(string)} callback
+     */
     requestSource: function(callback)
     {
         if (this._source) {
@@ -47,16 +55,34 @@ WebInspector.Script.prototype = {
             return;
         }
 
+        /**
+         * @this {WebInspector.Script}
+         * @param {?Protocol.Error} error
+         * @param {string} source
+         */
         function didGetScriptSource(error, source)
         {
             this._source = error ? "" : source;
             callback(this._source);
         }
-        DebuggerAgent.getScriptSource(this.scriptId, didGetScriptSource.bind(this));
+        if (this.scriptId) {
+            // Script failed to parse.
+            DebuggerAgent.getScriptSource(this.scriptId, didGetScriptSource.bind(this));
+        } else
+            callback("");
     },
 
+    /**
+     * @param {string} query
+     * @param {function(Array.<PageAgent.SearchMatch>)} callback
+     */
     searchInContent: function(query, callback)
     {
+        /**
+         * @this {WebInspector.Script}
+         * @param {?Protocol.Error} error
+         * @param {Array.<PageAgent.SearchMatch>} searchMatches
+         */
         function innerCallback(error, searchMatches)
         {
             if (error)
@@ -64,17 +90,34 @@ WebInspector.Script.prototype = {
             callback(searchMatches || []);
         }
         
-        DebuggerAgent.searchInContent(this.scriptId, query, innerCallback.bind(this));
+        if (this.scriptId) {
+            // Script failed to parse.
+            DebuggerAgent.searchInContent(this.scriptId, query, innerCallback.bind(this));
+        } else
+            callback([]);
     },
     
+    /**
+     * @param {string} newSource
+     * @param {function(?Protocol.Error, Array.<DebuggerAgent.CallFrame>=)} callback
+     */
     editSource: function(newSource, callback)
     {
+        /**
+         * @this {WebInspector.Script}
+         * @param {?Protocol.Error} error
+         * @param {Array.<DebuggerAgent.CallFrame>|undefined} callFrames
+         */
         function didEditScriptSource(error, callFrames)
         {
             if (!error)
                 this._source = newSource;
             callback(error, callFrames);
         }
-        DebuggerAgent.setScriptSource(this.scriptId, newSource, undefined, didEditScriptSource.bind(this));
+        if (this.scriptId) {
+            // Script failed to parse.
+            DebuggerAgent.setScriptSource(this.scriptId, newSource, undefined, didEditScriptSource.bind(this));
+        } else
+            callback("Script failed to parse");
     }
 }
index 55cdbb604ef4d81626fc1b65163af7b7d0d5834e..1ba271cf1891cacff7b33dbf97c5e7f235610930 100644 (file)
@@ -83,7 +83,7 @@ WebInspector.ScriptsPanel = function(presentationModel)
 
     this.toggleBreakpointsButton = new WebInspector.StatusBarButton(WebInspector.UIString("Deactivate all breakpoints."), "toggle-breakpoints");
     this.toggleBreakpointsButton.toggled = true;
-    this.toggleBreakpointsButton.addEventListener("click", this._toggleBreakpointsClicked.bind(this), false);
+    this.toggleBreakpointsButton.addEventListener("click", this._toggleBreakpointsClicked, this);
     this.sidebarButtonsElement.appendChild(this.toggleBreakpointsButton.element);
 
     this.debuggerStatusElement = document.createElement("div");
@@ -148,16 +148,16 @@ WebInspector.ScriptsPanel = function(presentationModel)
     this.element.appendChild(this.sidebarResizeElement);
 
     this.enableToggleButton = new WebInspector.StatusBarButton("", "enable-toggle-status-bar-item");
-    this.enableToggleButton.addEventListener("click", this._toggleDebugging.bind(this), false);
+    this.enableToggleButton.addEventListener("click", this._toggleDebugging, this);
     if (Preferences.debuggerAlwaysEnabled)
         this.enableToggleButton.element.addStyleClass("hidden");
 
     this._pauseOnExceptionButton = new WebInspector.StatusBarButton("", "scripts-pause-on-exceptions-status-bar-item", 3);
-    this._pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions.bind(this), false);
+    this._pauseOnExceptionButton.addEventListener("click", this._togglePauseOnExceptions, this);
 
     this._toggleFormatSourceButton = new WebInspector.StatusBarButton(WebInspector.UIString("Pretty print"), "scripts-toggle-pretty-print-status-bar-item");
     this._toggleFormatSourceButton.toggled = false;
-    this._toggleFormatSourceButton.addEventListener("click", this._toggleFormatSource.bind(this), false);
+    this._toggleFormatSourceButton.addEventListener("click", this._toggleFormatSource, this);
 
     this._scriptViewStatusBarItemsContainer = document.createElement("div");
     this._scriptViewStatusBarItemsContainer.style.display = "inline-block";
@@ -446,13 +446,23 @@ WebInspector.ScriptsPanel.prototype = {
         this.sidebarPanes.jsBreakpoints.removeBreakpoint(breakpoint.uiSourceCode, breakpoint.lineNumber);
     },
 
+    /**
+     * @param {function(?WebInspector.RemoteObject, boolean, RuntimeAgent.RemoteObject=)} callback
+     */
     evaluateInSelectedCallFrame: function(code, objectGroup, includeCommandLineAPI, returnByValue, callback)
     {
-        function didEvaluate()
+        /**
+         * @param {?RuntimeAgent.RemoteObject} result
+         * @param {boolean} wasThrown
+         */
+        function didEvaluate(result, wasThrown)
         {
             if (objectGroup === "console")
                 this.sidebarPanes.scopechain.update(this._presentationModel.selectedCallFrame);
-            callback.apply(null, arguments);
+            if (returnByValue)
+                callback(null, wasThrown, wasThrown ? null : result);
+            else
+                callback(WebInspector.RemoteObject.fromPayload(result), wasThrown);
         }
         var selectedCallFrame = this._presentationModel.selectedCallFrame;
         selectedCallFrame.evaluate(code, objectGroup, includeCommandLineAPI, returnByValue, didEvaluate.bind(this));
index 6a7aa2dee5c78a117773e3baa53cea3a565d44fc..a8a12c337b65131083ba9116d27941f143d809e0 100644 (file)
@@ -231,16 +231,16 @@ WebInspector.TimelinePanel.prototype = {
     _createStatusbarButtons: function()
     {
         this.toggleTimelineButton = new WebInspector.StatusBarButton(WebInspector.UIString("Record"), "record-profile-status-bar-item");
-        this.toggleTimelineButton.addEventListener("click", this._toggleTimelineButtonClicked.bind(this), false);
+        this.toggleTimelineButton.addEventListener("click", this._toggleTimelineButtonClicked, this);
 
         this.clearButton = new WebInspector.StatusBarButton(WebInspector.UIString("Clear"), "clear-status-bar-item");
-        this.clearButton.addEventListener("click", this._clearPanel.bind(this), false);
+        this.clearButton.addEventListener("click", this._clearPanel, this);
 
         this.toggleFilterButton = new WebInspector.StatusBarButton(this._hideShortRecordsTitleText, "timeline-filter-status-bar-item");
-        this.toggleFilterButton.addEventListener("click", this._toggleFilterButtonClicked.bind(this), false);
+        this.toggleFilterButton.addEventListener("click", this._toggleFilterButtonClicked, this);
 
         this.garbageCollectButton = new WebInspector.StatusBarButton(WebInspector.UIString("Collect Garbage"), "garbage-collect-status-bar-item");
-        this.garbageCollectButton.addEventListener("click", this._garbageCollectButtonClicked.bind(this), false);
+        this.garbageCollectButton.addEventListener("click", this._garbageCollectButtonClicked, this);
 
         this.recordsCounter = document.createElement("span");
         this.recordsCounter.className = "timeline-records-counter";
index d2f14d4d18cbd551627f76ec283d42c3fb31e208..3a8fb67d6bb712e0958cc91c57909cc67069f965 100644 (file)
 /**
  * @constructor
  * @extends {WebInspector.Object}
+ * @param {string} id
+ * @param {string} url
+ * @param {boolean} isContentScript
+ * @param {WebInspector.RawSourceCode} rawSourceCode
+ * @param {WebInspector.ContentProvider} contentProvider
  */
 WebInspector.UISourceCode = function(id, url, isContentScript, rawSourceCode, contentProvider)
 {
@@ -39,6 +44,9 @@ WebInspector.UISourceCode = function(id, url, isContentScript, rawSourceCode, co
     this._isContentScript = isContentScript;
     this._rawSourceCode = rawSourceCode;
     this._contentProvider = contentProvider;
+    /**
+     * @type Array.<function(string,string)>
+     */
     this._requestContentCallbacks = [];
 }
 
@@ -47,26 +55,41 @@ WebInspector.UISourceCode.Events = {
 }
 
 WebInspector.UISourceCode.prototype = {
+    /**
+     * @return {string}
+     */
     get id()
     {
         return this._id;
     },
 
+    /**
+     * @return {string}
+     */
     get url()
     {
         return this._url;
     },
 
+    /**
+     * @return {boolean}
+     */
     get isContentScript()
     {
         return this._isContentScript;
     },
 
+    /**
+     * @return {WebInspector.RawSourceCode}
+     */
     get rawSourceCode()
     {
         return this._rawSourceCode;
     },
 
+    /**
+     * @param {function(string,string)} callback
+     */
     requestContent: function(callback)
     {
         if (this._contentLoaded) {
@@ -79,6 +102,9 @@ WebInspector.UISourceCode.prototype = {
             this._contentProvider.requestContent(this._didRequestContent.bind(this));
     },
 
+    /**
+     * @param {string} newContent
+     */
     contentChanged: function(newContent)
     {
         console.assert(this._contentLoaded);
@@ -86,6 +112,10 @@ WebInspector.UISourceCode.prototype = {
         this.dispatchEventToListeners(WebInspector.UISourceCode.Events.ContentChanged);
     },
 
+    /**
+     * @param {string} mimeType
+     * @param {string} content
+     */
     _didRequestContent: function(mimeType, content)
     {
         this._contentLoaded = true;
@@ -104,6 +134,24 @@ WebInspector.UISourceCode.prototype.__proto__ = WebInspector.Object.prototype;
  */
 WebInspector.ContentProvider = function() { }
 WebInspector.ContentProvider.prototype = {
+    /**
+     * @param {function(string,string)} callback
+     */
     requestContent: function(callback) { },
+
+    /**
+     * @param {string} query
+     * @param {function(Array.<WebInspector.ContentProvider.SearchMatch>)} callback
+     */
     searchInContent: function(query, callback) { }
 }
+
+/**
+ * @constructor
+ * @param {number} lineNumber
+ * @param {string} lineContent
+ */
+WebInspector.ContentProvider.SearchMatch = function(lineNumber, lineContent) {
+    this.lineNumber = lineNumber;
+    this.lineContent = lineContent;
+}
index 2cd444a3441fbcd3cf0708ae1cfd56a45eaf238f..e03e04af5f58ae39e8b5e1e96c6172cd26500a15 100644 (file)
@@ -199,7 +199,7 @@ WebInspector.WatchExpressionsSection.prototype = {
             if (!expression)
                 continue;
 
-            WebInspector.consoleView.evalInInspectedWindow(expression, this._watchObjectGroupId, false, true, undefined, appendResult.bind(this, expression, i));
+            WebInspector.consoleView.evalInInspectedWindow(expression, this._watchObjectGroupId, false, true, false, appendResult.bind(this, expression, i));
         }
 
         if (!propertyCount) {
index 9bfeb097946a1f766331a5d5d0bb0ec96fd7cfcd..6e87c25389551b4faab96c54cd8f3521bc9700ac 100644 (file)
@@ -66,7 +66,7 @@ WebInspector.linkifyResourceAsNode = function(url, lineNumber, classes, tooltipT
 
 /**
  * @param {string} url
- * @param {number} lineNumber
+ * @param {number=} lineNumber
  */
 WebInspector.formatLinkText = function(url, lineNumber) {}
 
index a239fcae8ac806a29b20c1540cb079681eb93f37..299d9fc682450e874c7b2eed229e2542a7e6dc4b 100755 (executable)
@@ -46,6 +46,12 @@ json_api = eval(json_string)["domains"]
 
 output_file = open(output_path, "w")
 
+output_file.write("""
+var Protocol = {};
+/** @typedef {string}*/
+Protocol.Error;
+""")
+
 type_traits = {
     "any": "*",
     "string": "string",
@@ -122,7 +128,7 @@ for domain in json_api:
                     else:
                         params.append(in_param["name"])
                         output_file.write(" * @param {%s} %s\n" % (param_type(domain_name, in_param), in_param["name"]))
-            returns = []
+            returns = ["?Protocol.Error"]
             if ("returns" in command):
                 for out_param in command["returns"]:
                     if ("optional" in out_param):