Closed
Bug 715634
Opened 13 years ago
Closed 12 years ago
Cleanup XPCJSContextStack
Categories
(Core :: XPConnect, defect)
Core
XPConnect
Tracking
()
RESOLVED
FIXED
mozilla12
People
(Reporter: Ms2ger, Assigned: Ms2ger)
Details
Attachments
(2 files, 1 obsolete file)
29.39 KB,
patch
|
bholley
:
review+
|
Details | Diff | Splinter Review |
24.97 KB,
patch
|
Details | Diff | Splinter Review |
For some reason, XPCJSContextStack uses virtual methods with useless nsresult returns... This patch should make stuff cleaner.
Attachment #586188 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 1•13 years ago
|
||
And apparently people call Pop with a null retval
Attachment #586188 -
Attachment is obsolete: true
Attachment #586188 -
Flags: review?(bobbyholley+bmo)
Attachment #586385 -
Flags: review?(bobbyholley+bmo)
Assignee | ||
Comment 2•13 years ago
|
||
And in case a diff -w helps you, here's one.
Comment 3•13 years ago
|
||
Comment on attachment 586385 [details] [diff] [review] Patch v2 >+ nsRefPtr<nsXPConnect> xpc = nsXPConnect::GetXPConnect(); >+ if (!xpc) >+ return NULL; >+ >+ XPCJSRuntime* xpcrt = xpc->GetRuntime(); >+ if (!xpcrt) >+ return NULL; >+ >+ JSRuntime *rt = xpcrt->GetJSRuntime(); >+ if (!xpcrt) >+ return NULL; This should check rt, not xpcrt. > private: >- nsAutoTArray<XPCJSContextInfo, 16> mStack; >+ AutoFallibleTArray<XPCJSContextInfo, 16> mStack; What's this all about? r+ with the above fix and a reasonable explanation for the FallibleT stuff.
Attachment #586385 -
Flags: review?(bobbyholley+bmo) → review+
Assignee | ||
Comment 4•13 years ago
|
||
The code was checking for allocation failures, even though nsTArray / nsAutoTArray changed to using infallible malloc a while ago. Because we don't gain much from using infallible malloc (we still have to handle failure from JS_SaveFrameChain), I thought we might as well use explicitly fallible malloc.
Comment 5•13 years ago
|
||
(In reply to Ms2ger from comment #4) > The code was checking for allocation failures, even though nsTArray / > nsAutoTArray changed to using infallible malloc a while ago. Because we > don't gain much from using infallible malloc (we still have to handle > failure from JS_SaveFrameChain), I thought we might as well use explicitly > fallible malloc. Hm. Given that this is never going to be allocating much more than 200 bytes, I'd prefer to keep this infallible. IMO fallible allocation should be reserved for large (or potentially large) allocations. OOMing on allocations of these size just means the browser is about to fall flat on its face anyway, so I'd rather keep the code simple.
Assignee | ||
Comment 6•13 years ago
|
||
WFM. I'll make it AutoInfallibleTArray for clarity and remove the checks, then.
Assignee | ||
Comment 7•12 years ago
|
||
https://hg.mozilla.org/mozilla-central/rev/df571c75b4c0
Status: ASSIGNED → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla12
You need to log in
before you can comment on or make changes to this bug.
Description
•