Errata

Programming Chrome Apps

Errata for Programming Chrome Apps

Submit your own errata for this product.

The errata list is a list of errors and their corrections that were found after the product was released.

The following errata were submitted by our customers and have not yet been approved or disproved by the author or editor. They solely represent the opinion of the customer.

Color Key: Serious technical mistake Minor technical mistake Language or formatting error Typo Question Note Update

Version Location Description Submitted by Date submitted
Mobi

Found 2 logic errors in the source code examples in Chapter 2 having to do with the various note editors being created. I'm reading the book on an iPad in the Kindle app, so there are no page numbers, and the errors occur at various parts of the chapter in the source code listings.

1) The "dirty = false;" statement, used when saving a note to storage, is in the wrong location. It is in the callback called after the write operation has completed, but it should be immediately after the write statement containing the callback reference. The reason for this is that the callback is called at some future point after the write operation is scheduled. It is entirely possible that the user may continue to type into the note before the callback gets called, which will set "dirty = true;", which will the be overwritten by "dirty = false;" when the callback eventually occurs. At that point the data in the textarea will not be the same as what was written to storage, but the buffer will not be marked as "dirty", which could potentially lead to user data loss. By moving the "dirty = false;" statement immediately after the write operation is scheduled, the data written to storage, the data currently in the textarea, and the "dirty" state will all be synchronized.

2) A new "dirty = false;" statement should be inserted into the code immediately after the statement used to assign data read from disk to the value of the textarea, again to synchronize file and textarea contents with "dirty" state. This is needed in the "syncfile" version of the example code. As it stands now, when the file is synced externally, the example code will overlay the user's typing with the syncfile's contents, which means the textarea and file are now synced, but the textarea will still be marked as "dirty" from whatever typing the user had done prior to the sync. Assuming the user has stopped typing (in surprise when seeing all his hard work replaced by the syncing operation :-) the contents of the textarea will eventually be rewritten back to storage (even though it is still identical to what was just loaded), which could in turn cause the Chrome system to propagate the (unchanged) file back to other systems, causing further mayhem and consternation :-)

David Morrill  Sep 15, 2014 
Printed Page 44
inside <head> tag

When viewed in the Chrome Dev Editor, the Dialogs.js file generates several warnings about missing semicolons (which are easily fixed). However, lines 54 and 72 generate warnings that you should not make functions within a loop. Are these legitimate errors and if so, how should the code be changed?

John Morris  Jun 30, 2016 
Printed Page 59
Figure 3-3

The "Set Backup" button is missing from the Options dialog.

John Morris  Jul 02, 2016