Skip to content

Commit

Permalink
Bug 1770395 - Telemetry for file protocol script loads. r=freddyb
Browse files Browse the repository at this point in the history
  • Loading branch information
evilpie committed May 25, 2022
1 parent 3cc9231 commit 0182433
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
2 changes: 2 additions & 0 deletions dom/security/nsContentSecurityManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1291,9 +1291,11 @@ static nsresult CheckAllowFileProtocolScriptLoad(nsIChannel* aChannel) {

if (!nsContentUtils::IsJavascriptMIMEType(
NS_ConvertUTF8toUTF16(contentType))) {
Telemetry::Accumulate(Telemetry::SCRIPT_FILE_PROTOCOL_CORRECT_MIME, false);
return NS_ERROR_CONTENT_BLOCKED;
}

Telemetry::Accumulate(Telemetry::SCRIPT_FILE_PROTOCOL_CORRECT_MIME, true);
return NS_OK;
}

Expand Down
10 changes: 10 additions & 0 deletions toolkit/components/telemetry/Histograms.json
Original file line number Diff line number Diff line change
Expand Up @@ -10085,6 +10085,16 @@
"labels": ["unknown","javaScript","image", "audio", "video","text_plain","text_csv","text_xml","app_octet_stream","app_xml","app_json","text_json","text_html","empty","serviceworker_load","worker_load","importScript_load","script_load","same_origin","CORS_origin","cross_origin", "worklet_load"],
"description": "Whether the script load has a MIME type of ...? (unknown, javaScript, image, audio, video, text_plain, text_csv, text_xml, app_octet_stream, app_xml, app_json, text_json, text_html, empty). Whether the script load is from ...? (serviceworker_load, worker_load, importSript_load, script_load). Whether the script load is of ...? (same_origin, CORS_origin, cross_origin)"
},
"SCRIPT_FILE_PROTOCOL_CORRECT_MIME": {
"record_in_processes": ["main", "content"],
"products": ["firefox"],
"alert_emails": ["[email protected]"],
"bug_numbers": [1770395],
"expires_in_version": "107",
"releaseChannelCollection": "opt-out",
"kind": "boolean",
"description": "Script loaded from file:// has a correct MIME type."
},
"NEWTAB_PAGE_ENABLED": {
"record_in_processes": ["main", "content"],
"products": ["firefox", "fennec"],
Expand Down

0 comments on commit 0182433

Please sign in to comment.