diff options
Diffstat (limited to 'data/extensions/jsr@javascriptrestrictor/fp_detect_background.js')
-rw-r--r-- | data/extensions/jsr@javascriptrestrictor/fp_detect_background.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/data/extensions/jsr@javascriptrestrictor/fp_detect_background.js b/data/extensions/jsr@javascriptrestrictor/fp_detect_background.js index 8b3e3bf..a60c2fd 100644 --- a/data/extensions/jsr@javascriptrestrictor/fp_detect_background.js +++ b/data/extensions/jsr@javascriptrestrictor/fp_detect_background.js @@ -111,6 +111,12 @@ var exceptionWrappers = ["CSSStyleDeclaration.prototype.fontFamily"]; var availableTabs = {}; /** + * A global variable shared with level_cache that controls the collection of calling scripts for FPD + * report. + */ +var fpd_track_callers_tab = undefined; + +/** * Definition of settings supported by this module. */ const FPD_DEF_SETTINGS = { @@ -753,6 +759,12 @@ function fpdCommonMessageListener(record, sender) { fpCounterObj["total"] = fpCounterObj["total"] || 0; fpCounterObj["total"] += 1; fpDb.update(record.resource, sender.tab.id, record.type, fpCounterObj["total"]); + + // Track callers + fpCounterObj["callers"] = fpCounterObj["callers"] || {}; + if (record.stack !== undefined) { + fpCounterObj["callers"][record.stack] = true; + } break; case "fpd-state-change": browser.storage.sync.get(["fpDetectionOn"]).then(function(result) { @@ -847,6 +859,14 @@ function fpdCommonMessageListener(record, sender) { } return Promise.resolve(hits); } + case "fpd-track-callers": { + let tabId = Number(record.tabId); + fpd_track_callers_tab = tabId; + return browser.tabs.reload(tabId); + } + case "fpd-track-callers-stop": { + fpd_track_callers_tab = undefined; + } } } } |