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

creating 404 error for video preroll ad on adding just library. #2799

Closed
ArmanGrewal opened this issue Mar 27, 2018 · 8 comments
Closed

creating 404 error for video preroll ad on adding just library. #2799

ArmanGrewal opened this issue Mar 27, 2018 · 8 comments

Comments

@ArmanGrewal
Copy link

Hi,

environment - windows/chrome
Please refer below code-

<title>JW version 8 test page</title> <style type="text/css"> body { overflow-y: hidden; } </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/mootools/1.6.0/mootools-core.js"></script>
<script src="//content.jwplatform.com/players/ToSPhea8-p1bZS6Zu.js"></script>

It is creating following error on just adding library reference. Can you please look, why library is trying to get something that is not present-

error - bridge3.198.2_en.html:438 GET http://imasdk.googleapis.com/js/core/undefined 404 (Not Found)

Thanks

@swhiteman
Copy link

This is neither relevant to, nor a bug in, the MooTools library.

As you can see by commenting out mootools-core.js, the error is in your JWPlayer library.

@timwienk
Copy link
Member

Thanks for responding so quickly, Sandy!

@swhiteman
Copy link

I still leap at the chance to do anything Moo. 👍

@ArmanGrewal
Copy link
Author

Thank you for quick response.

I am not seeing any error in "JWPlayer library". Are you seeing any error? I am only seeing "404" errors only adding library and it is slowing down video load.

@timwienk
Copy link
Member

timwienk commented Mar 27, 2018

The JWPlayer library in turn loads other files, among which are several JavaScript files and somewhere along the way the file that's causing an error as well.

MooTools Core does not load any extra files, unless you tell it to, using Request.

The errors (404 or otherwise) you are seeing, are caused by what the JWPlayer is loading. It may not be JWPlayer's fault either (perhaps it's something of or about the video that doesn't exist?), but I'm afraid we can't quite help either way.

@ArmanGrewal
Copy link
Author

ArmanGrewal commented Mar 27, 2018

Hi,

Sorry but I am seeing the errors only adding "mootools" library. You might need to check it local site(may be created by IIS / apache) If you see it just saving file as .html then you will see protocol errors not actual error. I have just included few lines of code from mootools/core/Core/Core.js-

Code:
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
    <title>JW version 8 test page</title>
    <style type="text/css">
        body {
            overflow-y: hidden;
        }
    </style>
    <script type="text/javascript">
    /*
---

name: Core

description: The heart of MooTools.

license: MIT-style license.

copyright: Copyright (c) 2006-2015 [Valerio Proietti](http://mad4milk.net/).

authors: The MooTools production team (http://mootools.net/developers/)

inspiration:
  - Class implementation inspired by [Base.js](http://dean.edwards.name/weblog/2006/03/base/) Copyright (c) 2006 Dean Edwards, [GNU Lesser General Public License](http://opensource.org/licenses/lgpl-license.php)
  - Some functionality inspired by [Prototype.js](http://prototypejs.org) Copyright (c) 2005-2007 Sam Stephenson, [MIT License](http://opensource.org/licenses/mit-license.php)

provides: [Core, MooTools, Type, typeOf, instanceOf, Native]

...
*/
/*! MooTools: the javascript framework. license: MIT-style license. copyright: Copyright (c) 2006-2015 [Valerio Proietti](http://mad4milk.net/).*/
(function(){

this.MooTools = {
	version: '1.6.0',
	build: '%build%'
};

// typeOf, instanceOf

var typeOf = this.typeOf = function(item){
	if (item == null) return 'null';
	if (item.$family != null) return item.$family();

	if (item.nodeName){
		if (item.nodeType == 1) return 'element';
		if (item.nodeType == 3) return (/\S/).test(item.nodeValue) ? 'textnode' : 'whitespace';
	} else if (typeof item.length == 'number'){
		if ('callee' in item) return 'arguments';
		if ('item' in item) return 'collection';
	}

	return typeof item;
};

var instanceOf = this.instanceOf = function(item, object){
	if (item == null) return false;
	var constructor = item.$constructor || item.constructor;
	while (constructor){
		if (constructor === object) return true;
		constructor = constructor.parent;
	}
	/*<ltIE8>*/
	if (!item.hasOwnProperty) return false;
	/*</ltIE8>*/
	return item instanceof object;
};

var hasOwnProperty = Object.prototype.hasOwnProperty;

// /*<ltIE8>*/
var enumerables = true;
for (var i in {toString: 1}) enumerables = null;
if (enumerables) enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor'];
function forEachObjectEnumberableKey(object, fn, bind){
	if (enumerables) for (var i = enumerables.length; i--;){
		var k = enumerables[i];
		// signature has key-value, so overloadSetter can directly pass the
		// method function, without swapping arguments.
		if (hasOwnProperty.call(object, k)) fn.call(bind, k, object[k]);
	}
}
// /*</ltIE8>*/

// // Function overloading

var Function = this.Function;

Function.prototype.overloadSetter = function(usePlural){
	var self = this;
	return function(a, b){
		if (a == null) return this;
		if (usePlural || typeof a != 'string'){
			for (var k in a) self.call(this, k, a[k]);
			/*<ltIE8>*/
			forEachObjectEnumberableKey(a, self, this);
			/*</ltIE8>*/
		} else {
			self.call(this, a, b);
		}
		return this;
	};
};

Function.prototype.overloadGetter = function(usePlural){
	var self = this;
	return function(a){
		var args, result;
		if (typeof a != 'string') args = a;
		else if (arguments.length > 1) args = arguments;
		else if (usePlural) args = [a];
		if (args){
			result = {};
			for (var i = 0; i < args.length; i++) result[args[i]] = self.call(this, args[i]);
		} else {
			result = self.call(this, a);
		}
		return result;
	};
};

Function.prototype.extend = function(key, value){
	this[key] = value;
}.overloadSetter();

Function.prototype.implement = function(key, value){
	this.prototype[key] = value;
}.overloadSetter();

// // From

var slice = Array.prototype.slice;

Array.convert = function(item){
	if (item == null) return [];
	return (Type.isEnumerable(item) && typeof item != 'string') ? (typeOf(item) == 'array') ? item : slice.call(item) : [item];
};

Function.convert = function(item){
	return (typeOf(item) == 'function') ? item : function(){
		return item;
	};
};


Number.convert = function(item){
	var number = parseFloat(item);
	return isFinite(number) ? number : null;
};

String.convert = function(item){
	return item + '';
};

/*<1.5compat>*/
Array.from = Array.convert;
/*</1.5compat>*/

Function.from = Function.convert;
Number.from = Number.convert;
String.from = String.convert;

// hide, protect

Function.implement({

	hide: function(){
		this.$hidden = true;
		return this;
	},

	protect: function(){
		this.$protected = true;
		return this;
	}

});

// Type

var Type = this.Type = function(name, object){
	if (name){
		var lower = name.toLowerCase();
		var typeCheck = function(item){
			return (typeOf(item) == lower);
		};

		Type['is' + name] = typeCheck;
		if (object != null){
			object.prototype.$family = (function(){
				return lower;
			}).hide();
		}
	}

	if (object == null) return null;

	object.extend(this);
	object.$constructor = Type;
	object.prototype.$constructor = object;

	return object;
};

var toString = Object.prototype.toString;

Type.isEnumerable = function(item){
	return (item != null && typeof item.length == 'number' && toString.call(item) != '[object Function]' );
};

var hooks = {};

var hooksOf = function(object){
	var type = typeOf(object.prototype);
	return hooks[type] || (hooks[type] = []);
};

var implement = function(name, method){
	if (method && method.$hidden) return;

	var hooks = hooksOf(this);

	for (var i = 0; i < hooks.length; i++){
		var hook = hooks[i];
		if (typeOf(hook) == 'type') implement.call(hook, name, method);
		else hook.call(this, name, method);
	}

	var previous = this.prototype[name];
	if (previous == null || !previous.$protected) this.prototype[name] = method;

	if (this[name] == null && typeOf(method) == 'function') extend.call(this, name, function(item){
		return method.apply(item, slice.call(arguments, 1));
	});
};

var extend = function(name, method){
	if (method && method.$hidden) return;
	var previous = this[name];
	if (previous == null || !previous.$protected) this[name] = method;
};

Type.implement({

	implement: implement.overloadSetter(),

	extend: extend.overloadSetter(),

	alias: function(name, existing){
		implement.call(this, name, this.prototype[existing]);
	}.overloadSetter(),

	mirror: function(hook){
		hooksOf(this).push(hook);
		return this;
	}

});

new Type('Type', Type);

// Default Types

var force = function(name, object, methods){
	var isType = (object != Object),
		prototype = object.prototype;

	if (isType) object = new Type(name, object);

	for (var i = 0, l = methods.length; i < l; i++){
		var key = methods[i],
			generic = object[key],
			proto = prototype[key];

		if (generic) generic.protect();
		if (isType && proto) object.implement(key, proto.protect());
	}

	if (isType){
		var methodsEnumerable = prototype.propertyIsEnumerable(methods[0]);
		object.forEachMethod = function(fn){
			if (!methodsEnumerable) for (var i = 0, l = methods.length; i < l; i++){
				fn.call(prototype, prototype[methods[i]], methods[i]);
			}
			for (var key in prototype) fn.call(prototype, prototype[key], key);
		};
	}

	return force;
};

force('String', String, [
	'charAt', 'charCodeAt', 'concat', 'contains', 'indexOf', 'lastIndexOf', 'match', 'quote', 'replace', 'search',
	'slice', 'split', 'substr', 'substring', 'trim', 'toLowerCase', 'toUpperCase'
])('Number', Number, [
	'toExponential', 'toFixed', 'toLocaleString', 'toPrecision'
])('Function', Function, [
	'apply', 'call', 'bind'
])('RegExp', RegExp, [
	'exec', 'test'
])('Object', Object, [
	'create', 'defineProperty', 'defineProperties', 'keys',
	'getPrototypeOf', 'getOwnPropertyDescriptor', 'getOwnPropertyNames',
	'preventExtensions', 'isExtensible', 'seal', 'isSealed', 'freeze', 'isFrozen'
])('Date', Date, ['now'])
('Array', Array, [
	'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice',
	'indexOf', 'lastIndexOf', 'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight', 'contains'
]);

// Object.extend = extend.overloadSetter();

// Date.extend('now', function(){
// 	return +(new Date);
// });

// new Type('Boolean', Boolean);

// // fixes NaN returning as Number

// Number.prototype.$family = function(){
// 	return isFinite(this) ? 'number' : 'null';
// }.hide();

// // Number.random

// Number.extend('random', function(min, max){
// 	return Math.floor(Math.random() * (max - min + 1) + min);
// });

// // forEach, each, keys

// Array.implement({

// 	/*<!ES5>*/
// 	forEach: function(fn, bind){
// 		for (var i = 0, l = this.length; i < l; i++){
// 			if (i in this) fn.call(bind, this[i], i, this);
// 		}
// 	},
// 	/*</!ES5>*/

// 	each: function(fn, bind){
// 		Array.forEach(this, fn, bind);
// 		return this;
// 	}

// });

// Object.extend({

// 	keys: function(object){
// 		var keys = [];
// 		for (var k in object){
// 			if (hasOwnProperty.call(object, k)) keys.push(k);
// 		}
// 		/*<ltIE8>*/
// 		forEachObjectEnumberableKey(object, function(k){
// 			keys.push(k);
// 		});
// 		/*</ltIE8>*/
// 		return keys;
// 	},

// 	forEach: function(object, fn, bind){
// 		Object.keys(object).forEach(function(key){
// 			fn.call(bind, object[key], key, object);
// 		});
// 	}

// });

// Object.each = Object.forEach;


// // Array & Object cloning, Object merging and appending

// var cloneOf = function(item){
// 	switch (typeOf(item)){
// 		case 'array': return item.clone();
// 		case 'object': return Object.clone(item);
// 		default: return item;
// 	}
// };

// Array.implement('clone', function(){
// 	var i = this.length, clone = new Array(i);
// 	while (i--) clone[i] = cloneOf(this[i]);
// 	return clone;
// });

// var mergeOne = function(source, key, current){
// 	switch (typeOf(current)){
// 		case 'object':
// 			if (typeOf(source[key]) == 'object') Object.merge(source[key], current);
// 			else source[key] = Object.clone(current);
// 			break;
// 		case 'array': source[key] = current.clone(); break;
// 		default: source[key] = current;
// 	}
// 	return source;
// };

// Object.extend({

// 	merge: function(source, k, v){
// 		if (typeOf(k) == 'string') return mergeOne(source, k, v);
// 		for (var i = 1, l = arguments.length; i < l; i++){
// 			var object = arguments[i];
// 			for (var key in object) mergeOne(source, key, object[key]);
// 		}
// 		return source;
// 	},

// 	clone: function(object){
// 		var clone = {};
// 		for (var key in object) clone[key] = cloneOf(object[key]);
// 		return clone;
// 	},

// 	append: function(original){
// 		for (var i = 1, l = arguments.length; i < l; i++){
// 			var extended = arguments[i] || {};
// 			for (var key in extended) original[key] = extended[key];
// 		}
// 		return original;
// 	}

// });

// // Object-less types

// ['Object', 'WhiteSpace', 'TextNode', 'Collection', 'Arguments'].each(function(name){
// 	new Type(name);
// });

// // Unique ID

// var UID = Date.now();

// String.extend('uniqueID', function(){
// 	return (UID++).toString(36);
// });


})();

    </script>
</head>
<body>
    <div>
        <script src="//content.jwplatform.com/players/ToSPhea8-p1bZS6Zu.js"></script>
    </div>
</body>
</html>

on commenting out following code, I am not seeing any console error -
('Array', Array, [
'pop', 'push', 'reverse', 'shift', 'sort', 'splice', 'unshift', 'concat', 'join', 'slice',
'indexOf', 'lastIndexOf', 'filter', 'forEach', 'every', 'map', 'some', 'reduce', 'reduceRight', 'contains'
]);

else it is showing four 404 errors and including whole library creating 20-30 errors. I have tried compact/ non compact. I am seeing same error.

Thanks,

@swhiteman
Copy link

You must isolate the code in your JWPlayer script that is triggering the issue.

Perhaps JWPlayer is attempting its own extensions of native objects. Perhaps it has a bug in the way it uses ES5 Array functions. Perhaps there is an underlying implementation problem in MooTools, but this can't be known unless you show exactly where in the consuming code -- the code that uses the MooTools API -- the error is thrown.

Please use Markdown if posting code. If you have a running site that demonstrates the error, post the link. If you have more questions this would be better posted to the MooTools mailing list, not the bug tracker.

@timwienk
Copy link
Member

@ArmanGrewal I've edited your message, so it's a bit more readable.

Either way - it's impossible to help you without being able to see what's actually going on. Like @swhiteman mentioned, a link to a working site (or JSFiddle) would help.

Since this is very unlikely to be a MooTools Core related problem, I agree with Sandy that it should be asked on the mailing list. Please take your question to https://groups.google.com/forum/#!forum/mootools-users if you still don't get it working.

@mootools mootools locked and limited conversation to collaborators Mar 28, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants