Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1151)

Unified Diff: third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js

Issue 1801393002: [DevTools] When selected network preset is remove, select another one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js
diff --git a/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js b/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js
index c4e08c8635ae3fc04ad4bf095cfe37b0372382d0..4c2db2df481078d43d6164a452debe5b6cbaf4c1 100644
--- a/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js
+++ b/third_party/WebKit/Source/devtools/front_end/components/NetworkConditionsSelector.js
@@ -76,7 +76,14 @@ WebInspector.NetworkConditionsSelector.prototype = {
var presetsGroup = {title: WebInspector.UIString("Presets"), items: WebInspector.NetworkConditionsSelector._presets};
var disabledGroup = {title: WebInspector.UIString("Disabled"), items: [WebInspector.NetworkManager.NoThrottlingConditions]};
this._options = this._populateCallback([customGroup, presetsGroup, disabledGroup]);
- this._conditionsChanged();
+ if (!this._conditionsChanged()) {
+ for (var i = this._options.length - 1; i >= 0; i--) {
+ if (this._options[i]) {
+ this.optionSelected(/** @type {!WebInspector.NetworkManager.Conditions} */ (this._options[i]));
+ break;
+ }
+ }
+ }
},
revealAndUpdate: function()
@@ -93,16 +100,20 @@ WebInspector.NetworkConditionsSelector.prototype = {
this._manager.setNetworkConditions(conditions);
},
+ /**
+ * @return {boolean}
+ */
_conditionsChanged: function()
{
var value = this._manager.networkConditions();
for (var index = 0; index < this._options.length; ++index) {
var option = this._options[index];
- if (!option)
- continue;
- if (option.download === value.download && option.upload === value.upload && option.latency === value.latency && option.title === value.title)
+ if (option && option.download === value.download && option.upload === value.upload && option.latency === value.latency && option.title === value.title) {
this._selectCallback(index);
+ return true;
+ }
}
+ return false;
}
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698