Bug 97171 - Support the replace attribute of window.open
Summary: Support the replace attribute of window.open
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore JavaScript (show other bugs)
Version: 528+ (Nightly build)
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: KyungTae Kim
URL:
Keywords: WebExposed
Depends on:
Blocks:
 
Reported: 2012-09-19 22:38 PDT by KyungTae Kim
Modified: 2016-07-14 11:53 PDT (History)
16 users (show)

See Also:


Attachments
test case (201 bytes, text/html)
2012-09-19 22:39 PDT, KyungTae Kim
no flags Details
Patch (15.80 KB, patch)
2012-09-24 03:42 PDT, KyungTae Kim
no flags Details | Formatted Diff | Diff
Patch (11.80 KB, patch)
2012-11-01 02:37 PDT, KyungTae Kim
abarth: review-
webkit-ews: commit-queue-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description KyungTae Kim 2012-09-19 22:38:53 PDT
According to a spec of window.open() below, if the 'replace' attribute is false, the current window must be exist in the window's session history.
http://www.w3.org/TR/2009/WD-html5-20090423/browsers.html#dom-open

When test with the attached html file, 
I can back to the page after redirected on the IE and the the Firefox, but not on the Webkit browser.

Is the last parameter of the below function ignored on Webkit?
window.open("http://www.google.com", "_self", "", false);
Comment 1 KyungTae Kim 2012-09-19 22:39:26 PDT
Created attachment 164841 [details]
test case
Comment 2 KyungTae Kim 2012-09-24 03:42:47 PDT
Created attachment 165346 [details]
Patch
Comment 3 Build Bot 2012-09-24 04:30:46 PDT
Comment on attachment 165346 [details]
Patch

Attachment 165346 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/13994604

New failing tests:
fast/history/window-open-replace-true.html
fast/history/window-open-replace-false.html
fast/history/gesture-before-onload-form-submit.html
Comment 4 WebKit Review Bot 2012-09-24 08:58:58 PDT
Comment on attachment 165346 [details]
Patch

Attachment 165346 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13985751

New failing tests:
fast/history/window-open-replace-false.html
fast/history/gesture-before-onload-form-submit.html
Comment 5 WebKit Review Bot 2012-09-24 10:00:14 PDT
Comment on attachment 165346 [details]
Patch

Attachment 165346 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/13993687

New failing tests:
fast/history/window-open-replace-false.html
fast/history/gesture-before-onload-form-submit.html
Comment 6 KyungTae Kim 2012-11-01 01:13:33 PDT
The standard says  "the replace attribute, if true, means that whatever page is currently open in that window will be removed from the window's session history".
http://www.w3.org/TR/2009/WD-html5-20090423/browsers.html#dom-open

Then, if the replace attribute is false, what is proper operation?
Not remove the current opened page, or following "by the user gesture" rules?
Comment 7 KyungTae Kim 2012-11-01 02:37:25 PDT
Created attachment 171800 [details]
Patch
Comment 8 Early Warning System Bot 2012-11-01 02:46:36 PDT
Comment on attachment 171800 [details]
Patch

Attachment 171800 [details] did not pass qt-ews (qt):
Output: http://queues.webkit.org/results/14670434
Comment 9 Early Warning System Bot 2012-11-01 02:47:57 PDT
Comment on attachment 171800 [details]
Patch

Attachment 171800 [details] did not pass qt-wk2-ews (qt):
Output: http://queues.webkit.org/results/14697238
Comment 10 Build Bot 2012-11-01 03:09:25 PDT
Comment on attachment 171800 [details]
Patch

Attachment 171800 [details] did not pass win-ews (win):
Output: http://queues.webkit.org/results/14693459
Comment 11 Build Bot 2012-11-01 03:12:04 PDT
Comment on attachment 171800 [details]
Patch

Attachment 171800 [details] did not pass mac-ews (mac):
Output: http://queues.webkit.org/results/14696268
Comment 12 EFL EWS Bot 2012-11-01 04:01:14 PDT
Comment on attachment 171800 [details]
Patch

Attachment 171800 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/14656506
Comment 13 EFL EWS Bot 2012-11-01 04:20:10 PDT
Comment on attachment 171800 [details]
Patch

Attachment 171800 [details] did not pass efl-ews (efl):
Output: http://queues.webkit.org/results/14685552
Comment 14 WebKit Review Bot 2012-11-01 04:45:33 PDT
Comment on attachment 171800 [details]
Patch

Attachment 171800 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/14670460

New failing tests:
fast/history/window-open-replace-false.html
Comment 15 WebKit Review Bot 2012-11-01 05:41:29 PDT
Comment on attachment 171800 [details]
Patch

Attachment 171800 [details] did not pass chromium-ews (chromium-xvfb):
Output: http://queues.webkit.org/results/14693489

New failing tests:
fast/history/window-open-replace-false.html
Comment 16 Adam Barth 2012-11-01 08:01:50 PDT
Comment on attachment 171800 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=171800&action=review

Looks like you have compile and test failures.

> Source/WebCore/page/DOMWindow.cpp:1933
> +        bool lockHistory = false, lockBackForwardList = false;
> +        if (locking == LockHistoryAndBackForwardList)
> +            lockHistory = lockBackForwardList = true;

This is pretty far out of style.  Please take a look at http://www.webkit.org/coding/coding-style.html
Comment 17 Ian 'Hixie' Hickson 2012-11-01 14:42:12 PDT
(In reply to comment #6)
> The standard says  "the replace attribute, if true, means that whatever page is currently open in that window will be removed from the window's session history".
> http://www.w3.org/TR/2009/WD-html5-20090423/browsers.html#dom-open

First, that's a REALLY OLD version of the spec, quite obsolete. The up to date link is:

   http://whatwg.org/html#dom-open

The behaviour of the "replace" argument is just "If the replace is true or if the browsing context was just created as part of the rules for choosing a browsing context given a browsing context name, then replacement must be enabled". (The text quoted in comment 6 isn't normative and doesn't define what "replace" does, it's just descriptive. Please ignore it for when implementing the spec. See the introduction to the spec for information on how to read the spec to avoid interpreting non-normative statements as normative ones; the basic idea is that if it doesn't say "must", it's not normative.)

The meaning of "replacement enabled" is defined here:

   http://whatwg.org/html#replacement-enabled

If "replace" isn't specified, then replacement isn't enabled and so the text above doesn't take effect.

HTH.
Comment 18 Chris Dumez 2016-07-14 11:53:18 PDT
Only IE/Edge implements this. It looks like it is about to get removed from the specification:
https://github.com/whatwg/html/pull/1556