diff --git a/CHANGES.md b/CHANGES.md index 64bd93315ff2..5242b7be96ab 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -19,6 +19,7 @@ Change Log * The `PostProcessStageLibrary.createBlackAndWhiteStage` and `PostProcessStageLibrary.createSilhouetteStage` have per-feature support. ##### Fixes :wrench: +* Fixed a bug that caused Cesium to be unable to load local resources in Electron. [#6726](https://github.com/AnalyticalGraphicsInc/cesium/pull/6726) * Fixed a bug causing crashes with custom vertex attributes on `Geometry` crossing the IDL. Attributes will be barycentrically interpolated. [#6644](https://github.com/AnalyticalGraphicsInc/cesium/pull/6644) * Fixed a bug causing Point Cloud tiles with unsigned int batch-ids to not load. [#6666](https://github.com/AnalyticalGraphicsInc/cesium/pull/6666) * Fixed a bug with Draco encoded i3dm tiles, and loading two Draco models with the same url. [#6668](https://github.com/AnalyticalGraphicsInc/cesium/issues/6668) diff --git a/Source/Core/FeatureDetection.js b/Source/Core/FeatureDetection.js index 4d6631556557..8f34384c782a 100644 --- a/Source/Core/FeatureDetection.js +++ b/Source/Core/FeatureDetection.js @@ -163,14 +163,6 @@ define([ return isFirefox() && firefoxVersionResult; } - var isNodeJsResult; - function isNodeJs() { - if (!defined(isNodeJsResult)) { - isNodeJsResult = typeof process === 'object' && Object.prototype.toString.call(process) === '[object process]'; // eslint-disable-line - } - return isNodeJsResult; - } - var hasPointerEvents; function supportsPointerEvents() { if (!defined(hasPointerEvents)) { @@ -238,7 +230,6 @@ define([ isFirefox : isFirefox, firefoxVersion : firefoxVersion, isWindows : isWindows, - isNodeJs: isNodeJs, hardwareConcurrency : defaultValue(theNavigator.hardwareConcurrency, 3), supportsPointerEvents : supportsPointerEvents, supportsImageRenderingPixelated: supportsImageRenderingPixelated, diff --git a/Source/Core/Resource.js b/Source/Core/Resource.js index 5fc104794dd4..264f0ab3a0d7 100644 --- a/Source/Core/Resource.js +++ b/Source/Core/Resource.js @@ -1834,6 +1834,7 @@ define([ }).end(); } + var noXMLHttpRequest = typeof XMLHttpRequest === 'undefined'; Resource._Implementations.loadWithXhr = function(url, responseType, method, data, headers, deferred, overrideMimeType) { var dataUriRegexResult = dataUriRegex.exec(url); if (dataUriRegexResult !== null) { @@ -1841,7 +1842,7 @@ define([ return; } - if (FeatureDetection.isNodeJs()) { + if (noXMLHttpRequest) { loadWithHttpRequest(url, responseType, method, data, headers, deferred, overrideMimeType); return; } diff --git a/Specs/Core/FeatureDetectionSpec.js b/Specs/Core/FeatureDetectionSpec.js index 869cccdf7aae..af0087a18f9c 100644 --- a/Specs/Core/FeatureDetectionSpec.js +++ b/Specs/Core/FeatureDetectionSpec.js @@ -115,8 +115,4 @@ defineSuite([ expect(FeatureDetection.imageRenderingValue()).not.toBeDefined(); } }); - - it('detects Node.js', function() { - expect(FeatureDetection.isNodeJs()).toBe(false); - }); });