Bug 1926106 - Special case _generated_background_page.html moz-extension url in nsStandardURL::EqualsInternal. r=valentin,necko-reviewers

This patch includes a special handling for the moz-extension _generated_background_page.html urls inside
nsStandardURL::EqualsInternal because it doesn't resolve to a file (instead it resolves to a data: URI,
see ExtensionProtocolHandler::ResolveSpecialCases), similarly to resource:// urls which are special case
a few lines before in the same nsStandardURL::EqualsInternal.

The test case introduced by the parent patch passes successfully on the unpacked extension loaded temporarily
with these changes applied.

Depends on D226376

Differential Revision: https://phabricator.services.mozilla.com/D226470
This commit is contained in:
Luca Greco 2024-10-24 15:19:48 +00:00
parent d272cef4f8
commit 6ccb86807e

View File

@ -2144,8 +2144,12 @@ nsresult nsStandardURL::EqualsInternal(
rv = EnsureFile();
nsresult rv2 = other->EnsureFile();
// special case for resource:// urls that don't resolve to files
if (rv == NS_ERROR_NO_INTERFACE && rv == rv2) {
// Special case for resource:// urls that don't resolve to files,
// and for moz-extension://UUID/_generated_background_page.html
// because it doesn't resolve to a file (instead it resolves to a data: URI,
// see ExtensionProtocolHandler::ResolveSpecialCases, see Bug 1926106).
if (rv == NS_ERROR_NO_INTERFACE || rv2 == NS_ERROR_NO_INTERFACE) {
return NS_OK;
}
@ -2155,6 +2159,7 @@ nsresult nsStandardURL::EqualsInternal(
return rv;
}
NS_ASSERTION(mFile, "EnsureFile() lied!");
rv = rv2;
if (NS_FAILED(rv)) {
LOG(