nsresult rv; nsRect bounds;  WEB_TRACE(WEB_TRACE_CALLS, ("nsWebShell::Embed: this=%p aDocViewer=%p aCommand=%s aExtraInfo=%p", this, aContentViewer, aCommand ? aCommand : "", aExtraInfo));  NS_IF_RELEASE(mContentViewer); if (nsnull != mScriptContext) { mScriptContext->GC(); } mContentViewer = aContentViewer; NS_ADDREF(aContentViewer);    if(mWindow && mWindow->GetNativeData(NS_NATIVE_WIDGET)) { mWindow->GetClientBounds(bounds); bounds.x = bounds.y = 0; rv = mContentViewer->Init(mWindow->GetNativeData(NS_NATIVE_WIDGET), mDeviceContext, mPrefs, bounds, mScrollPref);     if (mContentViewer && mHistoryState) { nsCOMPtr<nsIDocumentViewer> docv = do_QueryInterface(mContentViewer); if (nsnull != docv) { nsCOMPtr<nsIPresShell> shell; rv = docv->GetPresShell(*getter_AddRefs(shell)); if (NS_SUCCEEDED(rv)) { rv = shell->SetHistoryState((nsILayoutHistoryState*) mHistoryState); } } }  if (NS_SUCCEEDED(rv)) { mContentViewer->Show(); } } else { mContentViewer = nsnull; }   DestroyChildren();  return rv;
return nsDocShell::Embed(aContentViewer, aCommand, aExtraInfo);
nsWebShell::Embed(nsIContentViewer* aContentViewer,                  const char* aCommand,                  nsISupports* aExtraInfo){  nsresult rv;  nsRect bounds;  WEB_TRACE(WEB_TRACE_CALLS,      ("nsWebShell::Embed: this=%p aDocViewer=%p aCommand=%s aExtraInfo=%p",       this, aContentViewer, aCommand ? aCommand : "", aExtraInfo));  NS_IF_RELEASE(mContentViewer);  if (nsnull != mScriptContext) {    mScriptContext->GC();  }  mContentViewer = aContentViewer;  NS_ADDREF(aContentViewer);  // check to see if we have a window to embed into --dwc0001  /* Note we also need to check for the presence of a native widget. If the     webshell is hidden before it's embedded, which can happen in an onload     handler, the native widget is destroyed before this code is run.  This     appears to be mostly harmless except on Windows, where the subsequent     attempt to create a child window without a parent is met with disdain     by the OS. It's handy, then, that GetNativeData on Windows returns     null in this case. */  if(mWindow && mWindow->GetNativeData(NS_NATIVE_WIDGET)) {    mWindow->GetClientBounds(bounds);    bounds.x = bounds.y = 0;    rv = mContentViewer->Init(mWindow->GetNativeData(NS_NATIVE_WIDGET),                              mDeviceContext,                              mPrefs,                              bounds,                              mScrollPref);    // If the history state has been set by session history,    // set it on the pres shell now that we have a content    // viewer.    if (mContentViewer && mHistoryState) {      nsCOMPtr<nsIDocumentViewer> docv = do_QueryInterface(mContentViewer);      if (nsnull != docv) {        nsCOMPtr<nsIPresShell> shell;        rv = docv->GetPresShell(*getter_AddRefs(shell));        if (NS_SUCCEEDED(rv)) {          rv = shell->SetHistoryState((nsILayoutHistoryState*) mHistoryState);        }      }    }    if (NS_SUCCEEDED(rv)) {      mContentViewer->Show();    }  } else {    mContentViewer = nsnull;  }  // Now that we have switched documents, forget all of our children  DestroyChildren();  return rv;}