Skip to content

Commit

Permalink
Discovery Bid Adapter: remove calls to navigator (#12088)
Browse files Browse the repository at this point in the history
* Discovery Bid Adapter: delete the fingerprint related code

* Discovery Bid Adapter: delete the fingerprint related code

---------

Co-authored-by: lvhuixin <lvhuixin@baidu.com>
  • Loading branch information
lhxx121 and lvhuixin authored Aug 5, 2024
1 parent bfea83e commit 625185b
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 53 deletions.
4 changes: 1 addition & 3 deletions modules/discoveryBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { getPageTitle, getPageDescription, getPageKeywords, getConnectionDownLin
import { getDevice, getScreenSize } from '../libraries/fpdUtils/deviceInfo.js';
import { getBidFloor } from '../libraries/currencyUtils/floor.js';
import { transformSizes, normalAdSize } from '../libraries/sizeUtils/tranformSize.js';
import {getDM, getHC, getHLen} from '../libraries/navigatorData/navigatorData.js';
import { getHLen } from '../libraries/navigatorData/navigatorData.js';

/**
* @typedef {import('../src/adapters/bidderFactory.js').BidRequest} BidRequest
Expand Down Expand Up @@ -291,8 +291,6 @@ function getParam(validBidRequests, bidderRequest) {
},
device: {
nbw: getConnectionDownLink(),
hc: getHC(),
dm: getDM()
}
}
} catch (error) {}
Expand Down
4 changes: 1 addition & 3 deletions modules/mediagoBidAdapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { getPageTitle, getPageDescription, getPageKeywords, getConnectionDownLin
import { getDevice } from '../libraries/fpdUtils/deviceInfo.js';
import { getBidFloor } from '../libraries/currencyUtils/floor.js';
import { transformSizes, normalAdSize } from '../libraries/sizeUtils/tranformSize.js';
import {getDM, getHC, getHLen} from '../libraries/navigatorData/navigatorData.js';
import { getHLen } from '../libraries/navigatorData/navigatorData.js';

// import { config } from '../src/config.js';
// import { isPubcidEnabled } from './pubCommonId.js';
Expand Down Expand Up @@ -271,8 +271,6 @@ function getParam(validBidRequests, bidderRequest) {
},
device: {
nbw: getConnectionDownLink(),
hc: getHC(),
dm: getDM()
}
},
user: {
Expand Down
48 changes: 1 addition & 47 deletions test/spec/modules/discoveryBidAdapter_spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {
} from 'modules/discoveryBidAdapter.js';
import { getPageTitle, getPageDescription, getPageKeywords, getConnectionDownLink } from '../../../libraries/fpdUtils/pageInfo.js';
import * as utils from 'src/utils.js';
import {getDM, getHC, getHLen} from '../../../libraries/navigatorData/navigatorData.js';
import {getHLen} from '../../../libraries/navigatorData/navigatorData.js';

describe('discovery:BidAdapterTests', function () {
let sandbox;
Expand Down Expand Up @@ -660,51 +660,5 @@ describe('discovery Bid Adapter Tests', function () {
expect(result).be.undefined;
});
});

describe('getHC', () => {
it('should return the correct value of hardwareConcurrency when accessible', () => {
const mockWindow = {
top: {
navigator: {
hardwareConcurrency: 4
}
}
};
const result = getHC(mockWindow);
expect(result).to.equal(4);
});
it('should return undefined when accessing win.top.navigator.hardwareConcurrency throws an error', () => {
const mockWindow = {
get top() {
throw new Error('Access denied');
}
};
const result = getHC(mockWindow);
expect(result).be.undefined;
});
});

describe('getDM', () => {
it('should return the correct value of deviceMemory when accessible', () => {
const mockWindow = {
top: {
navigator: {
deviceMemory: 4
}
}
};
const result = getDM(mockWindow);
expect(result).to.equal(4);
});
it('should return undefined when accessing win.top.navigator.deviceMemory throws an error', () => {
const mockWindow = {
get top() {
throw new Error('Access denied');
}
};
const result = getDM(mockWindow);
expect(result).be.undefined;
});
});
});
});

0 comments on commit 625185b

Please sign in to comment.