Skip to content

Commit

Permalink
Thunderbird 60 Fixes
Browse files Browse the repository at this point in the history
- CSS for the preference dialogs has moved
- NsISupportsString in setComplexValue() has been dropped in favour of setStringPref()
- Thunderbird 60 refusing explicit decliration of option type 1 in install.rdf
  • Loading branch information
dugite-code committed Aug 21, 2018
1 parent 6bdab32 commit 496c022
Show file tree
Hide file tree
Showing 4 changed files with 61 additions and 27 deletions.
14 changes: 10 additions & 4 deletions src/common/options-store.js
Original file line number Diff line number Diff line change
Expand Up @@ -327,10 +327,16 @@ var MozillaOptionsStore = {
}

try {
prefsObj[prefKeys[i]] = window.JSON.parse(
extPrefsBranch.getComplexValue(
prefKeys[i],
Components.interfaces.nsISupportsString).data);
if ( Services.vc.compare(Services.appinfo.platformVersion, '58') < 0 ) {
prefsObj[prefKeys[i]] = window.JSON.parse(
extPrefsBranch.getComplexValue(
prefKeys[i],
Components.interfaces.nsISupportsString).data);
} else {
prefsObj[prefKeys[i]] = window.JSON.parse(
extPrefsBranch.getStringPref(
prefKeys[i]));
}
}
catch(e) {
// Null values and empty strings will result in JSON exceptions
Expand Down
72 changes: 50 additions & 22 deletions src/firefox/chrome/content/background-services.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@
* No additional processing is done, like filling in default values.
*/


(function() {
"use strict";
/*global Components:false, AddonManager:false, markdown_here:false*/
/*jshint devel:true*/

var scriptLoader, imports = {};

// See comment in ff-overlay.js for info about module loading.
Expand Down Expand Up @@ -151,10 +149,16 @@ function prefsAccessRequestHandler(request) {
}

try {
prefsObj[prefKeys[i]] = JSON.parse(
extPrefsBranch.getComplexValue(
prefKeys[i],
Components.interfaces.nsISupportsString).data);
if ( Services.vc.compare(Services.appinfo.platformVersion, '58') < 0 ) {
prefsObj[prefKeys[i]] = JSON.parse(
extPrefsBranch.getComplexValue(
prefKeys[i],
Components.interfaces.nsISupportsString).data);
} else {
prefsObj[prefKeys[i]] = JSON.parse(
extPrefsBranch.getStringPref(
prefKeys[i]));
}
}
catch(e) {
// Null values and empty strings will result in JSON exceptions
Expand All @@ -167,10 +171,16 @@ function prefsAccessRequestHandler(request) {
else if (request.verb === 'set') {
for (var key in request.obj) {
supportString.data = JSON.stringify(request.obj[key]);
extPrefsBranch.setComplexValue(
key,
Components.interfaces.nsISupportsString,
supportString);
if ( Services.vc.compare(Services.appinfo.platformVersion, '58') < 0 ) {
extPrefsBranch.setComplexValue(
key,
Components.interfaces.nsISupportsString,
supportString);
} else {
extPrefsBranch.setStringPref(
key,
supportString.data);
}
}

return;
Expand Down Expand Up @@ -227,10 +237,16 @@ function updateHandler(currVer) {

var lastVersion = '';
try {
lastVersion = JSON.parse(
extPrefsBranch.getComplexValue(
'last-version',
Components.interfaces.nsISupportsString).data);
if ( Services.vc.compare(Services.appinfo.platformVersion, '58') < 0 ) {
lastVersion = JSON.parse(
extPrefsBranch.getComplexValue(
'last-version',
Components.interfaces.nsISupportsString).data);
} else {
lastVersion = JSON.parse(
extPrefsBranch.getStringPref(
'last-version'));
}
}
catch (ex) {
}
Expand All @@ -239,17 +255,29 @@ function updateHandler(currVer) {
var localFirstRun = !extPrefsBranch.prefHasUserValue('local-first-run');

supportString.data = JSON.stringify(false);
extPrefsBranch.setComplexValue(
'local-first-run',
Components.interfaces.nsISupportsString,
supportString);

if (currVer !== lastVersion) {
supportString.data = JSON.stringify(currVer);
if ( Services.vc.compare(Services.appinfo.platformVersion, '58') < 0 ) {
extPrefsBranch.setComplexValue(
'last-version',
'local-first-run',
Components.interfaces.nsISupportsString,
supportString);
} else {
extPrefsBranch.setStringPref(
'local-first-run',
supportString.data);
}

if (currVer !== lastVersion) {
supportString.data = JSON.stringify(currVer);
if ( Services.vc.compare(Services.appinfo.platformVersion, '58') < 0 ) {
extPrefsBranch.setComplexValue(
'last-version',
Components.interfaces.nsISupportsString,
supportString);
} else {
extPrefsBranch.setStringPref(
'local-first-run',
supportString.data);
}

// Set the preference sync flags while we're at it.

Expand Down
1 change: 1 addition & 0 deletions src/firefox/chrome/content/options.xul
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<!DOCTYPE overlay SYSTEM "chrome://markdown_here/locale/strings.dtd">

<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://messenger/skin/preferences/preferences.css" type="text/css"?>

<prefwindow id="markdown-here-options-intermediate"
title="&moz_options_dlg_title;"
Expand Down
1 change: 0 additions & 1 deletion src/install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,6 @@
<em:iconURL>resource://markdown_here_common/images/icon128.png</em:iconURL>
<em:homepageURL>https://github.com/adam-p/markdown-here</em:homepageURL>

<em:optionsType>1</em:optionsType>
<em:optionsURL>chrome://markdown_here/content/options.xul</em:optionsURL>

</Description>
Expand Down

0 comments on commit 496c022

Please sign in to comment.