if(aURI) { nsIDocument *document = aPresContext->PresShell()->GetDocument(); if (! document) return NS_ERROR_FAILURE;  nsIURI *docURI = document->GetDocumentURI();   PRInt16 shouldLoad = nsIContentPolicy::ACCEPT; nsresult rv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_OBJECT, aURI, docURI, mContent, nsDependentCString(aMimetype ? aMimetype : ""), nsnull, &shouldLoad); if (NS_FAILED(rv) || NS_CP_REJECTED(shouldLoad)) { return NS_ERROR_CONTENT_BLOCKED_SHOW_ALT; } }  nsCOMPtr<nsIDocument> doc; nsresult rv = mInstanceOwner->GetDocument(getter_AddRefs(doc)); nsCOMPtr<nsIPluginDocument> pDoc (do_QueryInterface(doc));  if (pDoc) {    nsCAutoString spec; rv = aURI->GetSpec(spec); if (NS_SUCCEEDED(rv)) { NS_ConvertUTF8toUCS2 url(spec);  nsCOMPtr<nsIStreamListener> stream; rv = aPluginHost->InstantiateFullPagePlugin(aMimetype, url,        *getter_AddRefs(stream), mInstanceOwner); if (NS_SUCCEEDED(rv)) pDoc->SetStreamListener(stream); } } else {    rv = aPluginHost->InstantiateEmbededPlugin(aMimetype, aURI, mInstanceOwner); }  return rv;
nsObjectFrame::InstantiatePlugin(nsIPresContext&          aPresContext,							nsHTMLReflowMetrics&     aMetrics,							const nsHTMLReflowState& aReflowState,							nsIPluginHost* aPluginHost, 							const char* aMimetype,							nsIURL* aURL){  nsIView *parentWithView;  nsPoint origin;  nsPluginWindow  *window;  float           t2p;  aPresContext.GetTwipsToPixels(&t2p);  SetFullURL(aURL);  // we need to recalculate this now that we have access to the nsPluginInstanceOwner  // and its size info (as set in the tag)  GetDesiredSize(&aPresContext, aReflowState, aMetrics);  if (nsnull != aMetrics.maxElementSize)   {    //XXX              AddBorderPaddingToMaxElementSize(borderPadding);    aMetrics.maxElementSize->width = aMetrics.width;    aMetrics.maxElementSize->height = aMetrics.height;  }  mInstanceOwner->GetWindow(window);  GetOffsetFromView(origin, &parentWithView);  window->x = NSTwipsToIntPixels(origin.x, t2p);  window->y = NSTwipsToIntPixels(origin.y, t2p);  window->width = NSTwipsToIntPixels(aMetrics.width, t2p);  window->height = NSTwipsToIntPixels(aMetrics.height, t2p);  window->clipRect.top = 0;  window->clipRect.left = 0;  window->clipRect.bottom = NSTwipsToIntPixels(aMetrics.height, t2p);  window->clipRect.right = NSTwipsToIntPixels(aMetrics.width, t2p);#ifdef XP_UNIX  window->ws_info = nsnull;   //XXX need to figure out what this is. MMP#endif  return aPluginHost->InstantiateEmbededPlugin(aMimetype, aURL, mInstanceOwner);}