mshtml: Added support for frames in navigate_url.

This commit is contained in:
Jacek Caban 2009-11-30 18:01:31 +01:00 committed by Alexandre Julliard
parent ec13e51087
commit 050a1372b0
4 changed files with 144 additions and 4 deletions

View File

@ -666,6 +666,7 @@ void release_nsio(void);
BOOL install_wine_gecko(BOOL); BOOL install_wine_gecko(BOOL);
HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*); HRESULT nsuri_to_url(LPCWSTR,BOOL,BSTR*);
HRESULT create_doc_uri(HTMLWindow*,WCHAR*,nsIWineURI**);
HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD); HRESULT hlink_frame_navigate(HTMLDocument*,LPCWSTR,nsIInputStream*,DWORD);
HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*); HRESULT navigate_url(HTMLWindow*,const WCHAR*,const WCHAR*);

View File

@ -1236,6 +1236,10 @@ HRESULT hlink_frame_navigate(HTMLDocument *doc, LPCWSTR url,
HRESULT navigate_url(HTMLWindow *window, const WCHAR *new_url, const WCHAR *base_url) HRESULT navigate_url(HTMLWindow *window, const WCHAR *new_url, const WCHAR *base_url)
{ {
WCHAR url[INTERNET_MAX_URL_LENGTH]; WCHAR url[INTERNET_MAX_URL_LENGTH];
nsIWebNavigation *web_navigation;
nsIDocShell *doc_shell;
nsIWineURI *uri;
nsresult nsres;
HRESULT hres; HRESULT hres;
if(!new_url) { if(!new_url) {
@ -1262,9 +1266,38 @@ HRESULT navigate_url(HTMLWindow *window, const WCHAR *new_url, const WCHAR *base
} }
} }
hres = hlink_frame_navigate(&window->doc->basedoc, url, NULL, 0); if(window->doc_obj && window == window->doc_obj->basedoc.window) {
if(FAILED(hres)) hres = hlink_frame_navigate(&window->doc->basedoc, url, NULL, 0);
FIXME("hlink_frame_navigate failed: %08x\n", hres); if(SUCCEEDED(hres))
return S_OK;
TRACE("hlink_frame_navigate failed: %08x\n", hres);
}
return hres; nsres = get_nsinterface((nsISupports*)window->nswindow, &IID_nsIWebNavigation, (void**)&web_navigation);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIWebNavigation interface: %08x\n", nsres);
return E_FAIL;
}
nsres = nsIWebNavigation_QueryInterface(web_navigation, &IID_nsIDocShell, (void**)&doc_shell);
nsIWebNavigation_Release(web_navigation);
if(NS_FAILED(nsres)) {
ERR("Could not get nsIDocShell: %08x\n", nsres);
return E_FAIL;
}
hres = create_doc_uri(window, url, &uri);
if(FAILED(hres)) {
nsIDocShell_Release(doc_shell);
return hres;
}
nsres = nsIDocShell_LoadURI(doc_shell, (nsIURI*)uri, NULL, 0, FALSE);
nsIDocShell_Release(doc_shell);
if(NS_FAILED(nsres)) {
WARN("LoadURI failed: %08x\n", nsres);
return E_FAIL;
}
return S_OK;
} }

View File

@ -142,6 +142,14 @@ typedef nsISupports nsIStyleSheet;
typedef nsISupports nsIStyleRule; typedef nsISupports nsIStyleRule;
typedef nsISupports nsIVariant; typedef nsISupports nsIVariant;
typedef nsISupports nsIDOMUserDataHandler; typedef nsISupports nsIDOMUserDataHandler;
typedef nsISupports nsIDocShellLoadInfo;
typedef nsISupports nsISHEntry;
typedef nsISupports nsIPresShell;
typedef nsISupports nsIContentViewer;
typedef nsISupports nsIDocumentCharsetInfo;
typedef nsISupports nsILayoutHistoryState;
typedef nsISupports nsISecureBrowserUI;
typedef nsISupports nsIDOMStorage;
[ [
object, object,
@ -2650,6 +2658,88 @@ interface nsIHTMLEditor : nsISupports
nsresult SetReturnInParagraphCreatesNewParagraph([in] PRBool prb); nsresult SetReturnInParagraphCreatesNewParagraph([in] PRBool prb);
} }
[
object,
uuid(8adfb831-1053-4a19-884d-bcdad7277b4b),
local
/* NOT_FROZEN */
]
interface nsIDocShell : nsISupports
{
nsresult LoadURI(nsIURI *uri, nsIDocShellLoadInfo *loadInfo, PRUint32 aLoadFlags, PRBool firstParty);
nsresult LoadStream(nsIInputStream *aStream, nsIURI *aURI, const nsACString *aContentType,
const nsACString *aContentCharset, nsIDocShellLoadInfo *aLoadInfo);
nsresult InternalLoad(nsIURI *aURI, nsIURI *aReferrer, nsISupports *aOwner, PRUint32 aFlags, const PRUnichar *aWindowTarget,
const char *aTypeHint, nsIInputStream *aPostDataStream, nsIInputStream *aHeadersStream, PRUint32 aLoadFlags,
nsISHEntry *aSHEntry, PRBool firstParty, nsIDocShell **aDocShell, nsIRequest **aRequest);
nsresult CreateLoadInfo(nsIDocShellLoadInfo **loadInfo);
nsresult PrepareForNewContentModel();
nsresult SetCurrentURI(nsIURI *aURI);
nsresult FirePageHideNotification(PRBool isUnload);
nsresult GetPresContext(void /*nsPresContext*/ **aPresContext);
nsresult GetPresShell(nsIPresShell **aPresShell);
nsresult GetEldestPresShell(nsIPresShell **aEldestPresShell);
nsresult GetContentViewer(nsIContentViewer **aContentViewer);
nsresult GetChromeEventHandler(nsIDOMEventTarget **aChromeEventHandler);
nsresult SetChromeEventHandler(nsIDOMEventTarget *aChromeEventHandler);
nsresult GetDocumentCharsetInfo(nsIDocumentCharsetInfo **aDocumentCharsetInfo);
nsresult SetDocumentCharsetInfo(nsIDocumentCharsetInfo *aDocumentCharsetInfo);
nsresult GetAllowPlugins(PRBool *aAllowPlugins);
nsresult SetAllowPlugins(PRBool aAllowPlugins);
nsresult GetAllowJavascript(PRBool *aAllowJavascript);
nsresult SetAllowJavascript(PRBool aAllowJavascript);
nsresult GetAllowMetaRedirects(PRBool *aAllowMetaRedirects);
nsresult SetAllowMetaRedirects(PRBool aAllowMetaRedirects);
nsresult GetAllowSubframes(PRBool *aAllowSubframes);
nsresult SetAllowSubframes(PRBool aAllowSubframes);
nsresult GetAllowImages(PRBool *aAllowImages);
nsresult SetAllowImages(PRBool aAllowImages);
nsresult GetAllowDNSPrefetch(PRBool *aAllowDNSPrefetch);
nsresult SetAllowDNSPrefetch(PRBool aAllowDNSPrefetch);
nsresult GetDocShellEnumerator(PRInt32 aItemType, PRInt32 aDirection, nsISimpleEnumerator **_retval);
nsresult GetAppType(PRUint32 *aAppType);
nsresult SetAppType(PRUint32 aAppType);
nsresult GetAllowAuth(PRBool *aAllowAuth);
nsresult SetAllowAuth(PRBool aAllowAuth);
nsresult GetZoom(float *aZoom);
nsresult SetZoom(float aZoom);
nsresult GetMarginWidth(PRInt32 *aMarginWidth);
nsresult SetMarginWidth(PRInt32 aMarginWidth);
nsresult GetMarginHeight(PRInt32 *aMarginHeight);
nsresult SetMarginHeight(PRInt32 aMarginHeight);
nsresult TabToTreeOwner(PRBool forward, PRBool *tookFocus);
nsresult GetBusyFlags(PRUint32 *aBusyFlags);
nsresult GetLoadType(PRUint32 *aLoadType);
nsresult SetLoadType(PRUint32 aLoadType);
nsresult IsBeingDestroyed(PRBool *_retval);
nsresult GetIsExecutingOnLoadHandler(PRBool *aIsExecutingOnLoadHandler);
nsresult GetLayoutHistoryState(nsILayoutHistoryState **aLayoutHistoryState);
nsresult SetLayoutHistoryState(nsILayoutHistoryState *aLayoutHistoryState);
nsresult GetShouldSaveLayoutState(PRBool *aShouldSaveLayoutState);
nsresult GetSecurityUI(nsISecureBrowserUI **aSecurityUI);
nsresult SetSecurityUI(nsISecureBrowserUI *aSecurityUI);
nsresult SuspendRefreshURIs();
nsresult ResumeRefreshURIs();
nsresult BeginRestore(nsIContentViewer *viewer, PRBool top);
nsresult FinishRestore();
nsresult GetRestoringDocument(PRBool *aRestoringDocument);
nsresult GetUseErrorPages(PRBool *aUseErrorPages);
nsresult SetUseErrorPages(PRBool aUseErrorPages);
nsresult GetPreviousTransIndex(PRInt32 *aPreviousTransIndex);
nsresult GetLoadedTransIndex(PRInt32 *aLoadedTransIndex);
nsresult HistoryPurged(PRInt32 numEntries);
nsresult GetSessionStorageForURI(nsIURI *uri, nsIDOMStorage **_retval);
nsresult GetSessionStorageForPrincipal(nsIPrincipal *principal, PRBool create, nsIDOMStorage **_retval);
nsresult AddSessionStorage(nsIPrincipal *principal, nsIDOMStorage *storage);
nsresult GetCurrentDocumentChannel(nsIChannel * *aCurrentDocumentChannel);
nsresult SetChildOffset(PRUint32 offset);
nsresult GetIsInUnload(PRBool *aIsInUnload);
nsresult GetChannelIsUnsafe(PRBool *aChannelIsUnsafe);
void DetachEditorFromWindow();
nsresult GetIsOffScreenBrowser(PRBool *aIsOffScreenBrowser);
nsresult SetIsOffScreenBrowser(PRBool aIsOffScreenBrowser);
}
[ [
object, object,
uuid(365d600b-868a-452a-8de8-f46fad8fee53), uuid(365d600b-868a-452a-8de8-f46fad8fee53),

View File

@ -2365,6 +2365,22 @@ static nsresult create_uri(nsIURI *uri, HTMLWindow *window, NSContainer *contain
return NS_OK; return NS_OK;
} }
HRESULT create_doc_uri(HTMLWindow *window, WCHAR *url, nsIWineURI **ret)
{
nsIWineURI *uri;
nsresult nsres;
nsres = create_uri(NULL, window, window->doc_obj->nscontainer, &uri);
if(NS_FAILED(nsres))
return E_FAIL;
nsIWineURI_SetWineURL(uri, url);
nsIWineURI_SetIsDocumentURI(uri, TRUE);
*ret = uri;
return S_OK;
}
typedef struct { typedef struct {
const nsIProtocolHandlerVtbl *lpProtocolHandlerVtbl; const nsIProtocolHandlerVtbl *lpProtocolHandlerVtbl;