Some browser extensions, like React DevTools, send messages to the content area. Since our beforeunload event test listens for all messages, it used to catch those as well, failing the test.
Add a source field to the payload JSON and check for it before treating the message as coming from our own test to make sure the test passes even with such browser extensions installed.
Checklist
New tests have been added to show the fix or feature works
Summary
Some browser extensions, like React DevTools, send messages to the content area. Since our beforeunload event test listens for all messages, it used to catch those as well, failing the test.
Add a
source
field to the payload JSON and check for it before treating the message as coming from our own test to make sure the test passes even with such browser extensions installed.Checklist
New tests have been added to show the fix or feature worksIf needed, a docs issue/PR was created at https://github.com/jquery/api.jquery.com