HRESULT set_frame_doc(HTMLFrameBase *frame, nsIDOMDocument *nsdoc) { nsIDOMWindow *nswindow; HTMLOuterWindow *window; nsresult nsres; HRESULT hres = S_OK; if(frame->content_window) return S_OK; nsres = nsIDOMDocument_GetDefaultView(nsdoc, &nswindow); if(NS_FAILED(nsres) || !nswindow) return E_FAIL; window = nswindow_to_window(nswindow); if(!window) hres = HTMLOuterWindow_Create(frame->element.node.doc->basedoc.doc_obj, nswindow, frame->element.node.doc->basedoc.window, &window); nsIDOMWindow_Release(nswindow); if(FAILED(hres)) return hres; frame->content_window = window; window->frame_element = frame; return S_OK; }
static nsresult NSAPI nsPromptService_Alert(nsIPromptService *iface, nsIDOMWindow *aParent, const PRUnichar *aDialogTitle, const PRUnichar *aText) { HTMLWindow *window; BSTR text; TRACE("(%p %s %s)\n", aParent, debugstr_w(aDialogTitle), debugstr_w(aText)); window = nswindow_to_window(aParent); if(!window) { WARN("Could not find HTMLWindow for nsIDOMWindow %p\n", aParent); return NS_ERROR_UNEXPECTED; } text = SysAllocString(aText); IHTMLWindow2_alert(&window->IHTMLWindow2_iface, text); SysFreeString(text); return NS_OK; }