зеркало из https://github.com/mozilla/gecko-dev.git
Коммит
4ade9738fe
|
@ -52,8 +52,8 @@ parser/html/java/javaparser/
|
|||
.settings/
|
||||
|
||||
# Python virtualenv artifacts.
|
||||
python/psutil/*.so
|
||||
python/psutil/*.pyd
|
||||
python/psutil/**/*.so
|
||||
python/psutil/**/*.pyd
|
||||
python/psutil/build/
|
||||
|
||||
# Ignore chrome.manifest files from the devtools loader
|
||||
|
|
|
@ -32,9 +32,9 @@ let principaluri = Cc["@mozilla.org/network/io-service;1"].
|
|||
getService(Ci.nsIIOService).
|
||||
newURI(PSEUDOURI, null, null);
|
||||
|
||||
let principal = Cc["@mozilla.org/scriptsecuritymanager;1"].
|
||||
getService(Ci.nsIScriptSecurityManager).
|
||||
getCodebasePrincipal(principaluri);
|
||||
let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
let principal = ssm.createCodebasePrincipal(principaluri, {});
|
||||
|
||||
function toArray(args) {
|
||||
return Array.prototype.slice.call(args);
|
||||
|
|
|
@ -154,11 +154,10 @@ this.AboutServiceWorkers = {
|
|||
return;
|
||||
}
|
||||
|
||||
let principal = Services.scriptSecurityManager.getAppCodebasePrincipal(
|
||||
let principal = Services.scriptSecurityManager.createCodebasePrincipal(
|
||||
// TODO: Bug 1196652. use originNoSuffix
|
||||
Services.io.newURI(message.principal.origin, null, null),
|
||||
message.principal.originAttributes.appId,
|
||||
message.principal.originAttributes.inBrowser
|
||||
);
|
||||
message.principal.originAttributes);
|
||||
|
||||
if (!message.scope) {
|
||||
self.sendError(message.id, "MissingScope");
|
||||
|
|
|
@ -205,9 +205,9 @@ ContentPermissionPrompt.prototype = {
|
|||
// URL.
|
||||
let notDenyAppPrincipal = function(type) {
|
||||
let url = Services.io.newURI(app.origin, null, null);
|
||||
let principal = secMan.getAppCodebasePrincipal(url,
|
||||
request.principal.appId,
|
||||
/*mozbrowser*/false);
|
||||
let principal =
|
||||
secMan.createCodebasePrincipal(url,
|
||||
{appId: request.principal.appId});
|
||||
let result = Services.perms.testExactPermissionFromPrincipal(principal,
|
||||
type.access);
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="14f32ddf49e9c1f2b30c391a26ba2dc867e948c1"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="d784c81961d82cbe9e111405468c590a8345856c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6d7ddcc5594d334f926aa2e0546ab5b57b9a1e3c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6641107c83e718d9896f90a9529ad0c252ddc271"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="14f32ddf49e9c1f2b30c391a26ba2dc867e948c1"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="d784c81961d82cbe9e111405468c590a8345856c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6d7ddcc5594d334f926aa2e0546ab5b57b9a1e3c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6641107c83e718d9896f90a9529ad0c252ddc271"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="14f32ddf49e9c1f2b30c391a26ba2dc867e948c1"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d784c81961d82cbe9e111405468c590a8345856c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="2d58f4b9206b50b8fda0d5036da6f0c62608db7c"/>
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="14f32ddf49e9c1f2b30c391a26ba2dc867e948c1"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="d784c81961d82cbe9e111405468c590a8345856c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="51ebaf824cc634665c5efcae95b8301ad1758c5e"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6d7ddcc5594d334f926aa2e0546ab5b57b9a1e3c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6641107c83e718d9896f90a9529ad0c252ddc271"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="14f32ddf49e9c1f2b30c391a26ba2dc867e948c1"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="d784c81961d82cbe9e111405468c590a8345856c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6d7ddcc5594d334f926aa2e0546ab5b57b9a1e3c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6641107c83e718d9896f90a9529ad0c252ddc271"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="f92a936f2aa97526d4593386754bdbf02db07a12"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="6e47ff2790f5656b5b074407829ceecf3e6188c4"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="05a36844c1046a1eb07d5b1325f85ed741f961ea">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="14f32ddf49e9c1f2b30c391a26ba2dc867e948c1"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="d784c81961d82cbe9e111405468c590a8345856c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6d7ddcc5594d334f926aa2e0546ab5b57b9a1e3c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6641107c83e718d9896f90a9529ad0c252ddc271"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>
|
||||
|
|
|
@ -19,7 +19,7 @@
|
|||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="14f32ddf49e9c1f2b30c391a26ba2dc867e948c1"/>
|
||||
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="d784c81961d82cbe9e111405468c590a8345856c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="2d58f4b9206b50b8fda0d5036da6f0c62608db7c"/>
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="e935894ef5f27e2f04b9e929a45a958e6288a223">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="14f32ddf49e9c1f2b30c391a26ba2dc867e948c1"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="d784c81961d82cbe9e111405468c590a8345856c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6d7ddcc5594d334f926aa2e0546ab5b57b9a1e3c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6641107c83e718d9896f90a9529ad0c252ddc271"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/i686-linux-glibc2.7-4.6" revision="95bb5b66b3ec5769c3de8d3f25d681787418e7d2"/>
|
||||
<project groups="linux" name="platform/prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" path="prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.7-4.6" revision="ebdad82e61c16772f6cd47e9f11936bf6ebe9aa0"/>
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
{
|
||||
"git": {
|
||||
"git_revision": "14f32ddf49e9c1f2b30c391a26ba2dc867e948c1",
|
||||
"git_revision": "d784c81961d82cbe9e111405468c590a8345856c",
|
||||
"remote": "https://git.mozilla.org/releases/gaia.git",
|
||||
"branch": ""
|
||||
},
|
||||
"revision": "0164a51c5b868d7362a7d048785e43a01bacdea8",
|
||||
"revision": "34464a3c3dc438c500b48f2b7ff54025f46ce1fd",
|
||||
"repo_path": "integration/gaia-central"
|
||||
}
|
||||
|
|
|
@ -17,10 +17,10 @@
|
|||
</project>
|
||||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="14f32ddf49e9c1f2b30c391a26ba2dc867e948c1"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="d784c81961d82cbe9e111405468c590a8345856c"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="moztt" path="external/moztt" remote="b2g" revision="51ebaf824cc634665c5efcae95b8301ad1758c5e"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6d7ddcc5594d334f926aa2e0546ab5b57b9a1e3c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6641107c83e718d9896f90a9529ad0c252ddc271"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<!-- Stock Android things -->
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
<project name="platform_build" path="build" remote="b2g" revision="05a36844c1046a1eb07d5b1325f85ed741f961ea">
|
||||
<copyfile dest="Makefile" src="core/root.mk"/>
|
||||
</project>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="14f32ddf49e9c1f2b30c391a26ba2dc867e948c1"/>
|
||||
<project name="gaia" path="gaia" remote="mozillaorg" revision="d784c81961d82cbe9e111405468c590a8345856c"/>
|
||||
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
|
||||
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="62cfa11ae7d77f6330de019a5aa79607e35be7d1"/>
|
||||
<project name="librecovery" path="librecovery" remote="b2g" revision="1b3591a50ed352fc6ddb77462b7b35d0bfa555a3"/>
|
||||
|
@ -23,7 +23,7 @@
|
|||
<project name="rilproxy" path="rilproxy" remote="b2g" revision="5ef30994f4778b4052e58a4383dbe7890048c87e"/>
|
||||
<project name="valgrind" path="external/valgrind" remote="b2g" revision="daa61633c32b9606f58799a3186395fd2bbb8d8c"/>
|
||||
<project name="vex" path="external/VEX" remote="b2g" revision="47f031c320888fe9f3e656602588565b52d43010"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6d7ddcc5594d334f926aa2e0546ab5b57b9a1e3c"/>
|
||||
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="6641107c83e718d9896f90a9529ad0c252ddc271"/>
|
||||
<!-- Stock Android things -->
|
||||
<project groups="pdk,linux" name="platform/prebuilts/clang/linux-x86/host/3.5" path="prebuilts/clang/linux-x86/host/3.5" revision="ffc05a232799fe8fcb3e47b7440b52b1fb4244c0"/>
|
||||
<project groups="pdk,linux,arm" name="platform/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" path="prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.8" revision="337e0ef5e40f02a1ae59b90db0548976c70a7226"/>
|
||||
|
|
|
@ -55,7 +55,8 @@
|
|||
// the error message.
|
||||
if (!config.origin) {
|
||||
let URI = Services.io.newURI(url, null, null);
|
||||
config.origin = Services.scriptSecurityManager.getNoAppCodebasePrincipal(URI).origin;
|
||||
config.origin =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(URI, {}).origin;
|
||||
}
|
||||
|
||||
switch (mode) {
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
*/
|
||||
const GRID_BOTTOM_EXTRA = 7; // title's line-height extends 7px past the margin
|
||||
const GRID_WIDTH_EXTRA = 1; // provide 1px buffer to allow for rounding error
|
||||
const SPONSORED_TAG_BUFFER = 2; // 2px buffer to clip off top of sponsored tag
|
||||
|
||||
/**
|
||||
* This singleton represents the grid that contains all sites.
|
||||
|
@ -175,6 +176,15 @@ let gGrid = {
|
|||
this._siteFragment.appendChild(site);
|
||||
},
|
||||
|
||||
/**
|
||||
* Test a tile at a given position for being pinned or history
|
||||
* @param position Position in sites array
|
||||
*/
|
||||
_isHistoricalTile: function Grid_isHistoricalTile(aPos) {
|
||||
let site = this.sites[aPos];
|
||||
return site && (site.isPinned() || site.link && site.link.type == "history");
|
||||
},
|
||||
|
||||
/**
|
||||
* Make sure the correct number of rows and columns are visible
|
||||
*/
|
||||
|
@ -195,9 +205,50 @@ let gGrid = {
|
|||
parseFloat(getComputedStyle(refCell).marginBottom);
|
||||
this._cellWidth = refCell.offsetWidth + this._cellMargin;
|
||||
}
|
||||
this._node.style.height = this._computeHeight() + "px";
|
||||
this._node.style.maxHeight = this._node.style.height;
|
||||
|
||||
let searchContainer = document.querySelector("#newtab-search-container");
|
||||
// Save search-container margin height
|
||||
if (this._searchContainerMargin === undefined) {
|
||||
this._searchContainerMargin = parseFloat(getComputedStyle(searchContainer).marginBottom) +
|
||||
parseFloat(getComputedStyle(searchContainer).marginTop);
|
||||
}
|
||||
|
||||
// Find the number of rows we can place into view port
|
||||
let availHeight = document.documentElement.clientHeight - this._cellMargin -
|
||||
searchContainer.offsetHeight - this._searchContainerMargin;
|
||||
let visibleRows = Math.floor(availHeight / this._cellHeight);
|
||||
|
||||
// Find the number of columns that fit into view port
|
||||
let maxGridWidth = gGridPrefs.gridColumns * this._cellWidth + GRID_WIDTH_EXTRA;
|
||||
// available width is current grid width, but no greater than maxGridWidth
|
||||
let availWidth = Math.min(document.querySelector("#newtab-grid").clientWidth,
|
||||
maxGridWidth);
|
||||
// finally get the number of columns we can fit into view port
|
||||
let gridColumns = Math.floor(availWidth / this._cellWidth);
|
||||
// walk sites backwords until a pinned or history tile is found or visibleRows reached
|
||||
let tileIndex = Math.min(gGridPrefs.gridRows * gridColumns, this.sites.length) - 1;
|
||||
while (tileIndex >= visibleRows * gridColumns) {
|
||||
if (this._isHistoricalTile(tileIndex)) {
|
||||
break;
|
||||
}
|
||||
tileIndex --;
|
||||
}
|
||||
|
||||
// Compute the actual number of grid rows we will display (potentially
|
||||
// with a scroll bar). tileIndex now points to a historical tile with
|
||||
// heighest index or to the last index of the visible row, if none found
|
||||
// Dividing tileIndex by number of tiles in a column gives the rows
|
||||
let gridRows = Math.floor(tileIndex / gridColumns) + 1;
|
||||
|
||||
// we need to set grid width, for otherwise the scrollbar may shrink
|
||||
// the grid when shown and cause grid layout to be different from
|
||||
// what being computed above. This, in turn, may cause scrollbar shown
|
||||
// for directory tiles, and introduce jitter when grid width is aligned
|
||||
// exactly on the column boundary
|
||||
this._node.style.width = gridColumns * this._cellWidth + "px";
|
||||
this._node.style.maxWidth = gGridPrefs.gridColumns * this._cellWidth +
|
||||
GRID_WIDTH_EXTRA + "px";
|
||||
this._node.style.height = this._computeHeight() + "px";
|
||||
this._node.style.maxHeight = this._computeHeight(gridRows) - SPONSORED_TAG_BUFFER + "px";
|
||||
}
|
||||
};
|
||||
|
|
|
@ -11,7 +11,7 @@ const URL = "http://mochi.test:8888/browser/browser/base/content/test/general/of
|
|||
registerCleanupFunction(function() {
|
||||
// Clean up after ourself
|
||||
let uri = Services.io.newURI(URL, null, null);
|
||||
var principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
|
||||
let principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
|
||||
Services.perms.removeFromPrincipal(principal, "offline-app");
|
||||
Services.prefs.clearUserPref("offline-apps.quota.warn");
|
||||
Services.prefs.clearUserPref("offline-apps.allow_by_default");
|
||||
|
|
|
@ -564,7 +564,7 @@ var gAllTests = [
|
|||
|
||||
var sm = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
var principal = sm.getNoAppCodebasePrincipal(URI);
|
||||
var principal = sm.createCodebasePrincipal(URI, {});
|
||||
|
||||
// Give www.example.com privileges to store offline data
|
||||
var pm = Cc["@mozilla.org/permissionmanager;1"]
|
||||
|
@ -634,7 +634,7 @@ var gAllTests = [
|
|||
|
||||
var sm = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
var principal = sm.getNoAppCodebasePrincipal(URI);
|
||||
var principal = sm.createCodebasePrincipal(URI, {});
|
||||
|
||||
// Open the dialog
|
||||
let wh = new WindowHelper();
|
||||
|
|
|
@ -43,12 +43,10 @@ window.addEventListener("message", function(event) {
|
|||
var uri1 = ioService.newURI(frames.testFrame.location, null, null);
|
||||
var uri2 = ioService.newURI(frames.testFrame3.location, null, null);
|
||||
|
||||
var principal1 = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(SpecialPowers.Ci.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri1);
|
||||
var principal2 = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(SpecialPowers.Ci.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri2);
|
||||
var ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(SpecialPowers.Ci.nsIScriptSecurityManager);
|
||||
var principal1 = ssm.createCodebasePrincipal(uri1, {});
|
||||
var principal2 = ssm.createCodebasePrincipal(uri2, {});
|
||||
|
||||
pm.removeFromPrincipal(principal1, "offline-app");
|
||||
pm.removeFromPrincipal(principal2, "offline-app");
|
||||
|
|
|
@ -39,9 +39,9 @@ function finishTest() {
|
|||
|
||||
var uri = Cc["@mozilla.org/network/io-service;1"].getService(SpecialPowers.Ci.nsIIOService)
|
||||
.newURI(window.frames[0].location, null, null);
|
||||
var principal = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(SpecialPowers.Ci.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri);
|
||||
var ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(SpecialPowers.Ci.nsIScriptSecurityManager);
|
||||
var principal = ssm.createCodebasePrincipal(uri, {});
|
||||
|
||||
pm.removeFromPrincipal(principal, "offline-app");
|
||||
|
||||
|
|
|
@ -49,3 +49,4 @@ support-files =
|
|||
[browser_newtab_update.js]
|
||||
[browser_newtab_bug1145428.js]
|
||||
[browser_newtab_bug1178586.js]
|
||||
[browser_newtab_bug1194895.js]
|
||||
|
|
|
@ -0,0 +1,141 @@
|
|||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const PRELOAD_PREF = "browser.newtab.preload";
|
||||
const PREF_NEWTAB_COLUMNS = "browser.newtabpage.columns";
|
||||
const PREF_NEWTAB_ROWS = "browser.newtabpage.rows";
|
||||
|
||||
function populateDirectoryTiles() {
|
||||
let directoryTiles = [];
|
||||
let i = 0;
|
||||
while (i++ < 14) {
|
||||
directoryTiles.push({
|
||||
directoryId: i,
|
||||
url: "http://example" + i + ".com/",
|
||||
enhancedImageURI: "data:image/png;base64,helloWORLD",
|
||||
title: "dirtitle" + i,
|
||||
type: "affiliate"
|
||||
});
|
||||
}
|
||||
return directoryTiles;
|
||||
}
|
||||
|
||||
gDirectorySource = "data:application/json," + JSON.stringify({
|
||||
"directory": populateDirectoryTiles()
|
||||
});
|
||||
|
||||
|
||||
function runTests() {
|
||||
let origEnhanced = NewTabUtils.allPages.enhanced;
|
||||
let origCompareLinks = NewTabUtils.links.compareLinks;
|
||||
registerCleanupFunction(() => {
|
||||
Services.prefs.clearUserPref(PRELOAD_PREF);
|
||||
Services.prefs.clearUserPref(PREF_NEWTAB_ROWS);
|
||||
Services.prefs.clearUserPref(PREF_NEWTAB_COLUMNS);
|
||||
NewTabUtils.allPages.enhanced = origEnhanced;
|
||||
NewTabUtils.links.compareLinks = origCompareLinks;
|
||||
});
|
||||
|
||||
// turn off preload to ensure grid updates on every setLinks
|
||||
Services.prefs.setBoolPref(PRELOAD_PREF, false);
|
||||
// set newtab to have three columns only
|
||||
Services.prefs.setIntPref(PREF_NEWTAB_COLUMNS, 3);
|
||||
Services.prefs.setIntPref(PREF_NEWTAB_ROWS, 5);
|
||||
|
||||
yield addNewTabPageTab();
|
||||
yield customizeNewTabPage("enhanced"); // Toggle enhanced off
|
||||
|
||||
// Testing history tiles
|
||||
|
||||
// two rows of tiles should always fit on any screen
|
||||
yield setLinks("0,1,2,3,4,5");
|
||||
yield addNewTabPageTab();
|
||||
|
||||
// should do not see scrollbar since tiles fit into visible space
|
||||
checkGrid("0,1,2,3,4,5");
|
||||
ok(!hasScrollbar(), "no scrollbar");
|
||||
|
||||
// add enough tiles to cause extra two rows and observe scrollbar
|
||||
yield setLinks("0,1,2,3,4,5,6,7,8,9");
|
||||
yield addNewTabPageTab();
|
||||
checkGrid("0,1,2,3,4,5,6,7,8,9");
|
||||
ok(hasScrollbar(), "document has scrollbar");
|
||||
|
||||
// pin the last tile to make it stay at the bottom of the newtab
|
||||
pinCell(9);
|
||||
// block first 6 tiles, which should not remove the scroll bar
|
||||
// since the last tile is pinned in the nineth position
|
||||
for (let i = 0; i < 6; i++) {
|
||||
yield blockCell(0);
|
||||
}
|
||||
yield addNewTabPageTab();
|
||||
checkGrid("6,7,8,,,,,,,9p");
|
||||
ok(hasScrollbar(), "document has scrollbar when tile is pinned to the last row");
|
||||
|
||||
// unpin the site: this will move tile up and make scrollbar disappear
|
||||
yield unpinCell(9);
|
||||
yield addNewTabPageTab();
|
||||
checkGrid("6,7,8,9");
|
||||
ok(!hasScrollbar(), "no scrollbar when bottom row tile is unpinned");
|
||||
|
||||
// reset everything to clean slate
|
||||
NewTabUtils.restore();
|
||||
|
||||
// Testing directory tiles
|
||||
yield customizeNewTabPage("enhanced"); // Toggle enhanced on
|
||||
|
||||
// setup page with no history tiles to test directory only display
|
||||
yield setLinks([]);
|
||||
yield addNewTabPageTab();
|
||||
ok(!hasScrollbar(), "no scrollbar for directory tiles");
|
||||
|
||||
// introduce one history tile - it should occupy the last
|
||||
// available slot at the bottom of newtab and cause scrollbar
|
||||
yield setLinks("41");
|
||||
yield addNewTabPageTab();
|
||||
ok(hasScrollbar(), "adding low frecency history site causes scrollbar");
|
||||
|
||||
// set PREF_NEWTAB_ROWS to 4, that should clip off the history tile
|
||||
// and remove scroll bar
|
||||
Services.prefs.setIntPref(PREF_NEWTAB_ROWS, 4);
|
||||
yield addNewTabPageTab();
|
||||
ok(!hasScrollbar(), "no scrollbar if history tiles falls past max rows");
|
||||
|
||||
// restore max rows and watch scrollbar re-appear
|
||||
Services.prefs.setIntPref(PREF_NEWTAB_ROWS, 5);
|
||||
yield addNewTabPageTab();
|
||||
ok(hasScrollbar(), "scrollbar is back when max rows allow for bottom history tile");
|
||||
|
||||
// block that history tile, and watch scrollbar disappear
|
||||
yield blockCell(14);
|
||||
yield addNewTabPageTab();
|
||||
ok(!hasScrollbar(), "no scrollbar after bottom history tiles is blocked");
|
||||
|
||||
// Test well-populated user history - newtab has highly-frecent history sites
|
||||
// redefine compareLinks to always choose history tiles first
|
||||
NewTabUtils.links.compareLinks = function (aLink1, aLink2) {
|
||||
if (aLink1.type == aLink2.type) {
|
||||
return aLink2.frecency - aLink1.frecency ||
|
||||
aLink2.lastVisitDate - aLink1.lastVisitDate;
|
||||
}
|
||||
else {
|
||||
if (aLink2.type == "history") {
|
||||
return 1;
|
||||
}
|
||||
else {
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// add a row of history tiles, directory tiles will be clipped off, hence no scrollbar
|
||||
yield setLinks("31,32,33");
|
||||
yield addNewTabPageTab();
|
||||
ok(!hasScrollbar(), "no scrollbar when directory tiles follow history tiles");
|
||||
|
||||
// fill first four rows with history tiles and observer scrollbar
|
||||
yield setLinks("30,31,32,33,34,35,36,37,38,39");
|
||||
yield addNewTabPageTab();
|
||||
ok(hasScrollbar(), "scrollbar appears when history tiles need extra row");
|
||||
|
||||
}
|
|
@ -18,7 +18,7 @@ Cu.import("resource://gre/modules/Timer.jsm", tmp);
|
|||
let {Promise, NewTabUtils, Sanitizer, clearTimeout, setTimeout, DirectoryLinksProvider, PlacesTestUtils} = tmp;
|
||||
|
||||
let uri = Services.io.newURI("about:newtab", null, null);
|
||||
let principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
|
||||
let principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
|
||||
|
||||
let isMac = ("nsILocalFileMac" in Ci);
|
||||
let isLinux = ("@mozilla.org/gnome-gconf-service;1" in Cc);
|
||||
|
@ -785,3 +785,11 @@ function customizeNewTabPage(aTheme) {
|
|||
|
||||
promise.then(TestRunner.next);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports presence of a scrollbar
|
||||
*/
|
||||
function hasScrollbar() {
|
||||
let docElement = getContentDocument().documentElement;
|
||||
return docElement.scrollHeight > docElement.clientHeight;
|
||||
}
|
||||
|
|
|
@ -77,4 +77,5 @@ skip-if = !crashreporter
|
|||
[browser_pageInfo_plugins.js]
|
||||
[browser_pluginCrashReportNonDeterminism.js]
|
||||
skip-if = !crashreporter || os == 'linux' # Bug 1152811
|
||||
[browser_private_clicktoplay.js]
|
||||
|
||||
|
|
|
@ -0,0 +1,235 @@
|
|||
let rootDir = getRootDirectory(gTestPath);
|
||||
const gTestRoot = rootDir;
|
||||
const gHttpTestRoot = rootDir.replace("chrome://mochitests/content/", "http://127.0.0.1:8888/");
|
||||
|
||||
let gTestBrowser = null;
|
||||
let gNextTest = null;
|
||||
let gPluginHost = Components.classes["@mozilla.org/plugin/host;1"].getService(Components.interfaces.nsIPluginHost);
|
||||
|
||||
Components.utils.import("resource://gre/modules/Services.jsm");
|
||||
|
||||
let gPrivateWindow = null;
|
||||
let gPrivateBrowser = null;
|
||||
|
||||
function pageLoad(aEvent) {
|
||||
// The plugin events are async dispatched and can come after the load event
|
||||
// This just allows the events to fire before we then go on to test the states
|
||||
executeSoon(gNextTest);
|
||||
gNextTest = null;
|
||||
}
|
||||
|
||||
function prepareTest(nextTest, url, window) {
|
||||
gNextTest = nextTest;
|
||||
if (!window)
|
||||
window = gTestBrowser.contentWindow;
|
||||
window.location = url;
|
||||
}
|
||||
|
||||
function finishTest() {
|
||||
clearAllPluginPermissions();
|
||||
gTestBrowser.removeEventListener("load", pageLoad, true);
|
||||
gBrowser.removeCurrentTab();
|
||||
if (gPrivateWindow) {
|
||||
gPrivateWindow.close();
|
||||
}
|
||||
window.focus();
|
||||
finish();
|
||||
}
|
||||
|
||||
function createPrivateWindow(nextTest, url) {
|
||||
gPrivateWindow = OpenBrowserWindow({private: true});
|
||||
ok(!!gPrivateWindow, "should have created a private window.");
|
||||
whenDelayedStartupFinished(gPrivateWindow, function() {
|
||||
gPrivateBrowser = gPrivateWindow.getBrowser().selectedBrowser;
|
||||
gPrivateBrowser.addEventListener("load", pageLoad, true);
|
||||
gNextTest = function() {
|
||||
prepareTest(nextTest, url, gPrivateBrowser.contentWindow);
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
function whenDelayedStartupFinished(aWindow, aCallback) {
|
||||
Services.obs.addObserver(function observer(aSubject, aTopic) {
|
||||
if (aWindow == aSubject) {
|
||||
Services.obs.removeObserver(observer, aTopic);
|
||||
executeSoon(aCallback);
|
||||
}
|
||||
}, "browser-delayed-startup-finished", false);
|
||||
}
|
||||
|
||||
function test() {
|
||||
waitForExplicitFinish();
|
||||
registerCleanupFunction(function() {
|
||||
clearAllPluginPermissions();
|
||||
getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_ENABLED;
|
||||
getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_ENABLED;
|
||||
});
|
||||
|
||||
let newTab = gBrowser.addTab();
|
||||
gBrowser.selectedTab = newTab;
|
||||
gTestBrowser = gBrowser.selectedBrowser;
|
||||
gTestBrowser.addEventListener("load", pageLoad, true);
|
||||
|
||||
Services.prefs.setBoolPref("plugins.click_to_play", true);
|
||||
getTestPlugin().enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
|
||||
getTestPlugin("Second Test Plug-in").enabledState = Ci.nsIPluginTag.STATE_CLICKTOPLAY;
|
||||
gNextTest = test1a;
|
||||
}
|
||||
|
||||
function test1a() {
|
||||
createPrivateWindow(test1b, gHttpTestRoot + "plugin_test.html");
|
||||
}
|
||||
|
||||
function test1b() {
|
||||
let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
|
||||
ok(popupNotification, "Test 1b, Should have a click-to-play notification");
|
||||
|
||||
let plugin = gPrivateBrowser.contentDocument.getElementById("test");
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 1b, Plugin should not be activated");
|
||||
|
||||
// Check the button status
|
||||
let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
|
||||
"Shown");
|
||||
popupNotification.reshow();
|
||||
promiseShown.then(() => {
|
||||
let button1 = gPrivateWindow.PopupNotifications.panel.firstChild._primaryButton;
|
||||
let button2 = gPrivateWindow.PopupNotifications.panel.firstChild._secondaryButton;
|
||||
is(button1.getAttribute("action"), "_singleActivateNow", "Test 1b, Blocked plugin in private window should have a activate now button");
|
||||
ok(button2.hidden, "Test 1b, Blocked plugin in a private window should not have a secondary button")
|
||||
|
||||
gPrivateWindow.close();
|
||||
prepareTest(test2a, gHttpTestRoot + "plugin_test.html");
|
||||
});
|
||||
}
|
||||
|
||||
function test2a() {
|
||||
// enable test plugin on this site
|
||||
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(popupNotification, "Test 2a, Should have a click-to-play notification");
|
||||
|
||||
let plugin = gTestBrowser.contentDocument.getElementById("test");
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 2a, Plugin should not be activated");
|
||||
|
||||
// Simulate clicking the "Allow Now" button.
|
||||
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
|
||||
"Shown");
|
||||
popupNotification.reshow();
|
||||
promiseShown.then(() => {
|
||||
PopupNotifications.panel.firstChild._secondaryButton.click();
|
||||
|
||||
let condition = function() objLoadingContent.activated;
|
||||
waitForCondition(condition, test2b, "Test 2a, Waited too long for plugin to activate");
|
||||
});
|
||||
}
|
||||
|
||||
function test2b() {
|
||||
createPrivateWindow(test2c, gHttpTestRoot + "plugin_test.html");
|
||||
}
|
||||
|
||||
function test2c() {
|
||||
let promise = TestUtils.topicObserved("PopupNotifications-updateNotShowing");
|
||||
promise.then(() => {
|
||||
let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
|
||||
ok(popupNotification, "Test 2c, Should have a click-to-play notification");
|
||||
|
||||
let plugin = gPrivateBrowser.contentDocument.getElementById("test");
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(objLoadingContent.activated, "Test 2c, Plugin should be activated");
|
||||
|
||||
// Check the button status
|
||||
let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
|
||||
"Shown");
|
||||
popupNotification.reshow();
|
||||
promiseShown.then(() => {
|
||||
let buttonContainer = gPrivateWindow.PopupNotifications.panel.firstChild._buttonContainer;
|
||||
ok(buttonContainer.hidden, "Test 2c, Activated plugin in a private window should not have visible buttons");
|
||||
|
||||
clearAllPluginPermissions();
|
||||
gPrivateWindow.close();
|
||||
prepareTest(test3a, gHttpTestRoot + "plugin_test.html");
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function test3a() {
|
||||
// enable test plugin on this site
|
||||
let popupNotification = PopupNotifications.getNotification("click-to-play-plugins", gTestBrowser);
|
||||
ok(popupNotification, "Test 3a, Should have a click-to-play notification");
|
||||
|
||||
let plugin = gTestBrowser.contentDocument.getElementById("test");
|
||||
let objLoadingContent = plugin.QueryInterface(Ci.nsIObjectLoadingContent);
|
||||
ok(!objLoadingContent.activated, "Test 3a, Plugin should not be activated");
|
||||
|
||||
// Simulate clicking the "Allow Always" button.
|
||||
let promiseShown = BrowserTestUtils.waitForEvent(PopupNotifications.panel,
|
||||
"Shown");
|
||||
popupNotification.reshow();
|
||||
promiseShown.then(() => {
|
||||
PopupNotifications.panel.firstChild._secondaryButton.click();
|
||||
|
||||
let condition = function() objLoadingContent.activated;
|
||||
waitForCondition(condition, test3b, "Test 3a, Waited too long for plugin to activate");
|
||||
});
|
||||
}
|
||||
|
||||
function test3b() {
|
||||
createPrivateWindow(test3c, gHttpTestRoot + "plugin_test.html");
|
||||
}
|
||||
|
||||
function test3c() {
|
||||
let promise = TestUtils.topicObserved("PopupNotifications-updateNotShowing");
|
||||
promise.then(() => {
|
||||
let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
|
||||
ok(popupNotification, "Test 3c, Should have a click-to-play notification");
|
||||
|
||||
// Check the button status
|
||||
let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
|
||||
"Shown");
|
||||
popupNotification.reshow();
|
||||
promiseShown.then(() => {
|
||||
let buttonContainer = gPrivateWindow.PopupNotifications.panel.firstChild._buttonContainer;
|
||||
ok(buttonContainer.hidden, "Test 3c, Activated plugin in a private window should not have visible buttons");
|
||||
|
||||
prepareTest(test3d, gHttpTestRoot + "plugin_two_types.html", gPrivateBrowser.contentWindow);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function test3d() {
|
||||
let popupNotification = gPrivateWindow.PopupNotifications.getNotification("click-to-play-plugins", gPrivateBrowser);
|
||||
ok(popupNotification, "Test 3d, Should have a click-to-play notification");
|
||||
|
||||
// Check the list item status
|
||||
let promiseShown = BrowserTestUtils.waitForEvent(gPrivateWindow.PopupNotifications.panel,
|
||||
"Shown");
|
||||
popupNotification.reshow();
|
||||
promiseShown.then(() => {
|
||||
let doc = gPrivateWindow.document;
|
||||
for (let item of gPrivateWindow.PopupNotifications.panel.firstChild.childNodes) {
|
||||
let allowalways = doc.getAnonymousElementByAttribute(item, "anonid", "allowalways");
|
||||
ok(allowalways, "Test 3d, should have list item for allow always");
|
||||
let allownow = doc.getAnonymousElementByAttribute(item, "anonid", "allownow");
|
||||
ok(allownow, "Test 3d, should have list item for allow now");
|
||||
let block = doc.getAnonymousElementByAttribute(item, "anonid", "block");
|
||||
ok(block, "Test 3d, should have list item for block");
|
||||
|
||||
if (item.action.pluginName === "Test") {
|
||||
is(item.value, "allowalways", "Test 3d, Plugin should bet set to 'allow always'");
|
||||
ok(!allowalways.hidden, "Test 3d, Plugin set to 'always allow' should have a visible 'always allow' action.");
|
||||
ok(allownow.hidden, "Test 3d, Plugin set to 'always allow' should have an invisible 'allow now' action.");
|
||||
ok(block.hidden, "Test 3d, Plugin set to 'always allow' should have an invisible 'block' action.");
|
||||
} else if (item.action.pluginName === "Second Test") {
|
||||
is(item.value, "block", "Test 3d, Second plugin should bet set to 'block'");
|
||||
ok(allowalways.hidden, "Test 3d, Plugin set to 'block' should have a visible 'always allow' action.");
|
||||
ok(!allownow.hidden, "Test 3d, Plugin set to 'block' should have a visible 'allow now' action.");
|
||||
ok(!block.hidden, "Test 3d, Plugin set to 'block' should have a visible 'block' action.");
|
||||
} else {
|
||||
ok(false, "Test 3d, Unexpected plugin '"+item.action.pluginName+"'");
|
||||
}
|
||||
}
|
||||
|
||||
finishTest();
|
||||
});
|
||||
}
|
|
@ -2402,6 +2402,20 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
}
|
||||
document.getAnonymousElementByAttribute(this, "anonid", "center-item-warning-label").value = warningString;
|
||||
|
||||
let chromeWin = window.QueryInterface(Ci.nsIDOMChromeWindow);
|
||||
let isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(chromeWin);
|
||||
|
||||
if (isWindowPrivate) {
|
||||
// TODO: temporary compromise of hiding some privacy leaks, remove once bug 892487 is fixed
|
||||
let allowalways = document.getAnonymousElementByAttribute(this, "anonid", "allowalways");
|
||||
let block = document.getAnonymousElementByAttribute(this, "anonid", "block");
|
||||
let allownow = document.getAnonymousElementByAttribute(this, "anonid", "allownow");
|
||||
|
||||
allowalways.hidden = curState !== "allowalways";
|
||||
block.hidden = curState !== "block";
|
||||
allownow.hidden = curState === "allowalways";
|
||||
}
|
||||
|
||||
if (url || linkHandler) {
|
||||
link.value = linkString;
|
||||
if (url) {
|
||||
|
@ -2577,6 +2591,8 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
<body><![CDATA[
|
||||
var action = this._items[0].action;
|
||||
var prePath = action.pluginPermissionPrePath;
|
||||
let chromeWin = window.QueryInterface(Ci.nsIDOMChromeWindow);
|
||||
let isWindowPrivate = PrivateBrowsingUtils.isWindowPrivate(chromeWin);
|
||||
|
||||
let label, linkLabel, linkUrl, button1, button2;
|
||||
|
||||
|
@ -2615,6 +2631,11 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
default:
|
||||
Cu.reportError(Error("Unexpected blocklist state"));
|
||||
}
|
||||
|
||||
// TODO: temporary compromise, remove this once bug 892487 is fixed
|
||||
if (isWindowPrivate) {
|
||||
this._buttonContainer.hidden = true;
|
||||
}
|
||||
}
|
||||
else if (action.pluginTag.enabledState == Ci.nsIPluginTag.STATE_DISABLED) {
|
||||
let linkElement =
|
||||
|
@ -2670,6 +2691,12 @@ file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|||
default:
|
||||
Cu.reportError(Error("Unexpected blocklist state"));
|
||||
}
|
||||
|
||||
// TODO: temporary compromise, remove this once bug 892487 is fixed
|
||||
if (isWindowPrivate) {
|
||||
button1.default = true;
|
||||
this._secondaryButton.hidden = true;
|
||||
}
|
||||
}
|
||||
this._setupDescription(label, action.pluginName, prePath);
|
||||
this._setupLink(linkLabel, action.detailsLink);
|
||||
|
|
|
@ -254,7 +254,7 @@ FeedConverter.prototype = {
|
|||
chromeChannel = ios.newChannelFromURIWithLoadInfo(aboutFeedsURI, loadInfo);
|
||||
chromeChannel.originalURI = result.uri;
|
||||
chromeChannel.owner =
|
||||
Services.scriptSecurityManager.getNoAppCodebasePrincipal(aboutFeedsURI);
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(aboutFeedsURI, {});
|
||||
} else {
|
||||
chromeChannel = ios.newChannelFromURIWithLoadInfo(result.uri, loadInfo);
|
||||
}
|
||||
|
|
|
@ -491,6 +491,7 @@ loop.roomViews = (function(mozL10n) {
|
|||
disabled: checked,
|
||||
label: checkboxLabel,
|
||||
onChange: this.handleCheckboxChange,
|
||||
useEllipsis: true,
|
||||
value: location}),
|
||||
React.createElement("form", {onSubmit: this.handleFormSubmit},
|
||||
React.createElement("input", {className: "room-context-name",
|
||||
|
@ -508,7 +509,7 @@ loop.roomViews = (function(mozL10n) {
|
|||
React.createElement("textarea", {className: "room-context-comments",
|
||||
onKeyDown: this.handleTextareaKeyDown,
|
||||
placeholder: mozL10n.get("context_edit_comments_placeholder"),
|
||||
rows: "3", type: "text",
|
||||
rows: "2", type: "text",
|
||||
valueLink: this.linkState("newRoomDescription")})
|
||||
),
|
||||
React.createElement("button", {className: "btn btn-info",
|
||||
|
|
|
@ -491,6 +491,7 @@ loop.roomViews = (function(mozL10n) {
|
|||
disabled={checked}
|
||||
label={checkboxLabel}
|
||||
onChange={this.handleCheckboxChange}
|
||||
useEllipsis={true}
|
||||
value={location} />
|
||||
<form onSubmit={this.handleFormSubmit}>
|
||||
<input className="room-context-name"
|
||||
|
@ -508,7 +509,7 @@ loop.roomViews = (function(mozL10n) {
|
|||
<textarea className="room-context-comments"
|
||||
onKeyDown={this.handleTextareaKeyDown}
|
||||
placeholder={mozL10n.get("context_edit_comments_placeholder")}
|
||||
rows="3" type="text"
|
||||
rows="2" type="text"
|
||||
valueLink={this.linkState("newRoomDescription")} />
|
||||
</form>
|
||||
<button className="btn btn-info"
|
||||
|
|
|
@ -524,6 +524,12 @@ html[dir="rtl"] .checkbox {
|
|||
background-image: url("../img/check.svg#check-disabled");
|
||||
}
|
||||
|
||||
.checkbox-label.ellipsis {
|
||||
text-overflow: ellipsis;
|
||||
white-space: nowrap;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
/* ContextUrlView classes */
|
||||
|
||||
.context-content {
|
||||
|
|
|
@ -897,6 +897,10 @@ body[platform="win"] .share-service-dropdown.overflow > .dropdown-menu-item {
|
|||
background-color: #dbf7ff;
|
||||
}
|
||||
|
||||
.showing-room-name > .text-chat-entries > .text-chat-scroller > .context-url-view-wrapper {
|
||||
padding-top: 0;
|
||||
}
|
||||
|
||||
.room-context {
|
||||
background: rgba(0,0,0,.8);
|
||||
border-top: 2px solid #444;
|
||||
|
@ -945,6 +949,7 @@ body[platform="win"] .share-service-dropdown.overflow > .dropdown-menu-item {
|
|||
|
||||
.room-context > .checkbox-wrapper {
|
||||
margin-bottom: .5em;
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.room-context-label {
|
||||
|
@ -1638,7 +1643,6 @@ html[dir="rtl"] .text-chat-entry.received .text-chat-arrow {
|
|||
/* 18px for indent of .text-chat-arrow, 1px for border of .text-chat-entry > p,
|
||||
0.5rem for padding of .text-chat-entry > p */
|
||||
padding: calc(18px - 1px - 0.5rem);
|
||||
padding-bottom: 0px;
|
||||
}
|
||||
|
||||
.text-chat-entry.special > p {
|
||||
|
|
|
@ -462,7 +462,6 @@ loop.shared.actions = (function() {
|
|||
// roomContextUrls: Array - Optional.
|
||||
// roomDescription: String - Optional.
|
||||
// roomName: String - Optional.
|
||||
roomOwner: String,
|
||||
roomToken: String,
|
||||
roomUrl: String,
|
||||
socialShareProviders: Array
|
||||
|
@ -477,7 +476,6 @@ loop.shared.actions = (function() {
|
|||
UpdateRoomInfo: Action.define("updateRoomInfo", {
|
||||
// description: String - Optional.
|
||||
// roomName: String - Optional.
|
||||
roomOwner: String,
|
||||
roomUrl: String
|
||||
// urls: Array - Optional.
|
||||
// See https://wiki.mozilla.org/Loop/Architecture/Context#Format_of_context.value
|
||||
|
|
|
@ -273,7 +273,6 @@ loop.store.ActiveRoomStore = (function() {
|
|||
roomContextUrls: roomData.decryptedContext.urls,
|
||||
roomDescription: roomData.decryptedContext.description,
|
||||
roomName: roomData.decryptedContext.roomName,
|
||||
roomOwner: roomData.roomOwner,
|
||||
roomUrl: roomData.roomUrl,
|
||||
socialShareProviders: this._mozLoop.getSocialShareProviders()
|
||||
}));
|
||||
|
@ -325,7 +324,6 @@ loop.store.ActiveRoomStore = (function() {
|
|||
}
|
||||
|
||||
var roomInfoData = new sharedActions.UpdateRoomInfo({
|
||||
roomOwner: result.roomOwner,
|
||||
roomUrl: result.roomUrl
|
||||
});
|
||||
|
||||
|
@ -396,7 +394,6 @@ loop.store.ActiveRoomStore = (function() {
|
|||
roomContextUrls: actionData.roomContextUrls,
|
||||
roomDescription: actionData.roomDescription,
|
||||
roomName: actionData.roomName,
|
||||
roomOwner: actionData.roomOwner,
|
||||
roomState: ROOM_STATES.READY,
|
||||
roomToken: actionData.roomToken,
|
||||
roomUrl: actionData.roomUrl,
|
||||
|
@ -420,7 +417,6 @@ loop.store.ActiveRoomStore = (function() {
|
|||
*/
|
||||
updateRoomInfo: function(actionData) {
|
||||
var newState = {
|
||||
roomOwner: actionData.roomOwner,
|
||||
roomUrl: actionData.roomUrl
|
||||
};
|
||||
// Iterate over the optional fields that _may_ be present on the actionData
|
||||
|
@ -456,7 +452,6 @@ loop.store.ActiveRoomStore = (function() {
|
|||
urls: roomData.decryptedContext.urls,
|
||||
description: roomData.decryptedContext.description,
|
||||
roomName: roomData.decryptedContext.roomName,
|
||||
roomOwner: roomData.roomOwner,
|
||||
roomUrl: roomData.roomUrl
|
||||
}));
|
||||
},
|
||||
|
|
|
@ -378,9 +378,13 @@ loop.shared.views.chat = (function(mozL10n) {
|
|||
|
||||
render: function() {
|
||||
var messageList;
|
||||
var showingRoomName = false;
|
||||
|
||||
if (this.props.showRoomName) {
|
||||
messageList = this.state.messageList;
|
||||
showingRoomName = this.state.messageList.some(function(item) {
|
||||
return item.contentType === CHAT_CONTENT_TYPES.ROOM_NAME;
|
||||
});
|
||||
} else {
|
||||
messageList = this.state.messageList.filter(function(item) {
|
||||
return item.type !== CHAT_MESSAGE_TYPES.SPECIAL ||
|
||||
|
@ -394,6 +398,7 @@ loop.shared.views.chat = (function(mozL10n) {
|
|||
});
|
||||
|
||||
var textChatViewClasses = React.addons.classSet({
|
||||
"showing-room-name": showingRoomName,
|
||||
"text-chat-view": true,
|
||||
"text-chat-disabled": !this.state.textChatEnabled,
|
||||
"text-chat-entries-empty": !messageList.length
|
||||
|
|
|
@ -378,9 +378,13 @@ loop.shared.views.chat = (function(mozL10n) {
|
|||
|
||||
render: function() {
|
||||
var messageList;
|
||||
var showingRoomName = false;
|
||||
|
||||
if (this.props.showRoomName) {
|
||||
messageList = this.state.messageList;
|
||||
showingRoomName = this.state.messageList.some(function(item) {
|
||||
return item.contentType === CHAT_CONTENT_TYPES.ROOM_NAME;
|
||||
});
|
||||
} else {
|
||||
messageList = this.state.messageList.filter(function(item) {
|
||||
return item.type !== CHAT_MESSAGE_TYPES.SPECIAL ||
|
||||
|
@ -394,6 +398,7 @@ loop.shared.views.chat = (function(mozL10n) {
|
|||
});
|
||||
|
||||
var textChatViewClasses = React.addons.classSet({
|
||||
"showing-room-name": showingRoomName,
|
||||
"text-chat-view": true,
|
||||
"text-chat-disabled": !this.state.textChatEnabled,
|
||||
"text-chat-entries-empty": !messageList.length
|
||||
|
|
|
@ -857,6 +857,9 @@ loop.shared.views = (function(_, mozL10n) {
|
|||
disabled: React.PropTypes.bool,
|
||||
label: React.PropTypes.string,
|
||||
onChange: React.PropTypes.func.isRequired,
|
||||
// If true, this will cause the label to be cut off at the end of the
|
||||
// first line with an ellipsis, and a tooltip supplied.
|
||||
useEllipsis: React.PropTypes.bool,
|
||||
// If `value` is not supplied, the consumer should rely on the boolean
|
||||
// `checked` state changes.
|
||||
value: React.PropTypes.string
|
||||
|
@ -868,6 +871,7 @@ loop.shared.views = (function(_, mozL10n) {
|
|||
checked: false,
|
||||
disabled: false,
|
||||
label: null,
|
||||
useEllipsis: false,
|
||||
value: ""
|
||||
};
|
||||
},
|
||||
|
@ -910,6 +914,11 @@ loop.shared.views = (function(_, mozL10n) {
|
|||
checked: this.state.checked,
|
||||
disabled: this.props.disabled
|
||||
};
|
||||
var labelClasses = {
|
||||
"checkbox-label": true,
|
||||
"ellipsis": this.props.useEllipsis
|
||||
};
|
||||
|
||||
if (this.props.additionalClass) {
|
||||
wrapperClasses[this.props.additionalClass] = true;
|
||||
}
|
||||
|
@ -918,9 +927,13 @@ loop.shared.views = (function(_, mozL10n) {
|
|||
disabled: this.props.disabled,
|
||||
onClick: this._handleClick},
|
||||
React.createElement("div", {className: cx(checkClasses)}),
|
||||
this.props.label ?
|
||||
React.createElement("label", null, this.props.label) :
|
||||
null
|
||||
|
||||
this.props.label ?
|
||||
React.createElement("div", {className: cx(labelClasses),
|
||||
title: this.props.useEllipsis ? this.props.label : ""},
|
||||
this.props.label
|
||||
) : null
|
||||
|
||||
)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -857,6 +857,9 @@ loop.shared.views = (function(_, mozL10n) {
|
|||
disabled: React.PropTypes.bool,
|
||||
label: React.PropTypes.string,
|
||||
onChange: React.PropTypes.func.isRequired,
|
||||
// If true, this will cause the label to be cut off at the end of the
|
||||
// first line with an ellipsis, and a tooltip supplied.
|
||||
useEllipsis: React.PropTypes.bool,
|
||||
// If `value` is not supplied, the consumer should rely on the boolean
|
||||
// `checked` state changes.
|
||||
value: React.PropTypes.string
|
||||
|
@ -868,6 +871,7 @@ loop.shared.views = (function(_, mozL10n) {
|
|||
checked: false,
|
||||
disabled: false,
|
||||
label: null,
|
||||
useEllipsis: false,
|
||||
value: ""
|
||||
};
|
||||
},
|
||||
|
@ -910,6 +914,11 @@ loop.shared.views = (function(_, mozL10n) {
|
|||
checked: this.state.checked,
|
||||
disabled: this.props.disabled
|
||||
};
|
||||
var labelClasses = {
|
||||
"checkbox-label": true,
|
||||
"ellipsis": this.props.useEllipsis
|
||||
};
|
||||
|
||||
if (this.props.additionalClass) {
|
||||
wrapperClasses[this.props.additionalClass] = true;
|
||||
}
|
||||
|
@ -918,9 +927,13 @@ loop.shared.views = (function(_, mozL10n) {
|
|||
disabled={this.props.disabled}
|
||||
onClick={this._handleClick}>
|
||||
<div className={cx(checkClasses)} />
|
||||
{this.props.label ?
|
||||
<label>{this.props.label}</label> :
|
||||
null}
|
||||
{
|
||||
this.props.label ?
|
||||
<div className={cx(labelClasses)}
|
||||
title={this.props.useEllipsis ? this.props.label : ""}>
|
||||
{this.props.label}
|
||||
</div> : null
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -91,7 +91,6 @@ loop.StandaloneMozLoop = (function(mozL10n) {
|
|||
try {
|
||||
// We currently only require things we need rather than everything possible.
|
||||
callback(null, validate(responseData, {
|
||||
roomOwner: String,
|
||||
roomUrl: String
|
||||
}));
|
||||
} catch (err) {
|
||||
|
|
|
@ -310,7 +310,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
decryptedContext: {
|
||||
roomName: "Monkeys"
|
||||
},
|
||||
roomOwner: "Alfred",
|
||||
roomUrl: "http://invalid"
|
||||
};
|
||||
|
||||
|
@ -353,7 +352,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
roomDescription: undefined,
|
||||
roomToken: fakeToken,
|
||||
roomName: fakeRoomData.decryptedContext.roomName,
|
||||
roomOwner: fakeRoomData.roomOwner,
|
||||
roomUrl: fakeRoomData.roomUrl,
|
||||
socialShareProviders: []
|
||||
}));
|
||||
|
@ -426,7 +424,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
|
||||
it("should dispatch an UpdateRoomInfo message with 'no data' failure if neither roomName nor context are supplied", function() {
|
||||
fakeMozLoop.rooms.get.callsArgWith(1, null, {
|
||||
roomOwner: "Dan",
|
||||
roomUrl: "http://invalid"
|
||||
});
|
||||
|
||||
|
@ -436,7 +433,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
sinon.assert.calledWithExactly(dispatcher.dispatch,
|
||||
new sharedActions.UpdateRoomInfo({
|
||||
roomInfoFailure: ROOM_INFO_FAILURES.NO_DATA,
|
||||
roomOwner: "Dan",
|
||||
roomState: ROOM_STATES.READY,
|
||||
roomUrl: "http://invalid"
|
||||
}));
|
||||
|
@ -446,8 +442,7 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
it("should dispatch UpdateRoomInfo if mozLoop.rooms.get is successful", function() {
|
||||
var roomDetails = {
|
||||
roomName: "fakeName",
|
||||
roomUrl: "http://invalid",
|
||||
roomOwner: "gavin"
|
||||
roomUrl: "http://invalid"
|
||||
};
|
||||
|
||||
fakeMozLoop.rooms.get.callsArgWith(1, null, roomDetails);
|
||||
|
@ -470,12 +465,10 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
context: {
|
||||
value: "fakeContext"
|
||||
},
|
||||
roomUrl: "http://invalid",
|
||||
roomOwner: "Mark"
|
||||
roomUrl: "http://invalid"
|
||||
};
|
||||
expectedDetails = {
|
||||
roomUrl: "http://invalid",
|
||||
roomOwner: "Mark"
|
||||
roomUrl: "http://invalid"
|
||||
};
|
||||
|
||||
fakeMozLoop.rooms.get.callsArgWith(1, null, roomDetails);
|
||||
|
@ -597,7 +590,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
beforeEach(function() {
|
||||
fakeRoomInfo = {
|
||||
roomName: "Its a room",
|
||||
roomOwner: "Me",
|
||||
roomToken: "fakeToken",
|
||||
roomUrl: "http://invalid",
|
||||
socialShareProviders: []
|
||||
|
@ -615,7 +607,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
|
||||
var state = store.getStoreState();
|
||||
expect(state.roomName).eql(fakeRoomInfo.roomName);
|
||||
expect(state.roomOwner).eql(fakeRoomInfo.roomOwner);
|
||||
expect(state.roomToken).eql(fakeRoomInfo.roomToken);
|
||||
expect(state.roomUrl).eql(fakeRoomInfo.roomUrl);
|
||||
expect(state.socialShareProviders).eql([]);
|
||||
|
@ -628,7 +619,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
beforeEach(function() {
|
||||
fakeRoomInfo = {
|
||||
roomName: "Its a room",
|
||||
roomOwner: "Me",
|
||||
roomUrl: "http://invalid",
|
||||
urls: [{
|
||||
description: "fake site",
|
||||
|
@ -643,7 +633,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
|
||||
var state = store.getStoreState();
|
||||
expect(state.roomName).eql(fakeRoomInfo.roomName);
|
||||
expect(state.roomOwner).eql(fakeRoomInfo.roomOwner);
|
||||
expect(state.roomUrl).eql(fakeRoomInfo.roomUrl);
|
||||
expect(state.roomContextUrls).eql(fakeRoomInfo.urls);
|
||||
});
|
||||
|
@ -1503,7 +1492,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
beforeEach(function() {
|
||||
store.setupRoomInfo(new sharedActions.SetupRoomInfo({
|
||||
roomName: "Its a room",
|
||||
roomOwner: "Me",
|
||||
roomToken: "fakeToken",
|
||||
roomUrl: "http://invalid",
|
||||
socialShareProviders: []
|
||||
|
@ -1521,7 +1509,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
fake: "url"
|
||||
}
|
||||
},
|
||||
roomOwner: "you",
|
||||
roomUrl: "original"
|
||||
};
|
||||
|
||||
|
@ -1532,7 +1519,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
new sharedActions.UpdateRoomInfo({
|
||||
description: "fakeDescription",
|
||||
roomName: fakeRoomData.decryptedContext.roomName,
|
||||
roomOwner: fakeRoomData.roomOwner,
|
||||
roomUrl: fakeRoomData.roomUrl,
|
||||
urls: {
|
||||
fake: "url"
|
||||
|
@ -1549,7 +1535,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
fake: "url"
|
||||
}
|
||||
},
|
||||
roomOwner: "you",
|
||||
roomUrl: "original"
|
||||
};
|
||||
|
||||
|
@ -1564,7 +1549,6 @@ describe("loop.store.ActiveRoomStore", function () {
|
|||
decryptedContext: {
|
||||
roomName: "Its a room"
|
||||
},
|
||||
roomOwner: "Me",
|
||||
roomToken: "fakeToken",
|
||||
roomUrl: "http://invalid"
|
||||
};
|
||||
|
|
|
@ -156,7 +156,6 @@ describe("loop.store.TextChatStore", function () {
|
|||
it("should add the room name to the list", function() {
|
||||
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
|
||||
roomName: "Let's share!",
|
||||
roomOwner: "Mark",
|
||||
roomUrl: "fake"
|
||||
}));
|
||||
|
||||
|
@ -173,7 +172,6 @@ describe("loop.store.TextChatStore", function () {
|
|||
it("should add the context to the list", function() {
|
||||
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
|
||||
roomName: "Let's share!",
|
||||
roomOwner: "Mark",
|
||||
roomUrl: "fake",
|
||||
urls: [{
|
||||
description: "A wonderful event",
|
||||
|
@ -206,7 +204,6 @@ describe("loop.store.TextChatStore", function () {
|
|||
|
||||
it("should not add more than one context message", function() {
|
||||
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
|
||||
roomOwner: "Mark",
|
||||
roomUrl: "fake",
|
||||
urls: [{
|
||||
description: "A wonderful event",
|
||||
|
@ -228,7 +225,6 @@ describe("loop.store.TextChatStore", function () {
|
|||
}]);
|
||||
|
||||
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
|
||||
roomOwner: "Mark",
|
||||
roomUrl: "fake",
|
||||
urls: [{
|
||||
description: "A wonderful event2",
|
||||
|
@ -253,7 +249,6 @@ describe("loop.store.TextChatStore", function () {
|
|||
it("should not dispatch a LoopChatMessageAppended event", function() {
|
||||
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
|
||||
roomName: "Let's share!",
|
||||
roomOwner: "Mark",
|
||||
roomUrl: "fake"
|
||||
}));
|
||||
|
||||
|
|
|
@ -453,6 +453,40 @@ describe("loop.shared.views.TextChatView", function () {
|
|||
expect(view.getDOMNode().classList.contains("text-chat-entries-empty")).eql(false);
|
||||
});
|
||||
|
||||
it("should add a showing room name class when the view shows room names and it has a room name", function() {
|
||||
view = mountTestComponent({
|
||||
showRoomName: true
|
||||
});
|
||||
|
||||
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
|
||||
roomName: "Study",
|
||||
roomUrl: "Fake"
|
||||
}));
|
||||
|
||||
expect(view.getDOMNode().classList.contains("showing-room-name")).eql(true);
|
||||
});
|
||||
|
||||
it("shouldn't add a showing room name class when the view doesn't show room names", function() {
|
||||
view = mountTestComponent({
|
||||
showRoomName: false
|
||||
});
|
||||
|
||||
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
|
||||
roomName: "Study",
|
||||
roomUrl: "Fake"
|
||||
}));
|
||||
|
||||
expect(view.getDOMNode().classList.contains("showing-room-name")).eql(false);
|
||||
});
|
||||
|
||||
it("shouldn't add a showing room name class when the view doesn't have a name", function() {
|
||||
view = mountTestComponent({
|
||||
showRoomName: true
|
||||
});
|
||||
|
||||
expect(view.getDOMNode().classList.contains("showing-room-name")).eql(false);
|
||||
});
|
||||
|
||||
it("should show timestamps from msgs sent more than 1 min apart", function() {
|
||||
view = mountTestComponent();
|
||||
|
||||
|
@ -540,7 +574,6 @@ describe("loop.shared.views.TextChatView", function () {
|
|||
|
||||
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
|
||||
roomName: "A wonderful surprise!",
|
||||
roomOwner: "Chris",
|
||||
roomUrl: "Fake"
|
||||
}));
|
||||
|
||||
|
@ -558,7 +591,6 @@ describe("loop.shared.views.TextChatView", function () {
|
|||
|
||||
store.updateRoomInfo(new sharedActions.UpdateRoomInfo({
|
||||
roomName: "A Very Long Conversation Name",
|
||||
roomOwner: "fake",
|
||||
roomUrl: "http://showcase",
|
||||
urls: [{
|
||||
description: "A wonderful page!",
|
||||
|
|
|
@ -941,7 +941,7 @@ describe("loop.shared.views", function() {
|
|||
view = mountTestComponent({ label: "Some label" });
|
||||
|
||||
var node = view.getDOMNode();
|
||||
expect(node.lastChild.localName).to.eql("label");
|
||||
expect(node.lastChild.localName).to.eql("div");
|
||||
expect(node.lastChild.textContent).to.eql("Some label");
|
||||
});
|
||||
|
||||
|
@ -974,6 +974,26 @@ describe("loop.shared.views", function() {
|
|||
var checkbox = view.getDOMNode().querySelector(".checkbox");
|
||||
expect(checkbox.classList.contains("checked")).eql(false);
|
||||
});
|
||||
|
||||
it("should add an ellipsis class when the prop is set", function() {
|
||||
view = mountTestComponent({
|
||||
label: "Some label",
|
||||
useEllipsis: true
|
||||
});
|
||||
|
||||
var label = view.getDOMNode().querySelector(".checkbox-label");
|
||||
expect(label.classList.contains("ellipsis")).eql(true);
|
||||
});
|
||||
|
||||
it("should not add an ellipsis class when the prop is not set", function() {
|
||||
view = mountTestComponent({
|
||||
label: "Some label",
|
||||
useEllipsis: false
|
||||
});
|
||||
|
||||
var label = view.getDOMNode().querySelector(".checkbox-label");
|
||||
expect(label.classList.contains("ellipsis")).eql(false);
|
||||
});
|
||||
});
|
||||
|
||||
describe("#_handleClick", function() {
|
||||
|
|
|
@ -83,8 +83,7 @@ describe("loop.StandaloneMozLoop", function() {
|
|||
|
||||
var roomDetails = {
|
||||
roomName: "fakeName",
|
||||
roomUrl: "http://invalid",
|
||||
roomOwner: "gavin"
|
||||
roomUrl: "http://invalid"
|
||||
};
|
||||
|
||||
requests[0].respond(200, {"Content-Type": "application/json"},
|
||||
|
|
|
@ -15,7 +15,6 @@ var fakeRooms = [
|
|||
}]
|
||||
},
|
||||
"roomUrl": "http://localhost:3000/rooms/_nxD4V4FflQ",
|
||||
"roomOwner": "Alexis",
|
||||
"maxSize": 2,
|
||||
"creationTime": 1405517546,
|
||||
"ctime": 1405517546,
|
||||
|
@ -28,7 +27,6 @@ var fakeRooms = [
|
|||
"roomName": "Second Room Name"
|
||||
},
|
||||
"roomUrl": "http://localhost:3000/rooms/QzBbvGmIZWU",
|
||||
"roomOwner": "Alexis",
|
||||
"maxSize": 2,
|
||||
"creationTime": 1405517546,
|
||||
"ctime": 1405517546,
|
||||
|
@ -41,7 +39,6 @@ var fakeRooms = [
|
|||
"roomName": "UX Discussion"
|
||||
},
|
||||
"roomUrl": "http://localhost:3000/rooms/3jKS_Els9IU",
|
||||
"roomOwner": "Alexis",
|
||||
"maxSize": 2,
|
||||
"clientMaxSize": 2,
|
||||
"creationTime": 1405517546,
|
||||
|
|
|
@ -385,7 +385,6 @@
|
|||
// Update the text chat store with the room info.
|
||||
textChatStore.updateRoomInfo(new sharedActions.UpdateRoomInfo({
|
||||
roomName: "A Very Long Conversation Name",
|
||||
roomOwner: "fake",
|
||||
roomUrl: "http://showcase",
|
||||
urls: [{
|
||||
description: "A wonderful page!",
|
||||
|
|
|
@ -385,7 +385,6 @@
|
|||
// Update the text chat store with the room info.
|
||||
textChatStore.updateRoomInfo(new sharedActions.UpdateRoomInfo({
|
||||
roomName: "A Very Long Conversation Name",
|
||||
roomOwner: "fake",
|
||||
roomUrl: "http://showcase",
|
||||
urls: [{
|
||||
description: "A wonderful page!",
|
||||
|
|
|
@ -27,7 +27,6 @@ support-files =
|
|||
[browser_bookmarkProperties_addKeywordForThisSearch.js]
|
||||
[browser_bookmarkProperties_readOnlyRoot.js]
|
||||
[browser_bookmarksProperties.js]
|
||||
skip-if = (os == 'win' && os_version == "6.2") # Bug 1178709
|
||||
[browser_drag_bookmarks_on_toolbar.js]
|
||||
skip-if = e10s # Bug ?????? - test fails - "Number of dragged items should be the same. - Got 0, expected 1"
|
||||
[browser_forgetthissite_single.js]
|
||||
|
|
|
@ -404,9 +404,8 @@ function open_properties_dialog() {
|
|||
if (aTopic != "domwindowopened")
|
||||
return;
|
||||
ww.unregisterNotification(windowObserver);
|
||||
var win = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
||||
win.addEventListener("focus", function (event) {
|
||||
win.removeEventListener("focus", arguments.callee, false);
|
||||
let win = aSubject.QueryInterface(Ci.nsIDOMWindow);
|
||||
waitForFocus(() => {
|
||||
// Windows has been loaded, execute our test now.
|
||||
executeSoon(function () {
|
||||
// Ensure overlay is loaded
|
||||
|
@ -418,7 +417,7 @@ function open_properties_dialog() {
|
|||
ok(false, "An error occured during test run: " + ex.message);
|
||||
}
|
||||
});
|
||||
}, false);
|
||||
}, win);
|
||||
}
|
||||
ww.registerNotification(windowObserver);
|
||||
|
||||
|
|
|
@ -505,7 +505,7 @@ let AboutPermissions = {
|
|||
while (row = aResults.getNextRow()) {
|
||||
let spec = row.getResultByName("url");
|
||||
let uri = NetUtil.newURI(spec);
|
||||
let principal = gSecMan.getNoAppCodebasePrincipal(uri);
|
||||
let principal = gSecMan.createCodebasePrincipal(uri, {});
|
||||
|
||||
AboutPermissions.addPrincipal(principal);
|
||||
}
|
||||
|
@ -556,7 +556,7 @@ let AboutPermissions = {
|
|||
try {
|
||||
// aLogin.hostname is a string in origin URL format (e.g. "http://foo.com")
|
||||
let uri = NetUtil.newURI(aLogin.hostname);
|
||||
let principal = gSecMan.getNoAppCodebasePrincipal(uri);
|
||||
let principal = gSecMan.createCodebasePrincipal(uri, {});
|
||||
this.addPrincipal(principal);
|
||||
} catch (e) {
|
||||
// newURI will throw for add-ons logins stored in chrome:// URIs
|
||||
|
@ -572,7 +572,7 @@ let AboutPermissions = {
|
|||
try {
|
||||
// aHostname is a string in origin URL format (e.g. "http://foo.com")
|
||||
let uri = NetUtil.newURI(aHostname);
|
||||
let principal = gSecMan.getNoAppCodebasePrincipal(uri);
|
||||
let principal = gSecMan.createCodebasePrincipal(uri, {});
|
||||
this.addPrincipal(principal);
|
||||
} catch (e) {
|
||||
// newURI will throw for add-ons logins stored in chrome:// URIs
|
||||
|
|
|
@ -260,7 +260,7 @@ let gSyncPane = {
|
|||
gSyncPane.signIn();
|
||||
return false;
|
||||
});
|
||||
setEventListener("verifiedManage", "command",
|
||||
setEventListener("verifiedManage", "click",
|
||||
gSyncPane.manageFirefoxAccount);
|
||||
setEventListener("fxaUnlinkButton", "click", function () {
|
||||
gSyncPane.unlinkFirefoxAccount(true);
|
||||
|
|
|
@ -95,12 +95,12 @@ var gPermissionManager = {
|
|||
let uri;
|
||||
try {
|
||||
uri = Services.io.newURI(input_url, null, null);
|
||||
principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
|
||||
principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
|
||||
// If we have ended up with an unknown scheme, the following will throw.
|
||||
principal.origin;
|
||||
} catch(ex) {
|
||||
uri = Services.io.newURI("http://" + input_url, null, null);
|
||||
principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
|
||||
principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
|
||||
// If we have ended up with an unknown scheme, the following will throw.
|
||||
principal.origin;
|
||||
}
|
||||
|
|
|
@ -8,8 +8,10 @@ const ABOUT_PERMISSIONS_SPEC = "about:permissions";
|
|||
const TEST_URI_1 = NetUtil.newURI("http://mozilla.com/");
|
||||
const TEST_URI_2 = NetUtil.newURI("http://mozilla.org/");
|
||||
|
||||
const TEST_PRINCIPAL_1 = Services.scriptSecurityManager.getNoAppCodebasePrincipal(TEST_URI_1);
|
||||
const TEST_PRINCIPAL_2 = Services.scriptSecurityManager.getNoAppCodebasePrincipal(TEST_URI_2);
|
||||
const TEST_PRINCIPAL_1 =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(TEST_URI_1, {});
|
||||
const TEST_PRINCIPAL_2 =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(TEST_URI_2, {});
|
||||
|
||||
// values from DefaultPermissions object
|
||||
const PERM_UNKNOWN = 0;
|
||||
|
|
|
@ -36,9 +36,9 @@ body[globalTpEnabled] .showGlobalTpDisabled {
|
|||
background-size: 47px 26px;
|
||||
padding-inline-start: 87px;
|
||||
color: white;
|
||||
font-size: 24pt;
|
||||
font-size: 1.5em;
|
||||
font-weight: 200;
|
||||
line-height: 60pt;
|
||||
line-height: 2.5em;
|
||||
}
|
||||
|
||||
#main {
|
||||
|
@ -62,7 +62,7 @@ body[globalTpEnabled] .showGlobalTpDisabled {
|
|||
}
|
||||
|
||||
ul {
|
||||
margin-bottom: 0;
|
||||
margin: 0;
|
||||
padding-inline-start: 8px;
|
||||
}
|
||||
|
||||
|
@ -100,10 +100,11 @@ li {
|
|||
}
|
||||
|
||||
#list-area > div {
|
||||
margin-inline-end: 1em;
|
||||
margin-inline-end: 3em;
|
||||
}
|
||||
|
||||
.list-header {
|
||||
margin-bottom: 0.4em;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
|
@ -156,8 +157,7 @@ li {
|
|||
}
|
||||
|
||||
#startTour {
|
||||
display: inline-block;
|
||||
width: 16em;
|
||||
display: block;
|
||||
border-radius: 2px;
|
||||
background-color: var(--in-content-primary-button-background);
|
||||
color: var(--in-content-selected-text);
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
<div id="bar" class="showPrivate">&privateBrowsing.title;</div>
|
||||
<div id="main" class="showPrivate">
|
||||
<div id="privateBrowsingSection"
|
||||
style="width: &aboutPrivateBrowsing.width;">
|
||||
style="width: &aboutPrivateBrowsing.width1;">
|
||||
<div class="sectionHeader">&aboutPrivateBrowsing.title;</div>
|
||||
<p>&aboutPrivateBrowsing.subtitle;</p>
|
||||
<div id="list-area">
|
||||
|
@ -59,7 +59,7 @@
|
|||
<a id="learnMore" target="_blank">&aboutPrivateBrowsing.learnMore;</a>
|
||||
</div>
|
||||
<div id="trackingProtectionSection"
|
||||
style="width: &trackingProtection.width;">
|
||||
style="width: &trackingProtection.width1;">
|
||||
<div class="sectionHeader">&trackingProtection.title;
|
||||
<span id="tpEnabled"
|
||||
style="width: &trackingProtection.state.width;"
|
||||
|
|
|
@ -237,7 +237,7 @@ HTMLBreadcrumbs.prototype = {
|
|||
// We make sure that the targeted node is selected
|
||||
// because we want to use the nodemenu that only works
|
||||
// for inspector.selection
|
||||
this.selection.setNodeFront(node, "breadcrumbs");
|
||||
this.navigateTo(node);
|
||||
|
||||
// Build a list of extra menu items that will be appended at the end of the
|
||||
// inspector node context menu.
|
||||
|
@ -262,10 +262,10 @@ HTMLBreadcrumbs.prototype = {
|
|||
item.setAttribute("type", "radio");
|
||||
item.setAttribute("label", this.prettyPrintNodeAsText(nodes[i]));
|
||||
|
||||
let selection = this.selection;
|
||||
let self = this;
|
||||
item.onmouseup = (function(node) {
|
||||
return function() {
|
||||
selection.setNodeFront(node, "breadcrumbs");
|
||||
self.navigateTo(node);
|
||||
};
|
||||
})(nodes[i]);
|
||||
|
||||
|
@ -353,39 +353,37 @@ HTMLBreadcrumbs.prototype = {
|
|||
* @param {DOMEvent} event.
|
||||
*/
|
||||
handleKeyPress: function(event) {
|
||||
let node = null;
|
||||
this._keyPromise = this._keyPromise || promise.resolve(null);
|
||||
let navigate = promise.resolve(null);
|
||||
|
||||
this._keyPromise = (this._keyPromise || promise.resolve(null)).then(() => {
|
||||
switch (event.keyCode) {
|
||||
case this.chromeWin.KeyEvent.DOM_VK_LEFT:
|
||||
if (this.currentIndex != 0) {
|
||||
node = promise.resolve(this.nodeHierarchy[this.currentIndex - 1].node);
|
||||
navigate = promise.resolve(
|
||||
this.nodeHierarchy[this.currentIndex - 1].node);
|
||||
}
|
||||
break;
|
||||
case this.chromeWin.KeyEvent.DOM_VK_RIGHT:
|
||||
if (this.currentIndex < this.nodeHierarchy.length - 1) {
|
||||
node = promise.resolve(this.nodeHierarchy[this.currentIndex + 1].node);
|
||||
navigate = promise.resolve(
|
||||
this.nodeHierarchy[this.currentIndex + 1].node);
|
||||
}
|
||||
break;
|
||||
case this.chromeWin.KeyEvent.DOM_VK_UP:
|
||||
node = this.walker.previousSibling(this.selection.nodeFront, {
|
||||
navigate = this.walker.previousSibling(this.selection.nodeFront, {
|
||||
whatToShow: Ci.nsIDOMNodeFilter.SHOW_ELEMENT
|
||||
});
|
||||
break;
|
||||
case this.chromeWin.KeyEvent.DOM_VK_DOWN:
|
||||
node = this.walker.nextSibling(this.selection.nodeFront, {
|
||||
navigate = this.walker.nextSibling(this.selection.nodeFront, {
|
||||
whatToShow: Ci.nsIDOMNodeFilter.SHOW_ELEMENT
|
||||
});
|
||||
break;
|
||||
}
|
||||
|
||||
return node.then((node) => {
|
||||
if (node) {
|
||||
this.selection.setNodeFront(node, "breadcrumbs");
|
||||
}
|
||||
});
|
||||
return navigate.then(node => this.navigateTo(node));
|
||||
});
|
||||
|
||||
event.preventDefault();
|
||||
event.stopPropagation();
|
||||
},
|
||||
|
@ -470,6 +468,14 @@ HTMLBreadcrumbs.prototype = {
|
|||
}
|
||||
},
|
||||
|
||||
navigateTo: function(node) {
|
||||
if (node) {
|
||||
this.selection.setNodeFront(node, "breadcrumbs");
|
||||
} else {
|
||||
this.inspector.emit("breadcrumbs-navigation-cancelled");
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Build a button representing the node.
|
||||
* @param {NodeFront} node The node from the page.
|
||||
|
@ -490,7 +496,7 @@ HTMLBreadcrumbs.prototype = {
|
|||
};
|
||||
|
||||
button.onBreadcrumbsClick = () => {
|
||||
this.selection.setNodeFront(node, "breadcrumbs");
|
||||
this.navigateTo(node);
|
||||
};
|
||||
|
||||
button.onBreadcrumbsHover = () => {
|
||||
|
|
|
@ -31,6 +31,7 @@ support-files =
|
|||
|
||||
[browser_inspector_breadcrumbs.js]
|
||||
[browser_inspector_breadcrumbs_highlight_hover.js]
|
||||
[browser_inspector_breadcrumbs_keybinding.js]
|
||||
[browser_inspector_breadcrumbs_menu.js]
|
||||
[browser_inspector_breadcrumbs_mutations.js]
|
||||
[browser_inspector_delete-selected-node-01.js]
|
||||
|
|
|
@ -0,0 +1,109 @@
|
|||
/* vim: set ft=javascript ts=2 et sw=2 tw=80: */
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
"use strict";
|
||||
|
||||
// Test that the breadcrumbs keybindings work.
|
||||
|
||||
const TEST_URI = TEST_URL_ROOT + "doc_inspector_breadcrumbs.html";
|
||||
const TEST_DATA = [{
|
||||
desc: "Pressing left should select the parent <body>",
|
||||
key: "VK_LEFT",
|
||||
newSelection: "body"
|
||||
}, {
|
||||
desc: "Pressing left again should select the parent <html>",
|
||||
key: "VK_LEFT",
|
||||
newSelection: "html"
|
||||
}, {
|
||||
desc: "Pressing left again should stay on root <html>",
|
||||
key: "VK_LEFT",
|
||||
newSelection: "html"
|
||||
}, {
|
||||
desc: "Pressing right should go down to <body>",
|
||||
key: "VK_RIGHT",
|
||||
newSelection: "body"
|
||||
}, {
|
||||
desc: "Pressing right again should go down to #i2",
|
||||
key: "VK_RIGHT",
|
||||
newSelection: "#i2"
|
||||
}, {
|
||||
desc: "Continue down to #i21",
|
||||
key: "VK_RIGHT",
|
||||
newSelection: "#i21"
|
||||
}, {
|
||||
desc: "Continue down to #i211",
|
||||
key: "VK_RIGHT",
|
||||
newSelection: "#i211"
|
||||
}, {
|
||||
desc: "Continue down to #i2111",
|
||||
key: "VK_RIGHT",
|
||||
newSelection: "#i2111"
|
||||
}, {
|
||||
desc: "Pressing right once more should stay at leaf node #i2111",
|
||||
key: "VK_RIGHT",
|
||||
newSelection: "#i2111"
|
||||
}, {
|
||||
desc: "Go back to #i211",
|
||||
key: "VK_LEFT",
|
||||
newSelection: "#i211"
|
||||
}, {
|
||||
desc: "Go back to #i21",
|
||||
key: "VK_LEFT",
|
||||
newSelection: "#i21"
|
||||
}, {
|
||||
desc: "Pressing down should move to next sibling #i22",
|
||||
key: "VK_DOWN",
|
||||
newSelection: "#i22"
|
||||
}, {
|
||||
desc: "Pressing up should move to previous sibling #i21",
|
||||
key: "VK_UP",
|
||||
newSelection: "#i21"
|
||||
}, {
|
||||
desc: "Pressing up again should stay on #i21 as there's no previous sibling",
|
||||
key: "VK_UP",
|
||||
newSelection: "#i21"
|
||||
}, {
|
||||
desc: "Going back down to #i22",
|
||||
key: "VK_DOWN",
|
||||
newSelection: "#i22"
|
||||
}, {
|
||||
desc: "Pressing down again should stay on #i22 as there's no next sibling",
|
||||
key: "VK_DOWN",
|
||||
newSelection: "#i22"
|
||||
}];
|
||||
|
||||
add_task(function*() {
|
||||
let {inspector} = yield openInspectorForURL(TEST_URI);
|
||||
|
||||
info("Selecting the test node");
|
||||
yield selectNode("#i2", inspector);
|
||||
|
||||
info("Clicking on the corresponding breadcrumbs node to focus it");
|
||||
let container = inspector.panelDoc.getElementById("inspector-breadcrumbs");
|
||||
|
||||
let button = container.querySelector("button[checked]");
|
||||
button.click();
|
||||
|
||||
let currentSelection = "#id2";
|
||||
for (let {desc, key, newSelection} of TEST_DATA) {
|
||||
info(desc);
|
||||
|
||||
let onUpdated;
|
||||
if (newSelection !== currentSelection) {
|
||||
info("Expecting a new node to be selected");
|
||||
onUpdated = inspector.once("breadcrumbs-updated");
|
||||
} else {
|
||||
info("Expecting the same node to remain selected");
|
||||
onUpdated = inspector.once("breadcrumbs-navigation-cancelled");
|
||||
}
|
||||
|
||||
EventUtils.synthesizeKey(key, {});
|
||||
yield onUpdated;
|
||||
|
||||
let newNodeFront = yield getNodeFront(newSelection, inspector);
|
||||
is(newNodeFront, inspector.selection.nodeFront,
|
||||
"The current selection is correct");
|
||||
|
||||
currentSelection = newSelection;
|
||||
}
|
||||
});
|
|
@ -15,9 +15,9 @@ const TEST_URI_XUL = TEST_URL_ROOT + "doc_content_stylesheet.xul";
|
|||
const XUL_URI = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService)
|
||||
.newURI(TEST_URI_XUL, null, null);
|
||||
const XUL_PRINCIPAL = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(XUL_URI);
|
||||
let ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
const XUL_PRINCIPAL = ssm.createCodebasePrincipal(XUL_URI, {});
|
||||
|
||||
add_task(function*() {
|
||||
info("Checking stylesheets on HTML document");
|
||||
|
|
|
@ -1056,6 +1056,10 @@ let UI = {
|
|||
},
|
||||
|
||||
updateToolboxFullscreenState: function() {
|
||||
if (projectList.sidebarsEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
let panel = document.querySelector("#deck").selectedPanel;
|
||||
let nbox = document.querySelector("#notificationbox");
|
||||
if (panel && panel.id == "deck-panel-details" &&
|
||||
|
|
|
@ -51,7 +51,7 @@
|
|||
ok(win.UI.toolboxIframe, "Toolbox iframe exists");
|
||||
|
||||
let nbox = win.document.querySelector("#notificationbox");
|
||||
ok(nbox.hasAttribute("toolboxfullscreen"), "Toolbox is fullsreen");
|
||||
ok(!nbox.hasAttribute("toolboxfullscreen"), "Toolbox is not fullscreen");
|
||||
|
||||
win.Cmds.showRuntimeDetails();
|
||||
|
||||
|
|
|
@ -995,14 +995,21 @@ PdfStreamConverter.prototype = {
|
|||
|
||||
// We can use resource principal when data is fetched by the chrome
|
||||
// e.g. useful for NoScript
|
||||
var securityManager = Cc['@mozilla.org/scriptsecuritymanager;1']
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
var ssm = Cc['@mozilla.org/scriptsecuritymanager;1']
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
var uri = NetUtil.newURI(PDF_VIEWER_WEB_PAGE, null, null);
|
||||
// FF16 and below had getCodebasePrincipal, it was replaced by
|
||||
// getNoAppCodebasePrincipal (bug 758258).
|
||||
var resourcePrincipal = 'getNoAppCodebasePrincipal' in securityManager ?
|
||||
securityManager.getNoAppCodebasePrincipal(uri) :
|
||||
securityManager.getCodebasePrincipal(uri);
|
||||
// FF 43 added createCodebasePrincipal to replace getNoAppCodebasePrincipal
|
||||
// (bug 1165272).
|
||||
var resourcePrincipal
|
||||
if ('createCodebasePrincipal' in ssm) {
|
||||
resourcePrincipal = ssm.createCodebasePrincipal(uri, {});
|
||||
} else if ('getNoAppCodebasePrincipal' in ssm) {
|
||||
resourcePrincipal = ssm.getNoAppCodebasePrincipal(uri)
|
||||
} else {
|
||||
resourcePrincipal = ssm.getCodebasePrincipal(uri);
|
||||
}
|
||||
aRequest.owner = resourcePrincipal;
|
||||
channel.asyncOpen(proxy, aContext);
|
||||
},
|
||||
|
|
|
@ -22,9 +22,9 @@ var SpecialStorageUtils = {
|
|||
createWrappedSpecialStorage: function (sandbox, swfUrl, privateBrowsing) {
|
||||
// Creating internal localStorage object based on url and privateBrowsing setting.
|
||||
var uri = Services.io.newURI(swfUrl, null, null);
|
||||
var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Components.interfaces.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri);
|
||||
var ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Components.interfaces.nsIScriptSecurityManager);
|
||||
var principal = ssm.createCodebasePrincipal(uri, {});
|
||||
var dsm = Components.classes["@mozilla.org/dom/localStorage-manager;1"]
|
||||
.getService(Components.interfaces.nsIDOMStorageManager);
|
||||
var storage = dsm.createStorage(null, principal, privateBrowsing);
|
||||
|
|
|
@ -8,10 +8,13 @@
|
|||
|
||||
<!ENTITY privateBrowsing.title "Private Browsing">
|
||||
|
||||
<!-- LOCALIZATION NOTE (aboutPrivateBrowsing.width):
|
||||
Width of the Private Browsing section.
|
||||
<!-- LOCALIZATION NOTE (aboutPrivateBrowsing.width1):
|
||||
Width of the Private Browsing section. This should depend primarily on the
|
||||
length of the headers and text, but should be roughly 1.5 times the width
|
||||
of the Tracking Protection section, and in general not much larger than
|
||||
30em to prevent the sections from wrapping on smaller window sizes.
|
||||
-->
|
||||
<!ENTITY aboutPrivateBrowsing.width "25em">
|
||||
<!ENTITY aboutPrivateBrowsing.width1 "30em">
|
||||
|
||||
<!-- LOCALIZATION NOTE (aboutPrivateBrowsing.subtitle,
|
||||
aboutPrivateBrowsing.info.forgotten, aboutPrivateBrowsing.info.kept):
|
||||
|
@ -36,11 +39,15 @@
|
|||
<!ENTITY aboutPrivateBrowsing.note1 "Please note that your employer or Internet service provider can still track the pages you visit.">
|
||||
<!ENTITY aboutPrivateBrowsing.learnMore "Learn More.">
|
||||
|
||||
<!-- LOCALIZATION NOTE (trackingProtection.width):
|
||||
Width of the Tracking Protection section. This should be enough to
|
||||
accommodate the title as well as the enabled or disabled indicator.
|
||||
<!-- LOCALIZATION NOTE (trackingProtection.width1):
|
||||
Width of the Tracking Protection section. It is fine for the enabled or
|
||||
disabled indicator or the words in the title to wrap to the next line, but
|
||||
you can expand or reduce this section to fit better, as long as the width
|
||||
of the Private Browsing section is roughly 1.5 times the width of this one.
|
||||
Note that the required space may vary between platforms because fonts are
|
||||
different, so testing on Windows, Mac, and Linux is encouraged.
|
||||
-->
|
||||
<!ENTITY trackingProtection.width "22em">
|
||||
<!ENTITY trackingProtection.width1 "22em">
|
||||
<!ENTITY trackingProtection.title "Tracking Protection">
|
||||
|
||||
<!-- LOCALIZATION NOTE (trackingProtection.state.width):
|
||||
|
|
|
@ -66,7 +66,8 @@ this.Feeds = {
|
|||
if (aIsFeed) {
|
||||
// re-create the principal as it may be a CPOW.
|
||||
let principalURI = BrowserUtils.makeURIFromCPOW(aPrincipal.URI);
|
||||
let principalToCheck = Services.scriptSecurityManager.getNoAppCodebasePrincipal(principalURI);
|
||||
let principalToCheck =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(principalURI, {});
|
||||
try {
|
||||
BrowserUtils.urlSecurityCheck(aLink.href, principalToCheck,
|
||||
Ci.nsIScriptSecurityManager.DISALLOW_INHERIT_PRINCIPAL);
|
||||
|
|
|
@ -546,6 +546,10 @@ box.requests-menu-status[code^="5"] {
|
|||
-moz-padding-start: 1em;
|
||||
}
|
||||
|
||||
.theme-dark #security-error-message {
|
||||
color: var(--theme-selection-color);
|
||||
}
|
||||
|
||||
#security-tabpanel {
|
||||
overflow: auto;
|
||||
}
|
||||
|
|
|
@ -28,6 +28,9 @@
|
|||
padding: 3px 5px;
|
||||
margin-inline-end: 4px;
|
||||
overflow: hidden;
|
||||
/* The latter two properties have a transition to handle the delayed hiding of
|
||||
the forward button when hovered. */
|
||||
transition: background-color 150ms ease, padding-left, padding-right;
|
||||
}
|
||||
|
||||
#identity-box:hover,
|
||||
|
@ -57,17 +60,15 @@
|
|||
border-radius: 0;
|
||||
}
|
||||
|
||||
@conditionalForwardWithUrlbar@:not([switchingtabs]) > #urlbar > #identity-box {
|
||||
transition: padding-left, padding-right;
|
||||
}
|
||||
|
||||
@conditionalForwardWithUrlbar@ > #forward-button[disabled] + #urlbar > #notification-popup-box[hidden] + #identity-box {
|
||||
padding-inline-start: calc(var(--backbutton-urlbar-overlap) + 4px);
|
||||
}
|
||||
|
||||
@conditionalForwardWithUrlbar@:hover:not([switchingtabs]) > #forward-button[disabled] + #urlbar > #notification-popup-box[hidden] + #identity-box {
|
||||
/* forward button hiding is delayed when hovered */
|
||||
transition-delay: 100s;
|
||||
/* Forward button hiding is delayed when hovered, so we should use the same
|
||||
delay for the identity box. We handle both horizontal paddings (for LTR and
|
||||
RTL), the latter two delays here are for padding-left and padding-right. */
|
||||
transition-delay: 0s, 100s, 100s;
|
||||
}
|
||||
|
||||
@conditionalForwardWithUrlbar@:not(:hover) > #forward-button[disabled] + #urlbar > #notification-popup-box[hidden] + #identity-box {
|
||||
|
|
|
@ -115,7 +115,7 @@
|
|||
.newtab-cell:not([ignorehover]) .newtab-link:hover,
|
||||
.newtab-site[dragged] {
|
||||
border: 2px solid white;
|
||||
box-shadow: 0 0 6px 2px #4cb1ff;
|
||||
box-shadow: 0 0 6px 1px #add6ff;
|
||||
margin: -2px;
|
||||
}
|
||||
|
||||
|
@ -168,8 +168,8 @@
|
|||
|
||||
.newtab-site:hover .newtab-title {
|
||||
color: white;
|
||||
background-color: black;
|
||||
border: 1px solid black;
|
||||
background-color: #333;
|
||||
border: 1px solid #333;
|
||||
border-top: 1px solid white;
|
||||
}
|
||||
|
||||
|
|
|
@ -438,9 +438,8 @@
|
|||
#tabbrowser-tabs:not([overflow]) > .tabbrowser-tab[last-visible-tab]:not([visuallyselected]):not([beforehovered]):not(:hover)::after {
|
||||
width: 1px;
|
||||
-moz-margin-start: -1px;
|
||||
padding-top: calc(var(--tab-separator-margin) + 1px);
|
||||
padding-bottom: var(--tab-separator-margin);
|
||||
background-clip: content-box;
|
||||
margin-top: calc(var(--tab-separator-margin) + 1px);
|
||||
margin-bottom: var(--tab-separator-margin);
|
||||
background-color: currentColor;
|
||||
opacity: var(--tab-separator-opacity);
|
||||
content: "";
|
||||
|
|
|
@ -26,7 +26,7 @@ class DomainPolicyClone;
|
|||
[ptr] native JSObjectPtr(JSObject);
|
||||
[ptr] native DomainPolicyClonePtr(mozilla::dom::DomainPolicyClone);
|
||||
|
||||
[scriptable, uuid(9a8f0b70-6b9f-4e19-8885-7cfe24f4a42d)]
|
||||
[scriptable, uuid(6e8a4d1e-d9c6-4d86-bf53-d73f58f36148)]
|
||||
interface nsIScriptSecurityManager : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -150,10 +150,12 @@ interface nsIScriptSecurityManager : nsISupports
|
|||
* @param appId is the app id of the principal. It can't be UNKNOWN_APP_ID.
|
||||
* @param inMozBrowser is true if the principal has to be considered as
|
||||
* inside a mozbrowser frame.
|
||||
*
|
||||
* @deprecated use createCodebasePrincipal instead.
|
||||
*/
|
||||
nsIPrincipal getAppCodebasePrincipal(in nsIURI uri,
|
||||
in unsigned long appId,
|
||||
in boolean inMozBrowser);
|
||||
[deprecated] nsIPrincipal getAppCodebasePrincipal(in nsIURI uri,
|
||||
in unsigned long appId,
|
||||
in boolean inMozBrowser);
|
||||
|
||||
/**
|
||||
* Returns a principal that has the appId and inMozBrowser of the load
|
||||
|
@ -175,8 +177,10 @@ interface nsIScriptSecurityManager : nsISupports
|
|||
* Returns a principal with that has the same origin as uri and is not part
|
||||
* of an appliction.
|
||||
* The returned principal will have appId = NO_APP_ID.
|
||||
*
|
||||
* @deprecated use createCodebasePrincipal instead.
|
||||
*/
|
||||
nsIPrincipal getNoAppCodebasePrincipal(in nsIURI uri);
|
||||
[deprecated] nsIPrincipal getNoAppCodebasePrincipal(in nsIURI uri);
|
||||
|
||||
/**
|
||||
* Legacy method for getting a principal with no origin attributes.
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/AutoRestore.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/Casting.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
|
@ -9360,9 +9361,6 @@ nsDocShell::CreatePrincipalFromReferrer(nsIURI* aReferrer,
|
|||
nsIPrincipal** aResult)
|
||||
{
|
||||
nsresult rv;
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan =
|
||||
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
uint32_t appId;
|
||||
rv = GetAppId(&appId);
|
||||
|
@ -9370,12 +9368,14 @@ nsDocShell::CreatePrincipalFromReferrer(nsIURI* aReferrer,
|
|||
bool isInBrowserElement;
|
||||
rv = GetIsInBrowserElement(&isInBrowserElement);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = secMan->GetAppCodebasePrincipal(aReferrer,
|
||||
appId,
|
||||
isInBrowserElement,
|
||||
aResult);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return NS_OK;
|
||||
|
||||
// TODO: Bug 1165466 - Pass mOriginAttributes directly.
|
||||
OriginAttributes attrs(appId, isInBrowserElement);
|
||||
nsCOMPtr<nsIPrincipal> prin =
|
||||
BasePrincipal::CreateCodebasePrincipal(aReferrer, attrs);
|
||||
prin.forget(aResult);
|
||||
|
||||
return *aResult ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
|
|
|
@ -11,15 +11,14 @@ function debug(s) {
|
|||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
const Cr = Components.results;
|
||||
|
||||
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
Cu.import("resource://gre/modules/Promise.jsm");
|
||||
try {
|
||||
if (Services.prefs.getBoolPref("dom.apps.customization.enabled")) {
|
||||
Cu.import("resource://gre/modules/UserCustomizations.jsm");
|
||||
}
|
||||
} catch(e) {}
|
||||
|
||||
XPCOMUtils.defineLazyModuleGetter(this, "UserCustomizations",
|
||||
"resource://gre/modules/UserCustomizations.jsm");
|
||||
|
||||
const APPS_SERVICE_CID = Components.ID("{05072afa-92fe-45bf-ae22-39b69c117058}");
|
||||
|
||||
|
@ -157,6 +156,16 @@ AppsService.prototype = {
|
|||
return null;
|
||||
},
|
||||
|
||||
isExtensionResource: function(aURI) {
|
||||
// This is only expected to be used by NeckoParent, and will not work
|
||||
// properly in child processes.
|
||||
if (Services.appinfo.processType != Ci.nsIXULRuntime.PROCESS_TYPE_DEFAULT) {
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
return UserCustomizations.isFromExtension(aURI);
|
||||
},
|
||||
|
||||
classID : APPS_SERVICE_CID,
|
||||
QueryInterface : XPCOMUtils.generateQI([Ci.nsIAppsService])
|
||||
}
|
||||
|
|
|
@ -73,11 +73,9 @@ mozIApplication.prototype = {
|
|||
this._principal = null;
|
||||
|
||||
try {
|
||||
this._principal = Services.scriptSecurityManager.getAppCodebasePrincipal(
|
||||
this._principal = Services.scriptSecurityManager.createCodebasePrincipal(
|
||||
Services.io.newURI(this.origin, null, null),
|
||||
this.localId,
|
||||
false /* mozbrowser */
|
||||
);
|
||||
{appId: this.localId});
|
||||
} catch(e) {
|
||||
dump("Could not create app principal " + e + "\n");
|
||||
}
|
||||
|
|
|
@ -228,8 +228,8 @@ function installCache(app) {
|
|||
if (!cacheManifest.exists())
|
||||
return;
|
||||
|
||||
let principal = Services.scriptSecurityManager.getAppCodebasePrincipal(
|
||||
app.origin, app.localId, false);
|
||||
let principal =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(app.origin, {appId: aApp.localId});
|
||||
|
||||
// If the build has been correctly configured, this should not happen!
|
||||
// If we install the cache anyway, it won't be updateable. If we don't install
|
||||
|
|
|
@ -40,7 +40,7 @@ this.ScriptPreloader = {
|
|||
let toLoad = aManifest.precompile.length;
|
||||
let principal =
|
||||
Services.scriptSecurityManager
|
||||
.getAppCodebasePrincipal(origin, aApp.localId, false);
|
||||
.createCodebasePrincipal(origin, {appId: aApp.localId});
|
||||
|
||||
aManifest.precompile.forEach((aPath) => {
|
||||
let uri = Services.io.newURI(aPath, null, origin);
|
||||
|
|
|
@ -34,6 +34,7 @@ function log(aStr) {
|
|||
|
||||
this.UserCustomizations = {
|
||||
extensions: new Map(), // id -> extension. Needed to disable extensions.
|
||||
appId: new Set(),
|
||||
|
||||
register: function(aApp) {
|
||||
if (!this._enabled || !aApp.enabled || aApp.role != "addon") {
|
||||
|
@ -51,7 +52,10 @@ this.UserCustomizations = {
|
|||
});
|
||||
|
||||
this.extensions.set(aApp.manifestURL, extension);
|
||||
extension.startup();
|
||||
extension.startup().then(() => {
|
||||
let uri = Services.io.newURI(aApp.origin, null, null);
|
||||
this.appId.add(uri.host);
|
||||
});
|
||||
},
|
||||
|
||||
unregister: function(aApp) {
|
||||
|
@ -63,9 +67,15 @@ this.UserCustomizations = {
|
|||
if (this.extensions.has(aApp.manifestURL)) {
|
||||
this.extensions.get(aApp.manifestURL).shutdown();
|
||||
this.extensions.delete(aApp.manifestURL);
|
||||
let uri = Services.io.newURI(aApp.origin, null, null);
|
||||
this.appId.delete(uri.host);
|
||||
}
|
||||
},
|
||||
|
||||
isFromExtension: function(aURI) {
|
||||
return this.appId.has(aURI.host);
|
||||
},
|
||||
|
||||
// Checks that this is a valid extension manifest.
|
||||
// The format is documented at https://developer.chrome.com/extensions/manifest
|
||||
checkExtensionManifest: function(aManifest) {
|
||||
|
|
|
@ -820,8 +820,7 @@ this.DOMApplicationRegistry = {
|
|||
let uri = Services.io.newURI(aOrigin, null, null);
|
||||
let secMan = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
let principal = secMan.getAppCodebasePrincipal(uri, aId,
|
||||
/*mozbrowser*/ false);
|
||||
let principal = secMan.createCodebasePrincipal(uri, {appId: aId});
|
||||
if (!dataStoreService.checkPermission(principal)) {
|
||||
return;
|
||||
}
|
||||
|
@ -3369,8 +3368,9 @@ this.DOMApplicationRegistry = {
|
|||
let requestChannel;
|
||||
|
||||
let appURI = NetUtil.newURI(aNewApp.origin, null, null);
|
||||
let principal = Services.scriptSecurityManager.getAppCodebasePrincipal(
|
||||
appURI, aNewApp.localId, false);
|
||||
let principal =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(appURI,
|
||||
{appId: aNewApp.localId});
|
||||
|
||||
if (aIsLocalFileInstall) {
|
||||
requestChannel = NetUtil.newChannel({
|
||||
|
|
|
@ -95,7 +95,6 @@
|
|||
#include "nsThreadUtils.h"
|
||||
#include "nsILoadContext.h"
|
||||
#include "nsIPresShell.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsView.h"
|
||||
#include "nsViewManager.h"
|
||||
|
@ -192,6 +191,7 @@
|
|||
#include "nsRefreshDriver.h"
|
||||
|
||||
#include "mozilla/AddonPathService.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/Telemetry.h"
|
||||
#include "nsLocation.h"
|
||||
|
@ -256,6 +256,8 @@ static const char kStorageEnabled[] = "dom.storage.enabled";
|
|||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::dom::ipc;
|
||||
using mozilla::BasePrincipal;
|
||||
using mozilla::OriginAttributes;
|
||||
using mozilla::TimeStamp;
|
||||
using mozilla::TimeDuration;
|
||||
using mozilla::dom::cache::CacheStorage;
|
||||
|
@ -8607,21 +8609,14 @@ nsGlobalWindow::PostMessageMozOuter(JSContext* aCx, JS::Handle<JS::Value> aMessa
|
|||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptSecurityManager> ssm =
|
||||
nsContentUtils::GetSecurityManager();
|
||||
MOZ_ASSERT(ssm);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal = nsContentUtils::SubjectPrincipal();
|
||||
MOZ_ASSERT(principal);
|
||||
|
||||
uint32_t appId = principal->GetAppId();
|
||||
bool isInBrowser = principal->GetIsInBrowserElement();
|
||||
|
||||
OriginAttributes attrs = BasePrincipal::Cast(principal)->OriginAttributesRef();
|
||||
// Create a nsIPrincipal inheriting the app/browser attributes from the
|
||||
// caller.
|
||||
nsresult rv = ssm->GetAppCodebasePrincipal(originURI, appId, isInBrowser,
|
||||
getter_AddRefs(providedPrincipal));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
providedPrincipal = BasePrincipal::CreateCodebasePrincipal(originURI, attrs);
|
||||
if (NS_WARN_IF(!providedPrincipal)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -833,14 +833,16 @@ BrowserElementParent.prototype = {
|
|||
catch(e) {
|
||||
debug('Malformed referrer -- ' + e);
|
||||
}
|
||||
|
||||
// TODO Bug 1165466: use originAttributes from nsILoadContext.
|
||||
let attrs = {appId: this._frameLoader.loadContext.appId,
|
||||
inBrowser: this._frameLoader.loadContext.isInBrowserElement};
|
||||
// This simply returns null if there is no principal available
|
||||
// for the requested uri. This is an acceptable fallback when
|
||||
// calling newChannelFromURI2.
|
||||
principal =
|
||||
Services.scriptSecurityManager.getAppCodebasePrincipal(
|
||||
referrer,
|
||||
this._frameLoader.loadContext.appId,
|
||||
this._frameLoader.loadContext.isInBrowserElement);
|
||||
principal =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(
|
||||
referrer, attrs);
|
||||
}
|
||||
|
||||
debug('Using principal? ' + !!principal);
|
||||
|
|
|
@ -158,15 +158,17 @@ function testAuthJarNoInterfere(e) {
|
|||
|
||||
// Set a bunch of auth data that should not conflict with the correct auth data already
|
||||
// stored in the cache.
|
||||
var principal = secMan.getAppCodebasePrincipal(uri, 1, false);
|
||||
var attrs = {appId: 1};
|
||||
var principal = secMan.createCodebasePrincipal(uri, attrs);
|
||||
authMgr.setAuthIdentity('http', 'test', -1, 'basic', 'http_realm',
|
||||
'tests/dom/browser-element/mochitest/file_http_401_response.sjs',
|
||||
'', 'httpuser', 'wrongpass', false, principal);
|
||||
principal = secMan.getAppCodebasePrincipal(uri, 1, true);
|
||||
attrs = {appId: 1, inBrowser: true};
|
||||
principal = secMan.createCodebasePrincipal(uri, attrs);
|
||||
authMgr.setAuthIdentity('http', 'test', -1, 'basic', 'http_realm',
|
||||
'tests/dom/browser-element/mochitest/file_http_401_response.sjs',
|
||||
'', 'httpuser', 'wrongpass', false, principal);
|
||||
principal = secMan.getAppCodebasePrincipal(uri, secMan.NO_APP_ID, false);
|
||||
principal = secMan.createCodebasePrincipal(uri, {});
|
||||
authMgr.setAuthIdentity('http', 'test', -1, 'basic', 'http_realm',
|
||||
'tests/dom/browser-element/mochitest/file_http_401_response.sjs',
|
||||
'', 'httpuser', 'wrongpass', false, principal);
|
||||
|
@ -196,7 +198,7 @@ function testAuthJarInterfere(e) {
|
|||
var uri = ioService.newURI("http://test/tests/dom/browser-element/mochitest/file_http_401_response.sjs", null, null);
|
||||
|
||||
// Set some auth data that should overwrite the successful stored details.
|
||||
var principal = secMan.getAppCodebasePrincipal(uri, secMan.NO_APP_ID, true);
|
||||
var principal = secMan.createCodebasePrincipal(uri, {inBrowser: true});
|
||||
authMgr.setAuthIdentity('http', 'test', -1, 'basic', 'http_realm',
|
||||
'tests/dom/browser-element/mochitest/file_http_401_response.sjs',
|
||||
'', 'httpuser', 'wrongpass', false, principal);
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// attach to a different origin's CacheStorage
|
||||
var url = 'http://example.com/';
|
||||
var uri = Services.io.newURI(url, null, null);
|
||||
var principal = Services.scriptSecurityManager.getNoAppCodebasePrincipal(uri);
|
||||
var principal = Services.scriptSecurityManager.createCodebasePrincipal(uri, {});
|
||||
var storage = new CacheStorage('content', principal);
|
||||
|
||||
// verify we can use the other origin's CacheStorage as normal
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
#include "mozilla/dom/DataStoreImplBinding.h"
|
||||
#include "nsIDataStore.h"
|
||||
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
#include "mozilla/Preferences.h"
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
|
@ -56,6 +57,9 @@
|
|||
return NS_ERROR_FAILURE; \
|
||||
}
|
||||
|
||||
using mozilla::BasePrincipal;
|
||||
using mozilla::OriginAttributes;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
|
@ -213,17 +217,10 @@ ResetPermission(uint32_t aAppId, const nsAString& aOriginURL,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsIScriptSecurityManager* ssm = nsContentUtils::GetSecurityManager();
|
||||
if (!ssm) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
rv = ssm->GetAppCodebasePrincipal(uri, aAppId, false,
|
||||
getter_AddRefs(principal));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
}
|
||||
OriginAttributes attrs(aAppId, false);
|
||||
nsCOMPtr<nsIPrincipal> principal =
|
||||
BasePrincipal::CreateCodebasePrincipal(uri, attrs);
|
||||
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> pm =
|
||||
do_GetService(NS_PERMISSIONMANAGER_CONTRACTID);
|
||||
|
|
|
@ -18519,12 +18519,6 @@ FactoryOp::CheckAtLeastOneAppHasPermission(ContentParent* aContentParent,
|
|||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan =
|
||||
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
|
||||
if (NS_WARN_IF(!secMan)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPermissionManager> permMan =
|
||||
mozilla::services::GetPermissionManager();
|
||||
if (NS_WARN_IF(!permMan)) {
|
||||
|
@ -18548,24 +18542,9 @@ FactoryOp::CheckAtLeastOneAppHasPermission(ContentParent* aContentParent,
|
|||
return false;
|
||||
}
|
||||
|
||||
nsString origin;
|
||||
rv = app->GetOrigin(origin);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
rv = NS_NewURI(getter_AddRefs(uri), origin, nullptr, nullptr, ioService);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
rv = secMan->GetAppCodebasePrincipal(uri, appId, false,
|
||||
getter_AddRefs(principal));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return false;
|
||||
}
|
||||
app->GetPrincipal(getter_AddRefs(principal));
|
||||
NS_ENSURE_TRUE(principal, false);
|
||||
|
||||
uint32_t permission;
|
||||
rv = permMan->TestExactPermissionFromPrincipal(principal,
|
||||
|
|
|
@ -116,9 +116,9 @@ function setPermission(url, permission)
|
|||
let uri = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService)
|
||||
.newURI(url, null, null);
|
||||
let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri);
|
||||
let ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
let principal = ssm.createCodebasePrincipal(uri, {});
|
||||
|
||||
Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(nsIPermissionManager)
|
||||
|
@ -131,9 +131,9 @@ function removePermission(url, permission)
|
|||
let uri = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService)
|
||||
.newURI(url, null, null);
|
||||
let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri);
|
||||
let ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
let principal = ssm.createCodebasePrincipal(uri, {});
|
||||
|
||||
Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Components.interfaces.nsIPermissionManager)
|
||||
|
@ -145,9 +145,9 @@ function getPermission(url, permission)
|
|||
let uri = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService)
|
||||
.newURI(url, null, null);
|
||||
let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri);
|
||||
let ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
let principal = ssm.createCodebasePrincipal(uri, {});
|
||||
|
||||
return Components.classes["@mozilla.org/permissionmanager;1"]
|
||||
.getService(Components.interfaces.nsIPermissionManager)
|
||||
|
|
|
@ -90,13 +90,10 @@ function testSteps()
|
|||
let request;
|
||||
if ("url" in params) {
|
||||
let uri = ios.newURI(params.url, null, null);
|
||||
let principal;
|
||||
if ("appId" in params) {
|
||||
principal = ssm.getAppCodebasePrincipal(uri, params.appId,
|
||||
params.inMozBrowser);
|
||||
} else {
|
||||
principal = ssm.getNoAppCodebasePrincipal(uri);
|
||||
}
|
||||
let principal =
|
||||
ssm.createCodebasePrincipal(uri,
|
||||
{appId: params.appId || ssm.NO_APPID,
|
||||
inBrowser: params.inMozBrowser});
|
||||
if ("dbVersion" in params) {
|
||||
request = indexedDB.openForPrincipal(principal, params.dbName,
|
||||
params.dbVersion);
|
||||
|
|
|
@ -10,9 +10,9 @@ function testSteps()
|
|||
let uri = Cc["@mozilla.org/network/io-service;1"].
|
||||
getService(Ci.nsIIOService).
|
||||
newURI("https://www.example.com", null, null);
|
||||
let principal = Cc["@mozilla.org/scriptsecuritymanager;1"].
|
||||
getService(Ci.nsIScriptSecurityManager).
|
||||
getNoAppCodebasePrincipal(uri);
|
||||
let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
let principal = ssm.createCodebasePrincipal(uri, {});
|
||||
|
||||
info("Setting permissions");
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ function testSteps()
|
|||
let request;
|
||||
if ("url" in params) {
|
||||
let uri = ios.newURI(params.url, null, null);
|
||||
let principal = ssm.getNoAppCodebasePrincipal(uri);
|
||||
let principal = ssm.createCodebasePrincipal(uri, {});
|
||||
request = indexedDB.openForPrincipal(principal, params.dbName,
|
||||
params.dbOptions);
|
||||
} else {
|
||||
|
|
|
@ -48,9 +48,9 @@ function testSteps()
|
|||
let uri = Components.classes["@mozilla.org/network/io-service;1"]
|
||||
.getService(Components.interfaces.nsIIOService)
|
||||
.newURI("http://appdata.example.com", null, null);
|
||||
let principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Components.interfaces.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri);
|
||||
let ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Components.interfaces.nsIScriptSecurityManager);
|
||||
let principal = ssm.createCodebasePrincipal(uri, {});
|
||||
|
||||
request = indexedDB.openForPrincipal(principal, name, 1);
|
||||
request.onerror = errorHandler;
|
||||
|
|
|
@ -34,9 +34,9 @@ function testSteps()
|
|||
let uri = Cc["@mozilla.org/network/io-service;1"]
|
||||
.getService(Ci.nsIIOService)
|
||||
.newURI(url, null, null);
|
||||
return Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri);
|
||||
let ssm = Cc["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
return ssm.createCodebasePrincipal(uri, {});
|
||||
}
|
||||
|
||||
for (let temporary of [true, false]) {
|
||||
|
|
|
@ -16,7 +16,7 @@ interface nsIURI;
|
|||
* This service allows accessing some DOMApplicationRegistry methods from
|
||||
* non-javascript code.
|
||||
*/
|
||||
[scriptable, uuid(03f1e30e-a1aa-4e18-ab3f-cd04b3b35a54)]
|
||||
[scriptable, uuid(8a035714-ed14-446f-8bd7-837e91cdce9e)]
|
||||
interface nsIAppsService : nsISupports
|
||||
{
|
||||
mozIApplication getAppByManifestURL(in DOMString manifestURL);
|
||||
|
@ -83,4 +83,11 @@ interface nsIAppsService : nsISupports
|
|||
* Returns the scope for app to use with service workers.
|
||||
*/
|
||||
DOMString getScopeByLocalId(in unsigned long localId);
|
||||
|
||||
/**
|
||||
* Returns true if this uri is a script or css resource loaded
|
||||
* from an extension.
|
||||
* Available only in the parent process.
|
||||
*/
|
||||
bool isExtensionResource(in nsIURI uri);
|
||||
};
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
#include "mozilla/hal_sandbox/PHalParent.h"
|
||||
#include "nsIAppsService.h"
|
||||
#include "nsIPrincipal.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "nsPrintfCString.h"
|
||||
#include "nsIURI.h"
|
||||
#include "nsNetUtil.h"
|
||||
|
@ -232,21 +231,10 @@ GetAppPrincipal(uint32_t aAppId)
|
|||
nsresult rv = appsService->GetAppByLocalId(aAppId, getter_AddRefs(app));
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
|
||||
nsString origin;
|
||||
rv = app->GetOrigin(origin);
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
app->GetPrincipal(getter_AddRefs(principal));
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
NS_NewURI(getter_AddRefs(uri), origin);
|
||||
|
||||
nsCOMPtr<nsIScriptSecurityManager> secMan =
|
||||
do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> appPrincipal;
|
||||
rv = secMan->GetAppCodebasePrincipal(uri, aAppId, false,
|
||||
getter_AddRefs(appPrincipal));
|
||||
NS_ENSURE_SUCCESS(rv, nullptr);
|
||||
return appPrincipal.forget();
|
||||
return principal.forget();
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
|
|
@ -1562,23 +1562,15 @@ TabChild::MaybeRequestPreinitCamera()
|
|||
return;
|
||||
}
|
||||
|
||||
nsString manifestUrl = EmptyString();
|
||||
appsService->GetManifestURLByLocalId(OwnAppId(), manifestUrl);
|
||||
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
|
||||
if (NS_WARN_IF(!secMan)) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), manifestUrl);
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
nsCOMPtr<mozIApplication> app;
|
||||
nsresult rv = appsService->GetAppByLocalId(OwnAppId(), getter_AddRefs(app));
|
||||
if (NS_WARN_IF(NS_FAILED(rv)) || !app) {
|
||||
return;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
rv = secMan->GetAppCodebasePrincipal(uri, OwnAppId(), false,
|
||||
getter_AddRefs(principal));
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
app->GetPrincipal(getter_AddRefs(principal));
|
||||
if (NS_WARN_IF(!principal)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -236,8 +236,9 @@ let PaymentManager = {
|
|||
if (systemAppId != Ci.nsIScriptSecurityManager.NO_APP_ID) {
|
||||
this.LOG("Granting firefox-accounts permission to " + provider.uri);
|
||||
let uri = Services.io.newURI(provider.uri, null, null);
|
||||
let principal = Services.scriptSecurityManager
|
||||
.getAppCodebasePrincipal(uri, systemAppId, true);
|
||||
let attrs = {appId: systemAppId, inBrowser: true};
|
||||
let principal =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(uri, attrs);
|
||||
|
||||
Services.perms.addFromPrincipal(principal, "firefox-accounts",
|
||||
Ci.nsIPermissionManager.ALLOW_ACTION,
|
||||
|
|
|
@ -35,10 +35,14 @@ XPCOMUtils.defineLazyServiceGetter(this,
|
|||
|
||||
PermissionSettings.prototype = {
|
||||
get: function get(aPermName, aManifestURL, aOrigin, aBrowserFlag) {
|
||||
// TODO: Bug 1196644 - Add signPKg parameter into PermissionSettings.js
|
||||
debug("Get called with: " + aPermName + ", " + aManifestURL + ", " + aOrigin + ", " + aBrowserFlag);
|
||||
let uri = Services.io.newURI(aOrigin, null, null);
|
||||
let appID = appsService.getAppLocalIdByManifestURL(aManifestURL);
|
||||
let principal = Services.scriptSecurityManager.getAppCodebasePrincipal(uri, appID, aBrowserFlag);
|
||||
let principal =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(uri,
|
||||
{appId: appID,
|
||||
inBrowser: aBrowserFlag});
|
||||
let result = Services.perms.testExactPermanentPermission(principal, aPermName);
|
||||
|
||||
switch (result)
|
||||
|
@ -59,11 +63,12 @@ PermissionSettings.prototype = {
|
|||
|
||||
isExplicit: function isExplicit(aPermName, aManifestURL, aOrigin,
|
||||
aBrowserFlag) {
|
||||
// TODO: Bug 1196644 - Add signPKg parameter into PermissionSettings.js
|
||||
debug("isExplicit: " + aPermName + ", " + aManifestURL + ", " + aOrigin);
|
||||
let uri = Services.io.newURI(aOrigin, null, null);
|
||||
let app = appsService.getAppByManifestURL(aManifestURL);
|
||||
let principal = Services.scriptSecurityManager
|
||||
.getAppCodebasePrincipal(uri, app.localId, aBrowserFlag);
|
||||
.createCodebasePrincipal(uri, {appId: app.localId, inBrowser: aBrowserFlag});
|
||||
|
||||
return isExplicitInPermissionsTable(aPermName,
|
||||
principal.appStatus,
|
||||
|
@ -99,9 +104,13 @@ PermissionSettings.prototype = {
|
|||
},
|
||||
|
||||
remove: function remove(aPermName, aManifestURL, aOrigin) {
|
||||
// TODO: Bug 1196644 - Add signPKg parameter into PermissionSettings.js
|
||||
let uri = Services.io.newURI(aOrigin, null, null);
|
||||
let appID = appsService.getAppLocalIdByManifestURL(aManifestURL);
|
||||
let principal = Services.scriptSecurityManager.getAppCodebasePrincipal(uri, appID, true);
|
||||
let principal =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(uri,
|
||||
{appId: appID,
|
||||
inBrowser: true});
|
||||
|
||||
if (principal.appStatus !== Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED) {
|
||||
let errorMsg = "PermissionSettings.js: '" + aOrigin + "'" +
|
||||
|
|
|
@ -67,9 +67,13 @@ this.PermissionSettingsModule = {
|
|||
|
||||
|
||||
_internalAddPermission: function _internalAddPermission(aData, aAllowAllChanges, aCallbacks) {
|
||||
// TODO: Bug 1196644 - Add signPKg parameter into PermissionSettings.jsm
|
||||
let uri = Services.io.newURI(aData.origin, null, null);
|
||||
let app = appsService.getAppByManifestURL(aData.manifestURL);
|
||||
let principal = Services.scriptSecurityManager.getAppCodebasePrincipal(uri, app.localId, aData.browserFlag);
|
||||
let principal =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(uri,
|
||||
{appId: app.localId,
|
||||
inBrowser: aData.browserFlag});
|
||||
|
||||
let action;
|
||||
switch (aData.value)
|
||||
|
@ -103,10 +107,14 @@ this.PermissionSettingsModule = {
|
|||
},
|
||||
|
||||
getPermission: function getPermission(aPermName, aManifestURL, aOrigin, aBrowserFlag) {
|
||||
// TODO: Bug 1196644 - Add signPKg parameter into PermissionSettings.jsm
|
||||
debug("getPermission: " + aPermName + ", " + aManifestURL + ", " + aOrigin);
|
||||
let uri = Services.io.newURI(aOrigin, null, null);
|
||||
let appID = appsService.getAppLocalIdByManifestURL(aManifestURL);
|
||||
let principal = Services.scriptSecurityManager.getAppCodebasePrincipal(uri, appID, aBrowserFlag);
|
||||
let principal =
|
||||
Services.scriptSecurityManager.createCodebasePrincipal(uri,
|
||||
{appId: appID,
|
||||
inBrowser: aBrowserFlag});
|
||||
let result = Services.perms.testExactPermissionFromPrincipal(principal, aPermName);
|
||||
|
||||
switch (result)
|
||||
|
|
|
@ -5288,10 +5288,9 @@ StorageDirectoryHelper::RunOnMainThread()
|
|||
rv = secMan->GetSimpleCodebasePrincipal(uri,
|
||||
getter_AddRefs(principal));
|
||||
} else {
|
||||
rv = secMan->GetAppCodebasePrincipal(uri,
|
||||
originProps.mAppId,
|
||||
originProps.mInMozBrowser,
|
||||
getter_AddRefs(principal));
|
||||
OriginAttributes attrs(originProps.mAppId, originProps.mInMozBrowser);
|
||||
principal = BasePrincipal::CreateCodebasePrincipal(uri, attrs);
|
||||
rv = principal ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
return rv;
|
||||
|
|
|
@ -27,9 +27,9 @@ function make_uri(url) {
|
|||
// Ensure "fullscreen" permissions are not present on the test URI.
|
||||
var pm = Cc["@mozilla.org/permissionmanager;1"].getService(Ci.nsIPermissionManager);
|
||||
var uri = make_uri("http://mochi.test:8888");
|
||||
var principal = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager)
|
||||
.getNoAppCodebasePrincipal(uri);
|
||||
var ssm = Components.classes["@mozilla.org/scriptsecuritymanager;1"]
|
||||
.getService(Ci.nsIScriptSecurityManager);
|
||||
var principal = ssm.createCodebasePrincipal(uri, {});
|
||||
pm.removeFromPrincipal(principal, "fullscreen");
|
||||
|
||||
SpecialPowers.pushPrefEnv({"set": [
|
||||
|
|
|
@ -18,11 +18,11 @@ function startTest()
|
|||
.getService(Components.interfaces.nsIDOMStorageManager);
|
||||
|
||||
var uri = ios.newURI(url, "", null);
|
||||
var principal = ssm.getNoAppCodebasePrincipal(uri);
|
||||
var principal = ssm.createCodebasePrincipal(uri, {});
|
||||
var storage = dsm.createStorage(window, principal, "");
|
||||
|
||||
|
||||
storage.setItem("chromekey", "chromevalue");
|
||||
|
||||
|
||||
var aframe = document.getElementById("aframe");
|
||||
aframe.onload = function()
|
||||
{
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
#include "nsContentUtils.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
#include "nsIEffectiveTLDService.h"
|
||||
#include "nsIScriptSecurityManager.h"
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
|
||||
// nsPermission Implementation
|
||||
|
@ -168,12 +167,9 @@ nsPermission::MatchesURI(nsIURI* aURI, bool aExactHost, bool* aMatches)
|
|||
{
|
||||
NS_ENSURE_ARG_POINTER(aURI);
|
||||
|
||||
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
|
||||
NS_ENSURE_TRUE(secMan, NS_ERROR_FAILURE);
|
||||
|
||||
nsCOMPtr<nsIPrincipal> principal;
|
||||
nsresult rv = secMan->GetNoAppCodebasePrincipal(aURI, getter_AddRefs(principal));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mozilla::OriginAttributes attrs;
|
||||
nsCOMPtr<nsIPrincipal> principal = mozilla::BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
|
||||
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
||||
|
||||
return Matches(principal, aExactHost, aMatches);
|
||||
}
|
||||
|
|
|
@ -126,19 +126,24 @@ GetPrincipalFromOrigin(const nsACString& aOrigin, nsIPrincipal** aPrincipal)
|
|||
nsresult
|
||||
GetPrincipal(nsIURI* aURI, uint32_t aAppId, bool aIsInBrowserElement, nsIPrincipal** aPrincipal)
|
||||
{
|
||||
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
|
||||
NS_ENSURE_TRUE(secMan, NS_ERROR_FAILURE);
|
||||
// TODO: Bug 1165267 - Use OriginAttributes for nsCookieService
|
||||
mozilla::OriginAttributes attrs(aAppId, aIsInBrowserElement);
|
||||
nsCOMPtr<nsIPrincipal> principal = mozilla::BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
|
||||
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
||||
|
||||
return secMan->GetAppCodebasePrincipal(aURI, aAppId, aIsInBrowserElement, aPrincipal);
|
||||
principal.forget(aPrincipal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
GetPrincipal(nsIURI* aURI, nsIPrincipal** aPrincipal)
|
||||
{
|
||||
nsIScriptSecurityManager* secMan = nsContentUtils::GetSecurityManager();
|
||||
NS_ENSURE_TRUE(secMan, NS_ERROR_FAILURE);
|
||||
mozilla::OriginAttributes attrs;
|
||||
nsCOMPtr<nsIPrincipal> principal = mozilla::BasePrincipal::CreateCodebasePrincipal(aURI, attrs);
|
||||
NS_ENSURE_TRUE(principal, NS_ERROR_FAILURE);
|
||||
|
||||
return secMan->GetNoAppCodebasePrincipal(aURI, aPrincipal);
|
||||
principal.forget(aPrincipal);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCString
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче