| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 // This test is for bizarre things that extensions probably will do. We just | 5 // This test is for bizarre things that extensions probably will do. We just |
| 6 // need to ensure that behaviour is predictable. | 6 // need to ensure that behaviour is predictable. |
| 7 | 7 |
| 8 chrome.test.runTests([ | 8 chrome.test.runTests([ |
| 9 function accessNonexistentIframe() { | 9 function accessNonexistentIframe() { |
| 10 var iframe = document.createElement("iframe"); | 10 var iframe = document.createElement("iframe"); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 // Second test is that it does if accessed before removal. | 25 // Second test is that it does if accessed before removal. |
| 26 var iframeChrome = iframe.contentWindow.chrome; | 26 var iframeChrome = iframe.contentWindow.chrome; |
| 27 var iframeChromeWebstore = iframeChrome.webstore; | 27 var iframeChromeWebstore = iframeChrome.webstore; |
| 28 chrome.test.assertTrue(typeof(iframeChromeWebstore) == 'object'); | 28 chrome.test.assertTrue(typeof(iframeChromeWebstore) == 'object'); |
| 29 document.body.removeChild(iframe); | 29 document.body.removeChild(iframe); |
| 30 chrome.test.assertTrue(typeof(iframeChrome.webstore) == 'object'); | 30 chrome.test.assertTrue(typeof(iframeChrome.webstore) == 'object'); |
| 31 document.body.appendChild(iframe); | 31 document.body.appendChild(iframe); |
| 32 break; | 32 break; |
| 33 } | 33 } |
| 34 case 2: { | 34 case 2: { |
| 35 // Third test is that calling frame-dependent methods doesn't crash | 35 // Third test is that accessing API methods doesn't crash the |
| 36 // the renderer if the frame doesn't exist anymore. | 36 // renderer if the frame doesn't exist anymore. |
| 37 // TODO(kalman): this fails. Fix. |
| 37 var iframeChromeApp = iframe.contentWindow.chrome.app; | 38 var iframeChromeApp = iframe.contentWindow.chrome.app; |
| 38 document.body.removeChild(iframe); | 39 document.body.removeChild(iframe); |
| 39 var exception = null; | 40 chrome.test.assertEq(undefined, iframeChromeApp.getDetails); |
| 40 try { | |
| 41 iframeChromeApp.getDetails(); | |
| 42 } catch (e) { | |
| 43 exception = e; | |
| 44 } | |
| 45 chrome.test.assertEq("Extension view no longer exists", exception); | |
| 46 chrome.test.succeed(); | 41 chrome.test.succeed(); |
| 47 break; | 42 break; |
| 48 } | 43 } |
| 49 } | 44 } |
| 50 iteration++; | 45 iteration++; |
| 51 }); | 46 }); |
| 52 document.body.appendChild(iframe); | 47 document.body.appendChild(iframe); |
| 53 } | 48 } |
| 54 ]); | 49 ]); |
| OLD | NEW |