New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 849507 link

Starred by 1 user

Issue metadata

Status: Duplicate
Merged: issue 853021
Owner:
Closed: Jul 17
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug-Regression



Sign in to add a comment

event beforeunload is not working with my chrome version 67

Reported by victorhu...@gmail.com, Jun 5 2018

Issue description

UserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.62 Safari/537.36

Steps to reproduce the problem:
$(window).off('beforeunload').on('beforeunload', removeDeviceFromStorage());

function removeDeviceFromStorage () {
    console.log('>>>removeDeviceFromStorage was called!!!');
    localStorage.removeItem("DEVICE_CREATED"); 
}

What is the expected behavior?
remove the item from localStorage before refresh a tab

What went wrong?
the item was never removed because the event listener never worked

Did this work before? Yes 65

Chrome version: 67.0.3396.62  Channel: stable
OS Version: 10.0
Flash Version: 

The web app is running in salesforce
 

Comment 1 by tkent@chromium.org, Jun 5 2018

Components: -Blink Blink>PageLifecycle
Labels: Needs-Bisect Needs-Triage-M67

Comment 3 by woxxom@gmail.com, Jun 5 2018

Your code is incorrect: it invokes removeDeviceFromStorage immediately instead of specifying a function reference. Remove () like this: .....on('beforeunload', removeDeviceFromStorage);
Cc: krajshree@chromium.org
Labels: Needs-Feedback
victorhugo.lunar@ - Thanks for filing the issue...!!

Could you please provide a sample test file/url to test the issue from TE-end.
This will help us in triaging the issue further.

Thanks...!!
I remove the () but it is still not working...

$(window).off('beforeunload').on('beforeunload', removeDeviceFromStorage);

function removeDeviceFromStorage () {
    console.log('>>>removeDeviceFromStorage was called!!!');
    localStorage.removeItem("DEVICE_CREATED"); 
}

Project Member

Comment 6 by sheriffbot@chromium.org, Jun 5 2018

Labels: -Needs-Feedback
Thank you for providing more feedback. Adding the requester to the cc list.

For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
Labels: Needs-Feedback
Tried testing the issue on Win-10 using chrome reported version #67.0.3396.62 and latest canary #69.0.3450.0.

Attached a screen shot for reference.

Following are the steps followed to reproduce the issue.
------------
1. Opened the following code in console:
$(window).off('beforeunload').on('beforeunload', removeDeviceFromStorage);

function removeDeviceFromStorage () {
    console.log('>>>removeDeviceFromStorage was called!!!');
    localStorage.removeItem("DEVICE_CREATED"); 
}
2. Got an uncaught exception as follows:
VM60:1 Uncaught TypeError: Cannot read property 'off' of undefined
    at <anonymous>:1:10

victorhugo.lunar@ - Could you please provide a sample test file/url to test the issue from TE-end. This will help us in triaging the issue further.

Thanks...!!
849507.PNG
101 KB View Download
Cc: creis@chromium.org
Mergedinto: 853021
Owner: alex...@chromium.org
Status: Duplicate (was: Unconfirmed)
We've landed a fix for beforeunload in cross-site iframes in  issue 853021 .  It should be working again in 69.0.3492.0, and we plan to merge the fix to Chrome 68.

Sign in to add a comment