react-server-dom-webpack 19.0.0-rc.1 → 19.1.0-canary-130095f7-20241212

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -322,14 +322,6 @@
322
322
  suspendedThenable = null;
323
323
  return thenable;
324
324
  }
325
- function prepareToUseHooksForComponent(
326
- prevThenableState,
327
- componentDebugInfo
328
- ) {
329
- thenableIndexCounter = 0;
330
- thenableState = prevThenableState;
331
- currentComponentDebugInfo = componentDebugInfo;
332
- }
333
325
  function getThenableStateAfterSuspending() {
334
326
  var state = thenableState || [];
335
327
  state._componentDebugInfo = currentComponentDebugInfo;
@@ -586,9 +578,8 @@
586
578
  1
587
579
  );
588
580
  request.pendingChunks++;
589
- var id = request.nextChunkId++,
590
- owner = resolveOwner();
591
- emitConsoleChunk(request, id, methodName, owner, stack, arguments);
581
+ var owner = resolveOwner();
582
+ emitConsoleChunk(request, methodName, owner, stack, arguments);
592
583
  }
593
584
  return originalMethod.apply(this, arguments);
594
585
  };
@@ -701,12 +692,7 @@
701
692
  newTask.id
702
693
  );
703
694
  case "rejected":
704
- task = thenable.reason;
705
- var digest = logRecoverableError(request, task, null);
706
- emitErrorChunk(request, newTask.id, digest, task);
707
- newTask.status = ERRORED$1;
708
- request.abortableTasks.delete(newTask);
709
- return newTask.id;
695
+ return erroredTask(request, newTask, thenable.reason), newTask.id;
710
696
  default:
711
697
  if (request.status === ABORTING)
712
698
  return (
@@ -736,13 +722,8 @@
736
722
  pingTask(request, newTask);
737
723
  },
738
724
  function (reason) {
739
- if (newTask.status === PENDING$1) {
740
- var _digest = logRecoverableError(request, reason, newTask);
741
- emitErrorChunk(request, newTask.id, _digest, reason);
742
- newTask.status = ERRORED$1;
743
- request.abortableTasks.delete(newTask);
744
- enqueueFlush(request);
745
- }
725
+ newTask.status === PENDING$1 &&
726
+ (erroredTask(request, newTask, reason), enqueueFlush(request));
746
727
  }
747
728
  );
748
729
  return newTask.id;
@@ -768,24 +749,20 @@
768
749
  }
769
750
  }
770
751
  function error(reason) {
771
- if (!aborted) {
772
- aborted = !0;
773
- request.abortListeners.delete(abortStream);
774
- var digest = logRecoverableError(request, reason, streamTask);
775
- emitErrorChunk(request, streamTask.id, digest, reason);
776
- enqueueFlush(request);
777
- reader.cancel(reason).then(error, error);
778
- }
752
+ aborted ||
753
+ ((aborted = !0),
754
+ request.abortListeners.delete(abortStream),
755
+ erroredTask(request, streamTask, reason),
756
+ enqueueFlush(request),
757
+ reader.cancel(reason).then(error, error));
779
758
  }
780
759
  function abortStream(reason) {
781
- if (!aborted) {
782
- aborted = !0;
783
- request.abortListeners.delete(abortStream);
784
- var digest = logRecoverableError(request, reason, streamTask);
785
- emitErrorChunk(request, streamTask.id, digest, reason);
786
- enqueueFlush(request);
787
- reader.cancel(reason).then(error, error);
788
- }
760
+ aborted ||
761
+ ((aborted = !0),
762
+ request.abortListeners.delete(abortStream),
763
+ erroredTask(request, streamTask, reason),
764
+ enqueueFlush(request),
765
+ reader.cancel(reason).then(error, error));
789
766
  }
790
767
  var supportsBYOB = stream.supportsBYOB;
791
768
  if (void 0 === supportsBYOB)
@@ -847,26 +824,22 @@
847
824
  }
848
825
  }
849
826
  function error(reason) {
850
- if (!aborted) {
851
- aborted = !0;
852
- request.abortListeners.delete(abortIterable);
853
- var digest = logRecoverableError(request, reason, streamTask);
854
- emitErrorChunk(request, streamTask.id, digest, reason);
855
- enqueueFlush(request);
827
+ aborted ||
828
+ ((aborted = !0),
829
+ request.abortListeners.delete(abortIterable),
830
+ erroredTask(request, streamTask, reason),
831
+ enqueueFlush(request),
856
832
  "function" === typeof iterator.throw &&
857
- iterator.throw(reason).then(error, error);
858
- }
833
+ iterator.throw(reason).then(error, error));
859
834
  }
860
835
  function abortIterable(reason) {
861
- if (!aborted) {
862
- aborted = !0;
863
- request.abortListeners.delete(abortIterable);
864
- var digest = logRecoverableError(request, reason, streamTask);
865
- emitErrorChunk(request, streamTask.id, digest, reason);
866
- enqueueFlush(request);
836
+ aborted ||
837
+ ((aborted = !0),
838
+ request.abortListeners.delete(abortIterable),
839
+ erroredTask(request, streamTask, reason),
840
+ enqueueFlush(request),
867
841
  "function" === typeof iterator.throw &&
868
- iterator.throw(reason).then(error, error);
869
- }
842
+ iterator.throw(reason).then(error, error));
870
843
  }
871
844
  var isIterator = iterable === iterator,
872
845
  streamTask = createTask(
@@ -890,9 +863,7 @@
890
863
  }
891
864
  function emitHint(request, code, model) {
892
865
  model = stringify(model);
893
- var id = request.nextChunkId++;
894
- code = serializeRowHeader("H" + code, id) + model + "\n";
895
- request.completedHintChunks.push(code);
866
+ request.completedHintChunks.push(":H" + code + model + "\n");
896
867
  enqueueFlush(request);
897
868
  }
898
869
  function readThenable(thenable) {
@@ -941,6 +912,71 @@
941
912
  currentOwner = null;
942
913
  }
943
914
  }
915
+ function processServerComponentReturnValue(
916
+ request,
917
+ task,
918
+ Component,
919
+ result
920
+ ) {
921
+ if (
922
+ "object" !== typeof result ||
923
+ null === result ||
924
+ isClientReference(result)
925
+ )
926
+ return result;
927
+ if ("function" === typeof result.then)
928
+ return (
929
+ result.then(function (resolvedValue) {
930
+ "object" === typeof resolvedValue &&
931
+ null !== resolvedValue &&
932
+ resolvedValue.$$typeof === REACT_ELEMENT_TYPE &&
933
+ (resolvedValue._store.validated = 1);
934
+ }, voidHandler),
935
+ "fulfilled" === result.status
936
+ ? result.value
937
+ : createLazyWrapperAroundWakeable(result)
938
+ );
939
+ result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1);
940
+ var iteratorFn = getIteratorFn(result);
941
+ if (iteratorFn) {
942
+ var multiShot = _defineProperty({}, Symbol.iterator, function () {
943
+ var iterator = iteratorFn.call(result);
944
+ iterator !== result ||
945
+ ("[object GeneratorFunction]" ===
946
+ Object.prototype.toString.call(Component) &&
947
+ "[object Generator]" ===
948
+ Object.prototype.toString.call(result)) ||
949
+ callWithDebugContextInDEV(request, task, function () {
950
+ console.error(
951
+ "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
952
+ );
953
+ });
954
+ return iterator;
955
+ });
956
+ multiShot._debugInfo = result._debugInfo;
957
+ return multiShot;
958
+ }
959
+ return "function" !== typeof result[ASYNC_ITERATOR] ||
960
+ ("function" === typeof ReadableStream &&
961
+ result instanceof ReadableStream)
962
+ ? result
963
+ : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () {
964
+ var iterator = result[ASYNC_ITERATOR]();
965
+ iterator !== result ||
966
+ ("[object AsyncGeneratorFunction]" ===
967
+ Object.prototype.toString.call(Component) &&
968
+ "[object AsyncGenerator]" ===
969
+ Object.prototype.toString.call(result)) ||
970
+ callWithDebugContextInDEV(request, task, function () {
971
+ console.error(
972
+ "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
973
+ );
974
+ });
975
+ return iterator;
976
+ })),
977
+ (multiShot._debugInfo = result._debugInfo),
978
+ multiShot);
979
+ }
944
980
  function renderFunctionComponent(request, task, key, Component, props) {
945
981
  var prevThenableState = task.thenableState;
946
982
  task.thenableState = null;
@@ -963,7 +999,9 @@
963
999
  emitDebugChunk(request, componentDebugID, componentDebugInfo);
964
1000
  task.environmentName = componentEnv;
965
1001
  }
966
- prepareToUseHooksForComponent(prevThenableState, componentDebugInfo);
1002
+ thenableIndexCounter = 0;
1003
+ thenableState = prevThenableState;
1004
+ currentComponentDebugInfo = componentDebugInfo;
967
1005
  props = componentStorage.run(
968
1006
  componentDebugInfo,
969
1007
  callComponentInDEV,
@@ -980,76 +1018,21 @@
980
1018
  props.then(voidHandler, voidHandler),
981
1019
  null)
982
1020
  );
983
- if (
984
- "object" === typeof props &&
985
- null !== props &&
986
- !isClientReference(props)
987
- ) {
988
- if ("function" === typeof props.then) {
989
- prevThenableState = props;
990
- prevThenableState.then(function (resolvedValue) {
991
- "object" === typeof resolvedValue &&
992
- null !== resolvedValue &&
993
- resolvedValue.$$typeof === REACT_ELEMENT_TYPE &&
994
- (resolvedValue._store.validated = 1);
995
- }, voidHandler);
996
- if ("fulfilled" === prevThenableState.status)
997
- return prevThenableState.value;
998
- props = createLazyWrapperAroundWakeable(props);
999
- }
1000
- var iteratorFn = getIteratorFn(props);
1001
- if (iteratorFn) {
1002
- var iterableChild = props;
1003
- props = _defineProperty({}, Symbol.iterator, function () {
1004
- var iterator = iteratorFn.call(iterableChild);
1005
- iterator !== iterableChild ||
1006
- ("[object GeneratorFunction]" ===
1007
- Object.prototype.toString.call(Component) &&
1008
- "[object Generator]" ===
1009
- Object.prototype.toString.call(iterableChild)) ||
1010
- callWithDebugContextInDEV(request, task, function () {
1011
- console.error(
1012
- "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
1013
- );
1014
- });
1015
- return iterator;
1016
- });
1017
- props._debugInfo = iterableChild._debugInfo;
1018
- } else if (
1019
- "function" !== typeof props[ASYNC_ITERATOR] ||
1020
- ("function" === typeof ReadableStream &&
1021
- props instanceof ReadableStream)
1022
- )
1023
- props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1);
1024
- else {
1025
- var _iterableChild = props;
1026
- props = _defineProperty({}, ASYNC_ITERATOR, function () {
1027
- var iterator = _iterableChild[ASYNC_ITERATOR]();
1028
- iterator !== _iterableChild ||
1029
- ("[object AsyncGeneratorFunction]" ===
1030
- Object.prototype.toString.call(Component) &&
1031
- "[object AsyncGenerator]" ===
1032
- Object.prototype.toString.call(_iterableChild)) ||
1033
- callWithDebugContextInDEV(request, task, function () {
1034
- console.error(
1035
- "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
1036
- );
1037
- });
1038
- return iterator;
1039
- });
1040
- props._debugInfo = _iterableChild._debugInfo;
1041
- }
1042
- }
1043
- prevThenableState = task.keyPath;
1044
- componentDebugID = task.implicitSlot;
1021
+ props = processServerComponentReturnValue(
1022
+ request,
1023
+ task,
1024
+ Component,
1025
+ props
1026
+ );
1027
+ Component = task.keyPath;
1028
+ prevThenableState = task.implicitSlot;
1045
1029
  null !== key
1046
- ? (task.keyPath =
1047
- null === prevThenableState ? key : prevThenableState + "," + key)
1048
- : null === prevThenableState && (task.implicitSlot = !0);
1049
- key = renderModelDestructive(request, task, emptyRoot, "", props);
1050
- task.keyPath = prevThenableState;
1051
- task.implicitSlot = componentDebugID;
1052
- return key;
1030
+ ? (task.keyPath = null === Component ? key : Component + "," + key)
1031
+ : null === Component && (task.implicitSlot = !0);
1032
+ request = renderModelDestructive(request, task, emptyRoot, "", props);
1033
+ task.keyPath = Component;
1034
+ task.implicitSlot = prevThenableState;
1035
+ return request;
1053
1036
  }
1054
1037
  function renderFragment(request, task, children) {
1055
1038
  for (var i = 0; i < children.length; i++) {
@@ -1252,9 +1235,6 @@
1252
1235
  ? "$-Infinity"
1253
1236
  : "$NaN";
1254
1237
  }
1255
- function serializeRowHeader(tag, id) {
1256
- return id.toString(16) + ":" + tag;
1257
- }
1258
1238
  function encodeReferenceChunk(request, id, reference) {
1259
1239
  request = stringify(reference);
1260
1240
  return id.toString(16) + ":" + request + "\n";
@@ -1305,7 +1285,7 @@
1305
1285
  request.pendingChunks++;
1306
1286
  var importId = request.nextChunkId++,
1307
1287
  json = stringify(clientReferenceMetadata),
1308
- processedChunk = serializeRowHeader("I", importId) + json + "\n";
1288
+ processedChunk = importId.toString(16) + ":I" + json + "\n";
1309
1289
  request.completedImportChunks.push(processedChunk);
1310
1290
  writtenClientReferences.set(clientReferenceKey, importId);
1311
1291
  return parent[0] === REACT_ELEMENT_TYPE && "1" === parentPropertyName
@@ -1399,24 +1379,20 @@
1399
1379
  );
1400
1380
  }
1401
1381
  function error(reason) {
1402
- if (!aborted) {
1403
- aborted = !0;
1404
- request.abortListeners.delete(abortBlob);
1405
- var digest = logRecoverableError(request, reason, newTask);
1406
- emitErrorChunk(request, newTask.id, digest, reason);
1407
- enqueueFlush(request);
1408
- reader.cancel(reason).then(error, error);
1409
- }
1382
+ aborted ||
1383
+ ((aborted = !0),
1384
+ request.abortListeners.delete(abortBlob),
1385
+ erroredTask(request, newTask, reason),
1386
+ enqueueFlush(request),
1387
+ reader.cancel(reason).then(error, error));
1410
1388
  }
1411
1389
  function abortBlob(reason) {
1412
- if (!aborted) {
1413
- aborted = !0;
1414
- request.abortListeners.delete(abortBlob);
1415
- var digest = logRecoverableError(request, reason, newTask);
1416
- emitErrorChunk(request, newTask.id, digest, reason);
1417
- enqueueFlush(request);
1418
- reader.cancel(reason).then(error, error);
1419
- }
1390
+ aborted ||
1391
+ ((aborted = !0),
1392
+ request.abortListeners.delete(abortBlob),
1393
+ erroredTask(request, newTask, reason),
1394
+ enqueueFlush(request),
1395
+ reader.cancel(reason).then(error, error));
1420
1396
  }
1421
1397
  var model = [blob.type],
1422
1398
  newTask = createTask(
@@ -1862,7 +1838,7 @@
1862
1838
  (stack = []);
1863
1839
  }
1864
1840
  digest = { digest: digest, message: message, stack: stack, env: env };
1865
- id = serializeRowHeader("E", id) + stringify(digest) + "\n";
1841
+ id = id.toString(16) + ":E" + stringify(digest) + "\n";
1866
1842
  request.completedErrorChunks.push(id);
1867
1843
  }
1868
1844
  function emitSymbolChunk(request, id, name) {
@@ -1884,7 +1860,7 @@
1884
1860
  value
1885
1861
  );
1886
1862
  });
1887
- id = serializeRowHeader("D", id) + debugInfo + "\n";
1863
+ id = id.toString(16) + ":D" + debugInfo + "\n";
1888
1864
  request.completedRegularChunks.push(id);
1889
1865
  }
1890
1866
  function outlineComponentInfo(request, componentInfo) {
@@ -2136,14 +2112,7 @@
2136
2112
  request.completedRegularChunks.push(json);
2137
2113
  return model;
2138
2114
  }
2139
- function emitConsoleChunk(
2140
- request,
2141
- id,
2142
- methodName,
2143
- owner,
2144
- stackTrace,
2145
- args
2146
- ) {
2115
+ function emitConsoleChunk(request, methodName, owner, stackTrace, args) {
2147
2116
  function replacer(parentPropertyName, value) {
2148
2117
  try {
2149
2118
  return renderConsoleValue(
@@ -2180,15 +2149,15 @@
2180
2149
  replacer
2181
2150
  );
2182
2151
  }
2183
- id = serializeRowHeader("W", id) + json + "\n";
2184
- request.completedRegularChunks.push(id);
2152
+ request.completedRegularChunks.push(":W" + json + "\n");
2185
2153
  }
2186
2154
  function forwardDebugInfo(request, id, debugInfo) {
2187
2155
  for (var i = 0; i < debugInfo.length; i++)
2188
2156
  request.pendingChunks++,
2189
- "string" === typeof debugInfo[i].name &&
2190
- outlineComponentInfo(request, debugInfo[i]),
2191
- emitDebugChunk(request, id, debugInfo[i]);
2157
+ "number" !== typeof debugInfo[i].time &&
2158
+ ("string" === typeof debugInfo[i].name &&
2159
+ outlineComponentInfo(request, debugInfo[i]),
2160
+ emitDebugChunk(request, id, debugInfo[i]));
2192
2161
  }
2193
2162
  function emitChunk(request, task, value) {
2194
2163
  var id = task.id;
@@ -2223,6 +2192,12 @@
2223
2192
  : ((value = stringify(value, task.toJSON)),
2224
2193
  emitModelChunk(request, task.id, value));
2225
2194
  }
2195
+ function erroredTask(request, task, error) {
2196
+ request.abortableTasks.delete(task);
2197
+ task.status = ERRORED$1;
2198
+ var digest = logRecoverableError(request, error, task);
2199
+ emitErrorChunk(request, task.id, digest, error);
2200
+ }
2226
2201
  function retryTask(request, task) {
2227
2202
  if (task.status === PENDING$1) {
2228
2203
  var prevDebugID = debugID;
@@ -2241,22 +2216,18 @@
2241
2216
  modelRoot = resolvedModel;
2242
2217
  task.keyPath = null;
2243
2218
  task.implicitSlot = !1;
2244
- if ("object" === typeof resolvedModel && null !== resolvedModel) {
2219
+ var currentEnv = (0, request.environmentName)();
2220
+ currentEnv !== task.environmentName &&
2221
+ (request.pendingChunks++,
2222
+ emitDebugChunk(request, task.id, { env: currentEnv }));
2223
+ if ("object" === typeof resolvedModel && null !== resolvedModel)
2245
2224
  request.writtenObjects.set(
2246
2225
  resolvedModel,
2247
2226
  serializeByValueID(task.id)
2248
- );
2249
- var currentEnv = (0, request.environmentName)();
2250
- currentEnv !== task.environmentName &&
2251
- (request.pendingChunks++,
2252
- emitDebugChunk(request, task.id, { env: currentEnv }));
2253
- emitChunk(request, task, resolvedModel);
2254
- } else {
2255
- var json = stringify(resolvedModel),
2256
- _currentEnv = (0, request.environmentName)();
2257
- _currentEnv !== task.environmentName &&
2258
- (request.pendingChunks++,
2259
- emitDebugChunk(request, task.id, { env: _currentEnv }));
2227
+ ),
2228
+ emitChunk(request, task, resolvedModel);
2229
+ else {
2230
+ var json = stringify(resolvedModel);
2260
2231
  emitModelChunk(request, task.id, json);
2261
2232
  }
2262
2233
  request.abortableTasks.delete(task);
@@ -2281,12 +2252,7 @@
2281
2252
  task.thenableState = getThenableStateAfterSuspending();
2282
2253
  var ping = task.ping;
2283
2254
  x.then(ping, ping);
2284
- } else {
2285
- request.abortableTasks.delete(task);
2286
- task.status = ERRORED$1;
2287
- var digest = logRecoverableError(request, x, task);
2288
- emitErrorChunk(request, task.id, digest, x);
2289
- }
2255
+ } else erroredTask(request, task, x);
2290
2256
  }
2291
2257
  } finally {
2292
2258
  debugID = prevDebugID;
@@ -3199,7 +3165,21 @@
3199
3165
  abort(request, Error(reason));
3200
3166
  };
3201
3167
  }
3202
- var util = require("util");
3168
+ function createFakeWritable(readable) {
3169
+ return {
3170
+ write: function (chunk) {
3171
+ return readable.push(chunk);
3172
+ },
3173
+ end: function () {
3174
+ readable.push(null);
3175
+ },
3176
+ destroy: function (error) {
3177
+ readable.destroy(error);
3178
+ }
3179
+ };
3180
+ }
3181
+ var stream = require("stream"),
3182
+ util = require("util");
3203
3183
  require("crypto");
3204
3184
  var async_hooks = require("async_hooks"),
3205
3185
  ReactDOM = require("react-dom"),
@@ -3456,7 +3436,7 @@
3456
3436
  var MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
3457
3437
  ASYNC_ITERATOR = Symbol.asyncIterator,
3458
3438
  SuspenseException = Error(
3459
- "Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`"
3439
+ "Suspense Exception: This is not a real error! It's an implementation detail of `use` to interrupt the current render. You must either rethrow it immediately, or move the `use` call outside of the `try/catch` block. Capturing without rethrowing will lead to unexpected behavior.\n\nTo handle async errors, wrap your component in an error boundary, or call the promise's `.catch` method and pass the result to `use`."
3460
3440
  ),
3461
3441
  suspendedThenable = null,
3462
3442
  currentRequest$1 = null,
@@ -3734,12 +3714,12 @@
3734
3714
  "React doesn't accept base64 encoded file uploads because we don't expect form data passed from a browser to ever encode data that way. If that's the wrong assumption, we can easily fix it."
3735
3715
  );
3736
3716
  pendingFiles++;
3737
- var JSCompiler_object_inline_chunks_141 = [];
3717
+ var JSCompiler_object_inline_chunks_143 = [];
3738
3718
  value.on("data", function (chunk) {
3739
- JSCompiler_object_inline_chunks_141.push(chunk);
3719
+ JSCompiler_object_inline_chunks_143.push(chunk);
3740
3720
  });
3741
3721
  value.on("end", function () {
3742
- var blob = new Blob(JSCompiler_object_inline_chunks_141, {
3722
+ var blob = new Blob(JSCompiler_object_inline_chunks_143, {
3743
3723
  type: mimeType
3744
3724
  });
3745
3725
  response._formData.append(name, blob, filename);
@@ -3829,4 +3809,45 @@
3829
3809
  }
3830
3810
  };
3831
3811
  };
3812
+ exports.unstable_prerenderToNodeStream = function (
3813
+ model,
3814
+ webpackMap,
3815
+ options
3816
+ ) {
3817
+ return new Promise(function (resolve, reject) {
3818
+ var request = new RequestInstance(
3819
+ PRERENDER,
3820
+ model,
3821
+ webpackMap,
3822
+ options ? options.onError : void 0,
3823
+ options ? options.identifierPrefix : void 0,
3824
+ options ? options.onPostpone : void 0,
3825
+ options ? options.temporaryReferences : void 0,
3826
+ options ? options.environmentName : void 0,
3827
+ options ? options.filterStackFrame : void 0,
3828
+ function () {
3829
+ var readable = new stream.Readable({
3830
+ read: function () {
3831
+ startFlowing(request, writable);
3832
+ }
3833
+ }),
3834
+ writable = createFakeWritable(readable);
3835
+ resolve({ prelude: readable });
3836
+ },
3837
+ reject
3838
+ );
3839
+ if (options && options.signal) {
3840
+ var signal = options.signal;
3841
+ if (signal.aborted) abort(request, signal.reason);
3842
+ else {
3843
+ var listener = function () {
3844
+ abort(request, signal.reason);
3845
+ signal.removeEventListener("abort", listener);
3846
+ };
3847
+ signal.addEventListener("abort", listener);
3848
+ }
3849
+ }
3850
+ startWork(request);
3851
+ });
3852
+ };
3832
3853
  })();