Logo Search packages:      
Sourcecode: xulrunner version File versions

nsresult nsObjectLoadingContent::Instantiate ( nsIObjectFrame *  aFrame,
const nsACString &  aMIMEType,
nsIURI *  aURI 
) [private]

Instantiates the plugin. This differs from GetFrame()->Instantiate() in that it ensures that the URI will be non-null, and that a MIME type will be passed. Note that this can cause the frame to be deleted while we're instantiating the plugin.

Definition at line 1689 of file nsObjectLoadingContent.cpp.

References GetObjectBaseURI(), mInstantiating, and mPendingInstantiateEvent.

Referenced by TryInstantiate().

{
  NS_ASSERTION(aFrame, "Must have a frame here");

  // We're instantiating now, invalidate any pending async instantiate
  // calls.
  mPendingInstantiateEvent = nsnull;

  // Mark that we're instantiating now so that we don't end up
  // re-entering instantiation code.
  PRBool oldInstantiatingValue = mInstantiating;
  mInstantiating = PR_TRUE;

  nsCString typeToUse(aMIMEType);
  if (typeToUse.IsEmpty() && aURI) {
    IsPluginEnabledByExtension(aURI, typeToUse);
  }

  nsCOMPtr<nsIURI> baseURI;
  if (!aURI) {
    // We need some URI. If we have nothing else, use the base URI.
    // XXX(biesi): The code used to do this. Not sure why this is correct...
    nsCOMPtr<nsIContent> thisContent = 
      do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
    NS_ASSERTION(thisContent, "must be a content");

    GetObjectBaseURI(thisContent, getter_AddRefs(baseURI));
    aURI = baseURI;
  }

  // We'll always have a type or a URI by the time we get here
  NS_ASSERTION(aURI || !typeToUse.IsEmpty(), "Need a URI or a type");
  LOG(("OBJLC [%p]: Calling [%p]->Instantiate(<%s>, %p)\n", this, aFrame,
       typeToUse.get(), aURI));
  nsresult rv = aFrame->Instantiate(typeToUse.get(), aURI);

  mInstantiating = oldInstantiatingValue;

  return rv;
}


Generated by  Doxygen 1.6.0   Back to index