Bug 25020

Summary: window.focus() does not work correctly in onclick event handler when open an new page in existing window.
Product: WebKit Reporter: Barry Han <zhan>
Component: JavaScriptCoreAssignee: Nobody <webkit-unassigned>
Status: UNCONFIRMED ---    
Severity: Normal    
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: Windows XP   
Attachments:
Description Flags
Here's the test call html I am using. It opens another test html each time when click on the anchor in the _same_ window. But only the first time the window get focused.
none
Here's the callee (popup page) the caller called, nothing special. none

Description Barry Han 2009-04-02 20:28:53 PDT
Reproduce process:
Web developers usually open a page multiple times in a singleton window by assign a window name in window.open javascript call.

For example, an anchor of html page may looks like:

<a href="javascript:void(0)"
   onclick="var target=window.open('some url', 'singletonwindow', '');target.focus();return false">
text
</a>

"target.focus()" call should make the singleton window being focused whenever the anchor is clicked thus the page is refreshed, and it works in FF and IE, but does not work in safari and chrome (only the first time the window get focused).
Comment 1 Barry Han 2009-04-02 20:31:21 PDT
Created attachment 29217 [details]
Here's the test call html I am using. It opens another test html each time when click on the anchor in the _same_ window. But only the first time the window get focused.
Comment 2 Barry Han 2009-04-02 20:32:15 PDT
Created attachment 29218 [details]
Here's the callee (popup page) the caller called, nothing special.