Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for strict mode (TB 60 compat) #7

Merged
merged 2 commits into from
Oct 23, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/chrome/content/calendarCreation.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
Expand Down Expand Up @@ -231,4 +233,4 @@ function cTBD_makeURL(aUriString) {
var ioSvc = Components.classes["@mozilla.org/network/io-service;1"].
getService(Components.interfaces.nsIIOService);
return ioSvc.newURI(aUriString, null, null);
}
}
4 changes: 3 additions & 1 deletion src/components/calThunderBirthDayModule.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
Expand Down Expand Up @@ -197,4 +199,4 @@ var calThunderBirthDayModule = {

function NSGetModule(aComponentManager, aFileSpec) {
return calThunderBirthDayModule;
}
}
4 changes: 3 additions & 1 deletion src/defaults/preferences/install.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
Expand Down Expand Up @@ -34,4 +36,4 @@
*
* ***** END LICENSE BLOCK ***** */

pref("extensions.{4C9FE6FE-2C83-11DC-90B4-DC8456D89593}.description", "chrome://thunderbirthday/locale/install.properties");
pref("extensions.{4C9FE6FE-2C83-11DC-90B4-DC8456D89593}.description", "chrome://thunderbirthday/locale/install.properties");
4 changes: 3 additions & 1 deletion src/defaults/preferences/user.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
Expand Down Expand Up @@ -34,4 +36,4 @@
*
* ***** END LICENSE BLOCK ***** */

pref("extensions.thunderbirthday.verbosity", 0);
pref("extensions.thunderbirthday.verbosity", 0);
8 changes: 4 additions & 4 deletions src/install.rdf
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@

<Description about="urn:mozilla:install-manifest">
<em:id>{4C9FE6FE-2C83-11DC-90B4-DC8456D89593}</em:id>
<em:version>0.8.2</em:version>
<em:version>0.8.3</em:version>
<em:type>2</em:type>

<em:name>ThunderBirthDay</em:name>
Expand All @@ -52,7 +52,7 @@
<em:contributor>www.icondrawer.com (icon)</em:contributor>
<em:iconURL>chrome://thunderbirthday/content/icon.png</em:iconURL>

<em:contributor>klemens (https://github.com/klemens)</em:contributor>
<em:contributor>Klemens Schölhorn</em:contributor>

<em:translator>agnetao (sv-SE)</em:translator>
<em:translator>Ahmed (ar)</em:translator>
Expand Down Expand Up @@ -82,7 +82,7 @@
<!-- Thunderbird -->
<em:id>{3550f703-e582-4d05-9a08-453d09bdfdc6}</em:id>
<em:minVersion>3.0</em:minVersion>
<em:maxVersion>38.*</em:maxVersion>
<em:maxVersion>60.*</em:maxVersion>
</Description>
<Description>
<!-- SeaMonkey -->
Expand All @@ -97,7 +97,7 @@
<!-- Lightning -->
<em:id>{e2fda1a4-762b-4020-b5ad-a41df1933103}</em:id>
<em:minVersion>1.0a1pre</em:minVersion>
<em:maxVersion>4.0.*</em:maxVersion>
<em:maxVersion>6.2.*</em:maxVersion>
</Description>
</em:requires>
</Description>
Expand Down
50 changes: 25 additions & 25 deletions src/js/calThunderBirthDay.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
"use strict";

/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
Expand Down Expand Up @@ -561,7 +563,7 @@ calThunderBirthDay.prototype = {

// Load all cards from the directory
while (abCardsEnum.hasMoreElements()) {
abCard = abCardsEnum.getNext()
var abCard = abCardsEnum.getNext()
.QueryInterface(Components.interfaces
.nsIAbCard);

Expand Down Expand Up @@ -788,15 +790,15 @@ calThunderBirthDay.prototype = {

// choose best field of the abCard for the title (one of these fields
// (except nickname) has to be set for every card)
with (abCard) var possibleTitles = [getProperty("DisplayName", null),
getProperty("NickName", null),
( getProperty("FirstName", null) && getProperty("LastName", null) ?
getProperty("FirstName", null) + " " + getProperty("LastName", null) :
null ),
getProperty("FirstName", null),
getProperty("LastName", null),
getProperty("PrimaryEmail", null),
getProperty("Company", null)]
var possibleTitles = [abCard.getProperty("DisplayName", null),
abCard.getProperty("NickName", null),
( abCard.getProperty("FirstName", null) && abCard.getProperty("LastName", null) ?
abCard.getProperty("FirstName", null) + " " + abCard.getProperty("LastName", null) :
null ),
abCard.getProperty("FirstName", null),
abCard.getProperty("LastName", null),
abCard.getProperty("PrimaryEmail", null),
abCard.getProperty("Company", null)]
for (var i = 0; i < possibleTitles.length; i++) {
if (possibleTitles[i]) {
event.title = possibleTitles[i];
Expand Down Expand Up @@ -894,13 +896,11 @@ function cTBD_getOccurencesFromEvent(aEvent, aRangeStart, aRangeEnd) {
for (var i = 0; i < occurrences.length; i++) {
occurrences[i] = occurrences[i].clone();

with (occurrences[i]) {
// append age to the title
var age = startDate.year - aEvent.startDate.year;
title += " (" + age + ")";

makeImmutable();
}
// append age to the title
var age = occurrences[i].startDate.year - aEvent.startDate.year;
occurrences[i].title += " (" + age + ")";

occurrences[i].makeImmutable();
}

return occurrences;
Expand Down Expand Up @@ -943,29 +943,29 @@ function cTBD_compareDatesInYear(aDateTime1, aDateTime2) {
* @param aMessage Message to be logged
*/
function MyLOG(aPriority, aMessage) {
if (this.mVerbosity == null) {
if (MyLOG.mVerbosity == null) {
// load verbosity from pref tree
this.mVerbosity = Components.classes["@mozilla.org/preferences-service;1"]
MyLOG.mVerbosity = Components.classes["@mozilla.org/preferences-service;1"]
.getService(Components.interfaces.nsIPrefService)
.getBranch("extensions.thunderbirthday.")
.getIntPref("verbosity");

// load console service
this.mConsoleService = Components.classes["@mozilla.org/consoleservice;1"]
MyLOG.mConsoleService = Components.classes["@mozilla.org/consoleservice;1"]
.getService(Components.interfaces
.nsIConsoleService);
}

if (aPriority <= this.mVerbosity) {
if (aPriority <= MyLOG.mVerbosity) {
if (aPriority == 0) {
Components.utils.reportError(aMessage);
} else {
this.mConsoleService.logStringMessage(aMessage);
MyLOG.mConsoleService.logStringMessage(aMessage);
}
}
}
MyLOG.prototype.mVerbosity = null;
MyLOG.prototype.mConsoleService = null;
MyLOG.mVerbosity = null;
MyLOG.mConsoleService = null;


/**
Expand Down Expand Up @@ -995,7 +995,7 @@ function md5(aString) {

// convert the binary hash data to a hex string.
var s = "";
for(i = 0; i < hash.length; i++) {
for(var i = 0; i < hash.length; i++) {
s += hash.charCodeAt(i).toString(16);
}

Expand Down