DevTools: bring back exception handling in URL decoding

The exception handling was added in r177449, but then was accidentally
removed via r183686. This patch brings the test and functionality back.

R=vsevik

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

git-svn-id: svn://svn.chromium.org/blink/trunk@183901 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 4ea1a738
...@@ -109,7 +109,7 @@ Revealing all resources: ...@@ -109,7 +109,7 @@ Revealing all resources:
path with spaces path with spaces
white space.html white space.html
the%2fdir the%2fdir
foo?bar=100%&baz=a %2fb foo?bar=100%&baz=a%20%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%25&baz=a%20%2fb", false); // Verify that adding invalid URL does not throw exception.
addUISourceCode("http://example.com/the%2fdir/foo?bar=100%&baz=a%20%2fb", false);
addUISourceCode("http://example.com/path%20with%20spaces/white%20space.html", 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);
......
...@@ -138,13 +138,7 @@ WebInspector.NetworkWorkspaceBinding.prototype = { ...@@ -138,13 +138,7 @@ WebInspector.NetworkWorkspaceBinding.prototype = {
var splitURL = WebInspector.ParsedURL.splitURLIntoPathComponents(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 {
parentPath = parentPath;
} catch (e) { }
var name = splitURL.peekLast() || ""; var name = splitURL.peekLast() || "";
try {
name = name;
} 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);
var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (this._workspace.uiSourceCode(projectDelegate.id(), path)); var uiSourceCode = /** @type {!WebInspector.UISourceCode} */ (this._workspace.uiSourceCode(projectDelegate.id(), path));
......
...@@ -92,7 +92,11 @@ WebInspector.ParsedURL = function(url) ...@@ -92,7 +92,11 @@ WebInspector.ParsedURL = function(url)
*/ */
WebInspector.ParsedURL.splitURLIntoPathComponents = function(url) WebInspector.ParsedURL.splitURLIntoPathComponents = function(url)
{ {
var parsedURL = new WebInspector.ParsedURL(decodeURI(url)); var decodedURL = url;
try {
decodedURL = decodeURI(url);
} catch (e) { }
var parsedURL = new WebInspector.ParsedURL(decodedURL);
var origin; var origin;
var folderPath; var folderPath;
var name; var name;
......
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