@@ -1040,22 +1040,22 @@ export class RuntimeService {
10401040 this . pageLoadCaches . delete ( script . uuid ) ;
10411041 // 安装,启用,或earlyStartScript的value更新
10421042 const scriptRes = buildScriptRunResourceBasic ( script ) ;
1043- const patterns = scriptURLPatternResults ( scriptRes ) ;
1044- if ( patterns ) {
1045- this . scriptMatchEntry ( scriptRes , patterns ) ;
1046- } else {
1047- void this . applyScriptMatchInfo ( scriptRes ) ;
1048- }
1049- const ret = await this . buildCompiledResourceFromScript ( script , true ) ;
1050- if ( ! ret ) {
1051- // 空匹配覆盖(match 与 include 均为空)时脚本不再匹配任何站点。内存 matcher 里只剩
1052- // 供 Popup 恢复用的原始规则,这里再清掉持久化的 CompiledResource 并注销浏览器旧注册,
1053- // 否则 SW 重启后 waitInit 会信任旧资源、让旧范围复活。
1054- await this . compiledResourceDAO . delete ( script . uuid ) ;
1055- await this . unregistryPageScripts ( [ script . uuid ] ) ;
1056- return ;
1057- }
1058- const { apiScript } = ret ;
1043+ const patterns = scriptURLPatternResults ( scriptRes ) ;
1044+ if ( patterns ) {
1045+ this . scriptMatchEntry ( scriptRes , patterns ) ;
1046+ } else {
1047+ void this . applyScriptMatchInfo ( scriptRes ) ;
1048+ }
1049+ const ret = await this . buildCompiledResourceFromScript ( script , true ) ;
1050+ if ( ! ret ) {
1051+ // 空匹配覆盖(match 与 include 均为空)时脚本不再匹配任何站点。内存 matcher 里只剩
1052+ // 供 Popup 恢复用的原始规则,这里再清掉持久化的 CompiledResource 并注销浏览器旧注册,
1053+ // 否则 SW 重启后 waitInit 会信任旧资源、让旧范围复活。
1054+ await this . compiledResourceDAO . delete ( script . uuid ) ;
1055+ await this . unregistryPageScripts ( [ script . uuid ] ) ;
1056+ return ;
1057+ }
1058+ const { apiScript } = ret ;
10591059 if ( await this . loadPageScript ( script , apiScript ! ) ) {
10601060 try {
10611061 await this . compiledResourceDAO . save ( ret . compiledResource ) ;
0 commit comments