mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-27 12:15:33 +00:00
Bug 889821 - Extend interface shim to allow nsIStreamListener callbacks to object/embed/applet tags to be used from script. r=bz
This commit is contained in:
parent
13c6db4e00
commit
f02a3602a7
@ -1080,21 +1080,29 @@ nsObjectLoadingContent::GetBaseURI(nsIURI **aResult)
|
||||
// see an interface requestor even though WebIDL bindings don't expose
|
||||
// that stuff.
|
||||
class ObjectInterfaceRequestorShim MOZ_FINAL : public nsIInterfaceRequestor,
|
||||
public nsIChannelEventSink
|
||||
public nsIChannelEventSink,
|
||||
public nsIStreamListener
|
||||
{
|
||||
public:
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(ObjectInterfaceRequestorShim,
|
||||
nsIInterfaceRequestor)
|
||||
NS_DECL_NSIINTERFACEREQUESTOR
|
||||
NS_FORWARD_NSICHANNELEVENTSINK(mContent->)
|
||||
// nsRefPtr<nsObjectLoadingContent> fails due to ambiguous AddRef/Release,
|
||||
// hence the ugly static cast :(
|
||||
NS_FORWARD_NSICHANNELEVENTSINK(static_cast<nsObjectLoadingContent *>
|
||||
(mContent.get())->)
|
||||
NS_FORWARD_NSISTREAMLISTENER (static_cast<nsObjectLoadingContent *>
|
||||
(mContent.get())->)
|
||||
NS_FORWARD_NSIREQUESTOBSERVER (static_cast<nsObjectLoadingContent *>
|
||||
(mContent.get())->)
|
||||
|
||||
ObjectInterfaceRequestorShim(nsIChannelEventSink* aContent)
|
||||
ObjectInterfaceRequestorShim(nsIObjectLoadingContent* aContent)
|
||||
: mContent(aContent)
|
||||
{}
|
||||
|
||||
protected:
|
||||
nsRefPtr<nsIChannelEventSink> mContent;
|
||||
nsCOMPtr<nsIObjectLoadingContent> mContent;
|
||||
};
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_1(ObjectInterfaceRequestorShim, mContent)
|
||||
@ -1102,6 +1110,8 @@ NS_IMPL_CYCLE_COLLECTION_1(ObjectInterfaceRequestorShim, mContent)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(ObjectInterfaceRequestorShim)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIInterfaceRequestor)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIChannelEventSink)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIStreamListener)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIRequestObserver)
|
||||
NS_INTERFACE_MAP_ENTRY_AMBIGUOUS(nsISupports, nsIInterfaceRequestor)
|
||||
NS_INTERFACE_MAP_END
|
||||
|
||||
@ -2261,7 +2271,7 @@ nsObjectLoadingContent::OpenChannel()
|
||||
}
|
||||
|
||||
// AsyncOpen can fail if a file does not exist.
|
||||
rv = chan->AsyncOpen(this, nullptr);
|
||||
rv = chan->AsyncOpen(shim, nullptr);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
LOG(("OBJLC [%p]: Channel opened", this));
|
||||
mChannel = chan;
|
||||
|
Loading…
Reference in New Issue
Block a user