mirror of
https://gitlab.torproject.org/tpo/anti-censorship/pluggable-transports/snowflake.git
synced 2025-10-14 05:11:19 -04:00
Ensure snnowflake
was initialized in unload handlers
This commit is contained in:
parent
99952ca7de
commit
3455cd5da8
2 changed files with 12 additions and 4 deletions
|
@ -63,14 +63,18 @@ var snowflake, query, debug, silenceNotifications, log, dbg, init;
|
|||
|
||||
// Notification of closing tab with active proxy.
|
||||
window.onbeforeunload = function() {
|
||||
if (!silenceNotifications && Snowflake.MODE.WEBRTC_READY === snowflake.state) {
|
||||
if (
|
||||
!silenceNotifications &&
|
||||
snowflake !== null &&
|
||||
Snowflake.MODE.WEBRTC_READY === snowflake.state
|
||||
) {
|
||||
return Snowflake.MESSAGE.CONFIRMATION;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
window.onunload = function() {
|
||||
snowflake.disable();
|
||||
if (snowflake !== null) { snowflake.disable(); }
|
||||
return null;
|
||||
};
|
||||
|
||||
|
|
|
@ -61,14 +61,18 @@ var debug, snowflake, config, broker, ui, log, dbg, init, update, silenceNotific
|
|||
|
||||
// Notification of closing tab with active proxy.
|
||||
window.onbeforeunload = function() {
|
||||
if (!silenceNotifications && Snowflake.MODE.WEBRTC_READY === snowflake.state) {
|
||||
if (
|
||||
!silenceNotifications &&
|
||||
snowflake !== null &&
|
||||
Snowflake.MODE.WEBRTC_READY === snowflake.state
|
||||
) {
|
||||
return Snowflake.MESSAGE.CONFIRMATION;
|
||||
}
|
||||
return null;
|
||||
};
|
||||
|
||||
window.onunload = function() {
|
||||
snowflake.disable();
|
||||
if (snowflake !== null) { snowflake.disable(); }
|
||||
return null;
|
||||
};
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue