diff --git a/mozilla/caps/src/nsScriptSecurityManager.cpp b/mozilla/caps/src/nsScriptSecurityManager.cpp index 9ca48b4..d871c52 100644 --- a/mozilla/caps/src/nsScriptSecurityManager.cpp +++ b/mozilla/caps/src/nsScriptSecurityManager.cpp @@ -1478,6 +1478,27 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal, nsCOMPtr prefService = do_GetService(NS_PREFSERVICE_CONTRACTID); if (prefService) { + PRBool allow_anyway = PR_FALSE; + nsresult allowed_result; + nsXPIDLCString allowed_gnomeVFSProtocols; + allowed_result = prefService->GetCharPref("network.gnomevfs.allowed-protocols", + getter_Copies(allowed_gnomeVFSProtocols)); + if (NS_SUCCEEDED(allowed_result)) + allowed_gnomeVFSProtocols.StripWhitespace(); + else + allowed_gnomeVFSProtocols.Truncate(); + + nsCAutoString allowed_scheme(targetScheme); + allowed_scheme.Append(':'); + nsACString::const_iterator allowed_begin, allowed_end, allowed_iter; + allowed_gnomeVFSProtocols.BeginReading(allowed_begin); + allowed_gnomeVFSProtocols.EndReading(allowed_end); + allowed_iter = allowed_begin; + if (CaseInsensitiveFindInReadable(allowed_scheme, allowed_iter, allowed_end) && + (allowed_iter == allowed_begin || *(--allowed_iter) == ',')) { + allow_anyway = PR_TRUE; + } + nsXPIDLCString gnomeVFSProtocols; nsresult result = prefService->GetCharPref("network.gnomevfs.supported-protocols", @@ -1494,11 +1515,14 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal, gnomeVFSProtocols.BeginReading(begin); gnomeVFSProtocols.EndReading(end); iter = begin; - if (CaseInsensitiveFindInReadable(scheme, iter, end) && - (iter == begin || *(--iter) == ',')) { - // Deny this load - ReportError(nsnull, errorTag, sourceURI, aTargetURI); - return NS_ERROR_DOM_BAD_URI; + if (CaseInsensitiveFindInReadable(scheme, iter, end) && (iter == begin || *(--iter) == ',')) { + // Deny this load iff allow_anyway is false + if (allow_anyway == PR_FALSE) { + ReportError(nsnull, errorTag, sourceURI, aTargetURI); + return NS_ERROR_DOM_BAD_URI; + } else { + return NS_OK; + } } } } diff --git a/mozilla/modules/libpref/src/init/all.js b/mozilla/modules/libpref/src/init/all.js index f9651a1..539540a 100644 --- a/mozilla/modules/libpref/src/init/all.js +++ b/mozilla/modules/libpref/src/init/all.js @@ -2410,4 +2410,5 @@ pref("print.print_command", "lp -c -s ${MOZ_PRINTER_NAME:+'-d '}${MOZ_PRINTER_NA #ifdef MOZ_X11 pref("network.gnomevfs.supported-protocols", "smb:,sftp:"); +pref("network.gnomevfs.allowed-protocols", ""); #endif