Bug 25624 - REGRESSION(r33963-r33980): Function.toString preserves quote style, but it shouldn't
Summary: REGRESSION(r33963-r33980): Function.toString preserves quote style, but it sh...
Status: RESOLVED WONTFIX
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: All All
: P1 Normal
Assignee: Nobody
URL: http://www.greenmountaininn.com/?gcli...
Keywords: HasReduction, InRadar
Depends on:
Blocks:
 
Reported: 2009-05-07 12:08 PDT by jasneet
Modified: 2011-08-23 14:43 PDT (History)
10 users (show)

See Also:


Attachments
reduced testcase (777 bytes, text/html)
2009-05-07 12:08 PDT, jasneet
no flags Details
further reduced test case (142 bytes, text/html)
2009-05-12 07:50 PDT, Alexey Proskuryakov
no flags Details
fix (5.48 KB, patch)
2011-01-28 15:16 PST, chris reiss
ggaren: review-
Details | Formatted Diff | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description jasneet 2009-05-07 12:08:31 PDT
I Steps:
Go to http://www.greenmountaininn.com/?gclid=CMHY_rPpv5UCFQZqswodsj4hQg

II Issue:
Javascript code seen instead of normal content

III Conclusion:
The way single and double quotes are interpreted when one type of quotes are within another. Line sd+="<div style='"+rt+"'>"; is causing the issue.

IV Other Browsers:
IE7: ok
FF3: ok

V Nightly tested: 43092

Bug in Chromium : http://code.google.com/p/chromium/issues/detail?id=696
Comment 1 jasneet 2009-05-07 12:08:51 PDT
Created attachment 30107 [details]
reduced testcase
Comment 2 Alexey Proskuryakov 2009-05-08 13:30:06 PDT
This is a regression from Safari 3.
Comment 3 Alexey Proskuryakov 2009-05-08 13:30:52 PDT
<rdar://problem/6870599>
Comment 4 Alexey Proskuryakov 2009-05-12 07:50:12 PDT
Created attachment 30228 [details]
further reduced test case
Comment 5 Alexey Proskuryakov 2009-05-12 07:53:10 PDT
This is a regression in how Function.toString() prints string literals - previously, double quotes were always used, matching Firefox - but now, the original style of quotes is preserved.
Comment 6 David Kilzer (:ddkilzer) 2009-05-14 06:55:04 PDT
Internal autospade tool reports:

Works: r33963  Fails: r33980
Comment 7 chris reiss 2011-01-25 13:57:20 PST
starting on this ...
Comment 8 chris reiss 2011-01-28 15:16:55 PST
Created attachment 80505 [details]
fix

added a conversion function for this - hopefully in the right place and not too much wheel reinvention.
Comment 9 WebKit Review Bot 2011-01-28 15:19:48 PST
Attachment 80505 [details] did not pass style-queue:

Failed to run "['Tools/Scripts/check-webkit-style', '--diff-files', u'LayoutTests/ChangeLog', u'LayoutTests/fast..." exit_code: 1

Source/JavaScriptCore/runtime/FunctionPrototype.cpp:76:  Extra space before ) in for  [whitespace/parens] [5]
Source/JavaScriptCore/runtime/FunctionPrototype.cpp:85:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
Source/JavaScriptCore/runtime/FunctionPrototype.cpp:84:  Missing space before ( in switch(  [whitespace/parens] [5]
Source/JavaScriptCore/runtime/FunctionPrototype.cpp:87:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
Source/JavaScriptCore/runtime/FunctionPrototype.cpp:86:  Missing space before ( in switch(  [whitespace/parens] [5]
Source/JavaScriptCore/runtime/FunctionPrototype.cpp:107:  A case label should not be indented, but line up with its switch statement.  [whitespace/indent] [4]
Source/JavaScriptCore/runtime/FunctionPrototype.cpp:106:  Missing space before ( in switch(  [whitespace/parens] [5]
Total errors found: 7 in 5 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 10 Geoffrey Garen 2011-01-28 15:29:35 PST
Chris, I'm glad you made the effort to fix this, and I hate to say it, but do we really want to make this change?

It looks like the website this was reported against has since been fixed, and we've had no reports of this bug at other websites. I'd prefer not to go through contortions in JavaScriptCore to maintain compatibility with a poorly coded website that doesn't exist anymore.

In general, we made a choice a few years ago not to decompile or specially contort JavaScript in Function.prototype.toString. We just return the original string provided in source code. A bug or two has cropped up here and there from poorly coded websites, but we haven't seen one that justified going back on our strategy yet.
Comment 11 Gavin Barraclough 2011-08-23 14:43:43 PDT
I don't think we intend to change our current behavior here.  This website has fixed its content, I don't think we are aware of further compatibility issues, and it is not clear that additional processing of the source is a good idea.

Since neither the spec nor web compatibility require us to do this, I think the bug is probably invalid, but it seems clear to be at least won't fix.