Commit b00d4d15 authored by John Emau's avatar John Emau Committed by Commit Bot

DevTools: Remove check for windows path forward slashes

This fixes issue #958651 Workspace name includes full URL on Windows.

The removed check causes the problem because on windows the file path
has already been normalized to file path URLs like: file://C:/example
but the check was added assuming on windows file paths would look like:
C:\\example which has not been the case since https://crrev.com/cf0a07b13661965f1c3df642306850b69cfeda8c

Screenshot: https://i.imgur.com/py7oc8u.png
Bug: 958651
Change-Id: I4eca2b29df0f550f3dc952e33b4782273b2e76a1
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1658680Reviewed-by: default avatarErik Luo <luoe@chromium.org>
Commit-Queue: John Emau <johnemau@microsoft.com>
Cr-Commit-Position: refs/heads/master@{#676648}
parent 3486b4f1
......@@ -105,7 +105,7 @@ Persistence.WorkspaceSettingsTab = class extends UI.VBox {
*/
_renderFileSystem(fileSystem) {
const fileSystemPath = fileSystem.path();
const lastIndexOfSlash = fileSystemPath.lastIndexOf(Host.isWin() ? '\\' : '/');
const lastIndexOfSlash = fileSystemPath.lastIndexOf('/');
const folderName = fileSystemPath.substr(lastIndexOfSlash + 1);
const element = createElementWithClass('div', 'file-system-container');
......
Tests workspace view file system headers
File system name: test
File system path: file:///this/is/a/test
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
(async function() {
TestRunner.addResult('Tests workspace view file system headers\n');
await TestRunner.loadModule('bindings_test_runner');
const fs = new BindingsTestRunner.TestFileSystem('file:///this/is/a/test');
await fs.reportCreatedPromise();
await UI.viewManager.showView('workspace');
const workspaceElement = (await UI.viewManager.view('workspace').widget()).element;
const fsName = workspaceElement.querySelector('.file-system-name').textContent;
const fsPath = workspaceElement.querySelector('.file-system-path').textContent;
TestRunner.addResult(`File system name: ${fsName}`);
TestRunner.addResult(`File system path: ${fsPath}`);
TestRunner.completeTest();
})();
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment