Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Fix string whitespace trimming of 0x200b and NEL character. (issue 11293277)
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  2 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
mstarzin...@chromium.org  
View profile  
 More options Nov 14 2012, 10:37 am
From: mstarzin...@chromium.org
Date: Wed, 14 Nov 2012 15:37:20 +0000
Local: Wed, Nov 14 2012 10:37 am
Subject: Fix string whitespace trimming of 0x200b and NEL character. (issue 11293277)
Reviewers: rossberg,

Description:
Fix string whitespace trimming of 0x200b and NEL character.

R=rossb...@chromium.org
BUG=v8:2408
TEST=mjsunit/regress/regress-2408,mjsunit/third_party/string-trim

Please review this at https://codereview.chromium.org/11293277/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files:
   M src/runtime.cc
   A + test/mjsunit/regress/regress-2408.js
   M test/mjsunit/third_party/string-trim.js

Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index  
de74f2ca6240d69f13fbd45df4d232a833ba3759..bb9a35406b2c2e5a689da5327696323cd 25b6443  
100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -6134,7 +6134,7 @@ RUNTIME_FUNCTION(MaybeObject*,  
Runtime_StringToUpperCase) {

  static inline bool IsTrimWhiteSpace(unibrow::uchar c) {
-  return unibrow::WhiteSpace::Is(c) || c == 0x200b || c == 0xfeff;
+  return (unibrow::WhiteSpace::Is(c) && c != 0x0085) || c == 0xfeff;
  }

Index: test/mjsunit/regress/regress-2408.js
diff --git a/src/platform-posix.h b/test/mjsunit/regress/regress-2408.js
similarity index 82%
copy from src/platform-posix.h
copy to test/mjsunit/regress/regress-2408.js
index  
7a982ed2ef3080dad77860d6f46b356a9067bf3b..dfd7c293d0921b25da11407b3cff101f4 d9bb414  
100644
--- a/src/platform-posix.h
+++ b/test/mjsunit/regress/regress-2408.js
@@ -25,15 +25,10 @@
  // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-#ifndef V8_PLATFORM_POSIX_H_
-#define V8_PLATFORM_POSIX_H_
+// The "Next Line (NEL)" character has the "White_Space" property  
according to
+// Unicode 6.1 but does not belong to the "Zs" category. Hence ECMA-262 5.1
+// specifies to not trim this character.

-namespace v8 {
-namespace internal {
-
-// Used by platform implementation files during OS::PostSetUp().
-void POSIXPostSetUp();
-
-} }  // namespace v8::internal
-
-#endif  // V8_PLATFORM_POSIX_H_
+assertEquals('\u0085'.trim(), '\u0085');
+assertEquals('\u0085'.trimLeft(), '\u0085');
+assertEquals('\u0085'.trimRight(), '\u0085');
Index: test/mjsunit/third_party/string-trim.js
diff --git a/test/mjsunit/third_party/string-trim.js  
b/test/mjsunit/third_party/string-trim.js
index  
234dff6dcd7608a0dcf0e3c26a7291d92b3a15f5..5170431a483b5ee8af3749db00a5c6207 67e6aef  
100644
--- a/test/mjsunit/third_party/string-trim.js
+++ b/test/mjsunit/third_party/string-trim.js
@@ -63,10 +63,12 @@ var whitespace      = [
    {s : '\u2008', t : 'PUNCTUATION SPACE'},
    {s : '\u2009', t : 'THIN SPACE'},
    {s : '\u200A', t : 'HAIR SPACE'},
-  {s : '\u3000', t : 'IDEOGRAPHIC SPACE'},
    {s : '\u2028', t : 'LINE SEPARATOR'},
    {s : '\u2029', t : 'PARAGRAPH SEPARATOR'},
-  {s : '\u200B', t : 'ZERO WIDTH SPACE (category Cf)'}
+  {s : '\u202F', t : 'NARROW NO-BREAK SPACE'},
+  {s : '\u205F', t : 'MEDIUM MATHEMATICAL SPACE'},
+  {s : '\u3000', t : 'IDEOGRAPHIC SPACE'},
+  {s : '\uFEFF', t : 'BYTE ORDER MARK'}
  ];

  for (var i = 0; i < whitespace.length; i++) {


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
rossb...@chromium.org  
View profile  
 More options Nov 14 2012, 10:44 am
From: rossb...@chromium.org
Date: Wed, 14 Nov 2012 15:44:03 +0000
Local: Wed, Nov 14 2012 10:44 am
Subject: Re: Fix string whitespace trimming of 0x200b and NEL character. (issue 11293277)
 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »