Bug 13581 - window.open returns a reference immediately, but properties are cleared later
Summary: window.open returns a reference immediately, but properties are cleared later
Status: RESOLVED INVALID
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 523.x (Safari 3)
Hardware: Mac OS X 10.4
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-05-03 18:24 PDT by Feng Qian
Modified: 2008-05-08 16:27 PDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Feng Qian 2007-05-03 18:24:10 PDT
example, change the target url of window.open to be in the same domain as the page.

<html>
<script>
foo = window.open("http://..."); 
foo.x = 10;
window.setTimeout('alert(foo.x)', 1000);
</script>
<body>
</body>
</html>

Target window is loaded asynchronized, and returns a window object to 'foo', but when finished loading, the loader wipes out all properties of the window object.

Both FF and IE7 keeps foo.x's value 10, but in Safari, it is undefined.
Comment 1 Soryu Waldfee 2007-06-09 04:19:40 PDT
Same goes for events, it seems. Adding a listener will not work either using addEventListener() or popup_window.onload = function() {…}

popup_window = window.open('popup.html', 'my_popup', 'width=500,height=400');
popup_window.addEventListener("load", function(e) {
	window.alert("loaded");
}, false);