- Revision
- 133583
- Author
- [email protected]
- Date
- 2012-11-06 04:07:45 -0800 (Tue, 06 Nov 2012)
Log Message
Web Inspector: Displayed name/path of urls in network tab of dev tools is inconsistent
https://bugs.webkit.org/show_bug.cgi?id=101064
Reviewed by Yury Semikhatsky.
Source/WebCore:
Extracted some generic methods from ParsedURL displayName getters (about:blank and data url handlers).
Implemented consistent name() and path() method on NetworkRequest based on ParsedURL.
NetworkPanel now uses name() and path() methods on NetworkRequest to show requests and search for them.
Test: http/tests/inspector/network/request-name-path.html
* inspector/front-end/NetworkPanel.js:
(WebInspector.NetworkLogView.prototype._matchRequest):
(WebInspector.NetworkLogView.prototype._highlightMatchedRequests):
(WebInspector.NetworkLogView.prototype.performFilter):
(WebInspector.NetworkDataGridNode.prototype._refreshNameCell):
(WebInspector.NetworkDataGridNode.NameComparator):
* inspector/front-end/NetworkRequest.js:
(WebInspector.NetworkRequest.prototype.set url):
(WebInspector.NetworkRequest.prototype.name):
(WebInspector.NetworkRequest.prototype.path):
(WebInspector.NetworkRequest.prototype._parseNameAndPathFromURL):
* inspector/front-end/ParsedURL.js:
(WebInspector.ParsedURL):
(WebInspector.ParsedURL.prototype.get displayName):
(WebInspector.ParsedURL.prototype.dataURLDisplayName):
(WebInspector.ParsedURL.prototype.isAboutBlank):
(WebInspector.ParsedURL.prototype.isDataURL):
LayoutTests:
* http/tests/inspector/network/request-name-path-expected.txt: Added.
* http/tests/inspector/network/request-name-path.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (133582 => 133583)
--- trunk/LayoutTests/ChangeLog 2012-11-06 12:00:48 UTC (rev 133582)
+++ trunk/LayoutTests/ChangeLog 2012-11-06 12:07:45 UTC (rev 133583)
@@ -1,3 +1,13 @@
+2012-11-06 Vsevolod Vlasov <[email protected]>
+
+ Web Inspector: Displayed name/path of urls in network tab of dev tools is inconsistent
+ https://bugs.webkit.org/show_bug.cgi?id=101064
+
+ Reviewed by Yury Semikhatsky.
+
+ * http/tests/inspector/network/request-name-path-expected.txt: Added.
+ * http/tests/inspector/network/request-name-path.html: Added.
+
2012-11-06 Takashi Sakamoto <[email protected]>
removeAttribute('style') not working in certain circumstances
Added: trunk/LayoutTests/http/tests/inspector/network/request-name-path-expected.txt (0 => 133583)
--- trunk/LayoutTests/http/tests/inspector/network/request-name-path-expected.txt (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/request-name-path-expected.txt 2012-11-06 12:07:45 UTC (rev 133583)
@@ -0,0 +1,52 @@
+Tests name() and path() methods of NetworkRequest.
+
+Bug 101064
+Dumping request name and path for url: http://www.example.com/foo/bar/baz?key=value
+ name = baz?key=value
+ path = www.example.com/foo/bar
+Dumping request name and path for url: http://www.example.com/foo/bar/?key=value
+ name = ?key=value
+ path = www.example.com/foo/bar
+Dumping request name and path for url: http://www.example.com/foo/bar/baz
+ name = baz
+ path = www.example.com/foo/bar
+Dumping request name and path for url: http://www.example.com/foo/bar/
+ name = bar/
+ path = www.example.com/foo
+Dumping request name and path for url: http://www.example.com/baz?key=value
+ name = baz?key=value
+ path = www.example.com
+Dumping request name and path for url: http://www.example.com/?key=value
+ name = ?key=value
+ path = www.example.com
+Dumping request name and path for url: http://www.example.com/baz
+ name = baz
+ path = www.example.com
+Dumping request name and path for url: http://www.example.com/
+ name = www.example.com
+ path =
+Dumping request name and path for url: http://127.0.0.1/foo/bar/baz?key=value
+ name = baz?key=value
+ path = /foo/bar
+Dumping request name and path for url: http://127.0.0.1/foo/bar/?key=value
+ name = ?key=value
+ path = /foo/bar
+Dumping request name and path for url: http://127.0.0.1/foo/bar/baz
+ name = baz
+ path = /foo/bar
+Dumping request name and path for url: http://127.0.0.1/foo/bar/
+ name = bar/
+ path = /foo
+Dumping request name and path for url: http://127.0.0.1/baz?key=value
+ name = baz?key=value
+ path =
+Dumping request name and path for url: http://127.0.0.1/?key=value
+ name = ?key=value
+ path =
+Dumping request name and path for url: http://127.0.0.1/baz
+ name = baz
+ path =
+Dumping request name and path for url: http://127.0.0.1/
+ name = 127.0.0.1
+ path =
+
Added: trunk/LayoutTests/http/tests/inspector/network/request-name-path.html (0 => 133583)
--- trunk/LayoutTests/http/tests/inspector/network/request-name-path.html (rev 0)
+++ trunk/LayoutTests/http/tests/inspector/network/request-name-path.html 2012-11-06 12:07:45 UTC (rev 133583)
@@ -0,0 +1,44 @@
+<html>
+<head>
+<script src=""
+<script>
+function test()
+{
+ function createNetworkRequestForURLAndDumpNameAndPath(url)
+ {
+ InspectorTest.addResult("Dumping request name and path for url: " + url);
+ var request = new WebInspector.NetworkRequest(0, url);
+ InspectorTest.addResult(" name = " + request.name());
+ InspectorTest.addResult(" path = " + request.path());
+ }
+
+ createNetworkRequestForURLAndDumpNameAndPath("http://www.example.com/foo/bar/baz?key=value");
+ createNetworkRequestForURLAndDumpNameAndPath("http://www.example.com/foo/bar/?key=value");
+ createNetworkRequestForURLAndDumpNameAndPath("http://www.example.com/foo/bar/baz");
+ createNetworkRequestForURLAndDumpNameAndPath("http://www.example.com/foo/bar/");
+
+ createNetworkRequestForURLAndDumpNameAndPath("http://www.example.com/baz?key=value");
+ createNetworkRequestForURLAndDumpNameAndPath("http://www.example.com/?key=value");
+ createNetworkRequestForURLAndDumpNameAndPath("http://www.example.com/baz");
+ createNetworkRequestForURLAndDumpNameAndPath("http://www.example.com/");
+
+ createNetworkRequestForURLAndDumpNameAndPath("http://127.0.0.1/foo/bar/baz?key=value");
+ createNetworkRequestForURLAndDumpNameAndPath("http://127.0.0.1/foo/bar/?key=value");
+ createNetworkRequestForURLAndDumpNameAndPath("http://127.0.0.1/foo/bar/baz");
+ createNetworkRequestForURLAndDumpNameAndPath("http://127.0.0.1/foo/bar/");
+
+ createNetworkRequestForURLAndDumpNameAndPath("http://127.0.0.1/baz?key=value");
+ createNetworkRequestForURLAndDumpNameAndPath("http://127.0.0.1/?key=value");
+ createNetworkRequestForURLAndDumpNameAndPath("http://127.0.0.1/baz");
+ createNetworkRequestForURLAndDumpNameAndPath("http://127.0.0.1/");
+
+ InspectorTest.completeTest();
+}
+
+</script>
+</head>
+<body _onload_="runTest()">
+<p>Tests name() and path() methods of NetworkRequest.</p>
+<a href="" 101064</a>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (133582 => 133583)
--- trunk/Source/WebCore/ChangeLog 2012-11-06 12:00:48 UTC (rev 133582)
+++ trunk/Source/WebCore/ChangeLog 2012-11-06 12:07:45 UTC (rev 133583)
@@ -1,3 +1,34 @@
+2012-11-06 Vsevolod Vlasov <[email protected]>
+
+ Web Inspector: Displayed name/path of urls in network tab of dev tools is inconsistent
+ https://bugs.webkit.org/show_bug.cgi?id=101064
+
+ Reviewed by Yury Semikhatsky.
+
+ Extracted some generic methods from ParsedURL displayName getters (about:blank and data url handlers).
+ Implemented consistent name() and path() method on NetworkRequest based on ParsedURL.
+ NetworkPanel now uses name() and path() methods on NetworkRequest to show requests and search for them.
+
+ Test: http/tests/inspector/network/request-name-path.html
+
+ * inspector/front-end/NetworkPanel.js:
+ (WebInspector.NetworkLogView.prototype._matchRequest):
+ (WebInspector.NetworkLogView.prototype._highlightMatchedRequests):
+ (WebInspector.NetworkLogView.prototype.performFilter):
+ (WebInspector.NetworkDataGridNode.prototype._refreshNameCell):
+ (WebInspector.NetworkDataGridNode.NameComparator):
+ * inspector/front-end/NetworkRequest.js:
+ (WebInspector.NetworkRequest.prototype.set url):
+ (WebInspector.NetworkRequest.prototype.name):
+ (WebInspector.NetworkRequest.prototype.path):
+ (WebInspector.NetworkRequest.prototype._parseNameAndPathFromURL):
+ * inspector/front-end/ParsedURL.js:
+ (WebInspector.ParsedURL):
+ (WebInspector.ParsedURL.prototype.get displayName):
+ (WebInspector.ParsedURL.prototype.dataURLDisplayName):
+ (WebInspector.ParsedURL.prototype.isAboutBlank):
+ (WebInspector.ParsedURL.prototype.isDataURL):
+
2012-11-05 Pavel Feldman <[email protected]>
Web Inspector: make Spectrum and Popover WebInspector.Views in order to enable reuse
Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (133582 => 133583)
--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2012-11-06 12:00:48 UTC (rev 133582)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2012-11-06 12:07:45 UTC (rev 133583)
@@ -1070,7 +1070,7 @@
if (!this._searchRegExp)
return -1;
- if ((!request.displayName || !request.displayName.match(this._searchRegExp)) && !request.folder.match(this._searchRegExp))
+ if (!request.name().match(this._searchRegExp) && !request.path().match(this._searchRegExp))
return -1;
if (request.requestId in this._matchedRequestsMap)
@@ -1136,8 +1136,8 @@
var request = requests[i];
var node = this._requestGridNode(request);
if (node) {
- var nameMatched = request.displayName && request.displayName.match(regExp);
- var pathMatched = request.parsedURL.path && request.folder.match(regExp);
+ var nameMatched = request.name().match(regExp);
+ var pathMatched = request.path().match(regExp);
if (!nameMatched && pathMatched && !this._largerRequestsButton.toggled)
this._toggleLargerRequests();
var highlightedSubstringChanges = node._highlightMatchedSubstring(regExp);
@@ -1202,8 +1202,8 @@
for (var i = 0; i < this._dataGrid.rootNode().children.length; ++i) {
var node = this._dataGrid.rootNode().children[i];
node.element.removeStyleClass("filtered-out");
- var nameMatched = node._request.displayName && node._request.displayName.match(filterRegExp);
- var pathMatched = node._request.parsedURL.path && node._request.folder.match(filterRegExp);
+ var nameMatched = node._request.name().match(filterRegExp);
+ var pathMatched = node._request.path().match(filterRegExp);
if (!nameMatched && !pathMatched) {
node.element.addStyleClass("filtered-out");
this._filteredOutRequests.put(this._requests[i], true);
@@ -1929,25 +1929,11 @@
iconElement.className = "icon";
}
this._nameCell.appendChild(iconElement);
- this._nameCell.appendChild(document.createTextNode(this._fileName()));
-
- var subtitle = this._request.parsedURL.host === WebInspector.inspectedPageDomain ? "" : this._request.parsedURL.host;
-
- if (this._request.parsedURL.path)
- subtitle += this._request.folder;
-
- this._appendSubtitle(this._nameCell, subtitle);
+ this._nameCell.appendChild(document.createTextNode(this._request.name()));
+ this._appendSubtitle(this._nameCell, this._request.path());
this._nameCell.title = this._request.url;
},
- _fileName: function()
- {
- var fileName = this._request.displayName;
- if (this._request.queryString())
- fileName += "?" + this._request.queryString();
- return fileName;
- },
-
_refreshStatusCell: function()
{
this._statusCell.removeChildren();
@@ -2173,8 +2159,8 @@
WebInspector.NetworkDataGridNode.NameComparator = function(a, b)
{
- var aFileName = a._request.displayName + (a._request.queryString() ? a._request.queryString() : "");
- var bFileName = b._request.displayName + (b._request.queryString() ? b._request.queryString() : "");
+ var aFileName = a._request.name();
+ var bFileName = b._request.name();
if (aFileName > bFileName)
return 1;
if (bFileName > aFileName)
Modified: trunk/Source/WebCore/inspector/front-end/NetworkRequest.js (133582 => 133583)
--- trunk/Source/WebCore/inspector/front-end/NetworkRequest.js 2012-11-06 12:00:48 UTC (rev 133582)
+++ trunk/Source/WebCore/inspector/front-end/NetworkRequest.js 2012-11-06 12:07:45 UTC (rev 133583)
@@ -97,6 +97,8 @@
this._url = x;
this._parsedURL = new WebInspector.ParsedURL(x);
delete this._parsedQueryParameters;
+ delete this._name;
+ delete this._path;
},
/**
@@ -356,6 +358,45 @@
return this._parsedURL.displayName;
},
+ name: function()
+ {
+ if (this._name)
+ return this._name;
+ this._parseNameAndPathFromURL();
+ return this._name;
+ },
+
+ path: function()
+ {
+ if (this._path)
+ return this._path;
+ this._parseNameAndPathFromURL();
+ return this._path;
+ },
+
+ _parseNameAndPathFromURL: function()
+ {
+ if (this._parsedURL.isDataURL()) {
+ this._name = this._parsedURL.dataURLDisplayName();
+ this._path = "";
+ } else if (this._parsedURL.isAboutBlank()) {
+ this._name = this._parsedURL.url;
+ this._path = "";
+ } else {
+ this._path = this._parsedURL.host + this._parsedURL.folderPathComponents;
+ this._path = this._path.trimURL(WebInspector.inspectedPageDomain ? WebInspector.inspectedPageDomain : "");
+ if (this._parsedURL.lastPathComponent || this._parsedURL.queryParams)
+ this._name = this._parsedURL.lastPathComponent + (this._parsedURL.queryParams ? "?" + this._parsedURL.queryParams : "");
+ else if (this._parsedURL.folderPathComponents) {
+ this._name = this._parsedURL.folderPathComponents.substring(this._parsedURL.folderPathComponents.lastIndexOf("/") + 1) + "/";
+ this._path = this._path.substring(0, this._path.lastIndexOf("/"));
+ } else {
+ this._name = this._parsedURL.host;
+ this._path = "";
+ }
+ }
+ },
+
/**
* @return {string}
*/
Modified: trunk/Source/WebCore/inspector/front-end/ParsedURL.js (133582 => 133583)
--- trunk/Source/WebCore/inspector/front-end/ParsedURL.js 2012-11-06 12:00:48 UTC (rev 133582)
+++ trunk/Source/WebCore/inspector/front-end/ParsedURL.js 2012-11-06 12:07:45 UTC (rev 133583)
@@ -69,23 +69,21 @@
this.path = this.url;
}
- if (this.path) {
- // First cut the query params.
- var path = this.path;
- var indexOfQuery = path.indexOf("?");
- if (indexOfQuery !== -1) {
- this.queryParams = path.substring(indexOfQuery + 1)
- path = path.substring(0, indexOfQuery);
- }
+ // First cut the query params.
+ var path = this.path;
+ var indexOfQuery = path.indexOf("?");
+ if (indexOfQuery !== -1) {
+ this.queryParams = path.substring(indexOfQuery + 1)
+ path = path.substring(0, indexOfQuery);
+ }
- // Then take last path component.
- var lastSlashIndex = path.lastIndexOf("/");
- if (lastSlashIndex !== -1) {
- this.folderPathComponents = path.substring(0, lastSlashIndex);
- this.lastPathComponent = path.substring(lastSlashIndex + 1);
- } else
- this.lastPathComponent = path;
- }
+ // Then take last path component.
+ var lastSlashIndex = path.lastIndexOf("/");
+ if (lastSlashIndex !== -1) {
+ this.folderPathComponents = path.substring(0, lastSlashIndex);
+ this.lastPathComponent = path.substring(lastSlashIndex + 1);
+ } else
+ this.lastPathComponent = path;
}
/**
@@ -146,12 +144,9 @@
if (this._displayName)
return this._displayName;
- if (this.scheme === "data") {
- this._displayName = this.url.trimEnd(20);
- return this._displayName;
- }
-
- if (this.url ="" "about:blank")
+ if (this.isDataURL())
+ return this.dataURLDisplayName();
+ if (this.isAboutBlank())
return this.url;
this._displayName = this.lastPathComponent;
@@ -162,6 +157,26 @@
if (this._displayName === "/")
this._displayName = this.url;
return this._displayName;
+ },
+
+ dataURLDisplayName: function()
+ {
+ if (this._dataURLDisplayName)
+ return this._dataURLDisplayName;
+ if (!this.isDataURL())
+ return "";
+ this._dataURLDisplayName = this.url.trimEnd(20);
+ return this._dataURLDisplayName;
+ },
+
+ isAboutBlank: function()
+ {
+ return this.url ="" "about:blank";
+ },
+
+ isDataURL: function()
+ {
+ return this.scheme === "data";
}
}