@@ -1546,19 +1546,10 @@ function purgeObsoleteData() {
1546
1546
}
1547
1547
1548
1548
async function initializeAccount ( ) {
1549
- let lastStep = 'start' ;
1550
- const timeout = setTimeout ( ( ) => {
1551
- const error = new Error ( `account init timeout after step: ${ lastStep } ` ) ;
1552
- error . name = 'AccountTimeoutError' ;
1553
- ErrorReporter . captureException ( error ) ;
1554
- alwaysLog ( error ) ;
1555
- } , 5000 ) ;
1556
-
1557
1549
try {
1558
1550
try {
1559
1551
// try to get user session from ghostery.com cookie
1560
1552
await account . getUser ( ) ;
1561
- lastStep = 'getUser' ;
1562
1553
} catch ( e ) {
1563
1554
// expected if the user is not logged in
1564
1555
}
@@ -1568,33 +1559,26 @@ async function initializeAccount() {
1568
1559
if ( globals . JUST_INSTALLED ) {
1569
1560
setGhosteryDefaultBlocking ( ) ;
1570
1561
}
1571
- lastStep = 'setGhosteryDefaultBlocking' ;
1572
1562
return ;
1573
1563
}
1574
1564
1575
1565
try {
1576
- lastStep = 'beforeGetUserSubscriptionData' ;
1577
1566
await account . getUserSubscriptionData ( ) ;
1578
- lastStep = 'afterGetUserSubscriptionData' ;
1579
1567
} catch ( e ) {
1580
1568
// expected if the user does not have active subscription
1581
1569
}
1582
1570
1583
1571
ghosteryDebugger . addAccountEvent ( 'app started' , 'signed in' , conf . account ) ;
1584
1572
1585
1573
await account . getUserSettings ( ) ;
1586
- lastStep = 'getUserSettings' ;
1587
1574
1588
1575
if ( conf . current_theme !== 'default' ) {
1589
1576
await account . getTheme ( conf . current_theme ) ;
1590
- lastStep = 'getTheme' ;
1591
1577
}
1592
1578
} catch ( e ) {
1593
1579
ErrorReporter . captureException ( e ) ;
1594
1580
e . name = 'AccountError' ;
1595
1581
alwaysLog ( e ) ;
1596
- } finally {
1597
- clearTimeout ( timeout ) ;
1598
1582
}
1599
1583
}
1600
1584
@@ -1623,52 +1607,32 @@ async function recordUTMs() {
1623
1607
* @memberOf Background
1624
1608
*/
1625
1609
async function init ( ) {
1626
- let lastStep = 'start' ;
1627
- const timeout = setTimeout ( ( ) => {
1628
- const error = new Error ( lastStep ) ;
1629
- error . name = 'InitTimeoutError' ;
1630
- ErrorReporter . captureException ( error ) ;
1631
- alwaysLog ( error ) ;
1632
- } , 20000 ) ;
1633
-
1634
1610
try {
1635
1611
await confData . init ( ) ;
1636
- lastStep = 'confData.init' ;
1637
1612
1638
1613
metrics . init ( ) ;
1639
- lastStep = 'metrics.init' ;
1640
1614
1641
1615
initializePopup ( ) ;
1642
- lastStep = 'initializePopup' ;
1643
1616
1644
1617
initializeEventListeners ( ) ;
1645
- lastStep = 'initializeEventListeners' ;
1646
1618
1647
1619
initializeVersioning ( ) ;
1648
- lastStep = 'initializeVersioning' ;
1649
1620
1650
1621
if ( globals . JUST_UPGRADED ) {
1651
1622
await purgeObsoleteData ( ) ;
1652
- lastStep = 'purgeObsoleteData' ;
1653
1623
await freeSpaceIfNearQuota ( { force : true } ) ; // TODO: consider dropping "force" once all users upgraded
1654
- lastStep = 'freeSpaceIfNearQuota' ;
1655
1624
}
1656
1625
1657
1626
initializeSearchMessageHandler ( ) ;
1658
- lastStep = 'initializeSearchMessageHandler' ;
1659
1627
1660
1628
await recordUTMs ( ) ;
1661
- lastStep = 'recordUTMs' ;
1662
1629
1663
1630
await initializeGhosteryModules ( ) ;
1664
- lastStep = 'initializeGhosteryModules' ;
1665
1631
1666
1632
await initializeAccount ( ) ;
1667
- lastStep = 'initializeAccount' ;
1668
1633
1669
1634
// persist Conf properties to storage only after init has completed
1670
1635
await prefsSet ( globals . initProps ) ;
1671
- lastStep = 'prefsSet' ;
1672
1636
1673
1637
globals . INIT_COMPLETE = true ;
1674
1638
@@ -1680,8 +1644,6 @@ async function init() {
1680
1644
alwaysLog ( 'Error in init()' , err ) ;
1681
1645
1682
1646
throw err ;
1683
- } finally {
1684
- clearTimeout ( timeout ) ;
1685
1647
}
1686
1648
}
1687
1649
0 commit comments