Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(759)

Unified Diff: src/regexp-delay.js

Issue 13088: Follow jsc in throwing an exception when using test or exec on a... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: '' Created 12 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/messages.js ('k') | test/mjsunit/mjsunit.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp-delay.js
===================================================================
--- src/regexp-delay.js (revision 905)
+++ src/regexp-delay.js (working copy)
@@ -163,6 +163,9 @@
function RegExpExec(string) {
if (%_ArgumentsLength() == 0) {
+ if (IS_UNDEFINED(regExpInput)) {
+ throw MakeError('no_input_to_regexp', [this]);
+ }
string = regExpInput;
}
var s = ToString(string);
@@ -283,7 +286,7 @@
// the last successful match.
var regExpCaptures = [0, 0];
var regExpSubject = '';
-var regExpInput = "";
+var regExpInput;
// -------------------------------------------------------------------
@@ -308,13 +311,11 @@
%FunctionSetLength($RegExp.prototype.compile, 1);
// The properties input, $input, and $_ are aliases for each other. When this
- // value is set in SpiderMonkey, the value it is set to is coerced to a
- // string. We mimic that behavior with a slight difference: in SpiderMonkey
- // the value of the expression 'RegExp.input = null' (for instance) is the
- // string "null" (ie, the value after coercion), while in V8 it is the value
- // null (ie, the value before coercion).
+ // value is set the value it is set to is coerced to a string.
// Getter and setter for the input.
- function RegExpGetInput() { return regExpInput; }
+ function RegExpGetInput() {
+ return IS_UNDEFINED(regExpInput) ? "" : regExpInput;
+ }
function RegExpSetInput(string) { regExpInput = ToString(string); }
%DefineAccessor($RegExp, 'input', GETTER, RegExpGetInput, DONT_DELETE);
« no previous file with comments | « src/messages.js ('k') | test/mjsunit/mjsunit.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698