Bug 32761

Summary: upstream LayoutTests/http/tests/misc/set-window-opener-to-null.html
Product: WebKit Reporter: Dirk Pranke <dpranke>
Component: Tools / TestsAssignee: Dirk Pranke <dpranke>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, ap, commit-queue, eric, sam, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: PC   
OS: OS X 10.5   
Attachments:
Description Flags
Patch
none
Patch
none
Patch abarth: review-

Description Dirk Pranke 2009-12-18 18:27:18 PST
upstreaming a test from Chromium.org - it seems to rely on some Chromium-specific timing issues, so I'm putting it in platform/chromium for now.
Comment 1 Dirk Pranke 2009-12-18 18:28:10 PST
Created attachment 45216 [details]
Patch
Comment 2 WebKit Review Bot 2009-12-18 18:31:47 PST
style-queue ran check-webkit-style on attachment 45216 [details] without any errors.
Comment 3 Eric Seidel (no email) 2009-12-19 11:56:15 PST
Looks OK.  Seems we might want some sort of comment in the test that it need not be chromium specific.
Comment 4 Dirk Pranke 2009-12-21 15:37:54 PST
Created attachment 45355 [details]
Patch
Comment 5 Dirk Pranke 2009-12-21 15:39:23 PST
Actually, it looks like it's not a platform-specific test, so I've revised the patch (which is good, because run_webkit_tests isn't set up to handle platform-specific http tests)
Comment 6 WebKit Review Bot 2009-12-21 15:42:33 PST
style-queue ran check-webkit-style on attachment 45355 [details] without any errors.
Comment 7 Adam Barth 2009-12-21 15:44:57 PST
Comment on attachment 45355 [details]
Patch

 22     // We might want to change it to using postMessage when it
 23     // is supported.

postMessage is supported.  Can we use that instead of polling?
Comment 8 Dirk Pranke 2009-12-21 17:52:06 PST
okay, it looks like the key thing is simply to check whether or not window.opener stays null.

Unfortunately, there doesn't seem to be a way to do this without using some 
sort of a timeout or a poll, since by setting window.opener to NULL, we prevent the target window from having a handle to the source. So, the source window has to send a message to the target, giving it a reference. But, if you post a message immediately after window.open(), the message gets dropped on the floor because the target window hasn't initialized yet. Sigh.

Anyway, revised patch uploaded.
Comment 9 Dirk Pranke 2009-12-21 17:54:31 PST
Created attachment 45361 [details]
Patch
Comment 10 Adam Barth 2009-12-21 18:03:38 PST
Comment on attachment 45361 [details]
Patch

I actually like the previous version better.  Julie will kill me if we land this one.
Comment 11 Dirk Pranke 2009-12-21 18:30:05 PST
heh. At least I got to spend some time learning how to use PostMessage() as a result of this ...
Comment 12 Adam Barth 2009-12-21 18:43:15 PST
Sorry for the wild goose chase.  :(
Comment 13 WebKit Commit Bot 2009-12-21 20:31:23 PST
Comment on attachment 45355 [details]
Patch

Clearing flags on attachment: 45355

Committed r52477: <http://trac.webkit.org/changeset/52477>
Comment 14 WebKit Commit Bot 2009-12-21 20:31:29 PST
All reviewed patches have been landed.  Closing bug.