Closed Bug 1591113 Opened 5 years ago Closed 4 years ago

Remove support for third-party vibrate

Categories

(Core :: DOM: Device Interfaces, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla72
Tracking Status
firefox72 --- fixed

People

(Reporter: annevk, Assigned: tnguyen)

References

(Regressed 1 open bug, )

Details

(Keywords: dev-doc-complete, site-compat)

Attachments

(1 file)

navigator.vibrate() is supported on Android and has its own permission dialog. For bug 1572461 we would either need to support delegating this permission through the allow="" attribute or simply disallow requesting it in third-party contexts. Disabling is what we've been doing for most unusual permissions and seems reasonable here too.

Keywords: site-compat

James, could you confirm this is okay for mobile? Perhaps you should also review bug 1572461 as some of that likely impacts mobile too.

Flags: needinfo?(snorp)

Yeah, just disabling seems fine to me.

Flags: needinfo?(snorp)
Pushed by tnguyen@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/452d9227aee6
Remove support for third-party vibrate r=baku,snorp
Status: NEW → RESOLVED
Closed: 4 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla72
Assignee: nobody → tnguyen

Correct me if I'm wrong, but this patch uses {"vibration", nullptr, DelegatePolicy::ePersistDeniedCrossOrigin}, which for top-level documents ends up in https://searchfox.org/mozilla-central/rev/82c04b9cad5b98bdf682bd477f2b1e3071b004ad/extensions/permissions/PermissionDelegateHandler.cpp#290

Unless the permission is explicitly set, this fails for all origins by default, so navigator.vibrate() only works in chrome:// documents out of the box.

Fabrice, wouldn't that mean that navigator.storage.persist() also does not work (it does)?

navigator.storage.persist() works because we end up prompting the user to grant the permission with https://searchfox.org/mozilla-central/rev/1b95a0179507a4dc7d4b0c94c2df420dc1a72885/dom/quota/StorageManager.cpp#144

But navigator.vibrate() just silently returns true.

Regressions: 1653318

Cross posting on this same issue on Github; https://github.com/mozilla-mobile/fenix/issues/2371

As a [mostly] web dev w/ 25+ years experience, I have been waiting years for PWA's to really arrive. Put up a simple japa counter example this weekend, and it's amazing, seems finally ready for prime time. However, my favorite mobile browser and daily driver falls a bit short.

Firefox Mobile doesn't support the Vibrate API (again, as of March 9, 2022). Not due to an actual technical issue, but because it was disabled due to abuse by shady websites.

FF Mobile renders the PWA much better as a "real" app, changing the android notification bar the theme color. And of course, FF is my daily driver, and I evangelize whenever possible and would prefer to use it everywhere. However, lack of vibration API support really skews that. The fact that FF has a worse PWA developer experience than all the chromium derivatives seems wrong on many levels.

Looked at the Fenix source, after tracing several other bug reports w/ patches, but clearly, nothing for current code base. Kotlin isn't too crazy different to at least poke around. Closest hackable section I found was the QR code section, which imported the Android vibrate API, and is clearly coded to vibrate, but doesn't. So the disabling is elsewhere that I couldn't track down...

My understanding from parsing bug reports here, on Github, and reddit, is that Fenix developers disabled this due to abuse, not technical issues, and can't quite figure out how to properly surface a user permission prompt on a per site basis.

Seems like a test for "am I installed as a PWA" and "am I active" might be a workaround. This wouldn't solve the [apparently thorny] per site permission issue, but would give developers the FF powered mobile app we desire...

See Also: → 1810000
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: