Closed Bug 1453647 Opened 2 years ago Closed 2 years ago
Unicode script as passed via -e into xpcshell isn't evaluated as UTF-8
59 bytes, text/x-review-board-request
Noticed while working on bug 1453596. When a script like in this case for Mochitests contains a unicode path, it cannot be accessed from inside an executed script by xpcshell because it's not found. James and Ted helped me to find the underlying cause: <jgraham> https://searchfox.org/mozilla-central/source/js/xpconnect/src/XPCShellImpl.cpp#971 <@ted> whimboo: yuck <whimboo> ted: i will have a look, but is there someone I could ask? <jgraham> I think you want to set opts.utf8 on the JSCOntext <jgraham> https://searchfox.org/mozilla-central/source/js/src/jsapi.cpp#4830 <jgraham> I mean generally the problem here is that the input could be any byte sequence and it doesn't have a defined encoding <whimboo> hm, interesting <whimboo> let me try that. thanks <@ted> jgraham: yeah i was just going to suggest that <@ted> jgraham: but! turns out someone thought of that and on windows argv** is already utf-8 <@ted> and on linux/macos we already assume the system encoding is utf-8 everywhere anyway <@ted> https://searchfox.org/mozilla-central/source/js/xpconnect/shell/xpcshell.cpp#22 <@ted> https://searchfox.org/mozilla-central/source/toolkit/xre/nsWindowsWMain.cpp#109 <@ted> so yeah, calling opts.setUTF8(true) should fix that
I pushed a try build with a possible fix: https://treeherder.mozilla.org/#/jobs?repo=try&revision=aa56b7238d1cbaaf81d8e1251b3d7bf912b4976a
I verified that this patch works like a charm. Will upload a patch in a minute.
Assignee: nobody → hskupin
Status: NEW → ASSIGNED
Comment on attachment 8967400 [details] Bug 1453647 - [xpcshell] Enforce utf-8 for evaluating injected script via -e argument. https://reviewboard.mozilla.org/r/236088/#review241884
Attachment #8967400 - Flags: review?(bzbarsky) → review+
Pushed by firstname.lastname@example.org: https://hg.mozilla.org/integration/autoland/rev/6d0f20a4aa1f [xpcshell] Enforce utf-8 for evaluating injected script via -e argument. r=bz
You need to log in before you can comment on or make changes to this bug.