Skip to content

Commit

Permalink
Bug 34250: Only listen to 'started' in noscript-control.js
Browse files Browse the repository at this point in the history
This fixes a race condition which can be hit in some cases,
such as running some marionette tests. The race condition
results in noscript not being initialized properly due to
the 'pageshow' event being received before 'started'.
  • Loading branch information
acatarineu committed May 18, 2020
1 parent 36f8182 commit 8f79fdb
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion modules/noscript-control.js
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ var initialize = () => {
let messageListener = (a, b, c) => {
try {
log(3, `Message received from NoScript: ${JSON.stringify([a, b, c])}`);
if (!["started", "pageshow"].includes(a.__meta.name)) {
if (a.__meta.name !== "started") {
return;
}
Services.mm.removeMessageListener("MessageChannel:Messages", listener);
Expand Down

0 comments on commit 8f79fdb

Please sign in to comment.