From: Jacek Caban jacek@codeweavers.com
--- dlls/mshtml/mshtml_private.h | 3 ++- dlls/mshtml/omnavigator.c | 18 ++++++++++-------- dlls/mshtml/tests/documentmode.js | 15 +++++++++++++++ dlls/mshtml/tests/es5.js | 2 ++ 4 files changed, 29 insertions(+), 9 deletions(-)
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index ca8629b64ef..daf7f825aa1 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -407,7 +407,8 @@ typedef struct { } dispex_static_data_vtbl_t;
#define ALL_PROTOTYPES \ - X(DOMImplementation) + X(DOMImplementation) \ + X(Navigator)
typedef enum { PROT_NONE, diff --git a/dlls/mshtml/omnavigator.c b/dlls/mshtml/omnavigator.c index 93a48309e2e..873c55dcd40 100644 --- a/dlls/mshtml/omnavigator.c +++ b/dlls/mshtml/omnavigator.c @@ -28,6 +28,7 @@ #include "wine/debug.h"
#include "mshtml_private.h" +#include "mshtmdid.h"
WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
@@ -1141,21 +1142,22 @@ static void OmNavigator_destructor(DispatchEx *dispex) free(This); }
-static const dispex_static_data_vtbl_t OmNavigator_dispex_vtbl = { +static const dispex_static_data_vtbl_t Navigator_dispex_vtbl = { .query_interface = OmNavigator_query_interface, .destructor = OmNavigator_destructor, .unlink = OmNavigator_unlink };
-static const tid_t OmNavigator_iface_tids[] = { +static const tid_t Navigator_iface_tids[] = { IOmNavigator_tid, 0 }; -static dispex_static_data_t OmNavigator_dispex = { - "Navigator", - &OmNavigator_dispex_vtbl, - DispHTMLNavigator_tid, - OmNavigator_iface_tids +dispex_static_data_t Navigator_dispex = { + .name = "Navigator", + .id = PROT_Navigator, + .vtbl = &Navigator_dispex_vtbl, + .disp_tid = DispHTMLNavigator_tid, + .iface_tids = Navigator_iface_tids, };
HRESULT create_navigator(HTMLInnerWindow *script_global, IOmNavigator **navigator) @@ -1168,7 +1170,7 @@ HRESULT create_navigator(HTMLInnerWindow *script_global, IOmNavigator **navigato
ret->IOmNavigator_iface.lpVtbl = &OmNavigatorVtbl;
- init_dispatch(&ret->dispex, &OmNavigator_dispex, script_global, + init_dispatch(&ret->dispex, &Navigator_dispex, script_global, dispex_compat_mode(&script_global->event_target.dispex));
*navigator = &ret->IOmNavigator_iface; diff --git a/dlls/mshtml/tests/documentmode.js b/dlls/mshtml/tests/documentmode.js index c2f0a7ecb82..5d9cf4a19ed 100644 --- a/dlls/mshtml/tests/documentmode.js +++ b/dlls/mshtml/tests/documentmode.js @@ -3108,3 +3108,18 @@ sync_test("form", function() { form.innerHTML = ""; ok(form[0] === "test", "form[0] = " + form[0]); }); + +sync_test("prototypes", function() { + var v = document.documentMode; + if(v < 9) + return; + + function check(obj, proto, name) { + ok(Object.getPrototypeOf(obj) === proto, "unexpected " + name + " prototype object"); + } + + check(document.implementation, DOMImplementation.prototype, "implementation"); + check(DOMImplementation.prototype, Object.prototype, "implementation prototype"); + check(window.navigator, Navigator.prototype, "navigator"); + check(Navigator.prototype, Object.prototype, "navigator prototype"); +}); diff --git a/dlls/mshtml/tests/es5.js b/dlls/mshtml/tests/es5.js index 78b50a40ec6..f2d81be9c7d 100644 --- a/dlls/mshtml/tests/es5.js +++ b/dlls/mshtml/tests/es5.js @@ -2754,4 +2754,6 @@ sync_test("prototypes", function() { DOMImplementation = constr;
ok(document.implementation instanceof DOMImplementation, "document.implementation is not an instance of DOMImplementation"); + ok(navigator instanceof Navigator, "navigator is not an instance of Navigator"); + ok(!(navigator instanceof DOMImplementation), "navigator is an instance of DOMImplementation"); });