Sep 25, 2013, 8:59 AM
[CLOSED] Upload completed and Chrome
Hi Guys,
I have a situation where I am not getting file upload completed events fired using Chrome. I think the reason is that Chrome doesn't raised an exception on cross domain issues but logs a message and returns a null object instead. Looking at the code that handles this means that the case falls through and neither a success or failure result is obtained...
What I need to do is to override this code somehow, so it checks for a null doc reference..
For Example...
Problem is, I have no idea how to properly override this code? Can you help?
I have a situation where I am not getting file upload completed events fired using Chrome. I think the reason is that Chrome doesn't raised an exception on cross domain issues but logs a message and returns a null object instead. Looking at the code that handles this means that the case falls through and neither a success or failure result is obtained...
try {
doc = frame.contentWindow.document || frame.contentDocument || window.frames[frame.id].document;
// Opera will fire an extraneous load event on about:blank
// We want to ignore this since the load event will be fired twice
if (doc) {
if (Ext.isOpera && doc.location == 'about:blank') {
return;
}
if (doc.body) {
// Response sent as Content-Type: text/json or text/plain. Browser will embed in a <pre> element
// Note: The statement below tests the result of an assignment.
if ((contentNode = doc.body.firstChild) && /pre/i.test(contentNode.tagName)) {
response.responseText = contentNode.textContent;
}
// Response sent as Content-Type: text/html. We must still support JSON response wrapped in textarea.
// Note: The statement below tests the result of an assignment.
else if ((contentNode = doc.getElementsByTagName('textarea')[0])) {
response.responseText = contentNode.value;
}
// Response sent as Content-Type: text/html with no wrapping. Scrape JSON response out of text
else {
response.responseText = doc.body.textContent || doc.body.innerText;
}
}
//in IE the document may still have a body even if returns XML.
response.responseXML = doc.XMLDocument || doc;
callback = options.success;
success = true;
}
} catch (e) {
// Report any error in the message property
response.responseText = '{success:false,message:"' + Ext.String.trim(e.message || e.description) + '"}';
callback = options.failure;
success = false;
}
What I need to do is to override this code somehow, so it checks for a null doc reference..
For Example...
try {
doc = frame.contentWindow.document || frame.contentDocument || window.frames[frame.id].document;
// Opera will fire an extraneous load event on about:blank
// We want to ignore this since the load event will be fired twice
if (doc == null) {
throw('null reference');
}
if (doc) {
if (Ext.isOpera && doc.location == 'about:blank') {
return;
}
if (doc.body) {
// Response sent as Content-Type: text/json or text/plain. Browser will embed in a <pre> element
// Note: The statement below tests the result of an assignment.
if ((contentNode = doc.body.firstChild) && /pre/i.test(contentNode.tagName)) {
response.responseText = contentNode.textContent;
}
// Response sent as Content-Type: text/html. We must still support JSON response wrapped in textarea.
// Note: The statement below tests the result of an assignment.
else if ((contentNode = doc.getElementsByTagName('textarea')[0])) {
response.responseText = contentNode.value;
}
// Response sent as Content-Type: text/html with no wrapping. Scrape JSON response out of text
else {
response.responseText = doc.body.textContent || doc.body.innerText;
}
}
//in IE the document may still have a body even if returns XML.
response.responseXML = doc.XMLDocument || doc;
callback = options.success;
success = true;
}
} catch (e) {
// Report any error in the message property
response.responseText = '{success:false,message:"' + Ext.String.trim(e.message || e.description) + '"}';
callback = options.failure;
success = false;
}
Problem is, I have no idea how to properly override this code? Can you help?
Last edited by Daniil; Oct 04, 2013 at 5:53 AM.
Reason: [CLOSED]