| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 window.addEventListener('message', function(e) { | 5 window.addEventListener('message', function(e) { |
| 6 var response = ''; | 6 var response = ''; |
| 7 var data = JSON.parse(e.data); | 7 var data = JSON.parse(e.data); |
| 8 | 8 |
| 9 if (data[0] == 'visibilityState-request') { | 9 if (data[0] == 'visibilityState-request') { |
| 10 response = document.visibilityState; | 10 response = document.visibilityState; |
| 11 } else { | 11 } else { |
| 12 response = 'FAILED'; | 12 response = 'FAILED'; |
| 13 } | 13 } |
| 14 | 14 |
| 15 e.source.postMessage( | 15 e.source.postMessage( |
| 16 JSON.stringify(['visibilityState-response', response]), '*'); | 16 JSON.stringify(['visibilityState-response', response]), '*'); |
| 17 }); | 17 }); |
| OLD | NEW |