Bug 1194848 - Make it possible to run fetch-canvas-tainting.https.html; r=jdm

This commit is contained in:
Ehsan Akhgari 2015-09-10 15:18:00 -04:00
parent 50b87b30dd
commit 4a192edc99
3 changed files with 27 additions and 27 deletions

View File

@ -1,6 +0,0 @@
[fetch-canvas-tainting.https.html]
type: testharness
expected: TIMEOUT
[Verify canvas tainting of fetched image in a Service Worker]
expected: TIMEOUT

View File

@ -11,7 +11,7 @@ async_test(function(t) {
var SCRIPT = 'resources/fetch-rewrite-worker.js'; var SCRIPT = 'resources/fetch-rewrite-worker.js';
var host_info = get_host_info(); var host_info = get_host_info();
login(t) login_https(t)
.then(function() { .then(function() {
return service_worker_unregister_and_register(t, SCRIPT, SCOPE); return service_worker_unregister_and_register(t, SCRIPT, SCOPE);
}) })
@ -28,7 +28,7 @@ async_test(function(t) {
service_worker_unregister_and_done(t, SCOPE); service_worker_unregister_and_done(t, SCOPE);
}); });
frame.contentWindow.postMessage({}, frame.contentWindow.postMessage({},
host_info['HTTP_ORIGIN'], host_info['HTTPS_ORIGIN'],
[channel.port2]); [channel.port2]);
}); });
}) })

View File

@ -51,8 +51,8 @@ function create_test_promise(url, cross_origin, expected_result) {
window.addEventListener('message', function(evt) { window.addEventListener('message', function(evt) {
var port = evt.ports[0]; var port = evt.ports[0];
var image_url = host_info['HTTP_ORIGIN'] + image_path; var image_url = host_info['HTTPS_ORIGIN'] + image_path;
var remote_image_url = host_info['HTTP_REMOTE_ORIGIN'] + image_path; var remote_image_url = host_info['HTTPS_REMOTE_ORIGIN'] + image_path;
Promise.all([ Promise.all([
// Reject tests // Reject tests
create_test_promise(image_url + '&reject', '', LOAD_ERROR), create_test_promise(image_url + '&reject', '', LOAD_ERROR),
@ -73,7 +73,7 @@ window.addEventListener('message', function(evt) {
'anonymous', 'anonymous',
LOAD_ERROR), LOAD_ERROR),
create_test_promise( create_test_promise(
remote_image_url + '&ACAOrigin=' + host_info['HTTP_ORIGIN'] + remote_image_url + '&ACAOrigin=' + host_info['HTTPS_ORIGIN'] +
'&ignore', '&ignore',
'anonymous', 'anonymous',
NOT_TAINTED), NOT_TAINTED),
@ -82,12 +82,12 @@ window.addEventListener('message', function(evt) {
'use-credentials', 'use-credentials',
LOAD_ERROR), LOAD_ERROR),
create_test_promise( create_test_promise(
remote_image_url + '&ACAOrigin=' + host_info['HTTP_ORIGIN'] + remote_image_url + '&ACAOrigin=' + host_info['HTTPS_ORIGIN'] +
'&ignore', '&ignore',
'use-credentials', 'use-credentials',
LOAD_ERROR), LOAD_ERROR),
create_test_promise( create_test_promise(
remote_image_url + '&ACAOrigin=' + host_info['HTTP_ORIGIN'] + remote_image_url + '&ACAOrigin=' + host_info['HTTPS_ORIGIN'] +
'&ACACredentials=true&ignore', '&ACACredentials=true&ignore',
'use-credentials', 'use-credentials',
NOT_TAINTED), NOT_TAINTED),
@ -110,12 +110,12 @@ window.addEventListener('message', function(evt) {
'use-credentials', 'use-credentials',
LOAD_ERROR), LOAD_ERROR),
create_test_promise( create_test_promise(
remote_image_url + '&Auth&ACAOrigin=' + host_info['HTTP_ORIGIN'] + remote_image_url + '&Auth&ACAOrigin=' + host_info['HTTPS_ORIGIN'] +
'&ignore', '&ignore',
'use-credentials', 'use-credentials',
LOAD_ERROR), LOAD_ERROR),
create_test_promise( create_test_promise(
remote_image_url + '&Auth&ACAOrigin=' + host_info['HTTP_ORIGIN'] + remote_image_url + '&Auth&ACAOrigin=' + host_info['HTTPS_ORIGIN'] +
'&ACACredentials=true&ignore', '&ACACredentials=true&ignore',
'use-credentials', 'use-credentials',
NOT_TAINTED), NOT_TAINTED),
@ -189,58 +189,64 @@ window.addEventListener('message', function(evt) {
image_url + image_url +
'&mode=cors&url=' + '&mode=cors&url=' +
encodeURIComponent(remote_image_url + encodeURIComponent(remote_image_url +
'&ACAOrigin=' + host_info['HTTP_ORIGIN']), '&ACAOrigin=' + host_info['HTTPS_ORIGIN']),
'', '',
NOT_TAINTED), TAINTED), // We expect TAINTED since the default origin behavior here
// is taint, and it doesn't matter what kind of fetch the
// SW performs.
create_test_promise( create_test_promise(
image_url + image_url +
'&mode=cors&url=' + '&mode=cors&url=' +
encodeURIComponent(remote_image_url + encodeURIComponent(remote_image_url +
'&ACAOrigin=' + host_info['HTTP_ORIGIN']), '&ACAOrigin=' + host_info['HTTPS_ORIGIN']),
'anonymous', 'anonymous',
NOT_TAINTED), NOT_TAINTED),
create_test_promise( create_test_promise(
image_url + image_url +
'&mode=cors&url=' + '&mode=cors&url=' +
encodeURIComponent(remote_image_url + encodeURIComponent(remote_image_url +
'&ACAOrigin=' + host_info['HTTP_ORIGIN']), '&ACAOrigin=' + host_info['HTTPS_ORIGIN']),
'use-credentials', 'use-credentials',
NOT_TAINTED), LOAD_ERROR), // We expect LOAD_ERROR since the server doesn't respond
// with an Access-Control-Allow-Credentials header.
create_test_promise( create_test_promise(
image_url + image_url +
'&mode=cors&url=' + '&mode=cors&url=' +
encodeURIComponent( encodeURIComponent(
remote_image_url + remote_image_url +
'&ACACredentials=true&ACAOrigin=' + host_info['HTTP_ORIGIN']), '&ACACredentials=true&ACAOrigin=' + host_info['HTTPS_ORIGIN']),
'use-credentials', 'use-credentials',
NOT_TAINTED), NOT_TAINTED),
create_test_promise( create_test_promise(
remote_image_url + remote_image_url +
'&mode=cors&url=' + '&mode=cors&url=' +
encodeURIComponent(remote_image_url + encodeURIComponent(remote_image_url +
'&ACAOrigin=' + host_info['HTTP_ORIGIN']), '&ACAOrigin=' + host_info['HTTPS_ORIGIN']),
'', '',
NOT_TAINTED), TAINTED), // We expect TAINTED since the default origin behavior here
// is taint, and it doesn't matter what kind of fetch the
// SW performs.
create_test_promise( create_test_promise(
remote_image_url + remote_image_url +
'&mode=cors&url=' + '&mode=cors&url=' +
encodeURIComponent(remote_image_url + encodeURIComponent(remote_image_url +
'&ACAOrigin=' + host_info['HTTP_ORIGIN']), '&ACAOrigin=' + host_info['HTTPS_ORIGIN']),
'anonymous', 'anonymous',
NOT_TAINTED), NOT_TAINTED),
create_test_promise( create_test_promise(
remote_image_url + remote_image_url +
'&mode=cors&url=' + '&mode=cors&url=' +
encodeURIComponent(remote_image_url + encodeURIComponent(remote_image_url +
'&ACAOrigin=' + host_info['HTTP_ORIGIN']), '&ACAOrigin=' + host_info['HTTPS_ORIGIN']),
'use-credentials', 'use-credentials',
NOT_TAINTED), LOAD_ERROR), // We expect LOAD_ERROR since the server doesn't respond
// with an Access-Control-Allow-Credentials header.
create_test_promise( create_test_promise(
remote_image_url + remote_image_url +
'&mode=cors&url=' + '&mode=cors&url=' +
encodeURIComponent( encodeURIComponent(
remote_image_url + remote_image_url +
'&ACACredentials=true&ACAOrigin=' + host_info['HTTP_ORIGIN']), '&ACACredentials=true&ACAOrigin=' + host_info['HTTPS_ORIGIN']),
'use-credentials', 'use-credentials',
NOT_TAINTED) NOT_TAINTED)
]) ])