mdn / content

The content behind MDN Web Docs
https://developer.mozilla.org
Other
9.2k stars 22.49k forks source link

Issue with "NavigatorID.platform": (Marked as deprecated by mistake ?) #4417

Closed chrisribe closed 3 years ago

chrisribe commented 3 years ago

MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/NavigatorID/platform

What information was incorrect, unhelpful, or incomplete?

This is marked as deprecated and should not be

Specific section or headline?

Deprecated banner seen on the English version of the site.

What did you expect to see?

No banner based on this previous conversation about the issue. https://groups.google.com/g/mozilla.dev.mdc/c/tIx2iiH2u3o?pli=1

MDN Content page report details * Folder: `en-us/web/api/navigatorid/platform` * MDN URL: https://developer.mozilla.org/en-US/docs/Web/API/NavigatorID/platform * GitHub URL: https://github.com/mdn/content/blob/main/files/en-us/web/api/navigatorid/platform/index.html * Last commit: https://github.com/mdn/content/commit/6979d7bbf100aaa0ce77aac5436da72acf538fb8 * Document last modified: 2021-04-20T07:40:28.000Z
hamishwillee commented 3 years ago

Hi @chrisribe I recently added this back to match the browser compatibility data - which is more "canonical" than the MDN. The discussion here says why: https://github.com/mdn/browser-compat-data/commit/e7e3be9744f23d41cbc673a90f22d5f872ab44e7

@sideshowbarker you made that BCD change - do you have an opinion on this?

chrisribe commented 3 years ago

I was looking at other sources describing the api and they do not mark it as deprecated... confused.

https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_dom_d_.navigator.html#platform

https://developer.apple.com/documentation/webkitjs/navigatorid/2528123-platform

https://docs.w3cub.com/dom/navigatorid/platform

https://www.w3.org/TR/2013/CR-html5-20130806/webappapis.html#the-navigator-object

When I could not find the deprecated tag on w3 I started doubting if Mozilla was correct. Is it?

sideshowbarker commented 3 years ago

@sideshowbarker you made that BCD change - do you have an opinion on this?

It’s right to keep it marked as deprecated in MDN, just as it is in BCD.

And that reason it’s deprecated is that developers actually have on assurance that the browser is trying to return anything accurate or useful for it. That’s because the spec allows browsers to return the empty string for it if they choose to.

So by marking this as deprecated, the message we’re giving to developers is: Don’t rely on this.

The thing is, any browser that’s currently returning something accurate for it could at any time change its behavior — and that browser would still be conforming to the spec requirements.

And when a browser changes to returning an empty string for it, any code a developer wrote which assumes that value is not the empty string is going to break.

sideshowbarker commented 3 years ago

I was looking at other sources describing the api and they do not mark it as deprecated... confused.

microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules_typedoc_node_modules_typescript_lib_lib_domd.navigator.html#platform

developer.apple.com/documentation/webkitjs/navigatorid/2528123-platform

docs.w3cub.com/dom/navigatorid/platform

None of those are authoritative. They rightly should all be updated to match MDN and BCD.

w3.org/TR/2013/CR-html5-20130806/webappapis.html#the-navigator-object

That spec and any other HTML spec in https://www.w3.org/TR space is long obsolete. At this point, no HTML specs in https://www.w3.org/TR should ever be used, by anybody, for anything. They are all either years out of date at best, or at worst contain information that conflicts with the actual HTML standard.

https://html.spec.whatwg.org/multipage/system-state.html#dom-navigator-platform is the sole authoritative source on this. And as pointed out in my earlier comment, the reason navigator.platform is marked deprecated in MDN and BCD is to give developers a warning that they can’t rely on it being accurate, because browsers are allowed to return the empty string for it.

If if the spec doesn’t explicitly state that a feature as deprecated, that doesn’t mean we can’t mark it deprecated in MDN and BCD. The meaning of deprecated in MDN and BCD is different than the stricter definition that the spec uses. In MDN and BCD, if a feature is not something that developers can safely rely on behaving in the way they except, we mark it as deprecated — even if the spec does not.

The spec doesn’t mark any of the NavigatorID members as deprecated. navigator.appName and navigator.product are not marked in the spec as deprecated — yet very clearly, those are not feature that developers should be using. So we mark them as deprecated in MDN and BCD even though the spec doesn’t. And similarly for other questionable NavigatorID members.

sideshowbarker commented 3 years ago

Note also in the spec the following big red warning:

https://html.spec.whatwg.org/multipage/system-state.html#client-identification:tracking-vector

⚠ Warning

Any information in this API that varies from user to user can be used to profile the user. In fact, if enough such information is available, a user can actually be uniquely identified. For this reason, user agent implementers are strongly urged to include as little information in this API as possible.

Notice especially the “implementers are strongly urged to include as little information in this API as possible” part. What that’s essentially saying to browser vendors is: Despite whatever details you may now have NavigatorID providing, consider changing your browser behavior to provide even less details — for example, changing behavior to have navigator.platform return the empty string, rather than whatever value it’s currently returning.

hamishwillee commented 3 years ago

Thanks @sideshowbarker - appreciate the response. I'm convinced.

@chrisribe

chrisribe commented 3 years ago

Thanks @sideshowbarker and @hamishwillee for taking the time to document and explain all of this in a clear fashion.