Closed Bug 940724 Opened 11 years ago Closed 11 years ago

Move XMLHttpRequest::StateData off of the stack to silence analysis

Categories

(Core :: DOM: Core & HTML, defect)

defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla28

People

(Reporter: sfink, Assigned: sfink)

Details

(Whiteboard: [qa-])

Attachments

(1 file)

Hazard:

Function 'XMLHttpRequest.cpp:uint8 {anonymous}::EventRunnable::WorkerRun(JSContext*, mozilla::dom::workers::WorkerPrivate*)' has unrooted 'state' of type 'mozilla::dom::workers::XMLHttpRequest::StateData' live across GC call 'uint8 JSAutoStructuredCloneBuffer::read(JSContext*, class JS::MutableHandle<JS::Value>, JSStructuredCloneCallbacks*, void*)' at dom/workers/XMLHttpRequest.cpp:715

This hazard is really a weakness of the analysis, because there's a StateDataAutoRooter in scope. But StateData contains a Heap<Value>, and it's a little funky to put one of those on the stack. Funky, but allowed as long as you trace it, and the StateDataAutoRooter will achieve that.
Still, it's simpler to always have StateData on the heap, especially since that will silence the analysis hazard as a side effect. We still need the AutoRooter to trace it. Once MOZ_HEAP_CLASS is implemented, we'll be able to mark StateData with it.
Attachment #8334907 - Flags: review?(jonas)
Comment on attachment 8334907 [details] [diff] [review]
Move XMLHttpRequest::StateData off of the stack to silence analysis

hup!
Attachment #8334907 - Flags: review?(jonas) → review?(bent.mozilla)
Comment on attachment 8334907 [details] [diff] [review]
Move XMLHttpRequest::StateData off of the stack to silence analysis

Review of attachment 8334907 [details] [diff] [review]:
-----------------------------------------------------------------

::: dom/workers/XMLHttpRequest.cpp
@@ +681,5 @@
>          mProxy->mLastTotal = mTotal;
>        }
>      }
>  
> +    ScopedDeletePtr<XMLHttpRequest::StateData> state(new XMLHttpRequest::StateData());

Nit: Please use nsAutoPtr.
Attachment #8334907 - Flags: review?(bent.mozilla) → review+
https://hg.mozilla.org/mozilla-central/rev/972924aa7110
Status: ASSIGNED → RESOLVED
Closed: 11 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla28
Whiteboard: [qa-]
Component: DOM → DOM: Core & HTML
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: