Skip to content

Commit

Permalink
Grants the URL reporter access to the browser configuration (#1502)
Browse files Browse the repository at this point in the history
  • Loading branch information
philipp-classen authored Mar 11, 2024
1 parent ec98f64 commit a7e1e02
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions extension-manifest-v3/src/background/reporting/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ const urlReporter = new UrlReporter({
storage: new Storage('reporting'),
connectDatabase: prefixedIndexedDBKeyValueStore('reporting'),
communication,
browserInfoProvider: getBrowserInfo.getRawBrowserInfo,
});
let requestReporter = null;
let pausedDomains = [];
Expand Down
24 changes: 24 additions & 0 deletions packages/libs/src/browser-info.js
Original file line number Diff line number Diff line change
Expand Up @@ -165,4 +165,28 @@ cachedGetBrowserInfo.isGhosteryBrowser = async () => {
return browserInfo.name.includes('ghostery');
};

// Provides direct access to the results of the parsing library.
// The results are not sanitized; thus, more care should be taken
// before sharing this information.
//
// Note:
// * the primary use case is for alive-signals (and they
// will check with the quorum service first before sharing)
cachedGetBrowserInfo.getRawBrowserInfo = async () => {
const ua = getUA();
const browserInfo = await getExtendedBrowserInfo();

const info = {};
if (browserInfo?.name === 'Ghostery') {
info.browser = browserInfo?.displayName || 'Ghostery';
info.version = browserInfo?.version ?? null;
} else {
info.browser = ua.browser?.name || null;
info.version = ua.browser?.version || null;
}
info.os = ua.os?.name || null;
info.platform = ua.platform?.type || null;
return info;
};

export default cachedGetBrowserInfo;

0 comments on commit a7e1e02

Please sign in to comment.