From ebc2b46a8bad6e8b0718ffbd2b8a3451d843a8e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gabriel=20Iv=C4=83ncescu?= Date: Sun, 3 Jul 2022 20:10:37 +0300 Subject: [PATCH] Allow loading local file URIs when schemas don't match. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Internet Explorer allows loading file:// URIs when the schemas don't match (for example, from a https website), and some applications, such as the launcher for Imperiums: Greek Wars, depends on this as it loads the news feed via http and then puts CSS with the background from the game directory via file:// Signed-off-by: Gabriel Ivăncescu --- caps/nsScriptSecurityManager.cpp | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/caps/nsScriptSecurityManager.cpp b/caps/nsScriptSecurityManager.cpp index 837a45782de..563d38c98d7 100644 --- a/caps/nsScriptSecurityManager.cpp +++ b/caps/nsScriptSecurityManager.cpp @@ -933,6 +933,14 @@ nsScriptSecurityManager::CheckLoadURIWithPrincipal(nsIPrincipal* aPrincipal, return NS_OK; } +#ifdef WINE_GECKO_SRC + // Internet Explorer allows loading file:// URIs from other schemes... + if (!(aFlags & (nsIScriptSecurityManager::DISALLOW_INHERIT_PRINCIPAL | + nsIScriptSecurityManager::DISALLOW_SCRIPT | + nsIScriptSecurityManager::LOAD_IS_AUTOMATIC_DOCUMENT_REPLACEMENT))) + return NS_OK; +#endif + // Nothing else. if (reportErrors) { ReportError(nullptr, errorTag, sourceURI, aTargetURI);