mshtml: Don't mess with gecko specific protocols.

This commit is contained in:
Jacek Caban 2007-08-12 17:37:33 +02:00 committed by Alexandre Julliard
parent 83a83880cd
commit 464121bc00
1 changed files with 16 additions and 17 deletions

View File

@ -1945,13 +1945,25 @@ static nsresult NSAPI nsIOService_GetProtocolFlags(nsIIOService *iface, const ch
return nsIIOService_GetProtocolFlags(nsio, aScheme, _retval); return nsIIOService_GetProtocolFlags(nsio, aScheme, _retval);
} }
static BOOL is_gecko_special_uri(const char *spec)
{
static const char chromeW[] = "chrome:";
static const char jarW[] = "jar:";
static const char resourceW[] = "resource:";
static const char javascriptW[] = "javascript:";
return !strncasecmp(spec, chromeW, sizeof(chromeW)-1)
|| !strncasecmp(spec, resourceW, sizeof(resourceW)-1)
|| !strncasecmp(spec, jarW, sizeof(jarW)-1)
|| !strncasecmp(spec, javascriptW, sizeof(javascriptW)-1);
}
static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString *aSpec, static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString *aSpec,
const char *aOriginCharset, nsIURI *aBaseURI, nsIURI **_retval) const char *aOriginCharset, nsIURI *aBaseURI, nsIURI **_retval)
{ {
const char *spec = NULL; const char *spec = NULL;
NSContainer *nscontainer = NULL; NSContainer *nscontainer = NULL;
nsIURI *uri = NULL; nsIURI *uri = NULL;
PRBool is_javascript = FALSE;
LPCWSTR base_wine_url = NULL; LPCWSTR base_wine_url = NULL;
nsIWineURI *base_wine_uri = NULL, *wine_uri; nsIWineURI *base_wine_uri = NULL, *wine_uri;
nsresult nsres; nsresult nsres;
@ -1961,13 +1973,13 @@ static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString *
TRACE("(%p(%s) %s %p %p)\n", aSpec, debugstr_a(spec), debugstr_a(aOriginCharset), TRACE("(%p(%s) %s %p %p)\n", aSpec, debugstr_a(spec), debugstr_a(aOriginCharset),
aBaseURI, _retval); aBaseURI, _retval);
if(is_gecko_special_uri(spec))
return nsIIOService_NewURI(nsio, aSpec, aOriginCharset, aBaseURI, _retval);
if(aBaseURI) { if(aBaseURI) {
nsACString base_uri_str; nsACString base_uri_str;
const char *base_uri = NULL; const char *base_uri = NULL;
static const char szChrome[] = "chrome:";
static const char szResource[] = "resource:";
nsACString_Init(&base_uri_str, NULL); nsACString_Init(&base_uri_str, NULL);
nsres = nsIURI_GetSpec(aBaseURI, &base_uri_str); nsres = nsIURI_GetSpec(aBaseURI, &base_uri_str);
@ -1979,25 +1991,12 @@ static nsresult NSAPI nsIOService_NewURI(nsIIOService *iface, const nsACString *
} }
nsACString_Finish(&base_uri_str); nsACString_Finish(&base_uri_str);
if(!strncmp(spec, szChrome, sizeof(szChrome)-1)
|| !strncmp(spec, szResource, sizeof(szResource)-1))
aBaseURI = NULL;
} }
nsres = nsIIOService_NewURI(nsio, aSpec, aOriginCharset, aBaseURI, &uri); nsres = nsIIOService_NewURI(nsio, aSpec, aOriginCharset, aBaseURI, &uri);
if(NS_FAILED(nsres)) if(NS_FAILED(nsres))
TRACE("NewURI failed: %08x\n", nsres); TRACE("NewURI failed: %08x\n", nsres);
if(uri) {
nsIURI_SchemeIs(uri, "javascript", &is_javascript);
if(is_javascript) {
TRACE("returning javascript uri: %p\n", uri);
*_retval = uri;
return NS_OK;
}
}
if(aBaseURI) { if(aBaseURI) {
nsres = nsIURI_QueryInterface(aBaseURI, &IID_nsIWineURI, (void**)&base_wine_uri); nsres = nsIURI_QueryInterface(aBaseURI, &IID_nsIWineURI, (void**)&base_wine_uri);
if(NS_SUCCEEDED(nsres)) { if(NS_SUCCEEDED(nsres)) {