Bug 1450874 P2 Don't save service worker time stamps if the fetch event didn't actually dispatch. r=asuth

This commit is contained in:
Ben Kelly 2018-04-03 19:53:21 -07:00
Родитель 96a73bdbed
Коммит 0145a9634a
2 изменённых файлов: 12 добавлений и 0 удалений

Просмотреть файл

@ -137,6 +137,12 @@ InterceptedChannelBase::SaveTimeStamps()
{
MOZ_ASSERT(NS_IsMainThread());
// If we were not able to start the fetch event for some reason (like
// corrupted scripts), then just do nothing here.
if (mHandleFetchEventStart.IsNull()) {
return NS_OK;
}
nsCOMPtr<nsIChannel> underlyingChannel;
nsresult rv = GetChannel(getter_AddRefs(underlyingChannel));
MOZ_ASSERT(NS_SUCCEEDED(rv));

Просмотреть файл

@ -957,6 +957,12 @@ InterceptedHttpChannel::SetChannelResetEnd(mozilla::TimeStamp aTimeStamp)
NS_IMETHODIMP
InterceptedHttpChannel::SaveTimeStamps(void)
{
// If we were not able to start the fetch event for some reason (like
// corrupted scripts), then just do nothing here.
if (mHandleFetchEventStart.IsNull()) {
return NS_OK;
}
bool isNonSubresourceRequest = nsContentUtils::IsNonSubresourceRequest(this);
nsCString navigationOrSubresource = isNonSubresourceRequest ?
NS_LITERAL_CSTRING("navigation") : NS_LITERAL_CSTRING("subresource");