Skip to content

Commit 90dfb26

Browse files
committed
Fix slow seed data ingestion / data merge
Caused when incoming data includes fingerprinting script hosts with lots of script path entries.
1 parent a5f6ecf commit 90dfb26

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

src/js/storage.js

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,11 +656,16 @@ BadgerPen.prototype = {
656656

657657
/**
658658
* Helps update fp_scripts.
659+
*
660+
* @param {String} script_fqdn
661+
* @param {Array} script_paths one or more script path strings
659662
*/
660-
recordFingerprintingScript: function (script_fqdn, script_path) {
663+
recordFingerprintingScript: function (script_fqdn, script_paths) {
661664
let fpStore = this.getStore('fp_scripts'),
662665
entry = fpStore.getItem(script_fqdn) || {};
663-
entry[script_path] = 1;
666+
for (let path of script_paths) {
667+
entry[path] = 1;
668+
}
664669
fpStore.setItem(script_fqdn, entry);
665670
}
666671
};
@@ -899,9 +904,8 @@ BadgerStorage.prototype = {
899904
if (!snitchItem) {
900905
continue;
901906
}
902-
for (let script_path in mapData[script_fqdn]) {
903-
badger.storage.recordFingerprintingScript(script_fqdn, script_path);
904-
}
907+
badger.storage.recordFingerprintingScript(script_fqdn,
908+
Object.keys(mapData[script_fqdn]));
905909
}
906910
}
907911
},

src/js/webrequest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -772,7 +772,7 @@ function recordFingerprinting(tab_id, msg) {
772772
badger.storage.recordTrackingDetails(
773773
script_base, document_base, 'canvas');
774774
badger.storage.recordFingerprintingScript(
775-
script_host, script_path);
775+
script_host, [script_path]);
776776
}
777777
}
778778
// This is a canvas write

0 commit comments

Comments
 (0)