All pastes #1062845 Raw Edit

Miscellany

public html v1 · immutable
#1062845 ·published 2008-07-05 06:38 UTC
rendered paste body
<html> <head> <title>nativeWindow.close() TypeError test case</title> </head> <body><h3>Isolated sample:<br />nativeWindow.close() throwing a TypeError</h3><div style="text-align: center;"><button id="window">Step 1: Popup window</button></div><p><b>Note</b>: The bug occurs when we're using the follwing path: HTMLLoader.window.nativeWindow.activate(),<br />calling from the parent (initial) window.<br /><br />By calling window.nativeWindow.activate() directly from the child window, the bug does <b>not</b> occur.</p><script type="text/javascript">	var winbox_window; // setting up as a global variable, just in case it would help.	winbox_loadcomplete = function() { 		//Using the following line will throw the TypeError: Undefined value		winbox_window.window.nativeWindow.activate();		//To see a working (bug-free) version, comment this above, and uncomment //showwindow() 		//in the winbox_body string below	}	document.getElementById('window').addEventListener("click",function() {		var winbox_options = new window.runtime.flash.display.NativeWindowInitOptions(); 		winbox_window = window.runtime.flash.html.HTMLLoader.createRootWindow(false, winbox_options, false, null); 		var winbox_body = '<html><head><title>test</title></head><body onload="//showwindow();"><script type="text/javascript">function showwindow() {window.nativeWindow.activate();}<\/script><span id="close">2. Close this window (by system chrome or by clicking thru text) to make the bug occur.<br />3. ??? (Look in the console)<br />4. Profit! (or not? :) )<\/span><script type="text/javascript">document.getElementById("close").addEventListener("click",function() { window.nativeWindow.close(); });<\/script><\/body><\/html>';		winbox_window.loadString(winbox_body);		winbox_window.addEventListener(window.runtime.flash.events.Event.COMPLETE,winbox_loadcomplete);	});</script></body></html>