PhoneGap app for Symbian | "Application closed : WidgetUi KERN-EXEC 3" - ajax

I develop phonegap app for symbian (cordova for symbian I'm get from here)
After 3-5 seconds when my app begin execute ajax request, I get error:
Maybe someone faced with this issue?
Update1:
I make cross-domain ajax request with jquery mobile 1.8.1
$.ajax({
type: 'GET',
url: "http://example.org/some/path",
dataType: "json",
mimeType: "application/json",
headers: { "TOKEN": "%SOME_TOKEN%" }
}).done(function (data) {
// success processing
}).fail(function (xhr, textStatus) {
// fail processing
});

It could be as simple as the fact that you're missing " from the url line of your AJAX creation, but I suspect it isn't. I'm guessing that's a copying typo. This error message means your getting an uncaught exception which is bringing your app down.
Other people have reported JQuery for mobile being buggy, and having problems with certain HTTP Response statuses. I suggest bypassing it altogether, and making your own AJAX request, as a workaround (plenty of examples on the internet; I would alert the response status just so you can see what you're getting).. If that works, you can investigate whether other version of JQuery suffer from the same bugs.
Example AJAX without JQuery:
<script type="text/javascript">
var xmlhttp = new XMLHttpRequest();
xmlhttp.onreadystatechange = function()
{
if (xmlhttp.readyState == 4)
{
// do stuff with xmlhttp.responseText;
}
}
xmlhttp.open("GET","ajax_info.txt",true);
xmlhttp.send();
</script>

KERN-EXEC 3 is due to referencing a bad pointer or running out of stack space. It's probably the latter but it's impossible to say. Is there any way you can provide a call-stack?

Related

CORS preflight requests working with jQuery AJAX, but failing with native XmlHttpRequests in Firefox

This question is based on an issue I had before but never managed to resolve.
I'm running an userscript via FireMonkey which regulary sends requests to my backend server, those using CORS since they are cross-domain. For testing purposes my response headers are currently set very loosely backend-side:
header("Access-Control-Allow-Origin: *");
header("Access-Control-Allow-Method: POST");
header("Access-Control-Allow-Headers: *");
Frontend-side my requests are sent via jQuery AJAX, looking roughly like this:
$.ajax({
method: "POST",
url: this.queryURL,
timeout: this.timeout,
data: this.formData,
processData: false,
contentType: false,
success: onSuccess,
error: onError
});
Nothing special here, requests have been working fine ever since.
I want to get rid of jQuery now and use native XmlHttpRequest instead. The implementation looks like this:
const xhr = new XMLHttpRequest();
xhr.open("POST", this.queryURL);
xhr.setRequestHeader('X-Requested-With', 'XMLHttpRequest');
xhr.timeout = this.timeout;
xhr.ontimeout = onTimeout;
xhr.onreadystatechange = () => {
if (xhr.readyState !== 4 || xhr.status === 0)
return;
if (xhr.status !== 200)
onError(xhr);
else
onSuccess(xhr.responseText);
};
xhr.send(this.formData);
For some reason the requests seem not to be sent anymore on Firefox, at least the network tab doesn't show any. Testing it on Chrome it still works, but I figured that the issue might have something to do with preflight requests, since I noticed something strange:
With jQuery AJAX:
With native XHR:
Using native XHR, Chrome seems to always have a first preflight request failing, with a second one being successful. This doesn't happen with AJAX. Not sure if this is helpful in any way, but could this explain why requests keep failing at all in Firefox, and how to resolve it?
After some more research I finally found out that this is actually a firefox-related issue with userscripts: https://bugzilla.mozilla.org/show_bug.cgi?id=1715249

Plivo SDK call Recording

I am getting an error that i dont understand an cannot find any helpfull informations about:
No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'https:*******' is therefore not allowed access. The response had HTTP status code 401.
function RecordTheCall()
{
var key = '*******************';
$.get( "https://api.plivo.com/v1/Account/"+key+"/Call/?status=live", function( data ) {
var callUuid = data.call_uuid
});
$.ajax({
url: "https://api.plivo.com/v1/Account/"+key+"/Call/"+callUuid+"/Record/",
type: "POST",
data: { 'auth_id': auth_id, 'call_uuid': CallUUID },
dataType: "json",
success: function (res) {
alert(res);
},
error: function(err) {
alert(err);
}
});
}
Call recording cannot be accomplished from the Web SDK directly. You cannot use the Plivo API from your Web browser using Javascript because cross-domain ajax requests are not allowed in browsers for security reasons.
This has been explained in this Wikipedia article. There are some work arounds to overcome this, but it is browser dependent and hence it might not work always. Instead you should use the Plivo XML/API in you application.

crossdomain $.ajax and 404 error

I want to retrieve some data using $.ajax from the external ASP.NET MVC site (in this case - from my site). The code below geive me a 404 Not Found error (of course the url is valid.
But, if I change the url from url: 'http://myurl.com/Home/GetMyCode/?id=mycode' to url: 'http://localhost:123/Home/GetMyCode/?id=mycode' everything is fine. So, how to fix it ?
$.ajax({
url: 'http://myurl.com/Home/GetMyCode/?id=mycode',
type: 'POST',
contentType: "application/json; charset=utf-8",
crossDomain: true,
success: function (res) {
...
},
error: function (jqXHR, textStatus, errorThrown) {
...
}
});
[HttpPost]
public JsonResult GetMyCode(string id)
{
try
{
return Json(new { result = "ok", resultData = "OK") });
}
catch (Exception e)
{
return Json(new { result = "error", resultData = "An error occured" });
}
}
Two Methods for Handling Cross-Domain Ajax Calls:
JSONP: The Current Standard for Cross-Domain Access
JSONP is a convention used by some sites to expose their content in a way that makes it easier for callers to consume data via script, even from an external domain. The trick consists in having the site return some JSON content not as a plain string but wrapped up in a script function call. For more details..
http://www.west-wind.com/weblog/posts/2007/Jul/04/JSONP-for-crosssite-Callbacks
http://www.jquery4u.com/json/jsonp-examples/
Cross-origin resource sharing (CORS)
To enable cross-domain requests in environments that do not support cors yet but do allow cross-domain XHR requests (windows gadget, etc), set $.support.cors = true;
You just tell jQuery that you're in an environment where Cross-Domain XHR requests are possible.
In order to retrieve data crossdomain, you probably need to use 'jsonp'
Looks like it might be a DNS issue. Are you able to get to: http://myurl.com ?
Is the .com domain you are trying to access publicly accessible? Or is it a loopback to localhost?
that tutorial worked for me, I had to implement the JSONP handling in my MVC project. http://www.codeguru.com/csharp/.net/net_asp/using-jsonp-in-asp.net-mvc.htm

IE AJAX Cross-Browser Issue

I have the following AJAX function:
function ajaxDesignerBrandInfo()
{
var D = wrapFormValues('#designer-brand-form');
var recursiveEncoded = $.param(D);
/*
$.post("/api/designer_brand/", { data : recursiveEncoded }, function(data)
{
var results = $.parseJSON(data);
window.location = "/register/designer-product/";
});*/
$.ajax( { type: "POST",
url: "/api/designer_brand/",
data : { data : recursiveEncoded },
success: function(data) {
console.log(data);
setTimeout(function() {
window.location = "/register/designer-product/";
},0);
},
error: function (xhr, ajaxOptions, thrownError ){
alert(xhr.status);
alert(thrownError); }
});
return false;
}
And the corresponding form
<form id="designer-brand-form" name="form" method="post" action="" onSubmit="ajaxDesignerBrandInfo(); return false;">
....
</form>
The submission works great on Chrome, Safari and FireFox, moving me to
/register/designer-product/
Correctly, but in IE9, the submissions seems to
Never make it to the server
clear the form and redirect back to the current page i am on (in which this form exists).
I can confirm via FireFox there are no javascript errors causing this to fail. And sometimes it actually works, but I cannot seem to always reproduce this error in the same way
Someone Please explain WTF is going on?
Thanks
I believe your issue is that IE is silently throwing a Javascript error. Just because Firefox doesn't throw a JS error one doesn't mean that IE doesn't. Check for JS errors in IE (see this link or this one). Find the error and you'll find the solution.
Also, try Fiddler, which is a standalone Windows tool that acts as a proxy server and will tell you EXACTLY what your AJAX traffic looks like.
Your specific problem may be the console.log call. That is a Firebug thing (that Chrome supports). IE does not, I think, unless you take steps to add it. See: What happened to console.log in IE8?

jQuery AJAX requests failing in IE8 with message 'Error: This method cannot be called until the open method has been called.'

I'm using jQuery 1.4.2 and am trying to perform a simple AJAX request. The target URL returns a JSON string (I validated it with jslint). The request works in Firefox and Chrome, but doesn't want to work in IE8, and I can't determine why. Here is the call:
jQuery.ajax({
url: 'http://' + domain + '/' + 'helper/echo/',
dataType: 'json',
success: function(data) {
alert(data);
},
beforeSend: function(request, settings) {
alert('Beginning ' + settings.dataType + ' request: ' + settings.url);
},
complete: function(request, status) {
alert('Request complete: ' + status);
},
error: function(request, status, error) {
alert(error);
}
});
IE will execute the beforeSend callback and the error callback. The error callback alerts with the message:
Error: This method cannot be called until the open method has been called.
My response header returns with Content-Type: text/javascript; charset=UTF-8.
What is going on with IE? I'm running the server on localhost, making a request from http://localhost:8080/psx to http://localhost:8080/helper. Maybe IE is blocking this request? I have tried installing Fiddler to analyze request traffic but it won't run on my machine because it's rather locked down. Firebug lets me, but everything seems good there.
Thanks for the help!!!
Alright, here's the fix! The request was using window.XMLHttpRequest(), which isn't working properly in IE8 for some reason. jQuery is not failing back to window.ActiveXObject("Microsoft.XMLHTTP") as it should.
Add this to your script somewhere before your AJAX call (only verified in IE8, not other IE's):
jQuery.ajaxSetup({
xhr: function() {
//return new window.XMLHttpRequest();
try{
if(window.ActiveXObject)
return new window.ActiveXObject("Microsoft.XMLHTTP");
} catch(e) { }
return new window.XMLHttpRequest();
}
});
Here's how I came to the solution:
Updated to jQuery 1.4.4 in case the issue was a bug that had been fixed.
Stepped through Firebug debugger and DevTools debugger until the results seemed to be drastically different.
On line 5899, the ajax() function creates the XmlHttpRequest object with the xhr() function. In Firefox, it was returning good data. In IE, this was returning with all fields being Error: This method cannot be called until the open method has been called.
I analyzed this function on line 5749, return new window.XMLHttpRequest();
I googled and came across this page that has the same problem and suggested the solution that works for me.
Official jQuery ticket:

Resources