dcp-client 4.4.10-0 → 4.4.11-0

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.
@@ -58,7 +58,6 @@ self.wrapScriptLoading({ scriptName: 'access-lists', ringTransition: true }, fun
58
58
  'null',
59
59
  'Number',
60
60
  'Object',
61
- 'OffscreenCanvas',
62
61
  'onerror',
63
62
  'onmessage',
64
63
  'parseFloat',
@@ -126,190 +125,9 @@ self.wrapScriptLoading({ scriptName: 'access-lists', ringTransition: true }, fun
126
125
  // WebAssembly symbols
127
126
  'WebAssembly',
128
127
 
129
- // WebGL symbols
130
- 'WebGL2RenderingContext',
131
- 'WebGLTexture',
132
- // All webGPU symbols are allowed
133
- // some of these are actually just type aliases but inclusion shouldn't hurt
134
- 'GPU',
135
- 'GPUAdapter',
136
- 'GPUAdapterInfo',
137
- 'GPUAdapterLimits',
138
- 'GPUAdapterProperties',
139
- 'GPUAdapterRequestOptions',
140
- 'GPUAddressMode',
141
- 'GPUAutoLayoutMode',
142
- 'GPUBindGroup',
143
- 'GPUBindGroupDescriptor',
144
- 'GPUBindGroupEntry',
145
- 'GPUBindGroupLayout',
146
- 'GPUBindGroupLayoutDescriptor',
147
- 'GPUBindGroupLayoutEntry',
148
- 'GPUBindingCommandsMixin',
149
- 'GPUBindingResource',
150
- 'GPUBlendComponent',
151
- 'GPUBlendFactor',
152
- 'GPUBlendOperation',
153
- 'GPUBlendState',
154
- 'GPUBuffer',
155
- 'GPUBufferBinding',
156
- 'GPUBufferBindingLayout',
157
- 'GPUBufferBindingType',
158
- 'GPUBufferDescriptor',
159
- 'GPUBufferDynamicOffset',
160
- 'GPUBufferMapState',
161
- 'GPUBufferUsage',
162
- 'GPUBufferUsageFlags',
163
- 'GPUCanvasAlphaMode',
164
- 'GPUCanvasConfiguration',
165
- 'GPUCanvasContext',
166
- 'GPUColor',
167
- 'GPUColorDict',
168
- 'GPUColorTargetState',
169
- 'GPUColorWrite',
170
- 'GPUColorWriteFlags',
171
- 'GPUCommandBuffer',
172
- 'GPUCommandBufferDescriptor',
173
- 'GPUCommandEncoder',
174
- 'GPUCommandEncoderDescriptor',
175
- 'GPUCommandsMixin',
176
- 'GPUCompareFunction',
177
- 'GPUCompilationInfo',
178
- 'GPUCompilationMessage',
179
- 'GPUCompilationMessageType',
180
- 'GPUComputePassDescriptor',
181
- 'GPUComputePassEncoder',
182
- 'GPUComputePassTimestampLocation',
183
- 'GPUComputePassTimestampWrite',
184
- 'GPUComputePassTimestampWrites',
185
- 'GPUComputePipeline',
186
- 'GPUComputePipelineDescriptor',
187
- 'GPUCullMode',
188
- 'GPUDebugCommandsMixin',
189
- 'GPUDepthBias',
190
- 'GPUDepthStencilState',
191
- 'GPUDevice',
192
- 'GPUDeviceDescriptor',
193
- 'GPUDeviceLostInfo',
194
- 'GPUDeviceLostReason',
195
- 'GPUError',
196
- 'GPUErrorFilter',
197
- 'GPUExtent3D',
198
- 'GPUExtent3DDict',
199
- 'GPUExtent3DDictStrict',
200
- 'GPUExtent3DStrict',
201
- 'GPUExternalTexture',
202
- 'GPUExternalTextureBindingLayout',
203
- 'GPUExternalTextureDescriptor',
204
- 'GPUFeatureName',
205
- 'GPUFilterMode',
206
- 'GPUFlagsConstant',
207
- 'GPUFragmentState',
208
- 'GPUFrontFace',
209
- 'GPUImageCopyBuffer',
210
- 'GPUImageCopyExternalImage',
211
- 'GPUImageCopyTexture',
212
- 'GPUImageCopyTextureTagged',
213
- 'GPUImageDataLayout',
214
- 'GPUIndex32',
215
- 'GPUIndexFormat',
216
- 'GPUIntegerCoordinate',
217
- 'GPUInternalError',
218
- 'GPULoadOp',
219
- 'GPUMapMode',
220
- 'GPUMapModeFlags',
221
- 'GPUMipmapFilterMode',
222
- 'GPUMultisampleState',
223
- 'GPUObjectBase',
224
- 'GPUObjectDescriptorBase',
225
- 'GPUOrigin2D',
226
- 'GPUOrigin2DDict',
227
- 'GPUOrigin2DDictStrict',
228
- 'GPUOrigin2DStrict',
229
- 'GPUOrigin3D',
230
- 'GPUOrigin3DDict',
231
- 'GPUOutOfMemoryError',
232
- 'GPUPipelineBase',
233
- 'GPUPipelineConstantValue',
234
- 'GPUPipelineDescriptorBase',
235
- 'GPUPipelineError',
236
- 'GPUPipelineErrorInit',
237
- 'GPUPipelineErrorReason',
238
- 'GPUPipelineLayout',
239
- 'GPUPipelineLayoutDescriptor',
240
- 'GPUPowerPreference',
241
- 'GPUPrimitiveState',
242
- 'GPUPrimitiveTopology',
243
- 'GPUProgrammableStage',
244
- 'GPUQuerySet',
245
- 'GPUQuerySetDescriptor',
246
- 'GPUQueryType',
247
- 'GPUQueue',
248
- 'GPUQueueDescriptor',
249
- 'GPURenderBundle',
250
- 'GPURenderBundleDescriptor',
251
- 'GPURenderBundleEncoder',
252
- 'GPURenderBundleEncoderDescriptor',
253
- 'GPURenderCommandsMixin',
254
- 'GPURenderPassColorAttachment',
255
- 'GPURenderPassDepthStencilAttachment',
256
- 'GPURenderPassDescriptor',
257
- 'GPURenderPassEncoder',
258
- 'GPURenderPassLayout',
259
- 'GPURenderPassTimestampLocation',
260
- 'GPURenderPassTimestampWrite',
261
- 'GPURenderPassTimestampWrites',
262
- 'GPURenderPipeline',
263
- 'GPURenderPipelineDescriptor',
264
- 'GPURequestAdapterOptions',
265
- 'GPUSampleMask',
266
- 'GPUSampler',
267
- 'GPUSamplerBindingLayout',
268
- 'GPUSamplerBindingType',
269
- 'GPUSamplerDescriptor',
270
- 'GPUShaderModule',
271
- 'GPUShaderModuleCompilationHint',
272
- 'GPUShaderModuleDescriptor',
273
- 'GPUShaderStage',
274
- 'GPUShaderStageFlags',
275
- 'GPUSignedOffset32',
276
- 'GPUSize32',
277
- 'GPUSize64',
278
- 'GPUStencilFaceState',
279
- 'GPUStencilOperation',
280
- 'GPUStencilValue',
281
- 'GPUStorageTextureAccess',
282
- 'GPUStorageTextureBindingLayout',
283
- 'GPUStoreOp',
284
- 'GPUSupportedFeatures',
285
- 'GPUSupportedLimits',
286
- 'GPUTexture',
287
- 'GPUTextureAspect',
288
- 'GPUTextureBindingLayout',
289
- 'GPUTextureDescriptor',
290
- 'GPUTextureDimension',
291
- 'GPUTextureFormat',
292
- 'GPUTextureSampleType',
293
- 'GPUTextureUsage',
294
- 'GPUTextureUsageFlags',
295
- 'GPUTextureView',
296
- 'GPUTextureViewDescriptor',
297
- 'GPUTextureViewDimension',
298
- 'GPUUncapturedErrorEvent',
299
- 'GPUUncapturedErrorEventInit',
300
- 'GPUValidationError',
301
- 'GPUVertexAttribute',
302
- 'GPUVertexBufferLayout',
303
- 'GPUVertexFormat',
304
- 'GPUVertexState',
305
- 'GPUVertexStepMode',
306
128
  'HTMLCanvasElement',
307
129
  'HTMLVideoElement',
308
130
  'Navigator',
309
- 'NavigatorGPU',
310
- 'OffscreenCanvas',
311
- 'WebGPUWindow',
312
- 'WGSLLanguageFeatures',
313
131
  'WorkerNavigator',
314
132
 
315
133
 
@@ -323,6 +141,21 @@ self.wrapScriptLoading({ scriptName: 'access-lists', ringTransition: true }, fun
323
141
  'removeEventListener',
324
142
  ]);
325
143
 
144
+ const navigatorAllowList = new Set([
145
+ // Deprecated but kept for compatibility
146
+ 'appCodeName',
147
+ 'appName',
148
+ 'appVersion',
149
+ 'platform',
150
+ 'product',
151
+
152
+ 'userAgent',
153
+ 'deviceMemory',
154
+ 'hardwareConcurrency',
155
+ 'onLine',
156
+ 'userAgentData',
157
+ ]);
158
+
326
159
  // Origin time for performance polyfill
327
160
  const pt0 = new Date().getTime();
328
161
 
@@ -809,25 +642,201 @@ self.wrapScriptLoading({ scriptName: 'access-lists', ringTransition: true }, fun
809
642
  }
810
643
  }
811
644
 
645
+ const webGLSymbols = [
646
+ 'WebGL2RenderingContext',
647
+ 'WebGLTexture',
648
+ 'OffscreenCanvas',
649
+ ];
812
650
 
813
- // Set values to true to disallow access to symbols
814
- const blockList = {
815
- OffscreenCanvas: false,
816
- WebGPUWindow: false,
817
- GPU: false,
818
- };
651
+ const webGPUSymbols = [
652
+ 'WebGPUWindow',
653
+ 'GPU',
654
+ 'GPU',
655
+ 'GPUAdapter',
656
+ 'GPUAdapterInfo',
657
+ 'GPUAdapterLimits',
658
+ 'GPUAdapterProperties',
659
+ 'GPUAdapterRequestOptions',
660
+ 'GPUAddressMode',
661
+ 'GPUAutoLayoutMode',
662
+ 'GPUBindGroup',
663
+ 'GPUBindGroupDescriptor',
664
+ 'GPUBindGroupEntry',
665
+ 'GPUBindGroupLayout',
666
+ 'GPUBindGroupLayoutDescriptor',
667
+ 'GPUBindGroupLayoutEntry',
668
+ 'GPUBindingCommandsMixin',
669
+ 'GPUBindingResource',
670
+ 'GPUBlendComponent',
671
+ 'GPUBlendFactor',
672
+ 'GPUBlendOperation',
673
+ 'GPUBlendState',
674
+ 'GPUBuffer',
675
+ 'GPUBufferBinding',
676
+ 'GPUBufferBindingLayout',
677
+ 'GPUBufferBindingType',
678
+ 'GPUBufferDescriptor',
679
+ 'GPUBufferDynamicOffset',
680
+ 'GPUBufferMapState',
681
+ 'GPUBufferUsage',
682
+ 'GPUBufferUsageFlags',
683
+ 'GPUCanvasAlphaMode',
684
+ 'GPUCanvasConfiguration',
685
+ 'GPUCanvasContext',
686
+ 'GPUColor',
687
+ 'GPUColorDict',
688
+ 'GPUColorTargetState',
689
+ 'GPUColorWrite',
690
+ 'GPUColorWriteFlags',
691
+ 'GPUCommandBuffer',
692
+ 'GPUCommandBufferDescriptor',
693
+ 'GPUCommandEncoder',
694
+ 'GPUCommandEncoderDescriptor',
695
+ 'GPUCommandsMixin',
696
+ 'GPUCompareFunction',
697
+ 'GPUCompilationInfo',
698
+ 'GPUCompilationMessage',
699
+ 'GPUCompilationMessageType',
700
+ 'GPUComputePassDescriptor',
701
+ 'GPUComputePassEncoder',
702
+ 'GPUComputePassTimestampLocation',
703
+ 'GPUComputePassTimestampWrite',
704
+ 'GPUComputePassTimestampWrites',
705
+ 'GPUComputePipeline',
706
+ 'GPUComputePipelineDescriptor',
707
+ 'GPUCullMode',
708
+ 'GPUDebugCommandsMixin',
709
+ 'GPUDepthBias',
710
+ 'GPUDepthStencilState',
711
+ 'GPUDevice',
712
+ 'GPUDeviceDescriptor',
713
+ 'GPUDeviceLostInfo',
714
+ 'GPUDeviceLostReason',
715
+ 'GPUError',
716
+ 'GPUErrorFilter',
717
+ 'GPUExtent3D',
718
+ 'GPUExtent3DDict',
719
+ 'GPUExtent3DDictStrict',
720
+ 'GPUExtent3DStrict',
721
+ 'GPUExternalTexture',
722
+ 'GPUExternalTextureBindingLayout',
723
+ 'GPUExternalTextureDescriptor',
724
+ 'GPUFeatureName',
725
+ 'GPUFilterMode',
726
+ 'GPUFlagsConstant',
727
+ 'GPUFragmentState',
728
+ 'GPUFrontFace',
729
+ 'GPUImageCopyBuffer',
730
+ 'GPUImageCopyExternalImage',
731
+ 'GPUImageCopyTexture',
732
+ 'GPUImageCopyTextureTagged',
733
+ 'GPUImageDataLayout',
734
+ 'GPUIndex32',
735
+ 'GPUIndexFormat',
736
+ 'GPUIntegerCoordinate',
737
+ 'GPUInternalError',
738
+ 'GPULoadOp',
739
+ 'GPUMapMode',
740
+ 'GPUMapModeFlags',
741
+ 'GPUMipmapFilterMode',
742
+ 'GPUMultisampleState',
743
+ 'GPUObjectBase',
744
+ 'GPUObjectDescriptorBase',
745
+ 'GPUOrigin2D',
746
+ 'GPUOrigin2DDict',
747
+ 'GPUOrigin2DDictStrict',
748
+ 'GPUOrigin2DStrict',
749
+ 'GPUOrigin3D',
750
+ 'GPUOrigin3DDict',
751
+ 'GPUOutOfMemoryError',
752
+ 'GPUPipelineBase',
753
+ 'GPUPipelineConstantValue',
754
+ 'GPUPipelineDescriptorBase',
755
+ 'GPUPipelineError',
756
+ 'GPUPipelineErrorInit',
757
+ 'GPUPipelineErrorReason',
758
+ 'GPUPipelineLayout',
759
+ 'GPUPipelineLayoutDescriptor',
760
+ 'GPUPowerPreference',
761
+ 'GPUPrimitiveState',
762
+ 'GPUPrimitiveTopology',
763
+ 'GPUProgrammableStage',
764
+ 'GPUQuerySet',
765
+ 'GPUQuerySetDescriptor',
766
+ 'GPUQueryType',
767
+ 'GPUQueue',
768
+ 'GPUQueueDescriptor',
769
+ 'GPURenderBundle',
770
+ 'GPURenderBundleDescriptor',
771
+ 'GPURenderBundleEncoder',
772
+ 'GPURenderBundleEncoderDescriptor',
773
+ 'GPURenderCommandsMixin',
774
+ 'GPURenderPassColorAttachment',
775
+ 'GPURenderPassDepthStencilAttachment',
776
+ 'GPURenderPassDescriptor',
777
+ 'GPURenderPassEncoder',
778
+ 'GPURenderPassLayout',
779
+ 'GPURenderPassTimestampLocation',
780
+ 'GPURenderPassTimestampWrite',
781
+ 'GPURenderPassTimestampWrites',
782
+ 'GPURenderPipeline',
783
+ 'GPURenderPipelineDescriptor',
784
+ 'GPURequestAdapterOptions',
785
+ 'GPUSampleMask',
786
+ 'GPUSampler',
787
+ 'GPUSamplerBindingLayout',
788
+ 'GPUSamplerBindingType',
789
+ 'GPUSamplerDescriptor',
790
+ 'GPUShaderModule',
791
+ 'GPUShaderModuleCompilationHint',
792
+ 'GPUShaderModuleDescriptor',
793
+ 'GPUShaderStage',
794
+ 'GPUShaderStageFlags',
795
+ 'GPUSignedOffset32',
796
+ 'GPUSize32',
797
+ 'GPUSize64',
798
+ 'GPUStencilFaceState',
799
+ 'GPUStencilOperation',
800
+ 'GPUStencilValue',
801
+ 'GPUStorageTextureAccess',
802
+ 'GPUStorageTextureBindingLayout',
803
+ 'GPUStoreOp',
804
+ 'GPUSupportedFeatures',
805
+ 'GPUSupportedLimits',
806
+ 'GPUTexture',
807
+ 'GPUTextureAspect',
808
+ 'GPUTextureBindingLayout',
809
+ 'GPUTextureDescriptor',
810
+ 'GPUTextureDimension',
811
+ 'GPUTextureFormat',
812
+ 'GPUTextureSampleType',
813
+ 'GPUTextureUsage',
814
+ 'GPUTextureUsageFlags',
815
+ 'GPUTextureView',
816
+ 'GPUTextureViewDescriptor',
817
+ 'GPUTextureViewDimension',
818
+ 'GPUUncapturedErrorEvent',
819
+ 'GPUUncapturedErrorEventInit',
820
+ 'GPUValidationError',
821
+ 'GPUVertexAttribute',
822
+ 'GPUVertexBufferLayout',
823
+ 'GPUVertexFormat',
824
+ 'GPUVertexState',
825
+ 'GPUVertexStepMode',
826
+ 'WGSLLanguageFeatures',
827
+ ];
828
+ // elements to be blocked from the navigator
829
+ const navigatorWebGPUSymbols = [
830
+ 'gpu',
831
+ ];
819
832
 
820
833
  /**
821
- * Applies a allow list and a block list of properties to an object. After this function, if someone tries
822
- * to access non-allowed or blocked properties, a warning is logged and it will return undefined. The allow
823
- * list and block list are not mutually exclusive. If an item is in both lists, then the block list will be
824
- * enacted upon it.
825
- *
834
+ * Applies a allow list to an object. After this function, non-allowed properties will
835
+ * appear undefined.
826
836
  * @param {object} obj - The object, which will have the allow list applied to its properties.
827
837
  * @param {Set} allowList - A set of properties to allow people to access.
828
- * @param {Object} blockList - An object of property names mapping to booleans to indicate whether access is allowed or not.
829
838
  */
830
- function applyAccessLists(obj, allowList, blockList = {}) {
839
+ function applyAccessLists(obj, allowList) {
831
840
  if (!obj) { return; }
832
841
  Object.getOwnPropertyNames(obj).forEach(function (prop) {
833
842
  if (Object.getOwnPropertyDescriptor(obj, prop)?.configurable) {
@@ -847,24 +856,6 @@ self.wrapScriptLoading({ scriptName: 'access-lists', ringTransition: true }, fun
847
856
  },
848
857
  configurable: false
849
858
  });
850
- } else if (blockList.hasOwnProperty(prop)) {
851
- let isSet = false;
852
- let blocked = blockList[prop];
853
- let propValue = obj[prop];
854
- Object.defineProperty(obj, prop, {
855
- get: function () {
856
- if (blocked && !isSet) {
857
- return undefined;
858
- } else {
859
- return propValue;
860
- }
861
- },
862
- set: function (value) {
863
- propValue = value;
864
- isSet = true;
865
- },
866
- configurable: false
867
- });
868
859
  }
869
860
  }
870
861
 
@@ -894,9 +885,10 @@ self.wrapScriptLoading({ scriptName: 'access-lists', ringTransition: true }, fun
894
885
  }
895
886
 
896
887
  /**
897
- * Applies the allowList and blockList to all global scopes.
888
+ * Applies the allowList.
898
889
  * This must be called after the requirements are assigned to the sandbox
899
- * so that the blockList is accessible to modify w/o adding it to the allowList.
890
+ * so that symbols only accessible if specific requirements are set (such as webGPU)
891
+ * can be added to the allowList.
900
892
  */
901
893
  function applyAllAccessLists() {
902
894
  // We need to apply the access lists to global, and the entirety of global's prototype chain
@@ -904,19 +896,42 @@ self.wrapScriptLoading({ scriptName: 'access-lists', ringTransition: true }, fun
904
896
 
905
897
  var global = typeof globalThis === 'undefined' ? self : globalThis;
906
898
  for (let g = global; Object.getPrototypeOf(g); g = Object.getPrototypeOf(g))
907
- applyAccessLists(g, allowList, blockList);
899
+ applyAccessLists(g, allowList);
908
900
 
909
901
  if (typeof navigator === 'undefined')
910
- navigator = { userAgent: 'not a browser' };
911
- else
902
+ global.navigator = { userAgent: 'not a browser' };
903
+
904
+ /**
905
+ * Replace the navigator object with a polyfill that only has symbols we are explicitly allowing access to.
906
+ * On web workers, the navigator is an attribute of the WorkerGlobalScope interface, which is inherited by the
907
+ * DedicatedWorkerGlobalScope, the global context (globalThis) in the web worker.
908
+ * In the native evaluator, the navigator is an attribute of the global object directly.
909
+ *
910
+ * On all tested platforms, navigator is non-writable, but is configurable, so we can delete & redefine the
911
+ * navigator. In the case where navigator is also non-configurable, we will fall back on applying the access list
912
+ * to the original navigator, to only allow access to allowed properties.
913
+ */
914
+ var owner;
915
+ if (Object.getOwnPropertyDescriptor(global, 'navigator')) // native
916
+ owner = global;
917
+ else // web worker
918
+ owner = Object.getPrototypeOf(Object.getPrototypeOf(global));
919
+
920
+ const navigatorDescriptor = Object.getOwnPropertyDescriptor(owner, 'navigator');
921
+
922
+ if (!navigatorDescriptor?.configurable)
912
923
  {
913
- const navPolyFill = {
914
- userAgent: navigator.userAgent || 'not a browser',
915
- };
916
- if (navigator.gpu)
917
- navPolyFill.gpu = navigator.gpu;
918
- navigator = navPolyFill;
924
+ for (let n = navigator; Object.getPrototypeOf(n); n = Object.getPrototypeOf(n))
925
+ applyAccessLists(n, navigatorAllowList);
926
+ return;
919
927
  }
928
+
929
+ const polyNavigator = {};
930
+ for (let prop of navigatorAllowList)
931
+ polyNavigator[prop] = navigator[prop];
932
+
933
+ delete owner.navigator;
934
+ owner.navigator = polyNavigator;
920
935
  }
921
936
 
922
937
  /* Polyfill section of workerBootstrap */
@@ -965,9 +980,18 @@ self.wrapScriptLoading({ scriptName: 'access-lists', ringTransition: true }, fun
965
980
  // apply restrictions to the environment based on the requirements.
966
981
  // Assume the scheduler gave us a nicely-shaped req object.
967
982
  const requirements = event.requirements;
968
- blockList.OffscreenCanvas = !requirements.environment.offscreenCanvas;
969
- blockList.WebGPUWindow = !requirements.environment.webgpu;
970
- blockList.GPU = !requirements.environment.webgpu;
983
+ if (requirements.environment.offscreenCanvas)
984
+ {
985
+ for (let symbol of webGLSymbols)
986
+ allowList.add(symbol);
987
+ }
988
+ if (requirements.environment.webgpu && !protectedStorage.forceDisableWebGPU)
989
+ {
990
+ for (let symbol of webGPUSymbols)
991
+ allowList.add(symbol);
992
+ for (let symbol of navigatorWebGPUSymbols)
993
+ navigatorAllowList.add(symbol)
994
+ }
971
995
 
972
996
  if (event.worktime && protectedStorage.worktimeGlobals[event.worktime])
973
997
  allowWorktimeSymbols(protectedStorage.worktimeGlobals[event.worktime]);
@@ -145,8 +145,22 @@ self.wrapScriptLoading({ scriptName: 'bootstrap', finalScript: true }, function
145
145
  });
146
146
  }
147
147
 
148
- function workerBootstrap$work$reject(reason) {
149
- protectedStorage.workRejectReason = reason; // Memoize reason
148
+ /**
149
+ * Syntax: work.reject(stringReason, retries = 0)
150
+ * - Old work.reject(stringReason) is equivalent to work.reject(stringReason, 0)
151
+ * - Old work.reject(false) is essentially equivalent to work.reject('false', 1)
152
+ */
153
+ function workerBootstrap$work$reject(reason, retries) {
154
+ if (typeof retries === 'undefined')
155
+ {
156
+ retries = 0; // Default
157
+ if (reason === false) // Back-compat
158
+ {
159
+ retries = 1;
160
+ reason = 'false';
161
+ }
162
+ }
163
+ protectedStorage.workRejectState = { reason, retries };
150
164
  throw Symbol.for('workReject');
151
165
  }
152
166
 
@@ -358,12 +358,11 @@ prepPyodide`);
358
358
  catch(e){};
359
359
  }
360
360
 
361
- if (error === Symbol.for('workReject')) {
362
- reportTimes(metrics);
363
- ring3PostMessage({ request: 'workReject', reason: protectedStorage.workRejectReason });
364
- }
361
+ reportTimes(metrics); // Report metrics for both 'workReject' and 'workError'.
362
+ if (error === Symbol.for('workReject'))
363
+ ring3PostMessage({ request: 'workReject', workRejectData: protectedStorage.workRejectState });
365
364
  else
366
- ring3PostMessage({request: 'workError', error: err});
365
+ ring3PostMessage({ request: 'workError', error: err });
367
366
  }
368
367
 
369
368
  /**
@@ -48,7 +48,9 @@ self.wrapScriptLoading({ scriptName: 'calculate-capabilities' }, function calcul
48
48
  return arguments[0];
49
49
  });`
50
50
 
51
- webgpu = Boolean(globalThis.navigator?.gpu);
51
+ await protectedStorage.webGPUInitialization();
52
+ if (!protectedStorage.forceDisableWebGPU)
53
+ webgpu = Boolean(globalThis.navigator?.gpu);
52
54
 
53
55
  if (webgpu) {
54
56
  try {