Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.

Commit c256963

Browse files
author
Alexander Korenev
committed
additional patching
1 parent 9329397 commit c256963

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

lib/browser/browser.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
import {findEventTasks} from '../common/events';
1414
import {patchTimer} from '../common/timers';
15-
import {bindArguments, patchClass, patchMacroTask, patchMethod, patchOnProperties, patchPrototype, scheduleMacroTaskWithCurrentZone, ZONE_SYMBOL_ADD_EVENT_LISTENER, ZONE_SYMBOL_REMOVE_EVENT_LISTENER, zoneSymbol, createConstructorFunctionWrapper} from '../common/utils';
15+
import {bindArguments, patchClass, patchMacroTask, patchMethod, patchOnProperties, patchPrototype, scheduleMacroTaskWithCurrentZone, ZONE_SYMBOL_ADD_EVENT_LISTENER, ZONE_SYMBOL_REMOVE_EVENT_LISTENER, zoneSymbol, createConstructorFunctionWrapper, createShallowObjectCopy, ObjectGetPrototypeOf} from '../common/utils';
1616

1717
import {propertyPatch} from './define-property';
1818
import {eventTargetPatch, patchEvent} from './event-target';
@@ -60,7 +60,12 @@ Zone.__load_patch('EventTarget', (global: any, Zone: ZoneType, api: _ZonePrivate
6060

6161
global['Event'] = createConstructorFunctionWrapper(global['Event']);
6262
global['EventTarget'] = createConstructorFunctionWrapper(global['EventTarget']);
63-
global['XMLHttpRequestEventTarget'] = createConstructorFunctionWrapper(global['XMLHttpRequestEventTarget']);
63+
64+
if (global['XMLHttpRequestEventTarget'] && global['XMLHttpRequestEventTarget'].prototype) {
65+
const XMLHttpRequestEventTargetProtoProto = createShallowObjectCopy(ObjectGetPrototypeOf(global['XMLHttpRequestEventTarget'].prototype));
66+
global['XMLHttpRequestEventTarget'] = createConstructorFunctionWrapper(global['XMLHttpRequestEventTarget']);
67+
(Object as any).setPrototypeOf(global['XMLHttpRequestEventTarget'].prototype, XMLHttpRequestEventTargetProtoProto);
68+
}
6469

6570
patchEvent(global, api);
6671
eventTargetPatch(global, api);

0 commit comments

Comments
 (0)