Include url in error message. Bug 167662, r=jkeiser, sr=jst

This commit is contained in:
bzbarsky%mit.edu 2002-09-11 02:55:14 +00:00
Родитель 105a88fa26
Коммит 6ec7dec1d6
3 изменённых файлов: 39 добавлений и 9 удалений

Просмотреть файл

@ -66,6 +66,8 @@
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
#include "nsIStringBundle.h"
#include "nsIDocument.h"
#include "nsINodeInfo.h"
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
@ -512,17 +514,30 @@ void RectArea::ParseCoords(const nsString& aSpec)
if (NS_FAILED(rv))
return;
nsXPIDLString errorText;
const PRUnichar* flatSpec = aSpec.get();
rv =
bundle->FormatStringFromName(NS_LITERAL_STRING("ImageMapRectBoundsError").get(),
&flatSpec, 1,
nsnull, 0,
getter_Copies(errorText));
if (NS_FAILED(rv))
return;
nsCOMPtr<nsINodeInfo> nodeInfo;
mArea->GetNodeInfo(*getter_AddRefs(nodeInfo));
NS_ASSERTION(nodeInfo, "Element with no nodeinfo");
nsCOMPtr<nsIDocument> doc;
nodeInfo->GetDocument(*getter_AddRefs(doc));
nsCAutoString urlSpec;
if (doc) {
nsCOMPtr<nsIURI> uri;
doc->GetDocumentURL(getter_AddRefs(uri));
if (uri) {
uri->GetSpec(urlSpec);
}
}
rv = errorObject->Init(errorText.get(),
NS_LITERAL_STRING("").get(), /* file name */
NS_LITERAL_STRING("").get(), /* source line */
NS_ConvertUTF8toUCS2(urlSpec).get(), /* file name */
aSpec.get(), /* source line */
0, /* line number */
0, /* column number */
flag,

Просмотреть файл

@ -35,4 +35,4 @@
#
# ***** END LICENSE BLOCK *****
ImageMapRectBoundsError=The "coords" attribute of <area shape="rect" coords="%S"> is not in the "left,top,right,bottom" format.
ImageMapRectBoundsError=The "coords" attribute of the <area shape="rect"> tag is not in the "left,top,right,bottom" format.

Просмотреть файл

@ -66,6 +66,8 @@
#include "nsIConsoleService.h"
#include "nsIScriptError.h"
#include "nsIStringBundle.h"
#include "nsIDocument.h"
#include "nsINodeInfo.h"
static NS_DEFINE_CID(kCStringBundleServiceCID, NS_STRINGBUNDLESERVICE_CID);
@ -512,17 +514,30 @@ void RectArea::ParseCoords(const nsString& aSpec)
if (NS_FAILED(rv))
return;
nsXPIDLString errorText;
const PRUnichar* flatSpec = aSpec.get();
rv =
bundle->FormatStringFromName(NS_LITERAL_STRING("ImageMapRectBoundsError").get(),
&flatSpec, 1,
nsnull, 0,
getter_Copies(errorText));
if (NS_FAILED(rv))
return;
nsCOMPtr<nsINodeInfo> nodeInfo;
mArea->GetNodeInfo(*getter_AddRefs(nodeInfo));
NS_ASSERTION(nodeInfo, "Element with no nodeinfo");
nsCOMPtr<nsIDocument> doc;
nodeInfo->GetDocument(*getter_AddRefs(doc));
nsCAutoString urlSpec;
if (doc) {
nsCOMPtr<nsIURI> uri;
doc->GetDocumentURL(getter_AddRefs(uri));
if (uri) {
uri->GetSpec(urlSpec);
}
}
rv = errorObject->Init(errorText.get(),
NS_LITERAL_STRING("").get(), /* file name */
NS_LITERAL_STRING("").get(), /* source line */
NS_ConvertUTF8toUCS2(urlSpec).get(), /* file name */
aSpec.get(), /* source line */
0, /* line number */
0, /* column number */
flag,