New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.
Starred by 4 users

Issue metadata

Status: Fixed
Owner:
Closed: May 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment
link

Issue 649571: [Resource Timing] PerformanceResourceTiming.initiatorType === "" when used with the fetch API

Reported by ericbidelman@chromium.org, Sep 23 2016 Project Member

Issue description

Version:  55.0.2868.0
OS: all

The following code fails:

let observer = new PerformanceObserver(list => {
  list.getEntries().forEach(entry => {
    console.assert(entry.initiatorType, 'initiatorType was blank');
  })
});
observer.observe({entryTypes: ['resource']});

fetch('https://bugzilla.mozilla.org/rest/bug/1304495');

Using an XHR instead succeeds b/c initiatorType=xmlhttprequest
 

Comment 1 by igrigo...@chromium.org, Sep 23 2016

Cc: kenjibaheux@chromium.org y...@yoav.ws panicker@chromium.org

Comment 2 by ericbidelman@chromium.org, Nov 11 2016

Cc: paulir...@chromium.org
Hey folks, any progress on this? Does it need to be added to the spec? Lighthouse is interested in this for one of its audits

Comment 3 by igrigo...@google.com, Nov 11 2016

Eric, good timing.. see: https://github.com/w3c/resource-timing/issues/69#issuecomment-260033801

For context, what information are you looking for in Lighthouse? You're specifically interested in distinguishing fetch()-initiated resources from the rest? Are there other types that are not covered today that you need?

Comment 4 by ericbide...@google.com, Nov 12 2016

The specific use case is here: https://github.com/GoogleChrome/lighthouse/issues/871#issuecomment-260062573

TLDR: We'd like to catch xhr's and fetch() requests in beforeunload/pagehide handlers using PerformanceObserver. For us, distinguishing between fetch/xhr isn't as important as verifying it was one of those methods that made the request. However, I can see other developers wanting to make the distinction.

> Are there other types that are not covered today that you need?

Can't think of any other (new platform ways) to make requests. :)

Comment 5 by igrigo...@google.com, Nov 14 2016

Gotcha, thanks for the context. Followed up on GitHub.

Comment 6 by ericbide...@google.com, Nov 14 2016

> Are there other types that are not covered today that you need?

Ah! navigator.sendBeacon() does not trigger PerformanceObserver callbacks for entryTypes: 'resource'.

LMK if I should file a bug on that.

Comment 7 by igrigo...@google.com, Nov 14 2016

Doh, and please do!

Comment 9 by yhirano@chromium.org, Jan 12 2017

Components: Blink>PerformanceAPIs
Status: Available (was: Untriaged)

Comment 10 by tdres...@chromium.org, Aug 2 2017

Summary: [Resource Timing] PerformanceResourceTiming.initiatorType === "" when used with the fetch API (was: PerformanceResourceTiming.initiatorType === "" when used with the fetch API)

Comment 11 by tdres...@chromium.org, Nov 15 2017

Components: -Blink>PerformanceAPIs Blink>PerformanceAPIs>ResourceTiming

Comment 12 Deleted

Comment 13 by ericbide...@google.com, Feb 11 2018

Any updates on this?

Comment 14 by tdres...@chromium.org, Feb 12 2018

Owner: tyoshino@chromium.org
Over to tyoshino@ for triage. Does someone in TOK have bandwidth for this?

Comment 15 by tyoshino@chromium.org, Feb 26 2018

Cc: ksakamoto@chromium.org
Owner: ricea@chromium.org
Tentatively assigning to ricea@ just in case you're familiar with, +ksakamoto@.

Comment 16 by 25pratha...@gmail.com, May 2 2018

Any updates on this? this issue affecting my performance measurement code.

Comment 17 by y...@yoav.ws, May 3 2018

Cc: -y...@yoav.ws ricea@chromium.org
Owner: y...@yoav.ws
Status: Started (was: Available)
Got a patch going last night, so taking over (considering ricea@ is out atm, I'm guessing he won't mind)

Comment 18 by 25pratha...@gmail.com, May 28 2018

y...@yoav.ws Any updates on this?   found the same issue for favicon also  checked on  Chrome Version 65.0.3325.181 MacOS 10.13.3

Comment 19 by y...@yoav.ws, May 28 2018

Thanks for pinging! I thought I already landed a fix for this at https://chromium-review.googlesource.com/c/chromium/src/+/1040925 but looks like it didn't make the CQ. Trying to reland now

Comment 20 by bugdroid1@chromium.org, May 28 2018

Project Member
The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d78c1e54e74aa1947a2cfc3caa33e441cec5f53d

commit d78c1e54e74aa1947a2cfc3caa33e441cec5f53d
Author: Yoav Weiss <yoav@yoav.ws>
Date: Mon May 28 09:36:44 2018

[Resource-Timing] Fix `initiatorType` values

There were multiple issues with current `initiatorType` implementation:
* `fetch()` resources had an empty value instead of "fetch"
* `<video>` resources had an empty value instead of "video"
* `<audio>` resources had an empty value instead of "audio"
* `<track>` resources had "texttrack" value instead of "track"
* EventSource resources had an empty value instead of "other"

On top of that, the test to make sure the above is all in check had
some values that were not aligned to the spec, and was disabled due to
the flakiness of audio and video loads.

This CL fixes the above values, fixes the test to be more spec
compliant and enables it.

Bug:  649571 , 822757
Change-Id: I1dc6fd35e5e4bc570cbbb7d743dc02279bf42b8b
Reviewed-on: https://chromium-review.googlesource.com/1040925
Commit-Queue: Yoav Weiss <yoav@yoav.ws>
Reviewed-by: Timothy Dresser <tdresser@chromium.org>
Reviewed-by: Nicolás Peña Moreno <npm@chromium.org>
Cr-Commit-Position: refs/heads/master@{#562221}
[modify] https://crrev.com/d78c1e54e74aa1947a2cfc3caa33e441cec5f53d/third_party/WebKit/LayoutTests/TestExpectations
[modify] https://crrev.com/d78c1e54e74aa1947a2cfc3caa33e441cec5f53d/third_party/WebKit/LayoutTests/external/wpt/resource-timing/resource_initiator_types.html
[modify] https://crrev.com/d78c1e54e74aa1947a2cfc3caa33e441cec5f53d/third_party/blink/renderer/core/exported/web_associated_url_loader_impl.cc
[modify] https://crrev.com/d78c1e54e74aa1947a2cfc3caa33e441cec5f53d/third_party/blink/renderer/core/fetch/fetch_manager.cc
[modify] https://crrev.com/d78c1e54e74aa1947a2cfc3caa33e441cec5f53d/third_party/blink/renderer/core/loader/text_track_loader.cc
[modify] https://crrev.com/d78c1e54e74aa1947a2cfc3caa33e441cec5f53d/third_party/blink/renderer/core/timing/performance_resource_timing.cc
[modify] https://crrev.com/d78c1e54e74aa1947a2cfc3caa33e441cec5f53d/third_party/blink/renderer/platform/loader/fetch/fetch_initiator_type_names.json5
[modify] https://crrev.com/d78c1e54e74aa1947a2cfc3caa33e441cec5f53d/third_party/blink/renderer/platform/loader/fetch/resource.cc

Comment 21 by y...@yoav.ws, May 28 2018

Status: Fixed (was: Started)
Should be fixed in tomorrow's Canary. Please verify in a few days and let me know if that's not the case.

Comment 22 by 25pratha...@gmail.com, Jun 1 2018

Hi y...@yoav.ws
bug fixed, verified in Canary Version 69.0.3447.2 on Mac OS 10.13.3
Thank You :)
Screen Shot 2018-06-01 at 5.07.04 PM.png
495 KB View Download

Sign in to add a comment