Backed out changeset 255d9078dd17 (bug 1633710) for Browser-chrome failures in extensions/test/xpinstall/browser_datauri.js. CLOSED TREE

This commit is contained in:
Dorel Luca 2020-07-06 18:38:13 +03:00
Родитель 8f18f8e4c5
Коммит 3e761e3907
13 изменённых файлов: 37 добавлений и 31 удалений

Просмотреть файл

@ -813,7 +813,7 @@ var ThirdPartyCookies = {
for (let perm of Services.perms.all) {
if (
perm.type == "cookie" &&
Services.eTLD.hasRootDomain(host, perm.principal.host)
Services.eTLD.hasRootDomain(host, perm.principal.URI.host)
) {
Services.perms.removePermission(perm);
}

Просмотреть файл

@ -7629,7 +7629,7 @@ var CanvasPermissionPromptHelper = {
let options = {
checkbox,
name: principal.host,
name: principal.URI.host,
learnMoreURL:
Services.urlFormatter.formatURLPref("app.support.baseURL") +
"fingerprint-permission",

Просмотреть файл

@ -51,7 +51,7 @@ add_task(async function test_toplevel_frame_permission() {
browser
);
is(
notification.options.principal.host,
notification.options.principal.URI.host,
"example.com",
"Should use top host for permission prompt!"
);

Просмотреть файл

@ -48,7 +48,7 @@ function waitForUnregister(host) {
return new Promise(resolve => {
let listener = {
onUnregister: registration => {
if (registration.principal.host != host) {
if (registration.principal.URI.host != host) {
return;
}
swm.removeListener(listener);
@ -72,7 +72,7 @@ async function createData(host) {
function moveOriginInTime(principals, endDate, host) {
for (let i = 0; i < principals.length; ++i) {
let principal = principals.queryElementAt(i, Ci.nsIPrincipal);
if (principal.host == host) {
if (principal.URI.host == host) {
sas.moveOriginInTime(principal, endDate - fiveHours);
return true;
}
@ -116,7 +116,10 @@ add_task(async function testWithRange() {
let found = 0;
for (let i = 0; i < principals.length; ++i) {
let principal = principals.queryElementAt(i, Ci.nsIPrincipal);
if (principal.host == "example.org" || principal.host == "example.com") {
if (
principal.URI.host == "example.org" ||
principal.URI.host == "example.com"
) {
found++;
}
}

Просмотреть файл

@ -104,7 +104,7 @@ add_task(async function testServiceWorkers() {
let host = serviceWorkers.queryElementAt(
0,
Ci.nsIServiceWorkerRegistrationInfo
).principal.host;
).principal.URI.host;
is(host, "mochi.test", "ServiceWorkers for example.com have been removed.");
extension.sendMessage({});

Просмотреть файл

@ -232,7 +232,7 @@ async function addTestData(data) {
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
site.origin
);
hosts.push(principal.host);
hosts.push(principal.URI.host);
}
return hosts;

Просмотреть файл

@ -485,7 +485,7 @@ var SiteDataManager = {
if (perm.principal.schemeIs("file")) {
Services.perms.removePermission(perm);
}
} else if (Services.eTLD.hasRootDomain(perm.principal.host, host)) {
} else if (Services.eTLD.hasRootDomain(perm.principal.URI.host, host)) {
Services.perms.removePermission(perm);
}
}

Просмотреть файл

@ -431,14 +431,14 @@ const QuotaCleaner = {
Services.obs.notifyObservers(
null,
"extension:purge-localStorage",
aPrincipal.host
aPrincipal.URI.host
);
// Clear sessionStorage
Services.obs.notifyObservers(
null,
"browser:purge-sessionStorage",
aPrincipal.host
aPrincipal.URI.host
);
// ServiceWorkers: they must be removed before cleaning QuotaManager.
@ -501,7 +501,7 @@ const QuotaCleaner = {
);
let host;
try {
host = principal.host;
host = principal.URI.host;
} catch (e) {
// There is no host for the given principal.
continue;
@ -698,7 +698,7 @@ const StorageAccessCleaner = {
let toBeRemoved = false;
try {
toBeRemoved = Services.eTLD.hasRootDomain(
perm.principal.host,
perm.principal.URI.host,
aHost
);
} catch (ex) {
@ -816,7 +816,10 @@ const PermissionsCleaner = {
for (let perm of Services.perms.all) {
let toBeRemoved;
try {
toBeRemoved = Services.eTLD.hasRootDomain(perm.principal.host, aHost);
toBeRemoved = Services.eTLD.hasRootDomain(
perm.principal.URI.host,
aHost
);
} catch (ex) {
continue;
}
@ -1143,7 +1146,7 @@ ClearDataService.prototype = Object.freeze({
// is to delete by host.
if (aCleaner.deleteByHost) {
return aCleaner.deleteByHost(
aPrincipal.host,
aPrincipal.URI.host,
aPrincipal.originAttributes
);
}

Просмотреть файл

@ -50,7 +50,7 @@ this.ServiceWorkerCleanUp = {
i,
Ci.nsIServiceWorkerRegistrationInfo
);
if (sw.principal.host == aHost) {
if (sw.principal.URI.host == aHost) {
promises.push(unregisterServiceWorker(sw));
}
}

Просмотреть файл

@ -91,7 +91,7 @@ var SiteDataTestUtils = {
origin
);
Services.cookies.add(
principal.host,
principal.URI.host,
principal.URI.pathQueryRef,
name,
value,
@ -190,7 +190,7 @@ var SiteDataTestUtils = {
principal.originAttributes,
cookie.originAttributes
) &&
cookie.host.includes(principal.host)
cookie.host.includes(principal.URI.host)
) {
return true;
}
@ -295,7 +295,7 @@ var SiteDataTestUtils = {
return new Promise(resolve => {
let listener = {
onRegister: registration => {
if (registration.principal.host != url.host) {
if (registration.principal.URI.host != url.host) {
return;
}
swm.removeListener(listener);
@ -322,7 +322,7 @@ var SiteDataTestUtils = {
return new Promise(resolve => {
let listener = {
onUnregister: registration => {
if (registration.principal.host != url.host) {
if (registration.principal.URI.host != url.host) {
return;
}
swm.removeListener(listener);

Просмотреть файл

@ -41,13 +41,12 @@ amContentHandler.prototype = {
let sourceHost;
let sourceURL;
try {
sourceHost = triggeringPrincipal.host;
sourceURL = triggeringPrincipal.URI?.spec;
} catch (error) {
// Ignore errors when retrieving the host for the principal (e.g. data URIs return
// an NS_ERROR_FAILURE when principal.host is accessed).
sourceURL = triggeringPrincipal.URI.spec;
sourceHost = triggeringPrincipal.URI.host;
} catch (err) {
// Ignore errors when retrieving the host for the principal (e.g. null principals raise
// an NS_ERROR_FAILURE when principal.URI.host is accessed).
}
let install = {

Просмотреть файл

@ -153,12 +153,13 @@ InstallTrigger.prototype = {
let sourceHost;
let sourceURL;
try {
sourceHost = this._principal.host;
sourceURL = this._principal.URI?.spec;
sourceHost = this._principal.URI.host;
sourceURL = this._principal.URI.spec;
} catch (err) {
// Ignore errors when retrieving the host for the principal (e.g. data:// principals raise
// an NS_ERROR_FAILURE when principal.host is accessed).
// Ignore errors when retrieving the host for the principal (e.g. null principals raise
// an NS_ERROR_FAILURE when principal.URI.host is accessed).
}
let installData = {

Просмотреть файл

@ -256,7 +256,7 @@ class WebAPI extends APIObject {
// Provide the host from which the amWebAPI is being called
// (so that we can detect if the API is being used from the disco pane,
// AMO, testpilot or another unknown webpage).
sourceHost: triggeringPrincipal.host,
sourceHost: triggeringPrincipal.URI && triggeringPrincipal.URI.host,
sourceURL: triggeringPrincipal.URI && triggeringPrincipal.URI.spec,
};
return this._apiTask("createInstall", [installOptions], installInfo => {