Closed Bug 1531405 Opened 5 years ago Closed 5 years ago

Gather telemetry on cross-origin style sheet Content-Type headers

Categories

(Core :: DOM: Core & HTML, enhancement, P2)

enhancement

Tracking

()

RESOLVED FIXED
mozilla71
Tracking Status
firefox71 --- fixed

People

(Reporter: annevk, Assigned: valentin)

References

(Blocks 1 open bug)

Details

(Whiteboard: [sp3])

Attachments

(2 files)

Currently anything lacking a Content-Type header or having a Content-Type header that cannot be parsed, can be used as a cross-origin style sheet. It would be good to know to what extent such resources exist.

Ideally we log all Content-Type header values (or the lack of the header).

Summary: Gather telemetry on MIME types encountered on cross-origin style sheet fetches → Gather telemetry on cross-origin style sheet Content-Type headers
Priority: -- → P2
Blocks: orb
Component: DOM → DOM: Core & HTML

For this particular part of CORB++ it would be good to get telemetry sooner rather than later because if we cannot enforce text/css for style sheets we will have to rethink the design.

Flags: needinfo?(nkochar)

Dave, would it be possible to add telemetry for this?

Flags: needinfo?(nkochar) → needinfo?(dtownsend)

The relevant place to add this telemetry is presumably at https://searchfox.org/mozilla-central/rev/878bbf3cb8897a208454df27535f3522ab482cf2/netwerk/protocol/http/nsHttpChannel.cpp#1821-1824 in the case when mContentTypeHint is "text/css" (or the loadinfo type is TYPE_STYLESHEET; those should be pretty equivalent, modulo XSLT). As in, this would need to be done in networking code; by the time the style loader sees things it just sees "text/css" for these sorts of loads.

Flags: needinfo?(dtownsend) → needinfo?(valentin.gosu)

It seems that we can use Telemetry::RecordEvent to record arbitrary contentType strings.
I'll write up a patch ASAP.

Assignee: nobody → valentin.gosu
Flags: needinfo?(valentin.gosu)

That's definitely going to need a data review...

I think we need to measure 4 things initially which are hopefully fine without data review. For a cross-origin style sheet:

  • 1) Are there Content-Type headers?
  • Is the result of extracting a MIME type (and ignoring MIME type parameters) from the Content-Type headers 2) failure, 3) text/css, or 4) another MIME type?

(In particular ideally we do not equate lack of Content-Type headers or failure to parse them with text/css.)

Attached file request.md
Attachment #9098502 - Flags: data-review?(chutten)
Comment on attachment 9098502 [details]
request.md

Load balancing to Martin.
Attachment #9098502 - Flags: data-review?(chutten) → data-review?(mlopatka)

Thanks for the data review request. I'd like to request clarification on one item.

  1. List all proposed measurements and indicate the category of data collection for each measurement, using the Firefox data collection categories on the Mozilla wiki.

Whether cross-origin stylesheet responses had a Content-Type, if it was successfully parsed, and if it parsed as text

It seems to me that these values can all be encoded as Boolean types.
Can you please specify the data collection schema for these three measurements:

  • presence/absence of a cross-origin stylesheet
  • presence/absence of a Content-Type in the responses
  • Boolean specifying that the Content-Type (if present) was parsed as text True/False

Furthermore, at what level of aggregation will these values be reported?

Flags: needinfo?(valentin.gosu)

(In reply to mlopatka from comment #11)

Thanks for the data review request. I'd like to request clarification on one item.

  1. List all proposed measurements and indicate the category of data collection for each measurement, using the Firefox data collection categories on the Mozilla wiki.

Whether cross-origin stylesheet responses had a Content-Type, if it was successfully parsed, and if it parsed as text

It seems to me that these values can all be encoded as Boolean types.
Can you please specify the data collection schema for these three measurements:

  • presence/absence of a cross-origin stylesheet
  • presence/absence of a Content-Type in the responses
  • Boolean specifying that the Content-Type (if present) was parsed as text True/False

These are all represented as a categorical probe with these categories:
"NoHeader", "EmptyHeader", "FailedToParse", "ParsedTextCSS", "ParsedOther"

Furthermore, at what level of aggregation will these values be reported?

Not sure if reporting the data as a categorical probe counts as aggregation or not.
From what I understand we will not be aggregating the data with any other probes.

Flags: needinfo?(valentin.gosu)

Thank you for the clarification.
Data review r+

Attachment #9098244 - Flags: data-review+

Thanks for the review!

Pushed by valentin.gosu@gmail.com:
https://hg.mozilla.org/integration/autoland/rev/fcf12f6e3f64
Gather telemetry on cross-origin style sheet Content-Type headers r=JuniorHsu
Status: NEW → RESOLVED
Closed: 5 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla71
Regressions: 1587199
Flags: needinfo?(valentin.gosu)
Regressions: 1587604
Flags: needinfo?(valentin.gosu)

For future reference and whoever is interested, the results of these measurements are noted and analyzed in https://github.com/whatwg/fetch/issues/964.

Attachment #9098502 - Flags: data-review?(mlopatka) → data-review?
Whiteboard: [sp3]
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: