@@ -30,7 +30,7 @@ enum LegacySpecificFilterType {
30
30
31
31
#[ derive( Deserialize , Serialize , Default ) ]
32
32
pub ( crate ) struct LegacyHostnameRuleDb {
33
- #[ serde( serialize_with = "crate::data_format::utils:: stabilize_hashmap_serialization" ) ]
33
+ #[ serde( serialize_with = "stabilize_hashmap_serialization" ) ]
34
34
db : HashMap < Hash , Vec < LegacySpecificFilterType > > ,
35
35
}
36
36
@@ -141,7 +141,7 @@ pub(crate) struct LegacyRedirectResource {
141
141
142
142
#[ derive( Serialize , Deserialize , Debug , PartialEq , Default ) ]
143
143
pub ( crate ) struct LegacyRedirectResourceStorage {
144
- #[ serde( serialize_with = "crate::data_format::utils:: stabilize_hashmap_serialization" ) ]
144
+ #[ serde( serialize_with = "stabilize_hashmap_serialization" ) ]
145
145
pub resources : HashMap < String , LegacyRedirectResource > ,
146
146
}
147
147
@@ -152,7 +152,7 @@ pub(crate) struct LegacyScriptletResource {
152
152
153
153
#[ derive( Default , Deserialize , Serialize ) ]
154
154
pub ( crate ) struct LegacyScriptletResourceStorage {
155
- #[ serde( serialize_with = "crate::data_format::utils:: stabilize_hashmap_serialization" ) ]
155
+ #[ serde( serialize_with = "stabilize_hashmap_serialization" ) ]
156
156
resources : HashMap < String , LegacyScriptletResource > ,
157
157
}
158
158
@@ -216,7 +216,7 @@ where
216
216
{
217
217
#[ derive( Serialize , Default ) ]
218
218
struct NetworkFilterListV0SerializeFmt < ' a > {
219
- #[ serde( serialize_with = "crate::data_format::utils:: stabilize_hashmap_serialization" ) ]
219
+ #[ serde( serialize_with = "stabilize_hashmap_serialization" ) ]
220
220
filter_map : HashMap < crate :: utils:: Hash , Vec < NetworkFilterV0SerializeFmt < ' a > > > ,
221
221
}
222
222
@@ -283,6 +283,11 @@ pub(crate) struct SerializeFormat<'a> {
283
283
misc_generic_selectors : & ' a HashSet < String > ,
284
284
285
285
scriptlets : LegacyScriptletResourceStorage ,
286
+
287
+ #[ serde( serialize_with = "stabilize_hashmap_serialization" ) ]
288
+ procedural_action : & ' a HashMap < Hash , Vec < String > > ,
289
+ #[ serde( serialize_with = "stabilize_hashmap_serialization" ) ]
290
+ procedural_action_exception : & ' a HashMap < Hash , Vec < String > > ,
286
291
}
287
292
288
293
impl < ' a > SerializeFormat < ' a > {
@@ -382,6 +387,11 @@ pub(crate) struct DeserializeFormat {
382
387
misc_generic_selectors : HashSet < String > ,
383
388
384
389
_scriptlets : LegacyScriptletResourceStorage ,
390
+
391
+ #[ serde( default ) ]
392
+ procedural_action : HashMap < Hash , Vec < String > > ,
393
+ #[ serde( default ) ]
394
+ procedural_action_exception : HashMap < Hash , Vec < String > > ,
385
395
}
386
396
387
397
impl DeserializeFormat {
@@ -422,12 +432,21 @@ impl<'a> From<(&'a Blocker, &'a CosmeticFilterCache)> for SerializeFormat<'a> {
422
432
misc_generic_selectors : & cfc. misc_generic_selectors ,
423
433
424
434
scriptlets : LegacyScriptletResourceStorage :: default ( ) ,
435
+
436
+ procedural_action : & cfc. specific_rules . procedural_action . 0 ,
437
+ procedural_action_exception : & cfc. specific_rules . procedural_action_exception . 0 ,
425
438
}
426
439
}
427
440
}
428
441
429
442
impl From < DeserializeFormat > for ( Blocker , CosmeticFilterCache ) {
430
443
fn from ( v : DeserializeFormat ) -> Self {
444
+ use crate :: cosmetic_filter_cache:: HostnameFilterBin ;
445
+
446
+ let mut specific_rules: HostnameRuleDb = v. specific_rules . into ( ) ;
447
+ specific_rules. procedural_action = HostnameFilterBin ( v. procedural_action ) ;
448
+ specific_rules. procedural_action_exception = HostnameFilterBin ( v. procedural_action_exception ) ;
449
+
431
450
(
432
451
Blocker {
433
452
csp : v. csp . into ( ) ,
@@ -454,7 +473,7 @@ impl From<DeserializeFormat> for (Blocker, CosmeticFilterCache) {
454
473
complex_class_rules : v. complex_class_rules ,
455
474
complex_id_rules : v. complex_id_rules ,
456
475
457
- specific_rules : v . specific_rules . into ( ) ,
476
+ specific_rules,
458
477
459
478
misc_generic_selectors : v. misc_generic_selectors ,
460
479
} ,
0 commit comments