Index: Source/devtools/front_end/Settings.js |
diff --git a/Source/devtools/front_end/Settings.js b/Source/devtools/front_end/Settings.js |
index 3e3eb23918d128cdbf39a89aa3a92f64fc56eea9..632108198c5890bf1d49a78829d0cfc4c09905c9 100644 |
--- a/Source/devtools/front_end/Settings.js |
+++ b/Source/devtools/front_end/Settings.js |
@@ -106,7 +106,7 @@ WebInspector.Settings = function() |
this.shortcutPanelSwitch = this.createSetting("shortcutPanelSwitch", false); |
this.showWhitespacesInEditor = this.createSetting("showWhitespacesInEditor", false); |
this.skipStackFramesSwitch = this.createSetting("skipStackFramesSwitch", false); |
- this.skipStackFramesPattern = this.createSetting("skipStackFramesPattern", ""); |
+ this.skipStackFramesPattern = this.createRegExpSetting("skipStackFramesPattern", ""); |
this.pauseOnExceptionEnabled = this.createSetting("pauseOnExceptionEnabled", false); |
this.pauseOnCaughtException = this.createSetting("pauseOnCaughtException", false); |
this.enableAsyncStackTraces = this.createSetting("enableAsyncStackTraces", false); |
@@ -127,6 +127,19 @@ WebInspector.Settings.prototype = { |
/** |
* @param {string} key |
+ * @param {string} defaultValue |
+ * @param {string=} regexFlags |
+ * @return {!WebInspector.Setting} |
+ */ |
+ createRegExpSetting: function(key, defaultValue, regexFlags) |
+ { |
+ if (!this._registry[key]) |
+ this._registry[key] = new WebInspector.RegExpSetting(key, defaultValue, this._eventSupport, window.localStorage, regexFlags); |
+ return this._registry[key]; |
+ }, |
+ |
+ /** |
+ * @param {string} key |
* @param {*} defaultValue |
* @param {function(*, function(string, ...))} setterCallback |
* @return {!WebInspector.Setting} |
@@ -225,6 +238,46 @@ WebInspector.Setting.prototype = { |
* @constructor |
* @extends {WebInspector.Setting} |
* @param {string} name |
+ * @param {string} defaultValue |
+ * @param {!WebInspector.Object} eventSupport |
+ * @param {?Storage} storage |
+ * @param {string=} regexFlags |
+ */ |
+WebInspector.RegExpSetting = function(name, defaultValue, eventSupport, storage, regexFlags) |
+{ |
+ WebInspector.Setting.call(this, name, defaultValue, eventSupport, storage); |
+ this._regexFlags = regexFlags; |
+} |
+ |
+WebInspector.RegExpSetting.prototype = { |
+ set: function(value) |
+ { |
+ delete this._regex; |
+ WebInspector.Setting.prototype.set.call(this, value); |
+ }, |
+ |
+ /** |
+ * @return {?RegExp} |
+ */ |
+ asRegExp: function() |
+ { |
+ if (typeof this._regex !== "undefined") |
+ return this._regex; |
+ this._regex = null; |
+ try { |
+ this._regex = new RegExp(this.get(), this._regexFlags || ""); |
+ } catch (e) { |
+ } |
+ return this._regex; |
+ }, |
+ |
+ __proto__: WebInspector.Setting.prototype |
+} |
+ |
+/** |
+ * @constructor |
+ * @extends {WebInspector.Setting} |
+ * @param {string} name |
* @param {*} defaultValue |
* @param {!WebInspector.Object} eventSupport |
* @param {?Storage} storage |
@@ -259,7 +312,7 @@ WebInspector.BackendSetting.prototype = { |
}, |
__proto__: WebInspector.Setting.prototype |
-}; |
+} |
/** |
* @constructor |