Closed Bug 482289 Opened 15 years ago Closed 15 years ago

RecordManager used nsIURI objects as keys, worked on Fx, not on Fennec

Categories

(Cloud Services :: General, defect)

defect
Not set
normal

Tracking

(Not tracked)

RESOLVED INVALID

People

(Reporter: hello, Unassigned)

Details

From bug 480420:

I don't know how it worked in Firefox.  Maybe Firefox was always using the same URI object, so the cache was getting hit?  That doesn't make sense, though.  Do you want me to look into it?  A difference between the way the WBOs are used in Fennec vs. Firefox could be a clue that other things are wrong.
If it was using the uri as the key, all uri's should be mapping to the same key of "[xpconnect wrapped nsIURI]", so I'm not too sure about the comment:

/* Note: using url object directly as key for this._records cache
 * does not work because different url objects (even pointing to the
 * same place) are different objects and therefore not equal.  So

Just run this in the error console (where you have weave installed).

Components.utils.import("resource://weave/util.js"); foo = Utils.makeURI("http://foo"); bar = Utils.makeURI("http://bar"); obj = {}; obj[foo] = 3.14; alert(obj[bar])

Notice that obj[bar] gets us the value in obj[foo].
So, it turns out, on debug builds the .toString() for nsIURI contains a memory address, making it fail every time.  Jono's Fennec build was a debug build, whereas I use nightlies / betas, which are not debug.

PubKeyManager / PrivMeyKanager currently only cache a single key each, so there was no visible error on non-debug builds.

Fun!
Status: NEW → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
Component: Weave → General
Product: Mozilla Labs → Weave
Target Milestone: -- → ---
QA Contact: weave → general
You need to log in before you can comment on or make changes to this bug.