Closed Bug 437523 Opened 17 years ago Closed 17 years ago

NS_ERROR_FAILURE on nsIJSON.decode in JsonFilter_afterGET

Categories

(Cloud Services :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: myk, Assigned: myk)

References

Details

Attachments

(1 file)

Attached patch fixes three bugsSplinter Review
I've been seeing errors like this one: 2008-06-05 15:24:56 Service.Main ERROR [Exception... "Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) [nsIJSON.decode]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: file:///mnt/hgfs/myk/Projects/weave/modules/remote.js :: JsonFilter_afterGET :: line 271" data: no] After some digging, I found three separate bugs, all of which cause Weave to encrypt a null value to the deltas file on the server, which, when retrieved, causes nsIJSON.decode to throw the exception. 1. Subclasses of Resource call their superclass's _init method with "this" set to the superclass's prototype rather than the subclass's instance, causing the remote objects for all engines to inherit the serverPrefix for the last engine to instantiate a resource, which entrains a long chain of disasters (like the bookmarks engine, which was instantiated first, trying to apply deltas from the tab engine, which was instantiated last). 2. Engine::_sync pushes serverDelta onto server.deltas instead of concatenating together the two arrays (which I think is a bug, but I'm not sure, as I don't totally understand this code). 3. Engine::_sync passes this._remote.deltas.put a serialized string of deltas rather than the original array. Here's a patch that fixes all three issues. With this patch, I no longer see the errors.
Attachment #323947 - Flags: review?(thunder)
Comment on attachment 323947 [details] [diff] [review] fixes three bugs Except for: - server.deltas.push(serverDelta); + server.deltas = server.deltas.concat(serverDelta); I'm pretty sure that's not right. server.deltas is an array of deltas, and serverDelta should just get appended to it. Otherwise, really good detective work on those bugs!
Attachment #323947 - Flags: review?(thunder) → review+
(In reply to comment #1) > (From update of attachment 323947 [details] [diff] [review]) > Except for: > > - server.deltas.push(serverDelta); > + server.deltas = server.deltas.concat(serverDelta); > > I'm pretty sure that's not right. server.deltas is an array of deltas, and > serverDelta should just get appended to it. Yup, it looks like the third bug was making the second bug look like a bug, although it wasn't. I've checked in the patch without that second fix. changeset: 475:3b2515690ea8 tag: tip date: Thu Jun 05 16:25:55 2008 -0700 summary: bug 437523: fix NS_ERROR_FAILURE on nsIJSON.decode in JsonFilter_afterGET
Status: ASSIGNED → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Component: Weave → General
Product: Mozilla Labs → Weave
QA Contact: weave → general
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: