[PATCH] window.open destinations _self and replace
Maciej Stachowiak
mjs at apple.com
Mon Oct 6 17:49:13 CEST 2003
On Oct 6, 2003, at 2:57 PM, Daniel Molkentin wrote:
> Moin!
>
> This patch adds the destinations _self and replace to window.open
> according to
> [1]. Apparently some reallife sites (Well, intranet sites) use it. It
> merely
> loads the url into the current window (similar to document.load()?).
> The
> bugreporter was able to verify a similar patch works (In first
> iteration I
> didn't make a difference between _self and replace, but that seems
> necessary.
> Quoting the docs from "replace": "... the new document is to replace
> the
> current entry in the history list."
Thanks. Do you happen to remember sites that use these?
>
> In khtml, the following other target destinations remain unimplemented:
>
> _search: "Available in Internet Explorer 5 and later. When opening a
> window,
> the sUrl is opened in the browser's search pane."
> _media: "Available in Internet Explorer 6 and later. The sUrl is
> loaded in the
> Media Bar."
>
> Both could probably supported the one or other way in Konq. (do we
> have means
> to access the sidebar media player? For the search we could fire a
> search
> using the peferred search provider in a new window).
>
> I didn't find comparable stuff in WebCore 85. Does Safari handle those?
The latest WebCore (soon to be released) includes support for "_self"
as a destination for window.open, but not "replace".
> [1]
> http://msdn.microsoft.com/workshop/author/dhtml/reference/methods/
> open_1.asp
Looking at these docs, it sounds like "replace" is only a valid
argument for document.open, not window.open. So you can do:
document.open("text/html", "replace")
but not
window.open("http://www.google.com", "replace");
The docs are a bit confusing because WinIE (and also Safari) will treat
document.open as window.open if the arguments look like it should be a
window.open call.
Safari doesn't get this 100% right, because it doesn't detect a single
argument being a mime type, or the second argument being "replace".
Based on this, I think your patch is not quite right, at least as to
"replace".
Also, in the latest WebCore we make sure to schedule any navigation of
an existing frame from a window.open as a redirect, instead of doing it
immediately, particularly for "_self". Otherwise you can get crashes if
this happens in the middle of parsing the document or running a script.
I'm not sure if goURL does this, it doesn't appear to exist in the
WebCore tree.
One specific crash that led us to schedule redirects for window.open
navigation was a crash on this page with popup blocking off:
http://www.nttdocomo.com/current_information/product/pressrelease/
article/20030326_12151810.html
Regards,
Maciej
More information about the Khtml-devel
mailing list