OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <script> | 4 <script> |
5 | 5 |
6 var popup; | 6 var popup; |
7 | 7 |
8 function openPopup(url, name) { | 8 function openPopup(url, name) { |
9 popup = window.open(url, name); | 9 popup = window.open(url, name); |
10 } | 10 } |
11 | 11 |
12 function focusPopup(url) { | 12 function focusPopup(url) { |
13 popup.focus(); | 13 popup.focus(); |
14 } | 14 } |
15 | 15 |
16 window.addEventListener('focus', function() { | 16 window.addEventListener('focus', function() { |
17 domAutomationController.setAutomationId(0); | |
18 domAutomationController.send(window.name + '-got-focus'); | 17 domAutomationController.send(window.name + '-got-focus'); |
19 }); | 18 }); |
20 | 19 |
21 window.addEventListener('blur', function() { | 20 window.addEventListener('blur', function() { |
22 domAutomationController.setAutomationId(0); | |
23 domAutomationController.send(window.name + '-lost-focus'); | 21 domAutomationController.send(window.name + '-lost-focus'); |
24 }); | 22 }); |
25 | 23 |
26 </script> | 24 </script> |
27 </head> | 25 </head> |
28 | 26 |
29 <body> | 27 <body> |
30 This page has focus and blur window events. | 28 This page has focus and blur window events. |
31 </body> | 29 </body> |
32 </html> | 30 </html> |
33 | 31 |
OLD | NEW |