if (doc && !baseURL) { rv = doc->GetBaseURL(*getter_AddRefs(baseURL));
if (!baseURL) { mNodeInfo->GetDocument(*getter_AddRefs(doc)); if (doc) { rv = doc->GetBaseURL(*getter_AddRefs(baseURL)); }
nsHTMLImageElement::SetSrc(const nsAString& aSrc){  /*   * If caller is not chrome and dom.disable_image_src_set is true,   * prevent setting image.src by exiting early   */  nsCOMPtr<nsIPref> prefs(do_GetService(kPrefServiceCID));  if (prefs) {    PRBool disableImageSrcSet = PR_FALSE;    prefs->GetBoolPref("dom.disable_image_src_set", &disableImageSrcSet);    if (disableImageSrcSet && !nsContentUtils::IsCallerChrome()) {      return NS_OK;    }  }  nsCOMPtr<nsIURI> baseURL;  nsresult rv = NS_OK;  (void) GetCallerSourceURL(getter_AddRefs(baseURL));  nsCOMPtr<nsIDocument> doc;  mNodeInfo->GetDocument(*getter_AddRefs(doc));  if (doc && !baseURL) {    rv = doc->GetBaseURL(*getter_AddRefs(baseURL));  }  if (NS_SUCCEEDED(rv)) {    rv = SetSrcInner(baseURL, aSrc);  }  return rv;}