forked from mirrors/gecko-dev
Bug 1770959 - [devtools] Use standard URL constructor instead of whatwg-url module. r=nchevobbe
And remove this module which is no longer used. Differential Revision: https://phabricator.services.mozilla.com/D147194
This commit is contained in:
parent
f475940c79
commit
215ceb2657
8 changed files with 8793 additions and 8947 deletions
|
|
@ -1208,7 +1208,22 @@
|
||||||
"../node_modules/babel-loader/lib/index.js??ref--1!../packages/devtools-source-map/src/utils/network-request.js": 1056,
|
"../node_modules/babel-loader/lib/index.js??ref--1!../packages/devtools-source-map/src/utils/network-request.js": 1056,
|
||||||
"../node_modules/babel-loader/lib/index.js??ref--1!../../shared/worker-dispatcher.js": 1057,
|
"../node_modules/babel-loader/lib/index.js??ref--1!../../shared/worker-dispatcher.js": 1057,
|
||||||
"../node_modules/babel-loader/lib/index.js??ref--1!../packages/devtools-source-map/src/utils/privileged-network-request.js": 1058,
|
"../node_modules/babel-loader/lib/index.js??ref--1!../packages/devtools-source-map/src/utils/privileged-network-request.js": 1058,
|
||||||
"../node_modules/babel-loader/lib/index.js??ref--1!../../shared/worker-utils.js": 1059
|
"../node_modules/babel-loader/lib/index.js??ref--1!../../shared/worker-utils.js": 1059,
|
||||||
|
"../packages/devtools-source-map/node_modules/whatwg-url/lib/url-state-machine.js": 1060,
|
||||||
|
"../packages/devtools-source-map/node_modules/whatwg-url/lib/urlencoded.js": 1061,
|
||||||
|
"../packages/devtools-source-map/node_modules/webidl-conversions/lib/index.js": 1062,
|
||||||
|
"../packages/devtools-source-map/node_modules/whatwg-url/lib/utils.js": 1063,
|
||||||
|
"../node_modules/node-libs-browser/node_modules/punycode/punycode.js": 1064,
|
||||||
|
"../packages/devtools-source-map/node_modules/whatwg-url/lib/infra.js": 1065,
|
||||||
|
"../packages/devtools-source-map/node_modules/whatwg-url/lib/URLSearchParams.js": 1066,
|
||||||
|
"../packages/devtools-source-map/node_modules/whatwg-url/lib/public-api.js": 1067,
|
||||||
|
"../packages/devtools-source-map/node_modules/whatwg-url/lib/URL.js": 1068,
|
||||||
|
"../packages/devtools-source-map/node_modules/whatwg-url/lib/URL-impl.js": 1069,
|
||||||
|
"../packages/devtools-source-map/node_modules/tr46/index.js": 1070,
|
||||||
|
"../packages/devtools-source-map/node_modules/tr46/lib/regexes.js": 1071,
|
||||||
|
"../node_modules/json-loader/index.js!../packages/devtools-source-map/node_modules/tr46/lib/mappingTable.json": 1072,
|
||||||
|
"../packages/devtools-source-map/node_modules/whatwg-url/lib/URLSearchParams-impl.js": 1073,
|
||||||
|
"../node_modules/lodash.sortby/index.js": 1074
|
||||||
},
|
},
|
||||||
"usedIds": {
|
"usedIds": {
|
||||||
"0": 0,
|
"0": 0,
|
||||||
|
|
@ -2270,7 +2285,22 @@
|
||||||
"1056": 1056,
|
"1056": 1056,
|
||||||
"1057": 1057,
|
"1057": 1057,
|
||||||
"1058": 1058,
|
"1058": 1058,
|
||||||
"1059": 1059
|
"1059": 1059,
|
||||||
|
"1060": 1060,
|
||||||
|
"1061": 1061,
|
||||||
|
"1062": 1062,
|
||||||
|
"1063": 1063,
|
||||||
|
"1064": 1064,
|
||||||
|
"1065": 1065,
|
||||||
|
"1066": 1066,
|
||||||
|
"1067": 1067,
|
||||||
|
"1068": 1068,
|
||||||
|
"1069": 1069,
|
||||||
|
"1070": 1070,
|
||||||
|
"1071": 1071,
|
||||||
|
"1072": 1072,
|
||||||
|
"1073": 1073,
|
||||||
|
"1074": 1074
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"chunks": {
|
"chunks": {
|
||||||
|
|
@ -2415,7 +2445,7 @@
|
||||||
"byName": {},
|
"byName": {},
|
||||||
"byBlocks": {},
|
"byBlocks": {},
|
||||||
"usedIds": {
|
"usedIds": {
|
||||||
"0": 0
|
"1": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -2436,7 +2466,7 @@
|
||||||
"byName": {},
|
"byName": {},
|
||||||
"byBlocks": {},
|
"byBlocks": {},
|
||||||
"usedIds": {
|
"usedIds": {
|
||||||
"0": 0
|
"1": 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -2,49 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
||||||
|
|
||||||
const whatwgUrl = `
|
|
||||||
(() => {
|
|
||||||
let factory;
|
|
||||||
function define(...args) {
|
|
||||||
if (factory) {
|
|
||||||
throw new Error("expected a single define call");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (
|
|
||||||
args.length !== 2 ||
|
|
||||||
!Array.isArray(args[0]) ||
|
|
||||||
args[0].length !== 0 ||
|
|
||||||
typeof args[1] !== "function"
|
|
||||||
) {
|
|
||||||
throw new Error("whatwg-url had unexpected factory arguments.");
|
|
||||||
}
|
|
||||||
|
|
||||||
factory = args[1];
|
|
||||||
}
|
|
||||||
define.amd = true;
|
|
||||||
|
|
||||||
const existingDefine = Object.getOwnPropertyDescriptor(globalThis, "define");
|
|
||||||
globalThis.define = define;
|
|
||||||
let err;
|
|
||||||
try {
|
|
||||||
importScripts("resource://devtools/client/shared/vendor/whatwg-url.js");
|
|
||||||
|
|
||||||
if (!factory) {
|
|
||||||
throw new Error("Failed to load whatwg-url factory");
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
if (existingDefine) {
|
|
||||||
Object.defineProperty(globalThis, "define", existingDefine);
|
|
||||||
} else {
|
|
||||||
delete globalThis.define;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return factory();
|
|
||||||
})()
|
|
||||||
`;
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
"./source-editor": "devtools/client/sourceeditor/editor",
|
"./source-editor": "devtools/client/sourceeditor/editor",
|
||||||
"../editor/source-editor": "devtools/client/sourceeditor/editor",
|
"../editor/source-editor": "devtools/client/sourceeditor/editor",
|
||||||
|
|
@ -59,5 +16,4 @@ module.exports = {
|
||||||
"devtools-services": "Services",
|
"devtools-services": "Services",
|
||||||
"wasmparser/dist/cjs/WasmParser": "devtools/client/shared/vendor/WasmParser",
|
"wasmparser/dist/cjs/WasmParser": "devtools/client/shared/vendor/WasmParser",
|
||||||
"wasmparser/dist/cjs/WasmDis": "devtools/client/shared/vendor/WasmDis",
|
"wasmparser/dist/cjs/WasmDis": "devtools/client/shared/vendor/WasmDis",
|
||||||
"whatwg-url": `var ${whatwgUrl}`,
|
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -113,11 +113,7 @@ describe("sources-tree", () => {
|
||||||
expect(base.name).toBe("webpack://");
|
expect(base.name).toBe("webpack://");
|
||||||
expect(base.contents).toHaveLength(1);
|
expect(base.contents).toHaveLength(1);
|
||||||
|
|
||||||
const emptyNode = base.contents[0];
|
const userNode = base.contents[0];
|
||||||
expect(emptyNode.name).toBe("");
|
|
||||||
expect(emptyNode.contents).toHaveLength(1);
|
|
||||||
|
|
||||||
const userNode = emptyNode.contents[0];
|
|
||||||
expect(userNode.name).toBe("Users");
|
expect(userNode.name).toBe("Users");
|
||||||
expect(userNode.contents).toHaveLength(1);
|
expect(userNode.contents).toHaveLength(1);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,6 @@
|
||||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||||
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
* file, You can obtain one at <http://mozilla.org/MPL/2.0/>. */
|
||||||
|
|
||||||
import { URL as URLParser } from "whatwg-url";
|
|
||||||
|
|
||||||
const defaultUrl = {
|
const defaultUrl = {
|
||||||
hash: "",
|
hash: "",
|
||||||
host: "",
|
host: "",
|
||||||
|
|
@ -57,7 +55,7 @@ export function parse(url) {
|
||||||
|
|
||||||
let urlObj;
|
let urlObj;
|
||||||
try {
|
try {
|
||||||
urlObj = new URLParser(url);
|
urlObj = new URL(url);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
urlObj = { ...defaultUrl };
|
urlObj = { ...defaultUrl };
|
||||||
// If we're given simply a filename...
|
// If we're given simply a filename...
|
||||||
|
|
@ -89,6 +87,10 @@ export function parse(url) {
|
||||||
urlObj.pathname = url;
|
urlObj.pathname = url;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// When provided a special URL like "webpack:///webpack/foo",
|
||||||
|
// prevents passing the three slashes in the path, and pass only onea.
|
||||||
|
// This will prevent displaying modules in empty-name sub folders.
|
||||||
|
urlObj.pathname = urlObj.pathname.replace(/\/+/, "/");
|
||||||
urlObj.path = urlObj.pathname + urlObj.search;
|
urlObj.path = urlObj.pathname + urlObj.search;
|
||||||
|
|
||||||
// Cache the result
|
// Cache the result
|
||||||
|
|
|
||||||
|
|
@ -21,7 +21,6 @@ const mappings = {
|
||||||
"devtools-services": "Services",
|
"devtools-services": "Services",
|
||||||
"wasmparser/dist/cjs/WasmParser": "devtools/client/shared/vendor/WasmParser",
|
"wasmparser/dist/cjs/WasmParser": "devtools/client/shared/vendor/WasmParser",
|
||||||
"wasmparser/dist/cjs/WasmDis": "devtools/client/shared/vendor/WasmDis",
|
"wasmparser/dist/cjs/WasmDis": "devtools/client/shared/vendor/WasmDis",
|
||||||
"whatwg-url": "devtools/client/shared/vendor/whatwg-url",
|
|
||||||
"framework-actions": "devtools/client/framework/actions/index",
|
"framework-actions": "devtools/client/framework/actions/index",
|
||||||
"inspector-shared-utils": "devtools/client/inspector/shared/utils",
|
"inspector-shared-utils": "devtools/client/inspector/shared/utils",
|
||||||
};
|
};
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
1
devtools/client/shared/vendor/moz.build
vendored
1
devtools/client/shared/vendor/moz.build
vendored
|
|
@ -23,7 +23,6 @@ DevToolsModules(
|
||||||
'seamless-immutable.js',
|
'seamless-immutable.js',
|
||||||
'WasmDis.js',
|
'WasmDis.js',
|
||||||
'WasmParser.js',
|
'WasmParser.js',
|
||||||
'whatwg-url.js',
|
|
||||||
)
|
)
|
||||||
|
|
||||||
# react dev versions are used if enable-debug-js-modules is set in .mozconfig.
|
# react dev versions are used if enable-debug-js-modules is set in .mozconfig.
|
||||||
|
|
|
||||||
8851
devtools/client/shared/vendor/whatwg-url.js
vendored
8851
devtools/client/shared/vendor/whatwg-url.js
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue