int typeIndex=0; while(gValidTypes[typeIndex]) { if (0== PL_strcmp(gValidTypes[typeIndex++], aContentType)) { goto nextstep; }
if (nsnull == aResult) { rv = NS_ERROR_NULL_POINTER; goto done;
nsDocFactoryImpl::CreateInstance(nsIURL* aURL,                                  const char* aContentType,                                  const char *aCommand,                                 nsIContentViewerContainer* aContainer,                                 nsIStreamListener** aDocListener,                                 nsIContentViewer** aDocViewer){    nsresult rv = NS_ERROR_FAILURE;    nsIDocument* doc = nsnull;    nsIDocumentViewer* docv = nsnull;    int typeIndex=0;    while(gValidTypes[typeIndex]) {      if (0== PL_strcmp(gValidTypes[typeIndex++], aContentType)) {        goto nextstep;      }    }    goto done;nextstep:    // Load the UA style sheet if we haven't already done that    if (nsnull == gUAStyleSheet) {        InitUAStyleSheet();    }    /*     * Create the HTML document...     */    rv = NS_NewHTMLDocument(&doc);    if (NS_OK != rv) {        goto done;    }    /*     * Create the HTML Content Viewer...     */    rv = NS_NewDocumentViewer(docv);    if (NS_OK != rv) {        goto done;    }    docv->SetUAStyleSheet(gUAStyleSheet);    /*      * Initialize the document to begin loading the data...     *     * An nsIStreamListener connected to the parser is returned in     * aDocListener.     */    rv = doc->StartDocumentLoad(aURL, aContainer, aDocListener);    if (NS_OK != rv) {        NS_IF_RELEASE(docv);        goto done;    }    /*     * Bind the document to the Content Viewer...     */    rv = docv->BindToDocument(doc, aCommand);    *aDocViewer = docv;done:    NS_IF_RELEASE(doc);    return rv;}