Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Media.net RTD module: use internal prebid method for loading external script #8506

Merged
merged 1 commit into from
Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions modules/medianetRtdProvider.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {insertElement, isEmptyStr, isFn, isStr, logError, mergeDeep} from '../src/utils.js';
import {isEmptyStr, isFn, isStr, logError, mergeDeep} from '../src/utils.js';
import {loadExternalScript} from '../src/adloader.js';
import {submodule} from '../src/hook.js';
import {getGlobal} from '../src/prebidGlobal.js';
import {includes} from '../src/polyfill.js';
Expand Down Expand Up @@ -82,11 +83,8 @@ function executeCommand(command) {
}

function loadRtdScript(customerId) {
const script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = getClientUrl(customerId, window.location.hostname);
insertElement(script, window.document, 'head');
const url = getClientUrl(customerId, window.location.hostname);
loadExternalScript(url, MODULE_NAME)
}

function getAdUnits(adUnits, adUnitCodes) {
Expand Down
3 changes: 2 additions & 1 deletion src/adloader.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ const _approvedLoadExternalJSList = [
'akamaidap',
'ftrackId',
'inskin',
'hadron'
'hadron',
'medianet'
]

/**
Expand Down
4 changes: 0 additions & 4 deletions test/spec/modules/medianetRtdProvider_spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import * as medianetRTD from '../../../modules/medianetRtdProvider.js';
import * as sinon from 'sinon';
import { assert } from 'chai';
import * as utils from '../../../src/utils.js';

let sandbox;
let setDataSpy;
Expand All @@ -20,9 +19,6 @@ const conf = {
describe('medianet realtime module', function () {
beforeEach(function () {
sandbox = sinon.sandbox.create();
const insertStub = sandbox.stub(utils, 'insertElement')
insertStub.withArgs(sinon.match.any, sinon.match.any, 'head')
.returns(() => void 0)
window.mnjs = window.mnjs || {};
window.mnjs.que = window.mnjs.que || [];
window.mnjs.setData = setDataSpy = sandbox.spy();
Expand Down