Bug 1216695 - Remove the Request.context specific bits from fetch-request-resources.https.html; r=bkelly

This commit is contained in:
Ehsan Akhgari 2015-10-20 15:27:23 -04:00
parent c8697d81e0
commit b6a8361701
2 changed files with 41 additions and 76 deletions

View File

@ -8,12 +8,11 @@
var url_count = 0;
var expected_results = {};
function image_test(frame, url, cross_origin, expected_context,
expexted_mode, expected_credentials) {
function image_test(frame, url, cross_origin, expexted_mode,
expected_credentials) {
var actual_url = url + (++url_count);
expected_results[actual_url] = {
cross_origin: cross_origin,
context: expected_context,
mode: expexted_mode,
credentials: expected_credentials,
message: 'Image load (url:' +
@ -22,12 +21,11 @@ function image_test(frame, url, cross_origin, expected_context,
return frame.contentWindow.load_image(actual_url, cross_origin);
}
function script_test(frame, url, cross_origin, expected_context,
expexted_mode, expected_credentials) {
function script_test(frame, url, cross_origin, expexted_mode,
expected_credentials) {
var actual_url = url + (++url_count);
expected_results[actual_url] = {
cross_origin: cross_origin,
context: expected_context,
mode: expexted_mode,
credentials: expected_credentials,
message: 'Script load (url:' +
@ -36,12 +34,11 @@ function script_test(frame, url, cross_origin, expected_context,
return frame.contentWindow.load_script(actual_url, cross_origin);
}
function css_test(frame, url, cross_origin, expected_context,
expexted_mode, expected_credentials) {
function css_test(frame, url, cross_origin, expexted_mode,
expected_credentials) {
var actual_url = url + (++url_count);
expected_results[actual_url] = {
cross_origin: cross_origin,
context: expected_context,
mode: expexted_mode,
credentials: expected_credentials,
message: 'CSS load (url:' +
@ -50,12 +47,10 @@ function css_test(frame, url, cross_origin, expected_context,
return frame.contentWindow.load_css(actual_url, cross_origin);
}
function font_face_test(frame, url, expected_context, expexted_mode,
expected_credentials) {
function font_face_test(frame, url, expexted_mode, expected_credentials) {
var actual_url = url + (++url_count);
expected_results[actual_url] = {
url: actual_url,
context: expected_context,
mode: expexted_mode,
credentials: expected_credentials,
message: 'FontFace load (url:' + actual_url + ')'
@ -63,12 +58,11 @@ function font_face_test(frame, url, expected_context, expexted_mode,
return frame.contentWindow.load_font(actual_url);
}
function css_image_test(frame, url, type, expected_context,
expexted_mode, expected_credentials) {
function css_image_test(frame, url, type, expexted_mode,
expected_credentials) {
var actual_url = url + (++url_count);
expected_results[actual_url] = {
url: actual_url,
context: expected_context,
mode: expexted_mode,
credentials: expected_credentials,
message: 'CSSImage load (url:' + actual_url + ' type:' + type + ')'
@ -76,12 +70,11 @@ function css_image_test(frame, url, type, expected_context,
return frame.contentWindow.load_css_image(actual_url, type);
}
function css_image_set_test(frame, url, type, expected_context,
expexted_mode, expected_credentials) {
function css_image_set_test(frame, url, type, expexted_mode,
expected_credentials) {
var actual_url = url + (++url_count);
expected_results[actual_url] = {
url: actual_url,
context: expected_context,
mode: expexted_mode,
credentials: expected_credentials,
message: 'CSSImageSet load (url:' + actual_url + ' type:' + type + ')'
@ -94,9 +87,9 @@ async_test(function(t) {
var SCRIPT = 'resources/fetch-request-resources-worker.js';
var host_info = get_host_info();
var LOCAL_URL =
host_info['HTTP_ORIGIN'] + base_path() + 'resources/dummy?test';
host_info['HTTPS_ORIGIN'] + base_path() + 'resources/dummy?test';
var REMOTE_URL =
host_info['HTTP_REMOTE_ORIGIN'] + base_path() + 'resources/dummy?test';
host_info['HTTPS_REMOTE_ORIGIN'] + base_path() + 'resources/dummy?test';
var worker;
var frame;
service_worker_unregister_and_register(t, SCRIPT, SCOPE)
@ -117,17 +110,6 @@ async_test(function(t) {
if (!expected) {
return;
}
assert_equals(
result.context, expected.context,
'context of ' + expected.message + ' must be ' +
expected.context + '.');
assert_equals(
result.context_clone, expected.context,
'context of clone() of' + expected.message +
' must be ' + expected.context + '.');
assert_equals(
result.context_new, '',
'context of new Request() must be the empty string');
assert_equals(
result.mode, expected.mode,
'mode of ' + expected.message + ' must be ' +
@ -150,53 +132,39 @@ async_test(function(t) {
.then(function() { return with_iframe(SCOPE); })
.then(function(f) {
frame = f;
image_test(f, LOCAL_URL, '', 'image', 'no-cors', 'same-origin');
image_test(f, LOCAL_URL, 'anonymous', 'image', 'cors', 'omit');
image_test(f, LOCAL_URL, 'use-credentials', 'image', 'cors',
'include');
image_test(f, REMOTE_URL, '', 'image', 'no-cors', 'same-origin');
image_test(f, REMOTE_URL, 'anonymous', 'image', 'cors', 'omit');
image_test(f, REMOTE_URL, 'use-credentials', 'image', 'cors',
'include');
image_test(f, LOCAL_URL, '', 'no-cors', 'same-origin');
image_test(f, LOCAL_URL, 'anonymous', 'cors', 'omit');
image_test(f, LOCAL_URL, 'use-credentials', 'cors', 'include');
image_test(f, REMOTE_URL, '', 'no-cors', 'same-origin');
image_test(f, REMOTE_URL, 'anonymous', 'cors', 'omit');
image_test(f, REMOTE_URL, 'use-credentials', 'cors', 'include');
script_test(f, LOCAL_URL, '', 'script', 'no-cors', 'same-origin');
script_test(f, LOCAL_URL, 'anonymous', 'script', 'cors', 'omit');
script_test(f, LOCAL_URL, 'use-credentials', 'script', 'cors',
'include');
script_test(f, REMOTE_URL, '', 'script', 'no-cors', 'same-origin');
script_test(f, REMOTE_URL, 'anonymous', 'script', 'cors', 'omit');
script_test(f, REMOTE_URL, 'use-credentials', 'script', 'cors',
'include');
script_test(f, LOCAL_URL, '', 'no-cors', 'same-origin');
script_test(f, LOCAL_URL, 'anonymous', 'cors', 'omit');
script_test(f, LOCAL_URL, 'use-credentials', 'cors', 'include');
script_test(f, REMOTE_URL, '', 'no-cors', 'same-origin');
script_test(f, REMOTE_URL, 'anonymous', 'cors', 'omit');
script_test(f, REMOTE_URL, 'use-credentials', 'cors', 'include');
css_test(f, LOCAL_URL, '', 'style', 'no-cors', 'same-origin');
css_test(f, LOCAL_URL, 'anonymous', 'style', 'cors', 'omit');
css_test(f, LOCAL_URL, 'use-credentials', 'style', 'cors',
'include');
css_test(f, REMOTE_URL, '', 'style', 'no-cors', 'same-origin');
css_test(f, REMOTE_URL, 'anonymous', 'style', 'cors', 'omit');
css_test(f, REMOTE_URL, 'use-credentials', 'style', 'cors',
'include');
css_test(f, LOCAL_URL, '', 'no-cors', 'same-origin');
css_test(f, LOCAL_URL, 'anonymous', 'cors', 'omit');
css_test(f, LOCAL_URL, 'use-credentials', 'cors', 'include');
css_test(f, REMOTE_URL, '', 'no-cors', 'same-origin');
css_test(f, REMOTE_URL, 'anonymous', 'cors', 'omit');
css_test(f, REMOTE_URL, 'use-credentials', 'cors', 'include');
font_face_test(f, LOCAL_URL, 'font', 'no-cors', 'same-origin');
font_face_test(f, REMOTE_URL, 'font', 'cors', 'omit');
font_face_test(f, LOCAL_URL, 'no-cors', 'same-origin');
font_face_test(f, REMOTE_URL, 'cors', 'omit');
css_image_test(f, LOCAL_URL, 'backgroundImage', 'image',
'no-cors', 'same-origin');
css_image_test(f, REMOTE_URL, 'backgroundImage', 'image',
'no-cors', 'same-origin');
css_image_test(f, LOCAL_URL, 'shapeOutside', 'image', 'cors',
'omit');
css_image_test(f, REMOTE_URL, 'shapeOutside', 'image', 'cors',
'omit');
css_image_test(f, LOCAL_URL, 'backgroundImage', 'no-cors', 'same-origin');
css_image_test(f, REMOTE_URL, 'backgroundImage', 'no-cors', 'same-origin');
css_image_test(f, LOCAL_URL, 'shapeOutside', 'cors', 'omit');
css_image_test(f, REMOTE_URL, 'shapeOutside', 'cors', 'omit');
css_image_set_test(f, LOCAL_URL, 'backgroundImage', 'image',
'no-cors', 'same-origin');
css_image_set_test(f, REMOTE_URL, 'backgroundImage', 'image',
'no-cors', 'same-origin');
css_image_set_test(f, LOCAL_URL, 'shapeOutside', 'image', 'cors',
'omit');
css_image_set_test(f, REMOTE_URL, 'shapeOutside', 'image', 'cors',
'omit');
css_image_set_test(f, LOCAL_URL, 'backgroundImage', 'no-cors', 'same-origin');
css_image_set_test(f, REMOTE_URL, 'backgroundImage', 'no-cors', 'same-origin');
css_image_set_test(f, LOCAL_URL, 'shapeOutside', 'cors', 'omit');
css_image_set_test(f, REMOTE_URL, 'shapeOutside', 'cors', 'omit');
})
.catch(unreached_rejection(t));

View File

@ -16,9 +16,6 @@ self.addEventListener('fetch', function(event) {
}
port.postMessage({
url: url,
context: event.request.context,
context_clone: event.request.clone().context,
context_new: (new Request(event.request)).context,
mode: event.request.mode,
credentials: event.request.credentials
});