Bug 1189581 - Make service-workers/service-worker/fetch-cors-xhr.https.html pass; r=bkelly

This commit is contained in:
Ehsan Akhgari 2015-10-20 09:41:49 -04:00
Родитель a6a5a83572
Коммит 4d5f1e4ac4
4 изменённых файлов: 31 добавлений и 22 удалений

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

@ -1,6 +0,0 @@
[fetch-cors-xhr.https.html]
type: testharness
expected: TIMEOUT
[Verify CORS XHR of fetch() in a Service Worker]
expected: TIMEOUT

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

@ -11,7 +11,7 @@ async_test(function(t) {
var SCRIPT = 'resources/fetch-rewrite-worker.js';
var host_info = get_host_info();
login(t)
login_https(t)
.then(function() {
return service_worker_unregister_and_register(t, SCRIPT, SCOPE);
})
@ -28,7 +28,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]);
});
})

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

@ -54,8 +54,8 @@ function create_serial_promise(test_cases) {
window.addEventListener('message', function(evt) {
var port = evt.ports[0];
var url = host_info['HTTP_ORIGIN'] + path;
var remote_url = host_info['HTTP_REMOTE_ORIGIN'] + path;
var url = host_info['HTTPS_ORIGIN'] + path;
var remote_url = host_info['HTTPS_REMOTE_ORIGIN'] + path;
// If the 4th value of the item of TEST_CASES is true, the test case outputs
// warning messages. So such tests must be executed in serial to match the
// expected output text.
@ -76,15 +76,15 @@ window.addEventListener('message', function(evt) {
[remote_url + '?ignore', false, FAIL, true], // Executed in serial.
[remote_url + '?ignore', true, FAIL, true], // Executed in serial.
[
remote_url + '?ACAOrigin=' + host_info['HTTP_ORIGIN'] + '&ignore',
remote_url + '?ACAOrigin=' + host_info['HTTPS_ORIGIN'] + '&ignore',
false, SUCCESS
],
[
remote_url + '?ACAOrigin=' + host_info['HTTP_ORIGIN'] + '&ignore',
remote_url + '?ACAOrigin=' + host_info['HTTPS_ORIGIN'] + '&ignore',
true, FAIL, true // Executed in serial.
],
[
remote_url + '?ACAOrigin=' + host_info['HTTP_ORIGIN'] +
remote_url + '?ACAOrigin=' + host_info['HTTPS_ORIGIN'] +
'&ACACredentials=true&ignore',
true, SUCCESS
],
@ -94,15 +94,15 @@ window.addEventListener('message', function(evt) {
[remote_url + '?Auth&ignore', false, FAIL, true], // Executed in serial.
[remote_url + '?Auth&ignore', true, FAIL, true], // Executed in serial.
[
remote_url + '?Auth&ACAOrigin=' + host_info['HTTP_ORIGIN'] + '&ignore',
remote_url + '?Auth&ACAOrigin=' + host_info['HTTPS_ORIGIN'] + '&ignore',
false, 'STATUS401'
],
[
remote_url + '?Auth&ACAOrigin=' + host_info['HTTP_ORIGIN'] + '&ignore',
remote_url + '?Auth&ACAOrigin=' + host_info['HTTPS_ORIGIN'] + '&ignore',
true, FAIL, true // Executed in serial.
],
[
remote_url + '?Auth&ACAOrigin=' + host_info['HTTP_ORIGIN'] +
remote_url + '?Auth&ACAOrigin=' + host_info['HTTPS_ORIGIN'] +
'&ACACredentials=true&ignore',
true, SUCCESS
],
@ -144,26 +144,41 @@ window.addEventListener('message', function(evt) {
[
url + '?mode=cors&url=' +
encodeURIComponent(remote_url + '?ACAOrigin=' +
host_info['HTTP_ORIGIN']),
host_info['HTTPS_ORIGIN']),
false, SUCCESS
],
[
url + '?mode=cors&url=' +
encodeURIComponent(remote_url + '?ACAOrigin=' +
host_info['HTTP_ORIGIN']),
host_info['HTTPS_ORIGIN']),
true, FAIL
],
[
url + '?mode=cors&url=' +
encodeURIComponent(remote_url + '?ACAOrigin=' +
host_info['HTTPS_ORIGIN'] +
'&ACACredentials=true'),
true, SUCCESS
],
[
remote_url + '?mode=cors&url=' +
encodeURIComponent(remote_url + '?ACAOrigin=' +
host_info['HTTP_ORIGIN']),
host_info['HTTPS_ORIGIN']),
false, SUCCESS
],
[
remote_url +
'?mode=cors&url=' +
encodeURIComponent(remote_url + '?ACAOrigin=' +
host_info['HTTP_ORIGIN']),
host_info['HTTPS_ORIGIN']),
true, FAIL
],
[
remote_url +
'?mode=cors&url=' +
encodeURIComponent(remote_url + '?ACAOrigin=' +
host_info['HTTPS_ORIGIN'] +
'&ACACredentials=true'),
true, SUCCESS
]
];

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

@ -166,8 +166,8 @@ function base_path() {
function test_login(test, origin, username, password, cookie) {
return new Promise(function(resolve, reject) {
with_iframe(
origin +
'/service-worker/resources/fetch-access-control-login.html')
origin + base_path() +
'resources/fetch-access-control-login.html')
.then(test.step_func(function(frame) {
var channel = new MessageChannel();
channel.port1.onmessage = test.step_func(function() {