Bug 24218 - Safari 4 javascript window resize inconsistency
Summary: Safari 4 javascript window resize inconsistency
Status: RESOLVED DUPLICATE of bug 23603
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebKit Misc. (show other bugs)
Version: 528+ (Nightly build)
Hardware: Mac (PowerPC) OS X 10.5
: P2 Normal
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-02-26 17:51 PST by Kevin M. Dean
Modified: 2010-06-14 12:31 PDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Kevin M. Dean 2009-02-26 17:51:34 PST
I have a series of bookmarks I use to trigger javascript window resizing and moving.

Here's the address fields for some of those bookmarks. Each line is a different bookmark

javascript:self.moveTo(0,0);self.resizeTo(screen.availWidth,screen.availHeight);
javascript:resizeTo(800,533);
javascript:resizeTo(1024,713);
javascript:moveTo(0,0);

Under Safari 4, if I have 1 tab open, they work as expected. As soon as I open another tab, they no longer work no matter which tab is selected.

I'll submit this via the Safari bug button as well just in case it's their issue.
Comment 1 ar 2009-03-31 00:43:06 PDT
Seconded.

It does work sometimes.
I can get it to work on a newly created window (but not consistently... I haven't figure out the pattern), but not a window that's been around the whole session.

Sometimes I can get around it by creating a new window and manually moving all of the tabs from the previous (not working) window to the new one.
Comment 2 Sam Garfield 2009-05-15 16:17:03 PDT
I think this may be indicative of a more general problem with the javascript engine.  Whatever the bug is that is causing this will probably crop up in other places as well.  

I rely on these bookmarklets and this is my biggest annoyance with Safari 4/Webkit.  But I love everything else so much I can't go back (top bar tabs FTW!)  I'm kinda surprised this hasn't gotten more attention as I know a lot of web developers who use these kinds of things.

Comment 3 Kevin M. Dean 2009-06-08 15:14:50 PDT
Well Safari 4 Final still leaves this broken.
Comment 4 Cody Robbins 2009-06-13 16:55:56 PDT
Here is a reproducible test case for this bug on my system:

1. Open Safari.
2. Create bookmarks with the following addresses:

javascript:moveTo(0,0);
javascript:resizeTo(100,100);

3. Open two tabs in the same window.
4. Click both bookmarks. Neither results in the expected behavior.
5. Close the second tab so that there is only one tab open in the window, and click both bookmarks. Both result in the expected behavior.

It does not appear to make a difference whether the window is new or has been open for the entire session. The problem occurs if you open Safari fresh and click the bookmarks immediately.

System details:

MacBook Pro 2.2GHz Intel Core 2 Duo
OS X 10.5.7 build 9J61
Safari 4.0 (5530.17)
Comment 5 Cody Robbins 2009-06-13 17:26:46 PDT
Never mind, I downloaded the WebKit source and tracked what was causing this undesired behavior, and as far as I can tell it appears as though the problem is with Safari, not WebKit.

WebChromeClient::setWindowRect in mac/WebCoreSupport/WebChromeClient.mm sends setFrame:windowRect: to WebUIDelegate with the exact same window rectangle regardless of the number of tabs open. The message simply doesn't result in the window being moved when there is more than one tab.

See http://blog.wearesakuzaku.com/fixing-maximize-bookmarklets-in-safari-4/ for a more detailed explanation.

I filed a bug for Safari on Radar describing the problem. I think this ticket should be closed since it's not a WebKit problem.
Comment 6 Sam Garfield 2009-08-11 15:29:56 PDT
Are we sure this isn't a webkit problem?  The same bug exists in webkit.
Comment 7 Kevin M. Dean 2010-06-07 17:59:46 PDT
Of course, Safari 5 does nothing to fix this.
Comment 8 Alexey Proskuryakov 2010-06-08 13:19:43 PDT
> I filed a bug for Safari on Radar describing the problem.
> I think this ticket should be closed since it's not a WebKit problem.

The bug was filed as <rdar://problem/6970303>. But this is really a duplicate of bug 23603, and I'll comment there.

*** This bug has been marked as a duplicate of bug 23603 ***
Comment 9 Kevin M. Dean 2010-06-14 12:31:25 PDT
There's a new Safari 5 extension that can resize the windows even with multiple tabs. It's quite nice.

http://www.apfelquak.de/2010/06/12/maximize-safari-extension/