Cleanup excess code and gURLProtocolWhitelist, add isWhitelistedProtocol()
# Conflicts: # indra/llwindow/llwindowmacosx.cpp # indra/llwindow/llwindowsdl2.cpp
This commit is contained in:
@@ -49,15 +49,18 @@ LLSplashScreen *gSplashScreenp = NULL;
|
||||
BOOL gDebugClicks = FALSE;
|
||||
BOOL gDebugWindowProc = FALSE;
|
||||
|
||||
const S32 gURLProtocolWhitelistCount = 5;
|
||||
const std::string gURLProtocolWhitelist[] = { "secondlife:", "http:", "https:", "data:", "mailto:" };
|
||||
|
||||
bool isWhitelistedProtocol(const std::string& escaped_url) {
|
||||
// CP: added a handler list - this is what's used to open the protocol and is based on registry entry
|
||||
// only meaningful difference currently is that file: protocols are opened using http:
|
||||
// since no protocol handler exists in registry for file:
|
||||
// Important - these lists should match - protocol to handler
|
||||
// Maestro: This list isn't referenced anywhere that I could find
|
||||
//const std::string gURLProtocolWhitelistHandler[] = { "http", "http", "https" };
|
||||
for (const auto& protocol : { "secondlife:", "http:", "https:", "data:", "mailto:" })
|
||||
if (escaped_url.find(protocol) != std::string::npos)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
S32 OSMessageBox(const std::string& text, const std::string& caption, U32 type)
|
||||
|
||||
@@ -290,11 +290,7 @@ public:
|
||||
//
|
||||
extern BOOL gDebugWindowProc;
|
||||
|
||||
// Protocols, like "http" and "https" we support in URLs
|
||||
extern const S32 gURLProtocolWhitelistCount;
|
||||
extern const std::string gURLProtocolWhitelist[];
|
||||
//extern const std::string gURLProtocolWhitelistHandler[];
|
||||
|
||||
bool isWhitelistedProtocol(const std::string& escaped_url);
|
||||
void simpleEscapeString ( std::string& stringIn );
|
||||
|
||||
#endif // _LL_window_h_
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -2476,18 +2476,7 @@ void exec_cmd(const std::string& cmd, const std::string& arg)
|
||||
// Must begin with protocol identifier.
|
||||
void LLWindowSDL::spawnWebBrowser(const std::string& escaped_url, bool async)
|
||||
{
|
||||
bool found = false;
|
||||
S32 i;
|
||||
for (i = 0; i < gURLProtocolWhitelistCount; i++)
|
||||
{
|
||||
if (escaped_url.find(gURLProtocolWhitelist[i]) != std::string::npos)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
if (!isWhitelistedProtocol(escaped_url))
|
||||
{
|
||||
LL_WARNS() << "spawn_web_browser called for url with protocol not on whitelist: " << escaped_url << LL_ENDL;
|
||||
return;
|
||||
|
||||
@@ -3377,18 +3377,7 @@ void LLWindowWin32::ShellEx(const std::string& command)
|
||||
|
||||
void LLWindowWin32::spawnWebBrowser(const std::string& escaped_url, bool async)
|
||||
{
|
||||
bool found = false;
|
||||
S32 i;
|
||||
for (i = 0; i < gURLProtocolWhitelistCount; i++)
|
||||
{
|
||||
if (escaped_url.find(gURLProtocolWhitelist[i]) == 0)
|
||||
{
|
||||
found = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!found)
|
||||
if (!isWhitelistedProtocol(escaped_url))
|
||||
{
|
||||
LL_WARNS("Window") << "spawn_web_browser() called for url with protocol not on whitelist: " << escaped_url << LL_ENDL;
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user