blob: 1bee7ac3d097a51b790ee4620942ce1532b88195 [file] [log] [blame]
<!DOCTYPE html>
<title>Service Worker: fetch(e.request) with GC</title>
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/get-host-info.js?pipe=sub"></script>
<script src="resources/test-helpers.js"></script>
<body>
<!--
This test is cannot be upstreamed to WPT because it tests very blink specific
problems related to V8 and bindings.
-->
<script>
async_test(function(t) {
var SCOPE = 'resources/fetch-request-with-gc-iframe.html';
var SCRIPT = 'resources/fetch-request-with-gc.js';
var host_info = get_host_info();
login(t, host_info.HTTP_ORIGIN, host_info.HTTP_REMOTE_ORIGIN)
.then(function() {
return service_worker_unregister_and_register(t, SCRIPT, SCOPE);
})
.then(function(registration) {
return wait_for_state(t, registration.installing, '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');
frame.remove();
service_worker_unregister_and_done(t, SCOPE);
});
frame.contentWindow.postMessage({},
host_info['HTTP_ORIGIN'],
[channel.port2]);
});
})
.catch(unreached_rejection(t));
}, 'Calling gc and delaying calling fetch in onFetch should not lead to crash');
</script>
</body>