Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js (186097 => 186098)
--- trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js 2015-06-30 00:24:05 UTC (rev 186097)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/FrameResourceManager.js 2015-06-30 00:27:29 UTC (rev 186098)
@@ -177,6 +177,13 @@
if (this._waitingForMainFrameResourceTreePayload)
return;
+ // COMPATIBILITY (iOS 8): Timeline timestamps for legacy backends are computed
+ // dynamically from the first backend timestamp received. For navigations we
+ // need to reset that base timestamp, and an appropriate timestamp to use is
+ // the new main resource's will be sent timestamp. So save this value on the
+ // resource in case it becomes a main resource.
+ var originalRequestWillBeSentTimestamp = timestamp;
+
var elapsedTime = WebInspector.timelineManager.computeElapsedTime(timestamp);
var resource = this._resourceRequestIdentifierMap[requestIdentifier];
if (resource) {
@@ -189,7 +196,7 @@
var initiatorSourceCodeLocation = this._initiatorSourceCodeLocationFromPayload(initiator);
// This is a new request, make a new resource and add it to the right frame.
- resource = this._addNewResourceToFrame(requestIdentifier, frameIdentifier, loaderIdentifier, request.url, type, request.method, request.headers, request.postData, elapsedTime, null, null, initiatorSourceCodeLocation);
+ resource = this._addNewResourceToFrame(requestIdentifier, frameIdentifier, loaderIdentifier, request.url, type, request.method, request.headers, request.postData, elapsedTime, null, null, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp);
// Associate the resource with the requestIdentifier so it can be found in future loading events.
this._resourceRequestIdentifierMap[requestIdentifier] = resource;
@@ -380,7 +387,7 @@
// Private
- _addNewResourceToFrame(requestIdentifier, frameIdentifier, loaderIdentifier, url, type, requestMethod, requestHeaders, requestData, elapsedTime, frameName, frameSecurityOrigin, initiatorSourceCodeLocation)
+ _addNewResourceToFrame(requestIdentifier, frameIdentifier, loaderIdentifier, url, type, requestMethod, requestHeaders, requestData, elapsedTime, frameName, frameSecurityOrigin, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp)
{
console.assert(!this._waitingForMainFrameResourceTreePayload);
@@ -394,12 +401,12 @@
else if (frame.provisionalMainResource && frame.provisionalMainResource.url ="" url && frame.provisionalLoaderIdentifier === loaderIdentifier)
resource = frame.provisionalMainResource;
else {
- resource = new WebInspector.Resource(url, null, type, loaderIdentifier, requestIdentifier, requestMethod, requestHeaders, requestData, elapsedTime, initiatorSourceCodeLocation);
+ resource = new WebInspector.Resource(url, null, type, loaderIdentifier, requestIdentifier, requestMethod, requestHeaders, requestData, elapsedTime, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp);
this._addResourceToFrame(frame, resource);
}
} else {
// This is a new request for a new frame, which is always the main resource.
- resource = new WebInspector.Resource(url, null, type, loaderIdentifier, requestIdentifier, requestMethod, requestHeaders, requestData, elapsedTime, initiatorSourceCodeLocation);
+ resource = new WebInspector.Resource(url, null, type, loaderIdentifier, requestIdentifier, requestMethod, requestHeaders, requestData, elapsedTime, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp);
frame = new WebInspector.Frame(frameIdentifier, frameName, frameSecurityOrigin, loaderIdentifier, resource);
this._frameIdentifierMap[frame.id] = frame;
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js (186097 => 186098)
--- trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js 2015-06-30 00:24:05 UTC (rev 186097)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/Resource.js 2015-06-30 00:27:29 UTC (rev 186098)
@@ -25,7 +25,7 @@
WebInspector.Resource = class Resource extends WebInspector.SourceCode
{
- constructor(url, mimeType, type, loaderIdentifier, requestIdentifier, requestMethod, requestHeaders, requestData, requestSentTimestamp, initiatorSourceCodeLocation)
+ constructor(url, mimeType, type, loaderIdentifier, requestIdentifier, requestMethod, requestHeaders, requestData, requestSentTimestamp, initiatorSourceCodeLocation, originalRequestWillBeSentTimestamp)
{
super();
@@ -45,6 +45,7 @@
this._responseHeaders = {};
this._parentFrame = null;
this._initiatorSourceCodeLocation = initiatorSourceCodeLocation || null;
+ this._originalRequestWillBeSentTimestamp = originalRequestWillBeSentTimestamp || null;
this._requestSentTimestamp = requestSentTimestamp || NaN;
this._responseReceivedTimestamp = NaN;
this._lastRedirectReceivedTimestamp = NaN;
@@ -139,6 +140,11 @@
return this._initiatorSourceCodeLocation;
}
+ get originalRequestWillBeSentTimestamp()
+ {
+ return this._originalRequestWillBeSentTimestamp;
+ }
+
get type()
{
return this._type;
Modified: trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js (186097 => 186098)
--- trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js 2015-06-30 00:24:05 UTC (rev 186097)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/TimelineRecording.js 2015-06-30 00:27:29 UTC (rev 186098)
@@ -197,17 +197,35 @@
if (!timestamp || isNaN(timestamp))
return NaN;
- // COMPATIBILITY (iOS8): old backends send timestamps (milliseconds since the epoch), rather
- // than seconds elapsed since timeline capturing started. We approximate the latter by
+ // COMPATIBILITY (iOS8): old backends send timestamps (seconds or milliseconds since the epoch),
+ // rather than seconds elapsed since timeline capturing started. We approximate the latter by
// subtracting the start timestamp, as old versions did not use monotonic times.
+ if (WebInspector.TimelineRecording.isLegacy === undefined)
+ WebInspector.TimelineRecording.isLegacy = timestamp > WebInspector.TimelineRecording.TimestampThresholdForLegacyRecordConversion;
+
+ if (!WebInspector.TimelineRecording.isLegacy)
+ return timestamp;
+
+ // If the record's start time is large, but not really large, then it is seconds since epoch
+ // not millseconds since epoch, so convert it to milliseconds.
+ if (timestamp < WebInspector.TimelineRecording.TimestampThresholdForLegacyAssumedMilliseconds)
+ timestamp *= 1000;
+
if (isNaN(this._legacyFirstRecordedTimestamp))
this._legacyFirstRecordedTimestamp = timestamp;
- // If the record's start time sems unreasonably large, treat it as a legacy timestamp.
- if (timestamp > WebInspector.TimelineRecording.TimestampThresholdForLegacyRecordConversion)
- return (timestamp - this._legacyFirstRecordedTimestamp) / 1000.0;
+ // Return seconds since the first recorded value.
+ return (timestamp - this._legacyFirstRecordedTimestamp) / 1000.0;
+ }
- return timestamp;
+ setLegacyBaseTimestamp(timestamp)
+ {
+ console.assert(isNaN(this._legacyFirstRecordedTimestamp));
+
+ if (timestamp < WebInspector.TimelineRecording.TimestampThresholdForLegacyAssumedMilliseconds)
+ timestamp *= 1000;
+
+ this._legacyFirstRecordedTimestamp = timestamp;
}
// Private
@@ -253,4 +271,6 @@
TimesUpdated: "timeline-recording-times-updated"
};
-WebInspector.TimelineRecording.TimestampThresholdForLegacyRecordConversion = 28800000; // Date.parse("Jan 1, 1970")
+WebInspector.TimelineRecording.isLegacy = undefined;
+WebInspector.TimelineRecording.TimestampThresholdForLegacyRecordConversion = 10000000; // Some value not near zero.
+WebInspector.TimelineRecording.TimestampThresholdForLegacyAssumedMilliseconds = 1420099200000; // Date.parse("Jan 1, 2015"). Milliseconds since epoch.