admin';?>

首页 / Development & communication

Load from Memory

By admin •  2018-10-28 16:44:52 •  100次点击

/*

aContentType: "text/html;charset=ISO-8859-1"
aContentType: "text/html;charset=gb2312"
aContentType must be consistent with  *.cpp file's encoding format.
*/
nsresult CBrowserWrapper::LoadData(const char *aBaseUrl,
									const char *aContentType,
									const PRUint8 *aData,
									PRUint32 aLen)
{
	nsresult rv;
	//nsCOMPtr<nsIWebBrowser> mWebBrowser; 
	nsCOMPtr<nsIWebBrowserStream> wbStream = do_QueryInterface(mWebBrowser);
	if (!wbStream)
		return NS_ERROR_FAILURE;

	nsCOMPtr<nsIURI> uri;
	rv = NS_NewURI(getter_AddRefs(uri), aBaseUrl);
	if (NS_FAILED(rv)) return rv;

	rv = wbStream->OpenStream(uri, nsDependentCString(aContentType));
	if (NS_FAILED(rv)) return rv;

	rv = wbStream->AppendToStream(aData, aLen);
	if (NS_FAILED(rv)) return rv;

	rv = wbStream->CloseStream();
	if (NS_FAILED(rv)) return rv;

	return NS_OK;
}

0 回复 | 直到2019-06-26 16:23添加回复

回复

登录发表 or 还没有账号?去注册

他山跨平台混合应用开发框架

现在注册 已注册请 登入
Development & communication

节点列表