Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/registration-iframe.https.html |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/registration-iframe.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/registration-iframe.https.html |
index fb60afe84975b1fa26862e577c3e6e5143911b0e..7918f40ababf059f05a02d3d66c9b2694e88d154 100644 |
--- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/registration-iframe.https.html |
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/registration-iframe.https.html |
@@ -5,15 +5,15 @@ |
<script src="/resources/testharnessreport.js"></script> |
<script src="resources/test-helpers.sub.js"></script> |
<script> |
-// Set script url and scope url relative to the calling frame's document's url. |
-// Assert the implementation parses the urls against the calling frame's |
-// document's url. |
+ |
+// Set script url and scope url relative to the iframe's document's url. Assert |
+// the implementation parses the urls against the iframe's document's url. |
async_test(function(t) { |
var url = 'resources/blank.html'; |
- var scope = 'resources/registration-for-iframe-from-calling-frame'; |
- var parsed_scope = normalizeURL(scope); |
- var script = 'resources/empty-worker.js'; |
- var parsed_script = normalizeURL(script); |
+ var scope = 'registration-for-iframe-from-parent-frame'; |
+ var expected_scope = normalizeURL('resources/' + scope); |
+ var script = 'empty-worker.js'; |
+ var expected_script = normalizeURL('resources/' + script); |
var frame; |
var registration; |
@@ -30,28 +30,25 @@ async_test(function(t) { |
return wait_for_state(t, r.installing, 'activated'); |
}) |
.then(function() { |
- assert_equals( |
- registration.scope, parsed_scope, |
- 'registration\'s scope must be the scope parsed against calling ' + |
- 'document\'s url'); |
- assert_equals( |
- registration.active.scriptURL, parsed_script, |
- 'worker\'s script must be the url parsed against calling ' + |
- 'document\'s url'); |
+ assert_equals(registration.scope, expected_scope, |
+ 'registration\'s scope must be parsed against the ' + |
+ '"relevant global object"'); |
+ assert_equals(registration.active.scriptURL, expected_script, |
+ 'worker\'s scriptURL must be parsed against the ' + |
+ '"relevant global object"'); |
frame.remove(); |
return service_worker_unregister_and_done(t, scope); |
}) |
.catch(unreached_rejection(t)); |
- }, 'Subframe\'s container\'s register method should use calling frame\'s ' + |
- 'document\'s url as a base url for parsing its script url and scope url ' + |
- '- normal case'); |
+ }, 'register method should use the "relevant global object" to parse its ' + |
+ 'scriptURL and scope - normal case'); |
-// Set script url and scope url relative to the iframe's document's url. |
-// Assert the implementation throws a NetworkError exception. |
+// Set script url and scope url relative to the parent frame's document's url. |
+// Assert the implementation throws a TypeError exception. |
async_test(function(t) { |
var url = 'resources/blank.html'; |
- var scope = 'registration-for-iframe-from-calling-frame'; |
- var script = 'empty-worker.js'; |
+ var scope = 'resources/registration-for-iframe-from-parent-frame'; |
+ var script = 'resources/empty-worker.js'; |
var frame; |
var registration; |
@@ -68,21 +65,22 @@ async_test(function(t) { |
assert_unreached('register() should reject'); |
}, |
function(e) { |
- assert_equals(e.name, 'TypeError'); |
+ assert_equals(e.name, 'TypeError', |
+ 'register method with scriptURL and scope parsed to ' + |
+ 'nonexistent location should reject with TypeError'); |
frame.remove(); |
return service_worker_unregister_and_done(t, scope); |
}) |
.catch(unreached_rejection(t)); |
- }, 'Subframe\'s container\'s register method should use calling frame\'s ' + |
- 'document\'s url as a base url for parsing its script url and scope url ' + |
- '- error case'); |
+ }, 'register method should use the "relevant global object" to parse its ' + |
+ 'scriptURL and scope - error case'); |
-// Set the scope url to a non-subdirectory of the script url. |
-// Assert the implementation throws a SecurityError exception. |
+// Set the scope url to a non-subdirectory of the script url. Assert the |
+// implementation throws a SecurityError exception. |
async_test(function(t) { |
var url = 'resources/blank.html'; |
- var scope = 'registration-for-iframe-from-calling-frame'; |
- var script = 'resources/empty-worker.js'; |
+ var scope = '../registration-for-iframe-from-parent-frame'; |
+ var script = 'empty-worker.js'; |
var frame; |
var registration; |
@@ -99,10 +97,13 @@ async_test(function(t) { |
assert_unreached('register() should reject'); |
}, |
function(e) { |
- assert_equals(e.name, 'SecurityError'); |
+ assert_equals(e.name, 'SecurityError', |
+ 'The scope set to a non-subdirectory of the scriptURL ' + |
+ 'should reject with SecurityError'); |
frame.remove(); |
return service_worker_unregister_and_done(t, scope); |
}) |
.catch(unreached_rejection(t)); |
}, 'A scope url should start with the given script url'); |
+ |
</script> |