ReactOS  0.4.14-dev-98-gb0d4763
navigate.c File Reference
#include "mshtml_private.h"
#include <hlguids.h>
#include <htiface.h>
Include dependency graph for navigate.c:

Go to the source code of this file.

Classes

struct  nsProtocolStream
 
struct  nsRedirectCallback
 
struct  stop_request_task_t
 
struct  start_doc_binding_task_t
 
struct  navigate_javascript_task_t
 
struct  navigate_task_t
 

Macros

#define CONTENT_LENGTH   "Content-Length"
 
#define UTF8_STR   "utf-8"
 
#define UTF16_STR   "utf-16"
 

Functions

static nsProtocolStreamimpl_from_nsIInputStream (nsIInputStream *iface)
 
static nsresult NSAPI nsInputStream_QueryInterface (nsIInputStream *iface, nsIIDRef riid, void **result)
 
static nsrefcnt NSAPI nsInputStream_AddRef (nsIInputStream *iface)
 
static nsrefcnt NSAPI nsInputStream_Release (nsIInputStream *iface)
 
static nsresult NSAPI nsInputStream_Close (nsIInputStream *iface)
 
static nsresult NSAPI nsInputStream_Available (nsIInputStream *iface, UINT64 *_retval)
 
static nsresult NSAPI nsInputStream_Read (nsIInputStream *iface, char *aBuf, UINT32 aCount, UINT32 *_retval)
 
static nsresult NSAPI nsInputStream_ReadSegments (nsIInputStream *iface, nsresult(WINAPI *aWriter)(nsIInputStream *, void *, const char *, UINT32, UINT32, UINT32 *), void *aClousure, UINT32 aCount, UINT32 *_retval)
 
static nsresult NSAPI nsInputStream_IsNonBlocking (nsIInputStream *iface, cpp_bool *_retval)
 
static nsProtocolStreamcreate_nsprotocol_stream (void)
 
static void release_request_data (request_data_t *request_data)
 
static BSCallbackimpl_from_IBindStatusCallback (IBindStatusCallback *iface)
 
static HRESULT WINAPI BindStatusCallback_QueryInterface (IBindStatusCallback *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI BindStatusCallback_AddRef (IBindStatusCallback *iface)
 
static ULONG WINAPI BindStatusCallback_Release (IBindStatusCallback *iface)
 
static HRESULT WINAPI BindStatusCallback_OnStartBinding (IBindStatusCallback *iface, DWORD dwReserved, IBinding *pbind)
 
static HRESULT WINAPI BindStatusCallback_GetPriority (IBindStatusCallback *iface, LONG *pnPriority)
 
static HRESULT WINAPI BindStatusCallback_OnLowResource (IBindStatusCallback *iface, DWORD reserved)
 
static HRESULT WINAPI BindStatusCallback_OnProgress (IBindStatusCallback *iface, ULONG ulProgress, ULONG ulProgressMax, ULONG ulStatusCode, LPCWSTR szStatusText)
 
static HRESULT WINAPI BindStatusCallback_OnStopBinding (IBindStatusCallback *iface, HRESULT hresult, LPCWSTR szError)
 
static HRESULT WINAPI BindStatusCallback_GetBindInfo (IBindStatusCallback *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
 
static HRESULT WINAPI BindStatusCallback_OnDataAvailable (IBindStatusCallback *iface, DWORD grfBSCF, DWORD dwSize, FORMATETC *pformatetc, STGMEDIUM *pstgmed)
 
static HRESULT WINAPI BindStatusCallback_OnObjectAvailable (IBindStatusCallback *iface, REFIID riid, IUnknown *punk)
 
static BSCallbackimpl_from_IHttpNegotiate2 (IHttpNegotiate2 *iface)
 
static HRESULT WINAPI HttpNegotiate_QueryInterface (IHttpNegotiate2 *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI HttpNegotiate_AddRef (IHttpNegotiate2 *iface)
 
static ULONG WINAPI HttpNegotiate_Release (IHttpNegotiate2 *iface)
 
static HRESULT WINAPI HttpNegotiate_BeginningTransaction (IHttpNegotiate2 *iface, LPCWSTR szURL, LPCWSTR szHeaders, DWORD dwReserved, LPWSTR *pszAdditionalHeaders)
 
static HRESULT WINAPI HttpNegotiate_OnResponse (IHttpNegotiate2 *iface, DWORD dwResponseCode, LPCWSTR szResponseHeaders, LPCWSTR szRequestHeaders, LPWSTR *pszAdditionalRequestHeaders)
 
static HRESULT WINAPI HttpNegotiate_GetRootSecurityId (IHttpNegotiate2 *iface, BYTE *pbSecurityId, DWORD *pcbSecurityId, DWORD_PTR dwReserved)
 
static BSCallbackimpl_from_IInternetBindInfo (IInternetBindInfo *iface)
 
static HRESULT WINAPI InternetBindInfo_QueryInterface (IInternetBindInfo *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI InternetBindInfo_AddRef (IInternetBindInfo *iface)
 
static ULONG WINAPI InternetBindInfo_Release (IInternetBindInfo *iface)
 
static HRESULT WINAPI InternetBindInfo_GetBindInfo (IInternetBindInfo *iface, DWORD *grfBINDF, BINDINFO *pbindinfo)
 
static HRESULT WINAPI InternetBindInfo_GetBindString (IInternetBindInfo *iface, ULONG ulStringType, LPOLESTR *ppwzStr, ULONG cEl, ULONG *pcElFetched)
 
static BSCallbackimpl_from_IServiceProvider (IServiceProvider *iface)
 
static HRESULT WINAPI BSCServiceProvider_QueryInterface (IServiceProvider *iface, REFIID riid, void **ppv)
 
static ULONG WINAPI BSCServiceProvider_AddRef (IServiceProvider *iface)
 
static ULONG WINAPI BSCServiceProvider_Release (IServiceProvider *iface)
 
static HRESULT WINAPI BSCServiceProvider_QueryService (IServiceProvider *iface, REFGUID guidService, REFIID riid, void **ppv)
 
void init_bscallback (BSCallback *This, const BSCallbackVtbl *vtbl, IMoniker *mon, DWORD bindf)
 
HRESULT read_stream (BSCallback *This, IStream *stream, void *buf, DWORD size, DWORD *ret_size)
 
static void parse_content_type (nsChannelBSC *This, const WCHAR *value)
 
static HRESULT parse_headers (const WCHAR *headers, struct list *headers_list)
 
static HRESULT process_response_headers (nsChannelBSC *This, const WCHAR *headers)
 
static void query_http_info (nsChannelBSC *This, IWinInetHttpInfo *wininet_info)
 
HRESULT start_binding (HTMLInnerWindow *inner_window, BSCallback *bscallback, IBindCtx *bctx)
 
static HRESULT read_post_data_stream (nsIInputStream *stream, BOOL contains_headers, struct list *headers_list, request_data_t *request_data)
 
static HRESULT on_start_nsrequest (nsChannelBSC *This)
 
static void on_stop_nsrequest (nsChannelBSC *This, HRESULT result)
 
static HRESULT read_stream_data (nsChannelBSC *This, IStream *stream)
 
static nsRedirectCallbackimpl_from_nsIAsyncVerifyRedirectCallback (nsIAsyncVerifyRedirectCallback *iface)
 
static nsresult NSAPI nsAsyncVerifyRedirectCallback_QueryInterface (nsIAsyncVerifyRedirectCallback *iface, nsIIDRef riid, void **result)
 
static nsrefcnt NSAPI nsAsyncVerifyRedirectCallback_AddRef (nsIAsyncVerifyRedirectCallback *iface)
 
static nsrefcnt NSAPI nsAsyncVerifyRedirectCallback_Release (nsIAsyncVerifyRedirectCallback *iface)
 
static nsresult NSAPI nsAsyncVerifyRedirectCallback_OnRedirectVerifyCallback (nsIAsyncVerifyRedirectCallback *iface, nsresult result)
 
static HRESULT create_redirect_callback (nsChannel *nschannel, nsChannelBSC *bsc, nsRedirectCallback **ret)
 
static nsChannelBSCnsChannelBSC_from_BSCallback (BSCallback *iface)
 
static void nsChannelBSC_destroy (BSCallback *bsc)
 
static HRESULT nsChannelBSC_start_binding (BSCallback *bsc)
 
static HRESULT nsChannelBSC_init_bindinfo (BSCallback *bsc)
 
static void stop_request_proc (task_t *_task)
 
static void stop_request_task_destr (task_t *_task)
 
static HRESULT async_stop_request (nsChannelBSC *This)
 
static void handle_navigation_error (nsChannelBSC *This, DWORD result)
 
static HRESULT nsChannelBSC_stop_binding (BSCallback *bsc, HRESULT result)
 
static HRESULT nsChannelBSC_read_data (BSCallback *bsc, IStream *stream)
 
static HRESULT handle_redirect (nsChannelBSC *This, const WCHAR *new_url)
 
static BOOL is_supported_doc_mime (const WCHAR *mime)
 
static IUriget_moniker_uri (IMoniker *mon)
 
static void handle_extern_mime_navigation (nsChannelBSC *This)
 
static HRESULT nsChannelBSC_on_progress (BSCallback *bsc, ULONG status_code, LPCWSTR status_text)
 
static HRESULT process_response_status_text (const WCHAR *header, const WCHAR *header_end, char **status_text)
 
static HRESULT nsChannelBSC_on_response (BSCallback *bsc, DWORD response_code, LPCWSTR response_headers)
 
static HRESULT nsChannelBSC_beginning_transaction (BSCallback *bsc, WCHAR **additional_headers)
 
HRESULT create_channelbsc (IMoniker *mon, const WCHAR *headers, BYTE *post_data, DWORD post_data_size, BOOL is_doc_binding, nsChannelBSC **retval)
 
static void start_doc_binding_proc (task_t *_task)
 
static void start_doc_binding_task_destr (task_t *_task)
 
HRESULT async_start_doc_binding (HTMLOuterWindow *window, HTMLInnerWindow *pending_window)
 
void abort_window_bindings (HTMLInnerWindow *window)
 
HRESULT channelbsc_load_stream (HTMLInnerWindow *pending_window, IMoniker *mon, IStream *stream)
 
void channelbsc_set_channel (nsChannelBSC *This, nsChannel *channel, nsIStreamListener *listener, nsISupports *context)
 
static void navigate_javascript_proc (task_t *_task)
 
static void navigate_javascript_task_destr (task_t *_task)
 
static void navigate_proc (task_t *_task)
 
static void navigate_task_destr (task_t *_task)
 
static HRESULT navigate_fragment (HTMLOuterWindow *window, IUri *uri)
 
HRESULT super_navigate (HTMLOuterWindow *window, IUri *uri, DWORD flags, const WCHAR *headers, BYTE *post_data, DWORD post_data_size)
 
HRESULT navigate_new_window (HTMLOuterWindow *window, IUri *uri, const WCHAR *name, request_data_t *request_data, IHTMLWindow2 **ret)
 
HRESULT hlink_frame_navigate (HTMLDocument *doc, LPCWSTR url, nsChannel *nschannel, DWORD hlnf, BOOL *cancel)
 
static HRESULT navigate_uri (HTMLOuterWindow *window, IUri *uri, const WCHAR *display_uri, const request_data_t *request_data, DWORD flags)
 
HRESULT load_uri (HTMLOuterWindow *window, IUri *uri, DWORD flags)
 
static HRESULT translate_uri (HTMLOuterWindow *window, IUri *orig_uri, BSTR *ret_display_uri, IUri **ret_uri)
 
HRESULT submit_form (HTMLOuterWindow *window, const WCHAR *target, IUri *submit_uri, nsIInputStream *post_stream)
 
HRESULT navigate_url (HTMLOuterWindow *window, const WCHAR *new_url, IUri *base_uri, DWORD flags)
 

Variables

static const WCHAR emptyW [] = {0}
 
static const WCHAR text_htmlW [] = {'t','e','x','t','/','h','t','m','l',0}
 
static const nsIInputStreamVtbl nsInputStreamVtbl
 
static const IBindStatusCallbackVtbl BindStatusCallbackVtbl
 
static const IHttpNegotiate2Vtbl HttpNegotiate2Vtbl
 
static const IInternetBindInfoVtbl InternetBindInfoVtbl
 
static const IServiceProviderVtbl ServiceProviderVtbl
 
static const nsIAsyncVerifyRedirectCallbackVtbl nsAsyncVerifyRedirectCallbackVtbl
 
static const BSCallbackVtbl nsChannelBSCVtbl
 

Macro Definition Documentation

◆ CONTENT_LENGTH

#define CONTENT_LENGTH   "Content-Length"

Definition at line 24 of file navigate.c.

◆ UTF16_STR

#define UTF16_STR   "utf-16"

Definition at line 26 of file navigate.c.

◆ UTF8_STR

#define UTF8_STR   "utf-8"

Definition at line 25 of file navigate.c.

Function Documentation

◆ abort_window_bindings()

void abort_window_bindings ( HTMLInnerWindow window)

Definition at line 1775 of file navigate.c.

1776 {
1777  BSCallback *iter;
1778 
1779  remove_target_tasks(window->task_magic);
1780 
1781  while(!list_empty(&window->bindings)) {
1782  iter = LIST_ENTRY(window->bindings.next, BSCallback, entry);
1783 
1784  TRACE("Aborting %p\n", iter);
1785 
1786  IBindStatusCallback_AddRef(&iter->IBindStatusCallback_iface);
1787 
1788  if(iter->binding)
1789  IBinding_Abort(iter->binding);
1790  else
1791  iter->vtbl->stop_binding(iter, E_ABORT);
1792 
1793  iter->window = NULL;
1794  list_remove(&iter->entry);
1795  list_init(&iter->entry);
1796 
1797  IBindStatusCallback_Release(&iter->IBindStatusCallback_iface);
1798  }
1799 
1800  if(window->bscallback) {
1801  IBindStatusCallback_Release(&window->bscallback->bsc.IBindStatusCallback_iface);
1802  window->bscallback = NULL;
1803  }
1804 
1805  if(window->mon) {
1806  IMoniker_Release(window->mon);
1807  window->mon = NULL;
1808  }
1809 }
IBinding * binding
Definition: binding.h:88
HTMLInnerWindow * window
Definition: binding.h:90
struct list entry
Definition: binding.h:92
smooth NULL
Definition: ftsmooth.c:416
void remove_target_tasks(LONG) DECLSPEC_HIDDEN
Definition: task.c:107
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
const BSCallbackVtbl * vtbl
Definition: binding.h:77
#define TRACE(s)
Definition: solgame.cpp:4
uint32_t entry
Definition: isohybrid.c:63
static IHTMLWindow2 * window
Definition: events.c:77
#define E_ABORT
Definition: winerror.h:2366
HRESULT(* stop_binding)(BSCallback *, HRESULT)
Definition: binding.h:114
__WINE_SERVER_LIST_INLINE int list_empty(const struct list *list)
Definition: list.h:143
IBindStatusCallback IBindStatusCallback_iface
Definition: binding.h:72
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
#define LIST_ENTRY(type)
Definition: queue.h:175

Referenced by create_pending_window(), detach_inner_window(), release_outer_window(), and set_moniker().

◆ async_start_doc_binding()

HRESULT async_start_doc_binding ( HTMLOuterWindow window,
HTMLInnerWindow pending_window 
)

Definition at line 1758 of file navigate.c.

1759 {
1761 
1762  TRACE("%p\n", pending_window);
1763 
1764  task = heap_alloc(sizeof(start_doc_binding_task_t));
1765  if(!task)
1766  return E_OUTOFMEMORY;
1767 
1768  task->window = window;
1769  task->pending_window = pending_window;
1770  IHTMLWindow2_AddRef(&pending_window->base.IHTMLWindow2_iface);
1771 
1773 }
HTMLInnerWindow * pending_window
Definition: navigate.c:1739
static void start_doc_binding_proc(task_t *_task)
Definition: navigate.c:1742
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define TRACE(s)
Definition: solgame.cpp:4
static IHTMLWindow2 * window
Definition: events.c:77
HTMLOuterWindow * window
Definition: navigate.c:1738
IHTMLWindow2 IHTMLWindow2_iface
HRESULT push_task(task_t *, task_proc_t, task_proc_t, LONG) DECLSPEC_HIDDEN
Definition: task.c:39
static void start_doc_binding_task_destr(task_t *_task)
Definition: navigate.c:1750

Referenced by async_open().

◆ async_stop_request()

static HRESULT async_stop_request ( nsChannelBSC This)
static

Definition at line 1258 of file navigate.c.

1259 {
1260  stop_request_task_t *task;
1261 
1262  if(!This->bsc.readed) {
1263  TRACE("No data read, calling OnStartRequest\n");
1265  }
1266 
1267  task = heap_alloc(sizeof(*task));
1268  if(!task)
1269  return E_OUTOFMEMORY;
1270 
1271  IBindStatusCallback_AddRef(&This->bsc.IBindStatusCallback_iface);
1272  task->bsc = This;
1273 
1274  return push_task(&task->header, stop_request_proc, stop_request_task_destr, This->bsc.window->task_magic);
1275 }
static void stop_request_task_destr(task_t *_task)
Definition: navigate.c:1250
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HRESULT on_start_nsrequest(nsChannelBSC *This)
Definition: navigate.c:903
#define TRACE(s)
Definition: solgame.cpp:4
static void stop_request_proc(task_t *_task)
Definition: navigate.c:1239
nsChannelBSC * bsc
Definition: navigate.c:1236
HRESULT push_task(task_t *, task_proc_t, task_proc_t, LONG) DECLSPEC_HIDDEN
Definition: task.c:39

Referenced by channelbsc_load_stream(), and nsChannelBSC_stop_binding().

◆ BindStatusCallback_AddRef()

static ULONG WINAPI BindStatusCallback_AddRef ( IBindStatusCallback iface)
static

Definition at line 239 of file navigate.c.

240 {
243 
244  TRACE("(%p) ref = %d\n", This, ref);
245 
246  return ref;
247 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
static BSCallback * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: navigate.c:199

◆ BindStatusCallback_GetBindInfo()

static HRESULT WINAPI BindStatusCallback_GetBindInfo ( IBindStatusCallback iface,
DWORD grfBINDF,
BINDINFO *  pbindinfo 
)
static

Definition at line 341 of file navigate.c.

343 {
345  DWORD size;
346 
347  TRACE("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
348 
349  if(!This->bindinfo_ready) {
350  HRESULT hres;
351 
352  hres = This->vtbl->init_bindinfo(This);
353  if(FAILED(hres))
354  return hres;
355 
356  This->bindinfo_ready = TRUE;
357  }
358 
359  *grfBINDF = This->bindf;
360 
361  size = pbindinfo->cbSize;
362  memset(pbindinfo, 0, size);
363  pbindinfo->cbSize = size;
364 
365  pbindinfo->cbstgmedData = This->request_data.post_data_len;
366  pbindinfo->dwCodePage = CP_UTF8;
367  pbindinfo->dwOptions = 0x80000;
368 
369  if(This->request_data.post_data_len) {
370  pbindinfo->dwBindVerb = BINDVERB_POST;
371 
372  pbindinfo->stgmedData.tymed = TYMED_HGLOBAL;
373  pbindinfo->stgmedData.u.hGlobal = This->request_data.post_data;
374  pbindinfo->stgmedData.pUnkForRelease = (IUnknown*)&This->IBindStatusCallback_iface;
375  IBindStatusCallback_AddRef(&This->IBindStatusCallback_iface);
376  }
377 
378  return S_OK;
379 }
#define TRUE
Definition: types.h:120
#define CP_UTF8
Definition: nls.h:20
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
#define S_OK
Definition: intsafe.h:59
static BSCallback * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: navigate.c:199
#define memset(x, y, z)
Definition: compat.h:39

◆ BindStatusCallback_GetPriority()

static HRESULT WINAPI BindStatusCallback_GetPriority ( IBindStatusCallback iface,
LONG pnPriority 
)
static

Definition at line 287 of file navigate.c.

288 {
290  FIXME("(%p)->(%p)\n", This, pnPriority);
291  return E_NOTIMPL;
292 }
#define FIXME(fmt,...)
Definition: debug.h:110
static BSCallback * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: navigate.c:199
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ BindStatusCallback_OnDataAvailable()

static HRESULT WINAPI BindStatusCallback_OnDataAvailable ( IBindStatusCallback iface,
DWORD  grfBSCF,
DWORD  dwSize,
FORMATETC *  pformatetc,
STGMEDIUM *  pstgmed 
)
static

Definition at line 381 of file navigate.c.

383 {
385 
386  TRACE("(%p)->(%08x %d %p %p)\n", This, grfBSCF, dwSize, pformatetc, pstgmed);
387 
388  return This->vtbl->read_data(This, pstgmed->u.pstm);
389 }
#define TRACE(s)
Definition: solgame.cpp:4
static BSCallback * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: navigate.c:199
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:54

◆ BindStatusCallback_OnLowResource()

static HRESULT WINAPI BindStatusCallback_OnLowResource ( IBindStatusCallback iface,
DWORD  reserved 
)
static

Definition at line 294 of file navigate.c.

295 {
297  FIXME("(%p)->(%d)\n", This, reserved);
298  return E_NOTIMPL;
299 }
#define FIXME(fmt,...)
Definition: debug.h:110
r reserved
Definition: btrfs.c:2893
static BSCallback * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: navigate.c:199
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ BindStatusCallback_OnObjectAvailable()

static HRESULT WINAPI BindStatusCallback_OnObjectAvailable ( IBindStatusCallback iface,
REFIID  riid,
IUnknown punk 
)
static

Definition at line 391 of file navigate.c.

393 {
395  FIXME("(%p)->(%s %p)\n", This, debugstr_guid(riid), punk);
396  return E_NOTIMPL;
397 }
REFIID riid
Definition: precomp.h:44
#define FIXME(fmt,...)
Definition: debug.h:110
#define debugstr_guid
Definition: kernel32.h:35
static BSCallback * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: navigate.c:199
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ BindStatusCallback_OnProgress()

static HRESULT WINAPI BindStatusCallback_OnProgress ( IBindStatusCallback iface,
ULONG  ulProgress,
ULONG  ulProgressMax,
ULONG  ulStatusCode,
LPCWSTR  szStatusText 
)
static

Definition at line 301 of file navigate.c.

303 {
305 
306  TRACE("%p)->(%u %u %u %s)\n", This, ulProgress, ulProgressMax, ulStatusCode,
307  debugstr_w(szStatusText));
308 
309  return This->vtbl->on_progress(This, ulStatusCode, szStatusText);
310 }
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4
static BSCallback * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: navigate.c:199

◆ BindStatusCallback_OnStartBinding()

static HRESULT WINAPI BindStatusCallback_OnStartBinding ( IBindStatusCallback iface,
DWORD  dwReserved,
IBinding pbind 
)
static

Definition at line 271 of file navigate.c.

273 {
275 
276  TRACE("(%p)->(%d %p)\n", This, dwReserved, pbind);
277 
278  IBinding_AddRef(pbind);
279  This->binding = pbind;
280 
281  if(This->window)
282  list_add_head(&This->window->bindings, &This->entry);
283 
284  return This->vtbl->start_binding(This);
285 }
__WINE_SERVER_LIST_INLINE void list_add_head(struct list *list, struct list *elem)
Definition: list.h:96
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define TRACE(s)
Definition: solgame.cpp:4
static BSCallback * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: navigate.c:199

◆ BindStatusCallback_OnStopBinding()

static HRESULT WINAPI BindStatusCallback_OnStopBinding ( IBindStatusCallback iface,
HRESULT  hresult,
LPCWSTR  szError 
)
static

Definition at line 312 of file navigate.c.

314 {
316  HRESULT hres;
317 
318  TRACE("(%p)->(%08x %s)\n", This, hresult, debugstr_w(szError));
319 
320  /* NOTE: IE7 calls GetBindResult here */
321 
322  hres = This->vtbl->stop_binding(This, hresult);
323 
324  if(This->binding) {
325  IBinding_Release(This->binding);
326  This->binding = NULL;
327  }
328 
329  if(This->mon) {
330  IMoniker_Release(This->mon);
331  This->mon = NULL;
332  }
333 
334  list_remove(&This->entry);
335  list_init(&This->entry);
336  This->window = NULL;
337 
338  return hres;
339 }
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static BSCallback * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: navigate.c:199
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149

◆ BindStatusCallback_QueryInterface()

static HRESULT WINAPI BindStatusCallback_QueryInterface ( IBindStatusCallback iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 204 of file navigate.c.

206 {
208 
209  *ppv = NULL;
210  if(IsEqualGUID(&IID_IUnknown, riid)) {
211  TRACE("(%p)->(IID_IUnknown, %p)\n", This, ppv);
212  *ppv = &This->IBindStatusCallback_iface;
213  }else if(IsEqualGUID(&IID_IBindStatusCallback, riid)) {
214  TRACE("(%p)->(IID_IBindStatusCallback, %p)\n", This, ppv);
215  *ppv = &This->IBindStatusCallback_iface;
216  }else if(IsEqualGUID(&IID_IServiceProvider, riid)) {
217  TRACE("(%p)->(IID_IServiceProvider %p)\n", This, ppv);
218  *ppv = &This->IServiceProvider_iface;
219  }else if(IsEqualGUID(&IID_IHttpNegotiate, riid)) {
220  TRACE("(%p)->(IID_IHttpNegotiate %p)\n", This, ppv);
221  *ppv = &This->IHttpNegotiate2_iface;
222  }else if(IsEqualGUID(&IID_IHttpNegotiate2, riid)) {
223  TRACE("(%p)->(IID_IHttpNegotiate2 %p)\n", This, ppv);
224  *ppv = &This->IHttpNegotiate2_iface;
225  }else if(IsEqualGUID(&IID_IInternetBindInfo, riid)) {
226  TRACE("(%p)->(IID_IInternetBindInfo %p)\n", This, ppv);
227  *ppv = &This->IInternetBindInfo_iface;
228  }
229 
230  if(*ppv) {
231  IBindStatusCallback_AddRef(&This->IBindStatusCallback_iface);
232  return S_OK;
233  }
234 
235  TRACE("Unsupported riid = %s\n", debugstr_guid(riid));
236  return E_NOINTERFACE;
237 }
#define E_NOINTERFACE
Definition: winerror.h:2364
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
const GUID IID_IUnknown
#define S_OK
Definition: intsafe.h:59
static BSCallback * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: navigate.c:199
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ BindStatusCallback_Release()

static ULONG WINAPI BindStatusCallback_Release ( IBindStatusCallback iface)
static

Definition at line 249 of file navigate.c.

250 {
253 
254  TRACE("(%p) ref = %d\n", This, ref);
255 
256  if(!ref) {
257  release_request_data(&This->request_data);
258  if(This->mon)
259  IMoniker_Release(This->mon);
260  if(This->binding)
261  IBinding_Release(This->binding);
262  list_remove(&This->entry);
263  list_init(&This->entry);
264 
265  This->vtbl->destroy(This);
266  }
267 
268  return ref;
269 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
__WINE_SERVER_LIST_INLINE void list_remove(struct list *elem)
Definition: list.h:108
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static BSCallback * impl_from_IBindStatusCallback(IBindStatusCallback *iface)
Definition: navigate.c:199
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
static void release_request_data(request_data_t *request_data)
Definition: navigate.c:190

◆ BSCServiceProvider_AddRef()

static ULONG WINAPI BSCServiceProvider_AddRef ( IServiceProvider iface)
static

Definition at line 553 of file navigate.c.

554 {
556  return IBindStatusCallback_AddRef(&This->IBindStatusCallback_iface);
557 }
static BSCallback * impl_from_IServiceProvider(IServiceProvider *iface)
Definition: navigate.c:541

◆ BSCServiceProvider_QueryInterface()

static HRESULT WINAPI BSCServiceProvider_QueryInterface ( IServiceProvider iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 546 of file navigate.c.

548 {
550  return IBindStatusCallback_QueryInterface(&This->IBindStatusCallback_iface, riid, ppv);
551 }
static BSCallback * impl_from_IServiceProvider(IServiceProvider *iface)
Definition: navigate.c:541
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ BSCServiceProvider_QueryService()

static HRESULT WINAPI BSCServiceProvider_QueryService ( IServiceProvider iface,
REFGUID  guidService,
REFIID  riid,
void **  ppv 
)
static

Definition at line 565 of file navigate.c.

567 {
569 
570  TRACE("(%p)->(%s %s %p)\n", This, debugstr_guid(guidService), debugstr_guid(riid), ppv);
571 
572  if(This->window && IsEqualGUID(guidService, &IID_IWindowForBindingUI))
573  return IServiceProvider_QueryService(&This->window->base.IServiceProvider_iface, guidService, riid, ppv);
574  return E_NOINTERFACE;
575 }
#define E_NOINTERFACE
Definition: winerror.h:2364
static BSCallback * impl_from_IServiceProvider(IServiceProvider *iface)
Definition: navigate.c:541
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021

◆ BSCServiceProvider_Release()

static ULONG WINAPI BSCServiceProvider_Release ( IServiceProvider iface)
static

Definition at line 559 of file navigate.c.

560 {
562  return IBindStatusCallback_Release(&This->IBindStatusCallback_iface);
563 }
static BSCallback * impl_from_IServiceProvider(IServiceProvider *iface)
Definition: navigate.c:541

◆ channelbsc_load_stream()

HRESULT channelbsc_load_stream ( HTMLInnerWindow pending_window,
IMoniker mon,
IStream stream 
)

Definition at line 1811 of file navigate.c.

1812 {
1813  nsChannelBSC *bscallback = pending_window->bscallback;
1814  HRESULT hres = S_OK;
1815 
1816  if(!bscallback->nschannel) {
1817  ERR("NULL nschannel\n");
1818  return E_FAIL;
1819  }
1820 
1821  bscallback->nschannel->content_type = heap_strdupA("text/html");
1822  if(!bscallback->nschannel->content_type)
1823  return E_OUTOFMEMORY;
1824 
1825  set_current_mon(pending_window->base.outer_window, mon, 0);
1826 
1827  bscallback->bsc.window = pending_window;
1828  if(stream)
1829  hres = read_stream_data(bscallback, stream);
1830  if(SUCCEEDED(hres))
1831  hres = async_stop_request(bscallback);
1832  if(FAILED(hres))
1833  IBindStatusCallback_OnStopBinding(&bscallback->bsc.IBindStatusCallback_iface, hres,
1834  ERROR_SUCCESS);
1835 
1836  return hres;
1837 }
#define ERROR_SUCCESS
Definition: deptool.c:10
static HRESULT async_stop_request(nsChannelBSC *This)
Definition: navigate.c:1258
BSCallback bsc
Definition: binding.h:98
HTMLInnerWindow * window
Definition: binding.h:90
#define E_FAIL
Definition: ddrawi.h:102
char * content_type
Definition: binding.h:53
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
Definition: parse.h:22
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
nsChannelBSC * bscallback
void set_current_mon(HTMLOuterWindow *, IMoniker *, DWORD) DECLSPEC_HIDDEN
Definition: persist.c:99
HTMLOuterWindow * outer_window
IBindStatusCallback IBindStatusCallback_iface
Definition: binding.h:72
nsChannel * nschannel
Definition: binding.h:100
static char * heap_strdupA(const char *str)
static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
Definition: navigate.c:960
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by PersistStreamInit_InitNew(), and PersistStreamInit_Load().

◆ channelbsc_set_channel()

void channelbsc_set_channel ( nsChannelBSC This,
nsChannel channel,
nsIStreamListener listener,
nsISupports context 
)

Definition at line 1839 of file navigate.c.

1840 {
1841  nsIHttpChannel_AddRef(&channel->nsIHttpChannel_iface);
1842  This->nschannel = channel;
1843 
1844  nsIStreamListener_AddRef(listener);
1845  This->nslistener = listener;
1846 
1847  if(context) {
1848  nsISupports_AddRef(context);
1849  This->nscontext = context;
1850  }
1851 
1852  if(This->bsc.request_data.headers) {
1853  HRESULT hres;
1854 
1855  hres = parse_headers(This->bsc.request_data.headers, &channel->request_headers);
1856  heap_free(This->bsc.request_data.headers);
1857  This->bsc.request_data.headers = NULL;
1858  if(FAILED(hres))
1859  WARN("parse_headers failed: %08x\n", hres);
1860  }
1861 }
nsIHttpChannel nsIHttpChannel_iface
Definition: binding.h:37
Definition: http.c:6587
#define WARN(fmt,...)
Definition: debug.h:111
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
struct list request_headers
Definition: binding.h:59
static HRESULT parse_headers(const WCHAR *headers, struct list *headers_list)
Definition: navigate.c:681
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by async_open(), and nsChannel_AsyncOpen().

◆ create_channelbsc()

HRESULT create_channelbsc ( IMoniker mon,
const WCHAR headers,
BYTE post_data,
DWORD  post_data_size,
BOOL  is_doc_binding,
nsChannelBSC **  retval 
)

Definition at line 1693 of file navigate.c.

1695 {
1696  nsChannelBSC *ret;
1697  DWORD bindf;
1698 
1699  ret = heap_alloc_zero(sizeof(*ret));
1700  if(!ret)
1701  return E_OUTOFMEMORY;
1702 
1703  bindf = BINDF_ASYNCHRONOUS | BINDF_ASYNCSTORAGE | BINDF_PULLDATA;
1704  if(post_data_size)
1705  bindf |= BINDF_FORMS_SUBMIT | BINDF_PRAGMA_NO_CACHE | BINDF_HYPERLINK | BINDF_GETNEWESTVERSION;
1706 
1707  init_bscallback(&ret->bsc, &nsChannelBSCVtbl, mon, bindf);
1708  ret->is_doc_channel = is_doc_binding;
1709 
1710  if(headers) {
1711  ret->bsc.request_data.headers = heap_strdupW(headers);
1712  if(!ret->bsc.request_data.headers) {
1713  IBindStatusCallback_Release(&ret->bsc.IBindStatusCallback_iface);
1714  return E_OUTOFMEMORY;
1715  }
1716  }
1717 
1718  if(post_data) {
1719  ret->bsc.request_data.post_data = GlobalAlloc(0, post_data_size+1);
1720  if(!ret->bsc.request_data.post_data) {
1721  release_request_data(&ret->bsc.request_data);
1722  IBindStatusCallback_Release(&ret->bsc.IBindStatusCallback_iface);
1723  return E_OUTOFMEMORY;
1724  }
1725 
1726  memcpy(ret->bsc.request_data.post_data, post_data, post_data_size);
1727  ((BYTE*)ret->bsc.request_data.post_data)[post_data_size] = 0;
1728  ret->bsc.request_data.post_data_len = post_data_size;
1729  }
1730 
1731  TRACE("created %p\n", ret);
1732  *retval = ret;
1733  return S_OK;
1734 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
vector< Header * > headers
Definition: sdkparse.cpp:39
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
static const BSCallbackVtbl nsChannelBSCVtbl
Definition: navigate.c:1682
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
static const CHAR post_data[]
Definition: protocol.c:215
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
void init_bscallback(BSCallback *This, const BSCallbackVtbl *vtbl, IMoniker *mon, DWORD bindf)
Definition: navigate.c:584
#define S_OK
Definition: intsafe.h:59
static void release_request_data(request_data_t *request_data)
Definition: navigate.c:190
static DWORD bindf
Definition: protocol.c:70

Referenced by async_open(), hlink_frame_navigate(), navigate_new_window(), set_moniker(), and super_navigate().

◆ create_nsprotocol_stream()

static nsProtocolStream* create_nsprotocol_stream ( void  )
static

Definition at line 175 of file navigate.c.

176 {
178 
179  ret = heap_alloc(sizeof(nsProtocolStream));
180  if(!ret)
181  return NULL;
182 
183  ret->nsIInputStream_iface.lpVtbl = &nsInputStreamVtbl;
184  ret->ref = 1;
185  ret->buf_size = 0;
186 
187  return ret;
188 }
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static const nsIInputStreamVtbl nsInputStreamVtbl
Definition: navigate.c:164
smooth NULL
Definition: ftsmooth.c:416
int ret

Referenced by read_stream_data().

◆ create_redirect_callback()

static HRESULT create_redirect_callback ( nsChannel nschannel,
nsChannelBSC bsc,
nsRedirectCallback **  ret 
)
static

Definition at line 1167 of file navigate.c.

1168 {
1170 
1171  callback = heap_alloc(sizeof(*callback));
1172  if(!callback)
1173  return E_OUTOFMEMORY;
1174 
1175  callback->nsIAsyncVerifyRedirectCallback_iface.lpVtbl = &nsAsyncVerifyRedirectCallbackVtbl;
1176  callback->ref = 1;
1177 
1178  nsIHttpChannel_AddRef(&nschannel->nsIHttpChannel_iface);
1179  callback->nschannel = nschannel;
1180 
1181  IBindStatusCallback_AddRef(&bsc->bsc.IBindStatusCallback_iface);
1182  callback->bsc = bsc;
1183 
1184  *ret = callback;
1185  return S_OK;
1186 }
nsIHttpChannel nsIHttpChannel_iface
Definition: binding.h:37
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static IBindStatusCallbackEx bsc
Definition: url.c:2149
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
int ret
#define S_OK
Definition: intsafe.h:59
static const nsIAsyncVerifyRedirectCallbackVtbl nsAsyncVerifyRedirectCallbackVtbl
Definition: navigate.c:1160

Referenced by handle_redirect().

◆ get_moniker_uri()

static IUri* get_moniker_uri ( IMoniker mon)
static

Definition at line 1449 of file navigate.c.

1450 {
1451  IUriContainer *uri_container;
1452  IUri *ret = NULL;
1453  HRESULT hres;
1454 
1455  hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
1456  if(SUCCEEDED(hres)) {
1457  hres = IUriContainer_GetIUri(uri_container, &ret);
1458  IUriContainer_Release(uri_container);
1459  if(FAILED(hres))
1460  return NULL;
1461  }else {
1462  FIXME("No IUriContainer\n");
1463  }
1464 
1465  return ret;
1466 }
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
int ret
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by handle_extern_mime_navigation().

◆ handle_extern_mime_navigation()

static void handle_extern_mime_navigation ( nsChannelBSC This)
static

Definition at line 1468 of file navigate.c.

1469 {
1470  IWebBrowserPriv2IE9 *webbrowser_priv;
1471  IOleCommandTarget *cmdtrg;
1472  HTMLDocumentObj *doc_obj;
1473  IBindCtx *bind_ctx;
1474  IUri *uri;
1475  VARIANT flags;
1476  HRESULT hres;
1477 
1478  if(!This->bsc.window || !This->bsc.window->base.outer_window || !This->bsc.window->base.outer_window->doc_obj)
1479  return;
1480 
1481  doc_obj = This->bsc.window->base.outer_window->doc_obj;
1482 
1483  hres = IOleClientSite_QueryInterface(doc_obj->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
1484  if(SUCCEEDED(hres)) {
1485  IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 62, 0, NULL, NULL);
1486  IOleCommandTarget_Release(cmdtrg);
1487  }
1488 
1489  set_document_navigation(doc_obj, FALSE);
1490 
1491  if(!doc_obj->webbrowser) {
1492  FIXME("unimplemented in non-webbrowser mode\n");
1493  return;
1494  }
1495 
1496  uri = get_moniker_uri(This->bsc.mon);
1497  if(!uri)
1498  return;
1499 
1500  hres = CreateBindCtx(0, &bind_ctx);
1501  if(FAILED(hres)) {
1502  IUri_Release(uri);
1503  return;
1504  }
1505 
1506  V_VT(&flags) = VT_I4;
1507  V_I4(&flags) = navHyperlink;
1508 
1509  hres = IUnknown_QueryInterface(doc_obj->webbrowser, &IID_IWebBrowserPriv2IE8, (void**)&webbrowser_priv);
1510  if(SUCCEEDED(hres)) {
1511  hres = IWebBrowserPriv2IE9_NavigateWithBindCtx2(webbrowser_priv, uri, &flags, NULL, NULL, NULL, bind_ctx, NULL, 0);
1512  IWebBrowserPriv2IE9_Release(webbrowser_priv);
1513  }else {
1514  IWebBrowserPriv *webbrowser_priv_old;
1515  VARIANT uriv;
1516 
1517  hres = IUnknown_QueryInterface(doc_obj->webbrowser, &IID_IWebBrowserPriv, (void**)&webbrowser_priv_old);
1518  if(SUCCEEDED(hres)) {
1519  V_VT(&uriv) = VT_BSTR;
1520  IUri_GetDisplayUri(uri, &V_BSTR(&uriv));
1521 
1522  hres = IWebBrowserPriv_NavigateWithBindCtx(webbrowser_priv_old, &uriv, &flags, NULL, NULL, NULL, bind_ctx, NULL);
1523 
1524  SysFreeString(V_BSTR(&uriv));
1525  IWebBrowserPriv_Release(webbrowser_priv_old);
1526  }
1527  }
1528 
1529  IUri_Release(uri);
1530 }
Definition: compat.h:1939
IOleClientSite * client
const char * uri
Definition: sec_mgr.c:1594
static IUri * get_moniker_uri(IMoniker *mon)
Definition: navigate.c:1449
#define V_I4(A)
Definition: oleauto.h:247
void set_document_navigation(HTMLDocumentObj *, BOOL) DECLSPEC_HIDDEN
Definition: oleobj.c:193
#define FIXME(fmt,...)
Definition: debug.h:110
smooth NULL
Definition: ftsmooth.c:416
IUnknown * webbrowser
HRESULT hres
Definition: protocol.c:465
HRESULT WINAPI CreateBindCtx(DWORD reserved, LPBC *ppbc)
Definition: bindctx.c:556
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
#define V_VT(A)
Definition: oleauto.h:211
#define V_BSTR(A)
Definition: oleauto.h:226
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by nsChannelBSC_on_progress().

◆ handle_navigation_error()

static void handle_navigation_error ( nsChannelBSC This,
DWORD  result 
)
static

Definition at line 1277 of file navigate.c.

1278 {
1279  HTMLOuterWindow *outer_window;
1280  HTMLDocumentObj *doc;
1281  BOOL is_error_url;
1282  SAFEARRAY *sa;
1283  SAFEARRAYBOUND bound;
1284  VARIANT var, varOut;
1285  LONG ind;
1286  BSTR unk;
1287  HRESULT hres;
1288 
1289  if(!This->is_doc_channel || !This->bsc.window)
1290  return;
1291 
1292  outer_window = This->bsc.window->base.outer_window;
1293 
1294  doc = outer_window->doc_obj;
1295  if(!doc || !doc->doc_object_service || !doc->client)
1296  return;
1297 
1298  hres = IDocObjectService_IsErrorUrl(doc->doc_object_service,
1299  outer_window->url, &is_error_url);
1300  if(FAILED(hres) || is_error_url)
1301  return;
1302 
1303  if(!doc->client_cmdtrg)
1304  return;
1305 
1306  bound.lLbound = 0;
1307  bound.cElements = 8;
1308  sa = SafeArrayCreate(VT_VARIANT, 1, &bound);
1309  if(!sa)
1310  return;
1311 
1312  ind = 0;
1313  V_VT(&var) = VT_I4;
1314  V_I4(&var) = result;
1315  SafeArrayPutElement(sa, &ind, &var);
1316 
1317  ind = 1;
1318  V_VT(&var) = VT_BSTR;
1319  V_BSTR(&var) = outer_window->url;
1320  SafeArrayPutElement(sa, &ind, &var);
1321 
1322  ind = 3;
1323  V_VT(&var) = VT_UNKNOWN;
1324  V_UNKNOWN(&var) = (IUnknown*)&outer_window->base.IHTMLWindow2_iface;
1325  SafeArrayPutElement(sa, &ind, &var);
1326 
1327  /* FIXME: what are the following fields for? */
1328  ind = 2;
1329  V_VT(&var) = VT_UNKNOWN;
1330  V_UNKNOWN(&var) = NULL;
1331  SafeArrayPutElement(sa, &ind, &var);
1332 
1333  ind = 4;
1334  V_VT(&var) = VT_BOOL;
1335  V_BOOL(&var) = FALSE;
1336  SafeArrayPutElement(sa, &ind, &var);
1337 
1338  ind = 5;
1339  V_VT(&var) = VT_BOOL;
1340  V_BOOL(&var) = FALSE;
1341  SafeArrayPutElement(sa, &ind, &var);
1342 
1343  ind = 6;
1344  V_VT(&var) = VT_BSTR;
1345  unk = SysAllocString(NULL);
1346  V_BSTR(&var) = unk;
1347  SafeArrayPutElement(sa, &ind, &var);
1348 
1349  ind = 7;
1350  V_VT(&var) = VT_UNKNOWN;
1351  V_UNKNOWN(&var) = NULL;
1352  SafeArrayPutElement(sa, &ind, &var);
1353 
1354  V_VT(&var) = VT_ARRAY;
1355  V_ARRAY(&var) = sa;
1356  V_VT(&varOut) = VT_BOOL;
1357  V_BOOL(&varOut) = VARIANT_TRUE;
1358  IOleCommandTarget_Exec(doc->client_cmdtrg, &CGID_DocHostCmdPriv, 1, 0, &var, FAILED(hres)?NULL:&varOut);
1359 
1360  SysFreeString(unk);
1362 }
Definition: compat.h:1939
IOleClientSite * client
#define V_ARRAY(A)
Definition: oleauto.h:222
OLECHAR * BSTR
Definition: compat.h:1934
#define V_I4(A)
Definition: oleauto.h:247
unsigned int BOOL
Definition: ntddk_ex.h:94
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:241
IOleCommandTarget * client_cmdtrg
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
#define V_BOOL(A)
Definition: oleauto.h:224
HRESULT WINAPI SafeArrayDestroy(SAFEARRAY *psa)
Definition: safearray.c:1349
#define V_VT(A)
Definition: oleauto.h:211
#define V_UNKNOWN(A)
Definition: oleauto.h:281
#define V_BSTR(A)
Definition: oleauto.h:226
SAFEARRAY *WINAPI SafeArrayCreate(VARTYPE vt, UINT cDims, SAFEARRAYBOUND *rgsabound)
Definition: safearray.c:602
HTMLDocumentObj * doc_obj
IDocObjectService * doc_object_service
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
HRESULT WINAPI SafeArrayPutElement(SAFEARRAY *psa, LONG *rgIndices, void *pvData)
Definition: safearray.c:866
IHTMLWindow2 IHTMLWindow2_iface
GLuint64EXT * result
Definition: glext.h:11304
static struct sockaddr_in sa
Definition: adnsresfilter.c:69

◆ handle_redirect()

static HRESULT handle_redirect ( nsChannelBSC This,
const WCHAR new_url 
)
static

Definition at line 1389 of file navigate.c.

1390 {
1393  nsChannel *new_channel;
1394  nsresult nsres;
1395  HRESULT hres;
1396 
1397  TRACE("(%p)->(%s)\n", This, debugstr_w(new_url));
1398 
1399  if(!This->nschannel || !This->nschannel->notif_callback)
1400  return S_OK;
1401 
1402  nsres = nsIInterfaceRequestor_GetInterface(This->nschannel->notif_callback, &IID_nsIChannelEventSink, (void**)&sink);
1403  if(NS_FAILED(nsres))
1404  return S_OK;
1405 
1406  hres = create_redirect_nschannel(new_url, This->nschannel, &new_channel);
1407  if(SUCCEEDED(hres)) {
1408  TRACE("%p %p->%p\n", This, This->nschannel, new_channel);
1409 
1410  hres = create_redirect_callback(new_channel, This, &callback);
1411  nsIHttpChannel_Release(&new_channel->nsIHttpChannel_iface);
1412  }
1413 
1414  if(SUCCEEDED(hres)) {
1415  nsres = nsIChannelEventSink_AsyncOnChannelRedirect(sink, (nsIChannel*)&This->nschannel->nsIHttpChannel_iface,
1416  (nsIChannel*)&callback->nschannel->nsIHttpChannel_iface, REDIRECT_TEMPORARY, /* FIXME */
1417  &callback->nsIAsyncVerifyRedirectCallback_iface);
1418 
1419  if(NS_FAILED(nsres))
1420  FIXME("AsyncOnChannelRedirect failed: %08x\n", hres);
1421  else if(This->nschannel != callback->nschannel)
1422  FIXME("nschannel not updated\n");
1423 
1424  nsIAsyncVerifyRedirectCallback_Release(&callback->nsIAsyncVerifyRedirectCallback_iface);
1425  }
1426 
1427  nsIChannelEventSink_Release(sink);
1428  return hres;
1429 }
nsIHttpChannel nsIHttpChannel_iface
Definition: binding.h:37
static HRESULT create_redirect_callback(nsChannel *nschannel, nsChannelBSC *bsc, nsRedirectCallback **ret)
Definition: navigate.c:1167
GLsizei GLenum GLboolean sink
Definition: glext.h:5672
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
#define NS_FAILED(res)
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
HRESULT create_redirect_nschannel(const WCHAR *, nsChannel *, nsChannel **) DECLSPEC_HIDDEN
Definition: nsio.c:3251
#define S_OK
Definition: intsafe.h:59
HRESULT nsresult
Definition: nsiface.idl:39
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by nsChannelBSC_on_progress().

◆ hlink_frame_navigate()

HRESULT hlink_frame_navigate ( HTMLDocument doc,
LPCWSTR  url,
nsChannel nschannel,
DWORD  hlnf,
BOOL cancel 
)

Definition at line 2193 of file navigate.c.

2194 {
2195  IHlinkFrame *hlink_frame;
2197  IBindCtx *bindctx;
2198  IMoniker *mon;
2199  IHlink *hlink;
2200  HRESULT hres;
2201 
2202  *cancel = FALSE;
2203 
2204  hres = do_query_service((IUnknown*)doc->doc_obj->client, &IID_IHlinkFrame, &IID_IHlinkFrame,
2205  (void**)&hlink_frame);
2206  if(FAILED(hres))
2207  return S_OK;
2208 
2210  if(FAILED(hres)) {
2211  IHlinkFrame_Release(hlink_frame);
2212  return hres;
2213  }
2214 
2215  if(nschannel)
2217  &nschannel->request_headers, &callback->bsc.request_data);
2218 
2219  hres = CreateAsyncBindCtx(0, &callback->bsc.IBindStatusCallback_iface, NULL, &bindctx);
2220  if(SUCCEEDED(hres))
2221  hres = CoCreateInstance(&CLSID_StdHlink, NULL, CLSCTX_INPROC_SERVER,
2222  &IID_IHlink, (LPVOID*)&hlink);
2223 
2224  if(SUCCEEDED(hres))
2225  hres = CreateURLMoniker(NULL, url, &mon);
2226 
2227  if(SUCCEEDED(hres)) {
2228  IHlink_SetMonikerReference(hlink, HLINKSETF_TARGET, mon, NULL);
2229 
2230  if(hlnf & HLNF_OPENINNEWWINDOW) {
2231  static const WCHAR wszBlank[] = {'_','b','l','a','n','k',0};
2232  IHlink_SetTargetFrameName(hlink, wszBlank); /* FIXME */
2233  }
2234 
2235  hres = IHlinkFrame_Navigate(hlink_frame, hlnf, bindctx,
2236  &callback->bsc.IBindStatusCallback_iface, hlink);
2237  IMoniker_Release(mon);
2238  *cancel = hres == S_OK;
2239  hres = S_OK;
2240  }
2241 
2242  IHlinkFrame_Release(hlink_frame);
2243  IBindCtx_Release(bindctx);
2244  IBindStatusCallback_Release(&callback->bsc.IBindStatusCallback_iface);
2245  return hres;
2246 }
HTMLDocumentObj * doc_obj
IOleClientSite * client
HRESULT do_query_service(IUnknown *unk, REFGUID guid_service, REFIID riid, void **ppv)
Definition: main.c:141
smooth NULL
Definition: ftsmooth.c:416
BOOL post_data_contains_headers
Definition: binding.h:45
MmuTrapHandler callback[0x30]
Definition: mmuobject.c:44
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
nsIInputStream * post_data_stream
Definition: binding.h:44
LONG HRESULT
Definition: typedefs.h:77
static const WCHAR url[]
Definition: encode.c:1432
static HRESULT read_post_data_stream(nsIInputStream *stream, BOOL contains_headers, struct list *headers_list, request_data_t *request_data)
Definition: navigate.c:800
struct list request_headers
Definition: binding.h:59
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI CreateAsyncBindCtx(DWORD reserved, IBindStatusCallback *callback, IEnumFORMATETC *format, IBindCtx **pbind)
Definition: bindctx.c:899
HRESULT create_channelbsc(IMoniker *mon, const WCHAR *headers, BYTE *post_data, DWORD post_data_size, BOOL is_doc_binding, nsChannelBSC **retval)
Definition: navigate.c:1693
HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
Definition: umon.c:732
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by before_async_open(), and navigate_uri().

◆ HttpNegotiate_AddRef()

static ULONG WINAPI HttpNegotiate_AddRef ( IHttpNegotiate2 iface)
static

Definition at line 425 of file navigate.c.

426 {
428  return IBindStatusCallback_AddRef(&This->IBindStatusCallback_iface);
429 }
static BSCallback * impl_from_IHttpNegotiate2(IHttpNegotiate2 *iface)
Definition: navigate.c:413

◆ HttpNegotiate_BeginningTransaction()

static HRESULT WINAPI HttpNegotiate_BeginningTransaction ( IHttpNegotiate2 iface,
LPCWSTR  szURL,
LPCWSTR  szHeaders,
DWORD  dwReserved,
LPWSTR pszAdditionalHeaders 
)
static

Definition at line 437 of file navigate.c.

439 {
441  HRESULT hres;
442 
443  TRACE("(%p)->(%s %s %d %p)\n", This, debugstr_w(szURL), debugstr_w(szHeaders),
444  dwReserved, pszAdditionalHeaders);
445 
446  *pszAdditionalHeaders = NULL;
447 
448  hres = This->vtbl->beginning_transaction(This, pszAdditionalHeaders);
449  if(hres != S_FALSE)
450  return hres;
451 
452  if(This->request_data.headers) {
453  DWORD size;
454 
455  size = (strlenW(This->request_data.headers)+1)*sizeof(WCHAR);
456  *pszAdditionalHeaders = CoTaskMemAlloc(size);
457  if(!*pszAdditionalHeaders)
458  return E_OUTOFMEMORY;
459  memcpy(*pszAdditionalHeaders, This->request_data.headers, size);
460  }
461 
462  return S_OK;
463 }
static BSCallback * impl_from_IHttpNegotiate2(IHttpNegotiate2 *iface)
Definition: navigate.c:413
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define debugstr_w
Definition: kernel32.h:32
#define S_FALSE
Definition: winerror.h:2357
smooth NULL
Definition: ftsmooth.c:416
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define S_OK
Definition: intsafe.h:59
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

◆ HttpNegotiate_GetRootSecurityId()

static HRESULT WINAPI HttpNegotiate_GetRootSecurityId ( IHttpNegotiate2 iface,
BYTE pbSecurityId,
DWORD pcbSecurityId,
DWORD_PTR  dwReserved 
)
static

Definition at line 476 of file navigate.c.

478 {
480  FIXME("(%p)->(%p %p %ld)\n", This, pbSecurityId, pcbSecurityId, dwReserved);
481  return E_NOTIMPL;
482 }
static BSCallback * impl_from_IHttpNegotiate2(IHttpNegotiate2 *iface)
Definition: navigate.c:413
_In_ HANDLE _In_ DWORD _In_ DWORD _Inout_opt_ LPOVERLAPPED _In_opt_ LPTRANSMIT_FILE_BUFFERS _In_ DWORD dwReserved
Definition: mswsock.h:90
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ HttpNegotiate_OnResponse()

static HRESULT WINAPI HttpNegotiate_OnResponse ( IHttpNegotiate2 iface,
DWORD  dwResponseCode,
LPCWSTR  szResponseHeaders,
LPCWSTR  szRequestHeaders,
LPWSTR pszAdditionalRequestHeaders 
)
static

Definition at line 465 of file navigate.c.

467 {
469 
470  TRACE("(%p)->(%d %s %s %p)\n", This, dwResponseCode, debugstr_w(szResponseHeaders),
471  debugstr_w(szRequestHeaders), pszAdditionalRequestHeaders);
472 
473  return This->vtbl->on_response(This, dwResponseCode, szResponseHeaders);
474 }
static BSCallback * impl_from_IHttpNegotiate2(IHttpNegotiate2 *iface)
Definition: navigate.c:413
#define debugstr_w
Definition: kernel32.h:32
#define TRACE(s)
Definition: solgame.cpp:4

◆ HttpNegotiate_QueryInterface()

static HRESULT WINAPI HttpNegotiate_QueryInterface ( IHttpNegotiate2 iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 418 of file navigate.c.

420 {
422  return IBindStatusCallback_QueryInterface(&This->IBindStatusCallback_iface, riid, ppv);
423 }
static BSCallback * impl_from_IHttpNegotiate2(IHttpNegotiate2 *iface)
Definition: navigate.c:413
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39

◆ HttpNegotiate_Release()

static ULONG WINAPI HttpNegotiate_Release ( IHttpNegotiate2 iface)
static

Definition at line 431 of file navigate.c.

432 {
434  return IBindStatusCallback_Release(&This->IBindStatusCallback_iface);
435 }
static BSCallback * impl_from_IHttpNegotiate2(IHttpNegotiate2 *iface)
Definition: navigate.c:413

◆ impl_from_IBindStatusCallback()

static BSCallback* impl_from_IBindStatusCallback ( IBindStatusCallback iface)
inlinestatic

Definition at line 199 of file navigate.c.

200 {
201  return CONTAINING_RECORD(iface, BSCallback, IBindStatusCallback_iface);
202 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by BindStatusCallback_AddRef(), BindStatusCallback_GetBindInfo(), BindStatusCallback_GetPriority(), BindStatusCallback_OnDataAvailable(), BindStatusCallback_OnLowResource(), BindStatusCallback_OnObjectAvailable(), BindStatusCallback_OnProgress(), BindStatusCallback_OnStartBinding(), BindStatusCallback_OnStopBinding(), BindStatusCallback_QueryInterface(), and BindStatusCallback_Release().

◆ impl_from_IHttpNegotiate2()

static BSCallback* impl_from_IHttpNegotiate2 ( IHttpNegotiate2 iface)
inlinestatic

Definition at line 413 of file navigate.c.

414 {
415  return CONTAINING_RECORD(iface, BSCallback, IHttpNegotiate2_iface);
416 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by HttpNegotiate_AddRef(), HttpNegotiate_BeginningTransaction(), HttpNegotiate_GetRootSecurityId(), HttpNegotiate_OnResponse(), HttpNegotiate_QueryInterface(), and HttpNegotiate_Release().

◆ impl_from_IInternetBindInfo()

static BSCallback* impl_from_IInternetBindInfo ( IInternetBindInfo iface)
inlinestatic

Definition at line 493 of file navigate.c.

494 {
495  return CONTAINING_RECORD(iface, BSCallback, IInternetBindInfo_iface);
496 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by InternetBindInfo_AddRef(), InternetBindInfo_GetBindInfo(), InternetBindInfo_GetBindString(), InternetBindInfo_QueryInterface(), and InternetBindInfo_Release().

◆ impl_from_IServiceProvider()

static BSCallback* impl_from_IServiceProvider ( IServiceProvider iface)
inlinestatic

Definition at line 541 of file navigate.c.

542 {
543  return CONTAINING_RECORD(iface, BSCallback, IServiceProvider_iface);
544 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by BSCServiceProvider_AddRef(), BSCServiceProvider_QueryInterface(), BSCServiceProvider_QueryService(), and BSCServiceProvider_Release().

◆ impl_from_nsIAsyncVerifyRedirectCallback()

static nsRedirectCallback* impl_from_nsIAsyncVerifyRedirectCallback ( nsIAsyncVerifyRedirectCallback iface)
static

Definition at line 1065 of file navigate.c.

1066 {
1067  return CONTAINING_RECORD(iface, nsRedirectCallback, nsIAsyncVerifyRedirectCallback_iface);
1068 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by nsAsyncVerifyRedirectCallback_AddRef(), nsAsyncVerifyRedirectCallback_OnRedirectVerifyCallback(), nsAsyncVerifyRedirectCallback_QueryInterface(), and nsAsyncVerifyRedirectCallback_Release().

◆ impl_from_nsIInputStream()

static nsProtocolStream* impl_from_nsIInputStream ( nsIInputStream iface)
inlinestatic

Definition at line 40 of file navigate.c.

41 {
42  return CONTAINING_RECORD(iface, nsProtocolStream, nsIInputStream_iface);
43 }
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by nsInputStream_AddRef(), nsInputStream_Available(), nsInputStream_Close(), nsInputStream_IsNonBlocking(), nsInputStream_QueryInterface(), nsInputStream_Read(), nsInputStream_ReadSegments(), and nsInputStream_Release().

◆ init_bscallback()

void init_bscallback ( BSCallback This,
const BSCallbackVtbl vtbl,
IMoniker mon,
DWORD  bindf 
)

Definition at line 584 of file navigate.c.

585 {
586  This->IBindStatusCallback_iface.lpVtbl = &BindStatusCallbackVtbl;
587  This->IServiceProvider_iface.lpVtbl = &ServiceProviderVtbl;
588  This->IHttpNegotiate2_iface.lpVtbl = &HttpNegotiate2Vtbl;
589  This->IInternetBindInfo_iface.lpVtbl = &InternetBindInfoVtbl;
590  This->vtbl = vtbl;
591  This->ref = 1;
592  This->bindf = bindf;
593  This->bom = BOM_NONE;
594 
595  list_init(&This->entry);
596 
597  if(mon)
598  IMoniker_AddRef(mon);
599  This->mon = mon;
600 }
static const IServiceProviderVtbl ServiceProviderVtbl
Definition: navigate.c:577
static const IBindStatusCallbackVtbl BindStatusCallbackVtbl
Definition: navigate.c:399
static const IHttpNegotiate2Vtbl HttpNegotiate2Vtbl
Definition: navigate.c:484
__WINE_SERVER_LIST_INLINE void list_init(struct list *list)
Definition: list.h:149
static const IInternetBindInfoVtbl InternetBindInfoVtbl
Definition: navigate.c:533
static DWORD bindf
Definition: protocol.c:70

Referenced by bind_script_to_text(), and create_channelbsc().

◆ InternetBindInfo_AddRef()

static ULONG WINAPI InternetBindInfo_AddRef ( IInternetBindInfo iface)
static

Definition at line 505 of file navigate.c.

506 {
508  return IBindStatusCallback_AddRef(&This->IBindStatusCallback_iface);
509 }
static BSCallback * impl_from_IInternetBindInfo(IInternetBindInfo *iface)
Definition: navigate.c:493

◆ InternetBindInfo_GetBindInfo()

static HRESULT WINAPI InternetBindInfo_GetBindInfo ( IInternetBindInfo iface,
DWORD grfBINDF,
BINDINFO *  pbindinfo 
)
static

Definition at line 517 of file navigate.c.

519 {
521  FIXME("(%p)->(%p %p)\n", This, grfBINDF, pbindinfo);
522  return E_NOTIMPL;
523 }
static BSCallback * impl_from_IInternetBindInfo(IInternetBindInfo *iface)
Definition: navigate.c:493
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InternetBindInfo_GetBindString()

static HRESULT WINAPI InternetBindInfo_GetBindString ( IInternetBindInfo iface,
ULONG  ulStringType,
LPOLESTR ppwzStr,
ULONG  cEl,
ULONG pcElFetched 
)
static

Definition at line 525 of file navigate.c.

527 {
529  FIXME("(%p)->(%u %p %u %p)\n", This, ulStringType, ppwzStr, cEl, pcElFetched);
530  return E_NOTIMPL;
531 }
static BSCallback * impl_from_IInternetBindInfo(IInternetBindInfo *iface)
Definition: navigate.c:493
#define FIXME(fmt,...)
Definition: debug.h:110
#define E_NOTIMPL
Definition: ddrawi.h:99

◆ InternetBindInfo_QueryInterface()

static HRESULT WINAPI InternetBindInfo_QueryInterface ( IInternetBindInfo iface,
REFIID  riid,
void **  ppv 
)
static

Definition at line 498 of file navigate.c.

500 {
502  return IBindStatusCallback_QueryInterface(&This->IBindStatusCallback_iface, riid, ppv);
503 }
REFIID riid
Definition: precomp.h:44
REFIID LPVOID * ppv
Definition: atlbase.h:39
static BSCallback * impl_from_IInternetBindInfo(IInternetBindInfo *iface)
Definition: navigate.c:493

◆ InternetBindInfo_Release()

static ULONG WINAPI InternetBindInfo_Release ( IInternetBindInfo iface)
static

Definition at line 511 of file navigate.c.

512 {
514  return IBindStatusCallback_Release(&This->IBindStatusCallback_iface);
515 }
static BSCallback * impl_from_IInternetBindInfo(IInternetBindInfo *iface)
Definition: navigate.c:493

◆ is_supported_doc_mime()

static BOOL is_supported_doc_mime ( const WCHAR mime)
static

Definition at line 1431 of file navigate.c.

1432 {
1433  char *nscat, *mimea;
1434  BOOL ret;
1435 
1436  mimea = heap_strdupWtoA(mime);
1437  if(!mimea)
1438  return FALSE;
1439 
1440  nscat = get_nscategory_entry("Gecko-Content-Viewers", mimea);
1441 
1442  ret = nscat != NULL && !strcmp(nscat, "@mozilla.org/content/document-loader-factory;1");
1443 
1444  heap_free(mimea);
1445  nsfree(nscat);
1446  return ret;
1447 }
const WCHAR * mime
Definition: mimefilter.c:512
unsigned int BOOL
Definition: ntddk_ex.h:94
void nsfree(void *) DECLSPEC_HIDDEN
Definition: nsembed.c:783
smooth NULL
Definition: ftsmooth.c:416
static char * heap_strdupWtoA(const WCHAR *str)
int ret
char * get_nscategory_entry(const char *, const char *) DECLSPEC_HIDDEN
Definition: nsembed.c:898
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by nsChannelBSC_on_progress().

◆ load_uri()

HRESULT load_uri ( HTMLOuterWindow window,
IUri uri,
DWORD  flags 
)

Definition at line 2306 of file navigate.c.

2307 {
2308  BSTR display_uri;
2309  HRESULT hres;
2310 
2311  hres = IUri_GetDisplayUri(uri, &display_uri);
2312  if(FAILED(hres))
2313  return hres;
2314 
2315  hres = navigate_uri(window, uri, display_uri, NULL, flags);
2316  SysFreeString(display_uri);
2317  return hres;
2318 }
const char * uri
Definition: sec_mgr.c:1594
OLECHAR * BSTR
Definition: compat.h:1934
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
static HRESULT navigate_uri(HTMLOuterWindow *window, IUri *uri, const WCHAR *display_uri, const request_data_t *request_data, DWORD flags)
Definition: navigate.c:2248
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
static IHTMLWindow2 * window
Definition: events.c:77
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274

Referenced by PersistHistory_LoadHistory(), and refresh_proc().

◆ navigate_fragment()

static HRESULT navigate_fragment ( HTMLOuterWindow window,
IUri uri 
)
static

Definition at line 1947 of file navigate.c.

1948 {
1949  nsIDOMLocation *nslocation;
1950  nsAString nsfrag_str;
1951  WCHAR *selector;
1952  BSTR frag;
1953  nsresult nsres;
1954  HRESULT hres;
1955 
1956  const WCHAR selector_formatW[] = {'a','[','i','d','=','"','%','s','"',']',0};
1957 
1959 
1960  nsres = nsIDOMWindow_GetLocation(window->nswindow, &nslocation);
1961  if(FAILED(nsres) || !nslocation)
1962  return E_FAIL;
1963 
1964  hres = IUri_GetFragment(uri, &frag);
1965  if(FAILED(hres)) {
1966  nsIDOMLocation_Release(nslocation);
1967  return hres;
1968  }
1969 
1970  nsAString_InitDepend(&nsfrag_str, frag);
1971  nsres = nsIDOMLocation_SetHash(nslocation, &nsfrag_str);
1972  nsAString_Finish(&nsfrag_str);
1973  nsIDOMLocation_Release(nslocation);
1974  if(NS_FAILED(nsres))
1975  ERR("SetHash failed: %08x\n", nsres);
1976 
1977  /*
1978  * IE supports scrolling to anchor elements with "#hash" ids (note that '#' is part of the id),
1979  * while Gecko scrolls only to elements with "hash" ids. We scroll the page ourselves if
1980  * a[id="#hash"] element can be found.
1981  */
1982  selector = heap_alloc(sizeof(selector_formatW)+SysStringLen(frag)*sizeof(WCHAR));
1983  if(selector) {
1984  nsIDOMElement *nselem = NULL;
1985  nsAString selector_str;
1986 
1987  sprintfW(selector, selector_formatW, frag);
1988  nsAString_InitDepend(&selector_str, selector);
1989  /* NOTE: Gecko doesn't set result to NULL if there is no match, so nselem must be initialized */
1990  nsres = nsIDOMHTMLDocument_QuerySelector(window->base.inner_window->doc->nsdoc, &selector_str, &nselem);
1991  nsAString_Finish(&selector_str);
1992  heap_free(selector);
1993  if(NS_SUCCEEDED(nsres) && nselem) {
1994  nsIDOMHTMLElement *html_elem;
1995 
1996  nsres = nsIDOMElement_QueryInterface(nselem, &IID_nsIDOMHTMLElement, (void**)&html_elem);
1997  nsIDOMElement_Release(nselem);
1998  if(NS_SUCCEEDED(nsres)) {
1999  nsIDOMHTMLElement_ScrollIntoView(html_elem, TRUE, 1);
2000  nsIDOMHTMLElement_Release(html_elem);
2001  }
2002  }
2003  }
2004 
2005  SysFreeString(frag);
2006 
2007  if(window->doc_obj->doc_object_service) {
2008  IDocObjectService_FireNavigateComplete2(window->doc_obj->doc_object_service, &window->base.IHTMLWindow2_iface, 0x10);
2009  IDocObjectService_FireDocumentComplete(window->doc_obj->doc_object_service, &window->base.IHTMLWindow2_iface, 0);
2010 
2011  }
2012 
2013  return S_OK;
2014 }
#define TRUE
Definition: types.h:120
const char * uri
Definition: sec_mgr.c:1594
OLECHAR * BSTR
Definition: compat.h:1934
#define E_FAIL
Definition: ddrawi.h:102
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
smooth NULL
Definition: ftsmooth.c:416
#define NS_FAILED(res)
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
#define NS_SUCCEEDED(res)
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:199
static IHTMLWindow2 * window
Definition: events.c:77
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
void set_current_uri(HTMLOuterWindow *, IUri *) DECLSPEC_HIDDEN
Definition: persist.c:68
#define sprintfW
Definition: unicode.h:58
void nsAString_InitDepend(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:826
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
HRESULT nsresult
Definition: nsiface.idl:39
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by super_navigate().

◆ navigate_javascript_proc()

static void navigate_javascript_proc ( task_t _task)
static

Definition at line 1869 of file navigate.c.

1870 {
1872  HTMLOuterWindow *window = task->window;
1873  VARIANT v;
1874  BSTR code;
1875  HRESULT hres;
1876 
1877  static const WCHAR jscriptW[] = {'j','s','c','r','i','p','t',0};
1878 
1879  task->window->readystate = READYSTATE_COMPLETE;
1880 
1881  hres = IUri_GetPath(task->uri, &code);
1882  if(FAILED(hres))
1883  return;
1884 
1886  if(FAILED(hres)) {
1888  return;
1889  }
1890 
1891  set_download_state(window->doc_obj, 1);
1892 
1893  V_VT(&v) = VT_EMPTY;
1894  hres = exec_script(window->base.inner_window, code, jscriptW, &v);
1896  if(SUCCEEDED(hres) && V_VT(&v) != VT_EMPTY) {
1897  FIXME("javascirpt URL returned %s\n", debugstr_variant(&v));
1898  VariantClear(&v);
1899  }
1900 
1901  if(window->doc_obj->view_sink)
1902  IAdviseSink_OnViewChange(window->doc_obj->view_sink, DVASPECT_CONTENT, -1);
1903 
1904  set_download_state(window->doc_obj, 0);
1905 }
#define URL_UNESCAPE_INPLACE
Definition: shlwapi.h:1224
OLECHAR * BSTR
Definition: compat.h:1934
HRESULT WINAPI UrlUnescapeW(LPWSTR pszUrl, LPWSTR pszUnescaped, LPDWORD pcchUnescaped, DWORD dwFlags)
Definition: url.c:1367
#define FIXME(fmt,...)
Definition: debug.h:110
void set_download_state(HTMLDocumentObj *, int) DECLSPEC_HIDDEN
Definition: persist.c:170
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
READYSTATE readystate
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:651
#define V_VT(A)
Definition: oleauto.h:211
static IHTMLWindow2 * window
Definition: events.c:77
int code
Definition: i386-dis.c:3591
HTMLOuterWindow * window
Definition: navigate.c:1865
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
HRESULT exec_script(HTMLInnerWindow *, const WCHAR *, const WCHAR *, VARIANT *) DECLSPEC_HIDDEN
Definition: script.c:1245
const GLdouble * v
Definition: gl.h:2040
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by super_navigate().

◆ navigate_javascript_task_destr()

static void navigate_javascript_task_destr ( task_t _task)
static

Definition at line 1907 of file navigate.c.

1908 {
1910 
1911  IUri_Release(task->uri);
1912  heap_free(task);
1913 }
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by super_navigate().

◆ navigate_new_window()

HRESULT navigate_new_window ( HTMLOuterWindow window,
IUri uri,
const WCHAR name,
request_data_t request_data,
IHTMLWindow2 **  ret 
)

Definition at line 2132 of file navigate.c.

2133 {
2134  IWebBrowser2 *web_browser;
2136  IBindCtx *bind_ctx;
2137  nsChannelBSC *bsc;
2138  HRESULT hres;
2139 
2140  if(request_data)
2141  hres = create_channelbsc(NULL, request_data->headers,
2142  request_data->post_data, request_data->post_data_len, FALSE,
2143  &bsc);
2144  else
2146  if(FAILED(hres))
2147  return hres;
2148 
2149  hres = CreateAsyncBindCtx(0, &bsc->bsc.IBindStatusCallback_iface, NULL, &bind_ctx);
2150  if(FAILED(hres)) {
2151  IBindStatusCallback_Release(&bsc->bsc.IBindStatusCallback_iface);
2152  return hres;
2153  }
2154 
2155  hres = CoCreateInstance(&CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER,
2156  &IID_IWebBrowser2, (void**)&web_browser);
2157  if(SUCCEEDED(hres)) {
2158  ITargetFramePriv2 *target_frame_priv;
2159 
2160  hres = IWebBrowser2_QueryInterface(web_browser, &IID_ITargetFramePriv2, (void**)&target_frame_priv);
2161  if(SUCCEEDED(hres)) {
2162  hres = ITargetFramePriv2_AggregatedNavigation2(target_frame_priv,
2163  HLNF_DISABLEWINDOWRESTRICTIONS|HLNF_OPENINNEWWINDOW, bind_ctx, &bsc->bsc.IBindStatusCallback_iface,
2164  name, uri, emptyW);
2165  ITargetFramePriv2_Release(target_frame_priv);
2166 
2167  if(SUCCEEDED(hres))
2168  hres = do_query_service((IUnknown*)web_browser, &SID_SHTMLWindow, &IID_IHTMLWindow2, (void**)&new_window);
2169  }
2170  if(FAILED(hres)) {
2171  IWebBrowser2_Quit(web_browser);
2172  IWebBrowser2_Release(web_browser);
2173  }
2174  }else {
2175  WARN("Could not create InternetExplorer instance: %08x\n", hres);
2176  }
2177 
2178  IBindStatusCallback_Release(&bsc->bsc.IBindStatusCallback_iface);
2179  IBindCtx_Release(bind_ctx);
2180  if(FAILED(hres))
2181  return hres;
2182 
2183  IWebBrowser2_put_Visible(web_browser, VARIANT_TRUE);
2184  IWebBrowser2_Release(web_browser);
2185 
2186  if(ret)
2187  *ret = new_window;
2188  else
2189  IHTMLWindow2_Release(new_window);
2190  return S_OK;
2191 }
static const WCHAR emptyW[]
Definition: navigate.c:28
const char * uri
Definition: sec_mgr.c:1594
#define WARN(fmt,...)
Definition: debug.h:111
ULONG post_data_len
Definition: binding.h:66
__IHTMLWindow2_FWD_DEFINED__ typedef interface IHTMLWindow2 IHTMLWindow2
Definition: mshtmhst.idl:64
HRESULT do_query_service(IUnknown *unk, REFGUID guid_service, REFIID riid, void **ppv)
Definition: main.c:141
static IBindStatusCallbackEx bsc
Definition: url.c:2149
smooth NULL
Definition: ftsmooth.c:416
WCHAR * headers
Definition: binding.h:64
HRESULT hres
Definition: protocol.c:465
static HWND new_window(LPCSTR lpClassName, DWORD dwStyle, HWND parent)
Definition: editor.c:54
LONG HRESULT
Definition: typedefs.h:77
int ret
HRESULT WINAPI DECLSPEC_HOTPATCH CoCreateInstance(REFCLSID rclsid, LPUNKNOWN pUnkOuter, DWORD dwClsContext, REFIID iid, LPVOID *ppv)
Definition: compobj.c:3234
#define S_OK
Definition: intsafe.h:59
HRESULT WINAPI CreateAsyncBindCtx(DWORD reserved, IBindStatusCallback *callback, IEnumFORMATETC *format, IBindCtx **pbind)
Definition: bindctx.c:899
HRESULT create_channelbsc(IMoniker *mon, const WCHAR *headers, BYTE *post_data, DWORD post_data_size, BOOL is_doc_binding, nsChannelBSC **retval)
Definition: navigate.c:1693
Definition: name.c:36
HGLOBAL post_data
Definition: binding.h:65
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by HlinkTarget_Navigate(), HTMLWindow2_open(), navigate_href_new_window(), and submit_form().

◆ navigate_proc()

static void navigate_proc ( task_t _task)
static

Definition at line 1924 of file navigate.c.

1925 {
1926  navigate_task_t *task = (navigate_task_t*)_task;
1927  HRESULT hres;
1928 
1929  hres = set_moniker(task->window, task->mon, task->uri, NULL, task->bscallback, TRUE);
1930  if(SUCCEEDED(hres)) {
1931  set_current_mon(task->window, task->bscallback->bsc.mon, task->flags);
1932  set_current_uri(task->window, task->uri);
1934  }
1935 }
#define TRUE
Definition: types.h:120
BSCallback bsc
Definition: binding.h:98
nsChannelBSC * bscallback
Definition: navigate.c:1918
HRESULT start_binding(HTMLInnerWindow *inner_window, BSCallback *bscallback, IBindCtx *bctx)
Definition: navigate.c:762
HTMLInnerWindow * pending_window
smooth NULL
Definition: ftsmooth.c:416
HTMLOuterWindow * window
Definition: navigate.c:1917
IMoniker * mon
Definition: navigate.c:1920
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
void set_current_mon(HTMLOuterWindow *, IMoniker *, DWORD) DECLSPEC_HIDDEN
Definition: persist.c:99
void set_current_uri(HTMLOuterWindow *, IUri *) DECLSPEC_HIDDEN
Definition: persist.c:68
IMoniker * mon
Definition: binding.h:87
HRESULT set_moniker(HTMLOuterWindow *, IMoniker *, IUri *, IBindCtx *, nsChannelBSC *, BOOL) DECLSPEC_HIDDEN
Definition: persist.c:329
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by super_navigate().

◆ navigate_task_destr()

static void navigate_task_destr ( task_t _task)
static

Definition at line 1937 of file navigate.c.

1938 {
1939  navigate_task_t *task = (navigate_task_t*)_task;
1940 
1941  IBindStatusCallback_Release(&task->bscallback->bsc.IBindStatusCallback_iface);
1942  IMoniker_Release(task->mon);
1943  IUri_Release(task->uri);
1944  heap_free(task);
1945 }
BSCallback bsc
Definition: binding.h:98
nsChannelBSC * bscallback
Definition: navigate.c:1918
IMoniker * mon
Definition: navigate.c:1920
IBindStatusCallback IBindStatusCallback_iface
Definition: binding.h:72
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by super_navigate().

◆ navigate_uri()

static HRESULT navigate_uri ( HTMLOuterWindow window,
IUri uri,
const WCHAR display_uri,
const request_data_t request_data,
DWORD  flags 
)
static

Definition at line 2248 of file navigate.c.

2250 {
2251  nsWineURI *nsuri;
2252  HRESULT hres;
2253 
2254  TRACE("%s\n", debugstr_w(display_uri));
2255 
2256  if(window->doc_obj && window->doc_obj->webbrowser) {
2257  DWORD post_data_len = request_data ? request_data->post_data_len : 0;
2258  void *post_data = post_data_len ? request_data->post_data : NULL;
2259  const WCHAR *headers = request_data ? request_data->headers : NULL;
2260 
2261  if(!(flags & BINDING_REFRESH)) {
2262  BSTR frame_name = NULL;
2263  BOOL cancel = FALSE;
2264 
2265  if(window != window->doc_obj->basedoc.window) {
2266  hres = IHTMLWindow2_get_name(&window->base.IHTMLWindow2_iface, &frame_name);
2267  if(FAILED(hres))
2268  return hres;
2269  }
2270 
2271  hres = IDocObjectService_FireBeforeNavigate2(window->doc_obj->doc_object_service, NULL, display_uri, 0x40,
2272  frame_name, post_data, post_data_len ? post_data_len+1 : 0, headers, TRUE, &cancel);
2273  SysFreeString(frame_name);
2274  if(SUCCEEDED(hres) && cancel) {
2275  TRACE("Navigation canceled\n");
2276  return S_OK;
2277  }
2278  }
2279 
2280  if(window == window->doc_obj->basedoc.window)
2281  return super_navigate(window, uri, flags, headers, post_data, post_data_len);
2282  }
2283 
2284  if(window->doc_obj && window == window->doc_obj->basedoc.window) {
2285  BOOL cancel;
2286 
2287  hres = hlink_frame_navigate(&window->base.inner_window->doc->basedoc, display_uri, NULL, 0, &cancel);
2288  if(FAILED(hres))
2289  return hres;
2290 
2291  if(cancel) {
2292  TRACE("Navigation handled by hlink frame\n");
2293  return S_OK;
2294  }
2295  }
2296 
2297  hres = create_doc_uri(window, uri, &nsuri);
2298  if(FAILED(hres))
2299  return hres;
2300 
2301  hres = load_nsuri(window, nsuri, request_data ? request_data->post_stream : NULL, NULL, LOAD_FLAGS_NONE);
2302  nsISupports_Release((nsISupports*)nsuri);
2303  return hres;
2304 }
HRESULT super_navigate(HTMLOuterWindow *window, IUri *uri, DWORD flags, const WCHAR *headers, BYTE *post_data, DWORD post_data_size)
Definition: navigate.c:2016
#define TRUE
Definition: types.h:120
const char * uri
Definition: sec_mgr.c:1594
Definition: nsio.c:34
ULONG post_data_len
Definition: binding.h:66
vector< Header * > headers
Definition: sdkparse.cpp:39
OLECHAR * BSTR
Definition: compat.h:1934
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
WCHAR * headers
Definition: binding.h:64
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
HRESULT create_doc_uri(HTMLOuterWindow *, IUri *, nsWineURI **) DECLSPEC_HIDDEN
Definition: nsio.c:3210
GLbitfield flags
Definition: glext.h:7161
static const CHAR post_data[]
Definition: protocol.c:215
static IHTMLWindow2 * window
Definition: events.c:77
HRESULT hlink_frame_navigate(HTMLDocument *doc, LPCWSTR url, nsChannel *nschannel, DWORD hlnf, BOOL *cancel)
Definition: navigate.c:2193
#define BINDING_REFRESH
Definition: binding.h:130
#define S_OK
Definition: intsafe.h:59
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
nsIInputStream * post_stream
Definition: binding.h:63
HRESULT load_nsuri(HTMLOuterWindow *, nsWineURI *, nsIInputStream *, nsChannelBSC *, DWORD) DECLSPEC_HIDDEN
Definition: nsio.c:250
HGLOBAL post_data
Definition: binding.h:65
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by load_uri(), navigate_url(), and submit_form().

◆ navigate_url()

HRESULT navigate_url ( HTMLOuterWindow window,
const WCHAR new_url,
IUri base_uri,
DWORD  flags 
)

Definition at line 2391 of file navigate.c.

2392 {
2393  IUri *uri, *nav_uri;
2394  BSTR display_uri;
2395  HRESULT hres;
2396 
2397  if(new_url && base_uri)
2399  &nav_uri, 0);
2400  else
2401  hres = create_uri(new_url, 0, &nav_uri);
2402  if(FAILED(hres))
2403  return hres;
2404 
2405  hres = translate_uri(window, nav_uri, &display_uri, &uri);
2406  IUri_Release(nav_uri);
2407  if(FAILED(hres))
2408  return hres;
2409 
2410  hres = navigate_uri(window, uri, display_uri, NULL, flags);
2411  IUri_Release(uri);
2412  SysFreeString(display_uri);
2413  return hres;
2414 }
HRESULT WINAPI CoInternetCombineUrlEx(IUri *pBaseUri, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, IUri **ppCombinedUri, DWORD_PTR dwReserved)
Definition: uri.c:6768
const char * uri
Definition: sec_mgr.c:1594
static HRESULT translate_uri(HTMLOuterWindow *window, IUri *orig_uri, BSTR *ret_display_uri, IUri **ret_uri)
Definition: navigate.c:2320
OLECHAR * BSTR
Definition: compat.h:1934
smooth NULL
Definition: ftsmooth.c:416
HRESULT hres
Definition: protocol.c:465
static HRESULT navigate_uri(HTMLOuterWindow *window, IUri *uri, const WCHAR *display_uri, const request_data_t *request_data, DWORD flags)
Definition: navigate.c:2248
LONG HRESULT
Definition: typedefs.h:77
GLbitfield flags
Definition: glext.h:7161
static IHTMLWindow2 * window
Definition: events.c:77
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:274
#define URL_ESCAPE_SPACES_ONLY
Definition: shlwapi.h:1216
#define URL_DONT_ESCAPE_EXTRA_INFO
Definition: shlwapi.h:1217
HRESULT create_uri(const WCHAR *, DWORD, IUri **) DECLSPEC_HIDDEN
Definition: persist.c:158

◆ nsAsyncVerifyRedirectCallback_AddRef()

static nsrefcnt NSAPI nsAsyncVerifyRedirectCallback_AddRef ( nsIAsyncVerifyRedirectCallback iface)
static

Definition at line 1091 of file navigate.c.

1092 {
1094  LONG ref = InterlockedIncrement(&This->ref);
1095 
1096  TRACE("(%p) ref=%d\n", This, ref);
1097 
1098  return ref;
1099 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
static nsRedirectCallback * impl_from_nsIAsyncVerifyRedirectCallback(nsIAsyncVerifyRedirectCallback *iface)
Definition: navigate.c:1065

◆ nsAsyncVerifyRedirectCallback_OnRedirectVerifyCallback()

static nsresult NSAPI nsAsyncVerifyRedirectCallback_OnRedirectVerifyCallback ( nsIAsyncVerifyRedirectCallback iface,
nsresult  result 
)
static

Definition at line 1117 of file navigate.c.

1118 {
1120  nsChannel *old_nschannel;
1121  nsresult nsres;
1122 
1123  TRACE("(%p)->(%08x)\n", This, result);
1124 
1125  old_nschannel = This->bsc->nschannel;
1126  nsIHttpChannel_AddRef(&This->nschannel->nsIHttpChannel_iface);
1127  This->bsc->nschannel = This->nschannel;
1128 
1129  if(This->nschannel->load_group) {
1130  nsres = nsILoadGroup_AddRequest(This->nschannel->load_group, (nsIRequest*)&This->nschannel->nsIHttpChannel_iface,
1131  NULL);
1132  if(NS_FAILED(nsres))
1133  ERR("AddRequest failed: %08x\n", nsres);
1134  }
1135 
1136  if(This->bsc->is_doc_channel) {
1137  IUri *uri = nsuri_get_uri(This->nschannel->uri);
1138 
1139  if(uri) {
1140  set_current_uri(This->bsc->bsc.window->base.outer_window, uri);
1141  IUri_Release(uri);
1142  }else {
1143  WARN("Could not get IUri from nsWineURI\n");
1144  }
1145  }
1146 
1147  if(old_nschannel) {
1148  if(old_nschannel->load_group) {
1149  nsres = nsILoadGroup_RemoveRequest(old_nschannel->load_group,
1150  (nsIRequest*)&old_nschannel->nsIHttpChannel_iface, NULL, NS_OK);
1151  if(NS_FAILED(nsres))
1152  ERR("RemoveRequest failed: %08x\n", nsres);
1153  }
1154  nsIHttpChannel_Release(&old_nschannel->nsIHttpChannel_iface);
1155  }
1156 
1157  return NS_OK;
1158 }
nsIHttpChannel nsIHttpChannel_iface
Definition: binding.h:37
const char * uri
Definition: sec_mgr.c:1594
IUri * nsuri_get_uri(nsWineURI *) DECLSPEC_HIDDEN
Definition: nsio.c:68
#define WARN(fmt,...)
Definition: debug.h:111
#define NS_OK
smooth NULL
Definition: ftsmooth.c:416
#define NS_FAILED(res)
#define TRACE(s)
Definition: solgame.cpp:4
#define ERR(fmt,...)
Definition: debug.h:109
void set_current_uri(HTMLOuterWindow *, IUri *) DECLSPEC_HIDDEN
Definition: persist.c:68
static nsRedirectCallback * impl_from_nsIAsyncVerifyRedirectCallback(nsIAsyncVerifyRedirectCallback *iface)
Definition: navigate.c:1065
nsILoadGroup * load_group
Definition: binding.h:46
HRESULT nsresult
Definition: nsiface.idl:39
GLuint64EXT * result
Definition: glext.h:11304

◆ nsAsyncVerifyRedirectCallback_QueryInterface()

static nsresult NSAPI nsAsyncVerifyRedirectCallback_QueryInterface ( nsIAsyncVerifyRedirectCallback iface,
nsIIDRef  riid,
void **  result 
)
static

Definition at line 1070 of file navigate.c.

1072 {
1074 
1075  if(IsEqualGUID(&IID_nsISupports, riid)) {
1076  TRACE("(%p)->(IID_nsISupports %p)\n", This, result);
1077  *result = &This->nsIAsyncVerifyRedirectCallback_iface;
1078  }else if(IsEqualGUID(&IID_nsIAsyncVerifyRedirectCallback, riid)) {
1079  TRACE("(%p)->(IID_nsIAsyncVerifyRedirectCallback %p)\n", This, result);
1080  *result = &This->nsIAsyncVerifyRedirectCallback_iface;
1081  }else {
1082  *result = NULL;
1083  WARN("unimplemented iface %s\n", debugstr_guid(riid));
1084  return NS_NOINTERFACE;
1085  }
1086 
1087  nsISupports_AddRef((nsISupports*)*result);
1088  return NS_OK;
1089 }
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
#define NS_OK
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define NS_NOINTERFACE
static nsRedirectCallback * impl_from_nsIAsyncVerifyRedirectCallback(nsIAsyncVerifyRedirectCallback *iface)
Definition: navigate.c:1065
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
GLuint64EXT * result
Definition: glext.h:11304

◆ nsAsyncVerifyRedirectCallback_Release()

static nsrefcnt NSAPI nsAsyncVerifyRedirectCallback_Release ( nsIAsyncVerifyRedirectCallback iface)
static

Definition at line 1101 of file navigate.c.

1102 {
1104  LONG ref = InterlockedDecrement(&This->ref);
1105 
1106  TRACE("(%p) ref=%d\n", This, ref);
1107 
1108  if(!ref) {
1109  IBindStatusCallback_Release(&This->bsc->bsc.IBindStatusCallback_iface);
1110  nsIHttpChannel_Release(&This->nschannel->nsIHttpChannel_iface);
1111  heap_free(This);
1112  }
1113 
1114  return ref;
1115 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static nsRedirectCallback * impl_from_nsIAsyncVerifyRedirectCallback(nsIAsyncVerifyRedirectCallback *iface)
Definition: navigate.c:1065
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ nsChannelBSC_beginning_transaction()

static HRESULT nsChannelBSC_beginning_transaction ( BSCallback bsc,
WCHAR **  additional_headers 
)
static

Definition at line 1633 of file navigate.c.

1634 {
1636  http_header_t *iter;
1637  DWORD len = 0;
1638  WCHAR *ptr;
1639 
1640  static const WCHAR content_lengthW[] =
1641  {'C','o','n','t','e','n','t','-','L','e','n','g','t','h',0};
1642 
1643  if(!This->nschannel)
1644  return S_FALSE;
1645 
1646  LIST_FOR_EACH_ENTRY(iter, &This->nschannel->request_headers, http_header_t, entry) {
1647  if(strcmpW(iter->header, content_lengthW))
1648  len += strlenW(iter->header) + 2 /* ": " */ + strlenW(iter->data) + 2 /* "\r\n" */;
1649  }
1650 
1651  if(!len)
1652  return S_OK;
1653 
1654  *additional_headers = ptr = CoTaskMemAlloc((len+1)*sizeof(WCHAR));
1655  if(!ptr)
1656  return E_OUTOFMEMORY;
1657 
1658  LIST_FOR_EACH_ENTRY(iter, &This->nschannel->request_headers, http_header_t, entry) {
1659  if(!strcmpW(iter->header, content_lengthW))
1660  continue;
1661 
1662  len = strlenW(iter->header);
1663  memcpy(ptr, iter->header, len*sizeof(WCHAR));
1664  ptr += len;
1665 
1666  *ptr++ = ':';
1667  *ptr++ = ' ';
1668 
1669  len = strlenW(iter->data);
1670  memcpy(ptr, iter->data, len*sizeof(WCHAR));
1671  ptr += len;
1672 
1673  *ptr++ = '\r';
1674  *ptr++ = '\n';
1675  }
1676 
1677  *ptr = 0;
1678 
1679  return S_OK;
1680 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
WCHAR * data
Definition: binding.h:124
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static PVOID ptr
Definition: dispmode.c:27
#define S_FALSE
Definition: winerror.h:2357
static IBindStatusCallbackEx bsc
Definition: url.c:2149
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
static nsChannelBSC * nsChannelBSC_from_BSCallback(BSCallback *iface)
Definition: navigate.c:1188
uint32_t entry
Definition: isohybrid.c:63
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
GLenum GLsizei len
Definition: glext.h:6722
WCHAR * header
Definition: binding.h:123
#define S_OK
Definition: intsafe.h:59
WINE_UNICODE_INLINE int strcmpW(const WCHAR *str1, const WCHAR *str2)
Definition: unicode.h:229
LPVOID WINAPI CoTaskMemAlloc(SIZE_T size)
Definition: ifs.c:406

◆ nsChannelBSC_destroy()

static void nsChannelBSC_destroy ( BSCallback bsc)
static

Definition at line 1193 of file navigate.c.

1194 {
1196 
1197  if(This->nschannel)
1198  nsIHttpChannel_Release(&This->nschannel->nsIHttpChannel_iface);
1199  if(This->nslistener)
1200  nsIStreamListener_Release(This->nslistener);
1201  if(This->nscontext)
1202  nsISupports_Release(This->nscontext);
1203  if(This->nsstream)
1204  nsIInputStream_Release(&This->nsstream->nsIInputStream_iface);
1205  heap_free(This);
1206 }
static IBindStatusCallbackEx bsc
Definition: url.c:2149
static nsChannelBSC * nsChannelBSC_from_BSCallback(BSCallback *iface)
Definition: navigate.c:1188
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ nsChannelBSC_from_BSCallback()

static nsChannelBSC* nsChannelBSC_from_BSCallback ( BSCallback iface)
inlinestatic

Definition at line 1188 of file navigate.c.

1189 {
1190  return CONTAINING_RECORD(iface, nsChannelBSC, bsc);
1191 }
static IBindStatusCallbackEx bsc
Definition: url.c:2149
PFLT_MESSAGE_WAITER_QUEUE CONTAINING_RECORD(Csq, DEVICE_EXTENSION, IrpQueue)) -> WaiterQ.mLock) _IRQL_raises_(DISPATCH_LEVEL) VOID NTAPI FltpAcquireMessageWaiterLock(_In_ PIO_CSQ Csq, _Out_ PKIRQL Irql)
Definition: Messaging.c:560

Referenced by nsChannelBSC_beginning_transaction(), nsChannelBSC_destroy(), nsChannelBSC_init_bindinfo(), nsChannelBSC_on_progress(), nsChannelBSC_on_response(), nsChannelBSC_read_data(), nsChannelBSC_start_binding(), and nsChannelBSC_stop_binding().

◆ nsChannelBSC_init_bindinfo()

static HRESULT nsChannelBSC_init_bindinfo ( BSCallback bsc)
static

Definition at line 1218 of file navigate.c.

1219 {
1221  nsChannel *nschannel = This->nschannel;
1222  HRESULT hres;
1223 
1224  if(nschannel && nschannel->post_data_stream) {
1226  &nschannel->request_headers, &This->bsc.request_data);
1227  if(FAILED(hres))
1228  return hres;
1229  }
1230 
1231  return S_OK;
1232 }
static IBindStatusCallbackEx bsc
Definition: url.c:2149
BOOL post_data_contains_headers
Definition: binding.h:45
HRESULT hres
Definition: protocol.c:465
nsIInputStream * post_data_stream
Definition: binding.h:44
LONG HRESULT
Definition: typedefs.h:77
static HRESULT read_post_data_stream(nsIInputStream *stream, BOOL contains_headers, struct list *headers_list, request_data_t *request_data)
Definition: navigate.c:800
static nsChannelBSC * nsChannelBSC_from_BSCallback(BSCallback *iface)
Definition: navigate.c:1188
struct list request_headers
Definition: binding.h:59
#define S_OK
Definition: intsafe.h:59

◆ nsChannelBSC_on_progress()

static HRESULT nsChannelBSC_on_progress ( BSCallback bsc,
ULONG  status_code,
LPCWSTR  status_text 
)
static

Definition at line 1532 of file navigate.c.

1533 {
1535 
1536  switch(status_code) {
1537  case BINDSTATUS_MIMETYPEAVAILABLE:
1538  if(This->is_doc_channel && !is_supported_doc_mime(status_text)) {
1539  FIXME("External MIME: %s\n", debugstr_w(status_text));
1540 
1542 
1543  This->nschannel = NULL;
1544  }
1545 
1546  if(!This->nschannel)
1547  return S_OK;
1548 
1549  heap_free(This->nschannel->content_type);
1550  This->nschannel->content_type = heap_strdupWtoA(status_text);
1551  break;
1552  case BINDSTATUS_REDIRECTING:
1553  return handle_redirect(This, status_text);
1554  case BINDSTATUS_BEGINDOWNLOADDATA: {
1555  IWinInetHttpInfo *http_info;
1556  DWORD status, size = sizeof(DWORD);
1557  HRESULT hres;
1558 
1559  if(!This->bsc.binding)
1560  break;
1561 
1562  hres = IBinding_QueryInterface(This->bsc.binding, &IID_IWinInetHttpInfo, (void**)&http_info);
1563  if(FAILED(hres))
1564  break;
1565 
1566  hres = IWinInetHttpInfo_QueryInfo(http_info,
1568  IWinInetHttpInfo_Release(http_info);
1569  if(FAILED(hres) || status == HTTP_STATUS_OK)
1570  break;
1571 
1573  }
1574  }
1575 
1576  return S_OK;
1577 }
#define DWORD
Definition: nt_native.h:44
static BOOL is_supported_doc_mime(const WCHAR *mime)
Definition: navigate.c:1431
#define debugstr_w
Definition: kernel32.h:32
#define FIXME(fmt,...)
Definition: debug.h:110
static IBindStatusCallbackEx bsc
Definition: url.c:2149
smooth NULL
Definition: ftsmooth.c:416
static HRESULT handle_redirect(nsChannelBSC *This, const WCHAR *new_url)
Definition: navigate.c:1389
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
static char * heap_strdupWtoA(const WCHAR *str)
unsigned long DWORD
Definition: ntddk_ex.h:95
#define HTTP_STATUS_OK
Definition: winhttp.h:240
static nsChannelBSC * nsChannelBSC_from_BSCallback(BSCallback *iface)
Definition: navigate.c:1188
static void handle_extern_mime_navigation(nsChannelBSC *This)
Definition: navigate.c:1468
#define HTTP_QUERY_STATUS_CODE
Definition: wininet.h:1542
#define S_OK
Definition: intsafe.h:59
#define HTTP_QUERY_FLAG_NUMBER
Definition: wininet.h:1606
void handle_navigation_error(DocHost *doc_host, HRESULT hres, BSTR url, IHTMLWindow2 *win2)
Definition: navigate.c:310
static SERVICE_STATUS status
Definition: service.c:31
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
Definition: ps.c:97

◆ nsChannelBSC_on_response()

static HRESULT nsChannelBSC_on_response ( BSCallback bsc,
DWORD  response_code,
LPCWSTR  response_headers 
)
static

Definition at line 1597 of file navigate.c.

1599 {
1601  char *str;
1602  HRESULT hres;
1603 
1604  This->response_processed = TRUE;
1605  This->nschannel->response_status = response_code;
1606 
1607  if(response_headers) {
1608  const WCHAR *headers;
1609 
1610  headers = strchrW(response_headers, '\r');
1611  hres = process_response_status_text(response_headers, headers, &str);
1612  if(FAILED(hres)) {
1613  WARN("parsing headers failed: %08x\n", hres);
1614  return hres;
1615  }
1616 
1617  heap_free(This->nschannel->response_status_text);
1618  This->nschannel->response_status_text = str;
1619 
1620  if(headers && headers[1] == '\n') {
1621  headers += 2;
1623  if(FAILED(hres)) {
1624  WARN("parsing headers failed: %08x\n", hres);
1625  return hres;
1626  }
1627  }
1628  }
1629 
1630  return S_OK;
1631 }
#define TRUE
Definition: types.h:120
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define WARN(fmt,...)
Definition: debug.h:111
vector< Header * > headers
Definition: sdkparse.cpp:39
static IBindStatusCallbackEx bsc
Definition: url.c:2149
const WCHAR * str
static HRESULT process_response_headers(nsChannelBSC *This, const WCHAR *headers)
Definition: navigate.c:714
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static nsChannelBSC * nsChannelBSC_from_BSCallback(BSCallback *iface)
Definition: navigate.c:1188
#define S_OK
Definition: intsafe.h:59
static HRESULT process_response_status_text(const WCHAR *header, const WCHAR *header_end, char **status_text)
Definition: navigate.c:1579
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ nsChannelBSC_read_data()

static HRESULT nsChannelBSC_read_data ( BSCallback bsc,
IStream stream 
)
static

Definition at line 1382 of file navigate.c.

1383 {
1385 
1386  return read_stream_data(This, stream);
1387 }
static IBindStatusCallbackEx bsc
Definition: url.c:2149
static nsChannelBSC * nsChannelBSC_from_BSCallback(BSCallback *iface)
Definition: navigate.c:1188
Definition: parse.h:22
static HRESULT read_stream_data(nsChannelBSC *This, IStream *stream)
Definition: navigate.c:960

◆ nsChannelBSC_start_binding()

static HRESULT nsChannelBSC_start_binding ( BSCallback bsc)
static

Definition at line 1208 of file navigate.c.

1209 {
1211 
1212  if(This->is_doc_channel)
1213  This->bsc.window->base.outer_window->base.inner_window->doc->skip_mutation_notif = FALSE;
1214 
1215  return S_OK;
1216 }
static IBindStatusCallbackEx bsc
Definition: url.c:2149
static nsChannelBSC * nsChannelBSC_from_BSCallback(BSCallback *iface)
Definition: navigate.c:1188
#define S_OK
Definition: intsafe.h:59

◆ nsChannelBSC_stop_binding()

static HRESULT nsChannelBSC_stop_binding ( BSCallback bsc,
HRESULT  result 
)
static

Definition at line 1364 of file navigate.c.

1365 {
1367 
1368  if(result != E_ABORT) {
1369  if(FAILED(result))
1371  else if(This->is_doc_channel && This->nschannel) {
1373  if(SUCCEEDED(result))
1374  return S_OK;
1375  }
1376  }
1377 
1379  return S_OK;
1380 }
static void on_stop_nsrequest(nsChannelBSC *This, HRESULT result)
Definition: navigate.c:929
static HRESULT async_stop_request(nsChannelBSC *This)
Definition: navigate.c:1258
static IBindStatusCallbackEx bsc
Definition: url.c:2149
static nsChannelBSC * nsChannelBSC_from_BSCallback(BSCallback *iface)
Definition: navigate.c:1188
#define E_ABORT
Definition: winerror.h:2366
#define S_OK
Definition: intsafe.h:59
void handle_navigation_error(DocHost *doc_host, HRESULT hres, BSTR url, IHTMLWindow2 *win2)
Definition: navigate.c:310
GLuint64EXT * result
Definition: glext.h:11304
#define SUCCEEDED(hr)
Definition: intsafe.h:57

◆ nsInputStream_AddRef()

static nsrefcnt NSAPI nsInputStream_AddRef ( nsIInputStream iface)
static

Definition at line 69 of file navigate.c.

70 {
73 
74  TRACE("(%p) ref=%d\n", This, ref);
75 
76  return ref;
77 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedIncrement
Definition: armddk.h:53
static nsProtocolStream * impl_from_nsIInputStream(nsIInputStream *iface)
Definition: navigate.c:40

◆ nsInputStream_Available()

static nsresult NSAPI nsInputStream_Available ( nsIInputStream iface,
UINT64 _retval 
)
static

Definition at line 100 of file navigate.c.

101 {
103  FIXME("(%p)->(%p)\n", This, _retval);
105 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define NS_ERROR_NOT_IMPLEMENTED
static nsProtocolStream * impl_from_nsIInputStream(nsIInputStream *iface)
Definition: navigate.c:40

◆ nsInputStream_Close()

static nsresult NSAPI nsInputStream_Close ( nsIInputStream iface)
static

Definition at line 93 of file navigate.c.

94 {
96  FIXME("(%p)\n", This);
98 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define NS_ERROR_NOT_IMPLEMENTED
static nsProtocolStream * impl_from_nsIInputStream(nsIInputStream *iface)
Definition: navigate.c:40

◆ nsInputStream_IsNonBlocking()

static nsresult NSAPI nsInputStream_IsNonBlocking ( nsIInputStream iface,
cpp_bool _retval 
)
static

Definition at line 157 of file navigate.c.

158 {
160  FIXME("(%p)->(%p)\n", This, _retval);
162 }
#define FIXME(fmt,...)
Definition: debug.h:110
#define NS_ERROR_NOT_IMPLEMENTED
static nsProtocolStream * impl_from_nsIInputStream(nsIInputStream *iface)
Definition: navigate.c:40

◆ nsInputStream_QueryInterface()

static nsresult NSAPI nsInputStream_QueryInterface ( nsIInputStream iface,
nsIIDRef  riid,
void **  result 
)
static

Definition at line 45 of file navigate.c.

47 {
49 
50  *result = NULL;
51 
52  if(IsEqualGUID(&IID_nsISupports, riid)) {
53  TRACE("(%p)->(IID_nsISupports %p)\n", This, result);
54  *result = &This->nsIInputStream_iface;
55  }else if(IsEqualGUID(&IID_nsIInputStream, riid)) {
56  TRACE("(%p)->(IID_nsIInputStream %p)\n", This, result);
57  *result = &This->nsIInputStream_iface;
58  }
59 
60  if(*result) {
61  nsIInputStream_AddRef(&This->nsIInputStream_iface);
62  return NS_OK;
63  }
64 
65  WARN("unsupported interface %s\n", debugstr_guid(riid));
66  return NS_NOINTERFACE;
67 }
REFIID riid
Definition: precomp.h:44
#define WARN(fmt,...)
Definition: debug.h:111
#define NS_OK
smooth NULL
Definition: ftsmooth.c:416
#define debugstr_guid
Definition: kernel32.h:35
#define TRACE(s)
Definition: solgame.cpp:4
#define NS_NOINTERFACE
BOOL WINAPI IsEqualGUID(REFGUID rguid1, REFGUID rguid2)
Definition: compobj.c:4021
static nsProtocolStream * impl_from_nsIInputStream(nsIInputStream *iface)
Definition: navigate.c:40
GLuint64EXT * result
Definition: glext.h:11304

◆ nsInputStream_Read()

static nsresult NSAPI nsInputStream_Read ( nsIInputStream iface,
char aBuf,
UINT32  aCount,
UINT32 _retval 
)
static

Definition at line 107 of file navigate.c.

109 {
111  DWORD read = aCount;
112 
113  TRACE("(%p)->(%p %d %p)\n", This, aBuf, aCount, _retval);
114 
115  if(read > This->buf_size)
116  read = This->buf_size;
117 
118  if(read) {
119  memcpy(aBuf, This->buf, read);
120  if(read < This->buf_size)
121  memmove(This->buf, This->buf+read, This->buf_size-read);
122  This->buf_size -= read;
123  }
124 
125  *_retval = read;
126  return NS_OK;
127 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
#define NS_OK
#define TRACE(s)
Definition: solgame.cpp:4
unsigned long DWORD
Definition: ntddk_ex.h:95
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static nsProtocolStream * impl_from_nsIInputStream(nsIInputStream *iface)
Definition: navigate.c:40
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)

◆ nsInputStream_ReadSegments()

static nsresult NSAPI nsInputStream_ReadSegments ( nsIInputStream iface,
nsresult(WINAPI *aWriter)(nsIInputStream *, void *, const char *, UINT32, UINT32, UINT32 *)  ,
void aClousure,
UINT32  aCount,
UINT32 _retval 
)
static

Definition at line 129 of file navigate.c.

132 {
134  UINT32 written = 0;
135  nsresult nsres;
136 
137  TRACE("(%p)->(%p %p %d %p)\n", This, aWriter, aClousure, aCount, _retval);
138 
139  if(!This->buf_size)
140  return S_OK;
141 
142  if(aCount > This->buf_size)
143  aCount = This->buf_size;
144 
145  nsres = aWriter(&This->nsIInputStream_iface, aClousure, This->buf, 0, aCount, &written);
146  if(NS_FAILED(nsres))
147  TRACE("aWriter failed: %08x\n", nsres);
148  else if(written != This->buf_size)
149  FIXME("written %d != buf_size %d\n", written, This->buf_size);
150 
151  This->buf_size -= written;
152 
153  *_retval = written;
154  return nsres;
155 }
unsigned int UINT32
#define FIXME(fmt,...)
Definition: debug.h:110
#define NS_FAILED(res)
#define TRACE(s)
Definition: solgame.cpp:4
#define S_OK
Definition: intsafe.h:59
static nsProtocolStream * impl_from_nsIInputStream(nsIInputStream *iface)
Definition: navigate.c:40
HRESULT nsresult
Definition: nsiface.idl:39

◆ nsInputStream_Release()

static nsrefcnt NSAPI nsInputStream_Release ( nsIInputStream iface)
static

Definition at line 80 of file navigate.c.

81 {
84 
85  TRACE("(%p) ref=%d\n", This, ref);
86 
87  if(!ref)
88  heap_free(This);
89 
90  return ref;
91 }
Definition: send.c:47
long LONG
Definition: pedump.c:60
GLenum GLint ref
Definition: glext.h:6028
#define TRACE(s)
Definition: solgame.cpp:4
#define InterlockedDecrement
Definition: armddk.h:52
static nsProtocolStream * impl_from_nsIInputStream(nsIInputStream *iface)
Definition: navigate.c:40
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

◆ on_start_nsrequest()

static HRESULT on_start_nsrequest ( nsChannelBSC This)
static

Definition at line 903 of file navigate.c.

904 {
905  nsresult nsres;
906 
907  /* FIXME: it's needed for http connections from BindToObject. */
908  if(!This->nschannel->response_status)
909  This->nschannel->response_status = 200;
910 
911  nsres = nsIStreamListener_OnStartRequest(This->nslistener,
912  (nsIRequest*)&This->nschannel->nsIHttpChannel_iface, This->nscontext);
913  if(NS_FAILED(nsres)) {
914  FIXME("OnStartRequest failed: %08x\n", nsres);
915  return E_FAIL;
916  }
917 
918  if(This->is_doc_channel) {
919  if(!This->bsc.window)
920  return E_ABORT; /* Binding aborted in OnStartRequest call. */
921  update_window_doc(This->bsc.window);
922  if(This->bsc.window->base.outer_window->readystate != READYSTATE_LOADING)
923  set_ready_state(This->bsc.window->base.outer_window, READYSTATE_LOADING);
924  }
925 
926  return S_OK;
927 }
HRESULT update_window_doc(HTMLInnerWindow *window)
Definition: htmlwindow.c:3033
#define E_FAIL
Definition: ddrawi.h:102
#define FIXME(fmt,...)
Definition: debug.h:110
#define NS_FAILED(res)
#define E_ABORT
Definition: winerror.h:2366
#define S_OK
Definition: intsafe.h:59
void set_ready_state(HTMLOuterWindow *, READYSTATE) DECLSPEC_HIDDEN
Definition: persist.c:450
HRESULT nsresult
Definition: nsiface.idl:39

Referenced by async_stop_request(), and read_stream_data().

◆ on_stop_nsrequest()

static void on_stop_nsrequest ( nsChannelBSC This,
HRESULT  result 
)
static

Definition at line 929 of file navigate.c.

930 {
931  nsresult nsres, request_result;
932 
933  switch(result) {
934  case S_OK:
935  request_result = NS_OK;
936  break;
937  case E_ABORT:
938  request_result = NS_BINDING_ABORTED;
939  break;
940  default:
941  request_result = NS_ERROR_FAILURE;
942  }
943 
944  if(This->nslistener) {
945  nsres = nsIStreamListener_OnStopRequest(This->nslistener,
946  (nsIRequest*)&This->nschannel->nsIHttpChannel_iface, This->nscontext,
947  request_result);
948  if(NS_FAILED(nsres))
949  WARN("OnStopRequest failed: %08x\n", nsres);
950  }
951 
952  if(This->nschannel && This->nschannel->load_group) {
953  nsres = nsILoadGroup_RemoveRequest(This->nschannel->load_group,
954  (nsIRequest*)&This->nschannel->nsIHttpChannel_iface, NULL, request_result);
955  if(NS_FAILED(nsres))
956  ERR("RemoveRequest failed: %08x\n", nsres);
957  }
958 }
#define NS_BINDING_ABORTED
#define WARN(fmt,...)
Definition: debug.h:111
#define NS_OK
smooth NULL
Definition: ftsmooth.c:416
#define NS_FAILED(res)
#define NS_ERROR_FAILURE
#define E_ABORT
Definition: winerror.h:2366
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
HRESULT nsresult
Definition: nsiface.idl:39
GLuint64EXT * result
Definition: glext.h:11304

Referenced by nsChannelBSC_stop_binding(), and stop_request_proc().

◆ parse_content_type()

static void parse_content_type ( nsChannelBSC This,
const WCHAR value 
)
static

Definition at line 630 of file navigate.c.

631 {
632  const WCHAR *ptr;
633  size_t len;
634 
635  static const WCHAR charsetW[] = {'c','h','a','r','s','e','t','='};
636 
637  ptr = strchrW(value, ';');
638  if(!ptr)
639  return;
640 
641  ptr++;
642  while(*ptr && isspaceW(*ptr))
643  ptr++;
644 
645  len = strlenW(value);
646  if(ptr + sizeof(charsetW)/sizeof(WCHAR) < value+len && !memicmpW(ptr, charsetW, sizeof(charsetW)/sizeof(WCHAR))) {
647  size_t charset_len, lena;
648  nsACString charset_str;
649  const WCHAR *charset;
650  char *charseta;
651 
652  ptr += sizeof(charsetW)/sizeof(WCHAR);
653 
654  if(*ptr == '\'') {
655  FIXME("Quoted value\n");
656  return;
657  }else {
658  charset = ptr;
659  while(*ptr && *ptr != ',')
660  ptr++;
661  charset_len = ptr-charset;
662  }
663 
664  lena = WideCharToMultiByte(CP_ACP, 0, charset, charset_len, NULL, 0, NULL, NULL);
665  charseta = heap_alloc(lena+1);
666  if(!charseta)
667  return;
668 
669  WideCharToMultiByte(CP_ACP, 0, charset, charset_len, charseta, lena, NULL, NULL);
670  charseta[lena] = 0;
671 
672  nsACString_InitDepend(&charset_str, charseta);
673  nsIHttpChannel_SetContentCharset(&This->nschannel->nsIHttpChannel_iface, &charset_str);
674  nsACString_Finish(&charset_str);
675  heap_free(charseta);
676  }else {
677  FIXME("unhandled: %s\n", debugstr_wn(ptr, len - (ptr-value)));
678  }
679 }
WINE_UNICODE_INLINE unsigned int strlenW(const WCHAR *str)
Definition: unicode.h:212
CFF_Charset charset
Definition: cffcmap.c:138
#define WideCharToMultiByte
Definition: compat.h:101
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define CP_ACP
Definition: compat.h:99
WINE_UNICODE_INLINE int isspaceW(WCHAR wc)
Definition: unicode.h:165
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static const WCHAR charsetW[]
Definition: htmlmeta.c:149
__wchar_t WCHAR
Definition: xmlstorage.h:180
GLenum GLsizei len
Definition: glext.h:6722
void nsACString_InitDepend(nsACString *, const char *) DECLSPEC_HIDDEN
Definition: nsembed.c:797
#define debugstr_wn
Definition: kernel32.h:33
void nsACString_Finish(nsACString *) DECLSPEC_HIDDEN
Definition: nsembed.c:812
#define memicmpW(s1, s2, n)
Definition: unicode.h:27
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by process_response_headers().

◆ parse_headers()

static HRESULT parse_headers ( const WCHAR headers,
struct list headers_list 
)
static

Definition at line 681 of file navigate.c.

682 {
683  const WCHAR *header, *header_end, *colon, *value;
684  HRESULT hres;
685 
686  header = headers;
687  while(*header) {
688  if(header[0] == '\r' && header[1] == '\n' && !header[2])
689  break;
690  for(colon = header; *colon && *colon != ':' && *colon != '\r'; colon++);
691  if(*colon != ':')
692  return E_FAIL;
693 
694  value = colon+1;
695  while(*value == ' ')
696  value++;
697  if(!*value)
698  return E_FAIL;
699 
700  for(header_end = value+1; *header_end && *header_end != '\r'; header_end++);
701 
702  hres = set_http_header(headers_list, header, colon-header, value, header_end-value);
703  if(FAILED(hres))
704  return hres;
705 
706  header = header_end;
707  if(header[0] == '\r' && header[1] == '\n')
708  header += 2;
709  }
710 
711  return S_OK;
712 }
HRESULT set_http_header(struct list *, const WCHAR *, int, const WCHAR *, int) DECLSPEC_HIDDEN
Definition: nsio.c:380
vector< Header * > headers
Definition: sdkparse.cpp:39
#define E_FAIL
Definition: ddrawi.h:102
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
GLsizei const GLfloat * value
Definition: glext.h:6069
#define S_OK
Definition: intsafe.h:59
struct CFHEADER header
Definition: fdi.c:109

Referenced by channelbsc_set_channel(), process_response_headers(), and read_post_data_stream().

◆ process_response_headers()

static HRESULT process_response_headers ( nsChannelBSC This,
const WCHAR headers 
)
static

Definition at line 714 of file navigate.c.

715 {
716  http_header_t *iter;
717  HRESULT hres;
718 
719  static const WCHAR content_typeW[] = {'c','o','n','t','e','n','t','-','t','y','p','e',0};
720 
721  hres = parse_headers(headers, &This->nschannel->response_headers);
722  if(FAILED(hres))
723  return hres;
724 
725  LIST_FOR_EACH_ENTRY(iter, &This->nschannel->response_headers, http_header_t, entry) {
726  if(!strcmpiW(iter->header, content_typeW))
727  parse_content_type(This, iter->data);
728  }
729 
730  return S_OK;
731 }
vector< Header * > headers
Definition: sdkparse.cpp:39
WCHAR * data
Definition: binding.h:124
static void parse_content_type(nsChannelBSC *This, const WCHAR *value)
Definition: navigate.c:630
#define LIST_FOR_EACH_ENTRY(elem, list, type, field)
Definition: list.h:198
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
uint32_t entry
Definition: isohybrid.c:63
WCHAR * header
Definition: binding.h:123
#define strcmpiW(s1, s2)
Definition: unicode.h:39
static HRESULT parse_headers(const WCHAR *headers, struct list *headers_list)
Definition: navigate.c:681
#define S_OK
Definition: intsafe.h:59

Referenced by nsChannelBSC_on_response(), and query_http_info().

◆ process_response_status_text()

static HRESULT process_response_status_text ( const WCHAR header,
const WCHAR header_end,
char **  status_text 
)
static

Definition at line 1579 of file navigate.c.

1580 {
1581  header = strchrW(header + 1, ' ');
1582  if(!header || header >= header_end)
1583  return E_FAIL;
1584  header = strchrW(header + 1, ' ');
1585  if(!header || header >= header_end)
1586  return E_FAIL;
1587  ++header;
1588 
1589  *status_text = heap_strndupWtoU(header, header_end - header);
1590 
1591  if(!*status_text)
1592  return E_OUTOFMEMORY;
1593 
1594  return S_OK;
1595 }
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
#define E_FAIL
Definition: ddrawi.h:102
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define S_OK
Definition: intsafe.h:59
static char * heap_strndupWtoU(LPCWSTR str, unsigned len)
struct CFHEADER header
Definition: fdi.c:109

Referenced by nsChannelBSC_on_response().

◆ query_http_info()

static void query_http_info ( nsChannelBSC This,
IWinInetHttpInfo wininet_info 
)
static

Definition at line 733 of file navigate.c.

734 {
735  const WCHAR *ptr;
736  DWORD len = 0;
737  WCHAR *buf;
738 
739  IWinInetHttpInfo_QueryInfo(wininet_info, HTTP_QUERY_RAW_HEADERS_CRLF, NULL, &len, NULL, NULL);
740  if(!len)
741  return;
742 
743  buf = heap_alloc(len);
744  if(!buf)
745  return;
746 
747  IWinInetHttpInfo_QueryInfo(wininet_info, HTTP_QUERY_RAW_HEADERS_CRLF, buf, &len, NULL, NULL);
748  if(!len) {
749  heap_free(buf);
750  return;
751  }
752 
753  ptr = strchrW(buf, '\r');
754  if(ptr && ptr[1] == '\n') {
755  ptr += 2;
757  }
758 
759  heap_free(buf);
760 }
#define HTTP_QUERY_RAW_HEADERS_CRLF
Definition: wininet.h:1545
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
WINE_UNICODE_INLINE WCHAR * strchrW(const WCHAR *str, WCHAR ch)
Definition: unicode.h:248
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static HRESULT process_response_headers(nsChannelBSC *This, const WCHAR *headers)
Definition: navigate.c:714
__wchar_t WCHAR
Definition: xmlstorage.h:180
unsigned long DWORD
Definition: ntddk_ex.h:95
GLenum GLsizei len
Definition: glext.h:6722
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by read_stream_data().

◆ read_post_data_stream()

static HRESULT read_post_data_stream ( nsIInputStream stream,
BOOL  contains_headers,
struct list headers_list,
request_data_t request_data 
)
static

Definition at line 800 of file navigate.c.

802 {
803  nsISeekableStream *seekable_stream;
804  UINT64 available = 0;
805  UINT32 data_len = 0;
806  char *data, *post_data;
807  nsresult nsres;
808  HRESULT hres = S_OK;
809 
810  if(!stream)
811  return S_OK;
812 
813  nsres = nsIInputStream_Available(stream, &available);
814  if(NS_FAILED(nsres))
815  return E_FAIL;
816 
818  if(!data)
819  return E_OUTOFMEMORY;
820 
821  nsres = nsIInputStream_Read(stream, data, available, &data_len);
822  if(NS_FAILED(nsres)) {
823  GlobalFree(data);
824  return E_FAIL;
825  }
826 
827  if(contains_headers) {
828  if(data_len >= 2 && data[0] == '\r' && data[1] == '\n') {
829  post_data = data+2;
830  data_len -= 2;
831  }else {
832  WCHAR *headers;
833  DWORD size;
834  char *ptr;
835 
836  post_data += data_len;
837  for(ptr = data; ptr+4 < data+data_len; ptr++) {
838  if(!memcmp(ptr, "\r\n\r\n", 4)) {
839  ptr += 2;
840  post_data = ptr+2;
841  break;
842  }
843  }
844 
845  data_len -= post_data-data;
846 
848  headers = heap_alloc((size+1)*sizeof(WCHAR));
849  if(headers) {
851  headers[size] = 0;
852  if(headers_list)
853  hres = parse_headers(headers, headers_list);
854  if(SUCCEEDED(hres))
855  request_data->headers = headers;
856  else
858  }else {
860  }
861  }
862  }
863 
864  if(FAILED(hres)) {
865  GlobalFree(data);
866  return hres;
867  }
868 
869  if(!data_len) {
870  GlobalFree(data);
871  post_data = NULL;
872  }else if(post_data != data) {
873  char *new_data;
874 
875  new_data = GlobalAlloc(0, data_len+1);
876  if(new_data)
877  memcpy(new_data, post_data, data_len);
878  GlobalFree(data);
879  if(!new_data)
880  return E_OUTOFMEMORY;
881  post_data = new_data;
882  }
883 
884  if(post_data)
885  post_data[data_len] = 0;
886  request_data->post_data = post_data;
887  request_data->post_data_len = data_len;
888 
889  nsres = nsIInputStream_QueryInterface(stream, &IID_nsISeekableStream, (void**)&seekable_stream);
890  assert(nsres == NS_OK);
891 
892  nsres = nsISeekableStream_Seek(seekable_stream, NS_SEEK_SET, 0);
893  assert(nsres == NS_OK);
894 
895  nsISeekableStream_Release(seekable_stream);
896 
897  nsIInputStream_AddRef(stream);
898  request_data->post_stream = stream;
899  TRACE("post_data = %s\n", debugstr_an(request_data->post_data, request_data->post_data_len));
900  return S_OK;
901 }
HGLOBAL NTAPI GlobalAlloc(UINT uFlags, SIZE_T dwBytes)
Definition: heapmem.c:368
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define CP_ACP
Definition: compat.h:99
ULONG post_data_len
Definition: binding.h:66
#define assert(x)
Definition: debug.h:53
vector< Header * > headers
Definition: sdkparse.cpp:39
#define E_FAIL
Definition: ddrawi.h:102
static void * heap_alloc(size_t len)
Definition: appwiz.h:65
#define NS_OK
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
unsigned int UINT32
static PVOID ptr
Definition: dispmode.c:27
smooth NULL
Definition: ftsmooth.c:416
static WCHAR available[MAX_STRING_RESOURCE_LEN]
Definition: object.c:2336
WCHAR * headers
Definition: binding.h:64
#define NS_FAILED(res)
#define TRACE(s)
Definition: solgame.cpp:4
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
HGLOBAL NTAPI GlobalFree(HGLOBAL hMem)
Definition: heapmem.c:611
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
static const CHAR post_data[]
Definition: protocol.c:215
Definition: parse.h:22
static __inline const char * debugstr_an(const char *s, int n)
Definition: compat.h:47
GLuint GLuint stream
Definition: glext.h:7522
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
static HRESULT parse_headers(const WCHAR *headers, struct list *headers_list)
Definition: navigate.c:681
#define S_OK
Definition: intsafe.h:59
nsIInputStream * post_stream
Definition: binding.h:63
#define MultiByteToWideChar
Definition: compat.h:100
HRESULT nsresult
Definition: nsiface.idl:39
unsigned long long UINT64
HGLOBAL post_data
Definition: binding.h:65
#define SUCCEEDED(hr)
Definition: intsafe.h:57
static BOOL heap_free(void *mem)
Definition: appwiz.h:75

Referenced by hlink_frame_navigate(), nsChannelBSC_init_bindinfo(), and submit_form().

◆ read_stream()

HRESULT read_stream ( BSCallback This,
IStream stream,
void buf,
DWORD  size,
DWORD ret_size 
)

Definition at line 602 of file navigate.c.

603 {
604  DWORD read_size = 0, skip=0;
605  BYTE *data = buf;
606  HRESULT hres;
607 
608  hres = IStream_Read(stream, buf, size, &read_size);
609 
610  if(!This->readed && This->bom == BOM_NONE) {
611  if(read_size >= 2 && data[0] == 0xff && data[1] == 0xfe) {
612  This->bom = BOM_UTF16;
613  skip = 2;
614  }else if(read_size >= 3 && data[0] == 0xef && data[1] == 0xbb && data[2] == 0xbf) {
615  This->bom = BOM_UTF8;
616  skip = 3;
617  }
618  if(skip) {
619  read_size -= skip;
620  if(read_size)
621  memmove(data, data+skip, read_size);
622  }
623  }
624 
625  This->readed += read_size;
626  *ret_size = read_size;
627  return hres;
628 }
#define memmove(s1, s2, n)
Definition: mkisofs.h:881
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLsizeiptr size
Definition: glext.h:5919
HRESULT hres
Definition: protocol.c:465
LONG HRESULT
Definition: typedefs.h:77
unsigned long DWORD
Definition: ntddk_ex.h:95
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
Definition: parse.h:22
unsigned char BYTE
Definition: mem.h:68
#define skip(...)
Definition: atltest.h:64

Referenced by duplicate_extents(), read_stream_data(), and ScriptBSC_read_data().

◆ read_stream_data()

static HRESULT read_stream_data ( nsChannelBSC This,
IStream stream 
)
static

Definition at line 960 of file navigate.c.

961 {
962  DWORD read;
963  nsresult nsres;
964  HRESULT hres;
965 
966  if(!This->response_processed) {
967  IWinInetHttpInfo *wininet_info;
968 
969  This->response_processed = TRUE;
970  if(This->bsc.binding) {
971  hres = IBinding_QueryInterface(This->bsc.binding, &IID_IWinInetHttpInfo, (void**)&wininet_info);
972  if(SUCCEEDED(hres)) {
973  query_http_info(This, wininet_info);
974  IWinInetHttpInfo_Release(wininet_info);
975  }
976  }
977  }
978 
979  if(!This->nschannel)
980  return S_OK;
981 
982  if(!This->nslistener) {
983  BYTE buf[1024];
984 
985  do {
986  hres = read_stream(&This->bsc, stream, buf, sizeof(buf), &read);
987  }while(hres == S_OK && read);
988 
989  return S_OK;
990  }
991 
992  if(!This->nsstream) {
993  This->nsstream = create_nsprotocol_stream();
994  if(!This->nsstream)
995  return E_OUTOFMEMORY;
996  }
997 
998  do {
999  BOOL first_read = !This->bsc.readed;
1000 
1001  hres = read_stream(&This->bsc, stream, This->nsstream->buf+This->nsstream->buf_size,
1002  sizeof(This->nsstream->buf)-This->nsstream->buf_size, &read);
1003  if(!read)
1004  break;
1005 
1006  This->nsstream->buf_size += read;
1007 
1008  if(first_read) {
1009  switch(This->bsc.bom) {
1010  case BOM_UTF8:
1011  This->nschannel->charset = heap_strdupA(UTF8_STR);
1012  break;
1013  case BOM_UTF16:
1014  This->nschannel->charset = heap_strdupA(UTF16_STR);
1015  case BOM_NONE:
1016  /* FIXME: Get charset from HTTP headers */;
1017  }
1018 
1019  if(!This->nschannel->content_type) {
1020  WCHAR *mime;
1021 
1022  hres = FindMimeFromData(NULL, NULL, This->nsstream->buf, This->nsstream->buf_size,
1023  This->is_doc_channel ? text_htmlW : NULL, 0, &mime, 0);
1024  if(FAILED(hres))
1025  return hres;
1026 
1027  TRACE("Found MIME %s\n", debugstr_w(mime));
1028 
1029  This->nschannel->content_type = heap_strdupWtoA(mime);
1031  if(!This->nschannel->content_type)
1032  return E_OUTOFMEMORY;
1033  }
1034 
1036  if(FAILED(hres))
1037  return hres;
1038  }
1039 
1040  nsres = nsIStreamListener_OnDataAvailable(This->nslistener,
1041  (nsIRequest*)&This->nschannel->nsIHttpChannel_iface, This->nscontext,
1042  &This->nsstream->nsIInputStream_iface, This->bsc.readed-This->nsstream->buf_size,
1043  This->nsstream->buf_size);
1044  if(NS_FAILED(nsres))
1045  ERR("OnDataAvailable failed: %08x\n", nsres);
1046 
1047  if(This->nsstream->buf_size == sizeof(This->nsstream->buf)) {
1048  ERR("buffer is full\n");
1049  break;
1050  }
1051  }while(hres == S_OK);
1052 
1053  return S_OK;
1054 }
#define TRUE
Definition: types.h:120
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:422
static nsProtocolStream * create_nsprotocol_stream(void)
Definition: navigate.c:175
const WCHAR * mime
Definition: mimefilter.c:512
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
#define UTF16_STR
Definition: navigate.c:26
#define UTF8_STR
Definition: navigate.c:25
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static HRESULT on_start_nsrequest(nsChannelBSC *This)
Definition: navigate.c:903
unsigned int BOOL
Definition: ntddk_ex.h:94
#define debugstr_w
Definition: kernel32.h:32
smooth NULL
Definition: ftsmooth.c:416
static void query_http_info(nsChannelBSC *This, IWinInetHttpInfo *wininet_info)
Definition: navigate.c:733
#define NS_FAILED(res)
#define TRACE(s)
Definition: solgame.cpp:4
HRESULT hres
Definition: protocol.c:465
static const WCHAR text_htmlW[]
Definition: navigate.c:29
__wchar_t WCHAR
Definition: xmlstorage.h:180
LONG HRESULT
Definition: typedefs.h:77
static char * heap_strdupWtoA(const WCHAR *str)
unsigned long DWORD
Definition: ntddk_ex.h:95
Definition: parse.h:22
unsigned char BYTE
Definition: mem.h:68
HRESULT read_stream(BSCallback *This, IStream *stream, void *buf, DWORD size, DWORD *ret_size)
Definition: navigate.c:602
#define ERR(fmt,...)
Definition: debug.h:109
#define S_OK
Definition: intsafe.h:59
HRESULT nsresult
Definition: nsiface.idl:39
static char * heap_strdupA(const char *str)
HRESULT WINAPI FindMimeFromData(LPBC pBC, LPCWSTR pwzUrl, LPVOID pBuffer, DWORD cbSize, LPCWSTR pwzMimeProposed, DWORD dwMimeFlags, LPWSTR *ppwzMimeOut, DWORD dwReserved)
Definition: mimefilter.c:680
_CRTIMP int __cdecl read(_In_ int _FileHandle, _Out_writes_bytes_(_MaxCharCount) void *_DstBuf, _In_ unsigned int _MaxCharCount)
#define SUCCEEDED(hr)
Definition: intsafe.h:57

Referenced by channelbsc_load_stream(), msi_load_admin_properties(), msi_load_string_table(), and nsChannelBSC_read_data().

◆ release_request_data()

static void release_request_data ( request_data_t request_data)
static

Definition at line 190 of file navigate.c.

191 {
192  if(request_data->post_stream)
193  nsIInputStream_Release(request_data->post_stream);
194  heap_free(request_data->headers);
195  if(request_data->post_data)
196  GlobalFree(request_data->post_data);
197 }