Bug 39606

Summary: Land tests for <rdar://problem/3277733>: \ in JavaScript mishandled when encoding is Japanese
Product: WebKit Reporter: Alexey Proskuryakov <ap>
Component: Tools / TestsAssignee: Alexey Proskuryakov <ap>
Status: RESOLVED FIXED    
Severity: Normal CC: abarth, eric, hamaji, webkit.review.bot
Priority: P2    
Version: 528+ (Nightly build)   
Hardware: All   
OS: All   
Attachments:
Description Flags
proposed patch hamaji: review+

Description Alexey Proskuryakov 2010-05-24 11:15:55 PDT
This is an ancient bug, fixed before having regression tests became a policy.
Comment 1 Alexey Proskuryakov 2010-05-24 11:21:23 PDT
The bug itself was fixed in http://trac.webkit.org/changeset/4502.
Comment 2 Alexey Proskuryakov 2010-05-24 11:21:48 PDT
Created attachment 56906 [details]
proposed patch
Comment 3 Alexey Proskuryakov 2010-05-24 11:53:51 PDT
Note that this test behaves differently in browser - IE displays yen signs here, and it looks like bug 24906 didn't help this case.

The should be still fine for DumpRenderTree text-only mode.
Comment 4 Alexey Proskuryakov 2010-05-24 11:55:25 PDT
Maybe it's because the tests use Shift-JIS?
Comment 5 Shinichiro Hamaji 2010-05-27 07:23:36 PDT
Comment on attachment 56906 [details]
proposed patch

Looks good, except for a few style nitpicks.

LooksLayoutTests/fast/encoding/yentest.html:13
 +  // document.write("one backslash inline: " + "\" + "<br>");
We can remove this line?

LayoutTests/fast/encoding/resources/yentestexternal2.js:2
 +  document.write("two backslashes external: \\ <br>");
It would be better to indent lines in functions.


LayoutTests/fast/encoding/resources/yentestexternal2.js:1
 +  function writeYenExternal() {
It would be better to break line between () and { to be consistent with C++ coding style.

LayoutTests/fast/encoding/resources/yentestexternal.js:1
 +  function writeYenExternal() {
The same comment as yenexternal2.js
Comment 6 Shinichiro Hamaji 2010-05-27 07:29:10 PDT
(In reply to comment #4)
> Maybe it's because the tests use Shift-JIS?

Yes. Only EUC-JP and Shift_JIS_X0213-2000 contents are transcoded for now. I believe we should add at least Shift_JIS and ISO-2022-JP families.

FYI, I've never seen a website which specifies charset=Shift_JIS_X0213-2000 and I'm guessing the person who added Shift_JIS_X0213-2000 intended to add Shift_JIS...
Comment 7 Alexey Proskuryakov 2010-05-27 10:21:19 PDT
> Shift_JIS_X0213-2000 intended to add Shift_JIS...

It is also possible that at the time, encoding name was normalized by ICU, so Shift_JIS was actually covered.
Comment 8 Alexey Proskuryakov 2010-05-27 10:34:03 PDT
Committed <http://trac.webkit.org/changeset/60311>.

>  +  // document.write("one backslash inline: " + "\" + "<br>");
> We can remove this line?

Addressed the comments. I usually try to keep layout tests close to original form, because we get more accidental testing that way. If we never land commented out code, how would we be sure that it's not executed? And how would we know that non-indented code in functions works well? It's rather frequent that such accidental testing helps catch a bug.

But many others disagree with that approach, and prefer to keep layout tests clean.
Comment 9 WebKit Review Bot 2010-05-27 11:31:31 PDT
http://trac.webkit.org/changeset/60311 might have broken Qt Linux Release
Comment 10 Shinichiro Hamaji 2010-05-31 02:23:51 PDT
> >  +  // document.write("one backslash inline: " + "\" + "<br>");
> > We can remove this line?
> 
> Addressed the comments. I usually try to keep layout tests close to original form, because we get more accidental testing that way. If we never land commented out code, how would we be sure that it's not executed? And how would we know that non-indented code in functions works well? It's rather frequent that such accidental testing helps catch a bug.

Very interesting. Usually, I'm trying to create a small and clean layout tests to make the point of a test clearer. I can also understand your opinion. Having diversity in our tests could be helpful. Maybe we should land both tests when the original report is quite different from the minimal test?