Bug 1275679 - Add option to the HTTP Networking preferences to disable Lightning user-agent addition. ui-r=Ratty r=IanN,Ratty a=IanN

This commit is contained in:
rsx11m 2016-06-22 16:53:26 -05:00
Родитель a853e1fe82
Коммит fa71f2eec7
4 изменённых файлов: 53 добавлений и 1 удалений

Просмотреть файл

@ -3,10 +3,13 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
var gLightningUAold;
function Startup()
{
CheckPipelining();
CheckPipeliningProxy();
CheckLightningUA();
}
function CheckPipelining()
@ -24,3 +27,32 @@ function CheckPipeliningProxy()
var enabled = prefHTTPVersion.value == "1.1";
EnableElementById("enablePipeliningProxy", enabled, false);
}
// Lightning adds a UA token if calendar.useragent.extra is not empty.
// Checkbox is visible if Lightning is installed and enabled.
// Checkbox is checked if the pref contains any non-whitespace character.
function CheckLightningUA()
{
var prefLightningUA = document.getElementById("calendar.useragent.extra");
var boxLightningUA = document.getElementById("uaLightningShow");
if (prefLightningUA.defaultValue)
{
boxLightningUA.hidden = false;
boxLightningUA.checked = prefLightningUA.value.trim() != "";
boxLightningUA.disabled = prefLightningUA.locked;
gLightningUAold = prefLightningUA.hasUserValue ? prefLightningUA.value : null;
}
}
// If the checkbox is checked, use previous user-set or default value.
// If the checkbox is not checked, set the pref to an empty string.
function OnLightningChanged(aChecked)
{
var prefLightningUA = document.getElementById("calendar.useragent.extra");
if (aChecked && !gLightningUAold)
prefLightningUA.reset();
else
prefLightningUA.value = (aChecked && gLightningUAold) || "";
}

Просмотреть файл

@ -27,6 +27,9 @@
<preference id="general.useragent.compatMode.firefox"
name="general.useragent.compatMode.firefox"
type="bool"/>
<preference id="calendar.useragent.extra"
name="calendar.useragent.extra"
type="string"/>
</preferences>
<description>&prefPara;</description>
@ -87,7 +90,14 @@
label="&prefFirefoxCompat.label;"
accesskey="&prefFirefoxCompat.accesskey;"
preference="general.useragent.compatMode.firefox"/>
<checkbox id="uaLightningShow"
hidden="true"
label="&prefLightningShow.label;"
accesskey="&prefLightningShow.accesskey;"
oncommand="OnLightningChanged(this.checked);"/>
</groupbox>
<description>&prefCompatWarning;</description>
</prefpane>
</overlay>

Просмотреть файл

@ -503,12 +503,19 @@
<li><strong>User Agent String</strong>:
The identifier sent by &brandShortName; to all websites is used for
statistics about website usage but also sometimes to expose certain features
only to known browsers (a practice known as "sniffing").
only to known browsers (a practice known as "sniffing"). Consequently,
unchecking any of these boxes may result in websites or remote calendar
services not working properly.
<ul>
<li><strong>Advertise Firefox compatibility</strong>: If this is enabled,
&brandShortName; will identify itself as both &brandShortName; and also
compatible with Firefox. This allows websites that check for certain
browsers rather than certain functionality to work with &brandShortName;.</li>
<li><strong>Advertise Lightning installation</strong>: This option is
only available when the Lightning calendar extension is installed and
activated. If this is enabled, &brandShortName; will add information on
Lightning being installed and which version, thus calendaring websites
and/or remote calendar services can customize their communication.</li>
</ul>
</li>
</ul>

Просмотреть файл

@ -21,3 +21,6 @@
<!ENTITY prefUseragent.label "User Agent String">
<!ENTITY prefFirefoxCompat.label "Advertise Firefox compatibility">
<!ENTITY prefFirefoxCompat.accesskey "F">
<!ENTITY prefLightningShow.label "Advertise Lightning installation">
<!ENTITY prefLightningShow.accesskey "L">
<!ENTITY prefCompatWarning "WARNING: disabling these settings may result in websites or services not working properly.">