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

JSONP Error: function cX does not exist on window._EsriLeafletCallbacks #762

Closed
scottsanzo opened this issue Mar 21, 2016 · 3 comments · Fixed by #772
Closed

JSONP Error: function cX does not exist on window._EsriLeafletCallbacks #762

scottsanzo opened this issue Mar 21, 2016 · 3 comments · Fixed by #772

Comments

@scottsanzo
Copy link

In certain cases the script tag loads and attempts to execute before the callback property is set. Creating the JSONP script tag after the callback property is set on the 'window._EsriLeafletCallbacks' object eliminates that possibility:
window._EsriLeafletCallbacks[callbackId] = function (response) {...};

var script = L.DomUtil.create('script', null, document.body);...
script.id = callbackId;

@jgravois
Copy link
Contributor

thanks for logging the issue! just to be clear, you're suggesting that we reverse the order of operations in the code block here, correct?

In certain cases the script tag loads and attempts to execute before the callback property is set.

in what circumstances are you seeing this? what is the resulting behavior?

@scottsanzo
Copy link
Author

No problem, thanks for the quick reply. Yes, those are the code blocks I'm referring to.

When using IE9, or in IE9 mode (though it could affect any browser that doesn't support CORS) the script tag returns and loads before the "window._EsriLeafletCallbacks[callbackId]" is set. When the resulting script is evaluated it attempts to execute the function (in this case "window._EsriLeafletCallbacks.c0") , which hasn't been set, the "Object doesn't support property or method 'c0'" error is thrown (attached image).

We're seeing it when the _getAttributionData function is called during initialization, but that's only because it's the first JSONP call being made.

Oddly enough, I can't reproduce this when the developer panel is open in IE, probably because it's more of a timing issue. I didn't see any closures inside the callback, so it seemed safe enough to reverse the order of operations, and testing seems to confirm that so far.

Date: Mon, 21 Mar 2016 12:14:03 -0700
From: [email protected]
To: [email protected]
CC: [email protected]
Subject: Re: [esri-leaflet] JSONP Error: function cX does not exist on window._EsriLeafletCallbacks (#762)

thanks for logging the issue! just to be clear, you're suggesting that we reverse the order of operations in the code block here, correct?

In certain cases the script tag loads and attempts to execute before the callback property is set.

in what circumstances are you seeing this? what is the resulting behavior?


You are receiving this because you authored the thread.
Reply to this email directly or view it on GitHub

@jgravois
Copy link
Contributor

awesome. thanks for all the info. i'll test a little myself and submit a patch shortly unless anyone else wants to take a stab at submitting their own pull request with the fix you outlined.

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

Successfully merging a pull request may close this issue.

2 participants