@@ -902,6 +902,7 @@ function signMsg (msgData) {
902902 log . debug ( 'action - signMsg' )
903903 return ( dispatch , getState ) => {
904904 dispatch ( actions . showLoadingIndication ( ) )
905+ window . onbeforeunload = null
905906
906907 return new Promise ( ( resolve , reject ) => {
907908 log . debug ( `actions calling background.signMessage` )
@@ -933,7 +934,7 @@ function signPersonalMsg (msgData) {
933934 log . debug ( 'action - signPersonalMsg' )
934935 return ( dispatch , getState ) => {
935936 dispatch ( actions . showLoadingIndication ( ) )
936-
937+ window . onbeforeunload = null
937938 return new Promise ( ( resolve , reject ) => {
938939 log . debug ( `actions calling background.signPersonalMessage` )
939940 background . signPersonalMessage ( msgData , ( err , newState ) => {
@@ -964,7 +965,7 @@ function signTypedMsg (msgData) {
964965 log . debug ( 'action - signTypedMsg' )
965966 return ( dispatch , getState ) => {
966967 dispatch ( actions . showLoadingIndication ( ) )
967-
968+ window . onbeforeunload = null
968969 return new Promise ( ( resolve , reject ) => {
969970 log . debug ( `actions calling background.signTypedMessage` )
970971 background . signTypedMessage ( msgData , ( err , newState ) => {
@@ -1168,6 +1169,7 @@ function sendTx (txData) {
11681169 log . info ( `actions - sendTx: ${ JSON . stringify ( txData . txParams ) } ` )
11691170 return ( dispatch , getState ) => {
11701171 log . debug ( `actions calling background.approveTransaction` )
1172+ window . onbeforeunload = null
11711173 background . approveTransaction ( txData . id , ( err ) => {
11721174 if ( err ) {
11731175 dispatch ( actions . txError ( err ) )
@@ -1230,7 +1232,7 @@ function updateAndApproveTx (txData) {
12301232 return ( dispatch , getState ) => {
12311233 log . debug ( `actions calling background.updateAndApproveTx` )
12321234 dispatch ( actions . showLoadingIndication ( ) )
1233-
1235+ window . onbeforeunload = null
12341236 return new Promise ( ( resolve , reject ) => {
12351237 background . updateAndApproveTransaction ( txData , err => {
12361238 dispatch ( actions . updateTransactionParams ( txData . id , txData . txParams ) )
@@ -1292,7 +1294,7 @@ function txError (err) {
12921294function cancelMsg ( msgData ) {
12931295 return ( dispatch , getState ) => {
12941296 dispatch ( actions . showLoadingIndication ( ) )
1295-
1297+ window . onbeforeunload = null
12961298 return new Promise ( ( resolve , reject ) => {
12971299 log . debug ( `background.cancelMessage` )
12981300 background . cancelMessage ( msgData . id , ( err , newState ) => {
@@ -1319,7 +1321,7 @@ function cancelMsg (msgData) {
13191321function cancelPersonalMsg ( msgData ) {
13201322 return ( dispatch , getState ) => {
13211323 dispatch ( actions . showLoadingIndication ( ) )
1322-
1324+ window . onbeforeunload = null
13231325 return new Promise ( ( resolve , reject ) => {
13241326 const id = msgData . id
13251327 background . cancelPersonalMessage ( id , ( err , newState ) => {
@@ -1346,7 +1348,7 @@ function cancelPersonalMsg (msgData) {
13461348function cancelTypedMsg ( msgData ) {
13471349 return ( dispatch , getState ) => {
13481350 dispatch ( actions . showLoadingIndication ( ) )
1349-
1351+ window . onbeforeunload = null
13501352 return new Promise ( ( resolve , reject ) => {
13511353 const id = msgData . id
13521354 background . cancelTypedMessage ( id , ( err , newState ) => {
@@ -1374,7 +1376,7 @@ function cancelTx (txData) {
13741376 return ( dispatch , getState ) => {
13751377 log . debug ( `background.cancelTransaction` )
13761378 dispatch ( actions . showLoadingIndication ( ) )
1377-
1379+ window . onbeforeunload = null
13781380 return new Promise ( ( resolve , reject ) => {
13791381 background . cancelTransaction ( txData . id , err => {
13801382 if ( err ) {
@@ -1408,6 +1410,7 @@ function cancelTx (txData) {
14081410 */
14091411function cancelTxs ( txDataList ) {
14101412 return async ( dispatch , getState ) => {
1413+ window . onbeforeunload = null
14111414 dispatch ( actions . showLoadingIndication ( ) )
14121415 const txIds = txDataList . map ( ( { id} ) => id )
14131416 const cancellations = txIds . map ( ( id ) => new Promise ( ( resolve , reject ) => {
@@ -1810,6 +1813,7 @@ function addTokens (tokens) {
18101813function removeSuggestedTokens ( ) {
18111814 return ( dispatch ) => {
18121815 dispatch ( actions . showLoadingIndication ( ) )
1816+ window . onbeforeunload = null
18131817 return new Promise ( ( resolve , reject ) => {
18141818 background . removeSuggestedTokens ( ( err , suggestedTokens ) => {
18151819 dispatch ( actions . hideLoadingIndication ( ) )
0 commit comments