diff options
author | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-27 17:32:51 +0000 |
---|---|---|
committer | amit@chromium.org <amit@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-10-27 17:32:51 +0000 |
commit | 2f1793eafae6419d8f0e776f441bcbe262e207d3 (patch) | |
tree | c5286986c7fa7bd007eaf2d3e1bcca57141c20c6 /chrome_frame/test/data | |
parent | 6f1dbc0060967d9ad7c214315f1ca843777d5c7f (diff) | |
download | chromium_src-2f1793eafae6419d8f0e776f441bcbe262e207d3.zip chromium_src-2f1793eafae6419d8f0e776f441bcbe262e207d3.tar.gz chromium_src-2f1793eafae6419d8f0e776f441bcbe262e207d3.tar.bz2 |
Add support for OnClose event in ActiveX and NPAPI
Provide event notification for window.close called within
ActiveX and NPAPI. Currently this is handled in ActiveDocument
to close the popups. In ActiveX and NPAPI plugin we just fire
an event as it is upto the container to decide what's the right
thing to do.
BUG=59664
TEST=New tests ChromeFrameTestWithWebServer.FullTabModeIE_WindowClose, ChromeFrameTestWithWebServer.FullTabModeFF_WindowClose
Review URL: http://codereview.chromium.org/4152005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64092 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome_frame/test/data')
-rw-r--r-- | chrome_frame/test/data/window_close.html | 48 | ||||
-rw-r--r-- | chrome_frame/test/data/window_close_frame.html | 20 |
2 files changed, 68 insertions, 0 deletions
diff --git a/chrome_frame/test/data/window_close.html b/chrome_frame/test/data/window_close.html new file mode 100644 index 0000000..e7f0718 --- /dev/null +++ b/chrome_frame/test/data/window_close.html @@ -0,0 +1,48 @@ +<html>
+ <head><title>window.close test</title> + <script type="text/javascript" src="chrome_frame_tester_helpers.js"> + </script> + <script type="text/javascript"> + function OnNavigationFailed() { + onFailure("WindowCloseTest", 1, "ChromeFrame Navigation failed"); + } + + function OnChromeFrameLoaded(url) { + appendStatus("Loaded URL: " + url.data); + var cf = window.document.ChromeFrame; + if (cf.attachEvent) { // Special case for IE + appendStatus("Attaching close event handler"); + cf.attachEvent("onclose", OnCloseWindow); + } + } + + function OnCloseWindow() { + appendStatus("Received window close event."); + return onSuccess("WindowCloseTest", 1);
+ }
+
+ </script> + </head> + <body> + <div id="statusPanel" style="border: 1px solid red; width: 100%"> + Test running.... + </div> + + <object id="ChromeFrame" width="500" height="500" + codebase="http://www.google.com" + classid="CLSID:E0A900DF-9611-4446-86BD-4B1D47E7DB2A"> + <param name="src" value="window_close_frame.html"> + <param name="onload" value="return OnChromeFrameLoaded(arguments[0]);"> + <param name="onloaderror" value="return OnNavigationFailed(arguments[0]);"> + <param name="onclose" value="return OnCloseWindow();"> + <embed id="ChromeFramePlugin" width="500" height="500" name="ChromeFrame" + src="window_close_frame.html" + type="application/chromeframe" + onload="return OnChromeFrameLoaded(arguments[0]);" + onloaderror="return OnNavigationFailed(arguments[0]);" + onclose="return OnCloseWindow();"> + </embed> + </object> + <p>Tests window.close notification from ChromeFrame to its container</p> + </body> +</html> diff --git a/chrome_frame/test/data/window_close_frame.html b/chrome_frame/test/data/window_close_frame.html new file mode 100644 index 0000000..c8a1d53 --- /dev/null +++ b/chrome_frame/test/data/window_close_frame.html @@ -0,0 +1,20 @@ +<html>
+ <head><title>window.close test</title>
+ <script type="text/javascript" src="chrome_frame_tester_helpers.js"> + </script> + <script type="text/javascript">
+ function close_window() {
+ if (!isRunningInChrome()) {
+ onFailure("WindowCloseTest", 1,
+ "window_close_frame.html should load in Chrome");
+ return;
+ }
+ window.close();
+ }
+ </script>
+ </head>
+ <body onLoad="setTimeout(close_window, 100);">
+ <h2>Prepare close!</h2>
+ <p>Content closing the window...</p>
+ </body>
+</html>
\ No newline at end of file |