WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
Patch
bug-201082-20190827131805.patch (text/plain), 41.74 KB, created by
Devin Rousso
on 2019-08-27 13:18:06 PDT
(
hide
)
Description:
Patch
Filename:
MIME Type:
Creator:
Devin Rousso
Created:
2019-08-27 13:18:06 PDT
Size:
41.74 KB
patch
obsolete
>diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog >index 97069e07eaa17e3118839c19fed527d7aec87ab0..c168c56e4e747d22f617c5a55bb1717692675202 100644 >--- a/Source/WebInspectorUI/ChangeLog >+++ b/Source/WebInspectorUI/ChangeLog >@@ -1,3 +1,75 @@ >+2019-08-27 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: replace uses of `Array.prototype.concat` with `Array.prototype.push` >+ https://bugs.webkit.org/show_bug.cgi?id=201082 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ `x = x.concat(y)` is very slow, as `x` has to be fully copied in order to add `y` to it. >+ Introduce `Array.prototype.pushIterable`, which iterates the given `iterable` and adds each >+ item to the `this` array. >+ >+ * UserInterface/Controllers/DOMDebuggerManager.js: >+ (WI.DOMDebuggerManager.prototype.get domBreakpoints): >+ (WI.DOMDebuggerManager.prototype.domBreakpointsInSubtree): >+ * UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js: >+ (WI.JavaScriptRuntimeCompletionProvider.completionControllerCompletionsNeeded.receivedPropertyNames): >+ * UserInterface/Models/CSSCompletions.js: >+ (WI.CSSCompletions): >+ * UserInterface/Models/CSSKeywordCompletions.js: >+ (WI.CSSKeywordCompletions.forProperty): >+ (WI.CSSKeywordCompletions.forProperty.addKeywordsForName): >+ (WI.CSSKeywordCompletions.forFunction): >+ * UserInterface/Models/Canvas.js: >+ (WI.Canvas.prototype.recordingProgress): >+ * UserInterface/Models/DOMNodeStyles.js: >+ (WI.DOMNodeStyles.prototype._updateStyleCascade): >+ (WI.DOMNodeStyles.prototype._collectStylesInCascadeOrder): >+ * UserInterface/Models/TimelineRecording.js: >+ (WI.TimelineRecording.prototype.get sourceCodeTimelines): >+ (WI.TimelineRecording.prototype.initializeCallingContextTrees): >+ * UserInterface/Protocol/RemoteObject.js: >+ (WI.RemoteObject.prototype._getPropertyDescriptorsResolver): >+ * UserInterface/Views/ConsoleMessageView.js: >+ (WI.ConsoleMessageView.prototype._appendMessageTextAndArguments): >+ * UserInterface/Views/ContentBrowser.js: >+ (WI.ContentBrowser.prototype.get currentRepresentedObjects): >+ * UserInterface/Views/DOMTreeElement.js: >+ (WI.DOMTreeElement.prototype._visibleChildren): >+ * UserInterface/Views/DataGridNode.js: >+ (WI.DataGridNode.prototype.get filterableData): >+ * UserInterface/Views/HeapAllocationsTimelineView.js: >+ (WI.HeapAllocationsTimelineView.prototype.get selectionPathComponents): >+ * UserInterface/Views/IndexedDatabaseObjectStoreContentView.js: >+ (WI.IndexedDatabaseObjectStoreContentView.prototype._fetchMoreData.processEntries): >+ * UserInterface/Views/NavigationItem.js: >+ (WI.NavigationItem.prototype.get _classNames): >+ * UserInterface/Views/ObjectTreeView.js: >+ (WI.ObjectTreeView.prototype._updateProperties): >+ * UserInterface/Views/OpenResourceDialog.js: >+ (WI.OpenResourceDialog.prototype._addResourcesForFrame): >+ * UserInterface/Views/OverviewTimelineView.js: >+ (WI.OverviewTimelineView.prototype._loadExistingRecords): >+ * UserInterface/Views/ResourceCollectionContentView.js: >+ (WI.ResourceCollectionContentView.prototype.get navigationItems): >+ * UserInterface/Views/ResourceHeadersContentView.js: >+ (WI.ResourceHeadersContentView.prototype._perfomSearchOnKeyValuePairs): >+ * UserInterface/Views/ResourceSecurityContentView.js: >+ (WI.ResourceSecurityContentView.prototype._perfomSearchOnKeyValuePairs): >+ * UserInterface/Views/ScriptClusterTimelineView.js: >+ (WI.ScriptClusterTimelineView.prototype.get selectionPathComponents): >+ * UserInterface/Views/ScrubberNavigationItem.js: >+ (WI.ScrubberNavigationItem.prototype.get additionalClassNames): >+ * UserInterface/Views/SpreadsheetStyleProperty.js: >+ (WI.SpreadsheetStyleProperty.prototype._addGradientTokens): >+ (WI.SpreadsheetStyleProperty.prototype._addColorTokens.pushPossibleColorToken): >+ (WI.SpreadsheetStyleProperty.prototype._addTimingFunctionTokens): >+ (WI.SpreadsheetStyleProperty.prototype._addVariableTokens): >+ * UserInterface/Views/TreeOutline.js: >+ (WI.TreeOutline.prototype.selfOrDescendant): >+ * UserInterface/Views/View.js: >+ (WI.View._visitViewTreeForLayout): >+ > 2019-08-26 Devin Rousso <drousso@apple.com> > > Web Inspector: decrease horizontal padding of `WI.ScopeBar` to have more room >diff --git a/Source/WebInspectorUI/UserInterface/Base/Utilities.js b/Source/WebInspectorUI/UserInterface/Base/Utilities.js >index dde9eeb3ae8f41d4b12dda7ed4a4a64969fb8d84..5f80f7a073ac3f18e7d450dcd034cc5bc877e61e 100644 >--- a/Source/WebInspectorUI/UserInterface/Base/Utilities.js >+++ b/Source/WebInspectorUI/UserInterface/Base/Utilities.js >@@ -690,6 +690,15 @@ Object.defineProperty(Array.prototype, "insertAtIndex", > } > }); > >+Object.defineProperty(Array.prototype, "pushIterable", >+{ >+ value(iterable) >+ { >+ for (let item of iterable) >+ this.push(item); >+ }, >+}); >+ > Object.defineProperty(Array.prototype, "keySet", > { > value() >diff --git a/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js b/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js >index e0279457b52370e5d5b8f19ca740e8561871255c..6af24570a682834e732aeed49fccec8dd930dea9 100644 >--- a/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js >+++ b/Source/WebInspectorUI/UserInterface/Controllers/DOMDebuggerManager.js >@@ -246,11 +246,12 @@ WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object > let frames = [mainFrame]; > while (frames.length) { > let frame = frames.shift(); >+ > let domBreakpointNodeIdentifierMap = this._domBreakpointFrameIdentifierMap.get(frame.id); > if (domBreakpointNodeIdentifierMap) >- resolvedBreakpoints = resolvedBreakpoints.concat(Array.from(domBreakpointNodeIdentifierMap.values())); >+ resolvedBreakpoints.pushIterable(domBreakpointNodeIdentifierMap.values()); > >- frames.push(...frame.childFrameCollection); >+ frames.pushIterable(frame.childFrameCollection); > } > > return resolvedBreakpoints; >@@ -294,8 +295,8 @@ WI.DOMDebuggerManager = class DOMDebuggerManager extends WI.Object > while (children.length) { > let child = children.pop(); > if (child.children) >- children = children.concat(child.children); >- breakpoints = breakpoints.concat(this.domBreakpointsForNode(child)); >+ children.pushIterable(child.children); >+ breakpoints.pushIterable(this.domBreakpointsForNode(child)); > } > } > >diff --git a/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js b/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js >index d12d42b360e1e5a8d32181e0422b26649b9560e5..1758356febb2d903ea50885625832ec33be136d3 100644 >--- a/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js >+++ b/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptRuntimeCompletionProvider.js >@@ -262,7 +262,7 @@ WI.JavaScriptRuntimeCompletionProvider = class JavaScriptRuntimeCompletionProvid > WI.runtimeManager.activeExecutionContext.target.RuntimeAgent.releaseObjectGroup("completion"); > > if (!base) { >- propertyNames.push(...JavaScriptRuntimeCompletionProvider._commandLineAPIKeys); >+ propertyNames.pushIterable(JavaScriptRuntimeCompletionProvider._commandLineAPIKeys); > > let savedResultAlias = WI.settings.consoleSavedResultAlias.value; > if (savedResultAlias) >diff --git a/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js b/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js >index dc28122ddb9e981bb2664c2df468af82cd261c1d..25488e2bdfeefde931b70b9b0e30205117b77b5c 100644 >--- a/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js >+++ b/Source/WebInspectorUI/UserInterface/Models/CSSCompletions.js >@@ -42,7 +42,7 @@ WI.CSSCompletions = class CSSCompletions > // properties when initialized from the protocol for CSSCompletions.cssNameCompletions. > // Or it may just a list of strings when quickly initialized for other completion purposes. > if (properties.length && typeof properties[0] === "string") >- this._values = this._values.concat(properties); >+ this._values.pushIterable(properties); > else { > for (var property of properties) { > var propertyName = property.name; >@@ -52,7 +52,7 @@ WI.CSSCompletions = class CSSCompletions > > let aliases = property.aliases; > if (aliases) >- this._values = this._values.concat(aliases); >+ this._values.pushIterable(aliases); > > var longhands = property.longhands; > if (longhands) { >diff --git a/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js b/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js >index a536a5a84127a1e8af380fe2f987a9ecb81c476a..6993d9fb5cb82ce645f32f95adbbc33879d6e6c5 100644 >--- a/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js >+++ b/Source/WebInspectorUI/UserInterface/Models/CSSKeywordCompletions.js >@@ -39,12 +39,12 @@ WI.CSSKeywordCompletions.forProperty = function(propertyName) > let isNotPrefixed = name.charAt(0) !== "-"; > > if (name in WI.CSSKeywordCompletions._propertyKeywordMap) >- acceptedKeywords = acceptedKeywords.concat(WI.CSSKeywordCompletions._propertyKeywordMap[name]); >+ acceptedKeywords.pushIterable(WI.CSSKeywordCompletions._propertyKeywordMap[name]); > else if (isNotPrefixed && ("-webkit-" + name) in WI.CSSKeywordCompletions._propertyKeywordMap) >- acceptedKeywords = acceptedKeywords.concat(WI.CSSKeywordCompletions._propertyKeywordMap["-webkit-" + name]); >+ acceptedKeywords.pushIterable(WI.CSSKeywordCompletions._propertyKeywordMap["-webkit-" + name]); > > if (WI.CSSKeywordCompletions.isColorAwareProperty(name)) >- acceptedKeywords = acceptedKeywords.concat(WI.CSSKeywordCompletions._colors); >+ acceptedKeywords.pushIterable(WI.CSSKeywordCompletions._colors); > > // Only suggest "inherit" on inheritable properties even though it is valid on all properties. > if (WI.CSSKeywordCompletions.InheritedProperties.has(name)) >@@ -67,7 +67,7 @@ WI.CSSKeywordCompletions.forProperty = function(propertyName) > > if (acceptedKeywords.includes(WI.CSSKeywordCompletions.AllPropertyNamesPlaceholder) && WI.CSSCompletions.cssNameCompletions) { > acceptedKeywords.remove(WI.CSSKeywordCompletions.AllPropertyNamesPlaceholder); >- acceptedKeywords = acceptedKeywords.concat(WI.CSSCompletions.cssNameCompletions.values); >+ acceptedKeywords.pushIterable(WI.CSSCompletions.cssNameCompletions.values); > } > > return new WI.CSSCompletions(Array.from(new Set(acceptedKeywords)), true); >@@ -107,16 +107,16 @@ WI.CSSKeywordCompletions.forFunction = function(functionName) > if (functionName === "var") > suggestions = []; > else if (functionName === "calc" || functionName === "min" || functionName === "max") >- suggestions = suggestions.concat(["calc()", "min()", "max()"]); >+ suggestions.push("calc()", "min()", "max()"); > else if (functionName === "env") >- suggestions = suggestions.concat(["safe-area-inset-top", "safe-area-inset-right", "safe-area-inset-bottom", "safe-area-inset-left"]); >+ suggestions.push("safe-area-inset-top", "safe-area-inset-right", "safe-area-inset-bottom", "safe-area-inset-left"); > else if (functionName === "image-set") > suggestions.push("url()"); > else if (functionName === "repeat") >- suggestions = suggestions.concat(["auto", "auto-fill", "auto-fit", "min-content", "max-content"]); >+ suggestions.push("auto", "auto-fill", "auto-fit", "min-content", "max-content"); > else if (functionName.endsWith("gradient")) { >- suggestions = suggestions.concat(["to", "left", "right", "top", "bottom"]); >- suggestions = suggestions.concat(WI.CSSKeywordCompletions._colors); >+ suggestions.push("to", "left", "right", "top", "bottom"); >+ suggestions.pushIterable(WI.CSSKeywordCompletions._colors); > } > > return new WI.CSSCompletions(suggestions, true); >diff --git a/Source/WebInspectorUI/UserInterface/Models/Canvas.js b/Source/WebInspectorUI/UserInterface/Models/Canvas.js >index 7a3880fd56c7e601d1668f182e625987cacc0032..6dcb637ca173a621b384627a7f45e0f041aaf4da 100644 >--- a/Source/WebInspectorUI/UserInterface/Models/Canvas.js >+++ b/Source/WebInspectorUI/UserInterface/Models/Canvas.js >@@ -362,7 +362,7 @@ WI.Canvas = class Canvas extends WI.Object > { > // Called from WI.CanvasManager. > >- this._recordingFrames.push(...framesPayload.map(WI.RecordingFrame.fromPayload)); >+ this._recordingFrames.pushIterable(framesPayload.map(WI.RecordingFrame.fromPayload)); > > this._recordingBufferUsed = bufferUsed; > >diff --git a/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js b/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js >index 4309b6a61e3789e4cd12c672b0e293a6088d85cd..79f2e7488a5f4bc5b286c3ceadc565ea0a722f9f 100644 >--- a/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js >+++ b/Source/WebInspectorUI/UserInterface/Models/DOMNodeStyles.js >@@ -738,7 +738,7 @@ WI.DOMNodeStyles = class DOMNodeStyles extends WI.Object > for (var i = 0; i < this._inheritedRules.length; ++i) { > var inheritedStyleInfo = this._inheritedRules[i]; > var inheritedCascadeOrder = this._collectStylesInCascadeOrder(inheritedStyleInfo.matchedRules, inheritedStyleInfo.inlineStyle, null); >- cascadeOrderedStyleDeclarations = cascadeOrderedStyleDeclarations.concat(inheritedCascadeOrder); >+ cascadeOrderedStyleDeclarations.pushIterable(inheritedCascadeOrder); > } > > this._orderedStyles = cascadeOrderedStyleDeclarations; >@@ -788,7 +788,7 @@ WI.DOMNodeStyles = class DOMNodeStyles extends WI.Object > result.push(attributesStyle); > > // Finally add the user and user stylesheet's matched style rules we collected earlier. >- result = result.concat(userAndUserAgentStyles); >+ result.pushIterable(userAndUserAgentStyles); > > return result; > } >diff --git a/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js b/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js >index 873e878eef1cd296deffa41734cbea1d04f0ec1a..7b9a54a6a90f4a82943f771aae81bfdfe428f9d9 100644 >--- a/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js >+++ b/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js >@@ -272,7 +272,7 @@ WI.TimelineRecording = class TimelineRecording extends WI.Object > { > let timelines = []; > for (let timelinesForSourceCode of this._sourceCodeTimelinesMap.values()) >- timelines = timelines.concat(Array.from(timelinesForSourceCode.values())); >+ timelines.pushIterable(timelinesForSourceCode.values()); > return timelines; > } > >@@ -460,8 +460,8 @@ WI.TimelineRecording = class TimelineRecording extends WI.Object > > initializeCallingContextTrees(stackTraces, sampleDurations) > { >- this._exportDataSampleStackTraces = this._exportDataSampleStackTraces.concat(stackTraces); >- this._exportDataSampleDurations = this._exportDataSampleDurations.concat(sampleDurations); >+ this._exportDataSampleStackTraces.pushIterable(stackTraces); >+ this._exportDataSampleDurations.pushIterable(sampleDurations); > > for (let i = 0; i < stackTraces.length; i++) { > this._topDownCallingContextTree.updateTreeWithStackTrace(stackTraces[i], sampleDurations[i]); >diff --git a/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js b/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js >index 022827940d0fe09dd57dc7c47acb7b6f6f3f076b..0b44a40318686a591613e3bf3600776da29e5243 100644 >--- a/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js >+++ b/Source/WebInspectorUI/UserInterface/Protocol/RemoteObject.js >@@ -628,14 +628,11 @@ WI.RemoteObject = class RemoteObject > return; > } > >- let descriptors = properties.map((payload) => { >- return WI.PropertyDescriptor.fromPayload(payload, false, this._target); >- }); >+ let descriptors = properties.map((payload) => WI.PropertyDescriptor.fromPayload(payload, false, this._target)); > > if (internalProperties) { >- descriptors = descriptors.concat(internalProperties.map((payload) => { >- return WI.PropertyDescriptor.fromPayload(payload, true, this._target); >- })); >+ for (let payload of internalProperties) >+ descriptors.push(WI.PropertyDescriptor.fromPayload(payload, true, this._target)); > } > > callback(descriptors); >diff --git a/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js b/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js >index 2544d7f5053c634220e6bdb57219fadf35326da0..07a907b44f1dea5ee2eff255f716b7ac3138afd1 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/ConsoleMessageView.js >@@ -262,7 +262,7 @@ WI.ConsoleMessageView = class ConsoleMessageView extends WI.Object > var prefixedFormatString = WI.UIString("Trace: %s").format(this._message.parameters[0].description); > args = [prefixedFormatString].concat(this._message.parameters.slice(1)); > } else >- args = args.concat(this._message.parameters); >+ args.pushIterable(this._message.parameters); > } > this._appendFormattedArguments(element, args); > return; >@@ -274,7 +274,7 @@ WI.ConsoleMessageView = class ConsoleMessageView extends WI.Object > var prefixedFormatString = WI.UIString("Assertion Failed: %s").format(this._message.parameters[0].description); > args = [prefixedFormatString].concat(this._message.parameters.slice(1)); > } else >- args = args.concat(this._message.parameters); >+ args.pushIterable(this._message.parameters); > } > this._appendFormattedArguments(element, args); > return; >@@ -300,7 +300,7 @@ WI.ConsoleMessageView = class ConsoleMessageView extends WI.Object > case WI.ConsoleMessage.MessageType.Timing: { > let args = [this._message.messageText]; > if (this._extraParameters) >- args = args.concat(this._extraParameters); >+ args.pushIterable(this._extraParameters); > this._appendFormattedArguments(element, args); > return; > } >@@ -345,7 +345,7 @@ WI.ConsoleMessageView = class ConsoleMessageView extends WI.Object > > let args = [WI.UIString("Could not capture screenshot"), this._message.messageText]; > if (this._extraParameters) >- args = args.concat(this._extraParameters); >+ args.pushIterable(this._extraParameters); > this._appendFormattedArguments(element, args); > }); > } >@@ -359,7 +359,7 @@ WI.ConsoleMessageView = class ConsoleMessageView extends WI.Object > else > args.push(this._message.messageText); > if (this._extraParameters) >- args = args.concat(this._extraParameters); >+ args.pushIterable(this._extraParameters); > this._appendFormattedArguments(element, args); > return; > } >diff --git a/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js b/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js >index 7e9a2f91eff48cb0fe4bb61e608a5675bf5f026e..e45f8728a1a22184aa93d5e716dda91d3308d7e8 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js >+++ b/Source/WebInspectorUI/UserInterface/Views/ContentBrowser.js >@@ -140,7 +140,7 @@ WI.ContentBrowser = class ContentBrowser extends WI.View > if (currentContentView) { > var supplementalRepresentedObjects = currentContentView.supplementalRepresentedObjects; > if (supplementalRepresentedObjects && supplementalRepresentedObjects.length) >- representedObjects = representedObjects.concat(supplementalRepresentedObjects); >+ representedObjects.pushIterable(supplementalRepresentedObjects); > } > > return representedObjects; >diff --git a/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js b/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js >index 5ce3395ab2d59bdba1dd670140c13fabb2f32608..269a21a6c6264a8a49af96b3ff9df1b9b1f09371 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js >+++ b/Source/WebInspectorUI/UserInterface/Views/DOMTreeElement.js >@@ -1628,7 +1628,7 @@ WI.DOMTreeElement = class DOMTreeElement extends WI.TreeElement > visibleChildren.push(beforePseudoElement); > > if (node.childNodeCount && node.children) >- visibleChildren = visibleChildren.concat(node.children); >+ visibleChildren.pushIterable(node.children); > > var afterPseudoElement = node.afterPseudoElement(); > if (afterPseudoElement) >diff --git a/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js b/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js >index d90a9480ae0056d3661b7acab9996fbc6ae4df15..e59eccb92fff2d88c733eb37a43a80db22b7cbf6 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js >+++ b/Source/WebInspectorUI/UserInterface/Views/DataGridNode.js >@@ -175,7 +175,7 @@ WI.DataGridNode = class DataGridNode extends WI.Object > if (!value.length) > continue; > >- this._cachedFilterableData = this._cachedFilterableData.concat(value); >+ this._cachedFilterableData.pushIterable(value); > } > > return this._cachedFilterableData; >diff --git a/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js >index be5dac309512c099cf7597ee5fe40b9a14e4cfd6..59c785ff425b8163464f7323dd2f5172467f01ed 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/HeapAllocationsTimelineView.js >@@ -217,7 +217,7 @@ WI.HeapAllocationsTimelineView = class HeapAllocationsTimelineView extends WI.Ti > } > > if (this._contentViewContainer.currentContentView) >- components = components.concat(this._contentViewContainer.currentContentView.selectionPathComponents); >+ components.pushIterable(this._contentViewContainer.currentContentView.selectionPathComponents); > > return components; > } >diff --git a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js >index 80bd1051849cc916ce463d46799dd483af2793bf..da6aa1319b9da08956206ebf805254d173f6cac7 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/IndexedDatabaseObjectStoreContentView.js >@@ -142,7 +142,7 @@ WI.IndexedDatabaseObjectStoreContentView = class IndexedDatabaseObjectStoreConte > > function processEntries(entries, moreAvailable) > { >- this._entries = this._entries.concat(entries); >+ this._entries.pushIterable(entries); > this._moreEntriesAvailable = moreAvailable; > > for (var entry of entries) { >diff --git a/Source/WebInspectorUI/UserInterface/Views/NavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/NavigationItem.js >index 9c9aa00e118cacf257b16f4eca9892279b1c4d49..99303bf035f39d16ac800e1aaed43846b70a0b6d 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/NavigationItem.js >+++ b/Source/WebInspectorUI/UserInterface/Views/NavigationItem.js >@@ -125,8 +125,8 @@ WI.NavigationItem = class NavigationItem extends WI.Object > var classNames = ["item"]; > if (this._identifier) > classNames.push(this._identifier); >- if (this.additionalClassNames instanceof Array) >- classNames = classNames.concat(this.additionalClassNames); >+ if (Array.isArray(this.additionalClassNames)) >+ classNames.pushIterable(this.additionalClassNames); > return classNames; > } > }; >diff --git a/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js b/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js >index da2938eb66198628fa35bd9ff4213f2e565157c9..55a2e517df60852af6e791c4de3cf33371cf7c94 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/ObjectTreeView.js >@@ -311,7 +311,7 @@ WI.ObjectTreeView = class ObjectTreeView extends WI.Object > _updateProperties(properties, propertyPath) > { > if (this._extraProperties) >- properties = properties.concat(this._extraProperties); >+ properties.pushIterable(this._extraProperties); > > properties.sort(WI.ObjectTreeView.comparePropertyDescriptors); > >diff --git a/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js b/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js >index ea395b5d6ba26203e4b44a0cd49f45a7524edb8f..dbac786e04461da43b9b1edb6459cdc6b3899f2a 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js >+++ b/Source/WebInspectorUI/UserInterface/Views/OpenResourceDialog.js >@@ -301,7 +301,7 @@ WI.OpenResourceDialog = class OpenResourceDialog extends WI.Dialog > for (let resource of currentFrame.resourceCollection) > this._addResource(resource, suppressFilterUpdate); > >- frames.push(...currentFrame.childFrameCollection); >+ frames.pushIterable(currentFrame.childFrameCollection); > } > } > >diff --git a/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js >index 0d73ae46c76b808f17991b3db61c7d56bb366863..54884e311384d2fc7669e3c2a2b52642dd336d8f 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/OverviewTimelineView.js >@@ -225,12 +225,12 @@ WI.OverviewTimelineView = class OverviewTimelineView extends WI.TimelineView > if (this._shouldGroupBySourceCode) { > let networkTimeline = this._recording.timelines.get(WI.TimelineRecord.Type.Network); > if (networkTimeline) >- this._pendingRepresentedObjects = this._pendingRepresentedObjects.concat(networkTimeline.records.map((record) => record.resource)); >+ this._pendingRepresentedObjects.pushIterable(networkTimeline.records.map((record) => record.resource)); > >- this._pendingRepresentedObjects = this._pendingRepresentedObjects.concat(this._recording.sourceCodeTimelines); >+ this._pendingRepresentedObjects.pushIterable(this._recording.sourceCodeTimelines); > } else { > for (let timeline of this._relevantTimelines) >- this._pendingRepresentedObjects = this._pendingRepresentedObjects.concat(timeline.records); >+ this._pendingRepresentedObjects.pushIterable(timeline.records); > } > > this.needsLayout(); >diff --git a/Source/WebInspectorUI/UserInterface/Views/ResourceCollectionContentView.js b/Source/WebInspectorUI/UserInterface/Views/ResourceCollectionContentView.js >index 5696abf9c4cb6617f8707e21b59e1682a4471372..024fed30d66bbe59607f2ebd3cf9b899a8a75017 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/ResourceCollectionContentView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/ResourceCollectionContentView.js >@@ -78,7 +78,7 @@ WI.ResourceCollectionContentView = class ResourceCollectionContentView extends W > navigationItems.push(this._imageTypeScopeBar); > if (this._showGridButtonNavigationItem) > navigationItems.push(this._showGridButtonNavigationItem); >- navigationItems = navigationItems.concat(super.navigationItems); >+ navigationItems.pushIterable(super.navigationItems); > return navigationItems; > } > >diff --git a/Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js b/Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js >index acc5055f411b2ea84a415e8712d4b49d5c66ac52..e4d893e67c9ecb7566cd34be824162978669fa53 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/ResourceHeadersContentView.js >@@ -487,7 +487,7 @@ WI.ResourceHeadersContentView = class ResourceHeadersContentView extends WI.Cont > > if (matchRanges.length) { > let highlightedNodes = WI.highlightRangesWithStyleClass(element, matchRanges, "search-highlight", this._searchDOMChanges); >- this._searchResults = this._searchResults.concat(highlightedNodes); >+ this._searchResults.pushIterable(highlightedNodes); > } > } > } >diff --git a/Source/WebInspectorUI/UserInterface/Views/ResourceSecurityContentView.js b/Source/WebInspectorUI/UserInterface/Views/ResourceSecurityContentView.js >index 12808418f29ddc3a33ab1f0194ced96bc85c1550..cd89fad331e9c47b1683bf998bb09dba12acfff6 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/ResourceSecurityContentView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/ResourceSecurityContentView.js >@@ -298,7 +298,7 @@ WI.ResourceSecurityContentView = class ResourceSecurityContentView extends WI.Co > > if (matchRanges.length) { > let highlightedNodes = WI.highlightRangesWithStyleClass(element, matchRanges, "search-highlight", this._searchDOMChanges); >- this._searchResults = this._searchResults.concat(highlightedNodes); >+ this._searchResults.pushIterable(highlightedNodes); > } > } > } >diff --git a/Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js b/Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js >index ffa3341f102fede321f295e28fda946fd9b972df..dcc4d707a2344df9637a3bae41f88acb73b829d6 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js >+++ b/Source/WebInspectorUI/UserInterface/Views/ScriptClusterTimelineView.js >@@ -104,9 +104,11 @@ WI.ScriptClusterTimelineView = class ScriptClusterTimelineView extends WI.Cluste > return []; > > let components = [this._pathComponentForContentView(currentContentView)]; >+ > let subComponents = currentContentView.selectionPathComponents; > if (subComponents) >- return components.concat(subComponents); >+ components.pushIterable(subComponents); >+ > return components; > } > >diff --git a/Source/WebInspectorUI/UserInterface/Views/ScrubberNavigationItem.js b/Source/WebInspectorUI/UserInterface/Views/ScrubberNavigationItem.js >index a6a1d99b9280dab2fb0c7cfb432b8b57fa64acab..948654b4ff4abf7c6c73a0232ae5048a7f3b0ede 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/ScrubberNavigationItem.js >+++ b/Source/WebInspectorUI/UserInterface/Views/ScrubberNavigationItem.js >@@ -59,7 +59,9 @@ WI.ScrubberNavigationItem = class ScrubberNavigationItem extends WI.FlexibleSpac > > get additionalClassNames() > { >- return super.additionalClassNames.concat(["scrubber"]); >+ let additionalClassNames = super.additionalClassNames; >+ additionalClassNames.push("scrubber"); >+ return additionalClassNames; > } > > // Private >diff --git a/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js b/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js >index ed1d7b5a461b8891ba64f7ff9bc81988be0bd9dc..bec17f4b0ca04cf40f55419fff4e75f819c29d17 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js >+++ b/Source/WebInspectorUI/UserInterface/Views/SpreadsheetStyleProperty.js >@@ -580,7 +580,7 @@ WI.SpreadsheetStyleProperty = class SpreadsheetStyleProperty extends WI.Object > if (gradient) > newTokens.push(this._createInlineSwatch(WI.InlineSwatch.Type.Gradient, rawTokens, gradient)); > else >- newTokens.push(...rawTokens); >+ newTokens.pushIterable(rawTokens); > > gradientStartIndex = NaN; > } else if (isNaN(gradientStartIndex)) >@@ -599,7 +599,7 @@ WI.SpreadsheetStyleProperty = class SpreadsheetStyleProperty extends WI.Object > if (color) > newTokens.push(this._createInlineSwatch(WI.InlineSwatch.Type.Color, rawTokens, color)); > else >- newTokens.push(...rawTokens); >+ newTokens.pushIterable(rawTokens); > }; > > let colorFunctionStartIndex = NaN; >@@ -666,7 +666,7 @@ WI.SpreadsheetStyleProperty = class SpreadsheetStyleProperty extends WI.Object > if (valueObject) > newTokens.push(this._createInlineSwatch(inlineSwatchType, rawTokens, valueObject)); > else >- newTokens.push(...rawTokens); >+ newTokens.pushIterable(rawTokens); > > startIndex = NaN; > } else if (isNaN(startIndex)) >@@ -702,20 +702,20 @@ WI.SpreadsheetStyleProperty = class SpreadsheetStyleProperty extends WI.Object > let contents = []; > let fallbackStartIndex = rawTokens.findIndex((value, i) => i > variableNameIndex + 1 && /\bm-css\b/.test(value.type)); > if (fallbackStartIndex !== -1) { >- contents = contents.concat(rawTokens.slice(0, fallbackStartIndex)); >- contents = contents.concat(this._replaceSpecialTokens(rawTokens.slice(fallbackStartIndex, i))); >+ contents.pushIterable(rawTokens.slice(0, fallbackStartIndex)); >+ contents.pushIterable(this._replaceSpecialTokens(rawTokens.slice(fallbackStartIndex, i))); > } else >- contents = contents.concat(rawTokens.slice(0, i)); >+ contents.pushIterable(rawTokens.slice(0, i)); > contents.push(token); > > let text = rawTokens.reduce((accumulator, token) => accumulator + token.value, ""); > if (this._property.ownerStyle.nodeStyles.computedStyle.resolveVariableValue(text)) > newTokens.push(this._createInlineSwatch(WI.InlineSwatch.Type.Variable, contents)); > else >- newTokens = newTokens.concat(contents); >+ newTokens.pushIterable(contents); > } else { > this._hasInvalidVariableValue = true; >- newTokens.push(...rawTokens); >+ newTokens.pushIterable(rawTokens); > } > > startIndex = NaN; >diff --git a/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js b/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js >index 4a72da14015a1154cc005ecfe5e1e641cad1cc9e..81f753099d03e6550755b8a9437ba68f17bc54ca 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js >+++ b/Source/WebInspectorUI/UserInterface/Views/TreeOutline.js >@@ -510,7 +510,7 @@ WI.TreeOutline = class TreeOutline extends WI.Object > if (predicate(treeElement)) > return treeElement; > >- treeElements = treeElements.concat(treeElement.children); >+ treeElements.pushIterable(treeElement.children); > } > > return false; >diff --git a/Source/WebInspectorUI/UserInterface/Views/View.js b/Source/WebInspectorUI/UserInterface/Views/View.js >index 6363991223a68a3a2580bda24a59dac1fc443dda..19e964d3e1f2d7acfd1cbff8e0f89925602f3c1d 100644 >--- a/Source/WebInspectorUI/UserInterface/Views/View.js >+++ b/Source/WebInspectorUI/UserInterface/Views/View.js >@@ -391,7 +391,7 @@ WI.View = class View extends WI.Object > if (view.layoutPending) > view._layoutSubtree(); > else if (view._dirtyDescendantsCount) { >- views = views.concat(view.subviews); >+ views.pushIterable(view.subviews); > view._dirtyDescendantsCount = 0; > } > } >diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog >index 04a94595600c8676f5c5ec98df135dedaed5a864..1abab8149ace3429932efd37d2823016c27129af 100644 >--- a/LayoutTests/ChangeLog >+++ b/LayoutTests/ChangeLog >@@ -1,3 +1,14 @@ >+2019-08-27 Devin Rousso <drousso@apple.com> >+ >+ Web Inspector: replace uses of `Array.prototype.concat` with `Array.prototype.push` >+ https://bugs.webkit.org/show_bug.cgi?id=201082 >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ * inspector/unit-tests/array-utilities.html: >+ * inspector/unit-tests/array-utilities-expected.txt: >+ Add tests for added utility `Array.prototype.pushIterable`. >+ > 2019-08-26 Myles C. Maxfield <mmaxfield@apple.com> > > [WHLSL] Rewrite all tests to use WHLSL and delete the isWHLSL flag >diff --git a/LayoutTests/inspector/unit-tests/array-utilities-expected.txt b/LayoutTests/inspector/unit-tests/array-utilities-expected.txt >index 9cc6c96a99f12d26b944044baabcb3faf39d976b..3f12b19a0527604dd9c9bb247befc49d7aaf0cad 100644 >--- a/LayoutTests/inspector/unit-tests/array-utilities-expected.txt >+++ b/LayoutTests/inspector/unit-tests/array-utilities-expected.txt >@@ -132,6 +132,38 @@ PASS: insertAtIndex with 0 < index < length should insert at the correct locatio > PASS: insertAtIndex with negative index should insert from the end. > PASS: insertAtIndex with index greater than array length should insert at the end. > >+-- Running test case: Array.prototype.pushIterable >+Array: >+[1,2] => [1,2,"a1","a2"] >+ >+Set: >+[1,2] => [1,2,"s1","s2"] >+[1,2] => [1,2,["s1","s1"],["s2","s2"]] >+[1,2] => [1,2,"s1","s2"] >+[1,2] => [1,2,"s1","s2"] >+ >+Map: >+[1,2] => [1,2,["m1k","m1v"],["m2k","m2v"]] >+[1,2] => [1,2,["m1k","m1v"],["m2k","m2v"]] >+[1,2] => [1,2,"m1k","m2k"] >+[1,2] => [1,2,"m1v","m2v"] >+ >+Object: >+[1,2] => [1,2,["o1k","o1v"],["o2k","o2v"]] >+[1,2] => [1,2,"o1k","o2k"] >+[1,2] => [1,2,"o1v","o2v"] >+ >+Generator: >+[1,2] => [1,2,"g1","g2"] >+ >+Node: >+[1,2] => [1,2,<n1>,<n2>] >+[1,2] => [1,2,<n1>,<n2>] >+ >+Object (doesn't have [Symbol.iterator]): >+PASS: Should produce an exception. >+TypeError: undefined is not a function (near '...item of iterable...') >+ > -- Running test case: Array.prototype.keySet > PASS: keySet should create an object with keys equal to the array values. > PASS: keySet should create an object with all values equal to true. >diff --git a/LayoutTests/inspector/unit-tests/array-utilities.html b/LayoutTests/inspector/unit-tests/array-utilities.html >index c3282a778c05fbe666f341c5e64fc50d07d675ac..f3eb3816011e17dde0b19af67edf0877d1907d8d 100644 >--- a/LayoutTests/inspector/unit-tests/array-utilities.html >+++ b/LayoutTests/inspector/unit-tests/array-utilities.html >@@ -304,6 +304,88 @@ function test() > } > }); > >+ suite.addTestCase({ >+ name: "Array.prototype.pushIterable", >+ test() { >+ function test(iterable) { >+ let array = [1, 2]; >+ >+ function stringify(object) >+ { >+ let string = JSON.stringify(object, function(key, value) { >+ if (value instanceof Node) >+ return "<" + value.localName + ">"; >+ return value; >+ }); >+ return string.replace(/"(<[^>]*>)"/g, "$1"); >+ } >+ >+ let before = stringify(array); >+ array.pushIterable(iterable); >+ let after = stringify(array); >+ >+ InspectorTest.log(before + " => " + after); >+ } >+ >+ InspectorTest.log("Array:"); >+ test(["a1", "a2"]); >+ >+ InspectorTest.newline(); >+ >+ InspectorTest.log("Set:"); >+ const set = new Set(["s1", "s2"]); >+ test(set); >+ test(set.entries()); >+ test(set.keys()); >+ test(set.values()); >+ >+ InspectorTest.newline(); >+ >+ InspectorTest.log("Map:"); >+ const map = new Map([["m1k", "m1v"], ["m2k", "m2v"]]); >+ test(map); >+ test(map.entries()); >+ test(map.keys()); >+ test(map.values()); >+ >+ InspectorTest.newline(); >+ >+ InspectorTest.log("Object:"); >+ const object = { >+ o1k: "o1v", >+ o2k: "o2v", >+ }; >+ test(Object.entries(object)); >+ test(Object.keys(object)); >+ test(Object.values(object)); >+ >+ InspectorTest.newline(); >+ >+ InspectorTest.log("Generator:"); >+ function* generator() { >+ yield "g1"; >+ yield "g2"; >+ } >+ test(generator()); >+ >+ InspectorTest.newline(); >+ >+ InspectorTest.log("Node:"); >+ const node = document.createElement("div"); >+ node.appendChild(document.createElement("n1")); >+ node.appendChild(document.createElement("n2")); >+ test(node.children); >+ test(node.querySelectorAll("*")); >+ >+ InspectorTest.newline(); >+ >+ InspectorTest.log("Object (doesn't have [Symbol.iterator]):"); >+ InspectorTest.expectException(() => { >+ test(object); >+ }); >+ }, >+ }); >+ > suite.addTestCase({ > name: "Array.prototype.keySet", > test() {
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 201082
:
377158
|
377374
|
377632