OLD | NEW |
(Empty) | |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 'use strict'; |
| 6 |
| 7 var didRun = sessionStorage.didRun; |
| 8 |
| 9 function beforeUnload() { |
| 10 chrome.test.fail(); |
| 11 } |
| 12 |
| 13 try { |
| 14 delete window.onbeforeunload; |
| 15 window.onbeforeunload = beforeUnload; |
| 16 } catch (e) {} |
| 17 |
| 18 try { |
| 19 window.addEventListener('beforeunload', beforeUnload); |
| 20 } catch (e) {} |
| 21 |
| 22 if (!didRun) { |
| 23 sessionStorage.didRun = true; |
| 24 location.reload(); |
| 25 } else { |
| 26 chrome.test.succeed(); |
| 27 } |
OLD | NEW |