| Index: third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
|
| diff --git a/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js b/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
|
| index 2ef3d1cf0a208504e9ba6affc558ccda0da60901..b3b95027faa86da51c2c36ee29de43618488ccf6 100644
|
| --- a/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
|
| +++ b/third_party/WebKit/Source/devtools/front_end/sources/NavigatorView.js
|
| @@ -266,17 +266,15 @@ Sources.NavigatorView = class extends UI.VBox {
|
|
|
| var isFromSourceMap = uiSourceCode.contentType().isFromSourceMap();
|
| var path;
|
| - if (uiSourceCode.project().type() === Workspace.projectTypes.FileSystem)
|
| + if (Persistence.FileSystemWorkspaceBinding.isFileSystemUISourceCode(uiSourceCode))
|
| path = Persistence.FileSystemWorkspaceBinding.relativePath(uiSourceCode).slice(0, -1);
|
| else
|
| path = Common.ParsedURL.extractPath(uiSourceCode.url()).split('/').slice(1, -1);
|
|
|
| - var project = uiSourceCode.project();
|
| var target = Bindings.NetworkProject.targetForUISourceCode(uiSourceCode);
|
| var frame = this._uiSourceCodeFrame(uiSourceCode);
|
|
|
| - var folderNode =
|
| - this._folderNode(uiSourceCode, project, target, frame, uiSourceCode.origin(), path, isFromSourceMap);
|
| + var folderNode = this._folderNode(uiSourceCode, target, frame, uiSourceCode.origin(), path, isFromSourceMap);
|
| var uiSourceCodeNode = new Sources.NavigatorUISourceCodeTreeNode(this, uiSourceCode);
|
| this._uiSourceCodeNodes.set(uiSourceCode, uiSourceCodeNode);
|
| folderNode.appendChild(uiSourceCodeNode);
|
| @@ -330,14 +328,13 @@ Sources.NavigatorView = class extends UI.VBox {
|
| */
|
| _folderNodeId(project, target, frame, projectOrigin, path) {
|
| var targetId = target ? target.id() : '';
|
| - var projectId = project.type() === Workspace.projectTypes.FileSystem ? project.id() : '';
|
| + var projectId = Persistence.FileSystemWorkspaceBinding.isFileSystemProject(project) ? project.id() : '';
|
| var frameId = this._groupByFrame && frame ? frame.id : '';
|
| return targetId + ':' + projectId + ':' + frameId + ':' + projectOrigin + ':' + path;
|
| }
|
|
|
| /**
|
| * @param {!Workspace.UISourceCode} uiSourceCode
|
| - * @param {!Workspace.Project} project
|
| * @param {?SDK.Target} target
|
| * @param {?SDK.ResourceTreeFrame} frame
|
| * @param {string} projectOrigin
|
| @@ -345,8 +342,9 @@ Sources.NavigatorView = class extends UI.VBox {
|
| * @param {boolean} fromSourceMap
|
| * @return {!Sources.NavigatorTreeNode}
|
| */
|
| - _folderNode(uiSourceCode, project, target, frame, projectOrigin, path, fromSourceMap) {
|
| - if (project.type() === Workspace.projectTypes.Snippets)
|
| + _folderNode(uiSourceCode, target, frame, projectOrigin, path, fromSourceMap) {
|
| + var project = uiSourceCode.project();
|
| + if (Snippets.ScriptSnippetModel.isSnippetUISourceCode(uiSourceCode))
|
| return this._rootNode;
|
|
|
| if (target && !this._groupByFolder && !fromSourceMap)
|
| @@ -370,10 +368,9 @@ Sources.NavigatorView = class extends UI.VBox {
|
| return fileSystemNode;
|
| }
|
|
|
| - var parentNode =
|
| - this._folderNode(uiSourceCode, project, target, frame, projectOrigin, path.slice(0, -1), fromSourceMap);
|
| + var parentNode = this._folderNode(uiSourceCode, target, frame, projectOrigin, path.slice(0, -1), fromSourceMap);
|
| var type = fromSourceMap ? Sources.NavigatorView.Types.SourceMapFolder : Sources.NavigatorView.Types.NetworkFolder;
|
| - if (project.type() === Workspace.projectTypes.FileSystem)
|
| + if (Persistence.FileSystemWorkspaceBinding.isFileSystemUISourceCode(uiSourceCode))
|
| type = Sources.NavigatorView.Types.FileSystemFolder;
|
| var name = path[path.length - 1];
|
|
|
| @@ -613,13 +610,12 @@ Sources.NavigatorView = class extends UI.VBox {
|
| contextMenu.appendApplicableItems(uiSourceCode);
|
| contextMenu.appendSeparator();
|
|
|
| - var project = uiSourceCode.project();
|
| - if (project.type() === Workspace.projectTypes.FileSystem) {
|
| + if (Persistence.FileSystemWorkspaceBinding.isFileSystemUISourceCode(uiSourceCode)) {
|
| var parentURL = uiSourceCode.parentURL();
|
| contextMenu.appendItem(Common.UIString('Rename\u2026'), this._handleContextMenuRename.bind(this, uiSourceCode));
|
| contextMenu.appendItem(
|
| Common.UIString('Make a copy\u2026'),
|
| - this._handleContextMenuCreate.bind(this, project, parentURL, uiSourceCode));
|
| + this._handleContextMenuCreate.bind(this, uiSourceCode.project(), parentURL, uiSourceCode));
|
| contextMenu.appendItem(Common.UIString('Delete'), this._handleContextMenuDelete.bind(this, uiSourceCode));
|
| contextMenu.appendSeparator();
|
| }
|
| @@ -640,7 +636,7 @@ Sources.NavigatorView = class extends UI.VBox {
|
| Sources.NavigatorView.appendSearchItem(contextMenu, path);
|
| contextMenu.appendSeparator();
|
|
|
| - if (project.type() !== Workspace.projectTypes.FileSystem)
|
| + if (!Persistence.FileSystemWorkspaceBinding.isFileSystemProject(project))
|
| return;
|
|
|
| contextMenu.appendItem(Common.UIString('New file'), this._handleContextMenuCreate.bind(this, project, path));
|
| @@ -1369,7 +1365,7 @@ Sources.NavigatorUISourceCodeTreeNode = class extends Sources.NavigatorTreeNode
|
| Sources.NavigatorFolderTreeNode = class extends Sources.NavigatorTreeNode {
|
| /**
|
| * @param {!Sources.NavigatorView} navigatorView
|
| - * @param {?Workspace.Project} project
|
| + * @param {!Workspace.Project} project
|
| * @param {string} id
|
| * @param {string} type
|
| * @param {string} folderPath
|
| @@ -1396,7 +1392,7 @@ Sources.NavigatorFolderTreeNode = class extends Sources.NavigatorTreeNode {
|
| }
|
|
|
| updateTitle() {
|
| - if (!this._treeElement || this._project.type() !== Workspace.projectTypes.FileSystem)
|
| + if (!this._treeElement || !Persistence.FileSystemWorkspaceBinding.isFileSystemProject(this._project))
|
| return;
|
| var absoluteFileSystemPath =
|
| Persistence.FileSystemWorkspaceBinding.fileSystemPath(this._project.id()) + '/' + this._folderPath;
|
| @@ -1410,7 +1406,7 @@ Sources.NavigatorFolderTreeNode = class extends Sources.NavigatorTreeNode {
|
| * @return {!TreeElement}
|
| */
|
| _createTreeElement(title, node) {
|
| - if (this._project.type() !== Workspace.projectTypes.FileSystem) {
|
| + if (!Persistence.FileSystemWorkspaceBinding.isFileSystemProject(this._project)) {
|
| try {
|
| title = decodeURI(title);
|
| } catch (e) {
|
| @@ -1573,7 +1569,7 @@ Sources.NavigatorGroupTreeNode = class extends Sources.NavigatorTreeNode {
|
| }
|
|
|
| updateTitle() {
|
| - if (!this._treeElement || this._project.type() !== Workspace.projectTypes.FileSystem)
|
| + if (!this._treeElement || !Persistence.FileSystemWorkspaceBinding.isFileSystemProject(this._project))
|
| return;
|
| if (!Runtime.experiments.isEnabled('persistence2')) {
|
| this._treeElement.listItemElement.classList.add('has-mapped-files');
|
|
|