Chromium Code Reviews| Index: src/js/regexp.js |
| diff --git a/src/js/regexp.js b/src/js/regexp.js |
| index a456952ef37ba6ee5797f546256f904e551ec900..b6b0ad46daabea38a8714935de31a5d2eeb3917e 100644 |
| --- a/src/js/regexp.js |
| +++ b/src/js/regexp.js |
| @@ -278,8 +278,11 @@ function RegExpToString() { |
| %IncrementUseCounter(kRegExpPrototypeToString); |
| return '/(?:)/'; |
| } |
| - throw MakeTypeError(kIncompatibleMethodReceiver, |
| - 'RegExp.prototype.toString', this); |
| + if (!IS_OBJECT(this)) { |
|
Toon Verwaest
2016/02/10 10:11:21
This should be IS_RECEIVER or so. IS_OBJECT is jus
|
| + throw MakeTypeError( |
| + kIncompatibleMethodReceiver, 'RegExp.prototype.toString', this); |
| + } |
| + return '/' + TO_STRING(this.pattern()) + '/' + TO_STRING(this.flags()); |
| } |
| var result = '/' + REGEXP_SOURCE(this) + '/'; |
| if (REGEXP_GLOBAL(this)) result += 'g'; |