void set_current_mon(HTMLOuterWindow *This, IMoniker *mon, DWORD flags) { IUriContainer *uri_container; IUri *uri = NULL; HRESULT hres; if(This->mon) { if(This->doc_obj && !(flags & (BINDING_REPLACE|BINDING_REFRESH))) { if(This == This->doc_obj->basedoc.window) notify_travellog_update(This->doc_obj); else TRACE("Skipping travellog update for frame navigation.\n"); } IMoniker_Release(This->mon); This->mon = NULL; } This->load_flags = flags; if(!mon) return; IMoniker_AddRef(mon); This->mon = mon; hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container); if(SUCCEEDED(hres)) { hres = IUriContainer_GetIUri(uri_container, &uri); IUriContainer_Release(uri_container); if(hres != S_OK) { WARN("GetIUri failed: %08x\n", hres); uri = NULL; } } if(!uri) { WCHAR *url; hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url); if(SUCCEEDED(hres)) { hres = create_uri(url, 0, &uri); if(FAILED(hres)) { WARN("CrateUri failed: %08x\n", hres); set_current_uri(This, NULL); This->url = SysAllocString(url); CoTaskMemFree(url); return; } CoTaskMemFree(url); }else { WARN("GetDisplayName failed: %08x\n", hres); } } set_current_uri(This, uri); if(uri) IUri_Release(uri); set_script_mode(This, use_gecko_script(This) ? SCRIPTMODE_GECKO : SCRIPTMODE_ACTIVESCRIPT); }
static HRESULT WINAPI PersistHistory_LoadHistory(IPersistHistory *iface, IStream *pStream, IBindCtx *pbc) { HTMLDocument *This = impl_from_IPersistHistory(iface); ULONG str_len, read; WCHAR *uri_str; IUri *uri; HRESULT hres; TRACE("(%p)->(%p %p)\n", This, pStream, pbc); if(!This->window) { FIXME("No current window\n"); return E_UNEXPECTED; } if(pbc) FIXME("pbc not supported\n"); if(This->doc_obj->client) { IOleCommandTarget *cmdtrg = NULL; hres = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget, (void**)&cmdtrg); if(SUCCEEDED(hres)) { IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 138, 0, NULL, NULL); IOleCommandTarget_Release(cmdtrg); } } hres = IStream_Read(pStream, &str_len, sizeof(str_len), &read); if(FAILED(hres)) return hres; if(read != sizeof(str_len)) return E_FAIL; uri_str = heap_alloc((str_len+1)*sizeof(WCHAR)); if(!uri_str) return E_OUTOFMEMORY; hres = IStream_Read(pStream, uri_str, str_len*sizeof(WCHAR), &read); if(SUCCEEDED(hres) && read != str_len*sizeof(WCHAR)) hres = E_FAIL; if(SUCCEEDED(hres)) { uri_str[str_len] = 0; hres = create_uri(uri_str, 0, &uri); } heap_free(uri_str); if(FAILED(hres)) return hres; hres = load_uri(This->window, uri, BINDING_FROMHIST); IUri_Release(uri); return hres; }
HRESULT create_moniker_from_url(LPCWSTR url, IMoniker **mon) { HRESULT hr; IUri *uri; TRACE("%s\n", debugstr_w(url)); if (FAILED(hr = create_uri(url, &uri))) return hr; hr = CreateURLMonikerEx2(NULL, uri, mon, 0); IUri_Release(uri); return hr; }
HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBindCtx *pibc, nsChannelBSC *async_bsc, BOOL set_download) { download_proc_task_t *download_task; HTMLDocumentObj *doc_obj = NULL; nsChannelBSC *bscallback; nsWineURI *nsuri; LPOLESTR url; IUri *uri; HRESULT hres; if(window->doc_obj && window->doc_obj->basedoc.window == window) doc_obj = window->doc_obj; hres = IMoniker_GetDisplayName(mon, pibc, NULL, &url); if(FAILED(hres)) { WARN("GetDiaplayName failed: %08x\n", hres); return hres; } if(nav_uri) { uri = nav_uri; }else { hres = create_uri(url, 0, &uri); if(FAILED(hres)) { CoTaskMemFree(url); return hres; } } TRACE("got url: %s\n", debugstr_w(url)); set_ready_state(window, READYSTATE_LOADING); hres = create_doc_uri(window, uri, &nsuri); if(!nav_uri) IUri_Release(uri); if(SUCCEEDED(hres)) { if(async_bsc) bscallback = async_bsc; else hres = create_channelbsc(mon, NULL, NULL, 0, TRUE, &bscallback); } if(SUCCEEDED(hres)) { if(window->base.inner_window->doc) remove_target_tasks(window->base.inner_window->task_magic); abort_window_bindings(window->base.inner_window); hres = load_nsuri(window, nsuri, bscallback, LOAD_FLAGS_BYPASS_CACHE); nsISupports_Release((nsISupports*)nsuri); /* FIXME */ if(SUCCEEDED(hres)) { hres = create_pending_window(window, bscallback); TRACE("pending window for %p %p %p\n", window, bscallback, window->pending_window); } if(bscallback != async_bsc) IBindStatusCallback_Release(&bscallback->bsc.IBindStatusCallback_iface); } if(FAILED(hres)) { CoTaskMemFree(url); return hres; } if(doc_obj) { HTMLDocument_LockContainer(doc_obj, TRUE); if(doc_obj->frame) { docobj_task_t *task; task = heap_alloc(sizeof(docobj_task_t)); task->doc = doc_obj; hres = push_task(&task->header, set_progress_proc, NULL, doc_obj->basedoc.task_magic); if(FAILED(hres)) { CoTaskMemFree(url); return hres; } } download_task = heap_alloc(sizeof(download_proc_task_t)); download_task->doc = doc_obj; download_task->set_download = set_download; download_task->url = url; return push_task(&download_task->header, set_downloading_proc, set_downloading_task_destr, doc_obj->basedoc.task_magic); } return S_OK; }
HRESULT create_relative_uri(HTMLOuterWindow *window, const WCHAR *rel_uri, IUri **uri) { return window->uri ? CoInternetCombineUrlEx(window->uri, rel_uri, URL_ESCAPE_SPACES_ONLY|URL_DONT_ESCAPE_EXTRA_INFO, uri, 0) : create_uri(rel_uri, 0, uri); }
static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface) { HTMLFormElement *This = impl_from_IHTMLFormElement(iface); HTMLOuterWindow *window = NULL, *this_window = NULL; nsIInputStream *post_stream; nsAString action_uri_str, target_str; IUri *uri; nsresult nsres; HRESULT hres; TRACE("(%p)->()\n", This); if(This->element.node.doc) { HTMLDocumentNode *doc = This->element.node.doc; if(doc->window && doc->window->base.outer_window) this_window = doc->window->base.outer_window; } if(!this_window) { TRACE("No outer window\n"); return S_OK; } nsAString_Init(&target_str, NULL); nsres = nsIDOMHTMLFormElement_GetTarget(This->nsform, &target_str); if(NS_SUCCEEDED(nsres)) { BOOL use_new_window; window = get_target_window(this_window, &target_str, &use_new_window); if(use_new_window) FIXME("submit to new window is not supported\n"); } nsAString_Finish(&target_str); if(!window) return S_OK; /* * FIXME: We currently don't use our submit implementation for sub-windows because * load_nsuri can't support post data. We should fix it. */ if(!window->doc_obj || window->doc_obj->basedoc.window != window) { nsres = nsIDOMHTMLFormElement_Submit(This->nsform); IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); if(NS_FAILED(nsres)) { ERR("Submit failed: %08x\n", nsres); return E_FAIL; } return S_OK; } nsAString_Init(&action_uri_str, NULL); nsres = nsIDOMHTMLFormElement_GetFormData(This->nsform, NULL, &action_uri_str, &post_stream); if(NS_SUCCEEDED(nsres)) { const PRUnichar *action_uri; nsAString_GetData(&action_uri_str, &action_uri); hres = create_uri(action_uri, 0, &uri); }else { ERR("GetFormData failed: %08x\n", nsres); hres = E_FAIL; } nsAString_Finish(&action_uri_str); if(SUCCEEDED(hres)) { window->readystate_locked++; hres = submit_form(window, uri, post_stream); window->readystate_locked--; IUri_Release(uri); } IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); if(post_stream) nsIInputStream_Release(post_stream); return hres; }
static HRESULT WINAPI HTMLFormElement_submit(IHTMLFormElement *iface) { HTMLFormElement *This = impl_from_IHTMLFormElement(iface); HTMLOuterWindow *window = NULL, *this_window = NULL; nsAString action_uri_str, target_str, method_str; nsIInputStream *post_stream; BOOL is_post_submit = FALSE; IUri *uri; nsresult nsres; HRESULT hres; BOOL use_new_window = FALSE; TRACE("(%p)\n", This); if(This->element.node.doc) { HTMLDocumentNode *doc = This->element.node.doc; if(doc->window && doc->window->base.outer_window) this_window = doc->window->base.outer_window; } if(!this_window) { TRACE("No outer window\n"); return S_OK; } nsAString_Init(&target_str, NULL); nsres = nsIDOMHTMLFormElement_GetTarget(This->nsform, &target_str); if(NS_SUCCEEDED(nsres)) window = get_target_window(this_window, &target_str, &use_new_window); if(!window && !use_new_window) { nsAString_Finish(&target_str); return S_OK; } nsAString_Init(&method_str, NULL); nsres = nsIDOMHTMLFormElement_GetMethod(This->nsform, &method_str); if(NS_SUCCEEDED(nsres)) { const PRUnichar *method; static const PRUnichar postW[] = {'p','o','s','t',0}; nsAString_GetData(&method_str, &method); TRACE("method is %s\n", debugstr_w(method)); is_post_submit = !strcmpiW(method, postW); } nsAString_Finish(&method_str); /* * FIXME: We currently use our submit implementation for POST submit. We should always use it. */ if(window && !is_post_submit) { nsres = nsIDOMHTMLFormElement_Submit(This->nsform); nsAString_Finish(&target_str); IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); if(NS_FAILED(nsres)) { ERR("Submit failed: %08x\n", nsres); return E_FAIL; } return S_OK; } nsAString_Init(&action_uri_str, NULL); nsres = nsIDOMHTMLFormElement_GetFormData(This->nsform, NULL, &action_uri_str, &post_stream); if(NS_SUCCEEDED(nsres)) { const PRUnichar *action_uri; nsAString_GetData(&action_uri_str, &action_uri); hres = create_uri(action_uri, 0, &uri); }else { ERR("GetFormData failed: %08x\n", nsres); hres = E_FAIL; } nsAString_Finish(&action_uri_str); if(SUCCEEDED(hres)) { const PRUnichar *target; nsAString_GetData(&target_str, &target); hres = submit_form(window, target, uri, post_stream); IUri_Release(uri); } nsAString_Finish(&target_str); if(window) IHTMLWindow2_Release(&window->base.IHTMLWindow2_iface); if(post_stream) nsIInputStream_Release(post_stream); return hres; }
cloud_queue::cloud_queue(const storage_uri& uri, storage_credentials credentials) : m_client(create_service_client(uri, std::move(credentials))), m_name(read_queue_name(uri)), m_uri(create_uri(uri)), m_approximate_message_count(-1) { }
cloud_table::cloud_table(const storage_uri& uri, storage_credentials credentials) : m_client(create_service_client(uri, std::move(credentials))), m_name(read_table_name(uri)), m_uri(create_uri(uri)) { }
extern void init_suite(int argc, char **argv) { create_uri(); }