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

es6-shim.min.js (v0.34.1) in SharePoint - Uncaught Sys.ParameterCountException: Sys.ParameterCountException: Parameter count mismatch. #399

Closed
williamyinssw opened this issue Jan 12, 2016 · 8 comments
Assignees

Comments

@williamyinssw
Copy link

When 'es6-shim.min.js' is referred in any SharePoint 2013 page,

<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.34.0/es6-shim.min.js"></script>

it shows the following error:

Uncaught Sys.ParameterCountException: Sys.ParameterCountException: Parameter count mismatch.  ScriptResource.axd?d=....

This may be a conflict issue with .NET Ajax controls..

@ljharb
Copy link
Collaborator

ljharb commented Jan 12, 2016

Can you provide a reproducible test case, ideally on a jsfiddle?

Does that error come with any sort of stack trace? What happens if you include the non-minified version?

@arntj
Copy link

arntj commented Feb 5, 2016

All it takes to reproduce this issue, is to include the MicrosoftAjax 3.5 js (debug version) before ES6 shims. I've reproduced it in Chrome in the following jsfiddle (remember to have the browser debug console open before running it):

https://jsfiddle.net/p8ysoxts/

(Note: This fiddle is apparently empty, but the mentioned js files have been included as "external resources" in this fiddle. That is all it takes to reproduce the issue.)

@arntj
Copy link

arntj commented Feb 5, 2016

I've also reproduced it with Microsoft Ajax 4.5.2:

https://jsfiddle.net/18pdk5u3/

@arntj
Copy link

arntj commented Feb 5, 2016

The problem is that Microsoft Ajax enforces validation of parameters on String.prototype.startsWith, so that it throws an exception when it is called with more than one parameter. ES6-shim runs this function with two parameters as a part of a feature check (line 830 in es6-shim.js). This could be fixed by wrapping this line in a try-catch.

@ljharb
Copy link
Collaborator

ljharb commented Feb 5, 2016

@arntj In general, shims and polyfills need to always be run first, before application code (and language shims should run before engine-level shims). If you include es5-shim and es6-shim before your Ajax lib, does everything work?

@arntj
Copy link

arntj commented Feb 8, 2016

Yes, it does work, but it's a little inconvenient given the current architecure of our website.

@ljharb
Copy link
Collaborator

ljharb commented Feb 8, 2016

I'll fix this one - my general policy is not to fix errors like this, unless it's easy - and in this case it's easy.

Thanks for confirming!

@ljharb ljharb self-assigned this Feb 8, 2016
@ljharb ljharb closed this as completed in 23dd661 Feb 9, 2016
@ljharb
Copy link
Collaborator

ljharb commented Feb 9, 2016

This fix will be included in the next release. However, I'd recommend updating this Ajax library that's doing the wrong thing with startsWith, as well as loading the es5-shim and es6-shim first, before anything else.

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