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

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

Issue 204333004: DevTools: Speculatively patch DevTools to make CodeSchool extension work. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Fixed pause settings 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/Main.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 c9110fc9fd55130c3cae27641b58403d3d2651b5..5981f03fbbdc54bd09bf47c597986b38fa2c8dad 100644
--- a/Source/devtools/front_end/Settings.js
+++ b/Source/devtools/front_end/Settings.js
@@ -660,3 +660,80 @@ WebInspector.VersionController.prototype = {
WebInspector.settings = new WebInspector.Settings();
WebInspector.experimentsSettings = new WebInspector.ExperimentsSettings(WebInspector.queryParam("experiments") !== null);
+
+// These methods are added for backwards compatibility with Devtools CodeSchool extension.
+// DO NOT REMOVE
+
+/**
+ * @constructor
+ */
+WebInspector.PauseOnExceptionStateSetting = function()
+{
+ WebInspector.settings.pauseOnExceptionEnabled.addChangeListener(this._enabledChanged, this);
+ WebInspector.settings.pauseOnCaughtException.addChangeListener(this._pauseOnCaughtChanged, this);
+ this._name = "pauseOnExceptionStateString";
+ this._eventSupport = new WebInspector.Object();
+ this._value = this._calculateValue();
+}
+
+WebInspector.PauseOnExceptionStateSetting.prototype = {
+ /**
+ * @param {function(!WebInspector.Event)} listener
+ * @param {!Object=} thisObject
+ */
+ addChangeListener: function(listener, thisObject)
+ {
+ this._eventSupport.addEventListener(this._name, listener, thisObject);
+ },
+
+ /**
+ * @param {function(!WebInspector.Event)} listener
+ * @param {!Object=} thisObject
+ */
+ removeChangeListener: function(listener, thisObject)
+ {
+ this._eventSupport.removeEventListener(this._name, listener, thisObject);
+ },
+
+ /**
+ * @return {string}
+ */
+ get: function()
+ {
+ return this._value;
+ },
+
+ /**
+ * @return {string}
+ */
+ _calculateValue: function()
+ {
+ if (!WebInspector.settings.pauseOnExceptionEnabled.get())
+ return "none";
+ // The correct code here would be
+ // return WebInspector.settings.pauseOnCaughtException.get() ? "all" : "uncaught";
+ // But the CodeSchool DevTools relies on the fact that we used to enable pausing on ALL extensions by default, so we trick it here.
+ return "all";
+ },
+
+ _enabledChanged: function(event)
+ {
+ this._fireChangedIfNeeded();
+ },
+
+ _pauseOnCaughtChanged: function(event)
+ {
+ this._fireChangedIfNeeded();
+ },
+
+ _fireChangedIfNeeded: function()
+ {
+ var newValue = this._calculateValue();
+ if (newValue === this._value)
+ return;
+ this._value = newValue;
+ this._eventSupport.dispatchEventToListeners(this._name, this._value);
+ }
+}
+
+WebInspector.settings.pauseOnExceptionStateString = new WebInspector.PauseOnExceptionStateSetting();
« no previous file with comments | « Source/devtools/front_end/Main.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698