mirror of
https://github.com/mozilla/gecko-dev.git
synced 2025-02-14 04:03:47 +00:00
Merge mozilla-central to inbound. a=merge CLOSED TREE
This commit is contained in:
commit
aebbfd69ea
@ -146,7 +146,6 @@ modules/brotli/.*
|
||||
modules/fdlibm/.*
|
||||
modules/freetype2/.*
|
||||
modules/libbz2/.*
|
||||
modules/libmar/.*
|
||||
modules/pdfium/.*
|
||||
modules/woff2/.*
|
||||
modules/xz-embedded/.*
|
||||
|
1
.hgtags
1
.hgtags
@ -164,3 +164,4 @@ f4c23517cec8626038a915bfe3bc7c0e1f6af55d FIREFOX_BETA_67_BASE
|
||||
97dae745c1b3ef2292127ba1c4e90b1345c8f576 FIREFOX_NIGHTLY_68_END
|
||||
adc59d50adf815ad6764ff235f833a5ba74291b6 FIREFOX_BETA_69_BASE
|
||||
b7030ce607ec56690829e8fb6dbcd27dd54a044c PRE_TREEWIDE_PRETTIER_FORMAT
|
||||
e596664275d5e3e2fdcb7fa8d1447289f99269c3 FIREFOX_NIGHTLY_69_END
|
||||
|
@ -293,14 +293,18 @@ tasks:
|
||||
then:
|
||||
cron: {$json: {$eval: 'cron'}}
|
||||
- tasks_for: '${tasks_for}'
|
||||
# Email format for try pushes
|
||||
- $if: 'tasks_for == "hg-push" && repository.project == "try"'
|
||||
# Email for all pushes should link to treeherder
|
||||
- $if: 'tasks_for == "hg-push"'
|
||||
then:
|
||||
notify:
|
||||
email:
|
||||
subject: "Thank you for your try submission of ${push.revision}. It's the best!"
|
||||
content: "Your try push has been submitted. It's the best! Use the link to view the status of your jobs."
|
||||
link:
|
||||
text: "Treeherder Jobs"
|
||||
href: "https://treeherder.mozilla.org/#/jobs?repo=${repository.project}&revision=${push.revision}"
|
||||
$merge:
|
||||
- link:
|
||||
text: "Treeherder Jobs"
|
||||
href: "https://treeherder.mozilla.org/#/jobs?repo=${repository.project}&revision=${push.revision}"
|
||||
# Email for try pushes should thank you for your revision
|
||||
- $if: 'repository.project == "try"'
|
||||
then:
|
||||
subject: "Thank you for your try submission of ${push.revision}. It's the best!"
|
||||
content: "Your try push has been submitted. It's the best! Use the link to view the status of your jobs."
|
||||
|
||||
|
2
CLOBBER
2
CLOBBER
@ -22,4 +22,4 @@
|
||||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Bug 1555661 - Clobber due to search engine file removals (bug 1552120)
|
||||
Merge day clobber
|
18
Cargo.lock
generated
18
Cargo.lock
generated
@ -750,7 +750,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "cssparser"
|
||||
version = "0.25.5"
|
||||
version = "0.25.7"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cssparser-macros 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1193,7 +1193,7 @@ name = "geckoservo"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.25.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.51 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -1712,7 +1712,7 @@ name = "malloc_size_of"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.25.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hashglobe 0.1.0",
|
||||
"selectors 0.21.0",
|
||||
@ -2688,7 +2688,7 @@ name = "selectors"
|
||||
version = "0.21.0"
|
||||
dependencies = [
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.25.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fxhash 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -2903,7 +2903,7 @@ dependencies = [
|
||||
"bindgen 0.49.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.25.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"derive_more 0.13.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fallible 0.0.1",
|
||||
@ -2965,7 +2965,7 @@ version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.25.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.19.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"lazy_static 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
@ -2981,7 +2981,7 @@ name = "stylo_tests"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.25.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"geckoservo 0.0.1",
|
||||
@ -3127,7 +3127,7 @@ dependencies = [
|
||||
name = "to_shmem"
|
||||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.25.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"servo_arc 0.1.1",
|
||||
"smallbitvec 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.6.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
@ -3901,7 +3901,7 @@ dependencies = [
|
||||
"checksum crossbeam-epoch 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "04c9e3102cc2d69cd681412141b390abd55a362afc1540965dad0ad4d34280b4"
|
||||
"checksum crossbeam-utils 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)" = "2760899e32a1d58d5abb31129f8fae5de75220bc2176e77ff7c627ae45c918d9"
|
||||
"checksum crossbeam-utils 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)" = "f8306fcef4a7b563b76b7dd949ca48f52bc1141aa067d2ea09565f3e2652aa5c"
|
||||
"checksum cssparser 0.25.5 (registry+https://github.com/rust-lang/crates.io-index)" = "e06795910fc2f585a75bdc9690fbcc51e83519f07b6eb981db43944643c04933"
|
||||
"checksum cssparser 0.25.7 (registry+https://github.com/rust-lang/crates.io-index)" = "a921abc45ea75c2c817d951caeda31b94539d09a6b5e8d58a857b3b35c9c3894"
|
||||
"checksum cssparser-macros 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b16e382d9b983fdb9ac6a36b37fdeb84ce3ea81f749febfee3463cfa7f24275e"
|
||||
"checksum cstr 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b6557bdb1dc9647eae1cf7f5601b14cd45fc3c7ccf2df618387416fe542da6ea"
|
||||
"checksum cstr-macros 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "0f12dd847ec773fc98d75edba5394cb87d0f35e7ee548a4c81849ca6374b3d48"
|
||||
|
@ -1,5 +1,5 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<blocklist lastupdate="1562061250280" xmlns="http://www.mozilla.org/2006/addons-blocklist">
|
||||
<blocklist lastupdate="1562577903535" xmlns="http://www.mozilla.org/2006/addons-blocklist">
|
||||
<emItems>
|
||||
<emItem blockID="i334" id="{0F827075-B026-42F3-885D-98981EE7B1AE}">
|
||||
<prefs/>
|
||||
@ -3285,6 +3285,18 @@
|
||||
<prefs/>
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3"/>
|
||||
</emItem>
|
||||
<emItem blockID="7f55f27d-37e5-4c3e-bd9d-02924496ba3d" id="/^((\{fc2dbae0-1ab3-40fe-9a38-cbee911b903e\})|(\{82e3e07c-0cf3-4b9f-a625-65d378698af3\})|(\{2904a7ee-0b54-4adb-a500-b932b77b6936\})|(\{f6932562-1f6d-4779-b5a4-f4c4654980dd\})|(\{97f0cc0f-69cf-4e5a-af68-f404aa3f1ce5\})|(\{c346f3ce-08bc-44b7-9410-bd8ad65f32d5\})|(\{f68f3bd2-ece8-4a85-b071-cea253cd78ac\})|(\{d9b6a925-e00c-4e36-a282-e6b76833e5b5\})|(\{e8a67ebd-655e-48f9-99e7-619c850f6bcc\})|(\{15942451-8c62-457f-8ff1-8525ce647c0d\})|(\{8fcdb966-eec2-4cd0-865e-1d105e9b59e2\})|(\{6ae58312-7d81-4d39-84f1-454ae6ace826\})|(\{023cd859-1b7c-4384-80e5-eca82c68a21c\})|(\{694e912f-011f-4be4-add9-25c85af8014d\})|(\{b889539e-4b8c-4e52-a605-a0b33532fd05\})|(\{596c6d7c-49ab-440e-a50d-220e5db393f7\})|(\{f0fd5c9c-1fcd-4085-ac41-47c379517420\})|(\{545dbede-b51c-477b-b23b-936dd5e7a428\})|(\{c3f9f4e6-b5ed-49fb-82c6-313b9617cddb\})|(\{309908bd-c2fe-4066-82c5-0631571e77fc\})|(\{75f93037-6366-4f88-b92b-c3174d68a836\})|(\{36e57809-88bb-47ef-9b6c-90170bb753d5\})|(\{da83ef9e-f36a-4416-a4ab-29a09c981690\})|(\{09e50933-f19f-435a-8e6a-7663715ea3fc\})|(\{7f35f6f3-714d-4c0d-befa-5a6843c62b6f\})|(\{b3b3f9c6-6b64-47d0-bf5a-f9796d1d7cfc\})|(\{116c6521-bda8-469c-9ca6-0702860aca67\})|(\{98566ed5-4c57-4da4-946f-03beeaa6145b\})|(\{8fc257d4-612c-4196-9688-dd7de0979c44\})|(\{9b7f873c-cf3f-4d8d-9cd2-3c68ce0f831f\}))$/">
|
||||
<prefs/>
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3"/>
|
||||
</emItem>
|
||||
<emItem blockID="f8e35175-572a-4b00-b5d3-9c8df255f1ec" id="/^((\{6d0887bd-1f51-4852-9307-cf2a223c3a9a\})|(\{4cb2b177-e2a2-4ae1-b759-03606a85df61\})|(\{df28b68e-ad39-4300-add2-b2dc8bf54f71\})|(\{eff0a5d5-3f53-4b75-b451-5acffd5bb61d\})|(\{7561d328-6b59-449a-bf7a-46fea5027be4\})|(\{854246c0-f678-44ff-85f3-f340f33c5da9\})|(\{9e976e36-9eb7-44bd-97a3-4901ab3e1021\})|(\{2e9a0a60-8423-4ffc-89ef-74a02ca8c5e8\})|(\{a5e298c3-2d74-4268-8d13-e0efcb77d896\})|(\{39838189-7836-432f-9a34-a009886a61f8\})|(\{a3f781a4-adc7-4a12-9812-20da06e7b6d9\})|(\{365b3845-1e12-4096-80f1-8be24456d741\})|(\{701511ef-2e5a-458f-b735-c789b7ae6feb\})|(\{888807df-4517-4b97-ac73-e4294865e375\})|(\{ea7c7094-9d83-416d-bd13-e85fcef481a5\})|(\{1f67e4bd-6eb6-4fd7-a694-b8b360494cc3\})|(\{4f9520a5-caa6-4832-9582-2b26b8739305\})|(\{06f5112b-da03-481b-bef1-bf752ddbe7a2\}))$/">
|
||||
<prefs/>
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3"/>
|
||||
</emItem>
|
||||
<emItem blockID="04c27082-2b78-4005-a6c5-8e0a13f83288" id="/^((\{0b47ef96-f7c9-4017-97b6-51c1280eaf6e\})|(\{2c65ed54-5215-4f10-a7bd-39445a6450fd\})|(\{80dbc30a-168b-4a18-bd5b-51f9b1807d7f\})|(\{93a106e3-e70b-48af-9282-30e3d6c87af9\})|(\{2120dc72-6040-45ed-9655-aaabed57fc93\})|(\{c3c9f1ee-4192-4d5a-b753-a62c19b16c98\})|(\{d0fc8cf9-66aa-4f08-8c96-3f882c2e9c9b\})|(\{da69b9e2-c2d1-4b90-93be-4cc3976e452d\})|(\{eb70585e-76bb-4eae-9f06-7fc5efbc877e\})|(fairshare-unlock@burstworks-test\.com)|(fairshare-unlock@burstworks\.com)|(freevideodownloader-hosted@funnerapps\.com)|(freevideodownloader-test-hosted@funnerapps\.com)|(gmo-panel@ddmr\.com)|(helper-sig@savefrom\.net)|(ihmgiclibbndffejedjimfjmfoabpcke@chrome-store-foxified-\d+)|(ihmgiclibbndffejedjimfjmfoabpcke@chromeStoreFoxified-\d+)|(panel-branded@ddmr\.com)|(panel-canadaTalkNow@ddmr\.com)|(panel-community@ddmr\.com)|(panel-digaYgane@ddmr\.com)|(panel-ecglobal@ddmr\.com)|(panel-fusionCash@ddmr\.com)|(panel-grindaBuck@ddmr\.com)|(panel-measurement@ddmr\.com)|(panel-mysoapbox@ddmr\.com)|(panel-ofernation@ddmr\.com)|(panel-rewarding@ddmr\.com)|(panel-superpay@ddmr\.com)|(panel-zippy@ddmr\.com)|(test_fairshare-unlock@burstworks\.com)|(test-fairshare-unlock@burstworks\.com)|(vindale@ddmr\.com))$/">
|
||||
<prefs/>
|
||||
<versionRange minVersion="0" maxVersion="*" severity="3"/>
|
||||
</emItem>
|
||||
</emItems>
|
||||
<pluginItems>
|
||||
<pluginItem blockID="p332">
|
||||
|
@ -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
|
||||
|
@ -8314,7 +8314,7 @@ var CanvasPermissionPromptHelper = {
|
||||
1
|
||||
);
|
||||
|
||||
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
|
||||
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
aData
|
||||
);
|
||||
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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 }
|
||||
);
|
||||
|
@ -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,
|
||||
{}
|
||||
);
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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(
|
||||
|
@ -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,
|
||||
{}
|
||||
);
|
||||
|
@ -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,
|
||||
{}
|
||||
);
|
||||
|
@ -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,
|
||||
{}
|
||||
);
|
||||
|
@ -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),
|
||||
{}
|
||||
);
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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 => {
|
||||
|
@ -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,
|
||||
{}
|
||||
);
|
||||
|
@ -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,
|
||||
{}
|
||||
);
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -272,6 +272,7 @@ add_task(async function checkAllTheFluents() {
|
||||
{}
|
||||
);
|
||||
let domParser = new DOMParser();
|
||||
domParser.forceEnableDTD();
|
||||
for (let uri of uris) {
|
||||
let rawContents = await fetchFile(uri.spec);
|
||||
let resource = FluentResource.fromString(rawContents);
|
||||
|
@ -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(
|
||||
|
@ -41,10 +41,6 @@ add_task(async function setup() {
|
||||
.getHistogramById("TRACKING_PROTECTION_ENABLED")
|
||||
.snapshot().values;
|
||||
is(enabledCounts[0], 1, "TP was not enabled on start up");
|
||||
|
||||
let scalars = Services.telemetry.getSnapshotForScalars("main", false).parent;
|
||||
|
||||
is(scalars["contentblocking.exceptions"], 0, "no CB exceptions at startup");
|
||||
});
|
||||
|
||||
add_task(async function testShieldHistogram() {
|
||||
|
@ -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:
|
||||
|
@ -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,
|
||||
{}
|
||||
);
|
||||
|
@ -454,7 +454,6 @@ XPCOMUtils.defineLazyGetter(
|
||||
// lazy module getters
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetters(this, {
|
||||
AboutCertViewerHandler: "resource://gre/modules/AboutCertViewerHandler.jsm",
|
||||
AboutNetErrorHandler:
|
||||
"resource:///modules/aboutpages/AboutNetErrorHandler.jsm",
|
||||
AboutPrivateBrowsingHandler:
|
||||
@ -1614,8 +1613,6 @@ BrowserGlue.prototype = {
|
||||
|
||||
NewTabUtils.init();
|
||||
|
||||
AboutCertViewerHandler.init();
|
||||
|
||||
AboutNetErrorHandler.init();
|
||||
|
||||
AboutPrivateBrowsingHandler.init();
|
||||
@ -1736,14 +1733,6 @@ BrowserGlue.prototype = {
|
||||
);
|
||||
Services.telemetry.getHistogramById("COOKIE_BEHAVIOR").add(cookieBehavior);
|
||||
|
||||
let exceptions = 0;
|
||||
for (let permission of Services.perms.enumerator) {
|
||||
if (permission.type == "trackingprotection") {
|
||||
exceptions++;
|
||||
}
|
||||
}
|
||||
Services.telemetry.scalarSet("contentblocking.exceptions", exceptions);
|
||||
|
||||
let fpEnabled = Services.prefs.getBoolPref(
|
||||
"privacy.trackingprotection.fingerprinting.enabled"
|
||||
);
|
||||
@ -1829,7 +1818,6 @@ BrowserGlue.prototype = {
|
||||
|
||||
PageThumbs.uninit();
|
||||
NewTabUtils.uninit();
|
||||
AboutCertViewerHandler.uninit();
|
||||
AboutNetErrorHandler.uninit();
|
||||
AboutPrivateBrowsingHandler.uninit();
|
||||
AboutProtectionsHandler.uninit();
|
||||
|
@ -69,14 +69,16 @@ const convertSubjectToLogin = subject => {
|
||||
return augmentVanillaLoginObject(login);
|
||||
};
|
||||
|
||||
const SCHEME_REGEX = new RegExp(/^http(s)?:\/\//);
|
||||
const SUBDOMAIN_REGEX = new RegExp(/^www\d*\./);
|
||||
const augmentVanillaLoginObject = login => {
|
||||
let title;
|
||||
try {
|
||||
title = new URL(login.origin).host;
|
||||
} catch (ex) {
|
||||
title = login.origin;
|
||||
title = login.origin.replace(SCHEME_REGEX, "");
|
||||
}
|
||||
title = title.replace(/^http(s)?:\/\//, "").replace(/^www\d*\./, "");
|
||||
title = title.replace(SUBDOMAIN_REGEX, "");
|
||||
return Object.assign({}, login, {
|
||||
title,
|
||||
});
|
||||
|
@ -25,6 +25,10 @@ login-filter {
|
||||
align-self: center;
|
||||
}
|
||||
|
||||
menu-button {
|
||||
margin-inline-start: 18px;
|
||||
}
|
||||
|
||||
login-list {
|
||||
grid-area: logins;
|
||||
}
|
||||
@ -39,11 +43,6 @@ login-item {
|
||||
margin-inline-end: 18px;
|
||||
}
|
||||
|
||||
#create-login-button {
|
||||
margin-inline-start: 18px;
|
||||
margin-inline-end: 18px;
|
||||
}
|
||||
|
||||
#branding-logo {
|
||||
-moz-context-properties: fill;
|
||||
fill: #20123a;
|
||||
|
@ -11,7 +11,7 @@ about-logins-page-title = Logins & Passwords
|
||||
login-filter =
|
||||
.placeholder = Search Logins
|
||||
|
||||
create-login-button = New Login
|
||||
create-login-button = Create New Login
|
||||
|
||||
## The ⋯ menu that is in the top corner of the page
|
||||
menu =
|
||||
|
@ -25,7 +25,6 @@
|
||||
<header>
|
||||
<img id="branding-logo" src="chrome://branding/content/aboutlogins.svg" alt=""/>
|
||||
<login-filter></login-filter>
|
||||
<button id="create-login-button" data-l10n-id="create-login-button"></button>
|
||||
<menu-button></menu-button>
|
||||
</header>
|
||||
<login-list></login-list>
|
||||
@ -70,14 +69,14 @@
|
||||
</div>
|
||||
<ol role="listbox" tabindex="0" data-l10n-id="login-list">
|
||||
</ol>
|
||||
<button class="create-login-button" data-l10n-id="create-login-button"></button>
|
||||
</template>
|
||||
|
||||
<template id="login-list-item-template">
|
||||
<link rel="stylesheet" href="chrome://global/skin/in-content/common.css">
|
||||
<link rel="stylesheet" href="chrome://browser/content/aboutlogins/common.css">
|
||||
<link rel="stylesheet" href="chrome://browser/content/aboutlogins/components/login-list-item.css">
|
||||
<span class="title"></span>
|
||||
<span class="username"></span>
|
||||
<li class="login-list-item">
|
||||
<span class="title"></span>
|
||||
<span class="username"></span>
|
||||
</li>
|
||||
</template>
|
||||
|
||||
<template id="login-item-template">
|
||||
|
@ -2,8 +2,6 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import { recordTelemetryEvent } from "./aboutLoginsUtils.js";
|
||||
|
||||
let gElements = {};
|
||||
|
||||
document.addEventListener(
|
||||
@ -12,18 +10,12 @@ document.addEventListener(
|
||||
gElements.loginList = document.querySelector("login-list");
|
||||
gElements.loginItem = document.querySelector("login-item");
|
||||
gElements.loginFilter = document.querySelector("login-filter");
|
||||
gElements.newLoginButton = document.querySelector("#create-login-button");
|
||||
|
||||
let { searchParams } = new URL(document.location);
|
||||
if (searchParams.get("filter")) {
|
||||
gElements.loginFilter.value = searchParams.get("filter");
|
||||
}
|
||||
|
||||
gElements.newLoginButton.addEventListener("click", () => {
|
||||
window.dispatchEvent(new CustomEvent("AboutLoginsCreateLogin"));
|
||||
recordTelemetryEvent({ object: "new_login", method: "new" });
|
||||
});
|
||||
|
||||
document.dispatchEvent(
|
||||
new CustomEvent("AboutLoginsInit", { bubbles: true })
|
||||
);
|
||||
|
@ -1,42 +0,0 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
:host {
|
||||
display: block;
|
||||
padding: 10px;
|
||||
padding-inline-end: 18px;
|
||||
padding-inline-start: 14px;
|
||||
border-inline-start: 4px solid transparent;
|
||||
border-bottom: 1px solid var(--in-content-box-border-color);
|
||||
}
|
||||
|
||||
:host(:hover) {
|
||||
background-color: var(--in-content-box-background-hover);
|
||||
}
|
||||
|
||||
:host(:hover:active) {
|
||||
background-color: var(--in-content-box-background-active);
|
||||
}
|
||||
|
||||
:host(.keyboard-selected) {
|
||||
border-inline-start-color: var(--in-content-border-active-shadow);
|
||||
background-color: var(--in-content-box-background-odd);
|
||||
}
|
||||
|
||||
:host(.selected) {
|
||||
border-inline-start-color: var(--in-content-border-highlight);
|
||||
background-color: var(--in-content-box-background-hover);
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.title,
|
||||
.username {
|
||||
display: block;
|
||||
max-width: 50ch;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
@ -2,96 +2,49 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import { recordTelemetryEvent } from "../aboutLoginsUtils.js";
|
||||
|
||||
export default class LoginListItem extends HTMLElement {
|
||||
constructor(login) {
|
||||
super();
|
||||
this._login = login;
|
||||
this.id = login.guid
|
||||
? // Prepend the ID with a string since IDs must not begin with a number.
|
||||
"lli-" + this._login.guid
|
||||
: "new-login-list-item";
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
if (this.shadowRoot) {
|
||||
this.render();
|
||||
return;
|
||||
}
|
||||
|
||||
/**
|
||||
* LoginListItemFactory is used instead of the "login-list-item" custom element
|
||||
* since there may be 100s of login-list-items on about:logins and each
|
||||
* custom element carries with it significant overhead when used in large
|
||||
* numbers.
|
||||
*/
|
||||
export default class LoginListItemFactory {
|
||||
static create(login) {
|
||||
let loginListItemTemplate = document.querySelector(
|
||||
"#login-list-item-template"
|
||||
);
|
||||
let shadowRoot = this.attachShadow({ mode: "open" });
|
||||
document.l10n.connectRoot(shadowRoot);
|
||||
shadowRoot.appendChild(loginListItemTemplate.content.cloneNode(true));
|
||||
let loginListItem = loginListItemTemplate.content.cloneNode(true);
|
||||
let listItem = loginListItem.querySelector("li");
|
||||
let title = loginListItem.querySelector(".title");
|
||||
let username = loginListItem.querySelector(".username");
|
||||
|
||||
this._title = this.shadowRoot.querySelector(".title");
|
||||
this._username = this.shadowRoot.querySelector(".username");
|
||||
this.setAttribute("role", "option");
|
||||
listItem.setAttribute("role", "option");
|
||||
|
||||
this.addEventListener("click", this);
|
||||
|
||||
this.render();
|
||||
}
|
||||
|
||||
render() {
|
||||
if (!this._login.guid) {
|
||||
delete this.dataset.guid;
|
||||
if (!login.guid) {
|
||||
listItem.id = "new-login-list-item";
|
||||
document.l10n.setAttributes(title, "login-list-item-title-new-login");
|
||||
document.l10n.setAttributes(
|
||||
this._title,
|
||||
"login-list-item-title-new-login"
|
||||
);
|
||||
document.l10n.setAttributes(
|
||||
this._username,
|
||||
username,
|
||||
"login-list-item-subtitle-new-login"
|
||||
);
|
||||
return;
|
||||
return listItem;
|
||||
}
|
||||
|
||||
this.dataset.guid = this._login.guid;
|
||||
this._title.textContent = this._login.title;
|
||||
if (this._login.username.trim()) {
|
||||
this._username.removeAttribute("data-l10n-id");
|
||||
this._username.textContent = this._login.username.trim();
|
||||
// Prepend the ID with a string since IDs must not begin with a number.
|
||||
listItem.id = "lli-" + login.guid;
|
||||
listItem.dataset.guid = login.guid;
|
||||
listItem._login = login;
|
||||
title.textContent = login.title;
|
||||
if (login.username.trim()) {
|
||||
username.removeAttribute("data-l10n-id");
|
||||
username.textContent = login.username.trim();
|
||||
} else {
|
||||
document.l10n.setAttributes(
|
||||
this._username,
|
||||
username,
|
||||
"login-list-item-subtitle-missing-username"
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
handleEvent(event) {
|
||||
switch (event.type) {
|
||||
case "click": {
|
||||
if (!this._login.guid) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.dispatchEvent(
|
||||
new CustomEvent("AboutLoginsLoginSelected", {
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
detail: this._login,
|
||||
})
|
||||
);
|
||||
|
||||
recordTelemetryEvent({ object: "existing_login", method: "select" });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Updates the cached login object with new values.
|
||||
*
|
||||
* @param {login} login The login object to display. The login object is
|
||||
* a plain JS object representation of nsILoginInfo/nsILoginMetaInfo.
|
||||
*/
|
||||
update(login) {
|
||||
this._login = login;
|
||||
this.render();
|
||||
return listItem;
|
||||
}
|
||||
}
|
||||
customElements.define("login-list-item", LoginListItem);
|
||||
|
@ -30,4 +30,49 @@ ol {
|
||||
margin-bottom: 0;
|
||||
padding-inline-start: 0;
|
||||
overflow: hidden auto;
|
||||
flex-grow: 1;
|
||||
box-shadow: inset 0 -10px 10px -10px var(--grey-90-a20);
|
||||
}
|
||||
|
||||
.create-login-button {
|
||||
margin: 18px;
|
||||
}
|
||||
|
||||
.login-list-item {
|
||||
display: block;
|
||||
padding: 10px;
|
||||
padding-inline-end: 18px;
|
||||
padding-inline-start: 14px;
|
||||
border-inline-start: 4px solid transparent;
|
||||
border-bottom: 1px solid var(--in-content-box-border-color);
|
||||
}
|
||||
|
||||
.login-list-item:hover {
|
||||
background-color: var(--in-content-box-background-hover);
|
||||
}
|
||||
|
||||
.login-list-item:hover:active {
|
||||
background-color: var(--in-content-box-background-active);
|
||||
}
|
||||
|
||||
.login-list-item.keyboard-selected {
|
||||
border-inline-start-color: var(--in-content-border-active-shadow);
|
||||
background-color: var(--in-content-box-background-odd);
|
||||
}
|
||||
|
||||
.login-list-item.selected {
|
||||
border-inline-start-color: var(--in-content-border-highlight);
|
||||
background-color: var(--in-content-box-background-hover);
|
||||
}
|
||||
|
||||
.title {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.title,
|
||||
.username {
|
||||
display: block;
|
||||
max-width: 50ch;
|
||||
text-overflow: ellipsis;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
@ -2,7 +2,8 @@
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
import LoginListItem from "./login-list-item.js";
|
||||
import LoginListItemFactory from "./login-list-item.js";
|
||||
import { recordTelemetryEvent } from "../aboutLoginsUtils.js";
|
||||
|
||||
const collator = new Intl.Collator();
|
||||
const sortFnOptions = {
|
||||
@ -17,7 +18,7 @@ export default class LoginList extends HTMLElement {
|
||||
this._logins = [];
|
||||
this._filter = "";
|
||||
this._selectedGuid = null;
|
||||
this._blankLoginListItem = new LoginListItem({});
|
||||
this._blankLoginListItem = LoginListItemFactory.create({});
|
||||
}
|
||||
|
||||
connectedCallback() {
|
||||
@ -29,9 +30,10 @@ export default class LoginList extends HTMLElement {
|
||||
document.l10n.connectRoot(shadowRoot);
|
||||
shadowRoot.appendChild(loginListTemplate.content.cloneNode(true));
|
||||
|
||||
this._count = this.shadowRoot.querySelector(".count");
|
||||
this._list = this.shadowRoot.querySelector("ol");
|
||||
this._sortSelect = this.shadowRoot.querySelector("#login-sort");
|
||||
this._count = shadowRoot.querySelector(".count");
|
||||
this._createLoginButton = shadowRoot.querySelector(".create-login-button");
|
||||
this._list = shadowRoot.querySelector("ol");
|
||||
this._sortSelect = shadowRoot.querySelector("#login-sort");
|
||||
|
||||
this.render();
|
||||
|
||||
@ -40,10 +42,11 @@ export default class LoginList extends HTMLElement {
|
||||
.addEventListener("change", this);
|
||||
window.addEventListener("AboutLoginsClearSelection", this);
|
||||
window.addEventListener("AboutLoginsCreateLogin", this);
|
||||
window.addEventListener("AboutLoginsInitialLoginSelected", this);
|
||||
window.addEventListener("AboutLoginsLoginSelected", this);
|
||||
window.addEventListener("AboutLoginsFilterLogins", this);
|
||||
this._list.addEventListener("click", this);
|
||||
this.addEventListener("keydown", this);
|
||||
this._createLoginButton.addEventListener("click", this);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -52,7 +55,7 @@ export default class LoginList extends HTMLElement {
|
||||
* createLogin: When set to true will show and select
|
||||
* a blank login-list-item.
|
||||
*/
|
||||
render(options = {}) {
|
||||
async render(options = {}) {
|
||||
this._list.textContent = "";
|
||||
|
||||
if (options.createLogin) {
|
||||
@ -62,7 +65,9 @@ export default class LoginList extends HTMLElement {
|
||||
"aria-activedescendant",
|
||||
this._blankLoginListItem.id
|
||||
);
|
||||
this._list.append(this._blankLoginListItem);
|
||||
this._list.appendChild(this._blankLoginListItem);
|
||||
} else {
|
||||
this._blankLoginListItem.remove();
|
||||
}
|
||||
|
||||
if (!this._logins.length) {
|
||||
@ -72,24 +77,62 @@ export default class LoginList extends HTMLElement {
|
||||
return;
|
||||
}
|
||||
|
||||
for (let login of this._logins) {
|
||||
let listItem = new LoginListItem(login);
|
||||
if (login.guid == this._selectedGuid) {
|
||||
listItem.classList.add("selected");
|
||||
listItem.setAttribute("aria-selected", "true");
|
||||
this._list.setAttribute("aria-activedescendant", listItem.id);
|
||||
}
|
||||
this._list.append(listItem);
|
||||
}
|
||||
|
||||
let visibleLoginCount = this._applyFilter();
|
||||
let visibleLogins = this._applyFilter();
|
||||
document.l10n.setAttributes(this._count, "login-list-count", {
|
||||
count: visibleLoginCount,
|
||||
count: visibleLogins.length,
|
||||
});
|
||||
|
||||
let fragment = document.createDocumentFragment();
|
||||
let chunkSize = 5;
|
||||
for (let i = 0; i < this._logins.length; i++) {
|
||||
let login = this._logins[i];
|
||||
let listItem = LoginListItemFactory.create(login);
|
||||
if (login.guid == this._selectedGuid) {
|
||||
this._setListItemAsSelected(listItem);
|
||||
}
|
||||
|
||||
if (!visibleLogins.includes(login.guid)) {
|
||||
listItem.hidden = true;
|
||||
}
|
||||
|
||||
fragment.appendChild(listItem);
|
||||
|
||||
// Display a first chunk of logins ASAP to improve perceived performance,
|
||||
// then append progressively larger chunks until complete.
|
||||
if (i == chunkSize) {
|
||||
this._list.appendChild(fragment);
|
||||
await new Promise(resolve => requestAnimationFrame(resolve));
|
||||
chunkSize *= chunkSize;
|
||||
}
|
||||
}
|
||||
this._list.appendChild(fragment);
|
||||
}
|
||||
|
||||
handleEvent(event) {
|
||||
switch (event.type) {
|
||||
case "click": {
|
||||
if (event.originalTarget == this._createLoginButton) {
|
||||
window.dispatchEvent(new CustomEvent("AboutLoginsCreateLogin"));
|
||||
recordTelemetryEvent({ object: "new_login", method: "new" });
|
||||
return;
|
||||
}
|
||||
|
||||
let loginListItem = event.originalTarget.closest(".login-list-item");
|
||||
if (!loginListItem || !loginListItem.dataset.guid) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.dispatchEvent(
|
||||
new CustomEvent("AboutLoginsLoginSelected", {
|
||||
bubbles: true,
|
||||
composed: true,
|
||||
detail: loginListItem._login,
|
||||
})
|
||||
);
|
||||
|
||||
recordTelemetryEvent({ object: "existing_login", method: "select" });
|
||||
break;
|
||||
}
|
||||
case "change": {
|
||||
const sort = this._sortSelect.value;
|
||||
this._logins = this._logins.sort((a, b) => sortFnOptions[sort](a, b));
|
||||
@ -117,14 +160,19 @@ export default class LoginList extends HTMLElement {
|
||||
this.render();
|
||||
break;
|
||||
}
|
||||
case "AboutLoginsInitialLoginSelected":
|
||||
case "AboutLoginsLoginSelected": {
|
||||
if (this._selectedGuid == event.detail.guid) {
|
||||
return;
|
||||
}
|
||||
|
||||
this._selectedGuid = event.detail.guid;
|
||||
this.render();
|
||||
let listItem = this._list.querySelector(
|
||||
`.login-list-item[data-guid="${event.detail.guid}"]`
|
||||
);
|
||||
if (listItem) {
|
||||
this._setListItemAsSelected(listItem);
|
||||
} else {
|
||||
this.render();
|
||||
}
|
||||
break;
|
||||
}
|
||||
case "keydown": {
|
||||
@ -149,13 +197,15 @@ export default class LoginList extends HTMLElement {
|
||||
!this._logins.findIndex(login => login.guid == this._selectedGuid) != -1
|
||||
) {
|
||||
// Select the first visible login after any possible filter is applied.
|
||||
let firstVisibleLogin = this._list.querySelector(
|
||||
"login-list-item[data-guid]:not([hidden])"
|
||||
let firstVisibleListItem = this._list.querySelector(
|
||||
".login-list-item[data-guid]:not([hidden])"
|
||||
);
|
||||
if (firstVisibleLogin) {
|
||||
if (firstVisibleListItem) {
|
||||
this._selectedGuid = firstVisibleListItem.dataset.guid;
|
||||
this._setListItemAsSelected(firstVisibleListItem);
|
||||
window.dispatchEvent(
|
||||
new CustomEvent("AboutLoginsInitialLoginSelected", {
|
||||
detail: firstVisibleLogin._login,
|
||||
detail: firstVisibleListItem._login,
|
||||
})
|
||||
);
|
||||
}
|
||||
@ -213,25 +263,28 @@ export default class LoginList extends HTMLElement {
|
||||
matchingLoginGuids = this._logins.map(login => login.guid);
|
||||
}
|
||||
|
||||
for (let listItem of this._list.querySelectorAll("login-list-item")) {
|
||||
if (!listItem.dataset.guid) {
|
||||
// Don't hide the 'New Login' item if it is present.
|
||||
continue;
|
||||
}
|
||||
if (matchingLoginGuids.includes(listItem.dataset.guid)) {
|
||||
if (listItem.hidden) {
|
||||
listItem.hidden = false;
|
||||
}
|
||||
} else if (!listItem.hidden) {
|
||||
listItem.hidden = true;
|
||||
}
|
||||
}
|
||||
|
||||
return matchingLoginGuids.length;
|
||||
return matchingLoginGuids;
|
||||
}
|
||||
|
||||
_handleKeyboardNav(event) {
|
||||
if (this._list != this.shadowRoot.activeElement) {
|
||||
if (
|
||||
this._createLoginButton == this.shadowRoot.activeElement &&
|
||||
event.key == "Tab"
|
||||
) {
|
||||
// Bug 1562716: Pressing Tab from the create-login-button cycles back to the
|
||||
// login-sort dropdown due to the login-list having `overflow`
|
||||
// CSS property set. Explicitly forward focus here until
|
||||
// this keyboard trap is fixed.
|
||||
if (event.shiftKey) {
|
||||
return;
|
||||
}
|
||||
let loginItem = document.querySelector("login-item");
|
||||
if (loginItem) {
|
||||
event.preventDefault();
|
||||
loginItem.shadowRoot.querySelector(".edit-button").focus();
|
||||
}
|
||||
return;
|
||||
} else if (this._list != this.shadowRoot.activeElement) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -278,21 +331,6 @@ export default class LoginList extends HTMLElement {
|
||||
newlyFocusedItem = previousItem;
|
||||
break;
|
||||
}
|
||||
case "Tab": {
|
||||
// Bug 1562716: Pressing Tab from the login-list cycles back to the
|
||||
// login-sort dropdown due to the login-list having `overflow`
|
||||
// CSS property set. Explicitly forward focus here until
|
||||
// this keyboard trap is fixed.
|
||||
if (event.shiftKey) {
|
||||
return;
|
||||
}
|
||||
let loginItem = document.querySelector("login-item");
|
||||
if (loginItem) {
|
||||
event.preventDefault();
|
||||
loginItem.shadowRoot.querySelector(".edit-button").focus();
|
||||
}
|
||||
return;
|
||||
}
|
||||
case " ":
|
||||
case "Enter": {
|
||||
event.preventDefault();
|
||||
@ -308,5 +346,20 @@ export default class LoginList extends HTMLElement {
|
||||
newlyFocusedItem.classList.add("keyboard-selected");
|
||||
newlyFocusedItem.scrollIntoView(false);
|
||||
}
|
||||
|
||||
_setListItemAsSelected(listItem) {
|
||||
let oldSelectedItem = this._list.querySelector(".selected");
|
||||
if (oldSelectedItem) {
|
||||
oldSelectedItem.classList.remove("selected");
|
||||
oldSelectedItem.removeAttribute("aria-selected");
|
||||
}
|
||||
if (listItem.dataset.guid) {
|
||||
this._blankLoginListItem.remove();
|
||||
}
|
||||
listItem.classList.add("selected");
|
||||
listItem.setAttribute("aria-selected", "true");
|
||||
this._list.setAttribute("aria-activedescendant", listItem.id);
|
||||
this._selectedGuid = listItem.dataset.guid;
|
||||
}
|
||||
}
|
||||
customElements.define("login-list", LoginList);
|
||||
|
@ -11,7 +11,6 @@ browser.jar:
|
||||
content/browser/aboutlogins/components/login-item.js (content/components/login-item.js)
|
||||
content/browser/aboutlogins/components/login-list.css (content/components/login-list.css)
|
||||
content/browser/aboutlogins/components/login-list.js (content/components/login-list.js)
|
||||
content/browser/aboutlogins/components/login-list-item.css (content/components/login-list-item.css)
|
||||
content/browser/aboutlogins/components/login-list-item.js (content/components/login-list-item.js)
|
||||
content/browser/aboutlogins/components/menu-button.css (content/components/menu-button.css)
|
||||
content/browser/aboutlogins/components/menu-button.js (content/components/menu-button.js)
|
||||
|
@ -51,7 +51,7 @@ add_task(async function test_telemetry_events() {
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
|
||||
let loginList = content.document.querySelector("login-list");
|
||||
let loginListItem = loginList.shadowRoot.querySelector(
|
||||
"login-list-item:nth-child(2)"
|
||||
".login-list-item:nth-child(2)"
|
||||
);
|
||||
loginListItem.click();
|
||||
});
|
||||
@ -111,7 +111,9 @@ add_task(async function test_telemetry_events() {
|
||||
await waitForTelemetryEventCount(6);
|
||||
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
|
||||
let newLoginButton = content.document.querySelector("#create-login-button");
|
||||
let newLoginButton = content.document
|
||||
.querySelector("login-list")
|
||||
.shadowRoot.querySelector(".create-login-button");
|
||||
newLoginButton.click();
|
||||
});
|
||||
await waitForTelemetryEventCount(7);
|
||||
@ -126,7 +128,7 @@ add_task(async function test_telemetry_events() {
|
||||
await ContentTask.spawn(gBrowser.selectedBrowser, null, async function() {
|
||||
let loginList = content.document.querySelector("login-list");
|
||||
let loginListItem = loginList.shadowRoot.querySelector(
|
||||
"login-list-item[data-guid]"
|
||||
".login-list-item[data-guid]"
|
||||
);
|
||||
loginListItem.click();
|
||||
});
|
||||
|
@ -34,7 +34,9 @@ add_task(async function test_create_login() {
|
||||
|
||||
let browser = gBrowser.selectedBrowser;
|
||||
await ContentTask.spawn(browser, originTuple, async aOriginTuple => {
|
||||
let createButton = content.document.querySelector("#create-login-button");
|
||||
let createButton = content.document
|
||||
.querySelector("login-list")
|
||||
.shadowRoot.querySelector(".create-login-button");
|
||||
createButton.click();
|
||||
await Promise.resolve();
|
||||
|
||||
@ -84,7 +86,7 @@ add_task(async function test_create_login() {
|
||||
ok(loginFound, "Expected number of logins found in login-list");
|
||||
|
||||
let loginListItem = [
|
||||
...loginList.shadowRoot.querySelectorAll("login-list-item"),
|
||||
...loginList.shadowRoot.querySelectorAll(".login-list-item"),
|
||||
].find(l => l._login.origin == aOriginTuple[1]);
|
||||
ok(
|
||||
!!loginListItem,
|
||||
|
@ -45,7 +45,7 @@ add_task(async function test_login_item() {
|
||||
await ContentTask.spawn(browser, [TEST_LOGIN1, TEST_LOGIN2], async logins => {
|
||||
let loginList = content.document.querySelector("login-list");
|
||||
let loginListItem = loginList.shadowRoot.querySelector(
|
||||
"login-list-item[data-guid]"
|
||||
".login-list-item[data-guid]"
|
||||
);
|
||||
info("Clicking on the first login");
|
||||
loginListItem.click();
|
||||
|
@ -71,10 +71,10 @@ add_task(async function test_query_parameter_filter() {
|
||||
);
|
||||
|
||||
let hiddenLoginListItems = loginList.shadowRoot.querySelectorAll(
|
||||
"login-list-item[hidden]"
|
||||
".login-list-item[hidden]"
|
||||
);
|
||||
let visibleLoginListItems = loginList.shadowRoot.querySelectorAll(
|
||||
"login-list-item:not([hidden])"
|
||||
".login-list-item:not([hidden])"
|
||||
);
|
||||
is(visibleLoginListItems.length, 1, "The one login should be visible");
|
||||
is(
|
||||
|
@ -34,7 +34,7 @@ add_task(async function test_login_item() {
|
||||
async login => {
|
||||
let loginList = content.document.querySelector("login-list");
|
||||
let loginListItem = Cu.waiveXrays(
|
||||
loginList.shadowRoot.querySelector("login-list-item[data-guid]")
|
||||
loginList.shadowRoot.querySelector(".login-list-item[data-guid]")
|
||||
);
|
||||
loginListItem.click();
|
||||
|
||||
@ -103,7 +103,7 @@ add_task(async function test_login_item() {
|
||||
);
|
||||
await ContentTaskUtils.waitForCondition(() => {
|
||||
loginListItem = Cu.waiveXrays(
|
||||
loginList.shadowRoot.querySelector("login-list-item")
|
||||
loginList.shadowRoot.querySelector(".login-list-item")
|
||||
);
|
||||
return (
|
||||
loginListItem._login.username == usernameInput.value &&
|
||||
@ -132,7 +132,7 @@ add_task(async function test_login_item() {
|
||||
|
||||
await ContentTaskUtils.waitForCondition(() => {
|
||||
loginListItem = Cu.waiveXrays(
|
||||
loginList.shadowRoot.querySelector("login-list-item")
|
||||
loginList.shadowRoot.querySelector(".login-list-item")
|
||||
);
|
||||
return !loginListItem;
|
||||
}, "Waiting for login to be removed from list");
|
||||
|
@ -74,13 +74,12 @@ add_task(async function test_empty_list() {
|
||||
add_task(async function test_keyboard_navigation() {
|
||||
gLoginList.setLogins([TEST_LOGIN_1, TEST_LOGIN_2, TEST_LOGIN_3]);
|
||||
|
||||
while (document.activeElement != gLoginList) {
|
||||
while (document.activeElement != gLoginList &&
|
||||
gLoginList.shadowRoot.querySelector("#login-sort") != gLoginList.shadowRoot.activeElement) {
|
||||
sendKey("TAB");
|
||||
await new Promise(resolve => requestAnimationFrame(resolve));
|
||||
}
|
||||
|
||||
sendKey("TAB");
|
||||
sendKey("TAB");
|
||||
let loginSort = gLoginList.shadowRoot.querySelector("#login-sort");
|
||||
await SimpleTest.promiseWaitForCondition(() => loginSort == gLoginList.shadowRoot.activeElement,
|
||||
"waiting for login-sort to get focus");
|
||||
@ -125,35 +124,33 @@ add_task(async function test_empty_login_username_in_list() {
|
||||
}));
|
||||
|
||||
gLoginList.setLogins([TEST_LOGIN_3]);
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
is(loginListItems.length, 1, "The one stored login should be displayed");
|
||||
is(loginListItems[0].dataset.guid, TEST_LOGIN_3.guid, "login-list-item should have correct guid attribute");
|
||||
|
||||
loginListItems[0].render();
|
||||
let loginUsername = loginListItems[0].shadowRoot.querySelector(".username");
|
||||
let loginUsername = loginListItems[0].querySelector(".username");
|
||||
is(loginUsername.getAttribute("data-l10n-id"), "login-list-item-subtitle-missing-username", "login should show missing username text");
|
||||
});
|
||||
|
||||
add_task(async function test_populated_list() {
|
||||
gLoginList.setLogins([TEST_LOGIN_1, TEST_LOGIN_2]);
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
is(loginListItems.length, 2, "The two stored logins should be displayed");
|
||||
is(loginListItems[0].dataset.guid, TEST_LOGIN_1.guid, "login-list-item should have correct guid attribute");
|
||||
is(loginListItems[0].shadowRoot.querySelector(".title").textContent, TEST_LOGIN_1.title,
|
||||
is(loginListItems[0].querySelector(".title").textContent, TEST_LOGIN_1.title,
|
||||
"login-list-item origin should match");
|
||||
is(loginListItems[0].shadowRoot.querySelector(".username").textContent, TEST_LOGIN_1.username,
|
||||
is(loginListItems[0].querySelector(".username").textContent, TEST_LOGIN_1.username,
|
||||
"login-list-item username should match");
|
||||
ok(loginListItems[0].classList.contains("selected"), "The first item should be selected by default");
|
||||
ok(!loginListItems[1].classList.contains("selected"), "The second item should not be selected by default");
|
||||
loginListItems[0].click();
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
is(loginListItems.length, 2, "After selecting one, only the two stored logins should be displayed");
|
||||
ok(loginListItems[0].classList.contains("selected"), "The first item should be selected");
|
||||
ok(!loginListItems[1].classList.contains("selected"), "The second item should still not be selected");
|
||||
});
|
||||
|
||||
add_task(async function test_filtered_list() {
|
||||
is(gLoginList.shadowRoot.querySelectorAll("login-list-item:not([hidden])").length, 2, "Both logins should be visible");
|
||||
is(gLoginList.shadowRoot.querySelectorAll(".login-list-item:not([hidden])").length, 2, "Both logins should be visible");
|
||||
let countSpan = gLoginList.shadowRoot.querySelector(".count");
|
||||
is(JSON.parse(countSpan.getAttribute("data-l10n-args")).count, 2, "Count should match full list length");
|
||||
window.dispatchEvent(new CustomEvent("AboutLoginsFilterLogins", {
|
||||
@ -161,8 +158,8 @@ add_task(async function test_filtered_list() {
|
||||
detail: "user1",
|
||||
}));
|
||||
is(JSON.parse(countSpan.getAttribute("data-l10n-args")).count, 1, "Count should match result amount");
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
is(loginListItems[0].shadowRoot.querySelector(".username").textContent, "user1", "user1 is expected first");
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
is(loginListItems[0].querySelector(".username").textContent, "user1", "user1 is expected first");
|
||||
ok(!loginListItems[0].hidden, "user1 should remain visible");
|
||||
ok(loginListItems[1].hidden, "user2 should be hidden");
|
||||
window.dispatchEvent(new CustomEvent("AboutLoginsFilterLogins", {
|
||||
@ -170,7 +167,7 @@ add_task(async function test_filtered_list() {
|
||||
detail: "user2",
|
||||
}));
|
||||
is(JSON.parse(countSpan.getAttribute("data-l10n-args")).count, 1, "Count should match result amount");
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
ok(loginListItems[0].hidden, "user1 should be hidden");
|
||||
ok(!loginListItems[1].hidden, "user2 should be visible");
|
||||
window.dispatchEvent(new CustomEvent("AboutLoginsFilterLogins", {
|
||||
@ -178,7 +175,7 @@ add_task(async function test_filtered_list() {
|
||||
detail: "user",
|
||||
}));
|
||||
is(JSON.parse(countSpan.getAttribute("data-l10n-args")).count, 2, "Count should match result amount");
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
ok(!loginListItems[0].hidden, "user1 should be visible");
|
||||
ok(!loginListItems[1].hidden, "user2 should be visible");
|
||||
window.dispatchEvent(new CustomEvent("AboutLoginsFilterLogins", {
|
||||
@ -186,7 +183,7 @@ add_task(async function test_filtered_list() {
|
||||
detail: "foo",
|
||||
}));
|
||||
is(JSON.parse(countSpan.getAttribute("data-l10n-args")).count, 0, "Count should match result amount");
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
ok(loginListItems[0].hidden, "user1 should be hidden");
|
||||
ok(loginListItems[1].hidden, "user2 should be hidden");
|
||||
window.dispatchEvent(new CustomEvent("AboutLoginsFilterLogins", {
|
||||
@ -194,7 +191,7 @@ add_task(async function test_filtered_list() {
|
||||
detail: "",
|
||||
}));
|
||||
is(JSON.parse(countSpan.getAttribute("data-l10n-args")).count, 2, "Count should be reset to full list length");
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
ok(!loginListItems[0].hidden, "user1 should be visible");
|
||||
ok(!loginListItems[1].hidden, "user2 should be visible");
|
||||
});
|
||||
@ -203,14 +200,14 @@ add_task(async function test_login_modified() {
|
||||
let modifiedLogin = Object.assign(TEST_LOGIN_1, {username: "user11"});
|
||||
gLoginList.loginModified(modifiedLogin);
|
||||
await asyncElementRendered();
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
is(loginListItems.length, 2, "Both logins should be displayed");
|
||||
is(loginListItems[0].dataset.guid, TEST_LOGIN_1.guid, "login-list-item should have correct guid attribute");
|
||||
is(loginListItems[0].shadowRoot.querySelector(".title").textContent, TEST_LOGIN_1.title,
|
||||
is(loginListItems[0].querySelector(".title").textContent, TEST_LOGIN_1.title,
|
||||
"login-list-item origin should match");
|
||||
is(loginListItems[0].shadowRoot.querySelector(".username").textContent, modifiedLogin.username,
|
||||
is(loginListItems[0].querySelector(".username").textContent, modifiedLogin.username,
|
||||
"login-list-item username should have been updated");
|
||||
is(loginListItems[1].shadowRoot.querySelector(".username").textContent, TEST_LOGIN_2.username,
|
||||
is(loginListItems[1].querySelector(".username").textContent, TEST_LOGIN_2.username,
|
||||
"login-list-item2 username should remain unchanged");
|
||||
});
|
||||
|
||||
@ -218,21 +215,21 @@ add_task(async function test_login_added() {
|
||||
let newLogin = Object.assign({}, TEST_LOGIN_1, {username: "user22", guid: "111222"});
|
||||
gLoginList.loginAdded(newLogin);
|
||||
await asyncElementRendered();
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
is(loginListItems.length, 3, "New login should be added to the list");
|
||||
is(loginListItems[0].dataset.guid, TEST_LOGIN_1.guid, "login-list-item1 should have correct guid attribute");
|
||||
is(loginListItems[1].dataset.guid, TEST_LOGIN_2.guid, "login-list-item2 should have correct guid attribute");
|
||||
is(loginListItems[2].dataset.guid, newLogin.guid, "login-list-item3 should have correct guid attribute");
|
||||
is(loginListItems[2].shadowRoot.querySelector(".title").textContent, newLogin.title,
|
||||
is(loginListItems[2].querySelector(".title").textContent, newLogin.title,
|
||||
"login-list-item origin should match");
|
||||
is(loginListItems[2].shadowRoot.querySelector(".username").textContent, newLogin.username,
|
||||
is(loginListItems[2].querySelector(".username").textContent, newLogin.username,
|
||||
"login-list-item username should have been updated");
|
||||
});
|
||||
|
||||
add_task(async function test_login_removed() {
|
||||
gLoginList.loginRemoved({guid: "111222"});
|
||||
await asyncElementRendered();
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
is(loginListItems.length, 2, "New login should be removed from the list");
|
||||
is(loginListItems[0].dataset.guid, TEST_LOGIN_1.guid, "login-list-item1 should have correct guid attribute");
|
||||
is(loginListItems[1].dataset.guid, TEST_LOGIN_2.guid, "login-list-item2 should have correct guid attribute");
|
||||
@ -251,7 +248,7 @@ add_task(async function test_login_added_filtered() {
|
||||
let newLogin = Object.assign({}, TEST_LOGIN_1, {username: "user22", guid: "111222"});
|
||||
gLoginList.loginAdded(newLogin);
|
||||
await asyncElementRendered();
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
is(loginListItems.length, 3, "New login should be added to the list");
|
||||
is(loginListItems[0].dataset.guid, TEST_LOGIN_1.guid, "login-list-item1 should have correct guid attribute");
|
||||
is(loginListItems[1].dataset.guid, TEST_LOGIN_2.guid, "login-list-item2 should have correct guid attribute");
|
||||
@ -270,7 +267,7 @@ add_task(async function test_sorted_list() {
|
||||
|
||||
// sort by last used
|
||||
gLoginList.shadowRoot.getElementById("login-sort").selectedIndex = 1;
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
let loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
is(loginListItems.length, 3, "The list should contain the three stored logins");
|
||||
let timeUsed = loginListItems[0]._login.timeLastUsed;
|
||||
let timeUsed2 = loginListItems[1]._login.timeLastUsed;
|
||||
@ -278,14 +275,14 @@ add_task(async function test_sorted_list() {
|
||||
|
||||
// sort by name
|
||||
gLoginList.shadowRoot.getElementById("login-sort").selectedIndex = 0;
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
let title = loginListItems[0]._login.title;
|
||||
let title2 = loginListItems[1]._login.title;
|
||||
is(title.localeCompare(title2), -1, "Logins should be sorted alphabetically by hostname");
|
||||
|
||||
// sort by last changed
|
||||
gLoginList.shadowRoot.getElementById("login-sort").selectedIndex = 2;
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll("login-list-item");
|
||||
loginListItems = gLoginList.shadowRoot.querySelectorAll(".login-list-item");
|
||||
let pwChanged = loginListItems[0]._login.timePasswordChanged;
|
||||
let pwChanged2 = loginListItems[1]._login.timePasswordChanged;
|
||||
is(pwChanged2 > pwChanged, true, "Login with most recently changed password should be displayed at top of list");
|
||||
|
@ -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,
|
||||
{}
|
||||
);
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -127,9 +127,9 @@ class _BookmarkPanelHub {
|
||||
|
||||
const createElement = elem =>
|
||||
target.document.createElementNS("http://www.w3.org/1999/xhtml", elem);
|
||||
|
||||
if (!target.container.querySelector("#cfrMessageContainer")) {
|
||||
const recommendation = createElement("div");
|
||||
let recommendation = target.container.querySelector("#cfrMessageContainer");
|
||||
if (!recommendation) {
|
||||
recommendation = createElement("div");
|
||||
const headerContainer = createElement("div");
|
||||
headerContainer.classList.add("cfrMessageHeader");
|
||||
recommendation.setAttribute("id", "cfrMessageContainer");
|
||||
@ -190,6 +190,41 @@ class _BookmarkPanelHub {
|
||||
}
|
||||
|
||||
this.toggleRecommendation(true);
|
||||
this._adjustPanelHeight(win, recommendation);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adjust the size of the container for locales where the message is
|
||||
* longer than the fixed 150px set for height
|
||||
*/
|
||||
async _adjustPanelHeight(window, messageContainer) {
|
||||
const { document } = window;
|
||||
// Contains the screenshot of the page we are bookmarking
|
||||
const screenshotContainer = document.getElementById(
|
||||
"editBookmarkPanelImage"
|
||||
);
|
||||
// Wait for strings to be added which can change element height
|
||||
await document.l10n.translateElements([messageContainer]);
|
||||
window.requestAnimationFrame(() => {
|
||||
let { height } = messageContainer.getBoundingClientRect();
|
||||
if (height > 150) {
|
||||
messageContainer.classList.add("longMessagePadding");
|
||||
// Get the new value with the added padding
|
||||
height = messageContainer.getBoundingClientRect().height;
|
||||
// Needs to be adjusted to match the message height
|
||||
screenshotContainer.style.height = `${height}px`;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Restore the panel back to the original size so the slide in
|
||||
* animation can run again
|
||||
*/
|
||||
_restorePanelHeight(window) {
|
||||
const { document } = window;
|
||||
// Contains the screenshot of the page we are bookmarking
|
||||
document.getElementById("editBookmarkPanelImage").style.height = "";
|
||||
}
|
||||
|
||||
toggleRecommendation(visible) {
|
||||
@ -224,6 +259,7 @@ class _BookmarkPanelHub {
|
||||
target || this._response.target
|
||||
).container.querySelector("#cfrMessageContainer");
|
||||
if (container) {
|
||||
this._restorePanelHeight(this._response.win);
|
||||
container.remove();
|
||||
}
|
||||
}
|
||||
@ -250,7 +286,7 @@ class _BookmarkPanelHub {
|
||||
// Remove any existing message
|
||||
this.hideMessage(panelTarget);
|
||||
// Reset the reference to the panel elements
|
||||
this._response = { target: panelTarget };
|
||||
this._response = { target: panelTarget, win };
|
||||
// Required if we want to preview messages that include fluent strings
|
||||
win.MozXULElement.insertFTLIfNeeded("browser/newtab/asrouter.ftl");
|
||||
win.MozXULElement.insertFTLIfNeeded("browser/branding/sync-brand.ftl");
|
||||
|
@ -68,7 +68,7 @@ function clearAllPlacesFavicons() {
|
||||
}
|
||||
|
||||
function observeFavicon(aFirstPartyDomain, aExpectedCookie, aPageURI) {
|
||||
let expectedPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(
|
||||
let expectedPrincipal = Services.scriptSecurityManager.createContentPrincipal(
|
||||
aPageURI,
|
||||
{ firstPartyDomain: aFirstPartyDomain }
|
||||
);
|
||||
|
@ -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 }
|
||||
);
|
||||
|
@ -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."
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -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."
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -6,4 +6,5 @@ support-files =
|
||||
../../../../../../browser/extensions/formautofill/content/editCreditCard.xhtml
|
||||
../../../../../../browser/extensions/formautofill/content/editAddress.xhtml
|
||||
|
||||
skip-if = true # Bug 1446164
|
||||
[test_editCreditCard.html]
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -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(
|
||||
|
@ -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,
|
||||
{}
|
||||
);
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -54,7 +54,7 @@ function observeFavicon(aIsPrivate, aExpectedCookie, aPageURI) {
|
||||
attr.privateBrowsingId = 1;
|
||||
}
|
||||
|
||||
let expectedPrincipal = Services.scriptSecurityManager.createCodebasePrincipal(
|
||||
let expectedPrincipal = Services.scriptSecurityManager.createContentPrincipal(
|
||||
aPageURI,
|
||||
attr
|
||||
);
|
||||
|
@ -215,32 +215,44 @@ input {
|
||||
display: none;
|
||||
}
|
||||
|
||||
label {
|
||||
#legend label {
|
||||
display: inline-block;
|
||||
margin: 0 0 -1px;
|
||||
padding: 15px 25px;
|
||||
font-weight: 600;
|
||||
text-align: center;
|
||||
border: 1px solid transparent;
|
||||
padding: 15px 23px;
|
||||
border: 3px solid transparent;
|
||||
-moz-context-properties: fill;
|
||||
background-repeat: no-repeat;
|
||||
background-position: left center;
|
||||
background-size: 16px;
|
||||
}
|
||||
|
||||
label[data-type="social"] {
|
||||
background-image: url(chrome://browser/skin/controlcenter/socialblock.svg);
|
||||
fill: var(--social-color);
|
||||
color: var(--social-color);
|
||||
}
|
||||
|
||||
label[data-type="crossSite"] {
|
||||
background-image: url(chrome://browser/skin/controlcenter/3rdpartycookies.svg);
|
||||
fill: var(--crossSite-color);
|
||||
color: var(--crossSite-color);
|
||||
}
|
||||
|
||||
label[data-type="tracker"] {
|
||||
background-image: url(chrome://browser/skin/controlcenter/trackers.svg);
|
||||
fill: var(--tracker-color);
|
||||
color: var(--tracker-color);
|
||||
}
|
||||
|
||||
label[data-type="fingerprinter"] {
|
||||
background-image: url(chrome://browser/skin/controlcenter/fingerprinters.svg);
|
||||
fill: var(--fingerprinter-color);
|
||||
color: var(--fingerprinter-color);
|
||||
}
|
||||
|
||||
label[data-type="cryptominer"] {
|
||||
background-image: url(chrome://browser/skin/controlcenter/cryptominers.svg);
|
||||
fill: var(--cryptominer-color);
|
||||
color: var(--cryptominer-color);
|
||||
}
|
||||
|
||||
@ -254,7 +266,7 @@ label:hover {
|
||||
cursor: pointer;
|
||||
}
|
||||
|
||||
input:checked + label {
|
||||
#legend input:checked + label {
|
||||
border-bottom: 3px solid var(--tab-highlight);
|
||||
}
|
||||
|
||||
|
@ -41,19 +41,19 @@
|
||||
<div id="graph"></div>
|
||||
<div id="legend">
|
||||
<input id="tab-social" data-type="social" type="radio" name="tabs" checked>
|
||||
<label for="tab-social" data-type="social">Social</label>
|
||||
<label for="tab-social" data-type="social">345</label>
|
||||
|
||||
<input id="tab-crossSite" data-type="crossSite" type="radio" name="tabs">
|
||||
<label for="tab-crossSite" data-type="crossSite">cross-site-tracker</label>
|
||||
<label for="tab-crossSite" data-type="crossSite">123</label>
|
||||
|
||||
<input id="tab-tracker" data-type="tracker" type="radio" name="tabs">
|
||||
<label for="tab-tracker" data-type="tracker">ad-tracker</label>
|
||||
<label for="tab-tracker" data-type="tracker">1</label>
|
||||
|
||||
<input id="tab-fingerprinter" data-type="fingerprinter" type="radio" name="tabs">
|
||||
<label for="tab-fingerprinter" data-type="fingerprinter">fingerprinter</label>
|
||||
<label for="tab-fingerprinter" data-type="fingerprinter">45666</label>
|
||||
|
||||
<input id="tab-cryptominer" data-type="cryptominer" type="radio" name="tabs">
|
||||
<label for="tab-cryptominer" data-type="cryptominer">cryptominer</label>
|
||||
<label for="tab-cryptominer" data-type="cryptominer">7</label>
|
||||
|
||||
<div id="social" class="tab-content">
|
||||
<p class="content-title">Social Media Trackers</p>
|
||||
|
@ -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),
|
||||
{}
|
||||
);
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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),
|
||||
{}
|
||||
),
|
||||
|
@ -1 +1 @@
|
||||
69.0a1
|
||||
70.0a1
|
||||
|
@ -1 +1 @@
|
||||
69.0a1
|
||||
70.0a1
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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
|
||||
);
|
||||
|
@ -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
|
||||
)
|
||||
);
|
||||
|
@ -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(
|
||||
|
@ -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);
|
||||
},
|
||||
|
@ -475,7 +475,7 @@ function prompt(aBrowser, aRequest) {
|
||||
requestTypes,
|
||||
} = aRequest;
|
||||
|
||||
let principal = Services.scriptSecurityManager.createCodebasePrincipalFromOrigin(
|
||||
let principal = Services.scriptSecurityManager.createContentPrincipalFromOrigin(
|
||||
aRequest.origin
|
||||
);
|
||||
|
||||
|
6
browser/themes/shared/controlcenter/socialblock.svg
Normal file
6
browser/themes/shared/controlcenter/socialblock.svg
Normal file
@ -0,0 +1,6 @@
|
||||
<!-- This Source Code Form is subject to the terms of the Mozilla Public
|
||||
- License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
- file, You can obtain one at http://mozilla.org/MPL/2.0/. -->
|
||||
<svg data-name="social-block" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16">
|
||||
<path fill="context-fill" fill-opacity="context-fill-opacity" d="M14.51 6.46a1.87 1.87 0 0 0-.57-2.29c.21-1.31-.59-1.78-1.91-2.12A14.6 14.6 0 0 0 9.71 2c-1.43 0-2.71.19-4.18.25S2.49 2 1 2v6h3a3.65 3.65 0 0 1 .83.66.61.61 0 0 1 .1.23 4.6 4.6 0 0 0 .58.94A11.59 11.59 0 0 1 8 14.58c.32.5-.65 1.23.59 1.38s1.7-2.1 1.3-3-.89-2.67 0-2.46l.65.15c1.15.35 2.85.49 3.7-.08s.44-1.09.33-1.76a1.73 1.73 0 0 0-.06-2.35z"/>
|
||||
</svg>
|
After Width: | Height: | Size: 717 B |
@ -36,6 +36,7 @@
|
||||
skin/classic/browser/controlcenter/fingerprinters-disabled.svg (../shared/controlcenter/fingerprinters-disabled.svg)
|
||||
skin/classic/browser/controlcenter/info.svg (../shared/controlcenter/info.svg)
|
||||
skin/classic/browser/controlcenter/permissions.svg (../shared/controlcenter/permissions.svg)
|
||||
skin/classic/browser/controlcenter/socialblock.svg (../shared/controlcenter/socialblock.svg)
|
||||
skin/classic/browser/controlcenter/trackers.svg (../shared/controlcenter/trackers.svg)
|
||||
skin/classic/browser/controlcenter/trackers-disabled.svg (../shared/controlcenter/trackers-disabled.svg)
|
||||
skin/classic/browser/controlcenter/tracking-protection.svg (../shared/controlcenter/tracking-protection.svg)
|
||||
|
@ -47,23 +47,27 @@
|
||||
position: absolute;
|
||||
height: 100%;
|
||||
width: 100%;
|
||||
transition: all 0.25s cubic-bezier(0.07, 0.95, 0, 1);
|
||||
transition: transform 0.25s cubic-bezier(0.07, 0.95, 0, 1);
|
||||
}
|
||||
|
||||
#editBookmarkPanelRecommendation[disabled] {
|
||||
transform: translateY(-100%);
|
||||
}
|
||||
|
||||
#editBookmarkPanelRecommendation > div {
|
||||
#editBookmarkPanelRecommendation #cfrMessageContainer {
|
||||
border-radius: 2px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
height: 150px;
|
||||
min-height: 150px;
|
||||
cursor: pointer;
|
||||
position: relative;
|
||||
padding: 0 16px;
|
||||
}
|
||||
|
||||
#editBookmarkPanelRecommendation #cfrMessageContainer.longMessagePadding {
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
#editBookmarkPanelRecommendation > div::-moz-focus-inner {
|
||||
border: none;
|
||||
}
|
||||
@ -158,6 +162,11 @@ html|img#editBookmarkPanelFavicon[src] {
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
margin: 0 2px;
|
||||
/* When adjusting the height for long CFR messages we want the animations
|
||||
* to align. The delay is used to force the animation to start when the
|
||||
* panel message has finished sliding down. */
|
||||
transition: height 0.28s cubic-bezier(0.07, 0.95, 0, 1);
|
||||
transition-delay: 10ms;
|
||||
}
|
||||
|
||||
#editBookmarkPanelRows,
|
||||
|
@ -1,3 +1,7 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef ThirdPartyPaths_h__
|
||||
#define ThirdPartyPaths_h__
|
||||
|
||||
|
@ -1,3 +1,7 @@
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "VariableUsageHelpers.h"
|
||||
#include "Utils.h"
|
||||
|
||||
|
@ -757,6 +757,8 @@ def split_triplet(triplet, allow_unknown=False):
|
||||
|
||||
if os.startswith('darwin'):
|
||||
toolchain = '%s-apple-%s' % (cpu, os)
|
||||
elif canonical_cpu == 'aarch64' and canonical_os == 'WINNT':
|
||||
toolchain = 'aarch64-windows-msvc'
|
||||
else:
|
||||
toolchain = '%s-%s' % (cpu, os)
|
||||
|
||||
|
@ -219,7 +219,7 @@ def rust_supported_targets(rustc):
|
||||
|
||||
|
||||
@template
|
||||
def rust_triple_alias(host_or_target):
|
||||
def rust_triple_alias(host_or_target, host_or_target_c_compiler):
|
||||
"""Template defining the alias used for rustc's --target flag.
|
||||
`host_or_target` is either `host` or `target` (the @depends functions
|
||||
from init.configure).
|
||||
@ -228,8 +228,8 @@ def rust_triple_alias(host_or_target):
|
||||
|
||||
host_or_target_str = {host: 'host', target: 'target'}[host_or_target]
|
||||
|
||||
@depends(rustc, host_or_target, c_compiler, rust_supported_targets,
|
||||
arm_target, when=rust_compiler)
|
||||
@depends(rustc, host_or_target, host_or_target_c_compiler,
|
||||
rust_supported_targets, arm_target, when=rust_compiler)
|
||||
@checking('for rust %s triplet' % host_or_target_str)
|
||||
@imports('os')
|
||||
@imports('subprocess')
|
||||
@ -324,8 +324,8 @@ def rust_triple_alias(host_or_target):
|
||||
return rust_target
|
||||
|
||||
|
||||
rust_target_triple = rust_triple_alias(target)
|
||||
rust_host_triple = rust_triple_alias(host)
|
||||
rust_target_triple = rust_triple_alias(target, c_compiler)
|
||||
rust_host_triple = rust_triple_alias(host, host_c_compiler)
|
||||
|
||||
|
||||
@depends(host, rust_host_triple, rustc_info.host)
|
||||
|
@ -420,11 +420,9 @@ def get_compiler_info(compiler, language):
|
||||
# the feature check, so that an unsupported version of clang would have
|
||||
# no version number.
|
||||
check = dedent('''\
|
||||
#if defined(_MSC_VER)
|
||||
#if defined(__clang__)
|
||||
#if defined(_MSC_VER) && defined(__clang__) && defined(_MT)
|
||||
%COMPILER "clang-cl"
|
||||
%VERSION __clang_major__.__clang_minor__.__clang_patchlevel__
|
||||
#endif
|
||||
#elif defined(__clang__)
|
||||
%COMPILER "clang"
|
||||
# if __has_attribute(diagnose_if)
|
||||
@ -582,8 +580,7 @@ def check_compiler(compiler, language, target):
|
||||
elif (info.cpu, target.cpu) in same_arch:
|
||||
flags.append('-m64')
|
||||
elif info.type == 'clang-cl' and target.cpu == 'aarch64':
|
||||
# clang-cl uses a different name for this target
|
||||
flags.append('--target=aarch64-windows-msvc')
|
||||
flags.append('--target=%s' % target.toolchain)
|
||||
elif info.type == 'clang':
|
||||
flags.append('--target=%s' % target.toolchain)
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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 <typename T>
|
||||
static nsTArray<typename T::KeyVal> GetJSONKeys(const Json::Value* aInput) {
|
||||
@ -228,7 +228,7 @@ already_AddRefed<BasePrincipal> BasePrincipal::FromJSON(
|
||||
return NullPrincipal::FromProperties(res);
|
||||
}
|
||||
|
||||
if (principalKind == eCodebasePrincipal) {
|
||||
if (principalKind == eContentPrincipal) {
|
||||
nsTArray<ContentPrincipal::KeyVal> res =
|
||||
GetJSONKeys<ContentPrincipal>(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> BasePrincipal::CreateCodebasePrincipal(
|
||||
already_AddRefed<BasePrincipal> BasePrincipal::CreateContentPrincipal(
|
||||
nsIURI* aURI, const OriginAttributes& aAttrs) {
|
||||
MOZ_ASSERT(aURI);
|
||||
|
||||
@ -483,17 +483,17 @@ already_AddRefed<BasePrincipal> BasePrincipal::CreateCodebasePrincipal(
|
||||
return NullPrincipal::Create(aAttrs);
|
||||
}
|
||||
|
||||
return CreateCodebasePrincipal(aURI, aAttrs, originNoSuffix);
|
||||
return CreateContentPrincipal(aURI, aAttrs, originNoSuffix);
|
||||
}
|
||||
|
||||
already_AddRefed<BasePrincipal> BasePrincipal::CreateCodebasePrincipal(
|
||||
already_AddRefed<BasePrincipal> 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> BasePrincipal::CreateCodebasePrincipal(
|
||||
}
|
||||
MOZ_ASSERT(origin);
|
||||
OriginAttributes attrs;
|
||||
RefPtr<BasePrincipal> principal = CreateCodebasePrincipal(origin, attrs);
|
||||
RefPtr<BasePrincipal> principal = CreateContentPrincipal(origin, attrs);
|
||||
return principal.forget();
|
||||
}
|
||||
#endif
|
||||
@ -527,22 +527,22 @@ already_AddRefed<BasePrincipal> BasePrincipal::CreateCodebasePrincipal(
|
||||
return principal.forget();
|
||||
}
|
||||
|
||||
// Mint a codebase principal.
|
||||
RefPtr<ContentPrincipal> codebase = new ContentPrincipal();
|
||||
rv = codebase->Init(aURI, aAttrs, aOriginNoSuffix);
|
||||
// Mint a content principal.
|
||||
RefPtr<ContentPrincipal> principal = new ContentPrincipal();
|
||||
rv = principal->Init(aURI, aAttrs, aOriginNoSuffix);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
return codebase.forget();
|
||||
return principal.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<BasePrincipal> BasePrincipal::CreateCodebasePrincipal(
|
||||
already_AddRefed<BasePrincipal> 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> 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> BasePrincipal::CloneForcingOriginAttributes(
|
||||
const OriginAttributes& aOriginAttributes) {
|
||||
if (NS_WARN_IF(!IsCodebasePrincipal())) {
|
||||
if (NS_WARN_IF(!IsContentPrincipal())) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@ -567,7 +567,7 @@ already_AddRefed<BasePrincipal> BasePrincipal::CloneForcingOriginAttributes(
|
||||
nsresult rv = GetOriginNoSuffix(originNoSuffix);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
nsIURI* uri = static_cast<ContentPrincipal*>(this)->mCodebase;
|
||||
nsIURI* uri = static_cast<ContentPrincipal*>(this)->mURI;
|
||||
RefPtr<ContentPrincipal> copy = new ContentPrincipal();
|
||||
rv = copy->Init(uri, aOriginAttributes, originNoSuffix);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
@ -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<BasePrincipal*>(aPrin);
|
||||
@ -144,14 +144,14 @@ class BasePrincipal : public nsJSPrincipals {
|
||||
return static_cast<const BasePrincipal*>(aPrin);
|
||||
}
|
||||
|
||||
static already_AddRefed<BasePrincipal> CreateCodebasePrincipal(
|
||||
static already_AddRefed<BasePrincipal> 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<BasePrincipal> CreateCodebasePrincipal(
|
||||
static already_AddRefed<BasePrincipal> 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<BasePrincipal> CreateCodebasePrincipal(
|
||||
static already_AddRefed<BasePrincipal> 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;
|
||||
|
@ -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<BasePrincipal> 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<nsIURI>& aCodebase,
|
||||
static nsresult GetSpecialBaseDomain(const nsCOMPtr<nsIURI>& 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<nsIURI>& aCodebase,
|
||||
}
|
||||
|
||||
// Otherwise, we return the file path.
|
||||
nsCOMPtr<nsIURL> url = do_QueryInterface(aCodebase);
|
||||
nsCOMPtr<nsIURL> url = do_QueryInterface(aURI);
|
||||
|
||||
if (url) {
|
||||
*aHandled = true;
|
||||
@ -399,21 +397,21 @@ static nsresult GetSpecialBaseDomain(const nsCOMPtr<nsIURI>& 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<nsIURI> 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<BasePrincipal> principal = CreateCodebasePrincipal(siteOrigin);
|
||||
RefPtr<BasePrincipal> 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<nsISupports> supports;
|
||||
nsCOMPtr<nsIURI> codebase;
|
||||
nsCOMPtr<nsIURI> 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<BasePrincipal> ContentPrincipal::FromProperties(
|
||||
nsTArray<ContentPrincipal::KeyVal>& aFields) {
|
||||
MOZ_ASSERT(aFields.Length() == eMax + 1, "Must have all the keys");
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIURI> codebaseURI;
|
||||
nsCOMPtr<nsIURI> principalURI;
|
||||
nsCOMPtr<nsIURI> domain;
|
||||
nsCOMPtr<nsIContentSecurityPolicy> csp;
|
||||
OriginAttributes attrs;
|
||||
@ -667,25 +664,26 @@ already_AddRefed<BasePrincipal> 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<BasePrincipal> ContentPrincipal::FromProperties(
|
||||
}
|
||||
}
|
||||
nsAutoCString originNoSuffix;
|
||||
rv = ContentPrincipal::GenerateOriginNoSuffixFromURI(codebaseURI,
|
||||
rv = ContentPrincipal::GenerateOriginNoSuffixFromURI(principalURI,
|
||||
originNoSuffix);
|
||||
if (NS_FAILED(rv)) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
RefPtr<ContentPrincipal> codebase = new ContentPrincipal();
|
||||
rv = codebase->Init(codebaseURI, attrs, originNoSuffix);
|
||||
RefPtr<ContentPrincipal> 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();
|
||||
}
|
||||
|
@ -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<nsIURI> mDomain;
|
||||
nsCOMPtr<nsIURI> mCodebase;
|
||||
nsCOMPtr<nsIURI> 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
|
||||
|
@ -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);
|
||||
|
@ -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.
|
||||
|
@ -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);
|
||||
|
@ -376,7 +376,7 @@ nsScriptSecurityManager::GetChannelURIPrincipal(nsIChannel* aChannel,
|
||||
OriginAttributes attrs = loadInfo->GetOriginAttributes();
|
||||
|
||||
nsCOMPtr<nsIPrincipal> 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<JS::Value> aOriginAttributes, JSContext* aCx,
|
||||
nsIPrincipal** aPrincipal) {
|
||||
OriginAttributes attrs;
|
||||
@ -1129,13 +1129,13 @@ nsScriptSecurityManager::CreateCodebasePrincipal(
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
nsCOMPtr<nsIPrincipal> 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<nsIPrincipal> prin = BasePrincipal::CreateCodebasePrincipal(aOrigin);
|
||||
nsCOMPtr<nsIPrincipal> 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<nsIPrincipal> 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<nsIPrincipal> prin = BasePrincipal::CreateCodebasePrincipal(
|
||||
nsCOMPtr<nsIPrincipal> 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;
|
||||
|
@ -26,7 +26,7 @@ TEST(PrincipalSerialization, ReusedJSONArgument)
|
||||
nsAutoCString spec("https://mozilla.com");
|
||||
nsCOMPtr<nsIPrincipal> 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<nsIPrincipal> 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<nsIPrincipal> 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<nsIPrincipal> combinedPrincipal = BasePrincipal::FromJSON(
|
||||
@ -105,19 +104,19 @@ TEST(PrincipalSerialization, ExpandedPrincipal)
|
||||
nsAutoCString spec("https://mozilla.com");
|
||||
nsCOMPtr<nsIPrincipal> 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<nsIPrincipal> 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<nsIPrincipal> 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<nsIPrincipal> 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<nsIPrincipal> 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<nsIPrincipal> 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));
|
||||
}
|
||||
|
@ -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,
|
||||
|
@ -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"; }
|
||||
|
@ -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)
|
||||
);
|
||||
|
@ -2,6 +2,7 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
from __future__ import absolute_import
|
||||
import os
|
||||
import time
|
||||
import zipfile
|
||||
@ -47,7 +48,7 @@ class ZipFile(zipfile.ZipFile):
|
||||
date_time=time.localtime(time.time()))
|
||||
zinfo.compress_type = self.compression
|
||||
# Add some standard UNIX file access permissions (-rw-r--r--).
|
||||
zinfo.external_attr = (0x81a4 & 0xFFFF) << 16L
|
||||
zinfo.external_attr = (0x81a4 & 0xFFFF) << 16
|
||||
else:
|
||||
zinfo = zinfo_or_arcname
|
||||
|
||||
|
@ -9,6 +9,7 @@
|
||||
# JSErrorFormatString.format member should be in ASCII encoding.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
|
@ -7,6 +7,7 @@
|
||||
# This script checks bytecode documentation in js/src/vm/Opcodes.h
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
import os
|
||||
|
@ -20,6 +20,7 @@
|
||||
# proper methods annotations.
|
||||
# ----------------------------------------------------------------------------
|
||||
|
||||
from __future__ import absolute_import
|
||||
from __future__ import print_function
|
||||
|
||||
import difflib
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user