OLD | NEW |
1 This page should be sandboxed. | 1 This page should be sandboxed. |
2 | 2 |
3 <script> | 3 <script> |
4 // We're not served with the extension default CSP, we can use inline script. | 4 // We're not served with the extension default CSP, we can use inline script. |
5 onload = function() { | 5 onload = function() { |
6 var secret = 'sandboxed_window_secret'; | 6 var secret = 'sandboxed_window_secret'; |
7 | 7 |
8 if (chrome.extension) { | 8 if (chrome.extension) { |
9 chrome.test.notifyFail('Extension APIs should not be injected.'); | 9 chrome.test.notifyFail('Extension APIs should not be injected.'); |
10 return; | 10 return; |
11 } | 11 } |
12 | 12 |
13 var mainWindow = window.opener || window.top; | 13 var mainWindow = window.opener || window.top; |
14 mainWindow.postMessage(mainWindow.secret, '*'); | 14 var mainWindowSecret = undefined; |
| 15 try { |
| 16 mainWindowSecret = mainWindow.secret; |
| 17 } catch(e) {} |
| 18 mainWindow.postMessage(mainWindowSecret, '*'); |
15 }; | 19 }; |
16 </script> | 20 </script> |
OLD | NEW |