bug 265135: put internal referrers on channels to fix xpinstall whitelisting the right way. r=darin,sr=jst
git-svn-id: svn://10.0.0.236/trunk@164582 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -257,7 +257,6 @@ nsDocShell::nsDocShell():
|
||||
mEODForCurrentDocument(PR_FALSE),
|
||||
mURIResultedInDocument(PR_FALSE),
|
||||
mIsBeingDestroyed(PR_FALSE),
|
||||
mUseExternalProtocolHandler(PR_FALSE),
|
||||
mDisallowPopupWindows(PR_FALSE),
|
||||
mValidateOrigin(PR_TRUE), // validate frame origins by default
|
||||
mIsExecutingOnLoadHandler(PR_FALSE),
|
||||
@@ -3092,13 +3091,6 @@ nsDocShell::Create()
|
||||
|
||||
PRBool tmpbool;
|
||||
|
||||
// i don't want to read this pref in every time we load a url
|
||||
// so read it in once here and be done with it...
|
||||
rv = mPrefs->GetBoolPref("network.protocols.useSystemDefaults",
|
||||
&tmpbool);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mUseExternalProtocolHandler = tmpbool;
|
||||
|
||||
rv = mPrefs->GetBoolPref("browser.block.target_new_window", &tmpbool);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
mDisallowPopupWindows = tmpbool;
|
||||
@@ -5091,40 +5083,6 @@ nsDocShell::InternalLoad(nsIURI * aURI,
|
||||
nsCOMPtr<nsIDocShell> targetDocShell;
|
||||
nsAutoString name(aWindowTarget);
|
||||
|
||||
//
|
||||
// This is a hack for Shrimp :-(
|
||||
//
|
||||
// if the load cmd is a user click....and we are supposed to try using
|
||||
// external default protocol handlers....then try to see if we have one for
|
||||
// this protocol
|
||||
//
|
||||
// See bug #52182
|
||||
//
|
||||
if (mUseExternalProtocolHandler && aLoadType == LOAD_LINK) {
|
||||
// don't do it for javascript urls!
|
||||
// _main is an IE target which should be case-insensitive but isn't
|
||||
// see bug 217886 for details
|
||||
if (!bIsJavascript &&
|
||||
(name.LowerCaseEqualsLiteral("_content") || name.EqualsLiteral("_main") ||
|
||||
name.LowerCaseEqualsLiteral("_blank")))
|
||||
{
|
||||
nsCOMPtr<nsIExternalProtocolService> extProtService;
|
||||
nsCAutoString urlScheme;
|
||||
|
||||
extProtService = do_GetService(NS_EXTERNALPROTOCOLSERVICE_CONTRACTID);
|
||||
if (extProtService) {
|
||||
PRBool haveHandler = PR_FALSE;
|
||||
aURI->GetScheme(urlScheme);
|
||||
|
||||
extProtService->ExternalProtocolHandlerExists(urlScheme.get(),
|
||||
&haveHandler);
|
||||
if (haveHandler) {
|
||||
return extProtService->LoadUrl(aURI);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// This is a hack to prevent top-level windows from ever being
|
||||
// created. It really doesn't belong here, but until there is a
|
||||
@@ -5526,6 +5484,14 @@ nsDocShell::DoURILoad(nsIURI * aURI,
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIProperties> props(do_QueryInterface(channel));
|
||||
if (props)
|
||||
{
|
||||
// save true referrer for those who need it (e.g. xpinstall whitelisting)
|
||||
// Currently only http and ftp channels support this.
|
||||
props->Set("docshell.internalReferrer", aReferrerURI);
|
||||
}
|
||||
|
||||
//
|
||||
// If this is a HTTP channel, then set up the HTTP specific information
|
||||
// (ie. POST data, referrer, ...)
|
||||
|
||||
Reference in New Issue
Block a user