Skip to content
Open
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
17 changes: 17 additions & 0 deletions js/IVPAIDAdUnit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,22 @@ var METHODS = [
'unsubscribe'
];

// for avoiding argument leaking
var METHODS_LENGTH = {
'handshakeVersion': 2,
'initAd': 7,
'startAd': 1,
'stopAd': 1,
'skipAd': 1, // VPAID 2.0 new method
'resizeAd': 4,
'pauseAd': 1,
'resumeAd': 1,
'expandAd': 1,
'collapseAd': 1,
'subscribe': 3,
'unsubscribe': 2
};

var EVENTS = [
'AdLoaded',
'AdStarted',
Expand Down Expand Up @@ -257,6 +273,7 @@ IVPAIDAdUnit.prototype.getAdIcons = function(callback) {};
IVPAIDAdUnit.prototype.setAdVolume = function(volume, callback) {};

addStaticToInterface(IVPAIDAdUnit, 'METHODS', METHODS);
addStaticToInterface(IVPAIDAdUnit, 'METHODS_LENGTH', METHODS_LENGTH);
addStaticToInterface(IVPAIDAdUnit, 'GETTERS', GETTERS);
addStaticToInterface(IVPAIDAdUnit, 'SETTERS', SETTERS);
addStaticToInterface(IVPAIDAdUnit, 'EVENTS', EVENTS);
Expand Down
2 changes: 1 addition & 1 deletion js/VPAIDAdUnit.js
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ IVPAIDAdUnit.METHODS.forEach(function(method) {
if (ignores.indexOf(method) !== -1) return;

VPAIDAdUnit.prototype[method] = function () {
var ariaty = IVPAIDAdUnit.prototype[method].length;
var ariaty = IVPAIDAdUnit.METHODS_LENGTH[method];
// TODO avoid leaking arguments
// https://github.com/petkaantonov/bluebird/wiki/Optimization-killers#32-leaking-arguments
var args = Array.prototype.slice.call(arguments);
Expand Down