Bug 1104435 part 1 - Make AnimationTimeline::GetParentObject return an nsIGlobalObject; r=smaug

In order to create a Promise object for AnimationPlayer.ready, we need an
nsIGlobalObject. Currently we can access this through the following chain:

  AnimationPlayer -> AnimationTimeline -> Document -> nsIGlobalObject

Come bug 1096776 (Support AnimationPlayers without a timeline or with an
inactive timeline) we will no longer be able to rely on having an
AnimationTimeline so we will probably have to store the corresponding window
object on the AnimationPlayer. For now, however, we can look up the timeline as
above.

This patch makes this a little more straightforward by changing the return type
and value of AnimationTimeline::GetParentObject to return the nsIGlobalObject of
the document with which it is associated.
This commit is contained in:
Brian Birtles 2014-12-18 08:42:40 +09:00
parent c4b04bce21
commit 3a1c92a1f8

View File

@ -29,7 +29,10 @@ public:
NS_INLINE_DECL_CYCLE_COLLECTING_NATIVE_REFCOUNTING(AnimationTimeline)
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_NATIVE_CLASS(AnimationTimeline)
nsISupports* GetParentObject() const { return mDocument; }
nsIGlobalObject* GetParentObject() const
{
return mDocument->GetParentObject();
}
virtual JSObject* WrapObject(JSContext* aCx) MOZ_OVERRIDE;
// AnimationTimeline methods