Index: third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/request-end-to-end.https.html |
diff --git a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/request-end-to-end.https.html b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/request-end-to-end.https.html |
index c9c3b30464b2e980b79b25aba0cee819b75955b5..e952332c586adfb03722d874a28995db0de24549 100644 |
--- a/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/request-end-to-end.https.html |
+++ b/third_party/WebKit/LayoutTests/external/wpt/service-workers/service-worker/request-end-to-end.https.html |
@@ -22,22 +22,34 @@ t.step(function() { |
function onRegister(registration) { |
var sw = registration.installing; |
+ sw.addEventListener('statechange', t.step_func(function(event) { |
+ if (event.target.state == 'activated') { |
+ onActive(sw); |
+ } |
+ })); |
+ } |
+ |
+ function onActive(sw) { |
var port = sendMessagePort(sw); |
port.addEventListener('message', t.step_func(function(event) { |
onMessage(event); |
}), false); |
port.start(); |
- sw.addEventListener('statechange', t.step_func(function(event) { |
- if (event.target.state == 'activated') |
- onActive(); |
- })); |
} |
- function onActive() { |
+ function onMessage(event) { |
+ if (event.data === 'received port') { |
+ onPortReady(); |
+ } else { |
+ onResult(event); |
+ } |
+ } |
+ |
+ function onPortReady() { |
with_iframe(scope).then(function(f) { frames.push(f); }); |
} |
- function onMessage(event) { |
+ function onResult(event) { |
assert_equals( |
event.data.url, |
location.href.substring(0, location.href.lastIndexOf('/') + 1) + |