Web Inspector: Use ECMAScript Numeric Separators for numbers with 5 or more digits
https://bugs.webkit.org/show_bug.cgi?id=209879
Reviewed by Joseph Pecoraro.
Instead of `1000000` write `1_000_000` so it's easier to read.
* UserInterface/Base/Utilities.js:
* UserInterface/Controllers/JavaScriptLogViewController.js:
* UserInterface/Controllers/TimelineManager.js:
* UserInterface/Models/Gradient.js:
(WI.Gradient.prototype.stringFromStops):
* UserInterface/Models/HeapAllocationsInstrument.js:
(WI.HeapAllocationsInstrument.prototype.startInstrumentation):
* UserInterface/Protocol/Connection.js:
(InspectorBackend.Connection.prototype._dispatchResponse):
* UserInterface/Views/Layers3DContentView.js:
(WI.Layers3DContentView.prototype.initialLayout):
* UserInterface/Views/NetworkTableContentView.js:
(WI.NetworkTableContentView.prototype._updateLoadTimeStatistic):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@259368 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebInspectorUI/ChangeLog b/Source/WebInspectorUI/ChangeLog
index 01bd1b4..4c3992d 100644
--- a/Source/WebInspectorUI/ChangeLog
+++ b/Source/WebInspectorUI/ChangeLog
@@ -1,3 +1,26 @@
+2020-04-01 Nikita Vasilyev <nvasilyev@apple.com>
+
+ Web Inspector: Use ECMAScript Numeric Separators for numbers with 5 or more digits
+ https://bugs.webkit.org/show_bug.cgi?id=209879
+
+ Reviewed by Joseph Pecoraro.
+
+ Instead of `1000000` write `1_000_000` so it's easier to read.
+
+ * UserInterface/Base/Utilities.js:
+ * UserInterface/Controllers/JavaScriptLogViewController.js:
+ * UserInterface/Controllers/TimelineManager.js:
+ * UserInterface/Models/Gradient.js:
+ (WI.Gradient.prototype.stringFromStops):
+ * UserInterface/Models/HeapAllocationsInstrument.js:
+ (WI.HeapAllocationsInstrument.prototype.startInstrumentation):
+ * UserInterface/Protocol/Connection.js:
+ (InspectorBackend.Connection.prototype._dispatchResponse):
+ * UserInterface/Views/Layers3DContentView.js:
+ (WI.Layers3DContentView.prototype.initialLayout):
+ * UserInterface/Views/NetworkTableContentView.js:
+ (WI.NetworkTableContentView.prototype._updateLoadTimeStatistic):
+
2020-03-31 Jon Davis <jond@apple.com>
Added new WebSocket icon
diff --git a/Source/WebInspectorUI/UserInterface/Base/Utilities.js b/Source/WebInspectorUI/UserInterface/Base/Utilities.js
index 0459622..f81aee6 100644
--- a/Source/WebInspectorUI/UserInterface/Base/Utilities.js
+++ b/Source/WebInspectorUI/UserInterface/Base/Utilities.js
@@ -1348,13 +1348,13 @@
if (num < 1000)
return num.toLocaleString();
- if (num < 1000000)
+ if (num < 1_000_000)
return WI.UIString("%.1fK").format(Math.round(num / 100) / 10);
- if (num < 1000000000)
- return WI.UIString("%.1fM").format(Math.round(num / 100000) / 10);
+ if (num < 1_000_000_000)
+ return WI.UIString("%.1fM").format(Math.round(num / 100_000) / 10);
- return WI.UIString("%.1fB").format(Math.round(num / 100000000) / 10);
+ return WI.UIString("%.1fB").format(Math.round(num / 100_000_000) / 10);
}
});
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js b/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js
index 105f21c..772b6fe 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/JavaScriptLogViewController.js
@@ -362,5 +362,5 @@
}
};
-WI.JavaScriptLogViewController.CachedPropertiesDuration = 30000;
+WI.JavaScriptLogViewController.CachedPropertiesDuration = 30_000;
WI.JavaScriptLogViewController.IgnoredRepeatCount = Symbol("ignored-repeat-count");
diff --git a/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js b/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
index 729696f..fd1c442 100644
--- a/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
+++ b/Source/WebInspectorUI/UserInterface/Controllers/TimelineManager.js
@@ -1440,6 +1440,6 @@
RecordingImported: "timeline-manager-recording-imported",
};
-WI.TimelineManager.MaximumAutoRecordDuration = 90000; // 90 seconds
-WI.TimelineManager.MaximumAutoRecordDurationAfterLoadEvent = 10000; // 10 seconds
-WI.TimelineManager.DeadTimeRequiredToStopAutoRecordingEarly = 2000; // 2 seconds
+WI.TimelineManager.MaximumAutoRecordDuration = 90_000; // 90 seconds
+WI.TimelineManager.MaximumAutoRecordDurationAfterLoadEvent = 10_000; // 10 seconds
+WI.TimelineManager.DeadTimeRequiredToStopAutoRecordingEarly = 2_000; // 2 seconds
diff --git a/Source/WebInspectorUI/UserInterface/Models/Gradient.js b/Source/WebInspectorUI/UserInterface/Models/Gradient.js
index df89c16..f73de75 100644
--- a/Source/WebInspectorUI/UserInterface/Models/Gradient.js
+++ b/Source/WebInspectorUI/UserInterface/Models/Gradient.js
@@ -142,7 +142,7 @@
return stops.map(function(stop, index) {
var str = stop.color;
if (stop.offset !== index / count)
- str += " " + Math.round(stop.offset * 10000) / 100 + "%";
+ str += " " + Math.round(stop.offset * 10_000) / 100 + "%";
return str;
}).join(", ");
}
diff --git a/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsInstrument.js b/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsInstrument.js
index 13b08d2..6a68133 100644
--- a/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsInstrument.js
+++ b/Source/WebInspectorUI/UserInterface/Models/HeapAllocationsInstrument.js
@@ -60,7 +60,7 @@
}
// Periodic snapshots.
- const snapshotInterval = 10000;
+ const snapshotInterval = 10_000;
this._snapshotIntervalIdentifier = setInterval(this._takeHeapSnapshot.bind(this), snapshotInterval);
}
diff --git a/Source/WebInspectorUI/UserInterface/Protocol/Connection.js b/Source/WebInspectorUI/UserInterface/Protocol/Connection.js
index 1ba5c99..302cdba 100644
--- a/Source/WebInspectorUI/UserInterface/Protocol/Connection.js
+++ b/Source/WebInspectorUI/UserInterface/Protocol/Connection.js
@@ -102,7 +102,7 @@
{
console.assert(this._pendingResponses.size >= 0);
- if (messageObject.error && messageObject.error.code !== -32000)
+ if (messageObject.error && messageObject.error.code !== -32_000)
console.error("Request with id = " + messageObject["id"] + " failed. " + JSON.stringify(messageObject.error));
let sequenceId = messageObject["id"];
diff --git a/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js b/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js
index 61bc36d..1b273d6 100644
--- a/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/Layers3DContentView.js
@@ -163,7 +163,7 @@
window.matchMedia("(prefers-color-scheme: dark)").addListener(updateBackground);
updateBackground();
- this._camera = new THREE.PerspectiveCamera(45, this.element.offsetWidth / this.element.offsetHeight, 1, 100000);
+ this._camera = new THREE.PerspectiveCamera(45, this.element.offsetWidth / this.element.offsetHeight, 1, 100_000);
this._controls = new THREE.OrbitControls(this._camera, this._renderer.domElement);
this._controls.enableDamping = true;
diff --git a/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js b/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js
index 906c94f..f7c20bc 100644
--- a/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js
+++ b/Source/WebInspectorUI/UserInterface/Views/NetworkTableContentView.js
@@ -2167,12 +2167,12 @@
let duration = Date.now() - loadTimeStatistic.start;
let delay = loadTimeStatistic.delay;
- if (duration >= 1000) // 1 second
+ if (duration >= 1_000) // 1 second
delay = 100;
- else if (duration >= 60000) // 60 seconds
- delay = 1000;
- else if (duration >= 3600000) // 1 minute
- delay = 10000;
+ else if (duration >= 60_000) // 60 seconds
+ delay = 1_000;
+ else if (duration >= 3_600_000) // 1 minute
+ delay = 10_000;
if (delay !== loadTimeStatistic.delay) {
loadTimeStatistic.delay = delay;
@@ -2189,7 +2189,7 @@
loadTimeStatistic.container.hidden = !this._isShowingMainCollection();
if (isNaN(mainFrameStartTime) || isNaN(mainFrameLoadEventTime)) {
- this._updateStatistic("load-time", WI.UIString("Loading for %s"), Number.secondsToString(duration / 1000));
+ this._updateStatistic("load-time", WI.UIString("Loading for %s"), Number.secondsToString(duration / 1_000));
return;
}