Index: third_party/WebKit/Source/devtools/front_end/bindings/BlackboxManager.js |
diff --git a/third_party/WebKit/Source/devtools/front_end/bindings/BlackboxManager.js b/third_party/WebKit/Source/devtools/front_end/bindings/BlackboxManager.js |
index 98fc9c29eebbd6d256d323c13490c2b18290a30b..df7911e4a38df155f45fbc8765b1579e471a2c47 100644 |
--- a/third_party/WebKit/Source/devtools/front_end/bindings/BlackboxManager.js |
+++ b/third_party/WebKit/Source/devtools/front_end/bindings/BlackboxManager.js |
@@ -6,6 +6,7 @@ |
* @constructor |
* @param {!WebInspector.DebuggerWorkspaceBinding} debuggerWorkspaceBinding |
* @param {!WebInspector.NetworkMapping} networkMapping |
+ * @implements {WebInspector.TargetManager.Observer} |
*/ |
WebInspector.BlackboxManager = function(debuggerWorkspaceBinding, networkMapping) |
{ |
@@ -21,6 +22,8 @@ WebInspector.BlackboxManager = function(debuggerWorkspaceBinding, networkMapping |
this._debuggerModelData = new Map(); |
/** @type {!Map<string, boolean>} */ |
this._isBlackboxedURLCache = new Map(); |
+ |
+ WebInspector.targetManager.observeTargets(this); |
} |
WebInspector.BlackboxManager.prototype = { |
@@ -149,6 +152,40 @@ WebInspector.BlackboxManager.prototype = { |
}, |
/** |
+ * @override |
+ * @param {!WebInspector.Target} target |
+ */ |
+ targetAdded: function(target) |
+ { |
+ var debuggerModel = WebInspector.DebuggerModel.fromTarget(target); |
+ if (debuggerModel) |
+ this._addBlackboxPatterns(debuggerModel); |
+ }, |
+ |
+ /** |
+ * @override |
+ * @param {!WebInspector.Target} target |
+ */ |
+ targetRemoved: function(target) |
+ { |
+ }, |
+ |
+ /** |
+ * @param {!WebInspector.DebuggerModel} debuggerModel |
+ * @return {!Promise<boolean>} |
+ */ |
+ _addBlackboxPatterns: function(debuggerModel) |
+ { |
+ var regexPatterns = WebInspector.moduleSetting("skipStackFramesPattern").getAsArray(); |
+ var patterns = /** @type {!Array<!DebuggerAgent.BlackboxPattern>} */([]); |
+ for (var item of regexPatterns) { |
+ if (!item.disabled && item.pattern) |
+ patterns.push({ regexp: item.pattern }); |
+ } |
+ return debuggerModel.addBlackboxPatterns(patterns); |
+ }, |
+ |
+ /** |
* @param {!WebInspector.UISourceCode} uiSourceCode |
* @return {?string} |
*/ |
@@ -262,6 +299,7 @@ WebInspector.BlackboxManager.prototype = { |
promises.push(this._addScript(script) |
.then(loadSourceMap.bind(this, script))); |
} |
+ promises.push(clearBlackboxPatterns(debuggerModel).then(addBlackboxPatterns.bind(this, debuggerModel))); |
dgozman
2016/03/08 18:48:12
This should go before _addScript calls.
|
} |
Promise.all(promises).then(this._patternChangeFinishedForTests.bind(this)); |
@@ -274,6 +312,29 @@ WebInspector.BlackboxManager.prototype = { |
{ |
return this.sourceMapLoaded(script, this._debuggerWorkspaceBinding.sourceMapForScript(script)); |
} |
+ |
+ /** |
+ * @param {!WebInspector.DebuggerModel} debuggerModel |
+ * @return {!Promise<boolean>} |
+ */ |
+ function clearBlackboxPatterns(debuggerModel) |
+ { |
+ return debuggerModel.clearBlackboxPatterns(); |
dgozman
2016/03/08 18:48:12
Inline it!
|
+ } |
+ |
+ /** |
+ * @param {!WebInspector.DebuggerModel} debuggerModel |
+ * @param {boolean} wasCleared |
+ * @return {!Promise<boolean>} |
+ * @this {WebInspector.BlackboxManager} |
+ */ |
+ function addBlackboxPatterns(debuggerModel, wasCleared) |
+ { |
+ if (!wasCleared) |
dgozman
2016/03/08 18:48:12
Ignore this and inline.
|
+ return Promise.resolve(false); |
+ else |
+ return this._addBlackboxPatterns(debuggerModel); |
+ } |
}, |
_patternChangeFinishedForTests: function() |
@@ -362,7 +423,7 @@ WebInspector.BlackboxManager.prototype = { |
return Promise.resolve().then(updateState.bind(this, false)); |
} |
- return script.setBlackboxedRanges(positions).then(updateState.bind(this)); |
+ return script.addBlackboxPattern(positions).then(updateState.bind(this)); |
/** |
* @param {boolean} success |