if(!mDocLoaderObserver && mParent) {  nsCOMPtr<nsIDocShellTreeItem> rootItem; GetSameTypeRootTreeItem(getter_AddRefs(rootItem)); nsCOMPtr<nsIDocShell> rootDocShell(do_QueryInterface(rootItem)); if(rootDocShell) rootDocShell->GetDocLoaderObserver(getter_AddRefs(dlObserver)); } else dlObserver = do_QueryInterface(mDocLoaderObserver);  if(mContainer && dlObserver) dlObserver->OnStartDocumentLoad(mDocLoader, aURL, aCommand);
NS_RELEASE(presContext);
nsWebShell::OnStartDocumentLoad(nsIDocumentLoader* loader,                                nsIURI* aURL,                                const char* aCommand){  nsresult rv = NS_ERROR_FAILURE;   if(loader == mDocLoader)      {      nsCOMPtr<nsIDocumentLoaderObserver> dlObserver;      if(!mDocLoaderObserver && mParent)         {         /* If this is a frame (in which case it would have a parent && doesn't          * have a documentloaderObserver, get it from the rootWebShell          */         nsCOMPtr<nsIDocShellTreeItem> rootItem;         GetSameTypeRootTreeItem(getter_AddRefs(rootItem));         nsCOMPtr<nsIDocShell> rootDocShell(do_QueryInterface(rootItem));         if(rootDocShell)            rootDocShell->GetDocLoaderObserver(getter_AddRefs(dlObserver));         }      else         dlObserver = do_QueryInterface(mDocLoaderObserver);  // we need this to addref      /*       * Fire the OnStartDocumentLoad of the webshell observer       */      if(mContainer && dlObserver)         dlObserver->OnStartDocumentLoad(mDocLoader, aURL, aCommand);      }   return rv;}