window.opener navigation inside a beforeunload/unload handler is ignored
Reported by
m...@hanleym.com,
Oct 28 2016
|
|||||||||||||
Issue descriptionUserAgent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/54.0.2840.71 Safari/537.36 Steps to reproduce the problem: 1. Open index.html with popups enabled. 2. Close the popup (popup.html) that is opened by index.html. What is the expected behavior? The original window (opener) location should change to unload.html. What went wrong? The setting of window.opener.location.href was ignored and the original window (opener) location remained index.html. Did this work before? Yes 414582 Does this work in other browsers? N/A Chrome version: 54.0.2840.71 Channel: stable OS Version: OS X 10.11.6 Flash Version: Shockwave Flash 23.0 r0 I am mostly confident that 8fb70277dba468aac9d2eae51e432d76667a79db (https://chromium.googlesource.com/chromium/src/+/8fb70277dba468aac9d2eae51e432d76667a79db) is the cause of this issue, however, the result of bisect-builds.py is below. Additionally, the discussion referenced in the commit (https://groups.google.com/a/chromium.org/forum/#!topic/blink-dev/VfItzNe3WO0) states that this is consistent with the behavior of Firefox and Edge. This is not the case with regards to window.opener as both allow this. Finally, I think this bug (https://bugs.chromium.org/p/chromium/issues/detail?id=660276) is likely caused by the same issue. bisect-builds.py: You are probably looking for a change made after 414582 (known good), but no later than 414590 (first known bad). CHANGELOG URL: https://chromium.googlesource.com/chromium/src/+log/cbdfa25c7526a8ddddba3fc6a84c17b25263d48e..aaad992eef8e8c1e879f72afd9dabb05d3855e67
,
Nov 2 2016
,
Nov 3 2016
,
Nov 3 2016
This was unintentional, the idea is to block navigations only on the document that's being unloaded, I'll work on a fix, but a possible workaround you can use is:
window.onbeforeunload = function() {
setTimeout(function() {
window.opener.location.href = "something";
}, 0);
}
,
Nov 7 2016
I have the same problem. When do you think this issue will be fixed?
,
Nov 8 2016
Re#5: Targeting M55 for a fix.
,
Nov 8 2016
,
Nov 9 2016
I have the same issue. I tried the workaround suggested by lfg@chromium.org from this comment https://bugs.chromium.org/p/chromium/issues/detail?id=660496#c4, but no success. Is there any other possible workaround/quickfix?
,
Nov 9 2016
We did something similar to the suggested fix and it works great:
window.onunload = function() {
window.opener.callRefresh();
};
function callRefresh(){
var winTimer = window.setInterval(function()
{
window.clearInterval(winTimer);
location.href = your url go here
}, 500);
}
Hope this helps.
,
Nov 9 2016
Issue 661905 has been merged into this issue.
,
Nov 11 2016
Issue 664470 has been merged into this issue.
,
Nov 14 2016
**** Bulk edit - please ignore if not applicable **** A friendly reminder that M55 Stable is launch is coming soon! Your bug is labelled as Stable ReleaseBlock, pls make sure to land the fix and get it merged into the release branch ASAP so it gets enough baking time in Beta (before Stable promotion). Thank you! Also due to Thanksgiving holidays in US, please make sure fix is ready and merged to M55 latest by 5:00 PM PT Friday, 11/18/16 (sooner the better).
,
Nov 15 2016
I talked with dcheng@ yesterday and we are moving this to M56. We are too close to merge this back to M55, and since there are plenty of workarounds available I don't think we should take the risk merging this to M55. If you want to try the WIP patch, the CL is at https://codereview.chromium.org/2487403002/ .
,
Nov 15 2016
Specifically, I'm worried about merging this because of the behavior changes for beforeunload: I haven't managed to convince myself that it's safe to let beforeunload handlers navigate *other* frames, even if those frames aren't in the subtree that will be navigated.
,
Nov 22 2016
,
Nov 28 2016
Any updates?
,
Dec 1 2016
,
Dec 9 2016
This issue is tagged as Stable Blocker, can we have the latest update?
,
Dec 12 2016
Review in progress, hoping to land a fix soon.
,
Dec 19 2016
Any updates?
,
Jan 3 2017
Gentle Ping... ! Any update on this stable blocker issue? Thanks,
,
Jan 9 2017
,
Jan 9 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/2267cfcce06c92602376754343e5f45effeee1f1 commit 2267cfcce06c92602376754343e5f45effeee1f1 Author: lfg <lfg@chromium.org> Date: Mon Jan 09 21:27:48 2017 Allow navigations to frames that aren't being unloaded in the unload handler. This change lets the page navigate frames that aren't being unloaded in the unload handler. For example, a popup may want to navigate its opener while it's being closed. FrameLoader now also correctly checks if the |targetFrame| can be navigated, instead of checking if |m_frame| can be navigated. BUG= 660496 Review-Url: https://codereview.chromium.org/2487403002 Cr-Commit-Position: refs/heads/master@{#442353} [add] https://crrev.com/2267cfcce06c92602376754343e5f45effeee1f1/third_party/WebKit/LayoutTests/http/tests/navigation/resources/targeted-navigation-in-unload-handler-subframe.html [add] https://crrev.com/2267cfcce06c92602376754343e5f45effeee1f1/third_party/WebKit/LayoutTests/http/tests/navigation/targeted-navigation-in-unload-handler.html [modify] https://crrev.com/2267cfcce06c92602376754343e5f45effeee1f1/third_party/WebKit/Source/core/frame/History.cpp [modify] https://crrev.com/2267cfcce06c92602376754343e5f45effeee1f1/third_party/WebKit/Source/core/loader/FrameLoader.cpp [modify] https://crrev.com/2267cfcce06c92602376754343e5f45effeee1f1/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp [modify] https://crrev.com/2267cfcce06c92602376754343e5f45effeee1f1/third_party/WebKit/Source/core/loader/NavigationScheduler.h
,
Jan 10 2017
Tested the issue on chrome latest M57-57.0.2977.0 Windows-10, Ubuntu 14.04 and Mac OS 10.12.2 and able to reproduce the issue.Please find the screen shot for reference. @lfg: Could you please look in to this issue. Thank You!
,
Jan 10 2017
I just tested and the issue is fixed on 2977. Make sure you have popups enabled if you are using the test case on comment #1.
,
Jan 10 2017
,
Jan 10 2017
Your change meets the bar and is auto-approved for M56. Please go ahead and merge the CL manually. Please contact milestone owner if you have questions. Owners: amineer@(clank), cmasso@(bling), gkihumba@(cros), bustamante@(desktop) For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
Jan 12 2017
The following revision refers to this bug: https://chromium.googlesource.com/chromium/src.git/+/99a040bf679e8d63f3836a7dfddbab77b95c5f22 commit 99a040bf679e8d63f3836a7dfddbab77b95c5f22 Author: lfg <lfg@chromium.org> Date: Thu Jan 12 00:51:51 2017 Allow navigations to frames that aren't being unloaded in the unload handler. This change lets the page navigate frames that aren't being unloaded in the unload handler. For example, a popup may want to navigate its opener while it's being closed. FrameLoader now also correctly checks if the |targetFrame| can be navigated, instead of checking if |m_frame| can be navigated. BUG= 660496 Review-Url: https://codereview.chromium.org/2487403002 Cr-Commit-Position: refs/heads/master@{#442353} (cherry picked from commit 2267cfcce06c92602376754343e5f45effeee1f1) TBR=dcheng@chromium.org NOTRY=true NOPRESUBMIT=true Review-Url: https://codereview.chromium.org/2621193004 Cr-Commit-Position: refs/branch-heads/2924@{#736} Cr-Branched-From: 3a87aecc31cd1ffe751dd72c04e5a96a1fc8108a-refs/heads/master@{#433059} [add] https://crrev.com/99a040bf679e8d63f3836a7dfddbab77b95c5f22/third_party/WebKit/LayoutTests/http/tests/navigation/resources/targeted-navigation-in-unload-handler-subframe.html [add] https://crrev.com/99a040bf679e8d63f3836a7dfddbab77b95c5f22/third_party/WebKit/LayoutTests/http/tests/navigation/targeted-navigation-in-unload-handler.html [modify] https://crrev.com/99a040bf679e8d63f3836a7dfddbab77b95c5f22/third_party/WebKit/Source/core/frame/History.cpp [modify] https://crrev.com/99a040bf679e8d63f3836a7dfddbab77b95c5f22/third_party/WebKit/Source/core/loader/FrameLoader.cpp [modify] https://crrev.com/99a040bf679e8d63f3836a7dfddbab77b95c5f22/third_party/WebKit/Source/core/loader/NavigationScheduler.cpp [modify] https://crrev.com/99a040bf679e8d63f3836a7dfddbab77b95c5f22/third_party/WebKit/Source/core/loader/NavigationScheduler.h
,
Jan 18 2017
Verified the fix on Mac 10.12.2, Win-10 and Ubuntu 14.04 using Chrome beta version #56.0.2924.67 as per the comment #0. Observed that the original window (opener) location changed to unload.html as expected. Hence, the fix is working as expected. Attaching the screencast for reference Adding the verified labels. Thanks...!! |
|||||||||||||
►
Sign in to add a comment |
|||||||||||||
Comment 1 by erikc...@chromium.org
, Oct 31 2016Status: Assigned (was: Unconfirmed)