<div dir="ltr"><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Hi David,<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Can you file Toolkit::General bugs blocking 1304322 for the first two issues please? Note that this module is just a refactoring of LoginStore.jsm from a few years ago to make it more generic so these issues already existed before.<br><br>Regarding ensureDataReady, code review and developer judgement can be used to judge whether that method should be used by an individual consumer. Perhaps we could have warnings in the JSDoc comment to make it more clear that it should be avoided but in the original code (LoginStore.jsm) it was needed.<br><br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Thanks,<br></div><div class="gmail_default" style="font-family:arial,helvetica,sans-serif">Matthew<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Oct 11, 2016 at 1:39 PM, David Teller <span dir="ltr"><<a href="mailto:dteller@mozilla.com" target="_blank">dteller@mozilla.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Thanks for writing this, I believe that it can be useful.<br>
<br>
A few remarks:<br>
<br>
- you should never mix nsIFile/FileUtils and OS.File, as they operate on<br>
different threads, so you could end up with data loss;<br>
<br>
- to improve durability in case of I/O error, you should consider using<br>
backups in addition to `tmpPath`;<br>
<br>
- by definition, `ensureDataReady` blocks the main thread, I don't think<br>
it is such a good idea – maybe for some very specific use cases, but<br>
probably not in a library meant to be reused.<br>
<br>
Cheers,<br>
 David<br>
<div class="HOEnZb"><div class="h5"><br>
<br>
On 11/10/16 16:53, Luke Chang wrote:<br>
> Hey folks,<br>
><br>
> This is a notice about a module, JSONFile.jsm, just landed in<br>
> "toolkit/modules".<br>
><br>
> Matt, Steve and I have been working on Form Autofill [1]. While<br>
> implementing, we intend to leverage modules of Password Manager because<br>
> of their similar behaviors. LoginStore.jsm [2] is one of those modules.<br>
><br>
> The above-mentioned JSONFile.jsm is basically separated from<br>
> LoginStore.jsm, which is in charge of storing login-related data in a<br>
> ".json" file. In order to increase the reusability of such<br>
> JSON-formatted storage that we're going to use in Form Autofill as well,<br>
> we refactored LoginStore.jsm. More specifically, those IO-specific APIs<br>
> were generalized and moved to JSONFile.jsm. Therefore, LoginStore.jsm<br>
> will focus on schema-related operations such as data migrations.<br>
><br>
> To sum up, you can now utilize JSONFile.jsm to store simple data in a<br>
> single file as long as the data can be serialized to JSON format. More<br>
> details can be found in bug 1304322 [3].<br>
><br>
> Thanks,<br>
> Luke<br>
><br>
> [1] <a href="https://wiki.mozilla.org/Firefox/Features/Form_Autofill" rel="noreferrer" target="_blank">https://wiki.mozilla.org/<wbr>Firefox/Features/Form_Autofill</a><br>
> [2]<br>
> <a href="https://dxr.mozilla.org/mozilla-central/source/toolkit/components/passwordmgr/LoginStore.jsm" rel="noreferrer" target="_blank">https://dxr.mozilla.org/<wbr>mozilla-central/source/<wbr>toolkit/components/<wbr>passwordmgr/LoginStore.jsm</a><br>
> [3] <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1304322" rel="noreferrer" target="_blank">https://bugzilla.mozilla.org/<wbr>show_bug.cgi?id=1304322</a><br>
><br>
><br>
><br>
</div></div><div class="HOEnZb"><div class="h5">> ______________________________<wbr>_________________<br>
> firefox-dev mailing list<br>
> <a href="mailto:firefox-dev@mozilla.org">firefox-dev@mozilla.org</a><br>
> <a href="https://mail.mozilla.org/listinfo/firefox-dev" rel="noreferrer" target="_blank">https://mail.mozilla.org/<wbr>listinfo/firefox-dev</a><br>
><br>
______________________________<wbr>_________________<br>
firefox-dev mailing list<br>
<a href="mailto:firefox-dev@mozilla.org">firefox-dev@mozilla.org</a><br>
<a href="https://mail.mozilla.org/listinfo/firefox-dev" rel="noreferrer" target="_blank">https://mail.mozilla.org/<wbr>listinfo/firefox-dev</a><br>
</div></div></blockquote></div><br></div>