Title: [201620] trunk/Source/WebInspectorUI
Revision
201620
Author
[email protected]
Date
2016-06-02 15:11:54 -0700 (Thu, 02 Jun 2016)

Log Message

Web Inspector: Modernize some function expressions that bind(this) to arrow functions
https://bugs.webkit.org/show_bug.cgi?id=158315

Patch by Joseph Pecoraro <[email protected]> on 2016-06-02
Reviewed by Brian Burg.

Convert a common "function(x) { ... }.bind(this)" pattern to use arrow
functions "(x) => { ... }", which lexically binds `this`, slightly faster,
and uses less memory.

* UserInterface/Base/Main.js:
(WebInspector._updateNewTabButtonState):
* UserInterface/Controllers/BreakpointPopoverController.js:
(WebInspector.BreakpointPopoverController.prototype._createPopoverContent):
* UserInterface/Controllers/TypeTokenAnnotator.js:
(WebInspector.TypeTokenAnnotator.prototype.insertAnnotations):
(WebInspector.TypeTokenAnnotator.prototype.insertAnnotations.): Deleted.
* UserInterface/Models/RenderingFrameTimelineRecord.js:
(WebInspector.RenderingFrameTimelineRecord.prototype._calculateDurationRemainder):
(WebInspector.RenderingFrameTimelineRecord):
* UserInterface/Models/Resource.js:
(WebInspector.Resource.prototype.requestContent):
* UserInterface/Models/Script.js:
(WebInspector.Script.prototype.requestScriptSyntaxTree):
(WebInspector.Script.prototype.requestScriptSyntaxTree.makeSyntaxTreeAndCallCallback): Deleted.
* UserInterface/Models/SourceCodeLocation.js:
(WebInspector.SourceCodeLocation.prototype.populateLiveDisplayLocationString):
* UserInterface/Models/WrappedPromise.js:
(WebInspector.WrappedPromise):
* UserInterface/Views/BreakpointActionView.js:
(WebInspector.BreakpointActionView.prototype._updateBody):
* UserInterface/Views/BreakpointTreeElement.js:
(WebInspector.BreakpointTreeElement.prototype._dataUpdated):
* UserInterface/Views/CSSStyleDeclarationTextEditor.js:
(WebInspector.CSSStyleDeclarationTextEditor.prototype._updateTextMarkers.update):
(WebInspector.CSSStyleDeclarationTextEditor.prototype._updateTextMarkers):
* UserInterface/Views/DefaultDashboardView.js:
(WebInspector.DefaultDashboardView.prototype._appendElementForNamedItem.set item):
(WebInspector.DefaultDashboardView.prototype._appendElementForNamedItem):
* UserInterface/Views/ErrorObjectView.js:
(WebInspector.ErrorObjectView.prototype.update):
* UserInterface/Views/GeneralTreeElement.js:
(WebInspector.GeneralTreeElement.prototype.onattach):
(WebInspector.GeneralTreeElement.prototype.onattach.this._boundContextMenuEventHandler): Deleted.
* UserInterface/Views/InlineSwatch.js:
(WebInspector.InlineSwatch.prototype._getNextValidHEXFormat):
(WebInspector.InlineSwatch):
* UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
(WebInspector.LayerTreeDetailsSidebarPanel.prototype.refresh):
(WebInspector.LayerTreeDetailsSidebarPanel.prototype._showPopoverForSelectedNode):
(WebInspector.LayerTreeDetailsSidebarPanel.prototype._contentForPopover):
* UserInterface/Views/LogContentView.js:
(WebInspector.LogContentView.prototype._mouseup):
* UserInterface/Views/NavigationSidebarPanel.js:
(WebInspector.NavigationSidebarPanel.prototype._checkElementsForPendingViewStateCookie):
* UserInterface/Views/ObjectTreeBaseTreeElement.js:
(WebInspector.ObjectTreeBaseTreeElement.prototype.createGetterElement):
(WebInspector.ObjectTreeBaseTreeElement.prototype.createGetterElement.): Deleted.
* UserInterface/Views/ObjectTreePropertyTreeElement.js:
(WebInspector.ObjectTreePropertyTreeElement.prototype._updateEntries):
* UserInterface/Views/ObjectTreeView.js:
(WebInspector.ObjectTreeView.prototype._updateEntries):
* UserInterface/Views/ResourceDetailsSidebarPanel.js:
(WebInspector.ResourceDetailsSidebarPanel.prototype._refreshImageSizeSection):
* UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
(WebInspector.ScopeChainDetailsSidebarPanel.prototype._addWatchExpressionButtonClicked):
(WebInspector.ScopeChainDetailsSidebarPanel.prototype._objectTreeElementAddContextMenuItems):
(WebInspector.ScopeChainDetailsSidebarPanel.prototype._addWatchExpressionButtonClicked.this._codeMirror.addKeyMap): Deleted.
* UserInterface/Views/TabBar.js:
* UserInterface/Views/VisualStylePropertyEditor.js:
(WebInspector.VisualStylePropertyEditor.prototype._checkDependencies):

Modified Paths

Diff

Modified: trunk/Source/WebInspectorUI/ChangeLog (201619 => 201620)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-06-02 22:11:54 UTC (rev 201620)
@@ -1,3 +1,76 @@
+2016-06-02  Joseph Pecoraro  <[email protected]>
+
+        Web Inspector: Modernize some function expressions that bind(this) to arrow functions
+        https://bugs.webkit.org/show_bug.cgi?id=158315
+
+        Reviewed by Brian Burg.
+
+        Convert a common "function(x) { ... }.bind(this)" pattern to use arrow
+        functions "(x) => { ... }", which lexically binds `this`, slightly faster,
+        and uses less memory.
+
+        * UserInterface/Base/Main.js:
+        (WebInspector._updateNewTabButtonState):
+        * UserInterface/Controllers/BreakpointPopoverController.js:
+        (WebInspector.BreakpointPopoverController.prototype._createPopoverContent):
+        * UserInterface/Controllers/TypeTokenAnnotator.js:
+        (WebInspector.TypeTokenAnnotator.prototype.insertAnnotations):
+        (WebInspector.TypeTokenAnnotator.prototype.insertAnnotations.): Deleted.
+        * UserInterface/Models/RenderingFrameTimelineRecord.js:
+        (WebInspector.RenderingFrameTimelineRecord.prototype._calculateDurationRemainder):
+        (WebInspector.RenderingFrameTimelineRecord):
+        * UserInterface/Models/Resource.js:
+        (WebInspector.Resource.prototype.requestContent):
+        * UserInterface/Models/Script.js:
+        (WebInspector.Script.prototype.requestScriptSyntaxTree):
+        (WebInspector.Script.prototype.requestScriptSyntaxTree.makeSyntaxTreeAndCallCallback): Deleted.
+        * UserInterface/Models/SourceCodeLocation.js:
+        (WebInspector.SourceCodeLocation.prototype.populateLiveDisplayLocationString):
+        * UserInterface/Models/WrappedPromise.js:
+        (WebInspector.WrappedPromise):
+        * UserInterface/Views/BreakpointActionView.js:
+        (WebInspector.BreakpointActionView.prototype._updateBody):
+        * UserInterface/Views/BreakpointTreeElement.js:
+        (WebInspector.BreakpointTreeElement.prototype._dataUpdated):
+        * UserInterface/Views/CSSStyleDeclarationTextEditor.js:
+        (WebInspector.CSSStyleDeclarationTextEditor.prototype._updateTextMarkers.update):
+        (WebInspector.CSSStyleDeclarationTextEditor.prototype._updateTextMarkers):
+        * UserInterface/Views/DefaultDashboardView.js:
+        (WebInspector.DefaultDashboardView.prototype._appendElementForNamedItem.set item):
+        (WebInspector.DefaultDashboardView.prototype._appendElementForNamedItem):
+        * UserInterface/Views/ErrorObjectView.js:
+        (WebInspector.ErrorObjectView.prototype.update):
+        * UserInterface/Views/GeneralTreeElement.js:
+        (WebInspector.GeneralTreeElement.prototype.onattach):
+        (WebInspector.GeneralTreeElement.prototype.onattach.this._boundContextMenuEventHandler): Deleted.
+        * UserInterface/Views/InlineSwatch.js:
+        (WebInspector.InlineSwatch.prototype._getNextValidHEXFormat):
+        (WebInspector.InlineSwatch):
+        * UserInterface/Views/LayerTreeDetailsSidebarPanel.js:
+        (WebInspector.LayerTreeDetailsSidebarPanel.prototype.refresh):
+        (WebInspector.LayerTreeDetailsSidebarPanel.prototype._showPopoverForSelectedNode):
+        (WebInspector.LayerTreeDetailsSidebarPanel.prototype._contentForPopover):
+        * UserInterface/Views/LogContentView.js:
+        (WebInspector.LogContentView.prototype._mouseup):
+        * UserInterface/Views/NavigationSidebarPanel.js:
+        (WebInspector.NavigationSidebarPanel.prototype._checkElementsForPendingViewStateCookie):
+        * UserInterface/Views/ObjectTreeBaseTreeElement.js:
+        (WebInspector.ObjectTreeBaseTreeElement.prototype.createGetterElement):
+        (WebInspector.ObjectTreeBaseTreeElement.prototype.createGetterElement.): Deleted.
+        * UserInterface/Views/ObjectTreePropertyTreeElement.js:
+        (WebInspector.ObjectTreePropertyTreeElement.prototype._updateEntries):
+        * UserInterface/Views/ObjectTreeView.js:
+        (WebInspector.ObjectTreeView.prototype._updateEntries):
+        * UserInterface/Views/ResourceDetailsSidebarPanel.js:
+        (WebInspector.ResourceDetailsSidebarPanel.prototype._refreshImageSizeSection):
+        * UserInterface/Views/ScopeChainDetailsSidebarPanel.js:
+        (WebInspector.ScopeChainDetailsSidebarPanel.prototype._addWatchExpressionButtonClicked):
+        (WebInspector.ScopeChainDetailsSidebarPanel.prototype._objectTreeElementAddContextMenuItems):
+        (WebInspector.ScopeChainDetailsSidebarPanel.prototype._addWatchExpressionButtonClicked.this._codeMirror.addKeyMap): Deleted.
+        * UserInterface/Views/TabBar.js:
+        * UserInterface/Views/VisualStylePropertyEditor.js:
+        (WebInspector.VisualStylePropertyEditor.prototype._checkDependencies):
+
 2016-05-31  Nikita Vasilyev  <[email protected]>
 
         Web Inspector: Storage DataGrids have a half-pixel transparent/white border below the header

Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Main.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Main.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -522,11 +522,7 @@
 {
     let allTabs = [...this._knownTabClassesByType.values()];
     let addableTabs = allTabs.filter((tabClass) => !tabClass.isEphemeral());
-
-    // FIXME: Use arrow functions once http://webkit.org/b/152497 is resolved.
-    let canMakeNewTab = addableTabs.some(function(tabClass) {
-        return this.isNewTabWithTypeAllowed(tabClass.Type);
-    }.bind(this));
+    let canMakeNewTab = addableTabs.some((tabClass) => this.isNewTabWithTypeAllowed(tabClass.Type));
     this.tabBar.newTabItem.disabled = !canMakeNewTab;
 };
 
@@ -2368,19 +2364,19 @@
     this._downloadingPage = true;
     this._updateDownloadToolbarButton();
 
-    PageAgent.archive(function(error, data) {
+    PageAgent.archive((error, data) => {
         this._downloadingPage = false;
         this._updateDownloadToolbarButton();
 
         if (error)
             return;
 
-        var mainFrame = WebInspector.frameResourceManager.mainFrame;
-        var archiveName = mainFrame.mainResource.urlComponents.host || mainFrame.mainResource.displayName || "Archive";
-        var url = "" + encodeURI(archiveName) + ".webarchive";
+        let mainFrame = WebInspector.frameResourceManager.mainFrame;
+        let archiveName = mainFrame.mainResource.urlComponents.host || mainFrame.mainResource.displayName || "Archive";
+        let url = "" + encodeURI(archiveName) + ".webarchive";
 
         InspectorFrontendHost.save(url, data, true, true);
-    }.bind(this));
+    });
 };
 
 WebInspector.canArchiveMainFrame = function()

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/BreakpointPopoverController.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -161,10 +161,10 @@
         completionController.addExtendedCompletionProvider("_javascript_", WebInspector._javascript_RuntimeCompletionProvider);
 
         // CodeMirror needs a refresh after the popover displays, to layout, otherwise it doesn't appear.
-        setTimeout(function() {
+        setTimeout(() => {
             this._conditionCodeMirror.refresh();
             this._conditionCodeMirror.focus();
-        }.bind(this), 0);
+        }, 0);
 
         // COMPATIBILITY (iOS 7): Debugger.setBreakpoint did not support options.
         if (DebuggerAgent.setBreakpoint.supports("options")) {

Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -44,12 +44,11 @@
         var scriptSyntaxTree = this._script.scriptSyntaxTree;
 
         if (!scriptSyntaxTree) {
-            this._script.requestScriptSyntaxTree(function(syntaxTree) {
+            this._script.requestScriptSyntaxTree((syntaxTree) => {
                 // After requesting the tree, we still might get a null tree from a parse error.
                 if (syntaxTree)
                     this.insertAnnotations();
-            }.bind(this));
-
+            });
             return;
         }
 
@@ -60,20 +59,20 @@
 
         var startTime = Date.now();
         var allNodesInRange = scriptSyntaxTree.filterByRange(startOffset, endOffset);
-        scriptSyntaxTree.updateTypes(allNodesInRange, function afterTypeUpdates(nodesWithUpdatedTypes) {
+        scriptSyntaxTree.updateTypes(allNodesInRange, (nodesWithUpdatedTypes) => {
             // Because this is an asynchronous call, we could have been deactivated before the callback function is called.
             if (!this.isActive())
                 return;
 
             nodesWithUpdatedTypes.forEach(this._insertTypeToken, this);
 
-            var totalTime = Date.now() - startTime;
-            var timeoutTime = Number.constrain(8 * totalTime, 500, 2000);
-            this._timeoutIdentifier = setTimeout(function timeoutUpdate() {
+            let totalTime = Date.now() - startTime;
+            let timeoutTime = Number.constrain(8 * totalTime, 500, 2000);
+            this._timeoutIdentifier = setTimeout(() => {
                 this._timeoutIdentifier = null;
                 this.insertAnnotations();
-            }.bind(this), timeoutTime);
-        }.bind(this));
+            }, timeoutTime);
+        });
     }
 
     clearAnnotations()

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/RenderingFrameTimelineRecord.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -127,12 +127,12 @@
 
     _calculateDurationRemainder()
     {
-        return Object.keys(WebInspector.RenderingFrameTimelineRecord.TaskType).reduce(function(previousValue, key) {
-            var taskType = WebInspector.RenderingFrameTimelineRecord.TaskType[key];
+        return Object.keys(WebInspector.RenderingFrameTimelineRecord.TaskType).reduce((previousValue, key) => {
+            let taskType = WebInspector.RenderingFrameTimelineRecord.TaskType[key];
             if (taskType === WebInspector.RenderingFrameTimelineRecord.TaskType.Other)
                 return previousValue;
             return previousValue - this.durationForTask(taskType);
-        }.bind(this), this.duration);
+        }, this.duration);
     }
 };
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -650,10 +650,10 @@
             return Promise.resolve({error: WebInspector.UIString("An error occurred trying to load the resource.")});
 
         if (!this._finishThenRequestContentPromise) {
-            this._finishThenRequestContentPromise = new Promise(function (resolve, reject) {
+            this._finishThenRequestContentPromise = new Promise((resolve, reject) => {
                 this.addEventListener(WebInspector.Resource.Event.LoadingDidFinish, resolve);
                 this.addEventListener(WebInspector.Resource.Event.LoadingDidFail, reject);
-            }.bind(this)).then(WebInspector.SourceCode.prototype.requestContent.bind(this));
+            }).then(WebInspector.SourceCode.prototype.requestContent.bind(this));
         }
 
         return this._finishThenRequestContentPromise;

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Script.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Models/Script.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Script.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -217,15 +217,14 @@
     requestScriptSyntaxTree(callback)
     {
         if (this._scriptSyntaxTree) {
-            setTimeout(function() { callback(this._scriptSyntaxTree); }.bind(this), 0);
+            setTimeout(() => { callback(this._scriptSyntaxTree); }, 0);
             return;
         }
 
-        var makeSyntaxTreeAndCallCallback = function(content)
-        {
+        var makeSyntaxTreeAndCallCallback = () => {
             this._makeSyntaxTree(content);
             callback(this._scriptSyntaxTree);
-        }.bind(this);
+        };
 
         var content = this.content;
         if (!content && this._resource && this._resource.type === WebInspector.Resource.Type.Script && this._resource.finished)

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/SourceCodeLocation.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -244,10 +244,7 @@
         var boundMouseOverOrMove = mouseOverOrMove.bind(this);
         element.addEventListener("mouseover", boundMouseOverOrMove);
         element.addEventListener("mousemove", boundMouseOverOrMove);
-
-        element.addEventListener("mouseout", function(event) {
-            updateDisplayString.call(this, false);
-        }.bind(this));
+        element.addEventListener("mouseout", (event) => { updateDisplayString.call(this, false); });
     }
 
     // Protected

Modified: trunk/Source/WebInspectorUI/UserInterface/Models/WrappedPromise.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Models/WrappedPromise.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/WrappedPromise.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -27,13 +27,13 @@
 {
     constructor(work)
     {
-        this._promise = new Promise(function(resolve, reject) {
+        this._promise = new Promise((resolve, reject) => {
             this._resolve = resolve;
             this._reject = reject;
 
             if (work && typeof work === "function")
                 work();
-        }.bind(this));
+        });
     }
 
     // Public

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointActionView.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -167,11 +167,11 @@
             completionController.addExtendedCompletionProvider("_javascript_", WebInspector._javascript_RuntimeCompletionProvider);
 
             // CodeMirror needs a refresh after the popover displays, to layout, otherwise it doesn't appear.
-            setTimeout(function() {
+            setTimeout(() => {
                 this._codeMirror.refresh();
                 if (!omitFocus)
                     this._codeMirror.focus();
-            }.bind(this), 0);
+            }, 0);
 
             break;
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/BreakpointTreeElement.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -231,9 +231,9 @@
         }
 
         this.element.classList.add(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);
-        this._removeIconAnimationTimeoutIdentifier = setTimeout(function() {
+        this._removeIconAnimationTimeoutIdentifier = setTimeout(() => {
             this.element.classList.remove(WebInspector.BreakpointTreeElement.ProbeDataUpdatedStyleClassName);
-        }.bind(this), WebInspector.BreakpointTreeElement.ProbeDataUpdatedAnimationDuration);
+        }, WebInspector.BreakpointTreeElement.ProbeDataUpdatedAnimationDuration);
     }
 
     _breakpointLocationDidChange(event)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/CSSStyleDeclarationTextEditor.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -803,9 +803,9 @@
 
             if (!this._codeMirror.getOption("readOnly")) {
                 // Look for comments that look like properties and add checkboxes in front of them.
-                this._codeMirror.eachLine(function(lineHandler) {
+                this._codeMirror.eachLine((lineHandler) => {
                     this._createCommentedCheckboxMarker(lineHandler);
-                }.bind(this));
+                });
             }
 
             // Look for swatchable values and make inline swatches.

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DefaultDashboardView.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -122,9 +122,9 @@
             }
         });
 
-        item.container.addEventListener("click", function(event) {
+        item.container.addEventListener("click", (event) => {
             this._itemWasClicked(name);
-        }.bind(this));
+        });
     }
 
     _itemWasClicked(name)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ErrorObjectView.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -88,14 +88,14 @@
 
     update()
     {
-        this._object.getOwnPropertyDescriptorsAsObject(function(properties) {
+        this._object.getOwnPropertyDescriptorsAsObject((properties) => {
             console.assert(properties && properties.stack && properties.stack.value);
 
             if (!this._hasStackTrace)
                 this._buildStackTrace(properties.stack.value.value);
 
             this._hasStackTrace = true;
-        }.bind(this));
+        });
     }
 
     expand()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/GeneralTreeElement.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -215,7 +215,7 @@
         }
 
         if (!this._boundContextMenuEventHandler && this.treeOutline.oncontextmenu && typeof this.treeOutline._oncontextmenu_ === "function") {
-            this._boundContextMenuEventHandler = function(event) { this.treeOutline.oncontextmenu(event, this); }.bind(this);
+            this._boundContextMenuEventHandler = (event) => { this.treeOutline.oncontextmenu(event, this); };
             this._listItemNode.addEventListener("contextmenu", this._boundContextMenuEventHandler);
         }
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/InlineSwatch.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -254,10 +254,7 @@
             }
         ];
 
-        // FIXME: <https://webkit.org/b/152497> Arrow functions: "this" isn't lexically bound
-        let currentColorIsHEX = hexFormats.some(function(info) {
-            return info.format === this._value.format;
-        }.bind(this));
+        let currentColorIsHEX = hexFormats.some((info) => info.format === this._value.format);
 
         for (let i = 0; i < hexFormats.length; ++i) {
             if (currentColorIsHEX && this._value.format !== hexFormats[i].format)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LayerTreeDetailsSidebarPanel.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -67,10 +67,10 @@
         if (!this.domNode)
             return;
 
-        WebInspector.layerTreeManager.layersForNode(this.domNode, function(layerForNode, childLayers) {
+        WebInspector.layerTreeManager.layersForNode(this.domNode, (layerForNode, childLayers) => {
             this._unfilteredChildLayers = childLayers;
             this._updateDisplayWithLayers(layerForNode, childLayers);
-        }.bind(this));
+        });
     }
 
     // DOMDetailsSidebarPanel Overrides
@@ -318,10 +318,10 @@
         if (!dataGridNode)
             return;
 
-        this._contentForPopover(dataGridNode.layer, function(content) {
+        this._contentForPopover(dataGridNode.layer, (content) => {
             if (dataGridNode === this._dataGrid.selectedNode)
                 this._updatePopoverForSelectedNode(content);
-        }.bind(this));
+        });
     }
 
     _updatePopoverForSelectedNode(content)
@@ -357,7 +357,7 @@
 
         var list = content.appendChild(document.createElement("ul"));
 
-        WebInspector.layerTreeManager.reasonsForCompositingLayer(layer, function(compositingReasons) {
+        WebInspector.layerTreeManager.reasonsForCompositingLayer(layer, (compositingReasons) => {
             if (isEmptyObject(compositingReasons)) {
                 callback(content);
                 return;
@@ -366,7 +366,7 @@
             this._populateListOfCompositingReasons(list, compositingReasons);
 
             callback(content);
-        }.bind(this));
+        });
 
         return content;
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/LogContentView.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -444,7 +444,7 @@
             this._clearMessagesSelection();
 
             // Focus the prompt. Focusing the prompt needs to happen after the click to work.
-            setTimeout(function () { this.prompt.focus(); }.bind(this), 0);
+            setTimeout(() => { this.prompt.focus(); }, 0);
         }
 
         delete this._mouseMoveIsRowSelection;

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/NavigationSidebarPanel.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -780,9 +780,9 @@
 
             // Delay clearing the restoringState flag until the next runloop so listeners
             // checking for it in this runloop still know state was being restored.
-            setTimeout(function() {
+            setTimeout(() => {
                 this._restoringState = false;
-            }.bind(this));
+            }, 0);
 
             if (this._finalAttemptToRestoreViewStateTimeout) {
                 clearTimeout(this._finalAttemptToRestoreViewStateTimeout);

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeBaseTreeElement.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -124,17 +124,17 @@
         }
 
         getterElement.title = WebInspector.UIString("Invoke getter");
-        getterElement.addEventListener("click", function(event) {
+        getterElement.addEventListener("click", (event) => {
             event.stopPropagation();
             var lastNonPrototypeObject = this._propertyPath.lastNonPrototypeObject;
             var getterObject = this._property.get;
-            lastNonPrototypeObject.invokeGetter(getterObject, function(error, result, wasThrown) {
+            lastNonPrototypeObject.invokeGetter(getterObject, (error, result, wasThrown) => {
                 this._getterHadError = !!(error || wasThrown);
                 this._getterValue = result;
                 if (this.invokedGetter && typeof this.invokedGetter === "function")
                     this.invokedGetter();
-            }.bind(this));
-        }.bind(this));
+            });
+        });
 
         return getterElement;
     }

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreePropertyTreeElement.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -344,10 +344,10 @@
 
         // Show the prototype so users can see the API.
         var resolvedValue = this.resolvedValue();
-        resolvedValue.getOwnPropertyDescriptor("__proto__", function(propertyDescriptor) {
+        resolvedValue.getOwnPropertyDescriptor("__proto__", (propertyDescriptor) => {
             if (propertyDescriptor)
                 this.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, mode));
-        }.bind(this));
+        });
     }
 
     _updateProperties(properties, propertyPath, mode)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -279,10 +279,10 @@
         }
 
         // Show the prototype so users can see the API.
-        this._object.getOwnPropertyDescriptor("__proto__", function(propertyDescriptor) {
+        this._object.getOwnPropertyDescriptor("__proto__", (propertyDescriptor) => {
             if (propertyDescriptor)
                 this._outline.appendChild(new WebInspector.ObjectTreePropertyTreeElement(propertyDescriptor, propertyPath, this._mode));
-        }.bind(this));
+        });
     }
 
     _updateProperties(properties, propertyPath)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ResourceDetailsSidebarPanel.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -415,10 +415,10 @@
         this.contentView.element.insertBefore(this._imageSizeSection.element, this._locationSection.element);
 
         // Get the metrics for this resource and fill in the metrics rows with that information.
-        resource.getImageSize(function(size) {
+        resource.getImageSize((size) => {
             this._imageWidthRow.value = WebInspector.UIString("%dpx").format(size.width);
             this._imageHeightRow.value = WebInspector.UIString("%dpx").format(size.height);
-        }.bind(this));
+        });
     }
 
     _goToRequestDataClicked()

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/ScopeChainDetailsSidebarPanel.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -416,7 +416,7 @@
         this._popoverCommitted = false;
 
         this._codeMirror.addKeyMap({
-            "Enter": function() { this._popoverCommitted = true; popover.dismiss(); }.bind(this),
+            "Enter": () => { this._popoverCommitted = true; popover.dismiss(); },
         });
 
         let completionController = new WebInspector.CodeMirrorCompletionController(this._codeMirror);
@@ -440,11 +440,11 @@
         presentPopoverOverTargetElement();
 
         // CodeMirror needs a refresh after the popover displays, to layout, otherwise it doesn't appear.
-        setTimeout(function() {
+        setTimeout(() => {
             this._codeMirror.refresh();
             this._codeMirror.focus();
             popover.update();
-        }.bind(this), 0);
+        }, 0);
     }
 
     willDismissPopover(popover)
@@ -492,10 +492,10 @@
         if (objectTreeElement.parent !== objectTreeElement.treeOutline)
             return;
 
-        contextMenu.appendItem(WebInspector.UIString("Remove Watch _expression_"), function() {
+        contextMenu.appendItem(WebInspector.UIString("Remove Watch _expression_"), () => {
             let _expression_ = objectTreeElement.property.name;
             this._removeWatchExpression(_expression_);
-        }.bind(this));
+        });
     }
 
     _propertyPathIdentifierForTreeElement(identifier, objectPropertyTreeElement)

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/TabBar.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -96,9 +96,9 @@
 
         if (this._tabAnimatedClosedSinceMouseEnter) {
             // Delay adding the new tab until we can expand the tabs after a closed tab.
-            this._finishExpandingTabsAfterClose().then(function() {
+            this._finishExpandingTabsAfterClose().then(() => {
                 this.insertTabBarItem(tabBarItem, index, doNotAnimate);
-            }.bind(this));
+            });
             return;
         }
 

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js (201619 => 201620)


--- trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js	2016-06-02 22:01:50 UTC (rev 201619)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/VisualStylePropertyEditor.js	2016-06-02 22:11:54 UTC (rev 201620)
@@ -538,10 +538,9 @@
 
         let title = "";
 
-        // FIXME: <https://webkit.org/b/152497> Arrow functions: "this" isn't lexically bound
-        let dependencies = this._style.nodeStyles.computedStyle.properties.filter(function(property) {
+        let dependencies = this._style.nodeStyles.computedStyle.properties.filter((property) => {
             return this._dependencies.has(property.name) || this._dependencies.has(property.canonicalName);
-        }.bind(this));
+        });
 
         for (let property of dependencies) {
             let dependencyValues = this._dependencies.get(property.name);
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to