blob: 2fc512b19202baaccff9aef0fc1432238bf60a26 [file] [log] [blame]
<!DOCTYPE html>
<title>ServiceWorker object: scriptURL property</title>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="resources/test-helpers.js"></script>
<script>
function url_test(name, url) {
var scope = 'resources/scope/' + name;
async_test(function(t) {
var expectedURL = normalizeURL(url);
service_worker_unregister_and_register(t, url, scope)
.then(function(registration) {
var worker = registration.installing;
assert_equals(worker.scriptURL, expectedURL,
'Returned ServiceWorker object should have scriptURL');
service_worker_unregister_and_done(t, scope);
})
.catch(unreached_rejection(t));
}, 'Verify the scriptURL property: ' + name);
}
url_test('relative', 'resources/empty-worker.js');
url_test('with-fragment', 'resources/empty-worker.js#ref');
url_test('absolute', window.location.origin +
'/serviceworker/resources/empty-worker.js');
</script>