Backed out changeset 7b8dad8341e4 (bug 1510225) for wpt failures at src/netwerk/protocol/http/nsHttpChannel.cpp

This commit is contained in:
Coroiu Cristina 2018-12-19 02:23:36 +02:00
Родитель 3aeca11e88
Коммит 0e430197d3
2 изменённых файлов: 20 добавлений и 58 удалений

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

@ -1314,34 +1314,10 @@ nsresult EnsureMIMEOfScript(nsIURI *aURI, nsHttpResponseHead *aResponseHead,
if (nsContentUtils::IsJavascriptMIMEType(typeString)) {
// script load has type script
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::javaScript);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::javaScript);
return NS_OK;
}
switch (aLoadInfo->InternalContentPolicyType()) {
case nsIContentPolicy::TYPE_INTERNAL_SCRIPT:
case nsIContentPolicy::TYPE_INTERNAL_SCRIPT_PRELOAD:
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::script_load);
break;
case nsIContentPolicy::TYPE_INTERNAL_WORKER:
case nsIContentPolicy::TYPE_INTERNAL_SHARED_WORKER:
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::worker_load);
break;
case nsIContentPolicy::TYPE_INTERNAL_SERVICE_WORKER:
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::serviceworker_load);
break;
case nsIContentPolicy::TYPE_INTERNAL_WORKER_IMPORT_SCRIPTS:
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::importScript_load);
break;
default:
MOZ_ASSERT_UNREACHABLE("unexpected script type");
break;
}
nsCOMPtr<nsIURI> requestURI;
aLoadInfo->LoadingPrincipal()->GetURI(getter_AddRefs(requestURI));
@ -1351,7 +1327,7 @@ nsresult EnsureMIMEOfScript(nsIURI *aURI, nsHttpResponseHead *aResponseHead,
if (NS_SUCCEEDED(rv)) {
// same origin
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::same_origin);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::same_origin);
} else {
bool cors = false;
nsAutoCString corsOrigin;
@ -1377,11 +1353,11 @@ nsresult EnsureMIMEOfScript(nsIURI *aURI, nsHttpResponseHead *aResponseHead,
if (cors) {
// cors origin
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::CORS_origin);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::CORS_origin);
} else {
// cross origin
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::cross_origin);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::cross_origin);
}
}
@ -1389,22 +1365,22 @@ nsresult EnsureMIMEOfScript(nsIURI *aURI, nsHttpResponseHead *aResponseHead,
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("image/"))) {
// script load has type image
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::image);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::image);
block = true;
} else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("audio/"))) {
// script load has type audio
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::audio);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::audio);
block = true;
} else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("video/"))) {
// script load has type video
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::video);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::video);
block = true;
} else if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/csv"))) {
// script load has type text/csv
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_csv);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::text_csv);
block = true;
}
@ -1431,14 +1407,14 @@ nsresult EnsureMIMEOfScript(nsIURI *aURI, nsHttpResponseHead *aResponseHead,
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/plain"))) {
// script load has type text/plain
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_plain);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::text_plain);
return NS_OK;
}
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/xml"))) {
// script load has type text/xml
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_xml);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::text_xml);
return NS_OK;
}
@ -1446,48 +1422,34 @@ nsresult EnsureMIMEOfScript(nsIURI *aURI, nsHttpResponseHead *aResponseHead,
NS_LITERAL_CSTRING("application/octet-stream"))) {
// script load has type application/octet-stream
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::app_octet_stream);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::app_octet_stream);
return NS_OK;
}
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("application/xml"))) {
// script load has type application/xml
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::app_xml);
return NS_OK;
}
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("application/json"))) {
// script load has type application/json
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::app_json);
return NS_OK;
}
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/json"))) {
// script load has type text/json
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_json);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::app_xml);
return NS_OK;
}
if (StringBeginsWith(contentType, NS_LITERAL_CSTRING("text/html"))) {
// script load has type text/html
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::text_html);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::text_html);
return NS_OK;
}
if (contentType.IsEmpty()) {
// script load has no type
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::empty);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::empty);
return NS_OK;
}
// script load has unknown type
AccumulateCategorical(
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_3::unknown);
Telemetry::LABELS_SCRIPT_BLOCK_INCORRECT_MIME_2::unknown);
return NS_OK;
}

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

@ -7897,14 +7897,14 @@
"n_values": 3,
"description": "Whether the user is in safe mode (No, Yes, Forced)"
},
"SCRIPT_BLOCK_INCORRECT_MIME_3": {
"SCRIPT_BLOCK_INCORRECT_MIME_2": {
"record_in_processes": ["main", "content"],
"alert_emails": ["ckerschbaumer@mozilla.com"],
"bug_numbers": [1288361, 1299267, 1399990, 1510225],
"expires_in_version": "70",
"bug_numbers": [1288361, 1299267, 1399990],
"expires_in_version": "63",
"kind": "categorical",
"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"],
"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)"
"labels": ["unknown","javaScript","image", "audio", "video","text_plain","text_csv","text_xml","app_octet_stream","app_xml","text_html","empty","worker_load","importSript_load","script_load","same_origin","CORS_origin","cross_origin"],
"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, text_html, empty). Whether the script load is from ...? (worker_load, importSript_load, script_load). Whether the script load is of ...? (same_origin, CORS_origin, cross_origin)"
},
"NEWTAB_PAGE_ENABLED": {
"record_in_processes": ["main", "content"],