Skip to content

Commit

Permalink
manually decode encoded hash-character and make it part of the path-c…
Browse files Browse the repository at this point in the history
…omponent (not fragment), microsoft/vscode#56691
  • Loading branch information
jrieken committed Aug 24, 2018
1 parent 818b11e commit f1897eb
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 44 deletions.
2 changes: 1 addition & 1 deletion src/core/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 7 additions & 7 deletions src/css.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -94,7 +94,7 @@ var CSSBuildLoaderPlugin;
};
return BrowserCSSLoader;
}());
var NodeCSSLoader = /** @class */ (function () {
var NodeCSSLoader = (function () {
function NodeCSSLoader() {
this.fs = require.nodeRequire('fs');
}
Expand All @@ -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;
}
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/css.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -93,7 +93,7 @@ var CSSLoaderPlugin;
return BrowserCSSLoader;
}());
// ------------------------------ Finally, the plugin
var CSSPlugin = /** @class */ (function () {
var CSSPlugin = (function () {
function CSSPlugin() {
this._cssLoader = new BrowserCSSLoader();
}
Expand Down
54 changes: 27 additions & 27 deletions src/loader.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand All @@ -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)];
}
Expand All @@ -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) {
Expand All @@ -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 = {}));
/*---------------------------------------------------------------------------------------------
Expand All @@ -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
Expand Down Expand Up @@ -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 = {}));
/*---------------------------------------------------------------------------------------------
Expand All @@ -234,7 +234,7 @@ var AMDLoader;
*--------------------------------------------------------------------------------------------*/
var AMDLoader;
(function (AMDLoader) {
var ConfigurationOptionsUtil = /** @class */ (function () {
var ConfigurationOptionsUtil = (function () {
function ConfigurationOptionsUtil() {
}
/**
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -551,7 +551,7 @@ var AMDLoader;
/**
* Load `scriptSrc` only once (avoid multiple <script> tags)
*/
var OnlyOnceScriptLoader = /** @class */ (function () {
var OnlyOnceScriptLoader = (function () {
function OnlyOnceScriptLoader(env) {
this._env = env;
this._scriptLoader = null;
Expand Down Expand Up @@ -593,7 +593,7 @@ var AMDLoader;
};
return OnlyOnceScriptLoader;
}());
var BrowserScriptLoader = /** @class */ (function () {
var BrowserScriptLoader = (function () {
function BrowserScriptLoader() {
}
/**
Expand Down Expand Up @@ -626,7 +626,7 @@ var AMDLoader;
};
return BrowserScriptLoader;
}());
var WorkerScriptLoader = /** @class */ (function () {
var WorkerScriptLoader = (function () {
function WorkerScriptLoader() {
}
WorkerScriptLoader.prototype.load = function (moduleManager, scriptSrc, callback, errorback) {
Expand All @@ -640,7 +640,7 @@ var AMDLoader;
};
return WorkerScriptLoader;
}());
var NodeScriptLoader = /** @class */ (function () {
var NodeScriptLoader = (function () {
function NodeScriptLoader(env) {
this._env = env;
this._didInitialize = false;
Expand Down Expand Up @@ -843,9 +843,9 @@ var AMDLoader;
var timeout = minTimeout + Math.ceil(Math.random() * minTimeout);
setTimeout(callback, timeout);
};
NodeScriptLoader._BOM = 0xFEFF;
return NodeScriptLoader;
}());
NodeScriptLoader._BOM = 0xFEFF;
function createScriptLoader(env) {
return new OnlyOnceScriptLoader(env);
}
Expand All @@ -859,7 +859,7 @@ var AMDLoader;
(function (AMDLoader) {
// ------------------------------------------------------------------------
// ModuleIdResolver
var ModuleIdResolver = /** @class */ (function () {
var ModuleIdResolver = (function () {
function ModuleIdResolver(fromModuleId) {
var lastSlash = fromModuleId.lastIndexOf('/');
if (lastSlash !== -1) {
Expand Down Expand Up @@ -902,13 +902,13 @@ var AMDLoader;
}
return result;
};
ModuleIdResolver.ROOT = new ModuleIdResolver('');
return ModuleIdResolver;
}());
ModuleIdResolver.ROOT = new ModuleIdResolver('');
AMDLoader.ModuleIdResolver = ModuleIdResolver;
// ------------------------------------------------------------------------
// Module
var Module = /** @class */ (function () {
var Module = (function () {
function Module(id, strId, dependencies, callback, errorback, moduleIdResolver) {
this.id = id;
this.strId = strId;
Expand Down Expand Up @@ -998,7 +998,7 @@ var AMDLoader;
return Module;
}());
AMDLoader.Module = Module;
var ModuleIdProvider = /** @class */ (function () {
var ModuleIdProvider = (function () {
function ModuleIdProvider() {
this._nextId = 0;
this._strModuleIdToIntModuleId = new Map();
Expand All @@ -1025,17 +1025,17 @@ var AMDLoader;
};
return ModuleIdProvider;
}());
var RegularDependency = /** @class */ (function () {
var RegularDependency = (function () {
function RegularDependency(id) {
this.id = id;
}
RegularDependency.EXPORTS = new RegularDependency(0 /* EXPORTS */);
RegularDependency.MODULE = new RegularDependency(1 /* MODULE */);
RegularDependency.REQUIRE = new RegularDependency(2 /* REQUIRE */);
return RegularDependency;
}());
RegularDependency.EXPORTS = new RegularDependency(0 /* EXPORTS */);
RegularDependency.MODULE = new RegularDependency(1 /* MODULE */);
RegularDependency.REQUIRE = new RegularDependency(2 /* REQUIRE */);
AMDLoader.RegularDependency = RegularDependency;
var PluginDependency = /** @class */ (function () {
var PluginDependency = (function () {
function PluginDependency(id, pluginId, pluginParam) {
this.id = id;
this.pluginId = pluginId;
Expand All @@ -1044,7 +1044,7 @@ var AMDLoader;
return PluginDependency;
}());
AMDLoader.PluginDependency = PluginDependency;
var ModuleManager = /** @class */ (function () {
var ModuleManager = (function () {
function ModuleManager(env, scriptLoader, defineFunc, requireFunc, loaderAvailableTimestamp) {
if (loaderAvailableTimestamp === void 0) { loaderAvailableTimestamp = 0; }
this._env = env;
Expand Down
8 changes: 4 additions & 4 deletions src/nls.build.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ var NLSBuildLoaderPlugin;
return _format(scope[idx], restArgs);
};
}
var NLSPlugin = /** @class */ (function () {
var NLSPlugin = (function () {
function NLSPlugin() {
this.localize = localize;
}
Expand Down Expand Up @@ -170,11 +170,11 @@ var NLSBuildLoaderPlugin;
}, null, '\t'));
};
;
NLSPlugin.DEFAULT_TAG = 'i-default';
NLSPlugin.BUILD_MAP = {};
NLSPlugin.BUILD_MAP_KEYS = {};
return NLSPlugin;
}());
NLSPlugin.DEFAULT_TAG = 'i-default';
NLSPlugin.BUILD_MAP = {};
NLSPlugin.BUILD_MAP_KEYS = {};
NLSBuildLoaderPlugin.NLSPlugin = NLSPlugin;
(function () {
define('vs/nls', new NLSPlugin());
Expand Down
6 changes: 3 additions & 3 deletions src/nls.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
'use strict';
var NLSLoaderPlugin;
(function (NLSLoaderPlugin) {
var Environment = /** @class */ (function () {
var Environment = (function () {
function Environment() {
this._detected = false;
this._isPseudo = false;
Expand Down Expand Up @@ -77,7 +77,7 @@ var NLSLoaderPlugin;
return _format(scope[idx], restArgs, env);
};
}
var NLSPlugin = /** @class */ (function () {
var NLSPlugin = (function () {
function NLSPlugin(env) {
var _this = this;
this._env = env;
Expand Down Expand Up @@ -137,9 +137,9 @@ var NLSLoaderPlugin;
}
}
};
NLSPlugin.DEFAULT_TAG = 'i-default';
return NLSPlugin;
}());
NLSPlugin.DEFAULT_TAG = 'i-default';
NLSLoaderPlugin.NLSPlugin = NLSPlugin;
define('vs/nls', new NLSPlugin(new Environment()));
})(NLSLoaderPlugin || (NLSLoaderPlugin = {}));

0 comments on commit f1897eb

Please sign in to comment.