ReactOS  0.4.14-dev-583-g2a1ba2c
object.c
Go to the documentation of this file.
1 /*
2  * Copyright 2008 Jacek Caban for CodeWeavers
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 <assert.h>
20 
21 #include "jscript.h"
22 
23 #include "wine/debug.h"
24 
26 
27 static const WCHAR toStringW[] = {'t','o','S','t','r','i','n','g',0};
28 static const WCHAR toLocaleStringW[] = {'t','o','L','o','c','a','l','e','S','t','r','i','n','g',0};
29 static const WCHAR valueOfW[] = {'v','a','l','u','e','O','f',0};
30 static const WCHAR hasOwnPropertyW[] = {'h','a','s','O','w','n','P','r','o','p','e','r','t','y',0};
31 static const WCHAR propertyIsEnumerableW[] =
32  {'p','r','o','p','e','r','t','y','I','s','E','n','u','m','e','r','a','b','l','e',0};
33 static const WCHAR isPrototypeOfW[] = {'i','s','P','r','o','t','o','t','y','p','e','O','f',0};
34 
35 static const WCHAR createW[] = {'c','r','e','a','t','e',0};
37  {'g','e','t','O','w','n','P','r','o','p','e','r','t','y','D','e','s','c','r','i','p','t','o','r',0};
38 static const WCHAR getPrototypeOfW[] =
39  {'g','e','t','P','r','o','t','o','t','y','p','e','O','f',0};
40 static const WCHAR definePropertyW[] = {'d','e','f','i','n','e','P','r','o','p','e','r','t','y',0};
41 
42 static const WCHAR definePropertiesW[] = {'d','e','f','i','n','e','P','r','o','p','e','r','t','i','e','s',0};
43 
44 static const WCHAR default_valueW[] = {'[','o','b','j','e','c','t',' ','O','b','j','e','c','t',']',0};
45 
46 static const WCHAR configurableW[] = {'c','o','n','f','i','g','u','r','a','b','l','e',0};
47 static const WCHAR enumerableW[] = {'e','n','u','m','e','r','a','b','l','e',0};
48 static const WCHAR valueW[] = {'v','a','l','u','e',0};
49 static const WCHAR writableW[] = {'w','r','i','t','a','b','l','e',0};
50 static const WCHAR getW[] = {'g','e','t',0};
51 static const WCHAR setW[] = {'s','e','t',0};
52 
54  jsval_t *r)
55 {
56  jsdisp_t *jsdisp;
57  const WCHAR *str;
58 
59  static const WCHAR formatW[] = {'[','o','b','j','e','c','t',' ','%','s',']',0};
60 
61  static const WCHAR arrayW[] = {'A','r','r','a','y',0};
62  static const WCHAR booleanW[] = {'B','o','o','l','e','a','n',0};
63  static const WCHAR dateW[] = {'D','a','t','e',0};
64  static const WCHAR errorW[] = {'E','r','r','o','r',0};
65  static const WCHAR functionW[] = {'F','u','n','c','t','i','o','n',0};
66  static const WCHAR mathW[] = {'M','a','t','h',0};
67  static const WCHAR numberW[] = {'N','u','m','b','e','r',0};
68  static const WCHAR objectW[] = {'O','b','j','e','c','t',0};
69  static const WCHAR regexpW[] = {'R','e','g','E','x','p',0};
70  static const WCHAR stringW[] = {'S','t','r','i','n','g',0};
71  /* Keep in sync with jsclass_t enum */
72  static const WCHAR *names[] = {NULL, arrayW, booleanW, dateW, objectW, errorW,
73  functionW, NULL, mathW, numberW, objectW, regexpW, stringW, objectW, objectW, objectW};
74 
75  TRACE("\n");
76 
77  jsdisp = get_jsdisp(jsthis);
78  if(!jsdisp) {
79  str = objectW;
80  }else if(names[jsdisp->builtin_info->class]) {
81  str = names[jsdisp->builtin_info->class];
82  }else {
84  FIXME("jdisp->builtin_info->class = %d\n", jsdisp->builtin_info->class);
85  return E_FAIL;
86  }
87 
88  if(r) {
89  jsstr_t *ret;
90  WCHAR *ptr;
91 
93  if(!ret)
94  return E_OUTOFMEMORY;
95 
96  swprintf(ptr, formatW, str);
97  *r = jsval_string(ret);
98  }
99 
100  return S_OK;
101 }
102 
104  jsval_t *r)
105 {
106  TRACE("\n");
107 
108  if(!is_jsdisp(jsthis)) {
109  FIXME("Host object this\n");
110  return E_FAIL;
111  }
112 
113  return jsdisp_call_name(jsthis->u.jsdisp, toStringW, DISPATCH_METHOD, 0, NULL, r);
114 }
115 
117  jsval_t *r)
118 {
119  TRACE("\n");
120 
121  if(r) {
122  IDispatch_AddRef(jsthis->u.disp);
123  *r = jsval_disp(jsthis->u.disp);
124  }
125  return S_OK;
126 }
127 
129  jsval_t *r)
130 {
131  jsstr_t *name;
132  DISPID id;
133  BSTR bstr;
134  HRESULT hres;
135 
136  TRACE("\n");
137 
138  if(!argc) {
139  if(r)
140  *r = jsval_bool(FALSE);
141  return S_OK;
142  }
143 
144  hres = to_string(ctx, argv[0], &name);
145  if(FAILED(hres))
146  return hres;
147 
148  if(is_jsdisp(jsthis)) {
149  property_desc_t prop_desc;
150  const WCHAR *name_str;
151 
152  name_str = jsstr_flatten(name);
153  if(!name_str) {
155  return E_OUTOFMEMORY;
156  }
157 
158  hres = jsdisp_get_own_property(jsthis->u.jsdisp, name_str, TRUE, &prop_desc);
161  return hres;
162 
163  if(r) *r = jsval_bool(hres == S_OK);
164  return S_OK;
165  }
166 
167 
169  if(bstr)
170  jsstr_flush(name, bstr);
172  if(!bstr)
173  return E_OUTOFMEMORY;
174 
175  if(is_dispex(jsthis))
176  hres = IDispatchEx_GetDispID(jsthis->u.dispex, bstr, make_grfdex(ctx, fdexNameCaseSensitive), &id);
177  else
178  hres = IDispatch_GetIDsOfNames(jsthis->u.disp, &IID_NULL, &bstr, 1, ctx->lcid, &id);
179 
180  SysFreeString(bstr);
181  if(r)
182  *r = jsval_bool(SUCCEEDED(hres));
183  return S_OK;
184 }
185 
187  jsval_t *r)
188 {
189  property_desc_t prop_desc;
190  const WCHAR *name;
191  jsstr_t *name_str;
192  HRESULT hres;
193 
194  TRACE("\n");
195 
196  if(argc != 1) {
197  FIXME("argc %d not supported\n", argc);
198  return E_NOTIMPL;
199  }
200 
201  if(!is_jsdisp(jsthis)) {
202  FIXME("Host object this\n");
203  return E_FAIL;
204  }
205 
206  hres = to_flat_string(ctx, argv[0], &name_str, &name);
207  if(FAILED(hres))
208  return hres;
209 
210  hres = jsdisp_get_own_property(jsthis->u.jsdisp, name, TRUE, &prop_desc);
211  jsstr_release(name_str);
213  return hres;
214 
215  if(r)
216  *r = jsval_bool(hres == S_OK && (prop_desc.flags & PROPF_ENUMERABLE) != 0);
217  return S_OK;
218 }
219 
221  jsval_t *r)
222 {
223  FIXME("\n");
224  return E_NOTIMPL;
225 }
226 
228 {
229  jsstr_t *ret;
230 
231  TRACE("\n");
232 
234  if(!ret)
235  return E_OUTOFMEMORY;
236 
237  *r = jsval_string(ret);
238  return S_OK;
239 }
240 
241 static void Object_destructor(jsdisp_t *dispex)
242 {
243  heap_free(dispex);
244 }
245 
246 static const builtin_prop_t Object_props[] = {
253 };
254 
255 static const builtin_info_t Object_info = {
257  {NULL, NULL,0, Object_get_value},
259  Object_props,
261  NULL
262 };
263 
266  {NULL, NULL,0, Object_get_value},
267  0, NULL,
269  NULL
270 };
271 
273 {
274  if(desc->explicit_value)
275  jsval_release(desc->value);
276  if(desc->getter)
277  jsdisp_release(desc->getter);
278  if(desc->setter)
279  jsdisp_release(desc->setter);
280 }
281 
283 {
284  DISPID id;
285  jsval_t v;
286  BOOL b;
287  HRESULT hres;
288 
289  memset(desc, 0, sizeof(*desc));
290  desc->value = jsval_undefined();
291 
292  hres = jsdisp_get_id(attr_obj, enumerableW, 0, &id);
293  if(SUCCEEDED(hres)) {
294  desc->mask |= PROPF_ENUMERABLE;
295  hres = jsdisp_propget(attr_obj, id, &v);
296  if(FAILED(hres))
297  return hres;
298  hres = to_boolean(v, &b);
299  jsval_release(v);
300  if(FAILED(hres))
301  return hres;
302  if(b)
303  desc->flags |= PROPF_ENUMERABLE;
304  }else if(hres != DISP_E_UNKNOWNNAME) {
305  return hres;
306  }
307 
308  hres = jsdisp_get_id(attr_obj, configurableW, 0, &id);
309  if(SUCCEEDED(hres)) {
310  desc->mask |= PROPF_CONFIGURABLE;
311  hres = jsdisp_propget(attr_obj, id, &v);
312  if(FAILED(hres))
313  return hres;
314  hres = to_boolean(v, &b);
315  jsval_release(v);
316  if(FAILED(hres))
317  return hres;
318  if(b)
319  desc->flags |= PROPF_CONFIGURABLE;
320  }else if(hres != DISP_E_UNKNOWNNAME) {
321  return hres;
322  }
323 
324  hres = jsdisp_get_id(attr_obj, valueW, 0, &id);
325  if(SUCCEEDED(hres)) {
326  hres = jsdisp_propget(attr_obj, id, &desc->value);
327  if(FAILED(hres))
328  return hres;
329  desc->explicit_value = TRUE;
330  }else if(hres != DISP_E_UNKNOWNNAME) {
331  return hres;
332  }
333 
334  hres = jsdisp_get_id(attr_obj, writableW, 0, &id);
335  if(SUCCEEDED(hres)) {
336  desc->mask |= PROPF_WRITABLE;
337  hres = jsdisp_propget(attr_obj, id, &v);
338  if(SUCCEEDED(hres)) {
339  hres = to_boolean(v, &b);
340  jsval_release(v);
341  if(SUCCEEDED(hres) && b)
342  desc->flags |= PROPF_WRITABLE;
343  }
344  }else if(hres == DISP_E_UNKNOWNNAME) {
345  hres = S_OK;
346  }
347  if(FAILED(hres)) {
349  return hres;
350  }
351 
352  hres = jsdisp_get_id(attr_obj, getW, 0, &id);
353  if(SUCCEEDED(hres)) {
354  desc->explicit_getter = TRUE;
355  hres = jsdisp_propget(attr_obj, id, &v);
356  if(SUCCEEDED(hres) && !is_undefined(v)) {
357  if(!is_object_instance(v)) {
358  FIXME("getter is not an object\n");
359  jsval_release(v);
360  hres = E_FAIL;
361  }else {
362  /* FIXME: Check IsCallable */
363  desc->getter = to_jsdisp(get_object(v));
364  if(!desc->getter)
365  FIXME("getter is not JS object\n");
366  }
367  }
368  }else if(hres == DISP_E_UNKNOWNNAME) {
369  hres = S_OK;
370  }
371  if(FAILED(hres)) {
373  return hres;
374  }
375 
376  hres = jsdisp_get_id(attr_obj, setW, 0, &id);
377  if(SUCCEEDED(hres)) {
378  desc->explicit_setter = TRUE;
379  hres = jsdisp_propget(attr_obj, id, &v);
380  if(SUCCEEDED(hres) && !is_undefined(v)) {
381  if(!is_object_instance(v)) {
382  FIXME("setter is not an object\n");
383  jsval_release(v);
384  hres = E_FAIL;
385  }else {
386  /* FIXME: Check IsCallable */
387  desc->setter = to_jsdisp(get_object(v));
388  if(!desc->setter)
389  FIXME("setter is not JS object\n");
390  }
391  }
392  }else if(hres == DISP_E_UNKNOWNNAME) {
393  hres = S_OK;
394  }
395  if(FAILED(hres)) {
397  return hres;
398  }
399 
400  if(desc->explicit_getter || desc->explicit_setter) {
401  if(desc->explicit_value)
403  else if(desc->mask & PROPF_WRITABLE)
405  }
406 
407  if(FAILED(hres))
409  return hres;
410 }
411 
413 {
414  DISPID id = DISPID_STARTENUM;
415  property_desc_t prop_desc;
416  IDispatch *list_disp;
417  jsdisp_t *list_obj, *desc_obj;
418  jsval_t desc_val;
419  BSTR name;
420  HRESULT hres;
421 
422  hres = to_object(ctx, list_val, &list_disp);
423  if(FAILED(hres))
424  return hres;
425 
426  if(!(list_obj = to_jsdisp(list_disp))) {
427  FIXME("non-JS list obj\n");
428  IDispatch_Release(list_disp);
429  return E_NOTIMPL;
430  }
431 
432  while(1) {
433  hres = jsdisp_next_prop(list_obj, id, TRUE, &id);
434  if(hres != S_OK)
435  break;
436 
437  hres = jsdisp_propget(list_obj, id, &desc_val);
438  if(FAILED(hres))
439  break;
440 
441  if(!is_object_instance(desc_val) || !get_object(desc_val) || !(desc_obj = to_jsdisp(get_object(desc_val)))) {
442  jsval_release(desc_val);
443  break;
444  }
445 
446  hres = to_property_descriptor(ctx, desc_obj, &prop_desc);
447  jsdisp_release(desc_obj);
448  if(FAILED(hres))
449  break;
450 
451  hres = IDispatchEx_GetMemberName(&list_obj->IDispatchEx_iface, id, &name);
452  if(SUCCEEDED(hres))
453  hres = jsdisp_define_property(obj, name, &prop_desc);
454  release_property_descriptor(&prop_desc);
455  if(FAILED(hres))
456  break;
457  }
458 
459  jsdisp_release(list_obj);
460  return FAILED(hres) ? hres : S_OK;
461 }
462 
464  unsigned argc, jsval_t *argv, jsval_t *r)
465 {
466  property_desc_t prop_desc;
467  jsdisp_t *obj, *attr_obj;
468  const WCHAR *name;
469  jsstr_t *name_str;
470  HRESULT hres;
471 
472  TRACE("\n");
473 
474  if(argc < 1 || !is_object_instance(argv[0]))
476  obj = to_jsdisp(get_object(argv[0]));
477  if(!obj) {
478  FIXME("not implemented non-JS object\n");
479  return E_NOTIMPL;
480  }
481 
482  hres = to_flat_string(ctx, argc >= 2 ? argv[1] : jsval_undefined(), &name_str, &name);
483  if(FAILED(hres))
484  return hres;
485 
486  if(argc >= 3 && is_object_instance(argv[2])) {
487  attr_obj = to_jsdisp(get_object(argv[2]));
488  if(attr_obj) {
489  hres = to_property_descriptor(ctx, attr_obj, &prop_desc);
490  }else {
491  FIXME("not implemented non-JS object\n");
492  hres = E_NOTIMPL;
493  }
494  }else {
496  }
497  jsstr_release(name_str);
498  if(FAILED(hres))
499  return hres;
500 
501  hres = jsdisp_define_property(obj, name, &prop_desc);
502  release_property_descriptor(&prop_desc);
503  if(SUCCEEDED(hres) && r)
505  return hres;
506 }
507 
509  unsigned argc, jsval_t *argv, jsval_t *r)
510 {
511  jsdisp_t *obj;
512  HRESULT hres;
513 
514  if(argc < 1 || !is_object_instance(argv[0]) || !get_object(argv[0]) || !(obj = to_jsdisp(get_object(argv[0])))) {
515  FIXME("not an object\n");
516  return E_NOTIMPL;
517  }
518 
519  TRACE("%p\n", obj);
520 
521  hres = jsdisp_define_properties(ctx, obj, argc >= 2 ? argv[1] : jsval_undefined());
522  if(SUCCEEDED(hres) && r)
524  return hres;
525 }
526 
528  unsigned argc, jsval_t *argv, jsval_t *r)
529 {
530  property_desc_t prop_desc;
531  jsdisp_t *obj, *desc_obj;
532  const WCHAR *name;
533  jsstr_t *name_str;
534  HRESULT hres;
535 
536  TRACE("\n");
537 
538  if(argc < 1 || !is_object_instance(argv[0]))
540  obj = to_jsdisp(get_object(argv[0]));
541  if(!obj) {
542  FIXME("not implemented non-JS object\n");
543  return E_NOTIMPL;
544  }
545 
546  hres = to_flat_string(ctx, argc >= 2 ? argv[1] : jsval_undefined(), &name_str, &name);
547  if(FAILED(hres))
548  return hres;
549 
550  hres = jsdisp_get_own_property(obj, name, FALSE, &prop_desc);
551  jsstr_release(name_str);
552  if(hres == DISP_E_UNKNOWNNAME) {
553  if(r) *r = jsval_undefined();
554  return S_OK;
555  }
556  if(FAILED(hres))
557  return hres;
558 
559  hres = create_object(ctx, NULL, &desc_obj);
560  if(FAILED(hres))
561  return hres;
562 
563  if(prop_desc.explicit_getter || prop_desc.explicit_setter) {
565  prop_desc.getter ? jsval_obj(prop_desc.getter) : jsval_undefined());
566  if(SUCCEEDED(hres))
568  prop_desc.setter ? jsval_obj(prop_desc.setter) : jsval_undefined());
569  }else {
570  hres = jsdisp_propput_name(desc_obj, valueW, prop_desc.value);
571  if(SUCCEEDED(hres))
573  jsval_bool(!!(prop_desc.flags & PROPF_WRITABLE)));
574  }
575  if(SUCCEEDED(hres))
577  jsval_bool(!!(prop_desc.flags & PROPF_ENUMERABLE)));
578  if(SUCCEEDED(hres))
580  jsval_bool(!!(prop_desc.flags & PROPF_CONFIGURABLE)));
581 
582  release_property_descriptor(&prop_desc);
583  if(SUCCEEDED(hres) && r)
584  *r = jsval_obj(desc_obj);
585  else
586  jsdisp_release(desc_obj);
587  return hres;
588 }
589 
591  unsigned argc, jsval_t *argv, jsval_t *r)
592 {
593  jsdisp_t *proto = NULL, *obj;
594  HRESULT hres;
595 
596  if(!argc || (!is_object_instance(argv[0]) && !is_null(argv[0]))) {
597  FIXME("Invalid arg\n");
598  return E_INVALIDARG;
599  }
600 
601  TRACE("(%s)\n", debugstr_jsval(argv[0]));
602 
603  if(argc && is_object_instance(argv[0])) {
604  if(get_object(argv[0]))
606  if(!proto) {
607  FIXME("Non-JS prototype\n");
608  return E_NOTIMPL;
609  }
610  }else if(!is_null(argv[0])) {
611  FIXME("Invalid arg %s\n", debugstr_jsval(argc ? argv[0] : jsval_undefined()));
612  return E_INVALIDARG;
613  }
614 
615  hres = create_dispex(ctx, NULL, proto, &obj);
616  if(FAILED(hres))
617  return hres;
618 
619  if(argc >= 2 && !is_undefined(argv[1]))
621 
622  if(SUCCEEDED(hres) && r)
623  *r = jsval_obj(obj);
624  else
626  return hres;
627 }
628 
630  unsigned argc, jsval_t *argv, jsval_t *r)
631 {
632  jsdisp_t *obj;
633 
634  if(!argc || !is_object_instance(argv[0])) {
635  FIXME("invalid arguments\n");
636  return E_NOTIMPL;
637  }
638 
639  TRACE("(%s)\n", debugstr_jsval(argv[1]));
640 
641  obj = to_jsdisp(get_object(argv[0]));
642  if(!obj) {
643  FIXME("Non-JS object\n");
644  return E_NOTIMPL;
645  }
646 
647  if(r)
648  *r = obj->prototype
649  ? jsval_obj(jsdisp_addref(obj->prototype))
650  : jsval_null();
651  return S_OK;
652 }
653 
660 };
661 
667  NULL,
668  NULL
669 };
670 
672  jsval_t *r)
673 {
674  HRESULT hres;
675 
676  TRACE("\n");
677 
678  switch(flags) {
679  case DISPATCH_METHOD:
680  case DISPATCH_CONSTRUCT: {
681  jsdisp_t *obj;
682 
683  if(argc) {
684  if(!is_undefined(argv[0]) && !is_null(argv[0]) && (!is_object_instance(argv[0]) || get_object(argv[0]))) {
685  IDispatch *disp;
686 
687  hres = to_object(ctx, argv[0], &disp);
688  if(FAILED(hres))
689  return hres;
690 
691  if(r)
692  *r = jsval_disp(disp);
693  else
694  IDispatch_Release(disp);
695  return S_OK;
696  }
697  }
698 
699  hres = create_object(ctx, NULL, &obj);
700  if(FAILED(hres))
701  return hres;
702 
703  if(r)
704  *r = jsval_obj(obj);
705  else
707  break;
708  }
709 
710  default:
711  FIXME("unimplemented flags: %x\n", flags);
712  return E_NOTIMPL;
713  }
714 
715  return S_OK;
716 }
717 
719 {
720  static const WCHAR ObjectW[] = {'O','b','j','e','c','t',0};
721 
723  object_prototype, ret);
724 }
725 
727 {
728  return create_dispex(ctx, &Object_info, NULL, ret);
729 }
730 
732 {
733  jsdisp_t *object;
734  HRESULT hres;
735 
736  object = heap_alloc_zero(sizeof(jsdisp_t));
737  if(!object)
738  return E_OUTOFMEMORY;
739 
740  hres = init_dispex_from_constr(object, ctx, &ObjectInst_info, constr ? constr : ctx->object_constr);
741  if(FAILED(hres)) {
742  heap_free(object);
743  return hres;
744  }
745 
746  *ret = object;
747  return S_OK;
748 }
#define PROPF_WRITABLE
Definition: jscript.h:101
static HRESULT Object_create(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:590
#define PROPF_ES5
Definition: jscript.h:108
Definition: jsval.h:54
#define DISP_E_UNKNOWNNAME
Definition: winerror.h:2515
static jsstr_t * jsstr_alloc(const WCHAR *str)
Definition: jsstr.h:103
static const WCHAR * jsstr_flatten(jsstr_t *str)
Definition: jsstr.h:139
disp
Definition: i386-dis.c:3181
static int argc
Definition: ServiceArgs.c:12
void jsval_release(jsval_t val)
Definition: jsutils.c:191
#define JS_E_PROP_DESC_MISMATCH
Definition: jscript.h:572
static const WCHAR numberW[]
Definition: engine.c:36
#define PROPF_ALL
Definition: jscript.h:103
#define TRUE
Definition: types.h:120
HRESULT jsdisp_propget(jsdisp_t *jsdisp, DISPID id, jsval_t *val)
Definition: dispex.c:1447
static const WCHAR hasOwnPropertyW[]
Definition: object.c:30
BSTR WINAPI SysAllocStringLen(const OLECHAR *str, unsigned int len)
Definition: oleaut.c:339
Definition: jsstr.h:39
static const WCHAR getPrototypeOfW[]
Definition: object.c:38
HRESULT jsdisp_call_name(jsdisp_t *disp, const WCHAR *name, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: dispex.c:1124
static jsval_t jsval_null(void)
Definition: jsval.h:130
static IDispatch * get_object(jsval_t v)
Definition: jsval.h:219
HRESULT jsdisp_get_own_property(jsdisp_t *obj, const WCHAR *name, BOOL flags_only, property_desc_t *desc)
Definition: dispex.c:1633
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static const WCHAR ObjectW[]
Definition: global.c:48
static HRESULT Object_get_value(script_ctx_t *ctx, jsdisp_t *jsthis, jsval_t *r)
Definition: object.c:227
unsigned flags
Definition: jscript.h:389
HRESULT jsdisp_define_data_property(jsdisp_t *obj, const WCHAR *name, unsigned flags, jsval_t value)
Definition: dispex.c:1801
const builtin_info_t * builtin_info
Definition: jscript.h:242
#define PROPF_CONSTR
Definition: jscript.h:98
HRESULT create_builtin_constructor(script_ctx_t *ctx, builtin_invoke_t value_proc, const WCHAR *name, const builtin_info_t *builtin_info, DWORD flags, jsdisp_t *prototype, jsdisp_t **ret)
Definition: function.c:686
static BOOL is_undefined(jsval_t v)
Definition: jsval.h:171
static unsigned jsstr_flush(jsstr_t *str, WCHAR *buf)
Definition: jsstr.h:148
#define assert(x)
Definition: debug.h:53
static unsigned jsstr_length(jsstr_t *str)
Definition: jsstr.h:58
OLECHAR * BSTR
Definition: compat.h:1942
static void jsstr_release(jsstr_t *str)
Definition: jsstr.h:110
jsdisp_t * getter
Definition: jscript.h:394
#define argv
Definition: mplay32.c:18
static const WCHAR isPrototypeOfW[]
Definition: object.c:33
#define PROPF_ENUMERABLE
Definition: jscript.h:100
#define lstrlenW
Definition: compat.h:415
#define E_FAIL
Definition: ddrawi.h:102
static HRESULT to_property_descriptor(script_ctx_t *ctx, jsdisp_t *attr_obj, property_desc_t *desc)
Definition: object.c:282
static const WCHAR stringW[]
Definition: engine.c:38
static const builtin_prop_t Object_props[]
Definition: object.c:246
jsdisp_t * to_jsdisp(IDispatch *disp)
Definition: dispex.c:914
#define DISPATCH_METHOD
Definition: oleauto.h:1006
GLsizei GLsizei GLuint * obj
Definition: glext.h:6042
static const WCHAR writableW[]
Definition: object.c:49
static const builtin_prop_t ObjectConstr_props[]
Definition: object.c:654
GLuint GLuint * names
Definition: glext.h:11545
static const WCHAR getW[]
Definition: object.c:50
#define E_OUTOFMEMORY
Definition: ddrawi.h:100
static const WCHAR propertyIsEnumerableW[]
Definition: object.c:31
IDispatchEx IDispatchEx_iface
Definition: jscript.h:231
unsigned int BOOL
Definition: ntddk_ex.h:94
static const WCHAR default_valueW[]
Definition: object.c:44
static const WCHAR desc[]
Definition: protectdata.c:36
static HRESULT Object_valueOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:116
#define FIXME(fmt,...)
Definition: debug.h:110
static PVOID ptr
Definition: dispmode.c:27
static HRESULT Object_defineProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:463
static HRESULT to_string(VARIANT *src, BSTR *dst)
Definition: host.c:48
static HRESULT Object_isPrototypeOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:220
#define E_INVALIDARG
Definition: ddrawi.h:101
HRESULT jsdisp_next_prop(jsdisp_t *obj, DISPID id, BOOL own_only, DISPID *ret)
Definition: dispex.c:1546
const WCHAR * str
smooth NULL
Definition: ftsmooth.c:416
BOOL explicit_setter
Definition: jscript.h:395
jsdisp_t * jsdisp
Definition: jscript.h:144
static BOOL is_object_instance(jsval_t v)
Definition: jsval.h:166
union vdisp_t::@425 u
static const WCHAR valueW[]
Definition: object.c:48
static jsval_t jsval_string(jsstr_t *str)
Definition: jsval.h:109
#define b
Definition: ke_i.h:79
static DWORD make_grfdex(script_ctx_t *ctx, DWORD flags)
Definition: jscript.h:519
static jsdisp_t * get_jsdisp(vdisp_t *vdisp)
Definition: jscript.h:199
static const WCHAR getOwnPropertyDescriptorW[]
Definition: object.c:36
GLboolean GLboolean GLboolean b
Definition: glext.h:6204
HRESULT jsdisp_define_property(jsdisp_t *obj, const WCHAR *name, property_desc_t *desc)
Definition: dispex.c:1677
#define TRACE(s)
Definition: solgame.cpp:4
static jsval_t jsval_disp(IDispatch *obj)
Definition: jsval.h:117
static const WCHAR toLocaleStringW[]
Definition: object.c:28
HRESULT hres
Definition: protocol.c:465
static void Object_destructor(jsdisp_t *dispex)
Definition: object.c:241
static const WCHAR valueOfW[]
Definition: object.c:29
IDispatch * disp
Definition: jscript.h:142
__wchar_t WCHAR
Definition: xmlstorage.h:180
HRESULT create_object(script_ctx_t *ctx, jsdisp_t *constr, jsdisp_t **ret)
Definition: object.c:731
IDispatchEx * dispex
Definition: jscript.h:143
LONG HRESULT
Definition: typedefs.h:77
#define swprintf(buf, format,...)
Definition: sprintf.c:56
unsigned short WORD
Definition: ntddk_ex.h:93
HRESULT to_boolean(jsval_t, BOOL *) DECLSPEC_HIDDEN
Definition: jsutils.c:472
static BOOL is_null(jsval_t v)
Definition: jsval.h:176
static jsdisp_t * jsdisp_addref(jsdisp_t *jsdisp)
Definition: jscript.h:262
static const builtin_info_t ObjectConstr_info
Definition: object.c:662
static HRESULT Object_defineProperties(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:508
GLbitfield flags
Definition: glext.h:7161
jsdisp_t * object_constr
Definition: jscript.h:456
HRESULT create_object_constr(script_ctx_t *ctx, jsdisp_t *object_prototype, jsdisp_t **ret)
Definition: object.c:718
int ret
#define IID_NULL
Definition: guiddef.h:98
static const WCHAR definePropertyW[]
Definition: object.c:40
static const WCHAR enumerableW[]
Definition: object.c:47
jsclass_t class
Definition: jscript.h:219
static HRESULT Object_hasOwnProperty(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:128
HRESULT jsdisp_get_id(jsdisp_t *jsdisp, const WCHAR *name, DWORD flags, DISPID *id)
Definition: dispex.c:1067
#define JS_E_INVALID_WRITABLE_PROP_DESC
Definition: jscript.h:573
static BOOL is_dispex(vdisp_t *vdisp)
Definition: jscript.h:162
#define DEFAULT_FUNCTION_VALUE
Definition: jscript.h:315
static HRESULT Object_toLocaleString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:103
static jsval_t jsval_undefined(void)
Definition: jsval.h:137
static const WCHAR booleanW[]
Definition: engine.c:34
static VARIANTARG static DISPID
Definition: ordinal.c:49
#define S_OK
Definition: intsafe.h:59
static const WCHAR configurableW[]
Definition: object.c:46
const GLdouble * v
Definition: gl.h:2040
#define PROPF_METHOD
Definition: jscript.h:97
static HRESULT Object_propertyIsEnumerable(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:186
static const WCHAR objectW[]
Definition: engine.c:37
#define ARRAY_SIZE(a)
Definition: main.h:24
#define E_NOTIMPL
Definition: ddrawi.h:99
static const WCHAR definePropertiesW[]
Definition: object.c:42
HRESULT create_dispex(script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *prototype, jsdisp_t **dispex)
Definition: dispex.c:957
static HRESULT Object_getPrototypeOf(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:629
void WINAPI DECLSPEC_HOTPATCH SysFreeString(BSTR str)
Definition: oleaut.c:271
static void jsdisp_release(jsdisp_t *jsdisp)
Definition: jscript.h:268
static HRESULT jsdisp_define_properties(script_ctx_t *ctx, jsdisp_t *obj, jsval_t list_val)
Definition: object.c:412
static jsval_t jsval_obj(jsdisp_t *obj)
Definition: jsval.h:125
static HRESULT Object_toString(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:53
static const WCHAR setW[]
Definition: object.c:51
static const WCHAR toStringW[]
Definition: object.c:27
jsstr_t * jsstr_alloc_buf(unsigned len, WCHAR **buf)
Definition: jsstr.c:69
Definition: name.c:38
HRESULT to_object(script_ctx_t *, jsval_t, IDispatch **) DECLSPEC_HIDDEN
Definition: jsutils.c:816
static void release_property_descriptor(property_desc_t *desc)
Definition: object.c:272
HRESULT jsdisp_propput_name(jsdisp_t *obj, const WCHAR *name, jsval_t val)
Definition: dispex.c:1344
static const WCHAR functionW[]
Definition: engine.c:35
GLenum GLuint id
Definition: glext.h:5579
static const builtin_info_t Object_info
Definition: object.c:255
HRESULT throw_type_error(script_ctx_t *ctx, HRESULT error, const WCHAR *str)
Definition: error.c:440
static HRESULT Object_getOwnPropertyDescriptor(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:527
static jsval_t jsval_bool(BOOL b)
Definition: jsval.h:101
jsval_t value
Definition: jscript.h:392
static HRESULT ObjectConstr_value(script_ctx_t *ctx, vdisp_t *jsthis, WORD flags, unsigned argc, jsval_t *argv, jsval_t *r)
Definition: object.c:671
static const builtin_info_t ObjectInst_info
Definition: object.c:264
HRESULT init_dispex_from_constr(jsdisp_t *dispex, script_ctx_t *ctx, const builtin_info_t *builtin_info, jsdisp_t *constr)
Definition: dispex.c:1030
#define memset(x, y, z)
Definition: compat.h:39
static const WCHAR createW[]
Definition: object.c:35
#define PROPF_CONFIGURABLE
Definition: jscript.h:102
#define JS_E_OBJECT_EXPECTED
Definition: jscript.h:555
WINE_DEFAULT_DEBUG_CHANNEL(crypt)
void * object
Definition: jmemsys.h:48
HRESULT to_flat_string(script_ctx_t *, jsval_t, jsstr_t **, const WCHAR **) DECLSPEC_HIDDEN
Definition: jsutils.c:798
BOOL explicit_getter
Definition: jscript.h:393
static const WCHAR errorW[]
Definition: htmlevent.c:61
HRESULT create_object_prototype(script_ctx_t *ctx, jsdisp_t **ret)
Definition: object.c:726
static BOOL is_jsdisp(vdisp_t *vdisp)
Definition: jscript.h:157
#define SUCCEEDED(hr)
Definition: intsafe.h:57
jsdisp_t * setter
Definition: jscript.h:396
const char * debugstr_jsval(const jsval_t) DECLSPEC_HIDDEN
Definition: jsutils.c:35
static BOOL heap_free(void *mem)
Definition: appwiz.h:75
GLuint const GLchar * name
Definition: glext.h:6031