Commit 82a5f866 authored by Kathleen Brade's avatar Kathleen Brade
Browse files

Bug 29440: Update about:tor when Tor Browser is updated

After the browser has been updated, notify the user by displaying
a message on the about:tor page. Also, in release and alpha builds,
include on the about:tor page below the Tor Browser version a link
to a simplified changelog page (which continues to be located at
about:tbupdate).
parent d45e7f50
......@@ -94,6 +94,17 @@ var AboutTorListener = {
else
body.removeAttribute("showmanual");
if (aData.updateChannel)
body.setAttribute("updatechannel", aData.updateChannel);
else
body.removeAttribute("updatechannel");
if (aData.hasBeenUpdated) {
body.setAttribute("hasbeenupdated", "yes");
content.document.getElementById("update-infolink").setAttribute("href",
aData.updateMoreInfoURL);
}
if (aData.mobile)
body.setAttribute("mobile", "yes");
......@@ -114,11 +125,11 @@ var AboutTorListener = {
.createBundle(kBrandBundle);
let productName = brandBundle.GetStringFromName("brandFullName");
let tbbVersion = Services.prefs.getCharPref("torbrowser.version");
elem = content.document.getElementById("torstatus-version");
let elem = content.document.getElementById("torbrowser-version");
while (elem.firstChild)
elem.removeChild(elem.firstChild);
elem.appendChild(content.document.createTextNode(productName + '\n'
elem.appendChild(content.document.createTextNode(productName + ' '
+ tbbVersion));
} catch (e) {}
}
......
......@@ -14,6 +14,8 @@
%globalDTD;
<!ENTITY % aboutTorDTD SYSTEM "chrome://torbutton/locale/aboutTor.dtd">
%aboutTorDTD;
<!ENTITY % tbUpdateDTD SYSTEM "chrome://browser/locale/aboutTBUpdate.dtd">
%tbUpdateDTD;
]>
<html xmlns="http://www.w3.org/1999/xhtml">
......@@ -33,15 +35,23 @@ window.addEventListener("pageshow", function() {
</head>
<body dir="&locale.dir;">
<div class="torcontent-container">
<div id="torstatus-version"/>
<div id="torbrowser-info">
<div id="torbrowser-version"/>
<div id="torbrowser-changelog-link"><a href="about:tbupdate">&aboutTor.viewChangelog.label;</a></div>
</div>
<img class="torcontent-logo" src="resource://torbutton-assets/torbrowser_mobile_logo.png"/>
<div id="torstatus" class="top">
<div id="torstatus-on-container" class="hideIfTorOff torstatus-container">
<div class="hideIfTorOff hideIfHasBeenUpdated torstatus-container">
<div class="heading1">&aboutTor.ready.label;</div>
<br/>
<div class="heading2">&aboutTor.ready2.label;</div>
</div>
<div id="torstatus-off-container" class="hideIfTorOn torstatus-container">
<div class="showIfHasBeenUpdated torstatus-container">
<div class="heading1">&aboutTBUpdate.updated;</div>
<br/>
<div class="heading2">&aboutTBUpdate.linkPrefix;<a id="update-infolink">&aboutTBUpdate.linkLabel;</a>&aboutTBUpdate.linkSuffix;</div>
</div>
<div class="hideIfTorOn torstatus-container">
<div class="heading1">&aboutTor.failure.label;</div>
<br/>
<div class="heading2">&aboutTor.failure2.label;</div>
......
......@@ -8,6 +8,7 @@
// http://kb.mozillazine.org/Links_to_local_pages_don%27t_work
let { Services } = Cu.import("resource://gre/modules/Services.jsm", {});
const {AppConstants} = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
let { showDialog, show_torbrowser_manual } = Cu.import("resource://torbutton/modules/utils.js", {});
let { unescapeTorString } = Cu.import("resource://torbutton/modules/utils.js", {});
let SecurityPrefs = Cu.import("resource://torbutton/modules/security-prefs.js", {});
......@@ -418,7 +419,7 @@ var torbutton_abouttor_message_handler = {
switch(aMessage.name) {
case "AboutTor:Loaded":
aMessage.target.messageManager.sendAsyncMessage("AboutTor:ChromeData",
this.chromeData);
this.getChromeData(true));
break;
}
},
......@@ -426,7 +427,7 @@ var torbutton_abouttor_message_handler = {
// Send privileged data to all of the about:tor content scripts.
updateAllOpenPages: function() {
window.messageManager.broadcastAsyncMessage("AboutTor:ChromeData",
this.chromeData);
this.getChromeData(false));
},
// The chrome data contains all of the data needed by the about:tor
......@@ -434,11 +435,32 @@ var torbutton_abouttor_message_handler = {
// It is sent to the content process when an about:tor window is opened
// and in response to events such as the browser noticing that Tor is
// not working.
get chromeData() {
return {
getChromeData: function(aIsRespondingToPageLoad) {
let dataObj = {
mobile: torbutton_is_mobile(),
updateChannel: AppConstants.MOZ_UPDATE_CHANNEL,
torOn: torbutton_tor_check_ok()
};
if (aIsRespondingToPageLoad) {
const kShouldNotifyPref = "torbrowser.post_update.shouldNotify";
if (m_tb_prefs.getBoolPref(kShouldNotifyPref, false)) {
m_tb_prefs.clearUserPref(kShouldNotifyPref);
dataObj.hasBeenUpdated = true;
dataObj.updateMoreInfoURL = this.getUpdateMoreInfoURL();
}
}
return dataObj;
},
getUpdateMoreInfoURL: function() {
try {
return Services.prefs.getCharPref("torbrowser.post_update.url");
} catch (e) {}
// Use the default URL as a fallback.
return Services.urlFormatter.formatURLPref("startup.homepage_override_url");
}
};
......
<!ENTITY aboutTBUpdate.title "Tor Browser Update">
<!ENTITY aboutTBUpdate.changelogTitle "Tor Browser Changelog">
<!ENTITY aboutTBUpdate.updated "Tor Browser has been updated.">
<!ENTITY aboutTBUpdate.linkPrefix "For the most up-to-date information about this release, ">
<!ENTITY aboutTBUpdate.linkLabel "visit our website">
<!ENTITY aboutTBUpdate.linkSuffix ".">
<!ENTITY aboutTBUpdate.changeLogHeading "Changelog:">
<!ENTITY aboutTBUpdate.version "Version">
<!ENTITY aboutTBUpdate.releaseDate "Release Date">
<!ENTITY aboutTBUpdate.releaseNotes "Release Notes">
......@@ -6,6 +6,8 @@
<!ENTITY aboutTor.title "About Tor">
<!ENTITY aboutTor.viewChangelog.label "View Changelog">
<!ENTITY aboutTor.ready.label "Explore. Privately.">
<!ENTITY aboutTor.ready2.label "You’re ready for the world’s most private browsing experience.">
<!ENTITY aboutTor.failure.label "Something Went Wrong!">
......
......@@ -60,16 +60,25 @@ body:not([initialized]) {
}
}
#torstatus-version {
#torbrowser-info {
position: absolute;
top: 6px;
offset-inline-end: 6px;
inset-inline-end: 6px;
height: 30px;
top: 16px;
offset-inline-end: 16px;
inset-inline-end: 16px;
height: 36px;
width: 200px;
font-size: 15px;
}
#torbrowser-info div {
font-size: 14px;
white-space: pre-wrap;
text-align: end;
margin-bottom: 6px;
}
/* Hide "View Changelog" link if update channel is not release or alpha. */
body:not([updatechannel="release"]):not([updatechannel="alpha"]) #torbrowser-changelog-link {
display: none;
}
a {
......@@ -79,15 +88,13 @@ a {
#torstatus {
margin-top: 135px;
display: flex;
justify-content: center;
flex-direction: column;
align-content: center;
justify-content: flex-end;
vertical-align: bottom;
min-height: 92px;
}
#torstatus > div {
align-self: flex-end; /* align text to bottom of container */
}
.top {
white-space: nowrap;
}
......@@ -96,11 +103,13 @@ a {
text-align: center;
}
body[hasbeenupdated] .hideIfHasBeenUpdated,
body[toron] .hideIfTorOn,
body:not([toron]) .hideIfTorOff {
display: none;
}
body:not([hasbeenupdated]) .showIfHasBeenUpdated,
body:not([showmanual]) .showForManual {
display: none;
}
......@@ -303,7 +312,7 @@ body:not([showmanual]) .showForManual {
display: none;
}
body[mobile] #torstatus-version,
body[mobile] #torbrowser-info,
body[mobile] .searchbox,
body[mobile] .top .heading2,
body[mobile] #manual,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment