Skip to content

Commit

Permalink
Backed out 4 changesets (bug 1945566) for causing build bustages/py3 …
Browse files Browse the repository at this point in the history
…unit test failures/bugzilla lint failures CLOSED TREE

Backed out changeset 6d69925d57ac (bug 1945566)
Backed out changeset 1b2bd35ca71f (bug 1945566)
Backed out changeset 9eba66d33006 (bug 1945566)
Backed out changeset c19c6833ebdc (bug 1945566)
  • Loading branch information
Sandor Molnar committed Feb 26, 2025
1 parent b34804c commit 08da4ec
Show file tree
Hide file tree
Showing 27 changed files with 27 additions and 694 deletions.
6 changes: 0 additions & 6 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ const httpTestingPaths = [
module.exports = {
settings: {
"import/extensions": [".mjs"],
"import/resolver": {
[path.resolve(__dirname, "srcdir-resolver.js")]: {},
node: {},
},
},
ignorePatterns,
// Ignore eslint configurations in parent directories.
Expand Down Expand Up @@ -112,8 +108,6 @@ module.exports = {
// *.config.js files are generally assumed to be configuration files
// based for node.
"*.config.?(m)js",
// The resolver for moz-src for eslint, vscode etc.
"srcdir-resolver.js",
],
env: {
node: true,
Expand Down
41 changes: 11 additions & 30 deletions browser/base/content/test/static/browser_all_files_referenced.js
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ var gChromeReg = Cc["@mozilla.org/chrome/chrome-registry;1"].getService(
);
var gChromeMap = new Map();
var gOverrideMap = new Map();
var gComponentsSet = new Set();

// In this map when the value is a Set of URLs, the file is referenced if any
// of the files in the Set is referenced.
Expand Down Expand Up @@ -507,6 +508,8 @@ function parseManifest(manifestUri) {
}
} else if (type == "resource") {
trackResourcePrefix(argv[0]);
} else if (type == "component") {
gComponentsSet.add(argv[1]);
}
}
});
Expand Down Expand Up @@ -647,10 +650,6 @@ function parseCodeFile(fileUri) {
/["'`]chrome:\/\/[a-zA-Z0-9-]+\/(content|skin|locale)\/[^"'` ]*["'`]/g
);

if (!urls) {
urls = line.match(/["']moz-src:\/\/\/[^"']+["']/g);
}

if (!urls) {
urls = line.match(/["']resource:\/\/[^"']+["']/g);
if (
Expand Down Expand Up @@ -738,10 +737,7 @@ function parseCodeFile(fileUri) {
if (!/\.(properties|js|jsm|mjs|json|css)$/.test(url)) {
url += ".js";
}
if (
url.startsWith("resource://") ||
url.startsWith("moz-src:///")
) {
if (url.startsWith("resource://")) {
addCodeReference(url, fileUri);
} else {
// if we end up with a chrome:// url here, it's likely because
Expand Down Expand Up @@ -791,22 +787,13 @@ function parseCodeFile(fileUri) {
function convertToCodeURI(fileUri) {
let baseUri = fileUri;
let path = "";
while (baseUri) {
while (true) {
let slashPos = baseUri.lastIndexOf("/", baseUri.length - 2);
if (slashPos <= 0) {
// File not accessible from chrome protocol, try resource://
for (let res of gResourceMap) {
if (fileUri.startsWith(res[1])) {
let resourceUriString = fileUri.replace(
res[1],
`resource://${res[0]}/`
);
// If inside moz-src, treat as moz-src url.
resourceUriString = resourceUriString.replace(
/^resource:\/\/gre\/moz-src\//,
"moz-src:///"
);
return resourceUriString;
return fileUri.replace(res[1], "resource://" + res[0] + "/");
}
}
// Give up and return the original URL.
Expand All @@ -818,7 +805,6 @@ function convertToCodeURI(fileUri) {
return gChromeMap.get(baseUri) + path;
}
}
throw new Error(`Unparsable URI: ${fileUri}`);
}

async function chromeFileExists(aURI) {
Expand Down Expand Up @@ -866,7 +852,6 @@ function findChromeUrlsFromArray(array, prefix) {
// Only keep strings that look like real chrome or resource urls.
if (
/chrome:\/\/[a-zA-Z09-]+\/(content|skin|locale)\//.test(string) ||
/moz-src:\/\/\/\w+/.test(string) ||
/resource:\/\/[a-zA-Z09-]*\/.*\.[a-z]+/.test(string)
) {
gReferencesFromCode.set(string, null);
Expand All @@ -880,12 +865,10 @@ add_task(async function checkAllTheFiles() {
const libxul = await IOUtils.read(PathUtils.xulLibraryPath);
findChromeUrlsFromArray(libxul, "chrome://");
findChromeUrlsFromArray(libxul, "resource://");
findChromeUrlsFromArray(libxul, "moz-src:///");
// Handle NS_LITERAL_STRING.
let uint16 = new Uint16Array(libxul.buffer);
findChromeUrlsFromArray(uint16, "chrome://");
findChromeUrlsFromArray(uint16, "resource://");
findChromeUrlsFromArray(uint16, "moz-src:///");

const kCodeExtensions = [
".xml",
Expand Down Expand Up @@ -974,7 +957,6 @@ add_task(async function checkAllTheFiles() {
// the non-devtools paths:
let devtoolsPrefixes = [
"chrome://devtools",
"moz-src:///devtools/",
"resource://devtools/",
"resource://devtools-shared-images/",
"resource://devtools-highlighter-styles/",
Expand All @@ -989,9 +971,7 @@ add_task(async function checkAllTheFiles() {
for (let uri of uris) {
uri = convertToCodeURI(uri.spec);
if (
(uri.startsWith("chrome://") ||
uri.startsWith("resource://") ||
uri.startsWith("moz-src:///")) &&
(uri.startsWith("chrome://") || uri.startsWith("resource://")) &&
isDevtools == hasDevtoolsPrefix(uri)
) {
chromeFiles.push(uri);
Expand Down Expand Up @@ -1048,6 +1028,9 @@ add_task(async function checkAllTheFiles() {
if (rv && f.startsWith("resource://app/")) {
rv = isUnreferenced(f.replace("resource://app/", "resource:///"));
}
if (rv && /^resource:\/\/(?:app|gre)\/components\/[^/]+\.js$/.test(f)) {
rv = !gComponentsSet.has(f.replace(/.*\//, ""));
}
if (!rv) {
foundReference = true;
if (useAllowlist) {
Expand Down Expand Up @@ -1128,9 +1111,7 @@ add_task(async function checkAllTheFiles() {
}

if (
(file.startsWith("chrome://") ||
file.startsWith("resource://") ||
file.startsWith("moz-src:///")) &&
(file.startsWith("chrome://") || file.startsWith("resource://")) &&
!(await chromeFileExists(file))
) {
// Ignore chrome prefixes that have been automatically expanded.
Expand Down
1 change: 0 additions & 1 deletion browser/installer/package-manifest.in
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,6 @@
; Modules
@RESPATH@/browser/modules/*
@RESPATH@/modules/*
@RESPATH@/moz-src/*
@RESPATH@/browser/actors/*
@RESPATH@/actors/*

Expand Down
3 changes: 1 addition & 2 deletions docshell/base/BaseHistory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,7 @@ static constexpr nsLiteralCString kDisallowedSchemes[] = {
"chrome"_ns, "data"_ns, "imap"_ns,
"javascript"_ns, "mailbox"_ns, "news"_ns,
"page-icon"_ns, "resource"_ns, "view-source"_ns,
"moz-extension"_ns, "moz-page-thumb"_ns, "moz-src"_ns,
"x-moz-ews"_ns,
"moz-extension"_ns, "moz-page-thumb"_ns, "x-moz-ews"_ns,
};

bool BaseHistory::CanStore(nsIURI* aURI) {
Expand Down
4 changes: 0 additions & 4 deletions dom/security/nsContentSecurityUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1903,10 +1903,6 @@ bool nsContentSecurityUtils::ValidateScriptFilename(JSContext* cx,
// If it's a resource:// url, allow it
return true;
}
if (StringBeginsWith(filename, "moz-src://"_ns)) {
// If it's a moz-src:// url, allow it
return true;
}
if (StringBeginsWith(filename, "file://"_ns)) {
// We will temporarily allow all file:// URIs through for now
return true;
Expand Down
2 changes: 1 addition & 1 deletion js/loader/ScriptLoadRequest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ void ScriptLoadRequest::MarkScriptForBytecodeEncoding(JSScript* aScript) {

static bool IsInternalURIScheme(nsIURI* uri) {
return uri->SchemeIs("moz-extension") || uri->SchemeIs("resource") ||
uri->SchemeIs("moz-src") || uri->SchemeIs("chrome");
uri->SchemeIs("chrome");
}

void ScriptLoadRequest::SetBaseURLFromChannelAndOriginalURI(
Expand Down
3 changes: 1 addition & 2 deletions js/xpconnect/loader/mozJSModuleLoader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1039,8 +1039,7 @@ nsresult mozJSModuleLoader::GetModuleImportStack(const nsACString& aLocation,

/* static */
bool mozJSModuleLoader::IsTrustedScheme(nsIURI* aURI) {
return aURI->SchemeIs("resource") || aURI->SchemeIs("chrome") ||
aURI->SchemeIs("moz-src");
return aURI->SchemeIs("resource") || aURI->SchemeIs("chrome");
}

nsresult mozJSModuleLoader::ImportESModule(
Expand Down
2 changes: 1 addition & 1 deletion netwerk/base/nsIOService.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -903,7 +903,7 @@ nsresult nsIOService::AsyncOnChannelRedirect(

bool nsIOService::UsesExternalProtocolHandler(const nsACString& aScheme) {
if (aScheme == "file"_ns || aScheme == "chrome"_ns ||
aScheme == "resource"_ns || aScheme == "moz-src"_ns) {
aScheme == "resource"_ns) {
// Don't allow file:, chrome: or resource: URIs to be handled with
// nsExternalProtocolHandler, since internally we rely on being able to
// use and read from these URIs.
Expand Down
10 changes: 0 additions & 10 deletions netwerk/base/nsNetUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,6 @@
#endif
#include "nsAboutProtocolHandler.h"
#include "nsResProtocolHandler.h"
#include "mozilla/net/MozSrcProtocolHandler.h"
#include "mozilla/net/ExtensionProtocolHandler.h"
#include "mozilla/net/PageThumbProtocolHandler.h"
#include "mozilla/net/SFVService.h"
Expand Down Expand Up @@ -1913,15 +1912,6 @@ nsresult NS_NewURI(nsIURI** aURI, const nsACString& aSpec,
return handler->NewURI(aSpec, aCharset, aBaseURI, aURI);
}

if (scheme.EqualsLiteral("moz-src")) {
RefPtr<MozSrcProtocolHandler> handler =
MozSrcProtocolHandler::GetSingleton();
if (!handler) {
return NS_ERROR_NOT_AVAILABLE;
}
return handler->NewURI(aSpec, aCharset, aBaseURI, aURI);
}

if (scheme.EqualsLiteral("indexeddb") || scheme.EqualsLiteral("uuid")) {
return NS_MutateURI(new nsStandardURL::Mutator())
.Apply(&nsIStandardURLMutator::Init, nsIStandardURL::URLTYPE_AUTHORITY,
Expand Down
1 change: 0 additions & 1 deletion netwerk/base/nsStandardURL.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -579,7 +579,6 @@ nsresult nsStandardURL::BuildNormalizedSpec(const char* spec,
nsDependentCSubstring tempHost(spec + mHost.mPos, mHost.mLen);
nsresult rv;
bool allowIp = !SegmentIs(spec, mScheme, "resource") &&
!SegmentIs(spec, mScheme, "moz-src") &&
!SegmentIs(spec, mScheme, "chrome");
if (tempHost.First() == '[' && allowIp) {
mCheckedIfHostA = true;
Expand Down
17 changes: 0 additions & 17 deletions netwerk/build/components.conf
Original file line number Diff line number Diff line change
Expand Up @@ -466,23 +466,6 @@ Classes = [
],
},
},
{
'cid': '{4abd60aa-6b7d-4f3b-bf52-d7ce8ae6dd36}',
'contract_ids': ['@mozilla.org/network/protocol;1?name=moz-src'],
'singleton': True,
'type': 'mozilla::net::MozSrcProtocolHandler',
'headers': ['/netwerk/protocol/res/MozSrcProtocolHandler.h'],
'constructor': 'mozilla::net::MozSrcProtocolHandler::GetSingleton',
'protocol_config': {
'scheme': 'moz-src',
'flags': [
'URI_STD',
'URI_IS_UI_RESOURCE',
'URI_IS_LOCAL_RESOURCE',
'URI_IS_POTENTIALLY_TRUSTWORTHY',
],
},
},
{
'cid': '{9c7ec5d1-23f9-11d5-aea8-8fcc0793e97f}',
'contract_ids': ['@mozilla.org/network/protocol;1?name=view-source'],
Expand Down
69 changes: 0 additions & 69 deletions netwerk/protocol/res/MozSrcProtocolHandler.cpp

This file was deleted.

49 changes: 0 additions & 49 deletions netwerk/protocol/res/MozSrcProtocolHandler.h

This file was deleted.

Loading

0 comments on commit 08da4ec

Please sign in to comment.