Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Privileged app doesn't have Contact constructor?

10 views
Skip to first unread message

Matěj Cepl

unread,
May 18, 2013, 2:45:00 PM5/18/13
to dev-w...@lists.mozilla.org
Hi,

I am trying to create an importer for the LDIF file (export from
Thunderbird Address Book) to my new Peak Contacts.

My current code is https://github.com/mcepl/import-LDIF . I have tried
to create a packaged privileged app (I need it for inserting new
Contacts to the system address book), but even though the package
validates on https://marketplace.firefox.com/developers/validator when I
run it in the Firefox OS Simulator 3.0 I get error

Timestamp: 05/18/13 20:18:26
Error: TypeError: Contact is not a constructor
Source File: app://84eb47f2-a003-47ee-8a32-c224b56aabb5/importAddrBook.js
Line: 88

How come? Any thoughts what do I do wrong?

Best,

Matěj Cepl
--
http://www.ceplovi.cz/matej/, Jabber: mc...@ceplovi.cz
GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC

If trains stop at train stations, what happens at work stations?

Harald Kirschner

unread,
May 18, 2013, 3:50:20 PM5/18/13
to Matěj Cepl, dev-w...@lists.mozilla.org
Hi Matěj,

nice project! That's a simple fix, you just need to rename Contact to mozContact.
You can see an example at https://wiki.mozilla.org/WebAPI/ContactsAPI#Example and a lot more code in the Gaia communications app https://github.com/mozilla-b2g/gaia/tree/master/apps/communications

You could also add a Web Activity to bind your app to "open" LDIF files (from links, email attachments, etc). The PDF app does that for PDF files [1].

Cheers,

---
Harald Kirschner | Partner Engineer & Web Craftsman | har...@mozilla.com (mailto:hkirs...@mozilla.com)

[1]: https://github.com/mozilla-b2g/gaia/blob/master/apps/pdfjs/manifest.webapp#L21


On Saturday, May 18, 2013 at 11:45 AM, Matěj Cepl wrote:

> Hi,
>
> I am trying to create an importer for the LDIF file (export from
> Thunderbird Address Book) to my new Peak Contacts.
>
> My current code is https://github.com/mcepl/import-LDIF . I have tried
> to create a packaged privileged app (I need it for inserting new
> Contacts to the system address book), but even though the package
> validates on https://marketplace.firefox.com/developers/validator when I
> run it in the Firefox OS Simulator 3.0 I get error
>
> Timestamp: 05/18/13 20:18:26
> Error: TypeError: Contact is not a constructor
> Source File: app://84eb47f2-a003-47ee-8a32-c224b56aabb5/importAddrBook.js
> Line: 88
>
> How come? Any thoughts what do I do wrong?
>
> Best,
>
> Matěj Cepl
> --
> http://www.ceplovi.cz/matej/, Jabber: mc...@ceplovi.cz (mailto:mc...@ceplovi.cz)
> GPG Finger: 89EF 4BC6 288A BF43 1BAB 25C3 E09F EF25 D964 84AC
>
> If trains stop at train stations, what happens at work stations?
> _______________________________________________
> dev-webapps mailing list
> dev-w...@lists.mozilla.org (mailto:dev-w...@lists.mozilla.org)
> https://lists.mozilla.org/listinfo/dev-webapps
>
>


Matej Cepl

unread,
May 18, 2013, 5:59:59 PM5/18/13
to
On 2013-05-18, 19:50 GMT, Harald Kirschner wrote:
> nice project! That's a simple fix, you just need to rename Contact to
> mozContact.
> You can see an example at
> https://wiki.mozilla.org/WebAPI/ContactsAPI#Example and a lot more
> code in the Gaia communications app
> https://github.com/mozilla-b2g/gaia/tree/master/apps/communications

Does the same moz* prefix applies to other Contact* constructors as well
(ContactAddress, ContactField, and ContactTelField)?

My current code
(https://github.com/mcepl/import-LDIF/blob/master/importAddrBook.js#L70)
now crashes on

cAddr = new subClass();

with errors

* Error: TypeError: subClass is not a constructor
Source File:
app://84eb47f2-a003-47ee-8a32-c224b56aabb5/importAddrBook.js
Line: 70
* Content JS LOG at
app://84eb47f2-a003-47ee-8a32-c224b56aabb5/importAddrBook.js:140 in
translateObjectToContact: new sub element ContactField
* Content JS LOG at
app://84eb47f2-a003-47ee-8a32-c224b56aabb5/importAddrBook.js:66 in
findSubElement: idx = email, subClass = [object ContactField], subType
= work

(I don't understand how it is possible that the error message precedes
log messages, and apparently subClass has a value of ContactField, so
the error message doesn't make much sense to me).

> You could also add a Web Activity to bind your app to "open" LDIF
> files (from links, email attachments, etc). The PDF app does that for
> PDF files [1].

Splendid idea! Will do, once the program works.

Best,

Matěj

Andrew Sutherland

unread,
May 19, 2013, 9:22:24 PM5/19/13
to dev-w...@lists.mozilla.org
On 05/18/2013 03:50 PM, Harald Kirschner wrote:
> You could also add a Web Activity to bind your app to "open" LDIF files (from links, email attachments, etc). The PDF app does that for PDF files [1].

For the time-being the e-mail app only will download/open attachments of
mime types found in MimeMapper._typeToExtensionMap in
https://github.com/mozilla-b2g/gaia/blob/master/shared/js/mime_mapper.js

Currently, this only covers image/audio/video types supported by the
device, and *not* PDF types or anything else. The e-mail bug on this is
https://bugzilla.mozilla.org/show_bug.cgi?id=825318

The pdf.js app bug (from a Gaia perspective) is
https://bugzilla.mozilla.org/show_bug.cgi?id=852849

The fundamental issue lies somewhere between an e-mail UX problem and a
lack of platform capabilities to detect mime types supported by
installed apps.

Andrew
0 new messages