MCPcopy Index your code
hub / github.com/TruthHun/BookStack / cb

Function cb

static/js/jquery.form.js:612–784  ·  view source on GitHub ↗
(e)

Source from the content-addressed store, hash-verified

610 var data, doc, domCheckCount = 50, callbackProcessed;
611
612 function cb(e) {
613 if (xhr.aborted || callbackProcessed) {
614 return;
615 }
616
617 doc = getDoc(io);
618 if(!doc) {
619 log('cannot access response document');
620 e = SERVER_ABORT;
621 }
622 if (e === CLIENT_TIMEOUT_ABORT && xhr) {
623 xhr.abort('timeout');
624 deferred.reject(xhr, 'timeout');
625 return;
626 }
627 else if (e == SERVER_ABORT && xhr) {
628 xhr.abort('server abort');
629 deferred.reject(xhr, 'error', 'server abort');
630 return;
631 }
632
633 if (!doc || doc.location.href == s.iframeSrc) {
634 // response not received yet
635 if (!timedOut) {
636 return;
637 }
638 }
639 if (io.detachEvent) {
640 io.detachEvent('onload', cb);
641 }
642 else {
643 io.removeEventListener('load', cb, false);
644 }
645
646 var status = 'success', errMsg;
647 try {
648 if (timedOut) {
649 throw 'timeout';
650 }
651
652 var isXml = s.dataType == 'xml' || doc.XMLDocument || $.isXMLDoc(doc);
653 log('isXml='+isXml);
654 if (!isXml && window.opera && (doc.body === null || !doc.body.innerHTML)) {
655 if (--domCheckCount) {
656 // in some browsers (Opera) the iframe DOM is not always traversable when
657 // the onload callback fires, so we loop a bit to accommodate
658 log('requeing onLoad callback, DOM not available');
659 setTimeout(cb, 250);
660 return;
661 }
662 // let this fall through because server response could be an empty document
663 //log('Could not access iframe DOM after mutiple tries.');
664 //throw 'DOMException: not available';
665 }
666
667 //log('response detected');
668 var docRoot = doc.body ? doc.body : doc.documentElement;
669 xhr.responseText = docRoot ? docRoot.innerHTML : null;

Callers 2

doSubmitFunction · 0.70
checkStateFunction · 0.70

Calls 4

getDocFunction · 0.85
logFunction · 0.85
httpDataFunction · 0.85
getAttributeMethod · 0.80

Tested by

no test coverage detected