The default bug view has changed. See this FAQ.

Impossible to implement a content sniffer in JS due to recursive GetService calls (nsIContentSniffer, JavaScript)

RESOLVED FIXED

Status

()

Core
Networking: HTTP
RESOLVED FIXED
10 years ago
9 years ago

People

(Reporter: Ben Turner (not reading bugmail, use the needinfo flag!), Assigned: Biesinger)

Tracking

({verified1.8.1.13})

Trunk
verified1.8.1.13
Points:
---
Bug Flags:
in-testsuite ?

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(2 attachments)

The IOService loads all content sniffers registered in the category manager the first time it is loaded. If a content sniffer is implemented in JS then initializing it requires the ScriptSecurityManager to load. That, in turn, requires the IOService. This recursion is not allowed and so the content sniffer fails to load properly.

Not sure what to do about this. I had to reimplement my component in C++ :(
Duplicate of this bug: 386880
Assignee: nobody → cbiesinger
Summary: Impossible to implement a content sniffer in JS due to recursive GetService calls → Impossible to implement a content sniffer in JS due to recursive GetService calls (nsIContentSniffer, JavaScript)
Created attachment 272406 [details] [diff] [review]
patch

this should fix it, and it doesn't break the content sniffer unit test, but I haven't tested yet whether it fixes the actual bug here.
Created attachment 272837 [details]
test component

copy to components/; starting the second app startup you'll see a security manager init assertion and no "called" dumps
Comment on attachment 272406 [details] [diff] [review]
patch

ok, I tested the patch and it works
Attachment #272406 - Flags: review?(benjamin)
Status: NEW → ASSIGNED
Attachment #272406 - Flags: review?(benjamin) → review+
Checking in netwerk/base/src/nsIOService.h;
/cvsroot/mozilla/netwerk/base/src/nsIOService.h,v  <--  nsIOService.h
new revision: 1.64; previous revision: 1.63
done
Checking in xpcom/glue/nsCategoryCache.h;
/cvsroot/mozilla/xpcom/glue/nsCategoryCache.h,v  <--  nsCategoryCache.h
new revision: 1.2; previous revision: 1.1
done
Status: ASSIGNED → RESOLVED
Last Resolved: 10 years ago
Resolution: --- → FIXED
Would be good to find a way to test this...
Flags: in-testsuite?
Comment on attachment 272406 [details] [diff] [review]
patch

This is a really safe fix, and this bug is causing branch extension developers a good bit of grief.  Ben and I both think this should be safe to take on branch, and I'd ask us to think about doing just that...
Attachment #272406 - Flags: approval1.8.1.13?
Comment on attachment 272406 [details] [diff] [review]
patch

approved for 1.8.1.13, a=dveditz for release-drivers
Attachment #272406 - Flags: approval1.8.1.13? → approval1.8.1.13+
Fixed on branch.
Keywords: fixed1.8.1.13
(In reply to comment #6)
> Would be good to find a way to test this...
> 

Did anyone find a way to test this? This is hard to verify otherwise.
For what it's worth, the extension developer who was having issues due to this has confirmed that his problem is fixed on branch.  Is that good enough to verify?
Yes, that's good enough for us. Marking it...
Keywords: fixed1.8.1.13 → verified1.8.1.13
You need to log in before you can comment on or make changes to this bug.