Bug 14186 - No back entry created for window.open navigation triggered by non-user-gesture
Summary: No back entry created for window.open navigation triggered by non-user-gesture
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: History (show other bugs)
Version: 523.x (Safari 3)
Hardware: All All
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2007-06-15 16:56 PDT by Matt Perry
Modified: 2007-08-16 11:25 PDT (History)
0 users

See Also:


Attachments
window.open test case (210 bytes, text/html)
2007-06-15 16:57 PDT, Matt Perry
no flags Details
document.location test case (178 bytes, text/html)
2007-06-15 17:02 PDT, Matt Perry
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Matt Perry 2007-06-15 16:56:12 PDT
Executing window.open() from javascript that isn't a user gesture (from an onload handler, for example) doesn't create a back/forward item for the initial navigation in the new window.  I think that any navigation that's not a user gesture also behaves this way, when not all should (for example, adding a 2s timeout in onload to set document.location doesn't add a back/forward item either).

Tested in r23552.  This does not happen in shipping Safari.  

Test case coming.
Comment 1 Matt Perry 2007-06-15 16:57:44 PDT
Created attachment 15074 [details]
window.open test case

Note that you'll need to disable popup blocking to test this.

The window opened from the onload handler doesn't have a back/forward item for the first navigation.
Comment 2 Matt Perry 2007-06-15 17:02:40 PDT
Created attachment 15075 [details]
document.location test case

This test assigns to document.location 2 seconds after loading.  No back/forward item is created for the test page.

There is code in FrameLoader.cpp that sets the frame load type to FrameLoadTypeInternal if the load was not a userGesture.  This load type doesn't add to the BF list.  The load type seems to have originally been meant for subframe loads, and was overloaded for this purpose as well.  Maybe the solution is to create a new load type?  Some non-userGesture loads should add to the BF list, some shouldn't.
Comment 3 Matt Perry 2007-06-15 17:23:38 PDT
The document.location case also fails in shipping Safari.  It passes in Firefox and IE.
Comment 4 Matt Perry 2007-08-16 11:25:03 PDT
This has been fixed since I filed it.