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

Unified Diff: Source/devtools/front_end/common/Settings.js

Issue 413213003: DevTools: Support Blackbox/Disabled options in framework blackboxing UI dialog. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 5 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
Index: Source/devtools/front_end/common/Settings.js
diff --git a/Source/devtools/front_end/common/Settings.js b/Source/devtools/front_end/common/Settings.js
index def7436396cd57c19686c156b960fecc7434512f..6167c290b69ea152db421caf07c6661a8eff9713 100644
--- a/Source/devtools/front_end/common/Settings.js
+++ b/Source/devtools/front_end/common/Settings.js
@@ -210,7 +210,7 @@ WebInspector.Setting.prototype = {
*/
WebInspector.RegExpSetting = function(name, defaultValue, eventSupport, storage, regexFlags)
{
- WebInspector.Setting.call(this, name, [defaultValue], eventSupport, storage);
+ WebInspector.Setting.call(this, name, defaultValue ? [{ pattern: defaultValue }] : [], eventSupport, storage);
this._regexFlags = regexFlags;
}
@@ -221,19 +221,34 @@ WebInspector.RegExpSetting.prototype = {
*/
get: function()
{
- return this.getAsArray().join("|");
+ var result = [];
+ var items = this.getAsArray();
+ for (var i = 0; i < items.length; ++i) {
+ var item = items[i];
+ if (item.pattern && !item.disabled)
+ result.push(item.pattern);
+ }
+ return result.join("|");
},
/**
- * @return {!Array.<string>}
+ * @return {!Array.<{pattern: string, disabled: (boolean|undefined)}>}
*/
getAsArray: function()
{
var value = WebInspector.Setting.prototype.get.call(this);
- if (typeof value === "string") // Backward compatibility.
+ // Backward compatibility #1.
vsevik 2014/07/28 08:27:57 Can we use WebInspector.VersionController to avoid
aandrey 2014/07/28 12:42:38 Done.
+ if (typeof value === "string")
value = [value];
- value.remove("");
- return value;
+ // Backward compatibility #2.
+ var result = [];
+ for (var i = 0; i < value.length; ++i) {
+ if (typeof value[i] === "string")
+ value[i] = { pattern: value[i] };
+ if (value[i].pattern)
+ result.push(value[i]);
+ }
+ return result;
},
/**
@@ -242,17 +257,21 @@ WebInspector.RegExpSetting.prototype = {
*/
set: function(value)
{
- this.setAsArray([value]);
+ this.setAsArray([{ pattern: value }]);
},
/**
- * @param {!Array.<string>} value
+ * @param {!Array.<{pattern: string, disabled: (boolean|undefined)}>} value
*/
setAsArray: function(value)
{
delete this._regex;
- value.remove("");
- WebInspector.Setting.prototype.set.call(this, value);
+ var result = [];
+ for (var i = 0; i < value.length; ++i) {
+ if (value[i].pattern)
+ result.push(value[i]);
+ }
+ WebInspector.Setting.prototype.set.call(this, result);
},
/**

Powered by Google App Engine
This is Rietveld 408576698