diff --git a/contributors/dugite-code.md b/contributors/dugite-code.md new file mode 100644 index 00000000..dd3ed1a5 --- /dev/null +++ b/contributors/dugite-code.md @@ -0,0 +1,9 @@ +2018-08-21 + +I hereby agree to the terms of the "Markdown Here Individual Contributor License Agreement", commit 5bb51a296ed5b0d941ac381420a19ed02886ae21. + +I furthermore declare that I am authorized and able to make this agreement and sign this declaration. + +Signed, + +Dugite-Code https://github.com/dugite-code \ No newline at end of file diff --git a/src/common/options-store.js b/src/common/options-store.js index b741d833..447d8af5 100644 --- a/src/common/options-store.js +++ b/src/common/options-store.js @@ -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 diff --git a/src/firefox/chrome/content/background-services.js b/src/firefox/chrome/content/background-services.js index aff59a59..75270803 100644 --- a/src/firefox/chrome/content/background-services.js +++ b/src/firefox/chrome/content/background-services.js @@ -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. @@ -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 @@ -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; @@ -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) { } @@ -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( + 'last-version', + supportString.data); + } // Set the preference sync flags while we're at it. diff --git a/src/firefox/chrome/content/options.xul b/src/firefox/chrome/content/options.xul index d585f67c..19257a27 100644 --- a/src/firefox/chrome/content/options.xul +++ b/src/firefox/chrome/content/options.xul @@ -2,6 +2,7 @@ + resource://markdown_here_common/images/icon128.png https://github.com/adam-p/markdown-here - 1 chrome://markdown_here/content/options.xul