All users were logged out of Bugzilla on October 13th, 2018

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

RESOLVED INVALID

Status

RESOLVED INVALID
10 years ago
10 years ago

People

(Reporter: hello, Unassigned)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

(Reporter)

Description

10 years ago
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.

Comment 1

10 years ago
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].
(Reporter)

Comment 2

10 years ago
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
Last Resolved: 10 years ago
Resolution: --- → INVALID

Updated

10 years ago
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.