Commit 87646f76 authored by Mathias Bynens's avatar Mathias Bynens Committed by Commit Bot

[inspector] Add support for the RegExp `d` flag

Prior to this patch, the RemoteObject for e.g. `/x/d` got a
`description` that omitted the new `d` (`hasIndices`) flag.

Bug: v8:11684, v8:9548
Change-Id: I774fbd9620c6f3f2f19b819c9009fab7cc2e3229
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2848460Reviewed-by: 's avatarYang Guo <yangguo@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
Cr-Commit-Position: refs/heads/master@{#74148}
parent 98300313
......@@ -202,6 +202,7 @@ String16 descriptionForRegExp(v8::Isolate* isolate,
description.append(toProtocolString(isolate, value->GetSource()));
description.append('/');
v8::RegExp::Flags flags = value->GetFlags();
if (flags & v8::RegExp::Flags::kHasIndices) description.append('d');
if (flags & v8::RegExp::Flags::kGlobal) description.append('g');
if (flags & v8::RegExp::Flags::kIgnoreCase) description.append('i');
if (flags & v8::RegExp::Flags::kLinear) description.append('l');
......
......@@ -397,6 +397,16 @@ Running test: testBigInt
}
Running test: testRegExp
'/w+/d', returnByValue: false, generatePreview: false
{
result : {
className : RegExp
description : /w+/d
objectId : <objectId>
subtype : regexp
type : object
}
}
'/w+/g', returnByValue: false, generatePreview: false
{
result : {
......@@ -457,11 +467,11 @@ Running test: testRegExp
type : object
}
}
'/w+/gimsuy', returnByValue: false, generatePreview: false
'/w+/dgimsuy', returnByValue: false, generatePreview: false
{
result : {
className : RegExp
description : /w+/gimsuy
description : /w+/dgimsuy
objectId : <objectId>
subtype : regexp
type : object
......
......@@ -200,6 +200,9 @@ InspectorTest.runAsyncTestSuite([
})).result);
},
async function testRegExp() {
InspectorTest.logMessage((await evaluate({
expression: '/\w+/d'
})).result);
InspectorTest.logMessage((await evaluate({
expression: '/\w+/g'
})).result);
......@@ -219,7 +222,7 @@ InspectorTest.runAsyncTestSuite([
expression: '/\w+/y'
})).result);
InspectorTest.logMessage((await evaluate({
expression: '/\w+/gimsuy'
expression: '/\w+/dgimsuy'
})).result);
InspectorTest.logMessage((await evaluate({
expression: `new RegExp('\\w+', 'g')`,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment