Skip to content

Commit

Permalink
[OT-PW] Fix a crash in a layout test
Browse files Browse the repository at this point in the history
Currently the layout test parse-input-arguments-018.https.html is
crashing with virtual/threaded which runs off-thread paint worklet.
The problem is that CSSPaintImageGeneratorImpl::HasDocumentDefinition
does not check whether the definition is valid or not.

In particular, PaintWorkletProxyClient::RegisterCSSPaintDefinition
can register two different CSSPaintDefinition which would throw an
exception. But the |document_definition_map_| will still have an entry
for this CSSPaintDefinition and the value of the entry is nullptr.
In this case, the CSSPaintImageGeneratorImpl::HasDocumentDefinition
should return false.

Bug: 957459
Change-Id: Ic192676e537ce6b09bf56f244db61dac68598bff
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1662592
Commit-Queue: Xida Chen <xidachen@chromium.org>
Reviewed-by: Yi Gu <yigu@chromium.org>
Cr-Commit-Position: refs/heads/master@{#670217}
  • Loading branch information
xidachen authored and Commit Bot committed Jun 18, 2019
1 parent 53eab5a commit 93fbb71
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ scoped_refptr<Image> CSSPaintImageGeneratorImpl::Paint(
}

bool CSSPaintImageGeneratorImpl::HasDocumentDefinition() const {
return paint_worklet_->GetDocumentDefinitionMap().Contains(name_);
return paint_worklet_->GetDocumentDefinitionMap().at(name_);
}

bool CSSPaintImageGeneratorImpl::GetValidDocumentDefinition(
Expand All @@ -77,8 +77,8 @@ bool CSSPaintImageGeneratorImpl::GetValidDocumentDefinition(
DCHECK(definition);
return true;
}
if (definition && definition->GetRegisteredDefinitionCount() !=
PaintWorklet::kNumGlobalScopesPerThread) {
if (definition->GetRegisteredDefinitionCount() !=
PaintWorklet::kNumGlobalScopesPerThread) {
definition = nullptr;
return false;
}
Expand All @@ -91,8 +91,6 @@ unsigned CSSPaintImageGeneratorImpl::GetRegisteredDefinitionCountForTesting()
return 0;
DocumentPaintDefinition* definition =
paint_worklet_->GetDocumentDefinitionMap().at(name_);
if (!definition)
return 0;
return definition->GetRegisteredDefinitionCount();
}

Expand Down
1 change: 0 additions & 1 deletion third_party/blink/web_tests/TestExpectations
Original file line number Diff line number Diff line change
Expand Up @@ -4481,7 +4481,6 @@ crbug.com/957457 virtual/threaded/external/wpt/css/css-paint-api/background-imag
crbug.com/957457 virtual/threaded/external/wpt/css/css-paint-api/geometry-background-image-tiled-001.https.html [ Crash ]
crbug.com/957457 virtual/threaded/external/wpt/css/css-paint-api/invalid-image-pending-script.https.html [ Crash ]
crbug.com/957457 virtual/threaded/external/wpt/css/css-paint-api/paint2d-image.https.html [ Failure Timeout ]
crbug.com/957459 virtual/threaded/external/wpt/css/css-paint-api/parse-input-arguments-018.https.html [ Crash Failure ]
crbug.com/957459 virtual/threaded/external/wpt/css/css-paint-api/registered-property-interpolation-004.https.html [ Failure ]
crbug.com/957459 virtual/threaded/external/wpt/css/css-paint-api/registered-property-interpolation-010.https.html [ Failure ]
crbug.com/957459 virtual/threaded/external/wpt/css/css-paint-api/registered-property-stylemap.https.html [ Failure ]
Expand Down

0 comments on commit 93fbb71

Please sign in to comment.