X
Tippen Sie hierhin, um die Version dieser Website für Mobilgeräte aufzurufen.
Scheduled maintenance: Thursday, April 2, between 3pm and 5pm UTC. This site will have limited functionality while we undergo maintenance to improve your experience. If an article doesn’t solve your issue and you want to ask a question, we have our support community waiting to help you at @firefox on Twitter

Hilfeforum

Since 0 evaluates to false (1 is true) why in God's name did you make media autoplay options like media.autoplay.default = 0 [0=Allowed, 1=Blocked, 2=Prompt]?

Veröffentlicht

If someone could explain the developer/user/common sense logic behind this implementation?

If someone could explain the developer/user/common sense logic behind this implementation?

Mehr Details zum System

Anwendung

  • User-Agent: Mozilla/5.0 (X11; Fedora; Linux x86_64; rv:65.0) Gecko/20100101 Firefox/65.0

Weitere Informationen

the-edmeister
  • Top 25 Contributor
  • Moderator
5433 Lösungen 40564 Antworten
Veröffentlicht

Hilfreiche Antwort

True and False is a 'toggle' for a pref. When the value has more that 2 choices or settings "logic" goes out the window.

Also, many times when default is used by Mozilla in the preference name the value of 0 or 1 is a double negative. We have seen a half-dozen or more prefs set up in that manner over the years.

True and False is a 'toggle' for a pref. When the value has more that 2 choices or settings "logic" goes out the window. Also, many times when '''default''' is used by Mozilla in the preference name the value of 0 or 1 is a double negative. We have seen a half-dozen or more prefs set up in that manner over the years.
Veröffentlicht

Fragesteller

Thanks for the answer but it still looks like some made-up excuse that leads to poor user experience, which requires you to search the state you need instead of just toggling it the way it's natural to be. It gets even worse when highly respected company like Mozilla polishing up things to make it look like it's right. A better solution could involve not using an integer f.ex. but rather some self-explanatory states like ['Allowed', 'Blocked', 'Prompt'] - there will not be that much people that will care what's exactly happening under the hood in this case.

Thanks for the answer but it still looks like some made-up excuse that leads to poor user experience, which requires you to search the state you need instead of just toggling it the way it's natural to be. It gets even worse when highly respected company like Mozilla polishing up things to make it look like it's right. A better solution could involve not using an integer f.ex. but rather some self-explanatory states like ['Allowed', 'Blocked', 'Prompt'] - there will not be that much people that will care what's exactly happening under the hood in this case.
cor-el
  • Top 10 Contributor
  • Moderator
17857 Lösungen 161589 Antworten
Veröffentlicht

Hilfreiche Antwort

It is easier to check in code for a zero value. Such decisions are usually based on making coding this as easy as possible. In this case zero means a default that allows to play media and nothing is blocked. The not zero state means either block or prompt, so only for a not zero state you need to take further action.

It is easier to check in code for a zero value. Such decisions are usually based on making coding this as easy as possible. In this case zero means a default that allows to play media and nothing is blocked. The not zero state means either block or prompt, so only for a not zero state you need to take further action.
Veröffentlicht

Fragesteller

OK, that's a valid statement since an integer comparison will be more efficient, comes with lower cost and applies perfectly for this programming case but then again my initial question was why an user app would implement something that misleading. Seriously the states could have been [0: 'Blocked', 1: 'Allowed', ...] and still the evaluation would be the same - 'if not 1 state...' with less ambiguity - just tweak it and go. Still thanks guys for your answers!

OK, that's a valid statement since an integer comparison will be more efficient, comes with lower cost and applies perfectly for this programming case but then again my initial question was why an user app would implement something that misleading. Seriously the states could have been [0: 'Blocked', 1: 'Allowed', ...] and still the evaluation would be the same - 'if not 1 state...' with less ambiguity - just tweak it and go. Still thanks guys for your answers!