зеркало из https://github.com/mozilla/gecko-dev.git
Backed out 3 changesets (bug 1217501) for m(4) leaks CLOSED TREE a=merge
Backed out changeset f00f079f712b (bug 1217501) Backed out changeset 86ac4feb0e38 (bug 1217501) Backed out changeset 0c7e876a69e5 (bug 1217501) --HG-- extra : commitid : HUAufLjKQfo extra : source : c6cc9d6108651a36914189dd326856e8f2692b42
This commit is contained in:
Родитель
fcb34ba269
Коммит
5b1bb98662
|
@ -303,11 +303,7 @@ FetchDriver::HttpFetch()
|
|||
// Set the same headers.
|
||||
nsAutoTArray<InternalHeaders::Entry, 5> headers;
|
||||
mRequest->Headers()->GetEntries(headers);
|
||||
bool hasAccept = false;
|
||||
for (uint32_t i = 0; i < headers.Length(); ++i) {
|
||||
if (!hasAccept && headers[i].mName.EqualsLiteral("accept")) {
|
||||
hasAccept = true;
|
||||
}
|
||||
if (headers[i].mValue.IsEmpty()) {
|
||||
httpChan->SetEmptyRequestHeader(headers[i].mName);
|
||||
} else {
|
||||
|
@ -315,12 +311,6 @@ FetchDriver::HttpFetch()
|
|||
}
|
||||
}
|
||||
|
||||
if (!hasAccept) {
|
||||
httpChan->SetRequestHeader(NS_LITERAL_CSTRING("accept"),
|
||||
NS_LITERAL_CSTRING("*/*"),
|
||||
false /* merge */);
|
||||
}
|
||||
|
||||
// Step 2. Set the referrer.
|
||||
nsAutoString referrer;
|
||||
mRequest->GetReferrer(referrer);
|
||||
|
|
|
@ -430,19 +430,16 @@ nsHttpHandler::AddStandardRequestHeaders(nsHttpHeaderArray *request, bool isSecu
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// MIME based content negotiation lives!
|
||||
// Add the "Accept" header. Note, this is set as an override because the
|
||||
// service worker expects to see it. The other "default" headers are
|
||||
// hidden from service worker interception.
|
||||
// Add the "Accept" header
|
||||
rv = request->SetHeader(nsHttp::Accept, mAccept,
|
||||
false, nsHttpHeaderArray::eVarietyOverride);
|
||||
false, nsHttpHeaderArray::eVarietyDefault);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
// Add the "Accept-Language" header. This header is also exposed to the
|
||||
// service worker.
|
||||
// Add the "Accept-Language" header
|
||||
if (!mAcceptLanguages.IsEmpty()) {
|
||||
// Add the "Accept-Language" header
|
||||
rv = request->SetHeader(nsHttp::Accept_Language, mAcceptLanguages,
|
||||
false, nsHttpHeaderArray::eVarietyOverride);
|
||||
false, nsHttpHeaderArray::eVarietyDefault);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
|
||||
// Resolve a promise when we recieve 2 success messages
|
||||
return new Promise(function(resolve, reject) {
|
||||
var remaining = 4;
|
||||
var remaining = 2;
|
||||
function onMessage(e) {
|
||||
if (e.data == 'PASS') {
|
||||
remaining--;
|
||||
|
|
|
@ -32,35 +32,4 @@
|
|||
}).catch(function(err) {
|
||||
parent.postMessage('noUA FAIL - unexpected error: ' + err, '*');
|
||||
});
|
||||
|
||||
var uri = document.location + '?check-accept-header';
|
||||
var headers = new Headers();
|
||||
headers.set('Accept', 'hmm');
|
||||
|
||||
// Check for custom accept header
|
||||
fetch(uri, { headers: headers }).then(function(response) {
|
||||
return response.text();
|
||||
}).then(function(text) {
|
||||
if (text === headers.get('Accept')) {
|
||||
parent.postMessage('PASS', '*');
|
||||
} else {
|
||||
parent.postMessage('custom accept FAIL - expected ' + headers.get('Accept') +
|
||||
' got "' + text + '"', '*');
|
||||
}
|
||||
}).catch(function(err) {
|
||||
parent.postMessage('custom accept FAIL - unexpected error: ' + err, '*');
|
||||
});
|
||||
|
||||
// Check for default accept header
|
||||
fetch(uri).then(function(response) {
|
||||
return response.text();
|
||||
}).then(function(text) {
|
||||
if (text === '*/*') {
|
||||
parent.postMessage('PASS', '*');
|
||||
} else {
|
||||
parent.postMessage('accept FAIL - expected */* got "' + text + '"', '*');
|
||||
}
|
||||
}).catch(function(err) {
|
||||
parent.postMessage('accept FAIL - unexpected error: ' + err, '*');
|
||||
});
|
||||
</script>
|
||||
|
|
|
@ -63,14 +63,6 @@ self.addEventListener('fetch', function(event) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
if (params['check-accept-header']) {
|
||||
var accept = event.request.headers.get('Accept');
|
||||
if (accept) {
|
||||
event.respondWith(new Response(accept));
|
||||
} else {
|
||||
event.respondWith(new Response('NO_ACCEPT'));
|
||||
}
|
||||
}
|
||||
event.respondWith(new Promise(function(resolve, reject) {
|
||||
var request = event.request;
|
||||
if (url) {
|
||||
|
|
Загрузка…
Ссылка в новой задаче