mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 430927 - Don't decompile to \0 as it was incorrectly interpreted as octal. r=waldo
This commit is contained in:
parent
aa3bb9941f
commit
43c95644be
@ -804,7 +804,6 @@ const char js_EscapeMap[] = {
|
||||
'"', '"',
|
||||
'\'', '\'',
|
||||
'\\', '\\',
|
||||
'\0', '0'
|
||||
};
|
||||
|
||||
#define DONT_ESCAPE 0x10000
|
||||
@ -852,7 +851,7 @@ QuoteString(Sprinter *sp, JSString *str, uint32 quote)
|
||||
/* Use js_EscapeMap, \u, or \x only if necessary. */
|
||||
bool ok;
|
||||
const char *e;
|
||||
if (!(c >> 8) && (e = strchr(js_EscapeMap, (int)c)) != NULL) {
|
||||
if (!(c >> 8) && c != 0 && (e = strchr(js_EscapeMap, (int)c)) != NULL) {
|
||||
ok = dontEscape
|
||||
? Sprint(sp, "%c", (char)c) >= 0
|
||||
: Sprint(sp, "\\%c", e[1]) >= 0;
|
||||
|
@ -61,3 +61,4 @@ script regress-677924.js
|
||||
skip-if(!xulRuntime.shell) script regress-696109.js
|
||||
script regress-691746.js
|
||||
script regress-697515.js
|
||||
script toSource-0.js
|
||||
|
14
js/src/tests/js1_8_5/extensions/toSource-0.js
Normal file
14
js/src/tests/js1_8_5/extensions/toSource-0.js
Normal file
@ -0,0 +1,14 @@
|
||||
/*
|
||||
* Any copyright is dedicated to the Public Domain.
|
||||
* http://creativecommons.org/licenses/publicdomain/
|
||||
*/
|
||||
|
||||
assertEq(eval(uneval('\x001')), '\x001');
|
||||
|
||||
f = eval('(' + (function () { return '\x001'; }).toString() + ')');
|
||||
assertEq(f(), '\x001');
|
||||
|
||||
assertEq(eval('\x001'.toSource()) == '\x001', true);
|
||||
|
||||
if (typeof reportCompare === 'function')
|
||||
reportCompare(true, true);
|
Loading…
Reference in New Issue
Block a user