<commit_before><!DOCTYPE html>
<title>Service Worker: canvas tainting of the fetched image</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="resources/test-helpers.js?pipe=sub"></script>
<body>
<script>
async_test(function(t) {
    var login1 =
      test_login(t, 'http://127.0.0.1:8000', 'username1', '<PASSWORD>');
    var login2 =
      test_login(t, 'http://localhost:8000', 'username2', '<PASSWORD>');
    var SCOPE = 'resources/fetch-canvas-tainting-iframe.html';
    var SCRIPT = 'resources/fetch-rewrite-worker.js';
    var host_info = get_host_info();
    
    Promise.all([login1, login2])
      .then(function() {
          return service_worker_unregister_and_register(t, SCRIPT, SCOPE);
        })
      .then(function(registration) {
          return wait_for_update(t, registration);
        })
      .then(function(sw) {
          return wait_for_state(t, sw, 'activated');
        })
      .then(function() { return with_iframe(SCOPE); })
      .then(function(frame) {
          return new Promise(function(resolve, reject) {
              var channel = new MessageChannel();
              channel.port1.onmessage = t.step_func(function(e) {
                  assert_equals(e.data.results, 'finish');
                  unload_iframe(frame);
                  service_worker_unregister_and_done(t, SCOPE);
                });
              frame.contentWindow.postMessage({},
                                              [channel.port2],
                                              host_info['HTTP_ORIGIN']);
            });
        })
      .catch(unreached_rejection(t));
  }, 'Verify canvas tainting of fetched image in a Service Worker');
</script>
</body><commit_msg>Fix fetch-canvas-tainting.html to not mix up origins and transferables.<commit_after><!DOCTYPE html>
<title>Service Worker: canvas tainting of the fetched image</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="resources/test-helpers.js?pipe=sub"></script>
<body>
<script>
async_test(function(t) {
    var login1 =
      test_login(t, 'http://127.0.0.1:8000', 'username1', '<PASSWORD>');
    var login2 =
      test_login(t, 'http://localhost:8000', 'username2', '<PASSWORD>');
    var SCOPE = 'resources/fetch-canvas-tainting-iframe.html';
    var SCRIPT = 'resources/fetch-rewrite-worker.js';
    var host_info = get_host_info();
    
    Promise.all([login1, login2])
      .then(function() {
          return service_worker_unregister_and_register(t, SCRIPT, SCOPE);
        })
      .then(function(registration) {
          return wait_for_update(t, registration);
        })
      .then(function(sw) {
          return wait_for_state(t, sw, 'activated');
        })
      .then(function() { return with_iframe(SCOPE); })
      .then(function(frame) {
          return new Promise(function(resolve, reject) {
              var channel = new MessageChannel();
              channel.port1.onmessage = t.step_func(function(e) {
                  assert_equals(e.data.results, 'finish');
                  unload_iframe(frame);
                  service_worker_unregister_and_done(t, SCOPE);
                });
              frame.contentWindow.postMessage({},
                                              host_info['HTTP_ORIGIN'],
                                              [channel.port2]);
            });
        })
      .catch(unreached_rejection(t));
  }, 'Verify canvas tainting of fetched image in a Service Worker');
</script>
</body>
{'fraction_non_alphanumeric': 0.14150943396226415, 'fraction_numerical': 0.01220865704772475, 'mean_word_length': 2.359739049394222, 'pattern_counts': {'":': 0, '<': 33, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 8, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4554384', 'n_tokens_mistral': 1086, 'n_tokens_neox': 1039, 'n_words': 189}