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.
@@ -295,14 +295,6 @@
295
295
  suspendedThenable = null;
296
296
  return thenable;
297
297
  }
298
- function prepareToUseHooksForComponent(
299
- prevThenableState,
300
- componentDebugInfo
301
- ) {
302
- thenableIndexCounter = 0;
303
- thenableState = prevThenableState;
304
- currentComponentDebugInfo = componentDebugInfo;
305
- }
306
298
  function getThenableStateAfterSuspending() {
307
299
  var state = thenableState || [];
308
300
  state._componentDebugInfo = currentComponentDebugInfo;
@@ -562,9 +554,8 @@
562
554
  1
563
555
  );
564
556
  request.pendingChunks++;
565
- var id = request.nextChunkId++,
566
- owner = resolveOwner();
567
- emitConsoleChunk(request, id, methodName, owner, stack, arguments);
557
+ var owner = resolveOwner();
558
+ emitConsoleChunk(request, methodName, owner, stack, arguments);
568
559
  }
569
560
  return originalMethod.apply(this, arguments);
570
561
  };
@@ -680,12 +671,7 @@
680
671
  newTask.id
681
672
  );
682
673
  case "rejected":
683
- task = thenable.reason;
684
- var digest = logRecoverableError(request, task, null);
685
- emitErrorChunk(request, newTask.id, digest, task);
686
- newTask.status = ERRORED$1;
687
- request.abortableTasks.delete(newTask);
688
- return newTask.id;
674
+ return erroredTask(request, newTask, thenable.reason), newTask.id;
689
675
  default:
690
676
  if (request.status === ABORTING)
691
677
  return (
@@ -715,13 +701,8 @@
715
701
  pingTask(request, newTask);
716
702
  },
717
703
  function (reason) {
718
- if (newTask.status === PENDING$1) {
719
- var _digest = logRecoverableError(request, reason, newTask);
720
- emitErrorChunk(request, newTask.id, _digest, reason);
721
- newTask.status = ERRORED$1;
722
- request.abortableTasks.delete(newTask);
723
- enqueueFlush(request);
724
- }
704
+ newTask.status === PENDING$1 &&
705
+ (erroredTask(request, newTask, reason), enqueueFlush(request));
725
706
  }
726
707
  );
727
708
  return newTask.id;
@@ -747,24 +728,20 @@
747
728
  }
748
729
  }
749
730
  function error(reason) {
750
- if (!aborted) {
751
- aborted = !0;
752
- request.abortListeners.delete(abortStream);
753
- var digest = logRecoverableError(request, reason, streamTask);
754
- emitErrorChunk(request, streamTask.id, digest, reason);
755
- enqueueFlush(request);
756
- reader.cancel(reason).then(error, error);
757
- }
731
+ aborted ||
732
+ ((aborted = !0),
733
+ request.abortListeners.delete(abortStream),
734
+ erroredTask(request, streamTask, reason),
735
+ enqueueFlush(request),
736
+ reader.cancel(reason).then(error, error));
758
737
  }
759
738
  function abortStream(reason) {
760
- if (!aborted) {
761
- aborted = !0;
762
- request.abortListeners.delete(abortStream);
763
- var digest = logRecoverableError(request, reason, streamTask);
764
- emitErrorChunk(request, streamTask.id, digest, reason);
765
- enqueueFlush(request);
766
- reader.cancel(reason).then(error, error);
767
- }
739
+ aborted ||
740
+ ((aborted = !0),
741
+ request.abortListeners.delete(abortStream),
742
+ erroredTask(request, streamTask, reason),
743
+ enqueueFlush(request),
744
+ reader.cancel(reason).then(error, error));
768
745
  }
769
746
  var supportsBYOB = stream.supportsBYOB;
770
747
  if (void 0 === supportsBYOB)
@@ -826,26 +803,22 @@
826
803
  }
827
804
  }
828
805
  function error(reason) {
829
- if (!aborted) {
830
- aborted = !0;
831
- request.abortListeners.delete(abortIterable);
832
- var digest = logRecoverableError(request, reason, streamTask);
833
- emitErrorChunk(request, streamTask.id, digest, reason);
834
- enqueueFlush(request);
806
+ aborted ||
807
+ ((aborted = !0),
808
+ request.abortListeners.delete(abortIterable),
809
+ erroredTask(request, streamTask, reason),
810
+ enqueueFlush(request),
835
811
  "function" === typeof iterator.throw &&
836
- iterator.throw(reason).then(error, error);
837
- }
812
+ iterator.throw(reason).then(error, error));
838
813
  }
839
814
  function abortIterable(reason) {
840
- if (!aborted) {
841
- aborted = !0;
842
- request.abortListeners.delete(abortIterable);
843
- var digest = logRecoverableError(request, reason, streamTask);
844
- emitErrorChunk(request, streamTask.id, digest, reason);
845
- enqueueFlush(request);
815
+ aborted ||
816
+ ((aborted = !0),
817
+ request.abortListeners.delete(abortIterable),
818
+ erroredTask(request, streamTask, reason),
819
+ enqueueFlush(request),
846
820
  "function" === typeof iterator.throw &&
847
- iterator.throw(reason).then(error, error);
848
- }
821
+ iterator.throw(reason).then(error, error));
849
822
  }
850
823
  var isIterator = iterable === iterator,
851
824
  streamTask = createTask(
@@ -869,9 +842,7 @@
869
842
  }
870
843
  function emitHint(request, code, model) {
871
844
  model = stringify(model);
872
- var id = request.nextChunkId++;
873
- code = serializeRowHeader("H" + code, id) + model + "\n";
874
- code = stringToChunk(code);
845
+ code = stringToChunk(":H" + code + model + "\n");
875
846
  request.completedHintChunks.push(code);
876
847
  enqueueFlush(request);
877
848
  }
@@ -921,6 +892,71 @@
921
892
  currentOwner = null;
922
893
  }
923
894
  }
895
+ function processServerComponentReturnValue(
896
+ request,
897
+ task,
898
+ Component,
899
+ result
900
+ ) {
901
+ if (
902
+ "object" !== typeof result ||
903
+ null === result ||
904
+ isClientReference(result)
905
+ )
906
+ return result;
907
+ if ("function" === typeof result.then)
908
+ return (
909
+ result.then(function (resolvedValue) {
910
+ "object" === typeof resolvedValue &&
911
+ null !== resolvedValue &&
912
+ resolvedValue.$$typeof === REACT_ELEMENT_TYPE &&
913
+ (resolvedValue._store.validated = 1);
914
+ }, voidHandler),
915
+ "fulfilled" === result.status
916
+ ? result.value
917
+ : createLazyWrapperAroundWakeable(result)
918
+ );
919
+ result.$$typeof === REACT_ELEMENT_TYPE && (result._store.validated = 1);
920
+ var iteratorFn = getIteratorFn(result);
921
+ if (iteratorFn) {
922
+ var multiShot = _defineProperty({}, Symbol.iterator, function () {
923
+ var iterator = iteratorFn.call(result);
924
+ iterator !== result ||
925
+ ("[object GeneratorFunction]" ===
926
+ Object.prototype.toString.call(Component) &&
927
+ "[object Generator]" ===
928
+ Object.prototype.toString.call(result)) ||
929
+ callWithDebugContextInDEV(request, task, function () {
930
+ console.error(
931
+ "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
932
+ );
933
+ });
934
+ return iterator;
935
+ });
936
+ multiShot._debugInfo = result._debugInfo;
937
+ return multiShot;
938
+ }
939
+ return "function" !== typeof result[ASYNC_ITERATOR] ||
940
+ ("function" === typeof ReadableStream &&
941
+ result instanceof ReadableStream)
942
+ ? result
943
+ : ((multiShot = _defineProperty({}, ASYNC_ITERATOR, function () {
944
+ var iterator = result[ASYNC_ITERATOR]();
945
+ iterator !== result ||
946
+ ("[object AsyncGeneratorFunction]" ===
947
+ Object.prototype.toString.call(Component) &&
948
+ "[object AsyncGenerator]" ===
949
+ Object.prototype.toString.call(result)) ||
950
+ callWithDebugContextInDEV(request, task, function () {
951
+ console.error(
952
+ "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
953
+ );
954
+ });
955
+ return iterator;
956
+ })),
957
+ (multiShot._debugInfo = result._debugInfo),
958
+ multiShot);
959
+ }
924
960
  function renderFunctionComponent(request, task, key, Component, props) {
925
961
  var prevThenableState = task.thenableState;
926
962
  task.thenableState = null;
@@ -943,7 +979,9 @@
943
979
  emitDebugChunk(request, componentDebugID, componentDebugInfo);
944
980
  task.environmentName = componentEnv;
945
981
  }
946
- prepareToUseHooksForComponent(prevThenableState, componentDebugInfo);
982
+ thenableIndexCounter = 0;
983
+ thenableState = prevThenableState;
984
+ currentComponentDebugInfo = componentDebugInfo;
947
985
  props = supportsComponentStorage
948
986
  ? componentStorage.run(
949
987
  componentDebugInfo,
@@ -962,76 +1000,21 @@
962
1000
  props.then(voidHandler, voidHandler),
963
1001
  null)
964
1002
  );
965
- if (
966
- "object" === typeof props &&
967
- null !== props &&
968
- !isClientReference(props)
969
- ) {
970
- if ("function" === typeof props.then) {
971
- prevThenableState = props;
972
- prevThenableState.then(function (resolvedValue) {
973
- "object" === typeof resolvedValue &&
974
- null !== resolvedValue &&
975
- resolvedValue.$$typeof === REACT_ELEMENT_TYPE &&
976
- (resolvedValue._store.validated = 1);
977
- }, voidHandler);
978
- if ("fulfilled" === prevThenableState.status)
979
- return prevThenableState.value;
980
- props = createLazyWrapperAroundWakeable(props);
981
- }
982
- var iteratorFn = getIteratorFn(props);
983
- if (iteratorFn) {
984
- var iterableChild = props;
985
- props = _defineProperty({}, Symbol.iterator, function () {
986
- var iterator = iteratorFn.call(iterableChild);
987
- iterator !== iterableChild ||
988
- ("[object GeneratorFunction]" ===
989
- Object.prototype.toString.call(Component) &&
990
- "[object Generator]" ===
991
- Object.prototype.toString.call(iterableChild)) ||
992
- callWithDebugContextInDEV(request, task, function () {
993
- console.error(
994
- "Returning an Iterator from a Server Component is not supported since it cannot be looped over more than once. "
995
- );
996
- });
997
- return iterator;
998
- });
999
- props._debugInfo = iterableChild._debugInfo;
1000
- } else if (
1001
- "function" !== typeof props[ASYNC_ITERATOR] ||
1002
- ("function" === typeof ReadableStream &&
1003
- props instanceof ReadableStream)
1004
- )
1005
- props.$$typeof === REACT_ELEMENT_TYPE && (props._store.validated = 1);
1006
- else {
1007
- var _iterableChild = props;
1008
- props = _defineProperty({}, ASYNC_ITERATOR, function () {
1009
- var iterator = _iterableChild[ASYNC_ITERATOR]();
1010
- iterator !== _iterableChild ||
1011
- ("[object AsyncGeneratorFunction]" ===
1012
- Object.prototype.toString.call(Component) &&
1013
- "[object AsyncGenerator]" ===
1014
- Object.prototype.toString.call(_iterableChild)) ||
1015
- callWithDebugContextInDEV(request, task, function () {
1016
- console.error(
1017
- "Returning an AsyncIterator from a Server Component is not supported since it cannot be looped over more than once. "
1018
- );
1019
- });
1020
- return iterator;
1021
- });
1022
- props._debugInfo = _iterableChild._debugInfo;
1023
- }
1024
- }
1025
- prevThenableState = task.keyPath;
1026
- componentDebugID = task.implicitSlot;
1003
+ props = processServerComponentReturnValue(
1004
+ request,
1005
+ task,
1006
+ Component,
1007
+ props
1008
+ );
1009
+ Component = task.keyPath;
1010
+ prevThenableState = task.implicitSlot;
1027
1011
  null !== key
1028
- ? (task.keyPath =
1029
- null === prevThenableState ? key : prevThenableState + "," + key)
1030
- : null === prevThenableState && (task.implicitSlot = !0);
1031
- key = renderModelDestructive(request, task, emptyRoot, "", props);
1032
- task.keyPath = prevThenableState;
1033
- task.implicitSlot = componentDebugID;
1034
- return key;
1012
+ ? (task.keyPath = null === Component ? key : Component + "," + key)
1013
+ : null === Component && (task.implicitSlot = !0);
1014
+ request = renderModelDestructive(request, task, emptyRoot, "", props);
1015
+ task.keyPath = Component;
1016
+ task.implicitSlot = prevThenableState;
1017
+ return request;
1035
1018
  }
1036
1019
  function renderFragment(request, task, children) {
1037
1020
  for (var i = 0; i < children.length; i++) {
@@ -1234,9 +1217,6 @@
1234
1217
  ? "$-Infinity"
1235
1218
  : "$NaN";
1236
1219
  }
1237
- function serializeRowHeader(tag, id) {
1238
- return id.toString(16) + ":" + tag;
1239
- }
1240
1220
  function encodeReferenceChunk(request, id, reference) {
1241
1221
  request = stringify(reference);
1242
1222
  id = id.toString(16) + ":" + request + "\n";
@@ -1288,7 +1268,7 @@
1288
1268
  request.pendingChunks++;
1289
1269
  var importId = request.nextChunkId++,
1290
1270
  json = stringify(clientReferenceMetadata),
1291
- row = serializeRowHeader("I", importId) + json + "\n",
1271
+ row = importId.toString(16) + ":I" + json + "\n",
1292
1272
  processedChunk = stringToChunk(row);
1293
1273
  request.completedImportChunks.push(processedChunk);
1294
1274
  writtenClientReferences.set(clientReferenceKey, importId);
@@ -1383,24 +1363,20 @@
1383
1363
  );
1384
1364
  }
1385
1365
  function error(reason) {
1386
- if (!aborted) {
1387
- aborted = !0;
1388
- request.abortListeners.delete(abortBlob);
1389
- var digest = logRecoverableError(request, reason, newTask);
1390
- emitErrorChunk(request, newTask.id, digest, reason);
1391
- enqueueFlush(request);
1392
- reader.cancel(reason).then(error, error);
1393
- }
1366
+ aborted ||
1367
+ ((aborted = !0),
1368
+ request.abortListeners.delete(abortBlob),
1369
+ erroredTask(request, newTask, reason),
1370
+ enqueueFlush(request),
1371
+ reader.cancel(reason).then(error, error));
1394
1372
  }
1395
1373
  function abortBlob(reason) {
1396
- if (!aborted) {
1397
- aborted = !0;
1398
- request.abortListeners.delete(abortBlob);
1399
- var digest = logRecoverableError(request, reason, newTask);
1400
- emitErrorChunk(request, newTask.id, digest, reason);
1401
- enqueueFlush(request);
1402
- reader.cancel(reason).then(error, error);
1403
- }
1374
+ aborted ||
1375
+ ((aborted = !0),
1376
+ request.abortListeners.delete(abortBlob),
1377
+ erroredTask(request, newTask, reason),
1378
+ enqueueFlush(request),
1379
+ reader.cancel(reason).then(error, error));
1404
1380
  }
1405
1381
  var model = [blob.type],
1406
1382
  newTask = createTask(
@@ -1851,7 +1827,7 @@
1851
1827
  (stack = []);
1852
1828
  }
1853
1829
  digest = { digest: digest, message: message, stack: stack, env: env };
1854
- id = serializeRowHeader("E", id) + stringify(digest) + "\n";
1830
+ id = id.toString(16) + ":E" + stringify(digest) + "\n";
1855
1831
  id = stringToChunk(id);
1856
1832
  request.completedErrorChunks.push(id);
1857
1833
  }
@@ -1875,7 +1851,7 @@
1875
1851
  value
1876
1852
  );
1877
1853
  });
1878
- id = serializeRowHeader("D", id) + debugInfo + "\n";
1854
+ id = id.toString(16) + ":D" + debugInfo + "\n";
1879
1855
  id = stringToChunk(id);
1880
1856
  request.completedRegularChunks.push(id);
1881
1857
  }
@@ -2133,14 +2109,7 @@
2133
2109
  request.completedRegularChunks.push(json);
2134
2110
  return model;
2135
2111
  }
2136
- function emitConsoleChunk(
2137
- request,
2138
- id,
2139
- methodName,
2140
- owner,
2141
- stackTrace,
2142
- args
2143
- ) {
2112
+ function emitConsoleChunk(request, methodName, owner, stackTrace, args) {
2144
2113
  function replacer(parentPropertyName, value) {
2145
2114
  try {
2146
2115
  return renderConsoleValue(
@@ -2177,16 +2146,16 @@
2177
2146
  replacer
2178
2147
  );
2179
2148
  }
2180
- id = serializeRowHeader("W", id) + json + "\n";
2181
- id = stringToChunk(id);
2182
- request.completedRegularChunks.push(id);
2149
+ methodName = stringToChunk(":W" + json + "\n");
2150
+ request.completedRegularChunks.push(methodName);
2183
2151
  }
2184
2152
  function forwardDebugInfo(request, id, debugInfo) {
2185
2153
  for (var i = 0; i < debugInfo.length; i++)
2186
2154
  request.pendingChunks++,
2187
- "string" === typeof debugInfo[i].name &&
2188
- outlineComponentInfo(request, debugInfo[i]),
2189
- emitDebugChunk(request, id, debugInfo[i]);
2155
+ "number" !== typeof debugInfo[i].time &&
2156
+ ("string" === typeof debugInfo[i].name &&
2157
+ outlineComponentInfo(request, debugInfo[i]),
2158
+ emitDebugChunk(request, id, debugInfo[i]));
2190
2159
  }
2191
2160
  function emitChunk(request, task, value) {
2192
2161
  var id = task.id;
@@ -2221,6 +2190,12 @@
2221
2190
  : ((value = stringify(value, task.toJSON)),
2222
2191
  emitModelChunk(request, task.id, value));
2223
2192
  }
2193
+ function erroredTask(request, task, error) {
2194
+ request.abortableTasks.delete(task);
2195
+ task.status = ERRORED$1;
2196
+ var digest = logRecoverableError(request, error, task);
2197
+ emitErrorChunk(request, task.id, digest, error);
2198
+ }
2224
2199
  function retryTask(request, task) {
2225
2200
  if (task.status === PENDING$1) {
2226
2201
  var prevDebugID = debugID;
@@ -2239,22 +2214,18 @@
2239
2214
  modelRoot = resolvedModel;
2240
2215
  task.keyPath = null;
2241
2216
  task.implicitSlot = !1;
2242
- if ("object" === typeof resolvedModel && null !== resolvedModel) {
2217
+ var currentEnv = (0, request.environmentName)();
2218
+ currentEnv !== task.environmentName &&
2219
+ (request.pendingChunks++,
2220
+ emitDebugChunk(request, task.id, { env: currentEnv }));
2221
+ if ("object" === typeof resolvedModel && null !== resolvedModel)
2243
2222
  request.writtenObjects.set(
2244
2223
  resolvedModel,
2245
2224
  serializeByValueID(task.id)
2246
- );
2247
- var currentEnv = (0, request.environmentName)();
2248
- currentEnv !== task.environmentName &&
2249
- (request.pendingChunks++,
2250
- emitDebugChunk(request, task.id, { env: currentEnv }));
2251
- emitChunk(request, task, resolvedModel);
2252
- } else {
2253
- var json = stringify(resolvedModel),
2254
- _currentEnv = (0, request.environmentName)();
2255
- _currentEnv !== task.environmentName &&
2256
- (request.pendingChunks++,
2257
- emitDebugChunk(request, task.id, { env: _currentEnv }));
2225
+ ),
2226
+ emitChunk(request, task, resolvedModel);
2227
+ else {
2228
+ var json = stringify(resolvedModel);
2258
2229
  emitModelChunk(request, task.id, json);
2259
2230
  }
2260
2231
  request.abortableTasks.delete(task);
@@ -2279,12 +2250,7 @@
2279
2250
  task.thenableState = getThenableStateAfterSuspending();
2280
2251
  var ping = task.ping;
2281
2252
  x.then(ping, ping);
2282
- } else {
2283
- request.abortableTasks.delete(task);
2284
- task.status = ERRORED$1;
2285
- var digest = logRecoverableError(request, x, task);
2286
- emitErrorChunk(request, task.id, digest, x);
2287
- }
2253
+ } else erroredTask(request, task, x);
2288
2254
  }
2289
2255
  } finally {
2290
2256
  debugID = prevDebugID;
@@ -2412,6 +2378,19 @@
2412
2378
  destination && flushCompletedChunks(request, destination);
2413
2379
  }, 0));
2414
2380
  }
2381
+ function startFlowing(request, destination) {
2382
+ if (request.status === CLOSING)
2383
+ (request.status = CLOSED),
2384
+ closeWithError(destination, request.fatalError);
2385
+ else if (request.status !== CLOSED && null === request.destination) {
2386
+ request.destination = destination;
2387
+ try {
2388
+ flushCompletedChunks(request, destination);
2389
+ } catch (error) {
2390
+ logRecoverableError(request, error, null), fatalError(request, error);
2391
+ }
2392
+ }
2393
+ }
2415
2394
  function abort(request, reason) {
2416
2395
  try {
2417
2396
  11 >= request.status && (request.status = ABORTING);
@@ -3477,7 +3456,7 @@
3477
3456
  var MAYBE_ITERATOR_SYMBOL = Symbol.iterator,
3478
3457
  ASYNC_ITERATOR = Symbol.asyncIterator,
3479
3458
  SuspenseException = Error(
3480
- "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`"
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`."
3481
3460
  ),
3482
3461
  suspendedThenable = null,
3483
3462
  currentRequest$1 = null,
@@ -3785,21 +3764,7 @@
3785
3764
  startWork(request);
3786
3765
  },
3787
3766
  pull: function (controller) {
3788
- if (request.status === CLOSING)
3789
- (request.status = CLOSED),
3790
- closeWithError(controller, request.fatalError);
3791
- else if (
3792
- request.status !== CLOSED &&
3793
- null === request.destination
3794
- ) {
3795
- request.destination = controller;
3796
- try {
3797
- flushCompletedChunks(request, controller);
3798
- } catch (error) {
3799
- logRecoverableError(request, error, null),
3800
- fatalError(request, error);
3801
- }
3802
- }
3767
+ startFlowing(request, controller);
3803
3768
  },
3804
3769
  cancel: function (reason) {
3805
3770
  request.destination = null;
@@ -3809,4 +3774,51 @@
3809
3774
  { highWaterMark: 0 }
3810
3775
  );
3811
3776
  };
3777
+ exports.unstable_prerender = function (model, webpackMap, options) {
3778
+ return new Promise(function (resolve, reject) {
3779
+ var request = new RequestInstance(
3780
+ PRERENDER,
3781
+ model,
3782
+ webpackMap,
3783
+ options ? options.onError : void 0,
3784
+ options ? options.identifierPrefix : void 0,
3785
+ options ? options.onPostpone : void 0,
3786
+ options ? options.temporaryReferences : void 0,
3787
+ options ? options.environmentName : void 0,
3788
+ options ? options.filterStackFrame : void 0,
3789
+ function () {
3790
+ var stream = new ReadableStream(
3791
+ {
3792
+ type: "bytes",
3793
+ start: function () {
3794
+ startWork(request);
3795
+ },
3796
+ pull: function (controller) {
3797
+ startFlowing(request, controller);
3798
+ },
3799
+ cancel: function (reason) {
3800
+ request.destination = null;
3801
+ abort(request, reason);
3802
+ }
3803
+ },
3804
+ { highWaterMark: 0 }
3805
+ );
3806
+ resolve({ prelude: stream });
3807
+ },
3808
+ reject
3809
+ );
3810
+ if (options && options.signal) {
3811
+ var signal = options.signal;
3812
+ if (signal.aborted) abort(request, signal.reason);
3813
+ else {
3814
+ var listener = function () {
3815
+ abort(request, signal.reason);
3816
+ signal.removeEventListener("abort", listener);
3817
+ };
3818
+ signal.addEventListener("abort", listener);
3819
+ }
3820
+ }
3821
+ startWork(request);
3822
+ });
3823
+ };
3812
3824
  })();