Closed Bug 79581 Opened 24 years ago Closed 24 years ago

XPConnect error message misleading when secman denies wrapper building

Categories

(Core :: Security: CAPS, defect)

All
Mac System 8.5
defect
Not set
normal

Tracking

()

VERIFIED DUPLICATE of bug 70162

People

(Reporter: sfraser_bugs, Assigned: security-bugs)

References

()

Details

Bug 79544 describes a problem where a security check failure caused a JS error like: ************************************************************ * Call to xpconnect wrapped JSObject produced this error: * [Exception... "Permission denied to create wrapper for object [nsIDocumentStateListener::NotifyDocumentCreated]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no] ************************************************************ This error implies that the security check failed when trying to create a wrapper for nsIDocumentStateListener::NotifyDocumentCreated. The real bug was that IsDOMClass() was failing for nsDOMDocumentType, which was used as a local variable in one of the JS functions that NotifyDocumentCreated() called.
OK. I've been debugging. The problem is that we don't catch this exception at the place it is generated. When we catch it later we assume it has to do with the current call. so, it gets tagged with info about the current call that is not correct. It looks like the fix is going to be to not let the exception spil through the cracks in the first place.
Status: NEW → ASSIGNED
Summary: XPConnect error messages need improving → XPConnect error message misleading when secman denies wrapper building
Well, I retract my statement about the exception getting left over for later. For xpconnect's part it is misleading that xpconnect just concat's the [interfacename:methodname] onto the back of the thrown string. I propose the following change in the format string used in xpconnect: Index: xpcconvert.cpp =================================================================== RCS file: /cvsroot/mozilla/js/src/xpconnect/src/xpcconvert.cpp,v retrieving revision 1.57 diff -r1.57 xpcconvert.cpp 978c978 < static const char format[] = "%s [%s::%s]"; --- > static const char format[] = "\'%s\' when calling method: [%s::%s]"; This will turn the message into: ************************************************************ * Call to xpconnect wrapped JSObject produced this error: * [Exception... "'Permission denied to create wrapper for object' when calling method: [nsIDocumentStateListener::NotifyDocumentCreated]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no] ************************************************************ The above quotes the part that caps set. This is a no-brainer fix in xpconnect. I say that the real bug is that caps does not give a more detailed error message. *It* sets the original JS exception that xpconnect later builds on. And at that point caps has nsIClassInfo (so can get the likely classname - if available) and it has iid info about the class we are trying to wrap (or get a property of or whatever). So, I can checkin my little patch to make this a little less confusing. And the bug goes to caps to improve its part.
Assignee: jband → mstoltz
Status: ASSIGNED → NEW
Component: XPConnect → Security: CAPS
QA Contact: pschwartau → ckritzer
*** This bug has been marked as a duplicate of 70162 ***
Status: NEW → RESOLVED
Closed: 24 years ago
Resolution: --- → DUPLICATE
Marking VERIFIED DUPLICATE.
Status: RESOLVED → VERIFIED
You need to log in before you can comment on or make changes to this bug.