Closed
Bug 474236
Opened 15 years ago
Closed 15 years ago
xpcshell/js shell don't wait for complete input
Categories
(Core :: JavaScript Engine, defect)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
People
(Reporter: roc, Assigned: mrbkap)
References
Details
(Keywords: fixed1.9.1, Whiteboard: fixed-in-tracemonkey)
Attachments
(1 file)
2.01 KB,
patch
|
brendan
:
review+
|
Details | Diff | Splinter Review |
meekness:bin roc$ ./js js> /* hello typein:1: SyntaxError: unterminated comment: typein:1: /* hello typein:1: ^ If I understand the code correctly, 'Process' is supposed to call JS_BufferIsCompilableUnit and keep reading lines until that returns true. But in this case, JS_BufferIsCompilableUnit is returning true for my input, which is obviously wrong.
Assignee | ||
Comment 1•15 years ago
|
||
Comment 2•15 years ago
|
||
Comment on attachment 357859 [details] [diff] [review] Proposed fix >diff --git a/js/src/jsparse.cpp b/js/src/jsparse.cpp >--- a/js/src/jsparse.cpp >+++ b/js/src/jsparse.cpp >@@ -1442,18 +1442,21 @@ Statements(JSContext *cx, JSTokenStream > tc->blockNode = pn; > PN_INIT_LIST(pn); > > for (;;) { > ts->flags |= TSF_OPERAND; > tt = js_PeekToken(cx, ts); > ts->flags &= ~TSF_OPERAND; > if (tt <= TOK_EOF || tt == TOK_RC) { >- if (tt == TOK_ERROR) >- return NULL; >+ if (tt == TOK_ERROR) { >+ if (ts->flags & TSF_EOF) >+ ts->flags |= TSF_UNEXPECTED_EOF; >+ return NULL; >+ } > break; > } > pn2 = Statement(cx, ts, tc); > if (!pn2) { > if (ts->flags & TSF_EOF) > ts->flags |= TSF_UNEXPECTED_EOF; > return NULL; > } Could you instead write this instead to share code? > if (tt <= TOK_EOF || tt == TOK_RC) { >+ if (tt != TOK_ERROR) > break; > } > pn2 = Statement(cx, ts, tc); > if (!pn2) { > if (ts->flags & TSF_EOF) > ts->flags |= TSF_UNEXPECTED_EOF; > return NULL; > } Blake pointed out that TSF_ERROR ensures stickyness. r=me with that (and maybe an assertion that the error stuck?). /be
Attachment #357859 -
Flags: review?(brendan) → review+
Assignee | ||
Comment 3•15 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/888dc199871c
Whiteboard: fixed-in-tracemonkey
Reporter | ||
Comment 4•15 years ago
|
||
Wouldn't it be trivial to write a test for this?
Assignee | ||
Comment 5•15 years ago
|
||
Hmm, as far as I know, we don't have any automated tests for JS_IsCompilableUnit.
Assignee | ||
Comment 6•15 years ago
|
||
http://hg.mozilla.org/tracemonkey/rev/f48a79146301 fixes the fallout from the first checkin :-/
Comment 7•15 years ago
|
||
http://hg.mozilla.org/mozilla-central/rev/888dc199871c
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → FIXED
Updated•15 years ago
|
Flags: wanted1.9.1?
Comment 8•15 years ago
|
||
http://hg.mozilla.org/releases/mozilla-1.9.1/rev/bdf0378ad4f8
Flags: wanted1.9.1? → wanted1.9.1+
Keywords: fixed1.9.1
Updated•15 years ago
|
Flags: in-testsuite-
Flags: in-litmus-
You need to log in
before you can comment on or make changes to this bug.
Description
•