зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1633710 - Move js uri.host to principal r=ckerschb,preferences-reviewers,ntim
Differential Revision: https://phabricator.services.mozilla.com/D73242
This commit is contained in:
Родитель
7fa2f11fad
Коммит
95212989d4
|
@ -813,7 +813,7 @@ var ThirdPartyCookies = {
|
|||
for (let perm of Services.perms.all) {
|
||||
if (
|
||||
perm.type == "cookie" &&
|
||||
Services.eTLD.hasRootDomain(host, perm.principal.URI.host)
|
||||
Services.eTLD.hasRootDomain(host, perm.principal.host)
|
||||
) {
|
||||
Services.perms.removePermission(perm);
|
||||
}
|
||||
|
|
|
@ -7629,7 +7629,7 @@ var CanvasPermissionPromptHelper = {
|
|||
|
||||
let options = {
|
||||
checkbox,
|
||||
name: principal.URI.host,
|
||||
name: principal.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.URI.host,
|
||||
notification.options.principal.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.URI.host != host) {
|
||||
if (registration.principal.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.URI.host == host) {
|
||||
if (principal.host == host) {
|
||||
sas.moveOriginInTime(principal, endDate - fiveHours);
|
||||
return true;
|
||||
}
|
||||
|
@ -116,10 +116,7 @@ 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.URI.host == "example.org" ||
|
||||
principal.URI.host == "example.com"
|
||||
) {
|
||||
if (principal.host == "example.org" || principal.host == "example.com") {
|
||||
found++;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -104,7 +104,7 @@ add_task(async function testServiceWorkers() {
|
|||
let host = serviceWorkers.queryElementAt(
|
||||
0,
|
||||
Ci.nsIServiceWorkerRegistrationInfo
|
||||
).principal.URI.host;
|
||||
).principal.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.URI.host);
|
||||
hosts.push(principal.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.URI.host, host)) {
|
||||
} else if (Services.eTLD.hasRootDomain(perm.principal.host, host)) {
|
||||
Services.perms.removePermission(perm);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -431,14 +431,14 @@ const QuotaCleaner = {
|
|||
Services.obs.notifyObservers(
|
||||
null,
|
||||
"extension:purge-localStorage",
|
||||
aPrincipal.URI.host
|
||||
aPrincipal.host
|
||||
);
|
||||
|
||||
// Clear sessionStorage
|
||||
Services.obs.notifyObservers(
|
||||
null,
|
||||
"browser:purge-sessionStorage",
|
||||
aPrincipal.URI.host
|
||||
aPrincipal.host
|
||||
);
|
||||
|
||||
// ServiceWorkers: they must be removed before cleaning QuotaManager.
|
||||
|
@ -501,7 +501,7 @@ const QuotaCleaner = {
|
|||
);
|
||||
let host;
|
||||
try {
|
||||
host = principal.URI.host;
|
||||
host = principal.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.URI.host,
|
||||
perm.principal.host,
|
||||
aHost
|
||||
);
|
||||
} catch (ex) {
|
||||
|
@ -816,10 +816,7 @@ const PermissionsCleaner = {
|
|||
for (let perm of Services.perms.all) {
|
||||
let toBeRemoved;
|
||||
try {
|
||||
toBeRemoved = Services.eTLD.hasRootDomain(
|
||||
perm.principal.URI.host,
|
||||
aHost
|
||||
);
|
||||
toBeRemoved = Services.eTLD.hasRootDomain(perm.principal.host, aHost);
|
||||
} catch (ex) {
|
||||
continue;
|
||||
}
|
||||
|
@ -1146,7 +1143,7 @@ ClearDataService.prototype = Object.freeze({
|
|||
// is to delete by host.
|
||||
if (aCleaner.deleteByHost) {
|
||||
return aCleaner.deleteByHost(
|
||||
aPrincipal.URI.host,
|
||||
aPrincipal.host,
|
||||
aPrincipal.originAttributes
|
||||
);
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ this.ServiceWorkerCleanUp = {
|
|||
i,
|
||||
Ci.nsIServiceWorkerRegistrationInfo
|
||||
);
|
||||
if (sw.principal.URI.host == aHost) {
|
||||
if (sw.principal.host == aHost) {
|
||||
promises.push(unregisterServiceWorker(sw));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,7 +91,7 @@ var SiteDataTestUtils = {
|
|||
origin
|
||||
);
|
||||
Services.cookies.add(
|
||||
principal.URI.host,
|
||||
principal.host,
|
||||
principal.URI.pathQueryRef,
|
||||
name,
|
||||
value,
|
||||
|
@ -190,7 +190,7 @@ var SiteDataTestUtils = {
|
|||
principal.originAttributes,
|
||||
cookie.originAttributes
|
||||
) &&
|
||||
cookie.host.includes(principal.URI.host)
|
||||
cookie.host.includes(principal.host)
|
||||
) {
|
||||
return true;
|
||||
}
|
||||
|
@ -295,7 +295,7 @@ var SiteDataTestUtils = {
|
|||
return new Promise(resolve => {
|
||||
let listener = {
|
||||
onRegister: registration => {
|
||||
if (registration.principal.URI.host != url.host) {
|
||||
if (registration.principal.host != url.host) {
|
||||
return;
|
||||
}
|
||||
swm.removeListener(listener);
|
||||
|
@ -322,7 +322,7 @@ var SiteDataTestUtils = {
|
|||
return new Promise(resolve => {
|
||||
let listener = {
|
||||
onUnregister: registration => {
|
||||
if (registration.principal.URI.host != url.host) {
|
||||
if (registration.principal.host != url.host) {
|
||||
return;
|
||||
}
|
||||
swm.removeListener(listener);
|
||||
|
|
|
@ -41,12 +41,13 @@ amContentHandler.prototype = {
|
|||
|
||||
let sourceHost;
|
||||
let sourceURL;
|
||||
|
||||
try {
|
||||
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).
|
||||
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).
|
||||
}
|
||||
|
||||
let install = {
|
||||
|
|
|
@ -153,13 +153,12 @@ InstallTrigger.prototype = {
|
|||
|
||||
let sourceHost;
|
||||
let sourceURL;
|
||||
|
||||
try {
|
||||
sourceHost = this._principal.URI.host;
|
||||
sourceURL = this._principal.URI.spec;
|
||||
sourceHost = this._principal.host;
|
||||
sourceURL = this._principal.URI?.spec;
|
||||
} 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).
|
||||
// Ignore errors when retrieving the host for the principal (e.g. data:// principals raise
|
||||
// an NS_ERROR_FAILURE when principal.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.URI && triggeringPrincipal.URI.host,
|
||||
sourceHost: triggeringPrincipal.host,
|
||||
sourceURL: triggeringPrincipal.URI && triggeringPrincipal.URI.spec,
|
||||
};
|
||||
return this._apiTask("createInstall", [installOptions], installInfo => {
|
||||
|
|
Загрузка…
Ссылка в новой задаче