Skip to content

Commit

Permalink
Backed out 3 changesets (bug 1783497) for wpt failure on protocol.htt…
Browse files Browse the repository at this point in the history
…ps.html . CLOSED TREE

Backed out changeset 0a2510ef7585 (bug 1783497)
Backed out changeset c92b392a186f (bug 1783497)
Backed out changeset 36d1dfe3d6c9 (bug 1783497)
  • Loading branch information
nbeleuzu committed Oct 19, 2022
1 parent 7c40e2d commit d32bd5b
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 58 deletions.
18 changes: 15 additions & 3 deletions chrome/nsChromeProtocolHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ nsChromeProtocolHandler::GetProtocolFlags(uint32_t* result) {
// and "chrome://navigator/content/navigator.xul".

rv = nsChromeRegistry::Canonify(surl);
mozilla::Unused << NS_WARN_IF(NS_FAILED(rv));
if (NS_FAILED(rv)) return rv;

surl.forget(result);
return NS_OK;
Expand All @@ -98,9 +98,21 @@ nsChromeProtocolHandler::NewChannel(nsIURI* aURI, nsILoadInfo* aLoadInfo,

MOZ_ASSERT(aResult, "Null out param");

#ifdef DEBUG
// Check that the uri we got is already canonified
nsresult debug_rv;
nsCOMPtr<nsIURI> debugURL = aURI;
rv = nsChromeRegistry::Canonify(debugURL);
NS_ENSURE_SUCCESS(rv, rv);
debug_rv = nsChromeRegistry::Canonify(debugURL);
if (NS_SUCCEEDED(debug_rv)) {
bool same;
debug_rv = aURI->Equals(debugURL, &same);
if (NS_SUCCEEDED(debug_rv)) {
NS_ASSERTION(same,
"Non-canonified chrome uri passed to "
"nsChromeProtocolHandler::NewChannel!");
}
}
#endif

nsCOMPtr<nsIChannel> result;

Expand Down
6 changes: 3 additions & 3 deletions chrome/test/unit/test_bug415367.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@ function test_uri(obj) {
function run_test() {
var tests = [
{ uri: "chrome://blah/content/blah.xul", result: true },
{ uri: "chrome://blah/content/:/blah/blah.xul", result: true },
{ uri: "chrome://blah/content/%252e./blah/blah.xul", result: true },
{ uri: "chrome://blah/content/%252e%252e/blah/blah.xul", result: true },
{ uri: "chrome://blah/content/:/blah/blah.xul", result: false },
{ uri: "chrome://blah/content/%252e./blah/blah.xul", result: false },
{ uri: "chrome://blah/content/%252e%252e/blah/blah.xul", result: false },
{ uri: "chrome://blah/content/blah.xul?param=%252e./blah/", result: true },
{ uri: "chrome://blah/content/blah.xul?param=:/blah/", result: true },
{
Expand Down
36 changes: 0 additions & 36 deletions chrome/test/unit/test_create_channel_chrome_url.js

This file was deleted.

1 change: 0 additions & 1 deletion chrome/test/unit/xpcshell.ini
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ tags = addons
[test_data_protocol_registration.js]
[test_no_remote_registration.js]
[test_resolve_uris.js]
[test_create_channel_chrome_url.js]
3 changes: 0 additions & 3 deletions dom/base/ChromeUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -949,9 +949,6 @@ void ChromeUtils::GetPartitionKeyFromURL(dom::GlobalObject& aGlobal,
ErrorResult& aRv) {
nsCOMPtr<nsIURI> uri;
nsresult rv = NS_NewURI(getter_AddRefs(uri), aURL);
if (NS_SUCCEEDED(rv) && uri->SchemeIs("chrome")) {
rv = NS_ERROR_FAILURE;
}

if (NS_WARN_IF(NS_FAILED(rv))) {
aPartitionKey.Truncate();
Expand Down
2 changes: 0 additions & 2 deletions dom/html/test/forms/test_input_url.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

function checkValidURL(element)
{
info(`Checking ${element.value}\n`);
gInvalid = false;
ok(!element.validity.typeMismatch,
"Element should not suffer from type mismatch");
Expand Down Expand Up @@ -72,7 +71,6 @@
[ "http://mózillä.órg", true ],
[ "ht://mózillä.órg", true ],
[ "httŭ://mózillä.órg", false ],
[ "chrome://bookmarks", true ],
];

values.forEach(function([value, valid]) {
Expand Down
1 change: 1 addition & 0 deletions services/common/tests/unit/test_utils_makeURI.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,6 @@ function _test_makeURI() {

_("Invalid uris are undefined");
Assert.equal(CommonUtils.makeURI("mozillalabs.com"), undefined);
Assert.equal(CommonUtils.makeURI("chrome://badstuff"), undefined);
Assert.equal(CommonUtils.makeURI("this is a test"), undefined);
}
Original file line number Diff line number Diff line change
Expand Up @@ -555,12 +555,7 @@ add_task(async function dfpi_invalid_partitionKey() {
await browser.test.assertRejects(
set({ partitionKey: { topLevelSite: "chrome://foo" } }),
/Invalid value for 'partitionKey' attribute/,
"partitionKey cannot be the chrome:-scheme (canonicalization fails)"
);
await browser.test.assertRejects(
set({ partitionKey: { topLevelSite: "chrome://foo/foo/foo" } }),
/Invalid value for 'partitionKey' attribute/,
"partitionKey cannot be the chrome:-scheme (canonicalization passes)"
"partitionKey cannot be the chrome:-scheme"
);
await browser.test.assertRejects(
set({ partitionKey: { topLevelSite: "http://[]:" } }),
Expand Down
2 changes: 1 addition & 1 deletion toolkit/components/passwordmgr/LoginInfo.jsm
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ nsLoginInfo.prototype = {
displayOrigin = uri.displayHostPort || this.origin;
} catch (ex) {
// Fallback to this.origin set above in case a URI can't be contructed e.g.
// file://
// chrome://FirefoxAccounts
}

if (this.httpRealm === null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ add_task(function test_displayOrigin() {
info(displayOrigin);
Assert.equal(typeof displayOrigin, "string", "Check type");
Assert.greater(displayOrigin.length, 0, "Check length");
if (loginInfo.origin.startsWith("file://")) {
// Fails to create the URL
if (
loginInfo.origin.startsWith("chrome://") ||
loginInfo.origin.startsWith("file://")
) {
Assert.ok(displayOrigin.startsWith(loginInfo.origin), "Contains origin");
} else {
Assert.ok(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
const TESTCASES = [
["javascript:void(0);", null],
["javascript:void(0);", "javascript:", true],
["chrome://MyAccount", "chrome://myaccount"],
["chrome://MyAccount", null],
["data:text/html,example", null],
[
"http://username:[email protected]:80/foo?bar=baz#fragment",
Expand Down

0 comments on commit d32bd5b

Please sign in to comment.