Closed
Bug 382123
Opened 19 years ago
Closed 8 years ago
Add a unit test for nsIException catching
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
INACTIVE
People
(Reporter: WeirdAl, Assigned: WeirdAl)
Details
Attachments
(1 file)
|
1.18 KB,
patch
|
Details | Diff | Splinter Review |
We actually don't have any unit tests for nsIException. It took me a little while to realize that's what XPConnect was throwing when returning to my code.
This patch adds a simple unit test for nsIException being returned, and the expected result code, to the test_import.js file. Because it's test code, it shouldn't need sr.
| Assignee | ||
Comment 1•19 years ago
|
||
whoops, forgot the actual patch :)
Assignee: nobody → ajvincent
Status: NEW → ASSIGNED
| Assignee | ||
Updated•19 years ago
|
Attachment #266199 -
Flags: review?(sayrer)
Comment 2•19 years ago
|
||
looks ok, but is this the right file to include it?
| Assignee | ||
Comment 3•19 years ago
|
||
I don't know. I'll take suggestions for better spots (including a new file).
Comment 4•19 years ago
|
||
yeah, new file seems right.
| Assignee | ||
Comment 5•19 years ago
|
||
I'll try a new file later. I would test the other properties of nsIException, but that would require a JS component file that was pretty much guaranteed to never change. Any suggestions?
Comment 6•19 years ago
|
||
the same component you use for the import test?
| Assignee | ||
Comment 7•19 years ago
|
||
Wow, this is odd. I dumped the properties of the caught nsIException and its stack trace, expecting to find component_import.js in there. I didn't get it. This leads me to wonder if I have misinterpreted how nsIException objects are created, and what they should have. I expected to get a full stack trace, essentially, from the JS component throwing the exception, on down.
exc.result: 2147500034
exc.QueryInterface: function QueryInterface() {
[native code]
}
exc.message: Component returned failure code: 0x80004002 (NS_NOINTERFACE) [nsISupports.QueryInterface]
exc.name: NS_NOINTERFACE
exc.filename: ../../../../_tests/xpcshell-simple/TestXPC/unit/test_nsIException.js
exc.lineNumber: 52
exc.columnNumber: 0
exc.location.QueryInterface: function QueryInterface() {
[native code]
}
exc.location.language: 2
exc.location.languageName: JavaScript
exc.location.filename: ../../../../_tests/xpcshell-simple/TestXPC/unit/test_nsIException.js
exc.location.name: run_test
exc.location.lineNumber: 52
exc.location.sourceLine: null
exc.location.caller.QueryInterface: function QueryInterface() {
[native code]
}
exc.location.caller.language: 2
exc.location.caller.languageName: JavaScript
exc.location.caller.filename: c:/trunk/mozilla/tools/test-harness/xpcshell-simple/tail.js
exc.location.caller.name: null
exc.location.caller.lineNumber: 41
exc.location.caller.sourceLine: null
exc.inner: null
exc.data: null
exc.initialize: function initialize() {
[native code]
}
Comment 8•19 years ago
|
||
Comment on attachment 266199 [details] [diff] [review]
patch
needs a new patch, right?
Attachment #266199 -
Flags: review?(sayrer)
| Assignee | ||
Comment 9•19 years ago
|
||
Yes, it does, but I probably won't submit one unless someone can clarify what the expected behavior of nsIException is - why, in particular, I didn't get what I expected in comment 7.
| Assignee | ||
Comment 10•18 years ago
|
||
Re comment 9: Components.Exception leaves the throwing line in there. Throwing a nsresult code leaves one line missing. That's what I missed.
Comment 11•8 years ago
|
||
Per policy at https://wiki.mozilla.org/Bug_Triage/Projects/Bug_Handling/Bug_Husbandry#Inactive_Bugs. If this bug is not an enhancement request or a bug not present in a supported release of Firefox, then it may be reopened.
Status: ASSIGNED → RESOLVED
Closed: 8 years ago
Resolution: --- → INACTIVE
You need to log in
before you can comment on or make changes to this bug.
Description
•