Bug 1455082 [wpt PR 10527] - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=184746, a=testonly
authoryouennf <youennf@users.noreply.github.com>
Fri, 27 Apr 2018 20:47:48 +0000
changeset 472283 87664c18684377d75118ba5eee951447ed60178c
parent 472282 bfcaffd393b7fb32108fb81f092f6bcef8cd24b9
child 472284 bc1c6ee4999ec8ca000482e67eba2fd028ea0b6a
push id1728
push userjlund@mozilla.com
push dateMon, 18 Jun 2018 21:12:27 +0000
treeherdermozilla-release@c296fde26f5f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerstestonly
bugs1455082, 10527, 184746
milestone61.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 1455082 [wpt PR 10527] - WebKit export of https://bugs.webkit.org/show_bug.cgi?id=184746, a=testonly Automatic update from web-platform-testsMerge pull request #10527 from youennf/wpt-export-for-webkit-184746 WebKit export of https://bugs.webkit.org/show_bug.cgi?id=184746 -- wpt-commits: 0a537e6b3407daaa02e0edb472db1badcd43fada wpt-pr: 10527
testing/web-platform/meta/MANIFEST.json
testing/web-platform/tests/service-workers/service-worker/fetch-request-resources.https.html
testing/web-platform/tests/service-workers/service-worker/resources/fetch-request-resources-iframe.https.html
testing/web-platform/tests/service-workers/service-worker/resources/fetch-request-resources-worker.js
--- a/testing/web-platform/meta/MANIFEST.json
+++ b/testing/web-platform/meta/MANIFEST.json
@@ -597947,17 +597947,17 @@
    "9631947d3cec78547bd4666b8ca970d037648cc8",
    "testharness"
   ],
   "service-workers/service-worker/fetch-request-redirect.https.html": [
    "d9df49b76012233e0aeb92f50a0613f90e8b3ee1",
    "testharness"
   ],
   "service-workers/service-worker/fetch-request-resources.https.html": [
-   "d21ef5a4263e26cd3053a89171e2597424eaad82",
+   "9b5be43fdacc1362d92f72c3d57f68fca0eaa493",
    "testharness"
   ],
   "service-workers/service-worker/fetch-request-xhr-sync-on-worker.https.html": [
    "aca28d4ad02c803873bea5fc922b8e4d427ccc4b",
    "testharness"
   ],
   "service-workers/service-worker/fetch-request-xhr-sync.https.html": [
    "4aaa0b1995643f4e18c47d1947476a1a67fe997d",
@@ -598751,21 +598751,21 @@
    "01aabcc28508a0a2dbe267dd47a293937b380187",
    "support"
   ],
   "service-workers/service-worker/resources/fetch-request-redirect-iframe.html": [
    "92ea3d394c02958d7be3a5425bf58f00458815b6",
    "support"
   ],
   "service-workers/service-worker/resources/fetch-request-resources-iframe.https.html": [
-   "95bcbc6a2f4560788f77fa717fa06d7d018d99c6",
+   "bcf833f49f3de4a67dfbd7522f525331bfb14bd9",
    "support"
   ],
   "service-workers/service-worker/resources/fetch-request-resources-worker.js": [
-   "4512140fe37ffd78086f54c6b0f6213675c0d74f",
+   "de3203b73bb35427d2b792a735ea2d6f7b9e4a2e",
    "support"
   ],
   "service-workers/service-worker/resources/fetch-request-xhr-iframe.https.html": [
    "4d7489b889c98bd66b40369e2d4ed56355ada6ae",
    "support"
   ],
   "service-workers/service-worker/resources/fetch-request-xhr-sync-iframe.html": [
    "a168a0326207e734f0229d49cce12af9a37e81ec",
--- a/testing/web-platform/tests/service-workers/service-worker/fetch-request-resources.https.html
+++ b/testing/web-platform/tests/service-workers/service-worker/fetch-request-resources.https.html
@@ -20,105 +20,112 @@ function image_test(frame, url, cross_or
                     expected_credentials) {
   var actual_url = url + (++url_count);
   expected_results[actual_url] = {
       cross_origin: cross_origin,
       mode: expected_mode,
       credentials: expected_credentials,
       redirect: 'follow',
       integrity: '',
+      destination: 'image',
       message: 'Image load (url:' +
                actual_url + ' cross_origin:' + cross_origin + ')'
     };
   frame.contentWindow.load_image(actual_url, cross_origin);
   return add_promise_to_test(actual_url);
 }
 
 function script_test(frame, url, cross_origin, expected_mode,
                      expected_credentials) {
   var actual_url = url + (++url_count);
   expected_results[actual_url] = {
       cross_origin: cross_origin,
       mode: expected_mode,
       credentials: expected_credentials,
       redirect: 'follow',
       integrity: '',
+      destination: 'script',
       message: 'Script load (url:' +
                actual_url + ' cross_origin:' + cross_origin + ')'
     };
   frame.contentWindow.load_script(actual_url, cross_origin);
   return add_promise_to_test(actual_url);
 }
 
 function css_test(frame, url, cross_origin, expected_mode,
                   expected_credentials) {
   var actual_url = url + (++url_count);
   expected_results[actual_url] = {
       cross_origin: cross_origin,
       mode: expected_mode,
       credentials: expected_credentials,
       redirect: 'follow',
       integrity: '',
+      destination: 'style',
       message: 'CSS load (url:' +
                actual_url + ' cross_origin:' + cross_origin + ')'
     };
   frame.contentWindow.load_css(actual_url, cross_origin);
   return add_promise_to_test(actual_url);
 }
 
 function font_face_test(frame, url, expected_mode, expected_credentials) {
   var actual_url = url + (++url_count);
   expected_results[actual_url] = {
       url: actual_url,
       mode: expected_mode,
       credentials: expected_credentials,
       redirect: 'follow',
       integrity: '',
+      destination: 'font',
       message: 'FontFace load (url:' + actual_url + ')'
     };
   frame.contentWindow.load_font(actual_url);
   return add_promise_to_test(actual_url);
 }
 
 function script_integrity_test(frame, url, integrity, expected_integrity) {
   var actual_url = url + (++url_count);
   expected_results[actual_url] = {
       url: actual_url,
       mode: 'no-cors',
       credentials: 'include',
       redirect: 'follow',
       integrity: expected_integrity,
+      destination: 'script',
       message: 'Script load (url:' + actual_url + ')'
     };
   frame.contentWindow.load_script_with_integrity(actual_url, integrity);
   return add_promise_to_test(actual_url);
 }
 
 function css_integrity_test(frame, url, integrity, expected_integrity) {
   var actual_url = url + (++url_count);
   expected_results[actual_url] = {
       url: actual_url,
       mode: 'no-cors',
       credentials: 'include',
       redirect: 'follow',
       integrity: expected_integrity,
+      destination: 'style',
       message: 'CSS load (url:' + actual_url + ')'
     };
   frame.contentWindow.load_css_with_integrity(actual_url, integrity);
   return add_promise_to_test(actual_url);
 }
 
 function fetch_test(frame, url, mode, credentials,
                     expected_mode, expected_credentials) {
   var actual_url = url + (++url_count);
   expected_results[actual_url] = {
       mode: expected_mode,
       credentials: expected_credentials,
       redirect: 'follow',
       integrity: '',
+      destination: '',
       message: 'fetch (url:' + actual_url + ' mode:' + mode + ' credentials:' +
                credentials + ')'
     };
   frame.contentWindow.fetch(
       new Request(actual_url, {mode: mode, credentials: credentials})).then(() => {
       }, () => { });
   return add_promise_to_test(actual_url);
 }
@@ -126,23 +133,41 @@ function fetch_test(frame, url, mode, cr
 function audio_test(frame, url, cross_origin,
                     expected_mode, expected_credentials) {
   var actual_url = url + (++url_count);
   expected_results[actual_url] = {
       mode: expected_mode,
       credentials: expected_credentials,
       redirect: 'follow',
       integrity: '',
+      destination: 'audio',
       message: 'Audio load (url:' + actual_url + ' cross_origin:' +
                cross_origin + ')'
     };
   frame.contentWindow.load_audio(actual_url, cross_origin);
   return add_promise_to_test(actual_url);
 }
 
+
+function video_test(frame, url, cross_origin,
+                    expected_mode, expected_credentials) {
+  var actual_url = url + (++url_count);
+  expected_results[actual_url] = {
+      mode: expected_mode,
+      credentials: expected_credentials,
+      redirect: 'follow',
+      integrity: '',
+      destination: 'video',
+      message: 'Video load (url:' + actual_url + ' cross_origin:' +
+               cross_origin + ')'
+    };
+  frame.contentWindow.load_video(actual_url, cross_origin);
+  return add_promise_to_test(actual_url);
+}
+
 promise_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['HTTPS_ORIGIN'] + base_path() + 'resources/dummy?test';
     var REMOTE_URL =
       host_info['HTTPS_REMOTE_ORIGIN'] + base_path() + 'resources/dummy?test';
@@ -178,16 +203,20 @@ promise_test(function(t) {
                    assert_equals(
                     result.redirect, expected.redirect,
                     'redirect mode of ' + expected.message +  ' must be ' +
                     expected.redirect + '.');
                   assert_equals(
                     result.integrity, expected.integrity,
                     'integrity of ' + expected.message +  ' must be ' +
                     expected.integrity + '.');
+                  assert_equals(
+                    result.destination, expected.destination,
+                    'destination of ' + expected.message +  ' must be ' +
+                    expected.destination + '.');
                 }, expected.message);
                 expected.resolve();
                 delete expected_results[result.url];
               });
               worker.postMessage(
                 {port: channel.port2}, [channel.port2]);
             });
         })
@@ -263,13 +292,20 @@ promise_test(function(t) {
 
         await audio_test(f, LOCAL_URL, '', 'no-cors', 'include');
         await audio_test(f, LOCAL_URL, 'anonymous', 'cors', 'same-origin');
         await audio_test(f, LOCAL_URL, 'use-credentials', 'cors', 'include');
         await audio_test(f, REMOTE_URL, '', 'no-cors', 'include');
         await audio_test(f, REMOTE_URL, 'anonymous', 'cors', 'same-origin');
         await audio_test(f, REMOTE_URL, 'use-credentials', 'cors', 'include');
 
+        await video_test(f, LOCAL_URL, '', 'no-cors', 'include');
+        await video_test(f, LOCAL_URL, 'anonymous', 'cors', 'same-origin');
+        await video_test(f, LOCAL_URL, 'use-credentials', 'cors', 'include');
+        await video_test(f, REMOTE_URL, '', 'no-cors', 'include');
+        await video_test(f, REMOTE_URL, 'anonymous', 'cors', 'same-origin');
+        await video_test(f, REMOTE_URL, 'use-credentials', 'cors', 'include');
+
         frame.remove();
         service_worker_unregister(t, SCOPE);
       }).catch(unreached_rejection(t));
   }, 'Verify FetchEvent for resources.');
 </script>
--- a/testing/web-platform/tests/service-workers/service-worker/resources/fetch-request-resources-iframe.https.html
+++ b/testing/web-platform/tests/service-workers/service-worker/resources/fetch-request-resources-iframe.https.html
@@ -66,10 +66,19 @@ function load_css_with_integrity(url, in
 function load_audio(url, cross_origin) {
   var audio = document.createElement('audio');
   if (cross_origin != '') {
     audio.crossOrigin = cross_origin;
   }
   audio.src = url;
   document.body.appendChild(audio);
 }
+
+function load_video(url, cross_origin) {
+  var video = document.createElement('video');
+  if (cross_origin != '') {
+    video.crossOrigin = cross_origin;
+  }
+  video.src = url;
+  document.body.appendChild(video);
+}
 </script>
 </body>
--- a/testing/web-platform/tests/service-workers/service-worker/resources/fetch-request-resources-worker.js
+++ b/testing/web-platform/tests/service-workers/service-worker/resources/fetch-request-resources-worker.js
@@ -14,12 +14,13 @@ self.addEventListener('fetch', function(
     if (url.indexOf('dummy?test') == -1) {
       return;
     }
     port.postMessage({
         url: url,
         mode: event.request.mode,
         redirect: event.request.redirect,
         credentials: event.request.credentials,
-        integrity: event.request.integrity
+        integrity: event.request.integrity,
+        destination: event.request.destination
       });
     event.respondWith(Promise.reject());
   });