mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 933885: make xpcshell dump() handle non-ASCII characters correctly. r=bz,ted
This commit is contained in:
parent
023958a6b3
commit
c4ed613c62
@ -121,7 +121,8 @@ Dump(JSContext *cx, unsigned argc, jsval *vp)
|
||||
if (!chars)
|
||||
return false;
|
||||
|
||||
NS_ConvertUTF16toUTF8 utf8str(reinterpret_cast<const PRUnichar*>(chars));
|
||||
NS_ConvertUTF16toUTF8 utf8str(reinterpret_cast<const PRUnichar*>(chars),
|
||||
length);
|
||||
#ifdef ANDROID
|
||||
__android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", utf8str.get());
|
||||
#endif
|
||||
|
@ -287,14 +287,22 @@ Dump(JSContext *cx, unsigned argc, jsval *vp)
|
||||
if (!str)
|
||||
return false;
|
||||
|
||||
JSAutoByteString bytes(cx, str);
|
||||
if (!bytes)
|
||||
size_t length;
|
||||
const jschar *chars = JS_GetStringCharsAndLength(cx, str, &length);
|
||||
if (!chars)
|
||||
return false;
|
||||
|
||||
NS_ConvertUTF16toUTF8 utf8str(reinterpret_cast<const PRUnichar*>(chars),
|
||||
length);
|
||||
#ifdef ANDROID
|
||||
__android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", bytes.ptr());
|
||||
__android_log_print(ANDROID_LOG_INFO, "Gecko", "%s", utf8str.get());
|
||||
#endif
|
||||
fputs(bytes.ptr(), gOutFile);
|
||||
#ifdef XP_WIN
|
||||
if (IsDebuggerPresent()) {
|
||||
OutputDebugStringW(reinterpret_cast<const PRUnichar*>(chars));
|
||||
}
|
||||
#endif
|
||||
fputs(utf8str.get(), gOutFile);
|
||||
fflush(gOutFile);
|
||||
return true;
|
||||
}
|
||||
|
@ -71,14 +71,6 @@ import manifestparser
|
||||
import mozcrash
|
||||
import mozinfo
|
||||
|
||||
# ---------------------------------------------------------------
|
||||
#TODO: replace this with json.loads when Python 2.6 is required.
|
||||
def parse_json(j):
|
||||
"""
|
||||
Awful hack to parse a restricted subset of JSON strings into Python dicts.
|
||||
"""
|
||||
return eval(j, {'true':True,'false':False,'null':None})
|
||||
|
||||
""" Control-C handling """
|
||||
gotSIGINT = False
|
||||
def markGotSIGINT(signum, stackFrame):
|
||||
@ -448,6 +440,9 @@ class XPCShellTestThread(Thread):
|
||||
human-readable log message. """
|
||||
message = self.message_from_line(line)
|
||||
|
||||
if isinstance(message, unicode):
|
||||
message = message.encode("utf-8")
|
||||
|
||||
if message.endswith('\n'):
|
||||
# A new line is always added by head.js to delimit messages,
|
||||
# however consumers will want to supply their own.
|
||||
@ -1251,7 +1246,7 @@ class XPCShellTests(object):
|
||||
if not os.path.isfile(mozInfoFile):
|
||||
self.log.error("Error: couldn't find mozinfo.json at '%s'. Perhaps you need to use --build-info-json?" % mozInfoFile)
|
||||
return False
|
||||
self.mozInfo = parse_json(open(mozInfoFile).read())
|
||||
self.mozInfo = json.loads(open(mozInfoFile).read())
|
||||
mozinfo.update(self.mozInfo)
|
||||
|
||||
# The appDirKey is a optional entry in either the default or individual test
|
||||
|
Loading…
Reference in New Issue
Block a user