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

fix(task): fix #832, fix #835, task.data should be an object #834

Merged
merged 3 commits into from
Jul 14, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/browser/browser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Zone.__load_patch('EventTarget', (global: any, Zone: ZoneType, api: _ZonePrivate
});

Zone.__load_patch('on_property', (global: any, Zone: ZoneType, api: _ZonePrivate) => {
propertyDescriptorPatch(global);
propertyDescriptorPatch(api, global);
propertyPatch();
registerElementPatch(global);
});
Expand Down
7 changes: 4 additions & 3 deletions lib/browser/event-target.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* found in the LICENSE file at https://angular.io/license
*/

import {FALSE_STR, globalSources, patchEventTargetMethods, TRUE_STR, ZONE_SYMBOL_PREFIX, zoneSymbolEventNames} from '../common/events';
import {FALSE_STR, globalSources, patchEventTarget, TRUE_STR, ZONE_SYMBOL_PREFIX, zoneSymbolEventNames} from '../common/events';
import {attachOriginToPatched, isIEOrEdge, zoneSymbol} from '../common/utils';

import {eventNames} from './property-descriptor';
Expand Down Expand Up @@ -96,11 +96,12 @@ export function eventTargetPatch(_global: any, api: _ZonePrivate) {
return true;
};

const apiTypes: any[] = [];
for (let i = 0; i < apis.length; i++) {
const type = _global[apis[i]];
patchEventTargetMethods(type && type.prototype, {validateHandler: checkIEAndCrossContext});
apiTypes.push(type && type.prototype);
}
patchEventTarget(api, _global, apiTypes, {validateHandler: checkIEAndCrossContext});

api.patchEventTargetMethods = patchEventTargetMethods;
return true;
}
4 changes: 2 additions & 2 deletions lib/browser/property-descriptor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ export const eventNames = globalEventHandlersEventNames.concat(
webglEventNames, formEventNames, detailEventNames, documentEventNames, windowEventNames,
htmlElementEventNames, ieElementEventNames);

export function propertyDescriptorPatch(_global: any) {
export function propertyDescriptorPatch(api: _ZonePrivate, _global: any) {
if (isNode && !isMix) {
return;
}
Expand Down Expand Up @@ -279,7 +279,7 @@ export function propertyDescriptorPatch(_global: any) {
patchViaCapturingAllTheEvents();
patchClass('XMLHttpRequest');
if (supportsWebSocket) {
webSocketPatch.apply(_global);
webSocketPatch.apply(api, _global);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/browser/websocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
* found in the LICENSE file at https://angular.io/license
*/

import {patchEventTargetMethods} from '../common/events';
import {patchEventTarget} from '../common/events';
import {patchOnProperties} from '../common/utils';

// we have to patch the instance since the proto is non-configurable
export function apply(_global: any) {
export function apply(api: _ZonePrivate, _global: any) {
const WS = (<any>_global).WebSocket;
// On Safari window.EventTarget doesn't exist so need to patch WS add/removeEventListener
// On older Chrome, no need since EventTarget was already patched
if (!(<any>_global).EventTarget) {
patchEventTargetMethods(WS.prototype);
patchEventTarget(api, _global, [WS.prototype]);
}
(<any>_global).WebSocket = function(a: any, b: any) {
const socket = arguments.length > 1 ? new WS(a, b) : new WS(a);
Expand Down
Loading