зеркало из https://github.com/mozilla/gecko-dev.git
fixing bug 82520 r=jag sr=hyatt a=tor
This commit is contained in:
Родитель
9dca9726d1
Коммит
11c8370603
|
@ -1354,11 +1354,11 @@ nsImageFrame::LoadImage(const nsAReadableString& aSpec, nsIPresContext *aPresCon
|
||||||
/* don't load the image if aSpec is empty */
|
/* don't load the image if aSpec is empty */
|
||||||
if (aSpec.IsEmpty()) return NS_ERROR_FAILURE;
|
if (aSpec.IsEmpty()) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> uri;
|
nsCOMPtr<nsIURI> realURI;
|
||||||
|
|
||||||
/* don't load the image if some security check fails... */
|
/* don't load the image if some security check fails... */
|
||||||
GetRealURI(aSpec, getter_AddRefs(uri));
|
GetRealURI(aSpec, getter_AddRefs(realURI));
|
||||||
if (!CanLoadImage(uri)) return NS_ERROR_FAILURE;
|
if (!CanLoadImage(realURI)) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
if (!mListener) {
|
if (!mListener) {
|
||||||
nsImageListener *listener = new nsImageListener(this);
|
nsImageListener *listener = new nsImageListener(this);
|
||||||
|
@ -1376,8 +1376,10 @@ nsImageFrame::LoadImage(const nsAReadableString& aSpec, nsIPresContext *aPresCon
|
||||||
GetLoadGroup(aPresContext, getter_AddRefs(loadGroup));
|
GetLoadGroup(aPresContext, getter_AddRefs(loadGroup));
|
||||||
|
|
||||||
/* get the URI, convert internal-gopher-stuff if needed */
|
/* get the URI, convert internal-gopher-stuff if needed */
|
||||||
|
nsCOMPtr<nsIURI> uri;
|
||||||
GetURI(aSpec, getter_AddRefs(uri));
|
GetURI(aSpec, getter_AddRefs(uri));
|
||||||
if (!uri) return NS_ERROR_FAILURE;
|
if (!uri)
|
||||||
|
uri = realURI;
|
||||||
|
|
||||||
/* set this back to FALSE before we do the real load */
|
/* set this back to FALSE before we do the real load */
|
||||||
mInitialLoadCompleted = PR_FALSE;
|
mInitialLoadCompleted = PR_FALSE;
|
||||||
|
@ -1385,13 +1387,12 @@ nsImageFrame::LoadImage(const nsAReadableString& aSpec, nsIPresContext *aPresCon
|
||||||
return il->LoadImage(uri, loadGroup, mListener, aPresContext, aRequest);
|
return il->LoadImage(uri, loadGroup, mListener, aPresContext, aRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define INTERNAL_GOPHER_STRING "internal-gopher-"
|
#define INTERNAL_GOPHER_LENGTH 16 /* "internal-gopher-" length */
|
||||||
#define INTERNAL_GOPHER_LENGTH 17
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsImageFrame::GetURI(const nsAReadableString& aSpec, nsIURI **aURI)
|
nsImageFrame::GetURI(const nsAReadableString& aSpec, nsIURI **aURI)
|
||||||
{
|
{
|
||||||
nsAutoString newURI;
|
*aURI = nsnull;
|
||||||
|
|
||||||
/* Note: navigator 4.* and earlier releases ignored the base tags
|
/* Note: navigator 4.* and earlier releases ignored the base tags
|
||||||
effect on the builtin images. So we do too. Use aSpec instead
|
effect on the builtin images. So we do too. Use aSpec instead
|
||||||
|
@ -1401,18 +1402,15 @@ nsImageFrame::GetURI(const nsAReadableString& aSpec, nsIURI **aURI)
|
||||||
/* The prefix for special "internal" images that are well known.
|
/* The prefix for special "internal" images that are well known.
|
||||||
Look and see if this is an internal-gopher- url.
|
Look and see if this is an internal-gopher- url.
|
||||||
*/
|
*/
|
||||||
if (NS_LITERAL_STRING(INTERNAL_GOPHER_STRING).Equals(Substring(aSpec, 0, INTERNAL_GOPHER_LENGTH))) {
|
if (NS_LITERAL_STRING("internal-gopher-").Equals(Substring(aSpec, 0, INTERNAL_GOPHER_LENGTH))) {
|
||||||
|
nsAutoString newURI;
|
||||||
newURI.Assign(NS_LITERAL_STRING("resource:/res/html/gopher-") +
|
newURI.Assign(NS_LITERAL_STRING("resource:/res/html/gopher-") +
|
||||||
Substring(aSpec, INTERNAL_GOPHER_LENGTH, aSpec.Length() - INTERNAL_GOPHER_LENGTH) +
|
Substring(aSpec, INTERNAL_GOPHER_LENGTH, aSpec.Length() - INTERNAL_GOPHER_LENGTH) +
|
||||||
NS_LITERAL_STRING(".gif"));
|
NS_LITERAL_STRING(".gif"));
|
||||||
} else {
|
GetRealURI(newURI, aURI);
|
||||||
newURI.Assign(aSpec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GetRealURI(newURI, aURI);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsImageFrame::GetRealURI(const nsAReadableString& aSpec, nsIURI **aURI)
|
nsImageFrame::GetRealURI(const nsAReadableString& aSpec, nsIURI **aURI)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1354,11 +1354,11 @@ nsImageFrame::LoadImage(const nsAReadableString& aSpec, nsIPresContext *aPresCon
|
||||||
/* don't load the image if aSpec is empty */
|
/* don't load the image if aSpec is empty */
|
||||||
if (aSpec.IsEmpty()) return NS_ERROR_FAILURE;
|
if (aSpec.IsEmpty()) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
nsCOMPtr<nsIURI> uri;
|
nsCOMPtr<nsIURI> realURI;
|
||||||
|
|
||||||
/* don't load the image if some security check fails... */
|
/* don't load the image if some security check fails... */
|
||||||
GetRealURI(aSpec, getter_AddRefs(uri));
|
GetRealURI(aSpec, getter_AddRefs(realURI));
|
||||||
if (!CanLoadImage(uri)) return NS_ERROR_FAILURE;
|
if (!CanLoadImage(realURI)) return NS_ERROR_FAILURE;
|
||||||
|
|
||||||
if (!mListener) {
|
if (!mListener) {
|
||||||
nsImageListener *listener = new nsImageListener(this);
|
nsImageListener *listener = new nsImageListener(this);
|
||||||
|
@ -1376,8 +1376,10 @@ nsImageFrame::LoadImage(const nsAReadableString& aSpec, nsIPresContext *aPresCon
|
||||||
GetLoadGroup(aPresContext, getter_AddRefs(loadGroup));
|
GetLoadGroup(aPresContext, getter_AddRefs(loadGroup));
|
||||||
|
|
||||||
/* get the URI, convert internal-gopher-stuff if needed */
|
/* get the URI, convert internal-gopher-stuff if needed */
|
||||||
|
nsCOMPtr<nsIURI> uri;
|
||||||
GetURI(aSpec, getter_AddRefs(uri));
|
GetURI(aSpec, getter_AddRefs(uri));
|
||||||
if (!uri) return NS_ERROR_FAILURE;
|
if (!uri)
|
||||||
|
uri = realURI;
|
||||||
|
|
||||||
/* set this back to FALSE before we do the real load */
|
/* set this back to FALSE before we do the real load */
|
||||||
mInitialLoadCompleted = PR_FALSE;
|
mInitialLoadCompleted = PR_FALSE;
|
||||||
|
@ -1385,13 +1387,12 @@ nsImageFrame::LoadImage(const nsAReadableString& aSpec, nsIPresContext *aPresCon
|
||||||
return il->LoadImage(uri, loadGroup, mListener, aPresContext, aRequest);
|
return il->LoadImage(uri, loadGroup, mListener, aPresContext, aRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define INTERNAL_GOPHER_STRING "internal-gopher-"
|
#define INTERNAL_GOPHER_LENGTH 16 /* "internal-gopher-" length */
|
||||||
#define INTERNAL_GOPHER_LENGTH 17
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsImageFrame::GetURI(const nsAReadableString& aSpec, nsIURI **aURI)
|
nsImageFrame::GetURI(const nsAReadableString& aSpec, nsIURI **aURI)
|
||||||
{
|
{
|
||||||
nsAutoString newURI;
|
*aURI = nsnull;
|
||||||
|
|
||||||
/* Note: navigator 4.* and earlier releases ignored the base tags
|
/* Note: navigator 4.* and earlier releases ignored the base tags
|
||||||
effect on the builtin images. So we do too. Use aSpec instead
|
effect on the builtin images. So we do too. Use aSpec instead
|
||||||
|
@ -1401,18 +1402,15 @@ nsImageFrame::GetURI(const nsAReadableString& aSpec, nsIURI **aURI)
|
||||||
/* The prefix for special "internal" images that are well known.
|
/* The prefix for special "internal" images that are well known.
|
||||||
Look and see if this is an internal-gopher- url.
|
Look and see if this is an internal-gopher- url.
|
||||||
*/
|
*/
|
||||||
if (NS_LITERAL_STRING(INTERNAL_GOPHER_STRING).Equals(Substring(aSpec, 0, INTERNAL_GOPHER_LENGTH))) {
|
if (NS_LITERAL_STRING("internal-gopher-").Equals(Substring(aSpec, 0, INTERNAL_GOPHER_LENGTH))) {
|
||||||
|
nsAutoString newURI;
|
||||||
newURI.Assign(NS_LITERAL_STRING("resource:/res/html/gopher-") +
|
newURI.Assign(NS_LITERAL_STRING("resource:/res/html/gopher-") +
|
||||||
Substring(aSpec, INTERNAL_GOPHER_LENGTH, aSpec.Length() - INTERNAL_GOPHER_LENGTH) +
|
Substring(aSpec, INTERNAL_GOPHER_LENGTH, aSpec.Length() - INTERNAL_GOPHER_LENGTH) +
|
||||||
NS_LITERAL_STRING(".gif"));
|
NS_LITERAL_STRING(".gif"));
|
||||||
} else {
|
GetRealURI(newURI, aURI);
|
||||||
newURI.Assign(aSpec);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GetRealURI(newURI, aURI);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
nsImageFrame::GetRealURI(const nsAReadableString& aSpec, nsIURI **aURI)
|
nsImageFrame::GetRealURI(const nsAReadableString& aSpec, nsIURI **aURI)
|
||||||
{
|
{
|
||||||
|
|
Загрузка…
Ссылка в новой задаче