NS_IMETHODIMP nsXPInstallManager::OnStartRequest(nsIRequest* request, nsISupports *ctxt) { nsresult rv = NS_ERROR_FAILURE; // If we are dealing with a HTTP request, then treat HTTP error pages as // download failures. nsCOMPtr<nsIHttpChannel> httpChan = do_QueryInterface(request); if (httpChan) { // If we were chrome lauched check the certificate on the request if (mFromChrome && NS_FAILED(CheckCert(httpChan))) { request->Cancel(NS_BINDING_ABORTED); return NS_OK; } PRBool succeeded; if (NS_SUCCEEDED(httpChan->GetRequestSucceeded(&succeeded)) && !succeeded) { // HTTP response is not a 2xx! request->Cancel(NS_BINDING_ABORTED); return NS_OK; } } NS_ASSERTION( mItem && mItem->mFile, "XPIMgr::OnStartRequest bad state"); if ( mItem && mItem->mFile ) { NS_ASSERTION( !mItem->mOutStream, "Received double OnStartRequest from Necko"); rv = NS_NewLocalFileOutputStream(getter_AddRefs(mItem->mOutStream), mItem->mFile, PR_WRONLY | PR_CREATE_FILE | PR_TRUNCATE, 0600); } return rv; }
// nsIChannelEventSink method NS_IMETHODIMP nsXPInstallManager::OnChannelRedirect(nsIChannel *oldChannel, nsIChannel *newChannel, PRUint32 flags) { // Chrome triggered installs need to have their certificates checked if (mFromChrome) return CheckCert(oldChannel); return NS_OK; }
// nsIChannelEventSink method NS_IMETHODIMP nsXPInstallManager::AsyncOnChannelRedirect(nsIChannel *oldChannel, nsIChannel *newChannel, PRUint32 flags, nsIAsyncVerifyRedirectCallback *callback) { // Chrome triggered installs need to have their certificates checked if (mFromChrome) { nsresult rv = CheckCert(oldChannel); if (NS_FAILED(rv())) return rv; } callback->OnRedirectVerifyCallback(NS_OK); return NS_OK; }
int NeedUpdateNonGpl() { std::wstring path = UTIL::OS::getAppDataPath(UPDATEFILE_W); if (!FileExists(UPDATEXML_W)) { return UPDATE_XML; } else { if (FileExists(path.c_str()) && CheckUpdate(path.c_str())) return UPDATE_MCF; if (!CheckInstall()) return UPDATE_FILES; } if (CheckCert()) return UPDATE_CERT; return UPDATE_NONE; }
int NeedUpdateNonGpl() { UpdateLogHandle ulh; std::wstring path = UTIL::OS::getAppDataPath(UPDATEFILE_W); if (!FileExists(UPDATEXML_W)) { Log("NeedUpdate: Missing Xml"); return UPDATE_XML; } else { if (FileExists(path.c_str()) && CheckUpdate(path.c_str())) { Log("NeedUpdate: Missing Mcf"); return UPDATE_MCF; } if (!CheckInstall()) { Log("NeedUpdate: Bad Files"); return UPDATE_FILES; } } #ifdef WITH_CODESIGN if (CheckCert()) { Log("NeedUpdate: Bad Cert"); return UPDATE_CERT; } #endif return UPDATE_NONE; }