Bug 1289050 - Part 3: Use UTF8 variant of JS_ReportError after re-encoding string. r=jwalden

This commit is contained in:
Tooru Fujisawa
2016-08-15 19:20:04 +09:00
parent 4cc046bb4b
commit 16ad9b187b
11 changed files with 71 additions and 52 deletions

View File

@@ -150,7 +150,10 @@ Load(JSContext *cx,
return false;
FILE *file = fopen(filename.ptr(), "r");
if (!file) {
JS_ReportError(cx, "cannot open file '%s' for reading", filename.ptr());
filename.clear();
if (!filename.encodeUtf8(cx, str))
return false;
JS_ReportErrorUTF8(cx, "cannot open file '%s' for reading", filename.ptr());
return false;
}
JS::CompileOptions options(cx);