Skip to content

Commit

Permalink
Backport an upstream fix for geolocation crash.
Browse files Browse the repository at this point in the history
Backport of https://chromium-review.googlesource.com/c/chromium/src/+/5840695

Fixes brave/brave-browser#41859

Pre-approval checklist:
- [ ] You have tested your change on Nightly.
- [ ] This contains text which needs to be translated.
    - [ ] There are more than 7 days before the release.
    - [ ] I've notified folks in #l10n on Slack that translations are needed.
- [ ] The PR milestones match the branch they are landing to.

Pre-merge checklist:
- [ ] You have checked CI and the builds, lint, and tests all pass or are not related to your PR.

Post-merge checklist:
- [ ] The associated issue milestone is set to the smallest version that the changes is landed on.
  • Loading branch information
iefremov committed Oct 28, 2024
1 parent ae30f5b commit 22d8a25
Showing 1 changed file with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
diff --git a/third_party/blink/renderer/modules/geolocation/geolocation.cc b/third_party/blink/renderer/modules/geolocation/geolocation.cc
index 223049e27395830a64f80ac67ccf435793e3f1e3..c7d247a700167f8215648bcb4fd43836f8507b40 100644
--- a/third_party/blink/renderer/modules/geolocation/geolocation.cc
+++ b/third_party/blink/renderer/modules/geolocation/geolocation.cc
@@ -90,10 +90,12 @@ GeolocationPositionError* CreatePositionError(
error_code = GeolocationPositionError::kPositionUnavailable;
break;
default:
- // On Blink side, it should only handles W3C defined error codes.
- // If it reaches here that means an unexpected error type being propagated
- // to Blink. This should never happen.
- NOTREACHED_NORETURN();
+ // On the Blink side, it should only handle W3C-defined error codes. If it
+ // reaches here, that means a platform-specific error type is being
+ // propagated to Blink. We will now just use kPositionUnavailable until
+ // more explicit error codes are defined in the W3C spec.
+ error_code = GeolocationPositionError::kPositionUnavailable;
+ break;
}
return MakeGarbageCollected<GeolocationPositionError>(error_code,
error.error_message);

0 comments on commit 22d8a25

Please sign in to comment.