mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 743575 - Try to get line number if at all possible when reporting warnings to the error console. r=mrbkap
This commit is contained in:
parent
1c058e0942
commit
3e4da21b72
@ -3105,7 +3105,19 @@ nsContentUtils::ReportToConsole(PRUint32 aErrorFlags,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCAutoString spec;
|
||||
if (aURI)
|
||||
if (!aLineNumber) {
|
||||
JSContext *cx = nsnull;
|
||||
sThreadJSContextStack->Peek(&cx);
|
||||
if (cx) {
|
||||
const char* filename;
|
||||
PRUint32 lineno;
|
||||
if (nsJSUtils::GetCallingLocation(cx, &filename, &lineno)) {
|
||||
spec = filename;
|
||||
aLineNumber = lineno;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (spec.IsEmpty() && aURI)
|
||||
aURI->GetSpec(spec);
|
||||
|
||||
nsCOMPtr<nsIScriptError> errorObject =
|
||||
|
@ -26,8 +26,14 @@ var tests = [
|
||||
"file_bug708620.html"
|
||||
];
|
||||
|
||||
function resolveURL(relative) {
|
||||
var a = document.createElement('a');
|
||||
a.href = relative;
|
||||
return a.href;
|
||||
}
|
||||
|
||||
var expectedErrors = [
|
||||
'[JavaScript Warning: "A form was submitted in the windows-1252 encoding which cannot encode all Unicode characters, so user input may get corrupted. To avoid this problem, the page should be changed so that the form is submitted in the UTF-8 encoding either by changing the encoding of the page itself to UTF-8 or by specifying accept-charset=utf-8 on the form element."]'
|
||||
'[JavaScript Warning: "A form was submitted in the windows-1252 encoding which cannot encode all Unicode characters, so user input may get corrupted. To avoid this problem, the page should be changed so that the form is submitted in the UTF-8 encoding either by changing the encoding of the page itself to UTF-8 or by specifying accept-charset=utf-8 on the form element." {file: "' + resolveURL(tests[0]) + '" line: 1}]'
|
||||
];
|
||||
|
||||
function consoleError(msg) {
|
||||
|
Loading…
Reference in New Issue
Block a user