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

hasOwnProperty returns a false negative #83

Open
Paul-Hess opened this issue Jun 5, 2018 · 0 comments
Open

hasOwnProperty returns a false negative #83

Paul-Hess opened this issue Jun 5, 2018 · 0 comments

Comments

@Paul-Hess
Copy link

Paul-Hess commented Jun 5, 2018

Current behavior:

The render method in createManager.js checks if any instance of adSlot has own property 'getServices'. If it does not it creates a dummy ad to enable publisher services with.
The hasOwnProperty method returns a false negative sometimes. This results in extraneous use of the dummyAdSlot implementation.
Consequently the googletag console shows errors concerning defineSlot being called without an accompanying call to render, which can inflate unfilled slot numbers.

Bugfix:

Replacing the use of "hasOwnProperty" with a check that adSlot is truthy, adSlot.getServices is truthy,
and that adSlot.getServices is a function before calling it fixes the issue. Possibly overkill, but it is certainly safe and more reliable than "hasOwnProperty". This may be due to the general unreliability of "hasOwnProperty" eslint/eslint#7071 or because in the reference to adSlot, getServices has been renamed to some abstracted random key, or a little of both.

Accompanying PR: #84

Cheers!

react-gpt -v 2.10.2
node -v 8.5.0
npm -v 5.3.0

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

1 participant