Fix RegExp.source for uncompiled regexp.
R=jkummerow@chromium.org BUG=435825 LOG=N Review URL: https://codereview.chromium.org/753983002 Cr-Commit-Position: refs/heads/master@{#25476}
This commit is contained in:
parent
9b5c279b9f
commit
14a3b9188d
@ -385,14 +385,17 @@ void Accessors::RegExpSourceGetter(
|
||||
Handle<Object> receiver =
|
||||
Utils::OpenHandle(*v8::Local<v8::Value>(info.This()));
|
||||
Handle<JSRegExp> regexp = Handle<JSRegExp>::cast(receiver);
|
||||
Handle<String> result;
|
||||
if (regexp->TypeTag() == JSRegExp::NOT_COMPILED) {
|
||||
result = isolate->factory()->empty_string();
|
||||
} else {
|
||||
Handle<String> pattern(regexp->Pattern(), isolate);
|
||||
MaybeHandle<String> maybe = EscapeRegExpSource(isolate, pattern);
|
||||
|
||||
Handle<String> result;
|
||||
if (!maybe.ToHandle(&result)) {
|
||||
isolate->OptionalRescheduleException(false);
|
||||
return;
|
||||
}
|
||||
}
|
||||
info.GetReturnValue().Set(Utils::ToLocal(result));
|
||||
}
|
||||
|
||||
|
11
test/mjsunit/regress/regress-crbug-435825.js
Normal file
11
test/mjsunit/regress/regress-crbug-435825.js
Normal file
@ -0,0 +1,11 @@
|
||||
// Copyright 2014 the V8 project authors. All rights reserved.
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
Error.prepareStackTrace = function (a,b) { return b; };
|
||||
|
||||
try {
|
||||
/(invalid regexp/;
|
||||
} catch (e) {
|
||||
e.stack[0].getThis().toString();
|
||||
}
|
Loading…
Reference in New Issue
Block a user