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

fixed mraid.fireEvent() in mraid.js #732

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AdviewOpen
Copy link

we found some ads contents with mraid may remove EventListener in listeners function. for example:
function addVchange(){
mraid.isViewable()?viewChangeCB(true):mraid.addEventListener("viewableChange",viewCB);//add cb
mraid.addEventListener("viewableChange",viewCB2);//add cb2
}
function viewCB(n){
console.log('+++++++ viewCB() ++++++++');
mraid.removeEventListener("viewableChange", viewCB));//remove itself
}
function viewCB2(n){
console.log('+++++++ viewCB2() ++++++++');
}
so, if use currently mraid.js, in viewCB(), listener itself will be removed and next item will be null, that mean viewCB2() will not be triggered, we already found some ads contains like this usage, so we change the mraid.fireEvent(), we make a copy when events needs to be fired, if listener function remove itself, the fireEvent()'s array will not be cracked and keep its original order, then all of EventListners will be triggered correctly.
the same issue we have committed pull request on ios-sdk #942. but prebid-android-sdk seems use remote url to download mraid.js into PBM library ,so we changed mraid.js in scripts\js, pls review it.
greate thx.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants