11cb0ef41Sopenharmony_ci// Flags: --expose-internals
21cb0ef41Sopenharmony_ci'use strict';
31cb0ef41Sopenharmony_ci
41cb0ef41Sopenharmony_cirequire('../common');
51cb0ef41Sopenharmony_ciconst assert = require('assert');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst {
81cb0ef41Sopenharmony_ci  Event,
91cb0ef41Sopenharmony_ci  CustomEvent,
101cb0ef41Sopenharmony_ci  EventTarget,
111cb0ef41Sopenharmony_ci  NodeEventTarget,
121cb0ef41Sopenharmony_ci} = require('internal/event_target');
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_ci[
151cb0ef41Sopenharmony_ci  'target',
161cb0ef41Sopenharmony_ci  'currentTarget',
171cb0ef41Sopenharmony_ci  'srcElement',
181cb0ef41Sopenharmony_ci  'type',
191cb0ef41Sopenharmony_ci  'cancelable',
201cb0ef41Sopenharmony_ci  'defaultPrevented',
211cb0ef41Sopenharmony_ci  'timeStamp',
221cb0ef41Sopenharmony_ci  'returnValue',
231cb0ef41Sopenharmony_ci  'bubbles',
241cb0ef41Sopenharmony_ci  'composed',
251cb0ef41Sopenharmony_ci  'eventPhase',
261cb0ef41Sopenharmony_ci].forEach((i) => {
271cb0ef41Sopenharmony_ci  assert.throws(() => Reflect.get(Event.prototype, i, {}), {
281cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_THIS',
291cb0ef41Sopenharmony_ci  });
301cb0ef41Sopenharmony_ci});
311cb0ef41Sopenharmony_ci
321cb0ef41Sopenharmony_ci[
331cb0ef41Sopenharmony_ci  'stopImmediatePropagation',
341cb0ef41Sopenharmony_ci  'preventDefault',
351cb0ef41Sopenharmony_ci  'composedPath',
361cb0ef41Sopenharmony_ci  'cancelBubble',
371cb0ef41Sopenharmony_ci  'stopPropagation',
381cb0ef41Sopenharmony_ci].forEach((i) => {
391cb0ef41Sopenharmony_ci  assert.throws(() => Reflect.apply(Event.prototype[i], [], {}), {
401cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_THIS',
411cb0ef41Sopenharmony_ci  });
421cb0ef41Sopenharmony_ci});
431cb0ef41Sopenharmony_ci
441cb0ef41Sopenharmony_ci[
451cb0ef41Sopenharmony_ci  'target',
461cb0ef41Sopenharmony_ci  'currentTarget',
471cb0ef41Sopenharmony_ci  'srcElement',
481cb0ef41Sopenharmony_ci  'type',
491cb0ef41Sopenharmony_ci  'cancelable',
501cb0ef41Sopenharmony_ci  'defaultPrevented',
511cb0ef41Sopenharmony_ci  'timeStamp',
521cb0ef41Sopenharmony_ci  'returnValue',
531cb0ef41Sopenharmony_ci  'bubbles',
541cb0ef41Sopenharmony_ci  'composed',
551cb0ef41Sopenharmony_ci  'eventPhase',
561cb0ef41Sopenharmony_ci  'detail',
571cb0ef41Sopenharmony_ci].forEach((i) => {
581cb0ef41Sopenharmony_ci  assert.throws(() => Reflect.get(CustomEvent.prototype, i, {}), {
591cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_THIS',
601cb0ef41Sopenharmony_ci  });
611cb0ef41Sopenharmony_ci});
621cb0ef41Sopenharmony_ci
631cb0ef41Sopenharmony_ci[
641cb0ef41Sopenharmony_ci  'stopImmediatePropagation',
651cb0ef41Sopenharmony_ci  'preventDefault',
661cb0ef41Sopenharmony_ci  'composedPath',
671cb0ef41Sopenharmony_ci  'cancelBubble',
681cb0ef41Sopenharmony_ci  'stopPropagation',
691cb0ef41Sopenharmony_ci].forEach((i) => {
701cb0ef41Sopenharmony_ci  assert.throws(() => Reflect.apply(CustomEvent.prototype[i], [], {}), {
711cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_THIS',
721cb0ef41Sopenharmony_ci  });
731cb0ef41Sopenharmony_ci});
741cb0ef41Sopenharmony_ci
751cb0ef41Sopenharmony_ci['addEventListener', 'removeEventListener', 'dispatchEvent'].forEach((i) => {
761cb0ef41Sopenharmony_ci  assert.throws(() => Reflect.apply(EventTarget.prototype[i], [], {}), {
771cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_THIS',
781cb0ef41Sopenharmony_ci  });
791cb0ef41Sopenharmony_ci});
801cb0ef41Sopenharmony_ci
811cb0ef41Sopenharmony_ci[
821cb0ef41Sopenharmony_ci  'setMaxListeners',
831cb0ef41Sopenharmony_ci  'getMaxListeners',
841cb0ef41Sopenharmony_ci  'eventNames',
851cb0ef41Sopenharmony_ci  'listenerCount',
861cb0ef41Sopenharmony_ci  'off',
871cb0ef41Sopenharmony_ci  'removeListener',
881cb0ef41Sopenharmony_ci  'on',
891cb0ef41Sopenharmony_ci  'addListener',
901cb0ef41Sopenharmony_ci  'once',
911cb0ef41Sopenharmony_ci  'emit',
921cb0ef41Sopenharmony_ci  'removeAllListeners',
931cb0ef41Sopenharmony_ci].forEach((i) => {
941cb0ef41Sopenharmony_ci  assert.throws(() => Reflect.apply(NodeEventTarget.prototype[i], [], {}), {
951cb0ef41Sopenharmony_ci    code: 'ERR_INVALID_THIS',
961cb0ef41Sopenharmony_ci  });
971cb0ef41Sopenharmony_ci});
98