From 31441f82ea44f171c2358de74d36bee4cc55c155 Mon Sep 17 00:00:00 2001 From: Jonathan Kingston Date: Mon, 8 Jul 2019 16:37:45 +0000 Subject: [PATCH] Bug 1560455 - rename CodebasePrincipal to ContentPrincipal. r=ckerschb Differential Revision: https://phabricator.services.mozilla.com/D35504 --HG-- extra : moz-landing-system : lando --- .../base/content/browser-contentblocking.js | 2 +- browser/base/content/browser.js | 2 +- browser/base/content/pageinfo/pageInfo.js | 2 +- browser/base/content/tabbrowser.js | 6 +- .../browser_notification_open_settings.js | 2 +- .../browser_principalSerialization_json.js | 16 +-- .../browser_utilityOverlayPrincipal.js | 2 +- .../test/general/browser_gZipOfflineChild.js | 2 +- .../browser_offlineQuotaNotification.js | 2 +- .../test/general/browser_web_channel.js | 6 +- ...rowser_canvas_fingerprinting_resistance.js | 2 +- .../browser_subframe_access_hidden_plugins.js | 2 +- .../browser_cookiePermission_aboutURL.js | 6 +- .../sanitize/browser_sanitize-offlineData.js | 2 +- .../test/sanitize/browser_sanitizeDialog.js | 4 +- browser/base/content/test/sanitize/head.js | 4 +- .../browser_trackingUI_cookies_subview.js | 6 +- browser/base/content/utilityOverlay.js | 2 +- browser/base/content/webext-panels.js | 2 +- ...rgetAPI_quota_clearStoragesForPrincipal.js | 2 +- .../extensions/parent/ext-browsingData.js | 4 +- .../components/extensions/parent/ext-tabs.js | 4 +- .../browser/browser_favicon_firstParty.js | 2 +- .../browser/browser_favicon_userContextId.js | 2 +- .../browser_firstPartyIsolation_aboutPages.js | 6 +- ...rowser_firstPartyIsolation_about_newtab.js | 4 +- .../originattributes/test/browser/head.js | 2 +- .../tests/browser_bug795764_cachedisabled.js | 2 +- .../tests/siteData/browser_siteData.js | 4 +- .../in-content/tests/siteData/head.js | 4 +- browser/components/preferences/permissions.js | 4 +- browser/components/preferences/translation.js | 4 +- .../browser_oa_private_browsing_window.js | 4 +- .../browser_privatebrowsing_favicon.js | 2 +- .../safebrowsing/content/test/head.js | 2 +- .../components/sessionstore/SessionStore.jsm | 4 +- browser/components/uitour/UITour.jsm | 2 +- .../pdfjs/content/PdfStreamConverter.jsm | 2 +- browser/extensions/webcompat/AboutCompat.jsm | 2 +- browser/modules/Sanitizer.jsm | 4 +- browser/modules/SiteDataManager.jsm | 6 +- browser/modules/SitePermissions.jsm | 8 +- browser/modules/webrtcUI.jsm | 2 +- build/win32/orderfile.txt | 16 +-- build/win64/orderfile.txt | 16 +-- caps/BasePrincipal.cpp | 50 ++++---- caps/BasePrincipal.h | 24 ++-- caps/ContentPrincipal.cpp | 118 +++++++++--------- caps/ContentPrincipal.h | 10 +- caps/NullPrincipal.cpp | 8 +- caps/nsIPrincipal.idl | 12 +- caps/nsIScriptSecurityManager.idl | 14 +-- caps/nsScriptSecurityManager.cpp | 20 +-- .../gtest/TestPrincipalSerialization.cpp | 31 +++-- caps/tests/mochitest/browser_checkloaduri.js | 2 +- caps/tests/mochitest/test_addonMayLoad.html | 4 +- caps/tests/unit/test_origin.js | 32 ++--- ...einspector_csslogic-content-stylesheets.js | 2 +- devtools/client/storage/test/head.js | 2 +- ...er_webconsole_trackingprotection_errors.js | 2 +- ...bconsole_warning_group_content_blocking.js | 2 +- devtools/server/actors/storage.js | 2 +- devtools/shared/DevToolsUtils.js | 4 +- devtools/shared/indexed-db.js | 2 +- .../tests/unit/test_console_filtering.js | 2 +- docshell/base/nsDocShell.cpp | 14 +-- docshell/base/nsDocShellLoadState.cpp | 2 +- .../browser/browser_loadDisallowInherit.js | 2 +- dom/base/ContentAreaDropListener.jsm | 2 +- dom/base/Document.cpp | 32 ++--- dom/base/Document.h | 12 +- dom/base/Navigator.cpp | 10 +- dom/base/nsContentSink.cpp | 12 +- dom/base/nsContentUtils.cpp | 2 +- dom/base/nsGlobalWindowOuter.cpp | 8 +- dom/base/test/browser_multiple_popups.js | 6 +- .../test/unit/test_structuredcloneholder.js | 4 +- .../mochitest/browserElement_Auth.js | 8 +- dom/html/HTMLIFrameElement.cpp | 2 +- dom/indexedDB/test/bug839193.js | 2 +- dom/indexedDB/test/head.js | 6 +- .../test/unit/test_bad_origin_directory.js | 2 +- .../test/unit/test_idle_maintenance.js | 2 +- .../test/unit/test_metadata2Restore.js | 2 +- .../test/unit/test_metadataRestore.js | 2 +- .../test/unit/test_oldDirectories.js | 2 +- .../test/unit/test_open_for_principal.js | 2 +- .../test/unit/xpcshell-head-parent-process.js | 2 +- .../storage/nsIStorageActivityService.idl | 2 +- dom/ipc/ContentChild.cpp | 2 +- dom/ipc/ContentParent.cpp | 2 +- .../test/gtest/TestLocalStorage.cpp | 8 +- dom/localstorage/test/unit/head.js | 2 +- dom/media/DOMMediaStream.cpp | 2 +- dom/media/MediaStreamTrack.cpp | 2 +- .../test_notification_insecure_context.html | 2 +- dom/plugins/base/nsPluginInstanceOwner.cpp | 4 +- dom/presentation/PresentationRequest.cpp | 2 +- dom/push/PushRecord.jsm | 2 +- dom/push/test/xpcshell/test_permissions.js | 2 +- dom/push/test/xpcshell/test_quota_observer.js | 2 +- dom/push/test/xpcshell/test_service_child.js | 2 +- dom/quota/ActorsParent.cpp | 2 +- dom/quota/test/head.js | 4 +- dom/quota/test/unit/head.js | 2 +- dom/script/ScriptLoader.cpp | 4 +- dom/script/ScriptLoader.h | 2 +- dom/security/featurepolicy/FeaturePolicy.cpp | 2 +- .../featurepolicy/FeaturePolicyParser.cpp | 2 +- .../test/gtest/TestFeaturePolicyParser.cpp | 8 +- dom/security/fuzztest/csp_fuzzer.cpp | 2 +- dom/security/nsContentSecurityManager.cpp | 6 +- dom/security/nsMixedContentBlocker.cpp | 2 +- dom/security/test/general/test_bug1277803.xul | 2 +- dom/security/test/gtest/TestCSPParser.cpp | 2 +- dom/security/test/gtest/TestSecureContext.cpp | 4 +- dom/security/test/unit/test_csp_reports.js | 2 +- .../test_isOriginPotentiallyTrustworthy.js | 4 +- .../ServiceWorkerInterceptController.cpp | 2 +- dom/serviceworkers/ServiceWorkerManager.cpp | 12 +- .../test/browser_storage_recovery.js | 2 +- dom/serviceworkers/test/test_scopes.html | 2 +- dom/storage/StorageActivityService.cpp | 8 +- .../browser_ConsoleAPI_originAttributes.js | 2 +- .../browser/browser_localStorage_e10s.js | 4 +- .../browser_localStorage_snapshotting_e10s.js | 2 +- .../chrome/test_MozDomFullscreen_event.xul | 2 +- .../localstorage/localStorageCommon.js | 2 +- .../test_localStorageFromChrome.xhtml | 2 +- dom/xslt/xslt/txMozillaStylesheetCompiler.cpp | 4 +- extensions/permissions/nsPermission.cpp | 4 +- extensions/permissions/nsPermission.h | 2 +- .../permissions/nsPermissionManager.cpp | 16 +-- .../test/gtest/PermissionManagerTest.cpp | 4 +- .../test/unit/test_permmanager_cleardata.js | 2 +- .../test/unit/test_permmanager_defaults.js | 20 +-- .../test/unit/test_permmanager_expiration.js | 2 +- .../test_permmanager_getPermissionObject.js | 2 +- .../test/unit/test_permmanager_idn.js | 2 +- .../test_permmanager_load_invalid_entries.js | 2 +- .../test/unit/test_permmanager_local_files.js | 2 +- .../test/unit/test_permmanager_matches.js | 48 +++---- .../test/unit/test_permmanager_matchesuri.js | 2 +- .../unit/test_permmanager_notifications.js | 2 +- .../test/unit/test_permmanager_removesince.js | 4 +- .../test/unit/test_permmanager_subdomains.js | 2 +- image/test/unit/test_private_channel.js | 2 +- ipc/glue/BackgroundUtils.cpp | 2 +- js/xpconnect/loader/mozJSSubScriptLoader.cpp | 4 +- js/xpconnect/src/Sandbox.cpp | 18 +-- js/xpconnect/src/XPCJSRuntime.cpp | 2 +- .../tests/unit/test_allowedDomainsXHR.js | 4 +- .../unit/test_nuke_sandbox_event_listeners.js | 2 +- .../unit/test_nuke_webextension_wrappers.js | 2 +- layout/build/nsContentDLF.h | 2 +- layout/svg/SVGContextPaint.cpp | 2 +- layout/tools/reftest/manifest.jsm | 4 +- mobile/android/components/AboutRedirector.js | 2 +- .../geckoview/GeckoViewPermission.js | 2 +- .../extensions/webcompat/AboutCompat.jsm | 2 +- mobile/android/modules/Sanitizer.jsm | 2 +- .../modules/geckoview/GeckoViewNavigation.jsm | 2 +- netwerk/base/Predictor.cpp | 4 +- netwerk/base/nsILoadInfo.idl | 4 +- netwerk/cookie/nsCookieService.cpp | 4 +- netwerk/cookie/test/unit/test_rawSameSite.js | 2 +- netwerk/protocol/http/HttpChannelParent.cpp | 2 +- .../res/SubstitutingProtocolHandler.h | 2 +- netwerk/test/TestCookie.cpp | 4 +- netwerk/test/gtest/TestMozURL.cpp | 2 +- .../test/unit/test_auth_dialog_permission.js | 2 +- netwerk/test/unit/test_auth_jar.js | 4 +- netwerk/test/unit/test_authentication.js | 2 +- netwerk/test/unit/test_bug1195415.js | 30 ++--- netwerk/test/unit/test_bug337744.js | 2 +- .../test/unit/test_cache2-32-clear-origin.js | 2 +- netwerk/test/unit/test_cacheflags.js | 2 +- .../test_fallback_no-cache-entry_canceled.js | 2 +- .../test_fallback_no-cache-entry_passing.js | 2 +- ...k_redirect-to-different-origin_canceled.js | 2 +- ...ck_redirect-to-different-origin_passing.js | 2 +- .../test_fallback_request-error_canceled.js | 2 +- .../test_fallback_request-error_passing.js | 2 +- .../test_fallback_response-error_canceled.js | 2 +- .../test_fallback_response-error_passing.js | 2 +- .../test_offlinecache_custom-directory.js | 2 +- netwerk/test/unit/test_permmgr.js | 6 +- netwerk/test/unit/test_referrer.js | 2 +- .../test/unit/test_referrer_cross_origin.js | 2 +- netwerk/test/unit/test_speculative_connect.js | 2 +- .../unit/test_suspend_channel_on_authRetry.js | 2 +- ...est_trackingProtection_annotateChannels.js | 4 +- services/sync/Weave.jsm | 2 +- .../content/SpecialPowersAPI.jsm | 4 +- .../meta/infrastructure/server/__dir__.ini | 2 +- .../service-worker/__dir__.ini | 2 +- .../web-platform/meta/websockets/__dir__.ini | 2 +- .../meta/websockets/binary/__dir__.ini | 2 +- .../meta/websockets/constructor/__dir__.ini | 2 +- .../wptrunner/executors/executormarionette.py | 2 +- toolkit/actors/WebChannelChild.jsm | 2 +- .../components/alerts/test/test_image.html | 2 +- .../antitracking/AntiTrackingCommon.cpp | 4 +- .../antitracking/ContentBlockingAllowList.jsm | 2 +- .../components/cleardata/ClearDataService.jsm | 16 +-- .../cleardata/SiteDataTestUtils.jsm | 8 +- .../tests/browser/browser_serviceworkers.js | 4 +- .../cleardata/tests/unit/test_cookies.js | 4 +- .../cleardata/tests/unit/test_downloads.js | 2 +- .../tests/unit/test_network_cache.js | 2 +- .../cleardata/tests/unit/test_passwords.js | 2 +- .../cleardata/tests/unit/test_permissions.js | 12 +- .../tests/unit/test_storage_permission.js | 6 +- toolkit/components/extensions/Extension.jsm | 6 +- .../components/extensions/ExtensionChild.jsm | 2 +- .../extensions/ExtensionContent.jsm | 2 +- .../extensions/WebExtensionContentScript.h | 2 +- .../extensions/WebExtensionPolicy.cpp | 6 +- .../test/mochitest/head_unlimitedStorage.js | 2 +- .../extensions/test/xpcshell/head_sync.js | 2 +- ...t_ext_contentscript_triggeringPrincipal.js | 2 +- .../test/xpcshell/test_ext_contexts.js | 4 +- .../xpcshell/test_ext_trustworthy_origin.js | 2 +- .../xpcshell/test_ext_webRequest_suspend.js | 2 +- .../extensions/webrequest/ChannelWrapper.cpp | 4 +- .../normandy/content/AboutPages.jsm | 2 +- .../passwordmgr/InsecurePasswordUtils.jsm | 2 +- ...r_hasInsecureLoginForms_streamConverter.js | 2 +- ...LoginManagerParent_doAutocompleteSearch.js | 2 +- ...LoginManagerParent_getGeneratedPassword.js | 4 +- ...ManagerParent_onGeneratedPasswordFilled.js | 2 +- toolkit/components/reader/ReaderMode.jsm | 2 +- .../RemoteWebNavigation.jsm | 2 +- .../ApplicationReputation.cpp | 2 +- .../test/unit/test_app_rep.js | 12 +- toolkit/components/search/SearchEngine.jsm | 4 +- .../sessionstore/SessionStoreUtils.cpp | 2 +- .../tests/mochitest/test_classifier.html | 2 +- .../mochitest/test_classifier_match.html | 2 +- .../tests/unit/head_urlclassifier.js | 4 +- .../tests/unit/test_dbservice.js | 12 +- .../tests/unit/test_digest256.js | 4 +- .../tests/unit/test_shouldclassify.js | 2 +- .../viewsource/content/viewSourceUtils.js | 2 +- toolkit/content/contentAreaUtils.js | 2 +- .../content/widgets/browser-custom-element.js | 2 +- .../test/unit/test_removeDataFromDomain.js | 8 +- toolkit/modules/BrowserUtils.jsm | 10 +- toolkit/modules/E10SUtils.jsm | 6 +- toolkit/modules/PermissionsUtils.jsm | 9 +- .../modules/tests/modules/MockDocument.jsm | 2 +- .../mozapps/extensions/AddonContentPolicy.cpp | 2 +- .../test/xpcshell/test_permissions.js | 2 +- .../test/xpcshell/test_permissions_prefs.js | 2 +- .../prefetch/nsOfflineCacheUpdateService.cpp | 4 +- widget/android/nsAppShell.cpp | 2 +- 256 files changed, 651 insertions(+), 657 deletions(-) diff --git a/browser/base/content/browser-contentblocking.js b/browser/base/content/browser-contentblocking.js index a4a836814036..80b7fd6358d4 100644 --- a/browser/base/content/browser-contentblocking.js +++ b/browser/base/content/browser-contentblocking.js @@ -728,7 +728,7 @@ var ThirdPartyCookies = { } } - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( origin ); // Cookie exceptions get "inherited" from parent- to sub-domain, so we need to diff --git a/browser/base/content/browser.js b/browser/base/content/browser.js index 948d52df3832..90c509af64dd 100644 --- a/browser/base/content/browser.js +++ b/browser/base/content/browser.js @@ -8314,7 +8314,7 @@ var CanvasPermissionPromptHelper = { 1 ); - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( aData ); diff --git a/browser/base/content/pageinfo/pageInfo.js b/browser/base/content/pageinfo/pageInfo.js index e0d713eae3c9..8442caf19f6d 100644 --- a/browser/base/content/pageinfo/pageInfo.js +++ b/browser/base/content/pageinfo/pageInfo.js @@ -410,7 +410,7 @@ function loadPageInfo(frameOuterWindowID, imageElement, browser) { uri.spec.startsWith("about:certerror") ) { uri = browser.currentURI; - principal = Services.scriptSecurityManager.createCodebasePrincipal( + principal = Services.scriptSecurityManager.createContentPrincipal( uri, browser.contentPrincipal.originAttributes ); diff --git a/browser/base/content/tabbrowser.js b/browser/base/content/tabbrowser.js index 5b387e7154d6..3df91030b349 100644 --- a/browser/base/content/tabbrowser.js +++ b/browser/base/content/tabbrowser.js @@ -6395,7 +6395,7 @@ var TabContextMenu = { } /* Create a triggering principal that is able to load the new tab - For codebase principals that are about: chrome: or resource: we need system to load them. + For content principals that are about: chrome: or resource: we need system to load them. Anything other than system principal needs to have the new userContextId. */ let triggeringPrincipal; @@ -6422,8 +6422,8 @@ var TabContextMenu = { triggeringPrincipal = Services.scriptSecurityManager.createNullPrincipal( { userContextId } ); - } else if (triggeringPrincipal.isCodebasePrincipal) { - triggeringPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + } else if (triggeringPrincipal.isContentPrincipal) { + triggeringPrincipal = Services.scriptSecurityManager.createContentPrincipal( triggeringPrincipal.URI, { userContextId } ); diff --git a/browser/base/content/test/alerts/browser_notification_open_settings.js b/browser/base/content/test/alerts/browser_notification_open_settings.js index 0c53d2ef13d9..339d236cc53d 100644 --- a/browser/base/content/test/alerts/browser_notification_open_settings.js +++ b/browser/base/content/test/alerts/browser_notification_open_settings.js @@ -22,7 +22,7 @@ add_task(async function test_settingsOpen_observer() { let tabPromise = BrowserTestUtils.waitForNewTab(gBrowser, expectedURL); info("simulate a notifications-open-settings notification"); let uri = NetUtil.newURI("https://example.com"); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/browser/base/content/test/caps/browser_principalSerialization_json.js b/browser/base/content/test/caps/browser_principalSerialization_json.js index d8365bb83758..04afed1e2a44 100644 --- a/browser/base/content/test/caps/browser_principalSerialization_json.js +++ b/browser/base/content/test/caps/browser_principalSerialization_json.js @@ -76,7 +76,7 @@ add_task(async function test_nullPrincipal() { add_task(async function test_contentPrincipal() { const contentId = "1"; // fields - const codebase = 0; + const content = 0; // const domain = 1; const suffix = 2; // const csp = 3; @@ -88,33 +88,33 @@ add_task(async function test_contentPrincipal() { let tests = [ { input: { uri: "http://example.com/", OA: {} }, - expected: `{"${contentId}":{"${codebase}":"http://example.com/"}}`, + expected: `{"${contentId}":{"${content}":"http://example.com/"}}`, }, { input: { uri: "http://mozilla1.com/", OA: {} }, - expected: `{"${contentId}":{"${codebase}":"http://mozilla1.com/"}}`, + expected: `{"${contentId}":{"${content}":"http://mozilla1.com/"}}`, }, { input: { uri: "http://mozilla2.com/", OA: { userContextId: 0 } }, - expected: `{"${contentId}":{"${codebase}":"http://mozilla2.com/"}}`, + expected: `{"${contentId}":{"${content}":"http://mozilla2.com/"}}`, }, { input: { uri: "http://mozilla3.com/", OA: { userContextId: 2 } }, - expected: `{"${contentId}":{"${codebase}":"http://mozilla3.com/","${suffix}":"^userContextId=2"}}`, + expected: `{"${contentId}":{"${content}":"http://mozilla3.com/","${suffix}":"^userContextId=2"}}`, }, { input: { uri: "http://mozilla4.com/", OA: { privateBrowsingId: 1 } }, - expected: `{"${contentId}":{"${codebase}":"http://mozilla4.com/","${suffix}":"^privateBrowsingId=1"}}`, + expected: `{"${contentId}":{"${content}":"http://mozilla4.com/","${suffix}":"^privateBrowsingId=1"}}`, }, { input: { uri: "http://mozilla5.com/", OA: { privateBrowsingId: 0 } }, - expected: `{"${contentId}":{"${codebase}":"http://mozilla5.com/"}}`, + expected: `{"${contentId}":{"${content}":"http://mozilla5.com/"}}`, }, ]; for (let test of tests) { let uri = Services.io.newURI(test.input.uri); - let p = Services.scriptSecurityManager.createCodebasePrincipal( + let p = Services.scriptSecurityManager.createContentPrincipal( uri, test.input.OA ); diff --git a/browser/base/content/test/contextMenu/browser_utilityOverlayPrincipal.js b/browser/base/content/test/contextMenu/browser_utilityOverlayPrincipal.js index 2184731da80d..a9d728c4c087 100644 --- a/browser/base/content/test/contextMenu/browser_utilityOverlayPrincipal.js +++ b/browser/base/content/test/contextMenu/browser_utilityOverlayPrincipal.js @@ -47,7 +47,7 @@ function test_openUILink_checkPrincipal() { "sanity: correct principalToInherit" ); ok( - content.document.nodePrincipal.isCodebasePrincipal, + content.document.nodePrincipal.isContentPrincipal, "sanity: correct doc.nodePrincipal" ); is( diff --git a/browser/base/content/test/general/browser_gZipOfflineChild.js b/browser/base/content/test/general/browser_gZipOfflineChild.js index 170240c59788..d389923fb9ff 100644 --- a/browser/base/content/test/general/browser_gZipOfflineChild.js +++ b/browser/base/content/test/general/browser_gZipOfflineChild.js @@ -9,7 +9,7 @@ const URL = registerCleanupFunction(function() { // Clean up after ourself let uri = Services.io.newURI(URL); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/browser/base/content/test/general/browser_offlineQuotaNotification.js b/browser/base/content/test/general/browser_offlineQuotaNotification.js index 7121450ea575..45a82df625a4 100644 --- a/browser/base/content/test/general/browser_offlineQuotaNotification.js +++ b/browser/base/content/test/general/browser_offlineQuotaNotification.js @@ -12,7 +12,7 @@ const URL = registerCleanupFunction(function() { // Clean up after ourself let uri = Services.io.newURI(URL); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/browser/base/content/test/general/browser_web_channel.js b/browser/base/content/test/general/browser_web_channel.js index 6495d8321046..7074ca7b897d 100644 --- a/browser/base/content/test/general/browser_web_channel.js +++ b/browser/base/content/test/general/browser_web_channel.js @@ -303,7 +303,7 @@ var gTests = [ { command: "unsolicited" }, { browser: targetBrowser, - principal: Services.scriptSecurityManager.createCodebasePrincipal( + principal: Services.scriptSecurityManager.createContentPrincipal( targetURI, {} ), @@ -345,7 +345,7 @@ var gTests = [ }, async function(targetBrowser) { let mismatchURI = Services.io.newURI(HTTP_MISMATCH_PATH); - let mismatchPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let mismatchPrincipal = Services.scriptSecurityManager.createContentPrincipal( mismatchURI, {} ); @@ -360,7 +360,7 @@ var gTests = [ } ); - let targetPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let targetPrincipal = Services.scriptSecurityManager.createContentPrincipal( targetURI, {} ); diff --git a/browser/base/content/test/permissions/browser_canvas_fingerprinting_resistance.js b/browser/base/content/test/permissions/browser_canvas_fingerprinting_resistance.js index 8738e922285c..064557218a2d 100644 --- a/browser/base/content/test/permissions/browser_canvas_fingerprinting_resistance.js +++ b/browser/base/content/test/permissions/browser_canvas_fingerprinting_resistance.js @@ -7,7 +7,7 @@ "use strict"; const kUrl = "https://example.com/"; -const kPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( +const kPrincipal = Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI(kUrl), {} ); diff --git a/browser/base/content/test/plugins/browser_subframe_access_hidden_plugins.js b/browser/base/content/test/plugins/browser_subframe_access_hidden_plugins.js index 5909346f41f6..62d55cb5cfd2 100644 --- a/browser/base/content/test/plugins/browser_subframe_access_hidden_plugins.js +++ b/browser/base/content/test/plugins/browser_subframe_access_hidden_plugins.js @@ -32,7 +32,7 @@ add_task(async function test_plugin_accessible_in_subframe() { // be activated. This permission will be cleaned up inside // our registerCleanupFunction when the test ends. let ssm = Services.scriptSecurityManager; - let principal = ssm.createCodebasePrincipalFromOrigin(DOMAIN_1); + let principal = ssm.createContentPrincipalFromOrigin(DOMAIN_1); let pluginHost = Cc["@mozilla.org/plugin/host;1"].getService( Ci.nsIPluginHost ); diff --git a/browser/base/content/test/sanitize/browser_cookiePermission_aboutURL.js b/browser/base/content/test/sanitize/browser_cookiePermission_aboutURL.js index df06ac453031..2c951a4aa95f 100644 --- a/browser/base/content/test/sanitize/browser_cookiePermission_aboutURL.js +++ b/browser/base/content/test/sanitize/browser_cookiePermission_aboutURL.js @@ -7,7 +7,7 @@ function checkDataForAboutURL() { return new Promise(resolve => { let data = true; let uri = Services.io.newURI("about:newtab"); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); @@ -49,7 +49,7 @@ add_task(async function deleteStorageInAboutURL() { // Clean up. await Sanitizer.sanitize(["cookies", "offlineApps"]); - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( "about:newtab" ); await new Promise(aResolve => { @@ -92,7 +92,7 @@ add_task(async function deleteStorageOnlyCustomPermissionInAboutURL() { // Clean up. await Sanitizer.sanitize(["cookies", "offlineApps"]); - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( "about:newtab" ); await new Promise(aResolve => { diff --git a/browser/base/content/test/sanitize/browser_sanitize-offlineData.js b/browser/base/content/test/sanitize/browser_sanitize-offlineData.js index 8e82e9946f6b..c8e9cfa634a8 100644 --- a/browser/base/content/test/sanitize/browser_sanitize-offlineData.js +++ b/browser/base/content/test/sanitize/browser_sanitize-offlineData.js @@ -30,7 +30,7 @@ function hasIndexedDB(origin) { return new Promise(resolve => { let hasData = true; let uri = Services.io.newURI(origin); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/browser/base/content/test/sanitize/browser_sanitizeDialog.js b/browser/base/content/test/sanitize/browser_sanitizeDialog.js index d6871b2faaec..9f1a79b0c710 100644 --- a/browser/base/content/test/sanitize/browser_sanitizeDialog.js +++ b/browser/base/content/test/sanitize/browser_sanitizeDialog.js @@ -493,7 +493,7 @@ add_task(async function test_offline_cache() { // Prepare stuff, we will work with www.example.com var URL = "http://www.example.com"; var URI = makeURI(URL); - var principal = Services.scriptSecurityManager.createCodebasePrincipal( + var principal = Services.scriptSecurityManager.createContentPrincipal( URI, {} ); @@ -575,7 +575,7 @@ add_task(async function test_offline_apps_permissions() { // Prepare stuff, we will work with www.example.com var URL = "http://www.example.com"; var URI = makeURI(URL); - var principal = Services.scriptSecurityManager.createCodebasePrincipal( + var principal = Services.scriptSecurityManager.createContentPrincipal( URI, {} ); diff --git a/browser/base/content/test/sanitize/head.js b/browser/base/content/test/sanitize/head.js index b589ca32819d..de273a338d8d 100644 --- a/browser/base/content/test/sanitize/head.js +++ b/browser/base/content/test/sanitize/head.js @@ -12,7 +12,7 @@ XPCOMUtils.defineLazyModuleGetters(this, { function createIndexedDB(host, originAttributes) { let uri = Services.io.newURI("https://" + host); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, originAttributes ); @@ -23,7 +23,7 @@ function checkIndexedDB(host, originAttributes) { return new Promise(resolve => { let data = true; let uri = Services.io.newURI("https://" + host); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, originAttributes ); diff --git a/browser/base/content/test/trackingUI/browser_trackingUI_cookies_subview.js b/browser/base/content/test/trackingUI/browser_trackingUI_cookies_subview.js index e3f2695473d9..97b6b1d22212 100644 --- a/browser/base/content/test/trackingUI/browser_trackingUI_cookies_subview.js +++ b/browser/base/content/test/trackingUI/browser_trackingUI_cookies_subview.js @@ -290,7 +290,7 @@ add_task(async function testCookiesSubViewAllowed() { TPC_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER ); - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( "http://trackertest.org/" ); Services.perms.addFromPrincipal( @@ -374,12 +374,12 @@ add_task(async function testCookiesSubViewAllowedHeuristic() { TPC_PREF, Ci.nsICookieService.BEHAVIOR_REJECT_TRACKER ); - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( "http://not-tracking.example.com/" ); // Pretend that the tracker has already been interacted with - let trackerPrincipal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let trackerPrincipal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( "http://trackertest.org/" ); Services.perms.addFromPrincipal( diff --git a/browser/base/content/utilityOverlay.js b/browser/base/content/utilityOverlay.js index 7180d0829b84..9c627d0fe042 100644 --- a/browser/base/content/utilityOverlay.js +++ b/browser/base/content/utilityOverlay.js @@ -446,7 +446,7 @@ function openLinkIn(url, where, params) { // can not do it for NullPrincipals since NullPrincipals are only // identical if they actually are the same object (See Bug: 1346759) function useOAForPrincipal(principal) { - if (principal && principal.isCodebasePrincipal) { + if (principal && principal.isContentPrincipal) { let attrs = { userContextId: aUserContextId, privateBrowsingId: diff --git a/browser/base/content/webext-panels.js b/browser/base/content/webext-panels.js index b91c1998e20a..5dec4b997523 100644 --- a/browser/base/content/webext-panels.js +++ b/browser/base/content/webext-panels.js @@ -148,7 +148,7 @@ function loadPanel(extensionId, extensionUrl, browserStyle) { getBrowser(sidebar).then(browser => { let uri = Services.io.newURI(policy.getURL()); - let triggeringPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let triggeringPrincipal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/browser/components/contextualidentity/test/browser/browser_forgetAPI_quota_clearStoragesForPrincipal.js b/browser/components/contextualidentity/test/browser/browser_forgetAPI_quota_clearStoragesForPrincipal.js index 0095deb6e5f0..4d9dd74f837c 100644 --- a/browser/components/contextualidentity/test/browser/browser_forgetAPI_quota_clearStoragesForPrincipal.js +++ b/browser/components/contextualidentity/test/browser/browser_forgetAPI_quota_clearStoragesForPrincipal.js @@ -136,7 +136,7 @@ add_task(async function test_quota_clearStoragesForPrincipal() { caUtils ); let httpURI = caUtils.makeURI("http://" + TEST_HOST); - let httpPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let httpPrincipal = Services.scriptSecurityManager.createContentPrincipal( httpURI, {} ); diff --git a/browser/components/extensions/parent/ext-browsingData.js b/browser/components/extensions/parent/ext-browsingData.js index bf3b04de10df..6c4d1b9113cb 100644 --- a/browser/components/extensions/parent/ext-browsingData.js +++ b/browser/components/extensions/parent/ext-browsingData.js @@ -113,7 +113,7 @@ const clearIndexedDB = async function(options) { } for (let item of request.result) { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( item.origin ); let scheme = principal.URI.scheme; @@ -182,7 +182,7 @@ const clearLocalStorage = async function(options) { } for (let item of request.result) { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( item.origin ); let host = principal.URI.hostPort; diff --git a/browser/components/extensions/parent/ext-tabs.js b/browser/components/extensions/parent/ext-tabs.js index 0d4e04a88588..62c3b029c971 100644 --- a/browser/components/extensions/parent/ext-tabs.js +++ b/browser/components/extensions/parent/ext-tabs.js @@ -674,8 +674,8 @@ this.tabs = class extends ExtensionAPI { // Make sure things like about:blank and data: URIs never inherit, // and instead always get a NullPrincipal. options.allowInheritPrincipal = false; - // Falling back to codebase here as about: requires it, however is safe. - principal = Services.scriptSecurityManager.createCodebasePrincipal( + // Falling back to content here as about: requires it, however is safe. + principal = Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI(url), { userContextId: options.userContextId, diff --git a/browser/components/originattributes/test/browser/browser_favicon_firstParty.js b/browser/components/originattributes/test/browser/browser_favicon_firstParty.js index f130ccb65e56..fdf47d3d416c 100644 --- a/browser/components/originattributes/test/browser/browser_favicon_firstParty.js +++ b/browser/components/originattributes/test/browser/browser_favicon_firstParty.js @@ -68,7 +68,7 @@ function clearAllPlacesFavicons() { } function observeFavicon(aFirstPartyDomain, aExpectedCookie, aPageURI) { - let expectedPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let expectedPrincipal = Services.scriptSecurityManager.createContentPrincipal( aPageURI, { firstPartyDomain: aFirstPartyDomain } ); diff --git a/browser/components/originattributes/test/browser/browser_favicon_userContextId.js b/browser/components/originattributes/test/browser/browser_favicon_userContextId.js index 7cac7d573eb5..3332d35f3231 100644 --- a/browser/components/originattributes/test/browser/browser_favicon_userContextId.js +++ b/browser/components/originattributes/test/browser/browser_favicon_userContextId.js @@ -139,7 +139,7 @@ FaviconObserver.prototype = { reset(aUserContextId, aExpectedCookie, aPageURI, aFaviconURL) { this._curUserContextId = aUserContextId; this._expectedCookie = aExpectedCookie; - this._expectedPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + this._expectedPrincipal = Services.scriptSecurityManager.createContentPrincipal( aPageURI, { userContextId: aUserContextId } ); diff --git a/browser/components/originattributes/test/browser/browser_firstPartyIsolation_aboutPages.js b/browser/components/originattributes/test/browser/browser_firstPartyIsolation_aboutPages.js index 14fbf65a0318..83ec633fcc21 100644 --- a/browser/components/originattributes/test/browser/browser_firstPartyIsolation_aboutPages.js +++ b/browser/components/originattributes/test/browser/browser_firstPartyIsolation_aboutPages.js @@ -186,7 +186,7 @@ add_task(async function test_aboutURL() { let flags = am.getURIFlags(uri); // We load pages with URI_SAFE_FOR_UNTRUSTED_CONTENT set, this means they - // are not loaded with System Principal but with codebase principal. + // are not loaded with System Principal but with content principal. // Also we skip pages with HIDE_FROM_ABOUTABOUT, some of them may have // errors while loading. if ( @@ -227,8 +227,8 @@ add_task(async function test_aboutURL() { "The about page should have firstPartyDomain set" ); Assert.ok( - content.document.nodePrincipal.isCodebasePrincipal, - "The principal should be a codebase principal." + content.document.nodePrincipal.isContentPrincipal, + "The principal should be a content principal." ); }); diff --git a/browser/components/originattributes/test/browser/browser_firstPartyIsolation_about_newtab.js b/browser/components/originattributes/test/browser/browser_firstPartyIsolation_about_newtab.js index 5af2c83df5a4..016276687641 100644 --- a/browser/components/originattributes/test/browser/browser_firstPartyIsolation_about_newtab.js +++ b/browser/components/originattributes/test/browser/browser_firstPartyIsolation_about_newtab.js @@ -38,8 +38,8 @@ add_task(async function test_aboutNewTab() { "about:newtab should have firstPartyDomain set" ); Assert.ok( - content.document.nodePrincipal.isCodebasePrincipal, - "The principal should be a codebase principal." + content.document.nodePrincipal.isContentPrincipal, + "The principal should be a content principal." ); }); diff --git a/browser/components/originattributes/test/browser/head.js b/browser/components/originattributes/test/browser/head.js index 53503c4e9c60..1e2831609702 100644 --- a/browser/components/originattributes/test/browser/head.js +++ b/browser/components/originattributes/test/browser/head.js @@ -39,7 +39,7 @@ async function openTabInUserContext(aURL, aUserContextId) { let originAttributes = { userContextId: aUserContextId, }; - let triggeringPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let triggeringPrincipal = Services.scriptSecurityManager.createContentPrincipal( makeURI(aURL), originAttributes ); diff --git a/browser/components/preferences/in-content/tests/browser_bug795764_cachedisabled.js b/browser/components/preferences/in-content/tests/browser_bug795764_cachedisabled.js index 9e0c93c0800a..1890e0e97ced 100644 --- a/browser/components/preferences/in-content/tests/browser_bug795764_cachedisabled.js +++ b/browser/components/preferences/in-content/tests/browser_bug795764_cachedisabled.js @@ -6,7 +6,7 @@ function test() { // Adding one fake site so that the SiteDataManager would run. // Otherwise, without any site then it would just return so we would end up in not testing SiteDataManager. - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( "https://www.foo.com" ); Services.perms.addFromPrincipal( diff --git a/browser/components/preferences/in-content/tests/siteData/browser_siteData.js b/browser/components/preferences/in-content/tests/siteData/browser_siteData.js index ff9dc754882c..06bed5eea787 100644 --- a/browser/components/preferences/in-content/tests/siteData/browser_siteData.js +++ b/browser/components/preferences/in-content/tests/siteData/browser_siteData.js @@ -5,7 +5,7 @@ function getPersistentStoragePermStatus(origin) { let uri = Services.io.newURI(origin); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); @@ -57,7 +57,7 @@ add_task(async function() { // Always remember to clean up OfflineAppCacheHelper.clear(); await new Promise(resolve => { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( TEST_QUOTA_USAGE_ORIGIN ); let request = Services.qms.clearStoragesForPrincipal( diff --git a/browser/components/preferences/in-content/tests/siteData/head.js b/browser/components/preferences/in-content/tests/siteData/head.js index 708fc500da03..ca8ab9c03d36 100644 --- a/browser/components/preferences/in-content/tests/siteData/head.js +++ b/browser/components/preferences/in-content/tests/siteData/head.js @@ -229,7 +229,7 @@ async function addTestData(data) { SiteDataTestUtils.addToCookies(site.origin, Cu.now()); } - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( site.origin ); hosts.push(principal.URI.host); @@ -273,7 +273,7 @@ function promiseServiceWorkersCleared() { function promiseServiceWorkerRegisteredFor(url) { return BrowserTestUtils.waitForCondition(() => { try { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( url ); let sw = serviceWorkerManager.getRegistrationByPrincipal( diff --git a/browser/components/preferences/permissions.js b/browser/components/preferences/permissions.js index c938bc7aae4c..8e4661767e0a 100644 --- a/browser/components/preferences/permissions.js +++ b/browser/components/preferences/permissions.js @@ -211,7 +211,7 @@ var gPermissionManager = { }, _addNewPrincipalToList(list, uri) { - list.push(Services.scriptSecurityManager.createCodebasePrincipal(uri, {})); + list.push(Services.scriptSecurityManager.createContentPrincipal(uri, {})); // If we have ended up with an unknown scheme, the following will throw. list[list.length - 1].origin; }, @@ -230,7 +230,7 @@ var gPermissionManager = { // permissions from being entered by the user. try { let uri = Services.io.newURI(input_url); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/browser/components/preferences/translation.js b/browser/components/preferences/translation.js index 2f3bb6206e61..0d847401e3b9 100644 --- a/browser/components/preferences/translation.js +++ b/browser/components/preferences/translation.js @@ -214,7 +214,7 @@ var gTranslationExceptions = { onSiteDeleted() { let removedSites = this._siteTree.getSelectedItems(); for (let origin of removedSites) { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( origin ); Services.perms.removeFromPrincipal(principal, kPermissionType); @@ -230,7 +230,7 @@ var gTranslationExceptions = { this._siteTree.tree.rowCountChanged(0, -removedSites.length); for (let origin of removedSites) { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( origin ); Services.perms.removeFromPrincipal(principal, kPermissionType); diff --git a/browser/components/privatebrowsing/test/browser/browser_oa_private_browsing_window.js b/browser/components/privatebrowsing/test/browser/browser_oa_private_browsing_window.js index 7dd4448b1719..e6738e0ced5b 100644 --- a/browser/components/privatebrowsing/test/browser/browser_oa_private_browsing_window.js +++ b/browser/components/privatebrowsing/test/browser/browser_oa_private_browsing_window.js @@ -38,8 +38,8 @@ add_task( let triggeringPrincipal = channel.loadInfo.triggeringPrincipal; ok( - triggeringPrincipal.isCodebasePrincipal, - "sanity check to ensure principal is a codebasePrincipal" + triggeringPrincipal.isContentPrincipal, + "sanity check to ensure principal is a contentPrincipal" ); is( triggeringPrincipal.URI.spec, diff --git a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_favicon.js b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_favicon.js index 43fd795eb272..0d66e09cbca7 100644 --- a/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_favicon.js +++ b/browser/components/privatebrowsing/test/browser/browser_privatebrowsing_favicon.js @@ -54,7 +54,7 @@ function observeFavicon(aIsPrivate, aExpectedCookie, aPageURI) { attr.privateBrowsingId = 1; } - let expectedPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let expectedPrincipal = Services.scriptSecurityManager.createContentPrincipal( aPageURI, attr ); diff --git a/browser/components/safebrowsing/content/test/head.js b/browser/components/safebrowsing/content/test/head.js index 7384a481a3ea..617295788372 100644 --- a/browser/components/safebrowsing/content/test/head.js +++ b/browser/components/safebrowsing/content/test/head.js @@ -79,7 +79,7 @@ function waitForDBInit(callback) { // The second part: we might have missed the event. Just do // an internal database lookup to confirm if the url has been // added. - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI(PHISH_URL), {} ); diff --git a/browser/components/sessionstore/SessionStore.jsm b/browser/components/sessionstore/SessionStore.jsm index 2bb4ea31926b..6b77ee83bdda 100644 --- a/browser/components/sessionstore/SessionStore.jsm +++ b/browser/components/sessionstore/SessionStore.jsm @@ -5814,10 +5814,10 @@ var SessionStoreInternal = { let { frameLoader } = browser; if (frameLoader.remoteTab) { let attrs = browser.contentPrincipal.originAttributes; - let dataPrincipal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let dataPrincipal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( origin ); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( dataPrincipal.URI, attrs ); diff --git a/browser/components/uitour/UITour.jsm b/browser/components/uitour/UITour.jsm index e8cde366e22f..fd4707562c02 100644 --- a/browser/components/uitour/UITour.jsm +++ b/browser/components/uitour/UITour.jsm @@ -1630,7 +1630,7 @@ var UITour = { let url = "about:newtab"; aWindow.openLinkIn(url, "current", { targetBrowser: aBrowser, - triggeringPrincipal: Services.scriptSecurityManager.createCodebasePrincipal( + triggeringPrincipal: Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI(url), {} ), diff --git a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm index da3e44806713..9cb04028bdb9 100644 --- a/browser/extensions/pdfjs/content/PdfStreamConverter.jsm +++ b/browser/extensions/pdfjs/content/PdfStreamConverter.jsm @@ -1129,7 +1129,7 @@ PdfStreamConverter.prototype = { // e.g. useful for NoScript. Make make sure we reuse the origin attributes // from the request channel to keep isolation consistent. var uri = NetUtil.newURI(PDF_VIEWER_WEB_PAGE); - var resourcePrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + var resourcePrincipal = Services.scriptSecurityManager.createContentPrincipal( uri, aRequest.loadInfo.originAttributes ); diff --git a/browser/extensions/webcompat/AboutCompat.jsm b/browser/extensions/webcompat/AboutCompat.jsm index a8b6726ac89a..3e13381be63b 100644 --- a/browser/extensions/webcompat/AboutCompat.jsm +++ b/browser/extensions/webcompat/AboutCompat.jsm @@ -27,7 +27,7 @@ AboutCompat.prototype = { const channel = Services.io.newChannelFromURIWithLoadInfo(uri, aLoadInfo); channel.originalURI = aURI; - channel.owner = Services.scriptSecurityManager.createCodebasePrincipal( + channel.owner = Services.scriptSecurityManager.createContentPrincipal( uri, aLoadInfo.originAttributes ); diff --git a/browser/modules/Sanitizer.jsm b/browser/modules/Sanitizer.jsm index db7e0a2238e5..9b6f71fbfc6b 100644 --- a/browser/modules/Sanitizer.jsm +++ b/browser/modules/Sanitizer.jsm @@ -780,7 +780,7 @@ class PrincipalsCollector { let list = []; for (let item of request.result) { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( item.origin ); let uri = principal.URI; @@ -824,7 +824,7 @@ class PrincipalsCollector { // Cookies and permissions are handled by origin/host. Doesn't matter if we // use http: or https: schema here. principals.push( - Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + Services.scriptSecurityManager.createContentPrincipalFromOrigin( "https://" + host ) ); diff --git a/browser/modules/SiteDataManager.jsm b/browser/modules/SiteDataManager.jsm index c4ac04c24d85..024b838a8a96 100644 --- a/browser/modules/SiteDataManager.jsm +++ b/browser/modules/SiteDataManager.jsm @@ -142,7 +142,7 @@ var SiteDataManager = { // An non-persistent-storage site with 0 byte quota usage is redundant for us so skip it. continue; } - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( item.origin ); let uri = principal.URI; @@ -212,7 +212,7 @@ var SiteDataManager = { // A site with 0 byte appcache usage is redundant for us so skip it. continue; } - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( group ); let uri = principal.URI; @@ -309,7 +309,7 @@ var SiteDataManager = { new Promise(resolve => { // We are clearing *All* across OAs so need to ensure a principal without suffix here, // or the call of `clearStoragesForPrincipal` would fail. - principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( originNoSuffix ); let request = this._qms.clearStoragesForPrincipal( diff --git a/browser/modules/SitePermissions.jsm b/browser/modules/SitePermissions.jsm index 93cd0dc7166c..66447a41a04a 100644 --- a/browser/modules/SitePermissions.jsm +++ b/browser/modules/SitePermissions.jsm @@ -292,7 +292,7 @@ var SitePermissions = { } let principal = uri - ? Services.scriptSecurityManager.createCodebasePrincipal(uri, {}) + ? Services.scriptSecurityManager.createContentPrincipal(uri, {}) : null; return this.getAllByPrincipal(principal); }, @@ -572,7 +572,7 @@ var SitePermissions = { } let principal = uri - ? Services.scriptSecurityManager.createCodebasePrincipal(uri, {}) + ? Services.scriptSecurityManager.createContentPrincipal(uri, {}) : null; return this.getForPrincipal(principal, permissionID, browser); }, @@ -669,7 +669,7 @@ var SitePermissions = { } let principal = uri - ? Services.scriptSecurityManager.createCodebasePrincipal(uri, {}) + ? Services.scriptSecurityManager.createContentPrincipal(uri, {}) : null; return this.setForPrincipal(principal, permissionID, state, scope, browser); }, @@ -788,7 +788,7 @@ var SitePermissions = { } let principal = uri - ? Services.scriptSecurityManager.createCodebasePrincipal(uri, {}) + ? Services.scriptSecurityManager.createContentPrincipal(uri, {}) : null; return this.removeFromPrincipal(principal, permissionID, browser); }, diff --git a/browser/modules/webrtcUI.jsm b/browser/modules/webrtcUI.jsm index de62e2d6f2c5..69d61c2be384 100644 --- a/browser/modules/webrtcUI.jsm +++ b/browser/modules/webrtcUI.jsm @@ -475,7 +475,7 @@ function prompt(aBrowser, aRequest) { requestTypes, } = aRequest; - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( aRequest.origin ); diff --git a/build/win32/orderfile.txt b/build/win32/orderfile.txt index 4746a9cb1626..ca10fb4cc60d 100644 --- a/build/win32/orderfile.txt +++ b/build/win32/orderfile.txt @@ -3700,15 +3700,15 @@ NS_NewWindowsRegKey ?Construct_nsIScriptSecurityManager@@YA?AW4nsresult@@PAVnsISupports@@ABUnsID@@PAPAX@Z ?QueryInterface@nsScriptSecurityManager@@UAG?AW4nsresult@@ABUnsID@@PAPAX@Z ?Release@nsScriptSecurityManager@@UAGKXZ -?CreateCodebasePrincipal@nsScriptSecurityManager@@UAG?AW4nsresult@@PAVnsIURI@@V?$Handle@TValue@JS@@@JS@@PAUJSContext@@PAPAVnsIPrincipal@@@Z +?CreateContentPrincipal@nsScriptSecurityManager@@UAG?AW4nsresult@@PAVnsIURI@@V?$Handle@TValue@JS@@@JS@@PAUJSContext@@PAPAVnsIPrincipal@@@Z ?InitIds@OriginAttributesDictionary@dom@mozilla@@CA_NPAUJSContext@@PAUOriginAttributesDictionaryAtoms@23@@Z ??$emplace@AAPAUJSContext@@PAVJSObject@@@?$Maybe@V?$Rooted@PAVJSObject@@@JS@@@mozilla@@QAEXAAPAUJSContext@@$$QAPAVJSObject@@@Z ??$emplace@AAPAUJSContext@@@?$Maybe@V?$Rooted@TValue@JS@@@JS@@@mozilla@@QAEXAAPAUJSContext@@@Z -?CreateCodebasePrincipal@BasePrincipal@mozilla@@SA?AU?$already_AddRefed@VBasePrincipal@mozilla@@@@PAVnsIURI@@ABVOriginAttributes@2@@Z +?CreateContentPrincipal@BasePrincipal@mozilla@@SA?AU?$already_AddRefed@VBasePrincipal@mozilla@@@@PAVnsIURI@@ABVOriginAttributes@2@@Z ?GenerateOriginNoSuffixFromURI@ContentPrincipal@mozilla@@SA?AW4nsresult@@PAVnsIURI@@AAV?$nsTSubstring@D@@@Z ?NS_GetInnermostURI@@YA?AU?$already_AddRefed@VnsIURI@@@@PAVnsIURI@@@Z ?GetBlobURLPrincipal@BlobURLProtocolHandler@dom@mozilla@@SA_NPAVnsIURI@@PAPAVnsIPrincipal@@@Z -?CreateCodebasePrincipal@BasePrincipal@mozilla@@CA?AU?$already_AddRefed@VBasePrincipal@mozilla@@@@PAVnsIURI@@ABVOriginAttributes@2@ABV?$nsTSubstring@D@@@Z +?CreateContentPrincipal@BasePrincipal@mozilla@@CA?AU?$already_AddRefed@VBasePrincipal@mozilla@@@@PAVnsIURI@@ABVOriginAttributes@2@ABV?$nsTSubstring@D@@@Z ?GetFlagsForURI@ExtensionProtocolHandler@net@mozilla@@UAG?AW4nsresult@@PAVnsIURI@@PAI@Z ??0URLInfo@extensions@mozilla@@QAE@PAVnsIURI@@@Z ?GetByURL@ExtensionPolicyService@mozilla@@QAEPAVWebExtensionPolicy@extensions@2@ABVURLInfo@42@@Z @@ -15479,7 +15479,7 @@ Gecko_DestroyAnonymousContentList ?SendRpcMessage@nsFrameMessageManager@@QAEXPAUJSContext@@ABV?$nsTSubstring@_S@@V?$Handle@TValue@JS@@@JS@@V?$Handle@PAVJSObject@@@5@PAVnsIPrincipal@@AAV?$nsTArray@TValue@JS@@@@AAVErrorResult@mozilla@@@Z ?GetContent@InProcessTabChildMessageManager@dom@mozilla@@UAE?AU?$Nullable@VWindowProxyHolder@dom@mozilla@@@23@AAVErrorResult@3@@Z ?MaybeCreateDoc@nsPIDOMWindowOuter@@IAEXXZ -?GetLoadContextCodebasePrincipal@nsScriptSecurityManager@@UAG?AW4nsresult@@PAVnsIURI@@PAVnsILoadContext@@PAPAVnsIPrincipal@@@Z +?GetLoadContextContentPrincipal@nsScriptSecurityManager@@UAG?AW4nsresult@@PAVnsIURI@@PAVnsILoadContext@@PAPAVnsIPrincipal@@@Z ?GetNearestWidget@nsView@@QBEPAVnsIWidget@@PAUnsPoint@@@Z ?GetNearestWidget@nsView@@QBEPAVnsIWidget@@PAUnsPoint@@H@Z ?InvalidateHierarchy@nsView@@AAEXXZ @@ -19217,7 +19217,7 @@ Gecko_BeginWritingCString ?UpdateAggregateCallbacks@nsHttpChannel@net@mozilla@@AAEXXZ ?SetLoadFlags@HttpBaseChannel@net@mozilla@@UAG?AW4nsresult@@I@Z ?SetInheritApplicationCache@nsHttpChannel@net@mozilla@@UAG?AW4nsresult@@_N@Z -?GetDocShellCodebasePrincipal@nsScriptSecurityManager@@UAG?AW4nsresult@@PAVnsIURI@@PAVnsIDocShell@@PAPAVnsIPrincipal@@@Z +?GetDocShellContentPrincipal@nsScriptSecurityManager@@UAG?AW4nsresult@@PAVnsIURI@@PAVnsIDocShell@@PAPAVnsIPrincipal@@@Z ?NS_ShouldCheckAppCache@@YA_NPAVnsIPrincipal@@@Z ?GetInstance@nsOfflineCacheUpdateService@@SA?AU?$already_AddRefed@VnsOfflineCacheUpdateService@@@@XZ ??0nsOfflineCacheUpdateService@@QAE@XZ @@ -19550,7 +19550,7 @@ XPCOMService_GetThirdPartyUtil ?GetTopLevelPrincipal@LoadInfo@net@mozilla@@UAEPAVnsIPrincipal@@XZ ?GetIsMainDocumentChannel@HttpBaseChannel@net@mozilla@@UAG?AW4nsresult@@PA_N@Z ?GetAddrInfo@net@mozilla@@YA?AW4nsresult@@ABV?$nsTSubstring@D@@GGPAPAVAddrInfo@12@_N@Z -?GetIsCodebasePrincipal@BasePrincipal@mozilla@@UAG?AW4nsresult@@PA_N@Z +?GetIsContentPrincipal@BasePrincipal@mozilla@@UAG?AW4nsresult@@PA_N@Z ?CookiePermission@CookieSettings@net@mozilla@@UAG?AW4nsresult@@PAVnsIPrincipal@@PAI@Z ?GetInstance@nsPermissionManager@@SAPAV1@XZ ?Create@nsPermission@@SA?AU?$already_AddRefed@VnsPermission@@@@PAVnsIPrincipal@@ABV?$nsTSubstring@D@@II_J@Z @@ -20982,7 +20982,7 @@ nsEscape ?ParseUserInfo@nsAuthURLParser@@UAG?AW4nsresult@@PBDHPAIPAH12@Z ?SetPort@?$TemplatedMutator@VSubstitutingURL@net@mozilla@@@nsStandardURL@net@mozilla@@EAG?AW4nsresult@@HPAPAVnsIURIMutator@@@Z ?SetPort@nsStandardURL@net@mozilla@@MAE?AW4nsresult@@H@Z -?CreateCodebasePrincipal@BasePrincipal@mozilla@@SA?AU?$already_AddRefed@VBasePrincipal@mozilla@@@@ABV?$nsTSubstring@D@@@Z +?CreateContentPrincipal@BasePrincipal@mozilla@@SA?AU?$already_AddRefed@VBasePrincipal@mozilla@@@@ABV?$nsTSubstring@D@@@Z ??0?$nsCOMPtr@VnsIBinaryInputStream@@@@QAE@XZ ?QueryInterface@nsBinaryInputStream@@UAG?AW4nsresult@@ABUnsID@@PAPAX@Z ?SetInputStream@nsBinaryInputStream@@UAG?AW4nsresult@@PAVnsIInputStream@@@Z @@ -21156,7 +21156,7 @@ nsEscape ?ShouldPrepareForIntercept@ServiceWorkerInterceptController@dom@mozilla@@UAG?AW4nsresult@@PAVnsIURI@@PAVnsIChannel@@PA_N@Z ?IsAvailable@ServiceWorkerManager@dom@mozilla@@QAE_NPAVnsIPrincipal@@PAVnsIURI@@@Z ?GetServiceWorkerRegistrationInfo@ServiceWorkerManager@dom@mozilla@@ABE?AU?$already_AddRefed@VServiceWorkerRegistrationInfo@dom@mozilla@@@@PAVnsIPrincipal@@PAVnsIURI@@@Z -?IsCodebasePrincipal@ContentPrincipal@mozilla@@UBE_NXZ +?IsContentPrincipal@ContentPrincipal@mozilla@@UBE_NXZ ??$?0$0BGL@@?$nsTLiteralString@D@@QAE@AAY0BGL@$$CBD@Z ?SetSchemaVersion@Connection@storage@mozilla@@UAG?AW4nsresult@@H@Z ?BindStringByName@Statement@storage@mozilla@@UAG?AW4nsresult@@ABV?$nsTSubstring@D@@ABV?$nsTSubstring@_S@@@Z diff --git a/build/win64/orderfile.txt b/build/win64/orderfile.txt index 92c8ab81aae1..509f1c33659e 100644 --- a/build/win64/orderfile.txt +++ b/build/win64/orderfile.txt @@ -3665,15 +3665,15 @@ NS_NewWindowsRegKey ?Construct_nsIScriptSecurityManager@@YA?AW4nsresult@@PEAVnsISupports@@AEBUnsID@@PEAPEAX@Z ?QueryInterface@nsScriptSecurityManager@@UEAA?AW4nsresult@@AEBUnsID@@PEAPEAX@Z ?Release@nsScriptSecurityManager@@UEAAKXZ -?CreateCodebasePrincipal@nsScriptSecurityManager@@UEAA?AW4nsresult@@PEAVnsIURI@@V?$Handle@TValue@JS@@@JS@@PEAUJSContext@@PEAPEAVnsIPrincipal@@@Z +?CreateContentPrincipal@nsScriptSecurityManager@@UEAA?AW4nsresult@@PEAVnsIURI@@V?$Handle@TValue@JS@@@JS@@PEAUJSContext@@PEAPEAVnsIPrincipal@@@Z ?InitIds@OriginAttributesDictionary@dom@mozilla@@CA_NPEAUJSContext@@PEAUOriginAttributesDictionaryAtoms@23@@Z ??$emplace@AEAPEAUJSContext@@PEAVJSObject@@@?$Maybe@V?$Rooted@PEAVJSObject@@@JS@@@mozilla@@QEAAXAEAPEAUJSContext@@$$QEAPEAVJSObject@@@Z ??$emplace@AEAPEAUJSContext@@@?$Maybe@V?$Rooted@TValue@JS@@@JS@@@mozilla@@QEAAXAEAPEAUJSContext@@@Z -?CreateCodebasePrincipal@BasePrincipal@mozilla@@SA?AU?$already_AddRefed@VBasePrincipal@mozilla@@@@PEAVnsIURI@@AEBVOriginAttributes@2@@Z +?CreateContentPrincipal@BasePrincipal@mozilla@@SA?AU?$already_AddRefed@VBasePrincipal@mozilla@@@@PEAVnsIURI@@AEBVOriginAttributes@2@@Z ?GenerateOriginNoSuffixFromURI@ContentPrincipal@mozilla@@SA?AW4nsresult@@PEAVnsIURI@@AEAV?$nsTSubstring@D@@@Z ?NS_GetInnermostURI@@YA?AU?$already_AddRefed@VnsIURI@@@@PEAVnsIURI@@@Z ?GetBlobURLPrincipal@BlobURLProtocolHandler@dom@mozilla@@SA_NPEAVnsIURI@@PEAPEAVnsIPrincipal@@@Z -?CreateCodebasePrincipal@BasePrincipal@mozilla@@CA?AU?$already_AddRefed@VBasePrincipal@mozilla@@@@PEAVnsIURI@@AEBVOriginAttributes@2@AEBV?$nsTSubstring@D@@@Z +?CreateContentPrincipal@BasePrincipal@mozilla@@CA?AU?$already_AddRefed@VBasePrincipal@mozilla@@@@PEAVnsIURI@@AEBVOriginAttributes@2@AEBV?$nsTSubstring@D@@@Z ?GetFlagsForURI@ExtensionProtocolHandler@net@mozilla@@UEAA?AW4nsresult@@PEAVnsIURI@@PEAI@Z ??0URLInfo@extensions@mozilla@@QEAA@PEAVnsIURI@@@Z ?GetByURL@ExtensionPolicyService@mozilla@@QEAAPEAVWebExtensionPolicy@extensions@2@AEBVURLInfo@42@@Z @@ -15412,7 +15412,7 @@ Gecko_DestroyAnonymousContentList ?SendRpcMessage@nsFrameMessageManager@@QEAAXPEAUJSContext@@AEBV?$nsTSubstring@_S@@V?$Handle@TValue@JS@@@JS@@V?$Handle@PEAVJSObject@@@5@PEAVnsIPrincipal@@AEAV?$nsTArray@TValue@JS@@@@AEAVErrorResult@mozilla@@@Z ?GetContent@InProcessTabChildMessageManager@dom@mozilla@@UEAA?AU?$Nullable@VWindowProxyHolder@dom@mozilla@@@23@AEAVErrorResult@3@@Z ?MaybeCreateDoc@nsPIDOMWindowOuter@@IEAAXXZ -?GetLoadContextCodebasePrincipal@nsScriptSecurityManager@@UEAA?AW4nsresult@@PEAVnsIURI@@PEAVnsILoadContext@@PEAPEAVnsIPrincipal@@@Z +?GetLoadContextContentPrincipal@nsScriptSecurityManager@@UEAA?AW4nsresult@@PEAVnsIURI@@PEAVnsILoadContext@@PEAPEAVnsIPrincipal@@@Z ?GetNearestWidget@nsView@@QEBAPEAVnsIWidget@@PEAUnsPoint@@@Z ?GetNearestWidget@nsView@@QEBAPEAVnsIWidget@@PEAUnsPoint@@H@Z ?InvalidateHierarchy@nsView@@AEAAXXZ @@ -19135,7 +19135,7 @@ Gecko_BeginWritingCString ?UpdateAggregateCallbacks@nsHttpChannel@net@mozilla@@AEAAXXZ ?SetLoadFlags@HttpBaseChannel@net@mozilla@@UEAA?AW4nsresult@@I@Z ?SetInheritApplicationCache@nsHttpChannel@net@mozilla@@UEAA?AW4nsresult@@_N@Z -?GetDocShellCodebasePrincipal@nsScriptSecurityManager@@UEAA?AW4nsresult@@PEAVnsIURI@@PEAVnsIDocShell@@PEAPEAVnsIPrincipal@@@Z +?GetDocShellContentPrincipal@nsScriptSecurityManager@@UEAA?AW4nsresult@@PEAVnsIURI@@PEAVnsIDocShell@@PEAPEAVnsIPrincipal@@@Z ?NS_ShouldCheckAppCache@@YA_NPEAVnsIPrincipal@@@Z ?GetInstance@nsOfflineCacheUpdateService@@SA?AU?$already_AddRefed@VnsOfflineCacheUpdateService@@@@XZ ??0nsOfflineCacheUpdateService@@QEAA@XZ @@ -19460,7 +19460,7 @@ XPCOMService_GetThirdPartyUtil ?IsFirstPartyStorageAccessGrantedFor@AntiTrackingCommon@mozilla@@SA_NPEAVnsIHttpChannel@@PEAVnsIURI@@PEAI@Z ?GetTopLevelPrincipal@LoadInfo@net@mozilla@@UEAAPEAVnsIPrincipal@@XZ ?GetIsMainDocumentChannel@HttpBaseChannel@net@mozilla@@UEAA?AW4nsresult@@PEA_N@Z -?GetIsCodebasePrincipal@BasePrincipal@mozilla@@UEAA?AW4nsresult@@PEA_N@Z +?GetIsContentPrincipal@BasePrincipal@mozilla@@UEAA?AW4nsresult@@PEA_N@Z ?CookiePermission@CookieSettings@net@mozilla@@UEAA?AW4nsresult@@PEAVnsIPrincipal@@PEAI@Z ?GetInstance@nsPermissionManager@@SAPEAV1@XZ ?Run@?$RunnableMethodImpl@PEAVnsHostResolver@@P81@EAAXXZ$00$0A@$$V@detail@mozilla@@UEAA?AW4nsresult@@XZ @@ -20797,7 +20797,7 @@ nsEscape ?ParseUserInfo@nsAuthURLParser@@UEAA?AW4nsresult@@PEBDHPEAIPEAH12@Z ?SetPort@?$TemplatedMutator@VSubstitutingURL@net@mozilla@@@nsStandardURL@net@mozilla@@EEAA?AW4nsresult@@HPEAPEAVnsIURIMutator@@@Z ?SetPort@nsStandardURL@net@mozilla@@MEAA?AW4nsresult@@H@Z -?CreateCodebasePrincipal@BasePrincipal@mozilla@@SA?AU?$already_AddRefed@VBasePrincipal@mozilla@@@@AEBV?$nsTSubstring@D@@@Z +?CreateContentPrincipal@BasePrincipal@mozilla@@SA?AU?$already_AddRefed@VBasePrincipal@mozilla@@@@AEBV?$nsTSubstring@D@@@Z ?flushConsoleMessages@nsCSPContext@@QEAAXXZ ?ClearAndRetainStorage@?$nsTArray_Impl@UConsoleMsgQueueElem@@UnsTArrayInfallibleAllocator@@@@QEAAXXZ ?PopulateContentSecurityPolicies@ipc@mozilla@@YA?AW4nsresult@@PEAVnsIContentSecurityPolicy@@AEAV?$nsTArray@VContentSecurityPolicy@ipc@mozilla@@@@@Z @@ -21054,7 +21054,7 @@ nsEscape ?ShouldPrepareForIntercept@ServiceWorkerInterceptController@dom@mozilla@@UEAA?AW4nsresult@@PEAVnsIURI@@PEAVnsIChannel@@PEA_N@Z ?IsAvailable@ServiceWorkerManager@dom@mozilla@@QEAA_NPEAVnsIPrincipal@@PEAVnsIURI@@@Z ?GetServiceWorkerRegistrationInfo@ServiceWorkerManager@dom@mozilla@@AEBA?AU?$already_AddRefed@VServiceWorkerRegistrationInfo@dom@mozilla@@@@PEAVnsIPrincipal@@PEAVnsIURI@@@Z -?IsCodebasePrincipal@ContentPrincipal@mozilla@@UEBA_NXZ +?IsContentPrincipal@ContentPrincipal@mozilla@@UEBA_NXZ ?GetServiceWorkerRegistrationInfo@ServiceWorkerManager@dom@mozilla@@AEBA?AU?$already_AddRefed@VServiceWorkerRegistrationInfo@dom@mozilla@@@@AEBV?$nsTSubstring@D@@PEAVnsIURI@@@Z ?FindScopeForPath@ServiceWorkerManager@dom@mozilla@@CA_NAEBV?$nsTSubstring@D@@0PEAPEAURegistrationDataPerPrincipal@123@AEAV4@@Z ?CacheQueueSize@CacheStorageService@net@mozilla@@SAI_N@Z diff --git a/caps/BasePrincipal.cpp b/caps/BasePrincipal.cpp index 6afef7bce0ff..54c58ff60273 100644 --- a/caps/BasePrincipal.cpp +++ b/caps/BasePrincipal.cpp @@ -67,7 +67,7 @@ BasePrincipal::GetSiteOrigin(nsACString& aSiteOrigin) { // {"0":{"0":"moz-nullprincipal:{56cac540-864d-47e7-8e25-1614eab5155e}"}} -> // {"0":"moz-nullprincipal:{56cac540-864d-47e7-8e25-1614eab5155e}"} // -// Codebase principal: +// Content principal: // {"1":{"0":"https://mozilla.com"}} -> {"0":"https://mozilla.com"} // // Expanded principal: @@ -102,7 +102,7 @@ static const Json::Value* GetPrincipalObject(const Json::Value& aRoot, return nullptr; } MOZ_ASSERT(principalKind == BasePrincipal::eNullPrincipal || - principalKind == BasePrincipal::eCodebasePrincipal || + principalKind == BasePrincipal::eContentPrincipal || principalKind == BasePrincipal::eExpandedPrincipal || principalKind == BasePrincipal::eSystemPrincipal); aOutPrincipalKind = principalKind; @@ -130,7 +130,7 @@ static const Json::Value* GetPrincipalObject(const Json::Value& aRoot, // value // - value: The string that was serialized for this key // - key: an SerializableKeys enum value specific to the principal. -// For example content principal is an enum of: eCodebase, eDomain, +// For example content principal is an enum of: eURI, eDomain, // eSuffix, eCSP // // @@ -143,7 +143,7 @@ static const Json::Value* GetPrincipalObject(const Json::Value& aRoot, // | // Value // -// They Key "0" corresponds to ContentPrincipal::eCodebase +// They Key "0" corresponds to ContentPrincipal::eURI // They Key "1" corresponds to ContentPrincipal::eSuffix template static nsTArray GetJSONKeys(const Json::Value* aInput) { @@ -228,7 +228,7 @@ already_AddRefed BasePrincipal::FromJSON( return NullPrincipal::FromProperties(res); } - if (principalKind == eCodebasePrincipal) { + if (principalKind == eContentPrincipal) { nsTArray res = GetJSONKeys(value); return ContentPrincipal::FromProperties(res); @@ -276,13 +276,13 @@ nsresult BasePrincipal::ToJSON(nsACString& aResult) { bool BasePrincipal::Subsumes(nsIPrincipal* aOther, DocumentDomainConsideration aConsideration) { MOZ_ASSERT(aOther); - MOZ_ASSERT_IF(Kind() == eCodebasePrincipal, mOriginSuffix); + MOZ_ASSERT_IF(Kind() == eContentPrincipal, mOriginSuffix); // Expanded principals handle origin attributes for each of their // sub-principals individually, null principals do only simple checks for // pointer equality, and system principals are immune to origin attributes - // checks, so only do this check for codebase principals. - if (Kind() == eCodebasePrincipal && + // checks, so only do this check for content principals. + if (Kind() == eContentPrincipal && mOriginSuffix != Cast(aOther)->mOriginSuffix) { return false; } @@ -385,8 +385,8 @@ BasePrincipal::GetIsNullPrincipal(bool* aResult) { } NS_IMETHODIMP -BasePrincipal::GetIsCodebasePrincipal(bool* aResult) { - *aResult = Kind() == eCodebasePrincipal; +BasePrincipal::GetIsContentPrincipal(bool* aResult) { + *aResult = Kind() == eContentPrincipal; return NS_OK; } @@ -470,7 +470,7 @@ nsIPrincipal* BasePrincipal::PrincipalToInherit(nsIURI* aRequestedURI) { return this; } -already_AddRefed BasePrincipal::CreateCodebasePrincipal( +already_AddRefed BasePrincipal::CreateContentPrincipal( nsIURI* aURI, const OriginAttributes& aAttrs) { MOZ_ASSERT(aURI); @@ -483,17 +483,17 @@ already_AddRefed BasePrincipal::CreateCodebasePrincipal( return NullPrincipal::Create(aAttrs); } - return CreateCodebasePrincipal(aURI, aAttrs, originNoSuffix); + return CreateContentPrincipal(aURI, aAttrs, originNoSuffix); } -already_AddRefed BasePrincipal::CreateCodebasePrincipal( +already_AddRefed BasePrincipal::CreateContentPrincipal( nsIURI* aURI, const OriginAttributes& aAttrs, const nsACString& aOriginNoSuffix) { MOZ_ASSERT(aURI); MOZ_ASSERT(!aOriginNoSuffix.IsEmpty()); // If the URI is supposed to inherit the security context of whoever loads it, - // we shouldn't make a codebase principal for it. + // we shouldn't make a content principal for it. bool inheritsPrincipal; nsresult rv = NS_URIChainHasFlags( aURI, nsIProtocolHandler::URI_INHERITS_SECURITY_CONTEXT, @@ -514,7 +514,7 @@ already_AddRefed BasePrincipal::CreateCodebasePrincipal( } MOZ_ASSERT(origin); OriginAttributes attrs; - RefPtr principal = CreateCodebasePrincipal(origin, attrs); + RefPtr principal = CreateContentPrincipal(origin, attrs); return principal.forget(); } #endif @@ -527,22 +527,22 @@ already_AddRefed BasePrincipal::CreateCodebasePrincipal( return principal.forget(); } - // Mint a codebase principal. - RefPtr codebase = new ContentPrincipal(); - rv = codebase->Init(aURI, aAttrs, aOriginNoSuffix); + // Mint a content principal. + RefPtr principal = new ContentPrincipal(); + rv = principal->Init(aURI, aAttrs, aOriginNoSuffix); NS_ENSURE_SUCCESS(rv, nullptr); - return codebase.forget(); + return principal.forget(); } -already_AddRefed BasePrincipal::CreateCodebasePrincipal( +already_AddRefed BasePrincipal::CreateContentPrincipal( const nsACString& aOrigin) { MOZ_ASSERT(!StringBeginsWith(aOrigin, NS_LITERAL_CSTRING("[")), - "CreateCodebasePrincipal does not support System and Expanded " + "CreateContentPrincipal does not support System and Expanded " "principals"); MOZ_ASSERT(!StringBeginsWith(aOrigin, NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME ":")), - "CreateCodebasePrincipal does not support NullPrincipal"); + "CreateContentPrincipal does not support NullPrincipal"); nsAutoCString originNoSuffix; OriginAttributes attrs; @@ -554,12 +554,12 @@ already_AddRefed BasePrincipal::CreateCodebasePrincipal( nsresult rv = NS_NewURI(getter_AddRefs(uri), originNoSuffix); NS_ENSURE_SUCCESS(rv, nullptr); - return BasePrincipal::CreateCodebasePrincipal(uri, attrs); + return BasePrincipal::CreateContentPrincipal(uri, attrs); } already_AddRefed BasePrincipal::CloneForcingOriginAttributes( const OriginAttributes& aOriginAttributes) { - if (NS_WARN_IF(!IsCodebasePrincipal())) { + if (NS_WARN_IF(!IsContentPrincipal())) { return nullptr; } @@ -567,7 +567,7 @@ already_AddRefed BasePrincipal::CloneForcingOriginAttributes( nsresult rv = GetOriginNoSuffix(originNoSuffix); NS_ENSURE_SUCCESS(rv, nullptr); - nsIURI* uri = static_cast(this)->mCodebase; + nsIURI* uri = static_cast(this)->mURI; RefPtr copy = new ContentPrincipal(); rv = copy->Init(uri, aOriginAttributes, originNoSuffix); NS_ENSURE_SUCCESS(rv, nullptr); diff --git a/caps/BasePrincipal.h b/caps/BasePrincipal.h index f9a946da1a7b..2869ff625a27 100644 --- a/caps/BasePrincipal.h +++ b/caps/BasePrincipal.h @@ -33,7 +33,7 @@ class WebExtensionPolicy; class BasePrincipal; -// Codebase principals (and codebase principals embedded within expanded +// Content principals (and content principals embedded within expanded // principals) stored in SiteIdentifier are guaranteed to contain only the // eTLD+1 part of the original domain. This is used to determine whether two // origins are same-site: if it's possible for two origins to access each other @@ -74,7 +74,7 @@ class BasePrincipal : public nsJSPrincipals { // Only update if you know exactly what you are doing enum PrincipalKind { eNullPrincipal = 0, - eCodebasePrincipal, + eContentPrincipal, eExpandedPrincipal, eSystemPrincipal, eKindMax = eSystemPrincipal @@ -113,7 +113,7 @@ class BasePrincipal : public nsJSPrincipals { bool allowIfInheritsPrincipal) final; NS_IMETHOD GetAddonPolicy(nsISupports** aResult) final; NS_IMETHOD GetIsNullPrincipal(bool* aResult) override; - NS_IMETHOD GetIsCodebasePrincipal(bool* aResult) override; + NS_IMETHOD GetIsContentPrincipal(bool* aResult) override; NS_IMETHOD GetIsExpandedPrincipal(bool* aResult) override; NS_IMETHOD GetIsSystemPrincipal(bool* aResult) override; NS_IMETHOD GetIsAddonOrExpandedAddonPrincipal(bool* aResult) override; @@ -134,7 +134,7 @@ class BasePrincipal : public nsJSPrincipals { virtual bool AddonHasPermission(const nsAtom* aPerm); - virtual bool IsCodebasePrincipal() const { return false; }; + virtual bool IsContentPrincipal() const { return false; }; static BasePrincipal* Cast(nsIPrincipal* aPrin) { return static_cast(aPrin); @@ -144,14 +144,14 @@ class BasePrincipal : public nsJSPrincipals { return static_cast(aPrin); } - static already_AddRefed CreateCodebasePrincipal( + static already_AddRefed CreateContentPrincipal( const nsACString& aOrigin); - // These following method may not create a codebase principal in case it's + // These following method may not create a content principal in case it's // not possible to generate a correct origin from the passed URI. If this // happens, a NullPrincipal is returned. - static already_AddRefed CreateCodebasePrincipal( + static already_AddRefed CreateContentPrincipal( nsIURI* aURI, const OriginAttributes& aAttrs); const OriginAttributes& OriginAttributesRef() final { @@ -201,7 +201,7 @@ class BasePrincipal : public nsJSPrincipals { /* Returns true if this principal's CSP should override a document's CSP for * loads that it triggers. Currently true for expanded principals which - * subsume the document principal, and add-on codebase principals regardless + * subsume the document principal, and add-on content principals regardless * of whether they subsume the document principal. */ bool OverridesCSP(nsIPrincipal* aDocumentPrincipal) { @@ -246,7 +246,7 @@ class BasePrincipal : public nsJSPrincipals { const OriginAttributes& aOriginAttributes); private: - static already_AddRefed CreateCodebasePrincipal( + static already_AddRefed CreateContentPrincipal( nsIURI* aURI, const OriginAttributes& aAttrs, const nsACString& aOriginNoSuffix); @@ -270,13 +270,13 @@ inline bool BasePrincipal::FastEquals(nsIPrincipal* aOther) { } // Two principals are considered to be equal if their origins are the same. - // If the two principals are codebase principals, their origin attributes + // If the two principals are content principals, their origin attributes // (aka the origin suffix) must also match. if (Kind() == eSystemPrincipal) { return this == other; } - if (Kind() == eCodebasePrincipal || Kind() == eNullPrincipal) { + if (Kind() == eContentPrincipal || Kind() == eNullPrincipal) { return mOriginNoSuffix == other->mOriginNoSuffix && mOriginSuffix == other->mOriginSuffix; } @@ -320,7 +320,7 @@ inline bool BasePrincipal::FastSubsumesConsideringDomain(nsIPrincipal* aOther) { inline bool BasePrincipal::FastSubsumesIgnoringFPD( nsIPrincipal* aOther, DocumentDomainConsideration aConsideration) { - if (Kind() == eCodebasePrincipal && + if (Kind() == eContentPrincipal && !dom::ChromeUtils::IsOriginAttributesEqualIgnoringFPD( mOriginAttributes, Cast(aOther)->mOriginAttributes)) { return false; diff --git a/caps/ContentPrincipal.cpp b/caps/ContentPrincipal.cpp index d638bdd4f1d0..5e614926218b 100644 --- a/caps/ContentPrincipal.cpp +++ b/caps/ContentPrincipal.cpp @@ -53,14 +53,14 @@ NS_IMPL_CLASSINFO(ContentPrincipal, nullptr, nsIClassInfo::MAIN_THREAD_ONLY, NS_IMPL_QUERY_INTERFACE_CI(ContentPrincipal, nsIPrincipal, nsISerializable) NS_IMPL_CI_INTERFACE_GETTER(ContentPrincipal, nsIPrincipal, nsISerializable) -ContentPrincipal::ContentPrincipal() : BasePrincipal(eCodebasePrincipal) {} +ContentPrincipal::ContentPrincipal() : BasePrincipal(eContentPrincipal) {} ContentPrincipal::~ContentPrincipal() {} -nsresult ContentPrincipal::Init(nsIURI* aCodebase, +nsresult ContentPrincipal::Init(nsIURI* aURI, const OriginAttributes& aOriginAttributes, const nsACString& aOriginNoSuffix) { - NS_ENSURE_ARG(aCodebase); + NS_ENSURE_ARG(aURI); // Assert that the URI we get here isn't any of the schemes that we know we // should not get here. These schemes always either inherit their principal @@ -71,11 +71,10 @@ nsresult ContentPrincipal::Init(nsIURI* aCodebase, Unused << hasFlag; // silence possible compiler warnings. MOZ_DIAGNOSTIC_ASSERT( NS_SUCCEEDED(NS_URIChainHasFlags( - aCodebase, nsIProtocolHandler::URI_INHERITS_SECURITY_CONTEXT, - &hasFlag)) && + aURI, nsIProtocolHandler::URI_INHERITS_SECURITY_CONTEXT, &hasFlag)) && !hasFlag); - mCodebase = aCodebase; + mURI = aURI; FinishInit(aOriginNoSuffix, aOriginAttributes); return NS_OK; @@ -85,7 +84,7 @@ nsresult ContentPrincipal::Init(ContentPrincipal* aOther, const OriginAttributes& aOriginAttributes) { NS_ENSURE_ARG(aOther); - mCodebase = aOther->mCodebase; + mURI = aOther->mURI; FinishInit(aOther, aOriginAttributes); mDomain = aOther->mDomain; @@ -94,7 +93,7 @@ nsresult ContentPrincipal::Init(ContentPrincipal* aOther, } nsresult ContentPrincipal::GetScriptLocation(nsACString& aStr) { - return mCodebase->GetSpec(aStr); + return mURI->GetSpec(aStr); } /* static */ @@ -278,13 +277,13 @@ bool ContentPrincipal::SubsumesInternal( rv = aOther->GetURI(getter_AddRefs(otherURI)); NS_ENSURE_SUCCESS(rv, false); - // Compare codebases. - return nsScriptSecurityManager::SecurityCompareURIs(mCodebase, otherURI); + // Compare uris. + return nsScriptSecurityManager::SecurityCompareURIs(mURI, otherURI); } NS_IMETHODIMP ContentPrincipal::GetURI(nsIURI** aURI) { - NS_ADDREF(*aURI = mCodebase); + NS_ADDREF(*aURI = mURI); return NS_OK; } @@ -303,7 +302,7 @@ bool ContentPrincipal::MayLoadInternal(nsIURI* aURI) { MOZ_ASSERT(origin); OriginAttributes attrs; RefPtr principal = - BasePrincipal::CreateCodebasePrincipal(origin, attrs); + BasePrincipal::CreateContentPrincipal(origin, attrs); return nsIPrincipal::Subsumes(principal); } #endif @@ -321,7 +320,7 @@ bool ContentPrincipal::MayLoadInternal(nsIURI* aURI) { return true; } - if (nsScriptSecurityManager::SecurityCompareURIs(mCodebase, aURI)) { + if (nsScriptSecurityManager::SecurityCompareURIs(mURI, aURI)) { return true; } @@ -329,8 +328,7 @@ bool ContentPrincipal::MayLoadInternal(nsIURI* aURI) { // SecurityCompareURIs unless they are identical. Explicitly check file origin // policy, in that case. if (nsScriptSecurityManager::GetStrictFileOriginPolicy() && - NS_URIIsLocalFile(aURI) && - NS_RelaxStrictFileOriginPolicy(aURI, mCodebase)) { + NS_URIIsLocalFile(aURI) && NS_RelaxStrictFileOriginPolicy(aURI, mURI)) { return true; } @@ -338,7 +336,7 @@ bool ContentPrincipal::MayLoadInternal(nsIURI* aURI) { } uint32_t ContentPrincipal::GetHashValue() { - MOZ_ASSERT(mCodebase, "Need a codebase"); + MOZ_ASSERT(mURI, "Need a principal URI"); return nsScriptSecurityManager::HashPrincipalByOrigin(this); } @@ -375,12 +373,12 @@ ContentPrincipal::SetDomain(nsIURI* aDomain) { return NS_OK; } -static nsresult GetSpecialBaseDomain(const nsCOMPtr& aCodebase, +static nsresult GetSpecialBaseDomain(const nsCOMPtr& aURI, bool* aHandled, nsACString& aBaseDomain) { *aHandled = false; // Special handling for a file URI. - if (NS_URIIsLocalFile(aCodebase)) { + if (NS_URIIsLocalFile(aURI)) { // If strict file origin policy is not in effect, all local files are // considered to be same-origin, so return a known dummy domain here. if (!nsScriptSecurityManager::GetStrictFileOriginPolicy()) { @@ -390,7 +388,7 @@ static nsresult GetSpecialBaseDomain(const nsCOMPtr& aCodebase, } // Otherwise, we return the file path. - nsCOMPtr url = do_QueryInterface(aCodebase); + nsCOMPtr url = do_QueryInterface(aURI); if (url) { *aHandled = true; @@ -399,21 +397,21 @@ static nsresult GetSpecialBaseDomain(const nsCOMPtr& aCodebase, } bool hasNoRelativeFlag; - nsresult rv = NS_URIChainHasFlags( - aCodebase, nsIProtocolHandler::URI_NORELATIVE, &hasNoRelativeFlag); + nsresult rv = NS_URIChainHasFlags(aURI, nsIProtocolHandler::URI_NORELATIVE, + &hasNoRelativeFlag); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } if (hasNoRelativeFlag) { *aHandled = true; - return aCodebase->GetSpec(aBaseDomain); + return aURI->GetSpec(aBaseDomain); } bool isBehaved; - if (NS_SUCCEEDED(aCodebase->SchemeIs("indexeddb", &isBehaved)) && isBehaved) { + if (NS_SUCCEEDED(aURI->SchemeIs("indexeddb", &isBehaved)) && isBehaved) { *aHandled = true; - return aCodebase->GetSpec(aBaseDomain); + return aURI->GetSpec(aBaseDomain); } return NS_OK; @@ -423,7 +421,7 @@ NS_IMETHODIMP ContentPrincipal::GetBaseDomain(nsACString& aBaseDomain) { // Handle some special URIs first. bool handled; - nsresult rv = GetSpecialBaseDomain(mCodebase, &handled, aBaseDomain); + nsresult rv = GetSpecialBaseDomain(mURI, &handled, aBaseDomain); NS_ENSURE_SUCCESS(rv, rv); if (handled) { @@ -437,7 +435,7 @@ ContentPrincipal::GetBaseDomain(nsACString& aBaseDomain) { return NS_ERROR_FAILURE; } - return thirdPartyUtil->GetBaseDomain(mCodebase, aBaseDomain); + return thirdPartyUtil->GetBaseDomain(mURI, aBaseDomain); } NS_IMETHODIMP @@ -445,7 +443,7 @@ ContentPrincipal::GetSiteOrigin(nsACString& aSiteOrigin) { // Handle some special URIs first. nsAutoCString baseDomain; bool handled; - nsresult rv = GetSpecialBaseDomain(mCodebase, &handled, baseDomain); + nsresult rv = GetSpecialBaseDomain(mURI, &handled, baseDomain); NS_ENSURE_SUCCESS(rv, rv); if (handled) { @@ -466,7 +464,7 @@ ContentPrincipal::GetSiteOrigin(nsACString& aSiteOrigin) { } bool gotBaseDomain = false; - rv = tldService->GetBaseDomain(mCodebase, 0, baseDomain); + rv = tldService->GetBaseDomain(mURI, 0, baseDomain); if (NS_SUCCEEDED(rv)) { gotBaseDomain = true; } else { @@ -481,7 +479,7 @@ ContentPrincipal::GetSiteOrigin(nsACString& aSiteOrigin) { // NOTE: Calling `SetHostPort` with a portless domain is insufficient to clear // the port, so an extra `SetPort` call has to be made. nsCOMPtr siteUri; - NS_MutateURI mutator(mCodebase); + NS_MutateURI mutator(mURI); mutator.SetUserPass(EmptyCString()).SetPort(-1); if (gotBaseDomain) { mutator.SetHost(baseDomain); @@ -508,9 +506,9 @@ nsresult ContentPrincipal::GetSiteIdentifier(SiteIdentifier& aSite) { nsresult rv = GetSiteOrigin(siteOrigin); NS_ENSURE_SUCCESS(rv, rv); - RefPtr principal = CreateCodebasePrincipal(siteOrigin); + RefPtr principal = CreateContentPrincipal(siteOrigin); if (!principal) { - NS_WARNING("could not instantiate codebase principal"); + NS_WARNING("could not instantiate content principal"); return NS_ERROR_FAILURE; } @@ -520,12 +518,11 @@ nsresult ContentPrincipal::GetSiteIdentifier(SiteIdentifier& aSite) { WebExtensionPolicy* ContentPrincipal::AddonPolicy() { if (!mAddon.isSome()) { - NS_ENSURE_TRUE(mCodebase, nullptr); + NS_ENSURE_TRUE(mURI, nullptr); bool isMozExt; - if (NS_SUCCEEDED(mCodebase->SchemeIs("moz-extension", &isMozExt)) && - isMozExt) { - mAddon.emplace(EPS().GetByURL(mCodebase.get())); + if (NS_SUCCEEDED(mURI->SchemeIs("moz-extension", &isMozExt)) && isMozExt) { + mAddon.emplace(EPS().GetByURL(mURI.get())); } else { mAddon.emplace(nullptr); } @@ -548,20 +545,20 @@ ContentPrincipal::GetAddonId(nsAString& aAddonId) { NS_IMETHODIMP ContentPrincipal::Read(nsIObjectInputStream* aStream) { nsCOMPtr supports; - nsCOMPtr codebase; + nsCOMPtr principalURI; nsresult rv = NS_ReadOptionalObject(aStream, true, getter_AddRefs(supports)); if (NS_FAILED(rv)) { return rv; } - codebase = do_QueryInterface(supports); + principalURI = do_QueryInterface(supports); // Enforce re-parsing about: URIs so that if they change, we continue to use // their new principals correctly. bool isAbout = false; - if (NS_SUCCEEDED(codebase->SchemeIs("about", &isAbout)) && isAbout) { + if (NS_SUCCEEDED(principalURI->SchemeIs("about", &isAbout)) && isAbout) { nsAutoCString spec; - codebase->GetSpec(spec); - NS_ENSURE_SUCCESS(NS_NewURI(getter_AddRefs(codebase), spec), + principalURI->GetSpec(spec); + NS_ENSURE_SUCCESS(NS_NewURI(getter_AddRefs(principalURI), spec), NS_ERROR_FAILURE); } @@ -595,10 +592,10 @@ ContentPrincipal::Read(nsIObjectInputStream* aStream) { Unused << NS_ReadOptionalObject(aStream, true, getter_AddRefs(supports)); nsAutoCString originNoSuffix; - rv = GenerateOriginNoSuffixFromURI(codebase, originNoSuffix); + rv = GenerateOriginNoSuffixFromURI(principalURI, originNoSuffix); NS_ENSURE_SUCCESS(rv, rv); - rv = Init(codebase, attrs, originNoSuffix); + rv = Init(principalURI, attrs, originNoSuffix); NS_ENSURE_SUCCESS(rv, rv); // Note: we don't call SetDomain here because we don't need the wrapper @@ -619,15 +616,15 @@ ContentPrincipal::Write(nsIObjectOutputStream* aStream) { } nsresult ContentPrincipal::PopulateJSONObject(Json::Value& aObject) { - nsAutoCString codebase; - nsresult rv = mCodebase->GetSpec(codebase); + nsAutoCString principalURI; + nsresult rv = mURI->GetSpec(principalURI); NS_ENSURE_SUCCESS(rv, rv); // We turn each int enum field into a JSON string key of the object // aObject is the inner JSON object that has stringified enum keys // An example aObject might be: // - // eCodebase eSuffix + // eURI eSuffix // | | // {"0": "https://mozilla.com", "2": "^privateBrowsingId=1"} // | | | | @@ -636,7 +633,7 @@ nsresult ContentPrincipal::PopulateJSONObject(Json::Value& aObject) { // Key ---------------------- // | // Value - aObject[std::to_string(eCodebase)] = codebase.get(); + aObject[std::to_string(eURI)] = principalURI.get(); if (mDomain) { nsAutoCString domainStr; @@ -658,7 +655,7 @@ already_AddRefed ContentPrincipal::FromProperties( nsTArray& aFields) { MOZ_ASSERT(aFields.Length() == eMax + 1, "Must have all the keys"); nsresult rv; - nsCOMPtr codebaseURI; + nsCOMPtr principalURI; nsCOMPtr domain; nsCOMPtr csp; OriginAttributes attrs; @@ -667,25 +664,26 @@ already_AddRefed ContentPrincipal::FromProperties( // if all the switch enum cases haven't been codified for (const auto& field : aFields) { switch (field.key) { - case ContentPrincipal::eCodebase: + case ContentPrincipal::eURI: if (!field.valueWasSerialized) { MOZ_ASSERT( false, - "Content principals require a codebase URI in serialized JSON"); + "Content principals require a principal URI in serialized JSON"); return nullptr; } - rv = NS_NewURI(getter_AddRefs(codebaseURI), field.value.get()); + rv = NS_NewURI(getter_AddRefs(principalURI), field.value.get()); NS_ENSURE_SUCCESS(rv, nullptr); { // Enforce re-parsing about: URIs so that if they change, we // continue to use their new principals correctly. bool isAbout = - NS_SUCCEEDED(codebaseURI->SchemeIs("about", &isAbout)) && isAbout; + NS_SUCCEEDED(principalURI->SchemeIs("about", &isAbout)) && + isAbout; if (isAbout) { nsAutoCString spec; - codebaseURI->GetSpec(spec); - if (NS_FAILED(NS_NewURI(getter_AddRefs(codebaseURI), spec))) { + principalURI->GetSpec(spec); + if (NS_FAILED(NS_NewURI(getter_AddRefs(principalURI), spec))) { return nullptr; } } @@ -708,22 +706,22 @@ already_AddRefed ContentPrincipal::FromProperties( } } nsAutoCString originNoSuffix; - rv = ContentPrincipal::GenerateOriginNoSuffixFromURI(codebaseURI, + rv = ContentPrincipal::GenerateOriginNoSuffixFromURI(principalURI, originNoSuffix); if (NS_FAILED(rv)) { return nullptr; } - RefPtr codebase = new ContentPrincipal(); - rv = codebase->Init(codebaseURI, attrs, originNoSuffix); + RefPtr principal = new ContentPrincipal(); + rv = principal->Init(principalURI, attrs, originNoSuffix); if (NS_FAILED(rv)) { return nullptr; } - codebase->mDomain = domain; - if (codebase->mDomain) { - codebase->SetHasExplicitDomain(); + principal->mDomain = domain; + if (principal->mDomain) { + principal->SetHasExplicitDomain(); } - return codebase.forget(); + return principal.forget(); } diff --git a/caps/ContentPrincipal.h b/caps/ContentPrincipal.h index 8c86fbcb074e..0e7dac44d7be 100644 --- a/caps/ContentPrincipal.h +++ b/caps/ContentPrincipal.h @@ -33,14 +33,14 @@ class ContentPrincipal final : public BasePrincipal { NS_IMETHOD GetBaseDomain(nsACString& aBaseDomain) override; NS_IMETHOD GetAddonId(nsAString& aAddonId) override; NS_IMETHOD GetSiteOrigin(nsACString& aSiteOrigin) override; - bool IsCodebasePrincipal() const override { return true; } + bool IsContentPrincipal() const override { return true; } ContentPrincipal(); - static PrincipalKind Kind() { return eCodebasePrincipal; } + static PrincipalKind Kind() { return eContentPrincipal; } // Init() must be called before the principal is in a usable state. - nsresult Init(nsIURI* aCodebase, const OriginAttributes& aOriginAttributes, + nsresult Init(nsIURI* aURI, const OriginAttributes& aOriginAttributes, const nsACString& aOriginNoSuffix); nsresult Init(ContentPrincipal* aOther, const OriginAttributes& aOriginAttributes); @@ -55,11 +55,11 @@ class ContentPrincipal final : public BasePrincipal { extensions::WebExtensionPolicy* AddonPolicy(); nsCOMPtr mDomain; - nsCOMPtr mCodebase; + nsCOMPtr mURI; virtual nsresult PopulateJSONObject(Json::Value& aObject) override; // Serializable keys are the valid enum fields the serialization supports - enum SerializableKeys { eCodebase = 0, eDomain, eSuffix, eMax = eSuffix }; + enum SerializableKeys { eURI = 0, eDomain, eSuffix, eMax = eSuffix }; // KeyVal is a lightweight storage that passes // SerializableKeys and values after JSON parsing in the BasePrincipal to // FromProperties diff --git a/caps/NullPrincipal.cpp b/caps/NullPrincipal.cpp index c93f08224113..c5a9b807173a 100644 --- a/caps/NullPrincipal.cpp +++ b/caps/NullPrincipal.cpp @@ -219,14 +219,14 @@ NullPrincipal::Write(nsIObjectOutputStream* aStream) { } nsresult NullPrincipal::PopulateJSONObject(Json::Value& aObject) { - nsAutoCString codebase; - nsresult rv = mURI->GetSpec(codebase); + nsAutoCString principalURI; + nsresult rv = mURI->GetSpec(principalURI); NS_ENSURE_SUCCESS(rv, rv); - MOZ_ASSERT(codebase.Length() == + MOZ_ASSERT(principalURI.Length() == NS_LITERAL_CSTRING(NS_NULLPRINCIPAL_SCHEME ":").Length() + NSID_LENGTH - 1, "Length of the URI should be: (scheme, uuid, - nullptr)"); - aObject[std::to_string(eSpec)] = codebase.get(); + aObject[std::to_string(eSpec)] = principalURI.get(); nsAutoCString suffix; OriginAttributesRef().CreateSuffix(suffix); diff --git a/caps/nsIPrincipal.idl b/caps/nsIPrincipal.idl index bad170ce6336..fd5bb43510af 100644 --- a/caps/nsIPrincipal.idl +++ b/caps/nsIPrincipal.idl @@ -70,7 +70,7 @@ interface nsIPrincipal : nsISerializable [notxpcom, nostdcall] readonly attribute unsigned long hashValue; /** - * The codebase URI to which this principal pertains. This is + * The principal URI to which this principal pertains. This is * generally the document URI. */ [infallible] readonly attribute nsIURI URI; @@ -122,7 +122,7 @@ interface nsIPrincipal : nsISerializable /** * Checks whether this principal is allowed to load the network resource * located at the given URI under the same-origin policy. This means that - * codebase principals are only allowed to load resources from the same + * content principals are only allowed to load resources from the same * domain, the system principal is allowed to load anything, and null * principals can only load URIs where they are the principal. This is * changed by the optional flag allowIfInheritsPrincipal (which defaults to @@ -170,7 +170,7 @@ interface nsIPrincipal : nsISerializable /** * A canonical representation of the origin for this principal. This - * consists of a base string (which, for codebase principals, is of the + * consists of a base string (which, for content principals, is of the * format scheme://host:port), concatenated with |originAttributes| (see * below). * @@ -212,7 +212,7 @@ interface nsIPrincipal : nsISerializable readonly attribute ACString siteOrigin; /** - * The base domain of the codebase URI to which this principal pertains + * The base domain of the principal URI to which this principal pertains * (generally the document URI), handling null principals and * non-hierarchical schemes correctly. */ @@ -255,9 +255,9 @@ interface nsIPrincipal : nsISerializable [infallible] readonly attribute boolean isNullPrincipal; /** - * Returns true iff this principal corresponds to a codebase origin. + * Returns true iff this principal corresponds to a principal origin. */ - [infallible] readonly attribute boolean isCodebasePrincipal; + [infallible] readonly attribute boolean isContentPrincipal; /** * Returns true iff this is an expanded principal. diff --git a/caps/nsIScriptSecurityManager.idl b/caps/nsIScriptSecurityManager.idl index 5811bd5076c4..7f8bd05d4828 100644 --- a/caps/nsIScriptSecurityManager.idl +++ b/caps/nsIScriptSecurityManager.idl @@ -144,18 +144,18 @@ interface nsIScriptSecurityManager : nsISupports * Returns a principal that has the OriginAttributes of the load context. * @param loadContext to get the OriginAttributes from. */ - nsIPrincipal getLoadContextCodebasePrincipal(in nsIURI uri, + nsIPrincipal getLoadContextContentPrincipal(in nsIURI uri, in nsILoadContext loadContext); /** * Returns a principal that has the OriginAttributes of the docshell. * @param docShell to get the OriginAttributes from. */ - nsIPrincipal getDocShellCodebasePrincipal(in nsIURI uri, + nsIPrincipal getDocShellContentPrincipal(in nsIURI uri, in nsIDocShell docShell); /** - * If this is a codebase principal, return a copy with different + * If this is a content principal, return a copy with different * origin attributes. */ [implicit_jscontext] @@ -168,14 +168,14 @@ interface nsIScriptSecurityManager : nsISupports * ChromeUtils.webidl for a list of origin attributes and their defaults. */ [implicit_jscontext] - nsIPrincipal createCodebasePrincipal(in nsIURI uri, in jsval originAttributes); + nsIPrincipal createContentPrincipal(in nsIURI uri, in jsval originAttributes); /** * Returns a principal whose origin is the one we pass in. * See nsIPrincipal.idl for a description of origin attributes, and * ChromeUtils.webidl for a list of origin attributes and their defaults. */ - nsIPrincipal createCodebasePrincipalFromOrigin(in ACString origin); + nsIPrincipal createContentPrincipalFromOrigin(in ACString origin); /** * Takes a principal and returns a string representation of it or a nullptr if it can't be serialized. @@ -213,7 +213,7 @@ interface nsIScriptSecurityManager : nsISupports /** * Get the principal for the given channel. This will typically be the - * channel owner if there is one, and the codebase principal for the + * channel owner if there is one, and the content principal for the * channel's URI otherwise. aChannel must not be null. */ nsIPrincipal getChannelResultPrincipal(in nsIChannel aChannel); @@ -254,7 +254,7 @@ interface nsIScriptSecurityManager : nsISupports nsIPrincipal getChannelResultPrincipalIfNotSandboxed(in nsIChannel aChannel); /** - * Get the codebase principal for the channel's URI. + * Get the content principal for the channel's URI. * aChannel must not be null. */ nsIPrincipal getChannelURIPrincipal(in nsIChannel aChannel); diff --git a/caps/nsScriptSecurityManager.cpp b/caps/nsScriptSecurityManager.cpp index 08bff2475f4f..32824c95f633 100644 --- a/caps/nsScriptSecurityManager.cpp +++ b/caps/nsScriptSecurityManager.cpp @@ -376,7 +376,7 @@ nsScriptSecurityManager::GetChannelURIPrincipal(nsIChannel* aChannel, OriginAttributes attrs = loadInfo->GetOriginAttributes(); nsCOMPtr prin = - BasePrincipal::CreateCodebasePrincipal(uri, attrs); + BasePrincipal::CreateContentPrincipal(uri, attrs); prin.forget(aPrincipal); return *aPrincipal ? NS_OK : NS_ERROR_FAILURE; } @@ -1121,7 +1121,7 @@ nsScriptSecurityManager::GetSystemPrincipal(nsIPrincipal** result) { } NS_IMETHODIMP -nsScriptSecurityManager::CreateCodebasePrincipal( +nsScriptSecurityManager::CreateContentPrincipal( nsIURI* aURI, JS::Handle aOriginAttributes, JSContext* aCx, nsIPrincipal** aPrincipal) { OriginAttributes attrs; @@ -1129,13 +1129,13 @@ nsScriptSecurityManager::CreateCodebasePrincipal( return NS_ERROR_INVALID_ARG; } nsCOMPtr prin = - BasePrincipal::CreateCodebasePrincipal(aURI, attrs); + BasePrincipal::CreateContentPrincipal(aURI, attrs); prin.forget(aPrincipal); return *aPrincipal ? NS_OK : NS_ERROR_FAILURE; } NS_IMETHODIMP -nsScriptSecurityManager::CreateCodebasePrincipalFromOrigin( +nsScriptSecurityManager::CreateContentPrincipalFromOrigin( const nsACString& aOrigin, nsIPrincipal** aPrincipal) { if (StringBeginsWith(aOrigin, NS_LITERAL_CSTRING("["))) { return NS_ERROR_INVALID_ARG; @@ -1146,7 +1146,7 @@ nsScriptSecurityManager::CreateCodebasePrincipalFromOrigin( return NS_ERROR_INVALID_ARG; } - nsCOMPtr prin = BasePrincipal::CreateCodebasePrincipal(aOrigin); + nsCOMPtr prin = BasePrincipal::CreateContentPrincipal(aOrigin); prin.forget(aPrincipal); return *aPrincipal ? NS_OK : NS_ERROR_FAILURE; } @@ -1199,22 +1199,22 @@ nsScriptSecurityManager::CreateNullPrincipal( } NS_IMETHODIMP -nsScriptSecurityManager::GetLoadContextCodebasePrincipal( +nsScriptSecurityManager::GetLoadContextContentPrincipal( nsIURI* aURI, nsILoadContext* aLoadContext, nsIPrincipal** aPrincipal) { NS_ENSURE_STATE(aLoadContext); OriginAttributes docShellAttrs; aLoadContext->GetOriginAttributes(docShellAttrs); nsCOMPtr prin = - BasePrincipal::CreateCodebasePrincipal(aURI, docShellAttrs); + BasePrincipal::CreateContentPrincipal(aURI, docShellAttrs); prin.forget(aPrincipal); return *aPrincipal ? NS_OK : NS_ERROR_FAILURE; } NS_IMETHODIMP -nsScriptSecurityManager::GetDocShellCodebasePrincipal( +nsScriptSecurityManager::GetDocShellContentPrincipal( nsIURI* aURI, nsIDocShell* aDocShell, nsIPrincipal** aPrincipal) { - nsCOMPtr prin = BasePrincipal::CreateCodebasePrincipal( + nsCOMPtr prin = BasePrincipal::CreateContentPrincipal( aURI, nsDocShell::Cast(aDocShell)->GetOriginAttributes()); prin.forget(aPrincipal); return *aPrincipal ? NS_OK : NS_ERROR_FAILURE; @@ -1227,7 +1227,7 @@ nsScriptSecurityManager::PrincipalWithOA( if (!aPrincipal) { return NS_OK; } - if (aPrincipal->GetIsCodebasePrincipal()) { + if (aPrincipal->GetIsContentPrincipal()) { OriginAttributes attrs; if (!aOriginAttributes.isObject() || !attrs.Init(aCx, aOriginAttributes)) { return NS_ERROR_INVALID_ARG; diff --git a/caps/tests/gtest/TestPrincipalSerialization.cpp b/caps/tests/gtest/TestPrincipalSerialization.cpp index 0aec9eec7ca7..1d4859e370be 100644 --- a/caps/tests/gtest/TestPrincipalSerialization.cpp +++ b/caps/tests/gtest/TestPrincipalSerialization.cpp @@ -26,7 +26,7 @@ TEST(PrincipalSerialization, ReusedJSONArgument) nsAutoCString spec("https://mozilla.com"); nsCOMPtr principal; nsresult rv = - ssm->CreateCodebasePrincipalFromOrigin(spec, getter_AddRefs(principal)); + ssm->CreateContentPrincipalFromOrigin(spec, getter_AddRefs(principal)); ASSERT_EQ(rv, NS_OK); nsAutoCString JSON; @@ -36,8 +36,7 @@ TEST(PrincipalSerialization, ReusedJSONArgument) nsAutoCString spec2("https://example.com"); nsCOMPtr principal2; - rv = - ssm->CreateCodebasePrincipalFromOrigin(spec2, getter_AddRefs(principal2)); + rv = ssm->CreateContentPrincipalFromOrigin(spec2, getter_AddRefs(principal2)); ASSERT_EQ(rv, NS_OK); // Reuse JSON without truncation to check the code is doing this @@ -82,7 +81,7 @@ TEST(PrincipalSerialization, TwoKeys) nsCOMPtr contentPrincipal = BasePrincipal::FromJSON( NS_LITERAL_CSTRING("{\"1\":{\"0\":\"https://mozilla.com\"}}")); ASSERT_EQ(BasePrincipal::Cast(contentPrincipal)->Kind(), - BasePrincipal::eCodebasePrincipal); + BasePrincipal::eContentPrincipal); // Check both combined don't return a principal nsCOMPtr combinedPrincipal = BasePrincipal::FromJSON( @@ -105,19 +104,19 @@ TEST(PrincipalSerialization, ExpandedPrincipal) nsAutoCString spec("https://mozilla.com"); nsCOMPtr principal; nsresult rv = - ssm->CreateCodebasePrincipalFromOrigin(spec, getter_AddRefs(principal)); + ssm->CreateContentPrincipalFromOrigin(spec, getter_AddRefs(principal)); ASSERT_EQ(rv, NS_OK); ASSERT_EQ(BasePrincipal::Cast(principal)->Kind(), - BasePrincipal::eCodebasePrincipal); + BasePrincipal::eContentPrincipal); allowedDomains[0] = principal; nsAutoCString spec2("https://mozilla.org"); nsCOMPtr principal2; rv = - ssm->CreateCodebasePrincipalFromOrigin(spec2, getter_AddRefs(principal2)); + ssm->CreateContentPrincipalFromOrigin(spec2, getter_AddRefs(principal2)); ASSERT_EQ(rv, NS_OK); ASSERT_EQ(BasePrincipal::Cast(principal2)->Kind(), - BasePrincipal::eCodebasePrincipal); + BasePrincipal::eContentPrincipal); allowedDomains[1] = principal2; OriginAttributes attrs; @@ -142,11 +141,11 @@ TEST(PrincipalSerialization, ExpandedPrincipal) nsAutoCString specDev("https://mozilla.dev"); nsCOMPtr principalDev; - rv = ssm->CreateCodebasePrincipalFromOrigin(specDev, + rv = ssm->CreateContentPrincipalFromOrigin(specDev, getter_AddRefs(principalDev)); ASSERT_EQ(rv, NS_OK); ASSERT_EQ(BasePrincipal::Cast(principalDev)->Kind(), - BasePrincipal::eCodebasePrincipal); + BasePrincipal::eContentPrincipal); ASSERT_FALSE(outPrincipal->FastSubsumesIgnoringFPD(principalDev)); } @@ -164,19 +163,19 @@ TEST(PrincipalSerialization, ExpandedPrincipalOA) nsAutoCString spec("https://mozilla.com"); nsCOMPtr principal; nsresult rv = - ssm->CreateCodebasePrincipalFromOrigin(spec, getter_AddRefs(principal)); + ssm->CreateContentPrincipalFromOrigin(spec, getter_AddRefs(principal)); ASSERT_EQ(rv, NS_OK); ASSERT_EQ(BasePrincipal::Cast(principal)->Kind(), - BasePrincipal::eCodebasePrincipal); + BasePrincipal::eContentPrincipal); allowedDomains[0] = principal; nsAutoCString spec2("https://mozilla.org"); nsCOMPtr principal2; rv = - ssm->CreateCodebasePrincipalFromOrigin(spec2, getter_AddRefs(principal2)); + ssm->CreateContentPrincipalFromOrigin(spec2, getter_AddRefs(principal2)); ASSERT_EQ(rv, NS_OK); ASSERT_EQ(BasePrincipal::Cast(principal2)->Kind(), - BasePrincipal::eCodebasePrincipal); + BasePrincipal::eContentPrincipal); allowedDomains[1] = principal2; OriginAttributes attrs; @@ -206,11 +205,11 @@ TEST(PrincipalSerialization, ExpandedPrincipalOA) nsAutoCString specDev("https://mozilla.dev"); nsCOMPtr principalDev; - rv = ssm->CreateCodebasePrincipalFromOrigin(specDev, + rv = ssm->CreateContentPrincipalFromOrigin(specDev, getter_AddRefs(principalDev)); ASSERT_EQ(rv, NS_OK); ASSERT_EQ(BasePrincipal::Cast(principalDev)->Kind(), - BasePrincipal::eCodebasePrincipal); + BasePrincipal::eContentPrincipal); ASSERT_FALSE(outPrincipal->FastSubsumesIgnoringFPD(principalDev)); } diff --git a/caps/tests/mochitest/browser_checkloaduri.js b/caps/tests/mochitest/browser_checkloaduri.js index db09795b807a..b3e5027365a8 100644 --- a/caps/tests/mochitest/browser_checkloaduri.js +++ b/caps/tests/mochitest/browser_checkloaduri.js @@ -300,7 +300,7 @@ add_task(async function() { if (sourceString.startsWith("about:test-chrome-privs")) { source = ssm.getSystemPrincipal(); } else { - source = ssm.createCodebasePrincipal(makeURI(sourceString), {}); + source = ssm.createContentPrincipal(makeURI(sourceString), {}); } for (let [ target, diff --git a/caps/tests/mochitest/test_addonMayLoad.html b/caps/tests/mochitest/test_addonMayLoad.html index 7709cc62628e..abf4596027fd 100644 --- a/caps/tests/mochitest/test_addonMayLoad.html +++ b/caps/tests/mochitest/test_addonMayLoad.html @@ -53,9 +53,9 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1180921 return p; } - let addonA = new Cu.Sandbox(ssm.createCodebasePrincipal(Services.io.newURI("moz-extension://addonA/"), {}), + let addonA = new Cu.Sandbox(ssm.createContentPrincipal(Services.io.newURI("moz-extension://addonA/"), {}), {wantGlobalProperties: ["XMLHttpRequest"]}); - let addonB = new Cu.Sandbox(ssm.createCodebasePrincipal(Services.io.newURI("moz-extension://addonB/"), {}), + let addonB = new Cu.Sandbox(ssm.createContentPrincipal(Services.io.newURI("moz-extension://addonB/"), {}), {wantGlobalProperties: ["XMLHttpRequest"]}); function uriForDomain(d) { return d + "/tests/caps/tests/mochitest/file_data.txt"; } diff --git a/caps/tests/unit/test_origin.js b/caps/tests/unit/test_origin.js index 78cafad7f076..287ac59a8e7a 100644 --- a/caps/tests/unit/test_origin.js +++ b/caps/tests/unit/test_origin.js @@ -35,9 +35,9 @@ function checkOriginAttributes(prin, attrs, suffix) { ChromeUtils.originAttributesMatchPattern(prin.originAttributes, attrs) ); if (!prin.isNullPrincipal && !prin.origin.startsWith("[")) { - Assert.ok(ssm.createCodebasePrincipalFromOrigin(prin.origin).equals(prin)); + Assert.ok(ssm.createContentPrincipalFromOrigin(prin.origin).equals(prin)); } else { - checkThrows(() => ssm.createCodebasePrincipalFromOrigin(prin.origin)); + checkThrows(() => ssm.createContentPrincipalFromOrigin(prin.origin)); } } @@ -88,13 +88,13 @@ function run_test() { // Attributeless origins. Assert.equal(ssm.getSystemPrincipal().origin, "[System Principal]"); checkOriginAttributes(ssm.getSystemPrincipal()); - var exampleOrg = ssm.createCodebasePrincipal( + var exampleOrg = ssm.createContentPrincipal( makeURI("http://example.org"), {} ); Assert.equal(exampleOrg.origin, "http://example.org"); checkOriginAttributes(exampleOrg); - var exampleCom = ssm.createCodebasePrincipal( + var exampleCom = ssm.createContentPrincipal( makeURI("https://www.example.com:123"), {} ); @@ -105,13 +105,13 @@ function run_test() { /^moz-nullprincipal:\{([0-9]|[a-z]|\-){36}\}$/.test(nullPrin.origin) ); checkOriginAttributes(nullPrin); - var ipv6Prin = ssm.createCodebasePrincipal( + var ipv6Prin = ssm.createContentPrincipal( makeURI("https://[2001:db8::ff00:42:8329]:123"), {} ); Assert.equal(ipv6Prin.origin, "https://[2001:db8::ff00:42:8329]:123"); checkOriginAttributes(ipv6Prin); - var ipv6NPPrin = ssm.createCodebasePrincipal( + var ipv6NPPrin = ssm.createContentPrincipal( makeURI("https://[2001:db8::ff00:42:8329]"), {} ); @@ -132,7 +132,7 @@ function run_test() { }]]` ); - // Make sure createCodebasePrincipal does what the rest of gecko does. + // Make sure createContentPrincipal does what the rest of gecko does. Assert.ok( exampleOrg.equals( Cu.getObjectPrincipal(new Cu.Sandbox("http://example.org")) @@ -144,7 +144,7 @@ function run_test() { // // Just browser. - var exampleOrg_browser = ssm.createCodebasePrincipal( + var exampleOrg_browser = ssm.createContentPrincipal( makeURI("http://example.org"), { inIsolatedMozBrowser: true } ); @@ -164,7 +164,7 @@ function run_test() { Assert.equal(exampleOrg_browser.origin, "http://example.org^inBrowser=1"); // First party Uri - var exampleOrg_firstPartyDomain = ssm.createCodebasePrincipal( + var exampleOrg_firstPartyDomain = ssm.createContentPrincipal( makeURI("http://example.org"), { firstPartyDomain: "example.org" } ); @@ -179,7 +179,7 @@ function run_test() { ); // Just userContext. - var exampleOrg_userContext = ssm.createCodebasePrincipal( + var exampleOrg_userContext = ssm.createContentPrincipal( makeURI("http://example.org"), { userContextId: 42 } ); @@ -215,19 +215,19 @@ function run_test() { // Check Principal kinds. function checkKind(prin, kind) { Assert.equal(prin.isNullPrincipal, kind == "nullPrincipal"); - Assert.equal(prin.isCodebasePrincipal, kind == "codebasePrincipal"); + Assert.equal(prin.isContentPrincipal, kind == "contentPrincipal"); Assert.equal(prin.isExpandedPrincipal, kind == "expandedPrincipal"); Assert.equal(prin.isSystemPrincipal, kind == "systemPrincipal"); } checkKind(ssm.createNullPrincipal({}), "nullPrincipal"); checkKind( - ssm.createCodebasePrincipal(makeURI("http://www.example.com"), {}), - "codebasePrincipal" + ssm.createContentPrincipal(makeURI("http://www.example.com"), {}), + "contentPrincipal" ); checkKind( Cu.getObjectPrincipal( Cu.Sandbox([ - ssm.createCodebasePrincipal(makeURI("http://www.example.com"), {}), + ssm.createContentPrincipal(makeURI("http://www.example.com"), {}), ]) ), "expandedPrincipal" @@ -312,13 +312,13 @@ function run_test() { ]; fileTests.forEach(t => { Services.prefs.setBoolPref("security.fileuri.strict_origin_policy", t[0]); - var filePrin = ssm.createCodebasePrincipal(fileURI, {}); + var filePrin = ssm.createContentPrincipal(fileURI, {}); Assert.equal(filePrin.origin, t[1]); }); Services.prefs.clearUserPref("security.fileuri.strict_origin_policy"); var aboutBlankURI = makeURI("about:blank"); - var aboutBlankPrin = ssm.createCodebasePrincipal(aboutBlankURI, {}); + var aboutBlankPrin = ssm.createContentPrincipal(aboutBlankURI, {}); Assert.ok( /^moz-nullprincipal:\{([0-9]|[a-z]|\-){36}\}$/.test(aboutBlankPrin.origin) ); diff --git a/devtools/client/inspector/shared/test/browser_styleinspector_csslogic-content-stylesheets.js b/devtools/client/inspector/shared/test/browser_styleinspector_csslogic-content-stylesheets.js index 70cc57d9fc8a..c905157ea454 100644 --- a/devtools/client/inspector/shared/test/browser_styleinspector_csslogic-content-stylesheets.js +++ b/devtools/client/inspector/shared/test/browser_styleinspector_csslogic-content-stylesheets.js @@ -14,7 +14,7 @@ const TEST_URI_HTML = TEST_URL_ROOT + "doc_content_stylesheet.html"; const TEST_URI_AUTHOR = TEST_URL_ROOT + "doc_author-sheet.html"; const TEST_URI_XUL = TEST_URL_ROOT + "doc_content_stylesheet.xul"; const XUL_URI = Services.io.newURI(TEST_URI_XUL); -const XUL_PRINCIPAL = Services.scriptSecurityManager.createCodebasePrincipal( +const XUL_PRINCIPAL = Services.scriptSecurityManager.createContentPrincipal( XUL_URI, {} ); diff --git a/devtools/client/storage/test/head.js b/devtools/client/storage/test/head.js index 1609934dfc39..2fce5f4a60d5 100644 --- a/devtools/client/storage/test/head.js +++ b/devtools/client/storage/test/head.js @@ -1003,7 +1003,7 @@ function setPermission(url, permission) { const nsIPermissionManager = Ci.nsIPermissionManager; const uri = Services.io.newURI(url); - const principal = Services.scriptSecurityManager.createCodebasePrincipal( + const principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/devtools/client/webconsole/test/mochitest/browser_webconsole_trackingprotection_errors.js b/devtools/client/webconsole/test/mochitest/browser_webconsole_trackingprotection_errors.js index 5e60861c3cb4..ffb2527b3df5 100644 --- a/devtools/client/webconsole/test/mochitest/browser_webconsole_trackingprotection_errors.js +++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_trackingprotection_errors.js @@ -151,7 +151,7 @@ add_task(async function testCookieBlockedByPermissionMessage() { info("Test cookie blocked by permission message"); // Turn off tracking protection and add a block permission on the URL. await pushPref("privacy.trackingprotection.enabled", false); - const p = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + const p = Services.scriptSecurityManager.createContentPrincipalFromOrigin( TRACKER_URL ); Services.perms.addFromPrincipal( diff --git a/devtools/client/webconsole/test/mochitest/browser_webconsole_warning_group_content_blocking.js b/devtools/client/webconsole/test/mochitest/browser_webconsole_warning_group_content_blocking.js index 3819587ce023..0b2cfc61412d 100644 --- a/devtools/client/webconsole/test/mochitest/browser_webconsole_warning_group_content_blocking.js +++ b/devtools/client/webconsole/test/mochitest/browser_webconsole_warning_group_content_blocking.js @@ -139,7 +139,7 @@ add_task(async function testCookieBlockedByPermissionMessage() { info("Test cookie blocked by permission message"); // Turn off tracking protection and add a block permission on the URL. await pushPref("privacy.trackingprotection.enabled", false); - const p = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + const p = Services.scriptSecurityManager.createContentPrincipalFromOrigin( "http://tracking.example.org/" ); Services.perms.addFromPrincipal( diff --git a/devtools/server/actors/storage.js b/devtools/server/actors/storage.js index f45f5c5540cf..42888ec7cf58 100644 --- a/devtools/server/actors/storage.js +++ b/devtools/server/actors/storage.js @@ -1386,7 +1386,7 @@ StorageActors.createActor( async getCachesForHost(host) { const uri = Services.io.newURI(host); const attrs = this.storageActor.document.nodePrincipal.originAttributes; - const principal = Services.scriptSecurityManager.createCodebasePrincipal( + const principal = Services.scriptSecurityManager.createContentPrincipal( uri, attrs ); diff --git a/devtools/shared/DevToolsUtils.js b/devtools/shared/DevToolsUtils.js index 37a4e83bd644..e605545f1433 100644 --- a/devtools/shared/DevToolsUtils.js +++ b/devtools/shared/DevToolsUtils.js @@ -496,7 +496,7 @@ DevToolsUtils.defineLazyGetter(this, "NetworkHelper", () => { * - window: the window to get the loadGroup from * - charset: the charset to use if the channel doesn't provide one * - principal: the principal to use, if omitted, the request is loaded - * with a codebase principal corresponding to the url being + * with a content principal corresponding to the url being * loaded, using the origin attributes of the window, if any. * - cacheKey: when loading from cache, use this key to retrieve a cache * specific to a given SHEntry. (Allows loading POST @@ -713,7 +713,7 @@ function newChannelForURL( // and it may not be correct. let prin = principal; if (!prin) { - prin = Services.scriptSecurityManager.createCodebasePrincipal(uri, {}); + prin = Services.scriptSecurityManager.createContentPrincipal(uri, {}); } channelOptions.loadingPrincipal = prin; diff --git a/devtools/shared/indexed-db.js b/devtools/shared/indexed-db.js index 7a24b3ed831f..aa895dce34e8 100644 --- a/devtools/shared/indexed-db.js +++ b/devtools/shared/indexed-db.js @@ -13,7 +13,7 @@ const Services = require("Services"); const PSEUDOURI = "indexeddb://fx-devtools"; const principaluri = Services.io.newURI(PSEUDOURI); -const principal = Services.scriptSecurityManager.createCodebasePrincipal( +const principal = Services.scriptSecurityManager.createContentPrincipal( principaluri, {} ); diff --git a/devtools/shared/tests/unit/test_console_filtering.js b/devtools/shared/tests/unit/test_console_filtering.js index 986230f09e5d..4cf0f2e23252 100644 --- a/devtools/shared/tests/unit/test_console_filtering.js +++ b/devtools/shared/tests/unit/test_console_filtering.js @@ -55,7 +55,7 @@ function createFakeAddonWindow({ addonId } = {}) { policy.active = true; const baseURI = Services.io.newURI(`moz-extension://${uuid}/`); - const principal = Services.scriptSecurityManager.createCodebasePrincipal( + const principal = Services.scriptSecurityManager.createContentPrincipal( baseURI, {} ); diff --git a/docshell/base/nsDocShell.cpp b/docshell/base/nsDocShell.cpp index 4a8eb6c9590c..a891ea720f53 100644 --- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -6584,8 +6584,8 @@ void nsDocShell::OnRedirectStateChange(nsIChannel* aOldChannel, if (secMan) { nsCOMPtr principal; - secMan->GetDocShellCodebasePrincipal(newURI, this, - getter_AddRefs(principal)); + secMan->GetDocShellContentPrincipal(newURI, this, + getter_AddRefs(principal)); appCacheChannel->SetChooseApplicationCache( NS_ShouldCheckAppCache(principal)); } @@ -9766,13 +9766,13 @@ static bool IsConsideredSameOriginForUIR(nsIPrincipal* aTriggeringPrincipal, return true; } - if (!aResultPrincipal->GetIsCodebasePrincipal()) { + if (!aResultPrincipal->GetIsContentPrincipal()) { return false; } nsCOMPtr resultURI = aResultPrincipal->GetURI(); - // We know this is a codebase principal, and codebase principals require valid + // We know this is a content principal, and content principals require valid // URIs, so we shouldn't need to check non-null here. if (!SchemeIsHTTP(resultURI)) { return false; @@ -9793,7 +9793,7 @@ static bool IsConsideredSameOriginForUIR(nsIPrincipal* aTriggeringPrincipal, BasePrincipal::Cast(aResultPrincipal)->OriginAttributesRef(); nsCOMPtr tmpResultPrincipal = - BasePrincipal::CreateCodebasePrincipal(tmpResultURI, tmpOA); + BasePrincipal::CreateContentPrincipal(tmpResultURI, tmpOA); return aTriggeringPrincipal->Equals(tmpResultPrincipal); } @@ -10172,8 +10172,8 @@ nsresult nsDocShell::DoURILoad(nsDocShellLoadState* aLoadState, if (secMan) { nsCOMPtr principal; - secMan->GetDocShellCodebasePrincipal(aLoadState->URI(), this, - getter_AddRefs(principal)); + secMan->GetDocShellContentPrincipal(aLoadState->URI(), this, + getter_AddRefs(principal)); appCacheChannel->SetChooseApplicationCache( NS_ShouldCheckAppCache(principal)); } diff --git a/docshell/base/nsDocShellLoadState.cpp b/docshell/base/nsDocShellLoadState.cpp index d2e21edceeda..82bc0e40b7d6 100644 --- a/docshell/base/nsDocShellLoadState.cpp +++ b/docshell/base/nsDocShellLoadState.cpp @@ -388,7 +388,7 @@ nsresult nsDocShellLoadState::SetupTriggeringPrincipal( if (mReferrerInfo) { nsCOMPtr referrer = mReferrerInfo->GetOriginalReferrer(); mTriggeringPrincipal = - BasePrincipal::CreateCodebasePrincipal(referrer, aOriginAttributes); + BasePrincipal::CreateContentPrincipal(referrer, aOriginAttributes); if (!mTriggeringPrincipal) { return NS_ERROR_FAILURE; diff --git a/docshell/test/browser/browser_loadDisallowInherit.js b/docshell/test/browser/browser_loadDisallowInherit.js index 3e415b022883..c40db0c4d1b1 100644 --- a/docshell/test/browser/browser_loadDisallowInherit.js +++ b/docshell/test/browser/browser_loadDisallowInherit.js @@ -38,7 +38,7 @@ function startTest() { function testURL(url, func) { let secMan = Services.scriptSecurityManager; let ios = Services.io; - let artificialPrincipal = secMan.createCodebasePrincipal( + let artificialPrincipal = secMan.createContentPrincipal( ios.newURI("http://example.com/"), {} ); diff --git a/dom/base/ContentAreaDropListener.jsm b/dom/base/ContentAreaDropListener.jsm index caee53fbdef0..09f3933284af 100644 --- a/dom/base/ContentAreaDropListener.jsm +++ b/dom/base/ContentAreaDropListener.jsm @@ -190,7 +190,7 @@ ContentAreaDropListener.prototype = .getService(Ci.nsIIOService); let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"]. getService(Ci.nsIScriptSecurityManager); - return secMan.createCodebasePrincipal(ioService.newURI(principalURISpec), {}); + return secMan.createContentPrincipal(ioService.newURI(principalURISpec), {}); }, getTriggeringPrincipal: function(aEvent) diff --git a/dom/base/Document.cpp b/dom/base/Document.cpp index 41c5acb9e544..c3208a5712e6 100644 --- a/dom/base/Document.cpp +++ b/dom/base/Document.cpp @@ -2424,7 +2424,7 @@ void Document::ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup, "must have a load context or pass in an explicit principal"); nsCOMPtr principal; - nsresult rv = securityManager->GetLoadContextCodebasePrincipal( + nsresult rv = securityManager->GetLoadContextContentPrincipal( mDocumentURI, loadContext, getter_AddRefs(principal)); if (NS_SUCCEEDED(rv)) { SetPrincipals(principal, principal); @@ -5429,12 +5429,12 @@ void Document::GetCookie(nsAString& aCookie, ErrorResult& rv) { do_GetService(NS_COOKIESERVICE_CONTRACTID); if (service) { // Get a URI from the document principal. We use the original - // codebase in case the codebase was changed by SetDomain - nsCOMPtr codebaseURI; - NodePrincipal()->GetURI(getter_AddRefs(codebaseURI)); + // content URI in case the domain was changed by SetDomain + nsCOMPtr principalURI; + NodePrincipal()->GetURI(getter_AddRefs(principalURI)); - if (!codebaseURI) { - // Document's principal is not a codebase (may be system), so + if (!principalURI) { + // Document's principal is not a content or null (may be system), so // can't set cookies return; @@ -5442,14 +5442,14 @@ void Document::GetCookie(nsAString& aCookie, ErrorResult& rv) { nsCOMPtr channel(mChannel); if (!channel) { - channel = CreateDummyChannelForCookies(codebaseURI); + channel = CreateDummyChannelForCookies(principalURI); if (!channel) { return; } } nsAutoCString cookie; - service->GetCookieString(codebaseURI, channel, cookie); + service->GetCookieString(principalURI, channel, cookie); // CopyUTF8toUTF16 doesn't handle error // because it assumes that the input is valid. UTF_8_ENCODING->DecodeWithoutBOMHandling(cookie, aCookie); @@ -5488,11 +5488,11 @@ void Document::SetCookie(const nsAString& aCookie, ErrorResult& rv) { do_GetService(NS_COOKIESERVICE_CONTRACTID); if (service && mDocumentURI) { // The code for getting the URI matches Navigator::CookieEnabled - nsCOMPtr codebaseURI; - NodePrincipal()->GetURI(getter_AddRefs(codebaseURI)); + nsCOMPtr principalURI; + NodePrincipal()->GetURI(getter_AddRefs(principalURI)); - if (!codebaseURI) { - // Document's principal is not a codebase (may be system), so + if (!principalURI) { + // Document's principal is not a content or null (may be system), so // can't set cookies return; @@ -5500,19 +5500,19 @@ void Document::SetCookie(const nsAString& aCookie, ErrorResult& rv) { nsCOMPtr channel(mChannel); if (!channel) { - channel = CreateDummyChannelForCookies(codebaseURI); + channel = CreateDummyChannelForCookies(principalURI); if (!channel) { return; } } NS_ConvertUTF16toUTF8 cookie(aCookie); - service->SetCookieString(codebaseURI, nullptr, cookie, channel); + service->SetCookieString(principalURI, nullptr, cookie, channel); } } already_AddRefed Document::CreateDummyChannelForCookies( - nsIURI* aCodebaseURI) { + nsIURI* aContentURI) { // The cookie service reads the privacy status of the channel we pass to it in // order to determine which cookie database to query. In some cases we don't // have a proper channel to hand it to the cookie service though. This @@ -5524,7 +5524,7 @@ already_AddRefed Document::CreateDummyChannelForCookies( // The following channel is never openend, so it does not matter what // securityFlags we pass; let's follow the principle of least privilege. nsCOMPtr channel; - NS_NewChannel(getter_AddRefs(channel), aCodebaseURI, this, + NS_NewChannel(getter_AddRefs(channel), aContentURI, this, nsILoadInfo::SEC_REQUIRE_SAME_ORIGIN_DATA_IS_BLOCKED, nsIContentPolicy::TYPE_INVALID); nsCOMPtr pbChannel = do_QueryInterface(channel); diff --git a/dom/base/Document.h b/dom/base/Document.h index 6fa225daadd7..350ec93bde8e 100644 --- a/dom/base/Document.h +++ b/dom/base/Document.h @@ -2319,7 +2319,7 @@ class Document : public nsINode, /** * Reset this document to aURI, aLoadGroup, aPrincipal and aStoragePrincipal. - * aURI must not be null. If aPrincipal is null, a codebase principal based + * aURI must not be null. If aPrincipal is null, a content principal based * on aURI will be used. */ virtual void ResetToURI(nsIURI* aURI, nsILoadGroup* aLoadGroup, @@ -2691,15 +2691,15 @@ class Document : public nsINode, // If we are a document "whose URL's scheme is not a network scheme." // NB: Explicitly allow file: URIs to store cookies. - nsCOMPtr codebaseURI; - NodePrincipal()->GetURI(getter_AddRefs(codebaseURI)); + nsCOMPtr contentURI; + NodePrincipal()->GetURI(getter_AddRefs(contentURI)); - if (!codebaseURI) { + if (!contentURI) { return true; } nsAutoCString scheme; - codebaseURI->GetScheme(scheme); + contentURI->GetScheme(scheme); return !scheme.EqualsLiteral("http") && !scheme.EqualsLiteral("https") && !scheme.EqualsLiteral("ftp") && !scheme.EqualsLiteral("file"); } @@ -4367,7 +4367,7 @@ class Document : public nsINode, // This should *ONLY* be used in GetCookie/SetCookie. already_AddRefed CreateDummyChannelForCookies( - nsIURI* aCodebaseURI); + nsIURI* aContentURI); nsCOMPtr mPreloadReferrerInfo; nsCOMPtr mReferrerInfo; diff --git a/dom/base/Navigator.cpp b/dom/base/Navigator.cpp index 93f71d1ede94..f2c67344c019 100644 --- a/dom/base/Navigator.cpp +++ b/dom/base/Navigator.cpp @@ -498,18 +498,18 @@ bool Navigator::CookieEnabled() { return cookieEnabled; } - nsCOMPtr codebaseURI; - doc->NodePrincipal()->GetURI(getter_AddRefs(codebaseURI)); + nsCOMPtr contentURI; + doc->NodePrincipal()->GetURI(getter_AddRefs(contentURI)); - if (!codebaseURI) { - // Not a codebase, so technically can't set cookies, but let's + if (!contentURI) { + // Not a content, so technically can't set cookies, but let's // just return the default value. return cookieEnabled; } uint32_t rejectedReason = 0; bool granted = AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor( - mWindow, codebaseURI, &rejectedReason); + mWindow, contentURI, &rejectedReason); AntiTrackingCommon::NotifyBlockingDecision( mWindow, diff --git a/dom/base/nsContentSink.cpp b/dom/base/nsContentSink.cpp index 45fca9682b63..734f50c1f43e 100644 --- a/dom/base/nsContentSink.cpp +++ b/dom/base/nsContentSink.cpp @@ -310,21 +310,21 @@ nsresult nsContentSink::ProcessHeaderData(nsAtom* aHeader, // Get a URI from the document principal - // We use the original codebase in case the codebase was changed + // We use the original content URI in case the principal was changed // by SetDomain - // Note that a non-codebase principal (eg the system principal) will return + // Note that a non-content principal (eg the system principal) will return // a null URI. - nsCOMPtr codebaseURI; - rv = mDocument->NodePrincipal()->GetURI(getter_AddRefs(codebaseURI)); - NS_ENSURE_TRUE(codebaseURI, rv); + nsCOMPtr contentURI; + rv = mDocument->NodePrincipal()->GetURI(getter_AddRefs(contentURI)); + NS_ENSURE_TRUE(contentURI, rv); nsCOMPtr channel; if (mParser) { mParser->GetChannel(getter_AddRefs(channel)); } - rv = cookieServ->SetCookieString(codebaseURI, nullptr, + rv = cookieServ->SetCookieString(contentURI, nullptr, NS_ConvertUTF16toUTF8(aValue), channel); if (NS_FAILED(rv)) { return rv; diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index ca893437c59e..7248daa58743 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -8991,7 +8991,7 @@ bool nsContentUtils::HttpsStateIsModern(Document* aDocument) { return false; } - MOZ_ASSERT(principal->GetIsCodebasePrincipal()); + MOZ_ASSERT(principal->GetIsContentPrincipal()); nsCOMPtr csm = do_GetService(NS_CONTENTSECURITYMANAGER_CONTRACTID); diff --git a/dom/base/nsGlobalWindowOuter.cpp b/dom/base/nsGlobalWindowOuter.cpp index b45197e30235..0c16381263e0 100644 --- a/dom/base/nsGlobalWindowOuter.cpp +++ b/dom/base/nsGlobalWindowOuter.cpp @@ -1681,9 +1681,9 @@ bool nsGlobalWindowOuter::ComputeIsSecureContext(Document* aDocument, // it doesn't actually matter what we use here, but reusing the document // principal's attributes is convenient. const OriginAttributes& attrs = principal->OriginAttributesRef(); - // CreateCodebasePrincipal correctly gets a useful principal for blob: and + // CreateContentPrincipal correctly gets a useful principal for blob: and // other URI_INHERITS_SECURITY_CONTEXT URIs. - principal = BasePrincipal::CreateCodebasePrincipal(uri, attrs); + principal = BasePrincipal::CreateContentPrincipal(uri, attrs); if (NS_WARN_IF(!principal)) { return false; } @@ -5973,7 +5973,7 @@ bool nsGlobalWindowOuter::GetPrincipalForPostMessage( // Create a nsIPrincipal inheriting the app/browser attributes from the // caller. providedPrincipal = - BasePrincipal::CreateCodebasePrincipal(aTargetOriginURI, attrs); + BasePrincipal::CreateContentPrincipal(aTargetOriginURI, attrs); if (NS_WARN_IF(!providedPrincipal)) { return false; } @@ -7291,7 +7291,7 @@ void nsGlobalWindowOuter::MaybeAllowStorageForOpenedWindow(nsIURI* aURI) { if (!doc) { return; } - nsCOMPtr principal = BasePrincipal::CreateCodebasePrincipal( + nsCOMPtr principal = BasePrincipal::CreateContentPrincipal( aURI, doc->NodePrincipal()->OriginAttributesRef()); // We don't care when the asynchronous work finishes here. diff --git a/dom/base/test/browser_multiple_popups.js b/dom/base/test/browser_multiple_popups.js index 4fad040a7df7..e0427a094bd4 100644 --- a/dom/base/test/browser_multiple_popups.js +++ b/dom/base/test/browser_multiple_popups.js @@ -75,7 +75,7 @@ add_task(async _ => { }); const uri = Services.io.newURI(TEST_DOMAIN); - const principal = Services.scriptSecurityManager.createCodebasePrincipal( + const principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); @@ -138,7 +138,7 @@ add_task(async _ => { }); const uri = Services.io.newURI(TEST_DOMAIN); - const principal = Services.scriptSecurityManager.createCodebasePrincipal( + const principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); @@ -356,7 +356,7 @@ add_task(async _ => { }); const uri = Services.io.newURI(TEST_DOMAIN); - const principal = Services.scriptSecurityManager.createCodebasePrincipal( + const principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/dom/base/test/unit/test_structuredcloneholder.js b/dom/base/test/unit/test_structuredcloneholder.js index 89e7ee3e347d..4711a1b26bed 100644 --- a/dom/base/test/unit/test_structuredcloneholder.js +++ b/dom/base/test/unit/test_structuredcloneholder.js @@ -3,7 +3,7 @@ const global = this; add_task(async function test_structuredCloneHolder() { - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI("http://example.com/"), {} ); @@ -113,7 +113,7 @@ add_task(async function test_structuredCloneHolder() { // Test that X-rays passed to an exported function are serialized // through their exported wrappers. add_task(async function test_structuredCloneHolder_xray() { - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI("http://example.com/"), {} ); diff --git a/dom/browser-element/mochitest/browserElement_Auth.js b/dom/browser-element/mochitest/browserElement_Auth.js index c4e0a434af52..446b9d4af69a 100644 --- a/dom/browser-element/mochitest/browserElement_Auth.js +++ b/dom/browser-element/mochitest/browserElement_Auth.js @@ -224,7 +224,7 @@ function testAuthJarNoInterfere(e) { // Set a bunch of auth data that should not conflict with the correct auth data already // stored in the cache. var attrs = { userContextId: 1 }; - var principal = secMan.createCodebasePrincipal(uri, attrs); + var principal = secMan.createContentPrincipal(uri, attrs); authMgr.setAuthIdentity( "http", "test", @@ -239,7 +239,7 @@ function testAuthJarNoInterfere(e) { principal ); attrs = { userContextId: 1, inIsolatedMozBrowser: true }; - principal = secMan.createCodebasePrincipal(uri, attrs); + principal = secMan.createContentPrincipal(uri, attrs); authMgr.setAuthIdentity( "http", "test", @@ -253,7 +253,7 @@ function testAuthJarNoInterfere(e) { false, principal ); - principal = secMan.createCodebasePrincipal(uri, {}); + principal = secMan.createContentPrincipal(uri, {}); authMgr.setAuthIdentity( "http", "test", @@ -301,7 +301,7 @@ function testAuthJarInterfere(e) { ); // Set some auth data that should overwrite the successful stored details. - var principal = secMan.createCodebasePrincipal(uri, { + var principal = secMan.createContentPrincipal(uri, { inIsolatedMozBrowser: true, }); authMgr.setAuthIdentity( diff --git a/dom/html/HTMLIFrameElement.cpp b/dom/html/HTMLIFrameElement.cpp index 11f138c27e21..f8e5ff0575a2 100644 --- a/dom/html/HTMLIFrameElement.cpp +++ b/dom/html/HTMLIFrameElement.cpp @@ -239,7 +239,7 @@ HTMLIFrameElement::GetFeaturePolicyDefaultOrigin() const { nsCOMPtr nodeURI; if (GetURIAttr(nsGkAtoms::src, nullptr, getter_AddRefs(nodeURI)) && nodeURI) { - principal = BasePrincipal::CreateCodebasePrincipal( + principal = BasePrincipal::CreateContentPrincipal( nodeURI, BasePrincipal::Cast(NodePrincipal())->OriginAttributesRef()); } diff --git a/dom/indexedDB/test/bug839193.js b/dom/indexedDB/test/bug839193.js index 0b7b1da3f07b..880d178076e3 100644 --- a/dom/indexedDB/test/bug839193.js +++ b/dom/indexedDB/test/bug839193.js @@ -14,7 +14,7 @@ function onLoad() { var quotaManagerService = Cc[ "@mozilla.org/dom/quota-manager-service;1" ].getService(nsIQuotaManagerService); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( gURI, {} ); diff --git a/dom/indexedDB/test/head.js b/dom/indexedDB/test/head.js index 8325dedea260..a7251a5298e9 100644 --- a/dom/indexedDB/test/head.js +++ b/dom/indexedDB/test/head.js @@ -124,7 +124,7 @@ function dispatchEvent(eventName) { function setPermission(url, permission) { let uri = Services.io.newURI(url); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); @@ -138,7 +138,7 @@ function setPermission(url, permission) { function removePermission(url, permission) { let uri = Services.io.newURI(url); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); @@ -148,7 +148,7 @@ function removePermission(url, permission) { function getPermission(url, permission) { let uri = Services.io.newURI(url); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/dom/indexedDB/test/unit/test_bad_origin_directory.js b/dom/indexedDB/test/unit/test_bad_origin_directory.js index a4f4e74dabef..40135c4c947b 100644 --- a/dom/indexedDB/test/unit/test_bad_origin_directory.js +++ b/dom/indexedDB/test/unit/test_bad_origin_directory.js @@ -11,7 +11,7 @@ function* testSteps() { let uri = Services.io.newURI(url); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/dom/indexedDB/test/unit/test_idle_maintenance.js b/dom/indexedDB/test/unit/test_idle_maintenance.js index 242287891f22..04d31828da68 100644 --- a/dom/indexedDB/test/unit/test_idle_maintenance.js +++ b/dom/indexedDB/test/unit/test_idle_maintenance.js @@ -8,7 +8,7 @@ var testGenerator = testSteps(); function* testSteps() { let uri = Services.io.newURI("https://www.example.com"); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/dom/indexedDB/test/unit/test_metadata2Restore.js b/dom/indexedDB/test/unit/test_metadata2Restore.js index 8211be6ad2ca..75ce5181d78c 100644 --- a/dom/indexedDB/test/unit/test_metadata2Restore.js +++ b/dom/indexedDB/test/unit/test_metadata2Restore.js @@ -298,7 +298,7 @@ function* testSteps() { let request; if ("url" in params) { let uri = Services.io.newURI(params.url); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, params.attrs || {} ); diff --git a/dom/indexedDB/test/unit/test_metadataRestore.js b/dom/indexedDB/test/unit/test_metadataRestore.js index b18c9015fd2f..422965d5725e 100644 --- a/dom/indexedDB/test/unit/test_metadataRestore.js +++ b/dom/indexedDB/test/unit/test_metadataRestore.js @@ -97,7 +97,7 @@ function* testSteps() { let request; if ("url" in params) { let uri = Services.io.newURI(params.url); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/dom/indexedDB/test/unit/test_oldDirectories.js b/dom/indexedDB/test/unit/test_oldDirectories.js index 750a878e751c..1edc2bb185dd 100644 --- a/dom/indexedDB/test/unit/test_oldDirectories.js +++ b/dom/indexedDB/test/unit/test_oldDirectories.js @@ -13,7 +13,7 @@ function* testSteps() { function openDatabase() { let uri = Services.io.newURI(url); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/dom/indexedDB/test/unit/test_open_for_principal.js b/dom/indexedDB/test/unit/test_open_for_principal.js index 97e85179e1d0..6bc8bddc11ab 100644 --- a/dom/indexedDB/test/unit/test_open_for_principal.js +++ b/dom/indexedDB/test/unit/test_open_for_principal.js @@ -46,7 +46,7 @@ function* testSteps() { is(event.target.result, data.key, "Got correct key"); let uri = Services.io.newURI("http://appdata.example.com"); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/dom/indexedDB/test/unit/xpcshell-head-parent-process.js b/dom/indexedDB/test/unit/xpcshell-head-parent-process.js index 6c14009a0b8c..ad496a5d8b60 100644 --- a/dom/indexedDB/test/unit/xpcshell-head-parent-process.js +++ b/dom/indexedDB/test/unit/xpcshell-head-parent-process.js @@ -519,7 +519,7 @@ function setMaxSerializedMsgSize(aSize) { function getPrincipal(url) { let uri = Services.io.newURI(url); - return Services.scriptSecurityManager.createCodebasePrincipal(uri, {}); + return Services.scriptSecurityManager.createContentPrincipal(uri, {}); } function expectingSuccess(request) { diff --git a/dom/interfaces/storage/nsIStorageActivityService.idl b/dom/interfaces/storage/nsIStorageActivityService.idl index b8ac8ed7bec3..f33fcfc2226a 100644 --- a/dom/interfaces/storage/nsIStorageActivityService.idl +++ b/dom/interfaces/storage/nsIStorageActivityService.idl @@ -24,7 +24,7 @@ interface nsIStorageActivityService : nsISupports // This returns an array of nsIPrincipals, active between |from| and |to| // timestamps. Note activities older than 1 day are forgotten. // Activity details are not persisted, so this only covers activity since - // Firefox was started. All codebase principals are logged, which includes + // Firefox was started. All content principals are logged, which includes // non-system principals like "moz-extension://ID", "moz-safe-about:home", // "about:newtab", so principals may need to be filtered before being used. nsIArray getActiveOrigins(in PRTime from, in PRTime to); diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 659d4f94f664..e465969fbe73 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -2660,7 +2660,7 @@ mozilla::ipc::IPCResult ContentChild::RecvAddPermission( NS_ENSURE_SUCCESS(rv, IPC_OK()); nsCOMPtr principal = - mozilla::BasePrincipal::CreateCodebasePrincipal(uri, attrs); + mozilla::BasePrincipal::CreateContentPrincipal(uri, attrs); // child processes don't care about modification time. int64_t modificationTime = 0; diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 47707df24eb2..acfbe46b076e 100644 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -5410,7 +5410,7 @@ nsresult ContentParent::AboutToLoadHttpFtpDocumentForChild( return NS_OK; } - if (principal->GetIsCodebasePrincipal()) { + if (principal->GetIsContentPrincipal()) { nsCOMPtr lsm = do_GetService("@mozilla.org/dom/localStorage-manager;1"); if (NS_WARN_IF(!lsm)) { diff --git a/dom/localstorage/test/gtest/TestLocalStorage.cpp b/dom/localstorage/test/gtest/TestLocalStorage.cpp index c4e6c4670b5a..ed1e270a7445 100644 --- a/dom/localstorage/test/gtest/TestLocalStorage.cpp +++ b/dom/localstorage/test/gtest/TestLocalStorage.cpp @@ -27,7 +27,7 @@ struct OriginKeyTest { const char* mOriginKey; }; -already_AddRefed GetCodebasePrincipal(const char* aSpec) { +already_AddRefed GetContentPrincipal(const char* aSpec) { nsCOMPtr uri; nsresult rv = NS_NewURI(getter_AddRefs(uri), nsDependentCString(aSpec)); if (NS_WARN_IF(NS_FAILED(rv))) { @@ -37,7 +37,7 @@ already_AddRefed GetCodebasePrincipal(const char* aSpec) { OriginAttributes attrs; nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(uri, attrs); + BasePrincipal::CreateContentPrincipal(uri, attrs); return principal.forget(); } @@ -109,9 +109,9 @@ TEST(LocalStorage, OriginKey) }; for (const auto& test : tests) { - principal = GetCodebasePrincipal(test.mSpec); + principal = GetContentPrincipal(test.mSpec); ASSERT_TRUE(principal) - << "GetCodebasePrincipal() should not fail"; + << "GetContentPrincipal() should not fail"; CheckGeneratedOriginKey(principal, test.mOriginKey); } diff --git a/dom/localstorage/test/unit/head.js b/dom/localstorage/test/unit/head.js index 17f5723562c0..b400d81f277c 100644 --- a/dom/localstorage/test/unit/head.js +++ b/dom/localstorage/test/unit/head.js @@ -261,7 +261,7 @@ function getPrincipal(url, attrs) { if (!attrs) { attrs = {}; } - return Services.scriptSecurityManager.createCodebasePrincipal(uri, attrs); + return Services.scriptSecurityManager.createContentPrincipal(uri, attrs); } function getCurrentPrincipal() { diff --git a/dom/media/DOMMediaStream.cpp b/dom/media/DOMMediaStream.cpp index 6d5da7890a2b..4439552cc20b 100644 --- a/dom/media/DOMMediaStream.cpp +++ b/dom/media/DOMMediaStream.cpp @@ -732,7 +732,7 @@ void DOMMediaStream::NotifyPrincipalChanged() { LOG(LogLevel::Info, ("DOMMediaStream %p Principal changed. Now: " "null=%d, codebase=%d, expanded=%d, system=%d", this, mPrincipal->GetIsNullPrincipal(), - mPrincipal->GetIsCodebasePrincipal(), + mPrincipal->GetIsContentPrincipal(), mPrincipal->GetIsExpandedPrincipal(), mPrincipal->IsSystemPrincipal())); } diff --git a/dom/media/MediaStreamTrack.cpp b/dom/media/MediaStreamTrack.cpp index 0c1d5590402d..cd00b2661920 100644 --- a/dom/media/MediaStreamTrack.cpp +++ b/dom/media/MediaStreamTrack.cpp @@ -402,7 +402,7 @@ void MediaStreamTrack::SetPrincipal(nsIPrincipal* aPrincipal) { ("MediaStreamTrack %p principal changed to %p. Now: " "null=%d, codebase=%d, expanded=%d, system=%d", this, mPrincipal.get(), mPrincipal->GetIsNullPrincipal(), - mPrincipal->GetIsCodebasePrincipal(), + mPrincipal->GetIsContentPrincipal(), mPrincipal->GetIsExpandedPrincipal(), mPrincipal->IsSystemPrincipal())); for (PrincipalChangeObserver* observer : mPrincipalChangeObservers) { diff --git a/dom/notification/test/mochitest/test_notification_insecure_context.html b/dom/notification/test/mochitest/test_notification_insecure_context.html index 5c3ed17d3a6f..ec78fdcdb59f 100644 --- a/dom/notification/test/mochitest/test_notification_insecure_context.html +++ b/dom/notification/test/mochitest/test_notification_insecure_context.html @@ -20,7 +20,7 @@ https://bugzilla.mozilla.org/show_bug.cgi?id=1429432 // Add an allow permission for the mochitest origin to test this. let script = SpecialPowers.loadChromeScript(function() { let {Services} = ChromeUtils.import("resource://gre/modules/Services.jsm"); - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin("http://mochi.test:8888"); + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin("http://mochi.test:8888"); Services.perms.addFromPrincipal(principal, "desktop-notification", Services.perms.ALLOW_ACTION); /* global addMessageListener */ addMessageListener("destroy", function() { diff --git a/dom/plugins/base/nsPluginInstanceOwner.cpp b/dom/plugins/base/nsPluginInstanceOwner.cpp index 4489196a1248..8779712ce16c 100644 --- a/dom/plugins/base/nsPluginInstanceOwner.cpp +++ b/dom/plugins/base/nsPluginInstanceOwner.cpp @@ -430,7 +430,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL( (PopupBlocker::PopupControlState)blockPopups); // if security checks (in particular CheckLoadURIWithPrincipal) needs - // to be skipped we are creating a codebasePrincipal to make sure + // to be skipped we are creating a contentPrincipal to make sure // that security check succeeds. Please note that we do not want to // fall back to using the systemPrincipal, because that would also // bypass ContentPolicy checks which should still be enforced. @@ -438,7 +438,7 @@ NS_IMETHODIMP nsPluginInstanceOwner::GetURL( if (!aDoCheckLoadURIChecks) { mozilla::OriginAttributes attrs = BasePrincipal::Cast(content->NodePrincipal())->OriginAttributesRef(); - triggeringPrincipal = BasePrincipal::CreateCodebasePrincipal(uri, attrs); + triggeringPrincipal = BasePrincipal::CreateContentPrincipal(uri, attrs); } else { triggeringPrincipal = NullPrincipal::CreateWithInheritedAttributes(content->NodePrincipal()); diff --git a/dom/presentation/PresentationRequest.cpp b/dom/presentation/PresentationRequest.cpp index ff3b19f40859..4004b395b229 100644 --- a/dom/presentation/PresentationRequest.cpp +++ b/dom/presentation/PresentationRequest.cpp @@ -504,7 +504,7 @@ bool PresentationRequest::IsPrioriAuthenticatedURL(const nsAString& aUrl) { OriginAttributes attrs; nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(uri, attrs); + BasePrincipal::CreateContentPrincipal(uri, attrs); if (NS_WARN_IF(!principal)) { return false; } diff --git a/dom/push/PushRecord.jsm b/dom/push/PushRecord.jsm index 3848dce82347..a04caa850e23 100644 --- a/dom/push/PushRecord.jsm +++ b/dom/push/PushRecord.jsm @@ -306,7 +306,7 @@ Object.defineProperties(PushRecord.prototype, { let uri = Services.io.newURI(this.scope); // Allow tests to omit origin attributes. let originSuffix = this.originAttributes || ""; - principal = Services.scriptSecurityManager.createCodebasePrincipal( + principal = Services.scriptSecurityManager.createContentPrincipal( uri, ChromeUtils.createOriginAttributesFromOrigin(originSuffix) ); diff --git a/dom/push/test/xpcshell/test_permissions.js b/dom/push/test/xpcshell/test_permissions.js index 7403ca03cde7..dd37c6a3499d 100644 --- a/dom/push/test/xpcshell/test_permissions.js +++ b/dom/push/test/xpcshell/test_permissions.js @@ -35,7 +35,7 @@ function makePushPermission(url, capability) { capability: Ci.nsIPermissionManager[capability], expireTime: 0, expireType: Ci.nsIPermissionManager.EXPIRE_NEVER, - principal: Services.scriptSecurityManager.createCodebasePrincipal( + principal: Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI(url), {} ), diff --git a/dom/push/test/xpcshell/test_quota_observer.js b/dom/push/test/xpcshell/test_quota_observer.js index 263b5d02d4a3..9f8c0148f74f 100644 --- a/dom/push/test/xpcshell/test_quota_observer.js +++ b/dom/push/test/xpcshell/test_quota_observer.js @@ -191,7 +191,7 @@ add_task(async function test_expiration_history_observer() { (subject, data) => { if (data == "https://example.net/sales") { ok( - subject.isCodebasePrincipal, + subject.isContentPrincipal, "Should pass subscription principal as the subject" ); return true; diff --git a/dom/push/test/xpcshell/test_service_child.js b/dom/push/test/xpcshell/test_service_child.js index ffbd2cbfe203..50615581d55d 100644 --- a/dom/push/test/xpcshell/test_service_child.js +++ b/dom/push/test/xpcshell/test_service_child.js @@ -285,7 +285,7 @@ add_test(function test_unsubscribe_error() { add_test(function test_subscribe_origin_principal() { let scope = "https://example.net/origin-principal"; - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( scope ); diff --git a/dom/quota/ActorsParent.cpp b/dom/quota/ActorsParent.cpp index bcb1ed95dd05..07b2242906ba 100644 --- a/dom/quota/ActorsParent.cpp +++ b/dom/quota/ActorsParent.cpp @@ -8773,7 +8773,7 @@ bool PrincipalVerifier::IsPrincipalInfoValid( } nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(uri, info.attrs()); + BasePrincipal::CreateContentPrincipal(uri, info.attrs()); if (NS_WARN_IF(!principal)) { return false; } diff --git a/dom/quota/test/head.js b/dom/quota/test/head.js index cd33946541cd..395d93b5b21c 100644 --- a/dom/quota/test/head.js +++ b/dom/quota/test/head.js @@ -142,7 +142,7 @@ function removePermission(url, permission) { let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].getService( Ci.nsIScriptSecurityManager ); - let principal = ssm.createCodebasePrincipal(uri, {}); + let principal = ssm.createContentPrincipal(uri, {}); Cc["@mozilla.org/permissionmanager;1"] .getService(Ci.nsIPermissionManager) @@ -156,7 +156,7 @@ function getPermission(url, permission) { let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].getService( Ci.nsIScriptSecurityManager ); - let principal = ssm.createCodebasePrincipal(uri, {}); + let principal = ssm.createContentPrincipal(uri, {}); return Cc["@mozilla.org/permissionmanager;1"] .getService(Ci.nsIPermissionManager) diff --git a/dom/quota/test/unit/head.js b/dom/quota/test/unit/head.js index 98f45e19cbbb..853afbdf2110 100644 --- a/dom/quota/test/unit/head.js +++ b/dom/quota/test/unit/head.js @@ -327,7 +327,7 @@ function getPrincipal(url) { let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].getService( Ci.nsIScriptSecurityManager ); - return ssm.createCodebasePrincipal(uri, {}); + return ssm.createContentPrincipal(uri, {}); } function getCurrentPrincipal() { diff --git a/dom/script/ScriptLoader.cpp b/dom/script/ScriptLoader.cpp index 751f17edf17e..21ec518d28ec 100644 --- a/dom/script/ScriptLoader.cpp +++ b/dom/script/ScriptLoader.cpp @@ -345,9 +345,9 @@ nsresult ScriptLoader::CheckContentPolicy(Document* aDocument, /* static */ bool ScriptLoader::IsAboutPageLoadingChromeURI(ScriptLoadRequest* aRequest) { - // if we are not dealing with a codebasePrincipal it can not be a + // if we are not dealing with a contentPrincipal it can not be a // Principal with a scheme of about: and there is nothing left to do - if (!aRequest->TriggeringPrincipal()->GetIsCodebasePrincipal()) { + if (!aRequest->TriggeringPrincipal()->GetIsContentPrincipal()) { return false; } diff --git a/dom/script/ScriptLoader.h b/dom/script/ScriptLoader.h index f149b9878c2b..567bea47963b 100644 --- a/dom/script/ScriptLoader.h +++ b/dom/script/ScriptLoader.h @@ -421,7 +421,7 @@ class ScriptLoader final : public nsISupports { /** * Helper function to determine whether an about: page loads a chrome: URI. * Please note that this function only returns true if: - * * the about: page uses a CodeBasePrincipal with scheme about: + * * the about: page uses a ContentPrincipal with scheme about: * * the about: page is not linkable from content * (e.g. the function will return false for about:blank or about:srcdoc) */ diff --git a/dom/security/featurepolicy/FeaturePolicy.cpp b/dom/security/featurepolicy/FeaturePolicy.cpp index 1bd546e3b61c..c6e5a850d869 100644 --- a/dom/security/featurepolicy/FeaturePolicy.cpp +++ b/dom/security/featurepolicy/FeaturePolicy.cpp @@ -102,7 +102,7 @@ bool FeaturePolicy::AllowsFeature(const nsAString& aFeatureName, if (NS_FAILED(rv)) { return false; } - origin = BasePrincipal::CreateCodebasePrincipal( + origin = BasePrincipal::CreateContentPrincipal( uri, BasePrincipal::Cast(mDefaultOrigin)->OriginAttributesRef()); } else { origin = mDefaultOrigin; diff --git a/dom/security/featurepolicy/FeaturePolicyParser.cpp b/dom/security/featurepolicy/FeaturePolicyParser.cpp index 6aa539a43784..b8625524570c 100644 --- a/dom/security/featurepolicy/FeaturePolicyParser.cpp +++ b/dom/security/featurepolicy/FeaturePolicyParser.cpp @@ -113,7 +113,7 @@ bool FeaturePolicyParser::ParseString(const nsAString& aPolicy, continue; } - nsCOMPtr origin = BasePrincipal::CreateCodebasePrincipal( + nsCOMPtr origin = BasePrincipal::CreateContentPrincipal( uri, BasePrincipal::Cast(aSelfOrigin)->OriginAttributesRef()); if (NS_WARN_IF(!origin)) { ReportToConsoleInvalidAllowValue(aDocument, curVal); diff --git a/dom/security/featurepolicy/test/gtest/TestFeaturePolicyParser.cpp b/dom/security/featurepolicy/test/gtest/TestFeaturePolicyParser.cpp index 857792496084..0ea882343042 100644 --- a/dom/security/featurepolicy/test/gtest/TestFeaturePolicyParser.cpp +++ b/dom/security/featurepolicy/test/gtest/TestFeaturePolicyParser.cpp @@ -22,7 +22,7 @@ void CheckParser(const nsAString& aInput, bool aExpectedResults, uint32_t aExpectedFeatures, nsTArray& aParsedFeatures) { nsCOMPtr principal = - mozilla::BasePrincipal::CreateCodebasePrincipal(URL_SELF); + mozilla::BasePrincipal::CreateContentPrincipal(URL_SELF); nsTArray parsedFeatures; ASSERT_TRUE(FeaturePolicyParser::ParseString(aInput, nullptr, principal, principal, parsedFeatures) == @@ -35,11 +35,11 @@ void CheckParser(const nsAString& aInput, bool aExpectedResults, TEST(FeaturePolicyParser, Basic) { nsCOMPtr selfPrincipal = - mozilla::BasePrincipal::CreateCodebasePrincipal(URL_SELF); + mozilla::BasePrincipal::CreateContentPrincipal(URL_SELF); nsCOMPtr exampleComPrincipal = - mozilla::BasePrincipal::CreateCodebasePrincipal(URL_EXAMPLE_COM); + mozilla::BasePrincipal::CreateContentPrincipal(URL_EXAMPLE_COM); nsCOMPtr exampleNetPrincipal = - mozilla::BasePrincipal::CreateCodebasePrincipal(URL_EXAMPLE_NET); + mozilla::BasePrincipal::CreateContentPrincipal(URL_EXAMPLE_NET); nsTArray parsedFeatures; diff --git a/dom/security/fuzztest/csp_fuzzer.cpp b/dom/security/fuzztest/csp_fuzzer.cpp index e80c48f17143..f9e200429276 100644 --- a/dom/security/fuzztest/csp_fuzzer.cpp +++ b/dom/security/fuzztest/csp_fuzzer.cpp @@ -17,7 +17,7 @@ static int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) { mozilla::OriginAttributes attrs; nsCOMPtr selfURIPrincipal = - mozilla::BasePrincipal::CreateCodebasePrincipal(selfURI, attrs); + mozilla::BasePrincipal::CreateContentPrincipal(selfURI, attrs); if (!selfURIPrincipal) return 0; nsCOMPtr csp = diff --git a/dom/security/nsContentSecurityManager.cpp b/dom/security/nsContentSecurityManager.cpp index 077d66fd0e3e..a21f9a2fba94 100644 --- a/dom/security/nsContentSecurityManager.cpp +++ b/dom/security/nsContentSecurityManager.cpp @@ -39,12 +39,12 @@ bool nsContentSecurityManager::AllowTopLevelNavigationToDataURI( nsIChannel* aChannel) { // Let's block all toplevel document navigations to a data: URI. // In all cases where the toplevel document is navigated to a - // data: URI the triggeringPrincipal is a codeBasePrincipal, or + // data: URI the triggeringPrincipal is a contentPrincipal, or // a NullPrincipal. In other cases, e.g. typing a data: URL into // the URL-Bar, the triggeringPrincipal is a SystemPrincipal; // we don't want to block those loads. Only exception, loads coming // from an external applicaton (e.g. Thunderbird) don't load - // using a codeBasePrincipal, but we want to block those loads. + // using a contentPrincipal, but we want to block those loads. if (!mozilla::net::nsIOService::BlockToplevelDataUriNavigations()) { return true; } @@ -1113,7 +1113,7 @@ nsContentSecurityManager::IsOriginPotentiallyTrustworthy( return NS_OK; } - MOZ_ASSERT(aPrincipal->GetIsCodebasePrincipal(), + MOZ_ASSERT(aPrincipal->GetIsContentPrincipal(), "Nobody is expected to call us with an nsIExpandedPrincipal"); nsCOMPtr uri; diff --git a/dom/security/nsMixedContentBlocker.cpp b/dom/security/nsMixedContentBlocker.cpp index e231e4cad3cf..81b06808ed3b 100644 --- a/dom/security/nsMixedContentBlocker.cpp +++ b/dom/security/nsMixedContentBlocker.cpp @@ -415,7 +415,7 @@ bool nsMixedContentBlocker::IsPotentiallyTrustworthyOrigin(nsIURI* aURI) { } // Blobs are expected to inherit their principal so we don't expect to have - // a codebase principal with scheme 'blob' here. We can't assert that though + // a content principal with scheme 'blob' here. We can't assert that though // since someone could mess with a non-blob URI to give it that scheme. NS_WARNING_ASSERTION(!scheme.EqualsLiteral("blob"), "IsOriginPotentiallyTrustworthy ignoring blob scheme"); diff --git a/dom/security/test/general/test_bug1277803.xul b/dom/security/test/general/test_bug1277803.xul index d36f0d142514..482dd6b916ec 100644 --- a/dom/security/test/general/test_bug1277803.xul +++ b/dom/security/test/general/test_bug1277803.xul @@ -24,7 +24,7 @@ let securityManager = Cc["@mozilla.org/scriptsecuritymanager;1"]. getService(Ci.nsIScriptSecurityManager); - let expectedPrincipal = securityManager.createCodebasePrincipal(makeURI(LOADING_URI), {}); + let expectedPrincipal = securityManager.createContentPrincipal(makeURI(LOADING_URI), {}); let systemPrincipal = Cc["@mozilla.org/systemprincipal;1"].createInstance(); function runTest() { diff --git a/dom/security/test/gtest/TestCSPParser.cpp b/dom/security/test/gtest/TestCSPParser.cpp index f5497fc7b046..d1bba155c38c 100644 --- a/dom/security/test/gtest/TestCSPParser.cpp +++ b/dom/security/test/gtest/TestCSPParser.cpp @@ -80,7 +80,7 @@ nsresult runTest( nsCOMPtr selfURIPrincipal; mozilla::OriginAttributes attrs; selfURIPrincipal = - mozilla::BasePrincipal::CreateCodebasePrincipal(selfURI, attrs); + mozilla::BasePrincipal::CreateContentPrincipal(selfURI, attrs); NS_ENSURE_TRUE(selfURIPrincipal, NS_ERROR_FAILURE); // create a CSP object diff --git a/dom/security/test/gtest/TestSecureContext.cpp b/dom/security/test/gtest/TestSecureContext.cpp index 7c252b2dc5d0..dddca673dc98 100644 --- a/dom/security/test/gtest/TestSecureContext.cpp +++ b/dom/security/test/gtest/TestSecureContext.cpp @@ -26,7 +26,7 @@ struct TestExpectations { // ============================= TestDirectives ======================== -TEST(SecureContext, IsOriginPotentiallyTrustworthyWithCodeBasePrincipal) +TEST(SecureContext, IsOriginPotentiallyTrustworthyWithContentPrincipal) { // boolean isOriginPotentiallyTrustworthy(in nsIPrincipal aPrincipal); @@ -60,7 +60,7 @@ TEST(SecureContext, IsOriginPotentiallyTrustworthyWithCodeBasePrincipal) nsCOMPtr prin; nsAutoCString uri(uris[i].uri); rv = nsScriptSecurityManager::GetScriptSecurityManager() - ->CreateCodebasePrincipalFromOrigin(uri, getter_AddRefs(prin)); + ->CreateContentPrincipalFromOrigin(uri, getter_AddRefs(prin)); bool isPotentiallyTrustworthy = false; rv = csManager->IsOriginPotentiallyTrustworthy(prin, &isPotentiallyTrustworthy); diff --git a/dom/security/test/unit/test_csp_reports.js b/dom/security/test/unit/test_csp_reports.js index 72a415b4db79..dbe3636b016e 100644 --- a/dom/security/test/unit/test_csp_reports.js +++ b/dom/security/test/unit/test_csp_reports.js @@ -93,7 +93,7 @@ function makeTest(id, expectedJSON, useReportOnlyPolicy, callback) { dump("Created test " + id + " : " + policy + "\n\n"); - principal = Services.scriptSecurityManager.createCodebasePrincipal( + principal = Services.scriptSecurityManager.createContentPrincipal( selfuri, {} ); diff --git a/dom/security/test/unit/test_isOriginPotentiallyTrustworthy.js b/dom/security/test/unit/test_isOriginPotentiallyTrustworthy.js index 3b24d3038fcd..e5bc3f7dcb87 100644 --- a/dom/security/test/unit/test_isOriginPotentiallyTrustworthy.js +++ b/dom/security/test/unit/test_isOriginPotentiallyTrustworthy.js @@ -48,7 +48,7 @@ add_task(async function test_isOriginPotentiallyTrustworthy() { ["http://1234567890abcdef.onion/", false], ]) { let uri = NetUtil.newURI(uriSpec); - let principal = gScriptSecurityManager.createCodebasePrincipal(uri, {}); + let principal = gScriptSecurityManager.createContentPrincipal(uri, {}); Assert.equal( gContentSecurityManager.isOriginPotentiallyTrustworthy(principal), expectedResult @@ -58,7 +58,7 @@ add_task(async function test_isOriginPotentiallyTrustworthy() { // whitelisted, see bug 1382359. Services.prefs.setBoolPref("dom.securecontext.whitelist_onions", true); let uri = NetUtil.newURI("http://1234567890abcdef.onion/"); - let principal = gScriptSecurityManager.createCodebasePrincipal(uri, {}); + let principal = gScriptSecurityManager.createContentPrincipal(uri, {}); Assert.equal( gContentSecurityManager.isOriginPotentiallyTrustworthy(principal), true diff --git a/dom/serviceworkers/ServiceWorkerInterceptController.cpp b/dom/serviceworkers/ServiceWorkerInterceptController.cpp index ba92bc257dfb..a5fe267272a4 100644 --- a/dom/serviceworkers/ServiceWorkerInterceptController.cpp +++ b/dom/serviceworkers/ServiceWorkerInterceptController.cpp @@ -36,7 +36,7 @@ ServiceWorkerInterceptController::ShouldPrepareForIntercept( return NS_OK; } - nsCOMPtr principal = BasePrincipal::CreateCodebasePrincipal( + nsCOMPtr principal = BasePrincipal::CreateContentPrincipal( aURI, loadInfo->GetOriginAttributes()); // First check with the ServiceWorkerManager for a matching service worker. diff --git a/dom/serviceworkers/ServiceWorkerManager.cpp b/dom/serviceworkers/ServiceWorkerManager.cpp index 221639edc9ed..2cc99b2e63f5 100644 --- a/dom/serviceworkers/ServiceWorkerManager.cpp +++ b/dom/serviceworkers/ServiceWorkerManager.cpp @@ -203,7 +203,7 @@ nsresult PopulateRegistrationData( MOZ_ASSERT(aPrincipal); MOZ_ASSERT(aRegistration); - if (NS_WARN_IF(!BasePrincipal::Cast(aPrincipal)->IsCodebasePrincipal())) { + if (NS_WARN_IF(!BasePrincipal::Cast(aPrincipal)->IsContentPrincipal())) { return NS_ERROR_FAILURE; } @@ -824,7 +824,7 @@ class GetRegistrationsRunnable final : public Runnable { nsTArray array; - if (NS_WARN_IF(!BasePrincipal::Cast(principal)->IsCodebasePrincipal())) { + if (NS_WARN_IF(!BasePrincipal::Cast(principal)->IsContentPrincipal())) { return NS_OK; } @@ -1156,7 +1156,7 @@ ServiceWorkerInfo* ServiceWorkerManager::GetActiveWorkerInfoForScope( return nullptr; } nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(scopeURI, aOriginAttributes); + BasePrincipal::CreateContentPrincipal(scopeURI, aOriginAttributes); RefPtr registration = GetServiceWorkerRegistrationInfo(principal, scopeURI); if (!registration) { @@ -1564,7 +1564,7 @@ nsresult ServiceWorkerManager::PrincipalToScopeKey(nsIPrincipal* aPrincipal, nsACString& aKey) { MOZ_ASSERT(aPrincipal); - if (!BasePrincipal::Cast(aPrincipal)->IsCodebasePrincipal()) { + if (!BasePrincipal::Cast(aPrincipal)->IsContentPrincipal()) { return NS_ERROR_FAILURE; } @@ -1975,7 +1975,7 @@ void ServiceWorkerManager::DispatchFetchEvent(nsIInterceptedChannel* aChannel, } // non-subresource request means the URI contains the principal - nsCOMPtr principal = BasePrincipal::CreateCodebasePrincipal( + nsCOMPtr principal = BasePrincipal::CreateContentPrincipal( uri, loadInfo->GetOriginAttributes()); RefPtr registration = @@ -2214,7 +2214,7 @@ void ServiceWorkerManager::SoftUpdateInternal( } nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(scopeURI, aOriginAttributes); + BasePrincipal::CreateContentPrincipal(scopeURI, aOriginAttributes); if (NS_WARN_IF(!principal)) { return; } diff --git a/dom/serviceworkers/test/browser_storage_recovery.js b/dom/serviceworkers/test/browser_storage_recovery.js index c18b93f3da48..6844c5433ff7 100644 --- a/dom/serviceworkers/test/browser_storage_recovery.js +++ b/dom/serviceworkers/test/browser_storage_recovery.js @@ -28,7 +28,7 @@ async function checkForUpdate(browser) { // QuotaManager APIs async function wipeStorage(u) { let uri = Services.io.newURI(u); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/dom/serviceworkers/test/test_scopes.html b/dom/serviceworkers/test/test_scopes.html index 93b604bf9878..a3bd3bb052c6 100644 --- a/dom/serviceworkers/test/test_scopes.html +++ b/dom/serviceworkers/test/test_scopes.html @@ -71,7 +71,7 @@ let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"] .getService(Ci.nsIScriptSecurityManager); addMessageListener("getScope", (msg) => { - let principal = secMan.createCodebasePrincipalFromOrigin(msg.principal); + let principal = secMan.createContentPrincipalFromOrigin(msg.principal); try { return { scope: swm.getScopeForUrl(principal, msg.path) }; } catch (e) { diff --git a/dom/storage/StorageActivityService.cpp b/dom/storage/StorageActivityService.cpp index ba0a8ccc5863..edbd404ad9e3 100644 --- a/dom/storage/StorageActivityService.cpp +++ b/dom/storage/StorageActivityService.cpp @@ -27,8 +27,8 @@ void StorageActivityService::SendActivity(nsIPrincipal* aPrincipal) { MOZ_ASSERT(NS_IsMainThread()); if (!aPrincipal || BasePrincipal::Cast(aPrincipal)->Kind() != - BasePrincipal::eCodebasePrincipal) { - // Only codebase principals. + BasePrincipal::eContentPrincipal) { + // Only content principals. return; } @@ -126,7 +126,7 @@ void StorageActivityService::SendActivityInternal(nsIPrincipal* aPrincipal) { MOZ_ASSERT(NS_IsMainThread()); MOZ_ASSERT(aPrincipal); MOZ_ASSERT(BasePrincipal::Cast(aPrincipal)->Kind() == - BasePrincipal::eCodebasePrincipal); + BasePrincipal::eContentPrincipal); if (!XRE_IsParentProcess()) { SendActivityToParent(aPrincipal); @@ -244,7 +244,7 @@ StorageActivityService::GetActiveOrigins(PRTime aFrom, PRTime aTo, for (auto iter = mActivities.Iter(); !iter.Done(); iter.Next()) { if (iter.UserData() >= aFrom && iter.UserData() <= aTo) { RefPtr principal = - BasePrincipal::CreateCodebasePrincipal(iter.Key()); + BasePrincipal::CreateContentPrincipal(iter.Key()); MOZ_ASSERT(principal); rv = devices->AppendElement(principal); diff --git a/dom/tests/browser/browser_ConsoleAPI_originAttributes.js b/dom/tests/browser/browser_ConsoleAPI_originAttributes.js index 62409a1dbdc9..c2bd997cf358 100644 --- a/dom/tests/browser/browser_ConsoleAPI_originAttributes.js +++ b/dom/tests/browser/browser_ConsoleAPI_originAttributes.js @@ -82,7 +82,7 @@ function test() { policy.active = true; let baseURI = Services.io.newURI(url); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( baseURI, {} ); diff --git a/dom/tests/browser/browser_localStorage_e10s.js b/dom/tests/browser/browser_localStorage_e10s.js index 6dce2d8bf4de..4c04bb826e44 100644 --- a/dom/tests/browser/browser_localStorage_e10s.js +++ b/dom/tests/browser/browser_localStorage_e10s.js @@ -72,7 +72,7 @@ function triggerAndWaitForLocalStorageFlush() { * like asking for intermittent failures. */ function clearOriginStorageEnsuringNoPreload() { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( HELPER_PAGE_ORIGIN ); @@ -111,7 +111,7 @@ async function verifyTabPreload(knownTab, expectStorageExists) { knownTab.tab.linkedBrowser, HELPER_PAGE_ORIGIN, function(origin) { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( origin ); if (Services.lsm.nextGenLocalStorageEnabled) { diff --git a/dom/tests/browser/browser_localStorage_snapshotting_e10s.js b/dom/tests/browser/browser_localStorage_snapshotting_e10s.js index 3cd22e7916e1..4468ad1e394d 100644 --- a/dom/tests/browser/browser_localStorage_snapshotting_e10s.js +++ b/dom/tests/browser/browser_localStorage_snapshotting_e10s.js @@ -11,7 +11,7 @@ Services.scriptloader.loadSubScript( ); function clearOrigin() { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( HELPER_PAGE_ORIGIN ); let request = Services.qms.clearStoragesForPrincipal( diff --git a/dom/tests/mochitest/chrome/test_MozDomFullscreen_event.xul b/dom/tests/mochitest/chrome/test_MozDomFullscreen_event.xul index eb36836f76ec..62cf8190ebf0 100644 --- a/dom/tests/mochitest/chrome/test_MozDomFullscreen_event.xul +++ b/dom/tests/mochitest/chrome/test_MozDomFullscreen_event.xul @@ -27,7 +27,7 @@ var pm = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManag var uri = make_uri("http://mochi.test:8888"); var ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"] .getService(Ci.nsIScriptSecurityManager); -var principal = ssm.createCodebasePrincipal(uri, {}); +var principal = ssm.createContentPrincipal(uri, {}); pm.removeFromPrincipal(principal, "fullscreen"); SpecialPowers.pushPrefEnv({"set": [ diff --git a/dom/tests/mochitest/localstorage/localStorageCommon.js b/dom/tests/mochitest/localstorage/localStorageCommon.js index 021761ef0599..03138ff17eff 100644 --- a/dom/tests/mochitest/localstorage/localStorageCommon.js +++ b/dom/tests/mochitest/localstorage/localStorageCommon.js @@ -67,7 +67,7 @@ function localStorageClearAll(callback) { let clearRequestCount = 0; for (let item of request.result) { - let principal = ssm.createCodebasePrincipalFromOrigin(item.origin); + let principal = ssm.createContentPrincipalFromOrigin(item.origin); let clearRequest = qms.clearStoragesForPrincipal( principal, "default", diff --git a/dom/tests/mochitest/localstorage/test_localStorageFromChrome.xhtml b/dom/tests/mochitest/localstorage/test_localStorageFromChrome.xhtml index 7af1cc21b6ea..fe7be443e9df 100644 --- a/dom/tests/mochitest/localstorage/test_localStorageFromChrome.xhtml +++ b/dom/tests/mochitest/localstorage/test_localStorageFromChrome.xhtml @@ -20,7 +20,7 @@ async function startTest() .getService(Components.interfaces.nsIDOMStorageManager); var uri = ios.newURI(url); - var principal = ssm.createCodebasePrincipal(uri, {}); + var principal = ssm.createContentPrincipal(uri, {}); var storage = dsm.createStorage(window, principal, principal, ""); storage.setItem("chromekey", "chromevalue"); diff --git a/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp b/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp index 2aff45267792..39ba33b2a811 100644 --- a/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp +++ b/dom/xslt/xslt/txMozillaStylesheetCompiler.cpp @@ -372,7 +372,7 @@ nsresult txCompileObserver::loadURI(const nsAString& aUri, OriginAttributes attrs; nsCOMPtr referrerPrincipal = - BasePrincipal::CreateCodebasePrincipal(referrerUri, attrs); + BasePrincipal::CreateContentPrincipal(referrerUri, attrs); NS_ENSURE_TRUE(referrerPrincipal, NS_ERROR_FAILURE); return startLoad(uri, aCompiler, referrerPrincipal, aReferrerPolicy); @@ -550,7 +550,7 @@ nsresult txSyncCompileObserver::loadURI(const nsAString& aUri, NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr referrerPrincipal = - BasePrincipal::CreateCodebasePrincipal(referrerUri, OriginAttributes()); + BasePrincipal::CreateContentPrincipal(referrerUri, OriginAttributes()); NS_ENSURE_TRUE(referrerPrincipal, NS_ERROR_FAILURE); // This is probably called by js, a loadGroup for the channel doesn't diff --git a/extensions/permissions/nsPermission.cpp b/extensions/permissions/nsPermission.cpp index f34a76507de7..4843cec4d384 100644 --- a/extensions/permissions/nsPermission.cpp +++ b/extensions/permissions/nsPermission.cpp @@ -41,7 +41,7 @@ already_AddRefed nsPermission::ClonePrincipalForPermission( rv = NS_NewURI(getter_AddRefs(uri), originNoSuffix); NS_ENSURE_SUCCESS(rv, nullptr); - return mozilla::BasePrincipal::CreateCodebasePrincipal(uri, attrs); + return mozilla::BasePrincipal::CreateContentPrincipal(uri, attrs); } already_AddRefed nsPermission::Create( @@ -220,7 +220,7 @@ nsPermission::MatchesURI(nsIURI* aURI, bool aExactHost, bool* aMatches) { mozilla::OriginAttributes attrs; nsCOMPtr principal = - mozilla::BasePrincipal::CreateCodebasePrincipal(aURI, attrs); + mozilla::BasePrincipal::CreateContentPrincipal(aURI, attrs); NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE); return Matches(principal, aExactHost, aMatches); diff --git a/extensions/permissions/nsPermission.h b/extensions/permissions/nsPermission.h index d33aba9bd52a..c27316f93c9c 100644 --- a/extensions/permissions/nsPermission.h +++ b/extensions/permissions/nsPermission.h @@ -23,7 +23,7 @@ class nsPermission : public nsIPermission { uint32_t aExpireType, int64_t aExpireTime, int64_t aModificationTime); // This method creates a new nsIPrincipal with a stripped OriginAttributes (no - // userContextId) and a codebase equal to the origin of 'aPrincipal'. + // userContextId) and a content principal equal to the origin of 'aPrincipal'. static already_AddRefed ClonePrincipalForPermission( nsIPrincipal* aPrincipal); diff --git a/extensions/permissions/nsPermissionManager.cpp b/extensions/permissions/nsPermissionManager.cpp index 1a652bef4222..555f0c6cc28f 100644 --- a/extensions/permissions/nsPermissionManager.cpp +++ b/extensions/permissions/nsPermissionManager.cpp @@ -192,7 +192,7 @@ nsresult GetPrincipalFromOrigin(const nsACString& aOrigin, NS_ENSURE_SUCCESS(rv, rv); nsCOMPtr principal = - mozilla::BasePrincipal::CreateCodebasePrincipal(uri, attrs); + mozilla::BasePrincipal::CreateContentPrincipal(uri, attrs); principal.forget(aPrincipal); return NS_OK; } @@ -201,7 +201,7 @@ nsresult GetPrincipal(nsIURI* aURI, bool aIsInIsolatedMozBrowserElement, nsIPrincipal** aPrincipal) { mozilla::OriginAttributes attrs(aIsInIsolatedMozBrowserElement); nsCOMPtr principal = - mozilla::BasePrincipal::CreateCodebasePrincipal(aURI, attrs); + mozilla::BasePrincipal::CreateContentPrincipal(aURI, attrs); NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE); principal.forget(aPrincipal); @@ -211,7 +211,7 @@ nsresult GetPrincipal(nsIURI* aURI, bool aIsInIsolatedMozBrowserElement, nsresult GetPrincipal(nsIURI* aURI, nsIPrincipal** aPrincipal) { mozilla::OriginAttributes attrs; nsCOMPtr principal = - mozilla::BasePrincipal::CreateCodebasePrincipal(aURI, attrs); + mozilla::BasePrincipal::CreateContentPrincipal(aURI, attrs); NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE); principal.forget(aPrincipal); @@ -280,7 +280,7 @@ already_AddRefed GetNextSubDomainPrincipal( attrs.StripAttributes(mozilla::OriginAttributes::STRIP_USER_CONTEXT_ID); nsCOMPtr principal = - mozilla::BasePrincipal::CreateCodebasePrincipal(newURI, attrs); + mozilla::BasePrincipal::CreateContentPrincipal(newURI, attrs); return principal.forget(); } @@ -2379,10 +2379,10 @@ nsresult nsPermissionManager::CommonTestPermissionInternal( nsCOMPtr prin = aPrincipal; if (!prin) { if (aURI) { - prin = mozilla::BasePrincipal::CreateCodebasePrincipal( + prin = mozilla::BasePrincipal::CreateContentPrincipal( aURI, OriginAttributes()); } else if (!aOriginNoSuffix.IsEmpty()) { - prin = mozilla::BasePrincipal::CreateCodebasePrincipal(aOriginNoSuffix); + prin = mozilla::BasePrincipal::CreateContentPrincipal(aOriginNoSuffix); } } MOZ_ASSERT(prin); @@ -2481,7 +2481,7 @@ nsPermissionManager::GetPermissionHashKey(nsIURI* aURI, rv = GetPrincipal(aURI, getter_AddRefs(principal)); } else { principal = - mozilla::BasePrincipal::CreateCodebasePrincipal(aOriginNoSuffix); + mozilla::BasePrincipal::CreateContentPrincipal(aOriginNoSuffix); } MOZ_ASSERT_IF(NS_SUCCEEDED(rv), PermissionAvailable(principal, mTypeArray[aType])); @@ -2518,7 +2518,7 @@ nsPermissionManager::GetPermissionHashKey(nsIURI* aURI, } } else { principal = - mozilla::BasePrincipal::CreateCodebasePrincipal(aOriginNoSuffix); + mozilla::BasePrincipal::CreateContentPrincipal(aOriginNoSuffix); } RemoveFromPrincipal(principal, mTypeArray[aType]); } else if (permEntry.mPermission == nsIPermissionManager::UNKNOWN_ACTION) { diff --git a/extensions/permissions/test/gtest/PermissionManagerTest.cpp b/extensions/permissions/test/gtest/PermissionManagerTest.cpp index 33ff08bd64b7..a98ec9ae92f9 100644 --- a/extensions/permissions/test/gtest/PermissionManagerTest.cpp +++ b/extensions/permissions/test/gtest/PermissionManagerTest.cpp @@ -26,8 +26,8 @@ class PermissionManager : public ::testing::Test { getter_AddRefs(uri), NS_LITERAL_CSTRING("https://test.origin.with.subdomains.example.com")); MOZ_RELEASE_ASSERT(NS_SUCCEEDED(rv)); - mPrincipal = mozilla::BasePrincipal::CreateCodebasePrincipal( - uri, OriginAttributes()); + mPrincipal = + mozilla::BasePrincipal::CreateContentPrincipal(uri, OriginAttributes()); } void TearDown() override { diff --git a/extensions/permissions/test/unit/test_permmanager_cleardata.js b/extensions/permissions/test/unit/test_permmanager_cleardata.js index 0dc002a8b0eb..3290db1b0b8b 100644 --- a/extensions/permissions/test/unit/test_permmanager_cleardata.js +++ b/extensions/permissions/test/unit/test_permmanager_cleardata.js @@ -5,7 +5,7 @@ var pm; // Create a principal based on the { origin, originAttributes }. function createPrincipal(aOrigin, aOriginAttributes) { - return Services.scriptSecurityManager.createCodebasePrincipal( + return Services.scriptSecurityManager.createContentPrincipal( NetUtil.newURI(aOrigin), aOriginAttributes ); diff --git a/extensions/permissions/test/unit/test_permmanager_defaults.js b/extensions/permissions/test/unit/test_permmanager_defaults.js index c586982a133c..8f5453925db5 100644 --- a/extensions/permissions/test/unit/test_permmanager_defaults.js +++ b/extensions/permissions/test/unit/test_permmanager_defaults.js @@ -62,45 +62,45 @@ add_task(async function do_test() { ); // test the default permission was applied. - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( TEST_ORIGIN, {} ); - let principalHttps = Services.scriptSecurityManager.createCodebasePrincipal( + let principalHttps = Services.scriptSecurityManager.createContentPrincipal( TEST_ORIGIN_HTTPS, {} ); - let principal2 = Services.scriptSecurityManager.createCodebasePrincipal( + let principal2 = Services.scriptSecurityManager.createContentPrincipal( TEST_ORIGIN_2, {} ); - let principal3 = Services.scriptSecurityManager.createCodebasePrincipal( + let principal3 = Services.scriptSecurityManager.createContentPrincipal( TEST_ORIGIN_3, {} ); let attrs = { inIsolatedMozBrowser: true }; - let principal4 = Services.scriptSecurityManager.createCodebasePrincipal( + let principal4 = Services.scriptSecurityManager.createContentPrincipal( TEST_ORIGIN, attrs ); - let principal5 = Services.scriptSecurityManager.createCodebasePrincipal( + let principal5 = Services.scriptSecurityManager.createContentPrincipal( TEST_ORIGIN_3, attrs ); attrs = { userContextId: 1 }; - let principal6 = Services.scriptSecurityManager.createCodebasePrincipal( + let principal6 = Services.scriptSecurityManager.createContentPrincipal( TEST_ORIGIN, attrs ); attrs = { firstPartyDomain: "cnn.com" }; - let principal7 = Services.scriptSecurityManager.createCodebasePrincipal( + let principal7 = Services.scriptSecurityManager.createContentPrincipal( TEST_ORIGIN, attrs ); attrs = { userContextId: 1, firstPartyDomain: "cnn.com" }; - let principal8 = Services.scriptSecurityManager.createCodebasePrincipal( + let principal8 = Services.scriptSecurityManager.createContentPrincipal( TEST_ORIGIN, attrs ); @@ -393,7 +393,7 @@ function checkCapabilityViaDB( // value (ie, the "capability" in nsIPermission parlance) or null if it can't // be found. function findCapabilityViaDB(origin = TEST_ORIGIN, type = TEST_PERMISSION) { - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( origin, {} ); diff --git a/extensions/permissions/test/unit/test_permmanager_expiration.js b/extensions/permissions/test/unit/test_permmanager_expiration.js index d5801f0a959b..c7acdb986ba4 100644 --- a/extensions/permissions/test/unit/test_permmanager_expiration.js +++ b/extensions/permissions/test/unit/test_permmanager_expiration.js @@ -20,7 +20,7 @@ function* do_run_test() { let pm = Services.perms; let permURI = NetUtil.newURI("http://example.com"); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( permURI, {} ); diff --git a/extensions/permissions/test/unit/test_permmanager_getPermissionObject.js b/extensions/permissions/test/unit/test_permmanager_getPermissionObject.js index b3ea8cf1bf83..df36d57ea1a2 100644 --- a/extensions/permissions/test/unit/test_permmanager_getPermissionObject.js +++ b/extensions/permissions/test/unit/test_permmanager_getPermissionObject.js @@ -6,7 +6,7 @@ function getPrincipalFromURI(aURI) { Ci.nsIScriptSecurityManager ); let uri = NetUtil.newURI(aURI); - return ssm.createCodebasePrincipal(uri, {}); + return ssm.createContentPrincipal(uri, {}); } function getSystemPrincipal() { diff --git a/extensions/permissions/test/unit/test_permmanager_idn.js b/extensions/permissions/test/unit/test_permmanager_idn.js index ae4a7b3411cf..335231c36f60 100644 --- a/extensions/permissions/test/unit/test_permmanager_idn.js +++ b/extensions/permissions/test/unit/test_permmanager_idn.js @@ -6,7 +6,7 @@ function getPrincipalFromDomain(aDomain) { Ci.nsIScriptSecurityManager ); let uri = NetUtil.newURI("http://" + aDomain); - return ssm.createCodebasePrincipal(uri, {}); + return ssm.createContentPrincipal(uri, {}); } function run_test() { diff --git a/extensions/permissions/test/unit/test_permmanager_load_invalid_entries.js b/extensions/permissions/test/unit/test_permmanager_load_invalid_entries.js index 07de107693e1..3fb34c0524f2 100644 --- a/extensions/permissions/test/unit/test_permmanager_load_invalid_entries.js +++ b/extensions/permissions/test/unit/test_permmanager_load_invalid_entries.js @@ -251,7 +251,7 @@ function run_test() { Ci.nsIScriptSecurityManager ); let uri = NetUtil.newURI("http://example.org"); - let principal = ssm.createCodebasePrincipal(uri, {}); + let principal = ssm.createContentPrincipal(uri, {}); Assert.equal( pm.testPermissionFromPrincipal(principal, "test-load-invalid-entries"), Ci.nsIPermissionManager.ALLOW_ACTION diff --git a/extensions/permissions/test/unit/test_permmanager_local_files.js b/extensions/permissions/test/unit/test_permmanager_local_files.js index 58e276b097ba..389eb7791695 100644 --- a/extensions/permissions/test/unit/test_permmanager_local_files.js +++ b/extensions/permissions/test/unit/test_permmanager_local_files.js @@ -5,7 +5,7 @@ function getPrincipalFromURIString(uriStr) { let uri = NetUtil.newURI(uriStr); - return Services.scriptSecurityManager.createCodebasePrincipal(uri, {}); + return Services.scriptSecurityManager.createContentPrincipal(uri, {}); } function run_test() { diff --git a/extensions/permissions/test/unit/test_permmanager_matches.js b/extensions/permissions/test/unit/test_permmanager_matches.js index 32831d98d0d5..f04fc9b0adae 100644 --- a/extensions/permissions/test/unit/test_permmanager_matches.js +++ b/extensions/permissions/test/unit/test_permmanager_matches.js @@ -58,36 +58,36 @@ function run_test() { let uri4 = NetUtil.newURI("https://hangouts.google.com/#!/hangout"); let uri5 = NetUtil.newURI("http://google.com:8096/"); - let uri0_n = secMan.createCodebasePrincipal(uri0, {}); - let uri1_n = secMan.createCodebasePrincipal(uri1, {}); - let uri2_n = secMan.createCodebasePrincipal(uri2, {}); - let uri3_n = secMan.createCodebasePrincipal(uri3, {}); - let uri4_n = secMan.createCodebasePrincipal(uri4, {}); - let uri5_n = secMan.createCodebasePrincipal(uri5, {}); + let uri0_n = secMan.createContentPrincipal(uri0, {}); + let uri1_n = secMan.createContentPrincipal(uri1, {}); + let uri2_n = secMan.createContentPrincipal(uri2, {}); + let uri3_n = secMan.createContentPrincipal(uri3, {}); + let uri4_n = secMan.createContentPrincipal(uri4, {}); + let uri5_n = secMan.createContentPrincipal(uri5, {}); attrs = { inIsolatedMozBrowser: true }; - let uri0_y_ = secMan.createCodebasePrincipal(uri0, attrs); - let uri1_y_ = secMan.createCodebasePrincipal(uri1, attrs); - let uri2_y_ = secMan.createCodebasePrincipal(uri2, attrs); - let uri3_y_ = secMan.createCodebasePrincipal(uri3, attrs); - let uri4_y_ = secMan.createCodebasePrincipal(uri4, attrs); - let uri5_y_ = secMan.createCodebasePrincipal(uri5, attrs); + let uri0_y_ = secMan.createContentPrincipal(uri0, attrs); + let uri1_y_ = secMan.createContentPrincipal(uri1, attrs); + let uri2_y_ = secMan.createContentPrincipal(uri2, attrs); + let uri3_y_ = secMan.createContentPrincipal(uri3, attrs); + let uri4_y_ = secMan.createContentPrincipal(uri4, attrs); + let uri5_y_ = secMan.createContentPrincipal(uri5, attrs); attrs = { userContextId: 1 }; - let uri0_1 = secMan.createCodebasePrincipal(uri0, attrs); - let uri1_1 = secMan.createCodebasePrincipal(uri1, attrs); - let uri2_1 = secMan.createCodebasePrincipal(uri2, attrs); - let uri3_1 = secMan.createCodebasePrincipal(uri3, attrs); - let uri4_1 = secMan.createCodebasePrincipal(uri4, attrs); - let uri5_1 = secMan.createCodebasePrincipal(uri5, attrs); + let uri0_1 = secMan.createContentPrincipal(uri0, attrs); + let uri1_1 = secMan.createContentPrincipal(uri1, attrs); + let uri2_1 = secMan.createContentPrincipal(uri2, attrs); + let uri3_1 = secMan.createContentPrincipal(uri3, attrs); + let uri4_1 = secMan.createContentPrincipal(uri4, attrs); + let uri5_1 = secMan.createContentPrincipal(uri5, attrs); attrs = { firstPartyDomain: "cnn.com" }; - let uri0_cnn = secMan.createCodebasePrincipal(uri0, attrs); - let uri1_cnn = secMan.createCodebasePrincipal(uri1, attrs); - let uri2_cnn = secMan.createCodebasePrincipal(uri2, attrs); - let uri3_cnn = secMan.createCodebasePrincipal(uri3, attrs); - let uri4_cnn = secMan.createCodebasePrincipal(uri4, attrs); - let uri5_cnn = secMan.createCodebasePrincipal(uri5, attrs); + let uri0_cnn = secMan.createContentPrincipal(uri0, attrs); + let uri1_cnn = secMan.createContentPrincipal(uri1, attrs); + let uri2_cnn = secMan.createContentPrincipal(uri2, attrs); + let uri3_cnn = secMan.createContentPrincipal(uri3, attrs); + let uri4_cnn = secMan.createContentPrincipal(uri4, attrs); + let uri5_cnn = secMan.createContentPrincipal(uri5, attrs); pm.addFromPrincipal(uri0_n, "test/matches", pm.ALLOW_ACTION); let perm_n = pm.getPermissionObject(uri0_n, "test/matches", true); diff --git a/extensions/permissions/test/unit/test_permmanager_matchesuri.js b/extensions/permissions/test/unit/test_permmanager_matchesuri.js index 335c50b2c9db..a94d5561c710 100644 --- a/extensions/permissions/test/unit/test_permmanager_matchesuri.js +++ b/extensions/permissions/test/unit/test_permmanager_matchesuri.js @@ -50,7 +50,7 @@ function mk_permission(uri) { ); // Get the permission from the principal! - let principal = secMan.createCodebasePrincipal(uri, {}); + let principal = secMan.createContentPrincipal(uri, {}); pm.addFromPrincipal(principal, "test/matchesuri", pm.ALLOW_ACTION); let permission = pm.getPermissionObject(principal, "test/matchesuri", true); diff --git a/extensions/permissions/test/unit/test_permmanager_notifications.js b/extensions/permissions/test/unit/test_permmanager_notifications.js index 801a7e2aca00..2255765533d3 100644 --- a/extensions/permissions/test/unit/test_permmanager_notifications.js +++ b/extensions/permissions/test/unit/test_permmanager_notifications.js @@ -27,7 +27,7 @@ function* do_run_test() { Ci.nsIScriptSecurityManager ); let uri = NetUtil.newURI("http://example.com"); - let principal = ssm.createCodebasePrincipal(uri, {}); + let principal = ssm.createContentPrincipal(uri, {}); let observer = new permission_observer(test_generator, now, permType); Services.obs.addObserver(observer, "perm-changed"); diff --git a/extensions/permissions/test/unit/test_permmanager_removesince.js b/extensions/permissions/test/unit/test_permmanager_removesince.js index 331bda8f7afd..33ca7c019abe 100644 --- a/extensions/permissions/test/unit/test_permmanager_removesince.js +++ b/extensions/permissions/test/unit/test_permmanager_removesince.js @@ -23,13 +23,13 @@ function* do_run_test() { // to help with testing edge-cases, we will arrange for .removeAllSince to // remove *all* permissions from one principal and one permission from another. let permURI1 = NetUtil.newURI("http://example.com"); - let principal1 = Services.scriptSecurityManager.createCodebasePrincipal( + let principal1 = Services.scriptSecurityManager.createContentPrincipal( permURI1, {} ); let permURI2 = NetUtil.newURI("http://example.org"); - let principal2 = Services.scriptSecurityManager.createCodebasePrincipal( + let principal2 = Services.scriptSecurityManager.createContentPrincipal( permURI2, {} ); diff --git a/extensions/permissions/test/unit/test_permmanager_subdomains.js b/extensions/permissions/test/unit/test_permmanager_subdomains.js index e896adfe8ec7..d533d73fda86 100644 --- a/extensions/permissions/test/unit/test_permmanager_subdomains.js +++ b/extensions/permissions/test/unit/test_permmanager_subdomains.js @@ -6,7 +6,7 @@ function getPrincipalFromURI(aURI) { Ci.nsIScriptSecurityManager ); let uri = NetUtil.newURI(aURI); - return ssm.createCodebasePrincipal(uri, {}); + return ssm.createContentPrincipal(uri, {}); } function run_test() { diff --git a/image/test/unit/test_private_channel.js b/image/test/unit/test_private_channel.js index a88ca02be365..2eadcfc7a096 100644 --- a/image/test/unit/test_private_channel.js +++ b/image/test/unit/test_private_channel.js @@ -42,7 +42,7 @@ var gImgPath = "http://localhost:" + server.identity.primaryPort + "/image.png"; function setup_chan(path, isPrivate, callback) { var uri = NetUtil.newURI(gImgPath); var securityFlags = Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL; - var principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, { + var principal = Services.scriptSecurityManager.createContentPrincipal(uri, { privateBrowsingId: isPrivate ? 1 : 0, }); var chan = NetUtil.newChannel({ diff --git a/ipc/glue/BackgroundUtils.cpp b/ipc/glue/BackgroundUtils.cpp index 1620984050ef..25fb178e13cd 100644 --- a/ipc/glue/BackgroundUtils.cpp +++ b/ipc/glue/BackgroundUtils.cpp @@ -85,7 +85,7 @@ already_AddRefed PrincipalInfoToPrincipal( return nullptr; } - principal = BasePrincipal::CreateCodebasePrincipal(uri, info.attrs()); + principal = BasePrincipal::CreateContentPrincipal(uri, info.attrs()); if (NS_WARN_IF(!principal)) { return nullptr; } diff --git a/js/xpconnect/loader/mozJSSubScriptLoader.cpp b/js/xpconnect/loader/mozJSSubScriptLoader.cpp index e5be1f4d1be5..48cd78941c38 100644 --- a/js/xpconnect/loader/mozJSSubScriptLoader.cpp +++ b/js/xpconnect/loader/mozJSSubScriptLoader.cpp @@ -424,13 +424,13 @@ nsresult mozJSSubScriptLoader::DoLoadSubScriptWithOptions( auto* content = principal->As(); nsAutoCString scheme; - content->mCodebase->GetScheme(scheme); + content->mURI->GetScheme(scheme); // We want to enable caching for scripts with Activity Stream's // codebase URLs. if (scheme.EqualsLiteral("about")) { nsAutoCString filePath; - content->mCodebase->GetFilePath(filePath); + content->mURI->GetFilePath(filePath); useCompilationScope = filePath.EqualsLiteral("home") || filePath.EqualsLiteral("newtab") || diff --git a/js/xpconnect/src/Sandbox.cpp b/js/xpconnect/src/Sandbox.cpp index 7d2fae622935..2e55b57d5b24 100644 --- a/js/xpconnect/src/Sandbox.cpp +++ b/js/xpconnect/src/Sandbox.cpp @@ -1237,16 +1237,16 @@ nsXPCComponents_utils_Sandbox::Construct(nsIXPConnectWrappedNative* wrapper, /* * For sandbox constructor the first argument can be a URI string in which case - * we use the related Codebase Principal for the sandbox. + * we use the related Content Principal for the sandbox. */ -bool ParsePrincipal(JSContext* cx, HandleString codebase, +bool ParsePrincipal(JSContext* cx, HandleString contentUrl, const OriginAttributes& aAttrs, nsIPrincipal** principal) { MOZ_ASSERT(principal); - MOZ_ASSERT(codebase); + MOZ_ASSERT(contentUrl); nsCOMPtr uri; - nsAutoJSString codebaseStr; - NS_ENSURE_TRUE(codebaseStr.init(cx, codebase), false); - nsresult rv = NS_NewURI(getter_AddRefs(uri), codebaseStr); + nsAutoJSString contentStr; + NS_ENSURE_TRUE(contentStr.init(cx, contentUrl), false); + nsresult rv = NS_NewURI(getter_AddRefs(uri), contentStr); if (NS_FAILED(rv)) { JS_ReportErrorASCII(cx, "Creating URI from string failed"); return false; @@ -1256,7 +1256,7 @@ bool ParsePrincipal(JSContext* cx, HandleString codebase, // sandbox constructor. But creating a sandbox based on a string is a // deprecated API so no need to add features to it. nsCOMPtr prin = - BasePrincipal::CreateCodebasePrincipal(uri, aAttrs); + BasePrincipal::CreateContentPrincipal(uri, aAttrs); prin.forget(principal); if (!*principal) { @@ -1339,7 +1339,7 @@ static bool GetExpandedPrincipal(JSContext* cx, HandleObject arrayObj, // check to make sure that it is the same as the OA found before. // In the second pass, we ignore objects, and use the OA found in pass 0 // (or the previously computed OA if we have obtained it from the options) - // to construct codebase principals. + // to construct content principals. // // The effective OA selected above will also be set as the OA of the // expanded principal object. @@ -1413,7 +1413,7 @@ static bool GetExpandedPrincipal(JSContext* cx, HandleObject arrayObj, nsCOMPtr principal; if (allowed.isString()) { - // In case of string let's try to fetch a codebase principal from it. + // In case of string let's try to fetch a content principal from it. RootedString str(cx, allowed.toString()); // attrs here is either a default OriginAttributes in case the diff --git a/js/xpconnect/src/XPCJSRuntime.cpp b/js/xpconnect/src/XPCJSRuntime.cpp index dc2df3e29b2c..cac9e988716a 100644 --- a/js/xpconnect/src/XPCJSRuntime.cpp +++ b/js/xpconnect/src/XPCJSRuntime.cpp @@ -468,7 +468,7 @@ Scriptability::Scriptability(JS::Realm* realm) nsIPrincipal* prin = nsJSPrincipals::get(JS::GetRealmPrincipals(realm)); mImmuneToScriptPolicy = PrincipalImmuneToScriptPolicy(prin); - // If we're not immune, we should have a real principal with a codebase URI. + // If we're not immune, we should have a real principal with a URI. // Check the URI against the new-style domain policy. if (!mImmuneToScriptPolicy) { nsCOMPtr codebase; diff --git a/js/xpconnect/tests/unit/test_allowedDomainsXHR.js b/js/xpconnect/tests/unit/test_allowedDomainsXHR.js index 645998b565d5..aec5b999bf2d 100644 --- a/js/xpconnect/tests/unit/test_allowedDomainsXHR.js +++ b/js/xpconnect/tests/unit/test_allowedDomainsXHR.js @@ -61,7 +61,7 @@ function run_test() Assert.ok(checkResults(res)); var principal = res.responseXML.nodePrincipal; - Assert.ok(principal.isCodebasePrincipal); + Assert.ok(principal.isContentPrincipal); var requestURL = "http://localhost:4444/simple"; Assert.equal(principal.URI.spec, requestURL); @@ -83,7 +83,7 @@ function run_test() Assert.ok(checkResults(res)); var principal = res.responseXML.nodePrincipal; - Assert.ok(principal.isCodebasePrincipal); + Assert.ok(principal.isContentPrincipal); var requestURL = "http://localhost:4444/simple"; Assert.equal(principal.URI.spec, requestURL); diff --git a/js/xpconnect/tests/unit/test_nuke_sandbox_event_listeners.js b/js/xpconnect/tests/unit/test_nuke_sandbox_event_listeners.js index 83b43ecd2b4e..159b583cc71a 100644 --- a/js/xpconnect/tests/unit/test_nuke_sandbox_event_listeners.js +++ b/js/xpconnect/tests/unit/test_nuke_sandbox_event_listeners.js @@ -14,7 +14,7 @@ function promiseEvent(target, event) { add_task(async function() { let principal = Services.scriptSecurityManager - .createCodebasePrincipalFromOrigin("http://example.com/"); + .createContentPrincipalFromOrigin("http://example.com/"); let webnav = Services.appShell.createWindowlessBrowser(false); diff --git a/js/xpconnect/tests/unit/test_nuke_webextension_wrappers.js b/js/xpconnect/tests/unit/test_nuke_webextension_wrappers.js index 00d01320c76d..5664561778da 100644 --- a/js/xpconnect/tests/unit/test_nuke_webextension_wrappers.js +++ b/js/xpconnect/tests/unit/test_nuke_webextension_wrappers.js @@ -10,7 +10,7 @@ function getWindowlessBrowser(url) { let uri = NetUtil.newURI(url); - let principal = ssm.createCodebasePrincipal(uri, {}); + let principal = ssm.createContentPrincipal(uri, {}); let webnav = Services.appShell.createWindowlessBrowser(false); diff --git a/layout/build/nsContentDLF.h b/layout/build/nsContentDLF.h index 07fe12f0c018..533cfcfbd8e6 100644 --- a/layout/build/nsContentDLF.h +++ b/layout/build/nsContentDLF.h @@ -48,7 +48,7 @@ class nsContentDLF final : public nsIDocumentLoaderFactory { /** * Create a blank document using the given loadgroup and given * principal. aPrincipal is allowed to be null, in which case the - * new document will get the about:blank codebase principal. + * new document will get the about:blank content principal. */ static already_AddRefed CreateBlankDocument( nsILoadGroup* aLoadGroup, nsIPrincipal* aPrincipal, diff --git a/layout/svg/SVGContextPaint.cpp b/layout/svg/SVGContextPaint.cpp index 9327fc2f5911..546f83eeb1c5 100644 --- a/layout/svg/SVGContextPaint.cpp +++ b/layout/svg/SVGContextPaint.cpp @@ -69,7 +69,7 @@ bool SVGContextPaint::IsAllowedForImageFromURI(nsIURI* aURI) { return true; } RefPtr principal = - BasePrincipal::CreateCodebasePrincipal(aURI, OriginAttributes()); + BasePrincipal::CreateContentPrincipal(aURI, OriginAttributes()); nsString addonId; if (NS_SUCCEEDED(principal->GetAddonId(addonId))) { if (StringEndsWith(addonId, NS_LITERAL_STRING("@mozilla.org")) || diff --git a/layout/tools/reftest/manifest.jsm b/layout/tools/reftest/manifest.jsm index 1b48bee0f140..38b7f6110129 100644 --- a/layout/tools/reftest/manifest.jsm +++ b/layout/tools/reftest/manifest.jsm @@ -266,7 +266,7 @@ function ReadManifest(aURL, aFilter) } } - var principal = secMan.createCodebasePrincipal(aURL, {}); + var principal = secMan.createContentPrincipal(aURL, {}); if (items[0] == "include") { if (items.length != 2) @@ -667,7 +667,7 @@ function CreateUrls(test) { var testURI = g.ioService.newURI(file, null, testbase); let isChrome = testURI.scheme == "chrome"; let principal = isChrome ? secMan.getSystemPrincipal() : - secMan.createCodebasePrincipal(manifestURL, {}); + secMan.createContentPrincipal(manifestURL, {}); secMan.checkLoadURIWithPrincipal(principal, testURI, Ci.nsIScriptSecurityManager.DISALLOW_SCRIPT); return testURI; diff --git a/mobile/android/components/AboutRedirector.js b/mobile/android/components/AboutRedirector.js index 49e94c6f86d9..1c69427dca1d 100644 --- a/mobile/android/components/AboutRedirector.js +++ b/mobile/android/components/AboutRedirector.js @@ -106,7 +106,7 @@ AboutRedirector.prototype = { if (!moduleInfo.privileged) { // Setting the owner to null means that we'll go through the normal - // path in GetChannelPrincipal and create a codebase principal based + // path in GetChannelPrincipal and create a content principal based // on the channel's originalURI channel.owner = null; } diff --git a/mobile/android/components/geckoview/GeckoViewPermission.js b/mobile/android/components/geckoview/GeckoViewPermission.js index 39ad2105a42a..ec0e93029d9a 100644 --- a/mobile/android/components/geckoview/GeckoViewPermission.js +++ b/mobile/android/components/geckoview/GeckoViewPermission.js @@ -53,7 +53,7 @@ GeckoViewPermission.prototype = { receiveMessage(aMsg) { switch (aMsg.name) { case "GeckoView:AddCameraPermission": { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( aMsg.data.origin ); diff --git a/mobile/android/extensions/webcompat/AboutCompat.jsm b/mobile/android/extensions/webcompat/AboutCompat.jsm index a8b6726ac89a..3e13381be63b 100644 --- a/mobile/android/extensions/webcompat/AboutCompat.jsm +++ b/mobile/android/extensions/webcompat/AboutCompat.jsm @@ -27,7 +27,7 @@ AboutCompat.prototype = { const channel = Services.io.newChannelFromURIWithLoadInfo(uri, aLoadInfo); channel.originalURI = aURI; - channel.owner = Services.scriptSecurityManager.createCodebasePrincipal( + channel.owner = Services.scriptSecurityManager.createContentPrincipal( uri, aLoadInfo.originAttributes ); diff --git a/mobile/android/modules/Sanitizer.jsm b/mobile/android/modules/Sanitizer.jsm index f244e4a2008b..9624c90eeecc 100644 --- a/mobile/android/modules/Sanitizer.jsm +++ b/mobile/android/modules/Sanitizer.jsm @@ -228,7 +228,7 @@ Sanitizer.prototype = { } for (let item of request.result) { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( item.origin ); let uri = principal.URI; diff --git a/mobile/android/modules/geckoview/GeckoViewNavigation.jsm b/mobile/android/modules/geckoview/GeckoViewNavigation.jsm index f7046df40136..b2ac591e318d 100644 --- a/mobile/android/modules/geckoview/GeckoViewNavigation.jsm +++ b/mobile/android/modules/geckoview/GeckoViewNavigation.jsm @@ -126,7 +126,7 @@ class GeckoViewNavigation extends GeckoViewModule { parsedUri.schemeIs("moz-extension") ) { // Only allow privileged loading for certain URIs. - triggeringPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + triggeringPrincipal = Services.scriptSecurityManager.createContentPrincipal( parsedUri, {} ); diff --git a/netwerk/base/Predictor.cpp b/netwerk/base/Predictor.cpp index 5c7a7b2b4634..80fcade33194 100644 --- a/netwerk/base/Predictor.cpp +++ b/netwerk/base/Predictor.cpp @@ -849,7 +849,7 @@ void Predictor::PredictForLink(nsIURI* targetURI, nsIURI* sourceURI, } nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(targetURI, originAttributes); + BasePrincipal::CreateContentPrincipal(targetURI, originAttributes); mSpeculativeService->SpeculativeConnect(targetURI, principal, nullptr); if (verifier) { @@ -1336,7 +1336,7 @@ bool Predictor::RunPredictions(nsIURI* referrer, ++totalPredictions; ++totalPreconnects; nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(uri, originAttributes); + BasePrincipal::CreateContentPrincipal(uri, originAttributes); mSpeculativeService->SpeculativeConnect(uri, principal, this); predicted = true; if (verifier) { diff --git a/netwerk/base/nsILoadInfo.idl b/netwerk/base/nsILoadInfo.idl index e665795010de..55791cff991a 100644 --- a/netwerk/base/nsILoadInfo.idl +++ b/netwerk/base/nsILoadInfo.idl @@ -257,7 +257,7 @@ interface nsILoadInfo : nsISupports * this, never set the loadingPrincipal to the system principal when * the URI to be loaded is controlled by a webpage. * If the loadingPrincipal and triggeringPrincipal are both - * codebase-principals, then we will always call into + * content principals, then we will always call into * nsIContentPolicies and CheckLoadURI. The call to nsIContentPolicies * and CheckLoadURI happen even if the URI to be loaded is same-origin * with the loadingPrincipal or triggeringPrincipal. @@ -298,7 +298,7 @@ interface nsILoadInfo : nsISupports * this, never set the triggeringPrincipal to the system principal when * the URI to be loaded is controlled by a webpage. * If the loadingPrincipal and triggeringPrincipal are both - * codebase-principals, then we will always call into + * content principals, then we will always call into * nsIContentPolicies and CheckLoadURI. The call to nsIContentPolicies * and CheckLoadURI happen even if the URI to be loaded is same-origin * with the loadingPrincipal or triggeringPrincipal. diff --git a/netwerk/cookie/nsCookieService.cpp b/netwerk/cookie/nsCookieService.cpp index 5118418e3137..06d88bb58478 100644 --- a/netwerk/cookie/nsCookieService.cpp +++ b/netwerk/cookie/nsCookieService.cpp @@ -4004,12 +4004,12 @@ CookieStatus nsCookieService::CheckPrefs( } nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(aHostURI, aOriginAttrs); + BasePrincipal::CreateContentPrincipal(aHostURI, aOriginAttrs); if (!principal) { COOKIE_LOGFAILURE(aCookieHeader.IsVoid() ? GET_COOKIE : SET_COOKIE, aHostURI, aCookieHeader, - "non-codebase principals cannot get/set cookies"); + "non-content principals cannot get/set cookies"); return STATUS_REJECTED_WITH_ERROR; } diff --git a/netwerk/cookie/test/unit/test_rawSameSite.js b/netwerk/cookie/test/unit/test_rawSameSite.js index 8aaac3a2aaf1..bbde4899ed49 100644 --- a/netwerk/cookie/test/unit/test_rawSameSite.js +++ b/netwerk/cookie/test/unit/test_rawSameSite.js @@ -59,7 +59,7 @@ add_task(async _ => { let uri = NetUtil.newURI("http://example.org/"); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/netwerk/protocol/http/HttpChannelParent.cpp b/netwerk/protocol/http/HttpChannelParent.cpp index ca9cf1fc6c4f..fdbab0e4d639 100644 --- a/netwerk/protocol/http/HttpChannelParent.cpp +++ b/netwerk/protocol/http/HttpChannelParent.cpp @@ -627,7 +627,7 @@ bool HttpChannelParent::DoAsyncOpen( NS_GetOriginAttributes(httpChannel, attrs); nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(uri, attrs); + BasePrincipal::CreateContentPrincipal(uri, attrs); bool chooseAppCache = false; // This works because we've already called SetNotificationCallbacks and diff --git a/netwerk/protocol/res/SubstitutingProtocolHandler.h b/netwerk/protocol/res/SubstitutingProtocolHandler.h index 62b9ce60210c..d97029ac51a9 100644 --- a/netwerk/protocol/res/SubstitutingProtocolHandler.h +++ b/netwerk/protocol/res/SubstitutingProtocolHandler.h @@ -122,7 +122,7 @@ class SubstitutingProtocolHandler { nsresult ResolveJARURI(nsIURL* aURL, nsIURI** aResult); // In general, we expect the principal of a document loaded from a - // substituting URI to be a codebase principal for that URI (rather than + // substituting URI to be a content principal for that URI (rather than // a principal for whatever is underneath). However, this only works if // the protocol handler for the underlying URI doesn't set an explicit // owner (which chrome:// does, for example). So we want to require that diff --git a/netwerk/test/TestCookie.cpp b/netwerk/test/TestCookie.cpp index 2373d7e19ee3..feb8950119e9 100644 --- a/netwerk/test/TestCookie.cpp +++ b/netwerk/test/TestCookie.cpp @@ -94,8 +94,8 @@ void SetASameSiteCookie(nsICookieService* aCookieService, const char* aSpec1, ASSERT_TRUE(NS_SUCCEEDED(rv0)); nsCOMPtr spec1Principal; nsCString tmpString(aSpec1); - ssm->CreateCodebasePrincipalFromOrigin(tmpString, - getter_AddRefs(spec1Principal)); + ssm->CreateContentPrincipalFromOrigin(tmpString, + getter_AddRefs(spec1Principal)); nsCOMPtr dummyChannel; NS_NewChannel(getter_AddRefs(dummyChannel), uri1, spec1Principal, diff --git a/netwerk/test/gtest/TestMozURL.cpp b/netwerk/test/gtest/TestMozURL.cpp index 53cb0b8fe9b1..b0ab8102f044 100644 --- a/netwerk/test/gtest/TestMozURL.cpp +++ b/netwerk/test/gtest/TestMozURL.cpp @@ -283,7 +283,7 @@ void CheckOrigin(const nsACString& aSpec, const nsACString& aBase, OriginAttributes attrs; nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(uri, attrs); + BasePrincipal::CreateContentPrincipal(uri, attrs); ASSERT_TRUE(principal); nsCString origin; diff --git a/netwerk/test/unit/test_auth_dialog_permission.js b/netwerk/test/unit/test_auth_dialog_permission.js index 583f6aff847e..2733a983ea32 100644 --- a/netwerk/test/unit/test_auth_dialog_permission.js +++ b/netwerk/test/unit/test_auth_dialog_permission.js @@ -109,7 +109,7 @@ function makeChan(loadingUrl, url, contentPolicy) { Ci.nsIScriptSecurityManager ); var uri = make_uri(loadingUrl); - var principal = ssm.createCodebasePrincipal(uri, {}); + var principal = ssm.createContentPrincipal(uri, {}); return NetUtil.newChannel({ uri: url, diff --git a/netwerk/test/unit/test_auth_jar.js b/netwerk/test/unit/test_auth_jar.js index 25143cf466d4..0d4393e38efe 100644 --- a/netwerk/test/unit/test_auth_jar.js +++ b/netwerk/test/unit/test_auth_jar.js @@ -13,8 +13,8 @@ function run_test() { Ci.nsIScriptSecurityManager ); const kURI1 = "http://example.com"; - var app = secMan.createCodebasePrincipal(createURI(kURI1), {}); - var appbrowser = secMan.createCodebasePrincipal(createURI(kURI1), { + var app = secMan.createContentPrincipal(createURI(kURI1), {}); + var appbrowser = secMan.createContentPrincipal(createURI(kURI1), { inIsolatedMozBrowser: true, }); diff --git a/netwerk/test/unit/test_authentication.js b/netwerk/test/unit/test_authentication.js index 413c8e97bee1..a4d3fee82503 100644 --- a/netwerk/test/unit/test_authentication.js +++ b/netwerk/test/unit/test_authentication.js @@ -284,7 +284,7 @@ function makeChan(url, loadingUrl) { var ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].getService( Ci.nsIScriptSecurityManager ); - var principal = ssm.createCodebasePrincipal(ios.newURI(loadingUrl), {}); + var principal = ssm.createContentPrincipal(ios.newURI(loadingUrl), {}); return NetUtil.newChannel({ uri: url, loadingPrincipal: principal, diff --git a/netwerk/test/unit/test_bug1195415.js b/netwerk/test/unit/test_bug1195415.js index 24ded161f49c..02973b1c75c0 100644 --- a/netwerk/test/unit/test_bug1195415.js +++ b/netwerk/test/unit/test_bug1195415.js @@ -13,7 +13,7 @@ function run_test() { .mutate() .setPort(90) .finalize(); - var prin = ssm.createCodebasePrincipal(uri, {}); + var prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "foo.com:90"); Assert.equal(prin.origin, "http://foo.com:90"); @@ -23,7 +23,7 @@ function run_test() { .mutate() .setPort(500) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "foo.com:500"); Assert.equal(prin.origin, "http://foo.com:500"); @@ -33,7 +33,7 @@ function run_test() { .mutate() .setPort(20) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "foo.com:20"); Assert.equal(prin.origin, "http://foo.com:20"); @@ -43,7 +43,7 @@ function run_test() { .mutate() .setPort(-1) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "foo.com"); Assert.equal(prin.origin, "http://foo.com"); @@ -53,7 +53,7 @@ function run_test() { .mutate() .setPort(80) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "foo.com"); Assert.equal(prin.origin, "http://foo.com"); @@ -64,7 +64,7 @@ function run_test() { .mutate() .setPort(90) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "xn--jos-dma.example.net.ch:90"); Assert.equal(prin.origin, "http://xn--jos-dma.example.net.ch:90"); @@ -74,7 +74,7 @@ function run_test() { .mutate() .setPort(500) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "xn--jos-dma.example.net.ch:500"); Assert.equal(prin.origin, "http://xn--jos-dma.example.net.ch:500"); @@ -84,7 +84,7 @@ function run_test() { .mutate() .setPort(20) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "xn--jos-dma.example.net.ch:20"); Assert.equal(prin.origin, "http://xn--jos-dma.example.net.ch:20"); @@ -94,7 +94,7 @@ function run_test() { .mutate() .setPort(-1) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "xn--jos-dma.example.net.ch"); Assert.equal(prin.origin, "http://xn--jos-dma.example.net.ch"); @@ -104,7 +104,7 @@ function run_test() { .mutate() .setPort(80) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "xn--jos-dma.example.net.ch"); Assert.equal(prin.origin, "http://xn--jos-dma.example.net.ch"); @@ -115,7 +115,7 @@ function run_test() { .mutate() .setPort(90) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "[123:45::678]:90"); Assert.equal(prin.origin, "http://[123:45::678]:90"); @@ -125,7 +125,7 @@ function run_test() { .mutate() .setPort(500) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "[123:45::678]:500"); Assert.equal(prin.origin, "http://[123:45::678]:500"); @@ -135,7 +135,7 @@ function run_test() { .mutate() .setPort(20) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "[123:45::678]:20"); Assert.equal(prin.origin, "http://[123:45::678]:20"); @@ -145,7 +145,7 @@ function run_test() { .mutate() .setPort(-1) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "[123:45::678]"); Assert.equal(prin.origin, "http://[123:45::678]"); @@ -155,7 +155,7 @@ function run_test() { .mutate() .setPort(80) .finalize(); - prin = ssm.createCodebasePrincipal(uri, {}); + prin = ssm.createContentPrincipal(uri, {}); Assert.equal(uri.asciiHostPort, "[123:45::678]"); Assert.equal(prin.origin, "http://[123:45::678]"); } diff --git a/netwerk/test/unit/test_bug337744.js b/netwerk/test/unit/test_bug337744.js index 688a8ebd32c9..fc1b1906b867 100644 --- a/netwerk/test/unit/test_bug337744.js +++ b/netwerk/test/unit/test_bug337744.js @@ -27,7 +27,7 @@ const error_specs = [ // Create some fake principal that has not enough // privileges to access any resource: uri. var uri = NetUtil.newURI("http://www.example.com"); -var principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {}); +var principal = Services.scriptSecurityManager.createContentPrincipal(uri, {}); function get_channel(spec) { var channelURI = NetUtil.newURI(spec); diff --git a/netwerk/test/unit/test_cache2-32-clear-origin.js b/netwerk/test/unit/test_cache2-32-clear-origin.js index 8ed3f4d4508f..30514efceba9 100644 --- a/netwerk/test/unit/test_cache2-32-clear-origin.js +++ b/netwerk/test/unit/test_cache2-32-clear-origin.js @@ -29,7 +29,7 @@ function run_test() { null, new OpenCallback(NORMAL, "f1m", "f1d", function(entry) { var url = Services.io.newURI(URL); - var principal = Services.scriptSecurityManager.createCodebasePrincipal( + var principal = Services.scriptSecurityManager.createContentPrincipal( url, {} ); diff --git a/netwerk/test/unit/test_cacheflags.js b/netwerk/test/unit/test_cacheflags.js index fff7965ed87d..e51d0934c135 100644 --- a/netwerk/test/unit/test_cacheflags.js +++ b/netwerk/test/unit/test_cacheflags.js @@ -22,7 +22,7 @@ function make_channel(url, flags, usePrivateBrowsing) { var securityFlags = Ci.nsILoadInfo.SEC_ALLOW_CROSS_ORIGIN_DATA_IS_NULL; var uri = Services.io.newURI(url); - var principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, { + var principal = Services.scriptSecurityManager.createContentPrincipal(uri, { privateBrowsingId: usePrivateBrowsing ? 1 : 0, }); diff --git a/netwerk/test/unit/test_fallback_no-cache-entry_canceled.js b/netwerk/test/unit/test_fallback_no-cache-entry_canceled.js index b5a77f380306..64e3f2dbee29 100644 --- a/netwerk/test/unit/test_fallback_no-cache-entry_canceled.js +++ b/netwerk/test/unit/test_fallback_no-cache-entry_canceled.js @@ -64,7 +64,7 @@ function run_test() { Ci.nsIScriptSecurityManager ); var uri = make_uri("http://localhost:" + httpServer.identity.primaryPort); - var principal = ssm.createCodebasePrincipal(uri, {}); + var principal = ssm.createContentPrincipal(uri, {}); if (pm.testPermissionFromPrincipal(principal, "offline-app") != 0) { dump( diff --git a/netwerk/test/unit/test_fallback_no-cache-entry_passing.js b/netwerk/test/unit/test_fallback_no-cache-entry_passing.js index 1883dc8218af..816b008beb29 100644 --- a/netwerk/test/unit/test_fallback_no-cache-entry_passing.js +++ b/netwerk/test/unit/test_fallback_no-cache-entry_passing.js @@ -64,7 +64,7 @@ function run_test() { Ci.nsIScriptSecurityManager ); var uri = make_uri("http://localhost:" + httpServer.identity.primaryPort); - var principal = ssm.createCodebasePrincipal(uri, {}); + var principal = ssm.createContentPrincipal(uri, {}); if (pm.testPermissionFromPrincipal(principal, "offline-app") != 0) { dump( diff --git a/netwerk/test/unit/test_fallback_redirect-to-different-origin_canceled.js b/netwerk/test/unit/test_fallback_redirect-to-different-origin_canceled.js index 0d280e0030ed..9046904b85b0 100644 --- a/netwerk/test/unit/test_fallback_redirect-to-different-origin_canceled.js +++ b/netwerk/test/unit/test_fallback_redirect-to-different-origin_canceled.js @@ -71,7 +71,7 @@ function run_test() { Ci.nsIScriptSecurityManager ); var uri = make_uri("http://localhost:" + httpServer.identity.primaryPort); - var principal = ssm.createCodebasePrincipal(uri, {}); + var principal = ssm.createContentPrincipal(uri, {}); if (pm.testPermissionFromPrincipal(principal, "offline-app") != 0) { dump( diff --git a/netwerk/test/unit/test_fallback_redirect-to-different-origin_passing.js b/netwerk/test/unit/test_fallback_redirect-to-different-origin_passing.js index d8ad05aafb11..f0bf011cf465 100644 --- a/netwerk/test/unit/test_fallback_redirect-to-different-origin_passing.js +++ b/netwerk/test/unit/test_fallback_redirect-to-different-origin_passing.js @@ -71,7 +71,7 @@ function run_test() { Ci.nsIScriptSecurityManager ); var uri = make_uri("http://localhost:" + httpServer.identity.primaryPort); - var principal = ssm.createCodebasePrincipal(uri, {}); + var principal = ssm.createContentPrincipal(uri, {}); if (pm.testPermissionFromPrincipal(principal, "offline-app") != 0) { dump( diff --git a/netwerk/test/unit/test_fallback_request-error_canceled.js b/netwerk/test/unit/test_fallback_request-error_canceled.js index 27fac1e13547..8746fd98a14a 100644 --- a/netwerk/test/unit/test_fallback_request-error_canceled.js +++ b/netwerk/test/unit/test_fallback_request-error_canceled.js @@ -70,7 +70,7 @@ function run_test() { Ci.nsIScriptSecurityManager ); var uri = make_uri("http://localhost:" + httpServer.identity.primaryPort); - var principal = ssm.createCodebasePrincipal(uri, {}); + var principal = ssm.createContentPrincipal(uri, {}); if (pm.testPermissionFromPrincipal(principal, "offline-app") != 0) { dump( diff --git a/netwerk/test/unit/test_fallback_request-error_passing.js b/netwerk/test/unit/test_fallback_request-error_passing.js index 6604b27d1d2b..24ffc3fd7b20 100644 --- a/netwerk/test/unit/test_fallback_request-error_passing.js +++ b/netwerk/test/unit/test_fallback_request-error_passing.js @@ -71,7 +71,7 @@ function run_test() { Ci.nsIScriptSecurityManager ); var uri = make_uri("http://localhost:" + httpServer.identity.primaryPort); - var principal = ssm.createCodebasePrincipal(uri, {}); + var principal = ssm.createContentPrincipal(uri, {}); if (pm.testPermissionFromPrincipal(principal, "offline-app") != 0) { dump( diff --git a/netwerk/test/unit/test_fallback_response-error_canceled.js b/netwerk/test/unit/test_fallback_response-error_canceled.js index e968a25eb879..c328d2ec2920 100644 --- a/netwerk/test/unit/test_fallback_response-error_canceled.js +++ b/netwerk/test/unit/test_fallback_response-error_canceled.js @@ -71,7 +71,7 @@ function run_test() { Ci.nsIScriptSecurityManager ); var uri = make_uri("http://localhost:" + httpServer.identity.primaryPort); - var principal = ssm.createCodebasePrincipal(uri, {}); + var principal = ssm.createContentPrincipal(uri, {}); if (pm.testPermissionFromPrincipal(principal, "offline-app") != 0) { dump( diff --git a/netwerk/test/unit/test_fallback_response-error_passing.js b/netwerk/test/unit/test_fallback_response-error_passing.js index 84956c6ea5d4..3d4281b91b8d 100644 --- a/netwerk/test/unit/test_fallback_response-error_passing.js +++ b/netwerk/test/unit/test_fallback_response-error_passing.js @@ -71,7 +71,7 @@ function run_test() { Ci.nsIScriptSecurityManager ); var uri = make_uri("http://localhost:" + httpServer.identity.primaryPort); - var principal = ssm.createCodebasePrincipal(uri, {}); + var principal = ssm.createContentPrincipal(uri, {}); if (pm.testPermissionFromPrincipal(principal, "offline-app") != 0) { dump( diff --git a/netwerk/test/unit/test_offlinecache_custom-directory.js b/netwerk/test/unit/test_offlinecache_custom-directory.js index 86aecab9b061..0948c2e8d205 100644 --- a/netwerk/test/unit/test_offlinecache_custom-directory.js +++ b/netwerk/test/unit/test_offlinecache_custom-directory.js @@ -104,7 +104,7 @@ function run_test() { Ci.nsIScriptSecurityManager ); var uri = make_uri("http://localhost:4444"); - var principal = ssm.createCodebasePrincipal(uri, {}); + var principal = ssm.createContentPrincipal(uri, {}); if (pm.testPermissionFromPrincipal(principal, "offline-app") != 0) { dump( diff --git a/netwerk/test/unit/test_permmgr.js b/netwerk/test/unit/test_permmgr.js index d58f692db404..1fc920f69087 100644 --- a/netwerk/test/unit/test_permmgr.js +++ b/netwerk/test/unit/test_permmgr.js @@ -51,7 +51,7 @@ function run_test() { // put a few hosts in for (var i = 0; i < hosts.length; ++i) { let uri = ioService.newURI(hosts[i][0]); - let principal = secMan.createCodebasePrincipal(uri, {}); + let principal = secMan.createContentPrincipal(uri, {}); pm.addFromPrincipal(principal, hosts[i][1], hosts[i][2]); } @@ -59,7 +59,7 @@ function run_test() { // test the result for (var i = 0; i < results.length; ++i) { let uri = ioService.newURI(results[i][0]); - let principal = secMan.createCodebasePrincipal(uri, {}); + let principal = secMan.createContentPrincipal(uri, {}); Assert.equal( pm.testPermissionFromPrincipal(principal, results[i][1]), @@ -115,7 +115,7 @@ function run_test() { uri = ioService.newURI("https://www.example.com"); pm.add(uri, "offline-app", pm.ALLOW_ACTION); - let principal = secMan.createCodebasePrincipalFromOrigin( + let principal = secMan.createContentPrincipalFromOrigin( "https://www.example.com" ); // Remove existing entry. diff --git a/netwerk/test/unit/test_referrer.js b/netwerk/test/unit/test_referrer.js index 046cbb57b01a..c1220e062a71 100644 --- a/netwerk/test/unit/test_referrer.js +++ b/netwerk/test/unit/test_referrer.js @@ -7,7 +7,7 @@ const ReferrerInfo = Components.Constructor( function getTestReferrer(server_uri, referer_uri, isPrivate = false) { var uri = NetUtil.newURI(server_uri); let referrer = NetUtil.newURI(referer_uri); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( referrer, { privateBrowsingId: isPrivate ? 1 : 0 } ); diff --git a/netwerk/test/unit/test_referrer_cross_origin.js b/netwerk/test/unit/test_referrer_cross_origin.js index 755b75a561c9..207e32bcbc89 100644 --- a/netwerk/test/unit/test_referrer_cross_origin.js +++ b/netwerk/test/unit/test_referrer_cross_origin.js @@ -32,7 +32,7 @@ function test_policy(test) { } let referrer = NetUtil.newURI(test.referrer); - let triggeringPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let triggeringPrincipal = Services.scriptSecurityManager.createContentPrincipal( referrer, {} ); diff --git a/netwerk/test/unit/test_speculative_connect.js b/netwerk/test/unit/test_speculative_connect.js index 3765bd90b08e..78e7ed6bd11a 100644 --- a/netwerk/test/unit/test_speculative_connect.js +++ b/netwerk/test/unit/test_speculative_connect.js @@ -153,7 +153,7 @@ function test_speculative_connect() { var URI = ios.newURI( "http://localhost:" + serv.listener.port + "/just/a/test" ); - var principal = ssm.createCodebasePrincipal(URI, {}); + var principal = ssm.createContentPrincipal(URI, {}); ios .QueryInterface(Ci.nsISpeculativeConnect) diff --git a/netwerk/test/unit/test_suspend_channel_on_authRetry.js b/netwerk/test/unit/test_suspend_channel_on_authRetry.js index 3db345a2e84e..6f4401dcec89 100644 --- a/netwerk/test/unit/test_suspend_channel_on_authRetry.js +++ b/netwerk/test/unit/test_suspend_channel_on_authRetry.js @@ -176,7 +176,7 @@ function makeChan(url, loadingUrl) { var ssm = Cc["@mozilla.org/scriptsecuritymanager;1"].getService( Ci.nsIScriptSecurityManager ); - var principal = ssm.createCodebasePrincipal(ios.newURI(loadingUrl), {}); + var principal = ssm.createContentPrincipal(ios.newURI(loadingUrl), {}); return NetUtil.newChannel({ uri: url, loadingPrincipal: principal, diff --git a/netwerk/test/unit/test_trackingProtection_annotateChannels.js b/netwerk/test/unit/test_trackingProtection_annotateChannels.js index 29841b1f1f23..81e71bfdf267 100644 --- a/netwerk/test/unit/test_trackingProtection_annotateChannels.js +++ b/netwerk/test/unit/test_trackingProtection_annotateChannels.js @@ -199,7 +199,7 @@ var tests = [ false ); } - var principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + var principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( normalOrigin ); testPriorityMap = [ @@ -259,7 +259,7 @@ var tests = [ true ); } - var principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + var principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( normalOrigin ); testPriorityMap = [ diff --git a/services/sync/Weave.jsm b/services/sync/Weave.jsm index c231d7cb0a44..69490b70ac69 100644 --- a/services/sync/Weave.jsm +++ b/services/sync/Weave.jsm @@ -169,7 +169,7 @@ AboutWeaveLog.prototype = { // view. That way links to files can be opened. make sure we use the correct // origin attributes when creating the principal for accessing the // about:sync-log data. - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, aLoadInfo.originAttributes ); diff --git a/testing/specialpowers/content/SpecialPowersAPI.jsm b/testing/specialpowers/content/SpecialPowersAPI.jsm index 48bbb5f3197e..8d388ae18c8c 100644 --- a/testing/specialpowers/content/SpecialPowersAPI.jsm +++ b/testing/specialpowers/content/SpecialPowersAPI.jsm @@ -1564,7 +1564,7 @@ class SpecialPowersAPI extends JSWindowActorChild { if (typeof arg == "string") { // It's an URL. let uri = Services.io.newURI(arg); - principal = secMan.createCodebasePrincipal(uri, {}); + principal = secMan.createContentPrincipal(uri, {}); } else if (arg.nodePrincipal) { // It's a document. // In some tests the arg is a wrapped DOM element, so we unwrap it first. @@ -1572,7 +1572,7 @@ class SpecialPowersAPI extends JSWindowActorChild { } else { let uri = Services.io.newURI(arg.url); let attrs = arg.originAttributes || {}; - principal = secMan.createCodebasePrincipal(uri, attrs); + principal = secMan.createContentPrincipal(uri, attrs); } return principal; diff --git a/testing/web-platform/meta/infrastructure/server/__dir__.ini b/testing/web-platform/meta/infrastructure/server/__dir__.ini index ad6937ecc56b..3f5a1f25de8b 100644 --- a/testing/web-platform/meta/infrastructure/server/__dir__.ini +++ b/testing/web-platform/meta/infrastructure/server/__dir__.ini @@ -1,2 +1,2 @@ -lsan-allowed: [Alloc, Create, CreateInner, GetClientInfo, MakeUnique, NewPage, PLDHashTable::ChangeTable, mozilla::BasePrincipal::CreateCodebasePrincipal, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::WeakPtr, mozilla::detail::UniqueSelector, mozilla::dom::WebSocket::ConstructorCommon, mozilla::dom::WebSocket::WebSocket, mozilla::net::BaseWebSocketChannel::InitLoadInfo, mozilla::net::BaseWebSocketChannel::InitLoadInfoNative, mozilla::net::CookieSettings::Create, mozilla::net::LoadInfo::LoadInfo, mozilla::net::WebSocketChannelChild::AsyncOpen, mozilla::net::WebSocketEventService::GetOrCreate, mozilla::net::nsStandardURL::TemplatedMutator, nsSupportsWeakReference::GetWeakReference] +lsan-allowed: [Alloc, Create, CreateInner, GetClientInfo, MakeUnique, NewPage, PLDHashTable::ChangeTable, mozilla::BasePrincipal::CreateContentPrincipal, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::WeakPtr, mozilla::detail::UniqueSelector, mozilla::dom::WebSocket::ConstructorCommon, mozilla::dom::WebSocket::WebSocket, mozilla::net::BaseWebSocketChannel::InitLoadInfo, mozilla::net::BaseWebSocketChannel::InitLoadInfoNative, mozilla::net::CookieSettings::Create, mozilla::net::LoadInfo::LoadInfo, mozilla::net::WebSocketChannelChild::AsyncOpen, mozilla::net::WebSocketEventService::GetOrCreate, mozilla::net::nsStandardURL::TemplatedMutator, nsSupportsWeakReference::GetWeakReference] leak-threshold: [default:51200, tab:51200] diff --git a/testing/web-platform/meta/service-workers/service-worker/__dir__.ini b/testing/web-platform/meta/service-workers/service-worker/__dir__.ini index 2088cbea27cc..5e16053731e1 100644 --- a/testing/web-platform/meta/service-workers/service-worker/__dir__.ini +++ b/testing/web-platform/meta/service-workers/service-worker/__dir__.ini @@ -1,3 +1,3 @@ prefs: [dom.serviceWorkers.enabled:true] -lsan-allowed: [Alloc, CompareNetwork, Create, EntrySlotOrCreate, GetClientInfo, MakeUnique, Malloc, NS_NewLoadGroup, NewChannelFromURIWithProxyFlagsInternal, NewPage, PLDHashTable::Add, Realloc, SharedMutex, Then, createTable, mozilla::BasePrincipal::CreateCodebasePrincipal, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::ThrottledEventQueue::Create, mozilla::WeakPtr, mozilla::detail::UniqueSelector, mozilla::dom::PerformanceStorageWorker::Create, mozilla::dom::ServiceWorkerJobQueue::RunJob, mozilla::dom::ServiceWorkerManager::Unregister, mozilla::dom::ServiceWorkerRegistrationMainThread::Unregister, mozilla::dom::UnregisterCallback::UnregisterCallback, mozilla::dom::WorkerCSPEventListener::Create, mozilla::dom::WorkerPrivate::EnsurePerformanceCounter, mozilla::dom::WorkerPrivate::WorkerPrivate, mozilla::dom::cache::CacheOpChild::Recv__delete__, mozilla::dom::serviceWorkerScriptCache::, mozilla::net::HttpBaseChannel::HttpBaseChannel, mozilla::net::HttpChannelChild::HttpChannelChild, mozilla::net::nsHttpHandler::NewProxiedChannel, mozilla::net::nsIOService::NewChannelFromURIWithProxyFlagsInternal, mozilla::net::nsStandardURL::TemplatedMutator, nsPermission::Create, nsTimer, nsTimer::WithEventTarget, operator] +lsan-allowed: [Alloc, CompareNetwork, Create, EntrySlotOrCreate, GetClientInfo, MakeUnique, Malloc, NS_NewLoadGroup, NewChannelFromURIWithProxyFlagsInternal, NewPage, PLDHashTable::Add, Realloc, SharedMutex, Then, createTable, mozilla::BasePrincipal::CreateContentPrincipal, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::ThrottledEventQueue::Create, mozilla::WeakPtr, mozilla::detail::UniqueSelector, mozilla::dom::PerformanceStorageWorker::Create, mozilla::dom::ServiceWorkerJobQueue::RunJob, mozilla::dom::ServiceWorkerManager::Unregister, mozilla::dom::ServiceWorkerRegistrationMainThread::Unregister, mozilla::dom::UnregisterCallback::UnregisterCallback, mozilla::dom::WorkerCSPEventListener::Create, mozilla::dom::WorkerPrivate::EnsurePerformanceCounter, mozilla::dom::WorkerPrivate::WorkerPrivate, mozilla::dom::cache::CacheOpChild::Recv__delete__, mozilla::dom::serviceWorkerScriptCache::, mozilla::net::HttpBaseChannel::HttpBaseChannel, mozilla::net::HttpChannelChild::HttpChannelChild, mozilla::net::nsHttpHandler::NewProxiedChannel, mozilla::net::nsIOService::NewChannelFromURIWithProxyFlagsInternal, mozilla::net::nsStandardURL::TemplatedMutator, nsPermission::Create, nsTimer, nsTimer::WithEventTarget, operator] leak-threshold: [default:51200, tab:51200] diff --git a/testing/web-platform/meta/websockets/__dir__.ini b/testing/web-platform/meta/websockets/__dir__.ini index 4b90b6ed9236..da0179755904 100644 --- a/testing/web-platform/meta/websockets/__dir__.ini +++ b/testing/web-platform/meta/websockets/__dir__.ini @@ -1,2 +1,2 @@ -lsan-allowed: [Alloc, Create, GetClientInfo, MakeUnique, NewPage, PLDHashTable::Add, Realloc, SetPropertyAsInterface, mozilla::BasePrincipal::CreateCodebasePrincipal, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::WeakPtr, mozilla::dom::WebSocket::ConstructorCommon, mozilla::dom::WebSocket::WebSocket, mozilla::extensions::ChannelWrapper::ChannelWrapper, mozilla::net::BaseWebSocketChannel::InitLoadInfo, mozilla::net::BaseWebSocketChannel::InitLoadInfoNative, mozilla::net::CookieSettings::Create, mozilla::net::LoadInfo::LoadInfo, mozilla::net::WebSocketChannelChild::AsyncOpen, mozilla::net::WebSocketEventService::GetOrCreate, mozilla::net::nsHttpTransaction::ParseHead, mozilla::net::nsStandardURL::TemplatedMutator, nsNodeSupportsWeakRefTearoff::GetWeakReference, nsSupportsWeakReference::GetWeakReference] +lsan-allowed: [Alloc, Create, GetClientInfo, MakeUnique, NewPage, PLDHashTable::Add, Realloc, SetPropertyAsInterface, mozilla::BasePrincipal::CreateContentPrincipal, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::WeakPtr, mozilla::dom::WebSocket::ConstructorCommon, mozilla::dom::WebSocket::WebSocket, mozilla::extensions::ChannelWrapper::ChannelWrapper, mozilla::net::BaseWebSocketChannel::InitLoadInfo, mozilla::net::BaseWebSocketChannel::InitLoadInfoNative, mozilla::net::CookieSettings::Create, mozilla::net::LoadInfo::LoadInfo, mozilla::net::WebSocketChannelChild::AsyncOpen, mozilla::net::WebSocketEventService::GetOrCreate, mozilla::net::nsHttpTransaction::ParseHead, mozilla::net::nsStandardURL::TemplatedMutator, nsNodeSupportsWeakRefTearoff::GetWeakReference, nsSupportsWeakReference::GetWeakReference] leak-threshold: [default:102400, tab:51200] diff --git a/testing/web-platform/meta/websockets/binary/__dir__.ini b/testing/web-platform/meta/websockets/binary/__dir__.ini index c738df38d799..d9bdb02cf162 100644 --- a/testing/web-platform/meta/websockets/binary/__dir__.ini +++ b/testing/web-platform/meta/websockets/binary/__dir__.ini @@ -1,3 +1,3 @@ -lsan-allowed: [MakeUnique, mozilla::dom::WebSocket::ConstructorCommon, mozilla::net::BaseWebSocketChannel::InitLoadInfo, mozilla::net::BaseWebSocketChannel::InitLoadInfoNative, mozilla::net::WebSocketChannelChild::AsyncOpen, mozilla::net::WebSocketEventService::GetOrCreate, Alloc, Create, Malloc, NewPage, PLDHashTable::Add, PLDHashTable::ChangeTable, Realloc, RecvOnAcknowledge, RecvOnStop, mozilla::BasePrincipal::CreateCodebasePrincipal, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::ThrottledEventQueue::Create, mozilla::WeakPtr, mozilla::dom::ScriptElement::MaybeProcessScript, mozilla::dom::WebSocket::WebSocket, mozilla::dom::WorkerCSPEventListener::Create, mozilla::dom::ContentChild::GetConstructedEventTarget, mozilla::net::WebSocketChannelChild::RecvOnServerClose, mozilla::net::nsStandardURL::TemplatedMutator, nsAtomTable::Atomize, nsDocShell::Create] +lsan-allowed: [MakeUnique, mozilla::dom::WebSocket::ConstructorCommon, mozilla::net::BaseWebSocketChannel::InitLoadInfo, mozilla::net::BaseWebSocketChannel::InitLoadInfoNative, mozilla::net::WebSocketChannelChild::AsyncOpen, mozilla::net::WebSocketEventService::GetOrCreate, Alloc, Create, Malloc, NewPage, PLDHashTable::Add, PLDHashTable::ChangeTable, Realloc, RecvOnAcknowledge, RecvOnStop, mozilla::BasePrincipal::CreateContentPrincipal, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::ThrottledEventQueue::Create, mozilla::WeakPtr, mozilla::dom::ScriptElement::MaybeProcessScript, mozilla::dom::WebSocket::WebSocket, mozilla::dom::WorkerCSPEventListener::Create, mozilla::dom::ContentChild::GetConstructedEventTarget, mozilla::net::WebSocketChannelChild::RecvOnServerClose, mozilla::net::nsStandardURL::TemplatedMutator, nsAtomTable::Atomize, nsDocShell::Create] lsan-max-stack-depth: 7 leak-threshold: [tab:51200] diff --git a/testing/web-platform/meta/websockets/constructor/__dir__.ini b/testing/web-platform/meta/websockets/constructor/__dir__.ini index 15bbd944fb84..3ebdca576b63 100644 --- a/testing/web-platform/meta/websockets/constructor/__dir__.ini +++ b/testing/web-platform/meta/websockets/constructor/__dir__.ini @@ -1,3 +1,3 @@ lsan-max-stack-depth: 7 -lsan-allowed: [Alloc, Create, MakeUnique, Malloc, NewPage, PLDHashTable::Add, PLDHashTable::ChangeTable, Realloc, RecvOnAcknowledge, RecvOnStop, SetPropertyAsInterface, SetSucceededCertChain, allocate, mozilla::BasePrincipal::CreateCodebasePrincipal, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::ThrottledEventQueue::Create, mozilla::WeakPtr, mozilla::detail::UniqueSelector, mozilla::dom::ContentChild::GetConstructedEventTarget, mozilla::dom::ScriptElement::MaybeProcessScript, mozilla::dom::WebSocket::ConstructorCommon, mozilla::dom::WebSocket::WebSocket, mozilla::dom::WorkerCSPEventListener::Create, mozilla::extensions::ChannelWrapper::ChannelWrapper, mozilla::net::BaseWebSocketChannel::InitLoadInfo, mozilla::net::BaseWebSocketChannel::InitLoadInfoNative, mozilla::net::WebSocketChannelChild::AsyncOpen, mozilla::net::WebSocketChannelChild::RecvOnServerClose, mozilla::net::WebSocketEventService::GetOrCreate, mozilla::net::nsHttpTransaction::ParseHead, mozilla::net::nsStandardURL::TemplatedMutator, nsAtomTable::Atomize, nsDocShell::Create, nsNSSCertificate::Create, nsNodeSupportsWeakRefTearoff::GetWeakReference, nsSSLIOLayerAddToSocket] +lsan-allowed: [Alloc, Create, MakeUnique, Malloc, NewPage, PLDHashTable::Add, PLDHashTable::ChangeTable, Realloc, RecvOnAcknowledge, RecvOnStop, SetPropertyAsInterface, SetSucceededCertChain, allocate, mozilla::BasePrincipal::CreateContentPrincipal, mozilla::SchedulerGroup::CreateEventTargetFor, mozilla::ThrottledEventQueue::Create, mozilla::WeakPtr, mozilla::detail::UniqueSelector, mozilla::dom::ContentChild::GetConstructedEventTarget, mozilla::dom::ScriptElement::MaybeProcessScript, mozilla::dom::WebSocket::ConstructorCommon, mozilla::dom::WebSocket::WebSocket, mozilla::dom::WorkerCSPEventListener::Create, mozilla::extensions::ChannelWrapper::ChannelWrapper, mozilla::net::BaseWebSocketChannel::InitLoadInfo, mozilla::net::BaseWebSocketChannel::InitLoadInfoNative, mozilla::net::WebSocketChannelChild::AsyncOpen, mozilla::net::WebSocketChannelChild::RecvOnServerClose, mozilla::net::WebSocketEventService::GetOrCreate, mozilla::net::nsHttpTransaction::ParseHead, mozilla::net::nsStandardURL::TemplatedMutator, nsAtomTable::Atomize, nsDocShell::Create, nsNSSCertificate::Create, nsNodeSupportsWeakRefTearoff::GetWeakReference, nsSSLIOLayerAddToSocket] leak-threshold: [tab:51200] diff --git a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py index 7ab701879ff1..909a73a65402 100644 --- a/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py +++ b/testing/web-platform/tests/tools/wptrunner/wptrunner/executors/executormarionette.py @@ -326,7 +326,7 @@ class MarionetteStorageProtocolPart(StorageProtocolPart): .newURI(url); let ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"] .getService(Ci.nsIScriptSecurityManager); - let principal = ssm.createCodebasePrincipal(uri, {}); + let principal = ssm.createContentPrincipal(uri, {}); let qms = Components.classes["@mozilla.org/dom/quota-manager-service;1"] .getService(Components.interfaces.nsIQuotaManagerService); qms.clearStoragesForPrincipal(principal, "default", null, true); diff --git a/toolkit/actors/WebChannelChild.jsm b/toolkit/actors/WebChannelChild.jsm index c98c2a3b8ec5..9bba7b96c349 100644 --- a/toolkit/actors/WebChannelChild.jsm +++ b/toolkit/actors/WebChannelChild.jsm @@ -48,7 +48,7 @@ class WebChannelChild extends ActorChild { if (whitelist != _lastWhitelistValue) { let urls = whitelist.split(/\s+/); _cachedWhitelist = urls.map(origin => - Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(origin) + Services.scriptSecurityManager.createContentPrincipalFromOrigin(origin) ); } return _cachedWhitelist; diff --git a/toolkit/components/alerts/test/test_image.html b/toolkit/components/alerts/test/test_image.html index 324e5cb0a057..3928529c13d9 100644 --- a/toolkit/components/alerts/test/test_image.html +++ b/toolkit/components/alerts/test/test_image.html @@ -99,7 +99,7 @@ add_task(async function testMixedContent() { // Loading principal is HTTPS; image URL is HTTP. var origin = "https://mochi.test:8888"; var principal = Services.scriptSecurityManager - .createCodebasePrincipalFromOrigin(origin); + .createContentPrincipalFromOrigin(origin); var alert = makeAlert(null, imageServerURL + "?f=image.png", null, null, false, null, null, null, diff --git a/toolkit/components/antitracking/AntiTrackingCommon.cpp b/toolkit/components/antitracking/AntiTrackingCommon.cpp index 7896d35d5d24..643c5db89800 100644 --- a/toolkit/components/antitracking/AntiTrackingCommon.cpp +++ b/toolkit/components/antitracking/AntiTrackingCommon.cpp @@ -161,7 +161,7 @@ uint32_t CheckCookiePermissionForPrincipal(nsICookieSettings* aCookieSettings, MOZ_ASSERT(aPrincipal); uint32_t cookiePermission = nsICookiePermission::ACCESS_DEFAULT; - if (!aPrincipal->GetIsCodebasePrincipal()) { + if (!aPrincipal->GetIsContentPrincipal()) { return cookiePermission; } @@ -1625,7 +1625,7 @@ bool AntiTrackingCommon::IsFirstPartyStorageAccessGrantedFor( MOZ_ASSERT(aCookieSettings); uint32_t access = nsICookiePermission::ACCESS_DEFAULT; - if (aPrincipal->GetIsCodebasePrincipal()) { + if (aPrincipal->GetIsContentPrincipal()) { nsPermissionManager* permManager = nsPermissionManager::GetInstance(); if (permManager) { Unused << NS_WARN_IF(NS_FAILED(permManager->TestPermissionFromPrincipal( diff --git a/toolkit/components/antitracking/ContentBlockingAllowList.jsm b/toolkit/components/antitracking/ContentBlockingAllowList.jsm index 7e0bc51ca2ce..498b3d343040 100644 --- a/toolkit/components/antitracking/ContentBlockingAllowList.jsm +++ b/toolkit/components/antitracking/ContentBlockingAllowList.jsm @@ -62,7 +62,7 @@ const ContentBlockingAllowList = { return null; } let attrs = browser.contentPrincipal.originAttributes; - return Services.scriptSecurityManager.createCodebasePrincipal( + return Services.scriptSecurityManager.createContentPrincipal( baseURI, attrs ); diff --git a/toolkit/components/cleardata/ClearDataService.jsm b/toolkit/components/cleardata/ClearDataService.jsm index 02bb33271d27..3e45fae3b0a1 100644 --- a/toolkit/components/cleardata/ClearDataService.jsm +++ b/toolkit/components/cleardata/ClearDataService.jsm @@ -130,11 +130,11 @@ const NetworkCacheCleaner = { // Delete data from both HTTP and HTTPS sites. let httpURI = Services.io.newURI("http://" + aHost); let httpsURI = Services.io.newURI("https://" + aHost); - let httpPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let httpPrincipal = Services.scriptSecurityManager.createContentPrincipal( httpURI, aOriginAttributes ); - let httpsPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let httpsPrincipal = Services.scriptSecurityManager.createContentPrincipal( httpsURI, aOriginAttributes ); @@ -170,11 +170,11 @@ const ImageCacheCleaner = { // Delete data from both HTTP and HTTPS sites. let httpURI = Services.io.newURI("http://" + aHost); let httpsURI = Services.io.newURI("https://" + aHost); - let httpPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let httpPrincipal = Services.scriptSecurityManager.createContentPrincipal( httpURI, aOriginAttributes ); - let httpsPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let httpsPrincipal = Services.scriptSecurityManager.createContentPrincipal( httpsURI, aOriginAttributes ); @@ -465,11 +465,11 @@ const QuotaCleaner = { // delete data from both HTTP and HTTPS sites let httpURI = Services.io.newURI("http://" + aHost); let httpsURI = Services.io.newURI("https://" + aHost); - let httpPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let httpPrincipal = Services.scriptSecurityManager.createContentPrincipal( httpURI, aOriginAttributes ); - let httpsPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let httpsPrincipal = Services.scriptSecurityManager.createContentPrincipal( httpsURI, aOriginAttributes ); @@ -521,7 +521,7 @@ const QuotaCleaner = { let promises = []; for (let item of aRequest.result) { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( item.origin ); let host; @@ -611,7 +611,7 @@ const QuotaCleaner = { let promises = []; for (let item of aRequest.result) { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( item.origin ); if ( diff --git a/toolkit/components/cleardata/SiteDataTestUtils.jsm b/toolkit/components/cleardata/SiteDataTestUtils.jsm index cc0104a3b6bd..ae7ef75e8580 100644 --- a/toolkit/components/cleardata/SiteDataTestUtils.jsm +++ b/toolkit/components/cleardata/SiteDataTestUtils.jsm @@ -43,7 +43,7 @@ var SiteDataTestUtils = { */ persist(origin, value = Services.perms.ALLOW_ACTION) { return new Promise(resolve => { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( origin ); Services.perms.addFromPrincipal(principal, "persistent-storage", value); @@ -61,7 +61,7 @@ var SiteDataTestUtils = { */ addToIndexedDB(origin, size = 1024) { return new Promise(resolve => { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( origin ); let request = indexedDB.openForPrincipal(principal, "TestDatabase", 1); @@ -90,7 +90,7 @@ var SiteDataTestUtils = { * @param {String} value [optional] - the cookie value */ addToCookies(origin, name = "foo", value = "bar") { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( origin ); Services.cookies.add( @@ -265,7 +265,7 @@ var SiteDataTestUtils = { */ getQuotaUsage(origin) { return new Promise(resolve => { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( origin ); Services.qms.getUsageForPrincipal(principal, request => diff --git a/toolkit/components/cleardata/tests/browser/browser_serviceworkers.js b/toolkit/components/cleardata/tests/browser/browser_serviceworkers.js index 8aa91387a301..19a44cc11b88 100644 --- a/toolkit/components/cleardata/tests/browser/browser_serviceworkers.js +++ b/toolkit/components/cleardata/tests/browser/browser_serviceworkers.js @@ -91,7 +91,7 @@ add_task(async function test_deleteFromPrincipal() { let unregistered = SiteDataTestUtils.promiseServiceWorkerUnregistered( "https://test1.example.com" ); - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( "https://test1.example.com/" ); await new Promise(aResolve => { @@ -119,7 +119,7 @@ add_task(async function test_deleteFromPrincipal() { unregistered = SiteDataTestUtils.promiseServiceWorkerUnregistered( "https://test1.example.org" ); - principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( "https://test1.example.org/" ); await new Promise(aResolve => { diff --git a/toolkit/components/cleardata/tests/unit/test_cookies.js b/toolkit/components/cleardata/tests/unit/test_cookies.js index 34a13905771d..2c2ca8bd7a6c 100644 --- a/toolkit/components/cleardata/tests/unit/test_cookies.js +++ b/toolkit/components/cleardata/tests/unit/test_cookies.js @@ -104,7 +104,7 @@ add_task(async function test_principal_cookies() { Assert.equal(Services.cookies.countCookiesFromHost("example.net"), 1); let uri = Services.io.newURI("http://example.com"); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); @@ -124,7 +124,7 @@ add_task(async function test_principal_cookies() { // Now we delete all. uri = Services.io.newURI("http://example.net"); - principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {}); + principal = Services.scriptSecurityManager.createContentPrincipal(uri, {}); await new Promise(aResolve => { Services.clearData.deleteDataFromPrincipal( principal, diff --git a/toolkit/components/cleardata/tests/unit/test_downloads.js b/toolkit/components/cleardata/tests/unit/test_downloads.js index b3cc9c7bb2e6..de37bfd48abf 100644 --- a/toolkit/components/cleardata/tests/unit/test_downloads.js +++ b/toolkit/components/cleardata/tests/unit/test_downloads.js @@ -167,7 +167,7 @@ add_task(async function test_principal_downloads() { await list.addView(view); let uri = Services.io.newURI("http://example.com"); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/toolkit/components/cleardata/tests/unit/test_network_cache.js b/toolkit/components/cleardata/tests/unit/test_network_cache.js index 91af2de817ef..e2ffb441c34a 100644 --- a/toolkit/components/cleardata/tests/unit/test_network_cache.js +++ b/toolkit/components/cleardata/tests/unit/test_network_cache.js @@ -86,7 +86,7 @@ add_task(async function test_deleteFromPrincipal() { "The memory cache has an entry" ); - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( "http://example.com/" ); await new Promise(aResolve => { diff --git a/toolkit/components/cleardata/tests/unit/test_passwords.js b/toolkit/components/cleardata/tests/unit/test_passwords.js index f813491018ba..850b0014db16 100644 --- a/toolkit/components/cleardata/tests/unit/test_passwords.js +++ b/toolkit/components/cleardata/tests/unit/test_passwords.js @@ -25,7 +25,7 @@ add_task(async function test_principal_downloads() { Assert.equal(countLogins(URL), 1); let uri = Services.io.newURI(URL); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/toolkit/components/cleardata/tests/unit/test_permissions.js b/toolkit/components/cleardata/tests/unit/test_permissions.js index f432ff08f5c7..d64b6f76885e 100644 --- a/toolkit/components/cleardata/tests/unit/test_permissions.js +++ b/toolkit/components/cleardata/tests/unit/test_permissions.js @@ -9,7 +9,7 @@ add_task(async function test_all_permissions() { const uri = Services.io.newURI("https://example.net"); - const principal = Services.scriptSecurityManager.createCodebasePrincipal( + const principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); @@ -40,13 +40,13 @@ add_task(async function test_all_permissions() { add_task(async function test_principal_permissions() { const uri = Services.io.newURI("https://example.net"); - const principal = Services.scriptSecurityManager.createCodebasePrincipal( + const principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); const anotherUri = Services.io.newURI("https://example.com"); - const anotherPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + const anotherPrincipal = Services.scriptSecurityManager.createContentPrincipal( anotherUri, {} ); @@ -97,7 +97,7 @@ add_task(async function test_principal_permissions() { add_task(async function test_3rdpartystorage_permissions() { const uri = Services.io.newURI("https://example.net"); - const principal = Services.scriptSecurityManager.createCodebasePrincipal( + const principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); @@ -108,7 +108,7 @@ add_task(async function test_3rdpartystorage_permissions() { ); const anotherUri = Services.io.newURI("https://example.com"); - const anotherPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + const anotherPrincipal = Services.scriptSecurityManager.createContentPrincipal( anotherUri, {} ); @@ -124,7 +124,7 @@ add_task(async function test_3rdpartystorage_permissions() { ); const oneMoreUri = Services.io.newURI("https://example.org"); - const oneMorePrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + const oneMorePrincipal = Services.scriptSecurityManager.createContentPrincipal( oneMoreUri, {} ); diff --git a/toolkit/components/cleardata/tests/unit/test_storage_permission.js b/toolkit/components/cleardata/tests/unit/test_storage_permission.js index 50b9f23c0e53..6f7197e36b0a 100644 --- a/toolkit/components/cleardata/tests/unit/test_storage_permission.js +++ b/toolkit/components/cleardata/tests/unit/test_storage_permission.js @@ -10,7 +10,7 @@ // Test that only the storageAccessAPI gets removed. add_task(async function test_removing_storage_permission() { const uri = Services.io.newURI("https://example.net"); - const principal = Services.scriptSecurityManager.createCodebasePrincipal( + const principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); @@ -70,13 +70,13 @@ add_task(async function test_removing_storage_permission() { // Test that the storageAccessAPI gets removed from a particular principal add_task(async function test_removing_storage_permission_from_principal() { const uri = Services.io.newURI("https://example.net"); - const principal = Services.scriptSecurityManager.createCodebasePrincipal( + const principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); const anotherUri = Services.io.newURI("https://example.com"); - const anotherPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + const anotherPrincipal = Services.scriptSecurityManager.createContentPrincipal( anotherUri, {} ); diff --git a/toolkit/components/extensions/Extension.jsm b/toolkit/components/extensions/Extension.jsm index 7bcda99509d6..6c80c5aa5682 100644 --- a/toolkit/components/extensions/Extension.jsm +++ b/toolkit/components/extensions/Extension.jsm @@ -287,14 +287,14 @@ var UninstallObserver = { // Clear any IndexedDB storage created by the extension // If LSNG is enabled, this also clears localStorage. let baseURI = Services.io.newURI(`moz-extension://${uuid}/`); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( baseURI, {} ); Services.qms.clearStoragesForPrincipal(principal); // Clear any storage.local data stored in the IDBBackend. - let storagePrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let storagePrincipal = Services.scriptSecurityManager.createContentPrincipal( baseURI, { userContextId: WEBEXT_STORAGE_USER_CONTEXT_ID, @@ -1756,7 +1756,7 @@ class Extension extends ExtensionData { } createPrincipal(uri = this.baseURI, originAttributes = {}) { - return Services.scriptSecurityManager.createCodebasePrincipal( + return Services.scriptSecurityManager.createContentPrincipal( uri, originAttributes ); diff --git a/toolkit/components/extensions/ExtensionChild.jsm b/toolkit/components/extensions/ExtensionChild.jsm index b024533cf4bd..55d7d1e14b8c 100644 --- a/toolkit/components/extensions/ExtensionChild.jsm +++ b/toolkit/components/extensions/ExtensionChild.jsm @@ -775,7 +775,7 @@ class BrowserExtensionContent extends EventEmitter { this.baseURI = Services.io.newURI(`moz-extension://${this.uuid}/`); this.baseURL = this.baseURI.spec; - this.principal = Services.scriptSecurityManager.createCodebasePrincipal( + this.principal = Services.scriptSecurityManager.createContentPrincipal( this.baseURI, {} ); diff --git a/toolkit/components/extensions/ExtensionContent.jsm b/toolkit/components/extensions/ExtensionContent.jsm index bcc0880533c1..b489e5ad714b 100644 --- a/toolkit/components/extensions/ExtensionContent.jsm +++ b/toolkit/components/extensions/ExtensionContent.jsm @@ -763,7 +763,7 @@ class ContentScriptContextChild extends BaseContext { // Copy origin attributes from the content window origin attributes to // preserve the user context id. let attrs = contentPrincipal.originAttributes; - let extensionPrincipal = ssm.createCodebasePrincipal( + let extensionPrincipal = ssm.createContentPrincipal( this.extension.baseURI, attrs ); diff --git a/toolkit/components/extensions/WebExtensionContentScript.h b/toolkit/components/extensions/WebExtensionContentScript.h index e86682b7d2d7..5aae45f37691 100644 --- a/toolkit/components/extensions/WebExtensionContentScript.h +++ b/toolkit/components/extensions/WebExtensionContentScript.h @@ -47,7 +47,7 @@ class MOZ_STACK_CLASS DocInfo final { nsIPrincipal* Principal() const; // Returns the URL of the document's principal. Note that this must *only* - // be called for codebase principals. + // be called for content principals. const URLInfo& PrincipalURL() const; bool IsTopLevel() const; diff --git a/toolkit/components/extensions/WebExtensionPolicy.cpp b/toolkit/components/extensions/WebExtensionPolicy.cpp index f3043b038d65..36cdb3b1dd3b 100644 --- a/toolkit/components/extensions/WebExtensionPolicy.cpp +++ b/toolkit/components/extensions/WebExtensionPolicy.cpp @@ -388,9 +388,9 @@ NS_IMPL_ISUPPORTS(AtomSetPref, nsIObserver, nsISupportsWeakReference) /* static */ bool WebExtensionPolicy::IsRestrictedDoc(const DocInfo& aDoc) { // With the exception of top-level about:blank documents with null - // principals, we never match documents that have non-codebase principals, + // principals, we never match documents that have non-content principals, // including those with null principals or system principals. - if (aDoc.Principal() && !aDoc.Principal()->GetIsCodebasePrincipal()) { + if (aDoc.Principal() && !aDoc.Principal()->GetIsContentPrincipal()) { return true; } @@ -830,7 +830,7 @@ nsIPrincipal* DocInfo::Principal() const { } const URLInfo& DocInfo::PrincipalURL() const { - if (!(Principal() && Principal()->GetIsCodebasePrincipal())) { + if (!(Principal() && Principal()->GetIsContentPrincipal())) { return URL(); } diff --git a/toolkit/components/extensions/test/mochitest/head_unlimitedStorage.js b/toolkit/components/extensions/test/mochitest/head_unlimitedStorage.js index 4f1973045012..73b98b68ae69 100644 --- a/toolkit/components/extensions/test/mochitest/head_unlimitedStorage.js +++ b/toolkit/components/extensions/test/mochitest/head_unlimitedStorage.js @@ -18,7 +18,7 @@ function checkSitePermissions(uuid, expectedPermAction, assertMessage) { } const baseURI = NetUtil.newURI(`moz-extension://${uuid}/`); - const principal = Services.scriptSecurityManager.createCodebasePrincipal( + const principal = Services.scriptSecurityManager.createContentPrincipal( baseURI, {} ); diff --git a/toolkit/components/extensions/test/xpcshell/head_sync.js b/toolkit/components/extensions/test/xpcshell/head_sync.js index f1d625cf6642..383ae86508be 100644 --- a/toolkit/components/extensions/test/xpcshell/head_sync.js +++ b/toolkit/components/extensions/test/xpcshell/head_sync.js @@ -35,7 +35,7 @@ class Context extends BaseContext { */ async function withContext(f) { const ssm = Services.scriptSecurityManager; - const PRINCIPAL1 = ssm.createCodebasePrincipalFromOrigin( + const PRINCIPAL1 = ssm.createContentPrincipalFromOrigin( "http://www.example.org" ); const context = new Context(PRINCIPAL1); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_triggeringPrincipal.js b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_triggeringPrincipal.js index 73138b9e0ca2..5192a88d77e1 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_triggeringPrincipal.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contentscript_triggeringPrincipal.js @@ -1198,7 +1198,7 @@ function mergeSources(a, b) { // use in verifying request triggering principals. function getOrigins(extension) { return { - page: Services.scriptSecurityManager.createCodebasePrincipal(pageURI, {}) + page: Services.scriptSecurityManager.createContentPrincipal(pageURI, {}) .origin, contentScript: Cu.getObjectPrincipal( Cu.Sandbox([extension.principal, pageURL]) diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_contexts.js b/toolkit/components/extensions/test/xpcshell/test_ext_contexts.js index 54eb344a8339..ad414a4805c3 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_contexts.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_contexts.js @@ -127,10 +127,10 @@ class Context extends BaseContext { } let ssm = Services.scriptSecurityManager; -const PRINCIPAL1 = ssm.createCodebasePrincipalFromOrigin( +const PRINCIPAL1 = ssm.createContentPrincipalFromOrigin( "http://www.example.org" ); -const PRINCIPAL2 = ssm.createCodebasePrincipalFromOrigin( +const PRINCIPAL2 = ssm.createContentPrincipalFromOrigin( "http://www.somethingelse.org" ); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_trustworthy_origin.js b/toolkit/components/extensions/test/xpcshell/test_ext_trustworthy_origin.js index fafb853423eb..0c6dd0b6f393 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_trustworthy_origin.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_trustworthy_origin.js @@ -10,7 +10,7 @@ add_task( "@mozilla.org/contentsecuritymanager;1" ].getService(Ci.nsIContentSecurityManager); let uri = NetUtil.newURI("moz-extension://foobar/something.html"); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_suspend.js b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_suspend.js index 71195f098994..c5b15c044cb9 100644 --- a/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_suspend.js +++ b/toolkit/components/extensions/test/xpcshell/test_ext_webRequest_suspend.js @@ -195,7 +195,7 @@ add_task(async function test_set_responseHeaders() { let channel = NetUtil.newChannel({ uri: "http://example.com/?modify_headers", - loadingPrincipal: ssm.createCodebasePrincipalFromOrigin( + loadingPrincipal: ssm.createContentPrincipalFromOrigin( "http://example.com" ), contentPolicyType: Ci.nsIContentPolicy.TYPE_XMLHTTPREQUEST, diff --git a/toolkit/components/extensions/webrequest/ChannelWrapper.cpp b/toolkit/components/extensions/webrequest/ChannelWrapper.cpp index 8d5610e6f6d5..fce9bd4ef668 100644 --- a/toolkit/components/extensions/webrequest/ChannelWrapper.cpp +++ b/toolkit/components/extensions/webrequest/ChannelWrapper.cpp @@ -438,7 +438,7 @@ already_AddRefed ChannelWrapper::GetOriginURI() const { nsCOMPtr uri; if (nsCOMPtr loadInfo = GetLoadInfo()) { if (nsIPrincipal* prin = loadInfo->TriggeringPrincipal()) { - if (prin->GetIsCodebasePrincipal()) { + if (prin->GetIsContentPrincipal()) { Unused << prin->GetURI(getter_AddRefs(uri)); } } @@ -450,7 +450,7 @@ already_AddRefed ChannelWrapper::GetDocumentURI() const { nsCOMPtr uri; if (nsCOMPtr loadInfo = GetLoadInfo()) { if (nsIPrincipal* prin = loadInfo->LoadingPrincipal()) { - if (prin->GetIsCodebasePrincipal()) { + if (prin->GetIsContentPrincipal()) { Unused << prin->GetURI(getter_AddRefs(uri)); } } diff --git a/toolkit/components/normandy/content/AboutPages.jsm b/toolkit/components/normandy/content/AboutPages.jsm index b97b21c029c9..eebba0e5d372 100644 --- a/toolkit/components/normandy/content/AboutPages.jsm +++ b/toolkit/components/normandy/content/AboutPages.jsm @@ -69,7 +69,7 @@ class AboutPage { channel.originalURI = uri; if (this.uriFlags & Ci.nsIAboutModule.URI_SAFE_FOR_UNTRUSTED_CONTENT) { - const principal = Services.scriptSecurityManager.createCodebasePrincipal( + const principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/toolkit/components/passwordmgr/InsecurePasswordUtils.jsm b/toolkit/components/passwordmgr/InsecurePasswordUtils.jsm index 91aadabdbcc2..7951a880c664 100644 --- a/toolkit/components/passwordmgr/InsecurePasswordUtils.jsm +++ b/toolkit/components/passwordmgr/InsecurePasswordUtils.jsm @@ -95,7 +95,7 @@ this.InsecurePasswordUtils = { let uri = Services.io.newURI( aForm.rootElement.action || aForm.rootElement.baseURI ); - let principal = gScriptSecurityManager.createCodebasePrincipal(uri, {}); + let principal = gScriptSecurityManager.createContentPrincipal(uri, {}); if (uri.schemeIs("http")) { isFormSubmitHTTP = true; diff --git a/toolkit/components/passwordmgr/test/browser/browser_hasInsecureLoginForms_streamConverter.js b/toolkit/components/passwordmgr/test/browser/browser_hasInsecureLoginForms_streamConverter.js index 2edf71cb2e94..8fabfc256956 100644 --- a/toolkit/components/passwordmgr/test/browser/browser_hasInsecureLoginForms_streamConverter.js +++ b/toolkit/components/passwordmgr/test/browser/browser_hasInsecureLoginForms_streamConverter.js @@ -39,7 +39,7 @@ function registerConverter() { }); channel.originalURI = aRequest.QueryInterface(Ci.nsIChannel).URI; channel.loadGroup = aRequest.loadGroup; - channel.owner = Services.scriptSecurityManager.createCodebasePrincipal( + channel.owner = Services.scriptSecurityManager.createContentPrincipal( channel.URI, {} ); diff --git a/toolkit/components/passwordmgr/test/unit/test_LoginManagerParent_doAutocompleteSearch.js b/toolkit/components/passwordmgr/test/unit/test_LoginManagerParent_doAutocompleteSearch.js index b38d14a5a179..0191889f077f 100644 --- a/toolkit/components/passwordmgr/test/unit/test_LoginManagerParent_doAutocompleteSearch.js +++ b/toolkit/components/passwordmgr/test/unit/test_LoginManagerParent_doAutocompleteSearch.js @@ -47,7 +47,7 @@ add_task(async function test_doAutocompleteSearch_generated_noLogins() { .callsFake(() => { return { currentWindowGlobal: { - documentPrincipal: Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + documentPrincipal: Services.scriptSecurityManager.createContentPrincipalFromOrigin( "https://www.example.com^userContextId=1" ), }, diff --git a/toolkit/components/passwordmgr/test/unit/test_LoginManagerParent_getGeneratedPassword.js b/toolkit/components/passwordmgr/test/unit/test_LoginManagerParent_getGeneratedPassword.js index 2bf057395b97..c88e24f32372 100644 --- a/toolkit/components/passwordmgr/test/unit/test_LoginManagerParent_getGeneratedPassword.js +++ b/toolkit/components/passwordmgr/test/unit/test_LoginManagerParent_getGeneratedPassword.js @@ -35,7 +35,7 @@ add_task(async function test_getGeneratedPassword() { .callsFake(() => { return { currentWindowGlobal: { - documentPrincipal: Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + documentPrincipal: Services.scriptSecurityManager.createContentPrincipalFromOrigin( "https://www.example.com^userContextId=6" ), }, @@ -72,7 +72,7 @@ add_task(async function test_getGeneratedPassword() { .callsFake(() => { return { currentWindowGlobal: { - documentPrincipal: Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + documentPrincipal: Services.scriptSecurityManager.createContentPrincipalFromOrigin( "https://www.mozilla.org^userContextId=2" ), }, diff --git a/toolkit/components/passwordmgr/test/unit/test_LoginManagerParent_onGeneratedPasswordFilled.js b/toolkit/components/passwordmgr/test/unit/test_LoginManagerParent_onGeneratedPasswordFilled.js index 2ef4cd7b75f1..51adf608f28b 100644 --- a/toolkit/components/passwordmgr/test/unit/test_LoginManagerParent_onGeneratedPasswordFilled.js +++ b/toolkit/components/passwordmgr/test/unit/test_LoginManagerParent_onGeneratedPasswordFilled.js @@ -43,7 +43,7 @@ add_task(async function test_onGeneratedPasswordFilled() { .callsFake(() => { return { currentWindowGlobal: { - documentPrincipal: Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + documentPrincipal: Services.scriptSecurityManager.createContentPrincipalFromOrigin( "https://www.example.com^userContextId=6" ), }, diff --git a/toolkit/components/reader/ReaderMode.jsm b/toolkit/components/reader/ReaderMode.jsm index bf298d575010..c4e1e1729295 100644 --- a/toolkit/components/reader/ReaderMode.jsm +++ b/toolkit/components/reader/ReaderMode.jsm @@ -116,7 +116,7 @@ var ReaderMode = { let referrerURI, principal; try { referrerURI = Services.io.newURI(url); - principal = Services.scriptSecurityManager.createCodebasePrincipal( + principal = Services.scriptSecurityManager.createContentPrincipal( referrerURI, win.document.nodePrincipal.originAttributes ); diff --git a/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm b/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm index 281b74ba6d04..f7cc002116ca 100644 --- a/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm +++ b/toolkit/components/remotebrowserutils/RemoteWebNavigation.jsm @@ -119,7 +119,7 @@ RemoteWebNavigation.prototype = { ? 1 : 0, }; - principal = Services.scriptSecurityManager.createCodebasePrincipal( + principal = Services.scriptSecurityManager.createContentPrincipal( uri, attrs ); diff --git a/toolkit/components/reputationservice/ApplicationReputation.cpp b/toolkit/components/reputationservice/ApplicationReputation.cpp index 2c97e58d7c3b..e4203f071d1f 100644 --- a/toolkit/components/reputationservice/ApplicationReputation.cpp +++ b/toolkit/components/reputationservice/ApplicationReputation.cpp @@ -780,7 +780,7 @@ nsresult PendingDBLookup::LookupSpecInternal(const nsACString& aSpec) { OriginAttributes attrs; nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(uri, attrs); + BasePrincipal::CreateContentPrincipal(uri, attrs); if (!principal) { return NS_ERROR_FAILURE; } diff --git a/toolkit/components/reputationservice/test/unit/test_app_rep.js b/toolkit/components/reputationservice/test/unit/test_app_rep.js index fea4b5b87858..925d9c3a2cd5 100644 --- a/toolkit/components/reputationservice/test/unit/test_app_rep.js +++ b/toolkit/components/reputationservice/test/unit/test_app_rep.js @@ -347,13 +347,13 @@ add_test(function test_redirect_on_blocklist() { let redirect1 = { QueryInterface: ChromeUtils.generateQI([Ci.nsIRedirectHistoryEntry]), - principal: secman.createCodebasePrincipal(exampleURI, {}), + principal: secman.createContentPrincipal(exampleURI, {}), }; badRedirects.appendElement(redirect1); let redirect2 = { QueryInterface: ChromeUtils.generateQI([Ci.nsIRedirectHistoryEntry]), - principal: secman.createCodebasePrincipal(blocklistedURI, {}), + principal: secman.createContentPrincipal(blocklistedURI, {}), }; badRedirects.appendElement(redirect2); @@ -361,7 +361,7 @@ add_test(function test_redirect_on_blocklist() { // whitelist (i.e. it will match NO_LIST). let redirect3 = { QueryInterface: ChromeUtils.generateQI([Ci.nsIRedirectHistoryEntry]), - principal: secman.createCodebasePrincipal(whitelistedURI, {}), + principal: secman.createContentPrincipal(whitelistedURI, {}), }; badRedirects.appendElement(redirect3); @@ -454,7 +454,7 @@ add_test(function test_whitelisted_redirect() { let redirect1 = { QueryInterface: ChromeUtils.generateQI([Ci.nsIRedirectHistoryEntry]), - principal: secman.createCodebasePrincipal(exampleURI, {}), + principal: secman.createContentPrincipal(exampleURI, {}), }; okayRedirects.appendElement(redirect1); @@ -462,7 +462,7 @@ add_test(function test_whitelisted_redirect() { // whitelist (i.e. it will match NO_LIST). let redirect2 = { QueryInterface: ChromeUtils.generateQI([Ci.nsIRedirectHistoryEntry]), - principal: secman.createCodebasePrincipal(whitelistedURI, {}), + principal: secman.createContentPrincipal(whitelistedURI, {}), }; okayRedirects.appendElement(redirect2); @@ -499,7 +499,7 @@ add_test(function test_remote_lookup_protocolbuf() { let redirects = Cc["@mozilla.org/array;1"].createInstance(Ci.nsIMutableArray); let redirect1 = { QueryInterface: ChromeUtils.generateQI([Ci.nsIRedirectHistoryEntry]), - principal: secman.createCodebasePrincipal(exampleRedirectURI, {}), + principal: secman.createContentPrincipal(exampleRedirectURI, {}), }; redirects.appendElement(redirect1); diff --git a/toolkit/components/search/SearchEngine.jsm b/toolkit/components/search/SearchEngine.jsm index 15c04a6ce361..f64f24bf20d4 100644 --- a/toolkit/components/search/SearchEngine.jsm +++ b/toolkit/components/search/SearchEngine.jsm @@ -2250,7 +2250,7 @@ SearchEngine.prototype = { let callbacks = options.window.docShell.QueryInterface(Ci.nsILoadContext); - // Using the codebase principal which is constructed by the search URI + // Using the content principal which is constructed by the search URI // and given originAttributes. If originAttributes are not given, we // fallback to use the docShell's originAttributes. let attrs = options.originAttributes; @@ -2259,7 +2259,7 @@ SearchEngine.prototype = { attrs = options.window.docShell.getOriginAttributes(); } - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( searchURI, attrs ); diff --git a/toolkit/components/sessionstore/SessionStoreUtils.cpp b/toolkit/components/sessionstore/SessionStoreUtils.cpp index c70ffc66b49c..55eda8244bf3 100644 --- a/toolkit/components/sessionstore/SessionStoreUtils.cpp +++ b/toolkit/components/sessionstore/SessionStoreUtils.cpp @@ -1104,7 +1104,7 @@ void SessionStoreUtils::RestoreSessionStorage( // OriginAttributes are always after a '^' character int32_t pos = entry.mKey.RFindChar('^'); - nsCOMPtr principal = BasePrincipal::CreateCodebasePrincipal( + nsCOMPtr principal = BasePrincipal::CreateContentPrincipal( NS_ConvertUTF16toUTF8(Substring(entry.mKey, 0, pos))); nsresult rv; nsCOMPtr storageManager = diff --git a/toolkit/components/url-classifier/tests/mochitest/test_classifier.html b/toolkit/components/url-classifier/tests/mochitest/test_classifier.html index ceef5884c0e7..6d5eba3dc291 100644 --- a/toolkit/components/url-classifier/tests/mochitest/test_classifier.html +++ b/toolkit/components/url-classifier/tests/mochitest/test_classifier.html @@ -94,7 +94,7 @@ function testService() { let test = testURLs.shift(); let tables = "test-malware-simple,test-unwanted-simple,moztest-phish-simple,test-block-simple,test-harmful-simple"; let uri = SpecialPowers.Services.io.newURI(test.url); - let prin = SpecialPowers.Services.scriptSecurityManager.createCodebasePrincipal(uri, {}); + let prin = SpecialPowers.Services.scriptSecurityManager.createContentPrincipal(uri, {}); SpecialPowers.doUrlClassify(prin, null, function(errorCode) { is(errorCode, test.result, `Successful asynchronous classification of ${test.url}`); diff --git a/toolkit/components/url-classifier/tests/mochitest/test_classifier_match.html b/toolkit/components/url-classifier/tests/mochitest/test_classifier_match.html index 2843984caded..04a281891906 100644 --- a/toolkit/components/url-classifier/tests/mochitest/test_classifier_match.html +++ b/toolkit/components/url-classifier/tests/mochitest/test_classifier_match.html @@ -153,7 +153,7 @@ function runTest() { } let test = testDatas.shift(); let uri = SpecialPowers.Services.io.newURI(test.url); - let prin = SpecialPowers.Services.scriptSecurityManager.createCodebasePrincipal(uri, {}); + let prin = SpecialPowers.Services.scriptSecurityManager.createContentPrincipal(uri, {}); SpecialPowers.doUrlClassify(prin, null, function(errorCode, table, provider, fullhash) { is(errorCode, test.expect.error, `Test url ${test.url} correct error`); is(table, test.expect.table, `Test url ${test.url} correct table`); diff --git a/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js b/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js index d66492dd5e6e..d2a6fa913725 100644 --- a/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js +++ b/toolkit/components/url-classifier/tests/unit/head_urlclassifier.js @@ -271,7 +271,7 @@ var gAssertions = { if (urls.length > 0) { var tables = useMoz ? mozTables : allTables; var fragment = urls.shift(); - var principal = Services.scriptSecurityManager.createCodebasePrincipal( + var principal = Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI("http://" + fragment), {} ); @@ -292,7 +292,7 @@ var gAssertions = { }, checkTables(url, expected, cb) { - var principal = Services.scriptSecurityManager.createCodebasePrincipal( + var principal = Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI("http://" + url), {} ); diff --git a/toolkit/components/url-classifier/tests/unit/test_dbservice.js b/toolkit/components/url-classifier/tests/unit/test_dbservice.js index a9c35f34fcd1..fc67061da249 100644 --- a/toolkit/components/url-classifier/tests/unit/test_dbservice.js +++ b/toolkit/components/url-classifier/tests/unit/test_dbservice.js @@ -86,7 +86,7 @@ function checkNoHost() { // Looking up a no-host uri such as a data: uri should throw an exception. var exception; try { - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI("data:text/html,test"), {} ); @@ -198,7 +198,7 @@ function checkState() { numExpecting = 0; for (let key in phishExpected) { - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI("http://" + key), {} ); @@ -207,7 +207,7 @@ function checkState() { } for (let key in phishUnexpected) { - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI("http://" + key), {} ); @@ -216,7 +216,7 @@ function checkState() { } for (let key in malwareExpected) { - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI("http://" + key), {} ); @@ -225,7 +225,7 @@ function checkState() { } for (let key in unwantedExpected) { - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI("http://" + key), {} ); @@ -234,7 +234,7 @@ function checkState() { } for (let key in blockedExpected) { - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI("http://" + key), {} ); diff --git a/toolkit/components/url-classifier/tests/unit/test_digest256.js b/toolkit/components/url-classifier/tests/unit/test_digest256.js index 0716689eb03b..602be0d73a62 100644 --- a/toolkit/components/url-classifier/tests/unit/test_digest256.js +++ b/toolkit/components/url-classifier/tests/unit/test_digest256.js @@ -125,7 +125,7 @@ add_test(function test_update() { add_test(function test_url_not_whitelisted() { let uri = Services.io.newURI("http://example.com"); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); @@ -144,7 +144,7 @@ add_test(function test_url_whitelisted() { // Hash of "whitelisted.com/" (canonicalized URL) is: // 93CA5F48E15E9861CD37C2D95DB43D23CC6E6DE5C3F8FA6E8BE66F97CC518907 let uri = Services.io.newURI("http://whitelisted.com"); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( uri, {} ); diff --git a/toolkit/components/url-classifier/tests/unit/test_shouldclassify.js b/toolkit/components/url-classifier/tests/unit/test_shouldclassify.js index ec4438974993..811cfcd8a517 100644 --- a/toolkit/components/url-classifier/tests/unit/test_shouldclassify.js +++ b/toolkit/components/url-classifier/tests/unit/test_shouldclassify.js @@ -99,7 +99,7 @@ function setupChannel(params) { contentPolicyType: params.contentType, }); } else { - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( NetUtil.newURI(trackingOrigin), {} ); diff --git a/toolkit/components/viewsource/content/viewSourceUtils.js b/toolkit/components/viewsource/content/viewSourceUtils.js index ec0656f996aa..da271d6d8d97 100644 --- a/toolkit/components/viewsource/content/viewSourceUtils.js +++ b/toolkit/components/viewsource/content/viewSourceUtils.js @@ -246,7 +246,7 @@ var gViewSourceUtils = { webBrowserPersist.progressListener = this.viewSourceProgressListener; let referrerPolicy = Ci.nsIHttpChannel.REFERRER_POLICY_NO_REFERRER; let ssm = Services.scriptSecurityManager; - let principal = ssm.createCodebasePrincipal( + let principal = ssm.createContentPrincipal( data.uri, browser.contentPrincipal.originAttributes ); diff --git a/toolkit/content/contentAreaUtils.js b/toolkit/content/contentAreaUtils.js index e8e60d46eb67..11f3e8290b5a 100644 --- a/toolkit/content/contentAreaUtils.js +++ b/toolkit/content/contentAreaUtils.js @@ -233,7 +233,7 @@ function saveBrowser(aBrowser, aSkipPrompt, aOuterWindowID = 0) { aBrowser.contentPrincipal.URI.spec == "resource://pdf.js/web/viewer.html" && aBrowser.currentURI.schemeIs("file") ) { - let correctPrincipal = Services.scriptSecurityManager.createCodebasePrincipal( + let correctPrincipal = Services.scriptSecurityManager.createContentPrincipal( aBrowser.currentURI, aBrowser.contentPrincipal.originAttributes ); diff --git a/toolkit/content/widgets/browser-custom-element.js b/toolkit/content/widgets/browser-custom-element.js index 3bc4494fdd63..e52b1061502a 100644 --- a/toolkit/content/widgets/browser-custom-element.js +++ b/toolkit/content/widgets/browser-custom-element.js @@ -1228,7 +1228,7 @@ ); let aboutBlank = Services.io.newURI("about:blank"); let ssm = Services.scriptSecurityManager; - this._contentPrincipal = ssm.getLoadContextCodebasePrincipal( + this._contentPrincipal = ssm.getLoadContextContentPrincipal( aboutBlank, this.loadContext ); diff --git a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js index f3c8c9dbab6a..95c5987c7711 100644 --- a/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js +++ b/toolkit/forgetaboutsite/test/unit/test_removeDataFromDomain.js @@ -143,7 +143,7 @@ function check_login_exists(aHost, aExists) { */ function add_permission(aURI) { check_permission_exists(aURI, false); - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( aURI, {} ); @@ -161,7 +161,7 @@ function add_permission(aURI) { * True if the permission should exist, false otherwise. */ function check_permission_exists(aURI, aExists) { - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( aURI, {} ); @@ -375,7 +375,7 @@ async function test_content_preferences_not_cleared_with_uri_contains_domain() { function push_registration_exists(aURL, ps) { return new Promise(resolve => { - let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin( aURL ); return ps.getSubscription(aURL, principal, (status, record) => { @@ -482,7 +482,7 @@ async function test_cache_cleared() { async function test_storage_cleared() { function getStorageForURI(aURI) { - let principal = Services.scriptSecurityManager.createCodebasePrincipal( + let principal = Services.scriptSecurityManager.createContentPrincipal( aURI, {} ); diff --git a/toolkit/modules/BrowserUtils.jsm b/toolkit/modules/BrowserUtils.jsm index d98a52d1d69f..011da42c828d 100644 --- a/toolkit/modules/BrowserUtils.jsm +++ b/toolkit/modules/BrowserUtils.jsm @@ -93,17 +93,17 @@ var BrowserUtils = { }, /** - * Return or create a principal with the codebase of one, and the originAttributes + * Return or create a principal with the content of one, and the originAttributes * of an existing principal (e.g. on a docshell, where the originAttributes ought * not to change, that is, we should keep the userContextId, privateBrowsingId, * etc. the same when changing the principal). * * @param principal - * The principal whose codebase/null/system-ness we want. + * The principal whose content/null/system-ness we want. * @param existingPrincipal * The principal whose originAttributes we want, usually the current * principal of a docshell. - * @return an nsIPrincipal that matches the codebase/null/system-ness of the first + * @return an nsIPrincipal that matches the content/null/system-ness of the first * param, and the originAttributes of the second. */ principalWithMatchingOA(principal, existingPrincipal) { @@ -118,8 +118,8 @@ var BrowserUtils = { } let secMan = Services.scriptSecurityManager; - if (principal.isCodebasePrincipal) { - return secMan.createCodebasePrincipal( + if (principal.isContentPrincipal) { + return secMan.createContentPrincipal( principal.URI, existingPrincipal.originAttributes ); diff --git a/toolkit/modules/E10SUtils.jsm b/toolkit/modules/E10SUtils.jsm index f6a871f5a039..5f777df98d79 100644 --- a/toolkit/modules/E10SUtils.jsm +++ b/toolkit/modules/E10SUtils.jsm @@ -123,7 +123,7 @@ function validatedWebRemoteType( // If we're within a fission window, extract site information from the URI in // question, and use it to generate an isolated origin. if (aRemoteSubframes) { - let targetPrincipal = sm.createCodebasePrincipal(aTargetUri, {}); + let targetPrincipal = sm.createContentPrincipal(aTargetUri, {}); return "webIsolated=" + targetPrincipal.siteOrigin; } @@ -436,9 +436,9 @@ var E10SUtils = { // We might care about the currently loaded URI. Pull it out of our current // principal. We never care about the current URI when working with a - // non-codebase principal. + // non-content principal. let currentURI = - aCurrentPrincipal && aCurrentPrincipal.isCodebasePrincipal + aCurrentPrincipal && aCurrentPrincipal.isContentPrincipal ? aCurrentPrincipal.URI : null; return E10SUtils.getRemoteTypeForURIObject( diff --git a/toolkit/modules/PermissionsUtils.jsm b/toolkit/modules/PermissionsUtils.jsm index fbc009d206b8..ad293ecb023d 100644 --- a/toolkit/modules/PermissionsUtils.jsm +++ b/toolkit/modules/PermissionsUtils.jsm @@ -24,7 +24,7 @@ function importPrefBranch(aPrefBranch, aPermission, aAction) { let principals = []; try { principals = [ - Services.scriptSecurityManager.createCodebasePrincipalFromOrigin( + Services.scriptSecurityManager.createContentPrincipalFromOrigin( origin ), ]; @@ -37,11 +37,8 @@ function importPrefBranch(aPrefBranch, aPermission, aAction) { let httpsURI = Services.io.newURI("https://" + origin); principals = [ - Services.scriptSecurityManager.createCodebasePrincipal(httpURI, {}), - Services.scriptSecurityManager.createCodebasePrincipal( - httpsURI, - {} - ), + Services.scriptSecurityManager.createContentPrincipal(httpURI, {}), + Services.scriptSecurityManager.createContentPrincipal(httpsURI, {}), ]; } catch (e2) {} } diff --git a/toolkit/modules/tests/modules/MockDocument.jsm b/toolkit/modules/tests/modules/MockDocument.jsm index 1f803c8461d5..dcb3a8834031 100644 --- a/toolkit/modules/tests/modules/MockDocument.jsm +++ b/toolkit/modules/tests/modules/MockDocument.jsm @@ -67,7 +67,7 @@ const MockDocument = { mockNodePrincipalProperty(aElement, aURL) { Object.defineProperty(aElement, "nodePrincipal", { - value: Services.scriptSecurityManager.createCodebasePrincipal( + value: Services.scriptSecurityManager.createContentPrincipal( Services.io.newURI(aURL), {} ), diff --git a/toolkit/mozapps/extensions/AddonContentPolicy.cpp b/toolkit/mozapps/extensions/AddonContentPolicy.cpp index 2992085dc866..705073cfde75 100644 --- a/toolkit/mozapps/extensions/AddonContentPolicy.cpp +++ b/toolkit/mozapps/extensions/AddonContentPolicy.cpp @@ -395,7 +395,7 @@ AddonContentPolicy::ValidateAddonCSP(const nsAString& aPolicyString, } RefPtr principal = - BasePrincipal::CreateCodebasePrincipal(NS_ConvertUTF16toUTF8(url)); + BasePrincipal::CreateContentPrincipal(NS_ConvertUTF16toUTF8(url)); nsCOMPtr selfURI; principal->GetURI(getter_AddRefs(selfURI)); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_permissions.js b/toolkit/mozapps/extensions/test/xpcshell/test_permissions.js index cbfb5311a4e6..5147ad63d36a 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_permissions.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_permissions.js @@ -8,7 +8,7 @@ const XPI_MIMETYPE = "application/x-xpinstall"; function newPrincipal(uri) { - return Services.scriptSecurityManager.createCodebasePrincipal( + return Services.scriptSecurityManager.createContentPrincipal( NetUtil.newURI(uri), {} ); diff --git a/toolkit/mozapps/extensions/test/xpcshell/test_permissions_prefs.js b/toolkit/mozapps/extensions/test/xpcshell/test_permissions_prefs.js index 9d59354e149d..f764a9a2eaea 100644 --- a/toolkit/mozapps/extensions/test/xpcshell/test_permissions_prefs.js +++ b/toolkit/mozapps/extensions/test/xpcshell/test_permissions_prefs.js @@ -9,7 +9,7 @@ const PREF_XPI_WHITELIST_PERMISSIONS = "xpinstall.whitelist.add"; const PREF_XPI_BLACKLIST_PERMISSIONS = "xpinstall.blacklist.add"; function newPrincipal(uri) { - return Services.scriptSecurityManager.createCodebasePrincipal( + return Services.scriptSecurityManager.createContentPrincipal( NetUtil.newURI(uri), {} ); diff --git a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp index de46de49ed94..09d4085a474b 100644 --- a/uriloader/prefetch/nsOfflineCacheUpdateService.cpp +++ b/uriloader/prefetch/nsOfflineCacheUpdateService.cpp @@ -605,7 +605,7 @@ nsOfflineCacheUpdateService::OfflineAppAllowedForURI(nsIURI* aURI, bool* aAllowed) { OriginAttributes attrs; nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(aURI, attrs); + BasePrincipal::CreateContentPrincipal(aURI, attrs); return OfflineAppPermForPrincipal(principal, aPrefBranch, false, aAllowed); } @@ -613,7 +613,7 @@ nsresult nsOfflineCacheUpdateService::OfflineAppPinnedForURI( nsIURI* aDocumentURI, nsIPrefBranch* aPrefBranch, bool* aPinned) { OriginAttributes attrs; nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(aDocumentURI, attrs); + BasePrincipal::CreateContentPrincipal(aDocumentURI, attrs); return OfflineAppPermForPrincipal(principal, aPrefBranch, true, aPinned); } diff --git a/widget/android/nsAppShell.cpp b/widget/android/nsAppShell.cpp index 189dac983e55..e57d107048ac 100644 --- a/widget/android/nsAppShell.cpp +++ b/widget/android/nsAppShell.cpp @@ -139,7 +139,7 @@ class GeckoThreadSupport final OriginAttributes attrs; nsCOMPtr principal = - BasePrincipal::CreateCodebasePrincipal(uri, attrs); + BasePrincipal::CreateContentPrincipal(uri, attrs); specConn->SpeculativeConnect(uri, principal, nullptr); }