Last Comment Bug 782471 - Add file name to JS error when ctypes.Create() fails
: Add file name to JS error when ctypes.Create() fails
Status: RESOLVED FIXED
:
Product: Core
Classification: Components
Component: js-ctypes (show other bugs)
: Trunk
: All All
: -- minor (vote)
: mozilla17
Assigned To: :Irving Reid (No longer working on Firefox)
:
: Jason Orendorff [:jorendorff]
Mentors:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2012-08-13 17:37 PDT by :Irving Reid (No longer working on Firefox)
Modified: 2012-08-21 19:10 PDT (History)
2 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---
Has Regression Range: ---
Has STR: ---


Attachments
Patch to add library path to error message (1.17 KB, patch)
2012-08-13 17:45 PDT, :Irving Reid (No longer working on Firefox)
bobbyholley: review-
Details | Diff | Splinter Review
Include file path in "failed to load library" error (1.14 KB, patch)
2012-08-15 14:14 PDT, :Irving Reid (No longer working on Firefox)
bobbyholley: review+
Details | Diff | Splinter Review

Description :Irving Reid (No longer working on Firefox) 2012-08-13 17:37:54 PDT
When ctypes.open() fails, the error message does not include the full path of the library that failed to load. Adding this information helped me diagnose https://bugzilla.mozilla.org/show_bug.cgi?id=781628
Comment 1 :Irving Reid (No longer working on Firefox) 2012-08-13 17:45:13 PDT
Created attachment 651590 [details] [diff] [review]
Patch to add library path to error message

The #ifdef flow feels a little dirty to me, but the mixture between control flow and platform-specific intermediate variables didn't leave an obvious alternative.
Comment 2 Bobby Holley (:bholley) (busy with Stylo) 2012-08-14 08:57:13 PDT
Comment on attachment 651590 [details] [diff] [review]
Patch to add library path to error message

How about making the argument a ternary value, conditional on libSpec.type, that evaluates to either libSpec.value.pathname or libSpec.value.pathname_u? As for the cleanup, we can just store the success of the JS_ReportError call in a local, and then return failures after doing unconditional cleanup.
Comment 3 :Irving Reid (No longer working on Firefox) 2012-08-15 14:14:20 PDT
Created attachment 652222 [details] [diff] [review]
Include file path in "failed to load library" error

(In reply to Bobby Holley (:bholley) from comment #2)
> Comment on attachment 651590 [details] [diff] [review]
> Patch to add library path to error message
> 
> How about making the argument a ternary value, conditional on libSpec.type,
> that evaluates to either libSpec.value.pathname or libSpec.value.pathname_u?

The printf format string varies too; in the Windows case it's %hs to render the 16-bit filename string into an otherwise 8-bit output.

> As for the cleanup, we can just store the success of the JS_ReportError call
> in a local, and then return failures after doing unconditional cleanup.

I've rearranged the #ifdefs a bit, how does this look?
Comment 4 Bobby Holley (:bholley) (busy with Stylo) 2012-08-15 14:26:30 PDT
Comment on attachment 652222 [details] [diff] [review]
Include file path in "failed to load library" error

I'd still prefer to avoid duplicating the JS_free call, but I don't think it's worth quibbling over. r+
Comment 5 :Irving Reid (No longer working on Firefox) 2012-08-21 08:04:28 PDT
Checked in to inbound: https://hg.mozilla.org/integration/mozilla-inbound/rev/88def2d79ce8
Comment 6 Ryan VanderMeulen [:RyanVM] 2012-08-21 19:10:01 PDT
https://hg.mozilla.org/mozilla-central/rev/88def2d79ce8

Note You need to log in before you can comment on or make changes to this bug.