Bug 1199831: Fix a bunch of mixed-content violations in imported ServiceWorker WPTs. r=jdm

This commit is contained in:
Kyle Huey 2015-08-28 16:53:43 -07:00
Родитель 63d0310e96
Коммит 8ccb0c0968
16 изменённых файлов: 29 добавлений и 40 удалений

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

@ -1,6 +1,5 @@
[fetch-csp.https.html]
type: testharness
expected: TIMEOUT
[Verify CSP control of fetch() in a Service Worker]
expected: TIMEOUT
expected: FAIL

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

@ -1,6 +1,5 @@
[fetch-request-css-base-url.https.html]
type: testharness
expected: TIMEOUT
[CSS's base URL must be the request URL even when fetched from other URL.]
expected: TIMEOUT
expected: FAIL

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

@ -1,6 +1,5 @@
[fetch-request-xhr.https.html]
type: testharness
disabled: https://bugzilla.mozilla.org/show_bug.cgi?id=1194881
[Verify the body of FetchEvent using XMLHttpRequest]
expected: TIMEOUT
expected: FAIL

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

@ -1,6 +1,5 @@
[invalid-blobtype.https.html]
type: testharness
expected: TIMEOUT
[Verify the response of FetchEvent using XMLHttpRequest]
expected: TIMEOUT
expected: FAIL

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

@ -1,6 +0,0 @@
[invalid-header.https.html]
type: testharness
expected: TIMEOUT
[Verify the response of FetchEvent using XMLHttpRequest]
expected: TIMEOUT

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

@ -1,6 +1,5 @@
[referer.https.html]
type: testharness
expected: TIMEOUT
[Verify the referer]
expected: TIMEOUT
expected: FAIL

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

@ -22,7 +22,7 @@ async_test(function(t) {
service_worker_unregister_and_done(t, SCOPE);
});
frame.contentWindow.postMessage({},
host_info['HTTP_ORIGIN'],
host_info['HTTPS_ORIGIN'],
[channel.port2]);
});
})

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

@ -25,7 +25,7 @@ async_test(function(t) {
return;
}
var result = msg.data;
var base = get_host_info()['HTTP_ORIGIN'] + base_path();
var base = get_host_info()['HTTPS_ORIGIN'] + base_path();
assert_equals(
result.url,
base + 'resources/dummy.png',

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

@ -22,7 +22,7 @@ async_test(function(t) {
service_worker_unregister_and_done(t, SCOPE);
});
frame.contentWindow.postMessage({},
host_info['HTTP_ORIGIN'],
host_info['HTTPS_ORIGIN'],
[channel.port2]);
})
.catch(unreached_rejection(t));

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

@ -22,7 +22,7 @@ async_test(function(t) {
service_worker_unregister_and_done(t, SCOPE);
});
frame.contentWindow.postMessage({},
host_info['HTTP_ORIGIN'],
host_info['HTTPS_ORIGIN'],
[channel.port2]);
})
.catch(unreached_rejection(t));

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

@ -22,7 +22,7 @@ async_test(function(t) {
service_worker_unregister_and_done(t, SCOPE);
});
frame.contentWindow.postMessage({},
host_info['HTTP_ORIGIN'],
host_info['HTTPS_ORIGIN'],
[channel.port2]);
})
.catch(unreached_rejection(t));

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

@ -22,7 +22,7 @@ async_test(function(t) {
service_worker_unregister_and_done(t, SCOPE);
});
frame.contentWindow.postMessage({},
host_info['HTTP_ORIGIN'],
host_info['HTTPS_ORIGIN'],
[channel.port2]);
})
.catch(unreached_rejection(t));

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

@ -8,7 +8,7 @@ var port = undefined;
var meta = document.createElement('meta');
meta.setAttribute('http-equiv', 'Content-Security-Policy');
meta.setAttribute('content', 'img-src ' + host_info['HTTP_ORIGIN'] +
meta.setAttribute('content', 'img-src ' + host_info['HTTPS_ORIGIN'] +
'; script-src \'unsafe-inline\'');
document.head.appendChild(meta);
@ -22,7 +22,7 @@ function test1() {
results += 'FAIL(1)';
test2();
};
img.src = host_info['HTTP_ORIGIN'] + image_path;
img.src = host_info['HTTPS_ORIGIN'] + image_path;
}
function test2() {
@ -35,7 +35,7 @@ function test2() {
img.onerror = function() {
test3();
};
img.src = host_info['HTTP_REMOTE_ORIGIN'] + image_path;
img.src = host_info['HTTPS_REMOTE_ORIGIN'] + image_path;
}
function test3() {
@ -49,7 +49,7 @@ function test3() {
test4();
};
img.src = './dummy?url=' +
encodeURIComponent(host_info['HTTP_ORIGIN'] + image_path);
encodeURIComponent(host_info['HTTPS_ORIGIN'] + image_path);
}
function test4() {
@ -63,7 +63,7 @@ function test4() {
finish();
};
img.src = './dummy?mode=no-cors&url=' +
encodeURIComponent(host_info['HTTP_REMOTE_ORIGIN'] + image_path);
encodeURIComponent(host_info['HTTPS_REMOTE_ORIGIN'] + image_path);
}
function finish() {

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

@ -15,7 +15,7 @@ self.addEventListener('fetch', function(event) {
var url = event.request.url;
if (url.indexOf('fetch-request-css-base-url-style.css') != -1) {
event.respondWith(fetch(
get_host_info()['HTTP_REMOTE_ORIGIN'] + base_path() +
get_host_info()['HTTPS_REMOTE_ORIGIN'] + base_path() +
'fetch-request-css-base-url-style.css',
{mode: 'no-cors'}));
} else if (url.indexOf('dummy.png') != -1) {

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

@ -56,7 +56,7 @@ function xhr_send(url_base, method, data, with_credentials) {
}
function string_test() {
return xhr_send(host_info['HTTP_ORIGIN'], 'POST', 'test string', false)
return xhr_send(host_info['HTTPS_ORIGIN'], 'POST', 'test string', false)
.then(function(response) {
assert_equals(response.context, 'xmlhttprequest');
assert_equals(response.method, 'POST');
@ -65,7 +65,7 @@ function string_test() {
}
function blob_test() {
return xhr_send(host_info['HTTP_ORIGIN'], 'POST', new Blob(['test blob']),
return xhr_send(host_info['HTTPS_ORIGIN'], 'POST', new Blob(['test blob']),
false)
.then(function(response) {
assert_equals(response.context, 'xmlhttprequest');
@ -75,7 +75,7 @@ function blob_test() {
}
function custom_method_test() {
return xhr_send(host_info['HTTP_ORIGIN'], 'XXX', 'test string xxx', false)
return xhr_send(host_info['HTTPS_ORIGIN'], 'XXX', 'test string xxx', false)
.then(function(response) {
assert_equals(response.method, 'XXX');
assert_equals(response.body, 'test string xxx');
@ -83,7 +83,7 @@ function custom_method_test() {
}
function options_method_test() {
return xhr_send(host_info['HTTP_ORIGIN'], 'OPTIONS', 'test string xxx', false)
return xhr_send(host_info['HTTPS_ORIGIN'], 'OPTIONS', 'test string xxx', false)
.then(function(response) {
assert_equals(response.method, 'OPTIONS');
assert_equals(response.body, 'test string xxx');
@ -98,7 +98,7 @@ function form_data_test() {
formData.append('sample blob', new Blob(['blob content']));
formData.append('sample file', new File(['file content'], 'file.dat'));
formData.append('sample fs file', file_system_file);
return xhr_send(host_info['HTTP_ORIGIN'], 'POST', formData, false);
return xhr_send(host_info['HTTPS_ORIGIN'], 'POST', formData, false);
})
.then(function(response) {
assert_equals(response.method, 'POST');
@ -132,21 +132,21 @@ function form_data_test() {
}
function mode_credentials_test() {
return xhr_send(host_info['HTTP_ORIGIN'], 'GET', '', false)
return xhr_send(host_info['HTTPS_ORIGIN'], 'GET', '', false)
.then(function(response){
assert_equals(response.mode, 'cors');
assert_equals(response.credentials, 'same-origin');
return xhr_send(host_info['HTTP_ORIGIN'], 'GET', '', true);
return xhr_send(host_info['HTTPS_ORIGIN'], 'GET', '', true);
})
.then(function(response){
assert_equals(response.mode, 'cors');
assert_equals(response.credentials, 'include');
return xhr_send(host_info['HTTP_REMOTE_ORIGIN'], 'GET', '', false);
return xhr_send(host_info['HTTPS_REMOTE_ORIGIN'], 'GET', '', false);
})
.then(function(response){
assert_equals(response.mode, 'cors');
assert_equals(response.credentials, 'same-origin');
return xhr_send(host_info['HTTP_REMOTE_ORIGIN'], 'GET', '', true);
return xhr_send(host_info['HTTPS_REMOTE_ORIGIN'], 'GET', '', true);
})
.then(function(response){
assert_equals(response.mode, 'cors');

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

@ -18,18 +18,18 @@ window.addEventListener('message', function(evt) {
var host_info = get_host_info();
var port = evt.ports[0];
check_referer('request-headers.py?ignore=true',
host_info['HTTP_ORIGIN'] +
host_info['HTTPS_ORIGIN'] +
'/service-worker/resources/referer-iframe.html')
.then(function() {
return check_referer(
'request-headers.py',
host_info['HTTP_ORIGIN'] +
host_info['HTTPS_ORIGIN'] +
'/service-worker/resources/fetch-rewrite-worker.js');
})
.then(function() {
return check_referer(
'request-headers.py?url=request-headers.py',
host_info['HTTP_ORIGIN'] +
host_info['HTTPS_ORIGIN'] +
'/service-worker/resources/fetch-rewrite-worker.js');
})
.then(function() { port.postMessage({results: 'finish'}); })