Logo Search packages:      
Sourcecode: xulrunner version File versions

nsresult nsObjectLoadingContent::LoadObject ( const nsAString aURI,
PRBool  aNotify,
const nsCString &  aTypeHint = EmptyCString(),
PRBool  aForceLoad = PR_FALSE 
) [protected]

Load the object from the given URI.

Parameters:
aURI The URI to load.
aNotify If true, nsIDocumentObserver state change notifications will be sent as needed.
aTypeHint MIME Type hint. Overridden by the server unless this class has the eOverrideServerType capability.
aForceLoad If true, the object will be refetched even if the URI is the same as the currently-loaded object.
Note:
Prefer the nsIURI-taking version of this function if a URI object is already available.
See also:
the URI-taking version of this function for a detailed description of how a plugin will be found.

Definition at line 901 of file nsObjectLoadingContent.cpp.

References Fallback(), GetObjectBaseURI(), and mInstantiating.

{
  LOG(("OBJLC [%p]: Loading object: URI string=<%s> notify=%i type=<%s> forceload=%i\n",
       this, NS_ConvertUTF16toUTF8(aURI).get(), aNotify, aTypeHint.get(), aForceLoad));

  NS_ASSERTION(!mInstantiating, "LoadObject was reentered?");

  // Avoid StringToURI in order to use the codebase attribute as base URI
  nsCOMPtr<nsIContent> thisContent = 
    do_QueryInterface(static_cast<nsIImageLoadingContent*>(this));
  NS_ASSERTION(thisContent, "must be a content");

  nsIDocument* doc = thisContent->GetOwnerDoc();
  nsCOMPtr<nsIURI> baseURI;
  GetObjectBaseURI(thisContent, getter_AddRefs(baseURI));

  nsCOMPtr<nsIURI> uri;
  nsContentUtils::NewURIWithDocumentCharset(getter_AddRefs(uri),
                                            aURI, doc,
                                            baseURI);
  // If URI creation failed, fallback immediately - this only happens for
  // malformed URIs
  if (!uri) {
    Fallback(aNotify);
    return NS_OK;
  }

  NS_TryToSetImmutable(uri);

  return LoadObject(uri, aNotify, aTypeHint, aForceLoad);
}


Generated by  Doxygen 1.6.0   Back to index