Merge m-c to f-t

This commit is contained in:
Phil Ringnalda 2014-03-29 10:13:56 -07:00
commit ec69c66d3a
744 changed files with 6572 additions and 1106 deletions

View File

@ -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 981166 - Disabling Metro was causing intermittent Windows l10n packaging issues.
Bug 957865 - Non-clobbered ASAN builds were failing all mochitests after the clang upgrade

View File

@ -240,9 +240,11 @@ FocusManager::ProcessDOMFocus(nsINode* aTarget)
DocAccessible* document =
GetAccService()->GetDocAccessible(aTarget->OwnerDoc());
if (!document)
return;
Accessible* target = document->GetAccessibleEvenIfNotInMapOrContainer(aTarget);
if (target && document) {
if (target) {
// Check if still focused. Otherwise we can end up with storing the active
// item for control that isn't focused anymore.
nsINode* focusedNode = FocusedDOMNode();

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="786421ba46463a9bb2cb35fb67b2e5e3dad87b1f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4cf7ec04b82320a1ff1f825220204f454f951a87"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="786421ba46463a9bb2cb35fb67b2e5e3dad87b1f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4cf7ec04b82320a1ff1f825220204f454f951a87"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="5b93c7150acac5f657675b91889d828cc2b532e3"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89c5816399e71bda92a8959b5b771c04d6672ea3"/>

View File

@ -15,7 +15,7 @@
<project name="platform_build" path="build" remote="b2g" revision="a9e08b91e9cd1f0930f16cfc49ec72f63575d5fe">
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="gaia" path="gaia" remote="mozillaorg" revision="786421ba46463a9bb2cb35fb67b2e5e3dad87b1f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4cf7ec04b82320a1ff1f825220204f454f951a87"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="5b93c7150acac5f657675b91889d828cc2b532e3"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="786421ba46463a9bb2cb35fb67b2e5e3dad87b1f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4cf7ec04b82320a1ff1f825220204f454f951a87"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="platform_hardware_ril" path="hardware/ril" remote="b2g" revision="d11f524d00cacf5ba0dfbf25e4aa2158b1c3a036"/>

View File

@ -4,6 +4,6 @@
"remote": "",
"branch": ""
},
"revision": "c159b9cb625a90109a032364ba54e101787e4adb",
"revision": "90c30688c09dd00957d0093c3b46ad00f0bd65a8",
"repo_path": "/integration/gaia-central"
}

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="786421ba46463a9bb2cb35fb67b2e5e3dad87b1f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4cf7ec04b82320a1ff1f825220204f454f951a87"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -15,7 +15,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="786421ba46463a9bb2cb35fb67b2e5e3dad87b1f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4cf7ec04b82320a1ff1f825220204f454f951a87"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -19,7 +19,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="786421ba46463a9bb2cb35fb67b2e5e3dad87b1f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4cf7ec04b82320a1ff1f825220204f454f951a87"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="786421ba46463a9bb2cb35fb67b2e5e3dad87b1f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4cf7ec04b82320a1ff1f825220204f454f951a87"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -17,7 +17,7 @@
</project>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="fake-libdvm" path="dalvik" remote="b2g" revision="d50ae982b19f42f0b66d08b9eb306be81687869f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="786421ba46463a9bb2cb35fb67b2e5e3dad87b1f"/>
<project name="gaia" path="gaia" remote="mozillaorg" revision="4cf7ec04b82320a1ff1f825220204f454f951a87"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="moztt" path="external/moztt" remote="b2g" revision="5b93c7150acac5f657675b91889d828cc2b532e3"/>
<project name="apitrace" path="external/apitrace" remote="apitrace" revision="89c5816399e71bda92a8959b5b771c04d6672ea3"/>

View File

@ -17,7 +17,7 @@
<copyfile dest="Makefile" src="core/root.mk"/>
</project>
<project name="fake-dalvik" path="dalvik" remote="b2g" revision="ca1f327d5acc198bb4be62fa51db2c039032c9ce"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="786421ba46463a9bb2cb35fb67b2e5e3dad87b1f"/>
<project name="gaia.git" path="gaia" remote="mozillaorg" revision="4cf7ec04b82320a1ff1f825220204f454f951a87"/>
<project name="gonk-misc" path="gonk-misc" remote="b2g" revision="266bca6e60dad43e395f38b66edabe8bdc882334"/>
<project name="rilproxy" path="rilproxy" remote="b2g" revision="827214fcf38d6569aeb5c6d6f31cb296d1f09272"/>
<project name="librecovery" path="librecovery" remote="b2g" revision="1f6a1fe07f81c5bc5e1d079c9b60f7f78ca2bf4f"/>

View File

@ -1,5 +1,5 @@
<?xml version="1.0"?>
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1395351978000">
<blocklist xmlns="http://www.mozilla.org/2006/addons-blocklist" lastupdate="1396046918000">
<emItems>
<emItem blockID="i454" id="sqlmoz@facebook.com">
<versionRange minVersion="0" maxVersion="*" severity="3">
@ -256,6 +256,12 @@
</versionRange>
<prefs>
</prefs>
</emItem>
<emItem blockID="i93" id="{68b8676b-99a5-46d1-b390-22411d8bcd61}">
<versionRange minVersion="0" maxVersion="*">
</versionRange>
<prefs>
</prefs>
</emItem>
<emItem blockID="i140" id="mozillahmpg@mozilla.org">
<versionRange minVersion="0" maxVersion="*" severity="3">
@ -1350,8 +1356,8 @@
<prefs>
</prefs>
</emItem>
<emItem blockID="i93" id="{68b8676b-99a5-46d1-b390-22411d8bcd61}">
<versionRange minVersion="0" maxVersion="*">
<emItem blockID="i568" os="Darwin" id="thunder@xunlei.com">
<versionRange minVersion="0" maxVersion="2.0.6" severity="1">
</versionRange>
<prefs>
</prefs>

View File

@ -1,6 +1,6 @@
[
{
"clang_version": "r185949"
"clang_version": "r200213"
},
{
"size": 47,
@ -9,8 +9,8 @@
"filename": "setup.sh"
},
{
"size": 73050713,
"digest": "2c5c26a44402f974c2a4ccffb07ea1ac2d01d84dc3e4281fef6e047a62606811a16534d034477dfd9be055a07d931b17ca4e883c8edcd1f8d3a8c91b150e2288",
"size": 71282740,
"digest": "ee9edb1ef3afd9ab29e39565145545ad57e8d8d2538be4d822d7dbd64038f4529b0b287cecf48bf83def52a26ac2c6faa331686c3ad5e8b4ba4c22686ee0808f",
"algorithm": "sha512",
"filename": "clang.tar.bz2"
}

View File

@ -1,6 +1,6 @@
[
{
"clang_version": "r185949"
"clang_version": "r200213"
},
{
"size": 47,
@ -9,8 +9,8 @@
"filename": "setup.sh"
},
{
"size": 61779086,
"digest": "b2f2861da7583e859b4fb40e1304dd284df02466c909893684341b16e2f58c4c100891504938cf62f26ac82254b9e87135ba98f8196dd26e9b58d3242f1cf811",
"size": 58997296,
"digest": "9757d142142442c881b8d1eb31c2fe80e1979a858e6133473b5574a5a3b9cdaf9abed32b2e246b715c9f0eb0969103337918215fc491feae196219e8fb03f0b1",
"algorithm": "sha512",
"filename": "clang.tar.bz2"
}

View File

@ -4,23 +4,35 @@
# Setup for build cache
read branch platform master <<EOF
$(python2.7 -c 'import json; p = json.loads(open("'"$topsrcdir"'/../buildprops.json").read())["properties"]; print p["branch"], p["platform"], p["master"]' 2> /dev/null)
EOF
bucket=
if test -z "$SCCACHE_DISABLE" -a -f "$topsrcdir/sccache/sccache.py"; then
case `hostname` in
try*spot*.use1.mozilla.com|try*ec2*.use1.mozilla.com)
if test -z "$SCCACHE_DISABLE" -a -z "$no_tooltool"; then
case "${branch}_${master}" in
try_*use1.mozilla.com*)
bucket=mozilla-releng-s3-cache-us-east-1-try
;;
try*spot*.usw2.mozilla.com|try*ec2*.usw2.mozilla.com)
try_*usw2.mozilla.com*)
bucket=mozilla-releng-s3-cache-us-west-2-try
;;
esac
fi
if test -z "$bucket"; then
ac_add_options --with-ccache
case "$platform" in
win*) : ;;
*)
ac_add_options --with-ccache
esac
else
mk_add_options "export SCCACHE_BUCKET=$bucket"
mk_add_options "export SCCACHE_NAMESERVER=169.254.169.253"
case "$master" in
*use1.mozilla.com*|*usw2.mozilla.com*)
mk_add_options "export SCCACHE_NAMESERVER=169.254.169.253"
;;
esac
ac_add_options "--with-compiler-wrapper=python2.7 $topsrcdir/sccache/sccache.py"
mk_add_options MOZ_PREFLIGHT+=build/sccache.mk
mk_add_options MOZ_POSTFLIGHT+=build/sccache.mk

View File

@ -38,7 +38,7 @@ def build_package(package_source_dir, package_build_dir, configure_args,
os.mkdir(package_build_dir)
run_in(package_build_dir,
["%s/configure" % package_source_dir] + configure_args)
run_in(package_build_dir, ["make", "-j8"] + make_args)
run_in(package_build_dir, ["make", "-j4"] + make_args)
run_in(package_build_dir, ["make", "install"])
@ -59,9 +59,9 @@ def svn_co(url, directory, revision):
check_run(["svn", "co", "-r", revision, url, directory])
def build_one_stage(env, stage_dir, llvm_source_dir):
def build_one_stage(env, stage_dir, llvm_source_dir, gcc_toolchain_dir):
def f():
build_one_stage_aux(stage_dir, llvm_source_dir)
build_one_stage_aux(stage_dir, llvm_source_dir, gcc_toolchain_dir)
with_env(env, f)
@ -99,7 +99,7 @@ def is_darwin():
return platform.system() == "Darwin"
def build_one_stage_aux(stage_dir, llvm_source_dir):
def build_one_stage_aux(stage_dir, llvm_source_dir, gcc_toolchain_dir):
os.mkdir(stage_dir)
build_dir = stage_dir + "/build"
@ -117,7 +117,8 @@ def build_one_stage_aux(stage_dir, llvm_source_dir):
"--enable-targets=" + ",".join(targets),
"--disable-assertions",
"--prefix=%s" % inst_dir,
"--with-gcc-toolchain=/tools/gcc-4.7.3-0moz1"]
"--with-gcc-toolchain=%s" % gcc_toolchain_dir,
"--disable-compiler-version-checks"]
build_package(llvm_source_dir, build_dir, configure_opts, [])
if __name__ == "__main__":
@ -134,6 +135,8 @@ if __name__ == "__main__":
clang_source_dir = source_dir + "/clang"
compiler_rt_source_dir = source_dir + "/compiler-rt"
gcc_dir = "/tools/gcc-4.7.3-0moz1"
if is_darwin():
os.environ['MACOSX_DEPLOYMENT_TARGET'] = '10.7'
@ -175,16 +178,21 @@ if __name__ == "__main__":
else:
extra_cflags = "-static-libgcc"
extra_cxxflags = "-static-libgcc -static-libstdc++"
cc = "/usr/bin/gcc"
cxx = "/usr/bin/g++"
cc = gcc_dir + "/bin/gcc"
cxx = gcc_dir + "/bin/g++"
build_one_stage({"CC": cc, "CXX": cxx}, stage1_dir, llvm_source_dir)
if os.environ.has_key('LD_LIBRARY_PATH'):
os.environ['LD_LIBRARY_PATH'] = '%s/lib64/:%s' % (gcc_dir, os.environ['LD_LIBRARY_PATH']);
else:
os.environ['LD_LIBRARY_PATH'] = '%s/lib64/' % gcc_dir
build_one_stage({"CC": cc, "CXX": cxx}, stage1_dir, llvm_source_dir, gcc_dir)
stage2_dir = build_dir + '/stage2'
build_one_stage(
{"CC": stage1_inst_dir + "/bin/clang %s" % extra_cflags,
"CXX": stage1_inst_dir + "/bin/clang++ %s" % extra_cxxflags},
stage2_dir, llvm_source_dir)
stage2_dir, llvm_source_dir, gcc_dir)
build_tar_package("tar", "clang.tar.bz2", stage2_dir, "clang")
build_tooltool_manifest(llvm_revision)

View File

@ -1,11 +1,11 @@
{
"llvm_revision": "185949",
"llvm_revision": "200213",
"llvm_repo": "https://llvm.org/svn/llvm-project/llvm/trunk",
"clang_repo": "https://llvm.org/svn/llvm-project/cfe/trunk",
"compiler_repo": "https://llvm.org/svn/llvm-project/compiler-rt/trunk",
"patches": {
"macosx64": ["llvm-debug-frame.patch"],
"linux64": ["llvm-debug-frame.patch", "no-sse-on-linux.patch"],
"linux32": ["llvm-debug-frame.patch", "no-sse-on-linux.patch"]
"linux64": ["llvm-debug-frame.patch", "no-sse-on-linux-trunk.patch"],
"linux32": ["llvm-debug-frame.patch", "no-sse-on-linux-trunk.patch"]
}
}

View File

@ -0,0 +1,13 @@
Index: lib/Driver/Tools.cpp
===================================================================
--- a/clang/lib/Driver/Tools.cpp (revision 199443)
+++ b/clang/lib/Driver/Tools.cpp (working copy)
@@ -1226,7 +1226,7 @@
// All x86 devices running Android have core2 as their common
// denominator. This makes a better choice than pentium4.
if (Triple.getEnvironment() == llvm::Triple::Android)
- return "core2";
+ return "686";
// Everything else goes to x86-64 in 64-bit mode.
if (Is64Bit)

View File

@ -49,3 +49,15 @@
obj:/lib/libgobject-2.0.so.0.2200.5
...
}
###################################
# Leaks in short lived precesses #
###################################
{
Bug 984196
Memcheck:Leak
...
fun:glxtest
...
}

View File

@ -71,3 +71,15 @@
fun:gdk_display_open
...
}
###################################
# Leaks in short lived precesses #
###################################
{
Bug 984196
Memcheck:Leak
...
fun:glxtest
...
}

View File

@ -67,7 +67,7 @@ Activity::Initialize(nsPIDOMWindow* aWindow,
NS_ENSURE_SUCCESS(rv, rv);
JS::Rooted<JS::Value> optionsValue(aCx);
if (!aOptions.ToObject(aCx, JS::NullPtr(), &optionsValue)) {
if (!aOptions.ToObject(aCx, &optionsValue)) {
return NS_ERROR_FAILURE;
}

View File

@ -689,7 +689,7 @@ Console::ProfileMethod(JSContext* aCx, const nsAString& aAction,
}
JS::Rooted<JS::Value> eventValue(aCx);
if (!event.ToObject(aCx, JS::NullPtr(), &eventValue)) {
if (!event.ToObject(aCx, &eventValue)) {
aRv.Throw(NS_ERROR_FAILURE);
return;
}
@ -1001,7 +1001,7 @@ Console::ProcessCallData(ConsoleCallData* aData)
}
JS::Rooted<JS::Value> eventValue(cx);
if (!event.ToObject(cx, JS::NullPtr(), &eventValue)) {
if (!event.ToObject(cx, &eventValue)) {
Throw(cx, NS_ERROR_FAILURE);
return;
}
@ -1300,7 +1300,7 @@ Console::StartTimer(JSContext* aCx, const JS::Value& aName,
RootedDictionary<ConsoleTimerError> error(aCx);
JS::Rooted<JS::Value> value(aCx);
if (!error.ToObject(aCx, JS::NullPtr(), &value)) {
if (!error.ToObject(aCx, &value)) {
return JS::UndefinedValue();
}
@ -1332,7 +1332,7 @@ Console::StartTimer(JSContext* aCx, const JS::Value& aName,
timer.mStarted = aTimestamp;
JS::Rooted<JS::Value> value(aCx);
if (!timer.ToObject(aCx, JS::NullPtr(), &value)) {
if (!timer.ToObject(aCx, &value)) {
return JS::UndefinedValue();
}
@ -1366,7 +1366,7 @@ Console::StopTimer(JSContext* aCx, const JS::Value& aName,
timer.mDuration = aTimestamp - entry;
JS::Rooted<JS::Value> value(aCx);
if (!timer.ToObject(aCx, JS::NullPtr(), &value)) {
if (!timer.ToObject(aCx, &value)) {
return JS::UndefinedValue();
}
@ -1414,7 +1414,7 @@ Console::IncreaseCounter(JSContext* aCx, const ConsoleStackEntry& aFrame,
RootedDictionary<ConsoleCounterError> error(aCx);
JS::Rooted<JS::Value> value(aCx);
if (!error.ToObject(aCx, JS::NullPtr(), &value)) {
if (!error.ToObject(aCx, &value)) {
return JS::UndefinedValue();
}
@ -1430,7 +1430,7 @@ Console::IncreaseCounter(JSContext* aCx, const ConsoleStackEntry& aFrame,
data.mCount = count;
JS::Rooted<JS::Value> value(aCx);
if (!data.ToObject(aCx, JS::NullPtr(), &value)) {
if (!data.ToObject(aCx, &value)) {
return JS::UndefinedValue();
}

View File

@ -5678,7 +5678,7 @@ nsGlobalWindow::DispatchResizeEvent(const nsIntSize& aSize)
detail.mWidth = aSize.width;
detail.mHeight = aSize.height;
JS::Rooted<JS::Value> detailValue(cx);
if (!detail.ToObject(cx, JS::NullPtr(), &detailValue)) {
if (!detail.ToObject(cx, &detailValue)) {
return false;
}

View File

@ -4672,7 +4672,7 @@ if (!returnArray) {
False)
if type.isDictionary():
return (wrapAndSetPtr("%s.ToObject(cx, ${obj}, ${jsvalHandle})" % result),
return (wrapAndSetPtr("%s.ToObject(cx, ${jsvalHandle})" % result),
False)
if type.isDate():
@ -9319,7 +9319,7 @@ if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
if self.dictionary.parent:
body += (
"// Per spec, we define the parent's members first\n"
"if (!%s::ToObject(cx, parentObject, rval)) {\n"
"if (!%s::ToObject(cx, rval)) {\n"
" return false;\n"
"}\n"
"JS::Rooted<JSObject*> obj(cx, &rval.toObject());\n"
@ -9339,7 +9339,6 @@ if (!*reinterpret_cast<jsid**>(atomsCache) && !InitIds(cx, atomsCache)) {
return ClassMethod("ToObject", "bool", [
Argument('JSContext*', 'cx'),
Argument('JS::Handle<JSObject*>', 'parentObject'),
Argument('JS::MutableHandle<JS::Value>', 'rval'),
], const=True, body=body)
@ -9598,7 +9597,9 @@ if (""",
'jsvalRef': "temp",
'jsvalHandle': "&temp",
'returnsNewObject': False,
'obj': "parentObject",
# 'obj' can just be allowed to be the string "obj", since that
# will be our dictionary object, which is presumably itself in
# the right scope.
'typedArraysAreStructs': True
})
conversion = CGGeneric(innerTemplate)

View File

@ -160,7 +160,7 @@ BrowserElementParent::DispatchOpenWindowEvent(Element* aOpenerFrameElement,
JS::Rooted<JSObject*> global(cx, sgo->GetGlobalJSObject());
JSAutoCompartment ac(cx, global);
if (!detail.ToObject(cx, global, &val)) {
if (!detail.ToObject(cx, &val)) {
MOZ_CRASH("Failed to convert dictionary to JS::Value due to OOM.");
return BrowserElementParent::OPEN_WINDOW_IGNORED;
}
@ -332,9 +332,7 @@ NS_IMETHODIMP DispatchAsyncScrollEventRunnable::Run()
JSAutoCompartment ac(cx, globalJSObject);
JS::Rooted<JS::Value> val(cx);
// We can get away with a null global here because
// AsyncScrollEventDetail only contains numeric values.
if (!detail.ToObject(cx, JS::NullPtr(), &val)) {
if (!detail.ToObject(cx, &val)) {
MOZ_CRASH("Failed to convert dictionary to JS::Value due to OOM.");
return NS_ERROR_FAILURE;
}

View File

@ -61,43 +61,4 @@ enum {
#define DOM_CAMERA_LOGW( ... ) DOM_CAMERA_LOG( DOM_CAMERA_LOG_WARNING, __VA_ARGS__ )
#define DOM_CAMERA_LOGE( ... ) DOM_CAMERA_LOG( DOM_CAMERA_LOG_ERROR, __VA_ARGS__ )
#ifdef PR_LOGGING
static inline void nsLogAddRefCamera(const char *file, uint32_t line, void* p, uint32_t count, const char *clazz, uint32_t size)
{
if (count == 1) {
DOM_CAMERA_LOGR("++++++++++++++++++++++++++++++++++++++++");
}
DOM_CAMERA_LOGR("%s:%d : CAMREF-ADD(%s): this=%p, mRefCnt=%d\n", file, line, clazz, p, count);
}
static inline void nsLogReleaseCamera(const char *file, uint32_t line, void* p, uint32_t count, const char *clazz, bool abortOnDelete)
{
DOM_CAMERA_LOGR("%s:%d : CAMREF-REL(%s): this=%p, mRefCnt=%d\n", file, line, clazz, p, count);
if (count == 0) {
if (!abortOnDelete) {
DOM_CAMERA_LOGR("----------------------------------------");
} else {
DOM_CAMERA_LOGR("---------- ABORTING ON DELETE ----------");
*((uint32_t *)0xdeadbeef) = 0x266230;
}
}
}
#ifdef NS_LOG_ADDREF
#undef NS_LOG_ADDREF
#endif
#ifdef NS_LOG_RELEASE
#undef NS_LOG_RELEASE
#endif
#define NS_LOG_ADDREF( p, n, c, s ) nsLogAddRefCamera(__FILE__, __LINE__, (p), (n), (c), (s))
#ifdef DOM_CAMERA_DEBUG_REFS_ABORT_ON_DELETE
#define NS_LOG_RELEASE( p, n, c ) nsLogReleaseCamera(__FILE__, __LINE__, (p), (n), (c), DOM_CAMERA_DEBUG_REFS_ABORT_ON_DELETE)
#else
#define NS_LOG_RELEASE( p, n, c ) nsLogReleaseCamera(__FILE__, __LINE__, (p), (n), (c), false)
#endif
#endif // PR_LOGGING
#endif // DOM_CAMERA_CAMERACOMMON_H

View File

@ -14,7 +14,10 @@ Cu.import("resource://gre/modules/ContactService.jsm", imports);
Cu.import("resource://gre/modules/Promise.jsm", imports);
Cu.importGlobalProperties(["indexedDB"]);
const {
// |const| will not work because
// it will make the Promise object immutable before assigning.
// Using |let| and Object.freeze() instead.
let {
STORE_NAME,
SAVED_GETALL_STORE_NAME,
REVISION_STORE,
@ -22,6 +25,7 @@ const {
ContactService,
Promise
} = imports;
Object.freeze(imports);
let DEBUG = false;
function debug(str) {

View File

@ -378,7 +378,7 @@ DataStoreService.prototype = {
},
observe: function observe(aSubject, aTopic, aData) {
debug('getDataStores - aTopic: ' + aTopic);
debug('observe - aTopic: ' + aTopic);
if (aTopic != 'webapps-clear-data') {
return;
}
@ -391,16 +391,35 @@ DataStoreService.prototype = {
return;
}
function isEmpty(aMap) {
for (var key in aMap) {
if (aMap.hasOwnProperty(key)) {
return false;
}
}
return true;
}
for (let key in this.stores) {
if (params.appId in this.stores[key]) {
this.deleteDatabase(key, this.stores[key][params.appId].owner);
delete this.stores[key][params.appId];
}
if (!this.stores[key].length) {
if (isEmpty(this.stores[key])) {
delete this.stores[key];
}
}
for (let key in this.accessStores) {
if (params.appId in this.accessStores[key]) {
delete this.accessStores[key][params.appId];
}
if (isEmpty(this.accessStores[key])) {
delete this.accessStores[key];
}
}
},
deleteDatabase: function(aName, aOwner) {

View File

@ -0,0 +1,26 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test for DataStore - bug 986056 app</title>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript;version=1.7">
function cbError() {
alert('KO error');
}
navigator.getDataStores('foo').then(function(stores) {
alert("OK " + stores.length);
}, cbError);
</script>
</pre>
</body>
</html>

View File

@ -0,0 +1,12 @@
{
"name": "Really Rapid Release (hosted)",
"description": "Updated even faster than <a href='http://mozilla.org'>Firefox</a>, just to annoy slashdotters.",
"launch_path": "/tests/dom/datastore/tests/TESTTOKEN",
"icons": { "128": "default_icon" },
"datastores-owned" : {
"foo" : { "access": "readwrite", "description" : "This store is called foo" }
},
"datastores-access" : {
"foo" : { "readonly": false, "description" : "This store is called foo" }
}
}

View File

@ -17,6 +17,8 @@ support-files =
file_duplicate.html
file_bug976311.html
file_bug976311.template.webapp
file_bug986056.html
file_bug986056.template.webapp
file_event_maker.html
file_event_receiver.html
@ -38,4 +40,5 @@ skip-if = (toolkit == 'gonk' && debug) #debug-only failure; time out
[test_keys.html]
[test_duplicate.html]
[test_bug976311.html]
[test_bug986056.html]
[test_oop_events.html]

View File

@ -0,0 +1,146 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test for DataStore - bug 986056</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<p id="display"></p>
<div id="content" style="display: none">
</div>
<pre id="test">
<script type="application/javascript;version=1.7">
var gHostedManifestURL = 'http://test/tests/dom/datastore/tests/file_app.sjs?testToken=file_bug986056.html&template=file_bug986056.template.webapp';
var gHostedManifestURL2 = 'http://example.com/tests/dom/datastore/tests/file_app.sjs?testToken=file_bug986056.html&template=file_bug986056.template.webapp';
var gApps = [];
function cbError() {
ok(false, "Error callback invoked");
finish();
}
function installApp(aApp) {
var request = navigator.mozApps.install(aApp);
request.onerror = cbError;
request.onsuccess = function() {
gApps.push(request.result);
runTest();
}
}
function uninstallApp(aApp) {
var request = navigator.mozApps.mgmt.uninstall(aApp);
request.onerror = cbError;
request.onsuccess = runTest;
}
function testApp(aCount) {
var ifr = document.createElement('iframe');
ifr.setAttribute('mozbrowser', 'true');
ifr.setAttribute('mozapp', gApps[0].manifestURL);
ifr.setAttribute('src', gApps[0].manifest.launch_path);
var domParent = document.getElementById('content');
// Set us up to listen for messages from the app.
var listener = function(e) {
var message = e.detail.message;
if (/KO/.exec(message)) {
ok(false, "Message from app: " + message);
} else if (/^OK/.exec(message)) {
is(message, "OK " + aCount, "Number of dataStore matches");
ifr.removeEventListener('mozbrowsershowmodalprompt', listener);
domParent.removeChild(ifr);
runTest();
}
}
// This event is triggered when the app calls "alert".
ifr.addEventListener('mozbrowsershowmodalprompt', listener, false);
domParent.appendChild(ifr);
}
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 }], runTest);
},
// Preferences
function() {
SpecialPowers.pushPrefEnv({"set": [["dom.datastore.enabled", true],
["dom.testing.ignore_ipc_principal", true],
["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest);
},
// Enabling mozBrowser
function() {
SpecialPowers.setAllAppsLaunchable(true);
SpecialPowers.pushPrefEnv({"set": [["dom.mozBrowserFramesEnabled", true]]}, runTest);
},
// No confirmation needed when an app is installed
function() {
SpecialPowers.autoConfirmAppInstall(runTest);
},
// Installing the app1
function() { installApp(gHostedManifestURL); },
// Installing the app2
function() { installApp(gHostedManifestURL2); },
// Run tests in app. 2 apps are installed so we want to have 2 'foo'
// dataStore.
function() { testApp(2); },
// Uninstall the first app
function() { uninstallApp(gApps.shift()); },
// Run tests in app. 1 single apps is installed so we want to have 1 'foo'
// dataStore.
function() { testApp(1); },
// Installing the app1
function() { installApp(gHostedManifestURL); },
// Run tests in app. Back to 2 apps, 2 datastores.
function() { testApp(2); },
// Uninstall the first app
function() { uninstallApp(gApps.shift()); },
// Uninstall the second app
function() { uninstallApp(gApps.shift()); }
];
function runTest() {
if (!tests.length) {
finish();
return;
}
var test = tests.shift();
test();
}
function finish() {
SimpleTest.finish();
}
if (SpecialPowers.isMainProcess()) {
SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm");
}
SimpleTest.waitForExplicitFinish();
runTest();
</script>
</pre>
</body>
</html>

View File

@ -125,7 +125,7 @@ skip-if = buildapp == 'b2g' # b2g(failing when the test gets moved around, and o
[test_bug930374-content.html]
[test_bug944847.html]
[test_bug967796.html]
skip-if = toolkit == "gonk"
skip-if = toolkit == "gonk" || e10s
[test_bug944011.html]
[test_bug946632.html]
[test_clickevent_on_input.html]

View File

@ -131,6 +131,7 @@ function runTests() {
sendMouseEvent("mousemove", outside);
is(mouseleavecount, 7, "Unexpected mouseleave event count!");
checkRelatedTarget = false;
SimpleTest.finish();
}

View File

@ -298,7 +298,7 @@ skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-namespace.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-newelements.html]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
skip-if = (toolkit == 'gonk' && debug) || (e10s && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-newelements.xhtml]
skip-if = (toolkit == 'gonk' && debug) #b2g-debug(debug-only failure)
[html/dom/documents/dta/doc.gEBN/test_document.getElementsByName-null-undef.html]

View File

@ -90,7 +90,7 @@ static nsresult CompareDictionaries(JSContext* aCx, JSObject *aA,
JS::Rooted<JSObject*> a(aCx, aA);
JSAutoCompartment ac(aCx, aA);
JS::Rooted<JS::Value> bval(aCx);
aB.ToObject(aCx, JS::NullPtr(), &bval);
aB.ToObject(aCx, &bval);
JS::Rooted<JSObject*> b(aCx, &bval.toObject());
// Iterate over each property in A, and check if it is in B

View File

@ -341,9 +341,17 @@ function isNetworkReady() {
SpecialPowers.Ci.nsINetworkInterfaceListService.LIST_NOT_INCLUDE_DUN_INTERFACES);
var num = itfList.getNumberOfInterface();
for (var i = 0; i < num; i++) {
if (itfList.getInterface(i).ip) {
info("Network interface is ready with address: " + itfList.getInterface(i).ip);
return true;
var ips = {};
var prefixLengths = {};
var length = itfList.getInterface(i).getAddresses(ips, prefixLengths);
for (var j = 0; j < length; j++) {
var ip = ips.value[j];
// skip IPv6 address
if (ip.indexOf(":") < 0) {
info("Network interface is ready with address: " + ip);
return true;
}
}
}
// ip address is not available

View File

@ -23,4 +23,4 @@ disabled = Bug 808783
[test_mobile_connections_array_uninitialized.js]
[test_mobile_signal_strength.js]
[test_mobile_data_ipv6.js]
disabled = Bug 978071
disabled = Bug 979137

View File

@ -24,7 +24,7 @@ MARIONETTE_HEAD_JS = "head.js";
*
* @return A deferred promise.
*/
function doTest(aApnSettings, aIsIPv6) {
function doTest(aApnSettings, aHaveV4Address, aHaveV6Address) {
return setDataApnSettings([])
.then(() => setDataApnSettings(aApnSettings))
.then(() => setDataEnabledAndWait(true))
@ -32,13 +32,23 @@ function doTest(aApnSettings, aIsIPv6) {
let nm = getNetworkManager();
let active = nm.active;
ok(active, "Active network interface");
log(" Interface: " + active.name);
log(" Address: " + active.ip);
if (aIsIPv6) {
ok(active.ip.indexOf(":") > 0, "IPv6 address");
} else {
ok(active.ip.indexOf(":") < 0, "IPv4 address");
let ips = {}, prefixLengths = {};
let num = active.getAddresses(ips, prefixLengths);
log(" Num addresses: " + num);
log(" Addresses: " + JSON.stringify(ips.value));
log(" PrefixLengths: " + JSON.stringify(prefixLengths.value));
if (aHaveV4Address) {
ok(ips.value.reduce(function(aFound, aAddress) {
return aFound || aAddress.indexOf(":") < 0;
}), "IPv4 address");
}
if (aHaveV6Address) {
ok(ips.value.reduce(function(aFound, aAddress) {
return aFound || aAddress.indexOf(":") > 0;
}), "IPv6 address");
}
})
.then(() => setDataEnabledAndWait(false));
@ -54,7 +64,9 @@ function doTestHome(aApnSettings, aProtocol) {
aApnSettings[0][0].protocol = aProtocol;
delete aApnSettings[0][0].roaming_protocol;
return doTest(aApnSettings, aProtocol === "IPV6");
return doTest(aApnSettings,
aProtocol === "IP" || aProtocol === "IPV4V6",
aProtocol === "IPV4V6" || aProtocol === "IPV6");
}
function doTestRoaming(aApnSettings, aRoaminProtocol) {
@ -67,7 +79,9 @@ function doTestRoaming(aApnSettings, aRoaminProtocol) {
delete aApnSettings[0][0].protocol;
aApnSettings[0][0].roaming_protocol = aRoaminProtocol;
return doTest(aApnSettings, aRoaminProtocol === "IPV6");
return doTest(aApnSettings,
aRoaminProtocol === "IP" || aRoaminProtocol === "IPV4V6",
aRoaminProtocol === "IPV4V6" || aRoaminProtocol === "IPV6");
}
startTestCommon(function() {
@ -92,12 +106,14 @@ startTestCommon(function() {
.then(() => doTestHome(aApnSettings, "NoSuchProtocol"))
.then(() => doTestHome(aApnSettings, "IP"))
.then(() => doTestHome(aApnSettings, "IPV4V6"))
.then(() => doTestHome(aApnSettings, "IPV6"))
.then(() => setEmulatorRoamingAndWait(true))
.then(() => doTestRoaming(aApnSettings, "NoSuchProtocol"))
.then(() => doTestRoaming(aApnSettings, "IP"))
.then(() => doTestRoaming(aApnSettings, "IPV4V6"))
.then(() => doTestRoaming(aApnSettings, "IPV6"))
.then(() => setEmulatorRoamingAndWait(false));

View File

@ -101,7 +101,7 @@ DesktopNotification::PostDesktopNotification()
ops.mTextClickable = true;
ops.mManifestURL = manifestUrl;
if (!ops.ToObject(cx, JS::NullPtr(), &val)) {
if (!ops.ToObject(cx, &val)) {
return NS_ERROR_FAILURE;
}

View File

@ -583,7 +583,7 @@ Notification::ShowInternal()
ops.mLang = mLang;
ops.mTag = mTag;
if (!ops.ToObject(cx, JS::NullPtr(), &val)) {
if (!ops.ToObject(cx, &val)) {
NS_WARNING("Converting dict to object failed!");
return;
}

View File

@ -19,9 +19,11 @@
#include "GonkGPSGeolocationProvider.h"
#include "mozilla/Preferences.h"
#include "mozilla/Services.h"
#include "nsGeoPosition.h"
#include "nsIInterfaceRequestorUtils.h"
#include "nsINetworkManager.h"
#include "nsIObserverService.h"
#include "nsJSUtils.h"
#include "nsServiceManagerUtils.h"
#include "nsThreadUtils.h"
@ -44,17 +46,20 @@ using namespace mozilla;
static const int kDefaultPeriod = 1000; // ms
static const char* kNetworkConnStateChangedTopic = "network-connection-state-changed";
// While most methods of GonkGPSGeolocationProvider should only be
// called from main thread, we deliberately put the Init and ShutdownGPS
// methods off main thread to avoid blocking.
#ifdef MOZ_B2G_RIL
NS_IMPL_ISUPPORTS3(GonkGPSGeolocationProvider,
nsIGeolocationProvider,
nsIRILDataCallback,
nsIObserver,
nsISettingsServiceCallback)
#else
NS_IMPL_ISUPPORTS1(GonkGPSGeolocationProvider,
nsIGeolocationProvider)
NS_IMPL_ISUPPORTS2(GonkGPSGeolocationProvider,
nsIGeolocationProvider,
nsIObserver)
#endif
/* static */ GonkGPSGeolocationProvider* GonkGPSGeolocationProvider::sSingleton = nullptr;
@ -636,15 +641,16 @@ GonkGPSGeolocationProvider::SetupAGPS()
return;
}
// Setup network state listener
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
if (obs) {
obs->AddObserver(this, kNetworkConnStateChangedTopic, false);
}
nsCOMPtr<nsIRadioInterfaceLayer> ril = do_GetService("@mozilla.org/ril;1");
if (ril) {
// TODO: Bug 878748 - B2G GPS: acquire correct RadioInterface instance in
// MultiSIM configuration
ril->GetRadioInterface(0 /* clientId */, getter_AddRefs(mRadioInterface));
if (mRadioInterface) {
mRadioInterface->RegisterDataCallCallback(this);
}
}
}
#endif // MOZ_B2G_RIL
@ -746,8 +752,9 @@ GonkGPSGeolocationProvider::Shutdown()
mNetworkLocationProvider = nullptr;
}
#ifdef MOZ_B2G_RIL
if (mRadioInterface) {
mRadioInterface->UnregisterDataCallCallback(this);
nsCOMPtr<nsIObserverService> obs = services::GetObserverService();
if (obs) {
obs->RemoveObserver(this, kNetworkConnStateChangedTopic);
}
#endif
@ -774,30 +781,27 @@ GonkGPSGeolocationProvider::SetHighAccuracy(bool)
return NS_OK;
}
#ifdef MOZ_B2G_RIL
/** nsIRILDataCallback interface **/
NS_IMETHODIMP
GonkGPSGeolocationProvider::DataCallStateChanged(nsIRILDataCallInfo* aDataCall)
GonkGPSGeolocationProvider::Observe(nsISupports* aSubject,
const char* aTopic,
const char16_t* aData)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aDataCall);
// We call Setting Service before we get the state of supl data connection
// since it is possible that state of supl data connection haven't been
// updated and will be updated after we finished this function (code that
// updates the state is in another dataCallStateChanged callback).
if (strcmp(aTopic, kNetworkConnStateChangedTopic)) {
return NS_OK;
}
nsCOMPtr<nsIRilNetworkInterface> iface = do_QueryInterface(aSubject);
if (!iface) {
return NS_OK;
}
RequestSettingValue("ril.supl.apn");
return NS_OK;
}
NS_IMETHODIMP
GonkGPSGeolocationProvider::ReceiveDataCallList(nsIRILDataCallInfo** aDataCalls,
uint32_t aLength)
{
return NS_OK;
}
#ifdef MOZ_B2G_RIL
/** nsISettingsServiceCallback **/
NS_IMETHODIMP

View File

@ -20,6 +20,7 @@
#include <hardware/gps.h> // for GpsInterface
#include "nsCOMPtr.h"
#include "nsIGeolocationProvider.h"
#include "nsIObserver.h"
#ifdef MOZ_B2G_RIL
#include "nsIRadioInterfaceLayer.h"
#include "nsISettingsService.h"
@ -34,16 +35,16 @@ class nsIThread;
"@mozilla.org/gonk-gps-geolocation-provider;1"
class GonkGPSGeolocationProvider : public nsIGeolocationProvider
, public nsIObserver
#ifdef MOZ_B2G_RIL
, public nsIRILDataCallback
, public nsISettingsServiceCallback
#endif
{
public:
NS_DECL_THREADSAFE_ISUPPORTS
NS_DECL_NSIGEOLOCATIONPROVIDER
NS_DECL_NSIOBSERVER
#ifdef MOZ_B2G_RIL
NS_DECL_NSIRILDATACALLBACK
NS_DECL_NSISETTINGSSERVICECALLBACK
#endif

View File

@ -47,12 +47,52 @@ NetworkInterfaceListService.prototype = {
}
};
function NetworkInterfaceList (aInterfaces) {
this._interfaces = aInterfaces;
function FakeNetworkInterface(aAttributes) {
this.state = aAttributes.state;
this.type = aAttributes.type;
this.name = aAttributes.name;
this.ips = aAttributes.ips;
this.prefixLengths = aAttributes.prefixLengths;
this.gateways = aAttributes.gateways;
this.dnses = aAttributes.dnses;
this.httpProxyHost = aAttributes.httpProxyHost;
this.httpProxyPort = aAttributes.httpProxyPort;
}
FakeNetworkInterface.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInterface]),
getAddresses: function (ips, prefixLengths) {
ips.value = this.ips.slice();
prefixLengths.value = this.prefixLengths.slice();
return this.ips.length;
},
getGateways: function (count) {
if (count) {
count.value = this.gateways.length;
}
return this.gateways.slice();
},
getDnses: function (count) {
if (count) {
count.value = this.dnses.length;
}
return this.dnses.slice();
}
};
function NetworkInterfaceList (aInterfaceLiterals) {
this._interfaces = [];
for (let entry of aInterfaceLiterals) {
this._interfaces.push(new FakeNetworkInterface(entry));
}
}
NetworkInterfaceList.prototype = {
QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInterfaceList]),
getNumberOfInterface: function() {
return this._interfaces.length;
},

View File

@ -357,16 +357,18 @@ NetworkManager.prototype = {
continue;
}
#endif
let ips = {};
let prefixLengths = {};
i.getAddresses(ips, prefixLengths);
interfaces.push({
state: i.state,
type: i.type,
name: i.name,
ip: i.ip,
prefixLength: i.prefixLength,
broadcast: i.broadcast,
gateway: i.gateway,
dns1: i.dns1,
dns2: i.dns2,
ips: ips.value,
prefixLengths: prefixLengths.value,
gateways: i.getGateways(),
dnses: i.getDnses(),
httpProxyHost: i.httpProxyHost,
httpProxyPort: i.httpProxyPort
});
@ -514,36 +516,44 @@ NetworkManager.prototype = {
},
setSecondaryDefaultRoute: function(network) {
// First, we need to add a host route to the gateway in the secondary
// routing table to make the gateway reachable. Host route takes the max
// prefix and gateway address 'any'.
let route = {
ip: network.gateway,
prefix: IPV4_MAX_PREFIX_LENGTH,
gateway: IPV4_ADDRESS_ANY
};
gNetworkService.addSecondaryRoute(network.name, route);
// Now we can add the default route through gateway. Default route takes the
// min prefix and destination ip 'any'.
route.ip = IPV4_ADDRESS_ANY;
route.prefix = 0;
route.gateway = network.gateway;
gNetworkService.addSecondaryRoute(network.name, route);
let gateways = network.getGateways();
for (let i = 0; i < gateways.length; i++) {
let isIPv6 = (gateways[i].indexOf(":") != -1) ? true : false;
// First, we need to add a host route to the gateway in the secondary
// routing table to make the gateway reachable. Host route takes the max
// prefix and gateway address 'any'.
let route = {
ip: gateways[i],
prefix: isIPv6 ? IPV6_MAX_PREFIX_LENGTH : IPV4_MAX_PREFIX_LENGTH,
gateway: isIPv6 ? IPV6_ADDRESS_ANY : IPV4_ADDRESS_ANY
};
gNetworkService.addSecondaryRoute(network.name, route);
// Now we can add the default route through gateway. Default route takes the
// min prefix and destination ip 'any'.
route.ip = isIPv6 ? IPV6_ADDRESS_ANY : IPV4_ADDRESS_ANY;
route.prefix = 0;
route.gateway = gateways[i];
gNetworkService.addSecondaryRoute(network.name, route);
}
},
removeSecondaryDefaultRoute: function(network) {
// Remove both host route and default route.
let route = {
ip: network.gateway,
prefix: IPV4_MAX_PREFIX_LENGTH,
gateway: IPV4_ADDRESS_ANY
};
gNetworkService.removeSecondaryRoute(network.name, route);
let gateways = network.getGateways();
for (let i = 0; i < gateways.length; i++) {
let isIPv6 = (gateways[i].indexOf(":") != -1) ? true : false;
// Remove both default route and host route.
let route = {
ip: isIPv6 ? IPV6_ADDRESS_ANY : IPV4_ADDRESS_ANY,
prefix: 0,
gateway: gateways[i]
};
gNetworkService.removeSecondaryRoute(network.name, route);
route.ip = IPV4_ADDRESS_ANY;
route.prefix = "0";
route.gateway = network.gateway;
gNetworkService.removeSecondaryRoute(network.name, route);
route.ip = gateways[i];
route.prefix = isIPv6 ? IPV6_MAX_PREFIX_LENGTH : IPV4_MAX_PREFIX_LENGTH;
route.gateway = isIPv6 ? IPV6_ADDRESS_ANY : IPV4_ADDRESS_ANY;
gNetworkService.removeSecondaryRoute(network.name, route);
}
},
#endif // MOZ_B2G_RIL

View File

@ -265,76 +265,87 @@ NetworkService.prototype = {
},
resetRoutingTable: function(network) {
if (!network.ip || !network.prefixLength) {
if(DEBUG) debug("Either ip or prefixLength is null. Cannot reset routing table.");
return;
let ips = {};
let prefixLengths = {};
let length = network.getAddresses(ips, prefixLengths);
for (let i = 0; i < length; i++) {
let ip = ips.value[i];
let prefixLength = prefixLengths.value[i];
let options = {
cmd: "removeNetworkRoute",
ifname: network.name,
ip: ip,
prefixLength: prefixLength
};
this.controlMessage(options);
}
let options = {
cmd: "removeNetworkRoute",
ifname: network.name,
ip: network.ip,
prefixLength: network.prefixLength
};
this.controlMessage(options, function() {});
},
setDNS: function(networkInterface) {
if(DEBUG) debug("Going DNS to " + networkInterface.name);
let dnses = networkInterface.getDnses();
let options = {
cmd: "setDNS",
ifname: networkInterface.name,
domain: "mozilla." + networkInterface.name + ".doman",
dns1_str: networkInterface.dns1,
dns2_str: networkInterface.dns2
dnses: dnses
};
this.controlMessage(options, function() {});
this.controlMessage(options);
},
setDefaultRouteAndDNS: function(network, oldInterface) {
if(DEBUG) debug("Going to change route and DNS to " + network.name);
let gateways = network.getGateways();
let dnses = network.getDnses();
let options = {
cmd: "setDefaultRouteAndDNS",
ifname: network.name,
oldIfname: (oldInterface && oldInterface !== network) ? oldInterface.name : null,
gateway_str: network.gateway,
gateways: gateways,
domain: "mozilla." + network.name + ".doman",
dns1_str: network.dns1,
dns2_str: network.dns2
dnses: dnses
};
this.controlMessage(options, function() {});
this.controlMessage(options);
this.setNetworkProxy(network);
},
removeDefaultRoute: function(network) {
if(DEBUG) debug("Remove default route for " + network.name);
let gateways = network.getGateways();
let options = {
cmd: "removeDefaultRoute",
ifname: network.name,
gateway: network.gateway
gateways: gateways
};
this.controlMessage(options, function() {});
this.controlMessage(options);
},
addHostRoute: function(network) {
if(DEBUG) debug("Going to add host route on " + network.name);
let gateways = network.getGateways();
let dnses = network.getDnses();
let options = {
cmd: "addHostRoute",
ifname: network.name,
gateway: network.gateway,
hostnames: [network.dns1, network.dns2, network.httpProxyHost]
gateways: gateways,
hostnames: dnses.concat(network.httpProxyHost)
};
this.controlMessage(options, function() {});
this.controlMessage(options);
},
removeHostRoute: function(network) {
if(DEBUG) debug("Going to remove host route on " + network.name);
let gateways = network.getGateways();
let dnses = network.getDnses();
let options = {
cmd: "removeHostRoute",
ifname: network.name,
gateway: network.gateway,
hostnames: [network.dns1, network.dns2, network.httpProxyHost]
gateways: gateways,
hostnames: dnses.concat(network.httpProxyHost)
};
this.controlMessage(options, function() {});
this.controlMessage(options);
},
removeHostRoutes: function(ifname) {
@ -343,29 +354,31 @@ NetworkService.prototype = {
cmd: "removeHostRoutes",
ifname: ifname,
};
this.controlMessage(options, function() {});
this.controlMessage(options);
},
addHostRouteWithResolve: function(network, hosts) {
if(DEBUG) debug("Going to add host route after dns resolution on " + network.name);
let gateways = network.getGateways();
let options = {
cmd: "addHostRoute",
ifname: network.name,
gateway: network.gateway,
gateways: gateways,
hostnames: hosts
};
this.controlMessage(options, function() {});
this.controlMessage(options);
},
removeHostRouteWithResolve: function(network, hosts) {
if(DEBUG) debug("Going to remove host route after dns resolution on " + network.name);
let gateways = network.getGateways();
let options = {
cmd: "removeHostRoute",
ifname: network.name,
gateway: network.gateway,
gateways: gateways,
hostnames: hosts
};
this.controlMessage(options, function() {});
this.controlMessage(options);
},
addSecondaryRoute: function(ifname, route) {
@ -377,7 +390,7 @@ NetworkService.prototype = {
prefix: route.prefix,
gateway: route.gateway
};
this.controlMessage(options, function() {});
this.controlMessage(options);
},
removeSecondaryRoute: function(ifname, route) {
@ -389,7 +402,7 @@ NetworkService.prototype = {
prefix: route.prefix,
gateway: route.gateway
};
this.controlMessage(options, function() {});
this.controlMessage(options);
},
setNetworkProxy: function(network) {

View File

@ -325,6 +325,24 @@ static int getIpType(const char *aIp) {
return type;
}
/**
* Helper function to find the best match gateway. For now, return
* the gateway that matches the address family passed.
*/
static uint32_t selectGateway(nsTArray<nsString>& gateways, int addrFamily)
{
uint32_t length = gateways.Length();
for (uint32_t i = 0; i < length; i++) {
NS_ConvertUTF16toUTF8 autoGateway(gateways[i]);
if ((getIpType(autoGateway.get()) == AF_INET && addrFamily == AF_INET) ||
(getIpType(autoGateway.get()) == AF_INET6 && addrFamily == AF_INET6)) {
return i;
}
}
return length; // invalid index.
}
static void postMessage(NetworkResultOptions& aResult)
{
MOZ_ASSERT(gNetworkUtils);
@ -836,7 +854,28 @@ void NetworkUtils::setInterfaceDns(CommandChain* aChain,
NetworkResultOptions& aResult)
{
char command[MAX_COMMAND_SIZE];
snprintf(command, MAX_COMMAND_SIZE - 1, "resolver setifdns %s %s %s %s", GET_CHAR(mIfname), GET_CHAR(mDomain), GET_CHAR(mDns1_str), GET_CHAR(mDns2_str));
int written = snprintf(command, sizeof command, "resolver setifdns %s %s",
GET_CHAR(mIfname), GET_CHAR(mDomain));
nsTArray<nsString>& dnses = GET_FIELD(mDnses);
uint32_t length = dnses.Length();
for (uint32_t i = 0; i < length; i++) {
NS_ConvertUTF16toUTF8 autoDns(dnses[i]);
int ret = snprintf(command + written, sizeof(command) - written, " %s", autoDns.get());
if (ret <= 1) {
command[written] = '\0';
continue;
}
if ((ret + written) >= sizeof(command)) {
command[written] = '\0';
break;
}
written += ret;
}
doCommand(command, aChain, aCallback);
}
@ -1139,19 +1178,23 @@ bool NetworkUtils::setDhcpServer(NetworkParams& aOptions)
*/
bool NetworkUtils::setDNS(NetworkParams& aOptions)
{
IFProperties interfaceProperties;
getIFProperties(GET_CHAR(mIfname), interfaceProperties);
uint32_t length = aOptions.mDnses.Length();
if (length > 0) {
for (uint32_t i = 0; i < length; i++) {
NS_ConvertUTF16toUTF8 autoDns(aOptions.mDnses[i]);
char dns_prop_key[PROPERTY_VALUE_MAX];
snprintf(dns_prop_key, sizeof dns_prop_key, "net.dns%d", i+1);
property_set(dns_prop_key, autoDns.get());
}
} else {
// Set dnses from system properties.
IFProperties interfaceProperties;
getIFProperties(GET_CHAR(mIfname), interfaceProperties);
if (aOptions.mDns1_str.IsEmpty()) {
property_set("net.dns1", interfaceProperties.dns1);
} else {
property_set("net.dns1", GET_CHAR(mDns1_str));
}
if (aOptions.mDns2_str.IsEmpty()) {
property_set("net.dns2", interfaceProperties.dns2);
} else {
property_set("net.dns2", GET_CHAR(mDns2_str));
}
// Bump the DNS change property.
@ -1176,40 +1219,50 @@ bool NetworkUtils::setDNS(NetworkParams& aOptions)
bool NetworkUtils::setDefaultRouteAndDNS(NetworkParams& aOptions)
{
NS_ConvertUTF16toUTF8 autoIfname(aOptions.mIfname);
char gateway[128];
if (aOptions.mGateway_str.IsEmpty()) {
if (!aOptions.mOldIfname.IsEmpty()) {
// Remove IPv4's default route.
mNetUtils->do_ifc_remove_default_route(GET_CHAR(mOldIfname));
// Remove IPv6's default route.
mNetUtils->do_ifc_remove_route(GET_CHAR(mOldIfname), "::", 0, NULL);
}
uint32_t length = aOptions.mGateways.Length();
if (length > 0) {
for (uint32_t i = 0; i < length; i++) {
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateways[i]);
int type = getIpType(autoGateway.get());
if (type != AF_INET && type != AF_INET6) {
continue;
}
if (type == AF_INET6) {
mNetUtils->do_ifc_add_route(autoIfname.get(), "::", 0, autoGateway.get());
} else { /* type == AF_INET */
mNetUtils->do_ifc_set_default_route(autoIfname.get(), inet_addr(autoGateway.get()));
}
}
} else {
// Set default froute from system properties.
char key[PROPERTY_KEY_MAX];
char gateway[PROPERTY_KEY_MAX];
snprintf(key, sizeof key - 1, "net.%s.gw", autoIfname.get());
property_get(key, gateway, "");
} else {
MOZ_ASSERT(strlen(GET_CHAR(mGateway_str)) < sizeof gateway);
strncpy(gateway, GET_CHAR(mGateway_str), sizeof(gateway) - 1);
}
int type = getIpType(gateway);
if (type != AF_INET && type != AF_INET6) {
return false;
}
if (type == AF_INET6) {
if (!aOptions.mOldIfname.IsEmpty()) {
mNetUtils->do_ifc_remove_route(GET_CHAR(mOldIfname), "::", 0, NULL);
int type = getIpType(gateway);
if (type != AF_INET && type != AF_INET6) {
return false;
}
mNetUtils->do_ifc_add_route(autoIfname.get(), "::", 0, gateway);
setDNS(aOptions);
return true;
if (type == AF_INET6) {
mNetUtils->do_ifc_add_route(autoIfname.get(), "::", 0, gateway);
} else { /* type == AF_INET */
mNetUtils->do_ifc_set_default_route(autoIfname.get(), inet_addr(gateway));
}
}
/* type == AF_INET */
if (!aOptions.mOldIfname.IsEmpty()) {
mNetUtils->do_ifc_remove_default_route(GET_CHAR(mOldIfname));
}
mNetUtils->do_ifc_set_default_route(autoIfname.get(), inet_addr(gateway));
setDNS(aOptions);
return true;
}
@ -1219,17 +1272,20 @@ bool NetworkUtils::setDefaultRouteAndDNS(NetworkParams& aOptions)
*/
bool NetworkUtils::removeDefaultRoute(NetworkParams& aOptions)
{
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateway);
uint32_t length = aOptions.mGateways.Length();
for (uint32_t i = 0; i < length; i++) {
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateways[i]);
int type = getIpType(autoGateway.get());
if (type != AF_INET && type != AF_INET6) {
return false;
int type = getIpType(autoGateway.get());
if (type != AF_INET && type != AF_INET6) {
return false;
}
mNetUtils->do_ifc_remove_route(GET_CHAR(mIfname),
type == AF_INET ? "0.0.0.0" : "::",
0, autoGateway.get());
}
mNetUtils->do_ifc_remove_route(GET_CHAR(mIfname),
type == AF_INET ? "0.0.0.0" : "::",
0, autoGateway.get());
return true;
}
@ -1239,7 +1295,6 @@ bool NetworkUtils::removeDefaultRoute(NetworkParams& aOptions)
bool NetworkUtils::addHostRoute(NetworkParams& aOptions)
{
NS_ConvertUTF16toUTF8 autoIfname(aOptions.mIfname);
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateway);
int type, prefix;
uint32_t length = aOptions.mHostnames.Length();
@ -1251,6 +1306,12 @@ bool NetworkUtils::addHostRoute(NetworkParams& aOptions)
continue;
}
uint32_t index = selectGateway(aOptions.mGateways, type);
if (index >= aOptions.mGateways.Length()) {
continue;
}
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateways[index]);
prefix = type == AF_INET ? 32 : 128;
mNetUtils->do_ifc_add_route(autoIfname.get(), autoHostname.get(), prefix,
autoGateway.get());
@ -1264,7 +1325,6 @@ bool NetworkUtils::addHostRoute(NetworkParams& aOptions)
bool NetworkUtils::removeHostRoute(NetworkParams& aOptions)
{
NS_ConvertUTF16toUTF8 autoIfname(aOptions.mIfname);
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateway);
int type, prefix;
uint32_t length = aOptions.mHostnames.Length();
@ -1276,6 +1336,12 @@ bool NetworkUtils::removeHostRoute(NetworkParams& aOptions)
continue;
}
uint32_t index = selectGateway(aOptions.mGateways, type);
if (index >= aOptions.mGateways.Length()) {
continue;
}
NS_ConvertUTF16toUTF8 autoGateway(aOptions.mGateways[index]);
prefix = type == AF_INET ? 32 : 128;
mNetUtils->do_ifc_remove_route(autoIfname.get(), autoHostname.get(), prefix,
autoGateway.get());

View File

@ -31,10 +31,8 @@ public:
mIp = aOther.mIp;
mCmd = aOther.mCmd;
mDomain = aOther.mDomain;
mDns1_str = aOther.mDns1_str;
mDns2_str = aOther.mDns2_str;
mGateway = aOther.mGateway;
mGateway_str = aOther.mGateway_str;
mGateways = aOther.mGateways;
mHostnames = aOther.mHostnames;
mId = aOther.mId;
mIfname = aOther.mIfname;
@ -60,6 +58,7 @@ public:
mUsbEndIp = aOther.mUsbEndIp;
mDns1 = aOther.mDns1;
mDns2 = aOther.mDns2;
mDnses = aOther.mDnses;
mRxBytes = aOther.mRxBytes;
mTxBytes = aOther.mTxBytes;
mDate = aOther.mDate;
@ -108,10 +107,8 @@ public:
COPY_FIELD(mId)
COPY_FIELD(mCmd)
COPY_OPT_STRING_FIELD(mDomain, EmptyString())
COPY_OPT_STRING_FIELD(mDns1_str, EmptyString())
COPY_OPT_STRING_FIELD(mDns2_str, EmptyString())
COPY_OPT_STRING_FIELD(mGateway, EmptyString())
COPY_OPT_STRING_FIELD(mGateway_str, EmptyString())
COPY_SEQUENCE_FIELD(mGateways, nsString)
COPY_SEQUENCE_FIELD(mHostnames, nsString)
COPY_OPT_STRING_FIELD(mIfname, EmptyString())
COPY_OPT_STRING_FIELD(mIp, EmptyString())
@ -137,6 +134,7 @@ public:
COPY_OPT_STRING_FIELD(mUsbEndIp, EmptyString())
COPY_OPT_STRING_FIELD(mDns1, EmptyString())
COPY_OPT_STRING_FIELD(mDns2, EmptyString())
COPY_SEQUENCE_FIELD(mDnses, nsString)
COPY_OPT_FIELD(mRxBytes, -1)
COPY_OPT_FIELD(mTxBytes, -1)
COPY_OPT_STRING_FIELD(mDate, EmptyString())
@ -159,10 +157,8 @@ public:
int32_t mId;
nsString mCmd;
nsString mDomain;
nsString mDns1_str;
nsString mDns2_str;
nsString mGateway;
nsString mGateway_str;
nsTArray<nsString> mGateways;
nsTArray<nsString> mHostnames;
nsString mIfname;
nsString mIp;
@ -188,6 +184,7 @@ public:
nsString mUsbEndIp;
nsString mDns1;
nsString mDns2;
nsTArray<nsString> mDnses;
float mRxBytes;
float mTxBytes;
nsString mDate;

View File

@ -208,7 +208,7 @@ NetworkWorker::DispatchNetworkResult(const NetworkResultOptions& aOptions)
mozilla::AutoSafeJSContext cx;
JS::RootedValue val(cx);
if (!aOptions.ToObject(cx, JS::NullPtr(), &val)) {
if (!aOptions.ToObject(cx, &val)) {
return;
}

View File

@ -1109,11 +1109,11 @@ DataConnectionHandler.prototype = {
if (this._dataCallbacks.indexOf(callback) == -1) {
continue;
}
let handler = callback[name];
if (typeof handler !== "function") {
throw new Error("No handler for " + name);
}
try {
let handler = callback[name];
if (typeof handler !== "function") {
throw new Error("No handler for " + name);
}
handler.apply(callback, args);
} catch (e) {
if (DEBUG) {
@ -1552,14 +1552,6 @@ DataConnectionHandler.prototype = {
}
}
},
/**
* Handle data call list.
*/
handleDataCallList: function(message) {
this._deliverDataCallCallback("receiveDataCallList",
[message.datacalls, message.datacalls.length]);
},
};
function RadioInterfaceLayer() {
@ -2145,21 +2137,19 @@ RadioInterface.prototype = {
connHandler.handleDataCallError(message);
break;
case "datacallstatechange":
message.ip = null;
message.prefixLength = 0;
message.broadcast = null;
if (message.ipaddr) {
message.ip = message.ipaddr.split("/")[0];
message.prefixLength = parseInt(message.ipaddr.split("/")[1], 10);
let ip_value = netHelpers.stringToIP(message.ip);
let mask_value = netHelpers.makeMask(message.prefixLength);
message.broadcast = netHelpers.ipToString((ip_value & mask_value) + ~mask_value);
let addresses = [];
for (let i = 0; i < message.addresses.length; i++) {
let [address, prefixLength] = message.addresses[i].split("/");
// From AOSP hardware/ril/include/telephony/ril.h, that address prefix
// is said to be OPTIONAL, but we never met such case before.
addresses.push({
address: address,
prefixLength: prefixLength ? parseInt(prefixLength, 10) : 0
});
}
message.addresses = addresses;
connHandler.handleDataCallState(message);
break;
case "datacalllist":
connHandler.handleDataCallList(message);
break;
case "emergencyCbModeChange":
this.handleEmergencyCbModeChange(message);
break;
@ -4294,20 +4284,6 @@ RadioInterface.prototype = {
sendingMessage, notifyResult);
},
// TODO: Bug 928861 - B2G NetworkManager: Provide a more generic function
// for connecting
registerDataCallCallback: function(callback) {
let connHandler = gDataConnectionManager.getConnectionHandler(this.clientId);
connHandler.registerDataCallCallback(callback);
},
// TODO: Bug 928861 - B2G NetworkManager: Provide a more generic function
// for connecting
unregisterDataCallCallback: function(callback) {
let connHandler = gDataConnectionManager.getConnectionHandler(this.clientId);
connHandler.unregisterDataCallCallback(callback);
},
// TODO: Bug 928861 - B2G NetworkManager: Provide a more generic function
// for connecting
setupDataCallByType: function(apntype) {
@ -4357,6 +4333,11 @@ function RILNetworkInterface(dataConnectionHandler, apnSetting) {
this.dataConnectionHandler = dataConnectionHandler;
this.apnSetting = apnSetting;
this.connectedTypes = [];
this.ips = [];
this.prefixLengths = [];
this.dnses = [];
this.gateways = [];
}
RILNetworkInterface.prototype = {
@ -4364,11 +4345,9 @@ RILNetworkInterface.prototype = {
classInfo: XPCOMUtils.generateCI({classID: RILNETWORKINTERFACE_CID,
classDescription: "RILNetworkInterface",
interfaces: [Ci.nsINetworkInterface,
Ci.nsIRilNetworkInterface,
Ci.nsIRILDataCallback]}),
Ci.nsIRilNetworkInterface]}),
QueryInterface: XPCOMUtils.generateQI([Ci.nsINetworkInterface,
Ci.nsIRilNetworkInterface,
Ci.nsIRILDataCallback]),
Ci.nsIRilNetworkInterface]),
// nsINetworkInterface
@ -4428,15 +4407,13 @@ RILNetworkInterface.prototype = {
name: null,
ip: null,
ips: null,
prefixLength: 0,
prefixLengths: null,
broadcast: null,
gateways: null,
dns1: null,
dns2: null,
dnses: null,
get httpProxyHost() {
return this.apnSetting.proxy || "";
@ -4513,13 +4490,32 @@ RILNetworkInterface.prototype = {
return port;
},
getAddresses: function (ips, prefixLengths) {
ips.value = this.ips.slice();
prefixLengths.value = this.prefixLengths.slice();
return this.ips.length;
},
getGateways: function (count) {
if (count) {
count.value = this.gateways.length;
}
return this.gateways.slice();
},
getDnses: function (count) {
if (count) {
count.value = this.dnses.length;
}
return this.dnses.slice();
},
debug: function(s) {
dump("-*- RILNetworkInterface[" + this.dataConnectionHandler.clientId + ":" +
this.type + "]: " + s + "\n");
},
// nsIRILDataCallback
dataCallError: function(message) {
if (message.apn != this.apnSetting.apn) {
return;
@ -4550,14 +4546,12 @@ RILNetworkInterface.prototype = {
this.connecting = false;
this.cid = datacall.cid;
this.name = datacall.ifname;
this.ip = datacall.ip;
this.prefixLength = datacall.prefixLength;
this.broadcast = datacall.broadcast;
this.gateway = datacall.gw;
if (datacall.dns) {
this.dns1 = datacall.dns[0];
this.dns2 = datacall.dns[1];
for (let entry of datacall.addresses) {
this.ips.push(entry.address);
this.prefixLengths.push(entry.prefixLength);
}
this.gateways = datacall.gateways.slice();
this.dnses = datacall.dnses.slice();
if (!this.registeredAsNetworkInterface) {
gNetworkManager.registerNetworkInterface(this);
this.registeredAsNetworkInterface = true;
@ -4576,17 +4570,28 @@ RILNetworkInterface.prototype = {
}
// State remains connected, check for minor changes.
let changed = false;
if (this.gateway != datacall.gw) {
this.gateway = datacall.gw;
if (this.ips.length != datacall.addresses.length) {
changed = true;
this.ips = [];
this.prefixLengths = [];
for (let entry of datacall.addresses) {
this.ips.push(entry.address);
this.prefixLengths.push(entry.prefixLength);
}
}
if (datacall.dns &&
(this.dns1 != datacall.dns[0] ||
this.dns2 != datacall.dns[1])) {
this.dns1 = datacall.dns[0];
this.dns2 = datacall.dns[1];
changed = true;
let reduceFunc = function(aRhs, aChanged, aElement, aIndex) {
return aChanged || (aElement != aRhs[aIndex]);
};
for (let field of ["gateways", "dnses"]) {
let lhs = this[field], rhs = datacall[field];
if (lhs.length != rhs.length ||
lhs.reduce(reduceFunc.bind(null, rhs), false)) {
changed = true;
this[field] = rhs.slice();
}
}
if (changed) {
if (DEBUG) this.debug("Notify for data call minor changes.");
Services.obs.notifyObservers(this,
@ -4609,6 +4614,11 @@ RILNetworkInterface.prototype = {
this.registeredAsNetworkInterface = false;
this.cid = null;
this.connectedTypes = [];
this.ips = [];
this.prefixLengths = [];
this.dnses = [];
this.gateways = [];
}
// In case the data setting changed while the datacall was being started or
@ -4621,9 +4631,6 @@ RILNetworkInterface.prototype = {
}
},
receiveDataCallList: function(dataCalls, length) {
},
// Helpers
cid: null,

View File

@ -9,7 +9,7 @@ interface nsIWifiTetheringCallback;
/**
* Information about networks that is exposed to network manager API consumers.
*/
[scriptable, uuid(0e5e8fca-0f46-416c-8bee-b3fea4bbdfd3)]
[scriptable, uuid(cb62ae03-6bda-43ff-9560-916d60203d33)]
interface nsINetworkInterface : nsISupports
{
const long NETWORK_STATE_UNKNOWN = -1;
@ -45,36 +45,6 @@ interface nsINetworkInterface : nsISupports
*/
readonly attribute DOMString name;
/**
* IP Address
*/
readonly attribute DOMString ip;
/**
* Network prefix length
*/
readonly attribute unsigned long prefixLength;
/**
* Broadcast
*/
readonly attribute DOMString broadcast;
/**
* Default gateway
*/
readonly attribute DOMString gateway;
/**
* Primary DNS address
*/
readonly attribute DOMString dns1;
/**
* Secondary DNS address
*/
readonly attribute DOMString dns2;
/**
* The host name of the http proxy server.
*/
@ -85,6 +55,43 @@ interface nsINetworkInterface : nsISupports
*/
readonly attribute long httpProxyPort;
/**
* Get the list of ip addresses and prefix lengths, ip address could be IPv4
* or IPv6, typically 1 IPv4 or 1 IPv6 or one of each.
*
* @param ips
* The list of ip addresses retrieved.
* @param prefixLengths
* The list of prefix lengths retrieved.
*
* @returns the length of the lists.
*/
void getAddresses([array, size_is(count)] out wstring ips,
[array, size_is(count)] out unsigned long prefixLengths,
[retval] out unsigned long count);
/**
* Get the list of gateways, could be IPv4 or IPv6, typically 1 IPv4 or 1
* IPv6 or one of each.
*
* @param count
* The length of the list of gateways
*
* @returns the list of gateways.
*/
void getGateways([optional] out unsigned long count,
[array, size_is(count), retval] out wstring gateways);
/**
* Get the list of dnses, could be IPv4 or IPv6.
*
* @param count
* The length of the list of dnses.
*
* @returns the list of dnses.
*/
void getDnses([optional] out unsigned long count,
[array, size_is(count), retval] out wstring dnses);
};
/**

View File

@ -21,48 +21,6 @@ interface nsIRilNetworkInterface : nsINetworkInterface
readonly attribute long mmsPort; // -1 if not set.
};
[scriptable, uuid(83dd3394-5de0-4485-a0b9-c1ed537507a3)]
interface nsIRILDataCallInfo : nsISupports
{
/**
* Current data call state, one of the
* nsINetworkInterface::NETWORK_STATE_* constants.
*/
readonly attribute unsigned long state;
readonly attribute AString cid;
readonly attribute AString apn;
readonly attribute AString ifname;
readonly attribute AString ip;
readonly attribute unsigned long prefixLength;
readonly attribute AString broadcast;
readonly attribute AString gw;
readonly attribute jsval dns;
};
[scriptable, uuid(5bcac053-c245-46f0-bb45-d0039bfb89f5)]
interface nsIRILDataCallback : nsISupports
{
/**
* Notified when a data call changes state.
*
* @param dataCall
* A nsIRILDataCallInfo object.
*/
void dataCallStateChanged(in nsIRILDataCallInfo dataCall);
/**
* Called when nsIRadioInterfaceLayer is asked to enumerate the current
* data call state.
*
* @param datacalls
* Array of nsIRILDataCallInfo objects.
* @param length
* Lenght of the aforementioned array.
*/
void receiveDataCallList([array,size_is(length)] in nsIRILDataCallInfo dataCalls,
in unsigned long length);
};
[scriptable, uuid(c0c5cb9f-6372-4b5a-b74c-baacc2da5e4f)]
interface nsIVoicemailInfo : nsISupports
{
@ -97,7 +55,7 @@ interface nsIRilSendWorkerMessageCallback : nsISupports
boolean handleResponse(in jsval response);
};
[scriptable, uuid(5b14cf79-2846-4226-b07f-9b9977b525fe)]
[scriptable, uuid(181d460e-220e-4274-8ba4-43f122eb518d)]
interface nsIRadioInterface : nsISupports
{
readonly attribute nsIRilContext rilContext;
@ -109,9 +67,6 @@ interface nsIRadioInterface : nsISupports
void deactivateDataCallByType(in DOMString apntype);
long getDataCallStateByType(in DOMString apntype);
void registerDataCallCallback(in nsIRILDataCallback callback);
void unregisterDataCallCallback(in nsIRILDataCallback callback);
void updateRILNetworkInterface();
/**

View File

@ -2361,12 +2361,13 @@ this.RIL_DATACALL_AUTH_TO_GECKO = [
];
this.GECKO_DATACALL_PDP_TYPE_IP = "IP";
this.GECKO_DATACALL_PDP_TYPE_IPV4V6 = "IPV4V6";
this.GECKO_DATACALL_PDP_TYPE_IPV6 = "IPV6";
this.GECKO_DATACALL_PDP_TYPE_DEFAULT = GECKO_DATACALL_PDP_TYPE_IP;
this.RIL_DATACALL_PDP_TYPES = [
GECKO_DATACALL_PDP_TYPE_IP,
GECKO_DATACALL_PDP_TYPE_IPV4V6,
GECKO_DATACALL_PDP_TYPE_IPV6,
// TODO: Bug 978711 - Support IPV4V6
];
this.DATACALL_PROFILE_DEFAULT = 0;

View File

@ -3924,25 +3924,48 @@ RilObject.prototype = {
this.sendChromeMessage(message);
},
_compareDataCallLink: function(source, target) {
if (source.ifname != target.ifname ||
source.ipaddr != target.ipaddr ||
source.gw != target.gw) {
return false;
/**
* @return "deactivate" if <ifname> changes or one of the currentDataCall
* addresses is missing in updatedDataCall, or "identical" if no
* changes found, or "changed" otherwise.
*/
_compareDataCallLink: function(updatedDataCall, currentDataCall) {
// If network interface is changed, report as "deactivate".
if (updatedDataCall.ifname != currentDataCall.ifname) {
return "deactivate";
}
// Compare <datacall>.dns.
let sdns = source.dns, tdns = target.dns;
if (sdns.length != tdns.length) {
return false;
}
for (let i = 0; i < sdns.length; i++) {
if (sdns[i] != tdns[i]) {
return false;
// If any existing address is missing, report as "deactivate".
for (let i = 0; i < currentDataCall.addresses.length; i++) {
let address = currentDataCall.addresses[i];
if (updatedDataCall.addresses.indexOf(address) < 0) {
return "deactivate";
}
}
return true;
if (currentDataCall.addresses.length != updatedDataCall.addresses.length) {
// Since now all |currentDataCall.addresses| are found in
// |updatedDataCall.addresses|, this means one or more new addresses are
// reported.
return "changed";
}
let fields = ["gateways", "dnses"];
for (let i = 0; i < fields.length; i++) {
// Compare <datacall>.<field>.
let field = fields[i];
let lhs = updatedDataCall[field], rhs = currentDataCall[field];
if (lhs.length != rhs.length) {
return "changed";
}
for (let i = 0; i < lhs.length; i++) {
if (lhs[i] != rhs[i]) {
return "changed";
}
}
}
return "identical";
},
_processDataCallList: function(datacalls, newDataCallOptions) {
@ -3998,12 +4021,13 @@ RilObject.prototype = {
}
// State not changed, now check links.
if (this._compareDataCallLink(updatedDataCall, currentDataCall)) {
let result =
this._compareDataCallLink(updatedDataCall, currentDataCall);
if (result == "identical") {
if (DEBUG) this.context.debug("No changes in data call.");
continue;
}
if ((updatedDataCall.ifname != currentDataCall.ifname) ||
(updatedDataCall.ipaddr != currentDataCall.ipaddr)) {
if (result == "deactivate") {
if (DEBUG) this.context.debug("Data link changed, cleanup.");
this.deactivateDataCall(currentDataCall);
continue;
@ -4012,12 +4036,9 @@ RilObject.prototype = {
if (DEBUG) {
this.context.debug("Data link minor change, just update and notify.");
}
currentDataCall.gw = updatedDataCall.gw;
if (updatedDataCall.dns) {
currentDataCall.dns = updatedDataCall.dns.slice();
} else {
currentDataCall.dns = [];
}
currentDataCall.addresses = updatedDataCall.addresses.slice();
currentDataCall.dnses = updatedDataCall.dnses.slice();
currentDataCall.gateways = updatedDataCall.gateways.slice();
currentDataCall.rilMessageType = "datacallstatechange";
this.sendChromeMessage(currentDataCall);
}
@ -5042,18 +5063,6 @@ RilObject.prototype = {
this.sendChromeMessage(options);
},
/**
* Get a list of current data calls.
*/
enumerateDataCalls: function() {
let datacall_list = [];
for each (let datacall in this.currentDataCalls) {
datacall_list.push(datacall);
}
this.sendChromeMessage({rilMessageType: "datacalllist",
datacalls: datacall_list});
},
/**
* Process STK Proactive Command.
*/
@ -5423,12 +5432,12 @@ RilObject.prototype.readSetupDataCall_v5 = function readSetupDataCall_v5(options
if (!options) {
options = {};
}
let [cid, ifname, ipaddr, dns, gw] = this.context.Buf.readStringList();
let [cid, ifname, addresses, dnses, gateways] = this.context.Buf.readStringList();
options.cid = cid;
options.ifname = ifname;
options.ipaddr = ipaddr;
options.dns = dns;
options.gw = gw;
options.addresses = addresses ? [addresses] : [];
options.dnses = dnses ? [dnses] : [];
options.gateways = gateways ? [gateways] : [];
options.active = DATACALL_ACTIVE_UNKNOWN;
options.state = GECKO_NETWORK_STATE_CONNECTING;
return options;
@ -5954,6 +5963,23 @@ RilObject.prototype[REQUEST_QUERY_CLIP] = function REQUEST_QUERY_CLIP(length, op
};
RilObject.prototype[REQUEST_LAST_DATA_CALL_FAIL_CAUSE] = null;
/**
* V3:
* # address - A space-delimited list of addresses.
*
* V4:
* # address - An address.
*
* V5:
* # addresses - A space-delimited list of addresses.
* # dnses - A space-delimited list of DNS server addresses.
*
* V6:
* # addresses - A space-delimited list of addresses with optional "/" prefix
* length.
* # dnses - A space-delimited list of DNS server addresses.
* # gateways - A space-delimited list of default gateway addresses.
*/
RilObject.prototype.readDataCall_v5 = function(options) {
if (!options) {
options = {};
@ -5963,7 +5989,11 @@ RilObject.prototype.readDataCall_v5 = function(options) {
options.active = Buf.readInt32(); // DATACALL_ACTIVE_*
options.type = Buf.readString();
options.apn = Buf.readString();
options.address = Buf.readString();
let addresses = Buf.readString();
let dnses = Buf.readString();
options.addresses = addresses ? addresses.split(" ") : [];
options.dnses = dnses ? dnses.split(" ") : [];
options.gateways = [];
return options;
};
@ -5978,19 +6008,12 @@ RilObject.prototype.readDataCall_v6 = function(options) {
options.active = Buf.readInt32(); // DATACALL_ACTIVE_*
options.type = Buf.readString();
options.ifname = Buf.readString();
options.ipaddr = Buf.readString();
options.dns = Buf.readString();
options.gw = Buf.readString();
if (options.dns) {
options.dns = options.dns.split(" ");
}
//TODO for now we only support one address and gateway
if (options.ipaddr) {
options.ipaddr = options.ipaddr.split(" ")[0];
}
if (options.gw) {
options.gw = options.gw.split(" ")[0];
}
let addresses = Buf.readString();
let dnses = Buf.readString();
let gateways = Buf.readString();
options.addresses = addresses ? addresses.split(" ") : [];
options.dnses = dnses ? dnses.split(" ") : [];
options.gateways = gateways ? gateways.split(" ") : [];
return options;
};

View File

@ -25,4 +25,4 @@ support-files =
iframe_differentDOM.html
[test_pointerlock-api.html]
skip-if = buildapp == 'b2g' || toolkit == 'android' #TIMED_OUT # b2g(window.open focus issues (using fullscreen)) b2g-debug(window.open focus issues (using fullscreen)) b2g-desktop(window.open focus issues (using fullscreen))
skip-if = buildapp == 'b2g' || toolkit == 'android' || e10s #TIMED_OUT # b2g(window.open focus issues (using fullscreen)) b2g-debug(window.open focus issues (using fullscreen)) b2g-desktop(window.open focus issues (using fullscreen))

View File

@ -16,12 +16,11 @@ dictionary NetworkCommandOptions
DOMString ip; // for "removeNetworkRoute", "setWifiTethering".
unsigned long prefixLength; // for "removeNetworkRoute".
DOMString domain; // for "setDNS"
DOMString dns1_str; // for "setDNS", "setDefaultRouteAndDNS".
DOMString dns2_str; // for "setDNS", "setDefaultRouteAndDNS".
sequence<DOMString> dnses; // for "setDNS", "setDefaultRouteAndDNS".
DOMString oldIfname; // for "setDefaultRouteAndDNS".
DOMString gateway_str; // for "setDefaultRouteAndDNS".
DOMString gateway; // for "addHostRoute", "removeHostRoute",
// "removeDefaultRoute".
DOMString gateway; // for "addSecondaryRoute", "removeSecondaryRoute".
sequence<DOMString> gateways; // for "setDefaultRouteAndDNS", "removeDefaultRoute",
// "addHostRoute", "removeHostRoute".
sequence<DOMString> hostnames; // for "addHostRoute", "removeHostRoute".
DOMString mode; // for "setWifiOperationMode".
boolean report; // for "setWifiOperationMode".

View File

@ -43,7 +43,6 @@ dictionary WifiResultOptions
DOMString ipaddr_str = ""; // The following are for the result of
// dhcp_do_request.
DOMString gateway_str = "";
DOMString broadcast_str = "";
DOMString dns1_str = "";
DOMString dns2_str = "";
DOMString mask_str = "";

View File

@ -93,7 +93,6 @@ const DEFAULT_P2P_DEVICE_TYPE = "10-0050F204-5"; // For wpa_supplicant.
const GO_NETWORK_INTERFACE = {
ip: "192.168.2.1",
maskLength: 24,
broadcast: "192.168.2.255",
gateway: "192.168.2.1",
dns1: "0.0.0.0",
dns2: "0.0.0.0",
@ -492,17 +491,36 @@ function P2pStateMachine(aP2pCommand, aNetUtil) {
state: Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED,
type: Ci.nsINetworkInterface.NETWORK_TYPE_WIFI_P2P,
name: P2P_INTERFACE_NAME,
ip: null,
prefixLength: 0,
broadcast: null,
dns1: null,
dns2: null,
gateway: null,
ips: [],
prefixLengths: [],
dnses: [],
gateways: [],
httpProxyHost: null,
httpProxyPort: null,
// help
registered: false,
getAddresses: function (ips, prefixLengths) {
ips.value = this.ips.slice();
prefixLengths.value = this.prefixLengths.slice();
return this.ips.length;
},
getGateways: function (count) {
if (count) {
count.value = this.gateways.length;
}
return this.gateways.slice();
},
getDnses: function (count) {
if (count) {
count.value = this.dnses.length;
}
return this.dnses.slice();
}
};
//---------------------------------------------------------
@ -1378,9 +1396,9 @@ function P2pStateMachine(aP2pCommand, aNetUtil) {
// Update p2p network interface.
_p2pNetworkInterface.state = Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED;
_p2pNetworkInterface.ip = GO_NETWORK_INTERFACE.ip;
_p2pNetworkInterface.prefixLength = GO_NETWORK_INTERFACE.maskLength;
_p2pNetworkInterface.gateway = GO_NETWORK_INTERFACE.ip;
_p2pNetworkInterface.ips = [GO_NETWORK_INTERFACE.ip];
_p2pNetworkInterface.prefixLengths = [GO_NETWORK_INTERFACE.maskLength];
_p2pNetworkInterface.gateways = [GO_NETWORK_INTERFACE.ip];
handleP2pNetworkInterfaceStateChanged();
_groupInfo.networkInterface = _p2pNetworkInterface;
@ -1409,13 +1427,21 @@ function P2pStateMachine(aP2pCommand, aNetUtil) {
// Update p2p network interface.
let maskLength =
netHelpers.getMaskLength(netHelpers.stringToIP(dhcpData.info.mask_str));
if (!maskLength) {
maskLength = 32; // max prefix for IPv4.
}
_p2pNetworkInterface.state = Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED;
_p2pNetworkInterface.ip = dhcpData.info.ipaddr_str;
_p2pNetworkInterface.prefixLength = maskLength;
_p2pNetworkInterface.broadcast = dhcpData.info.broadcast_str;
_p2pNetworkInterface.dns1 = dhcpData.info.dns1_str;
_p2pNetworkInterface.dns2 = dhcpData.info.dns2_str;
_p2pNetworkInterface.gateway = dhcpData.info.gateway_str;
_p2pNetworkInterface.ips = [dhcpData.info.ipaddr_str];
_p2pNetworkInterface.prefixLengths = [maskLength];
if (typeof dhcpData.info.dns1_str == "string" &&
dhcpData.info.dns1_str.length) {
_p2pNetworkInterface.dnses.push(dhcpData.info.dns1_str);
}
if (typeof dhcpData.info.dns2_str == "string" &&
dhcpData.info.dns2_str.length) {
_p2pNetworkInterface.dnses.push(dhcpData.info.dns2_str);
}
_p2pNetworkInterface.gateways = [dhcpData.info.gateway_str];
handleP2pNetworkInterfaceStateChanged();
_groupInfo.networkInterface = _p2pNetworkInterface;
@ -1427,12 +1453,10 @@ function P2pStateMachine(aP2pCommand, aNetUtil) {
function resetP2pNetworkInterface() {
_p2pNetworkInterface.state = Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED;
_p2pNetworkInterface.ip = null;
_p2pNetworkInterface.prefixLength = 0;
_p2pNetworkInterface.broadcast = null;
_p2pNetworkInterface.dns1 = null;
_p2pNetworkInterface.dns2 = null;
_p2pNetworkInterface.gateway = null;
_p2pNetworkInterface.ips = [];
_p2pNetworkInterface.prefixLengths = [];
_p2pNetworkInterface.dnses = [];
_p2pNetworkInterface.gateways = [];
}
function registerP2pNetworkInteface() {

View File

@ -94,7 +94,6 @@ public:
COPY_FIELD(mValue)
COPY_FIELD(mIpaddr_str)
COPY_FIELD(mGateway_str)
COPY_FIELD(mBroadcast_str)
COPY_FIELD(mDns1_str)
COPY_FIELD(mDns2_str)
COPY_FIELD(mMask_str)
@ -281,7 +280,7 @@ WifiProxyService::DispatchWifiResult(const WifiResultOptions& aOptions, const ns
mozilla::AutoSafeJSContext cx;
JS::Rooted<JS::Value> val(cx);
if (!aOptions.ToObject(cx, JS::NullPtr(), &val)) {
if (!aOptions.ToObject(cx, &val)) {
return;
}

View File

@ -411,11 +411,6 @@ bool WpaSupplicant::ExecuteCommand(CommandOptions aOptions,
if (inet_ntop(AF_INET, &aResult.mMask, inet_str, sizeof(inet_str))) {
aResult.mMask_str = NS_ConvertUTF8toUTF16(inet_str);
}
uint32_t broadcast = (aResult.mIpaddr & aResult.mMask) + ~aResult.mMask;
if (inet_ntop(AF_INET, &broadcast, inet_str, sizeof(inet_str))) {
aResult.mBroadcast_str = NS_ConvertUTF8toUTF16(inet_str);
}
} else {
NS_WARNING("WpaSupplicant::ExecuteCommand : Unknown command");
printf_stderr("WpaSupplicant::ExecuteCommand : Unknown command: %s",

View File

@ -894,12 +894,10 @@ var WifiManager = (function() {
WifiNetworkInterface.registered = true;
}
WifiNetworkInterface.state = Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED;
WifiNetworkInterface.ip = null;
WifiNetworkInterface.netmask = null;
WifiNetworkInterface.broadcast = null;
WifiNetworkInterface.gateway = null;
WifiNetworkInterface.dns1 = null;
WifiNetworkInterface.dns2 = null;
WifiNetworkInterface.ips = [];
WifiNetworkInterface.prefixLengths = [];
WifiNetworkInterface.gateways = [];
WifiNetworkInterface.dnses = [];
Services.obs.notifyObservers(WifiNetworkInterface,
kNetworkInterfaceStateChangedTopic,
null);
@ -1519,20 +1517,38 @@ let WifiNetworkInterface = {
name: null,
ip: null,
ips: [],
prefixLength: 0,
prefixLengths: [],
broadcast: null,
dnses: [],
dns1: null,
dns2: null,
gateways: [],
httpProxyHost: null,
httpProxyPort: null,
getAddresses: function (ips, prefixLengths) {
ips.value = this.ips.slice();
prefixLengths.value = this.prefixLengths.slice();
return this.ips.length;
},
getGateways: function (count) {
if (count) {
count.value = this.gateways.length;
}
return this.gateways.slice();
},
getDnses: function (count) {
if (count) {
count.value = this.dnses.length;
}
return this.dnses.slice();
}
};
function WifiScanResult() {}
@ -1931,12 +1947,10 @@ function WifiWorker() {
WifiNetworkInterface.state =
Ci.nsINetworkInterface.NETWORK_STATE_DISCONNECTED;
WifiNetworkInterface.ip = null;
WifiNetworkInterface.prefixLength = 0;
WifiNetworkInterface.broadcast = null;
WifiNetworkInterface.gateway = null;
WifiNetworkInterface.dns1 = null;
WifiNetworkInterface.dns2 = null;
WifiNetworkInterface.ips = [];
WifiNetworkInterface.prefixLengths = [];
WifiNetworkInterface.gateways = [];
WifiNetworkInterface.dnses = [];
Services.obs.notifyObservers(WifiNetworkInterface,
kNetworkInterfaceStateChangedTopic,
null);
@ -1961,21 +1975,29 @@ function WifiWorker() {
};
WifiManager.onnetworkconnected = function() {
if (!this.info) {
if (!this.info || !this.info.ipaddr_str) {
debug("Network information is invalid.");
return;
}
let maskLength =
netHelpers.getMaskLength(netHelpers.stringToIP(this.info.mask_str));
if (!maskLength) {
maskLength = 32; // max prefix for IPv4.
}
WifiNetworkInterface.state =
Ci.nsINetworkInterface.NETWORK_STATE_CONNECTED;
WifiNetworkInterface.ip = this.info.ipaddr_str;
WifiNetworkInterface.prefixLength = maskLength;
WifiNetworkInterface.broadcast = this.info.broadcast_str;
WifiNetworkInterface.gateway = this.info.gateway_str;
WifiNetworkInterface.dns1 = this.info.dns1_str;
WifiNetworkInterface.dns2 = this.info.dns2_str;
WifiNetworkInterface.ips = [this.info.ipaddr_str];
WifiNetworkInterface.prefixLengths = [maskLength];
WifiNetworkInterface.gateways = [this.info.gateway_str];
if (typeof this.info.dns1_str == "string" &&
this.info.dns1_str.length) {
WifiNetworkInterface.dnses.push(this.info.dns1_str);
}
if (typeof this.info.dns2_str == "string" &&
this.info.dns2_str.length) {
WifiNetworkInterface.dnses.push(this.info.dns2_str);
}
Services.obs.notifyObservers(WifiNetworkInterface,
kNetworkInterfaceStateChangedTopic,
null);

View File

@ -563,6 +563,9 @@ BasicCompositor::BeginFrame(const nsIntRegion& aInvalidRegion,
nsIntRegion invalidRegionSafe;
invalidRegionSafe.And(aInvalidRegion, intRect);
// FIXME: Redraw the whole screen in every frame to work around bug 972728.
invalidRegionSafe = intRect;
nsIntRect invalidRect = invalidRegionSafe.GetBounds();
mInvalidRect = IntRect(invalidRect.x, invalidRect.y, invalidRect.width, invalidRect.height);
mInvalidRegion = invalidRegionSafe;

View File

@ -861,6 +861,7 @@ TEST_F(AsyncPanZoomControllerTester, LongPressPreventDefault) {
status = apzc->ReceiveInputEvent(mti);
EXPECT_EQ(status, nsEventStatus_eIgnore);
EXPECT_CALL(*mcc, HandleLongTapUp(CSSPoint(touchX, touchEndY), 0, apzc->GetGuid())).Times(1);
status = ApzcUp(apzc, touchX, touchEndY, time);
EXPECT_EQ(nsEventStatus_eIgnore, status);

View File

@ -54,13 +54,19 @@ void MessagePumpDefault::Run(Delegate* delegate) {
if (delayed_work_time_.is_null()) {
hangMonitor.NotifyWait();
PROFILER_LABEL("MessagePump", "Wait");
event_.Wait();
{
GeckoProfilerSleepRAII profiler_sleep;
event_.Wait();
}
} else {
TimeDelta delay = delayed_work_time_ - TimeTicks::Now();
if (delay > TimeDelta()) {
hangMonitor.NotifyWait();
PROFILER_LABEL("MessagePump", "Wait");
event_.TimedWait(delay);
{
GeckoProfilerSleepRAII profiler_sleep;
event_.TimedWait(delay);
}
} else {
// It looks like delayed_work_time_ indicates a time in the past, so we
// need to call DoDelayedWork now.

View File

@ -0,0 +1,8 @@
(function(stdlib) {
"use asm";
var pow = stdlib.Math.pow
function f() {
return +pow(.0, .0)
}
return f
})(this, {}, ArrayBuffer)()

View File

@ -11,6 +11,6 @@ function randomFloat () {\
if (r < 0.25)\
fac = 10000000;\
}\
for (var i = 0; i < 100000; i++)\
for (var i = 0; i < 2000; i++)\
randomFloat();\
");

View File

@ -0,0 +1,6 @@
assertEq(typeof Debugger.Memory, "function");
let dbg = new Debugger;
assertEq(dbg.memory instanceof Debugger.Memory, true);
load(libdir + "asserts.js");
assertThrowsInstanceOf(() => new Debugger.Memory, TypeError);

View File

@ -0,0 +1,27 @@
function h(i, i) {
i = ([Infinity([])])(1 ? l : arguments)
}
for (var j = 0; j < 2; ++j) {
try {
h(-Number, -Number)
} catch (e) {}
}
function f() {
function f(i0, i1) {
i0 = i0 | 0;
i = i1 | 0;
switch (1) {
case -3:
switch (f) {}
} {
return 0
}(arguments)
}
return f
};
for (var j = 0; j < 5; ++j) {
(function(x) {
f()(f()(x, f()()))
})()
}

View File

@ -3918,8 +3918,10 @@ IonBuilder::inlineScriptedCall(CallInfo &callInfo, JSFunction *target)
{
types::StackTypeSet *types = types::TypeScript::ThisTypes(calleeScript);
if (!types->unknown()) {
MTypeBarrier *barrier =
MTypeBarrier::New(alloc(), callInfo.thisArg(), types->clone(alloc_->lifoAlloc()));
types::TemporaryTypeSet *clonedTypes = types->clone(alloc_->lifoAlloc());
if (!clonedTypes)
return oom();
MTypeBarrier *barrier = MTypeBarrier::New(alloc(), callInfo.thisArg(), clonedTypes);
current->add(barrier);
callInfo.setThis(barrier);
}

View File

@ -844,6 +844,11 @@ class IonBuilder : public MIRGenerator
}
IonBuilder *callerBuilder_;
bool oom() {
abortReason_ = AbortReason_Alloc;
return false;
}
struct LoopHeader {
jsbytecode *pc;
MBasicBlock *header;

View File

@ -49,9 +49,6 @@ enum BailoutKind
Bailout_BaselineInfo
};
static const uint32_t BAILOUT_KIND_BITS = 3;
static const uint32_t BAILOUT_RESUME_BITS = 1;
inline const char *
BailoutKindString(BailoutKind kind)
{

View File

@ -870,7 +870,6 @@ class LToIdV : public LInstructionHelper<BOX_PIECES, 2 * BOX_PIECES, 1>
{
public:
LIR_HEADER(ToIdV)
BOX_OUTPUT_ACCESSORS()
LToIdV(const LDefinition &temp)
{
@ -2808,7 +2807,6 @@ class LBinaryV : public LCallInstructionHelper<BOX_PIECES, 2 * BOX_PIECES, 0>
public:
LIR_HEADER(BinaryV)
BOX_OUTPUT_ACCESSORS()
LBinaryV(JSOp jsop)
: jsop_(jsop)
@ -3510,7 +3508,6 @@ class LImplicitThis : public LInstructionHelper<BOX_PIECES, 1, 0>
{
public:
LIR_HEADER(ImplicitThis)
BOX_OUTPUT_ACCESSORS()
LImplicitThis(const LAllocation &callee) {
setOperand(0, callee);
@ -3800,7 +3797,6 @@ class LLoadElementV : public LInstructionHelper<BOX_PIECES, 2, 0>
{
public:
LIR_HEADER(LoadElementV)
BOX_OUTPUT_ACCESSORS()
LLoadElementV(const LAllocation &elements, const LAllocation &index) {
setOperand(0, elements);
@ -3858,7 +3854,6 @@ class LLoadElementHole : public LInstructionHelper<BOX_PIECES, 3, 0>
{
public:
LIR_HEADER(LoadElementHole)
BOX_OUTPUT_ACCESSORS()
LLoadElementHole(const LAllocation &elements, const LAllocation &index, const LAllocation &initLength) {
setOperand(0, elements);
@ -4200,7 +4195,6 @@ class LLoadTypedArrayElementHole : public LInstructionHelper<BOX_PIECES, 2, 0>
{
public:
LIR_HEADER(LoadTypedArrayElementHole)
BOX_OUTPUT_ACCESSORS()
LLoadTypedArrayElementHole(const LAllocation &object, const LAllocation &index) {
setOperand(0, object);
@ -4373,7 +4367,6 @@ class LLoadFixedSlotV : public LInstructionHelper<BOX_PIECES, 1, 0>
{
public:
LIR_HEADER(LoadFixedSlotV)
BOX_OUTPUT_ACCESSORS()
LLoadFixedSlotV(const LAllocation &object) {
setOperand(0, object);
@ -4444,7 +4437,6 @@ class LGetNameCache : public LInstructionHelper<BOX_PIECES, 1, 0>
{
public:
LIR_HEADER(GetNameCache)
BOX_OUTPUT_ACCESSORS()
LGetNameCache(const LAllocation &scopeObj) {
setOperand(0, scopeObj);
@ -4461,7 +4453,6 @@ class LCallGetIntrinsicValue : public LCallInstructionHelper<BOX_PIECES, 0, 0>
{
public:
LIR_HEADER(CallGetIntrinsicValue)
BOX_OUTPUT_ACCESSORS()
const MCallGetIntrinsicValue *mir() const {
return mir_->toCallGetIntrinsicValue();
@ -4490,7 +4481,6 @@ class LGetPropertyCacheV : public LInstructionHelper<BOX_PIECES, 1, 0>
{
public:
LIR_HEADER(GetPropertyCacheV)
BOX_OUTPUT_ACCESSORS()
LGetPropertyCacheV(const LAllocation &object) {
setOperand(0, object);
@ -4525,7 +4515,6 @@ class LGetPropertyPolymorphicV : public LInstructionHelper<BOX_PIECES, 1, 0>
{
public:
LIR_HEADER(GetPropertyPolymorphicV)
BOX_OUTPUT_ACCESSORS()
LGetPropertyPolymorphicV(const LAllocation &obj) {
setOperand(0, obj);
@ -4627,7 +4616,6 @@ class LGetElementCacheV : public LInstructionHelper<BOX_PIECES, 1 + BOX_PIECES,
{
public:
LIR_HEADER(GetElementCacheV)
BOX_OUTPUT_ACCESSORS()
static const size_t Index = 1;
@ -4691,7 +4679,6 @@ class LLoadSlotV : public LInstructionHelper<BOX_PIECES, 1, 0>
{
public:
LIR_HEADER(LoadSlotV)
BOX_OUTPUT_ACCESSORS()
LLoadSlotV(const LAllocation &in) {
setOperand(0, in);
@ -4915,7 +4902,6 @@ class LCallGetElement : public LCallInstructionHelper<BOX_PIECES, 2 * BOX_PIECES
{
public:
LIR_HEADER(CallGetElement)
BOX_OUTPUT_ACCESSORS()
static const size_t LhsInput = 0;
static const size_t RhsInput = BOX_PIECES;
@ -4930,7 +4916,6 @@ class LCallSetElement : public LCallInstructionHelper<0, 1 + 2 * BOX_PIECES, 0>
{
public:
LIR_HEADER(CallSetElement)
BOX_OUTPUT_ACCESSORS()
static const size_t Index = 1;
static const size_t Value = 1 + BOX_PIECES;
@ -5171,7 +5156,6 @@ class LIteratorNext : public LInstructionHelper<BOX_PIECES, 1, 1>
{
public:
LIR_HEADER(IteratorNext)
BOX_OUTPUT_ACCESSORS()
LIteratorNext(const LAllocation &iterator, const LDefinition &temp) {
setOperand(0, iterator);
@ -5249,7 +5233,6 @@ class LGetFrameArgument : public LInstructionHelper<BOX_PIECES, 1, 0>
{
public:
LIR_HEADER(GetFrameArgument)
BOX_OUTPUT_ACCESSORS()
LGetFrameArgument(const LAllocation &index) {
setOperand(0, index);
@ -5300,7 +5283,6 @@ class LSetFrameArgumentV : public LInstructionHelper<0, BOX_PIECES, 0>
{
public:
LIR_HEADER(SetFrameArgumentV)
BOX_OUTPUT_ACCESSORS()
LSetFrameArgumentV() {}

View File

@ -1539,21 +1539,6 @@ LAllocation::toRegister() const
return visitor->visit##opcode(this); \
}
#if defined(JS_NUNBOX32)
# define BOX_OUTPUT_ACCESSORS() \
const LDefinition *outputType() { \
return getDef(TYPE_INDEX); \
} \
const LDefinition *outputPayload() { \
return getDef(PAYLOAD_INDEX); \
}
#elif defined(JS_PUNBOX64)
# define BOX_OUTPUT_ACCESSORS() \
const LDefinition *outputValue() { \
return getDef(0); \
}
#endif
#include "jit/LIR-Common.h"
#if defined(JS_CODEGEN_X86) || defined(JS_CODEGEN_X64)
# if defined(JS_CODEGEN_X86)

View File

@ -20,8 +20,9 @@ using namespace js::jit;
// Snapshot header:
//
// [vwu] bits (n-31]: frame count
// bits [0,n): bailout kind (n = BAILOUT_KIND_BITS)
// [vwu] bits ((n+1)-31]: frame count
// bit n+1: resume after
// bits [0,n): bailout kind (n = SNAPSHOT_BAILOUTKIND_BITS)
//
// Snapshot body, repeated "frame count" times, from oldest frame to newest frame.
// Note that the first frame doesn't have the "parent PC" field.
@ -463,20 +464,32 @@ SnapshotReader::SnapshotReader(const uint8_t *snapshots, uint32_t offset,
readSnapshotHeader();
}
static const uint32_t BAILOUT_KIND_SHIFT = 0;
static const uint32_t BAILOUT_KIND_MASK = (1 << BAILOUT_KIND_BITS) - 1;
static const uint32_t BAILOUT_RESUME_SHIFT = BAILOUT_KIND_SHIFT + BAILOUT_KIND_BITS;
static const uint32_t BAILOUT_FRAMECOUNT_SHIFT = BAILOUT_KIND_BITS + BAILOUT_RESUME_BITS;
static const uint32_t BAILOUT_FRAMECOUNT_BITS = (8 * sizeof(uint32_t)) - BAILOUT_FRAMECOUNT_SHIFT;
#define COMPUTE_SHIFT_AFTER_(name) (name ## _BITS + name ##_SHIFT)
#define COMPUTE_MASK_(name) (((1 << name ## _BITS) - 1) << name ##_SHIFT)
static const uint32_t SNAPSHOT_BAILOUTKIND_SHIFT = 0;
static const uint32_t SNAPSHOT_BAILOUTKIND_BITS = 3;
static const uint32_t SNAPSHOT_BAILOUTKIND_MASK = COMPUTE_MASK_(SNAPSHOT_BAILOUTKIND);
static const uint32_t SNAPSHOT_RESUMEAFTER_SHIFT = COMPUTE_SHIFT_AFTER_(SNAPSHOT_BAILOUTKIND);
static const uint32_t SNAPSHOT_RESUMEAFTER_BITS = 1;
static const uint32_t SNAPSHOT_RESUMEAFTER_MASK = COMPUTE_MASK_(SNAPSHOT_RESUMEAFTER);
static const uint32_t SNAPSHOT_FRAMECOUNT_SHIFT = COMPUTE_SHIFT_AFTER_(SNAPSHOT_RESUMEAFTER);
static const uint32_t SNAPSHOT_FRAMECOUNT_BITS = 32 - 4;
static const uint32_t SNAPSHOT_FRAMECOUNT_MASK = COMPUTE_MASK_(SNAPSHOT_FRAMECOUNT);
#undef COMPUTE_MASK_
#undef COMPUTE_SHIFT_AFTER_
void
SnapshotReader::readSnapshotHeader()
{
uint32_t bits = reader_.readUnsigned();
frameCount_ = bits >> BAILOUT_FRAMECOUNT_SHIFT;
frameCount_ = bits >> SNAPSHOT_FRAMECOUNT_SHIFT;
JS_ASSERT(frameCount_ > 0);
bailoutKind_ = BailoutKind((bits >> BAILOUT_KIND_SHIFT) & BAILOUT_KIND_MASK);
resumeAfter_ = !!(bits & (1 << BAILOUT_RESUME_SHIFT));
bailoutKind_ = BailoutKind((bits & SNAPSHOT_BAILOUTKIND_MASK) >> SNAPSHOT_BAILOUTKIND_SHIFT);
resumeAfter_ = !!(bits & (1 << SNAPSHOT_RESUMEAFTER_SHIFT));
#ifdef TRACK_SNAPSHOTS
pcOpcode_ = reader_.readUnsigned();
@ -559,13 +572,13 @@ SnapshotWriter::startSnapshot(uint32_t frameCount, BailoutKind kind, bool resume
IonSpew(IonSpew_Snapshots, "starting snapshot with frameCount %u, bailout kind %u",
frameCount, kind);
JS_ASSERT(frameCount > 0);
JS_ASSERT(frameCount < (1 << BAILOUT_FRAMECOUNT_BITS));
JS_ASSERT(uint32_t(kind) < (1 << BAILOUT_KIND_BITS));
JS_ASSERT(frameCount < (1 << SNAPSHOT_FRAMECOUNT_BITS));
JS_ASSERT(uint32_t(kind) < (1 << SNAPSHOT_BAILOUTKIND_BITS));
uint32_t bits = (uint32_t(kind) << BAILOUT_KIND_SHIFT) |
(frameCount << BAILOUT_FRAMECOUNT_SHIFT);
uint32_t bits = (uint32_t(kind) << SNAPSHOT_BAILOUTKIND_SHIFT) |
(frameCount << SNAPSHOT_FRAMECOUNT_SHIFT);
if (resumeAfter)
bits |= (1 << BAILOUT_RESUME_SHIFT);
bits |= (1 << SNAPSHOT_RESUMEAFTER_SHIFT);
writer_.writeUnsigned(bits);
return lastStart_;

View File

@ -136,11 +136,11 @@ CodeGeneratorX64::visitUnbox(LUnbox *unbox)
bool
CodeGeneratorX64::visitLoadSlotV(LLoadSlotV *load)
{
Register dest = ToRegister(load->outputValue());
ValueOperand dest = ToOutValue(load);
Register base = ToRegister(load->input());
int32_t offset = load->mir()->slot() * sizeof(js::Value);
masm.loadPtr(Address(base, offset), dest);
masm.loadValue(Address(base, offset), dest);
return true;
}

View File

@ -687,13 +687,17 @@ CodeGeneratorX86::postAsmJSCall(LAsmJSCall *lir)
return;
if (mir->type() == MIRType_Float32) {
Operand op(esp, -sizeof(float));
masm.reserveStack(sizeof(float));
Operand op(esp, 0);
masm.fstp32(op);
masm.loadFloat32(op, ReturnFloatReg);
masm.freeStack(sizeof(float));
} else {
Operand op(esp, -sizeof(double));
masm.reserveStack(sizeof(double));
Operand op(esp, 0);
masm.fstp(op);
masm.loadDouble(op, ReturnFloatReg);
masm.freeStack(sizeof(double));
}
}

View File

@ -163,6 +163,7 @@ UNIFIED_SOURCES += [
'vm/Compression.cpp',
'vm/DateTime.cpp',
'vm/Debugger.cpp',
'vm/DebuggerMemory.cpp',
'vm/ErrorObject.cpp',
'vm/ForkJoin.cpp',
'vm/GlobalObject.cpp',

View File

@ -14,19 +14,26 @@ printStatus (summary);
if (typeof window != 'undefined')
{
var s = self;
try {
actual = "FAIL: Unexpected exception thrown";
document.writeln(uneval(self));
self = 1;
document.writeln(uneval(self));
var win = window;
var windowString = String(window);
window = 1;
reportCompare(windowString, String(window), "window should be readonly");
if (1)
function self() { return 1; }
actual = ""; // We should reach this line, and throw an exception after it
document.writeln(uneval(self));
if (1)
function window() { return 1; }
// The test harness might rely on self having its original value: restore it.
self = s;
actual = "FAIL: this line should never be reached";
// The test harness might rely on window having its original value:
// restore it.
window = win;
} catch (e) {
}
}
else
{

View File

@ -12,19 +12,17 @@
#include "jsnum.h"
#include "jsobj.h"
#include "jswrapper.h"
#include "frontend/BytecodeCompiler.h"
#include "gc/Marking.h"
#include "jit/BaselineJIT.h"
#include "js/Vector.h"
#include "vm/ArgumentsObject.h"
#include "vm/DebuggerMemory.h"
#include "vm/WrapperObject.h"
#include "jsgcinlines.h"
#include "jsobjinlines.h"
#include "jsopcodeinlines.h"
#include "jsscriptinlines.h"
#include "vm/ObjectImpl-inl.h"
#include "vm/Stack-inl.h"
@ -1929,11 +1927,17 @@ Debugger::setUncaughtExceptionHook(JSContext *cx, unsigned argc, Value *vp)
"uncaughtExceptionHook");
return false;
}
dbg->uncaughtExceptionHook = args[0].toObjectOrNull();
args.rval().setUndefined();
return true;
}
bool
Debugger::getMemory(JSContext *cx, unsigned argc, Value *vp)
{
THIS_DEBUGGER(cx, argc, vp, "get memory", args, dbg);
args.rval().set(dbg->object->getReservedSlot(JSSLOT_DEBUG_MEMORY_INSTANCE));
return true;
}
GlobalObject *
Debugger::unwrapDebuggeeArgument(JSContext *cx, const Value &v)
@ -2135,17 +2139,24 @@ Debugger::construct(JSContext *cx, unsigned argc, Value *vp)
return false;
RootedObject proto(cx, &v.toObject());
JS_ASSERT(proto->getClass() == &Debugger::jsclass);
/*
* Make the new Debugger object. Each one has a reference to
* Debugger.{Frame,Object,Script}.prototype in reserved slots. The rest of
* the reserved slots are for hooks; they default to undefined.
* Debugger.{Frame,Object,Script,Memory}.prototype in reserved slots. The
* rest of the reserved slots are for hooks; they default to undefined.
*/
RootedObject obj(cx, NewObjectWithGivenProto(cx, &Debugger::jsclass, proto, nullptr));
if (!obj)
return false;
for (unsigned slot = JSSLOT_DEBUG_PROTO_START; slot < JSSLOT_DEBUG_PROTO_STOP; slot++)
obj->setReservedSlot(slot, proto->getReservedSlot(slot));
/* Create the Debugger.Memory instance accessible by the
* |Debugger.prototype.memory| getter. */
Value memoryProto = obj->getReservedSlot(JSSLOT_DEBUG_MEMORY_PROTO);
RootedObject memory(cx, NewObjectWithGivenProto(cx, &DebuggerMemory::class_,
&memoryProto.toObject(), nullptr));
if (!memory)
return false;
obj->setReservedSlot(JSSLOT_DEBUG_MEMORY_INSTANCE, ObjectValue(*memory));
/* Construct the underlying C++ object. */
Debugger *dbg = cx->new_<Debugger>(cx, obj.get());
@ -2814,9 +2825,9 @@ const JSPropertySpec Debugger::properties[] = {
JS_PSGS("onNewGlobalObject", Debugger::getOnNewGlobalObject, Debugger::setOnNewGlobalObject, 0),
JS_PSGS("uncaughtExceptionHook", Debugger::getUncaughtExceptionHook,
Debugger::setUncaughtExceptionHook, 0),
JS_PSG("memory", Debugger::getMemory, 0),
JS_PS_END
};
const JSFunctionSpec Debugger::methods[] = {
JS_FN("addDebuggee", Debugger::addDebuggee, 1, 0),
JS_FN("addAllGlobalsAsDebuggees", Debugger::addAllGlobalsAsDebuggees, 0, 0),
@ -5905,13 +5916,11 @@ JS_DefineDebuggerObject(JSContext *cx, HandleObject obj)
scriptProto(cx),
sourceProto(cx),
objectProto(cx),
envProto(cx);
envProto(cx),
memoryProto(cx);
objProto = obj->as<GlobalObject>().getOrCreateObjectPrototype(cx);
if (!objProto)
return false;
debugProto = js_InitClass(cx, obj,
objProto, &Debugger::jsclass, Debugger::construct,
1, Debugger::properties, Debugger::methods, nullptr, nullptr,
@ -5946,18 +5955,23 @@ JS_DefineDebuggerObject(JSContext *cx, HandleObject obj)
nullptr, nullptr);
if (!objectProto)
return false;
envProto = js_InitClass(cx, debugCtor, objProto, &DebuggerEnv_class,
DebuggerEnv_construct, 0,
DebuggerEnv_properties, DebuggerEnv_methods,
nullptr, nullptr);
if (!envProto)
return false;
memoryProto = js_InitClass(cx, debugCtor, objProto, &DebuggerMemory::class_,
DebuggerMemory::construct, 0, DebuggerMemory::properties,
DebuggerMemory::methods, nullptr, nullptr);
if (!memoryProto)
return false;
debugProto->setReservedSlot(Debugger::JSSLOT_DEBUG_FRAME_PROTO, ObjectValue(*frameProto));
debugProto->setReservedSlot(Debugger::JSSLOT_DEBUG_OBJECT_PROTO, ObjectValue(*objectProto));
debugProto->setReservedSlot(Debugger::JSSLOT_DEBUG_SCRIPT_PROTO, ObjectValue(*scriptProto));
debugProto->setReservedSlot(Debugger::JSSLOT_DEBUG_SOURCE_PROTO, ObjectValue(*sourceProto));
debugProto->setReservedSlot(Debugger::JSSLOT_DEBUG_ENV_PROTO, ObjectValue(*envProto));
debugProto->setReservedSlot(Debugger::JSSLOT_DEBUG_MEMORY_PROTO, ObjectValue(*memoryProto));
return true;
}

View File

@ -170,7 +170,6 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
OnNewGlobalObject,
HookCount
};
enum {
JSSLOT_DEBUG_PROTO_START,
JSSLOT_DEBUG_FRAME_PROTO = JSSLOT_DEBUG_PROTO_START,
@ -178,12 +177,13 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
JSSLOT_DEBUG_OBJECT_PROTO,
JSSLOT_DEBUG_SCRIPT_PROTO,
JSSLOT_DEBUG_SOURCE_PROTO,
JSSLOT_DEBUG_MEMORY_PROTO,
JSSLOT_DEBUG_PROTO_STOP,
JSSLOT_DEBUG_HOOK_START = JSSLOT_DEBUG_PROTO_STOP,
JSSLOT_DEBUG_HOOK_STOP = JSSLOT_DEBUG_HOOK_START + HookCount,
JSSLOT_DEBUG_COUNT = JSSLOT_DEBUG_HOOK_STOP
JSSLOT_DEBUG_MEMORY_INSTANCE = JSSLOT_DEBUG_HOOK_STOP,
JSSLOT_DEBUG_COUNT
};
private:
HeapPtrObject object; /* The Debugger object. Strong reference. */
GlobalObjectSet debuggees; /* Debuggee globals. Cross-compartment weak references. */
@ -321,6 +321,7 @@ class Debugger : private mozilla::LinkedListElement<Debugger>
static bool setOnNewGlobalObject(JSContext *cx, unsigned argc, Value *vp);
static bool getUncaughtExceptionHook(JSContext *cx, unsigned argc, Value *vp);
static bool setUncaughtExceptionHook(JSContext *cx, unsigned argc, Value *vp);
static bool getMemory(JSContext *cx, unsigned argc, Value *vp);
static bool addDebuggee(JSContext *cx, unsigned argc, Value *vp);
static bool addAllGlobalsAsDebuggees(JSContext *cx, unsigned argc, Value *vp);
static bool removeDebuggee(JSContext *cx, unsigned argc, Value *vp);

View File

@ -0,0 +1,47 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* 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 "vm/DebuggerMemory.h"
namespace js {
/* static */ bool
DebuggerMemory::construct(JSContext *cx, unsigned argc, Value *vp)
{
JS_ReportErrorNumber(cx, js_GetErrorMessage, nullptr, JSMSG_NO_CONSTRUCTOR,
"Debugger.Memory");
return false;
}
/* static */ const Class DebuggerMemory::class_ = {
"Memory",
JSCLASS_HAS_PRIVATE | JSCLASS_IMPLEMENTS_BARRIERS |
JSCLASS_HAS_RESERVED_SLOTS(JSSLOT_DEBUGGER_MEMORY_COUNT),
JS_PropertyStub, // addProperty
JS_DeletePropertyStub, // delProperty
JS_PropertyStub, // getProperty
JS_StrictPropertyStub, // setProperty
JS_EnumerateStub, // enumerate
JS_ResolveStub, // resolve
JS_ConvertStub, // convert
nullptr, // finalize
nullptr, // call
nullptr, // hasInstance
nullptr, // construct
nullptr // trace
};
/* static */ const JSPropertySpec DebuggerMemory::properties[] = {
JS_PS_END
};
/* static */ const JSFunctionSpec DebuggerMemory::methods[] = {
JS_FS_END
};
} /* namespace js */

View File

@ -0,0 +1,34 @@
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*-
* vim: set ts=8 sts=4 et sw=4 tw=99:
* 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 vm_DebuggerMemory_h
#define vm_DebuggerMemory_h
#include "jsapi.h"
#include "jscntxt.h"
#include "jsobj.h"
#include "js/Class.h"
#include "js/Value.h"
namespace js {
class DebuggerMemory : public JSObject {
enum {
JSSLOT_DEBUGGER_MEMORY_COUNT
};
public:
static bool construct(JSContext *cx, unsigned argc, Value *vp);
static const Class class_;
static const JSPropertySpec properties[];
static const JSFunctionSpec methods[];
};
} /* namespace js */
#endif /* vm_DebuggerMemory_h */

View File

@ -31,6 +31,7 @@
#include "XrayWrapper.h"
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
#include "mozilla/dom/PromiseBinding.h"
#include "mozilla/dom/TextDecoderBinding.h"
#include "mozilla/dom/TextEncoderBinding.h"
#include "mozilla/dom/URLBinding.h"
@ -974,6 +975,7 @@ xpc::GlobalProperties::Parse(JSContext *cx, JS::HandleObject obj)
uint32_t length;
bool ok = JS_GetArrayLength(cx, obj, &length);
NS_ENSURE_TRUE(ok, false);
bool promise = Promise;
for (uint32_t i = 0; i < length; i++) {
RootedValue nameValue(cx);
ok = JS_GetElement(cx, obj, i, &nameValue);
@ -984,7 +986,9 @@ xpc::GlobalProperties::Parse(JSContext *cx, JS::HandleObject obj)
}
JSAutoByteString name(cx, nameValue.toString());
NS_ENSURE_TRUE(name, false);
if (!strcmp(name.ptr(), "indexedDB")) {
if (promise && !strcmp(name.ptr(), "-Promise")) {
Promise = false;
} else if (!strcmp(name.ptr(), "indexedDB")) {
indexedDB = true;
} else if (!strcmp(name.ptr(), "XMLHttpRequest")) {
XMLHttpRequest = true;
@ -1009,6 +1013,9 @@ xpc::GlobalProperties::Parse(JSContext *cx, JS::HandleObject obj)
bool
xpc::GlobalProperties::Define(JSContext *cx, JS::HandleObject obj)
{
if (Promise && !dom::PromiseBinding::GetConstructorObject(cx, obj))
return false;
if (indexedDB && AccessCheck::isChrome(obj) &&
!IndexedDatabaseManager::DefineIndexedDB(cx, obj))
return false;

View File

@ -2756,7 +2756,7 @@ nsXPCComponents_Utils::ImportGlobalProperties(HandleValue aPropertyList,
{
RootedObject global(cx, CurrentGlobalOrNull(cx));
MOZ_ASSERT(global);
GlobalProperties options;
GlobalProperties options(false);
NS_ENSURE_TRUE(aPropertyList.isObject(), NS_ERROR_INVALID_ARG);
RootedObject propertyList(cx, &aPropertyList.toObject());
NS_ENSURE_TRUE(JS_IsArrayObject(cx, propertyList), NS_ERROR_INVALID_ARG);

View File

@ -30,7 +30,7 @@
#include "mozilla/dom/BindingUtils.h"
#include "mozilla/dom/Exceptions.h"
#include "mozilla/dom/indexedDB/IndexedDatabaseManager.h"
#include "mozilla/dom/PromiseBinding.h"
#include "mozilla/dom/TextDecoderBinding.h"
#include "mozilla/dom/TextEncoderBinding.h"
#include "mozilla/dom/DOMErrorBinding.h"
@ -47,8 +47,6 @@ using namespace mozilla::dom;
using namespace xpc;
using namespace JS;
using mozilla::dom::indexedDB::IndexedDatabaseManager;
NS_IMPL_ISUPPORTS4(nsXPConnect,
nsIXPConnect,
nsISupportsWeakReference,
@ -453,7 +451,8 @@ nsXPConnect::InitClassesWithNewWrappedGlobal(JSContext * aJSContext,
//
// XXX Please do not add any additional classes here without the approval of
// the XPConnect module owner.
if (!TextDecoderBinding::GetConstructorObject(aJSContext, global) ||
if (!PromiseBinding::GetConstructorObject(aJSContext, global) ||
!TextDecoderBinding::GetConstructorObject(aJSContext, global) ||
!TextEncoderBinding::GetConstructorObject(aJSContext, global) ||
!DOMErrorBinding::GetConstructorObject(aJSContext, global)) {
return UnexpectedFailure(NS_ERROR_FAILURE);

View File

@ -3289,9 +3289,13 @@ nsresult
ThrowAndFail(nsresult errNum, JSContext *cx, bool *retval);
struct GlobalProperties {
GlobalProperties() { mozilla::PodZero(this); }
GlobalProperties(bool aPromise) {
mozilla::PodZero(this);
Promise = true;
}
bool Parse(JSContext *cx, JS::HandleObject obj);
bool Define(JSContext *cx, JS::HandleObject obj);
bool Promise : 1;
bool indexedDB : 1;
bool XMLHttpRequest : 1;
bool TextDecoder : 1;
@ -3342,6 +3346,7 @@ public:
, proto(cx)
, sameZoneAs(cx)
, invisibleToDebugger(false)
, globalProperties(true)
, metadata(cx)
{ }

View File

@ -0,0 +1,12 @@
function run_test() {
var Cu = Components.utils;
sb = new Cu.Sandbox('http://www.example.com');
sb.do_check_eq = do_check_eq;
Cu.evalInSandbox('do_check_eq(typeof new Promise(function(resolve){resolve();}), "object");',
sb);
sb = new Cu.Sandbox('http://www.example.com',
{ wantGlobalProperties: ["-Promise"] });
sb.do_check_eq = do_check_eq;
Cu.evalInSandbox('do_check_eq(typeof Promise, "undefined");', sb);
do_check_eq(typeof new Promise(function(resolve){resolve();}), "object");
}

View File

@ -70,6 +70,7 @@ fail-if = os == "android"
[test_nuke_sandbox.js]
[test_sandbox_metadata.js]
[test_exportFunction.js]
[test_promise.js]
[test_textDecoder.js]
[test_url.js]
[test_sandbox_atob.js]

View File

@ -53,6 +53,7 @@ support-files =
[test_preserve3d_sorting_hit_testing.html]
[test_after_paint_pref.html]
skip-if = e10s
[test_border_radius_hit_testing.html]
[test_bug66619.html]
[test_bug93077-1.html]
@ -453,7 +454,7 @@ skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || toolkit == "win" #times ou
[test_bug570378-persian-5g.html]
skip-if = (buildapp == 'b2g' && toolkit != 'gonk') || toolkit == "win" #times out
[test_bug749186.html]
skip-if = toolkit == "win"
skip-if = toolkit == "win" || e10s
[test_bug644768.html]
skip-if = toolkit == "win"
[test_flush_on_paint.html]

View File

@ -641,7 +641,7 @@ inDOMUtils::ColorNameToRGB(const nsAString& aColorName, JSContext* aCx,
triple.mG = NS_GET_G(color);
triple.mB = NS_GET_B(color);
if (!triple.ToObject(aCx, JS::NullPtr(), aValue)) {
if (!triple.ToObject(aCx, aValue)) {
return NS_ERROR_FAILURE;
}

View File

@ -357,7 +357,7 @@ include ../../editor/reftests/reftest.list
include box-sizing/reftest.list
# invalidation - only run on B2G
skip-if(!B2G) include invalidation/reftest.list
include invalidation/reftest.list
# encodings
include ../../dom/encoding/test/reftest/reftest.list

View File

@ -0,0 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!-- Testcase for behavior of the 'baseline' value for align-items (and
align-self, implicitly). This test baseline-aligns various types of
content, and the flexbox's vertical size depends on the aggregate
post-alignment height of its children. This test also uses
"flex-wrap: wrap-reverse" to make the cross-axis bottom-to-top instead
of top-to-bottom.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Test: Baseline alignment of block flex items with 'baseline' value for 'align-items' / 'align-self' in a wrap-reverse flex container</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/>
<link rel="help" href="http://www.w3.org/TR/css3-flexbox/#baseline-participation"/>
<link rel="match" href="flexbox-align-self-baseline-horiz-1-ref.xhtml"/>
<style>
.flexbox {
display: flex;
align-items: baseline;
flex-wrap: wrap-reverse;
border: 1px dashed blue;
font: 14px sans-serif;
}
.big {
height: 100px;
font: 24px sans-serif;
margin-top: 20px;
}
.super {
vertical-align: super;
font-size: 12px;
}
.sub {
vertical-align: sub;
font-size: 12px;
}
.lime { background: lime; }
.yellow { background: yellow; }
.orange { background: orange; }
.pink { background: pink; }
.aqua { background: aqua; }
.tan { background: tan; }
</style>
</head>
<body>
<div class="flexbox">
<div class="lime">blk_1line</div>
<div class="yellow">blk<br/>2lines</div>
<div class="orange"><span class="super">super</span></div>
<div class="pink"><span class="sub">sub</span></div>
<div class="aqua big">big<br/>text<br/>3lines</div>
<i class="tan">ital<br/>ic</i>
</div>
</body>
</html>

View File

@ -3,54 +3,80 @@
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!-- Reference case for behavior of the 'baseline' value for align-items and
align-self, in a multi-line flex container.
This reference case just consists of three single-line flex containers,
to match the testcase's one flex container with three flex lines.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Reftest Reference</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/>
<style>
.flexbox {
display: flex;
align-items: baseline;
width: 90px;
width: 40px;
height: 40px;
border: 1px solid gray;
margin: 5px; /* just for visual separation */
float: left;
}
.flexbox > * {
width: 28px;
background: yellow;
border: 1px solid black;
height: 20px;
}
.big { font: 24px sans-serif; }
.medium { font: 14px sans-serif; }
.small { font: 8px sans-serif; }
</style>
</head>
<body>
<!-- ZEROTH ROW: NO MARGINS -->
<!-- No margins on flex item: -->
<div class="flexbox">
<!-- First flex line: Just 3 different sizes of text -->
<div class="big">a</div>
<div class="small">b</div>
<div class="medium">c</div>
<div>a</div>
</div>
<!-- FIRST ROW: SETTING MARGIN-TOP: -->
<br style="clear: both"/>
<!-- auto: -->
<div class="flexbox">
<!-- Second flex line: different margin/padding amounts on each item,
and one non-baseline-aligned item.-->
<div class="medium" style="padding-top: 10px">d</div>
<div class="medium" style="margin-bottom: 8px">e</div>
<div class="medium" style="align-self: stretch">f</div>
<div style="margin-top: 18px">a</div>
</div>
<!-- Negative: -->
<div class="flexbox">
<!-- Third flex line: other margin/padding amounts on each item -->
<div class="small" style="margin-top: 20px">g</div>
<div class="big">h</div>
<div class="medium" style="padding-bottom: 6px">i</div>
<div style="margin-top: -4px">a</div>
</div>
<!-- Small: -->
<div class="flexbox">
<div style="margin-top: 4px">a</div>
</div>
<!-- Large (pushing us out of container): -->
<div class="flexbox">
<div style="margin-top: 25px">a</div>
</div>
<!-- SECOND ROW: SETTING MARGIN-BOTTOM: -->
<br style="clear: both"/>
<!-- auto: -->
<div class="flexbox">
<div>a</div>
</div>
<!-- Negative: -->
<div class="flexbox">
<div>a</div>
</div>
<!-- Small: -->
<div class="flexbox">
<div>a</div>
</div>
<!-- Large: -->
<div class="flexbox">
<div>a</div>
</div>
</body>
</html>

View File

@ -3,54 +3,88 @@
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!-- Testcase for behavior of the 'baseline' value for align-items (and
align-self, implicitly), in a multi-line flex container.
This test baseline-aligns variously-sized flex items, and the container's
vertical size depends on the aggregate post-alignment height of its items.
<!-- Testcase for how a baseline-aligned flex item's position is impacted by
cross-axis margins, in a fixed-size flex container.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Test: Baseline alignment of block flex items with 'baseline' value for 'align-items' / 'align-self' in a multi-line flex container</title>
<title>CSS Test: Baseline alignment of flex items in fixed-size single-line flex container</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/>
<link rel="help" href="http://www.w3.org/TR/css3-flexbox/#baseline-participation"/>
<link rel="match" href="flexbox-align-self-baseline-horiz-2-ref.xhtml"/>
<style>
.flexbox {
display: flex;
flex-wrap: wrap;
align-items: baseline;
width: 90px;
width: 40px;
height: 40px;
border: 1px solid gray;
margin: 5px; /* just for visual separation */
float: left;
}
.flexbox > * {
width: 28px; /* 3 items per Flex Line */
background: yellow;
border: 1px solid black;
height: 20px;
flex: 1;
}
.big { font: 24px sans-serif; }
.medium { font: 14px sans-serif; }
.small { font: 8px sans-serif; }
</style>
</head>
<body>
<!-- ZEROTH ROW: NO MARGINS -->
<!-- No margins on flex item: -->
<div class="flexbox">
<!-- First flex line: Just 3 different sizes of text -->
<div class="big">a</div>
<div class="small">b</div>
<div class="medium">c</div>
<!-- Second flex line: different margin/padding amounts on each item,
and one non-baseline-aligned item.-->
<div class="medium" style="padding-top: 10px">d</div>
<div class="medium" style="margin-bottom: 8px">e</div>
<div class="medium" style="align-self: stretch">f</div>
<!-- Third flex line: other margin/padding amounts on each item -->
<div class="small" style="margin-top: 20px">g</div>
<div class="big">h</div>
<div class="medium" style="padding-bottom: 6px">i</div>
<div>a</div>
</div>
<!-- FIRST ROW: SETTING MARGIN-TOP: -->
<br style="clear: both"/>
<!-- auto: -->
<div class="flexbox">
<div style="margin-top: auto">a</div>
</div>
<!-- Negative: -->
<div class="flexbox">
<div style="margin-top: -4px">a</div>
</div>
<!-- Small: -->
<div class="flexbox">
<div style="margin-top: 4px">a</div>
</div>
<!-- Large (pushing us out of container): -->
<div class="flexbox">
<div style="margin-top: 25px">a</div>
</div>
<!-- SECOND ROW: SETTING MARGIN-BOTTOM: -->
<br style="clear: both"/>
<!-- auto: -->
<div class="flexbox">
<div style="margin-bottom: auto">a</div>
</div>
<!-- Negative: -->
<div class="flexbox">
<div style="margin-bottom: -4px">a</div>
</div>
<!-- Small: -->
<div class="flexbox">
<div style="margin-bottom: 4px">a</div>
</div>
<!-- Large: -->
<div class="flexbox">
<div style="margin-bottom: 25px">a</div>
</div>
</body>
</html>

View File

@ -3,56 +3,80 @@
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!-- Reference case for behavior of the 'baseline' value for align-items and
align-self, in a multi-line flex container.
This reference case just consists of three single-line flex containers,
to match the testcase's one flex container with three flex lines.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Reftest Reference</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/>
<style>
.flexbox {
display: flex;
align-items: baseline;
width: 90px;
width: 40px;
height: 40px;
border: 1px solid gray;
margin: 5px; /* just for visual separation */
float: left;
}
.flexbox > * {
width: 28px;
background: yellow;
border: 1px solid black;
height: 20px;
}
.big { font: 24px sans-serif; }
.medium { font: 14px sans-serif; }
.small { font: 8px sans-serif; }
</style>
</head>
<body>
<!-- Note: The lines are reversed here with respect to the testcase,
due to the testcase's "wrap-reverse". -->
<!-- ZEROTH ROW: NO MARGINS -->
<!-- No margins on flex item: -->
<div class="flexbox">
<!-- Third flex line: other margin/padding amounts on each item -->
<div class="small" style="margin-top: 20px">g</div>
<div class="big">h</div>
<div class="medium" style="padding-bottom: 6px">i</div>
<div style="margin-top: 18px">a</div>
</div>
<!-- FIRST ROW: SETTING MARGIN-TOP: -->
<br style="clear: both"/>
<!-- auto: -->
<div class="flexbox">
<!-- Second flex line: different margin/padding amounts on each item,
and one non-baseline-aligned item.-->
<div class="medium" style="padding-top: 10px">d</div>
<div class="medium" style="margin-bottom: 8px">e</div>
<div class="medium" style="align-self: stretch">f</div>
<div style="margin-top: 18px">a</div>
</div>
<!-- Negative: -->
<div class="flexbox">
<!-- First flex line: Just 3 different sizes of text -->
<div class="big">a</div>
<div class="small">b</div>
<div class="medium">c</div>
<div style="margin-top: 18px">a</div>
</div>
<!-- Small: -->
<div class="flexbox">
<div style="margin-top: 18px">a</div>
</div>
<!-- Large (pushing us out of container): -->
<div class="flexbox">
<div style="margin-top: 18px">a</div>
</div>
<!-- SECOND ROW: SETTING MARGIN-BOTTOM: -->
<br style="clear: both"/>
<!-- auto: -->
<div class="flexbox">
<div>a</div>
</div>
<!-- Negative: -->
<div class="flexbox">
<div style="margin-top: 22px">a</div>
</div>
<!-- Small: -->
<div class="flexbox">
<div style="margin-top: 14px">a</div>
</div>
<!-- Large: -->
<div class="flexbox">
<div style="margin-top: -7px">a</div>
</div>
</body>
</html>

View File

@ -3,54 +3,90 @@
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!-- Testcase for behavior of the 'baseline' value for align-items (and
align-self, implicitly), in a wrap-reverse multi-line flex container.
This test baseline-aligns variously-sized flex items, and the container's
vertical size depends on the aggregate post-alignment height of its items.
<!-- Testcase for how a baseline-aligned flex item's position is impacted by
cross-axis margins, in a fixed-size flex container with the cross axis
reversed via "flex-wrap: wrap-reverse".
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Test: Baseline alignment of block flex items with 'baseline' value for 'align-items' / 'align-self' in a multi-line flex container</title>
<title>CSS Test: Baseline alignment of flex items in fixed-size single-line flex container, with cross axis reversed</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/>
<link rel="help" href="http://www.w3.org/TR/css3-flexbox/#baseline-participation"/>
<link rel="match" href="flexbox-align-self-baseline-horiz-3-ref.xhtml"/>
<style>
.flexbox {
display: flex;
flex-wrap: wrap-reverse;
align-items: baseline;
width: 90px;
flex-wrap: wrap-reverse; /* Just to flip cross-axis */
width: 40px;
height: 40px;
border: 1px solid gray;
margin: 5px; /* just for visual separation */
float: left;
}
.flexbox > * {
width: 28px; /* 3 items per Flex Line */
background: yellow;
border: 1px solid black;
height: 20px;
flex: 1;
}
.big { font: 24px sans-serif; }
.medium { font: 14px sans-serif; }
.small { font: 8px sans-serif; }
</style>
</head>
<body>
<!-- ZEROTH ROW: NO MARGINS -->
<!-- No margins on flex item: -->
<div class="flexbox">
<!-- First flex line: Just 3 different sizes of text -->
<div class="big">a</div>
<div class="small">b</div>
<div class="medium">c</div>
<!-- Second flex line: different margin/padding amounts on each item,
and one non-baseline-aligned item.-->
<div class="medium" style="padding-top: 10px">d</div>
<div class="medium" style="margin-bottom: 8px">e</div>
<div class="medium" style="align-self: stretch">f</div>
<!-- Third flex line: other margin/padding amounts on each item -->
<div class="small" style="margin-top: 20px">g</div>
<div class="big">h</div>
<div class="medium" style="padding-bottom: 6px">i</div>
<div>a</div>
</div>
<!-- FIRST ROW: SETTING MARGIN-TOP: -->
<br style="clear: both"/>
<!-- auto: -->
<div class="flexbox">
<div style="margin-top: auto">a</div>
</div>
<!-- Negative: -->
<div class="flexbox">
<div style="margin-top: -4px">a</div>
</div>
<!-- Small: -->
<div class="flexbox">
<div style="margin-top: 4px">a</div>
</div>
<!-- Large (pushing us out of container): -->
<div class="flexbox">
<div style="margin-top: 25px">a</div>
</div>
<!-- SECOND ROW: SETTING MARGIN-BOTTOM: -->
<br style="clear: both"/>
<!-- auto: -->
<div class="flexbox">
<div style="margin-bottom: auto">a</div>
</div>
<!-- Negative: -->
<div class="flexbox">
<div style="margin-bottom: -4px">a</div>
</div>
<!-- Small: -->
<div class="flexbox">
<div style="margin-bottom: 4px">a</div>
</div>
<!-- Large: -->
<div class="flexbox">
<div style="margin-bottom: 25px">a</div>
</div>
</body>
</html>

View File

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/
-->
<!-- Reference case for behavior of the 'baseline' value for align-items and
align-self, in a multi-line flex container.
This reference case just consists of three single-line flex containers,
to match the testcase's one flex container with three flex lines.
-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>CSS Reftest Reference</title>
<link rel="author" title="Daniel Holbert" href="mailto:dholbert@mozilla.com"/>
<style>
.flexbox {
display: flex;
align-items: baseline;
width: 90px;
}
.flexbox > * {
width: 28px;
background: yellow;
border: 1px solid black;
}
.big { font: 24px sans-serif; }
.medium { font: 14px sans-serif; }
.small { font: 8px sans-serif; }
</style>
</head>
<body>
<div class="flexbox">
<!-- First flex line: Just 3 different sizes of text -->
<div class="big">a</div>
<div class="small">b</div>
<div class="medium">c</div>
</div>
<div class="flexbox">
<!-- Second flex line: different margin/padding amounts on each item,
and one non-baseline-aligned item.-->
<div class="medium" style="padding-top: 10px">d</div>
<div class="medium" style="margin-bottom: 8px">e</div>
<div class="medium" style="align-self: stretch">f</div>
</div>
<div class="flexbox">
<!-- Third flex line: other margin/padding amounts on each item -->
<div class="small" style="margin-top: 20px">g</div>
<div class="big">h</div>
<div class="medium" style="padding-bottom: 6px">i</div>
</div>
</body>
</html>

Some files were not shown because too many files have changed in this diff Show More