2019-05-31 11:56:07 -04:00
|
|
|
/**
|
|
|
|
* @license
|
2020-05-19 15:08:49 -04:00
|
|
|
* Copyright Google LLC All Rights Reserved.
|
2019-05-31 11:56:07 -04:00
|
|
|
*
|
|
|
|
* Use of this source code is governed by an MIT-style license that can be
|
|
|
|
* found in the LICENSE file at https://angular.io/license
|
|
|
|
*/
|
|
|
|
(function(_global) {
|
2020-04-13 19:40:21 -04:00
|
|
|
var mark = _global['__zone_symbol__mark'];
|
|
|
|
var measure = _global['__zone_symbol__measure'];
|
|
|
|
var testRunner = _global['__zone_symbol__testRunner'];
|
|
|
|
var zone = _global['__zone_symbol__callbackZone'];
|
|
|
|
var testTarget = {
|
|
|
|
title: 'xhr',
|
|
|
|
times: 3,
|
|
|
|
count: 1000,
|
|
|
|
before: function() {
|
|
|
|
_global['__zone_symbol__callbackContext'].measureName = 'xhr_callback';
|
|
|
|
_global['__zone_symbol__callbackContext'].type = 'macroTask';
|
|
|
|
_global['__zone_symbol__callbackContext'].source = 'send';
|
|
|
|
},
|
|
|
|
apis: [
|
|
|
|
{
|
|
|
|
supportClear: true,
|
|
|
|
method: 'XHR.send',
|
|
|
|
nativeMethod: 'native.XHR.send',
|
|
|
|
clearMethod: 'XHR.abort',
|
|
|
|
nativeClearMethod: 'native.XHR.abort',
|
|
|
|
run: function() {
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
xhr.open('get', 'http://localhost:8080', true);
|
|
|
|
xhr.send();
|
|
|
|
return xhr;
|
|
|
|
},
|
|
|
|
runClear: function(xhr) {
|
|
|
|
xhr.abort();
|
2019-05-31 11:56:07 -04:00
|
|
|
},
|
2020-04-13 19:40:21 -04:00
|
|
|
nativeRun: function() {
|
|
|
|
var xhr = new XMLHttpRequest();
|
|
|
|
xhr['__zone_symbol__open']('get', 'http://localhost:8080', true);
|
|
|
|
xhr['__zone_symbol__send']();
|
|
|
|
return xhr;
|
|
|
|
},
|
|
|
|
nativeRunClear: function(xhr) {
|
|
|
|
xhr['__zone_symbol__abort']();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
],
|
|
|
|
};
|
|
|
|
return testRunner(testTarget);
|
2019-05-31 11:56:07 -04:00
|
|
|
}(typeof window === 'undefined' ? global : window));
|