ReactOS 0.4.15-dev-7693-gd0e2924
persist.c
Go to the documentation of this file.
1/*
2 * Copyright 2005 Jacek Caban
3 *
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
8 *
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
13 *
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17 */
18
19#include "mshtml_private.h"
20
21/* Undocumented notification, see tests */
22#define CMDID_EXPLORER_UPDATEHISTORY 38
23
24static const WCHAR about_blankW[] = {'a','b','o','u','t',':','b','l','a','n','k',0};
25
26typedef struct {
32
34{
35 DWORD zone;
37
38 hres = IInternetSecurityManager_MapUrlToZone(window->secmgr, window->url, &zone, 0);
39 if(FAILED(hres)) {
40 WARN("Could not map %s to zone: %08x\n", debugstr_w(window->url), hres);
41 return TRUE;
42 }
43
44 TRACE("zone %d\n", zone);
45 return zone == URLZONE_UNTRUSTED;
46}
47
49{
50 IOleCommandTarget *cmdtrg;
52
53 if(!doc->webbrowser)
54 return;
55
56 hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&cmdtrg);
57 if(SUCCEEDED(hres)) {
58 VARIANT vin;
59
60 V_VT(&vin) = VT_I4;
61 V_I4(&vin) = 0;
62
63 IOleCommandTarget_Exec(cmdtrg, &CGID_Explorer, CMDID_EXPLORER_UPDATEHISTORY, 0, &vin, NULL);
64 IOleCommandTarget_Release(cmdtrg);
65 }
66}
67
69{
70 if(window->uri) {
71 IUri_Release(window->uri);
72 window->uri = NULL;
73 }
74
75 if(window->uri_nofrag) {
76 IUri_Release(window->uri_nofrag);
77 window->uri_nofrag = NULL;
78 }
79
81 window->url = NULL;
82
83 if(!uri)
84 return;
85
86 IUri_AddRef(uri);
87 window->uri = uri;
88
89 window->uri_nofrag = get_uri_nofrag(uri);
90 if(!window->uri_nofrag) {
91 FIXME("get_uri_nofrag failed\n");
92 IUri_AddRef(uri);
93 window->uri_nofrag = uri;
94 }
95
96 IUri_GetDisplayUri(uri, &window->url);
97}
98
100{
101 IUriContainer *uri_container;
102 IUri *uri = NULL;
104
105 if(This->mon) {
106 if(This->doc_obj && !(flags & (BINDING_REPLACE|BINDING_REFRESH))) {
107 if(This == This->doc_obj->basedoc.window)
109 else
110 TRACE("Skipping travellog update for frame navigation.\n");
111 }
112 IMoniker_Release(This->mon);
113 This->mon = NULL;
114 }
115
116 This->load_flags = flags;
117 if(!mon)
118 return;
119
120 IMoniker_AddRef(mon);
121 This->mon = mon;
122
123 hres = IMoniker_QueryInterface(mon, &IID_IUriContainer, (void**)&uri_container);
124 if(SUCCEEDED(hres)) {
125 hres = IUriContainer_GetIUri(uri_container, &uri);
126 IUriContainer_Release(uri_container);
127 if(hres != S_OK) {
128 WARN("GetIUri failed: %08x\n", hres);
129 uri = NULL;
130 }
131 }
132
133 if(!uri) {
134 WCHAR *url;
135
136 hres = IMoniker_GetDisplayName(mon, NULL, NULL, &url);
137 if(SUCCEEDED(hres)) {
138 hres = create_uri(url, 0, &uri);
139 if(FAILED(hres)) {
140 WARN("CrateUri failed: %08x\n", hres);
142 This->url = SysAllocString(url);
144 return;
145 }
147 }else {
148 WARN("GetDisplayName failed: %08x\n", hres);
149 }
150 }
151
153 if(uri)
154 IUri_Release(uri);
156}
157
159{
160 return CreateUri(uri_str, flags | Uri_CREATE_ALLOW_IMPLICIT_FILE_SCHEME, 0, uri);
161}
162
164{
165 return window->uri
167 : create_uri(rel_uri, 0, uri);
168}
169
171{
172 if(doc->client) {
173 IOleCommandTarget *olecmd;
175
176 hres = IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
177 if(SUCCEEDED(hres)) {
178 VARIANT var;
179
180 V_VT(&var) = VT_I4;
181 V_I4(&var) = state;
182
183 IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETDOWNLOADSTATE,
184 OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL);
185 IOleCommandTarget_Release(olecmd);
186 }
187 }
188
189 doc->download_state = state;
190}
191
192static void set_progress_proc(task_t *_task)
193{
194 docobj_task_t *task = (docobj_task_t*)_task;
195 IOleCommandTarget *olecmd = NULL;
196 HTMLDocumentObj *doc = task->doc;
198
199 TRACE("(%p)\n", doc);
200
201 if(doc->client)
202 IOleClientSite_QueryInterface(doc->client, &IID_IOleCommandTarget, (void**)&olecmd);
203
204 if(olecmd) {
205 VARIANT progress_max, progress;
206
207 V_VT(&progress_max) = VT_I4;
208 V_I4(&progress_max) = 0; /* FIXME */
209 IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSMAX, OLECMDEXECOPT_DONTPROMPTUSER,
210 &progress_max, NULL);
211
212 V_VT(&progress) = VT_I4;
213 V_I4(&progress) = 0; /* FIXME */
214 IOleCommandTarget_Exec(olecmd, NULL, OLECMDID_SETPROGRESSPOS, OLECMDEXECOPT_DONTPROMPTUSER,
215 &progress, NULL);
216 IOleCommandTarget_Release(olecmd);
217 }
218
219 if(doc->usermode == EDITMODE && doc->hostui) {
220 DOCHOSTUIINFO hostinfo;
221
222 memset(&hostinfo, 0, sizeof(DOCHOSTUIINFO));
223 hostinfo.cbSize = sizeof(DOCHOSTUIINFO);
224 hres = IDocHostUIHandler_GetHostInfo(doc->hostui, &hostinfo);
225 if(SUCCEEDED(hres))
226 /* FIXME: use hostinfo */
227 TRACE("hostinfo = {%u %08x %08x %s %s}\n",
228 hostinfo.cbSize, hostinfo.dwFlags, hostinfo.dwDoubleClick,
229 debugstr_w(hostinfo.pchHostCss), debugstr_w(hostinfo.pchHostNS));
230 }
231}
232
233static void set_downloading_proc(task_t *_task)
234{
236 HTMLDocumentObj *doc = task->doc;
238
239 TRACE("(%p)\n", doc);
240
242
243 if(task->set_download)
244 set_download_state(doc, 1);
245
246 if(!doc->client)
247 return;
248
249 if(doc->view_sink)
250 IAdviseSink_OnViewChange(doc->view_sink, DVASPECT_CONTENT, -1);
251
252 if(doc->hostui) {
253 IDropTarget *drop_target = NULL;
254
255 hres = IDocHostUIHandler_GetDropTarget(doc->hostui, NULL /* FIXME */, &drop_target);
256 if(SUCCEEDED(hres) && drop_target) {
257 FIXME("Use IDropTarget\n");
258 IDropTarget_Release(drop_target);
259 }
260 }
261}
262
264{
266
267 CoTaskMemFree(task->url);
268 heap_free(task);
269}
270
272{
274
275 if(This->doc_obj->client) {
276 VARIANT silent, offline;
277
278 hres = get_client_disp_property(This->doc_obj->client, DISPID_AMBIENT_SILENT, &silent);
279 if(SUCCEEDED(hres)) {
280 if(V_VT(&silent) != VT_BOOL)
281 WARN("silent = %s\n", debugstr_variant(&silent));
282 else if(V_BOOL(&silent))
283 FIXME("silent == true\n");
284 }
285
286 hres = get_client_disp_property(This->doc_obj->client,
288 if(SUCCEEDED(hres)) {
289 if(V_VT(&offline) != VT_BOOL)
290 WARN("offline = %s\n", debugstr_variant(&offline));
291 else if(V_BOOL(&offline))
292 FIXME("offline == true\n");
293 }
294 }
295
296 if(This->window->mon) {
298 }else {
300 set_current_mon(This->window, mon, flags);
301 }
302
303 if(This->doc_obj->client) {
304 IOleCommandTarget *cmdtrg = NULL;
305
306 hres = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget,
307 (void**)&cmdtrg);
308 if(SUCCEEDED(hres)) {
309 VARIANT var, out;
310
312 V_VT(&var) = VT_UNKNOWN;
313 V_UNKNOWN(&var) = (IUnknown*)&This->window->base.IHTMLWindow2_iface;
314 V_VT(&out) = VT_EMPTY;
315 hres = IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 63, 0, &var, &out);
316 if(SUCCEEDED(hres))
318 }else if(!(flags & BINDING_FROMHIST)) {
319 V_VT(&var) = VT_I4;
320 V_I4(&var) = 0;
321 IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 37, 0, &var, NULL);
322 }
323
324 IOleCommandTarget_Release(cmdtrg);
325 }
326 }
327}
328
330 BOOL set_download)
331{
332 download_proc_task_t *download_task;
333 HTMLDocumentObj *doc_obj = NULL;
334 nsChannelBSC *bscallback;
335 nsWineURI *nsuri;
337 IUri *uri;
339
340 if(window->doc_obj && window->doc_obj->basedoc.window == window)
341 doc_obj = window->doc_obj;
342
343 hres = IMoniker_GetDisplayName(mon, pibc, NULL, &url);
344 if(FAILED(hres)) {
345 WARN("GetDiaplayName failed: %08x\n", hres);
346 return hres;
347 }
348
349 if(nav_uri) {
350 uri = nav_uri;
351 }else {
352 hres = create_uri(url, 0, &uri);
353 if(FAILED(hres)) {
355 return hres;
356 }
357 }
358
359 TRACE("got url: %s\n", debugstr_w(url));
360
361 set_ready_state(window, READYSTATE_LOADING);
362
363 hres = create_doc_uri(window, uri, &nsuri);
364 if(!nav_uri)
365 IUri_Release(uri);
366 if(SUCCEEDED(hres)) {
367 if(async_bsc)
368 bscallback = async_bsc;
369 else
370 hres = create_channelbsc(mon, NULL, NULL, 0, TRUE, &bscallback);
371 }
372
373 if(SUCCEEDED(hres)) {
374 if(window->base.inner_window->doc)
375 remove_target_tasks(window->base.inner_window->task_magic);
376 abort_window_bindings(window->base.inner_window);
377
378 hres = load_nsuri(window, nsuri, NULL, bscallback, LOAD_FLAGS_BYPASS_CACHE);
379 nsISupports_Release((nsISupports*)nsuri); /* FIXME */
380 if(SUCCEEDED(hres)) {
381 hres = create_pending_window(window, bscallback);
382 TRACE("pending window for %p %p %p\n", window, bscallback, window->pending_window);
383 }
384 if(bscallback != async_bsc)
385 IBindStatusCallback_Release(&bscallback->bsc.IBindStatusCallback_iface);
386 }
387
388 if(FAILED(hres)) {
390 return hres;
391 }
392
393 if(doc_obj) {
395
396 if(doc_obj->frame) {
397 docobj_task_t *task;
398
399 task = heap_alloc(sizeof(docobj_task_t));
400 task->doc = doc_obj;
402 if(FAILED(hres)) {
404 return hres;
405 }
406 }
407
408 download_task = heap_alloc(sizeof(download_proc_task_t));
409 download_task->doc = doc_obj;
410 download_task->set_download = set_download;
411 download_task->url = url;
413 }
414
415 return S_OK;
416}
417
419{
420 window->readystate_pending = FALSE;
421
422 if(window->doc_obj && window->doc_obj->basedoc.window == window)
423 call_property_onchanged(&window->doc_obj->basedoc.cp_container, DISPID_READYSTATE);
424
425 fire_event(window->base.inner_window->doc, EVENTID_READYSTATECHANGE, FALSE,
426 window->base.inner_window->doc->node.nsnode, NULL, NULL);
427
428 if(window->frame_element)
429 fire_event(window->frame_element->element.node.doc, EVENTID_READYSTATECHANGE,
430 TRUE, window->frame_element->element.node.nsnode, NULL, NULL);
431}
432
433typedef struct {
437
438static void notif_readystate_proc(task_t *_task)
439{
440 readystate_task_t *task = (readystate_task_t*)_task;
442}
443
445{
446 readystate_task_t *task = (readystate_task_t*)_task;
447 IHTMLWindow2_Release(&task->window->base.IHTMLWindow2_iface);
448}
449
450void set_ready_state(HTMLOuterWindow *window, READYSTATE readystate)
451{
452 READYSTATE prev_state = window->readystate;
453
454 window->readystate = readystate;
455
456 if(window->readystate_locked) {
457 readystate_task_t *task;
459
460 if(window->readystate_pending || prev_state == readystate)
461 return;
462
463 task = heap_alloc(sizeof(*task));
464 if(!task)
465 return;
466
467 IHTMLWindow2_AddRef(&window->base.IHTMLWindow2_iface);
468 task->window = window;
469
471 if(SUCCEEDED(hres))
472 window->readystate_pending = TRUE;
473 return;
474 }
475
477}
478
480{
481 nsIDOMNode *nsnode;
483 nsAString nsstr;
484 nsresult nsres;
486
487 if(!This->nsdoc) {
488 WARN("NULL nsdoc\n");
489 return E_UNEXPECTED;
490 }
491
492 nsres = nsIDOMHTMLDocument_QueryInterface(This->nsdoc, &IID_nsIDOMNode, (void**)&nsnode);
493 if(NS_FAILED(nsres)) {
494 ERR("Could not get nsIDOMNode failed: %08x\n", nsres);
495 return E_FAIL;
496 }
497
498 nsAString_Init(&nsstr, NULL);
499 hres = nsnode_to_nsstring(nsnode, &nsstr);
500 nsIDOMNode_Release(nsnode);
501 if(FAILED(hres)) {
502 nsAString_Finish(&nsstr);
503 return hres;
504 }
505
506 nsAString_GetData(&nsstr, &strw);
507 TRACE("%s\n", debugstr_w(strw));
508
510
511 nsAString_Finish(&nsstr);
512
513 if(!*str)
514 return E_OUTOFMEMORY;
515 return S_OK;
516}
517
518
519/**********************************************************
520 * IPersistMoniker implementation
521 */
522
524{
525 return CONTAINING_RECORD(iface, HTMLDocument, IPersistMoniker_iface);
526}
527
529{
532}
533
535{
537 return htmldoc_addref(This);
538}
539
541{
543 return htmldoc_release(This);
544}
545
547{
549 return IPersistFile_GetClassID(&This->IPersistFile_iface, pClassID);
550}
551
553{
555
556 TRACE("(%p)\n", This);
557
558 return IPersistStreamInit_IsDirty(&This->IPersistStreamInit_iface);
559}
560
562 IMoniker *pimkName, LPBC pibc, DWORD grfMode)
563{
566
567 TRACE("(%p)->(%x %p %p %08x)\n", This, fFullyAvailable, pimkName, pibc, grfMode);
568
569 if(pibc) {
570 IUnknown *unk = NULL;
571
572 /* FIXME:
573 * Use params:
574 * "__PrecreatedObject"
575 * "BIND_CONTEXT_PARAM"
576 * "__HTMLLOADOPTIONS"
577 * "__DWNBINDINFO"
578 * "URL Context"
579 * "_ITransData_Object_"
580 * "_EnumFORMATETC_"
581 */
582
583 hres = IBindCtx_GetObjectParam(pibc, (LPOLESTR)SZ_HTML_CLIENTSITE_OBJECTPARAM, &unk);
584 if(SUCCEEDED(hres) && unk) {
586
587 hres = IUnknown_QueryInterface(unk, &IID_IOleClientSite, (void**)&client);
588 if(SUCCEEDED(hres)) {
589 TRACE("Got client site %p\n", client);
590 IOleObject_SetClientSite(&This->IOleObject_iface, client);
591 IOleClientSite_Release(client);
592 }
593
594 IUnknown_Release(unk);
595 }
596 }
597
598 prepare_for_binding(This, pimkName, FALSE);
599 call_docview_84(This->doc_obj);
600 hres = set_moniker(This->window, pimkName, NULL, pibc, NULL, TRUE);
601 if(FAILED(hres))
602 return hres;
603
604 return start_binding(This->window->pending_window, (BSCallback*)This->window->pending_window->bscallback, pibc);
605}
606
608 LPBC pbc, BOOL fRemember)
609{
611 FIXME("(%p)->(%p %p %x)\n", This, pimkName, pbc, fRemember);
612 return E_NOTIMPL;
613}
614
616{
618 FIXME("(%p)->(%p %p)\n", This, pimkName, pibc);
619 return E_NOTIMPL;
620}
621
623{
625
626 TRACE("(%p)->(%p)\n", This, ppimkName);
627
628 if(!This->window || !This->window->mon)
629 return E_UNEXPECTED;
630
631 IMoniker_AddRef(This->window->mon);
632 *ppimkName = This->window->mon;
633 return S_OK;
634}
635
636static const IPersistMonikerVtbl PersistMonikerVtbl = {
646};
647
648/**********************************************************
649 * IMonikerProp implementation
650 */
651
653{
654 return CONTAINING_RECORD(iface, HTMLDocument, IMonikerProp_iface);
655}
656
658{
661}
662
664{
666 return htmldoc_addref(This);
667}
668
670{
672 return htmldoc_release(This);
673}
674
675static HRESULT WINAPI MonikerProp_PutProperty(IMonikerProp *iface, MONIKERPROPERTY mkp, LPCWSTR val)
676{
678
679 TRACE("(%p)->(%d %s)\n", This, mkp, debugstr_w(val));
680
681 switch(mkp) {
682 case MIMETYPEPROP:
683 heap_free(This->doc_obj->mime);
684 This->doc_obj->mime = heap_strdupW(val);
685 break;
686
687 case CLASSIDPROP:
688 break;
689
690 default:
691 FIXME("mkp %d\n", mkp);
692 return E_NOTIMPL;
693 }
694
695 return S_OK;
696}
697
698static const IMonikerPropVtbl MonikerPropVtbl = {
703};
704
705/**********************************************************
706 * IPersistFile implementation
707 */
708
710{
711 return CONTAINING_RECORD(iface, HTMLDocument, IPersistFile_iface);
712}
713
715{
718}
719
721{
723 return htmldoc_addref(This);
724}
725
727{
729 return htmldoc_release(This);
730}
731
733{
735
736 TRACE("(%p)->(%p)\n", This, pClassID);
737
738 if(!pClassID)
739 return E_INVALIDARG;
740
741 *pClassID = CLSID_HTMLDocument;
742 return S_OK;
743}
744
746{
748
749 TRACE("(%p)\n", This);
750
751 return IPersistStreamInit_IsDirty(&This->IPersistStreamInit_iface);
752}
753
755{
757 FIXME("(%p)->(%s %08x)\n", This, debugstr_w(pszFileName), dwMode);
758 return E_NOTIMPL;
759}
760
761static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileName, BOOL fRemember)
762{
764 char *str;
765 DWORD written=0;
766 HANDLE file;
768
769 TRACE("(%p)->(%s %x)\n", This, debugstr_w(pszFileName), fRemember);
770
774 WARN("Could not create file: %u\n", GetLastError());
775 return E_FAIL;
776 }
777
778 hres = get_doc_string(This->doc_node, &str);
779 if(SUCCEEDED(hres))
780 WriteFile(file, str, strlen(str), &written, NULL);
781
783 return hres;
784}
785
787{
789 FIXME("(%p)->(%s)\n", This, debugstr_w(pszFileName));
790 return E_NOTIMPL;
791}
792
794{
796 FIXME("(%p)->(%p)\n", This, pszFileName);
797 return E_NOTIMPL;
798}
799
800static const IPersistFileVtbl PersistFileVtbl = {
810};
811
813{
814 return CONTAINING_RECORD(iface, HTMLDocument, IPersistStreamInit_iface);
815}
816
818 REFIID riid, void **ppv)
819{
822}
823
825{
827 return htmldoc_addref(This);
828}
829
831{
833 return htmldoc_release(This);
834}
835
837{
839 return IPersistFile_GetClassID(&This->IPersistFile_iface, pClassID);
840}
841
843{
845
846 TRACE("(%p)\n", This);
847
848 if(This->doc_obj->usermode == EDITMODE)
849 return editor_is_dirty(This);
850
851 return S_FALSE;
852}
853
855{
857 IMoniker *mon;
859
860 TRACE("(%p)->(%p)\n", This, pStm);
861
863 if(FAILED(hres)) {
864 WARN("CreateURLMoniker failed: %08x\n", hres);
865 return hres;
866 }
867
869 hres = set_moniker(This->window, mon, NULL, NULL, NULL, TRUE);
870 if(FAILED(hres))
871 return hres;
872
873 hres = channelbsc_load_stream(This->window->pending_window, mon, pStm);
874 IMoniker_Release(mon);
875 return hres;
876}
877
879 BOOL fClearDirty)
880{
882 char *str;
883 DWORD written=0;
885
886 TRACE("(%p)->(%p %x)\n", This, pStm, fClearDirty);
887
888 hres = get_doc_string(This->doc_node, &str);
889 if(FAILED(hres))
890 return hres;
891
892 hres = IStream_Write(pStm, str, strlen(str), &written);
893 if(FAILED(hres))
894 FIXME("Write failed: %08x\n", hres);
895
896 heap_free(str);
897
898 if(fClearDirty)
899 set_dirty(This, VARIANT_FALSE);
900
901 return S_OK;
902}
903
905 ULARGE_INTEGER *pcbSize)
906{
908 FIXME("(%p)->(%p)\n", This, pcbSize);
909 return E_NOTIMPL;
910}
911
913{
915 IMoniker *mon;
917
918 TRACE("(%p)\n", This);
919
921 if(FAILED(hres)) {
922 WARN("CreateURLMoniker failed: %08x\n", hres);
923 return hres;
924 }
925
927 hres = set_moniker(This->window, mon, NULL, NULL, NULL, FALSE);
928 if(FAILED(hres))
929 return hres;
930
931 hres = channelbsc_load_stream(This->window->pending_window, mon, NULL);
932 IMoniker_Release(mon);
933 return hres;
934}
935
936static const IPersistStreamInitVtbl PersistStreamInitVtbl = {
946};
947
948/**********************************************************
949 * IPersistHistory implementation
950 */
951
953{
954 return CONTAINING_RECORD(iface, HTMLDocument, IPersistHistory_iface);
955}
956
958{
961}
962
964{
966 return htmldoc_addref(This);
967}
968
970{
972 return htmldoc_release(This);
973}
974
976{
978 return IPersistFile_GetClassID(&This->IPersistFile_iface, pClassID);
979}
980
982{
985 WCHAR *uri_str;
986 IUri *uri;
988
989 TRACE("(%p)->(%p %p)\n", This, pStream, pbc);
990
991 if(!This->window) {
992 FIXME("No current window\n");
993 return E_UNEXPECTED;
994 }
995
996 if(pbc)
997 FIXME("pbc not supported\n");
998
999 if(This->doc_obj->client) {
1000 IOleCommandTarget *cmdtrg = NULL;
1001
1002 hres = IOleClientSite_QueryInterface(This->doc_obj->client, &IID_IOleCommandTarget,
1003 (void**)&cmdtrg);
1004 if(SUCCEEDED(hres)) {
1005 IOleCommandTarget_Exec(cmdtrg, &CGID_ShellDocView, 138, 0, NULL, NULL);
1006 IOleCommandTarget_Release(cmdtrg);
1007 }
1008 }
1009
1010 hres = IStream_Read(pStream, &str_len, sizeof(str_len), &read);
1011 if(FAILED(hres))
1012 return hres;
1013 if(read != sizeof(str_len))
1014 return E_FAIL;
1015
1016 uri_str = heap_alloc((str_len+1)*sizeof(WCHAR));
1017 if(!uri_str)
1018 return E_OUTOFMEMORY;
1019
1020 hres = IStream_Read(pStream, uri_str, str_len*sizeof(WCHAR), &read);
1021 if(SUCCEEDED(hres) && read != str_len*sizeof(WCHAR))
1022 hres = E_FAIL;
1023 if(SUCCEEDED(hres)) {
1024 uri_str[str_len] = 0;
1025 hres = create_uri(uri_str, 0, &uri);
1026 }
1027 heap_free(uri_str);
1028 if(FAILED(hres))
1029 return hres;
1030
1031 hres = load_uri(This->window, uri, BINDING_FROMHIST);
1032 IUri_Release(uri);
1033 return hres;
1034}
1035
1037{
1039 ULONG len, written;
1040 BSTR display_uri;
1041 HRESULT hres;
1042
1043 TRACE("(%p)->(%p)\n", This, pStream);
1044
1045 if(!This->window || !This->window->uri) {
1046 FIXME("No current URI\n");
1047 return E_FAIL;
1048 }
1049
1050 /* NOTE: The format we store is *not* compatible with native MSHTML. We currently
1051 * store only URI of the page (as a length followed by a string) */
1052 hres = IUri_GetDisplayUri(This->window->uri, &display_uri);
1053 if(FAILED(hres))
1054 return hres;
1055
1056 len = SysStringLen(display_uri);
1057 hres = IStream_Write(pStream, &len, sizeof(len), &written);
1058 if(SUCCEEDED(hres))
1059 hres = IStream_Write(pStream, display_uri, len*sizeof(WCHAR), &written);
1060 SysFreeString(display_uri);
1061 return hres;
1062}
1063
1065{
1067 FIXME("(%p)->(%x)\n", This, dwPositioncookie);
1068 return E_NOTIMPL;
1069}
1070
1072{
1074 FIXME("(%p)->(%p)\n", This, pdwPositioncookie);
1075 return E_NOTIMPL;
1076}
1077
1078static const IPersistHistoryVtbl PersistHistoryVtbl = {
1087};
1088
1090{
1091 This->IPersistMoniker_iface.lpVtbl = &PersistMonikerVtbl;
1092 This->IPersistFile_iface.lpVtbl = &PersistFileVtbl;
1093 This->IMonikerProp_iface.lpVtbl = &MonikerPropVtbl;
1094 This->IPersistStreamInit_iface.lpVtbl = &PersistStreamInitVtbl;
1095 This->IPersistHistory_iface.lpVtbl = &PersistHistoryVtbl;
1096}
#define UPDATE_TITLE
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
#define read
Definition: acwin.h:96
static char * heap_strdupWtoA(const WCHAR *str)
static int state
Definition: maze.c:121
static void * heap_alloc(size_t len)
Definition: appwiz.h:66
static BOOL heap_free(void *mem)
Definition: appwiz.h:76
#define BINDING_NAVIGATED
Definition: binding.h:127
IUri * get_uri_nofrag(IUri *) DECLSPEC_HIDDEN
Definition: nsio.c:77
#define BINDING_FROMHIST
Definition: binding.h:129
HRESULT channelbsc_load_stream(HTMLInnerWindow *, IMoniker *, IStream *) DECLSPEC_HIDDEN
Definition: navigate.c:1811
#define BINDING_REPLACE
Definition: binding.h:128
HRESULT load_nsuri(HTMLOuterWindow *, nsWineURI *, nsIInputStream *, nsChannelBSC *, DWORD) DECLSPEC_HIDDEN
Definition: nsio.c:250
HRESULT load_uri(HTMLOuterWindow *, IUri *, DWORD) DECLSPEC_HIDDEN
Definition: navigate.c:2306
#define BINDING_REFRESH
Definition: binding.h:130
HRESULT create_channelbsc(IMoniker *, const WCHAR *, BYTE *, DWORD, BOOL, nsChannelBSC **) DECLSPEC_HIDDEN
Definition: navigate.c:1693
HRESULT create_doc_uri(HTMLOuterWindow *, IUri *, nsWineURI **) DECLSPEC_HIDDEN
Definition: nsio.c:3210
#define FIXME(fmt,...)
Definition: debug.h:111
#define WARN(fmt,...)
Definition: debug.h:112
#define ERR(fmt,...)
Definition: debug.h:110
cd_progress_ptr progress
Definition: cdjpeg.h:152
void call_property_onchanged(ConnectionPointContainer *container, DISPID dispid)
Definition: conpoint.c:342
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
#define E_INVALIDARG
Definition: ddrawi.h:101
#define E_NOTIMPL
Definition: ddrawi.h:99
#define E_FAIL
Definition: ddrawi.h:102
#define NULL
Definition: types.h:112
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
static void set_dirty(struct d3dx_parameter *param)
Definition: effect.c:1318
static WCHAR * heap_strdupW(const WCHAR *str)
Definition: propsheet.c:178
#define CloseHandle
Definition: compat.h:739
#define INVALID_HANDLE_VALUE
Definition: compat.h:731
OLECHAR * BSTR
Definition: compat.h:2293
#define CreateFileW
Definition: compat.h:741
#define FILE_ATTRIBUTE_NORMAL
Definition: compat.h:137
@ VT_UNKNOWN
Definition: compat.h:2308
@ VT_I4
Definition: compat.h:2298
@ VT_BOOL
Definition: compat.h:2306
@ VT_EMPTY
Definition: compat.h:2295
BOOL WINAPI WriteFile(IN HANDLE hFile, IN LPCVOID lpBuffer, IN DWORD nNumberOfBytesToWrite OPTIONAL, OUT LPDWORD lpNumberOfBytesWritten, IN LPOVERLAPPED lpOverlapped OPTIONAL)
Definition: rw.c:24
HRESULT editor_is_dirty(HTMLDocument *This)
Definition: editor.c:1209
void set_statustext(HTMLDocumentObj *doc, INT id, LPCWSTR arg)
Definition: main.c:111
#define IDS_STATUS_DOWNLOADINGFROM
Definition: resource.h:24
HRESULT WINAPI CreateUri(LPCWSTR pwzURI, DWORD dwFlags, DWORD_PTR dwReserved, IUri **ppURI)
Definition: uri.c:5700
HRESULT WINAPI CoInternetCombineUrlEx(IUri *pBaseUri, LPCWSTR pwzRelativeUrl, DWORD dwCombineFlags, IUri **ppCombinedUri, DWORD_PTR dwReserved)
Definition: uri.c:6762
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
GLbitfield flags
Definition: glext.h:7161
GLuint GLfloat * val
Definition: glext.h:7180
GLenum GLsizei len
Definition: glext.h:6722
void fire_event(HTMLDocumentNode *doc, eventid_t eid, BOOL set_event, nsIDOMNode *target, nsIDOMEvent *nsevent, IDispatch *script_this)
Definition: htmlevent.c:1195
@ EVENTID_READYSTATECHANGE
Definition: htmlevent.h:47
void set_script_mode(HTMLOuterWindow *, SCRIPTMODE) DECLSPEC_HIDDEN
Definition: script.c:1551
HRESULT create_pending_window(HTMLOuterWindow *outer_window, nsChannelBSC *channelbsc)
Definition: htmlwindow.c:3009
#define DISPID_AMBIENT_OFFLINEIFNOTCONNECTED
Definition: idispids.h:25
#define DISPID_AMBIENT_SILENT
Definition: idispids.h:26
#define DISPID_READYSTATE
Definition: idispids.h:22
static WebBrowser * impl_from_IPersistStreamInit(IPersistStreamInit *iface)
Definition: persist.c:200
static HRESULT WINAPI PersistStreamInit_GetSizeMax(IPersistStreamInit *iface, ULARGE_INTEGER *pcbSize)
Definition: persist.c:251
static HRESULT WINAPI PersistStreamInit_InitNew(IPersistStreamInit *iface)
Definition: persist.c:259
static ULONG WINAPI PersistStreamInit_AddRef(IPersistStreamInit *iface)
Definition: persist.c:212
static const IPersistStreamInitVtbl PersistStreamInitVtbl
Definition: persist.c:266
static HRESULT WINAPI PersistStreamInit_IsDirty(IPersistStreamInit *iface)
Definition: persist.c:230
static ULONG WINAPI PersistStreamInit_Release(IPersistStreamInit *iface)
Definition: persist.c:218
static HRESULT WINAPI PersistStreamInit_GetClassID(IPersistStreamInit *iface, CLSID *pClassID)
Definition: persist.c:224
static HRESULT WINAPI PersistStreamInit_Load(IPersistStreamInit *iface, LPSTREAM pStg)
Definition: persist.c:236
static HRESULT WINAPI PersistStreamInit_Save(IPersistStreamInit *iface, LPSTREAM pStg, BOOL fSameAsLoad)
Definition: persist.c:243
static HRESULT WINAPI PersistStreamInit_QueryInterface(IPersistStreamInit *iface, REFIID riid, LPVOID *ppobj)
Definition: persist.c:205
VOID WINAPI CoTaskMemFree(LPVOID ptr)
Definition: ifs.c:442
REFIID riid
Definition: atlbase.h:39
REFIID LPVOID * ppv
Definition: atlbase.h:39
#define S_OK
Definition: intsafe.h:52
#define SUCCEEDED(hr)
Definition: intsafe.h:50
#define FAILED(hr)
Definition: intsafe.h:51
#define debugstr_w
Definition: kernel32.h:32
#define CREATE_ALWAYS
Definition: disk.h:72
static const WCHAR url[]
Definition: encode.c:1432
const char * var
Definition: shader.c:5666
static const char * debugstr_variant(const VARIANT *var)
Definition: container.c:46
HRESULT hres
Definition: protocol.c:465
static const char * strw(LPCWSTR x)
Definition: actctx.c:49
static IHTMLWindow2 * window
Definition: events.c:77
static LPOLESTR
Definition: stg_prop.c:27
DWORD zone
Definition: sec_mgr.c:1754
const char * uri
Definition: sec_mgr.c:1588
static const WCHAR SZ_HTML_CLIENTSITE_OBJECTPARAM[]
Definition: mshtmhst.idl:59
void set_current_mon(HTMLOuterWindow *This, IMoniker *mon, DWORD flags)
Definition: persist.c:99
static const WCHAR about_blankW[]
Definition: persist.c:24
static HRESULT WINAPI PersistFile_Load(IPersistFile *iface, LPCOLESTR pszFileName, DWORD dwMode)
Definition: persist.c:754
static HRESULT WINAPI PersistMoniker_GetClassID(IPersistMoniker *iface, CLSID *pClassID)
Definition: persist.c:546
static ULONG WINAPI PersistFile_Release(IPersistFile *iface)
Definition: persist.c:726
static HRESULT WINAPI PersistFile_QueryInterface(IPersistFile *iface, REFIID riid, void **ppv)
Definition: persist.c:714
static const IPersistFileVtbl PersistFileVtbl
Definition: persist.c:800
static HTMLDocument * impl_from_IMonikerProp(IMonikerProp *iface)
Definition: persist.c:652
static HRESULT WINAPI PersistHistory_QueryInterface(IPersistHistory *iface, REFIID riid, void **ppv)
Definition: persist.c:957
static HRESULT WINAPI PersistMoniker_Save(IPersistMoniker *iface, IMoniker *pimkName, LPBC pbc, BOOL fRemember)
Definition: persist.c:607
HRESULT set_moniker(HTMLOuterWindow *window, IMoniker *mon, IUri *nav_uri, IBindCtx *pibc, nsChannelBSC *async_bsc, BOOL set_download)
Definition: persist.c:329
static void notif_readystate_destr(task_t *_task)
Definition: persist.c:444
static void set_progress_proc(task_t *_task)
Definition: persist.c:192
static HTMLDocument * impl_from_IPersistHistory(IPersistHistory *iface)
Definition: persist.c:952
static HRESULT WINAPI MonikerProp_PutProperty(IMonikerProp *iface, MONIKERPROPERTY mkp, LPCWSTR val)
Definition: persist.c:675
static HRESULT WINAPI PersistFile_SaveCompleted(IPersistFile *iface, LPCOLESTR pszFileName)
Definition: persist.c:786
static ULONG WINAPI MonikerProp_AddRef(IMonikerProp *iface)
Definition: persist.c:663
static ULONG WINAPI PersistMoniker_Release(IPersistMoniker *iface)
Definition: persist.c:540
static HRESULT WINAPI PersistMoniker_IsDirty(IPersistMoniker *iface)
Definition: persist.c:552
static const IPersistMonikerVtbl PersistMonikerVtbl
Definition: persist.c:636
void set_download_state(HTMLDocumentObj *doc, int state)
Definition: persist.c:170
static HRESULT WINAPI PersistHistory_SetPositionCookie(IPersistHistory *iface, DWORD dwPositioncookie)
Definition: persist.c:1064
#define CMDID_EXPLORER_UPDATEHISTORY
Definition: persist.c:22
static ULONG WINAPI PersistFile_AddRef(IPersistFile *iface)
Definition: persist.c:720
HRESULT create_uri(const WCHAR *uri_str, DWORD flags, IUri **uri)
Definition: persist.c:158
static void set_downloading_proc(task_t *_task)
Definition: persist.c:233
static void set_downloading_task_destr(task_t *_task)
Definition: persist.c:263
static const IMonikerPropVtbl MonikerPropVtbl
Definition: persist.c:698
static HRESULT WINAPI PersistFile_IsDirty(IPersistFile *iface)
Definition: persist.c:745
HRESULT create_relative_uri(HTMLOuterWindow *window, const WCHAR *rel_uri, IUri **uri)
Definition: persist.c:163
void HTMLDocument_Persist_Init(HTMLDocument *This)
Definition: persist.c:1089
static HRESULT WINAPI MonikerProp_QueryInterface(IMonikerProp *iface, REFIID riid, void **ppv)
Definition: persist.c:657
static HRESULT WINAPI PersistFile_Save(IPersistFile *iface, LPCOLESTR pszFileName, BOOL fRemember)
Definition: persist.c:761
static const IPersistHistoryVtbl PersistHistoryVtbl
Definition: persist.c:1078
static HRESULT get_doc_string(HTMLDocumentNode *This, char **str)
Definition: persist.c:479
static HRESULT WINAPI PersistMoniker_Load(IPersistMoniker *iface, BOOL fFullyAvailable, IMoniker *pimkName, LPBC pibc, DWORD grfMode)
Definition: persist.c:561
static HRESULT WINAPI PersistHistory_LoadHistory(IPersistHistory *iface, IStream *pStream, IBindCtx *pbc)
Definition: persist.c:981
static HRESULT WINAPI PersistMoniker_SaveCompleted(IPersistMoniker *iface, IMoniker *pimkName, LPBC pibc)
Definition: persist.c:615
static HRESULT WINAPI PersistMoniker_GetCurMoniker(IPersistMoniker *iface, IMoniker **ppimkName)
Definition: persist.c:622
void set_ready_state(HTMLOuterWindow *window, READYSTATE readystate)
Definition: persist.c:450
static HTMLDocument * impl_from_IPersistMoniker(IPersistMoniker *iface)
Definition: persist.c:523
static ULONG WINAPI PersistMoniker_AddRef(IPersistMoniker *iface)
Definition: persist.c:534
static HRESULT WINAPI PersistHistory_SaveHistory(IPersistHistory *iface, IStream *pStream)
Definition: persist.c:1036
static HRESULT WINAPI PersistFile_GetCurFile(IPersistFile *iface, LPOLESTR *pszFileName)
Definition: persist.c:793
static HRESULT WINAPI PersistHistory_GetClassID(IPersistHistory *iface, CLSID *pClassID)
Definition: persist.c:975
static ULONG WINAPI PersistHistory_Release(IPersistHistory *iface)
Definition: persist.c:969
static HRESULT WINAPI PersistFile_GetClassID(IPersistFile *iface, CLSID *pClassID)
Definition: persist.c:732
static ULONG WINAPI MonikerProp_Release(IMonikerProp *iface)
Definition: persist.c:669
void set_current_uri(HTMLOuterWindow *window, IUri *uri)
Definition: persist.c:68
static HTMLDocument * impl_from_IPersistFile(IPersistFile *iface)
Definition: persist.c:709
static BOOL use_gecko_script(HTMLOuterWindow *window)
Definition: persist.c:33
static HRESULT WINAPI PersistHistory_GetPositionCookie(IPersistHistory *iface, DWORD *pdwPositioncookie)
Definition: persist.c:1071
static void notif_readystate(HTMLOuterWindow *window)
Definition: persist.c:418
static ULONG WINAPI PersistHistory_AddRef(IPersistHistory *iface)
Definition: persist.c:963
static void notif_readystate_proc(task_t *_task)
Definition: persist.c:438
static HRESULT WINAPI PersistMoniker_QueryInterface(IPersistMoniker *iface, REFIID riid, void **ppv)
Definition: persist.c:528
static void notify_travellog_update(HTMLDocumentObj *doc)
Definition: persist.c:48
void prepare_for_binding(HTMLDocument *This, IMoniker *mon, DWORD flags)
Definition: persist.c:271
HRESULT nsnode_to_nsstring(nsIDOMNode *, nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:1000
void nsAString_Finish(nsAString *) DECLSPEC_HIDDEN
Definition: nsembed.c:836
UINT32 nsAString_GetData(const nsAString *, const PRUnichar **) DECLSPEC_HIDDEN
Definition: nsembed.c:831
void abort_window_bindings(HTMLInnerWindow *) DECLSPEC_HIDDEN
Definition: navigate.c:1775
static HRESULT htmldoc_query_interface(HTMLDocument *This, REFIID riid, void **ppv)
BOOL nsAString_Init(nsAString *, const PRUnichar *) DECLSPEC_HIDDEN
Definition: nsembed.c:817
HRESULT start_binding(HTMLInnerWindow *, BSCallback *, IBindCtx *) DECLSPEC_HIDDEN
Definition: navigate.c:762
void call_docview_84(HTMLDocumentObj *) DECLSPEC_HIDDEN
Definition: oleobj.c:173
void HTMLDocument_LockContainer(HTMLDocumentObj *, BOOL) DECLSPEC_HIDDEN
Definition: oleobj.c:1183
static ULONG htmldoc_addref(HTMLDocument *This)
@ SCRIPTMODE_ACTIVESCRIPT
@ SCRIPTMODE_GECKO
@ EDITMODE
#define UPDATE_UI
static ULONG htmldoc_release(HTMLDocument *This)
#define NS_FAILED(res)
HRESULT push_task(task_t *, task_proc_t, task_proc_t, LONG) DECLSPEC_HIDDEN
Definition: task.c:39
void update_doc(HTMLDocument *, DWORD) DECLSPEC_HIDDEN
Definition: view.c:62
void remove_target_tasks(LONG) DECLSPEC_HIDDEN
Definition: task.c:107
#define GENERIC_WRITE
Definition: nt_native.h:90
interface IBindCtx * LPBC
Definition: objfwd.h:18
interface IStream * LPSTREAM
Definition: objfwd.h:10
BSTR WINAPI SysAllocString(LPCOLESTR str)
Definition: oleaut.c:238
UINT WINAPI SysStringLen(BSTR str)
Definition: oleaut.c:196
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
#define V_BOOL(A)
Definition: oleauto.h:224
#define V_UNKNOWN(A)
Definition: oleauto.h:281
#define V_VT(A)
Definition: oleauto.h:211
#define V_I4(A)
Definition: oleauto.h:247
const GUID IID_IOleClientSite
static HRESULT get_client_disp_property(IOleClientSite *client, DISPID dispid, VARIANT *res)
Definition: oleobject.c:233
#define REFIID
Definition: guiddef.h:118
static FILE * out
Definition: regtests2xml.c:44
const WCHAR * str
#define memset(x, y, z)
Definition: compat.h:39
static FILE * client
Definition: client.c:41
#define URL_DONT_ESCAPE_EXTRA_INFO
Definition: shlwapi.h:1217
#define URL_ESCAPE_SPACES_ONLY
Definition: shlwapi.h:1216
#define TRACE(s)
Definition: solgame.cpp:4
IBindStatusCallback IBindStatusCallback_iface
Definition: binding.h:72
IOleClientSite * client
IUnknown * webbrowser
IOleInPlaceFrame * frame
HTMLDocument basedoc
IAdviseSink * view_sink
IDocHostUIHandler * hostui
IHTMLWindow2 IHTMLWindow2_iface
HTMLDocumentObj * doc
HTMLDocumentObj * doc
Definition: persist.c:28
Definition: fci.c:127
BSCallback bsc
Definition: binding.h:98
Definition: nsio.c:34
HTMLOuterWindow * window
Definition: persist.c:435
#define str_len
Definition: treelist.c:89
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
uint32_t ULONG
Definition: typedefs.h:59
HRESULT WINAPI CreateURLMoniker(IMoniker *pmkContext, LPCWSTR szURL, IMoniker **ppmk)
Definition: umon.c:732
HRESULT WINAPI DECLSPEC_HOTPATCH VariantClear(VARIANTARG *pVarg)
Definition: variant.c:648
WORD WORD PSZ PSZ pszFileName
Definition: vdmdbg.h:44
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define WINAPI
Definition: msvc.h:6
#define S_FALSE
Definition: winerror.h:2357
#define E_UNEXPECTED
Definition: winerror.h:2456
__wchar_t WCHAR
Definition: xmlstorage.h:180
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185