Closed Bug 497032 Opened 16 years ago Closed 16 years ago

"ASSERTION: Oops! You're asking for a weak reference to an object that doesn't support that" on bankrate.com (geolocation on stack)

Categories

(Core :: DOM: Geolocation, defect)

x86
macOS
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla1.9.3a1
Tracking Status
status1.9.2 --- beta1-fixed
status1.9.1 --- wanted

People

(Reporter: jruderman, Assigned: ehsan.akhgari)

References

()

Details

(Keywords: assertion)

Attachments

(4 files)

Attached file stack trace
Steps to reproduce: 1. Load http://www.bankrate.com/ in a debug Firefox build. 2. Quit Firefox. Result: ###!!! ASSERTION: Oops! You're asking for a weak reference to an object that doesn't support that.: 'factoryPtr', file nsWeakReference.cpp, line 109 Jonas, how can I debug this?
You need to dump the JS stack. There's some function somewhere in XPConnect that will dump the current JS stack to the console I think. Jst knows iirc.
(gdb) call DumpJSStack() 0 [native frame] 1 anonymous() ["file:///Users/jruderman/central/debug-obj/dist/MinefieldDebug.app/Contents/MacOS/components/NetworkGeolocationProvider.js":179] os = [xpconnect wrapped nsIObserverService @ 0x1e6228b0 (native @ 0x71dcf0)] prefBranch = [xpconnect wrapped nsIPrefBranch @ 0x1906e2e0 (native @ 0x71e4f0)] this = [object Object] NetworkGeolocationProvider.js:179 is the following line in the shutdown method of WifiGeoPositionProvider: os.removeObserver(this, "private-browsing");
mrbkap says weak references aren't available during shutdown, so Geolocation should not call removeObserver (or call it earlier than shutdown).
Blocks: 491759
as so long as we don't leak, i have no objection to removing the removeObserver call. Are others also doing the wrong thing? http://mxr.mozilla.org/mozilla-central/search?string=os.removeObserver%28this%2C+%22&find=&findi=&filter=^[^\0]*%24&hitlimit=&tree=mozilla-central
The others usually do it on xpcom-shutdown or some other equivalent, not sure if geo can use that though...
i have no problem with simply not removing the observer as so long as it doesn't cause a leak (which it probably doesn't).
I think that causes the assertion in bug 481317, at least if I understood that correctly.
Note that since the QI to weaksupports currently fails, the call to removeObserver is a no-op.
Attached patch patch v.2Splinter Review
Assignee: nobody → doug.turner
Attachment #397191 - Flags: review?(highmind63)
Comment on attachment 397191 [details] [diff] [review] patch v.2 I'm totally not a reviewer for this, but afaik you're responsible to remove any observers you add. All the other places use xpcom-shutdown (even those observing xpcom-shutdown itself) for this, is there any reason you can't? Even though it probably isn't a memory leak per se (your really using this for the life of the app, which xpcom-shutdown signals), convention in current code dictates that it's good practice.
Attachment #397191 - Flags: review?(highmind63)
I thought i would get your input Natch. As jonas mentioned, it is a noop and therefore probably not needed. jonas, do you have an opinion one way or the other?
Hrm, on second thought, this is component js, rules are somewhat different here. See nsSessionStore, which afaict doesn't release _any_ of its observers (and it has a bunch). Component code is supposed to live for the lifetime of the app so using xpcom-shutdown to remove the observers is kind of redundant, I guess.
Attached patch Patch (v3)Splinter Review
If we make this object support weak references, and not call RemoveObserver, the observer will be released when the observer service dies, and nothing will crash if WifiGeoPositionProvider is shut down before that time.
Attachment #397524 - Flags: review?(jonas)
You have to also change the third argument of addObserver to true or this change won't take affect since you're still asking for a strong reference.
Status: NEW → RESOLVED
Closed: 16 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla1.9.3a1
Attachment #397524 - Flags: approval1.9.2?
Attachment #397524 - Flags: approval1.9.1.4?
Comment on attachment 397524 [details] [diff] [review] Patch (v3) For branches would prefer to approve a patch that reflects what got checked in.
Attachment #397524 - Flags: approval1.9.1.4?
Attachment #397524 - Flags: approval1.9.2?
Attached patch As checked inSplinter Review
Attachment #401715 - Flags: approval1.9.2?
Attachment #401715 - Flags: approval1.9.1.4?
Comment on attachment 401715 [details] [diff] [review] As checked in Approved for 1.9.1.4, a=dveditz for release-drivers
Attachment #401715 - Flags: approval1.9.1.4? → approval1.9.1.4+
Assignee: doug.turner → ehsan.akhgari
Comment on attachment 401715 [details] [diff] [review] As checked in past code-freeze for 1.9.1.4, removing non-blocker approval.
Attachment #401715 - Flags: approval1.9.1.4+ → approval1.9.1.4-
Attachment #401715 - Flags: approval1.9.1.5?
Attachment #401715 - Flags: approval1.9.2? → approval1.9.2+
QA's insists on a testcase if we're going to take this on the increasingly conservative 1.9.1 branch
Keywords: testcase-wanted
Flags: in-testsuite?
Comment on attachment 401715 [details] [diff] [review] As checked in We need a testcase before we take this on 1.9.1.
Attachment #401715 - Flags: approval1.9.1.6?
Is this really wanted for 1.9.1? I want to make sure it's needed before I invest time in creating a test case for it. Alternatively, Natch, are you willing to write a test for this?
status1.9.1: --- → ?
Yes, this is wanted on 1.9.1. (And really, it should've had a testcase before landing on trunk or 1.9.2, but it's a bit too late for that now.)
Doug, do you have any idea how to write a test case for this bug? Should I just write an xpcshell test which calls nsIGeolocationProvider::shutdown? Are assertions considered as failures in debug build tests?
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: