mshtml: Set reload load type to Gecko for document reloads.

So it can async open with proper binding flags.

Signed-off-by: Gabriel Ivăncescu <gabrielopcode@gmail.com>
This commit is contained in:
Gabriel Ivăncescu 2022-11-25 19:10:03 +02:00 committed by Alexandre Julliard
parent 12213e13ab
commit 25f205d9ac
4 changed files with 37 additions and 11 deletions

View file

@ -1090,7 +1090,7 @@ char *get_nscategory_entry(const char*,const char*) DECLSPEC_HIDDEN;
HRESULT create_pending_window(HTMLOuterWindow*,nsChannelBSC*) DECLSPEC_HIDDEN;
HRESULT start_binding(HTMLInnerWindow*,BSCallback*,IBindCtx*) DECLSPEC_HIDDEN;
HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*) DECLSPEC_HIDDEN;
HRESULT async_start_doc_binding(HTMLOuterWindow*,HTMLInnerWindow*,DWORD) DECLSPEC_HIDDEN;
void abort_window_bindings(HTMLInnerWindow*) DECLSPEC_HIDDEN;
void set_download_state(HTMLDocumentObj*,int) DECLSPEC_HIDDEN;
void call_docview_84(HTMLDocumentObj*) DECLSPEC_HIDDEN;

View file

@ -1926,6 +1926,7 @@ HRESULT create_channelbsc(IMoniker *mon, const WCHAR *headers, BYTE *post_data,
typedef struct {
task_t header;
DWORD flags;
HTMLOuterWindow *window;
HTMLInnerWindow *pending_window;
} start_doc_binding_task_t;
@ -1934,7 +1935,7 @@ static void start_doc_binding_proc(task_t *_task)
{
start_doc_binding_task_t *task = (start_doc_binding_task_t*)_task;
set_current_mon(task->window, task->pending_window->bscallback->bsc.mon, BINDING_NAVIGATED);
set_current_mon(task->window, task->pending_window->bscallback->bsc.mon, task->flags);
start_binding(task->pending_window, &task->pending_window->bscallback->bsc, NULL);
}
@ -1946,7 +1947,7 @@ static void start_doc_binding_task_destr(task_t *_task)
free(task);
}
HRESULT async_start_doc_binding(HTMLOuterWindow *window, HTMLInnerWindow *pending_window)
HRESULT async_start_doc_binding(HTMLOuterWindow *window, HTMLInnerWindow *pending_window, DWORD flags)
{
start_doc_binding_task_t *task;
@ -1956,6 +1957,7 @@ HRESULT async_start_doc_binding(HTMLOuterWindow *window, HTMLInnerWindow *pendin
if(!task)
return E_OUTOFMEMORY;
task->flags = flags;
task->window = window;
task->pending_window = pending_window;
IHTMLWindow2_AddRef(&pending_window->base.IHTMLWindow2_iface);
@ -2531,7 +2533,8 @@ static HRESULT navigate_uri(HTMLOuterWindow *window, IUri *uri, const WCHAR *dis
if(FAILED(hres))
return hres;
hres = load_nsuri(window, nsuri, request_data ? request_data->post_stream : NULL, NULL, LOAD_FLAGS_NONE);
hres = load_nsuri(window, nsuri, request_data ? request_data->post_stream : NULL, NULL,
(flags & BINDING_REFRESH) ? LOAD_FLAGS_IS_REFRESH : LOAD_FLAGS_NONE);
nsISupports_Release((nsISupports*)nsuri);
return hres;
}

View file

@ -496,6 +496,16 @@ interface nsIStandardURL : nsIMutable
]
interface nsIRequest : nsISupports
{
const UINT LOAD_NORMAL = 0;
const UINT LOAD_BACKGROUND = 1 << 1;
const UINT INHIBIT_CACHING = 1 << 7;
const UINT INHIBIT_PERSISTENT_CACHING = 1 << 8;
const UINT LOAD_BYPASS_CACHE = 1 << 9;
const UINT LOAD_FROM_CACHE = 1 << 10;
const UINT VALIDATE_ALWAYS = 1 << 11;
const UINT VALIDATE_NEVER = 1 << 12;
const UINT VALIDATE_ONCE_PER_SESSION = 1 << 13;
nsresult GetName(nsACString *aName);
nsresult IsPending(bool *_retval);
nsresult GetStatus(nsresult *aStatus);
@ -3936,6 +3946,11 @@ interface nsIDocShellLoadInfo : nsISupports
]
interface nsIDocShell : nsIDocShellTreeItem
{
const UINT LOAD_CMD_NORMAL = 1;
const UINT LOAD_CMD_RELOAD = 2;
const UINT LOAD_CMD_HISTORY = 4;
const UINT LOAD_CMD_PUSHSTATE = 8;
nsresult LoadURI(nsIURI *uri, nsIDocShellLoadInfo *loadInfo, uint32_t aLoadFlags, bool firstParty);
nsresult LoadStream(nsIInputStream *aStream, nsIURI *aURI, const nsACString *aContentType,
const nsACString *aContentCharset, nsIDocShellLoadInfo *aLoadInfo);

View file

@ -284,6 +284,7 @@ HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsIInputStream *post
nsChannelBSC *channelbsc, DWORD flags)
{
nsIWebNavigation *web_navigation;
nsDocShellInfoLoadType load_type;
nsIDocShellLoadInfo *load_info;
nsIDocShell *doc_shell;
HTMLDocumentNode *doc;
@ -308,7 +309,11 @@ HRESULT load_nsuri(HTMLOuterWindow *window, nsWineURI *uri, nsIInputStream *post
return E_FAIL;
}
nsres = nsIDocShellLoadInfo_SetLoadType(load_info, (flags & LOAD_FLAGS_BYPASS_CACHE) ? loadNormalBypassCache : loadNormal);
if(flags & LOAD_FLAGS_IS_REFRESH)
load_type = (flags & LOAD_FLAGS_BYPASS_CACHE) ? loadReloadBypassCache : loadReloadNormal;
else
load_type = (flags & LOAD_FLAGS_BYPASS_CACHE) ? loadNormalBypassCache : loadNormal;
nsres = nsIDocShellLoadInfo_SetLoadType(load_info, load_type);
assert(nsres == NS_OK);
if(post_stream) {
@ -905,7 +910,7 @@ static nsresult NSAPI nsChannel_Open2(nsIHttpChannel *iface, nsIInputStream **_r
return NS_ERROR_NOT_IMPLEMENTED;
}
static HTMLOuterWindow *get_channel_window(nsChannel *This)
static HTMLOuterWindow *get_channel_window(nsChannel *This, UINT32 *load_type)
{
nsIWebProgress *web_progress = NULL;
mozIDOMWindowProxy *mozwindow;
@ -944,6 +949,8 @@ static HTMLOuterWindow *get_channel_window(nsChannel *This)
return NULL;
}
nsIWebProgress_GetLoadType(web_progress, load_type);
nsres = nsIWebProgress_GetDOMWindow(web_progress, &mozwindow);
nsIWebProgress_Release(web_progress);
if(NS_FAILED(nsres) || !mozwindow) {
@ -982,8 +989,8 @@ static void start_binding_task_destr(task_t *_task)
free(task);
}
static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc_channel, nsIStreamListener *listener,
nsISupports *context)
static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc_channel, UINT32 load_type,
nsIStreamListener *listener, nsISupports *context)
{
nsChannelBSC *bscallback;
IMoniker *mon = NULL;
@ -1008,7 +1015,7 @@ static nsresult async_open(nsChannel *This, HTMLOuterWindow *window, BOOL is_doc
if(is_doc_channel) {
hres = create_pending_window(window, bscallback);
if(SUCCEEDED(hres))
async_start_doc_binding(window, window->pending_window);
async_start_doc_binding(window, window->pending_window, (load_type & LOAD_CMD_RELOAD) ? BINDING_REFRESH : BINDING_NAVIGATED);
IBindStatusCallback_Release(&bscallback->bsc.IBindStatusCallback_iface);
if(FAILED(hres))
return NS_ERROR_UNEXPECTED;
@ -1035,6 +1042,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
nsISupports *aContext)
{
nsChannel *This = impl_from_nsIHttpChannel(iface);
UINT32 load_type = LOAD_CMD_NORMAL;
HTMLOuterWindow *window = NULL;
BOOL is_document_channel;
BOOL cancel = FALSE;
@ -1058,7 +1066,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
}
}
window = get_channel_window(This);
window = get_channel_window(This, &load_type);
if(!window) {
ERR("window = NULL\n");
return NS_ERROR_UNEXPECTED;
@ -1088,7 +1096,7 @@ static nsresult NSAPI nsChannel_AsyncOpen(nsIHttpChannel *iface, nsIStreamListen
}
if(!cancel)
nsres = async_open(This, window, is_document_channel, aListener, aContext);
nsres = async_open(This, window, is_document_channel, load_type, aListener, aContext);
if(NS_SUCCEEDED(nsres) && This->load_group) {
nsres = nsILoadGroup_AddRequest(This->load_group, (nsIRequest*)&This->nsIHttpChannel_iface,