Skip to content

Commit

Permalink
Fix a crash in AILanguageDetectorFactory::capabilities() called on a …
Browse files Browse the repository at this point in the history
…detached frame

- Add [RaisesException] EA to AILanguageDetectorFactory::capabilities(), raise an exception when no execution context is present;
- See if execution context is available before calling GetLanguageDetectionDriverRemote()
- Add a CHECK() within GetLanguageDetectionDriverRemote() to enforce that.

Bug: 384233287
Change-Id: I81486a91cf2cdc270562615ccbc4a91720ec3ff7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6289147
Commit-Queue: Andrey Kosyakov <[email protected]>
Reviewed-by: Mike Wasserman <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1423264}
  • Loading branch information
caseq authored and chromium-wpt-export-bot committed Feb 21, 2025
1 parent 61aa60a commit b26ba1d
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<title>Assures no crash upon call of LanguageDetectorFactory.capabilities() on a detached document</title>
<link rel="author" href="mailto:[email protected]">
<link rel="help" href="https://issues.chromium.org/issues/384233287">
<body>
<iframe src="about:blank"></iframe>
<script>
const factory = frames[0].ai.languageDetector;
document.getElementsByTagName("iframe")[0].remove();
factory.capabilities();
</script>
</body>

0 comments on commit b26ba1d

Please sign in to comment.