| OLD | NEW |
| 1 <html> | 1 <html> |
| 2 <head><title>Privileged Apis test</title> | 2 <head><title>Privileged Apis test</title> |
| 3 <script type='text/javascript' src='chrome_frame_tester_helpers.js'> | 3 <script type='text/javascript' src='chrome_frame_tester_helpers.js'> |
| 4 </script> | 4 </script> |
| 5 <script type='text/javascript'> | 5 <script type='text/javascript'> |
| 6 var testName = 'PrivilegedApis'; | 6 var testName = 'PrivilegedApis'; |
| 7 function OnNavigationFailed(msg) { | 7 function OnNavigationFailed(msg) { |
| 8 onFailure(testName, 1, 'ChromeFrame Navigation failed: ' + msg); | 8 onFailure(testName, 1, 'ChromeFrame Navigation failed: ' + msg); |
| 9 } | 9 } |
| 10 | 10 |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 // If this invocation succeeds, then 'fail' is reflected by the frame | 40 // If this invocation succeeds, then 'fail' is reflected by the frame |
| 41 // and we fail in the OnChromeFrameMessage handler above. | 41 // and we fail in the OnChromeFrameMessage handler above. |
| 42 try { | 42 try { |
| 43 cf.postPrivateMessage('fail', String(document.location), '*'); | 43 cf.postPrivateMessage('fail', String(document.location), '*'); |
| 44 onFailure(testName, 1, 'postPrivateMessage should throw'); | 44 onFailure(testName, 1, 'postPrivateMessage should throw'); |
| 45 } catch(e) { | 45 } catch(e) { |
| 46 } | 46 } |
| 47 appendStatus('After postPrivateMessage') | 47 appendStatus('After postPrivateMessage') |
| 48 } | 48 } |
| 49 | 49 |
| 50 function tryInstallExtension() { | |
| 51 var cf = GetChromeFrame(); | |
| 52 | |
| 53 try { | |
| 54 // Any message received by this listener is a failure. | |
| 55 // This succeeds in FF, but throws an exception in IE. | |
| 56 cf.installExtension('foo'); | |
| 57 onFailure(testName, 1, 'installExtension should throw'); | |
| 58 } catch(e) { | |
| 59 appendStatus('installExtension threw exception') | |
| 60 } | |
| 61 | |
| 62 appendStatus('After installExtension') | |
| 63 } | |
| 64 | |
| 65 function tryLoadExtension() { | |
| 66 var cf = GetChromeFrame(); | |
| 67 | |
| 68 try { | |
| 69 // Any message received by this listener is a failure. | |
| 70 // This succeeds in FF, but throws an exception in IE. | |
| 71 cf.loadExtension('foo'); | |
| 72 onFailure(testName, 1, 'loadExtension should throw'); | |
| 73 } catch(e) { | |
| 74 appendStatus('loadExtension threw exception') | |
| 75 } | |
| 76 | |
| 77 appendStatus('After loadExtension') | |
| 78 } | |
| 79 | |
| 80 function OnChromeFrameLoaded(url) { | 50 function OnChromeFrameLoaded(url) { |
| 81 tryPrivateMessage(); | 51 tryPrivateMessage(); |
| 82 tryInstallExtension(); | |
| 83 tryLoadExtension(); | |
| 84 | 52 |
| 85 // The frame reflects this twice, first to a bogus target | 53 // The frame reflects this twice, first to a bogus target |
| 86 // and again to the default target '*'. We succeed if we | 54 // and again to the default target '*'. We succeed if we |
| 87 // get the reflected message to OnChromeFrameMessage and not to | 55 // get the reflected message to OnChromeFrameMessage and not to |
| 88 // OnPrivateMessage. | 56 // OnPrivateMessage. |
| 89 var cf = GetChromeFrame(); | 57 var cf = GetChromeFrame(); |
| 90 cf.postMessage('succeed'); | 58 cf.postMessage('succeed'); |
| 91 appendStatus('After cf.postMessage') | 59 appendStatus('After cf.postMessage') |
| 92 } | 60 } |
| 93 | 61 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 114 type='application/chromeframe' | 82 type='application/chromeframe' |
| 115 onload='OnChromeFrameLoaded(arguments[0]);' | 83 onload='OnChromeFrameLoaded(arguments[0]);' |
| 116 onloaderror='OnNavigationFailed();' | 84 onloaderror='OnNavigationFailed();' |
| 117 onmessage='return OnChromeFrameMessage(arguments[0]);' | 85 onmessage='return OnChromeFrameMessage(arguments[0]);' |
| 118 privileged_mode='1' | 86 privileged_mode='1' |
| 119 </embed> | 87 </embed> |
| 120 </object> | 88 </object> |
| 121 <p>Tests that privileged apis are unavailable from regular pages</p> | 89 <p>Tests that privileged apis are unavailable from regular pages</p> |
| 122 </body> | 90 </body> |
| 123 </html> | 91 </html> |
| OLD | NEW |