Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(548)

Unified Diff: chrome_frame/test/data/privileged_apis_host.html

Issue 218019: Initial import of the Chrome Frame codebase. Integration in chrome.gyp coming... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome_frame/test/data/privileged_apis_frame.html ('k') | chrome_frame/test/data/simple_object_focus.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome_frame/test/data/privileged_apis_host.html
===================================================================
--- chrome_frame/test/data/privileged_apis_host.html (revision 0)
+++ chrome_frame/test/data/privileged_apis_host.html (revision 0)
@@ -0,0 +1,85 @@
+<html>
+ <head><title>Privileged Apis test</title>
+ <script type='text/javascript' src='chrome_frame_tester_helpers.js'>
+ </script>
+ <script type='text/javascript'>
+ var testName = 'PrivilegedApis';
+ function OnNavigationFailed(msg) {
+ onFailure(testName, 1, 'ChromeFrame Navigation failed: ' + msg);
+ }
+
+ function OnPrivateMessage() {
+ onFailure(testName, 1, 'OnPrivateMessage should not execute');
+ }
+
+ function OnChromeFrameMessage(evt) {
+ try {
+ var d = new String(evt.data);
+ appendStatus('Message: ' + d);
+ if (d == 'succeed') {
+ onSuccess(testName, 1);
+ } else {
+ onFailure(testName, 1, 'unexpected data');
+ }
+ } catch (e) {
+ onFailure(testName, 1, 'exception in OnChromeFrameMessage');
+ }
+ }
+
+ function OnChromeFrameLoaded(url) {
+ var cf = GetChromeFrame();
+
+ try {
+ // Any message received by this listener is a failure.
+ // This succeeds in FF, but throws an exception in IE.
+ cf.addEventListener('onprivatemessage', OnPrivateMessage, false);
+ } catch(e) {
+ cf.onprivatemessage =
+ appendStatus('addEventListener onprivatemessage threw exception')
+ }
+
+ // If this invocation succeeds, then 'fail' is reflected by the frame
+ // and we fail in the OnChromeFrameMessage handler above.
+ try {
+ cf.postPrivateMessage('fail', String(document.location), '*');
+ onFailure(testName, 1, 'postPrivateMessage should throw');
+ } catch(e) {
+ }
+ appendStatus('After postPrivateMessage')
+ // The frame reflects this twice, first to a bogus target
+ // and again to the default target '*'. We succeed if we
+ // get the reflected message to OnChromeFrameMessage and not to
+ // OnPrivateMessage.
+ cf.postMessage('succeed');
+ }
+
+ function GetChromeFrame() {
+ return window.document.ChromeFrame;
+ }
+ </script>
+ </head>
+ <body>
+ <div id='statusPanel' style='border: 1px solid red; width: 100%'>
+ Test running....
+ </div>
+
+ <!-- TODO(siggi): Test setting onprivatemessage in these params -->
+ <object id='ChromeFrame' width='500' height='500'
+ codebase='http://www.google.com'
+ classid='CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A'>
+ <param name='src' value='privileged_apis_frame.html'>
+ <param name='onload' value='OnChromeFrameLoaded(arguments[0]);'>
+ <param name='onloaderror' value='OnNavigationFailed();'>
+ <param name='onmessage' value='OnChromeFrameMessage(arguments[0]);'>
+ <embed id='ChromeFramePlugin' width='500' height='500' name='ChromeFrame'
+ src='privileged_apis_frame.html'
+ type='application/chromeframe'
+ onload='OnChromeFrameLoaded(arguments[0]);'
+ onloaderror='OnNavigationFailed();'
+ onmessage='return OnChromeFrameMessage(arguments[0]);'
+ privileged_mode='1'
+ </embed>
+ </object>
+ <p>Tests that privileged apis are unavailable from regular pages</p>
+ </body>
+</html>
« no previous file with comments | « chrome_frame/test/data/privileged_apis_frame.html ('k') | chrome_frame/test/data/simple_object_focus.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698