| Index: LayoutTests/http/tests/serviceworker/current-on-load.html | 
| diff --git a/LayoutTests/http/tests/serviceworker/activation-after-registration.html b/LayoutTests/http/tests/serviceworker/current-on-load.html | 
| similarity index 50% | 
| copy from LayoutTests/http/tests/serviceworker/activation-after-registration.html | 
| copy to LayoutTests/http/tests/serviceworker/current-on-load.html | 
| index bde27e2cac5e7cd882c8d2efaadb6d10ea0f1b8d..ea27f05f72697f4fed1c6b2e9873581569c939cb 100644 | 
| --- a/LayoutTests/http/tests/serviceworker/activation-after-registration.html | 
| +++ b/LayoutTests/http/tests/serviceworker/current-on-load.html | 
| @@ -1,27 +1,38 @@ | 
| <!DOCTYPE html> | 
| -<title>Service Worker: Activation occurs after registration</title> | 
| +<title>Service Worker: Current on load</title> | 
| <script src="../resources/testharness.js"></script> | 
| <script src="../resources/testharnessreport.js"></script> | 
| <script src="resources/testutils.js"></script> | 
| <body> | 
| <script> | 
| -var t = async_test('activation occurs after registration'); | 
| +var t = async_test('current is set for a controlled document'); | 
| t.step(function() { | 
| -    var scope = 'resources/blank.html'; | 
| +    var scope = 'resources/blank.html' | 
| navigator.serviceWorker.unregister(scope).then(doTest, doTest); | 
| + | 
| function doTest() { | 
| navigator.serviceWorker.register( | 
| 'resources/worker-no-op.js', {scope: scope} | 
| -        ).then(t.step_func(onRegister), t.step_func(function(reason) { | 
| +        ).then(onRegister, t.step_func(function(reason) { | 
| assert_unreached('Registration should succeed, but failed: ' + reason.name); | 
| })); | 
| } | 
|  | 
| function onRegister(worker) { | 
| -        assert_equals(worker.state, 'parsed', 'worker should be in the "parsed" state upon registration'); | 
| worker.addEventListener('statechange', t.step_func(function(event) { | 
| if (event.target.state == 'active') | 
| -                t.done(); | 
| +                onActive(); | 
| +        })); | 
| +    } | 
| + | 
| +    function onActive() { | 
| +        withIframe(scope, t.step_func(function(frame) { | 
| +            var w = frame.contentWindow; | 
| +            // FIXME: Why instanceof doesn't work? | 
| +            // assert_true(w.navigator.serviceWorker.current instanceof ServiceWorker, | 
| +            assert_true(w.navigator.serviceWorker.current.constructor.name == 'ServiceWorker', | 
| +                        'current should be a ServiceWorker object'); | 
| +            t.done(); | 
| })); | 
| } | 
| }); | 
|  |