43 #include "nsNetUtil.h"
44 #include "nsIScriptSecurityManager.h"
70 #ifdef MOZ_SAFE_BROWSING
71 {
"blocked",
"chrome://browser/content/safebrowsing/blockedSite.xhtml",
72 nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
73 nsIAboutModule::ALLOW_SCRIPT },
75 {
"certerror",
"chrome://browser/content/certerror/aboutCertError.xhtml",
76 nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
77 nsIAboutModule::ALLOW_SCRIPT },
78 {
"feeds",
"chrome://browser/content/feeds/subscribe.xhtml",
79 nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
80 nsIAboutModule::ALLOW_SCRIPT },
81 {
"privatebrowsing",
"chrome://browser/content/aboutPrivateBrowsing.xhtml",
82 nsIAboutModule::ALLOW_SCRIPT },
85 "chrome://global/content/aboutRights.xhtml",
87 "chrome://global/content/aboutRights-unbranded.xhtml",
89 nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
90 nsIAboutModule::ALLOW_SCRIPT },
91 {
"robots",
"chrome://browser/content/aboutRobots.xhtml",
92 nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT |
93 nsIAboutModule::ALLOW_SCRIPT },
94 {
"sessionrestore",
"chrome://browser/content/aboutSessionRestore.xhtml",
95 nsIAboutModule::ALLOW_SCRIPT },
96 {
"support",
"chrome://browser/content/aboutSupport.xhtml",
97 nsIAboutModule::ALLOW_SCRIPT },
107 PRInt32 f = path.FindChar(
'#');
111 f = path.FindChar(
'?');
120 AboutRedirector::NewChannel(nsIURI *aURI,
nsIChannel **result)
122 NS_ENSURE_ARG_POINTER(aURI);
123 NS_ASSERTION(result,
"must not be null");
128 nsCOMPtr<nsIIOService>
ioService = do_GetIOService(&rv);
129 NS_ENSURE_SUCCESS(rv, rv);
133 nsCOMPtr<nsIChannel> tempChannel;
134 rv = ioService->NewChannel(nsDependentCString(
kRedirMap[
i].
url),
135 nsnull, nsnull, getter_AddRefs(tempChannel));
136 NS_ENSURE_SUCCESS(rv, rv);
138 tempChannel->SetOriginalURI(aURI);
141 if (
kRedirMap[
i].
flags & nsIAboutModule::URI_SAFE_FOR_UNTRUSTED_CONTENT) {
142 nsCOMPtr<nsIScriptSecurityManager> securityManager =
143 do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
144 NS_ENSURE_SUCCESS(rv, rv);
146 nsCOMPtr<nsIPrincipal> principal;
147 rv = securityManager->GetCodebasePrincipal(aURI, getter_AddRefs(principal));
148 NS_ENSURE_SUCCESS(rv, rv);
150 rv = tempChannel->SetOwner(principal);
151 NS_ENSURE_SUCCESS(rv, rv);
154 NS_ADDREF(*result = tempChannel);
159 return NS_ERROR_ILLEGAL_VALUE;
163 AboutRedirector::GetURIFlags(nsIURI *aURI, PRUint32 *result)
165 NS_ENSURE_ARG_POINTER(aURI);
176 return NS_ERROR_ILLEGAL_VALUE;
184 return NS_ERROR_OUT_OF_MEMORY;
186 nsresult rv = about->QueryInterface(aIID, result);
NS_DECL_ISUPPORTS NS_DECL_NSIABOUTMODULE AboutRedirector()
NS_IMPL_ISUPPORTS1(sbDeviceCapabilitiesUtils, sbIDeviceCapabilitiesUtils) sbDeviceCapabilitiesUtils
static RedirEntry kRedirMap[]
sbDeviceFirmwareAutoCheckForUpdate prototype flags
static const int kRedirTotal
static nsCAutoString GetAboutModuleName(nsIURI *aURI)
_getSelectedPageStyle s i
static NS_METHOD Create(nsISupports *aOuter, REFNSIID aIID, void **aResult)