Closed Bug 386376 Opened 17 years ago Closed 17 years ago

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

Categories

(Core :: Networking: HTTP, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED

People

(Reporter: bent.mozilla, Assigned: Biesinger)

References

Details

(Keywords: verified1.8.1.13)

Attachments

(2 files)

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++ :(
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)
Attached patch patchSplinter Review
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.
Attached file 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
Closed: 17 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...
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: