DevTools: [SSP] show links for matched styles with spaces in source URL

The patch fixes couple of workspace inner methods used for fetching
uiSourceCodes based on their URL's.

BUG=422073
R=vsevik

Review URL: https://codereview.chromium.org/656453002

git-svn-id: svn://svn.chromium.org/blink/trunk@183686 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 5caf9f8e
#inspected {
background-color: blue;
}
/*# sourceURL=file://drive/path%20with%20spaces/style.css */
Verifies that links for URLs with spaces displayed properly for matched styles.
[expanded]
element.style { ()
[expanded]
#inspected { (style.css:1 -> style.css:1:1)
background-color: blue;
[expanded]
div { (user agent stylesheet)
display: block;
<html>
<head>
<script src="../../../http/tests/inspector/inspector-test.js"></script>
<script src="../../../http/tests/inspector/elements-test.js"></script>
<link rel="stylesheet" href="resources/style-with-spaces-in-sourceURL.css">
<script>
function test()
{
InspectorTest.selectNodeAndWaitForStyles("inspected", onNodeSelected);
function onNodeSelected()
{
InspectorTest.dumpSelectedElementStyles(true);
InspectorTest.completeTest();
}
}
</script>
</head>
<body onload="runTest()">
<p>
Verifies that links for URLs with spaces displayed properly for matched styles.
</p>
<div id="inspected"></div>
</body>
</html>
...@@ -19,7 +19,7 @@ function test() ...@@ -19,7 +19,7 @@ function test()
InspectorTest.addResult(" fragment: " + parsedURL.fragment); InspectorTest.addResult(" fragment: " + parsedURL.fragment);
InspectorTest.addResult(" folderPathComponents: " + parsedURL.folderPathComponents); InspectorTest.addResult(" folderPathComponents: " + parsedURL.folderPathComponents);
InspectorTest.addResult(" lastPathComponent: " + parsedURL.lastPathComponent); InspectorTest.addResult(" lastPathComponent: " + parsedURL.lastPathComponent);
var splittedURL = WebInspector.ParsedURL.splitURL(url); var splittedURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url);
InspectorTest.addResult(" splittedURL: " + JSON.stringify(splittedURL)); InspectorTest.addResult(" splittedURL: " + JSON.stringify(splittedURL));
} }
......
...@@ -106,8 +106,10 @@ Revealing all resources: ...@@ -106,8 +106,10 @@ Revealing all resources:
?a=b ?a=b
very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo… very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooo…
example.com example.com
path with spaces
white space.html
the%2fdir the%2fdir
foo?bar=100%&baz=a%20%2fb foo?bar=100%&baz=a %2fb
foo?bar=100&baz=a %2fb foo?bar=100&baz=a %2fb
(index) (index)
?a=b ?a=b
......
...@@ -65,7 +65,8 @@ function test() ...@@ -65,7 +65,8 @@ function test()
addUISourceCode("http://example.com/", false); addUISourceCode("http://example.com/", false);
addUISourceCode("http://example.com/?a=b", false); addUISourceCode("http://example.com/?a=b", false);
addUISourceCode("http://example.com/the%2fdir/foo?bar=100&baz=a%20%2fb", false); addUISourceCode("http://example.com/the%2fdir/foo?bar=100&baz=a%20%2fb", false);
addUISourceCode("http://example.com/the%2fdir/foo?bar=100%&baz=a%20%2fb", false); addUISourceCode("http://example.com/the%2fdir/foo?bar=100%25&baz=a%20%2fb", false);
addUISourceCode("http://example.com/path%20with%20spaces/white%20space.html", false);
addUISourceCode("?a=b", false); addUISourceCode("?a=b", false);
addUISourceCode("very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url", false); addUISourceCode("very_looooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooong_url", false);
dumpNavigator(); dumpNavigator();
......
...@@ -175,7 +175,7 @@ WebInspector.DebuggerProjectDelegate.prototype = { ...@@ -175,7 +175,7 @@ WebInspector.DebuggerProjectDelegate.prototype = {
addScript: function(script) addScript: function(script)
{ {
var contentProvider = script.isInlineScript() && !script.hasSourceURL ? new WebInspector.ConcatenatedScriptsContentProvider([script]) : script; var contentProvider = script.isInlineScript() && !script.hasSourceURL ? new WebInspector.ConcatenatedScriptsContentProvider([script]) : script;
var splitURL = WebInspector.ParsedURL.splitURL(script.sourceURL); var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(script.sourceURL);
var name = splitURL[splitURL.length - 1]; var name = splitURL[splitURL.length - 1];
name = "VM" + script.scriptId + (name ? " " + name : ""); name = "VM" + script.scriptId + (name ? " " + name : "");
return this.addContentProvider("", name, script.sourceURL, script.sourceURL, contentProvider); return this.addContentProvider("", name, script.sourceURL, script.sourceURL, contentProvider);
......
...@@ -135,15 +135,15 @@ WebInspector.NetworkWorkspaceBinding.prototype = { ...@@ -135,15 +135,15 @@ WebInspector.NetworkWorkspaceBinding.prototype = {
*/ */
addFileForURL: function(url, contentProvider, isContentScript) addFileForURL: function(url, contentProvider, isContentScript)
{ {
var splitURL = WebInspector.ParsedURL.splitURL(url); var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url);
var projectName = splitURL[0]; var projectName = splitURL[0];
var parentPath = splitURL.slice(1, -1).join("/"); var parentPath = splitURL.slice(1, -1).join("/");
try { try {
parentPath = decodeURI(parentPath); parentPath = parentPath;
} catch (e) { } } catch (e) { }
var name = splitURL.peekLast() || ""; var name = splitURL.peekLast() || "";
try { try {
name = decodeURI(name); name = name;
} catch (e) { } } catch (e) { }
var projectDelegate = this._projectDelegate(projectName, isContentScript || false); var projectDelegate = this._projectDelegate(projectName, isContentScript || false);
var path = projectDelegate.addFile(parentPath, name, url, contentProvider); var path = projectDelegate.addFile(parentPath, name, url, contentProvider);
...@@ -157,7 +157,7 @@ WebInspector.NetworkWorkspaceBinding.prototype = { ...@@ -157,7 +157,7 @@ WebInspector.NetworkWorkspaceBinding.prototype = {
*/ */
removeFileForURL: function(url) removeFileForURL: function(url)
{ {
var splitURL = WebInspector.ParsedURL.splitURL(url); var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url);
var projectName = splitURL[0]; var projectName = splitURL[0];
var projectDelegate = this._projectDelegates[projectName]; var projectDelegate = this._projectDelegates[projectName];
projectDelegate.removeFile(url); projectDelegate.removeFile(url);
......
...@@ -90,9 +90,9 @@ WebInspector.ParsedURL = function(url) ...@@ -90,9 +90,9 @@ WebInspector.ParsedURL = function(url)
* @param {string} url * @param {string} url
* @return {!Array.<string>} * @return {!Array.<string>}
*/ */
WebInspector.ParsedURL.splitURL = function(url) WebInspector.ParsedURL.splitURLIntoPathComponents = function(url)
{ {
var parsedURL = new WebInspector.ParsedURL(url); var parsedURL = new WebInspector.ParsedURL(decodeURI(url));
var origin; var origin;
var folderPath; var folderPath;
var name; var name;
......
...@@ -732,7 +732,7 @@ WebInspector.Workspace.prototype = { ...@@ -732,7 +732,7 @@ WebInspector.Workspace.prototype = {
*/ */
_networkUISourceCodeForURL: function(url) _networkUISourceCodeForURL: function(url)
{ {
var splitURL = WebInspector.ParsedURL.splitURL(url); var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url);
var projectId = splitURL[0]; var projectId = splitURL[0];
var project = this.project(projectId); var project = this.project(projectId);
return project ? project.uiSourceCode(splitURL.slice(1).join("/")) : null; return project ? project.uiSourceCode(splitURL.slice(1).join("/")) : null;
...@@ -744,7 +744,7 @@ WebInspector.Workspace.prototype = { ...@@ -744,7 +744,7 @@ WebInspector.Workspace.prototype = {
*/ */
_contentScriptUISourceCodeForURL: function(url) _contentScriptUISourceCodeForURL: function(url)
{ {
var splitURL = WebInspector.ParsedURL.splitURL(url); var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(url);
var projectId = "contentscripts:" + splitURL[0]; var projectId = "contentscripts:" + splitURL[0];
var project = this.project(projectId); var project = this.project(projectId);
return project ? project.uiSourceCode(splitURL.slice(1).join("/")) : null; return project ? project.uiSourceCode(splitURL.slice(1).join("/")) : null;
......
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