Skip to content

Commit 7357fe1

Browse files
add support for clearing all geolocation watch (#252)
task: https://app.asana.com/0/1201048563534612/1203514593845595/f cc: @q71114 @jonathanKingston It's a windows only change, which adds support for clearing all registered geolocation watches.
1 parent cec60d4 commit 7357fe1

File tree

8 files changed

+134
-15
lines changed

8 files changed

+134
-15
lines changed

Sources/ContentScopeScripts/dist/contentScope.js

+19-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/android/contentScope.js

+19-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/chrome-mv3/inject.js

+19-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/chrome/inject.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/firefox/inject.js

+19-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/integration/contentScope.js

+19-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build/windows/contentScope.js

+19-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/features/windows-permission-usage.js

+19-2
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,14 @@ export function init () {
9090
}
9191
}
9292

93+
function stopTracks (streamTracks) {
94+
streamTracks?.forEach(track => track.stop())
95+
}
96+
97+
function clearAllGeolocationWatch () {
98+
watchedPositions.forEach(id => navigator.geolocation.clearWatch(id))
99+
}
100+
93101
function pause (permission) {
94102
const streamTracks = getTracks(permission)
95103
streamTracks?.forEach(track => {
@@ -105,8 +113,17 @@ export function init () {
105113
}
106114

107115
function stop (permission) {
108-
const streamTracks = getTracks(permission)
109-
streamTracks?.forEach(track => track.stop())
116+
switch (permission) {
117+
case Permission.Camera:
118+
stopTracks(videoTracks)
119+
break
120+
case Permission.Microphone:
121+
stopTracks(audioTracks)
122+
break
123+
case Permission.Geolocation:
124+
clearAllGeolocationWatch()
125+
break
126+
}
110127
}
111128

112129
function monitorTrack (track) {

0 commit comments

Comments
 (0)