Fix torbutton noscript-control race condition
While debugging some testsuite tests, I saw some race condition with the noscript initialization which prevents some tests from running correctly.
We currently listen for both startup
and pageshow
events here, and in some tests, pageshow
events are being received before startup
, which results in the configuration message being lost and noscript being initialized with the default settings, blocking scripts.
This was originally introduced in legacy/trac#27427 (moved), which added checks for the event types precisely because of these issues. However, "pageshow" in specific situations also seems to trigger those.
In that ticket, "pageshow" was added for a slightly more graceful failure mode in case Torbutton somehow misses NoScript startup
. However, I don't think that can really happen, and I suggest we just listen to startup
.