Diff
Modified: trunk/LayoutTests/ChangeLog (102915 => 102916)
--- trunk/LayoutTests/ChangeLog 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/LayoutTests/ChangeLog 2011-12-15 11:58:46 UTC (rev 102916)
@@ -1,3 +1,19 @@
+2011-12-13 Andrey Kosyakov <[email protected]>
+
+ Web Inspector: Generated HAR is missing pages.startedDateTime
+ https://bugs.webkit.org/show_bug.cgi?id=74188
+
+ Reviewed by Pavel Feldman.
+
+ * http/tests/inspector/inspector-test.js:
+ (initialize_InspectorTest.InspectorTest.formatRecentTime):
+ (initialize_InspectorTest.InspectorTest.addObject):
+ * http/tests/inspector/resource-har-conversion-expected.txt:
+ * http/tests/inspector/resource-parameters-expected.txt:
+ * http/tests/inspector/resources-test.js:
+ * platform/chromium/http/tests/inspector/resource-har-conversion-expected.txt:
+ * platform/mac-snowleopard/http/tests/inspector/resource-har-conversion-expected.txt:
+
2011-12-15 Kenichi Ishibashi <[email protected]>
Supports Unicode variation selector
Modified: trunk/LayoutTests/http/tests/inspector/inspector-test.js (102915 => 102916)
--- trunk/LayoutTests/http/tests/inspector/inspector-test.js 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/LayoutTests/http/tests/inspector/inspector-test.js 2011-12-15 11:58:46 UTC (rev 102916)
@@ -109,8 +109,23 @@
window.addEventListener("error", onError);
-InspectorTest.addObject = function(object, nondeterministicProps, prefix, firstLinePrefix)
+InspectorTest.formatters = {};
+
+InspectorTest.formatters.formatAsTypeName = function(value)
{
+ return "<" + typeof value + ">";
+}
+
+InspectorTest.formatters.formatAsRecentTime = function(value)
+{
+ if (typeof value !== "object" || !(value instanceof Date))
+ return InspectorTest.formatAsTypeName(value);
+ var delta = Date.now() - value;
+ return 0 <= delta && delta < 30 * 60 * 1000 ? "<plausible>" : value;
+}
+
+InspectorTest.addObject = function(object, customFormatters, prefix, firstLinePrefix)
+{
prefix = prefix || "";
firstLinePrefix = firstLinePrefix || prefix;
InspectorTest.addResult(firstLinePrefix + "{");
@@ -119,25 +134,27 @@
continue;
var prefixWithName = " " + prefix + prop + " : ";
var propValue = object[prop];
- if (nondeterministicProps && prop in nondeterministicProps)
- InspectorTest.addResult(prefixWithName + "<" + typeof propValue + ">");
- else
- InspectorTest.dump(propValue, nondeterministicProps, " " + prefix, prefixWithName);
+ if (customFormatters && customFormatters[prop]) {
+ var formatterName = customFormatters[prop];
+ var formatter = InspectorTest.formatters[formatterName];
+ InspectorTest.addResult(prefixWithName + formatter(propValue));
+ } else
+ InspectorTest.dump(propValue, customFormatters, " " + prefix, prefixWithName);
}
InspectorTest.addResult(prefix + "}");
}
-InspectorTest.addArray = function(array, nondeterministicProps, prefix, firstLinePrefix)
+InspectorTest.addArray = function(array, customFormatters, prefix, firstLinePrefix)
{
prefix = prefix || "";
firstLinePrefix = firstLinePrefix || prefix;
InspectorTest.addResult(firstLinePrefix + "[");
for (var i = 0; i < array.length; ++i)
- InspectorTest.dump(array[i], nondeterministicProps, prefix + " ");
+ InspectorTest.dump(array[i], customFormatters, prefix + " ");
InspectorTest.addResult(prefix + "]");
}
-InspectorTest.dump = function(value, nondeterministicProps, prefix, prefixWithName)
+InspectorTest.dump = function(value, customFormatters, prefix, prefixWithName)
{
prefixWithName = prefixWithName || prefix;
if (prefixWithName && prefixWithName.length > 80) {
@@ -147,9 +164,9 @@
if (value === null)
InspectorTest.addResult(prefixWithName + "null");
else if (value instanceof Array)
- InspectorTest.addArray(value, nondeterministicProps, prefix, prefixWithName);
+ InspectorTest.addArray(value, customFormatters, prefix, prefixWithName);
else if (typeof value === "object")
- InspectorTest.addObject(value, nondeterministicProps, prefix, prefixWithName);
+ InspectorTest.addObject(value, customFormatters, prefix, prefixWithName);
else if (typeof value === "string")
InspectorTest.addResult(prefixWithName + "\"" + value + "\"");
else
Modified: trunk/LayoutTests/http/tests/inspector/protocol-test.js (102915 => 102916)
--- trunk/LayoutTests/http/tests/inspector/protocol-test.js 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/LayoutTests/http/tests/inspector/protocol-test.js 2011-12-15 11:58:46 UTC (rev 102916)
@@ -24,7 +24,7 @@
var eventName = args.shift();
InspectorTest._agentCoverage[eventName] = "checked";
InspectorTest.addResult("event " + InspectorTest._agentName + "." + eventName);
- InspectorTest.addObject(InspectorTest._lastReceivedMessage, InspectorTest._nondeterministicProps);
+ InspectorTest.addObject(InspectorTest._lastReceivedMessage, InspectorTest._customFormatters);
InspectorTest.addResult("");
var originalEventHandler = args.shift();
@@ -37,7 +37,7 @@
var callArgumentsCopy = JSON.parse(JSON.stringify(callArguments));
var agentName = callArgumentsCopy.shift();
var functionName = callArgumentsCopy.shift();
- this.filterProps(callArgumentsCopy, this._nondeterministicProps);
+ this.filterProps(callArgumentsCopy, this._customFormatters);
var _expression_ = JSON.stringify(callArgumentsCopy);
_expression_ = _expression_.slice(1, _expression_.length - 1).replace(/\"<number>\"/g, "<number>").replace(/\"<string>\"/g, "<string>");
@@ -49,7 +49,7 @@
InspectorTest._callback = function(result)
{
InspectorTest.addResult("response:");
- InspectorTest.addObject(InspectorTest._lastReceivedMessage, InspectorTest._nondeterministicProps);
+ InspectorTest.addObject(InspectorTest._lastReceivedMessage, InspectorTest._customFormatters);
InspectorTest.addResult("");
InspectorTest._runNextTest();
};
@@ -69,7 +69,7 @@
var lastSentMessage = InspectorTest._lastSentMessage; // This is because the next call will override _lastSentMessage.
InspectorTest.addResult("request:");
- InspectorTest.addObject(lastSentMessage, InspectorTest._nondeterministicProps);
+ InspectorTest.addObject(lastSentMessage, InspectorTest._customFormatters);
InspectorTest.addResult("");
if (agentName === this._agentName)
@@ -89,9 +89,9 @@
{
this._agentName = agentName;
this._testSuite = testSuite;
- this._nondeterministicProps = {};
+ this._customFormatters = {};
for (var i = 0; i < nondeterministicProps.length; ++i)
- this._nondeterministicProps[nondeterministicProps[i]] = true;
+ this._customFormatters[nondeterministicProps[i]] = "formatAsTypeName";
var agent = window[agentName];
this._agentCoverage = {};
@@ -126,4 +126,4 @@
this._runNextTest();
};
-};
\ No newline at end of file
+};
Modified: trunk/LayoutTests/http/tests/inspector/resource-har-conversion-expected.txt (102915 => 102916)
--- trunk/LayoutTests/http/tests/inspector/resource-har-conversion-expected.txt 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/LayoutTests/http/tests/inspector/resource-har-conversion-expected.txt 2011-12-15 11:58:46 UTC (rev 102916)
@@ -9,7 +9,7 @@
}
pages : [
{
- startedDateTime : <object>
+ startedDateTime : <plausible>
id : <string>
title : ""
pageTimings : {
@@ -21,7 +21,7 @@
entries : [
{
pageref : "http://127.0.0.1:8000/inspector/resource-har-conversion.html"
- startedDateTime : <object>
+ startedDateTime : <plausible>
time : <number>
request : {
method : "GET"
@@ -111,7 +111,7 @@
}
{
pageref : "http://127.0.0.1:8000/inspector/resource-har-conversion.html"
- startedDateTime : <object>
+ startedDateTime : <plausible>
time : <number>
request : {
method : "GET"
@@ -147,7 +147,7 @@
}
{
pageref : "http://127.0.0.1:8000/inspector/resource-har-conversion.html"
- startedDateTime : <object>
+ startedDateTime : <plausible>
time : <number>
request : {
method : "GET"
@@ -183,7 +183,7 @@
}
{
pageref : "http://127.0.0.1:8000/inspector/resource-har-conversion.html"
- startedDateTime : <object>
+ startedDateTime : <plausible>
time : <number>
request : {
method : "POST"
Modified: trunk/LayoutTests/http/tests/inspector/resource-har-conversion.html (102915 => 102916)
--- trunk/LayoutTests/http/tests/inspector/resource-har-conversion.html 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/LayoutTests/http/tests/inspector/resource-har-conversion.html 2011-12-15 11:58:46 UTC (rev 102916)
@@ -52,7 +52,7 @@
return !/favicon\.ico$/.test(entry.request.url);
});
log.entries.sort(InspectorTest.resourceURLComparer);
- InspectorTest.addObject(log, InspectorTest.HARNondeterministicPropertiesWithSize);
+ InspectorTest.addObject(log, InspectorTest.HARPropertyFormattersWithSize);
var pageTimings = log.pages[0].pageTimings;
InspectorTest.completeTest();
}
Modified: trunk/LayoutTests/http/tests/inspector/resource-har-headers.html (102915 => 102916)
--- trunk/LayoutTests/http/tests/inspector/resource-har-headers.html 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/LayoutTests/http/tests/inspector/resource-har-headers.html 2011-12-15 11:58:46 UTC (rev 102916)
@@ -52,9 +52,9 @@
InspectorTest.addObject(resourceResults, {}, "", "Resource:");
var stillNondeterministic = {
- "startedDateTime": 1,
- "time": 1,
- "timings": 1
+ "startedDateTime": "formatAsTypeName",
+ "time": "formatAsTypeName",
+ "timings": "formatAsTypeName"
};
InspectorTest.addObject(new WebInspector.HAREntry(testResource).build(), stillNondeterministic, "", "HAR:");
InspectorTest.completeTest();
Modified: trunk/LayoutTests/http/tests/inspector/resource-parameters-expected.txt (102915 => 102916)
--- trunk/LayoutTests/http/tests/inspector/resource-parameters-expected.txt 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/LayoutTests/http/tests/inspector/resource-parameters-expected.txt 2011-12-15 11:58:46 UTC (rev 102916)
@@ -4,7 +4,7 @@
{
pageref : "http://localhost:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=#fragmentParam1=fragmentValue1&fragmentParam2="
- startedDateTime : <object>
+ startedDateTime : <plausible>
time : <number>
request : {
method : "POST"
Modified: trunk/LayoutTests/http/tests/inspector/resource-parameters.html (102915 => 102916)
--- trunk/LayoutTests/http/tests/inspector/resource-parameters.html 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/LayoutTests/http/tests/inspector/resource-parameters.html 2011-12-15 11:58:46 UTC (rev 102916)
@@ -19,7 +19,7 @@
var resource = event.data;
if (resource.url !== "http://localhost:8000/inspector/resources/post-target.cgi?queryParam1=queryValue1&queryParam2=#fragmentParam1=fragmentValue1&fragmentParam2=")
return;
- InspectorTest.addObject(new WebInspector.HAREntry(resource).build(), InspectorTest.HARNondeterministicProperties);
+ InspectorTest.addObject(new WebInspector.HAREntry(resource).build(), InspectorTest.HARPropertyFormatters);
InspectorTest.completeTest();
}
}
Modified: trunk/LayoutTests/http/tests/inspector/resources-test.js (102915 => 102916)
--- trunk/LayoutTests/http/tests/inspector/resources-test.js 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/LayoutTests/http/tests/inspector/resources-test.js 2011-12-15 11:58:46 UTC (rev 102916)
@@ -1,25 +1,25 @@
var initialize_ResourceTest = function() {
-InspectorTest.HARNondeterministicProperties = {
- bodySize: 1,
- compression: 1,
- headers: 1,
- headersSize: 1,
- id: 1,
- onContentLoad: 1,
- onLoad: 1,
- receive: 1,
- startedDateTime: 1,
- time: 1,
- timings: 1,
- version: 1,
- wait: 1,
+InspectorTest.HARPropertyFormatters = {
+ bodySize: "formatAsTypeName",
+ compression: "formatAsTypeName",
+ headers: "formatAsTypeName",
+ headersSize: "formatAsTypeName",
+ id: "formatAsTypeName",
+ onContentLoad: "formatAsTypeName",
+ onLoad: "formatAsTypeName",
+ receive: "formatAsTypeName",
+ startedDateTime: "formatAsRecentTime",
+ time: "formatAsTypeName",
+ timings: "formatAsTypeName",
+ version: "formatAsTypeName",
+ wait: "formatAsTypeName",
};
// addObject checks own properties only, so make a deep copy rather than use prototype.
-InspectorTest.HARNondeterministicPropertiesWithSize = JSON.parse(JSON.stringify(InspectorTest.HARNondeterministicProperties));
-InspectorTest.HARNondeterministicPropertiesWithSize.size = 1;
+InspectorTest.HARPropertyFormattersWithSize = JSON.parse(JSON.stringify(InspectorTest.HARPropertyFormatters));
+InspectorTest.HARPropertyFormattersWithSize.size = "formatAsTypeName";
InspectorTest.resourceURLComparer = function(r1, r2)
Modified: trunk/LayoutTests/inspector/runtime/runtime-getProperties.html (102915 => 102916)
--- trunk/LayoutTests/inspector/runtime/runtime-getProperties.html 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/LayoutTests/inspector/runtime/runtime-getProperties.html 2011-12-15 11:58:46 UTC (rev 102916)
@@ -68,7 +68,7 @@
var value = property.value;
if (value)
property.value = { type: value.type, description: value.description.replace("function foo", "function "), objectId: value.objectId };
- InspectorTest.dump(property, { objectId: true });
+ InspectorTest.dump(property, { objectId: "formatAsTypeName" });
}
}
Modified: trunk/LayoutTests/inspector/timeline/timeline-test.js (102915 => 102916)
--- trunk/LayoutTests/inspector/timeline/timeline-test.js 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/LayoutTests/inspector/timeline/timeline-test.js 2011-12-15 11:58:46 UTC (rev 102916)
@@ -1,19 +1,19 @@
var initialize_Timeline = function() {
// Scrub values when printing out these properties in the record or data field.
-InspectorTest.timelineNonDeterministicProps = {
- children: 1,
- endTime: 1,
- height: 1,
- requestId: 1,
- startTime: 1,
- width: 1,
- stackTrace: 1,
- url: 1,
- usedHeapSize: 1,
- totalHeapSize: 1,
- mimeType: 1,
- id: 1
+InspectorTest.timelinePropertyFormatters = {
+ children: "formatAsTypeName",
+ endTime: "formatAsTypeName",
+ height: "formatAsTypeName",
+ requestId: "formatAsTypeName",
+ startTime: "formatAsTypeName",
+ width: "formatAsTypeName",
+ stackTrace: "formatAsTypeName",
+ url: "formatAsTypeName",
+ usedHeapSize: "formatAsTypeName",
+ totalHeapSize: "formatAsTypeName",
+ mimeType: "formatAsTypeName",
+ id: "formatAsTypeName"
};
InspectorTest.startTimeline = function(callback)
@@ -122,7 +122,7 @@
{
InspectorTest.addResult(InspectorTest._timelineAgentTypeToString(record.type) + " Properties:");
// Use this recursive routine to print the properties
- InspectorTest.addObject(record, InspectorTest.timelineNonDeterministicProps);
+ InspectorTest.addObject(record, InspectorTest.timelinePropertyFormatters);
};
InspectorTest._timelineAgentTypeToString = function(numericType)
Modified: trunk/LayoutTests/platform/chromium/http/tests/inspector/resource-har-conversion-expected.txt (102915 => 102916)
--- trunk/LayoutTests/platform/chromium/http/tests/inspector/resource-har-conversion-expected.txt 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/LayoutTests/platform/chromium/http/tests/inspector/resource-har-conversion-expected.txt 2011-12-15 11:58:46 UTC (rev 102916)
@@ -9,7 +9,7 @@
}
pages : [
{
- startedDateTime : <object>
+ startedDateTime : <plausible>
id : <string>
title : ""
pageTimings : {
@@ -21,7 +21,7 @@
entries : [
{
pageref : "http://127.0.0.1:8000/inspector/resource-har-conversion.html"
- startedDateTime : <object>
+ startedDateTime : <plausible>
time : <number>
request : {
method : "GET"
@@ -111,7 +111,7 @@
}
{
pageref : "http://127.0.0.1:8000/inspector/resource-har-conversion.html"
- startedDateTime : <object>
+ startedDateTime : <plausible>
time : <number>
request : {
method : "GET"
@@ -147,7 +147,7 @@
}
{
pageref : "http://127.0.0.1:8000/inspector/resource-har-conversion.html"
- startedDateTime : <object>
+ startedDateTime : <plausible>
time : <number>
request : {
method : "GET"
@@ -183,7 +183,7 @@
}
{
pageref : "http://127.0.0.1:8000/inspector/resource-har-conversion.html"
- startedDateTime : <object>
+ startedDateTime : <plausible>
time : <number>
request : {
method : "POST"
Modified: trunk/LayoutTests/platform/mac-snowleopard/http/tests/inspector/resource-har-conversion-expected.txt (102915 => 102916)
--- trunk/LayoutTests/platform/mac-snowleopard/http/tests/inspector/resource-har-conversion-expected.txt 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/LayoutTests/platform/mac-snowleopard/http/tests/inspector/resource-har-conversion-expected.txt 2011-12-15 11:58:46 UTC (rev 102916)
@@ -9,7 +9,7 @@
}
pages : [
{
- startedDateTime : <object>
+ startedDateTime : <plausible>
id : <string>
title : ""
pageTimings : {
@@ -21,7 +21,7 @@
entries : [
{
pageref : "http://127.0.0.1:8000/inspector/resource-har-conversion.html"
- startedDateTime : <object>
+ startedDateTime : <plausible>
time : <number>
request : {
method : "GET"
@@ -111,7 +111,7 @@
}
{
pageref : "http://127.0.0.1:8000/inspector/resource-har-conversion.html"
- startedDateTime : <object>
+ startedDateTime : <plausible>
time : <number>
request : {
method : "GET"
@@ -147,7 +147,7 @@
}
{
pageref : "http://127.0.0.1:8000/inspector/resource-har-conversion.html"
- startedDateTime : <object>
+ startedDateTime : <plausible>
time : <number>
request : {
method : "GET"
@@ -183,7 +183,7 @@
}
{
pageref : "http://127.0.0.1:8000/inspector/resource-har-conversion.html"
- startedDateTime : <object>
+ startedDateTime : <plausible>
time : <number>
request : {
method : "POST"
Modified: trunk/Source/WebCore/ChangeLog (102915 => 102916)
--- trunk/Source/WebCore/ChangeLog 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/Source/WebCore/ChangeLog 2011-12-15 11:58:46 UTC (rev 102916)
@@ -1,3 +1,19 @@
+2011-12-13 Andrey Kosyakov <[email protected]>
+
+ Web Inspector: Generated HAR is missing pages.startedDateTime
+ https://bugs.webkit.org/show_bug.cgi?id=74188
+
+ Reviewed by Pavel Feldman.
+
+ * inspector/front-end/HAREntry.js:
+ (WebInspector.HARLog.prototype._buildPages):
+ * inspector/front-end/NetworkLog.js:
+ (WebInspector.NetworkLog):
+ (WebInspector.NetworkLog.prototype.get mainResourceStartTime):
+ (WebInspector.NetworkLog.prototype._mainFrameNavigated):
+ * inspector/front-end/NetworkPanel.js:
+ (WebInspector.NetworkLogView.prototype._updateSummaryBar):
+
2011-12-15 Kenichi Ishibashi <[email protected]>
Supports Unicode variation selector
Modified: trunk/Source/WebCore/inspector/front-end/HAREntry.js (102915 => 102916)
--- trunk/Source/WebCore/inspector/front-end/HAREntry.js 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/Source/WebCore/inspector/front-end/HAREntry.js 2011-12-15 11:58:46 UTC (rev 102916)
@@ -237,7 +237,7 @@
{
return [
{
- startedDateTime: new Date(WebInspector.mainResourceStartTime * 1000),
+ startedDateTime: new Date(WebInspector.networkLog.mainResourceStartTime * 1000),
id: WebInspector.inspectedPageURL,
title: "",
pageTimings: this.buildMainResourceTimings()
Modified: trunk/Source/WebCore/inspector/front-end/NetworkLog.js (102915 => 102916)
--- trunk/Source/WebCore/inspector/front-end/NetworkLog.js 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/Source/WebCore/inspector/front-end/NetworkLog.js 2011-12-15 11:58:46 UTC (rev 102916)
@@ -34,6 +34,7 @@
WebInspector.NetworkLog = function()
{
this._resources = [];
+ this._mainResourceStartTime = null;
WebInspector.networkManager.addEventListener(WebInspector.NetworkManager.EventTypes.ResourceStarted, this._onResourceStarted, this);
WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.MainFrameNavigated, this._mainFrameNavigated, this);
}
@@ -47,13 +48,27 @@
return this._resources;
},
+ /**
+ * @return {?Date}
+ */
+ get mainResourceStartTime()
+ {
+ return this._mainResourceStartTime;
+ },
+
_mainFrameNavigated: function(event)
{
+ var mainFrame = event.data;
+ this._mainResourceStartTime = null;
// Preserve resources from the new session.
var oldResources = this._resources.splice(0, this._resources.length);
for (var i = 0; i < oldResources.length; ++i) {
- if (oldResources[i].loaderId === event.data.loaderId)
- this._resources.push(oldResources[i]);
+ var resource = oldResources[i];
+ if (resource.loaderId === mainFrame.loaderId) {
+ if (!this._mainResourceStartTime && mainFrame.url ="" resource.url)
+ this._mainResourceStartTime = resource.startTime;
+ this._resources.push(resource);
+ }
}
},
Modified: trunk/Source/WebCore/inspector/front-end/NetworkPanel.js (102915 => 102916)
--- trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2011-12-15 11:57:05 UTC (rev 102915)
+++ trunk/Source/WebCore/inspector/front-end/NetworkPanel.js 2011-12-15 11:58:46 UTC (rev 102916)
@@ -403,10 +403,8 @@
selectedRequestsNumber++;
selectedTransferSize += resourceTransferSize;
}
- if (resource.url ="" WebInspector.inspectedPageURL) {
+ if (resource.url ="" WebInspector.inspectedPageURL)
baseTime = resource.startTime;
- WebInspector.mainResourceStartTime = resource.startTime;
- }
if (resource.endTime > maxTime)
maxTime = resource.endTime;
}