Skip to content

Commit 31441f8

Browse files
author
Jonathan Kingston
committed
Bug 1560455 - rename CodebasePrincipal to ContentPrincipal. r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D35504 --HG-- extra : moz-landing-system : lando
1 parent 3fda739 commit 31441f8

File tree

256 files changed

+651
-657
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

256 files changed

+651
-657
lines changed

browser/base/content/browser-contentblocking.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ var ThirdPartyCookies = {
728728
}
729729
}
730730

731-
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
731+
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
732732
origin
733733
);
734734
// Cookie exceptions get "inherited" from parent- to sub-domain, so we need to

browser/base/content/browser.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8314,7 +8314,7 @@ var CanvasPermissionPromptHelper = {
83148314
1
83158315
);
83168316

8317-
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
8317+
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
83188318
aData
83198319
);
83208320

browser/base/content/pageinfo/pageInfo.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,7 @@ function loadPageInfo(frameOuterWindowID, imageElement, browser) {
410410
uri.spec.startsWith("about:certerror")
411411
) {
412412
uri = browser.currentURI;
413-
principal = Services.scriptSecurityManager.createCodebasePrincipal(
413+
principal = Services.scriptSecurityManager.createContentPrincipal(
414414
uri,
415415
browser.contentPrincipal.originAttributes
416416
);

browser/base/content/tabbrowser.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6395,7 +6395,7 @@ var TabContextMenu = {
63956395
}
63966396

63976397
/* Create a triggering principal that is able to load the new tab
6398-
For codebase principals that are about: chrome: or resource: we need system to load them.
6398+
For content principals that are about: chrome: or resource: we need system to load them.
63996399
Anything other than system principal needs to have the new userContextId.
64006400
*/
64016401
let triggeringPrincipal;
@@ -6422,8 +6422,8 @@ var TabContextMenu = {
64226422
triggeringPrincipal = Services.scriptSecurityManager.createNullPrincipal(
64236423
{ userContextId }
64246424
);
6425-
} else if (triggeringPrincipal.isCodebasePrincipal) {
6426-
triggeringPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(
6425+
} else if (triggeringPrincipal.isContentPrincipal) {
6426+
triggeringPrincipal = Services.scriptSecurityManager.createContentPrincipal(
64276427
triggeringPrincipal.URI,
64286428
{ userContextId }
64296429
);

browser/base/content/test/alerts/browser_notification_open_settings.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ add_task(async function test_settingsOpen_observer() {
2222
let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, expectedURL);
2323
info("simulate a notifications-open-settings notification");
2424
let uri = NetUtil.newURI("https://example.com");
25-
let principal = Services.scriptSecurityManager.createCodebasePrincipal(
25+
let principal = Services.scriptSecurityManager.createContentPrincipal(
2626
uri,
2727
{}
2828
);

browser/base/content/test/caps/browser_principalSerialization_json.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ add_task(async function test_nullPrincipal() {
7676
add_task(async function test_contentPrincipal() {
7777
const contentId = "1";
7878
// fields
79-
const codebase = 0;
79+
const content = 0;
8080
// const domain = 1;
8181
const suffix = 2;
8282
// const csp = 3;
@@ -88,33 +88,33 @@ add_task(async function test_contentPrincipal() {
8888
let tests = [
8989
{
9090
input: { uri: "http://example.com/", OA: {} },
91-
expected: `{"${contentId}":{"${codebase}":"http://example.com/"}}`,
91+
expected: `{"${contentId}":{"${content}":"http://example.com/"}}`,
9292
},
9393
{
9494
input: { uri: "http://mozilla1.com/", OA: {} },
95-
expected: `{"${contentId}":{"${codebase}":"http://mozilla1.com/"}}`,
95+
expected: `{"${contentId}":{"${content}":"http://mozilla1.com/"}}`,
9696
},
9797
{
9898
input: { uri: "http://mozilla2.com/", OA: { userContextId: 0 } },
99-
expected: `{"${contentId}":{"${codebase}":"http://mozilla2.com/"}}`,
99+
expected: `{"${contentId}":{"${content}":"http://mozilla2.com/"}}`,
100100
},
101101
{
102102
input: { uri: "http://mozilla3.com/", OA: { userContextId: 2 } },
103-
expected: `{"${contentId}":{"${codebase}":"http://mozilla3.com/","${suffix}":"^userContextId=2"}}`,
103+
expected: `{"${contentId}":{"${content}":"http://mozilla3.com/","${suffix}":"^userContextId=2"}}`,
104104
},
105105
{
106106
input: { uri: "http://mozilla4.com/", OA: { privateBrowsingId: 1 } },
107-
expected: `{"${contentId}":{"${codebase}":"http://mozilla4.com/","${suffix}":"^privateBrowsingId=1"}}`,
107+
expected: `{"${contentId}":{"${content}":"http://mozilla4.com/","${suffix}":"^privateBrowsingId=1"}}`,
108108
},
109109
{
110110
input: { uri: "http://mozilla5.com/", OA: { privateBrowsingId: 0 } },
111-
expected: `{"${contentId}":{"${codebase}":"http://mozilla5.com/"}}`,
111+
expected: `{"${contentId}":{"${content}":"http://mozilla5.com/"}}`,
112112
},
113113
];
114114

115115
for (let test of tests) {
116116
let uri = Services.io.newURI(test.input.uri);
117-
let p = Services.scriptSecurityManager.createCodebasePrincipal(
117+
let p = Services.scriptSecurityManager.createContentPrincipal(
118118
uri,
119119
test.input.OA
120120
);

browser/base/content/test/contextMenu/browser_utilityOverlayPrincipal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ function test_openUILink_checkPrincipal() {
4747
"sanity: correct principalToInherit"
4848
);
4949
ok(
50-
content.document.nodePrincipal.isCodebasePrincipal,
50+
content.document.nodePrincipal.isContentPrincipal,
5151
"sanity: correct doc.nodePrincipal"
5252
);
5353
is(

browser/base/content/test/general/browser_gZipOfflineChild.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const URL =
99
registerCleanupFunction(function() {
1010
// Clean up after ourself
1111
let uri = Services.io.newURI(URL);
12-
let principal = Services.scriptSecurityManager.createCodebasePrincipal(
12+
let principal = Services.scriptSecurityManager.createContentPrincipal(
1313
uri,
1414
{}
1515
);

browser/base/content/test/general/browser_offlineQuotaNotification.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const URL =
1212
registerCleanupFunction(function() {
1313
// Clean up after ourself
1414
let uri = Services.io.newURI(URL);
15-
let principal = Services.scriptSecurityManager.createCodebasePrincipal(
15+
let principal = Services.scriptSecurityManager.createContentPrincipal(
1616
uri,
1717
{}
1818
);

browser/base/content/test/general/browser_web_channel.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ var gTests = [
303303
{ command: "unsolicited" },
304304
{
305305
browser: targetBrowser,
306-
principal: Services.scriptSecurityManager.createCodebasePrincipal(
306+
principal: Services.scriptSecurityManager.createContentPrincipal(
307307
targetURI,
308308
{}
309309
),
@@ -345,7 +345,7 @@ var gTests = [
345345
},
346346
async function(targetBrowser) {
347347
let mismatchURI = Services.io.newURI(HTTP_MISMATCH_PATH);
348-
let mismatchPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(
348+
let mismatchPrincipal = Services.scriptSecurityManager.createContentPrincipal(
349349
mismatchURI,
350350
{}
351351
);
@@ -360,7 +360,7 @@ var gTests = [
360360
}
361361
);
362362

363-
let targetPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(
363+
let targetPrincipal = Services.scriptSecurityManager.createContentPrincipal(
364364
targetURI,
365365
{}
366366
);

browser/base/content/test/permissions/browser_canvas_fingerprinting_resistance.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"use strict";
88

99
const kUrl = "https://example.com/";
10-
const kPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(
10+
const kPrincipal = Services.scriptSecurityManager.createContentPrincipal(
1111
Services.io.newURI(kUrl),
1212
{}
1313
);

browser/base/content/test/plugins/browser_subframe_access_hidden_plugins.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ add_task(async function test_plugin_accessible_in_subframe() {
3232
// be activated. This permission will be cleaned up inside
3333
// our registerCleanupFunction when the test ends.
3434
let ssm = Services.scriptSecurityManager;
35-
let principal = ssm.createCodebasePrincipalFromOrigin(DOMAIN_1);
35+
let principal = ssm.createContentPrincipalFromOrigin(DOMAIN_1);
3636
let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService(
3737
Ci.nsIPluginHost
3838
);

browser/base/content/test/sanitize/browser_cookiePermission_aboutURL.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ function checkDataForAboutURL() {
77
return new Promise(resolve => {
88
let data = true;
99
let uri = Services.io.newURI("about:newtab");
10-
let principal = Services.scriptSecurityManager.createCodebasePrincipal(
10+
let principal = Services.scriptSecurityManager.createContentPrincipal(
1111
uri,
1212
{}
1313
);
@@ -49,7 +49,7 @@ add_task(async function deleteStorageInAboutURL() {
4949
// Clean up.
5050
await Sanitizer.sanitize(["cookies", "offlineApps"]);
5151

52-
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
52+
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
5353
"about:newtab"
5454
);
5555
await new Promise(aResolve => {
@@ -92,7 +92,7 @@ add_task(async function deleteStorageOnlyCustomPermissionInAboutURL() {
9292
// Clean up.
9393
await Sanitizer.sanitize(["cookies", "offlineApps"]);
9494

95-
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
95+
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
9696
"about:newtab"
9797
);
9898
await new Promise(aResolve => {

browser/base/content/test/sanitize/browser_sanitize-offlineData.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function hasIndexedDB(origin) {
3030
return new Promise(resolve => {
3131
let hasData = true;
3232
let uri = Services.io.newURI(origin);
33-
let principal = Services.scriptSecurityManager.createCodebasePrincipal(
33+
let principal = Services.scriptSecurityManager.createContentPrincipal(
3434
uri,
3535
{}
3636
);

browser/base/content/test/sanitize/browser_sanitizeDialog.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -493,7 +493,7 @@ add_task(async function test_offline_cache() {
493493
// Prepare stuff, we will work with www.example.com
494494
var URL = "http://www.example.com";
495495
var URI = makeURI(URL);
496-
var principal = Services.scriptSecurityManager.createCodebasePrincipal(
496+
var principal = Services.scriptSecurityManager.createContentPrincipal(
497497
URI,
498498
{}
499499
);
@@ -575,7 +575,7 @@ add_task(async function test_offline_apps_permissions() {
575575
// Prepare stuff, we will work with www.example.com
576576
var URL = "http://www.example.com";
577577
var URI = makeURI(URL);
578-
var principal = Services.scriptSecurityManager.createCodebasePrincipal(
578+
var principal = Services.scriptSecurityManager.createContentPrincipal(
579579
URI,
580580
{}
581581
);

browser/base/content/test/sanitize/head.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ XPCOMUtils.defineLazyModuleGetters(this, {
1212

1313
function createIndexedDB(host, originAttributes) {
1414
let uri = Services.io.newURI("https://" + host);
15-
let principal = Services.scriptSecurityManager.createCodebasePrincipal(
15+
let principal = Services.scriptSecurityManager.createContentPrincipal(
1616
uri,
1717
originAttributes
1818
);
@@ -23,7 +23,7 @@ function checkIndexedDB(host, originAttributes) {
2323
return new Promise(resolve => {
2424
let data = true;
2525
let uri = Services.io.newURI("https://" + host);
26-
let principal = Services.scriptSecurityManager.createCodebasePrincipal(
26+
let principal = Services.scriptSecurityManager.createContentPrincipal(
2727
uri,
2828
originAttributes
2929
);

browser/base/content/test/trackingUI/browser_trackingUI_cookies_subview.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ add_task(async function testCookiesSubViewAllowed() {
290290
TPC_PREF,
291291
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER
292292
);
293-
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
293+
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
294294
"http://trackertest.org/"
295295
);
296296
Services.perms.addFromPrincipal(
@@ -374,12 +374,12 @@ add_task(async function testCookiesSubViewAllowedHeuristic() {
374374
TPC_PREF,
375375
Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER
376376
);
377-
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
377+
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
378378
"http://not-tracking.example.com/"
379379
);
380380

381381
// Pretend that the tracker has already been interacted with
382-
let trackerPrincipal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
382+
let trackerPrincipal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
383383
"http://trackertest.org/"
384384
);
385385
Services.perms.addFromPrincipal(

browser/base/content/utilityOverlay.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -446,7 +446,7 @@ function openLinkIn(url, where, params) {
446446
// can not do it for NullPrincipals since NullPrincipals are only
447447
// identical if they actually are the same object (See Bug: 1346759)
448448
function useOAForPrincipal(principal) {
449-
if (principal && principal.isCodebasePrincipal) {
449+
if (principal && principal.isContentPrincipal) {
450450
let attrs = {
451451
userContextId: aUserContextId,
452452
privateBrowsingId:

browser/base/content/webext-panels.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ function loadPanel(extensionId, extensionUrl, browserStyle) {
148148

149149
getBrowser(sidebar).then(browser => {
150150
let uri = Services.io.newURI(policy.getURL());
151-
let triggeringPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(
151+
let triggeringPrincipal = Services.scriptSecurityManager.createContentPrincipal(
152152
uri,
153153
{}
154154
);

browser/components/contextualidentity/test/browser/browser_forgetAPI_quota_clearStoragesForPrincipal.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ add_task(async function test_quota_clearStoragesForPrincipal() {
136136
caUtils
137137
);
138138
let httpURI = caUtils.makeURI("http://" + TEST_HOST);
139-
let httpPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(
139+
let httpPrincipal = Services.scriptSecurityManager.createContentPrincipal(
140140
httpURI,
141141
{}
142142
);

browser/components/extensions/parent/ext-browsingData.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ const clearIndexedDB = async function(options) {
113113
}
114114

115115
for (let item of request.result) {
116-
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
116+
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
117117
item.origin
118118
);
119119
let scheme = principal.URI.scheme;
@@ -182,7 +182,7 @@ const clearLocalStorage = async function(options) {
182182
}
183183

184184
for (let item of request.result) {
185-
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
185+
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
186186
item.origin
187187
);
188188
let host = principal.URI.hostPort;

browser/components/extensions/parent/ext-tabs.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -674,8 +674,8 @@ this.tabs = class extends ExtensionAPI {
674674
// Make sure things like about:blank and data: URIs never inherit,
675675
// and instead always get a NullPrincipal.
676676
options.allowInheritPrincipal = false;
677-
// Falling back to codebase here as about: requires it, however is safe.
678-
principal = Services.scriptSecurityManager.createCodebasePrincipal(
677+
// Falling back to content here as about: requires it, however is safe.
678+
principal = Services.scriptSecurityManager.createContentPrincipal(
679679
Services.io.newURI(url),
680680
{
681681
userContextId: options.userContextId,

browser/components/originattributes/test/browser/browser_favicon_firstParty.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ function clearAllPlacesFavicons() {
6868
}
6969

7070
function observeFavicon(aFirstPartyDomain, aExpectedCookie, aPageURI) {
71-
let expectedPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(
71+
let expectedPrincipal = Services.scriptSecurityManager.createContentPrincipal(
7272
aPageURI,
7373
{ firstPartyDomain: aFirstPartyDomain }
7474
);

browser/components/originattributes/test/browser/browser_favicon_userContextId.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ FaviconObserver.prototype = {
139139
reset(aUserContextId, aExpectedCookie, aPageURI, aFaviconURL) {
140140
this._curUserContextId = aUserContextId;
141141
this._expectedCookie = aExpectedCookie;
142-
this._expectedPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(
142+
this._expectedPrincipal = Services.scriptSecurityManager.createContentPrincipal(
143143
aPageURI,
144144
{ userContextId: aUserContextId }
145145
);

browser/components/originattributes/test/browser/browser_firstPartyIsolation_aboutPages.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ add_task(async function test_aboutURL() {
186186
let flags = am.getURIFlags(uri);
187187

188188
// We load pages with URI_SAFE_FOR_UNTRUSTED_CONTENT set, this means they
189-
// are not loaded with System Principal but with codebase principal.
189+
// are not loaded with System Principal but with content principal.
190190
// Also we skip pages with HIDE_FROM_ABOUTABOUT, some of them may have
191191
// errors while loading.
192192
if (
@@ -227,8 +227,8 @@ add_task(async function test_aboutURL() {
227227
"The about page should have firstPartyDomain set"
228228
);
229229
Assert.ok(
230-
content.document.nodePrincipal.isCodebasePrincipal,
231-
"The principal should be a codebase principal."
230+
content.document.nodePrincipal.isContentPrincipal,
231+
"The principal should be a content principal."
232232
);
233233
});
234234

browser/components/originattributes/test/browser/browser_firstPartyIsolation_about_newtab.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,8 @@ add_task(async function test_aboutNewTab() {
3838
"about:newtab should have firstPartyDomain set"
3939
);
4040
Assert.ok(
41-
content.document.nodePrincipal.isCodebasePrincipal,
42-
"The principal should be a codebase principal."
41+
content.document.nodePrincipal.isContentPrincipal,
42+
"The principal should be a content principal."
4343
);
4444
});
4545

browser/components/originattributes/test/browser/head.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ async function openTabInUserContext(aURL, aUserContextId) {
3939
let originAttributes = {
4040
userContextId: aUserContextId,
4141
};
42-
let triggeringPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(
42+
let triggeringPrincipal = Services.scriptSecurityManager.createContentPrincipal(
4343
makeURI(aURL),
4444
originAttributes
4545
);

browser/components/preferences/in-content/tests/browser_bug795764_cachedisabled.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ function test() {
66

77
// Adding one fake site so that the SiteDataManager would run.
88
// Otherwise, without any site then it would just return so we would end up in not testing SiteDataManager.
9-
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
9+
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
1010
"https://www.foo.com"
1111
);
1212
Services.perms.addFromPrincipal(

0 commit comments

Comments
 (0)