]> source.dussan.org Git - jquery.git/commit
Tests: Make the beforeunload event tests work regardless of extensions
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Wed, 24 Apr 2024 22:24:55 +0000 (00:24 +0200)
committerMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Wed, 24 Apr 2024 22:25:27 +0000 (00:25 +0200)
commit5d83fadb6be83bcda54a87c1c0d73534e5aad6fb
tree7b6489771911f225a6a1be6ee18c9e5b9b46cbe0
parent5d5872bd58ed671ccebbd05ca67d1963bc8a8f45
Tests: Make the beforeunload event tests work regardless of extensions

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.

Closes gh-5478

(cherry picked from commit 399a78ee9fc5802509df462a2851aef1b60b7fbc)
test/data/event/onbeforeunload.html
test/unit/event.js