From b15fe723595219e0e31ec84af246446668d297c8 Mon Sep 17 00:00:00 2001 From: Gareth Aye Date: Tue, 8 Apr 2014 20:39:18 -0400 Subject: Bug 974554 - CalDAV parser should accept ical inside xml comments nested in elements --- caldav.js | 25 ++++++++++++++++++++----- 1 file changed, 20 insertions(+), 5 deletions(-) (limited to 'caldav.js') diff --git a/caldav.js b/caldav.js index 6f43d34..0f21ea6 100644 --- a/caldav.js +++ b/caldav.js @@ -1463,6 +1463,7 @@ function write (chunk) { var events = [ 'ontext', + 'oncdata', 'onopentag', 'onclosetag', 'onerror', @@ -1643,6 +1644,10 @@ function write (chunk) { this._fireHandler('ontext', data); }, + oncdata: function(data) { + this._fireHandler('oncdata', data); + }, + onerror: function(data) { //TODO: XXX implement handling of parsing errors. //unlikely but possible if server goes down @@ -2739,7 +2744,8 @@ function write (chunk) { (function(module, ns) { - var XHR = ns.require('xhr'); + var Caldav = ns.require('caldav'), + XHR = ns.require('xhr'); /** * Connection objects contain @@ -2941,12 +2947,21 @@ function write (chunk) { //value where key is local tag name //and value is the text. ontext: function(data) { - var handler = this.handler; - this.current[this.currentTag[handler.tagField]] = - CalendarDataHandler.parseICAL(data); - } + return CalendarDataHandler.ondata.call(this, data); + }, + + // Servers can also stash ical data inside of an xml cdata. + oncdata: function(data) { + return CalendarDataHandler.ondata.call(this, data); + }, }); + CalendarDataHandler.ondata = function(data) { + var handler = this.handler; + this.current[this.currentTag[handler.tagField]] = + CalendarDataHandler.parseICAL(data); + }; + /** * Default ical parser handler. * -- cgit