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

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

Issue 212223003: DevTools: Introduce WebInspector.RegExpSetting. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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 | « Source/devtools/front_end/FileSystemMapping.js ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « Source/devtools/front_end/FileSystemMapping.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698