Closed
Bug 1504893
Opened 6 years ago
Closed 6 years ago
Add a jsapi-test for omitting a line of context when it would be empty
Categories
(Core :: JavaScript Engine, enhancement, P2)
Core
JavaScript Engine
Tracking
()
RESOLVED
FIXED
mozilla65
Tracking | Status | |
---|---|---|
firefox65 | --- | fixed |
People
(Reporter: Waldo, Assigned: Waldo)
References
Details
Attachments
(2 files)
2.32 KB,
patch
|
arai
:
review+
|
Details | Diff | Splinter Review |
6.48 KB,
patch
|
arai
:
review+
|
Details | Diff | Splinter Review |
Empty line of context is going to be a Thing when there are Unicode errors in the rest of the line. An error immediately at the point of the error, means there's no window after the current offset. A line break immediately before the error, also means there's no window. When there's an empty line of context, we decline to add a line of context to the error report. This is something I did roughly in passing awhile back, but with encoding errors, it's probably a little more prominent. Add some tests for it.
Assignee | ||
Comment 1•6 years ago
|
||
I really wanted JS::Compile for this, so template-y algorithms could call JS::Compile and not think about the type of SourceText passed in. :-( But I don't think we can eschew the DontInflate suffix just yet.
Attachment #9022797 -
Flags: review?(arai.unmht)
Assignee | ||
Comment 2•6 years ago
|
||
Attachment #9022798 -
Flags: review?(arai.unmht)
Updated•6 years ago
|
Priority: -- → P2
Updated•6 years ago
|
Flags: needinfo?(arai.unmht)
Updated•6 years ago
|
Attachment #9022797 -
Flags: review?(arai.unmht) → review+
Comment 3•6 years ago
|
||
Comment on attachment 9022798 [details] [diff] [review] Add a jsapi-test for omitting a line of context when it would be empty Review of attachment 9022798 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jsapi-tests/testEmptyWindowIsOmitted.cpp @@ +133,5 @@ > + CHECK(!compile(chars, N - 1, &script)); > + > + JS::RootedValue exn(cx); > + CHECK(JS_GetPendingException(cx, &exn)); > + JS_ClearPendingException(cx); I wonder if it's better moving js::GetAndClearException to more accessible place (now it's in vm/Interpreter.h, but apparently usage is already not vm nor interpreter specific) @@ +165,5 @@ > + ++iter; > + CHECK(iter == notes->end()); > + } else { > + CHECK(sizeof(CharT) == 2); > + CHECK(!badCodeUnits); can you put some comment that UTF-16 compilation isn't supposed to add notes to error at this point? (to help someone hit this assertion in case it changes in the future)
Attachment #9022798 -
Flags: review?(arai.unmht) → review+
Updated•6 years ago
|
Flags: needinfo?(arai.unmht)
Comment 4•6 years ago
|
||
Comment on attachment 9022798 [details] [diff] [review] Add a jsapi-test for omitting a line of context when it would be empty Review of attachment 9022798 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/src/jsapi-tests/testEmptyWindowIsOmitted.cpp @@ +113,5 @@ > +bool > +compile(const CharT* chars, size_t len, JS::MutableHandleScript script) > +{ > + JS::RealmOptions globalOptions; > + JS::RootedObject global(cx, JS_NewGlobalObject(cx, getGlobalClass(), nullptr, what's the reason why you're manually creating another global here? JSAPITest has global which is already created in JSAPITest::init(), and also there's createGlobal method even if you need to create new one
Pushed by jwalden@mit.edu: https://hg.mozilla.org/integration/mozilla-inbound/rev/0252a8bad879 Implement JS::CompileDontInflate that takes JS::SourceText<Utf8Unit>& paralleling JS::Compile that takes JS::SourceText<char16_t>&. r=arai https://hg.mozilla.org/integration/mozilla-inbound/rev/97dadee2ab7c Add a jsapi-test for omitting a line of context when it would be empty. r=arai
Comment 6•6 years ago
|
||
bugherder |
https://hg.mozilla.org/mozilla-central/rev/0252a8bad879 https://hg.mozilla.org/mozilla-central/rev/97dadee2ab7c
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
status-firefox65:
--- → fixed
Resolution: --- → FIXED
Target Milestone: --- → mozilla65
You need to log in
before you can comment on or make changes to this bug.
Description
•