Closed
Bug 1034917
Opened 10 years ago
Closed 10 years ago
Remove dangerous public destructor of nsJSID
Categories
(Core :: XPConnect, defect)
Tracking
()
RESOLVED
FIXED
mozilla34
People
(Reporter: bjacob, Assigned: rimjhim.mazumder17, Mentored)
References
Details
(Whiteboard: [lang=c++])
Attachments
(1 file, 3 obsolete files)
(deleted),
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
In bug 1028588 we removed dangerous public destructors of XPCOM-refcounted classes outside of a finite whitelist, see HasDangerousPublicDestructor. Now we are going over the entries in this whitelist.
One of them is: nsJSID
Updated•10 years ago
|
Component: JavaScript Engine → XPConnect
Updated•10 years ago
|
Mentor: continuation
Updated•10 years ago
|
Whiteboard: [lang=c++]
Comment 1•10 years ago
|
||
See bug 1028132 comment 3 and 4 for an explanation of how to fix this kind of bug.
Comment 3•10 years ago
|
||
Absolutely!
If I make nsJSID destructor protected, it cannot be accessed by XPCJSID.cpp which gives me the following error:
1:59.52 c:\mozilla-central\js\xpconnect\src\XPCJSID.cpp(555) : error C2248: 'ns JSID::~nsJSID' : cannot access protected member declared in class 'nsJSID'
I'm confused.Can someone help me out?
Comment 5•10 years ago
|
||
That's due to http://mxr.mozilla.org/mozilla-central/source/js/xpconnect/src/xpcprivate.h#2814. See bug 1028132 comment 4 part b) which describes how to fix declarations like this.
Comment 6•10 years ago
|
||
Is this bug already assigned to Debkanya Mazumder?
if not, I would give a try.
Please let me know. Thanks!
Comment 7•10 years ago
|
||
(In reply to arul.subramaniam from comment #6)
> Is this bug already assigned to Debkanya Mazumder?
Yes, we should give them more than a day to fix it. :)
Attachment #8464856 -
Flags: review?(continuation)
Updated•10 years ago
|
Assignee: nobody → rimjhim.mazumder17
Comment 9•10 years ago
|
||
Comment on attachment 8464856 [details] [diff] [review]
Making ~nsJSID() protected
Review of attachment 8464856 [details] [diff] [review]:
-----------------------------------------------------------------
Thanks for the patch! Other than a few minor fixups below, this looks good to me. Please address that comment, upload a new patch, and then ask :bholley for review. He's an XPConnect peer, so he can review this patch for real.
::: js/xpconnect/src/xpcprivate.h
@@ +2749,5 @@
> const nsID& GetInvalidIID() const;
>
> protected:
> +
> + ~nsJSID();
The indentation here should be fixed to match the rest, plus you should remove the trailing whitespace on the previous line.
Attachment #8464856 -
Flags: review?(continuation)
Assignee | ||
Comment 10•10 years ago
|
||
Hi Andrew, thank you for the review! Could you tell me how do I address the comment for the review?
Comment 11•10 years ago
|
||
Do you mean what is the process for addressing the comment? Update the patch to fix the whitespace and indentation, then upload the new version of the patch, and mark the old version of the patch obsolete.
Let me know if that doesn't answer your question.
Assignee | ||
Comment 12•10 years ago
|
||
I've tried to fix the indentation and it looks fine there, but it does not appear the same here. I'm not sure what to do about that so any help would be appreciated. Trailing whitespace on the previous line has been removed.
Attachment #8464856 -
Attachment is obsolete: true
Attachment #8464913 -
Flags: review?(bobbyholley)
Comment 13•10 years ago
|
||
Thanks. It looks like you are using a tab character to indent that, which is why it shows up here but not locally. You need to use 4 spaces instead.
Assignee | ||
Comment 14•10 years ago
|
||
Okay thank you, I think I got it.
Assignee | ||
Comment 15•10 years ago
|
||
Attachment #8464913 -
Attachment is obsolete: true
Attachment #8464913 -
Flags: review?(bobbyholley)
Attachment #8464932 -
Flags: review?(bobbyholley)
Comment 16•10 years ago
|
||
Comment on attachment 8464932 [details] [diff] [review]
Bug1034917- Remove Dangerous Public Destructor nsJSID
Review of attachment 8464932 [details] [diff] [review]:
-----------------------------------------------------------------
Now that mDetails is a pointer, we need to allocate it somewhere. If you fire up a build with this patch, I'd imagine that it would crash, because we never allocate mDetails.
Attachment #8464932 -
Flags: review?(bobbyholley) → review-
Assignee | ||
Comment 17•10 years ago
|
||
How do I allocate mDetails?
Comment 18•10 years ago
|
||
(In reply to Debkanya Mazumder from comment #17)
> How do I allocate mDetails?
Add something like
mDetails(new nsJSID())
to the initializer list in the constructor for nsJSCID.
Assignee | ||
Comment 19•10 years ago
|
||
Attachment #8464932 -
Attachment is obsolete: true
Attachment #8465655 -
Flags: review?(bobbyholley)
Comment 20•10 years ago
|
||
Comment on attachment 8465655 [details] [diff] [review]
Bug1034917 - Remove Dangerous Public Destructor nsJSID
Review of attachment 8465655 [details] [diff] [review]:
-----------------------------------------------------------------
Looks good! r=bholley
Attachment #8465655 -
Flags: review?(bobbyholley) → review+
Comment 21•10 years ago
|
||
try server run: https://tbpl.mozilla.org/?tree=Try&rev=99a14e37a159
I had to make the dtor virtual again or the compiler was complained.
Comment 22•10 years ago
|
||
Thanks for the patch!
https://hg.mozilla.org/integration/mozilla-inbound/rev/334445a5419f
Assignee | ||
Comment 23•10 years ago
|
||
Thank you for the help!
Comment 24•10 years ago
|
||
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla34
Updated•10 years ago
|
Flags: qe-verify-
You need to log in
before you can comment on or make changes to this bug.
Description
•