Closed Bug 1439805 Opened 6 years ago Closed 6 years ago

Implement CredentialsContainer.preventSilentAccess()

Categories

(Core :: DOM: Device Interfaces, defect, P2)

60 Branch
defect

Tracking

()

RESOLVED FIXED
mozilla60
Tracking Status
firefox59 --- disabled
firefox60 --- fixed

People

(Reporter: miketaylr, Assigned: ttaubert)

References

()

Details

Attachments

(1 file)

Originally reported @ https://github.com/webcompat/web-bugs/issues/15403

Maybe this better lives in Tech Evangelism or whatever. But filing so we have a record.

STR: 
1. go to delivery.panerabread.com
2. click rapid pick up

expected:
auth popup appears

actual:
> Error: e.navigator.credentials.preventSilentAccess is not a function

They have some feature detection code (gone wrong) that goes like this:

this.requireUserMediation = function() {
  return a.isBrowserCompatible() ? e.navigator.credentials.preventSilentAccess()     || e.navigator.credentials.requireUserMediation() : void 0
}

this.isBrowserCompatible = function() {
  return !_.isUndefined(e.navigator.credentials) && !_.isUndefined(e.fetch)
}

I guess we should try to get Panera to fix this... and be on the lookout for similar bustage.

There's a polyfill for preventSilentAccess that would throw (if we got that far) as well: https://github.com/webcompat/web-bugs/issues/15403#issuecomment-367192487 hopefully it's not popular...
ni? JC to be aware of the regression.
Flags: needinfo?(jjones)
Adam, would you be able to help us try to get in touch with Panera devs?

To fix this bug, they should do (at least?) two things in app.js:

requireUserMediation should be updated to test if `preventSilentAccess` and `requireUserMediation` exist as well, something like:

this.requireUserMediation = function() {
  return a.isBrowserCompatible() ? 
  e.navigator.credentials && "preventSilentAccess" in e.navigator.credentials ||
  e.navigator.credentials && "requireUserMediation" in e.navigator.credentais : void 0
}

And then their polyfill should test for the existence of requireUserMediation before trying to polyfill preventSilentAccess with it.

Something like:

if (navigator.credentials && 
    navigator.credentials.requireUserMediation && 
    !navigator.credentials.preventSilentAccess) {
...
Flags: needinfo?(astevenson)
JC, do we have a bug tracking preventSilentAccess?

The polyfill is not from Panera, but is something Google wrote: https://github.com/GoogleChromeLabs/cm-api-shim
Passing this to Tim, since I'm deep in meetings the rest of the week.
Flags: needinfo?(jjones) → needinfo?(ttaubert)
We should implemented Credential.preventSilentAccess(). requireUserMediation() is deprecated.
Blocks: 1384776
Flags: needinfo?(ttaubert)
Keywords: regression
Summary: Unable to log into Panera Bread since enabling navigator.credentials (60+) → Implement CredentialsContainer.preventSilentAccess()
Whiteboard: [webcompat]
Assignee: nobody → ttaubert
Status: NEW → ASSIGNED
Comment on attachment 8952686 [details]
Bug 1439805 - Implement CredentialsContainer.preventSilentAccess() r=jcj

J.C. Jones [:jcj] has approved the revision.

https://phabricator.services.mozilla.com/D629
Attachment #8952686 - Flags: review+
Oh awesome, thanks Tim! 

(No need to contact Panera if we can get this shipped in 60, Adam.)
Flags: needinfo?(astevenson)
Comment on attachment 8952686 [details]
Bug 1439805 - Implement CredentialsContainer.preventSilentAccess() r=jcj

Another WebIDL review, please :)
Attachment #8952686 - Flags: review?(bugs)
Comment on attachment 8952686 [details]
Bug 1439805 - Implement CredentialsContainer.preventSilentAccess() r=jcj

Olli Pettay [:smaug] has approved the revision.

https://phabricator.services.mozilla.com/D629
Attachment #8952686 - Flags: review+
Pushed by ttaubert@mozilla.com:
https://hg.mozilla.org/integration/mozilla-inbound/rev/2b09e9751108
Implement CredentialsContainer.preventSilentAccess() r=jcj,smaug
Priority: -- → P2
https://hg.mozilla.org/mozilla-central/rev/2b09e9751108
Status: ASSIGNED → RESOLVED
Closed: 6 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla60
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: