Open Bug 577744 Opened 14 years ago Updated 2 years ago

Exceptions thrown in NSGetFactory are swallowed

Categories

(Core :: XPCOM, defect)

defect

Tracking

()

People

(Reporter: Fallen, Unassigned)

References

Details

(Keywords: testcase)

Attachments

(1 file)

Attached file Testcase - v1 (deleted) —
STR: 1. Install Testcase Extension 2. Start Toolkit Application 3. Visit Error console 4. Execute Components.classes['@mozilla.org/test-exception;1'].createInstance(); Expected: * Exception is shown both on startup and when creating an instance Actual: * This is the only error message you get: Error: uncaught exception: [Exception... "Component returned failure code: 0x80570015 (NS_ERROR_XPC_CI_RETURNED_FAILURE) [nsIJSCID.createInstance]" nsresult: "0x80570015 (NS_ERROR_XPC_CI_RETURNED_FAILURE)" location: "JS frame :: javascript:%20Components.classes['@mozilla.org/test-exception;1'].createInstance(); :: <TOP_LEVEL> :: line 1" data: no]
OS: Linux → All
Hardware: x86 → All
Version: 1.9.2 Branch → Trunk
Hrm. I get the following in my error console: Error: Component {2ece11c6-720b-496c-a047-3fe0372bed4f} is being loaded... Source File: file:///c:/builds/test-profile/extensions/testexception@mozilla.kewis.ch/components/testException.js Line: 39 Error: [Exception... "'Loading via category manager works, but now try with: Components.classes['@mozilla.org/test-exception;1'].createInstance();' when calling method: [xpcIJSGetFactory::get]" nsresult: "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no] These happen during profile-after-change. Then, when I run the .createInstance bit, I get: Error: Component {2ece11c6-720b-496c-a047-3fe0372bed4f} is being loaded... Source File: file:///c:/builds/test-profile/extensions/testexception@mozilla.kewis.ch/components/testException.js Line: 39 Error: uncaught exception: [Exception... "Component returned failure code: 0x80570015 (NS_ERROR_XPC_CI_RETURNED_FAILURE) [nsIJSCID.createInstance]" nsresult: "0x80570015 (NS_ERROR_XPC_CI_RETURNED_FAILURE)" location: "JS frame :: javascript:%20Components.classes['@mozilla.org/test-exception;1'].createInstance(); :: <TOP_LEVEL> :: line 1" data: no] I wonder if this is because there is JS higher up on the stack.
In NS_ScriptErrorReporter we're hitting this early-return which bz added in bug 461917. If I understand everything here correctly, this code is intended to make sure that exceptions which are thrown across XPConnect boundaries are only reported if the caller isn't prepared to handle them. I don't understand why we don't have a stack of "I'm prepared to handle exceptions", rather than assuming that is the case, but oh well for now. I think the best thing to do here is probably something like JS_SaveFrameChain/JS_RestoreFrameChain around the component-eval/NSGetFactory calls. cc'ing bz/mrbkap for thoughts/confirmation.
I can confirm the first half of comment 2.... I have no idea about the second part, offhand. :(
Severity: normal → S3
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: