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..e1b111ad59b1162a70213e25a30597d49c6f7ea7 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,22 @@ 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. |
- value = [value]; |
- value.remove(""); |
- return value; |
+ return WebInspector.Setting.prototype.get.call(this); |
}, |
/** |
@@ -242,16 +245,15 @@ 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); |
}, |
@@ -454,7 +456,7 @@ WebInspector.VersionController = function() |
{ |
} |
-WebInspector.VersionController.currentVersion = 8; |
+WebInspector.VersionController.currentVersion = 9; |
WebInspector.VersionController.prototype = { |
updateVersion: function() |
@@ -641,6 +643,36 @@ WebInspector.VersionController.prototype = { |
setting.set(value); |
}, |
+ _updateVersionFrom8To9: function() |
+ { |
+ if (!window.localStorage) |
+ return; |
+ |
+ var settingNames = [ |
+ "skipStackFramesPattern", |
+ "workspaceFolderExcludePattern" |
+ ]; |
+ |
+ for (var i = 0; i < settingNames.length; ++i) { |
+ var settingName = settingNames[i]; |
+ if (!(settingName in window.localStorage)) |
+ continue; |
+ try { |
+ var value = JSON.parse(window.localStorage[settingName]); |
+ if (!value) |
+ continue; |
+ if (typeof value === "string") |
+ value = [value]; |
+ for (var j = 0; j < value.length; ++j) { |
+ if (typeof value[j] === "string") |
+ value[j] = { pattern: value[j] }; |
+ } |
+ window.localStorage[settingName] = JSON.stringify(value); |
+ } catch(e) { |
+ } |
+ } |
+ }, |
+ |
/** |
* @param {!WebInspector.Setting} breakpointsSetting |
* @param {number} maxBreakpointsCount |