@@ -1336,15 +1336,19 @@ function updatePersistButton() {
13361336
13371337function persistScope ( ) {
13381338 var httpsb = getHTTPSB ( ) ;
1339- var rulset = getTemporaryRuleset ( ) ;
1340- if ( httpsb . isGlobalScopeKey ( rulset . tScopeKey ) ) {
1341- httpsb . createPermanentGlobalScope ( HTTPSBPopup . pageURL ) ;
1342- } else if ( httpsb . isDomainScopeKey ( rulset . tScopeKey ) ) {
1343- httpsb . createPermanentDomainScope ( HTTPSBPopup . pageURL ) ;
1344- } else if ( httpsb . isSiteScopeKey ( rulset . tScopeKey ) ) {
1345- httpsb . createPermanentSiteScope ( HTTPSBPopup . pageURL ) ;
1346- }
1347- httpsb . applyRulesetPermanently ( rulset . tScopeKey , rulset ) ;
1339+ var ruleset = getTemporaryRuleset ( ) ;
1340+ var changed = false ;
1341+ if ( httpsb . isGlobalScopeKey ( ruleset . tScopeKey ) ) {
1342+ changed = httpsb . createPermanentGlobalScope ( HTTPSBPopup . pageURL ) ;
1343+ } else if ( httpsb . isDomainScopeKey ( ruleset . tScopeKey ) ) {
1344+ changed = httpsb . createPermanentDomainScope ( HTTPSBPopup . pageURL ) ;
1345+ } else if ( httpsb . isSiteScopeKey ( ruleset . tScopeKey ) ) {
1346+ changed = httpsb . createPermanentSiteScope ( HTTPSBPopup . pageURL ) ;
1347+ }
1348+ changed = httpsb . applyRulesetPermanently ( ruleset . tScopeKey , ruleset ) || changed ;
1349+ if ( changed ) {
1350+ httpsb . savePermissions ( ) ;
1351+ }
13481352 updateMatrixStats ( ) ;
13491353 updateMatrixColors ( ) ;
13501354 updateMatrixBehavior ( ) ;
@@ -1358,16 +1362,16 @@ function persistScope() {
13581362
13591363function revertScope ( ) {
13601364 var httpsb = getHTTPSB ( ) ;
1361- var rulset = getTemporaryRuleset ( ) ;
1362- httpsb . revertScopeRules ( rulset . tScopeKey ) ;
1363- if ( httpsb . isGlobalScopeKey ( rulset . pScopeKey ) ) {
1365+ var ruleset = getTemporaryRuleset ( ) ;
1366+ httpsb . revertScopeRules ( ruleset . tScopeKey ) ;
1367+ if ( httpsb . isGlobalScopeKey ( ruleset . pScopeKey ) ) {
13641368 httpsb . createTemporaryGlobalScope ( HTTPSBPopup . pageURL ) ;
1365- } else if ( httpsb . isDomainScopeKey ( rulset . pScopeKey ) ) {
1369+ } else if ( httpsb . isDomainScopeKey ( ruleset . pScopeKey ) ) {
13661370 httpsb . createTemporaryDomainScope ( HTTPSBPopup . pageURL ) ;
1367- } else if ( httpsb . isSiteScopeKey ( rulset . pScopeKey ) ) {
1371+ } else if ( httpsb . isSiteScopeKey ( ruleset . pScopeKey ) ) {
13681372 httpsb . createTemporarySiteScope ( HTTPSBPopup . pageURL ) ;
13691373 }
1370- httpsb . revertScopeRules ( rulset . pScopeKey ) ;
1374+ httpsb . revertScopeRules ( ruleset . pScopeKey ) ;
13711375 updateMatrixStats ( ) ;
13721376 updateMatrixColors ( ) ;
13731377 updateMatrixBehavior ( ) ;
0 commit comments