From f1897eb76f650e6d08a54ece59169842e5fd9172 Mon Sep 17 00:00:00 2001 From: Johannes Rieken Date: Fri, 24 Aug 2018 10:53:48 +0200 Subject: [PATCH] manually decode encoded hash-character and make it part of the path-component (not fragment), https://github.com/Microsoft/vscode/issues/56691 --- src/core/utils.ts | 2 +- src/css.build.js | 14 ++++++------ src/css.js | 4 ++-- src/loader.js | 54 +++++++++++++++++++++++------------------------ src/nls.build.js | 8 +++---- src/nls.js | 6 +++--- 6 files changed, 44 insertions(+), 44 deletions(-) diff --git a/src/core/utils.ts b/src/core/utils.ts index 4a5b47c..9266cff 100644 --- a/src/core/utils.ts +++ b/src/core/utils.ts @@ -10,7 +10,7 @@ namespace AMDLoader { * This method does not take care of / vs \ */ public static fileUriToFilePath(isWindows: boolean, uri: string): string { - uri = decodeURI(uri); + uri = decodeURI(uri).replace(/%23/g, '#'); if (isWindows) { if (/^file:\/\/\//.test(uri)) { // This is a URI without a hostname => return only the path segment diff --git a/src/css.build.js b/src/css.build.js index 4a617c5..046e04c 100644 --- a/src/css.build.js +++ b/src/css.build.js @@ -22,7 +22,7 @@ var CSSBuildLoaderPlugin; * Known issue: * - In IE there is no way to know if the CSS file loaded successfully or not. */ - var BrowserCSSLoader = /** @class */ (function () { + var BrowserCSSLoader = (function () { function BrowserCSSLoader() { this._pendingLoads = 0; } @@ -94,7 +94,7 @@ var CSSBuildLoaderPlugin; }; return BrowserCSSLoader; }()); - var NodeCSSLoader = /** @class */ (function () { + var NodeCSSLoader = (function () { function NodeCSSLoader() { this.fs = require.nodeRequire('fs'); } @@ -106,11 +106,11 @@ var CSSBuildLoaderPlugin; } externalCallback(contents); }; - NodeCSSLoader.BOM_CHAR_CODE = 65279; return NodeCSSLoader; }()); + NodeCSSLoader.BOM_CHAR_CODE = 65279; // ------------------------------ Finally, the plugin - var CSSPlugin = /** @class */ (function () { + var CSSPlugin = (function () { function CSSPlugin(cssLoader) { this.cssLoader = cssLoader; } @@ -169,12 +169,12 @@ var CSSBuildLoaderPlugin; CSSPlugin.prototype.getInlinedResources = function () { return global.cssInlinedResources || []; }; - CSSPlugin.BUILD_MAP = {}; - CSSPlugin.BUILD_PATH_MAP = {}; return CSSPlugin; }()); + CSSPlugin.BUILD_MAP = {}; + CSSPlugin.BUILD_PATH_MAP = {}; CSSBuildLoaderPlugin.CSSPlugin = CSSPlugin; - var Utilities = /** @class */ (function () { + var Utilities = (function () { function Utilities() { } Utilities.startsWith = function (haystack, needle) { diff --git a/src/css.js b/src/css.js index 4a2d5a4..7f29cd5 100644 --- a/src/css.js +++ b/src/css.js @@ -20,7 +20,7 @@ var CSSLoaderPlugin; * Known issue: * - In IE there is no way to know if the CSS file loaded successfully or not. */ - var BrowserCSSLoader = /** @class */ (function () { + var BrowserCSSLoader = (function () { function BrowserCSSLoader() { this._pendingLoads = 0; } @@ -93,7 +93,7 @@ var CSSLoaderPlugin; return BrowserCSSLoader; }()); // ------------------------------ Finally, the plugin - var CSSPlugin = /** @class */ (function () { + var CSSPlugin = (function () { function CSSPlugin() { this._cssLoader = new BrowserCSSLoader(); } diff --git a/src/loader.js b/src/loader.js index e4294a8..1688034 100644 --- a/src/loader.js +++ b/src/loader.js @@ -22,7 +22,7 @@ var _amdLoaderGlobal = this; var AMDLoader; (function (AMDLoader) { AMDLoader.global = _amdLoaderGlobal; - var Environment = /** @class */ (function () { + var Environment = (function () { function Environment() { this._detected = false; this._isWindows = false; @@ -93,7 +93,7 @@ var AMDLoader; *--------------------------------------------------------------------------------------------*/ var AMDLoader; (function (AMDLoader) { - var LoaderEvent = /** @class */ (function () { + var LoaderEvent = (function () { function LoaderEvent(type, detail, timestamp) { this.type = type; this.detail = detail; @@ -102,7 +102,7 @@ var AMDLoader; return LoaderEvent; }()); AMDLoader.LoaderEvent = LoaderEvent; - var LoaderEventRecorder = /** @class */ (function () { + var LoaderEventRecorder = (function () { function LoaderEventRecorder(loaderAvailableTimestamp) { this._events = [new LoaderEvent(1 /* LoaderAvailable */, '', loaderAvailableTimestamp)]; } @@ -115,7 +115,7 @@ var AMDLoader; return LoaderEventRecorder; }()); AMDLoader.LoaderEventRecorder = LoaderEventRecorder; - var NullLoaderEventRecorder = /** @class */ (function () { + var NullLoaderEventRecorder = (function () { function NullLoaderEventRecorder() { } NullLoaderEventRecorder.prototype.record = function (type, detail) { @@ -124,9 +124,9 @@ var AMDLoader; NullLoaderEventRecorder.prototype.getEvents = function () { return []; }; - NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder(); return NullLoaderEventRecorder; }()); + NullLoaderEventRecorder.INSTANCE = new NullLoaderEventRecorder(); AMDLoader.NullLoaderEventRecorder = NullLoaderEventRecorder; })(AMDLoader || (AMDLoader = {})); /*--------------------------------------------------------------------------------------------- @@ -135,14 +135,14 @@ var AMDLoader; *--------------------------------------------------------------------------------------------*/ var AMDLoader; (function (AMDLoader) { - var Utilities = /** @class */ (function () { + var Utilities = (function () { function Utilities() { } /** * This method does not take care of / vs \ */ Utilities.fileUriToFilePath = function (isWindows, uri) { - uri = decodeURI(uri); + uri = decodeURI(uri).replace(/%23/g, '#'); if (isWindows) { if (/^file:\/\/\//.test(uri)) { // This is a URI without a hostname => return only the path segment @@ -221,11 +221,11 @@ var AMDLoader; } return (this.HAS_PERFORMANCE_NOW ? AMDLoader.global.performance.now() : Date.now()); }; - Utilities.NEXT_ANONYMOUS_ID = 1; - Utilities.PERFORMANCE_NOW_PROBED = false; - Utilities.HAS_PERFORMANCE_NOW = false; return Utilities; }()); + Utilities.NEXT_ANONYMOUS_ID = 1; + Utilities.PERFORMANCE_NOW_PROBED = false; + Utilities.HAS_PERFORMANCE_NOW = false; AMDLoader.Utilities = Utilities; })(AMDLoader || (AMDLoader = {})); /*--------------------------------------------------------------------------------------------- @@ -234,7 +234,7 @@ var AMDLoader; *--------------------------------------------------------------------------------------------*/ var AMDLoader; (function (AMDLoader) { - var ConfigurationOptionsUtil = /** @class */ (function () { + var ConfigurationOptionsUtil = (function () { function ConfigurationOptionsUtil() { } /** @@ -340,7 +340,7 @@ var AMDLoader; return ConfigurationOptionsUtil; }()); AMDLoader.ConfigurationOptionsUtil = ConfigurationOptionsUtil; - var Configuration = /** @class */ (function () { + var Configuration = (function () { function Configuration(env, options) { this._env = env; this.options = ConfigurationOptionsUtil.mergeConfigurationOptions(options); @@ -551,7 +551,7 @@ var AMDLoader; /** * Load `scriptSrc` only once (avoid multiple