blob: 58f25f3a442c01387807300b1a278e71e9254d0a [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.sub.js"></script>
<script>
'use strict';
function url_test(name, url) {
var scope = 'resources/scope/' + name;
var expectedURL = normalizeURL(url);
promise_test(function(t) {
return service_worker_unregister_and_register(t, url, scope)
.then(function(registration) {
var worker = registration.installing;
t.add_cleanup(function() {
registration.unregister();
});
assert_equals(worker.scriptURL, expectedURL,
'Returned ServiceWorker object should have scriptURL');
});
}, 'Verify the scriptURL property: ' + name);
}
url_test('relative', 'resources/empty-worker.js');
url_test('with-fragment', 'resources/empty-worker.js#ref');
url_test('absolute', normalizeURL('./resources/empty-worker.js'));
</script>