mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 20:22:00 +00:00
bug 268059 hide URL user:pass in XPinstall dialogs, r/sr=dougt
This commit is contained in:
parent
ba3a7e5abf
commit
87c83c4bff
@ -39,6 +39,7 @@
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsXPITriggerInfo.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsDebug.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIEventQueueService.h"
|
||||
@ -105,6 +106,25 @@ PRBool nsXPITriggerItem::IsRelativeURL()
|
||||
return (cpos > spos);
|
||||
}
|
||||
|
||||
const PRUnichar*
|
||||
nsXPITriggerItem::GetSafeURLString()
|
||||
{
|
||||
// create the safe url string the first time
|
||||
if (mSafeURL.IsEmpty() && !mURL.IsEmpty())
|
||||
{
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), mURL);
|
||||
if (uri)
|
||||
{
|
||||
nsCAutoString spec;
|
||||
uri->SetUserPass(EmptyCString());
|
||||
uri->GetSpec(spec);
|
||||
mSafeURL = NS_ConvertUTF8toUTF16(spec);
|
||||
}
|
||||
}
|
||||
|
||||
return mSafeURL.get();
|
||||
}
|
||||
|
||||
void
|
||||
nsXPITriggerItem::SetPrincipal(nsIPrincipal* aPrincipal)
|
||||
|
@ -82,16 +82,20 @@ class nsXPITriggerItem
|
||||
nsCOMPtr<nsILocalFile> mFile;
|
||||
nsCOMPtr<nsIOutputStream> mOutStream;
|
||||
nsCOMPtr<nsIPrincipal> mPrincipal;
|
||||
|
||||
|
||||
|
||||
PRBool IsFileURL() { return StringBeginsWith(mURL, NS_LITERAL_STRING("file:/")); }
|
||||
PRBool IsRelativeURL();
|
||||
|
||||
const PRUnichar* GetSafeURLString();
|
||||
|
||||
void SetPrincipal(nsIPrincipal* aPrincipal);
|
||||
private:
|
||||
//-- prevent inadvertent copies and assignments
|
||||
nsXPITriggerItem& operator=(const nsXPITriggerItem& rhs);
|
||||
nsXPITriggerItem(const nsXPITriggerItem& rhs);
|
||||
|
||||
nsString mSafeURL;
|
||||
};
|
||||
|
||||
|
||||
|
@ -267,7 +267,7 @@ nsXPInstallManager::InitManagerInternal()
|
||||
{
|
||||
nsXPITriggerItem *item = mTriggers->Get(i);
|
||||
packageList[j++] = item->mName.get();
|
||||
packageList[j++] = item->mURL.get();
|
||||
packageList[j++] = item->GetSafeURLString();
|
||||
packageList[j++] = item->mIconURL.get();
|
||||
packageList[j++] = item->mCertName.get();
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user