Bug 1626739 - Set ical.js to use the new non-strict (lenient) mode. r=darktrojan
authorPaul Morris <paul@thunderbird.net>
Sat, 11 Apr 2020 13:50:53 +0300
changeset 38772 0f0c5a1c67f07885d4a38fc3d74c19ef6fc4d28f
parent 38771 de2bf949a75c5957685282c426ae4d88f36fd7d7
child 38773 9320f207dba3ae3c5a8d9c5429ad32bc2d4fa32c
push id401
push userclokep@gmail.com
push dateMon, 01 Jun 2020 20:41:59 +0000
reviewersdarktrojan
bugs1626739
Bug 1626739 - Set ical.js to use the new non-strict (lenient) mode. r=darktrojan
calendar/base/backend/calBackendLoader.js
calendar/base/content/calendar-chrome-startup.js
--- a/calendar/base/backend/calBackendLoader.js
+++ b/calendar/base/backend/calBackendLoader.js
@@ -16,17 +16,17 @@ function calBackendLoader() {
 
 calBackendLoader.prototype = {
   classID: Components.ID("{0314c271-7168-40fa-802e-83c8c46a557e}"),
   QueryInterface: ChromeUtils.generateQI([Ci.nsIObserver]),
 
   loaded: false,
 
   observe() {
-    // Nothing to do here, just need the entry so this is instantiated
+    // Nothing to do here, just need the entry so this is instantiated.
   },
 
   loadBackend() {
     if (this.loaded) {
       return;
     }
 
     if (Services.prefs.getBoolPref("calendar.icaljs", false)) {
@@ -46,19 +46,23 @@ calBackendLoader.prototype = {
       // sorts of problems. Just registering over it seems to work quite fine.
       let registrar = Components.manager.QueryInterface(Ci.nsIComponentRegistrar);
       for (let [contractID, classID] of Object.entries(contracts)) {
         let newClassID = Components.ID(classID);
         let newFactory = lazyFactoryFor(scope, newClassID);
         registrar.registerFactory(newClassID, "", contractID, newFactory);
       }
 
-      dump("[calBackendLoader] Using Lightning's icaljs backend\n");
+      // Set up ical.js to use non-strict (lenient) mode.
+      let { ICAL } = ChromeUtils.import("resource:///modules/calendar/Ical.jsm");
+      ICAL.design.strict = false;
+
+      dump("[calBackendLoader] Using Thunderbird's ical.js backend\n");
     } else {
-      dump("[calBackendLoader] Using Thunderbird's builtin libical backend\n");
+      dump("[calBackendLoader] Using Thunderbird's libical backend\n");
     }
 
     this.loaded = true;
   },
 };
 
 function lazyFactoryFor(backendScope, classID) {
   return {
--- a/calendar/base/content/calendar-chrome-startup.js
+++ b/calendar/base/content/calendar-chrome-startup.js
@@ -21,18 +21,16 @@
 var { Services } = ChromeUtils.import("resource://gre/modules/Services.jsm");
 var { AddonManager } = ChromeUtils.import("resource://gre/modules/AddonManager.jsm");
 var { AppConstants } = ChromeUtils.import("resource://gre/modules/AppConstants.jsm");
 var { cal } = ChromeUtils.import("resource:///modules/calendar/calUtils.jsm");
 var { calendarDeactivator } = ChromeUtils.import(
   "resource:///modules/calendar/calCalendarDeactivator.jsm"
 );
 
-/* exported commonInitCalendar, commonFinishCalendar */
-
 /**
  * Does calendar initialization steps for a given chrome window. Called at
  * startup as the application window is loaded, before tabs are restored.
  */
 async function loadCalendarComponent() {
   await uninstallLightningAddon();
 
   // Check if the binary component was loaded.