mTagText = elementHTML.ToNewUTF8String();
mTagText = ToNewUTF8String(elementHTML);
NS_IMETHODIMP nsPluginInstanceOwner::GetTagText(const char* *result){    if (nsnull == mTagText) {        nsresult rv;        nsCOMPtr<nsIContent> content;        rv = mOwner->GetContent(getter_AddRefs(content));        if (NS_FAILED(rv))            return rv;        nsCOMPtr<nsIDOMNode> node(do_QueryInterface(content, &rv));        if (NS_FAILED(rv))            return rv;        nsCOMPtr<nsIDocument> document;        rv = GetDocument(getter_AddRefs(document));        if (NS_FAILED(rv))            return rv;        nsCOMPtr<nsIDocumentEncoder> docEncoder(do_CreateInstance(NS_DOC_ENCODER_CONTRACTID_BASE "text/html", &rv));        if (NS_FAILED(rv))            return rv;        rv = docEncoder->Init(document, NS_LITERAL_STRING("text/html"), nsIDocumentEncoder::OutputEncodeEntities);        if (NS_FAILED(rv))            return rv;        nsCOMPtr<nsIDOMRange> range(do_CreateInstance(kRangeCID,&rv));        if (NS_FAILED(rv))            return rv;        rv = range->SelectNode(node);        if (NS_FAILED(rv))            return rv;        docEncoder->SetRange(range);        nsString elementHTML;        rv = docEncoder->EncodeToString(elementHTML);        if (NS_FAILED(rv))            return rv;        mTagText = elementHTML.ToNewUTF8String();        if (!mTagText)            return NS_ERROR_OUT_OF_MEMORY;    }    *result = mTagText;    return NS_OK;}