rem: if (theOutput) { if (is.ie) { theOutputDoc = theOutput.contentWindow.document; } else { theOutputDoc = theOutput.contentDocument; 
add: if (theOutput == null) return;  var theOutputDoc = theOutput.contentDocument; if (is.ie) { theOutputDoc = theOutput.contentWindow.document; }  if (theOutputDoc == null) return;  var theList = theOutputDoc.getElementsByTagName(g_cq_buffer_basename); if (is.ie && theOutputDoc.XMLDocument) { theList = theOutputDoc.XMLDocument.getElementsByTagName (g_cq_buffer_basename); }   var theTimeout = null; if (theList.length < 1) { debug("finishImport: no list: setting new timeout " + g_cq_timeout); theTimeout = setTimeout('finishImport();', g_cq_timeout); return null; } clearTimeout(theTimeout);    if (is.gecko) {      theOutputDoc.normalize(); }  debug("finishImport: theList = " + theList + ", length = " + theList.length); var theValue = null; for (var i = 0; i < theList.length; i++) { if (theList[i].firstChild == null) continue;   theValue = decodeURIComponent( (theList[i]).firstChild.nodeValue ); debug("finishImport: buffer i = " + i + ", " + theValue.length + ": " + theValue); getBuffer(i).value = theValue; }    var historyNode = document.getElementById(g_cq_history_node); if (! historyNode) { debug("finishImport: null historyNode"); } else { var theList = theOutputDoc.getElementsByTagName(g_cq_history_basename); for (var i = 0; i < theList.length ; i++) { if (g_cq_history_limit != null && i > g_cq_history_limit) break; if (theList[i].firstChild == null) continue;  theValue = decodeURIComponent( (theList[i]).firstChild.nodeValue ); saveQueryHistory(theValue, true); 
context: function finishImport() {    debug('finishImport');    var theOutput = getResultFrame();    var theOutputDoc = null;    debug("theOutput = " + theOutput);    if (theOutput) {        if (is.ie) {            theOutputDoc = theOutput.contentWindow.document;        } else {            theOutputDoc = theOutput.contentDocument;        }        if (theOutputDoc) {            var theList =                theOutputDoc.getElementsByTagName(g_cq_buffer_basename);            if (is.ie && theOutputDoc.XMLDocument) {                theList = theOutputDoc.XMLDocument.getElementsByTagName                    (g_cq_buffer_basename);            } // is.ie            var theTimeout = null;            // if we timed out, try again            if (theList.length < 1) {              debug("no list: setting new timeout " + g_cq_timeout);              theTimeout = setTimeout('finishImport();', g_cq_timeout);              return null;            }            clearTimeout(theTimeout);            // TODO if the imported worksheet has rows/cols attributes, use them            debug("theList = " + theList + ", length = " + theList.length);            var theValue = null;            for (var i = 0; i < theList.length; i++) {                if (theList[i].firstChild == null)                    continue;                // TODO remove decode if encode isn't needed?                theValue = decodeURIComponent( (theList[i]).firstChild.nodeValue );                debug("i = " + i + ", " + theValue);                getBuffer(i).value = theValue;            } // for theList            // import query history too, by appending            //clearQueryHistory();            var historyNode = document.getElementById(g_cq_history_node);            if (! historyNode) {                debug("cqImport: null historyNode");            } else {                var theList = theOutputDoc.getElementsByTagName(g_cq_history_basename);                for (var i = 0; i < theList.length ; i++) {                  if (g_cq_history_limit != null && i > g_cq_history_limit)                      break;                  if (theList[i].firstChild == null)                      continue;                  // TODO remove decode if encode isn't needed?                  theValue = decodeURIComponent( (theList[i]).firstChild.nodeValue );                  saveQueryHistory(theValue, true);                }            }            // leave the user in the same buffer            refreshBufferList(g_cq_buffer_current, "finishImport");            var theUri = document.getElementById(g_cq_uri).value;            var theQuery = '<p>' + theUri + ' imported</p>';            submitForm(document.getElementById(g_cq_query_form_id),                       theQuery, "text/html");        } // if theOutputDoc    } // if theOutput} // finishImport
meta: 952	/local1/tlutelli/issta_data/temp/all_js/javascript/2006_temp/2006/952/acaf2f3cc32a6781b1b116b2d37f39fc2d4472e2/cq.js/clean/cq.js