mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
merge mozilla-inbound to mozilla-central a=merge
This commit is contained in:
commit
108daa6a0d
2
CLOBBER
2
CLOBBER
@ -22,4 +22,4 @@
|
||||
# changes to stick? As of bug 928195, this shouldn't be necessary! Please
|
||||
# don't change CLOBBER for WebIDL changes any more.
|
||||
|
||||
Bug 1178892 requires clobber for profiler file moves.
|
||||
Bug 1178850 requires clobber for Android JNI header changes
|
||||
|
@ -5,3 +5,4 @@
|
||||
# This file is included at the bottom of all b2g mozconfigs
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -12,7 +12,6 @@ export GONK_PRODUCT=generic
|
||||
ac_add_options --with-gonk-toolchain-prefix="$topsrcdir/gonk-toolchain/prebuilt/$TOOLCHAIN_HOST/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-"
|
||||
ac_add_options --enable-debug-symbols
|
||||
ac_add_options --enable-debug
|
||||
#. "$topsrcdir/build/mozconfig.cache"
|
||||
ENABLE_MARIONETTE=1
|
||||
|
||||
# Enable dump() from JS.
|
||||
|
@ -13,7 +13,6 @@ export GONK_PRODUCT=generic
|
||||
ac_add_options --with-gonk-toolchain-prefix="$topsrcdir/gonk-toolchain/prebuilt/$TOOLCHAIN_HOST/toolchain/arm-linux-androideabi-4.4.x/bin/arm-linux-androideabi-"
|
||||
ac_add_options --enable-debug-symbols
|
||||
# ac_add_options --enable-profiling
|
||||
#. "$topsrcdir/build/mozconfig.cache"
|
||||
ENABLE_MARIONETTE=1
|
||||
|
||||
# Enable dump() from JS.
|
||||
|
@ -9,9 +9,6 @@ ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-signmar
|
||||
ac_add_options --enable-debug
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
#ac_add_options --enable-js-diagnostics
|
||||
|
||||
# This will overwrite the default of stripping everything and keep the symbol table.
|
||||
# This is useful for profiling and debugging and only increases the package size
|
||||
# by 2 MBs.
|
||||
@ -27,7 +24,6 @@ ac_add_options --enable-warnings-as-errors
|
||||
|
||||
# Use sccache
|
||||
no_sccache=
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
#B2G options
|
||||
ac_add_options --enable-application=b2g
|
||||
|
@ -9,9 +9,6 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
#ac_add_options --enable-js-diagnostics
|
||||
|
||||
# This will overwrite the default of stripping everything and keep the symbol table.
|
||||
# This is useful for profiling and debugging and only increases the package size
|
||||
# by 2 MBs.
|
||||
@ -27,7 +24,6 @@ ac_add_options --enable-warnings-as-errors
|
||||
|
||||
# Use sccache
|
||||
no_sccache=
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
#B2G options
|
||||
ac_add_options --enable-application=b2g
|
||||
|
@ -9,9 +9,6 @@ ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-signmar
|
||||
ac_add_options --enable-debug
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
#ac_add_options --enable-js-diagnostics
|
||||
|
||||
# This will overwrite the default of stripping everything and keep the symbol table.
|
||||
# This is useful for profiling and debugging and only increases the package size
|
||||
# by 2 MBs.
|
||||
@ -27,7 +24,6 @@ ac_add_options --enable-warnings-as-errors
|
||||
|
||||
# Use sccache
|
||||
no_sccache=
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
#B2G options
|
||||
ac_add_options --enable-application=b2g
|
||||
|
@ -9,9 +9,6 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
#ac_add_options --enable-js-diagnostics
|
||||
|
||||
# This will overwrite the default of stripping everything and keep the symbol table.
|
||||
# This is useful for profiling and debugging and only increases the package size
|
||||
# by 2 MBs.
|
||||
@ -27,7 +24,6 @@ ac_add_options --enable-warnings-as-errors
|
||||
|
||||
# Use sccache
|
||||
no_sccache=
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
#B2G options
|
||||
ac_add_options --enable-application=b2g
|
||||
|
@ -11,9 +11,6 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
||||
|
@ -12,9 +12,6 @@ ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
||||
|
@ -9,9 +9,6 @@ ac_add_options --enable-jemalloc
|
||||
ac_add_options --enable-signmar
|
||||
ac_add_options --enable-debug
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
||||
|
@ -9,9 +9,6 @@ ac_add_options --enable-update-packaging
|
||||
ac_add_options --enable-jemalloc
|
||||
ac_add_options --enable-signmar
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
||||
|
@ -1,28 +1,23 @@
|
||||
[
|
||||
{
|
||||
"size": 51,
|
||||
"digest": "c8e40edb314eeabfb92c77cf5ff9a7857033f15dd65a00349bcf9e3e5b75624afc71f733b2ff7e029c20a78313038409c2bd022bf7e5a7e0c487fc2c2d640986",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 80458572,
|
||||
"digest": "e5101f9dee1e462f6cbd3897ea57eede41d23981825c7b20d91d23ab461875d54d3dfc24999aa58a31e8b01f49fb3140e05ffe5af2957ef1d1afb89fd0dfe1ad",
|
||||
"algorithm": "sha512",
|
||||
"filename": "gcc.tar.xz",
|
||||
"unpack": "True"
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 167175,
|
||||
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
"filename": "sccache.tar.bz2",
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 31057326,
|
||||
"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51",
|
||||
"algorithm": "sha512",
|
||||
"filename": "moztt.tar.bz2",
|
||||
"unpack": "True"
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -1,28 +1,23 @@
|
||||
[
|
||||
{
|
||||
"size": 51,
|
||||
"digest": "c8e40edb314eeabfb92c77cf5ff9a7857033f15dd65a00349bcf9e3e5b75624afc71f733b2ff7e029c20a78313038409c2bd022bf7e5a7e0c487fc2c2d640986",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 80458572,
|
||||
"digest": "e5101f9dee1e462f6cbd3897ea57eede41d23981825c7b20d91d23ab461875d54d3dfc24999aa58a31e8b01f49fb3140e05ffe5af2957ef1d1afb89fd0dfe1ad",
|
||||
"algorithm": "sha512",
|
||||
"filename": "gcc.tar.xz",
|
||||
"unpack": "True"
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 167175,
|
||||
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
"filename": "sccache.tar.bz2",
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 31057326,
|
||||
"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51",
|
||||
"algorithm": "sha512",
|
||||
"filename": "moztt.tar.bz2",
|
||||
"unpack": "True"
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -3,28 +3,24 @@
|
||||
"clang_version": "r183744"
|
||||
},
|
||||
{
|
||||
"size": 88,
|
||||
"digest": "0d2ae9bcd7cea34ec0b768270725e98410dbb3bc150c7381e0dcf3eb5dbb3e69ac76dbb0f46b056151d6a6fa8681cab06da68173ae8598f3397b8f7628e67381",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 59602619,
|
||||
"digest": "86662ebc0ef650490559005948c4f0cb015dad72c7cac43732c2bf2995247081e30c139cf8008d19670a0009fc302c4eee2676981ee3f9ff4a15c01af22b783b",
|
||||
"algorithm": "sha512",
|
||||
"filename": "clang.tar.bz2"
|
||||
"filename": "clang.tar.bz2",
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 167175,
|
||||
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
"filename": "sccache.tar.bz2",
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 31057326,
|
||||
"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51",
|
||||
"algorithm": "sha512",
|
||||
"filename": "moztt.tar.bz2",
|
||||
"unpack": "True"
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -10,6 +10,13 @@
|
||||
"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51",
|
||||
"algorithm": "sha512",
|
||||
"filename": "moztt.tar.bz2",
|
||||
"unpack": "True"
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 167175,
|
||||
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2",
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -12,9 +12,6 @@ ac_add_options --enable-profiling
|
||||
ac_add_options --enable-instruments
|
||||
ac_add_options --enable-dtrace
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
||||
@ -30,3 +27,4 @@ export MOZ_PACKAGE_JSSHELL=1
|
||||
MOZTTDIR=$topsrcdir/moztt
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -1,27 +1,23 @@
|
||||
[
|
||||
{
|
||||
"size": 82,
|
||||
"digest": "70a6126249e40aa1da32248bf6bfe45e0d8c87334579ec0cf69403e61b635e27c766d9bf08d530978286552f158ee24c74b0168a57cc6b734dcfed4fc5e09cff",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 80458572,
|
||||
"digest": "e5101f9dee1e462f6cbd3897ea57eede41d23981825c7b20d91d23ab461875d54d3dfc24999aa58a31e8b01f49fb3140e05ffe5af2957ef1d1afb89fd0dfe1ad",
|
||||
"algorithm": "sha512",
|
||||
"filename": "gcc.tar.xz"
|
||||
"filename": "gcc.tar.xz",
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 167175,
|
||||
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
"filename": "sccache.tar.bz2",
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 31057326,
|
||||
"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51",
|
||||
"algorithm": "sha512",
|
||||
"filename": "moztt.tar.bz2",
|
||||
"unpack": "True"
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -3,28 +3,24 @@
|
||||
"clang_version": "r183744"
|
||||
},
|
||||
{
|
||||
"size": 88,
|
||||
"digest": "0d2ae9bcd7cea34ec0b768270725e98410dbb3bc150c7381e0dcf3eb5dbb3e69ac76dbb0f46b056151d6a6fa8681cab06da68173ae8598f3397b8f7628e67381",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 59602619,
|
||||
"digest": "86662ebc0ef650490559005948c4f0cb015dad72c7cac43732c2bf2995247081e30c139cf8008d19670a0009fc302c4eee2676981ee3f9ff4a15c01af22b783b",
|
||||
"algorithm": "sha512",
|
||||
"filename": "clang.tar.bz2"
|
||||
"filename": "clang.tar.bz2",
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 167175,
|
||||
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
"filename": "sccache.tar.bz2",
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 31057326,
|
||||
"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51",
|
||||
"algorithm": "sha512",
|
||||
"filename": "moztt.tar.bz2",
|
||||
"unpack": "True"
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -6,22 +6,17 @@
|
||||
"filename": "mozmake.exe"
|
||||
},
|
||||
{
|
||||
"size": 51,
|
||||
"digest": "c8e40edb314eeabfb92c77cf5ff9a7857033f15dd65a00349bcf9e3e5b75624afc71f733b2ff7e029c20a78313038409c2bd022bf7e5a7e0c487fc2c2d640986",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 167175,
|
||||
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
"filename": "sccache.tar.bz2",
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 31057326,
|
||||
"digest": "b844c3e52be493d2cacafa58c4a924b89c9be8d2dcc2a7c71aed58c253d8035fba4d51df309f73e3c4342a1f3c3898a9a25c4815e2112888d1280f43c41c8e51",
|
||||
"algorithm": "sha512",
|
||||
"filename": "moztt.tar.bz2",
|
||||
"unpack": "True"
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -11,7 +11,6 @@ MOZ_AUTOMATION_L10N_CHECK=0
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
||||
#Use ccache
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
|
||||
ac_add_options --enable-warnings-as-errors
|
||||
@ -22,3 +21,4 @@ export MOZ_PACKAGE_JSSHELL=1
|
||||
ac_add_options --with-branding=browser/branding/nightly
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -3,9 +3,6 @@
|
||||
ac_add_options --enable-signmar
|
||||
ac_add_options --enable-profiling
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
||||
# This will overwrite the default of stripping everything and keep the symbol table.
|
||||
# This is useful for profiling and debugging and only increases the package size
|
||||
# by 2 MBs.
|
||||
@ -13,7 +10,5 @@ STRIP_FLAGS="--strip-debug"
|
||||
|
||||
ac_add_options --with-branding=browser/branding/nightly
|
||||
|
||||
# Use ccache
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -10,9 +10,6 @@ MOZ_AUTOMATION_L10N_CHECK=0
|
||||
# Needed to enable breakpad in application.ini
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
||||
# Use ccache
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
# Treat warnings as errors in directories with FAIL_ON_WARNINGS.
|
||||
ac_add_options --enable-warnings-as-errors
|
||||
|
||||
@ -22,3 +19,4 @@ export MOZ_PACKAGE_JSSHELL=1
|
||||
ac_add_options --with-branding=browser/branding/nightly
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -3,9 +3,6 @@
|
||||
ac_add_options --enable-signmar
|
||||
ac_add_options --enable-profiling
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
||||
# This will overwrite the default of stripping everything and keep the symbol table.
|
||||
# This is useful for profiling and debugging and only increases the package size
|
||||
# by 2 MBs.
|
||||
@ -13,7 +10,5 @@ STRIP_FLAGS="--strip-debug"
|
||||
|
||||
ac_add_options --with-branding=browser/branding/nightly
|
||||
|
||||
# Use ccache
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -3,3 +3,4 @@
|
||||
ac_add_options --enable-official-branding
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -10,8 +10,7 @@ if test "${MOZ_UPDATE_CHANNEL}" = "nightly"; then
|
||||
ac_add_options --with-macbundlename-prefix=Firefox
|
||||
fi
|
||||
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
export MOZILLA_OFFICIAL=1
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -6,9 +6,6 @@ ac_add_options --enable-profiling
|
||||
ac_add_options --enable-instruments
|
||||
ac_add_options --enable-dtrace
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
||||
if test "${MOZ_UPDATE_CHANNEL}" = "nightly"; then
|
||||
ac_add_options --with-macbundlename-prefix=Firefox
|
||||
fi
|
||||
@ -16,3 +13,4 @@ fi
|
||||
ac_add_options --with-branding=browser/branding/nightly
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -9,3 +9,4 @@ ac_add_options --enable-official-branding
|
||||
export BUILDING_RELEASE=1
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -21,3 +21,4 @@ export MOZ_PACKAGE_JSSHELL=1
|
||||
ac_add_options --with-branding=browser/branding/nightly
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -13,3 +13,4 @@ ac_add_options --enable-warnings-as-errors
|
||||
ac_add_options --enable-clang-plugin
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -4,6 +4,6 @@ ac_add_options --with-l10n-base=../../l10n
|
||||
ac_add_options --enable-update-channel=${MOZ_UPDATE_CHANNEL}
|
||||
ac_add_options --enable-update-packaging
|
||||
ac_add_options --with-branding=browser/branding/nightly
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -19,3 +19,4 @@ export MOZ_PACKAGE_JSSHELL=1
|
||||
ac_add_options --with-branding=browser/branding/nightly
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -22,7 +22,6 @@ for platform in ['linux32', 'linux64', 'macosx-universal']:
|
||||
|
||||
for platform in ['linux32', 'linux64', 'macosx-universal', 'win32', 'win64']:
|
||||
whitelist['nightly'][platform] += ['ac_add_options --enable-signmar']
|
||||
whitelist['nightly'][platform] += ['ac_add_options --enable-js-diagnostics']
|
||||
|
||||
whitelist['nightly']['linux32'] += [
|
||||
'CXX=$REAL_CXX',
|
||||
|
@ -28,6 +28,5 @@ export MOZ_PACKAGE_JSSHELL=1
|
||||
|
||||
ac_add_options --with-branding=browser/branding/nightly
|
||||
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -4,11 +4,7 @@
|
||||
ac_add_options --enable-signmar
|
||||
ac_add_options --enable-profiling
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
||||
ac_add_options --with-branding=browser/branding/nightly
|
||||
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -30,6 +30,5 @@ ac_add_options --with-branding=browser/branding/nightly
|
||||
|
||||
. $topsrcdir/build/win64/mozconfig.vs2013
|
||||
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -5,11 +5,7 @@
|
||||
ac_add_options --enable-signmar
|
||||
ac_add_options --enable-profiling
|
||||
|
||||
# Nightlies only since this has a cost in performance
|
||||
ac_add_options --enable-js-diagnostics
|
||||
|
||||
ac_add_options --with-branding=browser/branding/nightly
|
||||
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
. "$topsrcdir/build/mozconfig.common.override"
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
@ -3,15 +3,10 @@
|
||||
"clang_version": "r185949"
|
||||
},
|
||||
{
|
||||
"size": 47,
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 72573411,
|
||||
"digest": "491753968f34d1bd3c58280688349499a92f31a118eb6f28e86746be62615004370394b8e1b10d48dc3fba4bc6d4fbb4ce6c7dbc4fadb39447de9aa55573c58e",
|
||||
"algorithm": "sha512",
|
||||
"filename": "clang.tar.bz2"
|
||||
"filename": "clang.tar.bz2",
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -3,15 +3,10 @@
|
||||
"clang_version": "r183744"
|
||||
},
|
||||
{
|
||||
"size": 47,
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 70206124,
|
||||
"digest": "a6b8046bd9485f9387dcb1c14b8d442822f02b1caa61b653e8b6cfd96906deadfb4b29809f2cd2b71f919b321d97dd2ebec6020c15f6d485f1641c0f710a762f",
|
||||
"algorithm": "sha512",
|
||||
"filename": "clang.tar.bz2"
|
||||
"filename": "clang.tar.bz2",
|
||||
"unpack": true,
|
||||
}
|
||||
]
|
||||
|
@ -1,20 +1,16 @@
|
||||
[
|
||||
{
|
||||
"size": 82,
|
||||
"digest": "70a6126249e40aa1da32248bf6bfe45e0d8c87334579ec0cf69403e61b635e27c766d9bf08d530978286552f158ee24c74b0168a57cc6b734dcfed4fc5e09cff",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 80458572,
|
||||
"digest": "e5101f9dee1e462f6cbd3897ea57eede41d23981825c7b20d91d23ab461875d54d3dfc24999aa58a31e8b01f49fb3140e05ffe5af2957ef1d1afb89fd0dfe1ad",
|
||||
"algorithm": "sha512",
|
||||
"filename": "gcc.tar.xz"
|
||||
"filename": "gcc.tar.xz",
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 167175,
|
||||
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
"filename": "sccache.tar.bz2",
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -3,15 +3,10 @@
|
||||
"clang_version": "r200213"
|
||||
},
|
||||
{
|
||||
"size": 47,
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 71282740,
|
||||
"digest": "ee9edb1ef3afd9ab29e39565145545ad57e8d8d2538be4d822d7dbd64038f4529b0b287cecf48bf83def52a26ac2c6faa331686c3ad5e8b4ba4c22686ee0808f",
|
||||
"algorithm": "sha512",
|
||||
"filename": "clang.tar.bz2"
|
||||
"filename": "clang.tar.bz2",
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -3,15 +3,10 @@
|
||||
"clang_version": "r183744"
|
||||
},
|
||||
{
|
||||
"size": 47,
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 70350828,
|
||||
"digest": "6cd04e8ec44c6fef159349c22bd0476891e4a2d46479f9586283eaf3305e42f79c720d40dfec0e78d8899c1651189b12e285de60862ffd0612b0dac7a0c336c6",
|
||||
"algorithm": "sha512",
|
||||
"filename": "clang.tar.bz2"
|
||||
"filename": "clang.tar.bz2",
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -1,20 +1,16 @@
|
||||
[
|
||||
{
|
||||
"size": 82,
|
||||
"digest": "70a6126249e40aa1da32248bf6bfe45e0d8c87334579ec0cf69403e61b635e27c766d9bf08d530978286552f158ee24c74b0168a57cc6b734dcfed4fc5e09cff",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 80458572,
|
||||
"digest": "e5101f9dee1e462f6cbd3897ea57eede41d23981825c7b20d91d23ab461875d54d3dfc24999aa58a31e8b01f49fb3140e05ffe5af2957ef1d1afb89fd0dfe1ad",
|
||||
"algorithm": "sha512",
|
||||
"filename": "gcc.tar.xz"
|
||||
"filename": "gcc.tar.xz",
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 167175,
|
||||
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
"filename": "sccache.tar.bz2",
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -3,15 +3,10 @@
|
||||
"clang_version": "r200213"
|
||||
},
|
||||
{
|
||||
"size": 47,
|
||||
"digest": "2005a41fe97a5e00997063705f39d42b6a43b1cf7ba306cbc7b1513de34cdcd050fc6326efa2107f19ba0cc67914745dbf13154fa748010a93cf072481ef4aaa",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 58997296,
|
||||
"digest": "9757d142142442c881b8d1eb31c2fe80e1979a858e6133473b5574a5a3b9cdaf9abed32b2e246b715c9f0eb0969103337918215fc491feae196219e8fb03f0b1",
|
||||
"algorithm": "sha512",
|
||||
"filename": "clang.tar.bz2"
|
||||
"filename": "clang.tar.bz2",
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -3,21 +3,17 @@
|
||||
"clang_version": "r183744"
|
||||
},
|
||||
{
|
||||
"size": 88,
|
||||
"digest": "0d2ae9bcd7cea34ec0b768270725e98410dbb3bc150c7381e0dcf3eb5dbb3e69ac76dbb0f46b056151d6a6fa8681cab06da68173ae8598f3397b8f7628e67381",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 59602619,
|
||||
"digest": "86662ebc0ef650490559005948c4f0cb015dad72c7cac43732c2bf2995247081e30c139cf8008d19670a0009fc302c4eee2676981ee3f9ff4a15c01af22b783b",
|
||||
"algorithm": "sha512",
|
||||
"filename": "clang.tar.bz2"
|
||||
"filename": "clang.tar.bz2",
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 167175,
|
||||
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
"filename": "sccache.tar.bz2",
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -3,21 +3,17 @@
|
||||
"clang_version": "r183744"
|
||||
},
|
||||
{
|
||||
"size": 88,
|
||||
"digest": "0d2ae9bcd7cea34ec0b768270725e98410dbb3bc150c7381e0dcf3eb5dbb3e69ac76dbb0f46b056151d6a6fa8681cab06da68173ae8598f3397b8f7628e67381",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 59602619,
|
||||
"digest": "86662ebc0ef650490559005948c4f0cb015dad72c7cac43732c2bf2995247081e30c139cf8008d19670a0009fc302c4eee2676981ee3f9ff4a15c01af22b783b",
|
||||
"algorithm": "sha512",
|
||||
"filename": "clang.tar.bz2"
|
||||
"filename": "clang.tar.bz2",
|
||||
"unpack": true
|
||||
},
|
||||
{
|
||||
"size": 167175,
|
||||
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
"filename": "sccache.tar.bz2",
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -6,15 +6,10 @@
|
||||
"filename": "mozmake.exe"
|
||||
},
|
||||
{
|
||||
"size": 176,
|
||||
"digest": "2809058907ac5eefdc394113d2e4fe76ba559ac61c2eca2f88e7a12a74bdf44a15d9039fa8aa229f7362a14b67d67395063f68147ae098beac5dfcc78aff98da",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 167175,
|
||||
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
"filename": "sccache.tar.bz2",
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -6,15 +6,10 @@
|
||||
"filename": "mozmake.exe"
|
||||
},
|
||||
{
|
||||
"size": 176,
|
||||
"digest": "2809058907ac5eefdc394113d2e4fe76ba559ac61c2eca2f88e7a12a74bdf44a15d9039fa8aa229f7362a14b67d67395063f68147ae098beac5dfcc78aff98da",
|
||||
"algorithm": "sha512",
|
||||
"filename": "setup.sh"
|
||||
},
|
||||
{
|
||||
"size": 167175,
|
||||
"digest": "0b71a936edf5bd70cf274aaa5d7abc8f77fe8e7b5593a208f805cc9436fac646b9c4f0b43c2b10de63ff3da671497d35536077ecbc72dba7f8159a38b580f831",
|
||||
"algorithm": "sha512",
|
||||
"filename": "sccache.tar.bz2"
|
||||
"filename": "sccache.tar.bz2",
|
||||
"unpack": true
|
||||
}
|
||||
]
|
||||
|
@ -436,7 +436,8 @@
|
||||
@RESPATH@/components/addoncompat.manifest
|
||||
@RESPATH@/components/multiprocessShims.js
|
||||
@RESPATH@/components/defaultShims.js
|
||||
@RESPATH@/components/remoteTagService.js
|
||||
@RESPATH@/components/utils.manifest
|
||||
@RESPATH@/components/simpleServices.js
|
||||
@RESPATH@/components/pluginGlue.manifest
|
||||
@RESPATH@/components/ProcessSingleton.manifest
|
||||
@RESPATH@/components/MainProcessSingleton.js
|
||||
@ -888,6 +889,8 @@ bin/libfreebl_32int64_3.so
|
||||
@RESPATH@/components/DataStoreImpl.js
|
||||
@RESPATH@/components/dom_datastore.xpt
|
||||
|
||||
@RESPATH@/components/dom_audiochannel.xpt
|
||||
|
||||
; Shutdown Terminator
|
||||
@RESPATH@/components/nsTerminatorTelemetry.js
|
||||
@RESPATH@/components/terminator.manifest
|
||||
|
@ -15,14 +15,15 @@ import java.util.Arrays;
|
||||
import java.util.Iterator;
|
||||
|
||||
public class AnnotationProcessor {
|
||||
public static final String OUTFILE = "GeneratedJNIWrappers.cpp";
|
||||
public static final String HEADERFILE = "GeneratedJNIWrappers.h";
|
||||
public static final String SOURCE_FILE = "GeneratedJNIWrappers.cpp";
|
||||
public static final String HEADER_FILE = "GeneratedJNIWrappers.h";
|
||||
public static final String NATIVES_FILE = "GeneratedJNINatives.h";
|
||||
|
||||
public static final String GENERATED_COMMENT =
|
||||
"// GENERATED CODE\n" +
|
||||
"// Generated by the Java program at /build/annotationProcessors at compile time\n" +
|
||||
"// from annotations on Java methods. To update, change the annotations on the\n" +
|
||||
"// corresponding Javamethods and rerun the build. Manually updating this file\n" +
|
||||
"// corresponding Java methods and rerun the build. Manually updating this file\n" +
|
||||
"// will cause your build to fail.\n" +
|
||||
"\n";
|
||||
|
||||
@ -47,8 +48,8 @@ public class AnnotationProcessor {
|
||||
|
||||
StringBuilder headerFile = new StringBuilder(GENERATED_COMMENT);
|
||||
headerFile.append(
|
||||
"#ifndef GeneratedJNIWrappers_h__\n" +
|
||||
"#define GeneratedJNIWrappers_h__\n" +
|
||||
"#ifndef " + getHeaderGuardName(HEADER_FILE) + "\n" +
|
||||
"#define " + getHeaderGuardName(HEADER_FILE) + "\n" +
|
||||
"\n" +
|
||||
"#include \"mozilla/jni/Refs.h\"\n" +
|
||||
"\n" +
|
||||
@ -65,6 +66,18 @@ public class AnnotationProcessor {
|
||||
"namespace widget {\n" +
|
||||
"\n");
|
||||
|
||||
StringBuilder nativesFile = new StringBuilder(GENERATED_COMMENT);
|
||||
nativesFile.append(
|
||||
"#ifndef " + getHeaderGuardName(NATIVES_FILE) + "\n" +
|
||||
"#define " + getHeaderGuardName(NATIVES_FILE) + "\n" +
|
||||
"\n" +
|
||||
"#include \"GeneratedJNIWrappers.h\"\n" +
|
||||
"#include \"mozilla/jni/Natives.h\"\n" +
|
||||
"\n" +
|
||||
"namespace mozilla {\n" +
|
||||
"namespace widget {\n" +
|
||||
"\n");
|
||||
|
||||
while (jarClassIterator.hasNext()) {
|
||||
ClassWithOptions aClassTuple = jarClassIterator.next();
|
||||
|
||||
@ -85,6 +98,9 @@ public class AnnotationProcessor {
|
||||
case METHOD:
|
||||
generatorInstance.generateMethod(aElementTuple);
|
||||
break;
|
||||
case NATIVE:
|
||||
generatorInstance.generateNative(aElementTuple);
|
||||
break;
|
||||
case FIELD:
|
||||
generatorInstance.generateField(aElementTuple);
|
||||
break;
|
||||
@ -96,6 +112,7 @@ public class AnnotationProcessor {
|
||||
|
||||
headerFile.append(generatorInstance.getHeaderFileContents());
|
||||
implementationFile.append(generatorInstance.getWrapperFileContents());
|
||||
nativesFile.append(generatorInstance.getNativesFileContents());
|
||||
}
|
||||
|
||||
implementationFile.append(
|
||||
@ -107,38 +124,33 @@ public class AnnotationProcessor {
|
||||
"\n" +
|
||||
"} /* widget */\n" +
|
||||
"} /* mozilla */\n" +
|
||||
"#endif // GeneratedJNIWrappers_h__\n");
|
||||
"#endif // " + getHeaderGuardName(HEADER_FILE) + "\n");
|
||||
|
||||
writeOutputFiles(headerFile, implementationFile);
|
||||
nativesFile.append(
|
||||
"\n" +
|
||||
"} /* widget */\n" +
|
||||
"} /* mozilla */\n" +
|
||||
"#endif // " + getHeaderGuardName(NATIVES_FILE) + "\n");
|
||||
|
||||
writeOutputFile(SOURCE_FILE, implementationFile);
|
||||
writeOutputFile(HEADER_FILE, headerFile);
|
||||
writeOutputFile(NATIVES_FILE, nativesFile);
|
||||
long e = System.currentTimeMillis();
|
||||
System.out.println("Annotation processing complete in " + (e - s) + "ms");
|
||||
}
|
||||
|
||||
private static void writeOutputFiles(StringBuilder aHeaderFile, StringBuilder aImplementationFile) {
|
||||
FileOutputStream headerStream = null;
|
||||
try {
|
||||
headerStream = new FileOutputStream(OUTFILE);
|
||||
headerStream.write(aImplementationFile.toString().getBytes());
|
||||
} catch (IOException e) {
|
||||
System.err.println("Unable to write " + OUTFILE + ". Perhaps a permissions issue?");
|
||||
e.printStackTrace(System.err);
|
||||
} finally {
|
||||
if (headerStream != null) {
|
||||
try {
|
||||
headerStream.close();
|
||||
} catch (IOException e) {
|
||||
System.err.println("Unable to close headerStream due to "+e);
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
private static String getHeaderGuardName(final String name) {
|
||||
return name.replaceAll("\\W", "_");
|
||||
}
|
||||
|
||||
private static void writeOutputFile(final String name,
|
||||
final StringBuilder content) {
|
||||
FileOutputStream outStream = null;
|
||||
try {
|
||||
outStream = new FileOutputStream(HEADERFILE);
|
||||
outStream.write(aHeaderFile.toString().getBytes());
|
||||
outStream = new FileOutputStream(name);
|
||||
outStream.write(content.toString().getBytes());
|
||||
} catch (IOException e) {
|
||||
System.err.println("Unable to write " + HEADERFILE + ". Perhaps a permissions issue?");
|
||||
System.err.println("Unable to write " + name + ". Perhaps a permissions issue?");
|
||||
e.printStackTrace(System.err);
|
||||
} finally {
|
||||
if (outStream != null) {
|
||||
|
@ -22,6 +22,8 @@ public class CodeGenerator {
|
||||
// Buffers holding the strings to ultimately be written to the output files.
|
||||
private final StringBuilder cpp = new StringBuilder();
|
||||
private final StringBuilder header = new StringBuilder();
|
||||
private final StringBuilder natives = new StringBuilder();
|
||||
private final StringBuilder nativesInits = new StringBuilder();
|
||||
|
||||
private final Class<?> cls;
|
||||
private final String clsName;
|
||||
@ -33,13 +35,13 @@ public class CodeGenerator {
|
||||
this.clsName = annotatedClass.generatedName;
|
||||
|
||||
header.append(
|
||||
"class " + clsName + " : public mozilla::jni::Class<" + clsName + "> {\n" +
|
||||
"\n" +
|
||||
"class " + clsName + " : public mozilla::jni::Class<" + clsName + ">\n" +
|
||||
"{\n" +
|
||||
"public:\n" +
|
||||
" typedef mozilla::jni::Ref<" + clsName + "> Ref;\n" +
|
||||
" typedef mozilla::jni::LocalRef<" + clsName + "> LocalRef;\n" +
|
||||
" typedef mozilla::jni::GlobalRef<" + clsName + "> GlobalRef;\n" +
|
||||
" typedef const typename mozilla::jni::Param<" + clsName + ">::Type& Param;\n" +
|
||||
" typedef const mozilla::jni::Param<" + clsName + ">& Param;\n" +
|
||||
"\n" +
|
||||
" static constexpr char name[] =\n" +
|
||||
" \"" + cls.getName().replace('.', '/') + "\";\n" +
|
||||
@ -51,6 +53,12 @@ public class CodeGenerator {
|
||||
cpp.append(
|
||||
"constexpr char " + clsName + "::name[];\n" +
|
||||
"\n");
|
||||
|
||||
natives.append(
|
||||
"template<class Impl>\n" +
|
||||
"class " + clsName + "::Natives : " +
|
||||
"public mozilla::jni::NativeImpl<" + clsName + ", Impl>\n" +
|
||||
"{\n");
|
||||
}
|
||||
|
||||
private String getTraitsName(String uniqueName, boolean includeScope) {
|
||||
@ -72,20 +80,30 @@ public class CodeGenerator {
|
||||
}
|
||||
|
||||
private void generateMember(AnnotationInfo info, Member member,
|
||||
String uniqueName, Class<?> type) {
|
||||
String uniqueName, Class<?> type, Class<?>[] argTypes) {
|
||||
final StringBuilder args = new StringBuilder();
|
||||
for (Class<?> argType : argTypes) {
|
||||
args.append("\n " + getNativeParameterType(argType, info) + ",");
|
||||
}
|
||||
if (args.length() > 0) {
|
||||
args.setLength(args.length() - 1);
|
||||
}
|
||||
|
||||
header.append(
|
||||
"public:\n" +
|
||||
" struct " + getTraitsName(uniqueName, /* includeScope */ false) + " {\n" +
|
||||
" typedef " + clsName + " Owner;\n" +
|
||||
" typedef " + getNativeReturnType(type, info) + " ReturnType;\n" +
|
||||
" typedef " + getNativeParameterType(type, info) + " SetterType;\n" +
|
||||
" typedef mozilla::jni::Args<" + args + "> Args;\n" +
|
||||
" static constexpr char name[] = \"" +
|
||||
Utils.getMemberName(member) + "\";\n" +
|
||||
" static constexpr char signature[] =\n" +
|
||||
" \"" + Utils.getSignature(member) + "\";\n" +
|
||||
" static const bool isStatic = " + Utils.isStatic(member) + ";\n" +
|
||||
" static const bool isMultithreaded = " + info.isMultithreaded + ";\n" +
|
||||
" static const mozilla::jni::ExceptionMode exceptionMode = " + (
|
||||
" static const mozilla::jni::ExceptionMode exceptionMode =\n" +
|
||||
" " + (
|
||||
info.catchException ? "mozilla::jni::ExceptionMode::NSRESULT" :
|
||||
info.noThrow ? "mozilla::jni::ExceptionMode::IGNORE" :
|
||||
"mozilla::jni::ExceptionMode::ABORT") + ";\n" +
|
||||
@ -248,15 +266,15 @@ public class CodeGenerator {
|
||||
final Method method = annotatedMethod.getMethod();
|
||||
final AnnotationInfo info = annotatedMethod.mAnnotationInfo;
|
||||
final String uniqueName = getUniqueMethodName(info.wrapperName);
|
||||
final Class<?>[] argTypes = method.getParameterTypes();
|
||||
final Class<?> returnType = method.getReturnType();
|
||||
|
||||
if (method.isSynthetic()) {
|
||||
return;
|
||||
}
|
||||
|
||||
generateMember(info, method, uniqueName, returnType);
|
||||
generateMember(info, method, uniqueName, returnType, argTypes);
|
||||
|
||||
final Class<?>[] argTypes = method.getParameterTypes();
|
||||
final boolean isStatic = Utils.isStatic(method);
|
||||
|
||||
header.append(
|
||||
@ -272,6 +290,35 @@ public class CodeGenerator {
|
||||
"\n");
|
||||
}
|
||||
|
||||
/**
|
||||
* Append the appropriate generated code to the buffers for the native method provided.
|
||||
*
|
||||
* @param annotatedMethod The Java native method, plus annotation data.
|
||||
*/
|
||||
public void generateNative(AnnotatableEntity annotatedMethod) {
|
||||
// Unpack the tuple and extract some useful fields from the Method..
|
||||
final Method method = annotatedMethod.getMethod();
|
||||
final AnnotationInfo info = annotatedMethod.mAnnotationInfo;
|
||||
final String uniqueName = getUniqueMethodName(info.wrapperName);
|
||||
final Class<?>[] argTypes = method.getParameterTypes();
|
||||
final Class<?> returnType = method.getReturnType();
|
||||
|
||||
generateMember(info, method, uniqueName, returnType, argTypes);
|
||||
|
||||
final String traits = getTraitsName(uniqueName, /* includeScope */ true);
|
||||
|
||||
if (nativesInits.length() > 0) {
|
||||
nativesInits.append(',');
|
||||
}
|
||||
|
||||
nativesInits.append(
|
||||
"\n" +
|
||||
"\n" +
|
||||
" mozilla::jni::MakeNativeMethod<" + traits + ">(\n" +
|
||||
" mozilla::jni::NativeStub<" + traits + ", Impl>\n" +
|
||||
" ::template Wrap<&Impl::" + info.wrapperName + ">)");
|
||||
}
|
||||
|
||||
private String getLiteral(Object val, AnnotationInfo info) {
|
||||
final Class<?> type = val.getClass();
|
||||
|
||||
@ -348,7 +395,7 @@ public class CodeGenerator {
|
||||
// Fall back to using accessors if we encounter an exception.
|
||||
}
|
||||
|
||||
generateMember(info, field, uniqueName, type);
|
||||
generateMember(info, field, uniqueName, type, EMPTY_CLASS_ARRAY);
|
||||
|
||||
final Class<?>[] getterArgs = EMPTY_CLASS_ARRAY;
|
||||
|
||||
@ -389,15 +436,14 @@ public class CodeGenerator {
|
||||
final AnnotationInfo info = annotatedConstructor.mAnnotationInfo;
|
||||
final String wrapperName = "New";
|
||||
final String uniqueName = getUniqueMethodName(wrapperName);
|
||||
final Class<?>[] argTypes = method.getParameterTypes();
|
||||
final Class<?> returnType = cls;
|
||||
|
||||
if (method.isSynthetic()) {
|
||||
return;
|
||||
}
|
||||
|
||||
generateMember(info, method, uniqueName, returnType);
|
||||
|
||||
final Class<?>[] argTypes = method.getParameterTypes();
|
||||
generateMember(info, method, uniqueName, returnType, argTypes);
|
||||
|
||||
header.append(
|
||||
" " + generateDeclaration(wrapperName, argTypes,
|
||||
@ -454,9 +500,34 @@ public class CodeGenerator {
|
||||
* @return The bytes to be written to the header file.
|
||||
*/
|
||||
public String getHeaderFileContents() {
|
||||
if (nativesInits.length() > 0) {
|
||||
header.append(
|
||||
"public:\n" +
|
||||
" template<class Impl> class Natives;\n");
|
||||
}
|
||||
header.append(
|
||||
"};\n" +
|
||||
"\n");
|
||||
return header.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the finalised bytes to go into the generated natives header file.
|
||||
*
|
||||
* @return The bytes to be written to the header file.
|
||||
*/
|
||||
public String getNativesFileContents() {
|
||||
if (nativesInits.length() == 0) {
|
||||
return "";
|
||||
}
|
||||
natives.append(
|
||||
"public:\n" +
|
||||
" static constexpr JNINativeMethod methods[] = {" + nativesInits + '\n' +
|
||||
" };\n" +
|
||||
"};\n" +
|
||||
"\n" +
|
||||
"template<class Impl>\n" +
|
||||
"constexpr JNINativeMethod " + clsName + "::Natives<Impl>::methods[];\n");
|
||||
return natives.toString();
|
||||
}
|
||||
}
|
||||
|
@ -10,13 +10,14 @@ import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Member;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
/**
|
||||
* Union type to hold either a method, field, or ctor. Allows us to iterate "The generatable stuff", despite
|
||||
* the fact that such things can be of either flavour.
|
||||
*/
|
||||
public class AnnotatableEntity {
|
||||
public enum ENTITY_TYPE {METHOD, FIELD, CONSTRUCTOR}
|
||||
public enum ENTITY_TYPE {METHOD, NATIVE, FIELD, CONSTRUCTOR}
|
||||
|
||||
private final Member mMember;
|
||||
public final ENTITY_TYPE mEntityType;
|
||||
@ -28,7 +29,11 @@ public class AnnotatableEntity {
|
||||
mAnnotationInfo = aAnnotationInfo;
|
||||
|
||||
if (aObject instanceof Method) {
|
||||
if (Modifier.isNative(aObject.getModifiers())) {
|
||||
mEntityType = ENTITY_TYPE.NATIVE;
|
||||
} else {
|
||||
mEntityType = ENTITY_TYPE.METHOD;
|
||||
}
|
||||
} else if (aObject instanceof Field) {
|
||||
mEntityType = ENTITY_TYPE.FIELD;
|
||||
} else {
|
||||
@ -37,7 +42,7 @@ public class AnnotatableEntity {
|
||||
}
|
||||
|
||||
public Method getMethod() {
|
||||
if (mEntityType != ENTITY_TYPE.METHOD) {
|
||||
if (mEntityType != ENTITY_TYPE.METHOD && mEntityType != ENTITY_TYPE.NATIVE) {
|
||||
throw new UnsupportedOperationException("Attempt to cast to unsupported member type.");
|
||||
}
|
||||
return (Method) mMember;
|
||||
|
@ -34,6 +34,4 @@ if [ -z "$CXX" ]; then
|
||||
export CXX=clang++
|
||||
fi
|
||||
|
||||
. "$topsrcdir/build/mozconfig.cache"
|
||||
|
||||
export SOCORRO_SYMBOL_UPLOAD_TOKEN_FILE=/builds/crash-stats-api.token
|
||||
|
@ -51,6 +51,10 @@ if test -z "$bucket"; then
|
||||
ac_add_options --with-ccache
|
||||
esac
|
||||
else
|
||||
if ! test -e $topsrcdir/sccache/sccache.py; then
|
||||
echo "Sccache missing in the tooltool manifest" >&2
|
||||
exit 1
|
||||
fi
|
||||
mk_add_options "export SCCACHE_BUCKET=$bucket"
|
||||
case "$master" in
|
||||
*use1.mozilla.com*|*usw2.mozilla.com*)
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include "mozilla/BasePrincipal.h"
|
||||
|
||||
#include "nsIAddonPolicyService.h"
|
||||
#include "nsIContentSecurityPolicy.h"
|
||||
#include "nsIObjectInputStream.h"
|
||||
#include "nsIObjectOutputStream.h"
|
||||
@ -15,6 +16,7 @@
|
||||
#include "nsIURIWithPrincipal.h"
|
||||
#include "nsNullPrincipal.h"
|
||||
#include "nsScriptSecurityManager.h"
|
||||
#include "nsServiceManagerUtils.h"
|
||||
|
||||
#include "mozilla/dom/CSPDictionariesBinding.h"
|
||||
#include "mozilla/dom/ToJSValue.h"
|
||||
@ -41,6 +43,10 @@ OriginAttributes::CreateSuffix(nsACString& aStr) const
|
||||
params->Set(NS_LITERAL_STRING("inBrowser"), NS_LITERAL_STRING("1"));
|
||||
}
|
||||
|
||||
if (!mAddonId.IsEmpty()) {
|
||||
params->Set(NS_LITERAL_STRING("addonId"), mAddonId);
|
||||
}
|
||||
|
||||
aStr.Truncate();
|
||||
|
||||
params->Serialize(value);
|
||||
@ -88,6 +94,12 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
if (aName.EqualsLiteral("addonId")) {
|
||||
MOZ_RELEASE_ASSERT(mOriginAttributes->mAddonId.IsEmpty());
|
||||
mOriginAttributes->mAddonId.Assign(aValue);
|
||||
return true;
|
||||
}
|
||||
|
||||
// No other attributes are supported.
|
||||
return false;
|
||||
}
|
||||
@ -346,4 +358,19 @@ BasePrincipal::CreateCodebasePrincipal(nsIURI* aURI, OriginAttributes& aAttrs)
|
||||
return codebase.forget();
|
||||
}
|
||||
|
||||
bool
|
||||
BasePrincipal::AddonAllowsLoad(nsIURI* aURI)
|
||||
{
|
||||
if (mOriginAttributes.mAddonId.IsEmpty()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAddonPolicyService> aps = do_GetService("@mozilla.org/addons/policy-service;1");
|
||||
NS_ENSURE_TRUE(aps, false);
|
||||
|
||||
bool allowed = false;
|
||||
nsresult rv = aps->AddonMayLoadURI(mOriginAttributes.mAddonId, aURI, &allowed);
|
||||
return NS_SUCCEEDED(rv) && allowed;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
@ -34,7 +34,8 @@ public:
|
||||
bool operator==(const OriginAttributes& aOther) const
|
||||
{
|
||||
return mAppId == aOther.mAppId &&
|
||||
mInBrowser == aOther.mInBrowser;
|
||||
mInBrowser == aOther.mInBrowser &&
|
||||
mAddonId == aOther.mAddonId;
|
||||
}
|
||||
bool operator!=(const OriginAttributes& aOther) const
|
||||
{
|
||||
@ -106,6 +107,10 @@ protected:
|
||||
virtual nsresult GetOriginInternal(nsACString& aOrigin) = 0;
|
||||
virtual bool SubsumesInternal(nsIPrincipal* aOther, DocumentDomainConsideration aConsider) = 0;
|
||||
|
||||
// Helper to check whether this principal is associated with an addon that
|
||||
// allows unprivileged code to load aURI.
|
||||
bool AddonAllowsLoad(nsIURI* aURI);
|
||||
|
||||
nsCOMPtr<nsIContentSecurityPolicy> mCSP;
|
||||
OriginAttributes mOriginAttributes;
|
||||
};
|
||||
|
@ -9,6 +9,7 @@ MOCHITEST_CHROME_MANIFESTS += ['tests/mochitest/chrome.ini']
|
||||
XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIAddonPolicyService.idl',
|
||||
'nsIDomainPolicy.idl',
|
||||
'nsIPrincipal.idl',
|
||||
'nsIScriptSecurityManager.idl',
|
||||
|
22
caps/nsIAddonPolicyService.idl
Normal file
22
caps/nsIAddonPolicyService.idl
Normal file
@ -0,0 +1,22 @@
|
||||
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
|
||||
*
|
||||
* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
#include "nsIURI.idl"
|
||||
|
||||
/**
|
||||
* This interface allows the security manager to query custom per-addon security
|
||||
* policy.
|
||||
*/
|
||||
[scriptable,uuid(fedf126c-988e-42df-82c9-f2ac99cd65f3)]
|
||||
interface nsIAddonPolicyService : nsISupports
|
||||
{
|
||||
/**
|
||||
* Returns true if unprivileged code associated with the given addon may load
|
||||
* data from |aURI|.
|
||||
*/
|
||||
boolean addonMayLoadURI(in AString aAddonId, in nsIURI aURI);
|
||||
};
|
@ -23,8 +23,8 @@
|
||||
class nsIURI;
|
||||
|
||||
#define NS_NULLPRINCIPAL_CID \
|
||||
{ 0xe502ffb8, 0x5d95, 0x48e8, \
|
||||
{ 0x82, 0x3c, 0x0d, 0x29, 0xd8, 0x3a, 0x59, 0x33 } }
|
||||
{ 0x34a19ab6, 0xca47, 0x4098, \
|
||||
{ 0xa7, 0xb8, 0x4a, 0xfc, 0xdd, 0xcd, 0x8f, 0x88 } }
|
||||
#define NS_NULLPRINCIPAL_CONTRACTID "@mozilla.org/nullprincipal;1"
|
||||
|
||||
#define NS_NULLPRINCIPAL_SCHEME "moz-nullprincipal"
|
||||
|
@ -236,6 +236,12 @@ nsPrincipal::CheckMayLoad(nsIURI* aURI, bool aReport, bool aAllowIfInheritsPrinc
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
// If this principal is associated with an addon, check whether that addon
|
||||
// has been given permission to load from this domain.
|
||||
if (AddonAllowsLoad(aURI)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
if (nsScriptSecurityManager::SecurityCompareURIs(mCodebase, aURI)) {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -112,12 +112,12 @@ private:
|
||||
|
||||
#define NS_PRINCIPAL_CONTRACTID "@mozilla.org/principal;1"
|
||||
#define NS_PRINCIPAL_CID \
|
||||
{ 0xb7c8505e, 0xc56d, 0x4191, \
|
||||
{ 0xa1, 0x5e, 0x5d, 0xcb, 0x88, 0x9b, 0xa0, 0x94 }}
|
||||
{ 0xb02c3023, 0x5b37, 0x472a, \
|
||||
{ 0xa2, 0xcd, 0x35, 0xaa, 0x5e, 0xe2, 0xa8, 0x19 } }
|
||||
|
||||
#define NS_EXPANDEDPRINCIPAL_CONTRACTID "@mozilla.org/expandedprincipal;1"
|
||||
#define NS_EXPANDEDPRINCIPAL_CID \
|
||||
{ 0x38539471, 0x68cc, 0x4a6f, \
|
||||
{ 0x81, 0x20, 0xdb, 0xd5, 0x4a, 0x22, 0x0a, 0x13 }}
|
||||
{ 0xe8ee88b0, 0x5571, 0x4086, \
|
||||
{ 0xa4, 0x5b, 0x39, 0xa7, 0x16, 0x90, 0x6b, 0xdb } }
|
||||
|
||||
#endif // nsPrincipal_h__
|
||||
|
@ -1,9 +1,10 @@
|
||||
[DEFAULT]
|
||||
skip-if = buildapp == 'b2g'
|
||||
skip-if = buildapp == 'b2g' || os == 'android'
|
||||
support-files =
|
||||
file_disableScript.html
|
||||
|
||||
[test_bug995943.xul]
|
||||
[test_addonMayLoad.html]
|
||||
[test_disableScript.xul]
|
||||
[test_principal_jarprefix_origin_appid_appstatus.html]
|
||||
# jarPrefix test doesn't work on Windows, see bug 776296.
|
||||
|
1
caps/tests/mochitest/file_data.txt
Normal file
1
caps/tests/mochitest/file_data.txt
Normal file
@ -0,0 +1 @@
|
||||
server data fetched over XHR
|
@ -1,5 +1,6 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
file_data.txt
|
||||
file_disableScript.html
|
||||
|
||||
[test_app_principal_equality.html]
|
||||
|
97
caps/tests/mochitest/test_addonMayLoad.html
Normal file
97
caps/tests/mochitest/test_addonMayLoad.html
Normal file
@ -0,0 +1,97 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<!--
|
||||
https://bugzilla.mozilla.org/show_bug.cgi?id=1180921
|
||||
-->
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test for Bug 1180921</title>
|
||||
<script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://global/skin"/>
|
||||
<link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"/>
|
||||
<script type="application/javascript;version=1.8">
|
||||
|
||||
/** Test for Bug 1180921 **/
|
||||
const Cc = Components.classes;
|
||||
const Ci = Components.interfaces;
|
||||
const Cu = Components.utils;
|
||||
Cu.import("resource://gre/modules/Services.jsm");
|
||||
let ssm = Services.scriptSecurityManager;
|
||||
let aps = Cc["@mozilla.org/addons/policy-service;1"].getService(Ci.nsIAddonPolicyService).wrappedJSObject;
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.registerCleanupFunction(function() {
|
||||
aps.setAddonLoadURICallback('addonA', null);
|
||||
aps.setAddonLoadURICallback('addonB', null);
|
||||
});
|
||||
|
||||
function tryLoad(sb, uri) {
|
||||
let p = new Promise(function(resolve, reject) {
|
||||
Cu.exportFunction(resolve, sb, { defineAs: "finish" });
|
||||
Cu.exportFunction(reject, sb, { defineAs: "error" });
|
||||
sb.eval("try { (function () { " +
|
||||
" var xhr = new XMLHttpRequest();" +
|
||||
" xhr.onreadystatechange = function() { if (xhr.readyState == XMLHttpRequest.DONE) { finish(xhr.status == 200); } };" +
|
||||
" xhr.open('GET', '" + uri + "', true);" +
|
||||
" xhr.send();" +
|
||||
"})() } catch (e) { error(e); }");
|
||||
});
|
||||
return p;
|
||||
}
|
||||
|
||||
let exampleCom_addonA = new Cu.Sandbox(ssm.createCodebasePrincipal(Services.io.newURI('http://example.com', null, null), {addonId: 'addonA'}),
|
||||
{wantGlobalProperties: ['XMLHttpRequest']});
|
||||
let nullPrin_addonA = new Cu.Sandbox(ssm.createNullPrincipal({addonId: 'addonA'}),
|
||||
{wantGlobalProperties: ['XMLHttpRequest']});
|
||||
let exampleCom_addonB = new Cu.Sandbox(ssm.createCodebasePrincipal(Services.io.newURI('http://example.com', null, null), {addonId: 'addonB'}),
|
||||
{wantGlobalProperties: ['XMLHttpRequest']});
|
||||
|
||||
function uriForDomain(d) { return d + '/tests/caps/tests/mochitest/file_data.txt' }
|
||||
|
||||
tryLoad(exampleCom_addonA, uriForDomain('http://example.com'))
|
||||
.then(function(success) {
|
||||
ok(success, "same-origin load should succeed for addon A");
|
||||
return tryLoad(nullPrin_addonA, uriForDomain('http://example.com'));
|
||||
}).then(function(success) {
|
||||
ok(!success, "null-principal load should fail for addon A");
|
||||
return tryLoad(exampleCom_addonB, uriForDomain('http://example.com'));
|
||||
}).then(function(success) {
|
||||
ok(success, "same-origin load should succeed for addon B");
|
||||
return tryLoad(exampleCom_addonA, uriForDomain('http://test1.example.org'));
|
||||
}).then(function(success) {
|
||||
ok(!success, "cross-origin load should fail for addon A");
|
||||
aps.setAddonLoadURICallback('addonA', function(uri) { return /test1/.test(uri.host); });
|
||||
aps.setAddonLoadURICallback('addonB', function(uri) { return /test2/.test(uri.host); });
|
||||
return tryLoad(exampleCom_addonA, uriForDomain('http://test1.example.org'));
|
||||
}).then(function(success) {
|
||||
ok(success, "whitelisted cross-origin load of test1 should succeed for addon A");
|
||||
return tryLoad(nullPrin_addonA, uriForDomain('http://test1.example.org'));
|
||||
}).then(function(success) {
|
||||
ok(!success, "whitelisted null principal load of test1 should still fail for addon A");
|
||||
return tryLoad(exampleCom_addonB, uriForDomain('http://test1.example.org'));
|
||||
}).then(function(success) {
|
||||
ok(!success, "non-whitelisted cross-origin load of test1 should fail for addon B");
|
||||
return tryLoad(exampleCom_addonB, uriForDomain('http://test2.example.org'));
|
||||
}).then(function(success) {
|
||||
ok(success, "whitelisted cross-origin load of test2 should succeed for addon B");
|
||||
return tryLoad(exampleCom_addonA, uriForDomain('http://test2.example.org'));
|
||||
}).then(function(success) {
|
||||
ok(!success, "non-whitelisted cross-origin load of test2 should fail for addon A");
|
||||
SimpleTest.finish();
|
||||
}, function(e) {
|
||||
ok(false, "Rejected promise chain: " + e);
|
||||
SimpleTest.finish();
|
||||
});
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1180921">Mozilla Bug 1180921</a>
|
||||
<p id="display"></p>
|
||||
<div id="content" style="display: none">
|
||||
|
||||
</div>
|
||||
<pre id="test">
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
@ -25,9 +25,10 @@ function checkCrossOrigin(a, b) {
|
||||
a.originAttributes.inBrowser == b.originAttributes.inBrowser);
|
||||
}
|
||||
|
||||
function checkOriginAttributes(prin, appId, inBrowser, suffix) {
|
||||
do_check_eq(prin.originAttributes.appId, appId || 0);
|
||||
do_check_eq(prin.originAttributes.inBrowser, inBrowser || false);
|
||||
function checkOriginAttributes(prin, attrs, suffix) {
|
||||
attrs = attrs || {};
|
||||
do_check_eq(prin.originAttributes.appId, attrs.appId || 0);
|
||||
do_check_eq(prin.originAttributes.inBrowser, attrs.inBrowser || false);
|
||||
do_check_eq(prin.originSuffix, suffix || '');
|
||||
if (!prin.isNullPrincipal && !prin.origin.startsWith('[')) {
|
||||
do_check_true(BrowserUtils.principalFromOrigin(prin.origin).equals(prin));
|
||||
@ -67,29 +68,34 @@ function run_test() {
|
||||
// Just app.
|
||||
var exampleOrg_app = ssm.createCodebasePrincipal(makeURI('http://example.org'), {appId: 42});
|
||||
var nullPrin_app = ssm.createNullPrincipal({appId: 42});
|
||||
checkOriginAttributes(exampleOrg_app, 42, false, '!appId=42');
|
||||
checkOriginAttributes(nullPrin_app, 42, false, '!appId=42');
|
||||
checkOriginAttributes(exampleOrg_app, {appId: 42}, '!appId=42');
|
||||
checkOriginAttributes(nullPrin_app, {appId: 42}, '!appId=42');
|
||||
do_check_eq(exampleOrg_app.origin, 'http://example.org!appId=42');
|
||||
|
||||
// Just browser.
|
||||
var exampleOrg_browser = ssm.createCodebasePrincipal(makeURI('http://example.org'), {inBrowser: true});
|
||||
var nullPrin_browser = ssm.createNullPrincipal({inBrowser: true});
|
||||
checkOriginAttributes(exampleOrg_browser, 0, true, '!inBrowser=1');
|
||||
checkOriginAttributes(nullPrin_browser, 0, true, '!inBrowser=1');
|
||||
checkOriginAttributes(exampleOrg_browser, {inBrowser: true}, '!inBrowser=1');
|
||||
checkOriginAttributes(nullPrin_browser, {inBrowser: true}, '!inBrowser=1');
|
||||
do_check_eq(exampleOrg_browser.origin, 'http://example.org!inBrowser=1');
|
||||
|
||||
// App and browser.
|
||||
var exampleOrg_appBrowser = ssm.createCodebasePrincipal(makeURI('http://example.org'), {inBrowser: true, appId: 42});
|
||||
var nullPrin_appBrowser = ssm.createNullPrincipal({inBrowser: true, appId: 42});
|
||||
checkOriginAttributes(exampleOrg_appBrowser, 42, true, '!appId=42&inBrowser=1');
|
||||
checkOriginAttributes(nullPrin_appBrowser, 42, true, '!appId=42&inBrowser=1');
|
||||
checkOriginAttributes(exampleOrg_appBrowser, {appId: 42, inBrowser: true}, '!appId=42&inBrowser=1');
|
||||
checkOriginAttributes(nullPrin_appBrowser, {appId: 42, inBrowser: true}, '!appId=42&inBrowser=1');
|
||||
do_check_eq(exampleOrg_appBrowser.origin, 'http://example.org!appId=42&inBrowser=1');
|
||||
|
||||
// App and browser, different domain.
|
||||
var exampleCom_appBrowser = ssm.createCodebasePrincipal(makeURI('https://www.example.com:123'), {appId: 42, inBrowser: true});
|
||||
checkOriginAttributes(exampleCom_appBrowser, 42, true, '!appId=42&inBrowser=1');
|
||||
checkOriginAttributes(exampleCom_appBrowser, {appId: 42, inBrowser: true}, '!appId=42&inBrowser=1');
|
||||
do_check_eq(exampleCom_appBrowser.origin, 'https://www.example.com:123!appId=42&inBrowser=1');
|
||||
|
||||
// Addon.
|
||||
var exampleOrg_addon = ssm.createCodebasePrincipal(makeURI('http://example.org'), {addonId: 'dummy'});
|
||||
checkOriginAttributes(exampleOrg_addon, { addonId: "dummy" }, '!addonId=dummy');
|
||||
do_check_eq(exampleOrg_addon.origin, 'http://example.org!addonId=dummy');
|
||||
|
||||
// Check that all of the above are cross-origin.
|
||||
checkCrossOrigin(exampleOrg_app, exampleOrg);
|
||||
checkCrossOrigin(exampleOrg_app, nullPrin_app);
|
||||
@ -98,4 +104,5 @@ function run_test() {
|
||||
checkCrossOrigin(exampleOrg_appBrowser, exampleOrg_app);
|
||||
checkCrossOrigin(exampleOrg_appBrowser, nullPrin_appBrowser);
|
||||
checkCrossOrigin(exampleOrg_appBrowser, exampleCom_appBrowser);
|
||||
checkCrossOrigin(exampleOrg_addon, exampleOrg);
|
||||
}
|
||||
|
10
config/external/lgpllibs/lgpllibs.def
vendored
Normal file
10
config/external/lgpllibs/lgpllibs.def
vendored
Normal file
@ -0,0 +1,10 @@
|
||||
; This Source Code Form is subject to the terms of the Mozilla Public
|
||||
; License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
; file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
LIBRARY lgpllibs.dll
|
||||
|
||||
EXPORTS
|
||||
av_rdft_init
|
||||
av_rdft_calc
|
||||
av_rdft_end
|
4
config/external/lgpllibs/moz.build
vendored
4
config/external/lgpllibs/moz.build
vendored
@ -12,3 +12,7 @@
|
||||
|
||||
SharedLibrary('lgpllibs')
|
||||
SHARED_LIBRARY_NAME = 'lgpllibs'
|
||||
|
||||
if CONFIG['MOZ_LIBAV_FFT']:
|
||||
DIRS += ['/media/libav']
|
||||
DEFFILE = SRCDIR + '/lgpllibs.def'
|
||||
|
@ -1258,6 +1258,9 @@ X11/Xutil.h
|
||||
zmouse.h
|
||||
soundtouch/SoundTouch.h
|
||||
soundtouch/SoundTouchFactory.h
|
||||
#if MOZ_LIBAV_FFT==1
|
||||
libavcodec/avfft.h
|
||||
#endif
|
||||
#if MOZ_NATIVE_PNG==1
|
||||
png.h
|
||||
#endif
|
||||
|
71
configure.in
71
configure.in
@ -6274,6 +6274,74 @@ elif test -n "$MOZ_LIBJPEG_TURBO"; then
|
||||
AC_MSG_WARN([No assembler or assembly support for libjpeg-turbo. Using unoptimized C routines.])
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = libav-fft configuration
|
||||
dnl ========================================================
|
||||
|
||||
MOZ_LIBAV_FFT=
|
||||
|
||||
dnl Turn on libav-fft for 32-bit windows, and all 64-bit supported platforms.
|
||||
dnl 32-bit linux/os x have text relocation issues.
|
||||
|
||||
case "$OS_ARCH:$CPU_ARCH" in
|
||||
WINNT:x86)
|
||||
MOZ_LIBAV_FFT=1
|
||||
;;
|
||||
*:x86_64)
|
||||
MOZ_LIBAV_FFT=1
|
||||
;;
|
||||
esac
|
||||
|
||||
dnl Detect if we can use yasm to compile libav's assembly
|
||||
|
||||
if test -n "$MOZ_LIBAV_FFT"; then
|
||||
AC_DEFINE(MOZ_LIBAV_FFT)
|
||||
dnl Do we support libav-fft on this platform?
|
||||
case "$OS_ARCH:$CPU_ARCH" in
|
||||
Darwin:x86_64)
|
||||
LIBAV_FFT_ASFLAGS="-f macho64 -rnasm -pnasm -D__x86_64__ -DPIC -DMACHO"
|
||||
;;
|
||||
WINNT:x86)
|
||||
LIBAV_FFT_ASFLAGS="-f win32 -rnasm -pnasm -DPIC -DWIN32"
|
||||
;;
|
||||
WINNT:x86_64)
|
||||
LIBAV_FFT_ASFLAGS="-f win64 -rnasm -pnasm -D__x86_64__ -DPIC -DWIN64 -DMSVC"
|
||||
;;
|
||||
*:x86_64)
|
||||
if $CC -E -dM -</dev/null | grep -q __ELF__; then
|
||||
LIBAV_FFT_ASFLAGS="-f elf64 -rnasm -pnasm -D__x86_64__ -DPIC -DELF"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
AC_MSG_ERROR([libav's FFT routines are only available for 32-bit windows or 64-bit x86 based platforms.])
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
|
||||
if test -n "$LIBAV_FFT_ASFLAGS"; then
|
||||
dnl If we're on an x86 or x64 system which supports libav-fft's asm routines
|
||||
dnl check for Yasm, and error out if it doesn't exist or we have too old of a
|
||||
dnl version.
|
||||
LIBAV_FFT_AS=$YASM
|
||||
if test -z "$LIBAV_FFT_AS" ; then
|
||||
AC_MSG_ERROR([Yasm is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
|
||||
fi
|
||||
dnl Check that we have the right yasm version. We require 1.0.1 or newer
|
||||
dnl on Linux and 1.1 or newer everywhere else.
|
||||
if test "$OS_ARCH" = "Linux" ; then
|
||||
if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -eq "0" -a "$_YASM_RELEASE" -lt "1" \) ; then
|
||||
AC_MSG_ERROR([Yasm 1.0.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
|
||||
fi
|
||||
else
|
||||
if test "$_YASM_MAJOR_VERSION" -lt "1" -o \( "$_YASM_MAJOR_VERSION" -eq "1" -a "$_YASM_MINOR_VERSION" -lt "1" \) ; then
|
||||
AC_MSG_ERROR([Yasm 1.1 or greater is required to build with libav's optimized FFT routines, but you do not appear to have Yasm installed. See https://developer.mozilla.org/en/YASM for more details.])
|
||||
fi
|
||||
fi
|
||||
elif test -n "$MOZ_LIBAV_FFT" -a "${CPU_ARCH}" != "arm"; then
|
||||
dnl Warn if we're not building either libav or opendl-max optimized routines.
|
||||
AC_MSG_WARN([No assembler or assembly support for libav-fft. Using unoptimized C routines.])
|
||||
fi
|
||||
|
||||
dnl ========================================================
|
||||
dnl = Enable compilation of specific extension modules
|
||||
dnl ========================================================
|
||||
@ -8959,6 +9027,9 @@ AC_SUBST(MOZ_INSTRUMENT_EVENT_LOOP)
|
||||
AC_SUBST(MOZ_CODE_COVERAGE)
|
||||
AC_SUBST(LIBJPEG_TURBO_AS)
|
||||
AC_SUBST_LIST(LIBJPEG_TURBO_ASFLAGS)
|
||||
AC_SUBST(MOZ_LIBAV_FFT)
|
||||
AC_SUBST(LIBAV_FFT_AS)
|
||||
AC_SUBST_LIST(LIBAV_FFT_ASFLAGS)
|
||||
|
||||
AC_SUBST(MOZ_PACKAGE_JSSHELL)
|
||||
AC_SUBST(MOZ_FOLD_LIBS)
|
||||
|
@ -1,5 +1,5 @@
|
||||
[DEFAULT]
|
||||
skip-if = buildapp == 'b2g'
|
||||
skip-if = buildapp == 'b2g' || os == 'android'
|
||||
support-files =
|
||||
662200a.html
|
||||
662200b.html
|
||||
|
@ -1,5 +1,5 @@
|
||||
[DEFAULT]
|
||||
skip-if = e10s
|
||||
skip-if = e10s || os == 'android'
|
||||
support-files =
|
||||
common.js
|
||||
system.webapp
|
||||
|
@ -20,6 +20,8 @@
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class Animation;
|
||||
|
||||
class AnimationTimeline
|
||||
: public nsISupports
|
||||
, public nsWrapperCache
|
||||
|
@ -1,5 +1,5 @@
|
||||
[DEFAULT]
|
||||
skip-if = buildapp == 'b2g'
|
||||
skip-if = buildapp == 'b2g' || os == 'android'
|
||||
support-files =
|
||||
asmjs/*
|
||||
file_bug_945152.html
|
||||
|
@ -5,7 +5,6 @@
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "AudioChannelAgent.h"
|
||||
#include "AudioChannelCommon.h"
|
||||
#include "AudioChannelService.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsPIDOMWindow.h"
|
||||
@ -26,15 +25,13 @@ NS_IMPL_CYCLE_COLLECTING_RELEASE(AudioChannelAgent)
|
||||
AudioChannelAgent::AudioChannelAgent()
|
||||
: mAudioChannelType(AUDIO_AGENT_CHANNEL_ERROR)
|
||||
, mIsRegToService(false)
|
||||
, mVisible(true)
|
||||
, mWithVideo(false)
|
||||
{
|
||||
}
|
||||
|
||||
AudioChannelAgent::~AudioChannelAgent()
|
||||
{
|
||||
if (mIsRegToService) {
|
||||
StopPlaying();
|
||||
NotifyStoppedPlaying();
|
||||
}
|
||||
}
|
||||
|
||||
@ -66,21 +63,10 @@ AudioChannelAgent::InitWithWeakCallback(nsIDOMWindow* aWindow,
|
||||
/* useWeakRef = */ true);
|
||||
}
|
||||
|
||||
/* void initWithVideo(in nsIDOMWindow window, in long channelType,
|
||||
* in nsIAudioChannelAgentCallback callback, in boolean weak); */
|
||||
NS_IMETHODIMP
|
||||
AudioChannelAgent::InitWithVideo(nsIDOMWindow* aWindow, int32_t aChannelType,
|
||||
nsIAudioChannelAgentCallback *aCallback,
|
||||
bool aUseWeakRef)
|
||||
{
|
||||
return InitInternal(aWindow, aChannelType, aCallback, aUseWeakRef,
|
||||
/* withVideo = */ true);
|
||||
}
|
||||
|
||||
nsresult
|
||||
AudioChannelAgent::InitInternal(nsIDOMWindow* aWindow, int32_t aChannelType,
|
||||
nsIAudioChannelAgentCallback *aCallback,
|
||||
bool aUseWeakRef, bool aWithVideo)
|
||||
bool aUseWeakRef)
|
||||
{
|
||||
// We syncd the enum of channel type between nsIAudioChannelAgent.idl and
|
||||
// AudioChannelBinding.h the same.
|
||||
@ -100,12 +86,16 @@ AudioChannelAgent::InitInternal(nsIDOMWindow* aWindow, int32_t aChannelType,
|
||||
}
|
||||
|
||||
if (aWindow) {
|
||||
nsCOMPtr<nsPIDOMWindow> pWindow = do_QueryInterface(aWindow);
|
||||
if (!pWindow->IsInnerWindow()) {
|
||||
pWindow = pWindow->GetCurrentInnerWindow();
|
||||
nsCOMPtr<nsIDOMWindow> topWindow;
|
||||
aWindow->GetScriptableTop(getter_AddRefs(topWindow));
|
||||
MOZ_ASSERT(topWindow);
|
||||
|
||||
mWindow = do_QueryInterface(topWindow);
|
||||
if (!mWindow) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mWindow = pWindow.forget();
|
||||
mWindow = mWindow->GetOuterWindow();
|
||||
}
|
||||
|
||||
mAudioChannelType = aChannelType;
|
||||
@ -116,65 +106,45 @@ AudioChannelAgent::InitInternal(nsIDOMWindow* aWindow, int32_t aChannelType,
|
||||
mCallback = aCallback;
|
||||
}
|
||||
|
||||
mWithVideo = aWithVideo;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* boolean startPlaying (); */
|
||||
NS_IMETHODIMP AudioChannelAgent::StartPlaying(int32_t *_retval)
|
||||
/* boolean notifyStartedPlaying (); */
|
||||
NS_IMETHODIMP AudioChannelAgent::NotifyStartedPlaying(float *aVolume,
|
||||
bool* aMuted)
|
||||
{
|
||||
AudioChannelService *service = AudioChannelService::GetOrCreateAudioChannelService();
|
||||
MOZ_ASSERT(aVolume);
|
||||
MOZ_ASSERT(aMuted);
|
||||
|
||||
nsRefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
if (mAudioChannelType == AUDIO_AGENT_CHANNEL_ERROR ||
|
||||
service == nullptr || mIsRegToService) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
service->RegisterAudioChannelAgent(this,
|
||||
static_cast<AudioChannel>(mAudioChannelType), mWithVideo);
|
||||
*_retval = service->GetState(this, !mVisible);
|
||||
static_cast<AudioChannel>(mAudioChannelType));
|
||||
|
||||
service->GetState(mWindow, mAudioChannelType, aVolume, aMuted);
|
||||
|
||||
mIsRegToService = true;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void stopPlaying (); */
|
||||
NS_IMETHODIMP AudioChannelAgent::StopPlaying(void)
|
||||
/* void notifyStoppedPlaying (); */
|
||||
NS_IMETHODIMP AudioChannelAgent::NotifyStoppedPlaying(void)
|
||||
{
|
||||
if (mAudioChannelType == AUDIO_AGENT_CHANNEL_ERROR ||
|
||||
!mIsRegToService) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
AudioChannelService *service = AudioChannelService::GetOrCreateAudioChannelService();
|
||||
nsRefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
service->UnregisterAudioChannelAgent(this);
|
||||
mIsRegToService = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
/* void setVisibilityState (in boolean visible); */
|
||||
NS_IMETHODIMP AudioChannelAgent::SetVisibilityState(bool visible)
|
||||
{
|
||||
bool oldVisibility = mVisible;
|
||||
|
||||
nsCOMPtr<nsIAudioChannelAgentCallback> callback = GetCallback();
|
||||
|
||||
mVisible = visible;
|
||||
if (mIsRegToService && oldVisibility != mVisible && callback) {
|
||||
AudioChannelService *service = AudioChannelService::GetOrCreateAudioChannelService();
|
||||
callback->CanPlayChanged(service->GetState(this, !mVisible));
|
||||
}
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void AudioChannelAgent::NotifyAudioChannelStateChanged()
|
||||
{
|
||||
nsCOMPtr<nsIAudioChannelAgentCallback> callback = GetCallback();
|
||||
if (callback) {
|
||||
AudioChannelService *service = AudioChannelService::GetOrCreateAudioChannelService();
|
||||
callback->CanPlayChanged(service->GetState(this, !mVisible));
|
||||
}
|
||||
}
|
||||
|
||||
already_AddRefed<nsIAudioChannelAgentCallback>
|
||||
AudioChannelAgent::GetCallback()
|
||||
{
|
||||
@ -193,20 +163,17 @@ AudioChannelAgent::WindowVolumeChanged()
|
||||
return;
|
||||
}
|
||||
|
||||
callback->WindowVolumeChanged();
|
||||
float volume = 1.0;
|
||||
bool muted = false;
|
||||
|
||||
nsRefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
service->GetState(mWindow, mAudioChannelType, &volume, &muted);
|
||||
|
||||
callback->WindowVolumeChanged(volume, muted);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
AudioChannelAgent::GetWindowVolume(float* aVolume)
|
||||
uint64_t
|
||||
AudioChannelAgent::WindowID() const
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aVolume);
|
||||
|
||||
nsCOMPtr<nsPIDOMWindow> win = do_QueryInterface(mWindow);
|
||||
if (!win) {
|
||||
*aVolume = 1.0f;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
*aVolume = win->GetAudioGlobalVolume();
|
||||
return NS_OK;
|
||||
return mWindow ? mWindow->WindowID() : 0;
|
||||
}
|
||||
|
@ -17,7 +17,7 @@
|
||||
#define NS_AUDIOCHANNELAGENT_CID {0xf27688e2, 0x3dd7, 0x11e2, \
|
||||
{0x90, 0x4e, 0x10, 0xbf, 0x48, 0xd6, 0x4b, 0xd4}}
|
||||
|
||||
class nsIDOMWindow;
|
||||
class nsPIDOMWindow;
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
@ -32,15 +32,16 @@ public:
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS(AudioChannelAgent)
|
||||
|
||||
AudioChannelAgent();
|
||||
virtual void NotifyAudioChannelStateChanged();
|
||||
|
||||
void WindowVolumeChanged();
|
||||
|
||||
nsIDOMWindow* Window() const
|
||||
nsPIDOMWindow* Window() const
|
||||
{
|
||||
return mWindow;
|
||||
}
|
||||
|
||||
uint64_t WindowID() const;
|
||||
|
||||
private:
|
||||
virtual ~AudioChannelAgent();
|
||||
|
||||
@ -50,18 +51,18 @@ private:
|
||||
|
||||
nsresult InitInternal(nsIDOMWindow* aWindow, int32_t aAudioAgentType,
|
||||
nsIAudioChannelAgentCallback* aCallback,
|
||||
bool aUseWeakRef, bool aWithVideo=false);
|
||||
bool aUseWeakRef);
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> mWindow;
|
||||
nsCOMPtr<nsPIDOMWindow> mWindow;
|
||||
nsCOMPtr<nsIAudioChannelAgentCallback> mCallback;
|
||||
|
||||
nsWeakPtr mWeakCallback;
|
||||
|
||||
int32_t mAudioChannelType;
|
||||
bool mIsRegToService;
|
||||
bool mVisible;
|
||||
bool mWithVideo;
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,24 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_audiochannelcommon_h__
|
||||
#define mozilla_dom_audiochannelcommon_h__
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
enum AudioChannelState {
|
||||
AUDIO_CHANNEL_STATE_NORMAL = 0,
|
||||
AUDIO_CHANNEL_STATE_MUTED,
|
||||
AUDIO_CHANNEL_STATE_FADED,
|
||||
AUDIO_CHANNEL_STATE_LAST
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -7,15 +7,14 @@
|
||||
#ifndef mozilla_dom_audiochannelservice_h__
|
||||
#define mozilla_dom_audiochannelservice_h__
|
||||
|
||||
#include "nsIAudioChannelService.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsIObserver.h"
|
||||
#include "nsTObserverArray.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsITimer.h"
|
||||
|
||||
#include "AudioChannelCommon.h"
|
||||
#include "AudioChannelAgent.h"
|
||||
#include "nsAttrValue.h"
|
||||
#include "nsClassHashtable.h"
|
||||
#include "mozilla/dom/AudioChannelBinding.h"
|
||||
|
||||
class nsIRunnable;
|
||||
@ -26,71 +25,74 @@ namespace dom {
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
class SpeakerManagerService;
|
||||
#endif
|
||||
class AudioChannelService
|
||||
: public nsIObserver
|
||||
, public nsITimerCallback
|
||||
|
||||
#define NUMBER_OF_AUDIO_CHANNELS (uint32_t)AudioChannel::Publicnotification + 1
|
||||
|
||||
class AudioChannelService final : public nsIAudioChannelService
|
||||
, public nsIObserver
|
||||
{
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIOBSERVER
|
||||
NS_DECL_NSITIMERCALLBACK
|
||||
|
||||
/**
|
||||
* Returns the AudioChannelServce singleton or null if the process havn't create it before.
|
||||
* Only to be called from main thread.
|
||||
*/
|
||||
static AudioChannelService* GetAudioChannelService();
|
||||
NS_DECL_NSIAUDIOCHANNELSERVICE
|
||||
|
||||
/**
|
||||
* Returns the AudioChannelServce singleton.
|
||||
* If AudioChannelServce is not exist, create and return new one.
|
||||
* Only to be called from main thread.
|
||||
*/
|
||||
static AudioChannelService* GetOrCreateAudioChannelService();
|
||||
static already_AddRefed<AudioChannelService> GetOrCreate();
|
||||
|
||||
/**
|
||||
* Shutdown the singleton.
|
||||
*/
|
||||
static void Shutdown();
|
||||
|
||||
static bool IsAudioChannelMutedByDefault();
|
||||
|
||||
/**
|
||||
* Any audio channel agent that starts playing should register itself to
|
||||
* this service, sharing the AudioChannel.
|
||||
*/
|
||||
virtual void RegisterAudioChannelAgent(AudioChannelAgent* aAgent,
|
||||
AudioChannel aChannel,
|
||||
bool aWithVideo);
|
||||
void RegisterAudioChannelAgent(AudioChannelAgent* aAgent, AudioChannel aChannel);
|
||||
|
||||
/**
|
||||
* Any audio channel agent that stops playing should unregister itself to
|
||||
* this service.
|
||||
*/
|
||||
virtual void UnregisterAudioChannelAgent(AudioChannelAgent* aAgent);
|
||||
void UnregisterAudioChannelAgent(AudioChannelAgent* aAgent);
|
||||
|
||||
/**
|
||||
* Return the state to indicate this agent should keep playing/
|
||||
* fading volume/muted.
|
||||
* Return the state to indicate this audioChannel for his window should keep
|
||||
* playing/muted.
|
||||
*/
|
||||
virtual AudioChannelState GetState(AudioChannelAgent* aAgent,
|
||||
bool aElementHidden);
|
||||
void GetState(nsPIDOMWindow* aWindow, uint32_t aChannel,
|
||||
float* aVolume, bool* aMuted);
|
||||
|
||||
/**
|
||||
* Return true if there is a content channel active in this process
|
||||
* or one of its subprocesses.
|
||||
*/
|
||||
virtual bool ContentOrNormalChannelIsActive();
|
||||
/* Methods for the BrowserElementAudioChannel */
|
||||
float GetAudioChannelVolume(nsPIDOMWindow* aWindow, AudioChannel aChannel);
|
||||
|
||||
void SetAudioChannelVolume(nsPIDOMWindow* aWindow, AudioChannel aChannel,
|
||||
float aVolume);
|
||||
|
||||
bool GetAudioChannelMuted(nsPIDOMWindow* aWindow, AudioChannel aChannel);
|
||||
|
||||
void SetAudioChannelMuted(nsPIDOMWindow* aWindow, AudioChannel aChannel,
|
||||
bool aMuted);
|
||||
|
||||
bool IsAudioChannelActive(nsPIDOMWindow* aWindow, AudioChannel aChannel);
|
||||
|
||||
/**
|
||||
* Return true if there is a telephony channel active in this process
|
||||
* or one of its subprocesses.
|
||||
*/
|
||||
virtual bool TelephonyChannelIsActive();
|
||||
bool TelephonyChannelIsActive();
|
||||
|
||||
/**
|
||||
* Return true if a normal or content channel is active for the given
|
||||
* process ID.
|
||||
*/
|
||||
virtual bool ProcessContentOrNormalChannelIsActive(uint64_t aChildID);
|
||||
bool ProcessContentOrNormalChannelIsActive(uint64_t aChildID);
|
||||
|
||||
/***
|
||||
* AudioChannelManager calls this function to notify the default channel used
|
||||
@ -125,163 +127,95 @@ public:
|
||||
static void GetAudioChannelString(AudioChannel aChannel, nsAString& aString);
|
||||
static void GetDefaultAudioChannelString(nsAString& aString);
|
||||
|
||||
void Notify();
|
||||
void Notify(uint64_t aWindowID);
|
||||
|
||||
protected:
|
||||
void SendNotification();
|
||||
void ChildStatusReceived(uint64_t aChildID, bool aTelephonyChannel,
|
||||
bool aContentOrNormalChannel, bool aAnyChannel);
|
||||
|
||||
/**
|
||||
* Send the audio-channel-changed notification for the given process ID if
|
||||
* needed.
|
||||
*/
|
||||
void SendAudioChannelChangedNotification(uint64_t aChildID);
|
||||
private:
|
||||
AudioChannelService();
|
||||
~AudioChannelService();
|
||||
|
||||
/* Register/Unregister IPC types: */
|
||||
void RegisterType(AudioChannel aChannel, uint64_t aChildID, bool aWithVideo);
|
||||
void UnregisterType(AudioChannel aChannel, bool aElementHidden,
|
||||
uint64_t aChildID, bool aWithVideo);
|
||||
void UnregisterTypeInternal(AudioChannel aChannel, bool aElementHidden,
|
||||
uint64_t aChildID, bool aWithVideo);
|
||||
void MaybeSendStatusUpdate();
|
||||
|
||||
AudioChannelState GetStateInternal(AudioChannel aChannel, uint64_t aChildID,
|
||||
bool aElementHidden,
|
||||
bool aElementWasHidden);
|
||||
|
||||
/* Update the internal type value following the visibility changes */
|
||||
void UpdateChannelType(AudioChannel aChannel, uint64_t aChildID,
|
||||
bool aElementHidden, bool aElementWasHidden);
|
||||
bool ContentOrNormalChannelIsActive();
|
||||
|
||||
/* Send the default-volume-channel-changed notification */
|
||||
void SetDefaultVolumeControlChannelInternal(int32_t aChannel,
|
||||
bool aVisible, uint64_t aChildID);
|
||||
|
||||
AudioChannelState CheckTelephonyPolicy(AudioChannel aChannel,
|
||||
uint64_t aChildID);
|
||||
void RegisterTelephonyChild(uint64_t aChildID);
|
||||
void UnregisterTelephonyChild(uint64_t aChildID);
|
||||
|
||||
AudioChannelService();
|
||||
virtual ~AudioChannelService();
|
||||
|
||||
enum AudioChannelInternalType {
|
||||
AUDIO_CHANNEL_INT_NORMAL = 0,
|
||||
AUDIO_CHANNEL_INT_NORMAL_HIDDEN,
|
||||
AUDIO_CHANNEL_INT_CONTENT,
|
||||
AUDIO_CHANNEL_INT_CONTENT_HIDDEN,
|
||||
AUDIO_CHANNEL_INT_NOTIFICATION,
|
||||
AUDIO_CHANNEL_INT_NOTIFICATION_HIDDEN,
|
||||
AUDIO_CHANNEL_INT_ALARM,
|
||||
AUDIO_CHANNEL_INT_ALARM_HIDDEN,
|
||||
AUDIO_CHANNEL_INT_TELEPHONY,
|
||||
AUDIO_CHANNEL_INT_TELEPHONY_HIDDEN,
|
||||
AUDIO_CHANNEL_INT_RINGER,
|
||||
AUDIO_CHANNEL_INT_RINGER_HIDDEN,
|
||||
AUDIO_CHANNEL_INT_PUBLICNOTIFICATION,
|
||||
AUDIO_CHANNEL_INT_PUBLICNOTIFICATION_HIDDEN,
|
||||
AUDIO_CHANNEL_INT_LAST
|
||||
};
|
||||
|
||||
bool ChannelsActiveWithHigherPriorityThan(AudioChannelInternalType aType);
|
||||
|
||||
bool CheckVolumeFadedCondition(AudioChannelInternalType aType,
|
||||
bool aElementHidden);
|
||||
|
||||
AudioChannelInternalType GetInternalType(AudioChannel aChannel,
|
||||
bool aElementHidden);
|
||||
|
||||
class AudioChannelAgentData {
|
||||
public:
|
||||
AudioChannelAgentData(AudioChannel aChannel,
|
||||
bool aElementHidden,
|
||||
AudioChannelState aState,
|
||||
bool aWithVideo)
|
||||
: mChannel(aChannel)
|
||||
, mElementHidden(aElementHidden)
|
||||
, mState(aState)
|
||||
, mWithVideo(aWithVideo)
|
||||
struct AudioChannelConfig final
|
||||
{
|
||||
AudioChannelConfig()
|
||||
: mVolume(1.0)
|
||||
, mMuted(IsAudioChannelMutedByDefault())
|
||||
, mNumberOfAgents(0)
|
||||
{}
|
||||
|
||||
AudioChannel mChannel;
|
||||
bool mElementHidden;
|
||||
AudioChannelState mState;
|
||||
const bool mWithVideo;
|
||||
float mVolume;
|
||||
bool mMuted;
|
||||
|
||||
uint32_t mNumberOfAgents;
|
||||
};
|
||||
|
||||
static PLDHashOperator
|
||||
NotifyEnumerator(AudioChannelAgent* aAgent,
|
||||
AudioChannelAgentData* aData, void *aUnused);
|
||||
struct AudioChannelWindow final
|
||||
{
|
||||
explicit AudioChannelWindow(uint64_t aWindowID)
|
||||
: mWindowID(aWindowID)
|
||||
{}
|
||||
|
||||
static PLDHashOperator
|
||||
RefreshAgentsVolumeEnumerator(AudioChannelAgent* aAgent,
|
||||
AudioChannelAgentData* aUnused,
|
||||
void *aPtr);
|
||||
uint64_t mWindowID;
|
||||
AudioChannelConfig mChannels[NUMBER_OF_AUDIO_CHANNELS];
|
||||
|
||||
static PLDHashOperator
|
||||
CountWindowEnumerator(AudioChannelAgent* aAgent,
|
||||
AudioChannelAgentData* aUnused,
|
||||
void *aPtr);
|
||||
// Raw pointer because the AudioChannelAgent must unregister itself.
|
||||
nsTObserverArray<AudioChannelAgent*> mAgents;
|
||||
};
|
||||
|
||||
static PLDHashOperator
|
||||
WindowDestroyedEnumerator(AudioChannelAgent* aAgent,
|
||||
nsAutoPtr<AudioChannelAgentData>& aData,
|
||||
void *aPtr);
|
||||
AudioChannelWindow*
|
||||
GetOrCreateWindowData(nsPIDOMWindow* aWindow);
|
||||
|
||||
// This returns the number of agents from this aWindow.
|
||||
uint32_t CountWindow(nsIDOMWindow* aWindow);
|
||||
AudioChannelWindow*
|
||||
GetWindowData(uint64_t aWindowID) const;
|
||||
|
||||
struct AudioChannelChildStatus final
|
||||
{
|
||||
explicit AudioChannelChildStatus(uint64_t aChildID)
|
||||
: mChildID(aChildID)
|
||||
, mActiveTelephonyChannel(false)
|
||||
, mActiveContentOrNormalChannel(false)
|
||||
{}
|
||||
|
||||
uint64_t mChildID;
|
||||
bool mActiveTelephonyChannel;
|
||||
bool mActiveContentOrNormalChannel;
|
||||
};
|
||||
|
||||
AudioChannelChildStatus*
|
||||
GetChildStatus(uint64_t aChildID) const;
|
||||
|
||||
void
|
||||
RemoveChildStatus(uint64_t aChildID);
|
||||
|
||||
nsTObserverArray<nsAutoPtr<AudioChannelWindow>> mWindows;
|
||||
|
||||
nsTObserverArray<nsAutoPtr<AudioChannelChildStatus>> mPlayingChildren;
|
||||
|
||||
nsClassHashtable< nsPtrHashKey<AudioChannelAgent>, AudioChannelAgentData > mAgents;
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
nsTArray<SpeakerManagerService*> mSpeakerManager;
|
||||
#endif
|
||||
nsTArray<uint64_t> mChannelCounters[AUDIO_CHANNEL_INT_LAST];
|
||||
|
||||
int32_t mCurrentHigherChannel;
|
||||
int32_t mCurrentVisibleHigherChannel;
|
||||
|
||||
nsTArray<uint64_t> mWithVideoChildIDs;
|
||||
|
||||
// Telephony Channel policy is "LIFO", the last app to require the resource is
|
||||
// allowed to play. The others are muted.
|
||||
struct TelephonyChild {
|
||||
uint64_t mChildID;
|
||||
uint32_t mInstances;
|
||||
|
||||
explicit TelephonyChild(uint64_t aChildID)
|
||||
: mChildID(aChildID)
|
||||
, mInstances(1)
|
||||
{}
|
||||
};
|
||||
nsTArray<TelephonyChild> mTelephonyChildren;
|
||||
|
||||
// mPlayableHiddenContentChildID stores the ChildID of the process which can
|
||||
// play content channel(s) in the background.
|
||||
// A background process contained content channel(s) will become playable:
|
||||
// 1. When this background process registers its content channel(s) in
|
||||
// AudioChannelService and there is no foreground process with registered
|
||||
// content channel(s).
|
||||
// 2. When this process goes from foreground into background and there is
|
||||
// no foreground process with registered content channel(s).
|
||||
// A background process contained content channel(s) will become non-playable:
|
||||
// 1. When there is a foreground process registering its content channel(s)
|
||||
// in AudioChannelService.
|
||||
// ps. Currently this condition is never satisfied because the default value
|
||||
// of visibility status of each channel during registering is hidden = true.
|
||||
// 2. When there is a process with registered content channel(s) goes from
|
||||
// background into foreground.
|
||||
// 3. When this process unregisters all hidden content channels.
|
||||
// 4. When this process shuts down.
|
||||
uint64_t mPlayableHiddenContentChildID;
|
||||
|
||||
bool mDisabled;
|
||||
|
||||
nsCOMPtr<nsIRunnable> mRunnable;
|
||||
|
||||
nsCOMPtr<nsITimer> mDeferTelChannelTimer;
|
||||
bool mTimerElementHidden;
|
||||
uint64_t mTimerChildID;
|
||||
|
||||
uint64_t mDefChannelChildID;
|
||||
|
||||
// These boolean are used to know if we have to send an status update to the
|
||||
// service running in the main process.
|
||||
bool mTelephonyChannel;
|
||||
bool mContentOrNormalChannel;
|
||||
bool mAnyChannel;
|
||||
|
||||
// This is needed for IPC comunication between
|
||||
// AudioChannelServiceChild and this class.
|
||||
friend class ContentParent;
|
||||
|
@ -1,168 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "AudioChannelServiceChild.h"
|
||||
|
||||
#include "base/basictypes.h"
|
||||
|
||||
#include "mozilla/Services.h"
|
||||
#include "mozilla/StaticPtr.h"
|
||||
#include "mozilla/unused.h"
|
||||
#include "mozilla/dom/ContentChild.h"
|
||||
#include "mozilla/dom/ContentParent.h"
|
||||
#include "nsIObserverService.h"
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
#include "SpeakerManagerService.h"
|
||||
#endif
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
using namespace mozilla::hal;
|
||||
|
||||
StaticRefPtr<AudioChannelServiceChild> gAudioChannelServiceChild;
|
||||
|
||||
// static
|
||||
AudioChannelService*
|
||||
AudioChannelServiceChild::GetAudioChannelService()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
return gAudioChannelServiceChild;
|
||||
|
||||
}
|
||||
|
||||
// static
|
||||
AudioChannelService*
|
||||
AudioChannelServiceChild::GetOrCreateAudioChannelService()
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
// If we already exist, exit early
|
||||
if (gAudioChannelServiceChild) {
|
||||
return gAudioChannelServiceChild;
|
||||
}
|
||||
|
||||
// Create new instance, register, return
|
||||
nsRefPtr<AudioChannelServiceChild> service = new AudioChannelServiceChild();
|
||||
MOZ_ASSERT(service);
|
||||
|
||||
gAudioChannelServiceChild = service;
|
||||
return gAudioChannelServiceChild;
|
||||
}
|
||||
|
||||
void
|
||||
AudioChannelServiceChild::Shutdown()
|
||||
{
|
||||
if (gAudioChannelServiceChild) {
|
||||
gAudioChannelServiceChild = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
AudioChannelServiceChild::AudioChannelServiceChild()
|
||||
{
|
||||
}
|
||||
|
||||
AudioChannelServiceChild::~AudioChannelServiceChild()
|
||||
{
|
||||
}
|
||||
|
||||
AudioChannelState
|
||||
AudioChannelServiceChild::GetState(AudioChannelAgent* aAgent, bool aElementHidden)
|
||||
{
|
||||
AudioChannelAgentData* data;
|
||||
if (!mAgents.Get(aAgent, &data)) {
|
||||
return AUDIO_CHANNEL_STATE_MUTED;
|
||||
}
|
||||
|
||||
AudioChannelState state = AUDIO_CHANNEL_STATE_MUTED;
|
||||
bool oldElementHidden = data->mElementHidden;
|
||||
|
||||
UpdateChannelType(data->mChannel, CONTENT_PROCESS_ID_MAIN, aElementHidden,
|
||||
oldElementHidden);
|
||||
|
||||
// Update visibility.
|
||||
data->mElementHidden = aElementHidden;
|
||||
|
||||
ContentChild* cc = ContentChild::GetSingleton();
|
||||
cc->SendAudioChannelGetState(data->mChannel, aElementHidden, oldElementHidden,
|
||||
&state);
|
||||
data->mState = state;
|
||||
cc->SendAudioChannelChangedNotification();
|
||||
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
/** Only modify the speaker status when
|
||||
* (1) apps in the foreground.
|
||||
* (2) apps in the backgrund and inactive.
|
||||
* Notice : modify only when the visible status is stable, because there
|
||||
* has lantency in passing the visibility events.
|
||||
**/
|
||||
bool active = AnyAudioChannelIsActive();
|
||||
if (aElementHidden == oldElementHidden &&
|
||||
(!aElementHidden || (aElementHidden && !active))) {
|
||||
for (uint32_t i = 0; i < mSpeakerManager.Length(); i++) {
|
||||
mSpeakerManager[i]->SetAudioChannelActive(active);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
return state;
|
||||
}
|
||||
|
||||
void
|
||||
AudioChannelServiceChild::RegisterAudioChannelAgent(AudioChannelAgent* aAgent,
|
||||
AudioChannel aChannel,
|
||||
bool aWithVideo)
|
||||
{
|
||||
AudioChannelService::RegisterAudioChannelAgent(aAgent, aChannel, aWithVideo);
|
||||
|
||||
ContentChild::GetSingleton()->SendAudioChannelRegisterType(aChannel, aWithVideo);
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
if (obs) {
|
||||
obs->NotifyObservers(nullptr, "audio-channel-agent-changed", nullptr);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
AudioChannelServiceChild::UnregisterAudioChannelAgent(AudioChannelAgent* aAgent)
|
||||
{
|
||||
AudioChannelAgentData *pData;
|
||||
if (!mAgents.Get(aAgent, &pData)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// We need to keep a copy because unregister will remove the
|
||||
// AudioChannelAgentData object from the hashtable.
|
||||
AudioChannelAgentData data(*pData);
|
||||
|
||||
AudioChannelService::UnregisterAudioChannelAgent(aAgent);
|
||||
|
||||
ContentChild::GetSingleton()->SendAudioChannelUnregisterType(
|
||||
data.mChannel, data.mElementHidden, data.mWithVideo);
|
||||
|
||||
nsCOMPtr<nsIObserverService> obs = mozilla::services::GetObserverService();
|
||||
if (obs) {
|
||||
obs->NotifyObservers(nullptr, "audio-channel-agent-changed", nullptr);
|
||||
}
|
||||
#ifdef MOZ_WIDGET_GONK
|
||||
bool active = AnyAudioChannelIsActive();
|
||||
for (uint32_t i = 0; i < mSpeakerManager.Length(); i++) {
|
||||
mSpeakerManager[i]->SetAudioChannelActive(active);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void
|
||||
AudioChannelServiceChild::SetDefaultVolumeControlChannel(int32_t aChannel,
|
||||
bool aHidden)
|
||||
{
|
||||
ContentChild *cc = ContentChild::GetSingleton();
|
||||
if (cc) {
|
||||
cc->SendAudioChannelChangeDefVolChannel(aChannel, aHidden);
|
||||
}
|
||||
}
|
@ -1,62 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this file,
|
||||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef mozilla_dom_audiochannelservicechild_h__
|
||||
#define mozilla_dom_audiochannelservicechild_h__
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsISupports.h"
|
||||
|
||||
#include "AudioChannelService.h"
|
||||
#include "AudioChannelCommon.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class AudioChannelServiceChild : public AudioChannelService
|
||||
{
|
||||
public:
|
||||
|
||||
/**
|
||||
* Returns the AudioChannelServce singleton or null if the process havn't create it before.
|
||||
* Only to be called from main thread.
|
||||
*/
|
||||
static AudioChannelService* GetAudioChannelService();
|
||||
|
||||
/**
|
||||
* Returns the AudioChannelServce singleton.
|
||||
* If AudioChannelServce is not exist, create and return new one.
|
||||
* Only to be called from main thread.
|
||||
*/
|
||||
static AudioChannelService* GetOrCreateAudioChannelService();
|
||||
|
||||
static void Shutdown();
|
||||
|
||||
virtual void RegisterAudioChannelAgent(AudioChannelAgent* aAgent,
|
||||
AudioChannel aChannel,
|
||||
bool aWithVideo);
|
||||
virtual void UnregisterAudioChannelAgent(AudioChannelAgent* aAgent);
|
||||
|
||||
/**
|
||||
* Return the state to indicate this agent should keep playing/
|
||||
* fading volume/muted.
|
||||
*/
|
||||
virtual AudioChannelState GetState(AudioChannelAgent* aAgent,
|
||||
bool aElementHidden);
|
||||
|
||||
virtual void SetDefaultVolumeControlChannel(int32_t aChannel,
|
||||
bool aHidden);
|
||||
|
||||
protected:
|
||||
AudioChannelServiceChild();
|
||||
virtual ~AudioChannelServiceChild();
|
||||
};
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
||||
|
@ -4,25 +4,21 @@
|
||||
# License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
||||
|
||||
TEST_DIRS += ['tests']
|
||||
|
||||
XPIDL_SOURCES += [
|
||||
'nsIAudioChannelAgent.idl',
|
||||
'nsIAudioChannelService.idl',
|
||||
]
|
||||
|
||||
XPIDL_MODULE = 'dom_audiochannel'
|
||||
|
||||
EXPORTS += [
|
||||
'AudioChannelAgent.h',
|
||||
'AudioChannelCommon.h',
|
||||
'AudioChannelService.h',
|
||||
'AudioChannelServiceChild.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
'AudioChannelAgent.cpp',
|
||||
'AudioChannelService.cpp',
|
||||
'AudioChannelServiceChild.cpp',
|
||||
]
|
||||
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
@ -6,24 +6,13 @@
|
||||
|
||||
interface nsIDOMWindow;
|
||||
|
||||
[uuid(194b55d9-39c0-45c6-b8ef-b8049f978ea5)]
|
||||
[uuid(4f537c88-3722-4946-9a09-ce559fa0591d)]
|
||||
interface nsIAudioChannelAgentCallback : nsISupports
|
||||
{
|
||||
/**
|
||||
* Notified when the playable status of channel is changed.
|
||||
*
|
||||
* @param canPlay
|
||||
* Callback from agent to notify component of the playable status
|
||||
* of the channel. If canPlay is muted state, component SHOULD stop
|
||||
* playing media associated with this channel as soon as possible. if
|
||||
* it is faded state then the volume of media should be reduced.
|
||||
*/
|
||||
void canPlayChanged(in long canPlay);
|
||||
|
||||
/**
|
||||
* Notified when the window volume/mute is changed
|
||||
*/
|
||||
void windowVolumeChanged();
|
||||
void windowVolumeChanged(in float aVolume, in bool aMuted);
|
||||
};
|
||||
|
||||
/**
|
||||
@ -40,7 +29,7 @@ interface nsIAudioChannelAgentCallback : nsISupports
|
||||
* 1. Changes to the playable status of this channel.
|
||||
*/
|
||||
|
||||
[uuid(2b0222a5-8f7b-49d2-9ab8-cd01b744b23e)]
|
||||
[uuid(e28e1569-2a44-4f71-9cd0-216874b05d57)]
|
||||
interface nsIAudioChannelAgent : nsISupports
|
||||
{
|
||||
const long AUDIO_AGENT_CHANNEL_NORMAL = 0;
|
||||
@ -62,6 +51,13 @@ interface nsIAudioChannelAgent : nsISupports
|
||||
*/
|
||||
readonly attribute long audioChannelType;
|
||||
|
||||
%{C++
|
||||
inline int32_t AudioChannelType() {
|
||||
int32_t channel;
|
||||
return NS_SUCCEEDED(GetAudioChannelType(&channel)) ? channel : AUDIO_AGENT_CHANNEL_ERROR;
|
||||
}
|
||||
%}
|
||||
|
||||
/**
|
||||
* Initialize the agent with a channel type.
|
||||
* Note: This function should only be called once.
|
||||
@ -91,16 +87,6 @@ interface nsIAudioChannelAgent : nsISupports
|
||||
void initWithWeakCallback(in nsIDOMWindow window, in long channelType,
|
||||
in nsIAudioChannelAgentCallback callback);
|
||||
|
||||
/**
|
||||
* This method is just like init(), and specify the channel is associated
|
||||
* with video.
|
||||
*
|
||||
* @param weak
|
||||
* true if weak reference should be hold.
|
||||
*/
|
||||
void initWithVideo(in nsIDOMWindow window, in long channelType,
|
||||
in nsIAudioChannelAgentCallback callback, in boolean weak);
|
||||
|
||||
/**
|
||||
* Notify the agent that we want to start playing.
|
||||
* Note: Gecko component SHOULD call this function first then start to
|
||||
@ -115,28 +101,15 @@ interface nsIAudioChannelAgent : nsISupports
|
||||
* faded state: the agent has registered with audio channel service the
|
||||
* component should start playback as well as reducing the volume.
|
||||
*/
|
||||
long startPlaying();
|
||||
void notifyStartedPlaying(out float volume, out bool muted);
|
||||
|
||||
/**
|
||||
* Notify the agent we no longer want to play.
|
||||
*
|
||||
* Note : even if startPlaying() returned false, the agent would still be
|
||||
* registered with the audio channel service and receive callbacks for status changes.
|
||||
* So stopPlaying must still eventually be called to unregister the agent with the
|
||||
* channel service.
|
||||
* Note : even if notifyStartedPlaying() returned false, the agent would
|
||||
* still be registered with the audio channel service and receive callbacks
|
||||
* for status changes. So notifyStoppedPlaying must still eventually be
|
||||
* called to unregister the agent with the channel service.
|
||||
*/
|
||||
void stopPlaying();
|
||||
|
||||
/**
|
||||
* Notify the agent of the visibility state of the window using this agent.
|
||||
* @param visible
|
||||
* True if the window associated with the agent is visible.
|
||||
*/
|
||||
void setVisibilityState(in boolean visible);
|
||||
|
||||
/**
|
||||
* Retrieve the volume from the window.
|
||||
*/
|
||||
readonly attribute float windowVolume;
|
||||
void notifyStoppedPlaying();
|
||||
};
|
||||
|
||||
|
29
dom/audiochannel/nsIAudioChannelService.idl
Normal file
29
dom/audiochannel/nsIAudioChannelService.idl
Normal file
@ -0,0 +1,29 @@
|
||||
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIDOMWindow;
|
||||
|
||||
[scriptable, builtinclass, uuid(323e5472-b8f4-4288-b1b9-53c7c54bbbe8)]
|
||||
interface nsIAudioChannelService : nsISupports
|
||||
{
|
||||
float getAudioChannelVolume(in nsIDOMWindow window,
|
||||
in unsigned short audioChannel);
|
||||
|
||||
void setAudioChannelVolume(in nsIDOMWindow window,
|
||||
in unsigned short audioChannel,
|
||||
in float volume);
|
||||
|
||||
boolean getAudioChannelMuted(in nsIDOMWindow window,
|
||||
in unsigned short audioChannel);
|
||||
|
||||
void setAudioChannelMuted(in nsIDOMWindow window,
|
||||
in unsigned short audioChannel,
|
||||
in boolean muted);
|
||||
|
||||
boolean isAudioChannelActive(in nsIDOMWindow window,
|
||||
in unsigned short audioChannel);
|
||||
};
|
@ -1,18 +0,0 @@
|
||||
/* Any copyright is dedicated to the Public Domain.
|
||||
http://creativecommons.org/publicdomain/zero/1.0/ */
|
||||
|
||||
const { classes: Cc, interfaces: Ci, results: Cr, utils: Cu } = Components;
|
||||
const { Services } = Cu.import('resource://gre/modules/Services.jsm');
|
||||
const { SystemAppProxy } = Cu.import('resource://gre/modules/SystemAppProxy.jsm');
|
||||
|
||||
addMessageListener('init-chrome-event', function(message) {
|
||||
// listen mozChromeEvent and forward to content process.
|
||||
let type = message.type;
|
||||
|
||||
SystemAppProxy.addEventListener('mozChromeEvent', function(event) {
|
||||
let details = event.detail;
|
||||
if (details.type === type) {
|
||||
sendAsyncMessage('chrome-event', details);
|
||||
}
|
||||
}, true);
|
||||
});
|
@ -1,669 +0,0 @@
|
||||
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#ifdef XP_WIN
|
||||
#include <windows.h>
|
||||
#else
|
||||
#include <unistd.h>
|
||||
#endif
|
||||
|
||||
#include "TestHarness.h"
|
||||
|
||||
#include "nsWeakReference.h"
|
||||
#include "AudioChannelService.h"
|
||||
#include "AudioChannelAgent.h"
|
||||
|
||||
#include "nsThreadUtils.h"
|
||||
|
||||
#define TEST_ENSURE_BASE(_test, _msg) \
|
||||
PR_BEGIN_MACRO \
|
||||
if (!(_test)) { \
|
||||
fail(_msg); \
|
||||
return NS_ERROR_FAILURE; \
|
||||
} else { \
|
||||
passed(_msg); \
|
||||
} \
|
||||
PR_END_MACRO
|
||||
|
||||
using namespace mozilla::dom;
|
||||
|
||||
void
|
||||
spin_events_loop_until_false(const bool* const aCondition)
|
||||
{
|
||||
nsCOMPtr<nsIThread> thread(::do_GetCurrentThread());
|
||||
nsresult rv = NS_OK;
|
||||
bool processed = true;
|
||||
while (*aCondition && NS_SUCCEEDED(rv)) {
|
||||
rv = thread->ProcessNextEvent(true, &processed);
|
||||
}
|
||||
}
|
||||
|
||||
class Agent : public nsIAudioChannelAgentCallback,
|
||||
public nsSupportsWeakReference
|
||||
{
|
||||
protected:
|
||||
virtual ~Agent()
|
||||
{
|
||||
if (mRegistered) {
|
||||
StopPlaying();
|
||||
}
|
||||
}
|
||||
|
||||
public:
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
explicit Agent(AudioChannel aChannel)
|
||||
: mChannel(aChannel)
|
||||
, mWaitCallback(false)
|
||||
, mRegistered(false)
|
||||
, mCanPlay(AUDIO_CHANNEL_STATE_MUTED)
|
||||
{
|
||||
mAgent = do_CreateInstance("@mozilla.org/audiochannelagent;1");
|
||||
}
|
||||
|
||||
nsresult Init(bool video=false)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (video) {
|
||||
rv = mAgent->InitWithVideo(nullptr, static_cast<int32_t>(mChannel),
|
||||
this, true);
|
||||
}
|
||||
else {
|
||||
rv = mAgent->InitWithWeakCallback(nullptr, static_cast<int32_t>(mChannel),
|
||||
this);
|
||||
}
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return mAgent->SetVisibilityState(false);
|
||||
}
|
||||
|
||||
nsresult StartPlaying(AudioChannelState *_ret)
|
||||
{
|
||||
if (mRegistered) {
|
||||
StopPlaying();
|
||||
}
|
||||
|
||||
nsresult rv = mAgent->StartPlaying((int32_t *)_ret);
|
||||
mRegistered = true;
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult StopPlaying()
|
||||
{
|
||||
mRegistered = false;
|
||||
spin_events_loop_until_false(&mWaitCallback);
|
||||
return mAgent->StopPlaying();
|
||||
}
|
||||
|
||||
nsresult SetVisibilityState(bool visible)
|
||||
{
|
||||
if (mRegistered) {
|
||||
mWaitCallback = true;
|
||||
}
|
||||
return mAgent->SetVisibilityState(visible);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP CanPlayChanged(int32_t canPlay) override
|
||||
{
|
||||
mCanPlay = static_cast<AudioChannelState>(canPlay);
|
||||
mWaitCallback = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP WindowVolumeChanged() override
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult GetCanPlay(AudioChannelState *_ret, bool aWaitCallback = false)
|
||||
{
|
||||
if (aWaitCallback) {
|
||||
mWaitCallback = true;
|
||||
}
|
||||
|
||||
spin_events_loop_until_false(&mWaitCallback);
|
||||
*_ret = mCanPlay;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIAudioChannelAgent> mAgent;
|
||||
AudioChannel mChannel;
|
||||
bool mWaitCallback;
|
||||
bool mRegistered;
|
||||
AudioChannelState mCanPlay;
|
||||
};
|
||||
|
||||
NS_IMPL_ISUPPORTS(Agent, nsIAudioChannelAgentCallback,
|
||||
nsISupportsWeakReference)
|
||||
|
||||
nsresult
|
||||
TestDoubleStartPlaying()
|
||||
{
|
||||
nsRefPtr<Agent> agent = new Agent(AudioChannel::Normal);
|
||||
|
||||
nsresult rv = agent->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
AudioChannelState playable;
|
||||
rv = agent->mAgent->StartPlaying((int32_t *)&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = agent->mAgent->StartPlaying((int32_t *)&playable);
|
||||
TEST_ENSURE_BASE(NS_FAILED(rv),
|
||||
"Test0: StartPlaying calling twice must return error");
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
TestOneNormalChannel()
|
||||
{
|
||||
nsRefPtr<Agent> agent = new Agent(AudioChannel::Normal);
|
||||
nsresult rv = agent->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
AudioChannelState playable;
|
||||
rv = agent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_MUTED,
|
||||
"Test1: A normal channel unvisible agent must be muted");
|
||||
|
||||
rv = agent->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = agent->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test1: A normal channel visible agent must be playable");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
TestTwoNormalChannels()
|
||||
{
|
||||
nsRefPtr<Agent> agent1 = new Agent(AudioChannel::Normal);
|
||||
nsresult rv = agent1->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<Agent> agent2 = new Agent(AudioChannel::Normal);
|
||||
rv = agent2->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
AudioChannelState playable;
|
||||
rv = agent1->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_MUTED,
|
||||
"Test2: A normal channel unvisible agent1 must be muted");
|
||||
|
||||
rv = agent2->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_MUTED,
|
||||
"Test2: A normal channel unvisible agent2 must be muted");
|
||||
|
||||
rv = agent1->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = agent2->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = agent1->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test2: A normal channel visible agent1 must be playable");
|
||||
|
||||
rv = agent2->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test2: A normal channel visible agent2 must be playable");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
TestContentChannels()
|
||||
{
|
||||
nsRefPtr<Agent> agent1 = new Agent(AudioChannel::Content);
|
||||
nsresult rv = agent1->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<Agent> agent2 = new Agent(AudioChannel::Content);
|
||||
rv = agent2->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// All content channels in the foreground can be allowed to play
|
||||
rv = agent1->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = agent2->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
AudioChannelState playable;
|
||||
rv = agent1->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test3: A content channel visible agent1 must be playable");
|
||||
|
||||
rv = agent2->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test3: A content channel visible agent2 must be playable");
|
||||
|
||||
// Test the transition state of one content channel tried to set non-visible
|
||||
// state first when app is going to background.
|
||||
rv = agent1->SetVisibilityState(false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = agent1->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test3: A content channel unvisible agent1 must be playable from "
|
||||
"foreground to background");
|
||||
|
||||
// Test all content channels set non-visible already
|
||||
rv = agent2->SetVisibilityState(false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = agent2->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test3: A content channel unvisible agent2 must be playable from "
|
||||
"foreground to background");
|
||||
|
||||
// Clear the content channels & mActiveContentChildIDs in AudioChannelService.
|
||||
// If agent stop playable in the background, we will reserve it's childID in
|
||||
// mActiveContentChildIDs, then it can allow to play next song. So we set agents
|
||||
// to foreground first then stopping to play
|
||||
rv = agent1->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = agent2->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = agent1->StopPlaying();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = agent2->StopPlaying();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Test that content channels can be allow to play when they starts from
|
||||
// the background state
|
||||
rv = agent1->SetVisibilityState(false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
rv = agent2->SetVisibilityState(false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = agent1->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test3: A content channel unvisible agent1 must be playable "
|
||||
"from background state");
|
||||
|
||||
rv = agent2->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test3: A content channel unvisible agent2 must be playable "
|
||||
"from background state");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
TestFadedState()
|
||||
{
|
||||
nsRefPtr<Agent> normalAgent = new Agent(AudioChannel::Normal);
|
||||
nsresult rv = normalAgent->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<Agent> contentAgent = new Agent(AudioChannel::Content);
|
||||
rv = contentAgent->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<Agent> notificationAgent = new Agent(AudioChannel::Notification);
|
||||
rv = notificationAgent->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = normalAgent->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = contentAgent->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = notificationAgent->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
AudioChannelState playable;
|
||||
rv = normalAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test4: A normal channel visible agent must be playable");
|
||||
|
||||
rv = contentAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test4: A content channel visible agent must be playable");
|
||||
|
||||
rv = notificationAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test4: A notification channel visible agent must be playable");
|
||||
|
||||
rv = contentAgent->GetCanPlay(&playable, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_FADED,
|
||||
"Test4: A content channel unvisible agent must be faded because of "
|
||||
"notification channel is playing");
|
||||
|
||||
rv = contentAgent->SetVisibilityState(false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = contentAgent->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_FADED,
|
||||
"Test4: A content channel unvisible agent must be faded because of "
|
||||
"notification channel is playing");
|
||||
|
||||
rv = notificationAgent->SetVisibilityState(false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = notificationAgent->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test4: A notification channel unvisible agent must be playable from "
|
||||
"foreground to background");
|
||||
|
||||
rv = notificationAgent->StopPlaying();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = contentAgent->GetCanPlay(&playable, true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test4: A content channel unvisible agent must be playable "
|
||||
"because of notification channel is stopped");
|
||||
|
||||
rv = contentAgent->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
TestPriorities()
|
||||
{
|
||||
nsRefPtr<Agent> normalAgent = new Agent(AudioChannel::Normal);
|
||||
nsresult rv = normalAgent->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<Agent> contentAgent = new Agent(AudioChannel::Content);
|
||||
rv = contentAgent->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<Agent> notificationAgent = new Agent(AudioChannel::Notification);
|
||||
rv = notificationAgent->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<Agent> alarmAgent = new Agent(AudioChannel::Alarm);
|
||||
rv = alarmAgent->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<Agent> telephonyAgent = new Agent(AudioChannel::Telephony);
|
||||
rv = telephonyAgent->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<Agent> ringerAgent = new Agent(AudioChannel::Ringer);
|
||||
rv = ringerAgent->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<Agent> pNotificationAgent =
|
||||
new Agent(AudioChannel::Publicnotification);
|
||||
rv = pNotificationAgent->Init();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
AudioChannelState playable;
|
||||
|
||||
rv = normalAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_MUTED,
|
||||
"Test5: A normal channel unvisible agent must be muted");
|
||||
|
||||
rv = contentAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test5: A content channel unvisible agent must be playable while "
|
||||
"playing from background state");
|
||||
|
||||
rv = notificationAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test5: A notification channel unvisible agent must be playable");
|
||||
|
||||
rv = alarmAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test5: An alarm channel unvisible agent must be playable");
|
||||
|
||||
rv = notificationAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_MUTED,
|
||||
"Test5: A notification channel unvisible agent must be muted when an "
|
||||
"alarm is playing");
|
||||
|
||||
rv = telephonyAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test5: A telephony channel unvisible agent must be playable");
|
||||
|
||||
rv = alarmAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_MUTED,
|
||||
"Test5: An alarm channel unvisible agent must be muted when a telephony "
|
||||
"is playing");
|
||||
|
||||
rv = ringerAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test5: A ringer channel unvisible agent must be playable");
|
||||
|
||||
rv = telephonyAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_MUTED,
|
||||
"Test5: A telephony channel unvisible agent must be muted when a ringer "
|
||||
"is playing");
|
||||
|
||||
rv = pNotificationAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test5: A pNotification channel unvisible agent must be playable");
|
||||
|
||||
rv = ringerAgent->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_MUTED,
|
||||
"Test5: A ringer channel unvisible agent must be muted when a public "
|
||||
"notification is playing");
|
||||
|
||||
// Stop to play notification channel or normal/content will be faded.
|
||||
// Which already be tested on Test 4.
|
||||
rv = notificationAgent->StopPlaying();
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Settings visible the normal channel.
|
||||
rv = normalAgent->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = normalAgent->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test5: A normal channel visible agent must be playable");
|
||||
|
||||
// Set the content channel as visible .
|
||||
rv = contentAgent->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Content must be playable because visible.
|
||||
rv = contentAgent->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test5: A content channel visible agent must be playable");
|
||||
|
||||
// Set the alarm channel as visible.
|
||||
rv = alarmAgent->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = alarmAgent->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test5: An alarm channel visible agent must be playable");
|
||||
|
||||
// Set the telephony channel as visible.
|
||||
rv = telephonyAgent->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = telephonyAgent->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test5: A telephony channel visible agent must be playable");
|
||||
|
||||
// Set the ringer channel as visible.
|
||||
rv = ringerAgent->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = ringerAgent->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test5: A ringer channel visible agent must be playable");
|
||||
|
||||
// Set the public notification channel as visible.
|
||||
rv = pNotificationAgent->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = pNotificationAgent->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test5: A pNotification channel visible agent must be playable");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
TestOneVideoNormalChannel()
|
||||
{
|
||||
nsRefPtr<Agent> agent1 = new Agent(AudioChannel::Normal);
|
||||
nsresult rv = agent1->Init(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsRefPtr<Agent> agent2 = new Agent(AudioChannel::Content);
|
||||
rv = agent2->Init(false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
AudioChannelState playable;
|
||||
rv = agent1->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_MUTED,
|
||||
"Test6: A video normal channel invisible agent1 must be muted");
|
||||
|
||||
rv = agent2->StartPlaying(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test6: A content channel invisible agent2 must be playable");
|
||||
|
||||
// one video normal channel in foreground and one content channel in background
|
||||
rv = agent1->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = agent1->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test6: A video normal channel visible agent1 must be playable");
|
||||
|
||||
rv = agent2->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_MUTED,
|
||||
"Test6: A content channel invisible agent2 must be muted");
|
||||
|
||||
// both one video normal channel and one content channel in foreground
|
||||
rv = agent2->SetVisibilityState(true);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = agent1->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test6: A video normal channel visible agent1 must be playable");
|
||||
|
||||
rv = agent2->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test6: A content channel visible agent2 must be playable");
|
||||
|
||||
// one video normal channel in background and one content channel in foreground
|
||||
rv = agent1->SetVisibilityState(false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = agent1->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_MUTED,
|
||||
"Test6: A video normal channel invisible agent1 must be muted");
|
||||
|
||||
rv = agent2->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test6: A content channel visible agent2 must be playable");
|
||||
|
||||
// both one video normal channel and one content channel in background
|
||||
rv = agent2->SetVisibilityState(false);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = agent1->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_MUTED,
|
||||
"Test6: A video normal channel invisible agent1 must be muted");
|
||||
|
||||
rv = agent2->GetCanPlay(&playable);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
TEST_ENSURE_BASE(playable == AUDIO_CHANNEL_STATE_NORMAL,
|
||||
"Test6: A content channel invisible agent2 must be playable");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
{
|
||||
ScopedXPCOM xpcom("AudioChannelService");
|
||||
if (xpcom.failed()) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (NS_FAILED(TestDoubleStartPlaying())) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (NS_FAILED(TestOneNormalChannel())) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (NS_FAILED(TestTwoNormalChannels())) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (NS_FAILED(TestContentChannels())) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (NS_FAILED(TestFadedState())) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
// Channel type with AudioChannel::Telephony cannot be unregistered until the
|
||||
// main thread has chances to process 1500 millisecond timer. In order to
|
||||
// skip ambiguous return value of ChannelsActiveWithHigherPriorityThan(), new
|
||||
// test cases are added before any test case that registers the channel type
|
||||
// with AudioChannel::Telephony channel.
|
||||
if (NS_FAILED(TestOneVideoNormalChannel())) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (NS_FAILED(TestPriorities())) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
Binary file not shown.
@ -1,99 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<title>Test audio-channel-changed & visible-audio-channel-changed mozChromeEvent</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script>
|
||||
var normalAudio;
|
||||
var contentAudio;
|
||||
var notificationAudio;
|
||||
var alarmAudio;
|
||||
var telephonyAudio;
|
||||
var ringerAudio;
|
||||
var publicnotificationAudio;
|
||||
|
||||
function playWithAudioType(audio, type) {
|
||||
audio.mozAudioChannelType = type;
|
||||
audio.src = "test.ogg";
|
||||
audio.loop = true;
|
||||
|
||||
audio.play();
|
||||
}
|
||||
|
||||
function runTest() {
|
||||
// normal channel.
|
||||
normalAudio = new Audio();
|
||||
playWithAudioType(normalAudio, 'normal');
|
||||
|
||||
// content channel.
|
||||
contentAudio = new Audio();
|
||||
playWithAudioType(contentAudio, 'content');
|
||||
|
||||
// notification channel.
|
||||
notificationAudio = new Audio();
|
||||
playWithAudioType(notificationAudio, 'notification');
|
||||
|
||||
// alarm channel.
|
||||
alarmAudio = new Audio();
|
||||
playWithAudioType(alarmAudio, 'alarm');
|
||||
|
||||
// telephony channel.
|
||||
telephonyAudio = new Audio();
|
||||
playWithAudioType(telephonyAudio, 'telephony');
|
||||
|
||||
// ringer channel.
|
||||
ringerAudio = new Audio();
|
||||
playWithAudioType(ringerAudio, 'ringer');
|
||||
|
||||
// publicnotification channel.
|
||||
publicnotificationAudio = new Audio();
|
||||
playWithAudioType(publicnotificationAudio, 'publicnotification');
|
||||
|
||||
window.addEventListener('hashchange', function(event) {
|
||||
if (location.hash == "#pauseAudio") {
|
||||
publicnotificationAudio.pause();
|
||||
ringerAudio.pause();
|
||||
telephonyAudio.pause();
|
||||
}
|
||||
|
||||
if (location.hash == "#pauseAudioFollowing") {
|
||||
alarmAudio.pause();
|
||||
notificationAudio.pause();
|
||||
contentAudio.pause();
|
||||
normalAudio.pause();
|
||||
}
|
||||
}, false);
|
||||
}
|
||||
|
||||
function checkBackgroundStatus() {
|
||||
if (location.hash == "#fg") {
|
||||
runTest();
|
||||
return;
|
||||
}
|
||||
|
||||
if (document.hidden) {
|
||||
runTest();
|
||||
return;
|
||||
}
|
||||
|
||||
document.addEventListener('visibilitychange', function visibilityChange() {
|
||||
if (document.hidden) {
|
||||
runTest();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
SpecialPowers.pushPermissions(
|
||||
[{ "type": "audio-channel-content", "allow": 1, "context": document },
|
||||
{ "type": "audio-channel-notification", "allow": 1, "context": document },
|
||||
{ "type": "audio-channel-alarm", "allow": 1, "context": document },
|
||||
{ "type": "audio-channel-telephony", "allow": 1, "context": document },
|
||||
{ "type": "audio-channel-ringer", "allow": 1, "context": document },
|
||||
{ "type": "audio-channel-publicnotification", "allow": 1, "context": document }],
|
||||
checkBackgroundStatus);
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,18 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test Telephony Channel Policy</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
<script type="application/javascript;version=1.7">
|
||||
|
||||
var audio = new Audio();
|
||||
audio.mozAudioChannelType = 'telephony';
|
||||
audio.src = "audio.ogg";
|
||||
audio.play();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,11 +0,0 @@
|
||||
[DEFAULT]
|
||||
support-files =
|
||||
audio.ogg
|
||||
file_audio.html
|
||||
file_telephonyPolicy.html
|
||||
AudioChannelChromeScript.js
|
||||
|
||||
[test_telephonyPolicy.html]
|
||||
skip-if = buildapp == 'mulet' || (toolkit == 'gonk' || e10s) || os == "android"
|
||||
[test_audioChannelChange.html]
|
||||
skip-if = (toolkit != 'gonk')
|
@ -1,209 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test audio-channel-changed & visible-audio-channel-changed mozChromeEvent</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="content"></div>
|
||||
<script type="application/javascript;version=1.7">
|
||||
var expectedAudioTypes;
|
||||
var expectedVisibleAudioTypes;
|
||||
var expectedVisibleAudioType;
|
||||
var index;
|
||||
var visibleIndex;
|
||||
var iframe1;
|
||||
var normalAudio;
|
||||
|
||||
function playWithAudioType(audio, type) {
|
||||
audio.mozAudioChannelType = type;
|
||||
audio.src = "test.ogg";
|
||||
audio.loop = true;
|
||||
|
||||
audio.play();
|
||||
}
|
||||
|
||||
function fgBgTestListener(message) {
|
||||
var type = message.type;
|
||||
var channel = message.channel;
|
||||
|
||||
if (type == 'audio-channel-changed') {
|
||||
is(channel, expectedAudioTypes[index], channel + " is received and expected " + expectedAudioTypes[index]);
|
||||
index++;
|
||||
}
|
||||
|
||||
if (type == 'visible-audio-channel-changed') {
|
||||
is(channel, expectedVisibleAudioType, channel + " is received and expected " + expectedVisibleAudioType);
|
||||
}
|
||||
|
||||
// All audio types are playing now so ask to pause them.
|
||||
// This call will stop audio from highest to telephony.
|
||||
if ('cmd-pause' == expectedAudioTypes[index]) {
|
||||
iframe1.src = 'file_audio.html#pauseAudio';
|
||||
index++;
|
||||
}
|
||||
|
||||
// According to there is a 1.5 second delay of releasing telephony,
|
||||
// we need to wait for it then continue to pause others.
|
||||
if ('cmd-secondPause' == expectedAudioTypes[index]) {
|
||||
iframe1.src = 'file_audio.html#pauseAudioFollowing';
|
||||
index++;
|
||||
}
|
||||
|
||||
if (index == expectedAudioTypes.length) {
|
||||
document.body.removeChild(iframe1);
|
||||
script.removeMessageListener('chrome-event', fgBgTestListener);
|
||||
normalAudio.pause();
|
||||
SimpleTest.finish();
|
||||
}
|
||||
}
|
||||
|
||||
// Channel of visible-audio-channel-changed event should be always normal.
|
||||
// Audios in background should not effect visible-audio-channel-changed.
|
||||
function runFgBgTest() {
|
||||
expectedAudioTypes = ["normal", "content", "notification",
|
||||
"alarm", "telephony", "ringer", "publicnotification", "cmd-pause",
|
||||
"ringer", "telephony", "alarm", "cmd-secondPause", "notification",
|
||||
"content", "normal"];
|
||||
expectedVisibleAudioType = "normal";
|
||||
index = 0;
|
||||
|
||||
script.addMessageListener('chrome-event', fgBgTestListener);
|
||||
|
||||
// To play a audio with normal channel in the foreground.
|
||||
normalAudio = new Audio();
|
||||
playWithAudioType(normalAudio, 'normal');
|
||||
|
||||
iframe1.src = 'file_audio.html#bg';
|
||||
document.body.appendChild(iframe1);
|
||||
iframe1.setVisible(false);
|
||||
}
|
||||
|
||||
function bgTestListener(message) {
|
||||
var type = message.type;
|
||||
var channel = message.channel;
|
||||
|
||||
if (type == 'audio-channel-changed') {
|
||||
is(channel, expectedAudioTypes[index], channel + " is received and expected " + expectedAudioTypes[index]);
|
||||
index++;
|
||||
}
|
||||
|
||||
if (type == 'visible-audio-channel-changed') {
|
||||
is(channel, expectedVisibleAudioType, channel + " is received and expected " + expectedVisibleAudioType);
|
||||
}
|
||||
|
||||
// All audio types are playing now so ask to pause them.
|
||||
if ('cmd-pause' == expectedAudioTypes[index]) {
|
||||
iframe1.src = 'file_audio.html#pauseAudio';
|
||||
index++;
|
||||
}
|
||||
|
||||
if ('cmd-secondPause' == expectedAudioTypes[index]) {
|
||||
iframe1.src = 'file_audio.html#pauseAudioFollowing';
|
||||
index++;
|
||||
}
|
||||
|
||||
if (index == expectedAudioTypes.length) {
|
||||
document.body.removeChild(iframe1);
|
||||
script.removeMessageListener('chrome-event', bgTestListener);
|
||||
runFgBgTest();
|
||||
}
|
||||
}
|
||||
|
||||
// 1. Channel of visible-audio-channel-changed event should be always none.
|
||||
// 2. normal is not allowed to be played in the background.
|
||||
function runBgTest() {
|
||||
expectedAudioTypes = ["content", "notification",
|
||||
"alarm", "telephony", "ringer", "publicnotification", "cmd-pause",
|
||||
"ringer", "telephony", "alarm", "cmd-secondPause", "notification",
|
||||
"content", "none"];
|
||||
expectedVisibleAudioType = "none";
|
||||
index = 0;
|
||||
|
||||
script.addMessageListener('chrome-event', bgTestListener);
|
||||
|
||||
iframe1.src = 'file_audio.html#bg';
|
||||
document.body.appendChild(iframe1);
|
||||
iframe1.setVisible(false);
|
||||
}
|
||||
|
||||
function fgTestListener(message) {
|
||||
var type = message.type;
|
||||
var channel = message.channel;
|
||||
|
||||
if (type == 'audio-channel-changed') {
|
||||
is(channel, expectedAudioTypes[index], channel + " is received and expected " + expectedAudioTypes[index]);
|
||||
index++;
|
||||
}
|
||||
|
||||
if (type == 'visible-audio-channel-changed') {
|
||||
is(channel, expectedAudioTypes[visibleIndex], channel + " is received and expected " + expectedAudioTypes[visibleIndex]);
|
||||
visibleIndex++;
|
||||
}
|
||||
|
||||
// All audio types are playing now so ask to pause them.
|
||||
if ('cmd-pause' == expectedAudioTypes[visibleIndex] &&
|
||||
'cmd-pause' == expectedAudioTypes[index]) {
|
||||
iframe1.src = 'file_audio.html#pauseAudio';
|
||||
visibleIndex++;
|
||||
index++;
|
||||
}
|
||||
|
||||
if ('cmd-secondPause' == expectedAudioTypes[visibleIndex] &&
|
||||
'cmd-secondPause' == expectedAudioTypes[index]) {
|
||||
iframe1.src = 'file_audio.html#pauseAudioFollowing';
|
||||
visibleIndex++;
|
||||
index++;
|
||||
}
|
||||
|
||||
if (index == expectedAudioTypes.length && visibleIndex == expectedAudioTypes.length) {
|
||||
document.body.removeChild(iframe1);
|
||||
script.removeMessageListener('chrome-event', fgTestListener);
|
||||
runBgTest();
|
||||
}
|
||||
}
|
||||
|
||||
// The foreground audio will effect both of audio-channel-changed and
|
||||
// visible-audio-channel-changed.
|
||||
function runFgTest() {
|
||||
expectedAudioTypes = ["normal", "content", "notification",
|
||||
"alarm", "telephony", "ringer", "publicnotification",
|
||||
"cmd-pause", "ringer", "telephony", "alarm",
|
||||
"cmd-secondPause", "notification", "content",
|
||||
"normal", "none"];
|
||||
|
||||
index = 0;
|
||||
visibleIndex = 0;
|
||||
|
||||
script.addMessageListener('chrome-event', fgTestListener);
|
||||
|
||||
iframe1 = document.createElement('iframe');
|
||||
iframe1.setAttribute('mozbrowser', true);
|
||||
iframe1.src = 'file_audio.html#fg';
|
||||
document.body.appendChild(iframe1);
|
||||
}
|
||||
|
||||
var url = SimpleTest.getTestFileURL("AudioChannelChromeScript.js")
|
||||
var script = SpecialPowers.loadChromeScript(url);
|
||||
script.sendAsyncMessage("init-chrome-event", {
|
||||
type: 'audio-channel-changed'
|
||||
});
|
||||
script.sendAsyncMessage("init-chrome-event", {
|
||||
type: 'visible-audio-channel-changed'
|
||||
});
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
|
||||
SpecialPowers.pushPermissions(
|
||||
[{ "type": "browser", "allow": 1, "context": document },
|
||||
{ "type": "embed-apps", "allow": 1, "context": document },
|
||||
{ "type": "webapps-manage", "allow": 1, "context": document }], function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.ipc.browser_frames.oop_by_default", true],
|
||||
["media.useAudioChannelService", true],
|
||||
["dom.mozBrowserFramesEnabled", true]]}, runFgTest);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -1,87 +0,0 @@
|
||||
<!DOCTYPE HTML>
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>Test the Telephony Channel Policy</title>
|
||||
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
|
||||
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
|
||||
</head>
|
||||
<body>
|
||||
<div id="container"></div>
|
||||
<script type="application/javascript;version=1.7">
|
||||
|
||||
function mainApp() {
|
||||
var audio = new Audio();
|
||||
audio.mozAudioChannelType = 'telephony';
|
||||
audio.src = "audio.ogg";
|
||||
audio.loop = true;
|
||||
audio.play();
|
||||
|
||||
audio.addEventListener('mozinterruptbegin', function() {
|
||||
ok(true, "This element has been muted!");
|
||||
}, false);
|
||||
|
||||
audio.addEventListener('mozinterruptend', function() {
|
||||
ok(true, "This element has been unmuted!");
|
||||
audio.pause();
|
||||
runTest();
|
||||
}, false);
|
||||
|
||||
setTimeout(runTest, 600);
|
||||
}
|
||||
|
||||
function newApp() {
|
||||
var iframe = document.createElement('iframe');
|
||||
iframe.setAttribute('mozbrowser', true);
|
||||
// That needs to be an app.
|
||||
iframe.setAttribute('mozapp', 'https://acertified.com/manifest.webapp');
|
||||
iframe.src = "file_telephonyPolicy.html";
|
||||
document.body.appendChild(iframe);
|
||||
}
|
||||
|
||||
var tests = [
|
||||
// Permissions
|
||||
function() {
|
||||
SpecialPowers.pushPermissions(
|
||||
[{ "type": "browser", "allow": 1, "context": document },
|
||||
{ "type": "embed-apps", "allow": 1, "context": document },
|
||||
{ "type": "webapps-manage", "allow": 1, "context": document },
|
||||
{ "type": "audio-channel-telephony", "allow": 1, "context": document }], runTest);
|
||||
},
|
||||
|
||||
// Preferences
|
||||
function() {
|
||||
SpecialPowers.pushPrefEnv({"set": [["dom.ipc.browser_frames.oop_by_default", true],
|
||||
["media.useAudioChannelAPI", true],
|
||||
["media.useAudioChannelService", true],
|
||||
["media.defaultAudioChannel", "telephony"],
|
||||
["dom.mozBrowserFramesEnabled", true],
|
||||
["network.disable.ipc.security", true]]}, runTest);
|
||||
},
|
||||
|
||||
// Run 2 apps
|
||||
mainApp,
|
||||
newApp,
|
||||
];
|
||||
|
||||
function runTest() {
|
||||
if (!tests.length) {
|
||||
finish();
|
||||
return;
|
||||
}
|
||||
|
||||
var test = tests.shift();
|
||||
test();
|
||||
}
|
||||
|
||||
function finish() {
|
||||
SimpleTest.finish();
|
||||
}
|
||||
|
||||
SimpleTest.waitForExplicitFinish();
|
||||
SimpleTest.requestFlakyTimeout("untriaged");
|
||||
runTest();
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
@ -703,8 +703,8 @@ ResponsiveImageCandidate::Density(int32_t aMatchingWidth) const
|
||||
if (mType == eCandidateType_Density) {
|
||||
return mValue.mDensity;
|
||||
} else if (mType == eCandidateType_ComputedFromWidth) {
|
||||
if (aMatchingWidth <= 0) {
|
||||
MOZ_ASSERT(false, "0 or negative matching width is invalid per spec");
|
||||
if (aMatchingWidth < 0) {
|
||||
MOZ_ASSERT(false, "Don't expect to have a negative matching width at this point");
|
||||
return 1.0;
|
||||
}
|
||||
double density = double(mValue.mWidth) / double(aMatchingWidth);
|
||||
|
@ -13,6 +13,8 @@
|
||||
#include "mozilla/DOMEventTargetHelper.h"
|
||||
#include "mozilla/net/WebSocketChannel.h"
|
||||
#include "mozilla/dom/File.h"
|
||||
#include "mozilla/dom/nsCSPContext.h"
|
||||
#include "mozilla/dom/nsCSPUtils.h"
|
||||
#include "mozilla/dom/ScriptSettings.h"
|
||||
#include "mozilla/dom/WorkerPrivate.h"
|
||||
#include "mozilla/dom/WorkerRunnable.h"
|
||||
@ -1466,6 +1468,67 @@ WebSocketImpl::Init(JSContext* aCx,
|
||||
}
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
{
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), mURI);
|
||||
|
||||
// We crash here because we are sure that mURI is a valid URI, so either we
|
||||
// are OOM'ing or something else bad is happening.
|
||||
if (NS_WARN_IF(NS_FAILED(rv))) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
}
|
||||
|
||||
// Check content policy.
|
||||
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
|
||||
nsCOMPtr<nsIDocument> originDoc = nsContentUtils::GetDocumentFromScriptContext(sc);
|
||||
mOriginDocument = do_GetWeakReference(originDoc);
|
||||
aRv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_WEBSOCKET,
|
||||
uri,
|
||||
aPrincipal,
|
||||
originDoc,
|
||||
EmptyCString(),
|
||||
nullptr,
|
||||
&shouldLoad,
|
||||
nsContentUtils::GetContentPolicy(),
|
||||
nsContentUtils::GetSecurityManager());
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (NS_CP_REJECTED(shouldLoad)) {
|
||||
// Disallowed by content policy.
|
||||
aRv.Throw(NS_ERROR_CONTENT_BLOCKED);
|
||||
return;
|
||||
}
|
||||
|
||||
// Potentially the page uses the CSP directive 'upgrade-insecure-requests'.
|
||||
// In such a case we have to upgrade ws: to wss: and also update mSecure
|
||||
// to reflect that upgrade. Please note that we can not upgrade from ws:
|
||||
// to wss: before performing content policy checks because CSP needs to
|
||||
// send reports in case the scheme is about to be upgraded.
|
||||
if (!mSecure && originDoc && originDoc->GetUpgradeInsecureRequests()) {
|
||||
// let's use the old specification before the upgrade for logging
|
||||
NS_ConvertUTF8toUTF16 reportSpec(mURI);
|
||||
|
||||
// upgrade the request from ws:// to wss:// and mark as secure
|
||||
mURI.ReplaceSubstring("ws://", "wss://");
|
||||
if (NS_WARN_IF(mURI.Find("wss://") != 0)) {
|
||||
return;
|
||||
}
|
||||
mSecure = true;
|
||||
|
||||
const char16_t* params[] = { reportSpec.get(), NS_LITERAL_STRING("wss").get() };
|
||||
CSP_LogLocalizedStr(NS_LITERAL_STRING("upgradeInsecureRequest").get(),
|
||||
params, ArrayLength(params),
|
||||
EmptyString(), // aSourceFile
|
||||
EmptyString(), // aScriptSample
|
||||
0, // aLineNumber
|
||||
0, // aColumnNumber
|
||||
nsIScriptError::warningFlag, "CSP",
|
||||
mInnerWindowID);
|
||||
}
|
||||
|
||||
// Don't allow https:// to open ws://
|
||||
if (!mSecure &&
|
||||
!Preferences::GetBool("network.websocket.allowInsecureFromHTTPS",
|
||||
@ -1512,40 +1575,6 @@ WebSocketImpl::Init(JSContext* aCx,
|
||||
AppendUTF16toUTF8(aProtocolArray[index], mRequestedProtocolList);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIURI> uri;
|
||||
{
|
||||
nsresult rv = NS_NewURI(getter_AddRefs(uri), mURI);
|
||||
|
||||
// We crash here because we are sure that mURI is a valid URI, so either we
|
||||
// are OOM'ing or something else bad is happening.
|
||||
if (NS_FAILED(rv)) {
|
||||
MOZ_CRASH();
|
||||
}
|
||||
}
|
||||
|
||||
// Check content policy.
|
||||
int16_t shouldLoad = nsIContentPolicy::ACCEPT;
|
||||
nsCOMPtr<nsIDocument> originDoc = nsContentUtils::GetDocumentFromScriptContext(sc);
|
||||
mOriginDocument = do_GetWeakReference(originDoc);
|
||||
aRv = NS_CheckContentLoadPolicy(nsIContentPolicy::TYPE_WEBSOCKET,
|
||||
uri,
|
||||
aPrincipal,
|
||||
originDoc,
|
||||
EmptyCString(),
|
||||
nullptr,
|
||||
&shouldLoad,
|
||||
nsContentUtils::GetContentPolicy(),
|
||||
nsContentUtils::GetSecurityManager());
|
||||
if (NS_WARN_IF(aRv.Failed())) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (NS_CP_REJECTED(shouldLoad)) {
|
||||
// Disallowed by content policy.
|
||||
aRv.Throw(NS_ERROR_CONTENT_BLOCKED);
|
||||
return;
|
||||
}
|
||||
|
||||
// the constructor should throw a SYNTAX_ERROR only if it fails to parse the
|
||||
// url parameter, so don't throw if InitializeConnection fails, and call
|
||||
// onerror/onclose asynchronously
|
||||
|
@ -30,6 +30,7 @@
|
||||
#include "nsFrameLoader.h"
|
||||
#include "mozilla/EventListenerManager.h"
|
||||
#include "mozilla/dom/Element.h"
|
||||
#include "mozilla/dom/ProcessGlobal.h"
|
||||
#include "xpcpublic.h"
|
||||
#include "nsObserverService.h"
|
||||
#include "nsFocusManager.h"
|
||||
@ -140,6 +141,14 @@ MarkChildMessageManagers(nsIMessageBroadcaster* aMM)
|
||||
static void
|
||||
MarkMessageManagers()
|
||||
{
|
||||
if (nsFrameMessageManager::GetChildProcessManager()) {
|
||||
// ProcessGlobal's MarkForCC marks also ChildProcessManager.
|
||||
ProcessGlobal* pg = ProcessGlobal::Get();
|
||||
if (pg) {
|
||||
pg->MarkForCC();
|
||||
}
|
||||
}
|
||||
|
||||
// The global message manager only exists in the root process.
|
||||
if (!XRE_IsParentProcess()) {
|
||||
return;
|
||||
@ -172,9 +181,6 @@ MarkMessageManagers()
|
||||
if (nsFrameMessageManager::sSameProcessParentManager) {
|
||||
nsFrameMessageManager::sSameProcessParentManager->MarkForCC();
|
||||
}
|
||||
if (nsFrameMessageManager::GetChildProcessManager()) {
|
||||
nsFrameMessageManager::GetChildProcessManager()->MarkForCC();
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1552,6 +1552,7 @@ nsIDocument::nsIDocument()
|
||||
: nsINode(nullNodeInfo),
|
||||
mReferrerPolicySet(false),
|
||||
mReferrerPolicy(mozilla::net::RP_Default),
|
||||
mUpgradeInsecureRequests(false),
|
||||
mCharacterSet(NS_LITERAL_CSTRING("ISO-8859-1")),
|
||||
mNodeInfoManager(nullptr),
|
||||
mCompatMode(eCompatibility_FullStandards),
|
||||
@ -2706,6 +2707,19 @@ nsDocument::StartDocumentLoad(const char* aCommand, nsIChannel* aChannel,
|
||||
WarnIfSandboxIneffective(docShell, mSandboxFlags, GetChannel());
|
||||
}
|
||||
|
||||
// The CSP directive upgrade-insecure-requests not only applies to the
|
||||
// toplevel document, but also to nested documents. Let's propagate that
|
||||
// flag from the parent to the nested document.
|
||||
nsCOMPtr<nsIDocShellTreeItem> treeItem = this->GetDocShell();
|
||||
if (treeItem) {
|
||||
nsCOMPtr<nsIDocShellTreeItem> sameTypeParent;
|
||||
treeItem->GetSameTypeParent(getter_AddRefs(sameTypeParent));
|
||||
if (sameTypeParent) {
|
||||
mUpgradeInsecureRequests =
|
||||
sameTypeParent->GetDocument()->GetUpgradeInsecureRequests();
|
||||
}
|
||||
}
|
||||
|
||||
// If this is not a data document, set CSP.
|
||||
if (!mLoadedAsData) {
|
||||
nsresult rv = InitCSP(aChannel);
|
||||
@ -2978,6 +2992,13 @@ nsDocument::InitCSP(nsIChannel* aChannel)
|
||||
// speculative loads.
|
||||
}
|
||||
|
||||
// ------ Set flag for 'upgrade-insecure-requests' if not already
|
||||
// inherited from the parent context.
|
||||
if (!mUpgradeInsecureRequests) {
|
||||
rv = csp->GetUpgradeInsecureRequests(&mUpgradeInsecureRequests);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
rv = principal->SetCsp(csp);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
MOZ_LOG(gCspPRLog, LogLevel::Debug,
|
||||
|
@ -2055,6 +2055,7 @@ GK_ATOM(onwarning, "onwarning")
|
||||
GK_ATOM(onstart, "onstart")
|
||||
GK_ATOM(onstop, "onstop")
|
||||
GK_ATOM(onphoto, "onphoto")
|
||||
GK_ATOM(onactivestatechanged, "onactivestatechanged")
|
||||
#ifdef MOZ_GAMEPAD
|
||||
GK_ATOM(ongamepadbuttondown, "ongamepadbuttondown")
|
||||
GK_ATOM(ongamepadbuttonup, "ongamepadbuttonup")
|
||||
|
@ -3735,39 +3735,10 @@ nsPIDOMWindow::SetAudioVolume(float aVolume)
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
float
|
||||
nsPIDOMWindow::GetAudioGlobalVolume()
|
||||
{
|
||||
float globalVolume = 1.0;
|
||||
nsCOMPtr<nsPIDOMWindow> window = this;
|
||||
|
||||
do {
|
||||
if (window->GetAudioMuted()) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
globalVolume *= window->GetAudioVolume();
|
||||
|
||||
nsCOMPtr<nsIDOMWindow> win;
|
||||
window->GetParent(getter_AddRefs(win));
|
||||
if (window == win) {
|
||||
break;
|
||||
}
|
||||
|
||||
window = do_QueryInterface(win);
|
||||
|
||||
// If there is not parent, or we are the toplevel or the volume is
|
||||
// already 0.0, we don't continue.
|
||||
} while (window && window != this && globalVolume);
|
||||
|
||||
return globalVolume;
|
||||
}
|
||||
|
||||
void
|
||||
nsPIDOMWindow::RefreshMediaElements()
|
||||
{
|
||||
nsRefPtr<AudioChannelService> service =
|
||||
AudioChannelService::GetOrCreateAudioChannelService();
|
||||
nsRefPtr<AudioChannelService> service = AudioChannelService::GetOrCreate();
|
||||
service->RefreshAgentsVolume(GetCurrentInnerWindow());
|
||||
}
|
||||
|
||||
|
@ -308,6 +308,18 @@ public:
|
||||
return GetReferrerPolicy();
|
||||
}
|
||||
|
||||
/**
|
||||
* If true, this flag indicates that all subresource loads for this
|
||||
* document need to be upgraded from http to https.
|
||||
* This flag becomes true if the CSP of the document itself, or any
|
||||
* of the document's ancestors up to the toplevel document makes use
|
||||
* of the CSP directive 'upgrade-insecure-requests'.
|
||||
*/
|
||||
bool GetUpgradeInsecureRequests() const
|
||||
{
|
||||
return mUpgradeInsecureRequests;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the principal responsible for this document.
|
||||
*/
|
||||
@ -2631,6 +2643,8 @@ protected:
|
||||
bool mReferrerPolicySet;
|
||||
ReferrerPolicyEnum mReferrerPolicy;
|
||||
|
||||
bool mUpgradeInsecureRequests;
|
||||
|
||||
mozilla::WeakPtr<nsDocShell> mDocumentContainer;
|
||||
|
||||
nsCString mCharacterSet;
|
||||
|
@ -422,6 +422,36 @@ nsINode::IsInAnonymousSubtree() const
|
||||
return AsContent()->IsInAnonymousSubtree();
|
||||
}
|
||||
|
||||
std::ostream&
|
||||
operator<<(std::ostream& aStream, const nsINode& aNode)
|
||||
{
|
||||
nsAutoString elemDesc;
|
||||
const nsINode* curr = &aNode;
|
||||
while (curr) {
|
||||
const nsString& localName = curr->LocalName();
|
||||
nsString id;
|
||||
if (curr->IsElement()) {
|
||||
curr->AsElement()->GetId(id);
|
||||
}
|
||||
|
||||
if (!elemDesc.IsEmpty()) {
|
||||
elemDesc = elemDesc + NS_LITERAL_STRING(".");
|
||||
}
|
||||
|
||||
elemDesc = elemDesc + localName;
|
||||
|
||||
if (!id.IsEmpty()) {
|
||||
elemDesc = elemDesc + NS_LITERAL_STRING("['") + id +
|
||||
NS_LITERAL_STRING("']");
|
||||
}
|
||||
|
||||
curr = curr->GetParentNode();
|
||||
}
|
||||
|
||||
NS_ConvertUTF16toUTF8 str(elemDesc);
|
||||
return aStream << str.get();
|
||||
}
|
||||
|
||||
bool
|
||||
nsINode::IsAnonymousContentInSVGUseSubtree() const
|
||||
{
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user