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

When using a 'wrapper', the data passed in 'onGotFirstAd' is not updated #4

Open
yanivefraim opened this issue Jun 11, 2014 · 3 comments

Comments

@yanivefraim
Copy link

Inside onGotFirstAd, when calling oaf.call(that, that);, the that argument is passed instead of ads. As far as I understand it should be:

(function(ad, allowPods, that) {
                onGotFirstAd = function(ads) {
                    ad.onLoaded(ads, allowPods);
                    if (that.onAdsAvailable) {
                        var oaf = that.onAdsAvailable;
                        that.onAdsAvailable = null;
                        oaf.call(that, ads);//instead of oaf.call(that, that);
                    }
                };
})(ad, allowPods, that);

while debugging the wrapper example I noticed that the that object which is passed does not contain the updated data. I guess it is somehow related to the fact that its value is passed before parsing and the reference not being changed later. Changing the value to ads fixed this issue for me. I will have to take a deeper look at this problem and see what could be the correct fix for that (if you have any ideas/suggestions I will love to here).

Wrapper example:
http://demo.tremorvideo.com/proddev/vast/vast_wrapper_linear_2.xml

related to issue #2

@yanivefraim
Copy link
Author

I am on it, hope to send a pull request by tomorrow...

@yanivefraim yanivefraim changed the title When using a 'wrapper', the data passed in 'onGotFirstAd' is not correct When using a 'wrapper', the data passed in 'onGotFirstAd' is not updated Jun 11, 2014
@jonhoo
Copy link
Owner

jonhoo commented Jun 11, 2014

I believe you are right; that will be referring to the wrapper VASTAds, and thus will never be updated with the new data. onGotFirstAd will be called from the new VASTAds when it starts receiving "real" ads. The first argument (ads) will be this inside the new VASTAds, which holds the new data (vast-vmap.js:424). In fact, you could probably just change that to this. Note that both the thats should be changed, not just one of them, so that the line becomes

oaf.call(ads, ads)
// or
oaf.call(this, this)

As always, if you could include a test case with the PR, that would be great!

@juanparati
Copy link

I can see that this issue is still present in the current version.

I requested to pull a new test case. I enclose a raw test where the linear Ad information is not retrieved, however the final document contains a linear Ad with mediafiles, tracking events, etc.

single_test.zip

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

No branches or pull requests

3 participants