Tests: Make the beforeunload event tests work regardless of extensions
commit399a78ee9fc5802509df462a2851aef1b60b7fbc
authorMichał Gołębiowski-Owczarek <m.goleb@gmail.com>
Wed, 24 Apr 2024 22:24:55 +0000 (25 00:24 +0200)
committerGitHub <noreply@github.com>
Wed, 24 Apr 2024 22:24:55 +0000 (25 00:24 +0200)
tree49d187378c79f2e1b3e7b81df605efb6d0b7b316
parent7cdd8374234b77a3c70dd511a1b06066afb146bb
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
test/data/event/onbeforeunload.html
test/unit/event.js