Re: [GSOC 2016] persisting tabs across app restart
Philipp Kewisch <[email protected]> Mon, 27 Jun 2016 08:42:24 +0200
| Newsgroups | gmane.comp.mozilla.devel.calendar |
|---|---|
| Message-ID | <[email protected]> |
Hi Paul, the initialStartDateValue are calIDateTime, so all you'd have to do is serialize that using initialStartDateValue.icalString and then later on use cal.createDateTime(serializedValue) to restore it. You may also need to save the timezone id, either separately or by serializing to a calIIcalProperty. Similar for the others, calendarEvent is calIItemBase (specifically calIEvent, calITodo), and calendar is a calICalendar. Regarding the hashId, while the format seems quite clear, it should not be relied on to split apart the item id. The intent of the hashId was to have something that can easily be usable in a dict. Instead, save the calendar id and item id, then use the calendar manager to get the calendar, and the getItem() method to retrieve the item. Since you have those ids then anyway, you could use that to serialize the calendarEvent and calendar. Philipp On 6/27/16 5:18 AM, Paul wrote: > Hi, I'm working on persisting tabs across app restart, for the event in > a tab project. > > The basic mechanism in the tabmail interface is to save a JS object that > contains the tab data/state as a JS object with the persistTab function > and then in the restoretab function use that data/state in a call to > openTab. > > So what we want to store is the same as the aArgs argument to openTab, > which we kept when opening the tab (as window.arguments[0] from within > the iframe). Seems simple enough, but... > > In that aArgs object the calendarEvent, calendar, and > initialStartDateValue values are "XPCWrappedNative_NoHelper"[1] but > between when aArgs is saved by persistTab and passed to restoreTab these > values have become standard empty JS objects. > > (In persistTab I have tried just returning > aTab.iframe.contentWindow.arguments[0] and using Object.assign() to > clone that object to a new one and returning it. Same result for both.) > > Any ideas on how to solve this? > > Thanks, > -Paul > > [1] > https://dxr.mozilla.org/comm-central/source/mozilla/js/xpconnect/src/XPCWrappedNativeJSOps.cpp#644 >