Bug 1216695 - Remove the Request.context specific bits from fetch-request-resources.https.html; r=bkelly
authorEhsan Akhgari <ehsan@mozilla.com>
Tue, 20 Oct 2015 15:27:23 -0400
changeset 268653 ea407fe50888b54de1ada0680017ac5dd6da7701
parent 268652 4f554ce35fb804c43ab12f27d18d61ec741d7609
child 268654 5d2eed6c293c08c000187d6751fd99b571d96b89
push id66896
push usereakhgari@mozilla.com
push dateWed, 21 Oct 2015 05:46:44 +0000
treeherdermozilla-inbound@da0a5c6ed61a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbkelly
bugs1216695
milestone44.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1216695 - Remove the Request.context specific bits from fetch-request-resources.https.html; r=bkelly
testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-request-resources.https.html
testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-request-resources-worker.js
--- a/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-request-resources.https.html
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/fetch-request-resources.https.html
@@ -3,105 +3,98 @@
 <script src="/resources/testharness.js"></script>
 <script src="/resources/testharnessreport.js"></script>
 <script src="resources/get-host-info.sub.js"></script>
 <script src="resources/test-helpers.sub.js?pipe=sub"></script>
 <script>
 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:' +
                actual_url + ' cross_origin:' + cross_origin + ')'
     };
   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:' +
                actual_url + ' cross_origin:' + cross_origin + ')'
     };
   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:' +
                actual_url + ' cross_origin:' + cross_origin + ')'
     };
   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 + ')'
     };
   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 + ')'
     };
   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 + ')'
     };
   return frame.contentWindow.load_css_image_set(actual_url, type);
 }
 
 async_test(function(t) {
     var SCOPE = 'resources/fetch-request-resources-iframe.https.html';
     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)
       .then(function(registration) {
           worker = registration.installing;
           return wait_for_state(t, worker, 'activated');
         })
       .then(function() {
@@ -113,27 +106,16 @@ async_test(function(t) {
                   return;
                 }
                 var result = msg.data;
                 var expected = expected_results[result.url];
                 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 ' +
                     expected.mode + '.');
                 assert_equals(
                     result.credentials, expected.credentials,
                     'credentials of ' + expected.message +  ' must be ' +
                     expected.credentials + '.');
                 --url_count;
@@ -145,60 +127,46 @@ async_test(function(t) {
               });
               worker.postMessage(
                 {port: channel.port2}, [channel.port2]);
             });
         })
       .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));
   }, 'Verify FetchEvent for resources.');
 </script>
--- a/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-request-resources-worker.js
+++ b/testing/web-platform/mozilla/tests/service-workers/service-worker/resources/fetch-request-resources-worker.js
@@ -11,16 +11,13 @@ self.onmessage = function(e) {
 
 self.addEventListener('fetch', function(event) {
     var url = event.request.url;
     if (url.indexOf('dummy?test') == -1) {
       return;
     }
     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
       });
     event.respondWith(Promise.reject());
   });