| OLD | NEW |
| 1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
| 2 <title>Service Worker: Clients.matchAll with includeUncontrolled</title> | 2 <title>Service Worker: Clients.matchAll with includeUncontrolled</title> |
| 3 <script src="/resources/testharness.js"></script> | 3 <script src="/resources/testharness.js"></script> |
| 4 <script src="/resources/testharnessreport.js"></script> | 4 <script src="/resources/testharnessreport.js"></script> |
| 5 <script src="resources/test-helpers.sub.js"></script> | 5 <script src="resources/test-helpers.sub.js"></script> |
| 6 <script> | 6 <script> |
| 7 var base_url = 'resources/blank.html'; // This is out-of-scope. | 7 var base_url = 'resources/blank.html'; // This is out-of-scope. |
| 8 var scope = base_url + '?clients-matchAll-includeUncontrolled'; | 8 var scope = base_url + '?clients-matchAll-includeUncontrolled'; |
| 9 var frames = []; | 9 var frames = []; |
| 10 | 10 |
| 11 // Creates 3 iframes, 2 for in-scope and 1 for out-of-scope. | 11 // Creates 3 iframes, 2 for in-scope and 1 for out-of-scope. |
| 12 // The frame opened for scope + '#2' is returned via a promise. | 12 // The frame opened for scope + '#2' is returned via a promise. |
| 13 function create_iframes(scope) { | 13 function create_iframes(scope) { |
| 14 return with_iframe(base_url) | 14 return with_iframe(base_url) |
| 15 .then(function(frame0) { | 15 .then(function(frame0) { |
| 16 frames.push(frame0); | 16 frames.push(frame0); |
| 17 return with_iframe(scope + '#1'); | 17 return with_iframe(scope + '#1'); |
| 18 }) | 18 }) |
| 19 .then(function(frame1) { | 19 .then(function(frame1) { |
| 20 frames.push(frame1); | 20 frames.push(frame1); |
| 21 return with_iframe(scope + '#2'); | 21 return with_iframe(scope + '#2'); |
| 22 }) | 22 }) |
| 23 .then(function(frame2) { | 23 .then(function(frame2) { |
| 24 frames.push(frame2); | 24 frames.push(frame2); |
| 25 return frame2; | 25 return frame2; |
| 26 }) | 26 }) |
| 27 } | 27 } |
| 28 | 28 |
| 29 var expected_without_include_uncontrolled = [ | 29 var expected_without_include_uncontrolled = [ |
| 30 /* visibilityState, focused, url, frameType */ | 30 // visibilityState, focused, url, type, frameType |
| 31 ['visible', false, new URL(scope + '#1', location).toString(), 'window', 'ne
sted'], | 31 ['visible', false, new URL(scope + '#1', location).toString(), 'window', 'ne
sted'], |
| 32 ['visible', true, new URL(scope + '#2', location).toString(), 'window', 'nes
ted'] | 32 ['visible', true, new URL(scope + '#2', location).toString(), 'window', 'nes
ted'] |
| 33 ]; | 33 ]; |
| 34 | 34 |
| 35 var expected_with_include_uncontrolled = [ | 35 var expected_with_include_uncontrolled = [ |
| 36 /* visibilityState, focused, url, frameType */ | 36 // visibilityState, focused, url, type, frameType |
| 37 ['visible', true, location.href, 'window', 'top-level'], | 37 ['visible', true, location.href, 'window', 'top-level'], |
| 38 ['visible', false, new URL(scope + '#1', location).toString(), 'window', 'ne
sted'], | 38 ['visible', false, new URL(scope + '#1', location).toString(), 'window', 'ne
sted'], |
| 39 ['visible', true, new URL(scope + '#2', location).toString(), 'window', 'nes
ted'], | 39 ['visible', true, new URL(scope + '#2', location).toString(), 'window', 'nes
ted'], |
| 40 ['visible', false, new URL(base_url, location).toString(), 'window', 'nested
'] | 40 ['visible', false, new URL(base_url, location).toString(), 'window', 'nested
'] |
| 41 ]; | 41 ]; |
| 42 | 42 |
| 43 function test_matchall(frame, expected, query_options) { | 43 function test_matchall(frame, expected, query_options) { |
| 44 // Make sure we have focus for '#2' frame and its parent window. | 44 // Make sure we have focus for '#2' frame and its parent window. |
| 45 frame.focus(); | 45 frame.focus(); |
| 46 frame.contentWindow.focus(); | 46 frame.contentWindow.focus(); |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 {includeUncontrolled:true}); | 84 {includeUncontrolled:true}); |
| 85 }) | 85 }) |
| 86 .then(function() { | 86 .then(function() { |
| 87 frames.forEach(function(f) { f.remove() }); | 87 frames.forEach(function(f) { f.remove() }); |
| 88 service_worker_unregister_and_done(t, scope); | 88 service_worker_unregister_and_done(t, scope); |
| 89 }) | 89 }) |
| 90 .catch(unreached_rejection(t)); | 90 .catch(unreached_rejection(t)); |
| 91 }, 'Verify matchAll() respect includeUncontrolled'); | 91 }, 'Verify matchAll() respect includeUncontrolled'); |
| 92 | 92 |
| 93 </script> | 93 </script> |
| OLD | NEW |