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

Side by Side Diff: third_party/WebKit/Source/devtools/front_end/components/ExecutionContextSelector.js

Issue 2122353002: [DevTools] Make resource tree model optional (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 /** 5 /**
6 * @constructor 6 * @constructor
7 * @implements {WebInspector.TargetManager.Observer} 7 * @implements {WebInspector.TargetManager.Observer}
8 * @param {!WebInspector.TargetManager} targetManager 8 * @param {!WebInspector.TargetManager} targetManager
9 * @param {!WebInspector.Context} context 9 * @param {!WebInspector.Context} context
10 */ 10 */
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 return true; 123 return true;
124 if (!this._lastSelectedContextId && this._isMainFrameContext(executionCo ntext)) 124 if (!this._lastSelectedContextId && this._isMainFrameContext(executionCo ntext))
125 return true; 125 return true;
126 return false; 126 return false;
127 }, 127 },
128 128
129 /** 129 /**
130 * @param {!WebInspector.ExecutionContext} executionContext 130 * @param {!WebInspector.ExecutionContext} executionContext
131 * @return {boolean} 131 * @return {boolean}
132 */ 132 */
133 _isMainFrameContext: function(executionContext) 133 _isMainFrameContext: function(executionContext)
pfeldman 2016/07/07 17:44:14 The name is misleading - we want to know whether t
eostroukhov-old 2016/07/13 23:30:58 Done. Note that the main target check is by checki
134 { 134 {
135 if (!executionContext.isDefault) 135 if (!executionContext.isDefault || !executionContext.frameId)
136 return false; 136 return false;
137 var frame = executionContext.target().resourceTreeModel.frameForId(execu tionContext.frameId); 137 var resourceTreeModel = WebInspector.ResourceTreeModel.fromTarget(execut ionContext.target());
138 if (!resourceTreeModel)
139 return false;
140 var frame = resourceTreeModel.frameForId(executionContext.frameId);
138 if (frame && frame.isMainFrame()) 141 if (frame && frame.isMainFrame())
139 return true; 142 return true;
140 return false; 143 return false;
141 }, 144 },
142 145
143 /** 146 /**
144 * @param {!WebInspector.Event} event 147 * @param {!WebInspector.Event} event
145 */ 148 */
146 _onExecutionContextCreated: function(event) 149 _onExecutionContextCreated: function(event)
147 { 150 {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 var expressionString = expressionRange.toString(); 217 var expressionString = expressionRange.toString();
215 218
216 // The "[" is also a stop character, except when it's the last character of the expression. 219 // The "[" is also a stop character, except when it's the last character of the expression.
217 var pos = expressionString.lastIndexOf("[", expressionString.length - 2); 220 var pos = expressionString.lastIndexOf("[", expressionString.length - 2);
218 if (pos !== -1) 221 if (pos !== -1)
219 expressionString = expressionString.substr(pos + 1); 222 expressionString = expressionString.substr(pos + 1);
220 223
221 var prefix = wordRange.toString(); 224 var prefix = wordRange.toString();
222 executionContext.completionsForExpression(expressionString, text, cursorOffs et, prefix, force, completionsReadyCallback); 225 executionContext.completionsForExpression(expressionString, text, cursorOffs et, prefix, force, completionsReadyCallback);
223 } 226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698