Bug 371309 - Migration wizard explicitly sets a homepage which is wrong when using a partner distribution, r=gavin

This commit is contained in:
benjamin%smedbergs.us 2007-03-05 19:22:22 +00:00
Родитель a01d7203f6
Коммит 8a2f5c1f61
3 изменённых файлов: 29 добавлений и 73 удалений

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

@ -295,19 +295,14 @@ var MigrationWizard = {
onHomePageMigrationPageShow: function ()
{
// only want this on the first run
if (!this._autoMigrate)
if (!this._autoMigrate) {
this._wiz.advance();
return;
}
var numberOfChoices = 0;
try {
var bundle = document.getElementById("brandBundle");
var pageTitle = bundle.getString("homePageMigrationPageTitle");
var pageDesc = bundle.getString("homePageMigrationDescription");
var startPages = bundle.getString("homePageOptionCount");
} catch(ex) {}
if (!pageTitle || !pageDesc || !startPages || startPages < 1)
this._wiz.advance();
var bundle = document.getElementById("brandBundle");
var pageTitle = bundle.getString("homePageMigrationPageTitle");
var pageDesc = bundle.getString("homePageMigrationDescription");
document.getElementById("homePageImport").setAttribute("label", pageTitle);
document.getElementById("homePageImportDesc").setAttribute("value", pageDesc);
@ -315,36 +310,10 @@ var MigrationWizard = {
this._wiz._adjustWizardHeader();
var singleStart = document.getElementById("homePageSingleStart");
var i, mainStr, radioItem, radioItemId, radioItemLabel, radioItemValue;
if (startPages > 1) {
numberOfChoices += startPages;
this._multipleStartOptions = true;
mainStr = bundle.getString("homePageMultipleStartMain");
var multipleStart = document.getElementById("homePageMultipleStartMain");
multipleStart.setAttribute("label", mainStr);
multipleStart.hidden = false;
multipleStart.setAttribute("selected", true);
singleStart.hidden = true;
for (i = 1; i <= startPages; i++) {
radioItemId = "homePageMultipleStart" + i;
radioItemLabel = bundle.getString(radioItemId + "Label");
radioItemValue = bundle.getString(radioItemId + "URL");
radioItem = document.getElementById(radioItemId);
radioItem.hidden = false;
radioItem.setAttribute("label", radioItemLabel);
radioItem.setAttribute("value", radioItemValue);
}
}
else {
numberOfChoices++;
mainStr = bundle.getString("homePageSingleStartMain");
radioItemValue = bundle.getString("homePageSingleStartMainURL");
singleStart.setAttribute("label", mainStr);
singleStart.setAttribute("value", radioItemValue);
singleStart.setAttribute("selected", true);
}
var mainStr = bundle.getString("homePageSingleStartMain");
singleStart.setAttribute("label", mainStr);
singleStart.setAttribute("value", "DEFAULT");
var source = null;
switch (this._source) {
@ -372,7 +341,6 @@ var MigrationWizard = {
var oldHomePageURL = this._migrator.sourceHomePageURL;
if (oldHomePageURL && source) {
numberOfChoices++;
var bundle2 = document.getElementById("bundle");
var appName = bundle2.getString(source);
var oldHomePageLabel = bundle.getFormattedString("homePageImport",
@ -382,10 +350,10 @@ var MigrationWizard = {
oldHomePage.setAttribute("value", oldHomePageURL);
oldHomePage.removeAttribute("hidden");
}
// if we don't have at least two options, just advance
if (numberOfChoices < 2)
else {
// if we don't have at least two options, just advance
this._wiz.advance();
}
},
onHomePageMigrationPageAdvanced: function ()
@ -393,8 +361,6 @@ var MigrationWizard = {
// we might not have a selectedItem if we're in fallback mode
try {
var radioGroup = document.getElementById("homePageRadiogroup");
if (radioGroup.selectedItem.id == "homePageMultipleStartMain")
radioGroup = document.getElementById("multipleStartRadiogroup");
this._newHomePage = radioGroup.selectedItem.value;
} catch(ex) {}
@ -474,12 +440,21 @@ var MigrationWizard = {
var prefSvc = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService);
var prefBranch = prefSvc.getBranch(null);
var str = Components.classes["@mozilla.org/supports-string;1"]
if (this._newHomePage == "DEFAULT") {
try {
prefBranch.clearUserPref("browser.startup.homepage");
}
catch (e) { }
}
else {
var str = Components.classes["@mozilla.org/supports-string;1"]
.createInstance(Components.interfaces.nsISupportsString);
str.data = this._newHomePage;
prefBranch.setComplexValue("browser.startup.homepage",
Components.interfaces.nsISupportsString,
str);
str.data = this._newHomePage;
prefBranch.setComplexValue("browser.startup.homepage",
Components.interfaces.nsISupportsString,
str);
}
var dirSvc = Components.classes["@mozilla.org/file/directory_service;1"]
.getService(Components.interfaces.nsIProperties);

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

@ -143,14 +143,8 @@
<description id="homePageImportDesc" control="homePageRadioGroup"/>
<radiogroup id="homePageRadiogroup">
<radio id="homePageSingleStart"/>
<radio id="homePageMultipleStartMain" hidden="true"/>
<radiogroup id="multipleStartRadiogroup" class="indent">
<radio id="homePageMultipleStart1" hidden="true" selected="true"/>
<radio id="homePageMultipleStart2" hidden="true"/>
<radio id="homePageMultipleStart3" hidden="true"/>
</radiogroup>
<radio id="oldHomePage" hidden="true"/>
<radio id="homePageSingleStart" selected="true" />
<radio id="oldHomePage" hidden="true" />
</radiogroup>
</wizardpage>

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

@ -2,21 +2,8 @@ brandShortName=Firefox
brandFullName=Mozilla Firefox
vendorShortName=Mozilla
# the following section is used in the first-time migration wizard
# new and scary, however if these strings are not present, we will simply
# skip this wizard page
homePageOptionCount=1
homePageSingleStartMain=Firefox Start, a fast search page with search results by Google
#expand homePageSingleStartMainURL=http://en-us.start.mozilla.com/firefox?client=firefox-a&rls=__MOZ_DISTRIBUTION_ID_UNQUOTED__:__AB_CD__:official
homePageMultipleStartMain=
homePageMultipleStart1Label=
homePageMultipleStart1URL=
homePageMultipleStart2Label=
homePageMultipleStart2URL=
homePageMultipleStart3Label=
homePageMultipleStart3URL=
homePageSingleStartMain=Firefox Start, a fast home page with built-in search
homePageImport=Import your home page from %S
homePageMigrationPageTitle=Home Page Selection
homePageMigrationDescription=Please select the home page you wish to use:
# end safe-to-not-have section