[JSCRIPT] Sync with Wine Staging 3.3. CORE-14434

This commit is contained in:
Amine Khaldi 2018-03-17 13:11:29 +01:00
parent 919215fd3b
commit 8dba275bd6
38 changed files with 859 additions and 453 deletions

View file

@ -16,37 +16,38 @@
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef _WINE_JSCRIPT_H
#define _WINE_JSCRIPT_H
#pragma once
#include <wine/config.h>
#include <wine/port.h>
#include <assert.h>
#include <stdarg.h>
#define WIN32_NO_STATUS
#define _INC_WINDOWS
#define COM_NO_WINDOWS_H
#include <stdio.h>
#define COBJMACROS
#include <windef.h>
#include <winbase.h>
#include <objbase.h>
#include <oleauto.h>
#include <dispex.h>
#include <activscp.h>
#include <objsafe.h>
#include <wine/debug.h>
#include <wine/list.h>
#include <wine/unicode.h>
WINE_DEFAULT_DEBUG_CHANNEL(jscript);
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
#include "ole2.h"
#include "dispex.h"
#include "activscp.h"
#include "resource.h"
#include "wine/unicode.h"
#include "wine/heap.h"
#include "wine/list.h"
/*
* This is Wine jscript extension for ES5 compatible mode. Native IE9+ implements
* a separated JavaScript enging in side MSHTML. We implement its features here
* and enable it when HTML flag is specified in SCRIPTPROP_INVOKEVERSIONING property.
*/
#define SCRIPTLANGUAGEVERSION_HTML 0x400
/*
* This is Wine jscript extension for ES5 compatible mode. Allowed only in HTML mode.
*/
#define SCRIPTLANGUAGEVERSION_ES5 0x102
typedef struct _jsval_t jsval_t;
typedef struct _jsstr_t jsstr_t;
typedef struct _script_ctx_t script_ctx_t;
@ -68,26 +69,6 @@ void heap_pool_clear(heap_pool_t*) DECLSPEC_HIDDEN;
void heap_pool_free(heap_pool_t*) DECLSPEC_HIDDEN;
heap_pool_t *heap_pool_mark(heap_pool_t*) DECLSPEC_HIDDEN;
static inline void* __WINE_ALLOC_SIZE(1) heap_alloc(size_t size)
{
return HeapAlloc(GetProcessHeap(), 0, size);
}
static inline void* __WINE_ALLOC_SIZE(1) heap_alloc_zero(size_t size)
{
return HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, size);
}
static inline void* __WINE_ALLOC_SIZE(2) heap_realloc(void *mem, size_t size)
{
return HeapReAlloc(GetProcessHeap(), 0, mem, size);
}
static inline BOOL heap_free(void *mem)
{
return HeapFree(GetProcessHeap(), 0, mem);
}
static inline LPWSTR heap_strdupW(LPCWSTR str)
{
LPWSTR ret = NULL;
@ -115,6 +96,11 @@ extern HINSTANCE jscript_hinstance DECLSPEC_HIDDEN;
#define PROPF_CONST 0x0800
#define PROPF_DONTDELETE 0x1000
#define PROPF_VERSION_MASK 0x01ff0000
#define PROPF_VERSION_SHIFT 16
#define PROPF_HTML (SCRIPTLANGUAGEVERSION_HTML << PROPF_VERSION_SHIFT)
#define PROPF_ES5 ((SCRIPTLANGUAGEVERSION_HTML|SCRIPTLANGUAGEVERSION_ES5) << PROPF_VERSION_SHIFT)
/*
* This is our internal dispatch flag informing calee that it's called directly from interpreter.
* If calee is executed as interpreted function, we may let already running interpreter to take
@ -357,6 +343,8 @@ HRESULT to_string(script_ctx_t*,jsval_t,jsstr_t**) DECLSPEC_HIDDEN;
HRESULT to_flat_string(script_ctx_t*,jsval_t,jsstr_t**,const WCHAR**) DECLSPEC_HIDDEN;
HRESULT to_object(script_ctx_t*,jsval_t,IDispatch**) DECLSPEC_HIDDEN;
HRESULT jsval_strict_equal(jsval_t,jsval_t,BOOL*) DECLSPEC_HIDDEN;
HRESULT variant_change_type(script_ctx_t*,VARIANT*,VARIANT*,VARTYPE) DECLSPEC_HIDDEN;
HRESULT decode_source(WCHAR*) DECLSPEC_HIDDEN;
@ -412,6 +400,7 @@ struct _script_ctx_t {
IInternetHostSecurityManager *secmgr;
DWORD safeopt;
DWORD version;
BOOL html_mode;
LCID lcid;
cc_ctx_t *cc;
JSCaller *jscaller;
@ -516,7 +505,7 @@ static inline BOOL is_int32(double d)
static inline DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
{
return (ctx->version << 28) | flags;
return ((ctx->version & 0xff) << 28) | flags;
}
#define FACILITY_JSCRIPT 10
@ -585,9 +574,3 @@ static inline void unlock_module(void)
{
InterlockedDecrement(&module_ref);
}
#include "engine.h"
#include "parser.h"
#include "regexp.h"
#endif /* _WINE_JSCRIPT_H */