Closed
Bug 366950
Opened 18 years ago
Closed 18 years ago
Double slash in a string causes error in evaluation
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
INVALID
People
(Reporter: yair, Unassigned)
Details
User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727)
Build Identifier: JavaScript-C 1.6 pre-release 1 2006-04-04
The following script causes evaluation errors:
var a = "\\";
Reproducible: Always
Steps to Reproduce:
The following code is my program:
int main (int argc, char **argv)
48 {
49 printf("hello1\n");
50 fflush(stdout);
51
52 JSRuntime * rt = JS_NewRuntime(0x100000);
53 JSContext * cx = JS_NewContext(rt, 0x1000);
54 JSClass global_class = {
55 "global",0,
56 JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,JS_PropertyStub,
57 JS_EnumerateStub,JS_ResolveStub,JS_ConvertStub,JS_FinalizeStub
58 };
59 JSObject * global = JS_NewObject(cx, &global_class, NULL, NULL);
60 JS_InitStandardClasses(cx, global);
61 jsval rval;
62
63
64 const char * script = "var test = \"\\\";";
65 int result = JS_EvaluateScript(cx, global, script, strlen(script), NULL, 0, &rval);
66 if (result)
67 {
68 JSString *str = JS_ValueToString(cx, rval);
69 printf("successfull interpreted: %s.\n", JS_GetStringBytes(str));
70 }
71 else
72 {
73 printf("failed to interpreter\n");
74 }
75 JS_DestroyContext(cx);
76 JS_DestroyRuntime(rt);
77 return 0;
78 }
Actual Results:
failed to interpreter
Comment 1•18 years ago
|
||
const char * script = "var test = \"\\\";";
equates to:
var test = "\";
which rightly should yield a syntax error (unterminated string literal). I believe this bug is invalid.
perhaps you meant:
const char * script = "var test = \"\\\\\";";
Status: UNCONFIRMED → RESOLVED
Closed: 18 years ago
Resolution: --- → INVALID
You need to log in
before you can comment on or make changes to this bug.
Description
•