⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 184083 in webkit


Ignore:
Timestamp:
May 11, 2015, 5:10:06 AM (11 years ago)
Author:
Carlos Garcia Campos
Message:

Merge r182872 - String.prototype.startsWith/endsWith/includes have wrong length in r182673
https://bugs.webkit.org/show_bug.cgi?id=143659

Patch by Jordan Harband <ljharb@gmail.com> on 2015-04-15
Reviewed by Benjamin Poulain.

Source/JavaScriptCore:

Fix lengths of String.prototype.{includes,startsWith,endsWith} per spec
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.includes
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.startswith
https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.endswith

  • runtime/StringPrototype.cpp:

(JSC::StringPrototype::finishCreation):

LayoutTests:

  • js/script-tests/string-includes.js:
  • js/string-includes-expected.txt:
Location:
releases/WebKitGTK/webkit-2.8
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • releases/WebKitGTK/webkit-2.8/LayoutTests/ChangeLog

    r184082 r184083  
     12015-04-15  Jordan Harband  <ljharb@gmail.com>
     2
     3        String.prototype.startsWith/endsWith/includes have wrong length in r182673
     4        https://bugs.webkit.org/show_bug.cgi?id=143659
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        * js/script-tests/string-includes.js:
     9        * js/string-includes-expected.txt:
     10
    1112015-04-15  Jordan Harband  <ljharb@gmail.com>
    212
  • releases/WebKitGTK/webkit-2.8/LayoutTests/js/script-tests/string-includes.js

    r181236 r184083  
    22
    33// Test includes
     4shouldBe("String.prototype.includes.length", "1");
    45shouldBe("'foo bar'.includes('bar')", "true");
    56shouldBe("'foo bar'.includes('bar', 4)", "true");
     
    3233
    3334// Test startsWith
     35shouldBe("String.prototype.startsWith.length", "1");
    3436shouldBe("'foo bar'.startsWith('foo')", "true");
    3537shouldBe("'foo bar'.startsWith('foo', 0)", "true");
     
    6163
    6264// Test endsWith
     65shouldBe("String.prototype.endsWith.length", "1");
    6366shouldBe("'foo bar'.endsWith('bar')", "true");
    6467shouldBe("'foo bar'.endsWith('ba', 6)", "true");
  • releases/WebKitGTK/webkit-2.8/LayoutTests/js/string-includes-expected.txt

    r181236 r184083  
    44
    55
     6PASS String.prototype.includes.length is 1
    67PASS 'foo bar'.includes('bar') is true
    78PASS 'foo bar'.includes('bar', 4) is true
     
    3233PASS 'フーバー'.includes('ーバ') is true
    3334PASS 'フーバー'.includes('クー') is false
     35PASS String.prototype.startsWith.length is 1
    3436PASS 'foo bar'.startsWith('foo') is true
    3537PASS 'foo bar'.startsWith('foo', 0) is true
     
    5961PASS 'foo bar'.startsWith('フー') is false
    6062PASS 'foo bar'.startsWith('フー', 1) is false
     63PASS String.prototype.endsWith.length is 1
    6164PASS 'foo bar'.endsWith('bar') is true
    6265PASS 'foo bar'.endsWith('ba', 6) is true
  • releases/WebKitGTK/webkit-2.8/Source/JavaScriptCore/ChangeLog

    r184082 r184083  
     12015-04-15  Jordan Harband  <ljharb@gmail.com>
     2
     3        String.prototype.startsWith/endsWith/includes have wrong length in r182673
     4        https://bugs.webkit.org/show_bug.cgi?id=143659
     5
     6        Reviewed by Benjamin Poulain.
     7
     8        Fix lengths of String.prototype.{includes,startsWith,endsWith} per spec
     9        https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.includes
     10        https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.startswith
     11        https://people.mozilla.org/~jorendorff/es6-draft.html#sec-string.prototype.endswith
     12
     13        * runtime/StringPrototype.cpp:
     14        (JSC::StringPrototype::finishCreation):
     15
    1162015-04-15  Jordan Harband  <ljharb@gmail.com>
    217
  • releases/WebKitGTK/webkit-2.8/Source/JavaScriptCore/runtime/StringPrototype.cpp

    r181236 r184083  
    33 *  Copyright (C) 2004, 2005, 2006, 2007, 2008, 2013 Apple Inc. All rights reserved.
    44 *  Copyright (C) 2009 Torch Mobile, Inc.
     5 *  Copyright (C) 2015 Jordan Harband (ljharb@gmail.com)
    56 *
    67 *  This library is free software; you can redistribute it and/or
     
    138139    JSC_NATIVE_FUNCTION("trimLeft", stringProtoFuncTrimLeft, DontEnum, 0);
    139140    JSC_NATIVE_FUNCTION("trimRight", stringProtoFuncTrimRight, DontEnum, 0);
    140     JSC_NATIVE_FUNCTION("startsWith", stringProtoFuncStartsWith, DontEnum, 0);
    141     JSC_NATIVE_FUNCTION("endsWith", stringProtoFuncEndsWith, DontEnum, 0);
    142     JSC_NATIVE_FUNCTION("includes", stringProtoFuncIncludes, DontEnum, 0);
     141    JSC_NATIVE_FUNCTION("startsWith", stringProtoFuncStartsWith, DontEnum, 1);
     142    JSC_NATIVE_FUNCTION("endsWith", stringProtoFuncEndsWith, DontEnum, 1);
     143    JSC_NATIVE_FUNCTION("includes", stringProtoFuncIncludes, DontEnum, 1);
    143144
    144145    // The constructor will be added later, after StringConstructor has been built
Note: See TracChangeset for help on using the changeset viewer.