From a42aa40c36c9571c536e0bf3ba016c1d6c4db9f5 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 24 Feb 2015 14:31:47 -0800 Subject: [PATCH 01/68] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/0ba5611497a3 Author: autolander Desc: Bug 1133006 - merge pull request #28244 from KevinGrandon:bug_1133006_modify_event_font_fit to mozilla-b2g:master ======== https://hg.mozilla.org/integration/gaia-central/rev/3efd959577fa Author: Kevin Grandon Desc: Bug 1133006 - [Calendar] Run font fit after rendering panels --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 57c69fb35de..2fbec3916b7 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "f6bfd854fe4746f21bc006eac145365e85f98808", + "git_revision": "2e34269bdc7ef56ccca5bea8e3470e9efcbf92ce", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "e6b6631570eae8356747b4d4f0e8c1257da9a195", + "revision": "0ba5611497a32a7f985d4775b3c30c5c6ba7a51e", "repo_path": "integration/gaia-central" } From dd5fdb6e4d5a1e56f5f27995e7c7988831530f28 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 24 Feb 2015 14:34:10 -0800 Subject: [PATCH 02/68] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 4b35b5722cf..8ea11608377 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 74c3b4bc788..005ace52063 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 140aa76d730..ef73cc87bcc 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index d50c3fb2226..46656f731ee 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 74c3b4bc788..005ace52063 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 41c8b2abe13..cba95f49d60 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 7de609e1083..0b5952898ae 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 060e672cc30..01f2546bc75 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index c0fa4c86303..ff169398d4f 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 968057b0574d5c068323787c0763a91726a0fda5 Mon Sep 17 00:00:00 2001 From: "jlal@mozilla.com" Date: Tue, 24 Feb 2015 08:26:48 -0800 Subject: [PATCH 03/68] Bug 1132562 - Use workspace directory so autoclobber can function with caches r=wcosta - Move builder scripts into tree proper instead of baked into docker images --- testing/docker/builder/Dockerfile | 21 +++----- testing/docker/builder/VERSION | 2 +- testing/docker/builder/b2g.env | 7 +++ .../docker/builder/bin/build-b2g-desktop.sh | 52 ------------------- testing/docker/builder/bin/build-setup.sh | 20 ------- testing/docker/builder/bin/build.sh | 35 ------------- testing/docker/builder/bin/checkout-gecko | 16 ++++++ testing/docker/builder/bin/decision.sh | 17 ------ testing/docker/builder/bin/pull-gecko.sh | 14 ----- testing/docker/builder/mulet.env | 7 +++ testing/docker/tester/tester.env | 6 +++ testing/taskcluster/README.md | 11 ++++ .../scripts/builder/build-b2g-desktop.sh | 41 +++++++++++++++ .../scripts/builder}/build-emulator.sh | 41 +++++++++------ .../scripts/builder}/build-mulet-linux.sh | 31 ++++------- .../scripts/builder/desktop-setup.sh | 22 ++++++++ .../scripts/builder}/gaia_props.py | 0 .../scripts/builder}/get-objdir.py | 4 +- .../scripts/builder}/install-packages.sh | 0 .../scripts/builder}/pull-gaia.sh | 0 testing/taskcluster/scripts/copy.sh | 9 ++++ .../tasks/builds/b2g_desktop_base.yml | 14 ++--- .../tasks/builds/b2g_desktop_debug.yml | 8 ++- .../tasks/builds/b2g_desktop_opt.yml | 5 +- .../tasks/builds/b2g_emulator_base.yml | 6 ++- .../tasks/builds/b2g_emulator_ics_debug.yml | 4 +- .../tasks/builds/b2g_emulator_ics_opt.yml | 4 +- .../tasks/builds/b2g_emulator_jb_debug.yml | 4 +- .../tasks/builds/b2g_emulator_jb_opt.yml | 4 +- .../tasks/builds/b2g_emulator_kk_debug.yml | 4 +- .../tasks/builds/b2g_emulator_kk_opt.yml | 4 +- .../tasks/builds/b2g_phone_base.yml | 1 + .../taskcluster/tasks/builds/mulet_linux.yml | 12 +++-- testing/taskcluster/tasks/decision/try.yml | 4 +- 34 files changed, 201 insertions(+), 229 deletions(-) create mode 100644 testing/docker/builder/b2g.env delete mode 100755 testing/docker/builder/bin/build-b2g-desktop.sh delete mode 100755 testing/docker/builder/bin/build-setup.sh delete mode 100755 testing/docker/builder/bin/build.sh create mode 100644 testing/docker/builder/bin/checkout-gecko delete mode 100755 testing/docker/builder/bin/decision.sh delete mode 100755 testing/docker/builder/bin/pull-gecko.sh create mode 100644 testing/docker/builder/mulet.env create mode 100644 testing/docker/tester/tester.env create mode 100755 testing/taskcluster/scripts/builder/build-b2g-desktop.sh rename testing/{docker/builder/bin => taskcluster/scripts/builder}/build-emulator.sh (57%) rename testing/{docker/builder/bin => taskcluster/scripts/builder}/build-mulet-linux.sh (52%) create mode 100755 testing/taskcluster/scripts/builder/desktop-setup.sh rename testing/{docker/builder/bin => taskcluster/scripts/builder}/gaia_props.py (100%) rename testing/{docker/builder/bin => taskcluster/scripts/builder}/get-objdir.py (83%) rename testing/{docker/builder/bin => taskcluster/scripts/builder}/install-packages.sh (100%) rename testing/{docker/builder/bin => taskcluster/scripts/builder}/pull-gaia.sh (100%) create mode 100755 testing/taskcluster/scripts/copy.sh diff --git a/testing/docker/builder/Dockerfile b/testing/docker/builder/Dockerfile index 00d2a74c46d..d70364a6624 100644 --- a/testing/docker/builder/Dockerfile +++ b/testing/docker/builder/Dockerfile @@ -4,33 +4,28 @@ MAINTAINER Dustin J. Mitchell ENV PYTHONPATH /tools/tools/lib/python:$PYTHONPATH ENV TOOLTOOL_CACHE /home/worker/tools/tooltool-cache +ADD https://raw.githubusercontent.com/taskcluster/buildbot-step/58a16f7370a8b4de7a4458436a4a5fad9905f5d9/buildbot_step.js /home/worker/bin/buildbot_step + # Add utilities and configuration RUN mkdir -p /home/worker/bin /home/worker/tools +# Add bin tools last as they are most likely to change RUN chown -R worker:worker /home/worker/* /home/worker/.* -# Install android repo tool -RUN curl https://storage.googleapis.com/git-repo-downloads/repo > /home/worker/bin/repo -RUN chmod a+x /home/worker/bin/repo - # Instal build tools RUN hg clone http://hg.mozilla.org/build/tools/ /tools/tools && \ cd /tools/tools && \ python setup.py install - # Initialize git (makes repo happy) -RUN git config --global user.email "docker@docker.com" && \ - git config --global user.name "docker" +RUN git config --global user.email "mozilla@example.com" && \ + git config --global user.name "mozilla" # VCS Tools -RUN npm install -g taskcluster-vcs@2.2.0 - -# Add bin tools last as they are most likely to change -COPY bin /home/worker/bin +RUN npm install -g taskcluster-vcs@2.3.0 # TODO enable worker # TODO volume mount permissions will be an issue # USER worker -# Set a default command useful for debugging -CMD ["/bin/bash", "--login"] +COPY bin /home/worker/bin +RUN chmod a+x /home/worker/bin/* diff --git a/testing/docker/builder/VERSION b/testing/docker/builder/VERSION index d15723fbe8d..8f0916f768f 100644 --- a/testing/docker/builder/VERSION +++ b/testing/docker/builder/VERSION @@ -1 +1 @@ -0.3.2 +0.5.0 diff --git a/testing/docker/builder/b2g.env b/testing/docker/builder/b2g.env new file mode 100644 index 00000000000..31dff66355a --- /dev/null +++ b/testing/docker/builder/b2g.env @@ -0,0 +1,7 @@ +GECKO_BASE_REPOSITORY=https://github.com/mozilla/gecko-dev +GECKO_HEAD_REPOSITORY=https://github.com/mozilla/gecko-dev +GECKO_HEAD_REF=master +GECKO_HEAD_REV=master +MOZHARNESS_REPOSITORY=http://hg.mozilla.org/build/mozharness +MOZHARNESS_REV=tip +MOZCONFIG=b2g/config/mozconfigs/linux64_gecko/nightly diff --git a/testing/docker/builder/bin/build-b2g-desktop.sh b/testing/docker/builder/bin/build-b2g-desktop.sh deleted file mode 100755 index 7ef8561b5c6..00000000000 --- a/testing/docker/builder/bin/build-b2g-desktop.sh +++ /dev/null @@ -1,52 +0,0 @@ -#!/bin/bash -live - -################################### build.sh ################################### - -. build-setup.sh - -### Check that require variables are defined -test $MOZCONFIG - -# Ensure gecko is at the correct revision -pull-gecko.sh $gecko_dir - -### Install package dependencies -install-packages.sh $gecko_dir - -### Clone gaia -pull-gaia.sh $gecko_dir $gaia_dir - -cd $gecko_dir - -# Nightly mozconfig expects gaia repo be inside mozilla-central tree -if [ ! -d "gaia" ]; then - ln -s $gaia_dir gaia -fi - -export MOZ_OBJDIR=$(get-objdir.py $gecko_dir) - -./mach build; - -### Make package -cd $MOZ_OBJDIR -make package package-tests; - -### Extract artifacts -# Navigate to dist/ folder -cd $MOZ_OBJDIR/dist - -ls -lah $MOZ_OBJDIR/dist/ - -# Target names are cached so make sure we discard them first if found. -rm -f target.linux-x86_64.tar.bz2 target.linux-x86_64.json target.tests.zip - -# Artifacts folder is outside of the cache. -mkdir -p /home/worker/artifacts/ - -# Discard version numbers from packaged files, they just make it hard to write -# the right filename in the task payload where artifacts are declared -mv *.linux-x86_64.tar.bz2 /home/worker/artifacts/target.linux-x86_64.tar.bz2 -mv *.linux-x86_64.json /home/worker/artifacts/target.linux-x86_64.json -mv *.tests.zip /home/worker/artifacts/target.tests.zip - -################################### build.sh ################################### diff --git a/testing/docker/builder/bin/build-setup.sh b/testing/docker/builder/bin/build-setup.sh deleted file mode 100755 index c5a6a96f8b2..00000000000 --- a/testing/docker/builder/bin/build-setup.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/bin/bash -vex - -gecko_dir=/home/worker/gecko/source -gaia_dir=/home/worker/gaia/source - -create_parent_dir() { - parent_dir=$(dirname $1) - if [ ! -d "$parent_dir" ]; then - mkdir -p "$parent_dir" - fi -} - -# Ensure we always have the parent directory for gecko -create_parent_dir $gecko_dir - -# Create .mozbuild so mach doesn't complain about this -mkdir -p /home/worker/.mozbuild/ - -# Create object-folder exists -mkdir -p /home/worker/object-folder/ diff --git a/testing/docker/builder/bin/build.sh b/testing/docker/builder/bin/build.sh deleted file mode 100755 index 137be0aece8..00000000000 --- a/testing/docker/builder/bin/build.sh +++ /dev/null @@ -1,35 +0,0 @@ -#!/bin/bash -live - -################################### build.sh ################################### - -build-setup.sh - -### Check that we are running as worker -test `whoami` == 'worker'; - -### Check that require variables are defined -test $REPOSITORY # Should be an hg repository url to pull from -test $REVISION # Should be an hg revision to pull down -test $MOZCONFIG # Should be a mozconfig file from mozconfig/ folder - -### Pull, Update and Build -cd /home/worker/mozilla-central; -hg pull -r $REVISION $REPOSITORY; -hg update $REVISION; -./mach build; - -### Make package -cd /home/worker/object-folder; -make package package-tests; - -### Extract artifacts -# Navigate to dist/ folder -cd /home/worker/object-folder/dist; -# Discard version numbers from packaged files, they just make it hard to write -# the right filename in the task payload where artifacts are declared -mv *.linux-x86_64.tar.bz2 target.linux-x86_64.tar.bz2 -mv *.linux-x86_64.json target.linux-x86_64.json -mv *.tests.zip target.tests.zip - - -################################### build.sh ################################### diff --git a/testing/docker/builder/bin/checkout-gecko b/testing/docker/builder/bin/checkout-gecko new file mode 100644 index 00000000000..e9d97aa8b6a --- /dev/null +++ b/testing/docker/builder/bin/checkout-gecko @@ -0,0 +1,16 @@ +#! /bin/bash -ex + +# Ensure we have at least enough to check gecko out... +test $GECKO_BASE_REPOSITORY + +# Workspace to checkout gecko into... +WORKSPACE=$1 +mkdir -p $WORKSPACE + +# Note that tc-vcs requires only the first two arguments so others are optional. +# This is intended to make it easier to clone local directories. +buildbot_step "Clone gecko" tc-vcs checkout $WORKSPACE/gecko \ + $GECKO_BASE_REPOSITORY \ + $GECKO_HEAD_REPOSITORY \ + $GECKO_HEAD_REV \ + $GECKO_HEAD_REF diff --git a/testing/docker/builder/bin/decision.sh b/testing/docker/builder/bin/decision.sh deleted file mode 100755 index c8fda409435..00000000000 --- a/testing/docker/builder/bin/decision.sh +++ /dev/null @@ -1,17 +0,0 @@ -#! /bin/bash -ex - -DEST=/home/worker/source/gecko - -test $GECKO_BASE_REPOSITORY # e.g. https://hg.mozilla.org/mozilla-central -test $GECKO_HEAD_REPOSITORY # e.g. https://hg.mozilla.org/try -test $GECKO_HEAD_REF # -test $GECKO_HEAD_REV # - -tc-vcs checkout $DEST \ - $GECKO_BASE_REPOSITORY \ - $GECKO_HEAD_REPOSITORY \ - $GECKO_HEAD_REV \ - $GECKO_HEAD_REF - -echo "At revision: $(tc-vcs revision $DEST)" -cd $DEST diff --git a/testing/docker/builder/bin/pull-gecko.sh b/testing/docker/builder/bin/pull-gecko.sh deleted file mode 100755 index 93e425eda43..00000000000 --- a/testing/docker/builder/bin/pull-gecko.sh +++ /dev/null @@ -1,14 +0,0 @@ -#! /bin/bash -e - -target=$1 - -test $GECKO_BASE_REPOSITORY # base repository -test $GECKO_HEAD_REPOSITORY # repository to pull from -test $GECKO_HEAD_REF # reference if needed (usually same as rev) -test $GECKO_HEAD_REV # revision to checkout after pull - -tc-vcs checkout $target \ - $GECKO_BASE_REPOSITORY \ - $GECKO_HEAD_REPOSITORY \ - $GECKO_HEAD_REV \ - $GECKO_HEAD_REF \ diff --git a/testing/docker/builder/mulet.env b/testing/docker/builder/mulet.env new file mode 100644 index 00000000000..268bb8ee248 --- /dev/null +++ b/testing/docker/builder/mulet.env @@ -0,0 +1,7 @@ +GECKO_BASE_REPOSITORY=https://github.com/mozilla/gecko-dev +GECKO_HEAD_REPOSITORY=https://github.com/mozilla/gecko-dev +GECKO_HEAD_REF=master +GECKO_HEAD_REV=master +MOZHARNESS_REPOSITORY=http://hg.mozilla.org/build/mozharness +MOZHARNESS_REV=tip +MOZCONFIG=b2g/dev/config/mozconfigs/linux64/mulet diff --git a/testing/docker/tester/tester.env b/testing/docker/tester/tester.env new file mode 100644 index 00000000000..10675bd9af5 --- /dev/null +++ b/testing/docker/tester/tester.env @@ -0,0 +1,6 @@ +MOZHARNESS_REPOSITORY=http://hg.mozilla.org/build/mozharness +MOZHARNESS_REV=tip +GAIA_REV=tip +GAIA_REF=tip +GAIA_BASE_REPOSITORY=https://hg.mozilla.org/integration/gaia-central +GAIA_HEAD_REPOSITORY=https://hg.mozilla.org/integration/gaia-central diff --git a/testing/taskcluster/README.md b/testing/taskcluster/README.md index ed24d178a10..2d77dc19b26 100644 --- a/testing/taskcluster/README.md +++ b/testing/taskcluster/README.md @@ -1,5 +1,16 @@ # Taskcluster + Gecko Integration +## Directory structure: + + - tasks/ : All task definitions + + - tests/ : Tests for the mach target internals related to task graph + generation + + - scripts : Various scripts used by taskcluster docker images and + utilities these exist in tree primarily to avoid rebuilding + docker images. + ## Task conventions In order to properly enable task reuse there are a small number of diff --git a/testing/taskcluster/scripts/builder/build-b2g-desktop.sh b/testing/taskcluster/scripts/builder/build-b2g-desktop.sh new file mode 100755 index 00000000000..79a2addb88e --- /dev/null +++ b/testing/taskcluster/scripts/builder/build-b2g-desktop.sh @@ -0,0 +1,41 @@ +#!/bin/bash -ex + +################################### build.sh ################################### +# Ensure all the scripts in this dir are on the path.... +DIRNAME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +PATH=$DIRNAME:$PATH + +. desktop-setup.sh + +### Clone gaia +pull-gaia.sh $GECKO_DIR $GAIA_DIR + +# Ensure symlink has been created to gaia... +rm -f $GECKO_DIR/gaia +ln -s $GAIA_DIR $GECKO_DIR/gaia + +cd $GECKO_DIR +./mach build; + +### Make package +cd $MOZ_OBJDIR +make package package-tests; + +### Extract artifacts +# Navigate to dist/ folder +cd $MOZ_OBJDIR/dist +ls -lah $MOZ_OBJDIR/dist/ + +# Target names are cached so make sure we discard them first if found. +rm -f target.linux-x86_64.tar.bz2 target.linux-x86_64.json target.tests.zip + +# Artifacts folder is outside of the cache. +mkdir -p $HOME/artifacts/ + +# Discard version numbers from packaged files, they just make it hard to write +# the right filename in the task payload where artifacts are declared +mv *.linux-x86_64.tar.bz2 $HOME/artifacts/target.linux-x86_64.tar.bz2 +mv *.linux-x86_64.json $HOME/artifacts/target.linux-x86_64.json +mv *.tests.zip $HOME/artifacts/target.tests.zip + +################################### build.sh ################################### diff --git a/testing/docker/builder/bin/build-emulator.sh b/testing/taskcluster/scripts/builder/build-emulator.sh similarity index 57% rename from testing/docker/builder/bin/build-emulator.sh rename to testing/taskcluster/scripts/builder/build-emulator.sh index da013bc695d..36a6418b817 100755 --- a/testing/docker/builder/bin/build-emulator.sh +++ b/testing/taskcluster/scripts/builder/build-emulator.sh @@ -1,6 +1,13 @@ #! /bin/bash -vex +# Ensure all the scripts in this dir are on the path.... +DIRNAME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +PATH=$DIRNAME:$PATH + +WORKSPACE=$1 + ### Check that require variables are defined +test -d $WORKSPACE test $GECKO_HEAD_REPOSITORY # Should be an hg repository url to pull from test $GECKO_BASE_REPOSITORY # Should be an hg repository url to clone from test $GECKO_HEAD_REV # Should be an hg revision to pull down @@ -8,6 +15,8 @@ test $MOZHARNESS_REPOSITORY # mozharness repository test $MOZHARNESS_REV # mozharness revision test $TARGET +. setup-ccache.sh + # First check if the mozharness directory is available. This is intended to be # used locally in development to test mozharness changes: # @@ -17,18 +26,13 @@ if [ ! -d mozharness ]; then tc-vcs checkout mozharness $MOZHARNESS_REPOSITORY $MOZHARNESS_REPOSITORY $MOZHARNESS_REV fi -OBJDIR="$HOME/object-folder" - -if [ ! -d $OBJDIR ]; then - mkdir -p $OBJDIR -fi - # Figure out where the remote manifest is so we can use caches for it. MANIFEST=$(repository-url.py $GECKO_HEAD_REPOSITORY $GECKO_HEAD_REV b2g/config/$TARGET/sources.xml) -tc-vcs repo-checkout $OBJDIR/B2G https://git.mozilla.org/b2g/B2G.git $MANIFEST -# Ensure we update gecko prior to invoking mozharness so commits match up -# initially between manifest and gecko tree... -pull-gecko.sh $OBJDIR/B2G/gecko +tc-vcs repo-checkout $WORKSPACE/B2G https://git.mozilla.org/b2g/B2G.git $MANIFEST + +# Ensure symlink has been created to gecko... +rm -f $WORKSPACE/B2G/gecko +ln -s $WORKSPACE/gecko $WORKSPACE/B2G/gecko debug_flag="" if [ 0$B2G_DEBUG -ne 0 ]; then @@ -39,7 +43,7 @@ fi --config b2g/taskcluster-emulator.py \ "$debug_flag" \ --disable-mock \ - --work-dir=$OBJDIR/B2G \ + --work-dir=$WORKSPACE/B2G \ --log-level=debug \ --target=$TARGET \ --b2g-config-dir=$TARGET \ @@ -48,10 +52,13 @@ fi --repo=$GECKO_HEAD_REPOSITORY # Move files into artifact locations! -mkdir -p artifacts +mkdir -p $HOME/artifacts -mv $OBJDIR/B2G/sources.xml artifacts/sources.xml -mv $OBJDIR/B2G/out/target/product/generic/tests/gaia-tests.zip artifacts/gaia-tests.zip -mv $OBJDIR/B2G/out/target/product/generic/tests/b2g-*.zip artifacts/b2g-tests.zip -mv $OBJDIR/B2G/out/emulator.tar.gz artifacts/emulator.tar.gz -mv $OBJDIR/B2G/objdir-gecko/dist/b2g-*.crashreporter-symbols.zip artifacts/b2g-crashreporter-symbols.zip +ls -lah $WORKSPACE/B2G/out +ls -lah $WORKSPACE/B2G/objdir-gecko/dist/ + +mv $WORKSPACE/B2G/sources.xml $HOME/artifacts/sources.xml +mv $WORKSPACE/B2G/out/target/product/generic/tests/gaia-tests.zip $HOME/artifacts/gaia-tests.zip +mv $WORKSPACE/B2G/out/target/product/generic/tests/b2g-*.zip $HOME/artifacts/b2g-tests.zip +mv $WORKSPACE/B2G/out/emulator.tar.gz $HOME/artifacts/emulator.tar.gz +mv $WORKSPACE/B2G/objdir-gecko/dist/b2g-*.crashreporter-symbols.zip $HOME/artifacts/b2g-crashreporter-symbols.zip diff --git a/testing/docker/builder/bin/build-mulet-linux.sh b/testing/taskcluster/scripts/builder/build-mulet-linux.sh similarity index 52% rename from testing/docker/builder/bin/build-mulet-linux.sh rename to testing/taskcluster/scripts/builder/build-mulet-linux.sh index 1659bbe8233..fde5825b953 100755 --- a/testing/docker/builder/bin/build-mulet-linux.sh +++ b/testing/taskcluster/scripts/builder/build-mulet-linux.sh @@ -1,21 +1,13 @@ -#!/bin/bash -live +#!/bin/bash -ex ################################### build-mulet-linux.sh ################################### +# Ensure all the scripts in this dir are on the path.... +DIRNAME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +PATH=$DIRNAME:$PATH -. build-setup.sh +. desktop-setup.sh -### Check that require variables are defined -test $MOZCONFIG - -# Ensure gecko is at the correct revision -pull-gecko.sh $gecko_dir - -### Install package dependencies -install-packages.sh $gecko_dir - -export MOZ_OBJDIR=$(get-objdir.py $gecko_dir) - -cd $gecko_dir +cd $GECKO_DIR ./mach build; ### Make package @@ -28,18 +20,17 @@ cd $MOZ_OBJDIR/dist; ls -lah $MOZ_OBJDIR/dist/ - # Target names are cached so make sure we discard them first if found. rm -f target.linux-x86_64.tar.bz2 target.linux-x86_64.json target.tests.zip # Artifacts folder is outside of the cache. -mkdir -p /home/worker/artifacts/ +mkdir -p $HOME/artifacts/ # Discard version numbers from packaged files, they just make it hard to write # the right filename in the task payload where artifacts are declared -mv *.linux-x86_64.tar.bz2 /home/worker/artifacts/target.linux-x86_64.tar.bz2 -mv *.linux-x86_64.json /home/worker/artifacts/target.linux-x86_64.json -mv *.tests.zip /home/worker/artifacts/target.tests.zip -mv jsshell-linux-x86_64.zip /home/worker/artifacts/jsshell-linux-x86_64.zip +mv *.linux-x86_64.tar.bz2 $HOME/artifacts/target.linux-x86_64.tar.bz2 +mv *.linux-x86_64.json $HOME/artifacts/target.linux-x86_64.json +mv *.tests.zip $HOME/artifacts/target.tests.zip +mv jsshell-linux-x86_64.zip $HOME/artifacts/jsshell-linux-x86_64.zip ################################### build.sh ################################### diff --git a/testing/taskcluster/scripts/builder/desktop-setup.sh b/testing/taskcluster/scripts/builder/desktop-setup.sh new file mode 100755 index 00000000000..a7c727c98ed --- /dev/null +++ b/testing/taskcluster/scripts/builder/desktop-setup.sh @@ -0,0 +1,22 @@ +#!/bin/bash -ex + +test $MOZCONFIG # mozconfig is required... +test -d $1 # workspace must exist at this point... +WORKSPACE=$( cd "$1" && pwd ) + +# Gecko source: +export GECKO_DIR=$WORKSPACE/gecko +# Gaia source: +export GAIA_DIR=$WORKSPACE/gaia +# Mozbuild config: +export MOZBUILD_STATE_PATH=$WORKSPACE/mozbuild/ + +# Create .mozbuild so mach doesn't complain about this +mkdir -p $MOZBUILD_STATE_PATH + +### Install package dependencies +install-packages.sh $GECKO_DIR + +# Ensure object-folder exists +export MOZ_OBJDIR=$(get-objdir.py $GECKO_DIR $WORKSPACE/object-folder/) +mkdir -p $MOZ_OBJDIR diff --git a/testing/docker/builder/bin/gaia_props.py b/testing/taskcluster/scripts/builder/gaia_props.py similarity index 100% rename from testing/docker/builder/bin/gaia_props.py rename to testing/taskcluster/scripts/builder/gaia_props.py diff --git a/testing/docker/builder/bin/get-objdir.py b/testing/taskcluster/scripts/builder/get-objdir.py similarity index 83% rename from testing/docker/builder/bin/get-objdir.py rename to testing/taskcluster/scripts/builder/get-objdir.py index 9854995b087..ec17e56ecd3 100755 --- a/testing/docker/builder/bin/get-objdir.py +++ b/testing/taskcluster/scripts/builder/get-objdir.py @@ -7,8 +7,6 @@ import json import subprocess from StringIO import StringIO -DEFAULT_OBJDIR = "/home/worker/object-folder" - gecko_dir = sys.argv[1] os.chdir(gecko_dir) @@ -17,6 +15,6 @@ environment = json.load(StringIO(result)) topobjdir = environment["mozconfig"]["topobjdir"] if topobjdir is None: - topobjdir = DEFAULT_OBJDIR + topobjdir = sys.argv[2] print(topobjdir) diff --git a/testing/docker/builder/bin/install-packages.sh b/testing/taskcluster/scripts/builder/install-packages.sh similarity index 100% rename from testing/docker/builder/bin/install-packages.sh rename to testing/taskcluster/scripts/builder/install-packages.sh diff --git a/testing/docker/builder/bin/pull-gaia.sh b/testing/taskcluster/scripts/builder/pull-gaia.sh similarity index 100% rename from testing/docker/builder/bin/pull-gaia.sh rename to testing/taskcluster/scripts/builder/pull-gaia.sh diff --git a/testing/taskcluster/scripts/copy.sh b/testing/taskcluster/scripts/copy.sh new file mode 100755 index 00000000000..931145a3b6e --- /dev/null +++ b/testing/taskcluster/scripts/copy.sh @@ -0,0 +1,9 @@ +#! /bin/bash -ex + +# This script copies the contents of the "scripts" folder into a docker +# container using tar/untar the container id must be passed. + +DIRNAME=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +docker exec $1 mkdir -p $2 +cd $DIRNAME +tar -cv * | docker exec -i $1 tar -x -C $2 diff --git a/testing/taskcluster/tasks/builds/b2g_desktop_base.yml b/testing/taskcluster/tasks/builds/b2g_desktop_base.yml index 984b140dc00..bb1045f0f4f 100644 --- a/testing/taskcluster/tasks/builds/b2g_desktop_base.yml +++ b/testing/taskcluster/tasks/builds/b2g_desktop_base.yml @@ -6,22 +6,18 @@ task: description: B2G Desktop {{build_type}} workerType: b2gbuild-desktop - scopes: - - 'docker-worker:cache:sources-gecko' - - 'docker-worker:cache:sources-gaia' - payload: - cache: - sources-gaia: '/home/worker/gaia' - sources-gecko: '/home/worker/gecko' - env: MOZCONFIG: 'b2g/config/mozconfigs/linux64_gecko/nightly' MOZTT_GIT_URL: '{{moztt_git_url}}' MOZTT_REVISION: '{{moztt_revision}}' command: - - bin/build-b2g-desktop.sh + - /bin/bash + - -c + - > + checkout-gecko workspace && + ./workspace/gecko/testing/taskcluster/scripts/builder/build-b2g-desktop.sh workspace extra: treeherder: diff --git a/testing/taskcluster/tasks/builds/b2g_desktop_debug.yml b/testing/taskcluster/tasks/builds/b2g_desktop_debug.yml index 07b446d958b..eacbe2f2ac7 100644 --- a/testing/taskcluster/tasks/builds/b2g_desktop_debug.yml +++ b/testing/taskcluster/tasks/builds/b2g_desktop_debug.yml @@ -5,11 +5,7 @@ $inherits: task: scopes: - - 'docker-worker:cache:build-b2g-desktop-objects-debug' - - payload: - cache: - build-b2g-desktop-objects-debug: '/home/worker/object-folder' + - 'docker-worker:cache:workspace-b2g-desktop-objects-debug' extra: treeherder: @@ -17,5 +13,7 @@ task: debug: true payload: + cache: + workspace-b2g-desktop-objects-debug: '/home/worker/workspace' env: MOZCONFIG: 'b2g/config/mozconfigs/linux64_gecko/debug' diff --git a/testing/taskcluster/tasks/builds/b2g_desktop_opt.yml b/testing/taskcluster/tasks/builds/b2g_desktop_opt.yml index 4b9f8abac7a..ea8139f58a3 100644 --- a/testing/taskcluster/tasks/builds/b2g_desktop_opt.yml +++ b/testing/taskcluster/tasks/builds/b2g_desktop_opt.yml @@ -5,12 +5,11 @@ $inherits: task: scopes: - - 'docker-worker:cache:build-b2g-desktop-objects-opt' + - 'docker-worker:cache:workspace-b2g-desktop-objects-opt' payload: cache: - build-b2g-desktop-objects-opt: '/home/worker/object-folder' + workspace-b2g-desktop-objects-opt: '/home/worker/workspace' - payload: env: MOZCONFIG: 'b2g/config/mozconfigs/linux64_gecko/nightly' diff --git a/testing/taskcluster/tasks/builds/b2g_emulator_base.yml b/testing/taskcluster/tasks/builds/b2g_emulator_base.yml index cb0f83b8cd5..e584517af52 100644 --- a/testing/taskcluster/tasks/builds/b2g_emulator_base.yml +++ b/testing/taskcluster/tasks/builds/b2g_emulator_base.yml @@ -14,7 +14,11 @@ task: maxRunTime: 14400 command: - - build-emulator.sh + - /bin/bash + - -c + - > + checkout-gecko workspace && + ./workspace/gecko/testing/taskcluster/scripts/builder/build-emulator.sh workspace extra: # Rather then enforcing particular conventions we require that all build diff --git a/testing/taskcluster/tasks/builds/b2g_emulator_ics_debug.yml b/testing/taskcluster/tasks/builds/b2g_emulator_ics_debug.yml index 8c2d8326d2a..79922c6a2c5 100644 --- a/testing/taskcluster/tasks/builds/b2g_emulator_ics_debug.yml +++ b/testing/taskcluster/tasks/builds/b2g_emulator_ics_debug.yml @@ -3,7 +3,7 @@ $inherits: task: workerType: emulator-ics-debug scopes: - - 'docker-worker:cache:build-emulator-ics-debug' + - 'docker-worker:cache:workspace-emulator-ics-debug' metadata: name: '[TC] B2G Emulator ICS Debug' extra: @@ -16,7 +16,7 @@ task: payload: cache: - build-emulator-ics-debug: /home/worker/object-folder + workspace-emulator-ics-debug: /home/worker/workspace env: TARGET: 'emulator' B2G_DEBUG: 1 diff --git a/testing/taskcluster/tasks/builds/b2g_emulator_ics_opt.yml b/testing/taskcluster/tasks/builds/b2g_emulator_ics_opt.yml index 6e0a57f296c..2a7b848bb68 100644 --- a/testing/taskcluster/tasks/builds/b2g_emulator_ics_opt.yml +++ b/testing/taskcluster/tasks/builds/b2g_emulator_ics_opt.yml @@ -3,7 +3,7 @@ $inherits: task: workerType: emulator-ics scopes: - - 'docker-worker:cache:build-emulator-ics-opt' + - 'docker-worker:cache:workspace-emulator-ics-opt' metadata: name: '[TC] B2G Emulator ICS Opt' @@ -14,7 +14,7 @@ task: payload: cache: - build-emulator-ics-opt: /home/worker/object-folder/ + workspace-emulator-ics-opt: /home/worker/workspace env: TARGET: 'emulator' diff --git a/testing/taskcluster/tasks/builds/b2g_emulator_jb_debug.yml b/testing/taskcluster/tasks/builds/b2g_emulator_jb_debug.yml index 0158a64df82..a3afbb6d369 100644 --- a/testing/taskcluster/tasks/builds/b2g_emulator_jb_debug.yml +++ b/testing/taskcluster/tasks/builds/b2g_emulator_jb_debug.yml @@ -3,7 +3,7 @@ $inherits: task: workerType: emulator-jb-debug scopes: - - 'docker-worker:cache:build-emulator-jb-debug' + - 'docker-worker:cache:workspace-emulator-jb-debug' metadata: name: '[TC] B2G Emulator JB Debug' @@ -16,7 +16,7 @@ task: payload: cache: - build-emulator-jb-debug: /home/worker/object-folder + workspace-emulator-jb-debug: /home/worker/workspace env: TARGET: 'emulator-jb' B2G_DEBUG: 1 diff --git a/testing/taskcluster/tasks/builds/b2g_emulator_jb_opt.yml b/testing/taskcluster/tasks/builds/b2g_emulator_jb_opt.yml index 44db1ff35d8..94c2815fbd4 100644 --- a/testing/taskcluster/tasks/builds/b2g_emulator_jb_opt.yml +++ b/testing/taskcluster/tasks/builds/b2g_emulator_jb_opt.yml @@ -3,7 +3,7 @@ $inherits: task: workerType: emulator-jb scopes: - - 'docker-worker:cache:build-emulator-jb-opt' + - 'docker-worker:cache:workspace-emulator-jb-opt' metadata: name: '[TC] B2G JB Emulator Opt' @@ -14,6 +14,6 @@ task: payload: cache: - build-emulator-jb-opt: /home/worker/object-folder + workspace-emulator-jb-opt: /home/worker/workspace env: TARGET: 'emulator-jb' diff --git a/testing/taskcluster/tasks/builds/b2g_emulator_kk_debug.yml b/testing/taskcluster/tasks/builds/b2g_emulator_kk_debug.yml index 0d412ea0cdc..55aa0369cbf 100644 --- a/testing/taskcluster/tasks/builds/b2g_emulator_kk_debug.yml +++ b/testing/taskcluster/tasks/builds/b2g_emulator_kk_debug.yml @@ -3,7 +3,7 @@ $inherits: task: workerType: emulator-kk-debug scopes: - - 'docker-worker:cache:build-emulator-kk-debug' + - 'docker-worker:cache:workspace-emulator-kk-debug' metadata: name: '[TC] B2G Emulator KK Debug' @@ -16,7 +16,7 @@ task: payload: cache: - build-emulator-jb-debug: /home/worker/object-folder + workspace-emulator-kk-debug: /home/worker/workspace env: TARGET: 'emulator-kk' B2G_DEBUG: 1 diff --git a/testing/taskcluster/tasks/builds/b2g_emulator_kk_opt.yml b/testing/taskcluster/tasks/builds/b2g_emulator_kk_opt.yml index 060e8e3c3cd..e28ad159c5d 100644 --- a/testing/taskcluster/tasks/builds/b2g_emulator_kk_opt.yml +++ b/testing/taskcluster/tasks/builds/b2g_emulator_kk_opt.yml @@ -3,7 +3,7 @@ $inherits: task: workerType: emulator-kk scopes: - - 'docker-worker:cache:build-emulator-kk-opt' + - 'docker-worker:cache:workspace-emulator-kk-opt' metadata: name: '[TC] B2G KK Emulator Opt' @@ -14,7 +14,7 @@ task: payload: cache: - build-emulator-kk-opt: /home/worker/object-folder + workspace-emulator-kk-opt: /home/worker/workspace env: TARGET: 'emulator-kk' diff --git a/testing/taskcluster/tasks/builds/b2g_phone_base.yml b/testing/taskcluster/tasks/builds/b2g_phone_base.yml index 19a05a8d0e1..1e308c2a75c 100644 --- a/testing/taskcluster/tasks/builds/b2g_phone_base.yml +++ b/testing/taskcluster/tasks/builds/b2g_phone_base.yml @@ -13,6 +13,7 @@ task: maxRunTime: 14400 command: + - with_workspace - build-phone.sh extra: diff --git a/testing/taskcluster/tasks/builds/mulet_linux.yml b/testing/taskcluster/tasks/builds/mulet_linux.yml index 4e4ed5b3416..b55ea2ef9b2 100644 --- a/testing/taskcluster/tasks/builds/mulet_linux.yml +++ b/testing/taskcluster/tasks/builds/mulet_linux.yml @@ -7,14 +7,12 @@ task: workerType: b2gbuild-desktop scopes: - - 'docker-worker:cache:sources-gecko' - - 'docker-worker:cache:build-mulet-linux-objects' + - 'docker-worker:cache:build-mulet-linux-workspace' - 'docker-worker:cache:tooltool-cache' payload: cache: - sources-gecko: '/home/worker/gecko' - build-mulet-linux-objects: '/home/worker/object-folder' + build-mulet-linux-workspace: '/home/worker/workspace' tooltool-cache: '/home/worker/tools/tooltool-cache' env: @@ -23,7 +21,11 @@ task: maxRunTime: 3600 command: - - bin/build-mulet-linux.sh + - /bin/bash + - -c + - > + checkout-gecko workspace && + ./workspace/gecko/testing/taskcluster/scripts/builder/build-mulet-linux.sh workspace extra: treeherder: diff --git a/testing/taskcluster/tasks/decision/try.yml b/testing/taskcluster/tasks/decision/try.yml index 692645dc6eb..b9dfeebdd02 100644 --- a/testing/taskcluster/tasks/decision/try.yml +++ b/testing/taskcluster/tasks/decision/try.yml @@ -56,7 +56,7 @@ tasks: # Note: This task is built server side without the context or tooling that # exist in tree so we must hard code the version - image: 'quay.io/mozilla/decision:0.0.3' + image: 'quay.io/mozilla/builder:0.3.0' # Virtually no network or other potentially risky operations happen as part # of the task timeout aside from the initial clone. We intentionally have @@ -68,7 +68,7 @@ tasks: - /bin/bash - -cx - > - source $(which entrypoint) && + source ./bin/decision.sh && ./mach taskcluster-graph --project='{{project}}' --message='{{comment}}' From 5bcf0f9e08044814ba83e96f3ff932f760f17f6e Mon Sep 17 00:00:00 2001 From: "jlal@mozilla.com" Date: Mon, 23 Feb 2015 21:50:39 -0800 Subject: [PATCH 04/68] Bug 1131157 - Add buildbot lines to mulet/b2g-desktop/emulator r=wcosta --- testing/taskcluster/tasks/builds/b2g_desktop_base.yml | 3 ++- testing/taskcluster/tasks/builds/b2g_emulator_base.yml | 3 ++- testing/taskcluster/tasks/builds/mulet_linux.yml | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/testing/taskcluster/tasks/builds/b2g_desktop_base.yml b/testing/taskcluster/tasks/builds/b2g_desktop_base.yml index bb1045f0f4f..9a9f7f8f63c 100644 --- a/testing/taskcluster/tasks/builds/b2g_desktop_base.yml +++ b/testing/taskcluster/tasks/builds/b2g_desktop_base.yml @@ -17,7 +17,8 @@ task: - -c - > checkout-gecko workspace && - ./workspace/gecko/testing/taskcluster/scripts/builder/build-b2g-desktop.sh workspace + cd ./workspace/gecko/testing/taskcluster/scripts/builder && + buildbot_step 'Build' ./build-b2g-desktop.sh $HOME/workspace extra: treeherder: diff --git a/testing/taskcluster/tasks/builds/b2g_emulator_base.yml b/testing/taskcluster/tasks/builds/b2g_emulator_base.yml index e584517af52..3f5d9ae3f69 100644 --- a/testing/taskcluster/tasks/builds/b2g_emulator_base.yml +++ b/testing/taskcluster/tasks/builds/b2g_emulator_base.yml @@ -18,7 +18,8 @@ task: - -c - > checkout-gecko workspace && - ./workspace/gecko/testing/taskcluster/scripts/builder/build-emulator.sh workspace + cd ./workspace/gecko/testing/taskcluster/scripts/builder && + buildbot_step 'Build' ./build-emulator.sh $HOME/workspace extra: # Rather then enforcing particular conventions we require that all build diff --git a/testing/taskcluster/tasks/builds/mulet_linux.yml b/testing/taskcluster/tasks/builds/mulet_linux.yml index b55ea2ef9b2..1a24ba5d16b 100644 --- a/testing/taskcluster/tasks/builds/mulet_linux.yml +++ b/testing/taskcluster/tasks/builds/mulet_linux.yml @@ -25,7 +25,8 @@ task: - -c - > checkout-gecko workspace && - ./workspace/gecko/testing/taskcluster/scripts/builder/build-mulet-linux.sh workspace + cd ./workspace/gecko/testing/taskcluster/scripts/builder && + buildbot_step 'Build' ./build-mulet-linux.sh $HOME/workspace extra: treeherder: From e9219b698309f1b45911ccbe3591388902d20c26 Mon Sep 17 00:00:00 2001 From: "jlal@mozilla.com" Date: Mon, 23 Feb 2015 21:54:42 -0800 Subject: [PATCH 05/68] Bug 1136020 - Update try decision task to use cache and more recent version of builder r=garndt --- testing/taskcluster/tasks/decision/try.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/testing/taskcluster/tasks/decision/try.yml b/testing/taskcluster/tasks/decision/try.yml index b9dfeebdd02..b162de05a27 100644 --- a/testing/taskcluster/tasks/decision/try.yml +++ b/testing/taskcluster/tasks/decision/try.yml @@ -52,11 +52,12 @@ tasks: # The taskcluster-vcs tooling stores the large clone caches in this # directory and will reuse them for new requests this saves about 20s~ and # is the most generic cache possible. - tc-vcs-public-sources: '/home/worker/.tc-vcs/' + tc-vcs-public-sources: /home/worker/.tc-vcs/ + gecko-decision: /home/worker/workspace # Note: This task is built server side without the context or tooling that # exist in tree so we must hard code the version - image: 'quay.io/mozilla/builder:0.3.0' + image: 'quay.io/mozilla/builder:0.5.0' # Virtually no network or other potentially risky operations happen as part # of the task timeout aside from the initial clone. We intentionally have @@ -68,7 +69,8 @@ tasks: - /bin/bash - -cx - > - source ./bin/decision.sh && + checkout-gecko workspace && + cd workspace/gecko && ./mach taskcluster-graph --project='{{project}}' --message='{{comment}}' From a294d39a29ce75586ffc7666437f7df7f41a813b Mon Sep 17 00:00:00 2001 From: "jlal@mozilla.com" Date: Tue, 24 Feb 2015 00:36:39 -0800 Subject: [PATCH 06/68] Bug 1136026 - Ensure ccache has enough space and is tied to specific caches r=wcosta --- testing/taskcluster/scripts/builder/build-b2g-desktop.sh | 2 ++ testing/taskcluster/scripts/builder/build-emulator.sh | 2 ++ testing/taskcluster/scripts/builder/build-mulet-linux.sh | 2 ++ testing/taskcluster/scripts/builder/desktop-setup.sh | 2 ++ testing/taskcluster/scripts/builder/setup-ccache.sh | 9 +++++++++ 5 files changed, 17 insertions(+) create mode 100644 testing/taskcluster/scripts/builder/setup-ccache.sh diff --git a/testing/taskcluster/scripts/builder/build-b2g-desktop.sh b/testing/taskcluster/scripts/builder/build-b2g-desktop.sh index 79a2addb88e..16176b381f9 100755 --- a/testing/taskcluster/scripts/builder/build-b2g-desktop.sh +++ b/testing/taskcluster/scripts/builder/build-b2g-desktop.sh @@ -38,4 +38,6 @@ mv *.linux-x86_64.tar.bz2 $HOME/artifacts/target.linux-x86_64.tar.bz2 mv *.linux-x86_64.json $HOME/artifacts/target.linux-x86_64.json mv *.tests.zip $HOME/artifacts/target.tests.zip +ccache -s + ################################### build.sh ################################### diff --git a/testing/taskcluster/scripts/builder/build-emulator.sh b/testing/taskcluster/scripts/builder/build-emulator.sh index 36a6418b817..ab08b989c7c 100755 --- a/testing/taskcluster/scripts/builder/build-emulator.sh +++ b/testing/taskcluster/scripts/builder/build-emulator.sh @@ -62,3 +62,5 @@ mv $WORKSPACE/B2G/out/target/product/generic/tests/gaia-tests.zip $HOME/artifact mv $WORKSPACE/B2G/out/target/product/generic/tests/b2g-*.zip $HOME/artifacts/b2g-tests.zip mv $WORKSPACE/B2G/out/emulator.tar.gz $HOME/artifacts/emulator.tar.gz mv $WORKSPACE/B2G/objdir-gecko/dist/b2g-*.crashreporter-symbols.zip $HOME/artifacts/b2g-crashreporter-symbols.zip + +ccache -s diff --git a/testing/taskcluster/scripts/builder/build-mulet-linux.sh b/testing/taskcluster/scripts/builder/build-mulet-linux.sh index fde5825b953..26799fa57f4 100755 --- a/testing/taskcluster/scripts/builder/build-mulet-linux.sh +++ b/testing/taskcluster/scripts/builder/build-mulet-linux.sh @@ -33,4 +33,6 @@ mv *.linux-x86_64.json $HOME/artifacts/target.linux-x86_64.json mv *.tests.zip $HOME/artifacts/target.tests.zip mv jsshell-linux-x86_64.zip $HOME/artifacts/jsshell-linux-x86_64.zip +ccache -s + ################################### build.sh ################################### diff --git a/testing/taskcluster/scripts/builder/desktop-setup.sh b/testing/taskcluster/scripts/builder/desktop-setup.sh index a7c727c98ed..e02f056f478 100755 --- a/testing/taskcluster/scripts/builder/desktop-setup.sh +++ b/testing/taskcluster/scripts/builder/desktop-setup.sh @@ -4,6 +4,8 @@ test $MOZCONFIG # mozconfig is required... test -d $1 # workspace must exist at this point... WORKSPACE=$( cd "$1" && pwd ) +. setup-ccache.sh + # Gecko source: export GECKO_DIR=$WORKSPACE/gecko # Gaia source: diff --git a/testing/taskcluster/scripts/builder/setup-ccache.sh b/testing/taskcluster/scripts/builder/setup-ccache.sh new file mode 100644 index 00000000000..3c03b264021 --- /dev/null +++ b/testing/taskcluster/scripts/builder/setup-ccache.sh @@ -0,0 +1,9 @@ +#! /bin/bash -ex + +test -d $1 # workspace must exist at this point... +WORKSPACE=$( cd "$1" && pwd ) + +export CCACHE_DIR=$WORKSPACE/ccache + +ccache -M 12G +ccache -s From 82329ddf665b4dc2af256807aa32f1dc62db80e9 Mon Sep 17 00:00:00 2001 From: "jlal@mozilla.com" Date: Mon, 23 Feb 2015 22:22:48 -0800 Subject: [PATCH 07/68] Bug 1132676 - Add support for try appearning anywhere in commit r=garndt --- .../taskcluster_graph/commit_parser.py | 11 ++++-- .../taskcluster/tests/test_commit_parser.py | 38 +++++++++++++++++++ 2 files changed, 46 insertions(+), 3 deletions(-) diff --git a/testing/taskcluster/taskcluster_graph/commit_parser.py b/testing/taskcluster/taskcluster_graph/commit_parser.py index bc3005c2f17..ff8684e11ef 100644 --- a/testing/taskcluster/taskcluster_graph/commit_parser.py +++ b/testing/taskcluster/taskcluster_graph/commit_parser.py @@ -167,9 +167,14 @@ def parse_commit(message, jobs): # shlex used to ensure we split correctly when giving values to argparse. parts = shlex.split(message) + try_idx = None + for idx, part in enumerate(parts): + if part == TRY_DELIMITER: + try_idx = idx + break - if parts[0] != TRY_DELIMITER: - raise InvalidCommitException('Invalid commit format must start with' + + if try_idx is None: + raise InvalidCommitException('Invalid commit format contain ' + TRY_DELIMITER) # Argument parser based on try flag flags @@ -177,7 +182,7 @@ def parse_commit(message, jobs): parser.add_argument('-b', dest='build_types') parser.add_argument('-p', nargs='?', dest='platforms', const='all', default='all') parser.add_argument('-u', nargs='?', dest='tests', const='all', default='all') - args, unknown = parser.parse_known_args(parts[1:]) + args, unknown = parser.parse_known_args(parts[try_idx:]) # Then builds... if args.build_types is None: diff --git a/testing/taskcluster/tests/test_commit_parser.py b/testing/taskcluster/tests/test_commit_parser.py index 2b1a703096b..10c212bbc19 100755 --- a/testing/taskcluster/tests/test_commit_parser.py +++ b/testing/taskcluster/tests/test_commit_parser.py @@ -80,6 +80,44 @@ class TestCommitParser(unittest.TestCase): result = parse_commit(commit, jobs) self.assertEqual(expected, result) + def test_try_flag_in_middle_of_commit(self): + ''' + The try command prefix may appear anywhere this test ensures that it + works in some common cases. + ''' + commit = 'Bug XXX - I like cheese try: -b o -p all -u none wootbar' + jobs = { + 'flags': { + 'builds': ['linux', 'linux64'], + 'tests': ['web-platform-tests'], + }, + 'builds': { + 'linux': { + 'types': { + 'opt': { + 'task': 'task/linux', + }, + 'debug': { + 'task': 'task/linux-debug' + } + } + }, + }, + 'tests': {} + } + + expected = [ + { + 'task': 'task/linux', + 'dependents': [], + 'additional-parameters': {} + } + ] + + result = parse_commit(commit, jobs) + self.assertEqual(expected, result) + + def test_commit_all_builds_no_tests(self): ''' This test covers the case of all builds but no tests passed -u none From c3f50df05a5e966ef0fa6149ddb0f16bfaa7f7c8 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 24 Feb 2015 15:35:25 -0800 Subject: [PATCH 08/68] Bumping gaia.json for 4 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/e2d7e04ebc1b Author: Jim Porter Desc: Merge pull request #27934 from jimporter/music-async-storage Bug 1129623 - [music] Don't wipe out the album art cache when upgrading ... ======== https://hg.mozilla.org/integration/gaia-central/rev/ab885bdc0d1f Author: Jim Desc: Bug 1129623 - [music] Don't wipe out the album art cache when upgrading the DB ======== https://hg.mozilla.org/integration/gaia-central/rev/e7fa30be49af Author: Jim Porter Desc: Merge pull request #27863 from jimporter/music-fl-art Bug 1128717 - [music] Album art in ForwardLocked files won't work ======== https://hg.mozilla.org/integration/gaia-central/rev/51e8611ae24e Author: Jim Desc: Bug 1128717 - [music] Album art in ForwardLocked files won't work --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 2fbec3916b7..c90ed99e6de 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "2e34269bdc7ef56ccca5bea8e3470e9efcbf92ce", + "git_revision": "6dbdca8c2ffe8cca445e057fea8289731d132c88", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "0ba5611497a32a7f985d4775b3c30c5c6ba7a51e", + "revision": "e2d7e04ebc1b2f3b52dbaa8fc922babef22530dd", "repo_path": "integration/gaia-central" } From d35c3b2cfbd32a41a49b5cdcab8c733622908fcf Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 24 Feb 2015 15:37:49 -0800 Subject: [PATCH 09/68] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 8ea11608377..c27b54e1608 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 005ace52063..660cade1b8e 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index ef73cc87bcc..aa346ea2309 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 46656f731ee..ffeeb48a9d1 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 005ace52063..660cade1b8e 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index cba95f49d60..4c312c3d463 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 0b5952898ae..a71624308c0 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 01f2546bc75..051819a1a18 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index ff169398d4f..cb29e3e7817 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 0f663c5d53a3689ed5abb84f121d81316e15b2a5 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 24 Feb 2015 15:51:55 -0800 Subject: [PATCH 10/68] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/b70c6689d3de Author: autolander Desc: Bug 1136362 - merge pull request #28430 from asutherland:email-imap-logging to mozilla-b2g:master ======== https://hg.mozilla.org/integration/gaia-central/rev/4f7e51dd54f3 Author: Andrew Sutherland Desc: Bug 1136362 - [email/IMAP] upgrade browserbox and imap-handler libs to get IMAP protocol logging. r=asuth land https://github.com/mozilla-b2g/gaia-email-libs-and-more/pull/372 --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index c90ed99e6de..6b0a3936c8c 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "6dbdca8c2ffe8cca445e057fea8289731d132c88", + "git_revision": "e4a5a54c0891a1cc964b2d94918408f2625c7aaa", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "e2d7e04ebc1b2f3b52dbaa8fc922babef22530dd", + "revision": "b70c6689d3ded57b3dd70c77b42427e7b77b81ea", "repo_path": "integration/gaia-central" } From 336d32d8c02d6af29a1701941d64ab9fcb523be1 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 24 Feb 2015 15:54:23 -0800 Subject: [PATCH 11/68] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index c27b54e1608..89f265a8f88 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 660cade1b8e..153fb1dcd0e 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index aa346ea2309..3571385d194 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index ffeeb48a9d1..fd52972b518 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 660cade1b8e..153fb1dcd0e 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 4c312c3d463..7b8fc6a4ceb 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index a71624308c0..2ab47cca30b 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 051819a1a18..0bc155ef124 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index cb29e3e7817..86b50aab587 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 8e7395b8b6627eee43fd6ff99ae38e292eadc4a5 Mon Sep 17 00:00:00 2001 From: John Dai Date: Thu, 12 Feb 2015 19:18:00 +0800 Subject: [PATCH 12/68] Bug 1120805 - Remove deprecated xpcshell test functions used in RIL test code. r=echen --- dom/system/gonk/tests/header_helpers.js | 33 - .../tests/test_ril_worker_barring_password.js | 16 +- dom/system/gonk/tests/test_ril_worker_buf.js | 42 +- .../tests/test_ril_worker_cdma_info_rec.js | 34 +- .../tests/test_ril_worker_cellbroadcast.js | 44 +- .../test_ril_worker_cellbroadcast_config.js | 14 +- dom/system/gonk/tests/test_ril_worker_cf.js | 26 +- dom/system/gonk/tests/test_ril_worker_clip.js | 10 +- dom/system/gonk/tests/test_ril_worker_clir.js | 20 +- dom/system/gonk/tests/test_ril_worker_cw.js | 24 +- dom/system/gonk/tests/test_ril_worker_ecm.js | 50 +- .../tests/test_ril_worker_icc_BerTlvHelper.js | 16 +- .../tests/test_ril_worker_icc_CardLock.js | 68 +- .../tests/test_ril_worker_icc_CardState.js | 10 +- .../tests/test_ril_worker_icc_GsmPDUHelper.js | 36 +- .../test_ril_worker_icc_ICCContactHelper.js | 68 +- .../tests/test_ril_worker_icc_ICCIOHelper.js | 20 +- .../tests/test_ril_worker_icc_ICCPDUHelper.js | 98 +-- .../test_ril_worker_icc_ICCRecordHelper.js | 116 +-- .../test_ril_worker_icc_ICCUtilsHelper.js | 40 +- .../tests/test_ril_worker_icc_IconLoader.js | 22 +- .../test_ril_worker_icc_SimRecordHelper.js | 140 ++-- dom/system/gonk/tests/test_ril_worker_mmi.js | 90 +-- .../gonk/tests/test_ril_worker_mmi_cf.js | 22 +- dom/system/gonk/tests/test_ril_worker_ruim.js | 34 +- dom/system/gonk/tests/test_ril_worker_sms.js | 4 +- .../gonk/tests/test_ril_worker_sms_cdma.js | 20 +- .../test_ril_worker_sms_cdmapduhelper.js | 10 +- .../tests/test_ril_worker_sms_gsmpduhelper.js | 18 +- .../tests/test_ril_worker_sms_nl_tables.js | 24 +- .../tests/test_ril_worker_sms_segment_info.js | 4 +- dom/system/gonk/tests/test_ril_worker_ssn.js | 6 +- dom/system/gonk/tests/test_ril_worker_stk.js | 660 +++++++++--------- .../tests/test_ril_worker_voiceprivacy.js | 12 +- 34 files changed, 911 insertions(+), 940 deletions(-) diff --git a/dom/system/gonk/tests/header_helpers.js b/dom/system/gonk/tests/header_helpers.js index 8c36e1c6645..75f5bd70124 100644 --- a/dom/system/gonk/tests/header_helpers.js +++ b/dom/system/gonk/tests/header_helpers.js @@ -191,36 +191,3 @@ function newIncomingParcel(fakeParcelSize, response, request, data) { return bytes; } - -/** - * Test whether specified function throws exception with expected - * result. - * - * @param func - * Function to be tested. - * @param message - * Message of expected exception. null for no throws. - * @param stack - * Optional stack object to be printed. null for - * Components#stack#caller. - */ -function do_check_throws(func, message, stack) -{ - if (!stack) - stack = Components.stack.caller; - - try { - func(); - } catch (exc) { - if (exc.message === message) { - return; - } - do_throw("expecting exception '" + message - + "', caught '" + exc.message + "'", stack); - } - - if (message) { - do_throw("expecting exception '" + message + "', none thrown", stack); - } -} - diff --git a/dom/system/gonk/tests/test_ril_worker_barring_password.js b/dom/system/gonk/tests/test_ril_worker_barring_password.js index 1b1f1660314..0acb356a82f 100644 --- a/dom/system/gonk/tests/test_ril_worker_barring_password.js +++ b/dom/system/gonk/tests/test_ril_worker_barring_password.js @@ -18,16 +18,16 @@ add_test(function test_change_call_barring_password() { function do_test(facility, pin, newPin) { buf.sendParcel = function fakeSendParcel () { // Request Type. - do_check_eq(this.readInt32(), REQUEST_CHANGE_BARRING_PASSWORD); + equal(this.readInt32(), REQUEST_CHANGE_BARRING_PASSWORD); // Token : we don't care. this.readInt32(); let parcel = this.readStringList(); - do_check_eq(parcel.length, 3); - do_check_eq(parcel[0], facility); - do_check_eq(parcel[1], pin); - do_check_eq(parcel[2], newPin); + equal(parcel.length, 3); + equal(parcel[0], facility); + equal(parcel[1], pin); + equal(parcel[2], newPin); }; let options = {facility: facility, pin: pin, newPin: newPin}; @@ -43,9 +43,9 @@ add_test(function test_check_change_call_barring_password_result() { let barringPasswordOptions; let worker = newWorker({ postMessage: function(message) { - do_check_eq(barringPasswordOptions.pin, PIN); - do_check_eq(barringPasswordOptions.newPin, NEW_PIN); - do_check_eq(message.errorMsg, GECKO_ERROR_SUCCESS); + equal(barringPasswordOptions.pin, PIN); + equal(barringPasswordOptions.newPin, NEW_PIN); + equal(message.errorMsg, GECKO_ERROR_SUCCESS); } }); diff --git a/dom/system/gonk/tests/test_ril_worker_buf.js b/dom/system/gonk/tests/test_ril_worker_buf.js index 00e03730ff2..30054a88151 100644 --- a/dom/system/gonk/tests/test_ril_worker_buf.js +++ b/dom/system/gonk/tests/test_ril_worker_buf.js @@ -50,10 +50,12 @@ function add_test_incoming_parcel(parcel, handler) { add_test_incoming_parcel(null, function test_normal_parcel_handling() { let self = this; - do_check_throws(function normal_handler() { + try { // reads exactly the same size, should not throw anything. self.context.Buf.readInt32(); - }); + } catch (e) { + ok(false, "Got exception: " + e); + } } ); @@ -61,10 +63,12 @@ add_test_incoming_parcel(null, add_test_incoming_parcel(null, function test_parcel_under_read() { let self = this; - do_check_throws(function under_read_handler() { + try { // reads less than parcel size, should not throw. self.context.Buf.readUint16(); - }); + } catch (e) { + ok(false, "Got exception: " + e); + } } ); @@ -78,7 +82,7 @@ add_test_incoming_parcel(null, buf.readUint8(); } - do_check_throws(function over_read_handler() { + throws(function over_read_handler() { // reads more than parcel size, should throw an error. buf.readUint8(); },"Trying to read data beyond the parcel end!"); @@ -133,14 +137,14 @@ add_test(function test_incoming_parcel_buffer_overwritten() { let p1 = pA.subarray(0, pA.length - 1); worker.onRILMessage(0, p1); // The parcel should not have been processed. - do_check_eq(buf.readAvailable, 0); + equal(buf.readAvailable, 0); // buf.currentParcelSize should have been set because incoming data has more // than 4 octets. - do_check_eq(buf.currentParcelSize, pA_parcelSize); + equal(buf.currentParcelSize, pA_parcelSize); // buf.readIncoming should contains remaining unconsumed octets count. - do_check_eq(buf.readIncoming, p1.length - buf.PARCEL_SIZE_SIZE); + equal(buf.readIncoming, p1.length - buf.PARCEL_SIZE_SIZE); // buf.incomingWriteIndex should be ready to accept the last octet. - do_check_eq(buf.incomingWriteIndex, p1.length); + equal(buf.incomingWriteIndex, p1.length); // Second, send the last octet of pA and whole pB. The Buf should now expand // to cover both pA & pB. @@ -149,13 +153,13 @@ add_test(function test_incoming_parcel_buffer_overwritten() { p2.set(pB, 1); worker.onRILMessage(0, p2); // The parcels should have been both consumed. - do_check_eq(buf.readAvailable, 0); + equal(buf.readAvailable, 0); // No parcel data remains. - do_check_eq(buf.currentParcelSize, 0); + equal(buf.currentParcelSize, 0); // No parcel data remains. - do_check_eq(buf.readIncoming, 0); + equal(buf.readIncoming, 0); // The Buf should now expand to cover both pA & pB. - do_check_eq(buf.incomingWriteIndex, pA.length + pB.length); + equal(buf.incomingWriteIndex, pA.length + pB.length); // end of incoming parcel's trip, let's do next test. run_next_test(); @@ -167,15 +171,15 @@ add_test_incoming_parcel(null, let buf = this.context.Buf; let u8array = buf.readUint8Array(1); - do_check_eq(u8array instanceof Uint8Array, true); - do_check_eq(u8array.length, 1); - do_check_eq(buf.readAvailable, 3); + equal(u8array instanceof Uint8Array, true); + equal(u8array.length, 1); + equal(buf.readAvailable, 3); u8array = buf.readUint8Array(2); - do_check_eq(u8array.length, 2); - do_check_eq(buf.readAvailable, 1); + equal(u8array.length, 2); + equal(buf.readAvailable, 1); - do_check_throws(function over_read_handler() { + throws(function over_read_handler() { // reads more than parcel size, should throw an error. u8array = buf.readUint8Array(2); }, "Trying to read data beyond the parcel end!"); diff --git a/dom/system/gonk/tests/test_ril_worker_cdma_info_rec.js b/dom/system/gonk/tests/test_ril_worker_cdma_info_rec.js index 3eaab37efaf..335c0c403d7 100644 --- a/dom/system/gonk/tests/test_ril_worker_cdma_info_rec.js +++ b/dom/system/gonk/tests/test_ril_worker_cdma_info_rec.js @@ -59,7 +59,7 @@ add_test(function test_display() { let helper = context.CdmaPDUHelper; let records = helper.decodeInformationRecord(); - do_check_eq(records[0].display, "Test Info"); + equal(records[0].display, "Test Info"); run_next_test(); }); @@ -79,7 +79,7 @@ add_test(function test_extended_display() { let helper = context.CdmaPDUHelper; let records = helper.decodeInformationRecord(); - do_check_eq(records[0].display, "Test Extended Info"); + equal(records[0].display, "Test Extended Info"); run_next_test(); }); @@ -102,8 +102,8 @@ add_test(function test_mixed() { let helper = context.CdmaPDUHelper; let records = helper.decodeInformationRecord(); - do_check_eq(records[0].display, "Test Info 1"); - do_check_eq(records[1].display, "Test Info 2"); + equal(records[0].display, "Test Info 1"); + equal(records[1].display, "Test Info 2"); run_next_test(); }); @@ -126,8 +126,8 @@ add_test(function test_multiple() { let helper = context.CdmaPDUHelper; let records = helper.decodeInformationRecord(); - do_check_eq(records[0].display, "Test Info 1"); - do_check_eq(records[1].display, "Test Info 2"); + equal(records[0].display, "Test Info 1"); + equal(records[1].display, "Test Info 2"); run_next_test(); }); @@ -147,9 +147,9 @@ add_test(function test_signal() { let helper = context.CdmaPDUHelper; let records = helper.decodeInformationRecord(); - do_check_eq(records[0].signal.type, 0x00); - do_check_eq(records[0].signal.alertPitch, 0x01); - do_check_eq(records[0].signal.signal, 0x03); + equal(records[0].signal.type, 0x00); + equal(records[0].signal.alertPitch, 0x01); + equal(records[0].signal.signal, 0x03); run_next_test(); }); @@ -169,7 +169,7 @@ add_test(function test_signal_not_present() { let helper = context.CdmaPDUHelper; let records = helper.decodeInformationRecord(); - do_check_eq(records.length, 0); + equal(records.length, 0); run_next_test(); }); @@ -189,10 +189,10 @@ add_test(function test_line_control() { let helper = context.CdmaPDUHelper; let records = helper.decodeInformationRecord(); - do_check_eq(records[0].lineControl.polarityIncluded, 1); - do_check_eq(records[0].lineControl.toggle, 0); - do_check_eq(records[0].lineControl.reverse, 1); - do_check_eq(records[0].lineControl.powerDenial, 255); + equal(records[0].lineControl.polarityIncluded, 1); + equal(records[0].lineControl.toggle, 0); + equal(records[0].lineControl.reverse, 1); + equal(records[0].lineControl.powerDenial, 255); run_next_test(); }); @@ -209,7 +209,7 @@ add_test(function test_clir() { let helper = context.CdmaPDUHelper; let records = helper.decodeInformationRecord(); - do_check_eq(records[0].clirCause, 1); + equal(records[0].clirCause, 1); run_next_test(); }); @@ -227,8 +227,8 @@ add_test(function test_clir() { let helper = context.CdmaPDUHelper; let records = helper.decodeInformationRecord(); - do_check_eq(records[0].audioControl.upLink, 1); - do_check_eq(records[0].audioControl.downLink, 255); + equal(records[0].audioControl.upLink, 1); + equal(records[0].audioControl.downLink, 255); run_next_test(); }); diff --git a/dom/system/gonk/tests/test_ril_worker_cellbroadcast.js b/dom/system/gonk/tests/test_ril_worker_cellbroadcast.js index 2ee3a92e1da..705e2cd184e 100644 --- a/dom/system/gonk/tests/test_ril_worker_cellbroadcast.js +++ b/dom/system/gonk/tests/test_ril_worker_cellbroadcast.js @@ -34,15 +34,15 @@ function hexStringToParcelByteArrayData(hexString) { add_test(function test_ril_consts_cellbroadcast_misc() { // Must be 16 for indexing. - do_check_eq(CB_DCS_LANG_GROUP_1.length, 16); - do_check_eq(CB_DCS_LANG_GROUP_2.length, 16); + equal(CB_DCS_LANG_GROUP_1.length, 16); + equal(CB_DCS_LANG_GROUP_2.length, 16); // Array length must be even. - do_check_eq(CB_NON_MMI_SETTABLE_RANGES.length & 0x01, 0); + equal(CB_NON_MMI_SETTABLE_RANGES.length & 0x01, 0); for (let i = 0; i < CB_NON_MMI_SETTABLE_RANGES.length;) { let from = CB_NON_MMI_SETTABLE_RANGES[i++]; let to = CB_NON_MMI_SETTABLE_RANGES[i++]; - do_check_eq(from < to, true); + equal(from < to, true); } run_next_test(); @@ -67,11 +67,11 @@ add_test(function test_ril_worker_GsmPDUHelper_readCbDataCodingScheme() { let msg = {}; context.GsmPDUHelper.readCbDataCodingScheme(msg); - do_check_eq(msg.dcs, dcs); - do_check_eq(msg.encoding, encoding); - do_check_eq(msg.language, language); - do_check_eq(msg.hasLanguageIndicator, hasLanguageIndicator); - do_check_eq(msg.messageClass, messageClass); + equal(msg.dcs, dcs); + equal(msg.encoding, encoding); + equal(msg.language, language); + equal(msg.hasLanguageIndicator, hasLanguageIndicator); + equal(msg.messageClass, messageClass); } function test_dcs_throws(dcs) { @@ -79,7 +79,7 @@ add_test(function test_ril_worker_GsmPDUHelper_readCbDataCodingScheme() { return dcs; }; - do_check_throws(function() { + throws(function() { context.GsmPDUHelper.readCbDataCodingScheme({}); }, "Unsupported CBS data coding scheme: " + dcs); } @@ -189,15 +189,15 @@ add_test(function test_ril_worker_GsmPDUHelper_readGsmCbData() { }; context.GsmPDUHelper.readGsmCbData(msg, options[3].length); - do_check_eq(msg.body, expected[0]); - do_check_eq(msg.data == null, expected[1] == null); + equal(msg.body, expected[0]); + equal(msg.data == null, expected[1] == null); if (expected[1] != null) { - do_check_eq(msg.data.length, expected[1].length); + equal(msg.data.length, expected[1].length); for (let i = 0; i < expected[1].length; i++) { - do_check_eq(msg.data[i], expected[1][i]); + equal(msg.data[i], expected[1][i]); } } - do_check_eq(msg.language, expected[2]); + equal(msg.language, expected[2]); } // We're testing Cell Broadcast message body with all zeros octet stream. As @@ -249,7 +249,7 @@ add_test(function test_ril_worker__checkCellBroadcastMMISettable() { let ril = context.RIL; function test(from, to, expected) { - do_check_eq(expected, ril._checkCellBroadcastMMISettable(from, to)); + equal(expected, ril._checkCellBroadcastMMISettable(from, to)); } test(-2, -1, false); @@ -301,7 +301,7 @@ add_test(function test_ril_worker__mergeCellBroadcastConfigs() { function test(olist, from, to, expected) { let result = ril._mergeCellBroadcastConfigs(olist, from, to); - do_check_eq(JSON.stringify(expected), JSON.stringify(result)); + equal(JSON.stringify(expected), JSON.stringify(result)); } test(null, 0, 1, [0, 1]); @@ -488,8 +488,8 @@ add_test(function test_GsmPDUHelper_readUmtsCbMessage_MultiParts() { hexStringToParcelByteArrayData(pdu))); let postedMessage = workerHelper.postedMessage; - do_check_eq("cellbroadcast-received", postedMessage.rilMessageType); - do_check_eq(postedMessage.fullBody.length, + equal("cellbroadcast-received", postedMessage.rilMessageType); + equal(postedMessage.fullBody.length, aNumOfPages * CB_MAX_CONTENT_PER_PAGE_7BIT); } @@ -534,11 +534,11 @@ add_test(function test_GsmPDUHelper_readUmtsCbMessage_Binary() { hexStringToParcelByteArrayData(pdu))); let postedMessage = workerHelper.postedMessage; - do_check_eq("cellbroadcast-received", postedMessage.rilMessageType); - do_check_eq(postedMessage.fullData.length, + equal("cellbroadcast-received", postedMessage.rilMessageType); + equal(postedMessage.fullData.length, aNumOfPages * CB_UMTS_MESSAGE_PAGE_SIZE); for (let i = 0; i < postedMessage.fullData.length; i++) { - do_check_eq(postedMessage.fullData[i], 255); + equal(postedMessage.fullData[i], 255); } } diff --git a/dom/system/gonk/tests/test_ril_worker_cellbroadcast_config.js b/dom/system/gonk/tests/test_ril_worker_cellbroadcast_config.js index 68dc4ef6790..aa1a5616bb2 100644 --- a/dom/system/gonk/tests/test_ril_worker_cellbroadcast_config.js +++ b/dom/system/gonk/tests/test_ril_worker_cellbroadcast_config.js @@ -36,8 +36,8 @@ add_test(function test_ril_worker_cellbroadcast_activate() { setup(isCdma); context.RIL.setCellBroadcastDisabled({disabled: true}); // Makesure that request parcel is sent out. - do_check_neq(parcelTypes.indexOf(expectedRequest), -1); - do_check_eq(context.RIL.cellBroadcastDisabled, true); + notEqual(parcelTypes.indexOf(expectedRequest), -1); + equal(context.RIL.cellBroadcastDisabled, true); } test(false, REQUEST_GSM_SMS_BROADCAST_ACTIVATION); @@ -81,14 +81,14 @@ add_test(function test_ril_worker_cellbroadcast_config() { found = true; // Check parcel. Data start from 4th word (32bit) - do_check_eq(u32Parcel.slice(3).toString(), expected); + equal(u32Parcel.slice(3).toString(), expected); }; context.RIL._isCdma = isCdma; context.RIL.setSmsBroadcastConfig(configs); // Makesure that request parcel is sent out. - do_check_true(found); + ok(found); } // (GSM) RIL writes the following data to outgoing parcel: @@ -121,7 +121,7 @@ add_test(function test_ril_worker_cellbroadcast_merge_config() { context.RIL._isCdma = isCdma; context.RIL.cellBroadcastConfigs = configs; context.RIL._mergeAllCellBroadcastConfigs(); - do_check_eq(context.RIL.mergedCellBroadcastConfig.toString(), expected); + equal(context.RIL.mergedCellBroadcastConfig.toString(), expected); } let configs = { @@ -155,8 +155,8 @@ add_test(function test_ril_worker_cellbroadcast_set_search_list() { let options = { searchList: aSearchList }; context.RIL.setCellBroadcastSearchList(options); // Enforce the MMI result to string for comparison. - do_check_eq("" + context.RIL.cellBroadcastConfigs.MMI, aExpected); - do_check_eq(options.success, true); + equal("" + context.RIL.cellBroadcastConfigs.MMI, aExpected); + equal(options.success, true); } let searchListStr = "1,2,3,4"; diff --git a/dom/system/gonk/tests/test_ril_worker_cf.js b/dom/system/gonk/tests/test_ril_worker_cf.js index 5e2a603e896..955af10423d 100644 --- a/dom/system/gonk/tests/test_ril_worker_cf.js +++ b/dom/system/gonk/tests/test_ril_worker_cf.js @@ -23,7 +23,7 @@ function toaFromString(number) { add_test(function test_toaFromString_empty() { let retval = toaFromString(""); - do_check_eq(retval, TOA_UNKNOWN); + equal(retval, TOA_UNKNOWN); run_next_test(); }); @@ -31,7 +31,7 @@ add_test(function test_toaFromString_empty() { add_test(function test_toaFromString_undefined() { let retval = toaFromString(); - do_check_eq(retval, TOA_UNKNOWN); + equal(retval, TOA_UNKNOWN); run_next_test(); }); @@ -39,7 +39,7 @@ add_test(function test_toaFromString_undefined() { add_test(function test_toaFromString_unknown() { let retval = toaFromString("666222333"); - do_check_eq(retval, TOA_UNKNOWN); + equal(retval, TOA_UNKNOWN); run_next_test(); }); @@ -47,7 +47,7 @@ add_test(function test_toaFromString_unknown() { add_test(function test_toaFromString_international() { let retval = toaFromString("+34666222333"); - do_check_eq(retval, TOA_INTERNATIONAL); + equal(retval, TOA_INTERNATIONAL); run_next_test(); }); @@ -73,8 +73,8 @@ add_test(function test_setCallForward_unconditional() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, GECKO_ERROR_SUCCESS); - do_check_true(postedMessage.success); + equal(postedMessage.errorMsg, GECKO_ERROR_SUCCESS); + ok(postedMessage.success); run_next_test(); }); @@ -122,13 +122,13 @@ add_test(function test_queryCallForwardStatus_unconditional() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, GECKO_ERROR_SUCCESS); - do_check_true(postedMessage.success); - do_check_true(Array.isArray(postedMessage.rules)); + equal(postedMessage.errorMsg, GECKO_ERROR_SUCCESS); + ok(postedMessage.success); + ok(Array.isArray(postedMessage.rules)); do_print(postedMessage.rules.length); - do_check_eq(postedMessage.rules.length, 1); - do_check_true(postedMessage.rules[0].active); - do_check_eq(postedMessage.rules[0].reason, CALL_FORWARD_REASON_UNCONDITIONAL); - do_check_eq(postedMessage.rules[0].number, "+34666222333"); + equal(postedMessage.rules.length, 1); + ok(postedMessage.rules[0].active); + equal(postedMessage.rules[0].reason, CALL_FORWARD_REASON_UNCONDITIONAL); + equal(postedMessage.rules[0].number, "+34666222333"); run_next_test(); }); diff --git a/dom/system/gonk/tests/test_ril_worker_clip.js b/dom/system/gonk/tests/test_ril_worker_clip.js index b2c9a530573..29c42148ac0 100644 --- a/dom/system/gonk/tests/test_ril_worker_clip.js +++ b/dom/system/gonk/tests/test_ril_worker_clip.js @@ -30,9 +30,9 @@ add_test(function test_queryCLIP_provisioned() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, undefined); - do_check_true(postedMessage.success); - do_check_eq(postedMessage.provisioned, 1); + equal(postedMessage.errorMsg, undefined); + ok(postedMessage.success); + equal(postedMessage.provisioned, 1); run_next_test(); }); @@ -59,7 +59,7 @@ add_test(function test_getCLIP_error_generic_failure_invalid_length() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, "GenericFailure"); - do_check_false(postedMessage.success); + equal(postedMessage.errorMsg, "GenericFailure"); + ok(!postedMessage.success); run_next_test(); }); diff --git a/dom/system/gonk/tests/test_ril_worker_clir.js b/dom/system/gonk/tests/test_ril_worker_clir.js index 66e6d5a979a..98ffb0b5921 100644 --- a/dom/system/gonk/tests/test_ril_worker_clir.js +++ b/dom/system/gonk/tests/test_ril_worker_clir.js @@ -34,8 +34,8 @@ add_test(function test_setCLIR_success() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, undefined); - do_check_true(postedMessage.success); + equal(postedMessage.errorMsg, undefined); + ok(postedMessage.success); run_next_test(); }); @@ -58,8 +58,8 @@ add_test(function test_setCLIR_generic_failure() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, "GenericFailure"); - do_check_false(postedMessage.success); + equal(postedMessage.errorMsg, "GenericFailure"); + ok(!postedMessage.success); run_next_test(); }); @@ -90,10 +90,10 @@ add_test(function test_getCLIR_n0_m1() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, undefined); - do_check_true(postedMessage.success); - do_check_eq(postedMessage.n, 0); - do_check_eq(postedMessage.m, 1); + equal(postedMessage.errorMsg, undefined); + ok(postedMessage.success); + equal(postedMessage.n, 0); + equal(postedMessage.m, 1); run_next_test(); }); @@ -123,7 +123,7 @@ add_test(function test_getCLIR_error_generic_failure_invalid_length() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, "GenericFailure"); - do_check_false(postedMessage.success); + equal(postedMessage.errorMsg, "GenericFailure"); + ok(!postedMessage.success); run_next_test(); }); diff --git a/dom/system/gonk/tests/test_ril_worker_cw.js b/dom/system/gonk/tests/test_ril_worker_cw.js index 7cd2c36c228..34dc857a4b2 100644 --- a/dom/system/gonk/tests/test_ril_worker_cw.js +++ b/dom/system/gonk/tests/test_ril_worker_cw.js @@ -24,8 +24,8 @@ add_test(function test_setCallWaiting_success() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, undefined); - do_check_true(postedMessage.success); + equal(postedMessage.errorMsg, undefined); + ok(postedMessage.success); run_next_test(); }); @@ -47,8 +47,8 @@ add_test(function test_setCallWaiting_generic_failure() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, "GenericFailure"); - do_check_false(postedMessage.success); + equal(postedMessage.errorMsg, "GenericFailure"); + ok(!postedMessage.success); run_next_test(); }); @@ -77,10 +77,10 @@ add_test(function test_queryCallWaiting_success_enabled_true() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, undefined); - do_check_true(postedMessage.success); - do_check_eq(postedMessage.length, 1); - do_check_true(postedMessage.enabled); + equal(postedMessage.errorMsg, undefined); + ok(postedMessage.success); + equal(postedMessage.length, 1); + ok(postedMessage.enabled); run_next_test(); }); @@ -108,9 +108,9 @@ add_test(function test_queryCallWaiting_success_enabled_false() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, undefined); - do_check_true(postedMessage.success); - do_check_eq(postedMessage.length, 1); - do_check_false(postedMessage.enabled); + equal(postedMessage.errorMsg, undefined); + ok(postedMessage.success); + equal(postedMessage.length, 1); + ok(!postedMessage.enabled); run_next_test(); }); diff --git a/dom/system/gonk/tests/test_ril_worker_ecm.js b/dom/system/gonk/tests/test_ril_worker_ecm.js index 2bf063fb929..7b74b60088b 100644 --- a/dom/system/gonk/tests/test_ril_worker_ecm.js +++ b/dom/system/gonk/tests/test_ril_worker_ecm.js @@ -17,17 +17,17 @@ const TIMEOUT_VALUE = 300000; // 5 mins. function setTimeout(callback, timeoutMs) { timeoutCallback = callback; timeoutDelayMs = timeoutMs; - do_check_eq(timeoutMs, TIMEOUT_VALUE); + equal(timeoutMs, TIMEOUT_VALUE); return TIMER_ID; } function clearTimeout(timeoutId) { - do_check_eq(timeoutId, TIMER_ID); + equal(timeoutId, TIMER_ID); timeoutCallback = null; } function fireTimeout() { - do_check_neq(timeoutCallback, null); + notEqual(timeoutCallback, null); if (timeoutCallback) { timeoutCallback(); timeoutCallback = null; @@ -45,15 +45,15 @@ add_test(function test_enter_emergencyCbMode() { let postedMessage = workerHelper.postedMessage; // Should store the mode. - do_check_eq(context.RIL._isInEmergencyCbMode, true); + equal(context.RIL._isInEmergencyCbMode, true); // Should notify change. - do_check_eq(postedMessage.rilMessageType, "emergencyCbModeChange"); - do_check_eq(postedMessage.active, true); - do_check_eq(postedMessage.timeoutMs, TIMEOUT_VALUE); + equal(postedMessage.rilMessageType, "emergencyCbModeChange"); + equal(postedMessage.active, true); + equal(postedMessage.timeoutMs, TIMEOUT_VALUE); // Should start timer. - do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID); + equal(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID); } run_next_test(); @@ -69,14 +69,14 @@ add_test(function test_exit_emergencyCbMode() { let postedMessage = workerHelper.postedMessage; // Should store the mode. - do_check_eq(context.RIL._isInEmergencyCbMode, false); + equal(context.RIL._isInEmergencyCbMode, false); // Should notify change. - do_check_eq(postedMessage.rilMessageType, "emergencyCbModeChange"); - do_check_eq(postedMessage.active, false); + equal(postedMessage.rilMessageType, "emergencyCbModeChange"); + equal(postedMessage.active, false); // Should clear timer. - do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null); + equal(context.RIL._exitEmergencyCbModeTimeoutID, null); run_next_test(); }); @@ -87,8 +87,8 @@ add_test(function test_request_exit_emergencyCbMode_when_timeout() { let context = worker.ContextPool._contexts[0]; context.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE](); - do_check_eq(context.RIL._isInEmergencyCbMode, true); - do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID); + equal(context.RIL._isInEmergencyCbMode, true); + equal(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID); let parcelTypes = []; context.Buf.newParcel = function(type, options) { @@ -99,10 +99,10 @@ add_test(function test_request_exit_emergencyCbMode_when_timeout() { fireTimeout(); // Should clear timeout event. - do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null); + equal(context.RIL._exitEmergencyCbModeTimeoutID, null); // Check indeed sent out REQUEST_EXIT_EMERGENCY_CALLBACK_MODE. - do_check_neq(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1); + notEqual(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1); run_next_test(); }); @@ -113,8 +113,8 @@ add_test(function test_request_exit_emergencyCbMode_when_dial() { let context = worker.ContextPool._contexts[0]; context.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE](); - do_check_eq(context.RIL._isInEmergencyCbMode, true); - do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID); + equal(context.RIL._isInEmergencyCbMode, true); + equal(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID); let parcelTypes = []; context.Buf.newParcel = function(type, options) { @@ -127,10 +127,10 @@ add_test(function test_request_exit_emergencyCbMode_when_dial() { isDialEmergency: false}); // Should clear timeout event. - do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null); + equal(context.RIL._exitEmergencyCbModeTimeoutID, null); // Check indeed sent out REQUEST_EXIT_EMERGENCY_CALLBACK_MODE. - do_check_neq(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1); + notEqual(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1); run_next_test(); }); @@ -141,8 +141,8 @@ add_test(function test_request_exit_emergencyCbMode_explicitly() { let context = worker.ContextPool._contexts[0]; context.RIL[UNSOLICITED_ENTER_EMERGENCY_CALLBACK_MODE](); - do_check_eq(context.RIL._isInEmergencyCbMode, true); - do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID); + equal(context.RIL._isInEmergencyCbMode, true); + equal(context.RIL._exitEmergencyCbModeTimeoutID, TIMER_ID); let parcelTypes = []; context.Buf.newParcel = function(type, options) { @@ -157,13 +157,13 @@ add_test(function test_request_exit_emergencyCbMode_explicitly() { let postedMessage = workerHelper.postedMessage; // Should clear timeout event. - do_check_eq(context.RIL._exitEmergencyCbModeTimeoutID, null); + equal(context.RIL._exitEmergencyCbModeTimeoutID, null); // Check indeed sent out REQUEST_EXIT_EMERGENCY_CALLBACK_MODE. - do_check_neq(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1); + notEqual(parcelTypes.indexOf(REQUEST_EXIT_EMERGENCY_CALLBACK_MODE), -1); // Send back the response. - do_check_eq(postedMessage.rilMessageType, "exitEmergencyCbMode"); + equal(postedMessage.rilMessageType, "exitEmergencyCbMode"); run_next_test(); }); diff --git a/dom/system/gonk/tests/test_ril_worker_icc_BerTlvHelper.js b/dom/system/gonk/tests/test_ril_worker_icc_BerTlvHelper.js index 954bdebceb9..5bb51d527f6 100644 --- a/dom/system/gonk/tests/test_ril_worker_icc_BerTlvHelper.js +++ b/dom/system/gonk/tests/test_ril_worker_icc_BerTlvHelper.js @@ -35,13 +35,13 @@ add_test(function test_fcp_template_for_transparent_structure() { let berTlv = berHelper.decode(tag_test.length); let iter = Iterator(berTlv.value); let tlv = berHelper.searchForNextTag(BER_FCP_FILE_DESCRIPTOR_TAG, iter); - do_check_eq(tlv.value.fileStructure, UICC_EF_STRUCTURE[EF_STRUCTURE_TRANSPARENT]); + equal(tlv.value.fileStructure, UICC_EF_STRUCTURE[EF_STRUCTURE_TRANSPARENT]); tlv = berHelper.searchForNextTag(BER_FCP_FILE_IDENTIFIER_TAG, iter); - do_check_eq(tlv.value.fileId, 0x2FE2); + equal(tlv.value.fileId, 0x2FE2); tlv = berHelper.searchForNextTag(BER_FCP_FILE_SIZE_DATA_TAG, iter); - do_check_eq(tlv.value.fileSizeData, 0x0A); + equal(tlv.value.fileSizeData, 0x0A); run_next_test(); }); @@ -73,15 +73,15 @@ add_test(function test_fcp_template_for_linear_fixed_structure() { let berTlv = berHelper.decode(tag_test.length); let iter = Iterator(berTlv.value); let tlv = berHelper.searchForNextTag(BER_FCP_FILE_DESCRIPTOR_TAG, iter); - do_check_eq(tlv.value.fileStructure, UICC_EF_STRUCTURE[EF_STRUCTURE_LINEAR_FIXED]); - do_check_eq(tlv.value.recordLength, 0x1A); - do_check_eq(tlv.value.numOfRecords, 0x01); + equal(tlv.value.fileStructure, UICC_EF_STRUCTURE[EF_STRUCTURE_LINEAR_FIXED]); + equal(tlv.value.recordLength, 0x1A); + equal(tlv.value.numOfRecords, 0x01); tlv = berHelper.searchForNextTag(BER_FCP_FILE_IDENTIFIER_TAG, iter); - do_check_eq(tlv.value.fileId, 0x6F40); + equal(tlv.value.fileId, 0x6F40); tlv = berHelper.searchForNextTag(BER_FCP_FILE_SIZE_DATA_TAG, iter); - do_check_eq(tlv.value.fileSizeData, 0x1A); + equal(tlv.value.fileSizeData, 0x1A); run_next_test(); }); diff --git a/dom/system/gonk/tests/test_ril_worker_icc_CardLock.js b/dom/system/gonk/tests/test_ril_worker_icc_CardLock.js index ba35594441f..c0eb0d919bf 100644 --- a/dom/system/gonk/tests/test_ril_worker_icc_CardLock.js +++ b/dom/system/gonk/tests/test_ril_worker_icc_CardLock.js @@ -25,19 +25,19 @@ add_test(function test_icc_get_card_lock_enabled() { buf.sendParcel = function fakeSendParcel() { // Request Type. - do_check_eq(this.readInt32(), REQUEST_QUERY_FACILITY_LOCK) + equal(this.readInt32(), REQUEST_QUERY_FACILITY_LOCK) // Token : we don't care. this.readInt32(); // Data let parcel = this.readStringList(); - do_check_eq(parcel.length, ril.v5Legacy ? 3 : 4); - do_check_eq(parcel[0], GECKO_CARDLOCK_TO_FACILITY[aLock]); - do_check_eq(parcel[1], ""); - do_check_eq(parcel[2], serviceClass.toString()); + equal(parcel.length, ril.v5Legacy ? 3 : 4); + equal(parcel[0], GECKO_CARDLOCK_TO_FACILITY[aLock]); + equal(parcel[1], ""); + equal(parcel[2], serviceClass.toString()); if (!ril.v5Legacy) { - do_check_eq(parcel[3], ril.aid); + equal(parcel[3], ril.aid); } }; @@ -64,16 +64,16 @@ add_test(function test_path_id_for_spid_and_spn() { // Test SIM RIL.appType = CARD_APPTYPE_SIM; - do_check_eq(ICCFileHelper.getEFPath(ICC_EF_SPDI), + equal(ICCFileHelper.getEFPath(ICC_EF_SPDI), EF_PATH_MF_SIM + EF_PATH_DF_GSM); - do_check_eq(ICCFileHelper.getEFPath(ICC_EF_SPN), + equal(ICCFileHelper.getEFPath(ICC_EF_SPN), EF_PATH_MF_SIM + EF_PATH_DF_GSM); // Test USIM RIL.appType = CARD_APPTYPE_USIM; - do_check_eq(ICCFileHelper.getEFPath(ICC_EF_SPDI), + equal(ICCFileHelper.getEFPath(ICC_EF_SPDI), EF_PATH_MF_SIM + EF_PATH_ADF_USIM); - do_check_eq(ICCFileHelper.getEFPath(ICC_EF_SPDI), + equal(ICCFileHelper.getEFPath(ICC_EF_SPDI), EF_PATH_MF_SIM + EF_PATH_ADF_USIM); run_next_test(); }); @@ -96,20 +96,20 @@ add_test(function test_icc_set_card_lock_enabled() { buf.sendParcel = function fakeSendParcel() { // Request Type. - do_check_eq(this.readInt32(), REQUEST_SET_FACILITY_LOCK); + equal(this.readInt32(), REQUEST_SET_FACILITY_LOCK); // Token : we don't care this.readInt32(); // Data let parcel = this.readStringList(); - do_check_eq(parcel.length, ril.v5Legacy ? 4 : 5); - do_check_eq(parcel[0], GECKO_CARDLOCK_TO_FACILITY[aLock]); - do_check_eq(parcel[1], aEnabled ? "1" : "0"); - do_check_eq(parcel[2], aPassword); - do_check_eq(parcel[3], serviceClass.toString()); + equal(parcel.length, ril.v5Legacy ? 4 : 5); + equal(parcel[0], GECKO_CARDLOCK_TO_FACILITY[aLock]); + equal(parcel[1], aEnabled ? "1" : "0"); + equal(parcel[2], aPassword); + equal(parcel[3], serviceClass.toString()); if (!ril.v5Legacy) { - do_check_eq(parcel[4], ril.aid); + equal(parcel[4], ril.aid); } }; @@ -144,18 +144,18 @@ add_test(function test_icc_change_card_lock_password() { buf.sendParcel = function fakeSendParcel() { // Request Type. - do_check_eq(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]); + equal(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]); // Token : we don't care this.readInt32(); // Data let parcel = this.readStringList(); - do_check_eq(parcel.length, ril.v5Legacy ? 2 : 3); - do_check_eq(parcel[0], aPassword); - do_check_eq(parcel[1], aNewPassword); + equal(parcel.length, ril.v5Legacy ? 2 : 3); + equal(parcel[0], aPassword); + equal(parcel[1], aNewPassword); if (!ril.v5Legacy) { - do_check_eq(parcel[2], ril.aid); + equal(parcel[2], ril.aid); } }; @@ -189,17 +189,17 @@ add_test(function test_icc_unlock_card_lock_pin() { buf.sendParcel = function fakeSendParcel() { // Request Type. - do_check_eq(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]); + equal(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]); // Token : we don't care this.readInt32(); // Data let parcel = this.readStringList(); - do_check_eq(parcel.length, ril.v5Legacy ? 1 : 2); - do_check_eq(parcel[0], aPassword); + equal(parcel.length, ril.v5Legacy ? 1 : 2); + equal(parcel[0], aPassword); if (!ril.v5Legacy) { - do_check_eq(parcel[1], ril.aid); + equal(parcel[1], ril.aid); } }; @@ -233,18 +233,18 @@ add_test(function test_icc_unlock_card_lock_puk() { buf.sendParcel = function fakeSendParcel() { // Request Type. - do_check_eq(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]); + equal(this.readInt32(), GECKO_CARDLOCK_TO_REQUEST[aLock]); // Token : we don't care this.readInt32(); // Data let parcel = this.readStringList(); - do_check_eq(parcel.length, ril.v5Legacy ? 2 : 3); - do_check_eq(parcel[0], aPassword); - do_check_eq(parcel[1], aNewPin); + equal(parcel.length, ril.v5Legacy ? 2 : 3); + equal(parcel[0], aPassword); + equal(parcel[1], aNewPin); if (!ril.v5Legacy) { - do_check_eq(parcel[2], ril.aid); + equal(parcel[2], ril.aid); } }; @@ -273,15 +273,15 @@ add_test(function test_icc_unlock_card_lock_depersonalization() { function do_test(aPassword) { buf.sendParcel = function fakeSendParcel() { // Request Type. - do_check_eq(this.readInt32(), REQUEST_ENTER_NETWORK_DEPERSONALIZATION_CODE); + equal(this.readInt32(), REQUEST_ENTER_NETWORK_DEPERSONALIZATION_CODE); // Token : we don't care this.readInt32(); // Data let parcel = this.readStringList(); - do_check_eq(parcel.length, 1); - do_check_eq(parcel[0], aPassword); + equal(parcel.length, 1); + equal(parcel[0], aPassword); }; ril.iccUnlockCardLock({ diff --git a/dom/system/gonk/tests/test_ril_worker_icc_CardState.js b/dom/system/gonk/tests/test_ril_worker_icc_CardState.js index 5abcb80efce..75ebc30a9a8 100644 --- a/dom/system/gonk/tests/test_ril_worker_icc_CardState.js +++ b/dom/system/gonk/tests/test_ril_worker_icc_CardState.js @@ -28,7 +28,7 @@ add_test(function test_personalization_state() { ril._isCdma = isCdma; ril._processICCStatus(iccStatus); - do_check_eq(ril.cardState, geckoCardState); + equal(ril.cardState, geckoCardState); } // Test GSM personalization state. @@ -117,7 +117,7 @@ add_test(function test_card_app_state() { }; ril._processICCStatus(iccStatus); - do_check_eq(ril.cardState, geckoCardState); + equal(ril.cardState, geckoCardState); } testCardAppState(CARD_APPSTATE_ILLEGAL, @@ -159,7 +159,7 @@ add_test(function test_icc_permanent_blocked() { }; ril._processICCStatus(iccStatus); - do_check_eq(ril.cardState, Ci.nsIIccProvider.CARD_STATE_PERMANENT_BLOCKED); + equal(ril.cardState, Ci.nsIIccProvider.CARD_STATE_PERMANENT_BLOCKED); } testPermanentBlocked(1, @@ -202,9 +202,9 @@ add_test(function test_icc_without_app_index() { ril._processICCStatus(iccStatus); // Should read icc id event if the app index is -1. - do_check_eq(ril.iccInfo.iccid, ICCID); + equal(ril.iccInfo.iccid, ICCID); // cardState is "unknown" if the app index is -1. - do_check_eq(ril.cardState, GECKO_CARDSTATE_UNKNOWN); + equal(ril.cardState, GECKO_CARDSTATE_UNKNOWN); run_next_test(); }); diff --git a/dom/system/gonk/tests/test_ril_worker_icc_GsmPDUHelper.js b/dom/system/gonk/tests/test_ril_worker_icc_GsmPDUHelper.js index 3de6dc203ea..0d074da7939 100644 --- a/dom/system/gonk/tests/test_ril_worker_icc_GsmPDUHelper.js +++ b/dom/system/gonk/tests/test_ril_worker_icc_GsmPDUHelper.js @@ -21,13 +21,13 @@ add_test(function test_write_timestamp() { helper.writeTimestamp(dateInput); dateOutput.setTime(helper.readTimestamp()); - do_check_eq(dateInput.getFullYear(), dateOutput.getFullYear()); - do_check_eq(dateInput.getMonth(), dateOutput.getMonth()); - do_check_eq(dateInput.getDate(), dateOutput.getDate()); - do_check_eq(dateInput.getHours(), dateOutput.getHours()); - do_check_eq(dateInput.getMinutes(), dateOutput.getMinutes()); - do_check_eq(dateInput.getSeconds(), dateOutput.getSeconds()); - do_check_eq(dateInput.getTimezoneOffset(), dateOutput.getTimezoneOffset()); + equal(dateInput.getFullYear(), dateOutput.getFullYear()); + equal(dateInput.getMonth(), dateOutput.getMonth()); + equal(dateInput.getDate(), dateOutput.getDate()); + equal(dateInput.getHours(), dateOutput.getHours()); + equal(dateInput.getMinutes(), dateOutput.getMinutes()); + equal(dateInput.getSeconds(), dateOutput.getSeconds()); + equal(dateInput.getTimezoneOffset(), dateOutput.getTimezoneOffset()); // 2034-01-23 12:34:56 -0800 GMT let time = Date.UTC(2034, 1, 23, 12, 34, 56); @@ -36,13 +36,13 @@ add_test(function test_write_timestamp() { helper.writeTimestamp(dateInput); dateOutput.setTime(helper.readTimestamp()); - do_check_eq(dateInput.getFullYear(), dateOutput.getFullYear()); - do_check_eq(dateInput.getMonth(), dateOutput.getMonth()); - do_check_eq(dateInput.getDate(), dateOutput.getDate()); - do_check_eq(dateInput.getHours(), dateOutput.getHours()); - do_check_eq(dateInput.getMinutes(), dateOutput.getMinutes()); - do_check_eq(dateInput.getSeconds(), dateOutput.getSeconds()); - do_check_eq(dateInput.getTimezoneOffset(), dateOutput.getTimezoneOffset()); + equal(dateInput.getFullYear(), dateOutput.getFullYear()); + equal(dateInput.getMonth(), dateOutput.getMonth()); + equal(dateInput.getDate(), dateOutput.getDate()); + equal(dateInput.getHours(), dateOutput.getHours()); + equal(dateInput.getMinutes(), dateOutput.getMinutes()); + equal(dateInput.getSeconds(), dateOutput.getSeconds()); + equal(dateInput.getTimezoneOffset(), dateOutput.getTimezoneOffset()); run_next_test(); }); @@ -58,22 +58,22 @@ add_test(function test_octect_BCD() { // 23 let number = 23; let octet = helper.BCDToOctet(number); - do_check_eq(helper.octetToBCD(octet), number); + equal(helper.octetToBCD(octet), number); // 56 number = 56; octet = helper.BCDToOctet(number); - do_check_eq(helper.octetToBCD(octet), number); + equal(helper.octetToBCD(octet), number); // 0x23 octet = 0x23; number = helper.octetToBCD(octet); - do_check_eq(helper.BCDToOctet(number), octet); + equal(helper.BCDToOctet(number), octet); // 0x56 octet = 0x56; number = helper.octetToBCD(octet); - do_check_eq(helper.BCDToOctet(number), octet); + equal(helper.BCDToOctet(number), octet); run_next_test(); }); diff --git a/dom/system/gonk/tests/test_ril_worker_icc_ICCContactHelper.js b/dom/system/gonk/tests/test_ril_worker_icc_ICCContactHelper.js index 8cea4798107..625012623e0 100644 --- a/dom/system/gonk/tests/test_ril_worker_icc_ICCContactHelper.js +++ b/dom/system/gonk/tests/test_ril_worker_icc_ICCContactHelper.js @@ -17,7 +17,7 @@ add_test(function test_error_message_read_icc_contact () { function do_test(options, expectedErrorMsg) { ril.sendChromeMessage = function(message) { - do_check_eq(message.errorMsg, expectedErrorMsg); + equal(message.errorMsg, expectedErrorMsg); } ril.readICCContacts(options); } @@ -51,7 +51,7 @@ add_test(function test_error_message_update_icc_contact() { function do_test(options, expectedErrorMsg) { ril.sendChromeMessage = function(message) { - do_check_eq(message.errorMsg, expectedErrorMsg); + equal(message.errorMsg, expectedErrorMsg); } ril.updateICCContact(options); } @@ -371,7 +371,7 @@ add_test(function test_read_icc_contacts() { let onerror = function onerror(errorMsg) { do_print("readICCContacts failed: " + errorMsg); - do_check_true(false); + ok(false); }; contactHelper.readICCContacts(aTestData.simType, aTestData.contactType, onsuccess, onerror); @@ -438,49 +438,49 @@ add_test(function test_update_icc_contact() { recordHelper.updateADNLike = function(fileId, contact, pin2, onsuccess, onerror) { if (aContactType === GECKO_CARDCONTACT_TYPE_FDN) { - do_check_eq(fileId, ICC_EF_FDN); + equal(fileId, ICC_EF_FDN); } else if (aContactType === GECKO_CARDCONTACT_TYPE_ADN) { - do_check_eq(fileId, ICC_EF_ADN); + equal(fileId, ICC_EF_ADN); } - do_check_eq(pin2, aPin2); - do_check_eq(contact.alphaId, aContact.alphaId); - do_check_eq(contact.number, aContact.number); + equal(pin2, aPin2); + equal(contact.alphaId, aContact.alphaId); + equal(contact.number, aContact.number); onsuccess(); }; recordHelper.readIAP = function(fileId, recordNumber, onsuccess, onerror) { - do_check_eq(fileId, IAP_FILE_ID); - do_check_eq(recordNumber, ADN_RECORD_ID); + equal(fileId, IAP_FILE_ID); + equal(recordNumber, ADN_RECORD_ID); onsuccess((aHaveIapIndex) ? [EMAIL_RECORD_ID, ANR0_RECORD_ID] : [0xff, 0xff]); }; recordHelper.updateIAP = function(fileId, recordNumber, iap, onsuccess, onerror) { - do_check_eq(fileId, IAP_FILE_ID); - do_check_eq(recordNumber, ADN_RECORD_ID); + equal(fileId, IAP_FILE_ID); + equal(recordNumber, ADN_RECORD_ID); onsuccess(); }; recordHelper.updateEmail = function(pbr, recordNumber, email, adnRecordId, onsuccess, onerror) { - do_check_eq(pbr.email.fileId, EMAIL_FILE_ID); + equal(pbr.email.fileId, EMAIL_FILE_ID); if (pbr.email.fileType === ICC_USIM_TYPE1_TAG) { - do_check_eq(recordNumber, ADN_RECORD_ID); + equal(recordNumber, ADN_RECORD_ID); } else if (pbr.email.fileType === ICC_USIM_TYPE2_TAG) { - do_check_eq(recordNumber, EMAIL_RECORD_ID); + equal(recordNumber, EMAIL_RECORD_ID); } - do_check_eq(email, aContact.email); + equal(email, aContact.email); onsuccess(); }; recordHelper.updateANR = function(pbr, recordNumber, number, adnRecordId, onsuccess, onerror) { - do_check_eq(pbr.anr0.fileId, ANR0_FILE_ID); + equal(pbr.anr0.fileId, ANR0_FILE_ID); if (pbr.anr0.fileType === ICC_USIM_TYPE1_TAG) { - do_check_eq(recordNumber, ADN_RECORD_ID); + equal(recordNumber, ADN_RECORD_ID); } else if (pbr.anr0.fileType === ICC_USIM_TYPE2_TAG) { - do_check_eq(recordNumber, ANR0_RECORD_ID); + equal(recordNumber, ANR0_RECORD_ID); } if (Array.isArray(aContact.anr)) { - do_check_eq(number, aContact.anr[0]); + equal(number, aContact.anr[0]); } onsuccess(); }; @@ -506,7 +506,7 @@ add_test(function test_update_icc_contact() { }; contactHelper.updateICCContact(aSimType, aContactType, aContact, aPin2, onsuccess, onerror); - do_check_true(isSuccess); + ok(isSuccess); } let contacts = [ @@ -619,12 +619,12 @@ add_test(function test_update_icc_contact_with_remove_type1_attr() { }; recordHelper.updateEmail = function(pbr, recordNumber, email, adnRecordId, onsuccess, onerror) { - do_check_true(email == null); + ok(email == null); onsuccess(); }; recordHelper.updateANR = function(pbr, recordNumber, number, adnRecordId, onsuccess, onerror) { - do_check_true(number == null); + ok(number == null); onsuccess(); }; @@ -651,12 +651,12 @@ add_test(function test_update_icc_contact_with_remove_type1_attr() { }; let successCb = function() { - do_check_true(true); + ok(true); }; let errorCb = function(errorMsg) { do_print(errorMsg); - do_check_true(false); + ok(false); }; contactHelper.updateICCContact(CARD_APPTYPE_USIM, @@ -693,13 +693,13 @@ add_test(function test_find_free_icc_contact_sim() { }; let successCb = function(pbrIndex, recordId) { - do_check_eq(pbrIndex, PBR_INDEX); + equal(pbrIndex, PBR_INDEX); records[recordId] = {}; }; let errorCb = function(errorMsg) { do_print(errorMsg); - do_check_true(false); + ok(false); }; for (let i = 0; i < MAX_RECORDS; i++) { @@ -708,15 +708,15 @@ add_test(function test_find_free_icc_contact_sim() { successCb, errorCb); } // The 1st element, records[0], is null. - do_check_eq(records.length - 1, MAX_RECORDS); + equal(records.length - 1, MAX_RECORDS); // Now the EF is full, so finding a free one should result failure. successCb = function(pbrIndex, recordId) { - do_check_true(false); + ok(false); }; errorCb = function(errorMsg) { - do_check_true(errorMsg === "No free record found."); + ok(errorMsg === "No free record found."); }; contactHelper.findFreeICCContact(CARD_APPTYPE_SIM, GECKO_CARDCONTACT_TYPE_ADN, successCb, errorCb); @@ -756,12 +756,12 @@ add_test(function test_find_free_icc_contact_usim() { }; let successCb = function(pbrIndex, recordId) { - do_check_eq(pbrIndex, 0); + equal(pbrIndex, 0); pbrs[pbrIndex].adn.records[recordId] = {}; }; let errorCb = function(errorMsg) { - do_check_true(false); + ok(false); }; contactHelper.findFreeICCContact(CARD_APPTYPE_USIM, @@ -771,8 +771,8 @@ add_test(function test_find_free_icc_contact_usim() { // Now the EF_ADN in the 1st phonebook set is full, so the next free contact // will come from the 2nd phonebook set. successCb = function(pbrIndex, recordId) { - do_check_eq(pbrIndex, 1); - do_check_eq(recordId, 1); + equal(pbrIndex, 1); + equal(recordId, 1); } contactHelper.findFreeICCContact(CARD_APPTYPE_USIM, GECKO_CARDCONTACT_TYPE_ADN, diff --git a/dom/system/gonk/tests/test_ril_worker_icc_ICCIOHelper.js b/dom/system/gonk/tests/test_ril_worker_icc_ICCIOHelper.js index 5db2fe771c5..cd0244595b2 100644 --- a/dom/system/gonk/tests/test_ril_worker_icc_ICCIOHelper.js +++ b/dom/system/gonk/tests/test_ril_worker_icc_ICCIOHelper.js @@ -18,12 +18,12 @@ add_test(function test_load_linear_fixed_ef() { io.getResponse = function fakeGetResponse(options) { // When recordSize is provided, loadLinearFixedEF should call iccIO directly. - do_check_true(false); + ok(false); run_next_test(); }; ril.iccIO = function fakeIccIO(options) { - do_check_true(true); + ok(true); run_next_test(); }; @@ -40,13 +40,13 @@ add_test(function test_load_linear_fixed_ef() { let io = context.ICCIOHelper; io.getResponse = function fakeGetResponse(options) { - do_check_true(true); + ok(true); run_next_test(); }; ril.iccIO = function fakeIccIO(options) { // When recordSize is not provided, loadLinearFixedEF should call getResponse. - do_check_true(false); + ok(false); run_next_test(); }; @@ -65,7 +65,7 @@ add_test(function test_process_icc_io_error() { let called = false; function errorCb(errorMsg) { called = true; - do_check_eq(errorMsg, expectedErrorMsg); + equal(errorMsg, expectedErrorMsg); } // Write sw1 and sw2 to buffer. @@ -78,7 +78,7 @@ add_test(function test_process_icc_io_error() { onerror: errorCb}); // onerror callback should be triggered. - do_check_true(called); + ok(called); } let TEST_DATA = [ @@ -126,7 +126,7 @@ add_test(function test_icc_io_get_response_for_transparent_structure() { structure: EF_STRUCTURE_TRANSPARENT}; iccioHelper.processICCIOGetResponse(options); - do_check_eq(options.fileSize, 0x0A); + equal(options.fileSize, 0x0A); } run_next_test(); @@ -164,9 +164,9 @@ add_test(function test_icc_io_get_response_for_linear_fixed_structure() { structure: EF_STRUCTURE_LINEAR_FIXED}; iccioHelper.processICCIOGetResponse(options); - do_check_eq(options.fileSize, 0x1A); - do_check_eq(options.recordSize, 0x1A); - do_check_eq(options.totalRecords, 0x01); + equal(options.fileSize, 0x1A); + equal(options.recordSize, 0x1A); + equal(options.totalRecords, 0x01); } run_next_test(); diff --git a/dom/system/gonk/tests/test_ril_worker_icc_ICCPDUHelper.js b/dom/system/gonk/tests/test_ril_worker_icc_ICCPDUHelper.js index 0b9ac68c054..f35bb55376c 100644 --- a/dom/system/gonk/tests/test_ril_worker_icc_ICCPDUHelper.js +++ b/dom/system/gonk/tests/test_ril_worker_icc_ICCPDUHelper.js @@ -24,7 +24,7 @@ add_test(function test_read_icc_ucs2_string() { for (let i = 0; i < ffLen; i++) { helper.writeHexOctet(0xff); } - do_check_eq(iccHelper.readICCUCS2String(0x80, (2 * text.length) + ffLen), text); + equal(iccHelper.readICCUCS2String(0x80, (2 * text.length) + ffLen), text); // 0x81 let array = [0x08, 0xd2, 0x4d, 0x6f, 0x7a, 0x69, 0x6c, 0x6c, 0x61, 0xca, @@ -33,7 +33,7 @@ add_test(function test_read_icc_ucs2_string() { for (let i = 0; i < len; i++) { helper.writeHexOctet(array[i]); } - do_check_eq(iccHelper.readICCUCS2String(0x81, len), "Mozilla\u694a"); + equal(iccHelper.readICCUCS2String(0x81, len), "Mozilla\u694a"); // 0x82 let array2 = [0x08, 0x69, 0x00, 0x4d, 0x6f, 0x7a, 0x69, 0x6c, 0x6c, 0x61, @@ -42,7 +42,7 @@ add_test(function test_read_icc_ucs2_string() { for (let i = 0; i < len2; i++) { helper.writeHexOctet(array2[i]); } - do_check_eq(iccHelper.readICCUCS2String(0x82, len2), "Mozilla\u694a"); + equal(iccHelper.readICCUCS2String(0x82, len2), "Mozilla\u694a"); run_next_test(); }); @@ -66,7 +66,7 @@ add_test(function test_read_dialling_number() { }; for (let i = 0; i < str.length; i++) { - do_check_eq(str.substring(0, i - 1), // -1 for the TON + equal(str.substring(0, i - 1), // -1 for the TON iccHelper.readDiallingNumber(i)); } @@ -104,10 +104,10 @@ add_test(function test_read_8bit_unpacked_to_string() { helper.writeHexOctet(0xff); } - do_check_eq(iccHelper.read8BitUnpackedToString(PDU_NL_EXTENDED_ESCAPE), + equal(iccHelper.read8BitUnpackedToString(PDU_NL_EXTENDED_ESCAPE), langTable.substring(0, PDU_NL_EXTENDED_ESCAPE)); - do_check_eq(iccHelper.read8BitUnpackedToString(2), " "); - do_check_eq(iccHelper.read8BitUnpackedToString(langTable.length - + equal(iccHelper.read8BitUnpackedToString(2), " "); + equal(iccHelper.read8BitUnpackedToString(langTable.length - PDU_NL_EXTENDED_ESCAPE - 1 + ffLen), langTable.substring(PDU_NL_EXTENDED_ESCAPE + 1)); @@ -118,19 +118,19 @@ add_test(function test_read_8bit_unpacked_to_string() { } // Read string before RESERVED_CONTROL. - do_check_eq(iccHelper.read8BitUnpackedToString(PDU_NL_RESERVED_CONTROL * 2), + equal(iccHelper.read8BitUnpackedToString(PDU_NL_RESERVED_CONTROL * 2), langShiftTable.substring(0, PDU_NL_RESERVED_CONTROL)); // ESCAPE + RESERVED_CONTROL will become ' '. - do_check_eq(iccHelper.read8BitUnpackedToString(2), " "); + equal(iccHelper.read8BitUnpackedToString(2), " "); // Read string between RESERVED_CONTROL and EXTENDED_ESCAPE. - do_check_eq(iccHelper.read8BitUnpackedToString( + equal(iccHelper.read8BitUnpackedToString( (PDU_NL_EXTENDED_ESCAPE - PDU_NL_RESERVED_CONTROL - 1) * 2), langShiftTable.substring(PDU_NL_RESERVED_CONTROL + 1, PDU_NL_EXTENDED_ESCAPE)); // ESCAPE + ESCAPE will become ' '. - do_check_eq(iccHelper.read8BitUnpackedToString(2), " "); + equal(iccHelper.read8BitUnpackedToString(2), " "); // Read remaining string. - do_check_eq(iccHelper.read8BitUnpackedToString( + equal(iccHelper.read8BitUnpackedToString( (langShiftTable.length - PDU_NL_EXTENDED_ESCAPE - 1) * 2), langShiftTable.substring(PDU_NL_EXTENDED_ESCAPE + 1)); @@ -157,18 +157,18 @@ add_test(function test_write_string_to_8bit_unpacked() { iccHelper.writeStringTo8BitUnpacked(langTable.length + ffLen, langTable); for (let i = 0; i < langTable.length; i++) { - do_check_eq(helper.readHexOctet(), i); + equal(helper.readHexOctet(), i); } for (let i = 0; i < ffLen; i++) { - do_check_eq(helper.readHexOctet(), 0xff); + equal(helper.readHexOctet(), 0xff); } // Test 2, write GSM extended alphabets. str = "\u000c\u20ac"; iccHelper.writeStringTo8BitUnpacked(4, str); - do_check_eq(iccHelper.read8BitUnpackedToString(4), str); + equal(iccHelper.read8BitUnpackedToString(4), str); // Test 3, write GSM and GSM extended alphabets. // \u000c, \u20ac are from gsm extended alphabets. @@ -181,7 +181,7 @@ add_test(function test_write_string_to_8bit_unpacked() { // "Totally 7 octets are to be written." iccHelper.writeStringTo8BitUnpacked(7, str); - do_check_eq(iccHelper.read8BitUnpackedToString(7), str); + equal(iccHelper.read8BitUnpackedToString(7), str); run_next_test(); }); @@ -202,26 +202,26 @@ add_test(function test_write_string_to_8bit_unpacked_with_max_octets_written() { iccHelper.writeStringTo8BitUnpacked(3, langTable.substring(0, 4)); helper.writeHexOctet(0xff); // dummy octet. for (let i = 0; i < 3; i++) { - do_check_eq(helper.readHexOctet(), i); + equal(helper.readHexOctet(), i); } - do_check_false(helper.readHexOctet() == 4); + ok(helper.readHexOctet() != 4); // \u000c is GSM extended alphabet, 2 octets. // \u00a3 is GSM alphabet, 1 octet. let str = "\u000c\u00a3"; iccHelper.writeStringTo8BitUnpacked(3, str); - do_check_eq(iccHelper.read8BitUnpackedToString(3), str); + equal(iccHelper.read8BitUnpackedToString(3), str); str = "\u00a3\u000c"; iccHelper.writeStringTo8BitUnpacked(3, str); - do_check_eq(iccHelper.read8BitUnpackedToString(3), str); + equal(iccHelper.read8BitUnpackedToString(3), str); // 2 GSM extended alphabets cost 4 octets, but maximum is 3, so only the 1st // alphabet can be written. str = "\u000c\u000c"; iccHelper.writeStringTo8BitUnpacked(3, str); helper.writeHexOctet(0xff); // dummy octet. - do_check_eq(iccHelper.read8BitUnpackedToString(4), str.substring(0, 1)); + equal(iccHelper.read8BitUnpackedToString(4), str.substring(0, 1)); run_next_test(); }); @@ -244,28 +244,28 @@ add_test(function test_read_alpha_identifier() { for (let i = 0; i < ffLen; i++) { helper.writeHexOctet(0xff); } - do_check_eq(iccHelper.readAlphaIdentifier(1 + (2 * text.length) + ffLen), text); + equal(iccHelper.readAlphaIdentifier(1 + (2 * text.length) + ffLen), text); // UCS2: 0x81 let array = [0x81, 0x08, 0xd2, 0x4d, 0x6f, 0x7a, 0x69, 0x6c, 0x6c, 0x61, 0xca, 0xff, 0xff]; for (let i = 0; i < array.length; i++) { helper.writeHexOctet(array[i]); } - do_check_eq(iccHelper.readAlphaIdentifier(array.length), "Mozilla\u694a"); + equal(iccHelper.readAlphaIdentifier(array.length), "Mozilla\u694a"); // UCS2: 0x82 let array2 = [0x82, 0x08, 0x69, 0x00, 0x4d, 0x6f, 0x7a, 0x69, 0x6c, 0x6c, 0x61, 0xca, 0xff, 0xff]; for (let i = 0; i < array2.length; i++) { helper.writeHexOctet(array2[i]); } - do_check_eq(iccHelper.readAlphaIdentifier(array2.length), "Mozilla\u694a"); + equal(iccHelper.readAlphaIdentifier(array2.length), "Mozilla\u694a"); // GSM 8 Bit Unpacked const langTable = PDU_NL_LOCKING_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT]; for (let i = 0; i < PDU_NL_EXTENDED_ESCAPE; i++) { helper.writeHexOctet(i); } - do_check_eq(iccHelper.readAlphaIdentifier(PDU_NL_EXTENDED_ESCAPE), + equal(iccHelper.readAlphaIdentifier(PDU_NL_EXTENDED_ESCAPE), langTable.substring(0, PDU_NL_EXTENDED_ESCAPE)); run_next_test(); @@ -284,36 +284,36 @@ add_test(function test_write_alpha_identifier() { // Removal iccHelper.writeAlphaIdentifier(10, null); - do_check_eq(iccHelper.readAlphaIdentifier(10), ""); + equal(iccHelper.readAlphaIdentifier(10), ""); // GSM 8 bit let str = "Mozilla"; iccHelper.writeAlphaIdentifier(str.length + ffLen, str); - do_check_eq(iccHelper.readAlphaIdentifier(str.length + ffLen), str); + equal(iccHelper.readAlphaIdentifier(str.length + ffLen), str); // UCS2 str = "Mozilla\u694a"; iccHelper.writeAlphaIdentifier(str.length * 2 + ffLen, str); // * 2 for each character will be encoded to UCS2 alphabets. - do_check_eq(iccHelper.readAlphaIdentifier(str.length * 2 + ffLen), str); + equal(iccHelper.readAlphaIdentifier(str.length * 2 + ffLen), str); // Test with maximum octets written. // 1 coding scheme (0x80) and 1 UCS2 character, total 3 octets. str = "\u694a"; iccHelper.writeAlphaIdentifier(3, str); - do_check_eq(iccHelper.readAlphaIdentifier(3), str); + equal(iccHelper.readAlphaIdentifier(3), str); // 1 coding scheme (0x80) and 2 UCS2 characters, total 5 octets. // numOctets is limited to 4, so only 1 UCS2 character can be written. str = "\u694a\u694a"; iccHelper.writeAlphaIdentifier(4, str); helper.writeHexOctet(0xff); // dummy octet. - do_check_eq(iccHelper.readAlphaIdentifier(5), str.substring(0, 1)); + equal(iccHelper.readAlphaIdentifier(5), str.substring(0, 1)); // Write 0 octet. iccHelper.writeAlphaIdentifier(0, "1"); helper.writeHexOctet(0xff); // dummy octet. - do_check_eq(iccHelper.readAlphaIdentifier(1), ""); + equal(iccHelper.readAlphaIdentifier(1), ""); run_next_test(); }); @@ -346,10 +346,10 @@ add_test(function test_read_alpha_id_dialling_number() { let contactR = iccHelper.readAlphaIdDiallingNumber(recordSize); if (contact.alphaId == "" && contact.number == "") { - do_check_eq(contactR, null); + equal(contactR, null); } else { - do_check_eq(contactR.alphaId, contact.alphaId); - do_check_eq(contactR.number, contact.number); + equal(contactR.alphaId, contact.alphaId); + equal(contactR.number, contact.number); } } @@ -377,8 +377,8 @@ add_test(function test_write_alpha_id_dialling_number() { contactW.number); let contactR = helper.readAlphaIdDiallingNumber(recordSize); - do_check_eq(contactW.alphaId, contactR.alphaId); - do_check_eq(contactW.number, contactR.number); + equal(contactW.alphaId, contactR.alphaId); + equal(contactW.number, contactR.number); // Write a contact with alphaId encoded in UCS2 and number has '+'. let contactUCS2 = { @@ -388,13 +388,13 @@ add_test(function test_write_alpha_id_dialling_number() { helper.writeAlphaIdDiallingNumber(recordSize, contactUCS2.alphaId, contactUCS2.number); contactR = helper.readAlphaIdDiallingNumber(recordSize); - do_check_eq(contactUCS2.alphaId, contactR.alphaId); - do_check_eq(contactUCS2.number, contactR.number); + equal(contactUCS2.alphaId, contactR.alphaId); + equal(contactUCS2.number, contactR.number); // Write a null contact (Removal). helper.writeAlphaIdDiallingNumber(recordSize); contactR = helper.readAlphaIdDiallingNumber(recordSize); - do_check_eq(contactR, null); + equal(contactR, null); // Write a longer alphaId/dialling number // Dialling Number : Maximum 20 digits(10 octets). @@ -408,16 +408,16 @@ add_test(function test_write_alpha_id_dialling_number() { helper.writeAlphaIdDiallingNumber(recordSize, longContact.alphaId, longContact.number); contactR = helper.readAlphaIdDiallingNumber(recordSize); - do_check_eq(contactR.alphaId, "AAAAAAAAABBBBBBBBB"); - do_check_eq(contactR.number, "12345678901234567890"); + equal(contactR.alphaId, "AAAAAAAAABBBBBBBBB"); + equal(contactR.number, "12345678901234567890"); // Add '+' to number and test again. longContact.number = "+123456789012345678901234567890"; helper.writeAlphaIdDiallingNumber(recordSize, longContact.alphaId, longContact.number); contactR = helper.readAlphaIdDiallingNumber(recordSize); - do_check_eq(contactR.alphaId, "AAAAAAAAABBBBBBBBB"); - do_check_eq(contactR.number, "+12345678901234567890"); + equal(contactR.alphaId, "AAAAAAAAABBBBBBBBB"); + equal(contactR.number, "+12345678901234567890"); run_next_test(); }); @@ -434,18 +434,18 @@ add_test(function test_write_dialling_number() { let number = "+123456"; let len = 4; helper.writeDiallingNumber(number); - do_check_eq(helper.readDiallingNumber(len), number); + equal(helper.readDiallingNumber(len), number); // without + number = "987654"; len = 4; helper.writeDiallingNumber(number); - do_check_eq(helper.readDiallingNumber(len), number); + equal(helper.readDiallingNumber(len), number); number = "9876543"; len = 5; helper.writeDiallingNumber(number); - do_check_eq(helper.readDiallingNumber(len), number); + equal(helper.readDiallingNumber(len), number); run_next_test(); }); @@ -513,9 +513,9 @@ add_test(function test_write_number_with_length() { expectedNumber = expectedNumber || number; iccHelper.writeNumberWithLength(number); let numLen = helper.readHexOctet(); - do_check_eq(expectedNumber, iccHelper.readDiallingNumber(numLen)); + equal(expectedNumber, iccHelper.readDiallingNumber(numLen)); for (let i = 0; i < (ADN_MAX_BCD_NUMBER_BYTES - numLen); i++) { - do_check_eq(0xff, helper.readHexOctet()); + equal(0xff, helper.readHexOctet()); } } @@ -539,7 +539,7 @@ add_test(function test_write_number_with_length() { // null iccHelper.writeNumberWithLength(null); for (let i = 0; i < (ADN_MAX_BCD_NUMBER_BYTES + 1); i++) { - do_check_eq(0xff, helper.readHexOctet()); + equal(0xff, helper.readHexOctet()); } run_next_test(); diff --git a/dom/system/gonk/tests/test_ril_worker_icc_ICCRecordHelper.js b/dom/system/gonk/tests/test_ril_worker_icc_ICCRecordHelper.js index 512321c1f16..9f90d9201d2 100644 --- a/dom/system/gonk/tests/test_ril_worker_icc_ICCRecordHelper.js +++ b/dom/system/gonk/tests/test_ril_worker_icc_ICCRecordHelper.js @@ -52,13 +52,13 @@ add_test(function test_read_pbr() { }; let successCb = function successCb(pbrs) { - do_check_eq(pbrs[0].adn.fileId, 0x4f3a); - do_check_eq(pbrs.length, 1); + equal(pbrs[0].adn.fileId, 0x4f3a); + equal(pbrs.length, 1); }; let errorCb = function errorCb(errorMsg) { do_print("Reading EF_PBR failed, msg = " + errorMsg); - do_check_true(false); + ok(false); }; record.readPBR(successCb, errorCb); @@ -69,7 +69,7 @@ add_test(function test_read_pbr() { ifLoadEF = true; } record.readPBR(successCb, errorCb); - do_check_false(ifLoadEF); + ok(!ifLoadEF); run_next_test(); }); @@ -117,13 +117,13 @@ add_test(function test_read_email() { // fileId and recordNumber are dummy arguments. record.readEmail(fileId, type, recordNumber, function(email) { - do_check_eq(email, expectedResult); + equal(email, expectedResult); }); }; doTestReadEmail(ICC_USIM_TYPE1_TAG, "email@mozilla.com$#"); doTestReadEmail(ICC_USIM_TYPE2_TAG, "email@mozilla.com"); - do_check_eq(record._emailRecordSize, recordSize); + equal(record._emailRecordSize, recordSize); run_next_test(); }); @@ -164,29 +164,29 @@ add_test(function test_update_email() { count++; // Request Type. - do_check_eq(this.readInt32(), REQUEST_SIM_IO); + equal(this.readInt32(), REQUEST_SIM_IO); // Token : we don't care this.readInt32(); // command. - do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD); + equal(this.readInt32(), ICC_COMMAND_UPDATE_RECORD); // fileId. - do_check_eq(this.readInt32(), fileId); + equal(this.readInt32(), fileId); // pathId. - do_check_eq(this.readString(), + equal(this.readString(), EF_PATH_MF_SIM + EF_PATH_DF_TELECOM + EF_PATH_DF_PHONEBOOK); // p1. - do_check_eq(this.readInt32(), recordNumber); + equal(this.readInt32(), recordNumber); // p2. - do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE); + equal(this.readInt32(), READ_RECORD_ABSOLUTE_MODE); // p3. - do_check_eq(this.readInt32(), recordSize); + equal(this.readInt32(), recordSize); // data. let strLen = this.readInt32(); @@ -195,14 +195,14 @@ add_test(function test_update_email() { email = iccHelper.read8BitUnpackedToString(recordSize); } else { email = iccHelper.read8BitUnpackedToString(recordSize - 2); - do_check_eq(pduHelper.readHexOctet(), pbr.adn.sfi); - do_check_eq(pduHelper.readHexOctet(), expectedAdnRecordId); + equal(pduHelper.readHexOctet(), pbr.adn.sfi); + equal(pduHelper.readHexOctet(), expectedAdnRecordId); } this.readStringDelimiter(strLen); - do_check_eq(email, expectedEmail); + equal(email, expectedEmail); // pin2. - do_check_eq(this.readString(), null); + equal(this.readString(), null); if (!ril.v5Legacy) { // AID. Ignore because it's from modem. @@ -262,12 +262,12 @@ add_test(function test_read_anr() { // fileId and recordNumber are dummy arguments. record.readANR(fileId, fileType, recordNumber, function(anr) { - do_check_eq(anr, expectedResult); + equal(anr, expectedResult); }); }; doTestReadAnr(ICC_USIM_TYPE1_TAG, "0123456"); - do_check_eq(record._anrRecordSize, recordSize); + equal(record._anrRecordSize, recordSize); run_next_test(); }); @@ -308,47 +308,47 @@ add_test(function test_update_anr() { count++; // Request Type. - do_check_eq(this.readInt32(), REQUEST_SIM_IO); + equal(this.readInt32(), REQUEST_SIM_IO); // Token : we don't care this.readInt32(); // command. - do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD); + equal(this.readInt32(), ICC_COMMAND_UPDATE_RECORD); // fileId. - do_check_eq(this.readInt32(), fileId); + equal(this.readInt32(), fileId); // pathId. - do_check_eq(this.readString(), + equal(this.readString(), EF_PATH_MF_SIM + EF_PATH_DF_TELECOM + EF_PATH_DF_PHONEBOOK); // p1. - do_check_eq(this.readInt32(), recordNumber); + equal(this.readInt32(), recordNumber); // p2. - do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE); + equal(this.readInt32(), READ_RECORD_ABSOLUTE_MODE); // p3. - do_check_eq(this.readInt32(), recordSize); + equal(this.readInt32(), recordSize); // data. let strLen = this.readInt32(); // EF_AAS, ignore. pduHelper.readHexOctet(); - do_check_eq(iccHelper.readNumberWithLength(), expectedANR); + equal(iccHelper.readNumberWithLength(), expectedANR); // EF_CCP, ignore. pduHelper.readHexOctet(); // EF_EXT1, ignore. pduHelper.readHexOctet(); if (pbr.anr0.fileType === ICC_USIM_TYPE2_TAG) { - do_check_eq(pduHelper.readHexOctet(), pbr.adn.sfi); - do_check_eq(pduHelper.readHexOctet(), expectedAdnRecordId); + equal(pduHelper.readHexOctet(), pbr.adn.sfi); + equal(pduHelper.readHexOctet(), expectedAdnRecordId); } this.readStringDelimiter(strLen); // pin2. - do_check_eq(this.readString(), null); + equal(this.readString(), null); if (!ril.v5Legacy) { // AID. Ignore because it's from modem. @@ -406,14 +406,14 @@ add_test(function test_read_iap() { let successCb = function successCb(iap) { for (let i = 0; i < iap.length; i++) { - do_check_eq(expectedIAP[i], iap[i]); + equal(expectedIAP[i], iap[i]); } run_next_test(); }.bind(this); let errorCb = function errorCb(errorMsg) { do_print(errorMsg); - do_check_true(false); + ok(false); run_next_test(); }.bind(this); @@ -453,39 +453,39 @@ add_test(function test_update_iap() { function do_test(expectedIAP) { buf.sendParcel = function() { // Request Type. - do_check_eq(this.readInt32(), REQUEST_SIM_IO); + equal(this.readInt32(), REQUEST_SIM_IO); // Token : we don't care this.readInt32(); // command. - do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD); + equal(this.readInt32(), ICC_COMMAND_UPDATE_RECORD); // fileId. - do_check_eq(this.readInt32(), fileId); + equal(this.readInt32(), fileId); // pathId. - do_check_eq(this.readString(), + equal(this.readString(), EF_PATH_MF_SIM + EF_PATH_DF_TELECOM + EF_PATH_DF_PHONEBOOK); // p1. - do_check_eq(this.readInt32(), recordNumber); + equal(this.readInt32(), recordNumber); // p2. - do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE); + equal(this.readInt32(), READ_RECORD_ABSOLUTE_MODE); // p3. - do_check_eq(this.readInt32(), recordSize); + equal(this.readInt32(), recordSize); // data. let strLen = this.readInt32(); for (let i = 0; i < recordSize; i++) { - do_check_eq(expectedIAP[i], pduHelper.readHexOctet()); + equal(expectedIAP[i], pduHelper.readHexOctet()); } this.readStringDelimiter(strLen); // pin2. - do_check_eq(this.readString(), null); + equal(this.readString(), null); if (!ril.v5Legacy) { // AID. Ignore because it's from modem. @@ -528,39 +528,39 @@ add_test(function test_update_adn_like() { buf.sendParcel = function() { // Request Type. - do_check_eq(this.readInt32(), REQUEST_SIM_IO); + equal(this.readInt32(), REQUEST_SIM_IO); // Token : we don't care this.readInt32(); // command. - do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD); + equal(this.readInt32(), ICC_COMMAND_UPDATE_RECORD); // fileId. - do_check_eq(this.readInt32(), fileId); + equal(this.readInt32(), fileId); // pathId. - do_check_eq(this.readString(), EF_PATH_MF_SIM + EF_PATH_DF_TELECOM); + equal(this.readString(), EF_PATH_MF_SIM + EF_PATH_DF_TELECOM); // p1. - do_check_eq(this.readInt32(), 1); + equal(this.readInt32(), 1); // p2. - do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE); + equal(this.readInt32(), READ_RECORD_ABSOLUTE_MODE); // p3. - do_check_eq(this.readInt32(), 0x20); + equal(this.readInt32(), 0x20); // data. let contact = pdu.readAlphaIdDiallingNumber(0x20); - do_check_eq(contact.alphaId, "test"); - do_check_eq(contact.number, "123456"); + equal(contact.alphaId, "test"); + equal(contact.number, "123456"); // pin2. if (fileId == ICC_EF_ADN) { - do_check_eq(this.readString(), null); + equal(this.readString(), null); } else { - do_check_eq(this.readString(), "1111"); + equal(this.readString(), "1111"); } if (!ril.v5Legacy) { @@ -631,12 +631,12 @@ add_test(function test_find_free_record_id() { recordHelper.findFreeRecordId( fileId, function(recordId) { - do_check_eq(recordId, 2); + equal(recordId, 2); run_next_test(); }.bind(this), function(errorMsg) { do_print(errorMsg); - do_check_true(false); + ok(false); run_next_test(); }.bind(this)); }); @@ -663,15 +663,15 @@ add_test(function test_fetch_icc_recodes() { RIL.appType = CARD_APPTYPE_SIM; iccRecord.fetchICCRecords(); - do_check_eq(fetchTag, 0x01); + equal(fetchTag, 0x01); RIL.appType = CARD_APPTYPE_RUIM; iccRecord.fetchICCRecords(); - do_check_eq(fetchTag, 0x02); + equal(fetchTag, 0x02); RIL.appType = CARD_APPTYPE_USIM; iccRecord.fetchICCRecords(); - do_check_eq(fetchTag, 0x01); + equal(fetchTag, 0x01); run_next_test(); }); @@ -711,7 +711,7 @@ add_test(function test_handling_iccid() { record.readICCID(); - do_check_eq(ril.iccInfo.iccid, expectedICCID); + equal(ril.iccInfo.iccid, expectedICCID); } // Invalid value 0xE at high nibbile + low nibbile contains 0xF. diff --git a/dom/system/gonk/tests/test_ril_worker_icc_ICCUtilsHelper.js b/dom/system/gonk/tests/test_ril_worker_icc_ICCUtilsHelper.js index 3a4ee687efd..fbddbfaf8ff 100644 --- a/dom/system/gonk/tests/test_ril_worker_icc_ICCUtilsHelper.js +++ b/dom/system/gonk/tests/test_ril_worker_icc_ICCUtilsHelper.js @@ -19,9 +19,9 @@ add_test(function test_is_icc_service_available() { function test_table(sst, geckoService, simEnabled, usimEnabled) { RIL.iccInfoPrivate.sst = sst; RIL.appType = CARD_APPTYPE_SIM; - do_check_eq(ICCUtilsHelper.isICCServiceAvailable(geckoService), simEnabled); + equal(ICCUtilsHelper.isICCServiceAvailable(geckoService), simEnabled); RIL.appType = CARD_APPTYPE_USIM; - do_check_eq(ICCUtilsHelper.isICCServiceAvailable(geckoService), usimEnabled); + equal(ICCUtilsHelper.isICCServiceAvailable(geckoService), usimEnabled); } test_table([0x08], "ADN", true, false); @@ -41,9 +41,9 @@ add_test(function test_is_gsm_8bit_alphabet() { const langTable = PDU_NL_LOCKING_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT]; const langShiftTable = PDU_NL_SINGLE_SHIFT_TABLES[PDU_NL_IDENTIFIER_DEFAULT]; - do_check_eq(ICCUtilsHelper.isGsm8BitAlphabet(langTable), true); - do_check_eq(ICCUtilsHelper.isGsm8BitAlphabet(langShiftTable), true); - do_check_eq(ICCUtilsHelper.isGsm8BitAlphabet("\uaaaa"), false); + equal(ICCUtilsHelper.isGsm8BitAlphabet(langTable), true); + equal(ICCUtilsHelper.isGsm8BitAlphabet(langShiftTable), true); + equal(ICCUtilsHelper.isGsm8BitAlphabet("\uaaaa"), false); run_next_test(); }); @@ -93,14 +93,14 @@ add_test(function test_parse_pbr_tlvs() { ]; let pbr = context.ICCUtilsHelper.parsePbrTlvs(pbrTlvs); - do_check_eq(pbr.adn.fileId, 0x4F3a); - do_check_eq(pbr.iap.fileId, 0x4F25); - do_check_eq(pbr.pbc.fileId, 0x4F09); - do_check_eq(pbr.email.fileId, 0x4F50); - do_check_eq(pbr.anr0.fileId, 0x4f11); - do_check_eq(pbr.anr1.fileId, 0x4f12); - do_check_eq(pbr.ccp1.fileId, 0x4F3D); - do_check_eq(pbr.ext1.fileId, 0x4F4A); + equal(pbr.adn.fileId, 0x4F3a); + equal(pbr.iap.fileId, 0x4F25); + equal(pbr.pbc.fileId, 0x4F09); + equal(pbr.email.fileId, 0x4F50); + equal(pbr.anr0.fileId, 0x4f11); + equal(pbr.anr1.fileId, 0x4f12); + equal(pbr.ccp1.fileId, 0x4F3D); + equal(pbr.ext1.fileId, 0x4F4A); run_next_test(); }); @@ -117,12 +117,12 @@ add_test(function test_mcc_mnc_parsing() { let result = helper.parseMccMncFromImsi(imsi, mncLength); if (!imsi) { - do_check_eq(result, null); + equal(result, null); return; } - do_check_eq(result.mcc, expectedMcc); - do_check_eq(result.mnc, expectedMnc); + equal(result.mcc, expectedMcc); + equal(result.mnc, expectedMnc); } // Test the imsi is null. @@ -153,10 +153,10 @@ add_test(function test_get_network_name_from_icc() { operatorData.lac); if (expectedResult == null) { - do_check_eq(result, expectedResult); + equal(result, expectedResult); } else { - do_check_eq(result.fullName, expectedResult.longName); - do_check_eq(result.shortName, expectedResult.shortName); + equal(result.fullName, expectedResult.longName); + equal(result.shortName, expectedResult.shortName); } } @@ -311,7 +311,7 @@ add_test(function test_is_cphs_service_available() { RIL.iccInfoPrivate.cphsSt.set(cphsSt); for (let service in GECKO_ICC_SERVICES.cphs) { - do_check_eq(ICCUtilsHelper.isCphsServiceAvailable(service), + equal(ICCUtilsHelper.isCphsServiceAvailable(service), geckoService == service); } } diff --git a/dom/system/gonk/tests/test_ril_worker_icc_IconLoader.js b/dom/system/gonk/tests/test_ril_worker_icc_IconLoader.js index 6b8d80de1bc..8bcd26ffeaa 100644 --- a/dom/system/gonk/tests/test_ril_worker_icc_IconLoader.js +++ b/dom/system/gonk/tests/test_ril_worker_icc_IconLoader.js @@ -364,17 +364,17 @@ add_test(function test_load_icon_basic() { let onsuccess = function(icons) { // Query one record at a time. - do_check_eq(icons.length, 1); - do_check_eq(icons[0].length, expected.length); + equal(icons.length, 1); + equal(icons[0].length, expected.length); for (let i = 0; i < icons[0].length; i++) { // Read the i_th image of the record. let icon = icons[0][i]; let exp = expected[i]; - do_check_eq(icon.width, exp.width); - do_check_eq(icon.height, exp.height); - do_check_eq(icon.pixels.length, exp.pixels.length); + equal(icon.width, exp.width); + equal(icon.height, exp.height); + equal(icon.pixels.length, exp.pixels.length); for (let j = 0; j < icon.pixels.length; j++) { - do_check_eq(icon.pixels[j], exp.pixels[j]); + equal(icon.pixels[j], exp.pixels[j]); } } }; @@ -746,17 +746,17 @@ add_test(function test_load_icons() { }; let onsuccess = function(icons) { - do_check_eq(icons.length, test_data.expected.length); + equal(icons.length, test_data.expected.length); for (let i = 0; i < icons.length; i++) { for (let j = 0; j < icons[i].length; j++) { // Read the j_th image from the i_th record. let icon = icons[i][j]; let expected = test_data.expected[i][j]; - do_check_eq(icon.width, expected.width); - do_check_eq(icon.height, expected.height); - do_check_eq(icon.pixels.length, expected.pixels.length); + equal(icon.width, expected.width); + equal(icon.height, expected.height); + equal(icon.pixels.length, expected.pixels.length); for (let k = 0; k < icon.pixels.length; k++) { - do_check_eq(icon.pixels[k], expected.pixels[k]); + equal(icon.pixels[k], expected.pixels[k]); } } } diff --git a/dom/system/gonk/tests/test_ril_worker_icc_SimRecordHelper.js b/dom/system/gonk/tests/test_ril_worker_icc_SimRecordHelper.js index 8055ef4a967..adb6eb7eefb 100644 --- a/dom/system/gonk/tests/test_ril_worker_icc_SimRecordHelper.js +++ b/dom/system/gonk/tests/test_ril_worker_icc_SimRecordHelper.js @@ -46,8 +46,8 @@ add_test(function test_reading_ad_and_parsing_mcc_mnc() { record.readAD(); - do_check_eq(ril.iccInfo.mcc, expectedMcc); - do_check_eq(ril.iccInfo.mnc, expectedMnc); + equal(ril.iccInfo.mcc, expectedMcc); + equal(ril.iccInfo.mnc, expectedMnc); } do_test(undefined, "466923202422409", "466", "92" ); @@ -140,7 +140,7 @@ add_test(function test_reading_optional_efs() { if (testEf.length !== 0) { do_print("Un-handled EF: " + JSON.stringify(testEf)); - do_check_true(false); + ok(false); } }; @@ -196,7 +196,7 @@ add_test(function test_fetch_sim_records() { for (let i = 0; i < expectCalled.length; i++ ) { if (ifCalled[i] != expectCalled[i]) { do_print(expectCalled[i] + " is not called."); - do_check_true(false); + ok(false); } } } @@ -263,9 +263,9 @@ add_test(function test_read_mwis() { buildMwisData(isActive, msgCount); recordHelper.readMWIS(); - do_check_eq("iccmwis", postedMessage.rilMessageType); - do_check_eq(isActive, postedMessage.mwi.active); - do_check_eq((isActive) ? msgCount : 0, postedMessage.mwi.msgCount); + equal("iccmwis", postedMessage.rilMessageType); + equal(isActive, postedMessage.mwi.active); + equal((isActive) ? msgCount : 0, postedMessage.mwi.msgCount); } do_test(true, GECKO_VOICEMAIL_MESSAGE_COUNT_UNKNOWN); @@ -319,41 +319,41 @@ add_test(function test_update_mwis() { isUpdated = true; // Request Type. - do_check_eq(this.readInt32(), REQUEST_SIM_IO); + equal(this.readInt32(), REQUEST_SIM_IO); // Token : we don't care this.readInt32(); // command. - do_check_eq(this.readInt32(), ICC_COMMAND_UPDATE_RECORD); + equal(this.readInt32(), ICC_COMMAND_UPDATE_RECORD); // fileId. - do_check_eq(this.readInt32(), ICC_EF_MWIS); + equal(this.readInt32(), ICC_EF_MWIS); // pathId. - do_check_eq(this.readString(), + equal(this.readString(), EF_PATH_MF_SIM + ((ril.appType === CARD_APPTYPE_USIM) ? EF_PATH_ADF_USIM : EF_PATH_DF_GSM)); // p1. - do_check_eq(this.readInt32(), recordNum); + equal(this.readInt32(), recordNum); // p2. - do_check_eq(this.readInt32(), READ_RECORD_ABSOLUTE_MODE); + equal(this.readInt32(), READ_RECORD_ABSOLUTE_MODE); // p3. - do_check_eq(this.readInt32(), recordSize); + equal(this.readInt32(), recordSize); // data. let strLen = this.readInt32(); - do_check_eq(recordSize * 2, strLen); + equal(recordSize * 2, strLen); let expectedMwis = buildMwisData(); for (let i = 0; i < recordSize; i++) { - do_check_eq(expectedMwis[i], pduHelper.readHexOctet()); + equal(expectedMwis[i], pduHelper.readHexOctet()); } this.readStringDelimiter(strLen); // pin2. - do_check_eq(this.readString(), null); + equal(this.readString(), null); if (!ril.v5Legacy) { // AID. Ignore because it's from modem. @@ -361,12 +361,12 @@ add_test(function test_update_mwis() { } }; - do_check_false(isUpdated); + ok(!isUpdated); recordHelper.updateMWIS({ active: isActive, msgCount: count }); - do_check_true((ril.iccInfoPrivate.mwis) ? isUpdated : !isUpdated); + ok((ril.iccInfoPrivate.mwis) ? isUpdated : !isUpdated); } do_test(true, GECKO_VOICEMAIL_MESSAGE_COUNT_UNKNOWN); @@ -485,10 +485,10 @@ add_test(function test_read_new_sms_on_sim() { let postedMessage = workerHelper.postedMessage; - do_check_eq("sms-received", postedMessage.rilMessageType); - do_check_eq("+0123456789", postedMessage.SMSC); - do_check_eq("+9876543210", postedMessage.sender); - do_check_eq("How are you?", postedMessage.body); + equal("sms-received", postedMessage.rilMessageType); + equal("+0123456789", postedMessage.SMSC); + equal("+9876543210", postedMessage.sender); + equal("How are you?", postedMessage.body); } do_test(); @@ -534,8 +534,8 @@ add_test(function test_update_display_condition() { record.readSPDI(); - do_check_eq(ril.iccInfo.isDisplayNetworkNameRequired, true); - do_check_eq(ril.iccInfo.isDisplaySpnRequired, false); + equal(ril.iccInfo.isDisplayNetworkNameRequired, true); + equal(ril.iccInfo.isDisplaySpnRequired, false); } function do_test_spn(displayCondition, @@ -566,8 +566,8 @@ add_test(function test_update_display_condition() { record.readSPN(); - do_check_eq(ril.iccInfo.isDisplayNetworkNameRequired, expectedPlmnNameDisplay); - do_check_eq(ril.iccInfo.isDisplaySpnRequired, expectedSpnDisplay); + equal(ril.iccInfo.isDisplayNetworkNameRequired, expectedPlmnNameDisplay); + equal(ril.iccInfo.isDisplaySpnRequired, expectedSpnDisplay); } // Create empty operator object. @@ -758,17 +758,17 @@ add_test(function test_reading_img_basic() { }; let onsuccess = function(icons) { - do_check_eq(icons.length, expected.length); + equal(icons.length, expected.length); for (let i = 0; i < icons.length; i++) { let icon = icons[i]; let exp = expected[i]; - do_check_eq(icon.width, exp.width); - do_check_eq(icon.height, exp.height); - do_check_eq(icon.codingScheme, exp.codingScheme); + equal(icon.width, exp.width); + equal(icon.height, exp.height); + equal(icon.codingScheme, exp.codingScheme); - do_check_eq(icon.body.length, exp.body.length); + equal(icon.body.length, exp.body.length); for (let j = 0; j < icon.body.length; j++) { - do_check_eq(icon.body[j], exp.body[j]); + equal(icon.body[j], exp.body[j]); } } }; @@ -839,12 +839,12 @@ add_test(function test_reading_img_length_error() { let onsuccess = function() { do_print("onsuccess shouldn't be called."); - do_check_true(false); + ok(false); }; let onerror = function() { do_print("onerror called as expected."); - do_check_true(true); + ok(true); }; record.readIMG(0, onsuccess, onerror); @@ -908,12 +908,12 @@ add_test(function test_reading_img_invalid_fileId() { let onsuccess = function() { do_print("onsuccess shouldn't be called."); - do_check_true(false); + ok(false); }; let onerror = function() { do_print("onerror called as expected."); - do_check_true(true); + ok(true); }; record.readIMG(0, onsuccess, onerror); @@ -957,12 +957,12 @@ add_test(function test_reading_img_wrong_record_length() { let onsuccess = function() { do_print("onsuccess shouldn't be called."); - do_check_true(false); + ok(false); }; let onerror = function() { do_print("onerror called as expected."); - do_check_true(true); + ok(true); }; record.readIMG(0, onsuccess, onerror); @@ -1109,22 +1109,22 @@ add_test(function test_reading_img_color() { }; let onsuccess = function(icons) { - do_check_eq(icons.length, expected.length); + equal(icons.length, expected.length); for (let i = 0; i < icons.length; i++) { let icon = icons[i]; let exp = expected[i]; - do_check_eq(icon.width, exp.width); - do_check_eq(icon.height, exp.height); - do_check_eq(icon.codingScheme, exp.codingScheme); + equal(icon.width, exp.width); + equal(icon.height, exp.height); + equal(icon.codingScheme, exp.codingScheme); - do_check_eq(icon.body.length, exp.body.length); + equal(icon.body.length, exp.body.length); for (let j = 0; j < icon.body.length; j++) { - do_check_eq(icon.body[j], exp.body[j]); + equal(icon.body[j], exp.body[j]); } - do_check_eq(icon.clut.length, exp.clut.length); + equal(icon.clut.length, exp.clut.length); for (let j = 0; j < icon.clut.length; j++) { - do_check_eq(icon.clut[j], exp.clut[j]); + equal(icon.clut[j], exp.clut[j]); } } }; @@ -1274,22 +1274,22 @@ add_test(function test_reading_img_color() { }; let onsuccess = function(icons) { - do_check_eq(icons.length, expected.length); + equal(icons.length, expected.length); for (let i = 0; i < icons.length; i++) { let icon = icons[i]; let exp = expected[i]; - do_check_eq(icon.width, exp.width); - do_check_eq(icon.height, exp.height); - do_check_eq(icon.codingScheme, exp.codingScheme); + equal(icon.width, exp.width); + equal(icon.height, exp.height); + equal(icon.codingScheme, exp.codingScheme); - do_check_eq(icon.body.length, exp.body.length); + equal(icon.body.length, exp.body.length); for (let j = 0; j < icon.body.length; j++) { - do_check_eq(icon.body[j], exp.body[j]); + equal(icon.body[j], exp.body[j]); } - do_check_eq(icon.clut.length, exp.clut.length); + equal(icon.clut.length, exp.clut.length); for (let j = 0; j < icon.clut.length; j++) { - do_check_eq(icon.clut[j], exp.clut[j]); + equal(icon.clut[j], exp.clut[j]); } } }; @@ -1346,15 +1346,15 @@ add_test(function test_read_cphs_info() { recordHelper.readCphsInfo(() => { onsuccess = true; }, () => { onerror = true; }); - do_check_true((cphsSt) ? onsuccess : onerror); - do_check_false((cphsSt) ? onerror : onsuccess); + ok((cphsSt) ? onsuccess : onerror); + ok(!((cphsSt) ? onerror : onsuccess)); if (cphsSt) { - do_check_eq(RIL.iccInfoPrivate.cphsSt.length, cphsSt.length); + equal(RIL.iccInfoPrivate.cphsSt.length, cphsSt.length); for (let i = 0; i < cphsSt.length; i++) { - do_check_eq(RIL.iccInfoPrivate.cphsSt[i], cphsSt[i]); + equal(RIL.iccInfoPrivate.cphsSt[i], cphsSt[i]); } } else { - do_check_eq(RIL.iccInfoPrivate.cphsSt, cphsSt); + equal(RIL.iccInfoPrivate.cphsSt, cphsSt); } } @@ -1439,9 +1439,9 @@ add_test(function test_read_voicemail_number() { delete RIL.iccInfoPrivate.mbdn; recordHelper[funcName](); - do_check_eq("iccmbdn", postedMessage.rilMessageType); - do_check_eq("Voicemail", postedMessage.alphaId); - do_check_eq("111", postedMessage.number); + equal("iccmbdn", postedMessage.rilMessageType); + equal("Voicemail", postedMessage.alphaId); + equal("111", postedMessage.number); } do_test("readMBDN"); @@ -1498,8 +1498,8 @@ add_test(function test_read_mbdn_recovered_from_cphs_mbn() { recordHelper.readMBDN(); - do_check_eq(RIL.iccInfoPrivate.mbdn, undefined); - do_check_true(isRecovered); + equal(RIL.iccInfoPrivate.mbdn, undefined); + ok(isRecovered); run_next_test(); }); @@ -1554,7 +1554,7 @@ add_test(function test_pnn_with_different_coding_scheme() { record.readPNN(); - do_check_eq(ril.iccInfoPrivate.PNN[0].fullName, expectedResult); + equal(ril.iccInfoPrivate.PNN[0].fullName, expectedResult); // Reset PNN info for next test ril.iccInfoPrivate.PNN = null; } @@ -1630,15 +1630,15 @@ add_test(function test_pnn_with_different_content() { record.readPNN(); - do_check_eq(test_data.length, ril.iccInfoPrivate.PNN.length); + equal(test_data.length, ril.iccInfoPrivate.PNN.length); for (let i = 0; i < test_data.length; i++) { if (test_data[i].expectedResult) { - do_check_eq(test_data[i].expectedResult.fullName, + equal(test_data[i].expectedResult.fullName, ril.iccInfoPrivate.PNN[i].fullName); - do_check_eq(test_data[i].expectedResult.shortName, + equal(test_data[i].expectedResult.shortName, ril.iccInfoPrivate.PNN[i].shortName); } else { - do_check_eq(test_data[i].expectedResult, ril.iccInfoPrivate.PNN[i]); + equal(test_data[i].expectedResult, ril.iccInfoPrivate.PNN[i]); } } } diff --git a/dom/system/gonk/tests/test_ril_worker_mmi.js b/dom/system/gonk/tests/test_ril_worker_mmi.js index 0d84aec1892..25f4a81ba9e 100644 --- a/dom/system/gonk/tests/test_ril_worker_mmi.js +++ b/dom/system/gonk/tests/test_ril_worker_mmi.js @@ -32,8 +32,8 @@ function testSendMMI(mmi, error) { let postedMessage = workerhelper.postedMessage; - do_check_eq(postedMessage.rilMessageType, "sendMMI"); - do_check_eq(postedMessage.errorMsg, error); + equal(postedMessage.rilMessageType, "sendMMI"); + equal(postedMessage.errorMsg, error); } /** @@ -65,10 +65,10 @@ add_test(function test_sendMMI_short_code() { context.RIL.sendMMI({mmi: {fullMMI: "**"}}); let postedMessage = workerhelper.postedMessage; - do_check_eq(ussdOptions.ussd, "**"); - do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); - do_check_true(postedMessage.success); - do_check_true(context.RIL._ussdSession); + equal(ussdOptions.ussd, "**"); + equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); + ok(postedMessage.success); + ok(context.RIL._ussdSession); run_next_test(); }); @@ -90,8 +90,8 @@ add_test(function test_sendMMI_change_PIN() { let postedMessage = workerhelper.postedMessage; - do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); - do_check_true(postedMessage.success); + equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); + ok(postedMessage.success); run_next_test(); }); @@ -141,8 +141,8 @@ add_test(function test_sendMMI_change_PIN2() { let postedMessage = workerhelper.postedMessage; - do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); - do_check_true(postedMessage.success); + equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); + ok(postedMessage.success); run_next_test(); }); @@ -192,8 +192,8 @@ add_test(function test_sendMMI_unblock_PIN() { let postedMessage = workerhelper.postedMessage; - do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); - do_check_true(postedMessage.success); + equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); + ok(postedMessage.success); run_next_test(); }); @@ -243,8 +243,8 @@ add_test(function test_sendMMI_unblock_PIN2() { let postedMessage = workerhelper.postedMessage; - do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); - do_check_true(postedMessage.success); + equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); + ok(postedMessage.success); run_next_test(); }); @@ -294,9 +294,9 @@ add_test(function test_sendMMI_get_IMEI() { let postedMessage = workerhelper.postedMessage; - do_check_neq(mmiOptions.mmi, null); - do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); - do_check_true(postedMessage.success); + notEqual(mmiOptions.mmi, null); + equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); + ok(postedMessage.success); run_next_test(); }); @@ -318,9 +318,9 @@ add_test(function test_sendMMI_get_IMEI_error() { let postedMessage = workerhelper.postedMessage; - do_check_neq(mmiOptions.mmi, null); - do_check_eq (postedMessage.errorMsg, GECKO_ERROR_RADIO_NOT_AVAILABLE); - do_check_false(postedMessage.success); + notEqual(mmiOptions.mmi, null); + equal (postedMessage.errorMsg, GECKO_ERROR_RADIO_NOT_AVAILABLE); + ok(!postedMessage.success); run_next_test(); }); @@ -347,11 +347,11 @@ add_test(function test_sendMMI_call_barring_BAIC_interrogation_voice() { let postedMessage = workerhelper.postedMessage; - do_check_true(postedMessage.success); - do_check_true(postedMessage.enabled); - do_check_eq(postedMessage.statusMessage, MMI_SM_KS_SERVICE_ENABLED_FOR); - do_check_true(Array.isArray(postedMessage.additionalInformation)); - do_check_eq(postedMessage.additionalInformation[0], "serviceClassVoice"); + ok(postedMessage.success); + ok(postedMessage.enabled); + equal(postedMessage.statusMessage, MMI_SM_KS_SERVICE_ENABLED_FOR); + ok(Array.isArray(postedMessage.additionalInformation)); + equal(postedMessage.additionalInformation[0], "serviceClassVoice"); run_next_test(); }); @@ -377,9 +377,9 @@ add_test(function test_sendMMI_call_barring_BAIC_activation() { let postedMessage = workerhelper.postedMessage; - do_check_eq(mmiOptions.procedure, MMI_PROCEDURE_ACTIVATION); - do_check_true(postedMessage.success); - do_check_eq(postedMessage.statusMessage, MMI_SM_KS_SERVICE_ENABLED); + equal(mmiOptions.procedure, MMI_PROCEDURE_ACTIVATION); + ok(postedMessage.success); + equal(postedMessage.statusMessage, MMI_SM_KS_SERVICE_ENABLED); run_next_test(); }); @@ -405,9 +405,9 @@ add_test(function test_sendMMI_call_barring_BAIC_deactivation() { let postedMessage = workerhelper.postedMessage; - do_check_eq(mmiOptions.procedure, MMI_PROCEDURE_DEACTIVATION); - do_check_true(postedMessage.success); - do_check_eq(postedMessage.statusMessage, MMI_SM_KS_SERVICE_DISABLED); + equal(mmiOptions.procedure, MMI_PROCEDURE_DEACTIVATION); + ok(postedMessage.success); + equal(postedMessage.statusMessage, MMI_SM_KS_SERVICE_DISABLED); run_next_test(); }); @@ -436,10 +436,10 @@ add_test(function test_sendMMI_USSD() { let postedMessage = workerhelper.postedMessage; - do_check_eq(ussdOptions.ussd, "**123#"); - do_check_eq (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); - do_check_true(postedMessage.success); - do_check_true(context.RIL._ussdSession); + equal(ussdOptions.ussd, "**123#"); + equal (postedMessage.errorMsg, GECKO_ERROR_SUCCESS); + ok(postedMessage.success); + ok(context.RIL._ussdSession); run_next_test(); }); @@ -462,10 +462,10 @@ add_test(function test_sendMMI_USSD_error() { let postedMessage = workerhelper.postedMessage; - do_check_eq(ussdOptions.ussd, "**123#"); - do_check_eq (postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE); - do_check_false(postedMessage.success); - do_check_false(context.RIL._ussdSession); + equal(ussdOptions.ussd, "**123#"); + equal (postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE); + ok(!postedMessage.success); + ok(!context.RIL._ussdSession); run_next_test(); }); @@ -486,8 +486,8 @@ function setCallWaitingSuccess(mmi) { let postedMessage = workerhelper.postedMessage; - do_check_eq(postedMessage.errorMsg, GECKO_ERROR_SUCCESS); - do_check_true(postedMessage.success); + equal(postedMessage.errorMsg, GECKO_ERROR_SUCCESS); + ok(postedMessage.success); } add_test(function test_sendMMI_call_waiting_activation() { @@ -539,9 +539,9 @@ add_test(function test_sendMMI_call_waiting_interrogation() { let postedMessage = workerhelper.postedMessage; - do_check_eq(postedMessage.errorMsg, GECKO_ERROR_SUCCESS); - do_check_true(postedMessage.success); - do_check_eq(postedMessage.length, 2); - do_check_true(postedMessage.enabled); + equal(postedMessage.errorMsg, GECKO_ERROR_SUCCESS); + ok(postedMessage.success); + equal(postedMessage.length, 2); + ok(postedMessage.enabled); run_next_test(); }); diff --git a/dom/system/gonk/tests/test_ril_worker_mmi_cf.js b/dom/system/gonk/tests/test_ril_worker_mmi_cf.js index e5ff40bcbfc..27fa48dfe34 100644 --- a/dom/system/gonk/tests/test_ril_worker_mmi_cf.js +++ b/dom/system/gonk/tests/test_ril_worker_mmi_cf.js @@ -37,8 +37,8 @@ function setCallForwardSuccess(procedure, serviceCode, sia, sib, sic) { let postedMessage = workerhelper.postedMessage; - do_check_eq(postedMessage.errorMsg, undefined); - do_check_true(postedMessage.success); + equal(postedMessage.errorMsg, undefined); + ok(postedMessage.success); } add_test(function test_sendMMI_call_forwarding_activation() { @@ -85,13 +85,13 @@ add_test(function test_sendMMI_call_forwarding_interrogation() { let postedMessage = workerhelper.postedMessage; - do_check_eq(postedMessage.errorMsg, undefined); - do_check_true(postedMessage.success); - do_check_true(Array.isArray(postedMessage.rules)); - do_check_eq(postedMessage.rules.length, 1); - do_check_true(postedMessage.rules[0].active); - do_check_eq(postedMessage.rules[0].reason, CALL_FORWARD_REASON_UNCONDITIONAL); - do_check_eq(postedMessage.rules[0].number, "+34666222333"); + equal(postedMessage.errorMsg, undefined); + ok(postedMessage.success); + ok(Array.isArray(postedMessage.rules)); + equal(postedMessage.rules.length, 1); + ok(postedMessage.rules[0].active); + equal(postedMessage.rules[0].reason, CALL_FORWARD_REASON_UNCONDITIONAL); + equal(postedMessage.rules[0].number, "+34666222333"); run_next_test(); }); @@ -115,8 +115,8 @@ add_test(function test_sendMMI_call_forwarding_interrogation_no_rules() { let postedMessage = workerhelper.postedMessage; - do_check_eq(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE); - do_check_false(postedMessage.success); + equal(postedMessage.errorMsg, GECKO_ERROR_GENERIC_FAILURE); + ok(!postedMessage.success); run_next_test(); }); diff --git a/dom/system/gonk/tests/test_ril_worker_ruim.js b/dom/system/gonk/tests/test_ril_worker_ruim.js index 52192e82593..0ddc10f2965 100644 --- a/dom/system/gonk/tests/test_ril_worker_ruim.js +++ b/dom/system/gonk/tests/test_ril_worker_ruim.js @@ -18,7 +18,7 @@ add_test(function test_is_ruim_service_available() { function test_table(cst, geckoService, enabled) { context.RIL.iccInfoPrivate.cst = cst; - do_check_eq(context.ICCUtilsHelper.isICCServiceAvailable(geckoService), + equal(context.ICCUtilsHelper.isICCServiceAvailable(geckoService), enabled); } @@ -40,7 +40,7 @@ add_test(function test_ruim_file_path_id() { let ICCFileHelper = context.ICCFileHelper; RIL.appType = CARD_APPTYPE_RUIM; - do_check_eq(ICCFileHelper.getEFPath(ICC_EF_CSIM_CST), + equal(ICCFileHelper.getEFPath(ICC_EF_CSIM_CST), EF_PATH_MF_SIM + EF_PATH_DF_CDMA); run_next_test(); @@ -76,7 +76,7 @@ add_test(function test_fetch_ruim_recodes() { for (let i = 0; i < expectCalled.length; i++ ) { if (ifCalled[i] != expectCalled[i]) { do_print(expectCalled[i] + " is not called."); - do_check_true(false); + ok(false); } } } @@ -98,7 +98,7 @@ add_test(function test_decode_imsi_value() { function testDecodeImsiValue(encoded, length, expect) { let decoded = context.RuimRecordHelper.decodeIMSIValue(encoded, length); - do_check_eq(expect, decoded); + equal(expect, decoded); } testDecodeImsiValue( 99, 2, "00"); @@ -150,7 +150,7 @@ add_test(function test_get_imsi_m() { context.RuimRecordHelper.getIMSI_M(); let imsi = context.RIL.iccInfoPrivate.imsi; - do_check_eq(expectedImsi, imsi) + equal(expectedImsi, imsi) } let imsi_1 = "466050081062861"; @@ -198,11 +198,11 @@ add_test(function test_read_cdmahome() { context.RuimRecordHelper.readCDMAHome(); let cdmaHome = context.RIL.cdmaHome; for (let i = 0; i < expectedSystemIds.length; i++) { - do_check_eq(cdmaHome.systemId[i], expectedSystemIds[i]); - do_check_eq(cdmaHome.networkId[i], expectedNetworkIds[i]); + equal(cdmaHome.systemId[i], expectedSystemIds[i]); + equal(cdmaHome.networkId[i], expectedNetworkIds[i]); } - do_check_eq(cdmaHome.systemId.length, expectedSystemIds.length); - do_check_eq(cdmaHome.networkId.length, expectedNetworkIds.length); + equal(cdmaHome.systemId.length, expectedSystemIds.length); + equal(cdmaHome.networkId.length, expectedNetworkIds.length); } testCdmaHome([13505], [65535]); @@ -239,8 +239,8 @@ add_test(function test_read_cdmaspn() { }; context.RuimRecordHelper.readSPN(); - do_check_eq(context.RIL.iccInfo.spn, expectedSpn); - do_check_eq(context.RIL.iccInfoPrivate.spnDisplayCondition, + equal(context.RIL.iccInfo.spn, expectedSpn); + equal(context.RIL.iccInfoPrivate.spnDisplayCondition, expectedDisplayCondition); } @@ -287,9 +287,9 @@ add_test(function test_cdma_spn_display_condition() { RIL._isCdma = true; // Test updateDisplayCondition runs before any of SIM file is ready. - do_check_eq(ICCUtilsHelper.updateDisplayCondition(), true); - do_check_eq(RIL.iccInfo.isDisplayNetworkNameRequired, true); - do_check_eq(RIL.iccInfo.isDisplaySpnRequired, false); + equal(ICCUtilsHelper.updateDisplayCondition(), true); + equal(RIL.iccInfo.isDisplayNetworkNameRequired, true); + equal(RIL.iccInfo.isDisplaySpnRequired, false); // Test with value. function testDisplayCondition(ruimDisplayCondition, @@ -307,9 +307,9 @@ add_test(function test_cdma_spn_display_condition() { cdmaNetworkId: currentNetworkId }; - do_check_eq(ICCUtilsHelper.updateDisplayCondition(), expectUpdateDisplayCondition); - do_check_eq(RIL.iccInfo.isDisplayNetworkNameRequired, false); - do_check_eq(RIL.iccInfo.isDisplaySpnRequired, expectIsDisplaySPNRequired); + equal(ICCUtilsHelper.updateDisplayCondition(), expectUpdateDisplayCondition); + equal(RIL.iccInfo.isDisplayNetworkNameRequired, false); + equal(RIL.iccInfo.isDisplaySpnRequired, expectIsDisplaySPNRequired); }; // SPN is not required when ruimDisplayCondition is false. diff --git a/dom/system/gonk/tests/test_ril_worker_sms.js b/dom/system/gonk/tests/test_ril_worker_sms.js index 4e3ba768ec0..5bdeb779c11 100644 --- a/dom/system/gonk/tests/test_ril_worker_sms.js +++ b/dom/system/gonk/tests/test_ril_worker_sms.js @@ -142,7 +142,7 @@ function add_test_receiving_sms(expected, pdu) { }, postMessage: function(message) { do_print("fullBody: " + message.fullBody); - do_check_eq(expected, message.fullBody) + equal(expected, message.fullBody) } }); @@ -247,7 +247,7 @@ add_test(function test_sendSMS_UCS2_without_langIndex_langShiftIndex_defined() { // // If we have additional 6(type, len, langIndex, type len, langShiftIndex) // octets here, then bug 809553 is not fixed. - do_check_eq(this.outgoingIndex, 57); + equal(this.outgoingIndex, 57); run_next_test(); }; diff --git a/dom/system/gonk/tests/test_ril_worker_sms_cdma.js b/dom/system/gonk/tests/test_ril_worker_sms_cdma.js index 459fc9d7722..85d0b6e0c95 100644 --- a/dom/system/gonk/tests/test_ril_worker_sms_cdma.js +++ b/dom/system/gonk/tests/test_ril_worker_sms_cdma.js @@ -213,20 +213,20 @@ add_test(function test_processCdmaSmsStatusReport() { let postedMessage = workerHelper.postedMessage; // Check if pending token is removed. - do_check_true((errorClass === 2) ? !!sentSmsMap[msgId] : !sentSmsMap[msgId]); + ok((errorClass === 2) ? !!sentSmsMap[msgId] : !sentSmsMap[msgId]); // Check the response message accordingly. if (errorClass === -1) { // Check if the report is treated as normal incoming SMS - do_check_eq("sms-received", postedMessage.rilMessageType); + equal("sms-received", postedMessage.rilMessageType); } else if (errorClass === 2) { // Do nothing. } else { // Check Delivery Status if (errorClass === 0) { - do_check_eq(postedMessage.deliveryStatus, GECKO_SMS_DELIVERY_STATUS_SUCCESS); + equal(postedMessage.deliveryStatus, GECKO_SMS_DELIVERY_STATUS_SUCCESS); } else { - do_check_eq(postedMessage.deliveryStatus, GECKO_SMS_DELIVERY_STATUS_ERROR); + equal(postedMessage.deliveryStatus, GECKO_SMS_DELIVERY_STATUS_ERROR); } } } @@ -283,12 +283,12 @@ add_test(function test_processCdmaSmsWapPush() { do_print("fullDataHexString: " + fullDataHexString); - do_check_eq("sms-received", postedMessage.rilMessageType); - do_check_eq(PDU_CDMA_MSG_TELESERIVCIE_ID_WAP, postedMessage.teleservice); - do_check_eq(orig_address, postedMessage.sender); - do_check_eq(0x23F0, postedMessage.header.originatorPort); - do_check_eq(0x0B84, postedMessage.header.destinationPort); - do_check_eq(fullDataHexString, bytesToHexString(postedMessage.data)); + equal("sms-received", postedMessage.rilMessageType); + equal(PDU_CDMA_MSG_TELESERIVCIE_ID_WAP, postedMessage.teleservice); + equal(orig_address, postedMessage.sender); + equal(0x23F0, postedMessage.header.originatorPort); + equal(0x0B84, postedMessage.header.destinationPort); + equal(fullDataHexString, bytesToHexString(postedMessage.data)); } // Verify Single WAP PDU diff --git a/dom/system/gonk/tests/test_ril_worker_sms_cdmapduhelper.js b/dom/system/gonk/tests/test_ril_worker_sms_cdmapduhelper.js index 15e7206d96e..276728f2fb2 100644 --- a/dom/system/gonk/tests/test_ril_worker_sms_cdmapduhelper.js +++ b/dom/system/gonk/tests/test_ril_worker_sms_cdmapduhelper.js @@ -29,10 +29,10 @@ add_test(function test_CdmaPDUHelper_encodeUserDataReplyOption() { let expectedDataBuffer = [PDU_CDMA_MSG_USERDATA_REPLY_OPTION, 0x01, 0x40]; - do_check_eq(testDataBuffer.length, expectedDataBuffer.length); + equal(testDataBuffer.length, expectedDataBuffer.length); for (let i = 0; i < expectedDataBuffer.length; i++) { - do_check_eq(testDataBuffer[i], expectedDataBuffer[i]); + equal(testDataBuffer[i], expectedDataBuffer[i]); } run_next_test(); @@ -58,8 +58,8 @@ add_test(function test_CdmaPDUHelper_decodeUserDataMsgStatus() { context.BitBufferHelper.startRead(testDataBuffer); let result = helper.decodeUserDataMsgStatus(); - do_check_eq(result.errorClass, octet >>> 6); - do_check_eq(result.msgStatus, octet & 0x3F); + equal(result.errorClass, octet >>> 6); + equal(result.msgStatus, octet & 0x3F); } // 00|000000: no error|Message accepted @@ -93,7 +93,7 @@ add_test(function test_CdmaPDUHelper_decodeCdmaPDUMsg_Shift_jis() { function test_decodePDUMsg(testDataBuffer, expected, encoding, msgType, msgBodySize) { context.BitBufferHelper.startRead(testDataBuffer); let result = helper.decodeCdmaPDUMsg(encoding, msgType, msgBodySize); - do_check_eq(result, expected); + equal(result, expected); } // Shift-JIS has 1 byte and 2 byte code for one character and has some types of characters: diff --git a/dom/system/gonk/tests/test_ril_worker_sms_gsmpduhelper.js b/dom/system/gonk/tests/test_ril_worker_sms_gsmpduhelper.js index b9c8de39594..3b532362b3e 100644 --- a/dom/system/gonk/tests/test_ril_worker_sms_gsmpduhelper.js +++ b/dom/system/gonk/tests/test_ril_worker_sms_gsmpduhelper.js @@ -30,14 +30,14 @@ add_test(function test_GsmPDUHelper_readDataCodingScheme() { let msg = {}; helper.readDataCodingScheme(msg); - do_check_eq(msg.dcs, dcs); - do_check_eq(msg.encoding, encoding); - do_check_eq(msg.messageClass, messageClass); - do_check_eq(msg.mwi == null, mwi == null); + equal(msg.dcs, dcs); + equal(msg.encoding, encoding); + equal(msg.messageClass, messageClass); + equal(msg.mwi == null, mwi == null); if (mwi != null) { - do_check_eq(msg.mwi.active, mwi.active); - do_check_eq(msg.mwi.discard, mwi.discard); - do_check_eq(msg.mwi.msgCount, mwi.msgCount); + equal(msg.mwi.active, mwi.active); + equal(msg.mwi.discard, mwi.discard); + equal(msg.mwi.msgCount, mwi.msgCount); } } @@ -179,7 +179,7 @@ add_test(function test_GsmPDUHelper_writeStringAsSeptets() { helper.resetOctetWritten(); helper.writeStringAsSeptets(str, paddingBits, PDU_NL_IDENTIFIER_DEFAULT, PDU_NL_IDENTIFIER_DEFAULT); - do_check_eq(Math.ceil(((len * 7) + paddingBits) / 8), + equal(Math.ceil(((len * 7) + paddingBits) / 8), helper.octetsWritten); } } @@ -217,7 +217,7 @@ add_test(function test_GsmPDUHelper_readAddress() { } let length = helper.readHexOctet(); let parsedAddr = helper.readAddress(length); - do_check_eq(parsedAddr, addrString); + equal(parsedAddr, addrString); } // For AlphaNumeric diff --git a/dom/system/gonk/tests/test_ril_worker_sms_nl_tables.js b/dom/system/gonk/tests/test_ril_worker_sms_nl_tables.js index 2b20b8399dd..32bc5dc2aeb 100644 --- a/dom/system/gonk/tests/test_ril_worker_sms_nl_tables.js +++ b/dom/system/gonk/tests/test_ril_worker_sms_nl_tables.js @@ -24,13 +24,13 @@ add_test(function test_nl_locking_shift_tables_validity() { let table = PDU_NL_LOCKING_SHIFT_TABLES[lst]; // Make sure table length is 128, or it will break table lookup algorithm. - do_check_eq(table.length, 128); + equal(table.length, 128); // Make sure special values are preserved. - do_check_eq(table[PDU_NL_EXTENDED_ESCAPE], ESCAPE); - do_check_eq(table[PDU_NL_LINE_FEED], LF); - do_check_eq(table[PDU_NL_CARRIAGE_RETURN], CR); - do_check_eq(table[PDU_NL_SPACE], SP); + equal(table[PDU_NL_EXTENDED_ESCAPE], ESCAPE); + equal(table[PDU_NL_LINE_FEED], LF); + equal(table[PDU_NL_CARRIAGE_RETURN], CR); + equal(table[PDU_NL_SPACE], SP); } run_next_test(); @@ -43,12 +43,12 @@ add_test(function test_nl_single_shift_tables_validity() { let table = PDU_NL_SINGLE_SHIFT_TABLES[sst]; // Make sure table length is 128, or it will break table lookup algorithm. - do_check_eq(table.length, 128); + equal(table.length, 128); // Make sure special values are preserved. - do_check_eq(table[PDU_NL_EXTENDED_ESCAPE], ESCAPE); - do_check_eq(table[PDU_NL_PAGE_BREAK], FF); - do_check_eq(table[PDU_NL_RESERVED_CONTROL], RESCTL); + equal(table[PDU_NL_EXTENDED_ESCAPE], ESCAPE); + equal(table[PDU_NL_PAGE_BREAK], FF); + equal(table[PDU_NL_RESERVED_CONTROL], RESCTL); } run_next_test(); @@ -64,12 +64,12 @@ add_test(function test_gsm_sms_strict_7bit_charmap_validity() { + to.charCodeAt(0).toString(16) + "\""); // Make sure "from" is not in default table - do_check_eq(defaultTable.indexOf(from), -1); - do_check_eq(defaultShiftTable.indexOf(from), -1); + equal(defaultTable.indexOf(from), -1); + equal(defaultShiftTable.indexOf(from), -1); // Make sure "to" is in default table if ((defaultTable.indexOf(to) < 0) && (defaultShiftTable.indexOf(to) < 0)) { - do_check_eq(false, true); + equal(false, true); } } diff --git a/dom/system/gonk/tests/test_ril_worker_sms_segment_info.js b/dom/system/gonk/tests/test_ril_worker_sms_segment_info.js index 1b3c2c02b21..2b29ac60ebe 100644 --- a/dom/system/gonk/tests/test_ril_worker_sms_segment_info.js +++ b/dom/system/gonk/tests/test_ril_worker_sms_segment_info.js @@ -42,7 +42,7 @@ add_test(function test_SmsSegmentHelper__countGsm7BitSeptets() { }; function do_check_calc(str, expectedCalcLen, lst, sst, strict7BitEncoding, strToWrite) { - do_check_eq(expectedCalcLen, + equal(expectedCalcLen, gSmsSegmentHelper .countGsm7BitSeptets(str, PDU_NL_LOCKING_SHIFT_TABLES[lst], @@ -52,7 +52,7 @@ add_test(function test_SmsSegmentHelper__countGsm7BitSeptets() { helper.resetOctetWritten(); strToWrite = strToWrite || str; helper.writeStringAsSeptets(strToWrite, 0, lst, sst); - do_check_eq(Math.ceil(expectedCalcLen * 7 / 8), helper.octetsWritten); + equal(Math.ceil(expectedCalcLen * 7 / 8), helper.octetsWritten); } // Test calculation encoded message length using both locking/single shift tables. diff --git a/dom/system/gonk/tests/test_ril_worker_ssn.js b/dom/system/gonk/tests/test_ril_worker_ssn.js index ff3eee23b66..96ecdc41914 100644 --- a/dom/system/gonk/tests/test_ril_worker_ssn.js +++ b/dom/system/gonk/tests/test_ril_worker_ssn.js @@ -67,9 +67,9 @@ add_test(function test_notification() { context.RIL._processSuppSvcNotification(notificationInfo); let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.rilMessageType, 'suppSvcNotification'); - do_check_eq(postedMessage.notification, resultNotification); - do_check_eq(postedMessage.callIndex, resultCallIndex); + equal(postedMessage.rilMessageType, 'suppSvcNotification'); + equal(postedMessage.notification, resultNotification); + equal(postedMessage.callIndex, resultCallIndex); // Clear all existed calls. context.RIL._processCalls({}); diff --git a/dom/system/gonk/tests/test_ril_worker_stk.js b/dom/system/gonk/tests/test_ril_worker_stk.js index bbc70a767a2..cf9925afcb1 100644 --- a/dom/system/gonk/tests/test_ril_worker_stk.js +++ b/dom/system/gonk/tests/test_ril_worker_stk.js @@ -62,7 +62,7 @@ add_test(function test_if_send_stk_terminal_profile() { context.RIL._processICCStatus(iccStatus); - do_check_eq(profileSend, false); + equal(profileSend, false); run_next_test(); }); @@ -81,7 +81,7 @@ add_test(function test_send_stk_terminal_profile() { buf.seekIncoming(8); let profile = buf.readString(); for (let i = 0; i < STK_SUPPORTED_TERMINAL_PROFILE.length; i++) { - do_check_eq(parseInt(profile.substring(2 * i, 2 * i + 2), 16), + equal(parseInt(profile.substring(2 * i, 2 * i + 2), 16), STK_SUPPORTED_TERMINAL_PROFILE[i]); } @@ -99,7 +99,7 @@ add_test(function test_stk_terminal_response() { buf.sendParcel = function() { // Type - do_check_eq(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE); + equal(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE); // Token : we don't care this.readInt32(); @@ -108,34 +108,34 @@ add_test(function test_stk_terminal_response() { // TLV_DEVICE_ID_SIZE(4) + // TLV_RESULT_SIZE(3) + // TEXT LENGTH(10)) - do_check_eq(this.readInt32(), 44); + equal(this.readInt32(), 44); // Command Details, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 3); - do_check_eq(pduHelper.readHexOctet(), 0x01); - do_check_eq(pduHelper.readHexOctet(), STK_CMD_PROVIDE_LOCAL_INFO); - do_check_eq(pduHelper.readHexOctet(), STK_LOCAL_INFO_NNA); + equal(pduHelper.readHexOctet(), 3); + equal(pduHelper.readHexOctet(), 0x01); + equal(pduHelper.readHexOctet(), STK_CMD_PROVIDE_LOCAL_INFO); + equal(pduHelper.readHexOctet(), STK_LOCAL_INFO_NNA); // Device Identifies, Type-Length-Value(Source ID-Destination ID) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); // Result - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_RESULT | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_RESULT | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 1); - do_check_eq(pduHelper.readHexOctet(), STK_RESULT_OK); + equal(pduHelper.readHexOctet(), 1); + equal(pduHelper.readHexOctet(), STK_RESULT_OK); // Text - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_TEXT_STRING | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_TEXT_STRING | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 8); - do_check_eq(pduHelper.readHexOctet(), STK_TEXT_CODING_GSM_7BIT_PACKED); - do_check_eq(pduHelper.readSeptetsToString(7, 0, PDU_NL_IDENTIFIER_DEFAULT, + equal(pduHelper.readHexOctet(), 8); + equal(pduHelper.readHexOctet(), STK_TEXT_CODING_GSM_7BIT_PACKED); + equal(pduHelper.readSeptetsToString(7, 0, PDU_NL_IDENTIFIER_DEFAULT, PDU_NL_IDENTIFIER_DEFAULT), "Mozilla"); run_next_test(); @@ -170,7 +170,7 @@ add_test(function test_stk_terminal_response_get_input_empty_string() { buf.sendParcel = function() { // Type - do_check_eq(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE); + equal(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE); // Token : we don't care this.readInt32(); @@ -179,33 +179,33 @@ add_test(function test_stk_terminal_response_get_input_empty_string() { // TLV_DEVICE_ID_SIZE(4) + // TLV_RESULT_SIZE(3) + // TEXT LENGTH(3)) - do_check_eq(this.readInt32(), 30); + equal(this.readInt32(), 30); // Command Details, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 3); - do_check_eq(pduHelper.readHexOctet(), 0x01); - do_check_eq(pduHelper.readHexOctet(), STK_CMD_GET_INPUT); - do_check_eq(pduHelper.readHexOctet(), 0x00); + equal(pduHelper.readHexOctet(), 3); + equal(pduHelper.readHexOctet(), 0x01); + equal(pduHelper.readHexOctet(), STK_CMD_GET_INPUT); + equal(pduHelper.readHexOctet(), 0x00); // Device Identifies, Type-Length-Value(Source ID-Destination ID) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); // Result - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_RESULT | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_RESULT | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 1); - do_check_eq(pduHelper.readHexOctet(), STK_RESULT_OK); + equal(pduHelper.readHexOctet(), 1); + equal(pduHelper.readHexOctet(), STK_RESULT_OK); // Text - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_TEXT_STRING | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_TEXT_STRING | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 1); - do_check_eq(pduHelper.readHexOctet(), STK_TEXT_CODING_GSM_8BIT); + equal(pduHelper.readHexOctet(), 1); + equal(pduHelper.readHexOctet(), STK_TEXT_CODING_GSM_8BIT); run_next_test(); }; @@ -252,7 +252,7 @@ add_test(function test_stk_terminal_response_get_input_160_unpacked_characters() buf.sendParcel = function() { // Type - do_check_eq(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE); + equal(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE); // Token : we don't care this.readInt32(); @@ -261,36 +261,36 @@ add_test(function test_stk_terminal_response_get_input_160_unpacked_characters() // TLV_DEVICE_ID_SIZE(4) + // TLV_RESULT_SIZE(3) + // TEXT LENGTH(164)) - do_check_eq(this.readInt32(), 352); + equal(this.readInt32(), 352); // Command Details, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 3); - do_check_eq(pduHelper.readHexOctet(), 0x01); - do_check_eq(pduHelper.readHexOctet(), STK_CMD_GET_INPUT); - do_check_eq(pduHelper.readHexOctet(), 0x00); + equal(pduHelper.readHexOctet(), 3); + equal(pduHelper.readHexOctet(), 0x01); + equal(pduHelper.readHexOctet(), STK_CMD_GET_INPUT); + equal(pduHelper.readHexOctet(), 0x00); // Device Identifies, Type-Length-Value(Source ID-Destination ID) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); // Result - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_RESULT | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_RESULT | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 1); - do_check_eq(pduHelper.readHexOctet(), STK_RESULT_OK); + equal(pduHelper.readHexOctet(), 1); + equal(pduHelper.readHexOctet(), STK_RESULT_OK); // Text - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_TEXT_STRING | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_TEXT_STRING | COMPREHENSIONTLV_FLAG_CR); // C-TLV Length Encoding: 161 = 0x81 0xA1 - do_check_eq(pduHelper.readHexOctet(), 0x81); - do_check_eq(pduHelper.readHexOctet(), 0xA1); - do_check_eq(pduHelper.readHexOctet(), STK_TEXT_CODING_GSM_8BIT); - do_check_eq(iccPduHelper.read8BitUnpackedToString(160), TEST_TEXT_STRING); + equal(pduHelper.readHexOctet(), 0x81); + equal(pduHelper.readHexOctet(), 0xA1); + equal(pduHelper.readHexOctet(), STK_TEXT_CODING_GSM_8BIT); + equal(iccPduHelper.read8BitUnpackedToString(160), TEST_TEXT_STRING); run_next_test(); }; @@ -326,7 +326,7 @@ add_test(function test_stk_terminal_response_get_inkey_no_response_from_user() { buf.sendParcel = function() { // Type - do_check_eq(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE); + equal(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE); // Token : we don't care this.readInt32(); @@ -335,33 +335,33 @@ add_test(function test_stk_terminal_response_get_inkey_no_response_from_user() { // TLV_DEVICE_ID_SIZE(4) + // TLV_RESULT_SIZE(3) + // DURATION(4)) - do_check_eq(this.readInt32(), 32); + equal(this.readInt32(), 32); // Command Details, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 3); - do_check_eq(pduHelper.readHexOctet(), 0x01); - do_check_eq(pduHelper.readHexOctet(), STK_CMD_GET_INKEY); - do_check_eq(pduHelper.readHexOctet(), 0x00); + equal(pduHelper.readHexOctet(), 3); + equal(pduHelper.readHexOctet(), 0x01); + equal(pduHelper.readHexOctet(), STK_CMD_GET_INKEY); + equal(pduHelper.readHexOctet(), 0x00); // Device Identifies, Type-Length-Value(Source ID-Destination ID) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); // Result - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_RESULT | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_RESULT | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 1); - do_check_eq(pduHelper.readHexOctet(), STK_RESULT_NO_RESPONSE_FROM_USER); + equal(pduHelper.readHexOctet(), 1); + equal(pduHelper.readHexOctet(), STK_RESULT_NO_RESPONSE_FROM_USER); // Duration, Type-Length-Value(Time unit, Time interval) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DURATION); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_TIME_UNIT_SECOND); - do_check_eq(pduHelper.readHexOctet(), 10); + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DURATION); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_TIME_UNIT_SECOND); + equal(pduHelper.readHexOctet(), 10); run_next_test(); }; @@ -396,7 +396,7 @@ add_test(function test_stk_terminal_response_get_inkey() { buf.sendParcel = function() { // Type - do_check_eq(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE); + equal(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE); // Token : we don't care this.readInt32(); @@ -405,34 +405,34 @@ add_test(function test_stk_terminal_response_get_inkey() { // TLV_DEVICE_ID_SIZE(4) + // TLV_RESULT_SIZE(3) + // TEXT LENGTH(4)) - do_check_eq(this.readInt32(), 32); + equal(this.readInt32(), 32); // Command Details, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 3); - do_check_eq(pduHelper.readHexOctet(), 0x01); - do_check_eq(pduHelper.readHexOctet(), STK_CMD_GET_INKEY); - do_check_eq(pduHelper.readHexOctet(), 0x04); + equal(pduHelper.readHexOctet(), 3); + equal(pduHelper.readHexOctet(), 0x01); + equal(pduHelper.readHexOctet(), STK_CMD_GET_INKEY); + equal(pduHelper.readHexOctet(), 0x04); // Device Identifies, Type-Length-Value(Source ID-Destination ID) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); // Result - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_RESULT | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_RESULT | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 1); - do_check_eq(pduHelper.readHexOctet(), STK_RESULT_OK); + equal(pduHelper.readHexOctet(), 1); + equal(pduHelper.readHexOctet(), STK_RESULT_OK); // Yes/No response - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_TEXT_STRING | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_TEXT_STRING | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_TEXT_CODING_GSM_8BIT); - do_check_eq(pduHelper.readHexOctet(), isYesNo ? 0x01 : 0x00); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_TEXT_CODING_GSM_8BIT); + equal(pduHelper.readHexOctet(), isYesNo ? 0x01 : 0x00); }; let response = { @@ -471,7 +471,7 @@ add_test(function test_stk_terminal_response_with_additional_info() { buf.sendParcel = function() { // Type - do_check_eq(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE); + equal(this.readInt32(), REQUEST_STK_SEND_TERMINAL_RESPONSE); // Token : we don't care this.readInt32(); @@ -479,28 +479,28 @@ add_test(function test_stk_terminal_response_with_additional_info() { // Data Length 26 = 2 * (TLV_COMMAND_DETAILS_SIZE(5) + // TLV_DEVICE_ID_SIZE(4) + // TLV_RESULT_SIZE(4)) - do_check_eq(this.readInt32(), 26); + equal(this.readInt32(), 26); // Command Details, Type-Length-Value(commandNumber, typeOfCommand, commandQualifier) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_COMMAND_DETAILS | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 3); - do_check_eq(pduHelper.readHexOctet(), 0x01); - do_check_eq(pduHelper.readHexOctet(), STK_CMD_DISPLAY_TEXT); - do_check_eq(pduHelper.readHexOctet(), 0x01); + equal(pduHelper.readHexOctet(), 3); + equal(pduHelper.readHexOctet(), 0x01); + equal(pduHelper.readHexOctet(), STK_CMD_DISPLAY_TEXT); + equal(pduHelper.readHexOctet(), 0x01); // Device Identifies, Type-Length-Value(Source ID-Destination ID) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); // Result, Type-Length-Value(General result, Additional information on result) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_RESULT | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_RESULT | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_RESULT_TERMINAL_CRNTLY_UNABLE_TO_PROCESS); - do_check_eq(pduHelper.readHexOctet(), aInfo); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_RESULT_TERMINAL_CRNTLY_UNABLE_TO_PROCESS); + equal(pduHelper.readHexOctet(), aInfo); }; let response = { @@ -545,23 +545,23 @@ add_test(function test_write_location_info_tlv() { tlvHelper.writeLocationInfoTlv(loc); let tag = pduHelper.readHexOctet(); - do_check_eq(tag, COMPREHENSIONTLV_TAG_LOCATION_INFO | + equal(tag, COMPREHENSIONTLV_TAG_LOCATION_INFO | COMPREHENSIONTLV_FLAG_CR); let length = pduHelper.readHexOctet(); - do_check_eq(length, 9); + equal(length, 9); let mcc_mnc = pduHelper.readSwappedNibbleBcdString(3); - do_check_eq(mcc_mnc, "46692"); + equal(mcc_mnc, "46692"); let lac = (pduHelper.readHexOctet() << 8) | pduHelper.readHexOctet(); - do_check_eq(lac, 10291); + equal(lac, 10291); let cellId = (pduHelper.readHexOctet() << 24) | (pduHelper.readHexOctet() << 16) | (pduHelper.readHexOctet() << 8) | (pduHelper.readHexOctet()); - do_check_eq(cellId, 19072823); + equal(cellId, 19072823); // Test with 1-digit mnc, and gsmCellId obtained from GSM network. loc = { @@ -573,20 +573,20 @@ add_test(function test_write_location_info_tlv() { tlvHelper.writeLocationInfoTlv(loc); tag = pduHelper.readHexOctet(); - do_check_eq(tag, COMPREHENSIONTLV_TAG_LOCATION_INFO | + equal(tag, COMPREHENSIONTLV_TAG_LOCATION_INFO | COMPREHENSIONTLV_FLAG_CR); length = pduHelper.readHexOctet(); - do_check_eq(length, 7); + equal(length, 7); mcc_mnc = pduHelper.readSwappedNibbleBcdString(3); - do_check_eq(mcc_mnc, "46602"); + equal(mcc_mnc, "46602"); lac = (pduHelper.readHexOctet() << 8) | pduHelper.readHexOctet(); - do_check_eq(lac, 10291); + equal(lac, 10291); cellId = (pduHelper.readHexOctet() << 8) | (pduHelper.readHexOctet()); - do_check_eq(cellId, 65534); + equal(cellId, 65534); // Test with 3-digit mnc, and gsmCellId obtained from GSM network. loc = { @@ -598,20 +598,20 @@ add_test(function test_write_location_info_tlv() { tlvHelper.writeLocationInfoTlv(loc); tag = pduHelper.readHexOctet(); - do_check_eq(tag, COMPREHENSIONTLV_TAG_LOCATION_INFO | + equal(tag, COMPREHENSIONTLV_TAG_LOCATION_INFO | COMPREHENSIONTLV_FLAG_CR); length = pduHelper.readHexOctet(); - do_check_eq(length, 7); + equal(length, 7); mcc_mnc = pduHelper.readSwappedNibbleBcdString(3); - do_check_eq(mcc_mnc, "466222"); + equal(mcc_mnc, "466222"); lac = (pduHelper.readHexOctet() << 8) | pduHelper.readHexOctet(); - do_check_eq(lac, 10291); + equal(lac, 10291); cellId = (pduHelper.readHexOctet() << 8) | (pduHelper.readHexOctet()); - do_check_eq(cellId, 65534); + equal(cellId, 65534); run_next_test(); }); @@ -627,13 +627,13 @@ add_test(function test_write_disconnecting_cause() { tlvHelper.writeCauseTlv(RIL_ERROR_TO_GECKO_ERROR[ERROR_GENERIC_FAILURE]); let tag = pduHelper.readHexOctet(); - do_check_eq(tag, COMPREHENSIONTLV_TAG_CAUSE | COMPREHENSIONTLV_FLAG_CR); + equal(tag, COMPREHENSIONTLV_TAG_CAUSE | COMPREHENSIONTLV_FLAG_CR); let len = pduHelper.readHexOctet(); - do_check_eq(len, 2); // We have one cause. + equal(len, 2); // We have one cause. let standard = pduHelper.readHexOctet(); - do_check_eq(standard, 0x60); + equal(standard, 0x60); let cause = pduHelper.readHexOctet(); - do_check_eq(cause, 0x80 | ERROR_GENERIC_FAILURE); + equal(cause, 0x80 | ERROR_GENERIC_FAILURE); run_next_test(); }); @@ -647,16 +647,16 @@ add_test(function test_get_size_of_length_octets() { let tlvHelper = context.ComprehensionTlvHelper; let length = 0x70; - do_check_eq(tlvHelper.getSizeOfLengthOctets(length), 1); + equal(tlvHelper.getSizeOfLengthOctets(length), 1); length = 0x80; - do_check_eq(tlvHelper.getSizeOfLengthOctets(length), 2); + equal(tlvHelper.getSizeOfLengthOctets(length), 2); length = 0x180; - do_check_eq(tlvHelper.getSizeOfLengthOctets(length), 3); + equal(tlvHelper.getSizeOfLengthOctets(length), 3); length = 0x18000; - do_check_eq(tlvHelper.getSizeOfLengthOctets(length), 4); + equal(tlvHelper.getSizeOfLengthOctets(length), 4); run_next_test(); }); @@ -672,25 +672,25 @@ add_test(function test_write_length() { let length = 0x70; tlvHelper.writeLength(length); - do_check_eq(pduHelper.readHexOctet(), length); + equal(pduHelper.readHexOctet(), length); length = 0x80; tlvHelper.writeLength(length); - do_check_eq(pduHelper.readHexOctet(), 0x81); - do_check_eq(pduHelper.readHexOctet(), length); + equal(pduHelper.readHexOctet(), 0x81); + equal(pduHelper.readHexOctet(), length); length = 0x180; tlvHelper.writeLength(length); - do_check_eq(pduHelper.readHexOctet(), 0x82); - do_check_eq(pduHelper.readHexOctet(), (length >> 8) & 0xff); - do_check_eq(pduHelper.readHexOctet(), length & 0xff); + equal(pduHelper.readHexOctet(), 0x82); + equal(pduHelper.readHexOctet(), (length >> 8) & 0xff); + equal(pduHelper.readHexOctet(), length & 0xff); length = 0x18000; tlvHelper.writeLength(length); - do_check_eq(pduHelper.readHexOctet(), 0x83); - do_check_eq(pduHelper.readHexOctet(), (length >> 16) & 0xff); - do_check_eq(pduHelper.readHexOctet(), (length >> 8) & 0xff); - do_check_eq(pduHelper.readHexOctet(), length & 0xff); + equal(pduHelper.readHexOctet(), 0x83); + equal(pduHelper.readHexOctet(), (length >> 16) & 0xff); + equal(pduHelper.readHexOctet(), (length >> 8) & 0xff); + equal(pduHelper.readHexOctet(), length & 0xff); run_next_test(); }); @@ -731,7 +731,7 @@ function test_stk_proactive_command(aOptions) { let ctlvs = berTlv.value; let ctlv = stkHelper.searchForTag(COMPREHENSIONTLV_TAG_COMMAND_DETAILS, ctlvs); let cmdDetails = ctlv.value; - do_check_eq(cmdDetails.typeOfCommand, testTypeOfCommand); + equal(cmdDetails.typeOfCommand, testTypeOfCommand); stkFactory.createParam(cmdDetails, ctlvs, (aResult) => { cmdDetails.options = aResult; @@ -766,19 +766,19 @@ add_test(function test_stk_proactive_command_search_for_selected_tags() { let selectedCtlvs = stkHelper.searchForSelectedTags(berTlv.value, [COMPREHENSIONTLV_TAG_ALPHA_ID]); let tlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID); - do_check_eq(tlv.value.identifier, "alpha id 1"); + equal(tlv.value.identifier, "alpha id 1"); tlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID); - do_check_eq(tlv.value.identifier, "alpha id 2"); + equal(tlv.value.identifier, "alpha id 2"); tlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID); - do_check_eq(tlv.value.identifier, "alpha id 3"); + equal(tlv.value.identifier, "alpha id 3"); tlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID); - do_check_eq(tlv.value.identifier, "alpha id 4"); + equal(tlv.value.identifier, "alpha id 4"); tlv = selectedCtlvs.retrieve(COMPREHENSIONTLV_TAG_ALPHA_ID); - do_check_eq(tlv.value.identifier, "alpha id 5"); + equal(tlv.value.identifier, "alpha id 5"); run_next_test(); }); @@ -800,7 +800,7 @@ add_test(function test_stk_proactive_command_refresh() { testFunc: (context, cmdDetails, ctlvs) => { let stkHelper = context.StkProactiveCmdHelper; let ctlv = stkHelper.searchForTag(COMPREHENSIONTLV_TAG_FILE_LIST, ctlvs); - do_check_eq(ctlv.value.fileList, "3F002FE2"); + equal(ctlv.value.fileList, "3F002FE2"); } }); @@ -827,12 +827,12 @@ add_test(function test_stk_proactive_command_play_tone() { testFunc: (context, cmdDetails, ctlvs) => { let playTone = cmdDetails.options; - do_check_eq(playTone.text, "Dial Tone"); - do_check_eq(playTone.tone, STK_TONE_TYPE_DIAL_TONE); - do_check_eq(playTone.duration.timeUnit, STK_TIME_UNIT_SECOND); - do_check_eq(playTone.duration.timeInterval, 5); - do_check_eq(playTone.iconSelfExplanatory, true); - do_check_eq(playTone.icons, 1); + equal(playTone.text, "Dial Tone"); + equal(playTone.tone, STK_TONE_TYPE_DIAL_TONE); + equal(playTone.duration.timeUnit, STK_TIME_UNIT_SECOND); + equal(playTone.duration.timeInterval, 5); + equal(playTone.iconSelfExplanatory, true); + equal(playTone.icons, 1); } }); @@ -856,8 +856,8 @@ add_test(function test_stk_proactive_command_poll_interval() { testFunc: (context, cmdDetails, ctlvs) => { let interval = cmdDetails.options; - do_check_eq(interval.timeUnit, STK_TIME_UNIT_SECOND); - do_check_eq(interval.timeInterval, 0x14); + equal(interval.timeUnit, STK_TIME_UNIT_SECOND); + equal(interval.timeInterval, 0x14); } }); @@ -884,9 +884,9 @@ add_test(function test_stk_proactive_command_display_text() { testFunc: (context, cmdDetails, ctlvs) => { let textMsg = cmdDetails.options; - do_check_eq(textMsg.text, "Saldo 2.04 E. Validez 20/05/13. "); - do_check_eq(textMsg.iconSelfExplanatory, true); - do_check_eq(textMsg.icons, 1); + equal(textMsg.text, "Saldo 2.04 E. Validez 20/05/13. "); + equal(textMsg.iconSelfExplanatory, true); + equal(textMsg.icons, 1); } }); @@ -910,10 +910,10 @@ add_test(function test_stk_proactive_command_event_list() { testFunc: (context, cmdDetails, ctlvs) => { let event = cmdDetails.options; - do_check_eq(Array.isArray(event.eventList), true); + equal(Array.isArray(event.eventList), true); for (let i = 0; i < event.eventList.length; i++) { - do_check_eq(event.eventList[i], i); + equal(event.eventList[i], i); } } }); @@ -941,17 +941,17 @@ add_test(function test_stk_proactive_command_get_input() { testFunc: (context, cmdDetails, ctlvs) => { let input = cmdDetails.options; - do_check_eq(input.text, "Text"); - do_check_eq(input.isAlphabet, true); - do_check_eq(input.isUCS2, true); - do_check_eq(input.hideInput, true); - do_check_eq(input.isPacked, true); - do_check_eq(input.isHelpAvailable, true); - do_check_eq(input.minLength, 0x01); - do_check_eq(input.maxLength, 0x10); - do_check_eq(input.defaultText, "Default"); - do_check_eq(input.iconSelfExplanatory, true); - do_check_eq(input.icons, 1); + equal(input.text, "Text"); + equal(input.isAlphabet, true); + equal(input.isUCS2, true); + equal(input.hideInput, true); + equal(input.isPacked, true); + equal(input.isHelpAvailable, true); + equal(input.minLength, 0x01); + equal(input.maxLength, 0x10); + equal(input.defaultText, "Default"); + equal(input.iconSelfExplanatory, true); + equal(input.icons, 1); } }); @@ -970,10 +970,10 @@ add_test(function test_stk_proactive_command_get_input() { testFunc: (context, cmdDetails, ctlvs) => { let input = cmdDetails.options; - do_check_eq(input.text, null); - do_check_eq(input.minLength, 0x01); - do_check_eq(input.maxLength, 0x10); - do_check_eq(input.defaultText, null); + equal(input.text, null); + equal(input.minLength, 0x01); + equal(input.maxLength, 0x10); + equal(input.defaultText, null); } }); @@ -1003,9 +1003,9 @@ add_test(function test_stk_proactive_command_more_time() { let berTlv = berHelper.decode(more_time_1.length); let ctlvs = berTlv.value; let tlv = stkHelper.searchForTag(COMPREHENSIONTLV_TAG_COMMAND_DETAILS, ctlvs); - do_check_eq(tlv.value.commandNumber, 0x01); - do_check_eq(tlv.value.typeOfCommand, STK_CMD_MORE_TIME); - do_check_eq(tlv.value.commandQualifier, 0x00); + equal(tlv.value.commandNumber, 0x01); + equal(tlv.value.typeOfCommand, STK_CMD_MORE_TIME); + equal(tlv.value.commandQualifier, 0x00); run_next_test(); }); @@ -1034,25 +1034,25 @@ add_test(function test_stk_proactive_command_select_item() { testFunc: (context, cmdDetails, ctlvs) => { let menu = cmdDetails.options; - do_check_eq(menu.title, "Title"); - do_check_eq(menu.iconSelfExplanatory, true); - do_check_eq(menu.icons, 1); - do_check_eq(menu.items[0].identifier, 1); - do_check_eq(menu.items[0].text, "item 1"); - do_check_eq(menu.items[0].iconSelfExplanatory, true); - do_check_eq(menu.items[0].icons, 1); - do_check_eq(menu.items[1].identifier, 2); - do_check_eq(menu.items[1].text, "item 2"); - do_check_eq(menu.items[1].iconSelfExplanatory, true); - do_check_eq(menu.items[1].icons, 2); - do_check_eq(menu.items[2].identifier, 3); - do_check_eq(menu.items[2].text, "item 3"); - do_check_eq(menu.items[2].iconSelfExplanatory, true); - do_check_eq(menu.items[2].icons, 3); - do_check_eq(menu.nextActionList[0], STK_CMD_SET_UP_CALL); - do_check_eq(menu.nextActionList[1], STK_CMD_LAUNCH_BROWSER); - do_check_eq(menu.nextActionList[2], STK_CMD_PLAY_TONE); - do_check_eq(menu.defaultItem, 0x00); + equal(menu.title, "Title"); + equal(menu.iconSelfExplanatory, true); + equal(menu.icons, 1); + equal(menu.items[0].identifier, 1); + equal(menu.items[0].text, "item 1"); + equal(menu.items[0].iconSelfExplanatory, true); + equal(menu.items[0].icons, 1); + equal(menu.items[1].identifier, 2); + equal(menu.items[1].text, "item 2"); + equal(menu.items[1].iconSelfExplanatory, true); + equal(menu.items[1].icons, 2); + equal(menu.items[2].identifier, 3); + equal(menu.items[2].text, "item 3"); + equal(menu.items[2].iconSelfExplanatory, true); + equal(menu.items[2].icons, 3); + equal(menu.nextActionList[0], STK_CMD_SET_UP_CALL); + equal(menu.nextActionList[1], STK_CMD_LAUNCH_BROWSER); + equal(menu.nextActionList[2], STK_CMD_PLAY_TONE); + equal(menu.defaultItem, 0x00); } }); @@ -1074,17 +1074,17 @@ add_test(function test_stk_proactive_command_select_item() { testFunc: (context, cmdDetails, ctlvs) => { let menu = cmdDetails.options; - do_check_eq(menu.title, "Title"); - do_check_eq(menu.items[0].identifier, 1); - do_check_eq(menu.items[0].text, "item 1"); - do_check_eq(menu.items[1].identifier, 2); - do_check_eq(menu.items[1].text, "item 2"); - do_check_eq(menu.items[2].identifier, 3); - do_check_eq(menu.items[2].text, "item 3"); - do_check_eq(menu.nextActionList[0], STK_NEXT_ACTION_NULL); - do_check_eq(menu.nextActionList[1], STK_CMD_LAUNCH_BROWSER); - do_check_eq(menu.nextActionList[2], STK_NEXT_ACTION_END_PROACTIVE_SESSION); - do_check_eq(menu.defaultItem, 0x02); + equal(menu.title, "Title"); + equal(menu.items[0].identifier, 1); + equal(menu.items[0].text, "item 1"); + equal(menu.items[1].identifier, 2); + equal(menu.items[1].text, "item 2"); + equal(menu.items[2].identifier, 3); + equal(menu.items[2].text, "item 3"); + equal(menu.nextActionList[0], STK_NEXT_ACTION_NULL); + equal(menu.nextActionList[1], STK_CMD_LAUNCH_BROWSER); + equal(menu.nextActionList[2], STK_NEXT_ACTION_END_PROACTIVE_SESSION); + equal(menu.defaultItem, 0x02); } }); @@ -1114,24 +1114,24 @@ add_test(function test_stk_proactive_command_set_up_menu() { testFunc: (context, cmdDetails, ctlvs) => { let menu = cmdDetails.options; - do_check_eq(menu.title, "Title"); - do_check_eq(menu.iconSelfExplanatory, true); - do_check_eq(menu.icons, 1); - do_check_eq(menu.items[0].identifier, 1); - do_check_eq(menu.items[0].text, "item 1"); - do_check_eq(menu.items[0].iconSelfExplanatory, true); - do_check_eq(menu.items[0].icons, 1); - do_check_eq(menu.items[1].identifier, 2); - do_check_eq(menu.items[1].text, "item 2"); - do_check_eq(menu.items[1].iconSelfExplanatory, true); - do_check_eq(menu.items[1].icons, 2); - do_check_eq(menu.items[2].identifier, 3); - do_check_eq(menu.items[2].text, "item 3"); - do_check_eq(menu.items[2].iconSelfExplanatory, true); - do_check_eq(menu.items[2].icons, 3); - do_check_eq(menu.nextActionList[0], STK_CMD_SET_UP_CALL); - do_check_eq(menu.nextActionList[1], STK_CMD_LAUNCH_BROWSER); - do_check_eq(menu.nextActionList[2], STK_CMD_PLAY_TONE); + equal(menu.title, "Title"); + equal(menu.iconSelfExplanatory, true); + equal(menu.icons, 1); + equal(menu.items[0].identifier, 1); + equal(menu.items[0].text, "item 1"); + equal(menu.items[0].iconSelfExplanatory, true); + equal(menu.items[0].icons, 1); + equal(menu.items[1].identifier, 2); + equal(menu.items[1].text, "item 2"); + equal(menu.items[1].iconSelfExplanatory, true); + equal(menu.items[1].icons, 2); + equal(menu.items[2].identifier, 3); + equal(menu.items[2].text, "item 3"); + equal(menu.items[2].iconSelfExplanatory, true); + equal(menu.items[2].icons, 3); + equal(menu.nextActionList[0], STK_CMD_SET_UP_CALL); + equal(menu.nextActionList[1], STK_CMD_LAUNCH_BROWSER); + equal(menu.nextActionList[2], STK_CMD_PLAY_TONE); } }); @@ -1152,16 +1152,16 @@ add_test(function test_stk_proactive_command_set_up_menu() { testFunc: (context, cmdDetails, ctlvs) => { let menu = cmdDetails.options; - do_check_eq(menu.title, "Title"); - do_check_eq(menu.items[0].identifier, 1); - do_check_eq(menu.items[0].text, "item 1"); - do_check_eq(menu.items[1].identifier, 2); - do_check_eq(menu.items[1].text, "item 2"); - do_check_eq(menu.items[2].identifier, 3); - do_check_eq(menu.items[2].text, "item 3"); - do_check_eq(menu.nextActionList[0], STK_NEXT_ACTION_END_PROACTIVE_SESSION); - do_check_eq(menu.nextActionList[1], STK_NEXT_ACTION_NULL); - do_check_eq(menu.nextActionList[2], STK_NEXT_ACTION_NULL); + equal(menu.title, "Title"); + equal(menu.items[0].identifier, 1); + equal(menu.items[0].text, "item 1"); + equal(menu.items[1].identifier, 2); + equal(menu.items[1].text, "item 2"); + equal(menu.items[2].identifier, 3); + equal(menu.items[2].text, "item 3"); + equal(menu.nextActionList[0], STK_NEXT_ACTION_END_PROACTIVE_SESSION); + equal(menu.nextActionList[1], STK_NEXT_ACTION_NULL); + equal(menu.nextActionList[2], STK_NEXT_ACTION_NULL); } }); @@ -1189,13 +1189,13 @@ add_test(function test_stk_proactive_command_set_up_call() { testFunc: (context, cmdDetails, ctlvs) => { let setupCall = cmdDetails.options; - do_check_eq(setupCall.address, "012340123456,1,2"); - do_check_eq(setupCall.confirmMessage.text, "Disconnect"); - do_check_eq(setupCall.confirmMessage.iconSelfExplanatory, true); - do_check_eq(setupCall.confirmMessage.icons, 1); - do_check_eq(setupCall.callMessage.text, "Message"); - do_check_eq(setupCall.callMessage.iconSelfExplanatory, false); - do_check_eq(setupCall.callMessage.icons, 2); + equal(setupCall.address, "012340123456,1,2"); + equal(setupCall.confirmMessage.text, "Disconnect"); + equal(setupCall.confirmMessage.iconSelfExplanatory, true); + equal(setupCall.confirmMessage.icons, 1); + equal(setupCall.callMessage.text, "Message"); + equal(setupCall.callMessage.iconSelfExplanatory, false); + equal(setupCall.callMessage.icons, 2); } }); @@ -1219,12 +1219,12 @@ add_test(function test_stk_proactive_command_timer_management() { typeOfCommand: STK_CMD_TIMER_MANAGEMENT, icons: null, testFunc: (context, cmdDetails, ctlvs) => { - do_check_eq(cmdDetails.commandQualifier, STK_TIMER_START); + equal(cmdDetails.commandQualifier, STK_TIMER_START); let timer = cmdDetails.options; - do_check_eq(timer.timerId, 0x01); - do_check_eq(timer.timerValue, (0x01 * 60 * 60) + (0x02 * 60) + 0x03); + equal(timer.timerId, 0x01); + equal(timer.timerValue, (0x01 * 60 * 60) + (0x02 * 60) + 0x03); } }); @@ -1240,12 +1240,12 @@ add_test(function test_stk_proactive_command_timer_management() { typeOfCommand: STK_CMD_TIMER_MANAGEMENT, icons: null, testFunc: (context, cmdDetails, ctlvs) => { - do_check_eq(cmdDetails.commandQualifier, STK_TIMER_DEACTIVATE); + equal(cmdDetails.commandQualifier, STK_TIMER_DEACTIVATE); let timer = cmdDetails.options; - do_check_eq(timer.timerId, 0x01); - do_check_true(timer.timerValue === undefined); + equal(timer.timerId, 0x01); + ok(timer.timerValue === undefined); } }); @@ -1274,10 +1274,10 @@ add_test(function test_stk_proactive_command_provide_local_information() { typeOfCommand: STK_CMD_PROVIDE_LOCAL_INFO, icons: null, testFunc: (context, cmdDetails, ctlvs) => { - do_check_eq(cmdDetails.commandQualifier, STK_LOCAL_INFO_IMEI); + equal(cmdDetails.commandQualifier, STK_LOCAL_INFO_IMEI); let provideLocalInfo = cmdDetails.options; - do_check_eq(provideLocalInfo.localInfoType, STK_LOCAL_INFO_IMEI); + equal(provideLocalInfo.localInfoType, STK_LOCAL_INFO_IMEI); } }); @@ -1292,10 +1292,10 @@ add_test(function test_stk_proactive_command_provide_local_information() { typeOfCommand: STK_CMD_PROVIDE_LOCAL_INFO, icons: null, testFunc: (context, cmdDetails, ctlvs) => { - do_check_eq(cmdDetails.commandQualifier, STK_LOCAL_INFO_DATE_TIME_ZONE); + equal(cmdDetails.commandQualifier, STK_LOCAL_INFO_DATE_TIME_ZONE); let provideLocalInfo = cmdDetails.options; - do_check_eq(provideLocalInfo.localInfoType, STK_LOCAL_INFO_DATE_TIME_ZONE); + equal(provideLocalInfo.localInfoType, STK_LOCAL_INFO_DATE_TIME_ZONE); } }); @@ -1327,7 +1327,7 @@ add_test(function test_stk_proactive_command_open_channel() { testFunc: (context, cmdDetails, ctlvs) => { let bipMsg = cmdDetails.options; - do_check_eq(bipMsg.text, "Open"); + equal(bipMsg.text, "Open"); } }); @@ -1345,7 +1345,7 @@ add_test(function test_stk_proactive_command_open_channel() { testFunc: (context, cmdDetails, ctlvs) => { let bipMsg = cmdDetails.options; - do_check_eq(bipMsg.text, "Close"); + equal(bipMsg.text, "Close"); } }); @@ -1363,7 +1363,7 @@ add_test(function test_stk_proactive_command_open_channel() { testFunc: (context, cmdDetails, ctlvs) => { let bipMsg = cmdDetails.options; - do_check_eq(bipMsg.text, "Receive"); + equal(bipMsg.text, "Receive"); } }); @@ -1381,7 +1381,7 @@ add_test(function test_stk_proactive_command_open_channel() { testFunc: (context, cmdDetails, ctlvs) => { let bipMsg = cmdDetails.options; - do_check_eq(bipMsg.text, "Send"); + equal(bipMsg.text, "Send"); } }); @@ -1399,7 +1399,7 @@ add_test(function test_stk_event_download_location_status() { buf.sendParcel = function() { // Type - do_check_eq(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND); + equal(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND); // Token : we don't care this.readInt32(); @@ -1408,48 +1408,48 @@ add_test(function test_stk_event_download_location_status() { // TLV_EVENT_LIST_SIZE(3) + // TLV_LOCATION_STATUS_SIZE(3) + // TLV_LOCATION_INFO_GSM_SIZE(9)) - do_check_eq(this.readInt32(), 42); + equal(this.readInt32(), 42); // BER tag - do_check_eq(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG); + equal(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG); // BER length, 19 = TLV_DEVICE_ID_SIZE(4) + // TLV_EVENT_LIST_SIZE(3) + // TLV_LOCATION_STATUS_SIZE(3) + // TLV_LOCATION_INFO_GSM_SIZE(9) - do_check_eq(pduHelper.readHexOctet(), 19); + equal(pduHelper.readHexOctet(), 19); // Event List, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_EVENT_LIST | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_EVENT_LIST | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 1); - do_check_eq(pduHelper.readHexOctet(), STK_EVENT_TYPE_LOCATION_STATUS); + equal(pduHelper.readHexOctet(), 1); + equal(pduHelper.readHexOctet(), STK_EVENT_TYPE_LOCATION_STATUS); // Device Identifies, Type-Length-Value(Source ID-Destination ID) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); // Location Status, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_LOCATION_STATUS | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_LOCATION_STATUS | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 1); - do_check_eq(pduHelper.readHexOctet(), STK_SERVICE_STATE_NORMAL); + equal(pduHelper.readHexOctet(), 1); + equal(pduHelper.readHexOctet(), STK_SERVICE_STATE_NORMAL); // Location Info, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_LOCATION_INFO | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_LOCATION_INFO | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 7); + equal(pduHelper.readHexOctet(), 7); - do_check_eq(pduHelper.readHexOctet(), 0x21); // MCC + MNC - do_check_eq(pduHelper.readHexOctet(), 0x63); - do_check_eq(pduHelper.readHexOctet(), 0x54); - do_check_eq(pduHelper.readHexOctet(), 0); // LAC - do_check_eq(pduHelper.readHexOctet(), 0); - do_check_eq(pduHelper.readHexOctet(), 0); // Cell ID - do_check_eq(pduHelper.readHexOctet(), 0); + equal(pduHelper.readHexOctet(), 0x21); // MCC + MNC + equal(pduHelper.readHexOctet(), 0x63); + equal(pduHelper.readHexOctet(), 0x54); + equal(pduHelper.readHexOctet(), 0); // LAC + equal(pduHelper.readHexOctet(), 0); + equal(pduHelper.readHexOctet(), 0); // Cell ID + equal(pduHelper.readHexOctet(), 0); run_next_test(); }; @@ -1483,7 +1483,7 @@ add_test(function test_stk_event_download_language_selection() { buf.sendParcel = function() { // Type - do_check_eq(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND); + equal(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND); // Token : we don't care this.readInt32(); @@ -1491,33 +1491,33 @@ add_test(function test_stk_event_download_language_selection() { // Data Size, 26 = 2 * (2 + TLV_DEVICE_ID_SIZE(4) + // TLV_EVENT_LIST_SIZE(3) + // TLV_LANGUAGE(4)) - do_check_eq(this.readInt32(), 26); + equal(this.readInt32(), 26); // BER tag - do_check_eq(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG); + equal(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG); // BER length, 19 = TLV_DEVICE_ID_SIZE(4) + // TLV_EVENT_LIST_SIZE(3) + // TLV_LANGUAGE(4) - do_check_eq(pduHelper.readHexOctet(), 11); + equal(pduHelper.readHexOctet(), 11); // Event List, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_EVENT_LIST | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_EVENT_LIST | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 1); - do_check_eq(pduHelper.readHexOctet(), STK_EVENT_TYPE_LANGUAGE_SELECTION); + equal(pduHelper.readHexOctet(), 1); + equal(pduHelper.readHexOctet(), STK_EVENT_TYPE_LANGUAGE_SELECTION); // Device Identifies, Type-Length-Value(Source ID-Destination ID) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); // Language, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_LANGUAGE); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(iccHelper.read8BitUnpackedToString(2), "zh"); + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_LANGUAGE); + equal(pduHelper.readHexOctet(), 2); + equal(iccHelper.read8BitUnpackedToString(2), "zh"); run_next_test(); }; @@ -1542,32 +1542,32 @@ add_test(function test_stk_event_download_user_activity() { buf.sendParcel = function() { // Type - do_check_eq(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND); + equal(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND); // Token : we don't care this.readInt32(); // Data Size, 18 = 2 * (2 + TLV_DEVICE_ID_SIZE(4) + TLV_EVENT_LIST_SIZE(3)) - do_check_eq(this.readInt32(), 18); + equal(this.readInt32(), 18); // BER tag - do_check_eq(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG); + equal(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG); // BER length, 7 = TLV_DEVICE_ID_SIZE(4) + TLV_EVENT_LIST_SIZE(3) - do_check_eq(pduHelper.readHexOctet(), 7); + equal(pduHelper.readHexOctet(), 7); // Event List, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_EVENT_LIST | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_EVENT_LIST | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 1); - do_check_eq(pduHelper.readHexOctet(), STK_EVENT_TYPE_USER_ACTIVITY); + equal(pduHelper.readHexOctet(), 1); + equal(pduHelper.readHexOctet(), STK_EVENT_TYPE_USER_ACTIVITY); // Device Identities, Type-Length-Value(Source ID-Destination ID) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); run_next_test(); }; @@ -1591,32 +1591,32 @@ add_test(function test_stk_event_download_idle_screen_available() { buf.sendParcel = function() { // Type - do_check_eq(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND); + equal(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND); // Token : we don't care this.readInt32(); // Data Size, 18 = 2 * (2 + TLV_DEVICE_ID_SIZE(4) + TLV_EVENT_LIST_SIZE(3)) - do_check_eq(this.readInt32(), 18); + equal(this.readInt32(), 18); // BER tag - do_check_eq(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG); + equal(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG); // BER length, 7 = TLV_DEVICE_ID_SIZE(4) + TLV_EVENT_LIST_SIZE(3) - do_check_eq(pduHelper.readHexOctet(), 7); + equal(pduHelper.readHexOctet(), 7); // Event List, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_EVENT_LIST | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_EVENT_LIST | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 1); - do_check_eq(pduHelper.readHexOctet(), STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE); + equal(pduHelper.readHexOctet(), 1); + equal(pduHelper.readHexOctet(), STK_EVENT_TYPE_IDLE_SCREEN_AVAILABLE); // Device Identities, Type-Length-Value(Source ID-Destination ID) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_DISPLAY); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_DISPLAY); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); run_next_test(); }; @@ -1640,40 +1640,40 @@ add_test(function test_stk_event_download_browser_termination() { buf.sendParcel = function() { // Type - do_check_eq(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND); + equal(this.readInt32(), REQUEST_STK_SEND_ENVELOPE_COMMAND); // Token : we don't care this.readInt32(); // Data Size, 24 = 2 * ( 2+TLV_DEVICE_ID(4)+TLV_EVENT_LIST_SIZE(3) // +TLV_BROWSER_TERMINATION_CAUSE(3) ) - do_check_eq(this.readInt32(), 24); + equal(this.readInt32(), 24); // BER tag - do_check_eq(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG); + equal(pduHelper.readHexOctet(), BER_EVENT_DOWNLOAD_TAG); // BER length, 10 = TLV_DEVICE_ID(4)+TLV_EVENT_LIST_SIZE(3) // ++TLV_BROWSER_TERMINATION_CAUSE(3) - do_check_eq(pduHelper.readHexOctet(), 10); + equal(pduHelper.readHexOctet(), 10); // Event List, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_EVENT_LIST | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_EVENT_LIST | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 1); - do_check_eq(pduHelper.readHexOctet(), STK_EVENT_TYPE_BROWSER_TERMINATION); + equal(pduHelper.readHexOctet(), 1); + equal(pduHelper.readHexOctet(), STK_EVENT_TYPE_BROWSER_TERMINATION); // Device Identities, Type-Length-Value(Source ID-Destination ID) - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_DEVICE_ID | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 2); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); - do_check_eq(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); + equal(pduHelper.readHexOctet(), 2); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_ME); + equal(pduHelper.readHexOctet(), STK_DEVICE_ID_SIM); // Browser Termination Case, Type-Length-Value - do_check_eq(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_BROWSER_TERMINATION_CAUSE | + equal(pduHelper.readHexOctet(), COMPREHENSIONTLV_TAG_BROWSER_TERMINATION_CAUSE | COMPREHENSIONTLV_FLAG_CR); - do_check_eq(pduHelper.readHexOctet(), 1); - do_check_eq(pduHelper.readHexOctet(), STK_BROWSER_TERMINATION_CAUSE_USER); + equal(pduHelper.readHexOctet(), 1); + equal(pduHelper.readHexOctet(), STK_BROWSER_TERMINATION_CAUSE_USER); run_next_test(); }; diff --git a/dom/system/gonk/tests/test_ril_worker_voiceprivacy.js b/dom/system/gonk/tests/test_ril_worker_voiceprivacy.js index 87422c48561..e625a639d1b 100644 --- a/dom/system/gonk/tests/test_ril_worker_voiceprivacy.js +++ b/dom/system/gonk/tests/test_ril_worker_voiceprivacy.js @@ -24,7 +24,7 @@ add_test(function test_setVoicePrivacyMode_success() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, undefined); + equal(postedMessage.errorMsg, undefined); run_next_test(); }); @@ -46,7 +46,7 @@ add_test(function test_setVoicePrivacyMode_generic_failure() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, "GenericFailure"); + equal(postedMessage.errorMsg, "GenericFailure"); run_next_test(); }); @@ -70,8 +70,8 @@ add_test(function test_queryVoicePrivacyMode_success_enabled_true() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, undefined); - do_check_true(postedMessage.enabled); + equal(postedMessage.errorMsg, undefined); + ok(postedMessage.enabled); run_next_test(); }); @@ -94,7 +94,7 @@ add_test(function test_queryVoicePrivacyMode_success_enabled_false() { let postedMessage = workerHelper.postedMessage; - do_check_eq(postedMessage.errorMsg, undefined); - do_check_false(postedMessage.enabled); + equal(postedMessage.errorMsg, undefined); + ok(!postedMessage.enabled); run_next_test(); }); From a52428237356b3e1e41c2a933b7d062738ceece0 Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Mon, 23 Feb 2015 17:57:25 -0500 Subject: [PATCH 13/68] Bug 1134891 - Make the print progress dialog for Windows and Linux be opened by the browser window's nsIDOMWindow instead of the content window. r=smaug. --- .../printingui/unixshared/nsPrintProgress.cpp | 34 ++++++++++++++++--- .../printingui/win/nsPrintProgress.cpp | 29 +++++++++++++--- 2 files changed, 55 insertions(+), 8 deletions(-) diff --git a/embedding/components/printingui/unixshared/nsPrintProgress.cpp b/embedding/components/printingui/unixshared/nsPrintProgress.cpp index 3df417c84e1..426da9d46eb 100644 --- a/embedding/components/printingui/unixshared/nsPrintProgress.cpp +++ b/embedding/components/printingui/unixshared/nsPrintProgress.cpp @@ -6,10 +6,16 @@ #include "nsPrintProgress.h" #include "nsIBaseWindow.h" +#include "nsIDocShell.h" +#include "nsIDocShellTreeOwner.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsISupportsArray.h" +#include "nsIXULWindow.h" #include "nsXPCOM.h" #include "nsISupportsPrimitives.h" #include "nsIComponentManager.h" +#include "nsPIDOMWindow.h" + NS_IMPL_ADDREF(nsPrintProgress) NS_IMPL_RELEASE(nsPrintProgress) @@ -71,12 +77,32 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent, array->AppendElement(parameters); + // We will set the opener of the dialog to be the nsIDOMWindow for the + // browser XUL window itself, as opposed to the content. That way, the + // progress window has access to the opener. + nsCOMPtr pParentWindow = do_QueryInterface(parent); + NS_ENSURE_STATE(pParentWindow); + + nsCOMPtr docShell = pParentWindow->GetDocShell(); + NS_ENSURE_STATE(docShell); + + nsCOMPtr owner; + docShell->GetTreeOwner(getter_AddRefs(owner)); + + nsCOMPtr ownerXULWindow = do_GetInterface(owner); + nsCOMPtr ownerWindow = do_GetInterface(ownerXULWindow); + NS_ENSURE_STATE(ownerWindow); + + MOZ_ASSERT_UNREACHABLE("This is a test to see if this can even compile. " + "I don't remember if C++ is this cool."); + // Open the dialog. nsCOMPtr newWindow; - rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), - NS_LITERAL_STRING("_blank"), - NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), - array, getter_AddRefs(newWindow)); + + rv = ownerWindow->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), + NS_LITERAL_STRING("_blank"), + NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), + array, getter_AddRefs(newWindow)); } return rv; diff --git a/embedding/components/printingui/win/nsPrintProgress.cpp b/embedding/components/printingui/win/nsPrintProgress.cpp index d711bddb132..1edb75b45f7 100644 --- a/embedding/components/printingui/win/nsPrintProgress.cpp +++ b/embedding/components/printingui/win/nsPrintProgress.cpp @@ -6,11 +6,16 @@ #include "nsPrintProgress.h" #include "nsIBaseWindow.h" +#include "nsIDocShell.h" +#include "nsIDocShellTreeOwner.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsISupportsArray.h" +#include "nsIXULWindow.h" #include "nsXPCOM.h" #include "nsISupportsPrimitives.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" +#include "nsPIDOMWindow.h" #if 0 NS_IMPL_ADDREF(nsPrintProgress) @@ -100,12 +105,28 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent, array->AppendElement(parameters); + // We will set the opener of the dialog to be the nsIDOMWindow for the + // browser XUL window itself, as opposed to the content. That way, the + // progress window has access to the opener. + nsCOMPtr pParentWindow = do_QueryInterface(parent); + NS_ENSURE_STATE(pParentWindow); + + nsCOMPtr docShell = pParentWindow->GetDocShell(); + NS_ENSURE_STATE(docShell); + + nsCOMPtr owner; + docShell->GetTreeOwner(getter_AddRefs(owner)); + + nsCOMPtr ownerXULWindow = do_GetInterface(owner); + nsCOMPtr ownerWindow = do_GetInterface(ownerXULWindow); + NS_ENSURE_STATE(ownerWindow); + // Open the dialog. nsCOMPtr newWindow; - rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), - NS_LITERAL_STRING("_blank"), - NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), - array, getter_AddRefs(newWindow)); + rv = ownerWindow->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), + NS_LITERAL_STRING("_blank"), + NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), + array, getter_AddRefs(newWindow)); } return rv; From 0dcaf1fc1679edefdb063e13a99126051a3c5ddb Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Mon, 23 Feb 2015 18:01:52 -0500 Subject: [PATCH 14/68] Bug 1134891 - Print progress code paths for OS X should be unreachable. r=trivial. These code paths should never be reached, since nsPrintingPromptService returns NS_ERROR_NOT_IMPLEMENTED for ShowProgress. Bug 1135901 has been filed to remove this dead code entirely. --- .../printingui/mac/nsPrintProgress.cpp | 54 ++++--------------- 1 file changed, 10 insertions(+), 44 deletions(-) diff --git a/embedding/components/printingui/mac/nsPrintProgress.cpp b/embedding/components/printingui/mac/nsPrintProgress.cpp index a35b21a5157..29c52daf688 100644 --- a/embedding/components/printingui/mac/nsPrintProgress.cpp +++ b/embedding/components/printingui/mac/nsPrintProgress.cpp @@ -42,55 +42,21 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent, nsIObserver *openDialogObserver, bool *notifyOnOpen) { - m_observer = openDialogObserver; - - nsresult rv = NS_ERROR_FAILURE; - - if (m_dialog) - return NS_ERROR_ALREADY_INITIALIZED; - - if (!dialogURL || !*dialogURL) - return NS_ERROR_INVALID_ARG; - - if (parent) - { - // Set up window.arguments[0]... - nsCOMPtr array; - rv = NS_NewISupportsArray(getter_AddRefs(array)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr ifptr = - do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - ifptr->SetData(static_cast(this)); - ifptr->SetDataIID(&NS_GET_IID(nsIPrintProgress)); - - array->AppendElement(ifptr); - - array->AppendElement(parameters); - - // Open the dialog. - nsCOMPtr newWindow; - rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), - NS_LITERAL_STRING("_blank"), - NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), - array, getter_AddRefs(newWindow)); - if (NS_SUCCEEDED(rv)) { - *notifyOnOpen = true; - } - } - - return rv; + MOZ_ASSERT_UNREACHABLE("The nsPrintingPromptService::ShowProgress " + "implementation for OS X returns " + "NS_ERROR_NOT_IMPLEMENTED, so we should never get " + "here."); + return NS_ERROR_NOT_IMPLEMENTED; } /* void closeProgressDialog (in boolean forceClose); */ NS_IMETHODIMP nsPrintProgress::CloseProgressDialog(bool forceClose) { - m_closeProgress = true; - // XXX Casting bool to nsresult - return OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, - static_cast(forceClose)); + MOZ_ASSERT_UNREACHABLE("The nsPrintingPromptService::ShowProgress " + "implementation for OS X returns " + "NS_ERROR_NOT_IMPLEMENTED, so we should never get " + "here."); + return NS_ERROR_NOT_IMPLEMENTED; } /* nsIPrompt GetPrompter (); */ From 193771a104eb94191bfd660542f05ea859859d24 Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Tue, 24 Feb 2015 10:19:41 -0800 Subject: [PATCH 15/68] Bug 1134800 - Properly cache file matching patterns; r=glandium The regular expression cache for mozpack.path.match was keyed off the original pattern. However, that variable was mutated as part of the function and the mutated result was subsequently stored as the cache key. This effectively resulted in a 0% cache hit rate. On some tests being written for bug 1132111 which involve a full filesystem traversal for moz.build files and subsequent execution of those files, the following timings are indicative of the impact of this patch. Before: real 16.082s user 14.760s sys 1.318s After: real 6.345s user 5.085s sys 1.257s --- python/mozbuild/mozpack/path.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/python/mozbuild/mozpack/path.py b/python/mozbuild/mozpack/path.py index 20e9053e82b..1b71ace78ed 100644 --- a/python/mozbuild/mozpack/path.py +++ b/python/mozbuild/mozpack/path.py @@ -99,12 +99,12 @@ def match(path, pattern): ''' if not pattern: return True - if not pattern in re_cache: - pattern = re.escape(pattern) - pattern = re.sub(r'(^|\\\/)\\\*\\\*\\\/', r'\1(?:.+/)?', pattern) - pattern = re.sub(r'(^|\\\/)\\\*\\\*$', r'(?:\1.+)?', pattern) - pattern = pattern.replace(r'\*', '[^/]*') + '(?:/.*)?$' - re_cache[pattern] = re.compile(pattern) + if pattern not in re_cache: + p = re.escape(pattern) + p = re.sub(r'(^|\\\/)\\\*\\\*\\\/', r'\1(?:.+/)?', p) + p = re.sub(r'(^|\\\/)\\\*\\\*$', r'(?:\1.+)?', p) + p = p.replace(r'\*', '[^/]*') + '(?:/.*)?$' + re_cache[pattern] = re.compile(p) return re_cache[pattern].match(path) is not None From 572c09a7125ac8943924aac92641bf242bbcc8ed Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Wed, 25 Feb 2015 05:47:01 +0900 Subject: [PATCH 16/68] Bug 1135401 - Do not run js1_8_5/extensions/file-mapped-arraybuffers.js test if memory mapped array buffer is not supported. r=sfink --- js/src/builtin/TestingFunctions.cpp | 12 ++++++++++++ .../js1_8_5/extensions/file-mapped-arraybuffers.js | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/js/src/builtin/TestingFunctions.cpp b/js/src/builtin/TestingFunctions.cpp index 318eb53303d..cc55940a6a6 100644 --- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -183,6 +183,18 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp) if (!JS_SetProperty(cx, info, "intl-api", value)) return false; +#if defined(XP_WIN) + value = BooleanValue(false); +#elif defined(SOLARIS) + value = BooleanValue(false); +#elif defined(XP_UNIX) + value = BooleanValue(true); +#else + value = BooleanValue(false); +#endif + if (!JS_SetProperty(cx, info, "mapped-array-buffer", value)) + return false; + args.rval().setObject(*info); return true; } diff --git a/js/src/tests/js1_8_5/extensions/file-mapped-arraybuffers.js b/js/src/tests/js1_8_5/extensions/file-mapped-arraybuffers.js index 57b0eed75f3..cea0cd79956 100644 --- a/js/src/tests/js1_8_5/extensions/file-mapped-arraybuffers.js +++ b/js/src/tests/js1_8_5/extensions/file-mapped-arraybuffers.js @@ -36,5 +36,6 @@ function test() { assertThrows(() => createMappedArrayBuffer("empty.txt", 0, 8), Error); } -test(); +if (getBuildConfiguration()["mapped-array-buffer"]) + test(); reportCompare(0, 0, 'ok'); From a93118acc07a42f267f53f93eb38f3e818584f24 Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Tue, 24 Feb 2015 12:54:40 -0800 Subject: [PATCH 17/68] Bug 1087646 - Properly serialize nullprincipal URIs across IPC. r=bzbarsky --- caps/moz.build | 3 +++ caps/nsNullPrincipal.cpp | 36 +++++++++++++++++++++++------------- caps/nsNullPrincipal.h | 4 +++- caps/nsNullPrincipalURI.cpp | 34 ++++++++++++++++++++++++++++++++++ caps/nsNullPrincipalURI.h | 8 ++++++++ ipc/glue/URIParams.ipdlh | 6 ++++++ ipc/glue/URIUtils.cpp | 7 ++++++- 7 files changed, 83 insertions(+), 15 deletions(-) diff --git a/caps/moz.build b/caps/moz.build index abee4c002db..26fa9634a59 100644 --- a/caps/moz.build +++ b/caps/moz.build @@ -17,6 +17,7 @@ XPIDL_MODULE = 'caps' EXPORTS += [ 'nsJSPrincipals.h', 'nsNullPrincipal.h', + 'nsNullPrincipalURI.h', ] UNIFIED_SOURCES += [ @@ -36,6 +37,8 @@ LOCAL_INCLUDES += [ '/js/xpconnect/src', ] +include('/ipc/chromium/chromium-config.mozbuild') + FINAL_LIBRARY = 'xul' FAIL_ON_WARNINGS = True diff --git a/caps/nsNullPrincipal.cpp b/caps/nsNullPrincipal.cpp index ab1b58dae3c..158b31fd33c 100644 --- a/caps/nsNullPrincipal.cpp +++ b/caps/nsNullPrincipal.cpp @@ -1,4 +1,5 @@ /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set sw=2 sts=2 ts=2 et tw=80: */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ @@ -86,6 +87,24 @@ nsNullPrincipal::Init(uint32_t aAppId, bool aInMozBrowser) mAppId = aAppId; mInMozBrowser = aInMozBrowser; + nsCString str; + nsresult rv = GenerateNullPrincipalURI(str); + NS_ENSURE_SUCCESS(rv, rv); + + mURI = new nsNullPrincipalURI(str); + + return NS_OK; +} + +void +nsNullPrincipal::GetScriptLocation(nsACString &aStr) +{ + mURI->GetSpec(aStr); +} + +nsresult +nsNullPrincipal::GenerateNullPrincipalURI(nsACString &aStr) +{ // FIXME: bug 327161 -- make sure the uuid generator is reseeding-resistant. nsresult rv; nsCOMPtr uuidgen = @@ -104,28 +123,19 @@ nsNullPrincipal::Init(uint32_t aAppId, bool aInMozBrowser) // Use an nsCString so we only do the allocation once here and then share // with nsJSPrincipals - nsCString str; - str.SetCapacity(prefixLen + suffixLen); + aStr.SetCapacity(prefixLen + suffixLen); - str.Append(NS_NULLPRINCIPAL_PREFIX); - str.Append(chars); + aStr.Append(NS_NULLPRINCIPAL_PREFIX); + aStr.Append(chars); - if (str.Length() != prefixLen + suffixLen) { + if (aStr.Length() != prefixLen + suffixLen) { NS_WARNING("Out of memory allocating null-principal URI"); return NS_ERROR_OUT_OF_MEMORY; } - mURI = new nsNullPrincipalURI(str); - return NS_OK; } -void -nsNullPrincipal::GetScriptLocation(nsACString &aStr) -{ - mURI->GetSpec(aStr); -} - #ifdef DEBUG void nsNullPrincipal::dumpImpl() { diff --git a/caps/nsNullPrincipal.h b/caps/nsNullPrincipal.h index 09f25d0b8ce..1a6034ce9d5 100644 --- a/caps/nsNullPrincipal.h +++ b/caps/nsNullPrincipal.h @@ -31,7 +31,7 @@ class nsNullPrincipal MOZ_FINAL : public nsJSPrincipals { public: nsNullPrincipal(); - + // Our refcount is managed by nsJSPrincipals. Use this macro to avoid an // extra refcount member. @@ -49,6 +49,8 @@ public: virtual void GetScriptLocation(nsACString &aStr) MOZ_OVERRIDE; + static nsresult GenerateNullPrincipalURI(nsACString &aStr); + #ifdef DEBUG virtual void dumpImpl() MOZ_OVERRIDE; #endif diff --git a/caps/nsNullPrincipalURI.cpp b/caps/nsNullPrincipalURI.cpp index 629626de67b..4d7a884cd0e 100644 --- a/caps/nsNullPrincipalURI.cpp +++ b/caps/nsNullPrincipalURI.cpp @@ -9,6 +9,8 @@ #include "mozilla/DebugOnly.h" #include "mozilla/MemoryReporting.h" +#include "mozilla/ipc/URIParams.h" + #include "nsNetUtil.h" #include "nsEscape.h" #include "nsCRT.h" @@ -17,6 +19,12 @@ //// nsNullPrincipalURI nsNullPrincipalURI::nsNullPrincipalURI(const nsCString &aSpec) +{ + InitializeFromSpec(aSpec); +} + +void +nsNullPrincipalURI::InitializeFromSpec(const nsCString &aSpec) { int32_t dividerPosition = aSpec.FindChar(':'); NS_ASSERTION(dividerPosition != -1, "Malformed URI!"); @@ -44,6 +52,7 @@ NS_INTERFACE_MAP_BEGIN(nsNullPrincipalURI) else NS_INTERFACE_MAP_ENTRY(nsIURI) NS_INTERFACE_MAP_ENTRY(nsISizeOf) + NS_INTERFACE_MAP_ENTRY(nsIIPCSerializableURI) NS_INTERFACE_MAP_END //////////////////////////////////////////////////////////////////////////////// @@ -272,6 +281,31 @@ nsNullPrincipalURI::SchemeIs(const char *aScheme, bool *_schemeIs) return NS_OK; } +//////////////////////////////////////////////////////////////////////////////// +//// nsIIPCSerializableURI + +void +nsNullPrincipalURI::Serialize(mozilla::ipc::URIParams &aParams) +{ + aParams = mozilla::ipc::NullPrincipalURIParams(); +} + +bool +nsNullPrincipalURI::Deserialize(const mozilla::ipc::URIParams &aParams) +{ + if (aParams.type() != mozilla::ipc::URIParams::TNullPrincipalURIParams) { + MOZ_ASSERT_UNREACHABLE("unexpected URIParams type"); + return false; + } + + nsCString str; + nsresult rv = nsNullPrincipal::GenerateNullPrincipalURI(str); + NS_ENSURE_SUCCESS(rv, false); + + InitializeFromSpec(str); + return true; +} + //////////////////////////////////////////////////////////////////////////////// //// nsISizeOf diff --git a/caps/nsNullPrincipalURI.h b/caps/nsNullPrincipalURI.h index 72baf06d79e..d87005324bc 100644 --- a/caps/nsNullPrincipalURI.h +++ b/caps/nsNullPrincipalURI.h @@ -16,6 +16,7 @@ #include "nsAutoPtr.h" #include "nsString.h" #include "mozilla/Attributes.h" +#include "nsIIPCSerializableURI.h" #include "mozilla/MemoryReporting.h" // {51fcd543-3b52-41f7-b91b-6b54102236e6} @@ -25,10 +26,12 @@ class nsNullPrincipalURI MOZ_FINAL : public nsIURI , public nsISizeOf + , public nsIIPCSerializableURI { public: NS_DECL_THREADSAFE_ISUPPORTS NS_DECL_NSIURI + NS_DECL_NSIIPCSERIALIZABLEURI // nsISizeOf virtual size_t SizeOfExcludingThis(mozilla::MallocSizeOf aMallocSizeOf) const MOZ_OVERRIDE; @@ -36,9 +39,14 @@ public: explicit nsNullPrincipalURI(const nsCString &aSpec); + // NB: This constructor exists only for deserialization. + nsNullPrincipalURI() { } + private: ~nsNullPrincipalURI() {} + void InitializeFromSpec(const nsCString &aSpec); + nsCString mScheme; nsCString mPath; }; diff --git a/ipc/glue/URIParams.ipdlh b/ipc/glue/URIParams.ipdlh index 997456d2a6c..964a1fd3fa3 100644 --- a/ipc/glue/URIParams.ipdlh +++ b/ipc/glue/URIParams.ipdlh @@ -64,12 +64,18 @@ struct IconURIParams int32_t iconState; }; +struct NullPrincipalURIParams +{ + // Purposefully empty. Null principal URIs do not round-trip. +}; + union URIParams { SimpleURIParams; StandardURLParams; JARURIParams; IconURIParams; + NullPrincipalURIParams; }; union OptionalURIParams diff --git a/ipc/glue/URIUtils.cpp b/ipc/glue/URIUtils.cpp index 415ea09fb17..ba1a342faca 100644 --- a/ipc/glue/URIUtils.cpp +++ b/ipc/glue/URIUtils.cpp @@ -13,6 +13,7 @@ #include "nsID.h" #include "nsJARURI.h" #include "nsIIconURI.h" +#include "nsNullPrincipalURI.h" #include "nsNetCID.h" #include "nsNetUtil.h" #include "nsThreadUtils.h" @@ -41,7 +42,7 @@ SerializeURI(nsIURI* aURI, nsCOMPtr serializable = do_QueryInterface(aURI); if (!serializable) { - MOZ_CRASH("All IPDL URIs must be serializable scheme!"); + MOZ_CRASH("All IPDL URIs must be serializable!"); } serializable->Serialize(aParams); @@ -90,6 +91,10 @@ DeserializeURI(const URIParams& aParams) serializable = do_CreateInstance(kIconURICID); break; + case URIParams::TNullPrincipalURIParams: + serializable = new nsNullPrincipalURI(); + break; + default: MOZ_CRASH("Unknown params!"); } From 83919915e755d068a8c739f19adc46b8fb744f9f Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Tue, 24 Feb 2015 12:54:40 -0800 Subject: [PATCH 18/68] Bug 1087646 - fast-path null principal'd documents. r=mcmanus --- netwerk/cookie/CookieServiceChild.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/netwerk/cookie/CookieServiceChild.cpp b/netwerk/cookie/CookieServiceChild.cpp index 3edff1aef69..952b8514960 100644 --- a/netwerk/cookie/CookieServiceChild.cpp +++ b/netwerk/cookie/CookieServiceChild.cpp @@ -109,6 +109,13 @@ CookieServiceChild::GetCookieStringInternal(nsIURI *aHostURI, *aCookieString = nullptr; + // Fast past: don't bother sending IPC messages about nullprincipal'd + // documents. + nsAutoCString scheme; + aHostURI->GetScheme(scheme); + if (scheme.EqualsLiteral("moz-nullprincipal")) + return NS_OK; + // Determine whether the request is foreign. Failure is acceptable. bool isForeign = true; if (RequireThirdPartyCheck()) @@ -137,6 +144,13 @@ CookieServiceChild::SetCookieStringInternal(nsIURI *aHostURI, NS_ENSURE_ARG(aHostURI); NS_ENSURE_ARG_POINTER(aCookieString); + // Fast past: don't bother sending IPC messages about nullprincipal'd + // documents. + nsAutoCString scheme; + aHostURI->GetScheme(scheme); + if (scheme.EqualsLiteral("moz-nullprincipal")) + return NS_OK; + // Determine whether the request is foreign. Failure is acceptable. bool isForeign = true; if (RequireThirdPartyCheck()) From 72bb2f11be146b3983ec44b4cafa69c67d75c240 Mon Sep 17 00:00:00 2001 From: Blake Kaplan Date: Tue, 24 Feb 2015 12:54:40 -0800 Subject: [PATCH 19/68] Bug 1087646 - Add a test. r=smaug --- dom/ipc/tests/mochitest.ini | 2 + dom/ipc/tests/test_cpow_cookies.html | 89 ++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 dom/ipc/tests/test_cpow_cookies.html diff --git a/dom/ipc/tests/mochitest.ini b/dom/ipc/tests/mochitest.ini index 5768900e3d3..dc10ecb1d77 100644 --- a/dom/ipc/tests/mochitest.ini +++ b/dom/ipc/tests/mochitest.ini @@ -4,6 +4,8 @@ skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s [test_blob_sliced_from_parent_process.html] # This test is only supposed to run in the main process. skip-if = buildapp == 'b2g' || buildapp == 'mulet' || e10s +[test_cpow_cookies.html] +skip-if = buildapp == 'b2g' || buildapp == 'mulet' [test_NuwaProcessCreation.html] skip-if = toolkit != 'gonk' [test_NuwaProcessDeadlock.html] diff --git a/dom/ipc/tests/test_cpow_cookies.html b/dom/ipc/tests/test_cpow_cookies.html new file mode 100644 index 00000000000..45f5d65dcb6 --- /dev/null +++ b/dom/ipc/tests/test_cpow_cookies.html @@ -0,0 +1,89 @@ + + + + Test for recursive CPOW-getting-cookie bug + + + + + + + + From 70d5a0bb34d5a47547900ce23c143878df08d376 Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Tue, 24 Feb 2015 13:00:54 -0800 Subject: [PATCH 20/68] Bug 1073352, part 1 - Make the DOMWINDOW and DOCSHELL leak detector work with e10s. r=jmaher This reworks how the Mochitest DOMWINDOW and DOCSHELL leak detector works. Rather than collecting immediately in the top-level script, it sends a message to all processes telling them to carry out collections. Each process prints out a message when it has finished the collections. This message is used by the test harness to decide when windows and docshells for that process should be have been destroyed. In non-e10s mode, the shutdown leak detector is only run in the parent process, to work around various issues with leak detection in the thumbnail process tests. --- build/automationutils.py | 11 +++-- testing/mochitest/ShutdownLeaksCollector.jsm | 48 +++++++++++++++++++ testing/mochitest/browser-test.js | 10 ++++ testing/mochitest/jar.mn | 2 + testing/mochitest/shutdown-leaks-collector.js | 7 +++ 5 files changed, 73 insertions(+), 5 deletions(-) create mode 100644 testing/mochitest/ShutdownLeaksCollector.jsm create mode 100644 testing/mochitest/shutdown-leaks-collector.js diff --git a/build/automationutils.py b/build/automationutils.py index 7ffe3c845ce..c9f67eaaf11 100644 --- a/build/automationutils.py +++ b/build/automationutils.py @@ -445,7 +445,7 @@ class ShutdownLeaks(object): self.leakedWindows = {} self.leakedDocShells = set() self.currentTest = None - self.seenShutdown = False + self.seenShutdown = set() def log(self, message): if message['action'] == 'log': @@ -454,8 +454,9 @@ class ShutdownLeaks(object): self._logWindow(line) elif line[2:10] == "DOCSHELL": self._logDocShell(line) - elif line.startswith("TEST-START | Shutdown"): - self.seenShutdown = True + elif line.startswith("Completed ShutdownLeaks collections in process"): + pid = int(line.split()[-1]) + self.seenShutdown.add(pid) elif message['action'] == 'test_start': fileName = message['test'].replace("chrome://mochitests/content/browser/", "") self.currentTest = {"fileName": fileName, "windows": set(), "docShells": set()} @@ -499,7 +500,7 @@ class ShutdownLeaks(object): windows.add(key) else: windows.discard(key) - elif self.seenShutdown and not created: + elif int(pid) in self.seenShutdown and not created: self.leakedWindows[key] = self._parseValue(line, "url") def _logDocShell(self, line): @@ -520,7 +521,7 @@ class ShutdownLeaks(object): docShells.add(key) else: docShells.discard(key) - elif self.seenShutdown and not created: + elif int(pid) in self.seenShutdown and not created: self.leakedDocShells.add(key) def _parseValue(self, line, name): diff --git a/testing/mochitest/ShutdownLeaksCollector.jsm b/testing/mochitest/ShutdownLeaksCollector.jsm new file mode 100644 index 00000000000..f8469b064da --- /dev/null +++ b/testing/mochitest/ShutdownLeaksCollector.jsm @@ -0,0 +1,48 @@ +/* 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/. */ + +var Ci = Components.interfaces; +var Cc = Components.classes; +var Cu = Components.utils; + +Cu.import("resource://gre/modules/Services.jsm"); + +this.EXPORTED_SYMBOLS = ["ContentCollector"]; + +// This listens for the message "browser-test:collect-request". When it gets it, +// it runs some GCs and CCs, then prints out a message indicating the collections +// are complete. Mochitest uses this information to determine when windows and +// docshells should be destroyed. + +var ContentCollector = { + init: function() { + let cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"] + .getService(Ci.nsISyncMessageSender); + cpmm.addMessageListener("browser-test:collect-request", this); + }, + + receiveMessage: function(aMessage) { + switch (aMessage.name) { + case "browser-test:collect-request": + Services.obs.notifyObservers(null, "memory-pressure", "heap-minimize"); + + Cu.forceGC(); + Cu.forceCC(); + + Cu.schedulePreciseShrinkingGC(() => { + Cu.forceCC(); + + let pid = Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULRuntime).processID; + dump("Completed ShutdownLeaks collections in process " + pid + "\n")}); + + let cpmm = Cc["@mozilla.org/childprocessmessagemanager;1"] + .getService(Ci.nsISyncMessageSender); + cpmm.removeMessageListener("browser-test:collect-request", this); + + break; + } + } + +}; +ContentCollector.init(); diff --git a/testing/mochitest/browser-test.js b/testing/mochitest/browser-test.js index 11cba28e34f..6bf290a07ce 100644 --- a/testing/mochitest/browser-test.js +++ b/testing/mochitest/browser-test.js @@ -88,6 +88,12 @@ function testInit() { } if (gConfig.e10s) { e10s_init(); + let globalMM = Cc["@mozilla.org/globalmessagemanager;1"] + .getService(Ci.nsIMessageListenerManager); + globalMM.loadFrameScript("chrome://mochikit/content/shutdown-leaks-collector.js", true); + } else { + // In non-e10s, only run the ShutdownLeaksCollector in the parent process. + Components.utils.import("chrome://mochikit/content/ShutdownLeaksCollector.jsm"); } } @@ -575,6 +581,10 @@ Tester.prototype = { // and thus get rid of more false leaks like already terminated workers. Services.obs.notifyObservers(null, "memory-pressure", "heap-minimize"); + let ppmm = Cc["@mozilla.org/parentprocessmessagemanager;1"] + .getService(Ci.nsIMessageBroadcaster); + ppmm.broadcastAsyncMessage("browser-test:collect-request"); + checkForLeakedGlobalWindows(aResults => { if (aResults.length == 0) { this.finish(); diff --git a/testing/mochitest/jar.mn b/testing/mochitest/jar.mn index 3db85f7f87a..1aba8e9307c 100644 --- a/testing/mochitest/jar.mn +++ b/testing/mochitest/jar.mn @@ -10,6 +10,8 @@ mochikit.jar: content/cc-analyzer.js (cc-analyzer.js) content/chrome-harness.js (chrome-harness.js) content/mochitest-e10s-utils.js (mochitest-e10s-utils.js) + content/shutdown-leaks-collector.js (shutdown-leaks-collector.js) + content/ShutdownLeaksCollector.jsm (ShutdownLeaksCollector.jsm) content/harness.xul (harness.xul) content/redirect.html (redirect.html) content/server.js (server.js) diff --git a/testing/mochitest/shutdown-leaks-collector.js b/testing/mochitest/shutdown-leaks-collector.js new file mode 100644 index 00000000000..f754eaafe47 --- /dev/null +++ b/testing/mochitest/shutdown-leaks-collector.js @@ -0,0 +1,7 @@ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +// We run this code in a .jsm rather than here to avoid keeping the current +// compartment alive. +Components.utils.import("chrome://mochikit/content/ShutdownLeaksCollector.jsm"); From 57e983a33f2dae5225ba3d2bd80312949a8d9b8f Mon Sep 17 00:00:00 2001 From: Andrew McCreight Date: Tue, 24 Feb 2015 13:00:54 -0800 Subject: [PATCH 21/68] Bug 1073352, part 2 - Enable some devtools tests. r=ejpbruel This enables a few of the debugger tests. The first test, browser_dbg_aaa_run_first_leaktest.js, is intentionally disabled, because it appears to have a legitimate leak. --- browser/devtools/debugger/test/browser.ini | 26 ---------------------- 1 file changed, 26 deletions(-) diff --git a/browser/devtools/debugger/test/browser.ini b/browser/devtools/debugger/test/browser.ini index eeba980ae5b..6527fc51604 100644 --- a/browser/devtools/debugger/test/browser.ini +++ b/browser/devtools/debugger/test/browser.ini @@ -103,71 +103,45 @@ support-files = [browser_dbg_aaa_run_first_leaktest.js] skip-if = e10s && debug [browser_dbg_addonactor.js] -skip-if = e10s && debug [browser_dbg_addon-sources.js] -skip-if = e10s && debug [browser_dbg_addon-modules.js] skip-if = e10s # TODO [browser_dbg_addon-modules-unpacked.js] skip-if = e10s # TODO [browser_dbg_addon-panels.js] -skip-if = e10s && debug [browser_dbg_addon-console.js] skip-if = e10s && debug || os == 'win' # bug 1005274 [browser_dbg_auto-pretty-print-01.js] -skip-if = e10s && debug [browser_dbg_auto-pretty-print-02.js] -skip-if = e10s && debug [browser_dbg_bfcache.js] skip-if = e10s || true # bug 1113935 [browser_dbg_blackboxing-01.js] -skip-if = e10s && debug [browser_dbg_blackboxing-02.js] -skip-if = e10s && debug [browser_dbg_blackboxing-03.js] -skip-if = e10s && debug [browser_dbg_blackboxing-04.js] -skip-if = e10s && debug [browser_dbg_blackboxing-05.js] -skip-if = e10s && debug [browser_dbg_blackboxing-06.js] -skip-if = e10s && debug [browser_dbg_breadcrumbs-access.js] -skip-if = e10s && debug [browser_dbg_break-on-dom-01.js] -skip-if = e10s && debug [browser_dbg_break-on-dom-02.js] -skip-if = e10s && debug [browser_dbg_break-on-dom-03.js] -skip-if = e10s && debug [browser_dbg_break-on-dom-04.js] -skip-if = e10s && debug [browser_dbg_break-on-dom-05.js] -skip-if = e10s && debug [browser_dbg_break-on-dom-06.js] -skip-if = e10s && debug [browser_dbg_break-on-dom-07.js] -skip-if = e10s && debug [browser_dbg_break-on-dom-08.js] -skip-if = e10s && debug [browser_dbg_break-on-dom-event-01.js] skip-if = e10s || os == "mac" || e10s # Bug 895426 [browser_dbg_break-on-dom-event-02.js] skip-if = e10s # TODO [browser_dbg_breakpoints-actual-location.js] -skip-if = e10s && debug [browser_dbg_breakpoints-actual-location2.js] -skip-if = e10s && debug [browser_dbg_breakpoints-break-on-last-line-of-script-on-reload.js] skip-if = e10s # Bug 1093535 [browser_dbg_breakpoints-button-01.js] -skip-if = e10s && debug [browser_dbg_breakpoints-button-02.js] -skip-if = e10s && debug [browser_dbg_breakpoints-contextmenu-add.js] -skip-if = e10s && debug [browser_dbg_breakpoints-contextmenu.js] -skip-if = e10s && debug [browser_dbg_breakpoints-disabled-reload.js] skip-if = e10s # Bug 1093535 [browser_dbg_breakpoints-editor.js] From df484c4fe5915d011f5737a5d879a508d496107c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 24 Feb 2015 16:04:22 -0500 Subject: [PATCH 22/68] Bug 1135792. Stop assuming that every binding for a global with a non-worker descriptor is a binding for Window. r=smaug --- dom/bindings/Codegen.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index ca2e8f05660..48b6131fb8a 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -381,7 +381,7 @@ class CGDOMJSClass(CGThing): classFlags += "JSCLASS_DOM_GLOBAL | JSCLASS_GLOBAL_FLAGS_WITH_SLOTS(DOM_GLOBAL_SLOTS) | JSCLASS_IMPLEMENTS_BARRIERS" traceHook = "JS_GlobalObjectTraceHook" reservedSlots = "JSCLASS_GLOBAL_APPLICATION_SLOTS" - if not self.descriptor.workers: + if self.descriptor.interface.identifier.name == "Window": classExtensionAndObjectOps = fill( """ { From be5d8357085d04cf3b1afc7bac5d9a34e254b449 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 24 Feb 2015 16:04:22 -0500 Subject: [PATCH 23/68] Bug 1135803. Take out the bits that try to handle interface types mapping to JSObject* in worker descriptors, since we never do that anymore. r=smaug --- dom/bindings/Bindings.conf | 31 ++++++++----------------------- dom/bindings/Codegen.py | 10 ++++------ dom/bindings/Configuration.py | 6 ++---- dom/webidl/EventTarget.webidl | 2 +- 4 files changed, 15 insertions(+), 34 deletions(-) diff --git a/dom/bindings/Bindings.conf b/dom/bindings/Bindings.conf index 24109b8b9a8..1d2d1c96ea6 100644 --- a/dom/bindings/Bindings.conf +++ b/dom/bindings/Bindings.conf @@ -13,13 +13,11 @@ # Valid fields for all descriptors: # * nativeType - The native type (concrete class or XPCOM interface) that # instances of this interface will unwrap to. If not -# specified, defaults to 'mozilla::dom::InterfaceName' for -# non-worker non-external-or-callback interfaces, to +# specified, defaults to 'nsIDOM' followed by the interface +# name for external interfaces, # 'mozilla::dom::workers::InterfaceName' for worker -# non-external interfaces, to 'nsIDOM' followed by the -# interface name for non-worker external-or-callback -# interfaces, and to 'JSObject' for worker external-or-callback -# interfaces. +# non-callback interfaces, and 'mozilla::dom::InterfaceName' +# for everything else. # * headerFile - The file in which the nativeType is declared (defaults # to an educated guess). # * concrete - Indicates whether there exist JS objects with this interface as @@ -31,6 +29,7 @@ # will not be made available on the main thread. # * notflattened - The native type does not have nsIClassInfo, so when # wrapping it the right IID needs to be passed in. +# Only relevant for callback interfaces. # * register - True if this binding should be registered. Defaults to true. # * binaryNames - Dict for mapping method and attribute names to different # names when calling the native methods (defaults to an empty @@ -606,14 +605,10 @@ DOMInterfaces = { 'headerFile': 'IDBEvents.h', }, -'IID': [ -{ +'IID': { 'nativeType': 'nsIJSID', 'headerFile': 'xpcjsid.h', }, -{ - 'workers': True, -}], 'ImageCapture': { 'binaryNames': { 'videoStreamTrack': 'GetVideoStreamTrack' } @@ -623,14 +618,10 @@ DOMInterfaces = { 'wrapperCache': False, }, -'InputStream': [ -{ +'InputStream': { 'nativeType': 'nsIInputStream', 'notflattened': True }, -{ - 'workers': True, -}], 'InstallEvent': { 'headerFile': 'ServiceWorkerEvents.h', @@ -1484,16 +1475,10 @@ DOMInterfaces = { }, }, -'WindowProxy': [ -{ +'WindowProxy': { 'nativeType': 'nsIDOMWindow', 'concrete': False }, -{ - # We need a worker descriptor for WindowProxy because EventTarget exists in - # workers. But it's an external interface, so it'll just map to JSObject*. - 'workers': True -}], 'WindowRoot': { 'nativeType': 'nsWindowRoot' diff --git a/dom/bindings/Codegen.py b/dom/bindings/Codegen.py index 48b6131fb8a..a9192f7fbdf 100644 --- a/dom/bindings/Codegen.py +++ b/dom/bindings/Codegen.py @@ -4635,10 +4635,7 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, descriptor = descriptorProvider.getDescriptor( type.unroll().inner.identifier.name) - if descriptor.nativeType == 'JSObject': - # XXXbz Workers code does this sometimes - assert descriptor.workers - return handleJSObjectType(type, isMember, failureCode, exceptionCode, sourceDescription) + assert descriptor.nativeType != 'JSObject' if descriptor.interface.isCallback(): name = descriptor.interface.identifier.name @@ -4715,9 +4712,10 @@ def getJSToNativeConversionInfo(type, descriptorProvider, failureCode=None, exceptionCode, isCallbackReturnValue, firstCap(sourceDescription))) - elif descriptor.workers: - return handleJSObjectType(type, isMember, failureCode, exceptionCode, sourceDescription) else: + # Worker descriptors can't end up here, because all of our + # "external" stuff is not exposed in workers. + assert not descriptor.workers # Either external, or new-binding non-castable. We always have a # holder for these, because we don't actually know whether we have # to addref when unwrapping or not. So we just pass an diff --git a/dom/bindings/Configuration.py b/dom/bindings/Configuration.py index 3d89c8cc828..25eb14929ea 100644 --- a/dom/bindings/Configuration.py +++ b/dom/bindings/Configuration.py @@ -305,10 +305,8 @@ class Descriptor(DescriptorProvider): # Read the desc, and fill in the relevant defaults. ifaceName = self.interface.identifier.name if self.interface.isExternal(): - if self.workers: - nativeTypeDefault = "JSObject" - else: - nativeTypeDefault = "nsIDOM" + ifaceName + assert not self.workers + nativeTypeDefault = "nsIDOM" + ifaceName elif self.interface.isCallback(): nativeTypeDefault = "mozilla::dom::" + ifaceName else: diff --git a/dom/webidl/EventTarget.webidl b/dom/webidl/EventTarget.webidl index 0ad59289c61..d140e882fa1 100644 --- a/dom/webidl/EventTarget.webidl +++ b/dom/webidl/EventTarget.webidl @@ -43,6 +43,6 @@ partial interface EventTarget { // chrome easier. This returns the window which can be used to create // events to fire at this EventTarget, or null if there isn't one. partial interface EventTarget { - [ChromeOnly] + [ChromeOnly, Exposed=Window] readonly attribute WindowProxy? ownerGlobal; }; From 78b98314a94d06fb16f93f265b8fbf890a424c36 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 24 Feb 2015 16:04:22 -0500 Subject: [PATCH 24/68] Bug 1134968. If JS_NewObjectWithGivenProto is passed a null parent and null proto, use the context's current global as the parent. r=waldo --- js/src/jsobj.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 1e5d87a19dc..f536d5a9bd9 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -1267,11 +1267,16 @@ js::NewObjectWithGivenTaggedProto(ExclusiveContext *cxArg, const Class *clasp, /* * Default parent to the parent of the prototype, which was set from - * the parent of the prototype's constructor. + * the parent of the prototype's constructor. If there is no + * prototype, use the global. */ RootedObject parent(cxArg, parentArg); - if (!parent && proto.isObject()) - parent = proto.toObject()->getParent(); + if (!parent) { + if (proto.isObject()) + parent = proto.toObject()->getParent(); + else + parent = cxArg->global(); + } RootedObject obj(cxArg, NewObject(cxArg, group, parent, allocKind, newKind)); if (!obj) From 6e8c0dde7f5b4c3f29334359d88364462d36f47f Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 24 Feb 2015 16:04:22 -0500 Subject: [PATCH 25/68] Bug 1134969. Make DeepCloneObjectLiteral correctly handle setLastProperty failures. r=waldo --- js/src/jsobj.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index f536d5a9bd9..cb51ecf5fa9 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -1869,7 +1869,8 @@ js::DeepCloneObjectLiteral(JSContext *cx, HandleNativeObject obj, NewObjectKind MOZ_ASSERT(!obj->hasPrivate()); RootedShape shape(cx, obj->lastProperty()); size_t span = shape->slotSpan(); - clone->setLastProperty(cx, shape); + if (!clone->setLastProperty(cx, shape)) + return nullptr; for (size_t i = 0; i < span; i++) { v = obj->getSlot(i); if (v.isObject()) { From c7901442ea95ffd4fe515e5202e7210572565e9a Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 24 Feb 2015 16:04:22 -0500 Subject: [PATCH 26/68] Bug 1134970 part 1. Add JS friend API to allocate an object which is guaranteed to have no attached metadata. r=waldo --- js/src/jsfriendapi.cpp | 8 ++++++++ js/src/jsfriendapi.h | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/js/src/jsfriendapi.cpp b/js/src/jsfriendapi.cpp index d32af161d38..537290f2175 100644 --- a/js/src/jsfriendapi.cpp +++ b/js/src/jsfriendapi.cpp @@ -145,6 +145,14 @@ JS_NewObjectWithUniqueType(JSContext *cx, const JSClass *clasp, HandleObject pro return obj; } +JS_FRIEND_API(JSObject *) +JS_NewObjectWithoutMetadata(JSContext *cx, const JSClass *clasp, JS::Handle proto) +{ + // Use an AutoEnterAnalysis to suppress invocation of the metadata callback. + AutoEnterAnalysis enter(cx); + return JS_NewObjectWithGivenProto(cx, clasp, proto); +} + JS_FRIEND_API(JSPrincipals *) JS_GetCompartmentPrincipals(JSCompartment *compartment) { diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 86e2f2ab9e9..83e87c1df5d 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -60,6 +60,13 @@ extern JS_FRIEND_API(JSObject *) JS_NewObjectWithUniqueType(JSContext *cx, const JSClass *clasp, JS::HandleObject proto, JS::HandleObject parent); +// Allocate an object in exactly the same way as JS_NewObjectWithGivenProto, but +// without invoking the metadata callback on it. This allows creation of +// internal bookkeeping objects that are guaranteed to not have metadata +// attached to them. +extern JS_FRIEND_API(JSObject *) +JS_NewObjectWithoutMetadata(JSContext *cx, const JSClass *clasp, JS::Handle proto); + extern JS_FRIEND_API(uint32_t) JS_ObjectCountDynamicSlots(JS::HandleObject obj); From f44d733cd9d3a5773a0c466bb1d89955c674f497 Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Tue, 24 Feb 2015 16:04:22 -0500 Subject: [PATCH 27/68] Bug 1134970 part 2. Add JS friend API to quickly copy properties from one object to another if the objects are similar enough. r=bhackett,waldo --- js/src/jsfriendapi.h | 18 +++++++++++++++ js/src/jsobj.cpp | 52 ++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+) diff --git a/js/src/jsfriendapi.h b/js/src/jsfriendapi.h index 83e87c1df5d..652d7e2e3b3 100644 --- a/js/src/jsfriendapi.h +++ b/js/src/jsfriendapi.h @@ -151,6 +151,24 @@ extern JS_FRIEND_API(JSObject *) JS_CloneObject(JSContext *cx, JS::HandleObject obj, JS::HandleObject proto, JS::HandleObject parent); +/* + * Copy the own properties of src to dst in a fast way. src and dst must both + * be native and must be in the compartment of cx. They must have the same + * class, the same parent, and the same prototype. Class reserved slots will + * NOT be copied. + * + * dst must not have any properties on it before this function is called. + * + * src must have been allocated via JS_NewObjectWithoutMetadata so that we can + * be sure it has no metadata that needs copying to dst. This also means that + * dst needs to have the compartment global as its parent. This function will + * preserve the existing metadata on dst, if any. + */ +extern JS_FRIEND_API(bool) +JS_InitializePropertiesFromCompatibleNativeObject(JSContext *cx, + JS::HandleObject dst, + JS::HandleObject src); + extern JS_FRIEND_API(JSString *) JS_BasicObjectToString(JSContext *cx, JS::HandleObject obj); diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index cb51ecf5fa9..447daa86ef5 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -1900,6 +1900,58 @@ js::DeepCloneObjectLiteral(JSContext *cx, HandleNativeObject obj, NewObjectKind return clone; } +static bool +InitializePropertiesFromCompatibleNativeObject(JSContext *cx, + HandleNativeObject dst, + HandleNativeObject src) +{ + assertSameCompartment(cx, src, dst); + MOZ_ASSERT(src->getClass() == dst->getClass()); + MOZ_ASSERT(src->getParent() == dst->getParent()); + MOZ_ASSERT(dst->getParent() == cx->global()); + MOZ_ASSERT(src->getProto() == dst->getProto()); + MOZ_ASSERT(dst->lastProperty()->getObjectFlags() == 0); + MOZ_ASSERT(!src->getMetadata()); + MOZ_ASSERT(!src->isSingleton()); + + // Save the dst metadata, if any, before we start messing with its shape. + RootedObject dstMetadata(cx, dst->getMetadata()); + + if (!dst->ensureElements(cx, src->getDenseInitializedLength())) + return false; + + uint32_t initialized = src->getDenseInitializedLength(); + for (uint32_t i = 0; i < initialized; ++i) { + dst->setDenseInitializedLength(i + 1); + dst->initDenseElement(i, src->getDenseElement(i)); + } + + MOZ_ASSERT(!src->hasPrivate()); + RootedShape shape(cx, src->lastProperty()); + size_t span = shape->slotSpan(); + if (!dst->setLastProperty(cx, shape)) + return false; + for (size_t i = JSCLASS_RESERVED_SLOTS(src->getClass()); i < span; i++) + dst->setSlot(i, src->getSlot(i)); + + if (dstMetadata) { + if (!js::SetObjectMetadata(cx, dst, dstMetadata)) + return false; + } + + return true; +} + +JS_FRIEND_API(bool) +JS_InitializePropertiesFromCompatibleNativeObject(JSContext *cx, + HandleObject dst, + HandleObject src) +{ + return InitializePropertiesFromCompatibleNativeObject(cx, + dst.as(), + src.as()); +} + template bool js::XDRObjectLiteral(XDRState *xdr, MutableHandleNativeObject obj) From 02bc2657b6ce97415a3a058723873cfc8cd82de3 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Fri, 20 Feb 2015 13:26:59 -0500 Subject: [PATCH 28/68] Bug 1135654 - part 1 - move backtrace conversion scripts to FINAL_TARGET_FILES; r=mshal --- build/Makefile.in | 21 --------------------- build/moz.build | 11 +++++++++++ 2 files changed, 11 insertions(+), 21 deletions(-) diff --git a/build/Makefile.in b/build/Makefile.in index 2a178476742..7f79fb9f80d 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -113,27 +113,6 @@ libs:: $(_VALGRIND_FILES) $(INSTALL) $^ $(_VALGRIND_DIR) endif -ifneq (,$(ENABLE_TESTS)$(MOZ_DMD)) -libs:: $(topsrcdir)/tools/rb/fix_stack_using_bpsyms.py - $(INSTALL) $< $(DIST)/bin - -ifeq ($(OS_ARCH),Darwin) -libs:: $(topsrcdir)/tools/rb/fix_macosx_stack.py - $(INSTALL) $< $(DIST)/bin -endif - -ifeq ($(OS_ARCH),Linux) -libs:: $(topsrcdir)/tools/rb/fix_linux_stack.py - $(INSTALL) $< $(DIST)/bin -endif -endif # ENABLE_TESTS or MOZ_DMD - ifdef ENABLE_TESTS GARBAGE += $(srcdir)/automationutils.pyc endif # ENABLE_TESTS - -ifdef MOZ_DMD -libs:: $(topsrcdir)/memory/replace/dmd/dmd.py - $(INSTALL) $< $(DIST)/bin -endif - diff --git a/build/moz.build b/build/moz.build index 74728007c54..1944ff30d88 100644 --- a/build/moz.build +++ b/build/moz.build @@ -48,3 +48,14 @@ if CONFIG['MOZ_BUILD_APP'] == 'browser': PYTHON_UNIT_TESTS += [ 'compare-mozconfig/compare-mozconfigs-wrapper.py', ] + +if CONFIG['ENABLE_TESTS'] or CONFIG['MOZ_DMD']: + tools_dir = TOPSRCDIR + '/tools/rb/' + FINAL_TARGET_FILES += [tools_dir + 'fix_stack_using_bpsyms.py'] + if CONFIG['OS_ARCH'] == 'Darwin': + FINAL_TARGET_FILES += [tools_dir + 'fix_macosx_stack.py'] + if CONFIG['OS_ARCH'] == 'Linux': + FINAL_TARGET_FILES += [tools_dir + 'fix_linux_stack.py'] + +if CONFIG['MOZ_DMD']: + FINAL_TARGET_FILES += [TOPSRCDIR + '/memory/replace/dmd/dmd.py'] From ee5691a04991ef43cf4a67c138b7ea5b1f4ea826 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Mon, 23 Feb 2015 08:27:45 -0500 Subject: [PATCH 29/68] Bug 1135654 - part 2 - move FINAL_TARGET's .gdbinit to FINAL_TARGET_FILES; r=mshal --- build/Makefile.in | 9 ++------- build/moz.build | 4 ++++ 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/build/Makefile.in b/build/Makefile.in index 7f79fb9f80d..df27cd042bf 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -42,16 +42,11 @@ endif endif -# Put a useful .gdbinit in the bin directory, to be picked up automatically -# by GDB when we debug executables there. # NOTE: Keep .gdbinit in the topsrcdir for people who run gdb from the topsrcdir. -GDBINIT_FILES := $(topsrcdir)/.gdbinit -GDBINIT_OBJDIR_FILES = $(topsrcdir)/.gdbinit -GDBINIT_DEST = $(FINAL_TARGET) - # needs to be absolute to be distinct from $(topsrcdir)/.gdbinit +GDBINIT_OBJDIR_FILES = $(topsrcdir)/.gdbinit GDBINIT_OBJDIR_DEST = $(abspath $(DEPTH)) -INSTALL_TARGETS += GDBINIT GDBINIT_OBJDIR +INSTALL_TARGETS += GDBINIT_OBJDIR # Put a .lldbinit in the bin directory and the objdir, to be picked up # automatically by LLDB when we debug executables using either of those two diff --git a/build/moz.build b/build/moz.build index 1944ff30d88..75ac68a9d01 100644 --- a/build/moz.build +++ b/build/moz.build @@ -59,3 +59,7 @@ if CONFIG['ENABLE_TESTS'] or CONFIG['MOZ_DMD']: if CONFIG['MOZ_DMD']: FINAL_TARGET_FILES += [TOPSRCDIR + '/memory/replace/dmd/dmd.py'] + +# Put a useful .gdbinit in the bin directory, to be picked up automatically +# by GDB when we debug executables there. +FINAL_TARGET_FILES += [TOPSRCDIR + '/.gdbinit'] From 76ae0b504a4199888f493781cdd70079e1d42a08 Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Mon, 23 Feb 2015 08:29:12 -0500 Subject: [PATCH 30/68] Bug 1135654 - part 3 - move installation of MOZ_CLANG_RT_ASAN_LIB_PATH to moz.build; r=mshal --- build/Makefile.in | 7 ------- build/moz.build | 4 ++++ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/build/Makefile.in b/build/Makefile.in index df27cd042bf..25f0abf80af 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -61,13 +61,6 @@ LLDBINIT_FINAL_TARGET_FILES := $(DEPTH)/.lldbinit LLDBINIT_FINAL_TARGET_DEST = $(FINAL_TARGET) INSTALL_TARGETS += LLDBINIT_FINAL_TARGET -ifeq (1_1,$(MOZ_ASAN)_$(CLANG_CL)) -# Install the clang-cl runtime library for ASAN next to the binaries we produce. -CLANG_RT_ASAN_FILES := $(MOZ_CLANG_RT_ASAN_LIB_PATH) -CLANG_RT_ASAN_DEST = $(FINAL_TARGET) -INSTALL_TARGETS += CLANG_RT_ASAN -endif - ifdef MOZTTDIR # Install the Firefox OS fonts. include $(MOZTTDIR)/fonts.mk diff --git a/build/moz.build b/build/moz.build index 75ac68a9d01..d30a35c1a05 100644 --- a/build/moz.build +++ b/build/moz.build @@ -63,3 +63,7 @@ if CONFIG['MOZ_DMD']: # Put a useful .gdbinit in the bin directory, to be picked up automatically # by GDB when we debug executables there. FINAL_TARGET_FILES += [TOPSRCDIR + '/.gdbinit'] + +# Install the clang-cl runtime library for ASAN next to the binaries we produce. +if CONFIG['MOZ_ASAN'] and CONFIG['CLANG_CL']: + FINAL_TARGET_FILES += [CONFIG['MOZ_CLANG_RT_ASAN_LIB_PATH']] From c2ae68c069d2a6f8357f308eb0a9d11534ff32bb Mon Sep 17 00:00:00 2001 From: Nathan Froyd Date: Mon, 23 Feb 2015 08:38:50 -0500 Subject: [PATCH 31/68] Bug 1135654 - part 4 - remove libs:: rule for installing Valgrind suppressions in favor of INSTALL_TARGETS; r=mshal --- build/Makefile.in | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/build/Makefile.in b/build/Makefile.in index 25f0abf80af..2339e362439 100644 --- a/build/Makefile.in +++ b/build/Makefile.in @@ -69,6 +69,19 @@ MOZTT_FILES = $(patsubst external/moztt/%,$(MOZTTDIR)/%,$(filter external/moztt/ INSTALL_TARGETS += MOZTT endif +ifdef MOZ_VALGRIND +_VALGRIND_DIR = $(DEPTH)/_valgrind +GARBAGE_DIRS += $(_VALGRIND_DIR) + +_VALGRIND_FILES = \ + $(topsrcdir)/build/valgrind/cross-architecture.sup \ + $(topsrcdir)/build/valgrind/i386-redhat-linux-gnu.sup \ + $(topsrcdir)/build/valgrind/x86_64-redhat-linux-gnu.sup \ + $(NULL) +_VALGRIND_DEST = $(_VALGRIND_DIR) +INSTALL_TARGETS += _VALGRIND +endif + include $(topsrcdir)/config/rules.mk TARGET_DEPTH = .. @@ -87,20 +100,6 @@ endif libs:: automation.py -ifdef MOZ_VALGRIND -_VALGRIND_DIR = $(DEPTH)/_valgrind -GARBAGE_DIRS += $(_VALGRIND_DIR) - -_VALGRIND_FILES = \ - $(topsrcdir)/build/valgrind/cross-architecture.sup \ - $(topsrcdir)/build/valgrind/i386-redhat-linux-gnu.sup \ - $(topsrcdir)/build/valgrind/x86_64-redhat-linux-gnu.sup \ - $(NULL) - -libs:: $(_VALGRIND_FILES) - $(INSTALL) $^ $(_VALGRIND_DIR) -endif - ifdef ENABLE_TESTS GARBAGE += $(srcdir)/automationutils.pyc endif # ENABLE_TESTS From cf720c0a8e489e6158d3e4acdb5852dbf11019a8 Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 24 Feb 2015 13:39:01 -0800 Subject: [PATCH 32/68] Implement GetMaxTextureSize in the basic compositor. (bug 1135883, r=mattwoodrow) --- gfx/2d/2D.h | 2 ++ gfx/2d/DrawTargetCG.cpp | 9 +++++---- gfx/2d/DrawTargetCG.h | 7 +++++++ gfx/2d/DrawTargetCairo.h | 5 +++++ gfx/2d/DrawTargetD2D.h | 4 ++++ gfx/2d/DrawTargetD2D1.h | 4 ++++ gfx/2d/Factory.cpp | 24 ++++++++++++++++++++++++ gfx/layers/basic/BasicCompositor.cpp | 9 +++++++++ gfx/layers/basic/BasicCompositor.h | 4 +++- gfx/layers/client/TextureClient.cpp | 2 +- 10 files changed, 64 insertions(+), 6 deletions(-) diff --git a/gfx/2d/2D.h b/gfx/2d/2D.h index 6530f1b9fde..86e612e8e61 100644 --- a/gfx/2d/2D.h +++ b/gfx/2d/2D.h @@ -1166,6 +1166,8 @@ public: // This is a little hacky at the moment, but we want to have this data. Bug 1068613. static void SetLogForwarder(LogForwarder* aLogFwd); + static uint32_t GetMaxSurfaceSize(BackendType aType); + static LogForwarder* GetLogForwarder() { return mLogForwarder; } private: diff --git a/gfx/2d/DrawTargetCG.cpp b/gfx/2d/DrawTargetCG.cpp index 5889e35bae5..238b8727725 100644 --- a/gfx/2d/DrawTargetCG.cpp +++ b/gfx/2d/DrawTargetCG.cpp @@ -1693,10 +1693,11 @@ DrawTargetCG::Init(BackendType aType, { // XXX: we should come up with some consistent semantics for dealing // with zero area drawtargets - if (aSize.width <= 0 || aSize.height <= 0 || - // 32767 is the maximum size supported by cairo - // we clamp to that to make it easier to interoperate - aSize.width > 32767 || aSize.height > 32767) { + if (aSize.width <= 0 || + aSize.height <= 0 || + aSize.width > GetMaxSurfaceSize() || + aSize.height > GetMaxSurfaceSize()) + { gfxWarning() << "Failed to Init() DrawTargetCG because of bad size."; mColorSpace = nullptr; mCg = nullptr; diff --git a/gfx/2d/DrawTargetCG.h b/gfx/2d/DrawTargetCG.h index 36ac3b79873..563446e54a3 100644 --- a/gfx/2d/DrawTargetCG.h +++ b/gfx/2d/DrawTargetCG.h @@ -183,6 +183,13 @@ public: CGContextRef GetCGContext() { return mCg; } + + // 32767 is the maximum size supported by cairo. We clamp to that to make it + // easier to interoperate. + static size_t GetMaxSurfaceSize() { + return 32767; + } + private: void MarkChanged(); diff --git a/gfx/2d/DrawTargetCairo.h b/gfx/2d/DrawTargetCairo.h index b7776742eaf..9b515f0a422 100644 --- a/gfx/2d/DrawTargetCairo.h +++ b/gfx/2d/DrawTargetCairo.h @@ -170,6 +170,11 @@ public: static cairo_surface_t *GetDummySurface(); + // Cairo hardcodes this as its maximum surface size. + static size_t GetMaxSurfaceSize() { + return 32767; + } + private: // methods // Init cairo surface without doing a cairo_surface_reference() call. bool InitAlreadyReferenced(cairo_surface_t* aSurface, const IntSize& aSize, SurfaceFormat* aFormat = nullptr); diff --git a/gfx/2d/DrawTargetD2D.h b/gfx/2d/DrawTargetD2D.h index 0acb88e9d67..bf1e0de1ca8 100644 --- a/gfx/2d/DrawTargetD2D.h +++ b/gfx/2d/DrawTargetD2D.h @@ -145,6 +145,10 @@ public: static IDWriteFactory *GetDWriteFactory(); ID2D1RenderTarget *GetRT() { return mRT; } + static uint32_t GetMaxSurfaceSize() { + return D3D10_REQ_TEXTURE2D_U_OR_V_DIMENSION; + } + operator std::string() const { std::stringstream stream; stream << "DrawTargetD2D(" << this << ")"; diff --git a/gfx/2d/DrawTargetD2D1.h b/gfx/2d/DrawTargetD2D1.h index d76415a48ad..541dd2a16c4 100644 --- a/gfx/2d/DrawTargetD2D1.h +++ b/gfx/2d/DrawTargetD2D1.h @@ -144,6 +144,10 @@ public: return stream.str(); } + static uint32_t GetMaxSurfaceSize() { + return D3D11_REQ_TEXTURE2D_U_OR_V_DIMENSION; + } + static uint64_t mVRAMUsageDT; static uint64_t mVRAMUsageSS; diff --git a/gfx/2d/Factory.cpp b/gfx/2d/Factory.cpp index f9e439a6b82..948d3c3bbda 100644 --- a/gfx/2d/Factory.cpp +++ b/gfx/2d/Factory.cpp @@ -449,6 +449,30 @@ Factory::DoesBackendSupportDataDrawtarget(BackendType aType) return false; } +uint32_t +Factory::GetMaxSurfaceSize(BackendType aType) +{ + switch (aType) { + case BackendType::CAIRO: + case BackendType::COREGRAPHICS: + return DrawTargetCairo::GetMaxSurfaceSize(); +#ifdef XP_MACOSX + case BackendType::COREGRAPHICS_ACCELERATED: + return DrawTargetCG::GetMaxSurfaceSize(); +#endif + case BackendType::SKIA: + return INT_MAX; +#ifdef WIN32 + case BackendType::DIRECT2D: + return DrawTargetD2D::GetMaxSurfaceSize(); + case BackendType::DIRECT2D1_1: + return DrawTargetD2D1::GetMaxSurfaceSize(); +#endif + default: + return 0; + } +} + TemporaryRef Factory::CreateScaledFontForNativeFont(const NativeFont &aNativeFont, Float aSize) { diff --git a/gfx/layers/basic/BasicCompositor.cpp b/gfx/layers/basic/BasicCompositor.cpp index 25f3fa9f974..676bd88ae0a 100644 --- a/gfx/layers/basic/BasicCompositor.cpp +++ b/gfx/layers/basic/BasicCompositor.cpp @@ -67,6 +67,9 @@ BasicCompositor::BasicCompositor(nsIWidget *aWidget) { MOZ_COUNT_CTOR(BasicCompositor); SetBackend(LayersBackend::LAYERS_BASIC); + + mMaxTextureSize = + Factory::GetMaxSurfaceSize(gfxPlatform::GetPlatform()->GetContentBackend()); } BasicCompositor::~BasicCompositor() @@ -74,6 +77,12 @@ BasicCompositor::~BasicCompositor() MOZ_COUNT_DTOR(BasicCompositor); } +int32_t +BasicCompositor::GetMaxTextureSize() const +{ + return mMaxTextureSize; +} + void BasicCompositingRenderTarget::BindRenderTarget() { diff --git a/gfx/layers/basic/BasicCompositor.h b/gfx/layers/basic/BasicCompositor.h index 1eb60b690e7..8fd49357258 100644 --- a/gfx/layers/basic/BasicCompositor.h +++ b/gfx/layers/basic/BasicCompositor.h @@ -103,7 +103,7 @@ public: virtual bool SupportsPartialTextureUpdate() MOZ_OVERRIDE { return true; } virtual bool CanUseCanvasLayerForSize(const gfx::IntSize &aSize) MOZ_OVERRIDE { return true; } - virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE { return INT32_MAX; } + virtual int32_t GetMaxTextureSize() const MOZ_OVERRIDE; virtual void SetDestinationSurfaceSize(const gfx::IntSize& aSize) MOZ_OVERRIDE { } virtual void SetScreenRenderOffset(const ScreenPoint& aOffset) MOZ_OVERRIDE { @@ -140,6 +140,8 @@ private: gfx::IntRect mInvalidRect; nsIntRegion mInvalidRegion; + + uint32_t mMaxTextureSize; }; } // namespace layers diff --git a/gfx/layers/client/TextureClient.cpp b/gfx/layers/client/TextureClient.cpp index fee69052f4a..bcb7a36ec56 100644 --- a/gfx/layers/client/TextureClient.cpp +++ b/gfx/layers/client/TextureClient.cpp @@ -745,7 +745,7 @@ BufferTextureClient::AllocateForSurface(gfx::IntSize aSize, TextureAllocationFla } uint32_t bufSize = ImageDataSerializer::ComputeMinBufferSize(aSize, mFormat); - if (!Allocate(bufSize)) { + if (!bufSize || !Allocate(bufSize)) { return false; } From 1d50988de8f0b980d4f9cb2b50d81d0027f005f0 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Wed, 18 Feb 2015 17:37:19 -0500 Subject: [PATCH 33/68] Bug 961887 - Refactor mVisibleAboveRegion management. r=roc --- layout/base/FrameLayerBuilder.cpp | 210 +++++++++++++++++++----------- 1 file changed, 133 insertions(+), 77 deletions(-) diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index fc22b419dcd..38215fb6767 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -242,6 +242,56 @@ static inline MaskLayerImageCache* GetMaskLayerImageCache() return gMaskLayerImageCache; } +/** + * A wrapper for nsIntRegion that can express infinite regions. + */ +struct PossiblyInfiniteRegion +{ + PossiblyInfiniteRegion() : mIsInfinite(false) {} + MOZ_IMPLICIT PossiblyInfiniteRegion(const nsIntRegion& aRegion) + : mRegion(aRegion) + , mIsInfinite(false) + {} + MOZ_IMPLICIT PossiblyInfiniteRegion(const nsIntRect& aRect) + : mRegion(aRect) + , mIsInfinite(false) + {} + + // Create an infinite region. + static PossiblyInfiniteRegion InfiniteRegion() + { + PossiblyInfiniteRegion r; + r.mIsInfinite = true; + return r; + } + + bool IsInfinite() const { return mIsInfinite; } + bool Intersects(const nsIntRegion& aRegion) const + { + if (IsInfinite()) { + return true; + } + return !mRegion.Intersect(aRegion).IsEmpty(); + } + + void AccumulateAndSimplifyOutward(const PossiblyInfiniteRegion& aRegion) + { + if (!IsInfinite()) { + if (aRegion.IsInfinite()) { + mIsInfinite = true; + mRegion.SetEmpty(); + } else { + mRegion.OrWith(aRegion.mRegion); + mRegion.SimplifyOutward(8); + } + } + } + +protected: + nsIntRegion mRegion; + bool mIsInfinite; +}; + /** * We keep a stack of these to represent the PaintedLayers that are * currently available to have display items added to. @@ -268,8 +318,7 @@ public: mOpaqueForAnimatedGeometryRootParent(false), mImage(nullptr), mCommonClipCount(-1), - mNewChildLayersIndex(-1), - mVisibleAboveRegionIsInfinite(false) + mNewChildLayersIndex(-1) {} #ifdef MOZ_DUMP_PAINTING @@ -321,52 +370,9 @@ public: */ already_AddRefed CanOptimizeImageLayer(nsDisplayListBuilder* aBuilder); - void AddVisibleAboveRegion(const nsIntRegion& aAbove) - { - if (!mVisibleAboveRegionIsInfinite) { - mVisibleAboveRegion.Or(mVisibleAboveRegion, aAbove); - mVisibleAboveRegion.SimplifyOutward(8); - } - } - - void CopyAboveRegion(PaintedLayerData* aOther) - { - if (mVisibleAboveRegionIsInfinite) { - return; - } - - // If aOther has a draw region and is subject to async transforms then the - // layer can potentially be moved arbitrarily on the compositor. So we - // should avoid moving display items from on top of the layer to below the - // layer, which we do by calling SetVisibleAboveRegionIsInfinite. Note that - // if the draw region is empty (such as when aOther has only event-regions - // items) then we don't need to do this. - bool aOtherCanDrawAnywhere = aOther->IsSubjectToAsyncTransforms() - && !aOther->mVisibleRegion.IsEmpty(); - - if (aOther->mVisibleAboveRegionIsInfinite || aOtherCanDrawAnywhere) { - SetVisibleAboveRegionIsInfinite(); - } else { - mVisibleAboveRegion.Or(mVisibleAboveRegion, aOther->mVisibleAboveRegion); - mVisibleAboveRegion.Or(mVisibleAboveRegion, aOther->mVisibleRegion); - mVisibleAboveRegion.SimplifyOutward(8); - } - } - - void SetVisibleAboveRegionIsInfinite() - { - mVisibleAboveRegionIsInfinite = true; - mVisibleAboveRegion.SetEmpty(); - } - - bool VisibleAboveRegionIntersects(const nsIntRect& aRect) const - { - return mVisibleAboveRegionIsInfinite || mVisibleAboveRegion.Intersects(aRect); - } - bool VisibleAboveRegionIntersects(const nsIntRegion& aRegion) const { - return mVisibleAboveRegionIsInfinite || !mVisibleAboveRegion.Intersect(aRegion).IsEmpty(); + return mVisibleAboveRegion.Intersects(aRegion); } bool VisibleRegionIntersects(const nsIntRect& aRect) const @@ -502,8 +508,6 @@ public: * The union of all the bounds of the display items in this layer. */ nsIntRect mBounds; - -private: /** * The region of visible content above the layer and below the * next PaintedLayerData currently in the stack, if any. Note that not @@ -511,12 +515,7 @@ private: * Same coordinate system as mVisibleRegion. * This is a conservative approximation: it contains the true region. */ - nsIntRegion mVisibleAboveRegion; - /** - * True if mVisibleAboveRegion should be treated as infinite, and all - * display items should be considered 'above' this layer. - */ - bool mVisibleAboveRegionIsInfinite; + PossiblyInfiniteRegion mVisibleAboveRegion; }; @@ -856,6 +855,31 @@ protected: bool ChooseAnimatedGeometryRoot(const nsDisplayList& aList, const nsIFrame **aAnimatedGeometryRoot); + /** + * When adding a new layer above the topmost PaintedLayerData layer in our + * PaintedLayerDataStack, update the visible above region of the topmost + * PaintedLayerData item. + * @param aVisibleRect The visible rect of the newly-added display item + * @param aCanMoveFreely Whether the visible area of the item can change + * without new layer building. + * @param aClipRectIfAny A clip rect, if the layer is clipped, or nullptr. + */ + void UpdateVisibleAboveRegionForNewItem(const nsIntRect& aVisibleRect, + bool aCanMoveFreely, + const nsIntRect* aClipRectIfAny); + + /** + * When popping aData from the PaintedLayerDataStack, update the next + * PaintedLayerData item's visible above region to take the popped layer + * into account. + * @param aData The layer data that is getting popped from + * the stack. + * @param aNextPaintedLayerData The next lower item in the stack, or nullptr + * if there is none. + */ + void UpdateVisibleAboveRegionOnPop(PaintedLayerData* aData, + PaintedLayerData* aNextPaintedLayerData); + nsDisplayListBuilder* mBuilder; LayerManager* mManager; FrameLayerBuilder* mLayerBuilder; @@ -2268,8 +2292,7 @@ ContainerState::PopPaintedLayerData() // Since we're going to pop off the last PaintedLayerData, the // mVisibleAboveRegion of the second-to-last item will need to include // the regions of the last item. - PaintedLayerData* nextData = mPaintedLayerDataStack[lastIndex - 1]; - nextData->CopyAboveRegion(data); + UpdateVisibleAboveRegionOnPop(data, mPaintedLayerDataStack[lastIndex - 1]); } mPaintedLayerDataStack.RemoveElementAt(lastIndex); @@ -2720,6 +2743,54 @@ ContainerState::ComputeOpaqueRect(nsDisplayItem* aItem, return opaquePixels; } +void +ContainerState::UpdateVisibleAboveRegionForNewItem(const nsIntRect& aVisibleRect, + bool aCanMoveFreely, + const nsIntRect* aClipRectIfAny) +{ + PaintedLayerData* data = GetTopPaintedLayerData(); + if (!data) { + return; + } + + PossiblyInfiniteRegion& visibleAboveRegion = data->mVisibleAboveRegion; + + if (aCanMoveFreely) { + // Prerendered transform items can be updated without layer building + // (async animations or an empty transaction), so we need to put items + // that the transform item can potentially move under into a layer above + // this item. We do this by making the visible above region infinite. + // If we have a clip, the transform can't escape from the clip rect, and + // the clip rect can't change without new layer building. In that case we + // can add just the clip rect to the visible above region. + visibleAboveRegion.AccumulateAndSimplifyOutward( + aClipRectIfAny ? *aClipRectIfAny : PossiblyInfiniteRegion::InfiniteRegion()); + } else { + visibleAboveRegion.AccumulateAndSimplifyOutward(aVisibleRect); + } +} + +void +ContainerState::UpdateVisibleAboveRegionOnPop(PaintedLayerData* aData, + PaintedLayerData* aNextPaintedLayerData) +{ + PossiblyInfiniteRegion& visibleAboveRegion = + aNextPaintedLayerData->mVisibleAboveRegion; + + // If aData has a draw region and is subject to async transforms then the + // layer can potentially be moved arbitrarily on the compositor. So we + // should avoid moving display items from on top of the layer to below the + // layer, which we do by making the visibleAboveRegion infinite. Note that + // if the visible region is empty (such as when aData has only event-regions + // items) then we don't need to do this. + if (aData->IsSubjectToAsyncTransforms() && !aData->mVisibleRegion.IsEmpty()) { + visibleAboveRegion.AccumulateAndSimplifyOutward(PossiblyInfiniteRegion::InfiniteRegion()); + } else { + visibleAboveRegion.AccumulateAndSimplifyOutward(aData->mVisibleAboveRegion); + visibleAboveRegion.AccumulateAndSimplifyOutward(aData->mVisibleRegion); + } +} + /* * Iterate through the non-clip items in aList and its descendants. * For each item we compute the effective clip rect. Each item is assigned @@ -2953,27 +3024,12 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList) } else { ownLayer->SetClipRect(nullptr); } - PaintedLayerData* data = GetTopPaintedLayerData(); - if (data) { - // Prerendered transform items can be updated without layer building - // (async animations or an empty transaction), so we need to put items - // that the transform item can potentially move under into a layer - // above this item. - if (prerenderedTransform) { - if (!itemClip.HasClip()) { - // The transform item can move anywhere, treat all other content - // as being above this item. - data->SetVisibleAboveRegionIsInfinite(); - } else { - // The transform can't escape from the clip rect, and the clip - // rect can't change without new layer building. Treat all content - // that intersects the clip rect as being above this item. - data->AddVisibleAboveRegion(clipRect); - } - } else { - data->AddVisibleAboveRegion(itemVisibleRect); - } - } + + // Update the "visible above region" of the topmost PaintedLayerData item + // so that FindPaintedLayerFor and FindOpaqueBackgroundColorFor are aware + // of this item, even though it's not in the PaintedLayerDataStack. + UpdateVisibleAboveRegionForNewItem(itemVisibleRect, prerenderedTransform, + itemClip.HasClip() ? &clipRect : nullptr); // rounded rectangle clipping using mask layers // (must be done after visible rect is set on layer) From 7c77f134f78c8ca0b7f41004b14d66567e68d930 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Fri, 20 Feb 2015 14:46:09 -0500 Subject: [PATCH 34/68] Bug 961887 - Make FindOpaqueBackgroundColorFor take a region instead of a PaintedLayerData. r=roc --- layout/base/FrameLayerBuilder.cpp | 34 ++++++++++++++++--------------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 38215fb6767..32b214c6406 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -732,12 +732,15 @@ protected: PaintedLayer* aNewLayer); /** - * Try to determine whether the PaintedLayer at aPaintedLayerIndex + * Try to determine whether a layer with visible region aTargetVisibleRegion * has a single opaque color behind it, over the entire bounds of its visible - * region. - * If successful, return that color, otherwise return NS_RGBA(0,0,0,0). + * region. The target layer is assumed to be on top of all thebes layers in + * the thebes layer data stack that have a stack index < aUnderPaintedLayerIndex. + * If successful, return the color, otherwise return NS_RGBA(0,0,0,0). + * aTargetVisibleRegion is relative to the the container reference frame. */ - nscolor FindOpaqueBackgroundColorFor(int32_t aPaintedLayerIndex); + nscolor FindOpaqueBackgroundColorFor(const nsIntRegion& aTargetVisibleRegion, + int32_t aUnderPaintedLayerIndex); /** * Find the fixed-pos frame, if any, containing (or equal to) * aAnimatedGeometryRoot. Only return a fixed-pos frame if its viewport @@ -1865,19 +1868,19 @@ ContainerState::SetOuterVisibleRegionForLayer(Layer* aLayer, } nscolor -ContainerState::FindOpaqueBackgroundColorFor(int32_t aPaintedLayerIndex) +ContainerState::FindOpaqueBackgroundColorFor(const nsIntRegion& aTargetVisibleRegion, + int32_t aUnderPaintedLayerIndex) { - PaintedLayerData* target = mPaintedLayerDataStack[aPaintedLayerIndex]; - for (int32_t i = aPaintedLayerIndex - 1; i >= 0; --i) { + for (int32_t i = aUnderPaintedLayerIndex - 1; i >= 0; --i) { PaintedLayerData* candidate = mPaintedLayerDataStack[i]; - if (candidate->VisibleAboveRegionIntersects(target->mVisibleRegion)) { + if (candidate->VisibleAboveRegionIntersects(aTargetVisibleRegion)) { // Some non-PaintedLayer content between target and candidate; this is // hopeless - break; + return NS_RGBA(0,0,0,0); } nsIntRegion intersection; - intersection.And(candidate->mVisibleRegion, target->mVisibleRegion); + intersection.And(candidate->mVisibleRegion, aTargetVisibleRegion); if (intersection.IsEmpty()) { // The layer doesn't intersect our target, ignore it and move on continue; @@ -1885,7 +1888,7 @@ ContainerState::FindOpaqueBackgroundColorFor(int32_t aPaintedLayerIndex) // The candidate intersects our target. If any layer has a solid-color // area behind our target, this must be it. Scan its display items. - nsIntRect deviceRect = target->mVisibleRegion.GetBounds(); + nsIntRect deviceRect = aTargetVisibleRegion.GetBounds(); nsRect appUnitRect = deviceRect.ToAppUnits(mAppUnitsPerDevPixel); appUnitRect.ScaleInverseRoundOut(mParameters.mXScale, mParameters.mYScale); @@ -1902,7 +1905,7 @@ ContainerState::FindOpaqueBackgroundColorFor(int32_t aPaintedLayerIndex) continue; if (!snappedBounds.Contains(deviceRect)) - break; + return NS_RGBA(0,0,0,0); } else { // The layer's visible rect is already (close enough to) pixel @@ -1911,7 +1914,7 @@ ContainerState::FindOpaqueBackgroundColorFor(int32_t aPaintedLayerIndex) continue; if (!bounds.Contains(appUnitRect)) - break; + return NS_RGBA(0,0,0,0); } if (item->IsInvisibleInRect(appUnitRect)) { @@ -1929,9 +1932,8 @@ ContainerState::FindOpaqueBackgroundColorFor(int32_t aPaintedLayerIndex) if (item->IsUniform(mBuilder, &color) && NS_GET_A(color) == 255) return color; - break; + return NS_RGBA(0,0,0,0); } - break; } return NS_RGBA(0,0,0,0); } @@ -2176,7 +2178,7 @@ ContainerState::PopPaintedLayerData() if (layer == data->mLayer) { nscolor backgroundColor = NS_RGBA(0,0,0,0); if (!isOpaque) { - backgroundColor = FindOpaqueBackgroundColorFor(lastIndex); + backgroundColor = FindOpaqueBackgroundColorFor(data->mVisibleRegion, lastIndex); if (NS_GET_A(backgroundColor) == 255) { isOpaque = true; } From 533b9d24b1cf50426f191d5cabd23cdb2fbe690b Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Tue, 24 Feb 2015 14:35:46 -0500 Subject: [PATCH 35/68] Bug 961887 - Find uniform opaque background colors under ContainerLayers. r=roc --- layout/base/FrameLayerBuilder.cpp | 72 ++++++++++++++----- layout/base/FrameLayerBuilder.h | 15 +++- layout/base/nsDisplayList.cpp | 13 ++-- layout/reftests/bugs/961887-1-ref.html | 23 ++++++ layout/reftests/bugs/961887-1.html | 30 ++++++++ layout/reftests/bugs/961887-2-ref.html | 24 +++++++ layout/reftests/bugs/961887-2.html | 32 +++++++++ layout/reftests/bugs/961887-3-ref.html | 16 +++++ layout/reftests/bugs/961887-3.html | 51 +++++++++++++ layout/reftests/bugs/reftest.list | 9 ++- .../percent-overflow-sizing/reftest.list | 2 +- 11 files changed, 259 insertions(+), 28 deletions(-) create mode 100644 layout/reftests/bugs/961887-1-ref.html create mode 100644 layout/reftests/bugs/961887-1.html create mode 100644 layout/reftests/bugs/961887-2-ref.html create mode 100644 layout/reftests/bugs/961887-2.html create mode 100644 layout/reftests/bugs/961887-3-ref.html create mode 100644 layout/reftests/bugs/961887-3.html diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 32b214c6406..306cb8d5947 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -574,7 +574,8 @@ public: const nsRect& aContainerBounds, ContainerLayer* aContainerLayer, const ContainerLayerParameters& aParameters, - bool aFlattenToSingleLayer) : + bool aFlattenToSingleLayer, + nscolor aBackgroundColor) : mBuilder(aBuilder), mManager(aManager), mLayerBuilder(aLayerBuilder), mContainerFrame(aContainerFrame), @@ -582,6 +583,7 @@ public: mContainerBounds(aContainerBounds), mParameters(aParameters), mNextFreeRecycledPaintedLayer(0), + mContainerUniformBackgroundColor(aBackgroundColor), mFlattenToSingleLayer(aFlattenToSingleLayer) { nsPresContext* presContext = aContainerFrame->PresContext(); @@ -914,8 +916,20 @@ protected: nsTArray > mRecycledPaintedLayers; nsDataHashtable, nsRefPtr > mRecycledMaskImageLayers; + /** + * The visible region of all visible content in this container layer under + * first PaintedLayerData layer in the PaintedLayerDataStack. + */ + PossiblyInfiniteRegion mVisibleAboveBackgroundRegion; uint32_t mNextFreeRecycledPaintedLayer; nscoord mAppUnitsPerDevPixel; + /** + * The uniform opaque color from behind this container layer, or + * NS_RGBA(0,0,0,0) if the background behind this container layer is not + * uniform and opaque. This color can be pulled into ThebesLayers that are + * directly above the background. + */ + nscolor mContainerUniformBackgroundColor; bool mSnappingEnabled; bool mFlattenToSingleLayer; /** @@ -1925,7 +1939,7 @@ ContainerState::FindOpaqueBackgroundColorFor(const nsIntRegion& aTargetVisibleRe mParameters.mXScale, mParameters.mYScale, mAppUnitsPerDevPixel)) { - break; + return NS_RGBA(0,0,0,0); } nscolor color; @@ -1935,7 +1949,11 @@ ContainerState::FindOpaqueBackgroundColorFor(const nsIntRegion& aTargetVisibleRe return NS_RGBA(0,0,0,0); } } - return NS_RGBA(0,0,0,0); + if (mVisibleAboveBackgroundRegion.Intersects(aTargetVisibleRegion)) { + // Some non-Thebes content is between container background and target. + return NS_RGBA(0,0,0,0); + } + return mContainerUniformBackgroundColor; } void @@ -2290,12 +2308,13 @@ ContainerState::PopPaintedLayerData() layer->SetEventRegions(regions); } - if (lastIndex > 0) { - // Since we're going to pop off the last PaintedLayerData, the - // mVisibleAboveRegion of the second-to-last item will need to include - // the regions of the last item. - UpdateVisibleAboveRegionOnPop(data, mPaintedLayerDataStack[lastIndex - 1]); - } + // Since we're going to pop off the last PaintedLayerData, the + // mVisibleAboveRegion of the second-to-last item will need to include + // the regions of the last item. If we're emptying the PaintedLayerDataStack, + // we instead need to accumulate the regions into the container's + // mVisibleAboveBackgroundRegion. + UpdateVisibleAboveRegionOnPop(data, + lastIndex > 0 ? mPaintedLayerDataStack[lastIndex - 1].get() : nullptr); mPaintedLayerDataStack.RemoveElementAt(lastIndex); } @@ -2751,11 +2770,8 @@ ContainerState::UpdateVisibleAboveRegionForNewItem(const nsIntRect& aVisibleRect const nsIntRect* aClipRectIfAny) { PaintedLayerData* data = GetTopPaintedLayerData(); - if (!data) { - return; - } - - PossiblyInfiniteRegion& visibleAboveRegion = data->mVisibleAboveRegion; + PossiblyInfiniteRegion& visibleAboveRegion = data + ? data->mVisibleAboveRegion : mVisibleAboveBackgroundRegion; if (aCanMoveFreely) { // Prerendered transform items can be updated without layer building @@ -2776,8 +2792,8 @@ void ContainerState::UpdateVisibleAboveRegionOnPop(PaintedLayerData* aData, PaintedLayerData* aNextPaintedLayerData) { - PossiblyInfiniteRegion& visibleAboveRegion = - aNextPaintedLayerData->mVisibleAboveRegion; + PossiblyInfiniteRegion& visibleAboveRegion = aNextPaintedLayerData ? + aNextPaintedLayerData->mVisibleAboveRegion : mVisibleAboveBackgroundRegion; // If aData has a draw region and is subject to async transforms then the // layer can potentially be moved arbitrarily on the compositor. So we @@ -2983,6 +2999,16 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList) continue; } + // 3D-transformed layers don't necessarily draw in the order in which + // they're added to their parent container layer. + bool mayDrawOutOfOrder = itemType == nsDisplayItem::TYPE_TRANSFORM && + (item->Frame()->Preserves3D() || item->Frame()->Preserves3DChildren()); + + // Pull up a uniform background color into the layer if possible. + mParameters.mBackgroundColor = (prerenderedTransform || mayDrawOutOfOrder) + ? NS_RGBA(0,0,0,0) + : FindOpaqueBackgroundColorFor(itemVisibleRect, mPaintedLayerDataStack.Length()); + // Just use its layer. // Set layerContentsVisibleRect.width/height to -1 to indicate we // currently don't know. If BuildContainerLayerFor gets called by @@ -3028,8 +3054,9 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList) } // Update the "visible above region" of the topmost PaintedLayerData item - // so that FindPaintedLayerFor and FindOpaqueBackgroundColorFor are aware - // of this item, even though it's not in the PaintedLayerDataStack. + // (or of the container's background) so that FindPaintedLayerFor and + // FindOpaqueBackgroundColorFor are aware of this item, even though it's + // not in the PaintedLayerDataStack. UpdateVisibleAboveRegionForNewItem(itemVisibleRect, prerenderedTransform, itemClip.HasClip() ? &clipRect : nullptr); @@ -4082,11 +4109,18 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder, { flattenToSingleLayer = true; } + + nscolor backgroundColor = NS_RGBA(0,0,0,0); + if (aFlags & CONTAINER_ALLOW_PULL_BACKGROUND_COLOR) { + backgroundColor = aParameters.mBackgroundColor; + } + uint32_t flags; while (true) { ContainerState state(aBuilder, aManager, aManager->GetLayerBuilder(), aContainerFrame, aContainerItem, bounds, - containerLayer, scaleParameters, flattenToSingleLayer); + containerLayer, scaleParameters, flattenToSingleLayer, + backgroundColor); state.ProcessDisplayItems(aChildren); diff --git a/layout/base/FrameLayerBuilder.h b/layout/base/FrameLayerBuilder.h index 4a5a2186098..9b35c093c89 100644 --- a/layout/base/FrameLayerBuilder.h +++ b/layout/base/FrameLayerBuilder.h @@ -57,6 +57,7 @@ struct ContainerLayerParameters { : mXScale(1) , mYScale(1) , mLayerContentsVisibleRect(nullptr) + , mBackgroundColor(NS_RGBA(0,0,0,0)) , mInTransformedSubtree(false) , mInActiveTransformedSubtree(false) , mDisableSubpixelAntialiasingInDescendants(false) @@ -66,6 +67,7 @@ struct ContainerLayerParameters { : mXScale(aXScale) , mYScale(aYScale) , mLayerContentsVisibleRect(nullptr) + , mBackgroundColor(NS_RGBA(0,0,0,0)) , mInTransformedSubtree(false) , mInActiveTransformedSubtree(false) , mDisableSubpixelAntialiasingInDescendants(false) @@ -78,6 +80,7 @@ struct ContainerLayerParameters { , mYScale(aYScale) , mLayerContentsVisibleRect(nullptr) , mOffset(aOffset) + , mBackgroundColor(aParent.mBackgroundColor) , mInTransformedSubtree(aParent.mInTransformedSubtree) , mInActiveTransformedSubtree(aParent.mInActiveTransformedSubtree) , mDisableSubpixelAntialiasingInDescendants(aParent.mDisableSubpixelAntialiasingInDescendants) @@ -94,6 +97,7 @@ struct ContainerLayerParameters { */ nsIntPoint mOffset; + nscolor mBackgroundColor; bool mInTransformedSubtree; bool mInActiveTransformedSubtree; bool mDisableSubpixelAntialiasingInDescendants; @@ -197,7 +201,16 @@ public: void DidEndTransaction(); enum { - CONTAINER_NOT_CLIPPED_BY_ANCESTORS = 0x01 + CONTAINER_NOT_CLIPPED_BY_ANCESTORS = 0x01, + + /** + * Set this when pulling an opaque background color from behind the + * container layer into the container doesn't change the visual results, + * given the effects you're going to apply to the container layer. + * For example, this is compatible with opacity or clipping/masking, but + * not with non-OVER blend modes or filters. + */ + CONTAINER_ALLOW_PULL_BACKGROUND_COLOR = 0x02 }; /** * Build a container layer for a display item that contains a child diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 6b663482f4a..2f7f6c05ede 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -3811,7 +3811,8 @@ nsDisplayOpacity::BuildLayer(nsDisplayListBuilder* aBuilder, const ContainerLayerParameters& aContainerParameters) { nsRefPtr container = aManager->GetLayerBuilder()-> BuildContainerLayerFor(aBuilder, aManager, mFrame, this, &mList, - aContainerParameters, nullptr); + aContainerParameters, nullptr, + FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR); if (!container) return nullptr; @@ -4120,7 +4121,8 @@ nsDisplayOwnLayer::BuildLayer(nsDisplayListBuilder* aBuilder, const ContainerLayerParameters& aContainerParameters) { nsRefPtr layer = aManager->GetLayerBuilder()-> BuildContainerLayerFor(aBuilder, aManager, mFrame, this, &mList, - aContainerParameters, nullptr); + aContainerParameters, nullptr, + FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR); if (mFlags & VERTICAL_SCROLLBAR) { layer->SetScrollbarData(mScrollTarget, Layer::ScrollDirection::VERTICAL); } @@ -4518,7 +4520,8 @@ nsDisplayScrollLayer::BuildLayer(nsDisplayListBuilder* aBuilder, return aManager->GetLayerBuilder()-> BuildContainerLayerFor(aBuilder, aManager, mFrame, this, &mList, - params, nullptr); + params, nullptr, + FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR); } UniquePtr @@ -5521,6 +5524,7 @@ already_AddRefed nsDisplayTransform::BuildLayer(nsDisplayListBuilder *aBu uint32_t flags = ShouldPrerender(aBuilder) ? FrameLayerBuilder::CONTAINER_NOT_CLIPPED_BY_ANCESTORS : 0; + flags |= FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR; nsRefPtr container = aManager->GetLayerBuilder()-> BuildContainerLayerFor(aBuilder, aManager, mFrame, this, mStoredList.GetChildren(), aContainerParameters, &newTransformMatrix, flags); @@ -5977,7 +5981,8 @@ nsDisplayVR::BuildLayer(nsDisplayListBuilder* aBuilder, const ContainerLayerParameters& aContainerParameters) { ContainerLayerParameters newContainerParameters = aContainerParameters; - uint32_t flags = FrameLayerBuilder::CONTAINER_NOT_CLIPPED_BY_ANCESTORS; + uint32_t flags = FrameLayerBuilder::CONTAINER_NOT_CLIPPED_BY_ANCESTORS | + FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR; nsRefPtr container = aManager->GetLayerBuilder()-> BuildContainerLayerFor(aBuilder, aManager, mFrame, this, &mList, newContainerParameters, nullptr, flags); diff --git a/layout/reftests/bugs/961887-1-ref.html b/layout/reftests/bugs/961887-1-ref.html new file mode 100644 index 00000000000..78673a82280 --- /dev/null +++ b/layout/reftests/bugs/961887-1-ref.html @@ -0,0 +1,23 @@ + +Don't pull background colors of container layers through DrawAboveRegions of ThebesLayers + + +
+
+
+
diff --git a/layout/reftests/bugs/961887-1.html b/layout/reftests/bugs/961887-1.html new file mode 100644 index 00000000000..65ff8d242cc --- /dev/null +++ b/layout/reftests/bugs/961887-1.html @@ -0,0 +1,30 @@ + +Don't pull background colors of container layers through DrawAboveRegions of ThebesLayers + + +
+ +
+
+ + diff --git a/layout/reftests/bugs/961887-2-ref.html b/layout/reftests/bugs/961887-2-ref.html new file mode 100644 index 00000000000..e484b399f9e --- /dev/null +++ b/layout/reftests/bugs/961887-2-ref.html @@ -0,0 +1,24 @@ + + + +Make sure that we don't pull background colors into container layers that have effects applied on them + + + +
+
+
+
diff --git a/layout/reftests/bugs/961887-2.html b/layout/reftests/bugs/961887-2.html new file mode 100644 index 00000000000..6d499740aa2 --- /dev/null +++ b/layout/reftests/bugs/961887-2.html @@ -0,0 +1,32 @@ + + + +Make sure that we don't pull background colors into container layers that have effects applied on them + + + +
+
+
+
diff --git a/layout/reftests/bugs/961887-3-ref.html b/layout/reftests/bugs/961887-3-ref.html new file mode 100644 index 00000000000..0d9b3cb30dd --- /dev/null +++ b/layout/reftests/bugs/961887-3-ref.html @@ -0,0 +1,16 @@ + + + +Test container background searching with clipped display items + + + +
diff --git a/layout/reftests/bugs/961887-3.html b/layout/reftests/bugs/961887-3.html new file mode 100644 index 00000000000..b70f03a1881 --- /dev/null +++ b/layout/reftests/bugs/961887-3.html @@ -0,0 +1,51 @@ + + + +Test container background searching with clipped display items + + + +
+
+
+
+
+
+
+
+
diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index 573f671dd3b..ecb01074503 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1658,9 +1658,9 @@ skip-if(Android||B2G) random-if(winWidget) == 632781-verybig.html 632781-ref.htm fuzzy-if(d2d&&/^Windows\x20NT\x206\.2/.test(http.oscpu),1,559) == 633344-1.html 633344-1-ref.html # bug 1103623 == 634232-1.html 634232-1-ref.html fails-if(Android&&AndroidVersion<17&&AndroidVersion!=10) == 635302-1.html 635302-1-ref.html -skip-if(B2G) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,11) == 635373-1.html 635373-1-ref.html -skip-if(B2G) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,15) == 635373-2.html 635373-2-ref.html -skip-if(B2G) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,15) == 635373-3.html 635373-3-ref.html +fuzzy(1,68) skip-if(B2G) fails-if(Android) == 635373-1.html 635373-1-ref.html +skip-if(B2G) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,61) == 635373-2.html 635373-2-ref.html +skip-if(B2G) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,60) == 635373-3.html 635373-3-ref.html HTTP(..) == 635639-1.html 635639-1-ref.html HTTP(..) == 635639-2.html 635639-2-ref.html random == 637597-1.html 637597-1-ref.html # bug 637597 was never really fixed! @@ -1803,6 +1803,9 @@ fuzzy-if(B2G,1,7) == 942672-1.html 942672-1-ref.html == 950436-1.html 950436-1-ref.html == 957770-1.svg 957770-1-ref.svg == 960277-1.html 960277-1-ref.html +== 961887-1.html 961887-1-ref.html +== 961887-2.html 961887-2-ref.html +== 961887-3.html 961887-3-ref.html pref(layout.css.overflow-clip-box.enabled,true) fuzzy(50,145) == 966992-1.html 966992-1-ref.html skip-if(Android) == 966510-1.html 966510-1-ref.html # scrollable elements other than the root probably won't work well on android until bug 776030 is fixed skip-if(Android) == 966510-2.html 966510-2-ref.html # same as above diff --git a/layout/reftests/percent-overflow-sizing/reftest.list b/layout/reftests/percent-overflow-sizing/reftest.list index e2eb72688da..25fe07045e8 100644 --- a/layout/reftests/percent-overflow-sizing/reftest.list +++ b/layout/reftests/percent-overflow-sizing/reftest.list @@ -11,7 +11,7 @@ skip-if(B2G) fails-if(Android&&browserIsRemote) == hScrollAbsHeightQuirks.html g skip-if(B2G) fails-if(Android&&browserIsRemote) == hScrollSimpleHeightD.html greenboxhbar.html # bug 650591, 732565 # bug 773482 skip-if(B2G) fails-if(Android&&browserIsRemote) == hScrollSimpleHeightQuirks-1D.html greenboxhbar.html # bug 650591, 732565 # bug 773482 skip-if(B2G) fails-if(Android&&browserIsRemote) == hScrollSimpleHeightQuirks-2D.html greenboxhbar.html # bug 650591, 732565 # bug 773482 -fails-if(Android&&browserIsRemote) == hScrollSimpleHeightQuirks-3D.html greenboxhbar.html # bug 650591, 732565 +fuzzy-if(B2G,1,11) fails-if(Android&&browserIsRemote) == hScrollSimpleHeightQuirks-3D.html greenboxhbar.html # bug 650591, 732565, 1136304 skip-if(B2G) fails-if(Android&&browserIsRemote) == hScrollAbsHeightD.html greenboxhbar.html # bug 650591, 732565 # bug 773482 skip-if(B2G) fails-if(Android&&browserIsRemote) == hScrollAbsHeightQuirksD.html greenboxhbar.html # bug 650591, 732565 # bug 773482 == simpleMinHeight100D.html greenbox.html From d95c3b927dc8f66bad1321d679b8241e89712b1c Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Mon, 23 Feb 2015 18:27:15 -0500 Subject: [PATCH 36/68] Bug 1135912 - Don't repaint vibrant regions on mouseover. r=smichaud --- widget/cocoa/nsNativeThemeCocoa.mm | 2 ++ 1 file changed, 2 insertions(+) diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm index 893d10c1486..66072103497 100644 --- a/widget/cocoa/nsNativeThemeCocoa.mm +++ b/widget/cocoa/nsNativeThemeCocoa.mm @@ -3494,6 +3494,8 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, case NS_THEME_PROGRESSBAR_VERTICAL: case NS_THEME_METERBAR: case NS_THEME_METERBAR_CHUNK: + case NS_THEME_MAC_VIBRANCY_LIGHT: + case NS_THEME_MAC_VIBRANCY_DARK: *aShouldRepaint = false; return NS_OK; } From b60c2d139c6beea8ec364a01e1ff547f6b60a588 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Tue, 24 Feb 2015 15:59:37 -0600 Subject: [PATCH 37/68] Bug 826741 - Use the backtracking register allocator by default, r=jandem. --- js/src/jit/IonOptimizationLevels.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/jit/IonOptimizationLevels.cpp b/js/src/jit/IonOptimizationLevels.cpp index 0f2c2038eb8..5c3a23ae26f 100644 --- a/js/src/jit/IonOptimizationLevels.cpp +++ b/js/src/jit/IonOptimizationLevels.cpp @@ -34,7 +34,7 @@ OptimizationInfo::initNormalOptimizationInfo() loopUnrolling_ = true; autoTruncate_ = true; sink_ = true; - registerAllocator_ = RegisterAllocator_LSRA; + registerAllocator_ = RegisterAllocator_Backtracking; inlineMaxTotalBytecodeLength_ = 1000; inliningMaxCallerBytecodeLength_ = 10000; From 74cba658d639c33281d632148629ca2b02790102 Mon Sep 17 00:00:00 2001 From: Brian Hackett Date: Tue, 24 Feb 2015 16:02:09 -0600 Subject: [PATCH 38/68] Bug 1133369 - Use consistent allocation kinds for new objects after converting an unboxed group, r=jandem. --- js/src/vm/ObjectGroup.h | 4 +-- js/src/vm/TypeInference.cpp | 61 +++++++++++++++++++++++++++++-------- js/src/vm/TypeInference.h | 4 +-- js/src/vm/UnboxedObject.cpp | 47 ++++++++++++++++++++++++---- js/src/vm/UnboxedObject.h | 10 +++++- 5 files changed, 103 insertions(+), 23 deletions(-) diff --git a/js/src/vm/ObjectGroup.h b/js/src/vm/ObjectGroup.h index 26b54dfb0e4..72debd99e96 100644 --- a/js/src/vm/ObjectGroup.h +++ b/js/src/vm/ObjectGroup.h @@ -252,7 +252,7 @@ class ObjectGroup : public gc::TenuredCell } TypeNewScript *anyNewScript(); - void detachNewScript(bool writeBarrier); + void detachNewScript(bool writeBarrier, ObjectGroup *replacement); ObjectGroupFlags flagsDontCheckGeneration() { return flags_; @@ -480,7 +480,7 @@ class ObjectGroup : public gc::TenuredCell void setFlags(ExclusiveContext *cx, ObjectGroupFlags flags); void markUnknown(ExclusiveContext *cx); void maybeClearNewScriptOnOOM(); - void clearNewScript(ExclusiveContext *cx); + void clearNewScript(ExclusiveContext *cx, ObjectGroup *replacement = nullptr); bool isPropertyNonData(jsid id); bool isPropertyNonWritable(jsid id); diff --git a/js/src/vm/TypeInference.cpp b/js/src/vm/TypeInference.cpp index e55a39a50b5..afcf11d6543 100644 --- a/js/src/vm/TypeInference.cpp +++ b/js/src/vm/TypeInference.cpp @@ -2765,7 +2765,7 @@ ObjectGroup::anyNewScript() } void -ObjectGroup::detachNewScript(bool writeBarrier) +ObjectGroup::detachNewScript(bool writeBarrier, ObjectGroup *replacement) { // Clear the TypeNewScript from this ObjectGroup and, if it has been // analyzed, remove it from the newObjectGroups table so that it will not be @@ -2775,8 +2775,16 @@ ObjectGroup::detachNewScript(bool writeBarrier) MOZ_ASSERT(newScript); if (newScript->analyzed()) { - newScript->function()->compartment()->objectGroups.removeDefaultNewGroup(nullptr, proto(), - newScript->function()); + ObjectGroupCompartment &objectGroups = newScript->function()->compartment()->objectGroups; + if (replacement) { + MOZ_ASSERT(replacement->newScript()->function() == newScript->function()); + objectGroups.replaceDefaultNewGroup(nullptr, proto(), newScript->function(), + replacement); + } else { + objectGroups.removeDefaultNewGroup(nullptr, proto(), newScript->function()); + } + } else { + MOZ_ASSERT(!replacement); } if (this->newScript()) @@ -2800,13 +2808,13 @@ ObjectGroup::maybeClearNewScriptOnOOM() addFlags(OBJECT_FLAG_NEW_SCRIPT_CLEARED); // This method is called during GC sweeping, so don't trigger pre barriers. - detachNewScript(/* writeBarrier = */ false); + detachNewScript(/* writeBarrier = */ false, nullptr); js_delete(newScript); } void -ObjectGroup::clearNewScript(ExclusiveContext *cx) +ObjectGroup::clearNewScript(ExclusiveContext *cx, ObjectGroup *replacement /* = nullptr*/) { TypeNewScript *newScript = anyNewScript(); if (!newScript) @@ -2814,15 +2822,17 @@ ObjectGroup::clearNewScript(ExclusiveContext *cx) AutoEnterAnalysis enter(cx); - // Invalidate any Ion code constructing objects of this type. - setFlags(cx, OBJECT_FLAG_NEW_SCRIPT_CLEARED); + if (!replacement) { + // Invalidate any Ion code constructing objects of this type. + setFlags(cx, OBJECT_FLAG_NEW_SCRIPT_CLEARED); - // Mark the constructing function as having its 'new' script cleared, so we - // will not try to construct another one later. - if (!newScript->function()->setNewScriptCleared(cx)) - cx->recoverFromOutOfMemory(); + // Mark the constructing function as having its 'new' script cleared, so we + // will not try to construct another one later. + if (!newScript->function()->setNewScriptCleared(cx)) + cx->recoverFromOutOfMemory(); + } - detachNewScript(/* writeBarrier = */ true); + detachNewScript(/* writeBarrier = */ true, replacement); if (cx->isJSContext()) { bool found = newScript->rollbackPartiallyInitializedObjects(cx->asJSContext(), this); @@ -3268,6 +3278,33 @@ TypeNewScript::make(JSContext *cx, ObjectGroup *group, JSFunction *fun) gc::TraceTypeNewScript(group); } +// Make a TypeNewScript with the same initializer list as |newScript| but with +// a new template object. +/* static */ TypeNewScript * +TypeNewScript::makeNativeVersion(JSContext *cx, TypeNewScript *newScript, + PlainObject *templateObject) +{ + MOZ_ASSERT(cx->zone()->types.activeAnalysis); + + ScopedJSDeletePtr nativeNewScript(cx->new_()); + if (!nativeNewScript) + return nullptr; + + nativeNewScript->function_ = newScript->function(); + nativeNewScript->templateObject_ = templateObject; + + Initializer *cursor = newScript->initializerList; + while (cursor->kind != Initializer::DONE) { cursor++; } + size_t initializerLength = cursor - newScript->initializerList + 1; + + nativeNewScript->initializerList = cx->zone()->pod_calloc(initializerLength); + if (!nativeNewScript->initializerList) + return nullptr; + PodCopy(nativeNewScript->initializerList, newScript->initializerList, initializerLength); + + return nativeNewScript.forget(); +} + size_t TypeNewScript::sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const { diff --git a/js/src/vm/TypeInference.h b/js/src/vm/TypeInference.h index 4724704fbb2..8097294a83e 100644 --- a/js/src/vm/TypeInference.h +++ b/js/src/vm/TypeInference.h @@ -827,8 +827,6 @@ class TypeNewScript private: // Scripted function which this information was computed for. - // If instances of the associated group are created without calling - // 'new' on this function, the new script information is cleared. HeapPtrFunction function_; // Any preliminary objects with the type. The analyses are not performed @@ -902,6 +900,8 @@ class TypeNewScript bool rollbackPartiallyInitializedObjects(JSContext *cx, ObjectGroup *group); static void make(JSContext *cx, ObjectGroup *group, JSFunction *fun); + static TypeNewScript *makeNativeVersion(JSContext *cx, TypeNewScript *newScript, + PlainObject *templateObject); size_t sizeOfIncludingThis(mozilla::MallocSizeOf mallocSizeOf) const; }; diff --git a/js/src/vm/UnboxedObject.cpp b/js/src/vm/UnboxedObject.cpp index c6c634e9aad..27e2dc2ebca 100644 --- a/js/src/vm/UnboxedObject.cpp +++ b/js/src/vm/UnboxedObject.cpp @@ -35,6 +35,9 @@ UnboxedLayout::trace(JSTracer *trc) if (nativeShape_) MarkShape(trc, &nativeShape_, "unboxed_layout_nativeShape"); + + if (replacementNewGroup_) + MarkObjectGroup(trc, &replacementNewGroup_, "unboxed_layout_replacementNewGroup"); } size_t @@ -172,18 +175,49 @@ UnboxedPlainObject::trace(JSTracer *trc, JSObject *obj) /* static */ bool UnboxedLayout::makeNativeGroup(JSContext *cx, ObjectGroup *group) { + AutoEnterAnalysis enter(cx); + UnboxedLayout &layout = group->unboxedLayout(); + Rooted proto(cx, group->proto()); MOZ_ASSERT(!layout.nativeGroup()); - // Immediately clear any new script on the group, as - // rollbackPartiallyInitializedObjects() will be confused by the type - // changes we make later on. - group->clearNewScript(cx); + // Immediately clear any new script on the group. This is done by replacing + // the existing new script with one for a replacement default new group. + // This is done so that the size of the replacment group's objects is the + // same as that for the unboxed group, so that we do not see polymorphic + // slot accesses later on for sites that see converted objects from this + // group and objects that were allocated using the replacement new group. + RootedObjectGroup replacementNewGroup(cx); + if (layout.newScript()) { + replacementNewGroup = ObjectGroupCompartment::makeGroup(cx, &PlainObject::class_, proto); + if (!replacementNewGroup) + return false; - AutoEnterAnalysis enter(cx); + PlainObject *templateObject = NewObjectWithGroup(cx, replacementNewGroup, + cx->global(), layout.getAllocKind(), + MaybeSingletonObject); + if (!templateObject) + return false; - Rooted proto(cx, group->proto()); + for (size_t i = 0; i < layout.properties().length(); i++) { + const UnboxedLayout::Property &property = layout.properties()[i]; + if (!templateObject->addDataProperty(cx, NameToId(property.name), i, JSPROP_ENUMERATE)) + return false; + MOZ_ASSERT(templateObject->slotSpan() == i + 1); + MOZ_ASSERT(!templateObject->inDictionaryMode()); + } + + TypeNewScript *replacementNewScript = + TypeNewScript::makeNativeVersion(cx, layout.newScript(), templateObject); + if (!replacementNewScript) + return false; + + replacementNewGroup->setNewScript(replacementNewScript); + gc::TraceTypeNewScript(replacementNewGroup); + + group->clearNewScript(cx, replacementNewGroup); + } size_t nfixed = gc::GetGCKindSlots(layout.getAllocKind()); RootedShape shape(cx, EmptyShape::getInitialShape(cx, &PlainObject::class_, proto, @@ -224,6 +258,7 @@ UnboxedLayout::makeNativeGroup(JSContext *cx, ObjectGroup *group) layout.nativeGroup_ = nativeGroup; layout.nativeShape_ = shape; + layout.replacementNewGroup_ = replacementNewGroup; nativeGroup->setOriginalUnboxedGroup(group); diff --git a/js/src/vm/UnboxedObject.h b/js/src/vm/UnboxedObject.h index 7f6549ac6be..291a3abee39 100644 --- a/js/src/vm/UnboxedObject.h +++ b/js/src/vm/UnboxedObject.h @@ -71,10 +71,18 @@ class UnboxedLayout : public mozilla::LinkedListElement HeapPtrObjectGroup nativeGroup_; HeapPtrShape nativeShape_; + // If nativeGroup is set and this object originally had a TypeNewScript, + // this points to the default 'new' group which replaced this one (and + // which might itself have been cleared since). This link is only needed to + // keep the replacement group from being GC'ed. If it were GC'ed and a new + // one regenerated later, that new group might have a different allocation + // kind from this group. + HeapPtrObjectGroup replacementNewGroup_; + public: UnboxedLayout(const PropertyVector &properties, size_t size) : size_(size), newScript_(nullptr), traceList_(nullptr), - nativeGroup_(nullptr), nativeShape_(nullptr) + nativeGroup_(nullptr), nativeShape_(nullptr), replacementNewGroup_(nullptr) { properties_.appendAll(properties); } From 20bb1641e341cef60ee93af8e991a1a6c6b1075b Mon Sep 17 00:00:00 2001 From: James Graham Date: Tue, 24 Feb 2015 15:18:19 +0000 Subject: [PATCH 39/68] Bug 1136398 - Update to latest wptrunner, a=testonly --- .../wptrunner/executors/executormarionette.py | 12 +++++++----- .../web-platform/harness/wptrunner/update/tree.py | 7 +++++++ 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/testing/web-platform/harness/wptrunner/executors/executormarionette.py b/testing/web-platform/harness/wptrunner/executors/executormarionette.py index 663f95f7ee4..1d03ef6d1ec 100644 --- a/testing/web-platform/harness/wptrunner/executors/executormarionette.py +++ b/testing/web-platform/harness/wptrunner/executors/executormarionette.py @@ -30,10 +30,12 @@ required_files = [("testharness_runner.html", "", False), def do_delayed_imports(): global marionette + global errors try: import marionette + from marionette import errors except ImportError: - import marionette_driver.marionette as marionette + from marionette_driver import marionette, errors class MarionetteTestExecutor(TestExecutor): @@ -153,13 +155,13 @@ class MarionetteTestExecutor(TestExecutor): try: self.marionette.set_script_timeout((timeout + extra_timeout) * 1000) - except IOError, marionette.errors.InvalidResponseException: + except IOError, errors.InvalidResponseException: self.logger.error("Lost marionette connection before starting test") return Stop try: result = self.convert_result(test, self.do_test(test, timeout)) - except marionette.errors.ScriptTimeoutException: + except errors.ScriptTimeoutException: with result_lock: if not result_flag.is_set(): result_flag.set() @@ -179,7 +181,7 @@ class MarionetteTestExecutor(TestExecutor): # else: # break # Now need to check if the browser is still responsive and restart it if not - except (socket.timeout, marionette.errors.InvalidResponseException, IOError): + except (socket.timeout, errors.InvalidResponseException, IOError): # This can happen on a crash # Also, should check after the test if the firefox process is still running # and otherwise ignore any other result and set it to crash @@ -250,7 +252,7 @@ class MarionetteReftestExecutor(MarionetteTestExecutor): full_url = urlparse.urljoin(self.http_server_url, url) try: self.marionette.navigate(full_url) - except marionette.errors.MarionetteException: + except errors.MarionetteException: return {"status": "ERROR", "message": "Failed to load url %s" % (full_url,)} if url_type == "test": diff --git a/testing/web-platform/harness/wptrunner/update/tree.py b/testing/web-platform/harness/wptrunner/update/tree.py index 7b01e30288d..292a45a4fe2 100644 --- a/testing/web-platform/harness/wptrunner/update/tree.py +++ b/testing/web-platform/harness/wptrunner/update/tree.py @@ -124,6 +124,13 @@ class HgTree(object): def commit_patch(self): self.hg("qfinish") + def contains_commit(self, commit): + try: + self.hg("identify", "-r", commit.sha1) + return True + except subprocess.CalledProcessError: + return False + class GitTree(object): name = "git" From 0c716b55ea371c6a0a6d07ffa6489a5a43c9e13c Mon Sep 17 00:00:00 2001 From: Robert Strong Date: Tue, 24 Feb 2015 14:11:33 -0800 Subject: [PATCH 40/68] Bug 897031 - NS_ERROR_XPC_GS_RETURNED_FAILURE at nsBlocklistService.js:70 followed by ReferenceError: gApp is not defined, on green Windows debug mochitest runs. r=dtownsend --- .../mozapps/extensions/nsBlocklistService.js | 31 ++++++++++++++++--- 1 file changed, 27 insertions(+), 4 deletions(-) diff --git a/toolkit/mozapps/extensions/nsBlocklistService.js b/toolkit/mozapps/extensions/nsBlocklistService.js index cced0c94b88..4746d02bfb7 100644 --- a/toolkit/mozapps/extensions/nsBlocklistService.js +++ b/toolkit/mozapps/extensions/nsBlocklistService.js @@ -83,9 +83,20 @@ XPCOMUtils.defineLazyGetter(this, "gPref", function bls_gPref() { QueryInterface(Ci.nsIPrefBranch); }); +// From appinfo in Services.jsm. It is not possible to use the one in +// Services.jsm since it will not successfully QueryInterface nsIXULAppInfo in +// xpcshell tests due to other code calling Services.appinfo before the +// nsIXULAppInfo is created by the tests. XPCOMUtils.defineLazyGetter(this, "gApp", function bls_gApp() { - return Cc["@mozilla.org/xre/app-info;1"].getService(Ci.nsIXULAppInfo). - QueryInterface(Ci.nsIXULRuntime); + let appinfo = Cc["@mozilla.org/xre/app-info;1"] + .getService(Ci.nsIXULRuntime); + try { + appinfo.QueryInterface(Ci.nsIXULAppInfo); + } catch (ex if ex instanceof Components.Exception && + ex.result == Cr.NS_NOINTERFACE) { + // Not all applications implement nsIXULAppInfo (e.g. xpcshell doesn't). + } + return appinfo; }); XPCOMUtils.defineLazyGetter(this, "gABI", function bls_gABI() { @@ -396,6 +407,10 @@ Blocklist.prototype = { if (!gBlocklistEnabled) return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; + // Not all applications implement nsIXULAppInfo (e.g. xpcshell doesn't). + if (!appVersion && !gApp.version) + return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; + if (!appVersion) appVersion = gApp.version; if (!toolkitVersion) @@ -529,9 +544,13 @@ Blocklist.prototype = { pingCountTotal = 1; dsURI = dsURI.replace(/%APP_ID%/g, gApp.ID); - dsURI = dsURI.replace(/%APP_VERSION%/g, gApp.version); + // Not all applications implement nsIXULAppInfo (e.g. xpcshell doesn't). + if (gApp.version) + dsURI = dsURI.replace(/%APP_VERSION%/g, gApp.version); dsURI = dsURI.replace(/%PRODUCT%/g, gApp.name); - dsURI = dsURI.replace(/%VERSION%/g, gApp.version); + // Not all applications implement nsIXULAppInfo (e.g. xpcshell doesn't). + if (gApp.version) + dsURI = dsURI.replace(/%VERSION%/g, gApp.version); dsURI = dsURI.replace(/%BUILD_ID%/g, gApp.appBuildID); dsURI = dsURI.replace(/%BUILD_TARGET%/g, gApp.OS + "_" + gABI); dsURI = dsURI.replace(/%OS_VERSION%/g, gOSVersion); @@ -1048,6 +1067,10 @@ Blocklist.prototype = { if (!gBlocklistEnabled) return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; + // Not all applications implement nsIXULAppInfo (e.g. xpcshell doesn't). + if (!appVersion && !gApp.version) + return Ci.nsIBlocklistService.STATE_NOT_BLOCKED; + if (!appVersion) appVersion = gApp.version; if (!toolkitVersion) From 8e87a2bd3327e3a1e0e0523b3affe59eb691bddf Mon Sep 17 00:00:00 2001 From: David Anderson Date: Tue, 24 Feb 2015 14:16:27 -0800 Subject: [PATCH 41/68] Fix build bustage on CLOSED TREE. No bug --- gfx/2d/DrawTargetCG.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gfx/2d/DrawTargetCG.cpp b/gfx/2d/DrawTargetCG.cpp index 238b8727725..7c9fe38f42d 100644 --- a/gfx/2d/DrawTargetCG.cpp +++ b/gfx/2d/DrawTargetCG.cpp @@ -1695,8 +1695,8 @@ DrawTargetCG::Init(BackendType aType, // with zero area drawtargets if (aSize.width <= 0 || aSize.height <= 0 || - aSize.width > GetMaxSurfaceSize() || - aSize.height > GetMaxSurfaceSize()) + size_t(aSize.width) > GetMaxSurfaceSize() || + size_t(aSize.height) > GetMaxSurfaceSize()) { gfxWarning() << "Failed to Init() DrawTargetCG because of bad size."; mColorSpace = nullptr; From e1f2c0e6ed1a24286ed92e67c56bb7baaf977e71 Mon Sep 17 00:00:00 2001 From: Jeff Gilbert Date: Tue, 24 Feb 2015 14:09:09 -0800 Subject: [PATCH 42/68] Bug 1130616 - Support EXT_color_buffer_half_float on ANGLE. - r=jrmuizel,khuey --- dom/canvas/WebGLContext.cpp | 7 + dom/canvas/WebGLContext.h | 6 +- .../WebGLContextFramebufferOperations.cpp | 26 +- dom/canvas/WebGLContextGL.cpp | 223 +++++--- dom/canvas/WebGLContextState.cpp | 20 + .../WebGLExtensionColorBufferHalfFloat.cpp | 3 +- dom/canvas/WebGLFramebuffer.cpp | 2 + dom/canvas/WebGLTexelConversions.h | 2 +- dom/canvas/test/webgl-mochitest.ini | 2 + .../test_webgl_color_buffer_float.html | 486 ++++++++++++++++++ dom/webidl/WebGLRenderingContext.webidl | 4 +- gfx/angle/src/libGLESv2/libGLESv2.cpp | 2 +- gfx/gl/GLContext.h | 4 +- gfx/gl/GLContextSymbols.h | 4 +- 14 files changed, 700 insertions(+), 91 deletions(-) create mode 100644 dom/canvas/test/webgl-mochitest/test_webgl_color_buffer_float.html diff --git a/dom/canvas/WebGLContext.cpp b/dom/canvas/WebGLContext.cpp index 1c22c27092f..549c63e6c3f 100644 --- a/dom/canvas/WebGLContext.cpp +++ b/dom/canvas/WebGLContext.cpp @@ -1852,6 +1852,12 @@ WebGLContext::TexImageFromVideoElement(const TexImageTarget texImageTarget, return ok; } +size_t mozilla::RoundUpToMultipleOf(size_t value, size_t multiple) +{ + size_t overshoot = value + multiple - 1; + return overshoot - (overshoot % multiple); +} + //////////////////////////////////////////////////////////////////////////////// WebGLContext::ScopedMaskWorkaround::ScopedMaskWorkaround(WebGLContext& webgl) @@ -1875,6 +1881,7 @@ WebGLContext::ScopedMaskWorkaround::~ScopedMaskWorkaround() mWebGL.mColorWriteMask[3]); } } + //////////////////////////////////////////////////////////////////////////////// // XPCOM goop diff --git a/dom/canvas/WebGLContext.h b/dom/canvas/WebGLContext.h index 4a8d9ed3538..e1ccceb8fc3 100644 --- a/dom/canvas/WebGLContext.h +++ b/dom/canvas/WebGLContext.h @@ -1092,9 +1092,7 @@ protected: GLenum pname); // Returns x rounded to the next highest multiple of y. - static CheckedUint32 RoundedToNextMultipleOf(CheckedUint32 x, - CheckedUint32 y) - { + static CheckedUint32 RoundedToNextMultipleOf(CheckedUint32 x, CheckedUint32 y) { return ((x + y - 1) / y) * y; } @@ -1693,6 +1691,8 @@ private: WebGLContext* mWebGL; }; +size_t RoundUpToMultipleOf(size_t value, size_t multiple); + } // namespace mozilla #endif diff --git a/dom/canvas/WebGLContextFramebufferOperations.cpp b/dom/canvas/WebGLContextFramebufferOperations.cpp index 96e0ea026fb..4cab00836f4 100644 --- a/dom/canvas/WebGLContextFramebufferOperations.cpp +++ b/dom/canvas/WebGLContextFramebufferOperations.cpp @@ -49,8 +49,8 @@ WebGLContext::Clear(GLbitfield mask) mShouldPresent = true; } -static GLclampf -GLClampFloat(GLclampf val) +static GLfloat +GLClampFloat(GLfloat val) { if (val < 0.0) return 0.0; @@ -62,18 +62,28 @@ GLClampFloat(GLclampf val) } void -WebGLContext::ClearColor(GLclampf r, GLclampf g, - GLclampf b, GLclampf a) +WebGLContext::ClearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) { if (IsContextLost()) return; MakeContextCurrent(); - mColorClearValue[0] = GLClampFloat(r); - mColorClearValue[1] = GLClampFloat(g); - mColorClearValue[2] = GLClampFloat(b); - mColorClearValue[3] = GLClampFloat(a); + + const bool supportsFloatColorBuffers = (IsExtensionEnabled(WebGLExtensionID::EXT_color_buffer_half_float) || + IsExtensionEnabled(WebGLExtensionID::WEBGL_color_buffer_float)); + if (!supportsFloatColorBuffers) { + r = GLClampFloat(r); + g = GLClampFloat(g); + b = GLClampFloat(b); + a = GLClampFloat(a); + } + gl->fClearColor(r, g, b, a); + + mColorClearValue[0] = r; + mColorClearValue[1] = g; + mColorClearValue[2] = b; + mColorClearValue[3] = a; } void diff --git a/dom/canvas/WebGLContextGL.cpp b/dom/canvas/WebGLContextGL.cpp index 7254d1bfe9a..956963771cb 100644 --- a/dom/canvas/WebGLContextGL.cpp +++ b/dom/canvas/WebGLContextGL.cpp @@ -1863,6 +1863,84 @@ SetFullAlpha(void* data, GLenum format, GLenum type, size_t width, return false; } +static void +ReadPixelsAndConvert(gl::GLContext* gl, GLint x, GLint y, GLsizei width, GLsizei height, + GLenum readFormat, GLenum readType, size_t pixelStorePackAlignment, + GLenum destFormat, GLenum destType, void* destBytes) +{ + if (readFormat == destFormat && readType == destType) { + gl->fReadPixels(x, y, width, height, destFormat, destType, destBytes); + return; + } + + if (readFormat == LOCAL_GL_RGBA && + readType == LOCAL_GL_HALF_FLOAT && + destFormat == LOCAL_GL_RGBA && + destType == LOCAL_GL_FLOAT) + { + size_t readBytesPerPixel = sizeof(uint16_t) * 4; + size_t destBytesPerPixel = sizeof(float) * 4; + + size_t readBytesPerRow = readBytesPerPixel * width; + + size_t readStride = RoundUpToMultipleOf(readBytesPerRow, pixelStorePackAlignment); + size_t destStride = RoundUpToMultipleOf(destBytesPerPixel * width, + pixelStorePackAlignment); + + size_t bytesNeeded = ((height - 1) * readStride) + readBytesPerRow; + UniquePtr readBuffer(new uint8_t[bytesNeeded]); + + gl->fReadPixels(x, y, width, height, readFormat, readType, readBuffer.get()); + + size_t channelsPerRow = width * 4; + for (size_t j = 0; j < (size_t)height; j++) { + uint16_t* src = (uint16_t*)(readBuffer.get()) + j*readStride; + float* dst = (float*)(destBytes) + j*destStride; + + uint16_t* srcEnd = src + channelsPerRow; + while (src != srcEnd) { + *dst = unpackFromFloat16(*src); + + ++src; + ++dst; + } + } + + return; + } + + MOZ_CRASH("bad format/type"); +} + +static bool +IsFormatAndTypeUnpackable(GLenum format, GLenum type) +{ + switch (type) { + case LOCAL_GL_UNSIGNED_BYTE: + case LOCAL_GL_FLOAT: + case LOCAL_GL_HALF_FLOAT: + case LOCAL_GL_HALF_FLOAT_OES: + switch (format) { + case LOCAL_GL_ALPHA: + case LOCAL_GL_RGB: + case LOCAL_GL_RGBA: + return true; + default: + return false; + } + + case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4: + case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1: + return format == LOCAL_GL_RGBA; + + case LOCAL_GL_UNSIGNED_SHORT_5_6_5: + return format == LOCAL_GL_RGB; + + default: + return false; + } +} + void WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, @@ -1883,59 +1961,61 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width, if (pixels.IsNull()) return ErrorInvalidValue("readPixels: null destination buffer"); + if (!IsFormatAndTypeUnpackable(format, type)) + return ErrorInvalidEnum("readPixels: Bad format or type."); + const WebGLRectangleObject* framebufferRect = CurValidReadFBRectObject(); GLsizei framebufferWidth = framebufferRect ? framebufferRect->Width() : 0; GLsizei framebufferHeight = framebufferRect ? framebufferRect->Height() : 0; - uint32_t channels = 0; + int channels = 0; // Check the format param switch (format) { - case LOCAL_GL_ALPHA: - channels = 1; - break; - case LOCAL_GL_RGB: - channels = 3; - break; - case LOCAL_GL_RGBA: - channels = 4; - break; - default: - return ErrorInvalidEnum("readPixels: Bad format"); + case LOCAL_GL_ALPHA: + channels = 1; + break; + case LOCAL_GL_RGB: + channels = 3; + break; + case LOCAL_GL_RGBA: + channels = 4; + break; + default: + MOZ_CRASH("bad `format`"); } - uint32_t bytesPerPixel = 0; - int requiredDataType = 0; // Check the type param - bool isReadTypeValid = false; - bool isReadTypeFloat = false; + int bytesPerPixel; + int requiredDataType; switch (type) { - case LOCAL_GL_UNSIGNED_BYTE: - isReadTypeValid = true; - bytesPerPixel = 1*channels; - requiredDataType = js::Scalar::Uint8; - break; - case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4: - case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1: - case LOCAL_GL_UNSIGNED_SHORT_5_6_5: - isReadTypeValid = true; - bytesPerPixel = 2; - requiredDataType = js::Scalar::Uint16; - break; - case LOCAL_GL_FLOAT: - if (IsExtensionEnabled(WebGLExtensionID::WEBGL_color_buffer_float) || - IsExtensionEnabled(WebGLExtensionID::EXT_color_buffer_half_float)) - { - isReadTypeValid = true; - isReadTypeFloat = true; - bytesPerPixel = 4*channels; - requiredDataType = js::Scalar::Float32; - } - break; + case LOCAL_GL_UNSIGNED_BYTE: + bytesPerPixel = 1*channels; + requiredDataType = js::Scalar::Uint8; + break; + + case LOCAL_GL_UNSIGNED_SHORT_4_4_4_4: + case LOCAL_GL_UNSIGNED_SHORT_5_5_5_1: + case LOCAL_GL_UNSIGNED_SHORT_5_6_5: + bytesPerPixel = 2; + requiredDataType = js::Scalar::Uint16; + break; + + case LOCAL_GL_FLOAT: + bytesPerPixel = 4*channels; + requiredDataType = js::Scalar::Float32; + break; + + case LOCAL_GL_HALF_FLOAT: + case LOCAL_GL_HALF_FLOAT_OES: + bytesPerPixel = 2*channels; + requiredDataType = js::Scalar::Uint16; + break; + + default: + MOZ_CRASH("bad `type`"); } - if (!isReadTypeValid) - return ErrorInvalidEnum("readPixels: Bad type", type); const ArrayBufferView& pixbuf = pixels.Value(); int dataType = JS_GetArrayBufferViewType(pixbuf.Obj()); @@ -1988,43 +2068,38 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width, isSourceTypeFloat = false; } - if (isReadTypeFloat != isSourceTypeFloat) - return ErrorInvalidOperation("readPixels: Invalid type floatness"); - // Check the format and type params to assure they are an acceptable pair (as per spec) - bool isFormatAndTypeValid = false; + const GLenum mainReadFormat = LOCAL_GL_RGBA; + const GLenum mainReadType = isSourceTypeFloat ? LOCAL_GL_FLOAT + : LOCAL_GL_UNSIGNED_BYTE; + + GLenum auxReadFormat = mainReadFormat; + GLenum auxReadType = mainReadType; // OpenGL ES 2.0 $4.3.1 - IMPLEMENTATION_COLOR_READ_{TYPE/FORMAT} is a valid // combination for glReadPixels(). if (gl->IsSupported(gl::GLFeature::ES2_compatibility)) { - GLenum implType = 0; - GLenum implFormat = 0; - - gl->fGetIntegerv(LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE, - reinterpret_cast(&implType)); gl->fGetIntegerv(LOCAL_GL_IMPLEMENTATION_COLOR_READ_FORMAT, - reinterpret_cast(&implFormat)); - - if (type == implType && format == implFormat) { - isFormatAndTypeValid = true; - } + reinterpret_cast(&auxReadFormat)); + gl->fGetIntegerv(LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE, + reinterpret_cast(&auxReadType)); } - switch (format) { - case LOCAL_GL_RGBA: { - switch (type) { - case LOCAL_GL_UNSIGNED_BYTE: - case LOCAL_GL_FLOAT: - isFormatAndTypeValid = true; - break; - } - break; - } - } - - if (!isFormatAndTypeValid) { + const bool mainMatches = (format == mainReadFormat && type == mainReadType); + const bool auxMatches = (format == auxReadFormat && type == auxReadType); + const bool isValid = mainMatches || auxMatches; + if (!isValid) return ErrorInvalidOperation("readPixels: Invalid format/type pair"); + + GLenum readType = type; + if (gl->WorkAroundDriverBugs() && gl->IsANGLE()) { + if (type == LOCAL_GL_FLOAT && + auxReadFormat == format && + auxReadType == LOCAL_GL_HALF_FLOAT) + { + readType = auxReadType; + } } // Now that the errors are out of the way, on to actually reading @@ -2035,7 +2110,10 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width, if (CanvasUtils::CheckSaneSubrectSize(x, y, width, height, framebufferWidth, framebufferHeight)) { // the easy case: we're not reading out-of-range pixels - gl->fReadPixels(x, y, width, height, format, type, data); + + // Effectively: gl->fReadPixels(x, y, width, height, format, type, dest); + ReadPixelsAndConvert(gl, x, y, width, height, format, readType, + mPixelStorePackAlignment, format, type, data); } else { // the rectangle doesn't fit entirely in the bound buffer. We then have to set to zero the part // of the buffer that correspond to out-of-range pixels. We don't want to rely on system OpenGL @@ -2084,8 +2162,11 @@ WebGLContext::ReadPixels(GLint x, GLint y, GLsizei width, if (!subrect_data) return ErrorOutOfMemory("readPixels: subrect_data"); - gl->fReadPixels(subrect_x, subrect_y, subrect_width, subrect_height, - format, type, subrect_data.get()); + // Effectively: gl->fReadPixels(subrect_x, subrect_y, subrect_width, + // subrect_height, format, type, subrect_data.get()); + ReadPixelsAndConvert(gl, subrect_x, subrect_y, subrect_width, subrect_height, + format, readType, mPixelStorePackAlignment, format, type, + subrect_data.get()); // notice that this for loop terminates because we already checked that subrect_height is at most height for (GLint y_inside_subrect = 0; y_inside_subrect < subrect_height; ++y_inside_subrect) { @@ -3597,7 +3678,7 @@ mozilla::GetWebGLTexelFormat(TexInternalFormat effectiveInternalFormat) } void -WebGLContext::BlendColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a) { +WebGLContext::BlendColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) { if (IsContextLost()) return; MakeContextCurrent(); diff --git a/dom/canvas/WebGLContextState.cpp b/dom/canvas/WebGLContextState.cpp index fe7f0783f8c..7ea1cff58ba 100644 --- a/dom/canvas/WebGLContextState.cpp +++ b/dom/canvas/WebGLContextState.cpp @@ -266,6 +266,16 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv) return JS::NumberValue(uint32_t(i)); } case LOCAL_GL_IMPLEMENTATION_COLOR_READ_TYPE: { + if (mBoundReadFramebuffer) { + FBStatus status = mBoundReadFramebuffer->CheckFramebufferStatus(); + if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) { + ErrorInvalidOperation("getParameter: Read framebuffer must be" + " complete before querying" + " IMPLEMENTATION_COLOR_READ_TYPE."); + return JS::NullValue(); + } + } + GLint i = 0; if (gl->IsSupported(gl::GLFeature::ES2_compatibility)) { gl->fGetIntegerv(pname, &i); @@ -275,6 +285,16 @@ WebGLContext::GetParameter(JSContext* cx, GLenum pname, ErrorResult& rv) return JS::NumberValue(uint32_t(i)); } case LOCAL_GL_IMPLEMENTATION_COLOR_READ_FORMAT: { + if (mBoundReadFramebuffer) { + FBStatus status = mBoundReadFramebuffer->CheckFramebufferStatus(); + if (status != LOCAL_GL_FRAMEBUFFER_COMPLETE) { + ErrorInvalidOperation("getParameter: Read framebuffer must be" + " complete before querying" + " IMPLEMENTATION_COLOR_READ_FORMAT."); + return JS::NullValue(); + } + } + GLint i = 0; if (gl->IsSupported(gl::GLFeature::ES2_compatibility)) { gl->fGetIntegerv(pname, &i); diff --git a/dom/canvas/WebGLExtensionColorBufferHalfFloat.cpp b/dom/canvas/WebGLExtensionColorBufferHalfFloat.cpp index 51329c37dce..7148ef4290d 100644 --- a/dom/canvas/WebGLExtensionColorBufferHalfFloat.cpp +++ b/dom/canvas/WebGLExtensionColorBufferHalfFloat.cpp @@ -26,7 +26,8 @@ WebGLExtensionColorBufferHalfFloat::IsSupported(const WebGLContext* webgl) gl::GLContext* gl = webgl->GL(); // ANGLE doesn't support ReadPixels from a RGBA16F with RGBA/FLOAT. - return gl->IsSupported(gl::GLFeature::renderbuffer_color_half_float); + return gl->IsSupported(gl::GLFeature::renderbuffer_color_half_float) || + gl->IsANGLE(); } IMPL_WEBGL_EXTENSION_GOOP(WebGLExtensionColorBufferHalfFloat) diff --git a/dom/canvas/WebGLFramebuffer.cpp b/dom/canvas/WebGLFramebuffer.cpp index eef55251f2e..35551743423 100644 --- a/dom/canvas/WebGLFramebuffer.cpp +++ b/dom/canvas/WebGLFramebuffer.cpp @@ -129,6 +129,7 @@ WebGLFramebuffer::Attachment::IsReadableFloat() const MOZ_ASSERT(internalformat != LOCAL_GL_NONE); TexType type = TypeFromInternalFormat(internalformat); return type == LOCAL_GL_FLOAT || + type == LOCAL_GL_HALF_FLOAT_OES || type == LOCAL_GL_HALF_FLOAT; } @@ -803,6 +804,7 @@ WebGLFramebuffer::CheckFramebufferStatus() const // Ok, attach our chosen flavor of {DEPTH, STENCIL, DEPTH_STENCIL}. FinalizeAttachments(); + // TODO: This should not be unconditionally GL_FRAMEBUFFER. mStatus = mContext->gl->fCheckFramebufferStatus(LOCAL_GL_FRAMEBUFFER); return mStatus; } diff --git a/dom/canvas/WebGLTexelConversions.h b/dom/canvas/WebGLTexelConversions.h index 813b1e8c0b7..269d405e7a6 100644 --- a/dom/canvas/WebGLTexelConversions.h +++ b/dom/canvas/WebGLTexelConversions.h @@ -105,7 +105,7 @@ unpackFromFloat16(uint16_t v) uint16_t exp = (v >> 10) & 0x001F; uint16_t mantissa = v & 0x03FF; - if (exp) { + if (!exp) { // Handle denormalized numbers // Adapted from: OpenGL ES 2.0 Programming Guide Appx. // Converting Float to Half-Float diff --git a/dom/canvas/test/webgl-mochitest.ini b/dom/canvas/test/webgl-mochitest.ini index 14c35d96e44..1e0a0bf9180 100644 --- a/dom/canvas/test/webgl-mochitest.ini +++ b/dom/canvas/test/webgl-mochitest.ini @@ -22,6 +22,8 @@ skip-if = android_version == '10' #Android 2.3 aws only; bug 1030942 [webgl-mochitest/test_texsubimage_float.html] [webgl-mochitest/test_webgl_available.html] skip-if = toolkit == 'android' #bug 865443- seperate suite - the non_conf* tests pass except for one on armv6 tests +#[webgl-mochitest/test_webgl_color_buffer_float.html] +# We haven't cleaned up the Try results yet, but let's get this on the books first. [webgl-mochitest/test_webgl_conformance.html] skip-if = buildapp == 'mulet' || toolkit == 'android' #bug 865443- seperate suite - the non_conf* tests pass except for one on armv6 tests [webgl-mochitest/test_webgl_request_context.html] diff --git a/dom/canvas/test/webgl-mochitest/test_webgl_color_buffer_float.html b/dom/canvas/test/webgl-mochitest/test_webgl_color_buffer_float.html new file mode 100644 index 00000000000..94a75fa9156 --- /dev/null +++ b/dom/canvas/test/webgl-mochitest/test_webgl_color_buffer_float.html @@ -0,0 +1,486 @@ + + + + + + + + + + + + + + + + diff --git a/dom/webidl/WebGLRenderingContext.webidl b/dom/webidl/WebGLRenderingContext.webidl index b5806ae4502..7321528edf5 100644 --- a/dom/webidl/WebGLRenderingContext.webidl +++ b/dom/webidl/WebGLRenderingContext.webidl @@ -520,7 +520,7 @@ interface WebGLRenderingContext { void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer); void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer); void bindTexture(GLenum target, WebGLTexture? texture); - void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void blendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); void blendEquation(GLenum mode); void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); void blendFunc(GLenum sfactor, GLenum dfactor); @@ -535,7 +535,7 @@ interface WebGLRenderingContext { [WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target); void clear(GLbitfield mask); - void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + void clearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); void clearDepth(GLclampf depth); void clearStencil(GLint s); void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); diff --git a/gfx/angle/src/libGLESv2/libGLESv2.cpp b/gfx/angle/src/libGLESv2/libGLESv2.cpp index bc1b5896b73..fbef5612f8d 100644 --- a/gfx/angle/src/libGLESv2/libGLESv2.cpp +++ b/gfx/angle/src/libGLESv2/libGLESv2.cpp @@ -295,7 +295,7 @@ void GL_APIENTRY glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLcla if (context) { - context->getState().setBlendColor(gl::clamp01(red), gl::clamp01(green), gl::clamp01(blue), gl::clamp01(alpha)); + context->getState().setBlendColor(red, green, blue, alpha); } } diff --git a/gfx/gl/GLContext.h b/gfx/gl/GLContext.h index 05406c9f8ed..31b9e64a892 100644 --- a/gfx/gl/GLContext.h +++ b/gfx/gl/GLContext.h @@ -886,7 +886,7 @@ public: AFTER_GL_CALL; } - void fBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { + void fBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { BEFORE_GL_CALL; mSymbols.fBlendColor(red, green, blue, alpha); AFTER_GL_CALL; @@ -986,7 +986,7 @@ public: AFTER_GL_CALL; } - void fClearColor(GLclampf r, GLclampf g, GLclampf b, GLclampf a) { + void fClearColor(GLfloat r, GLfloat g, GLfloat b, GLfloat a) { BEFORE_GL_CALL; mSymbols.fClearColor(r, g, b, a); AFTER_GL_CALL; diff --git a/gfx/gl/GLContextSymbols.h b/gfx/gl/GLContextSymbols.h index 91ff5ac71dc..c5bda3d4dda 100644 --- a/gfx/gl/GLContextSymbols.h +++ b/gfx/gl/GLContextSymbols.h @@ -49,7 +49,7 @@ struct GLContextSymbols PFNGLBINDTEXTUREPROC fBindTexture; typedef void (GLAPIENTRY * PFNGLBINDVERTEXARRAYPROC) (GLuint array); PFNGLBINDVERTEXARRAYPROC fBindVertexArray; - typedef void (GLAPIENTRY * PFNGLBLENDCOLORPROC) (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); + typedef void (GLAPIENTRY * PFNGLBLENDCOLORPROC) (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); PFNGLBLENDCOLORPROC fBlendColor; typedef void (GLAPIENTRY * PFNGLBLENDEQUATIONPROC) (GLenum mode); PFNGLBLENDEQUATIONPROC fBlendEquation; @@ -73,7 +73,7 @@ struct GLContextSymbols PFNGLCLEARBUFFERIVPROC fClearBufferiv; typedef void (GLAPIENTRY * PFNGLCLEARBUFFERUIVPROC) (GLenum buffer, GLint drawbuffer, const GLuint* value); PFNGLCLEARBUFFERUIVPROC fClearBufferuiv; - typedef void (GLAPIENTRY * PFNGLCLEARCOLORPROC) (GLclampf, GLclampf, GLclampf, GLclampf); + typedef void (GLAPIENTRY * PFNGLCLEARCOLORPROC) (GLfloat, GLfloat, GLfloat, GLfloat); PFNGLCLEARCOLORPROC fClearColor; typedef void (GLAPIENTRY * PFNGLCLEARSTENCILPROC) (GLint); PFNGLCLEARSTENCILPROC fClearStencil; From cf18f3d734f042b1103927f10540aeff4e7e0f2e Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Tue, 24 Feb 2015 09:37:13 -0800 Subject: [PATCH 43/68] Bug 1133909 - Fix hazards revealed by adding in new GCPointers, r=terrence --- js/src/builtin/SymbolObject.cpp | 2 +- js/src/builtin/SymbolObject.h | 2 +- js/src/irregexp/RegExpEngine.cpp | 2 +- js/src/jit/ExecutableAllocator.h | 6 +++++- js/src/jsobj.cpp | 3 ++- 5 files changed, 10 insertions(+), 5 deletions(-) diff --git a/js/src/builtin/SymbolObject.cpp b/js/src/builtin/SymbolObject.cpp index 214ce9fcc9c..14534567cb8 100644 --- a/js/src/builtin/SymbolObject.cpp +++ b/js/src/builtin/SymbolObject.cpp @@ -29,7 +29,7 @@ const Class SymbolObject::class_ = { }; SymbolObject * -SymbolObject::create(JSContext *cx, JS::Symbol *symbol) +SymbolObject::create(JSContext *cx, JS::HandleSymbol symbol) { JSObject *obj = NewBuiltinClassInstance(cx, &class_); if (!obj) diff --git a/js/src/builtin/SymbolObject.h b/js/src/builtin/SymbolObject.h index 080bc4a3936..6ed23e1bb4b 100644 --- a/js/src/builtin/SymbolObject.h +++ b/js/src/builtin/SymbolObject.h @@ -28,7 +28,7 @@ class SymbolObject : public NativeObject * Creates a new Symbol object boxing the given primitive Symbol. The * object's [[Prototype]] is determined from context. */ - static SymbolObject *create(JSContext *cx, JS::Symbol *symbol); + static SymbolObject *create(JSContext *cx, JS::HandleSymbol symbol); JS::Symbol *unbox() const { return getFixedSlot(PRIMITIVE_VALUE_SLOT).toSymbol(); diff --git a/js/src/irregexp/RegExpEngine.cpp b/js/src/irregexp/RegExpEngine.cpp index d23717ae634..7fedae7d864 100644 --- a/js/src/irregexp/RegExpEngine.cpp +++ b/js/src/irregexp/RegExpEngine.cpp @@ -1612,8 +1612,8 @@ RegExpCompiler::Assemble(JSContext *cx, return RegExpCode(); if (reg_exp_too_big_) { - JS_ReportError(cx, "regexp too big"); code.destroy(); + JS_ReportError(cx, "regexp too big"); return RegExpCode(); } diff --git a/js/src/jit/ExecutableAllocator.h b/js/src/jit/ExecutableAllocator.h index 2024e4b5ed0..cfba195c13a 100644 --- a/js/src/jit/ExecutableAllocator.h +++ b/js/src/jit/ExecutableAllocator.h @@ -35,6 +35,7 @@ #include "jit/mips/Simulator-mips.h" #include "js/HashTable.h" #include "js/Vector.h" +#include "js/GCAPI.h" #ifdef JS_CPU_SPARC #ifdef __linux__ // bugzilla 502369 @@ -250,8 +251,11 @@ class ExecutableAllocator { void releasePoolPages(ExecutablePool *pool) { MOZ_ASSERT(pool->m_allocation.pages); - if (destroyCallback) + if (destroyCallback) { + // Do not allow GC during the page release callback. + JS::AutoSuppressGCAnalysis nogc; destroyCallback(pool->m_allocation.pages, pool->m_allocation.size); + } systemRelease(pool->m_allocation); MOZ_ASSERT(m_pools.initialized()); m_pools.remove(m_pools.lookup(pool)); // this asserts if |pool| is not in m_pools diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 447daa86ef5..ef85419deae 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -3614,7 +3614,8 @@ js::PrimitiveToObject(JSContext *cx, const Value &v) if (v.isBoolean()) return BooleanObject::create(cx, v.toBoolean()); MOZ_ASSERT(v.isSymbol()); - return SymbolObject::create(cx, v.toSymbol()); + RootedSymbol symbol(cx, v.toSymbol()); + return SymbolObject::create(cx, symbol); } /* From 57bd8eeebb07e370ce6fec2a6b53b130f0c98e5c Mon Sep 17 00:00:00 2001 From: Brad Lassey Date: Mon, 23 Feb 2015 11:39:05 -0500 Subject: [PATCH 44/68] bug 1071880 - Notify user of addons that are slowing their browser down significantly r=mossop --- browser/components/nsBrowserGlue.js | 76 +++++++++++++++ .../en-US/chrome/browser/browser.properties | 11 +++ modules/libpref/init/all.js | 10 ++ toolkit/modules/AddonWatcher.jsm | 96 +++++++++++++++++++ toolkit/modules/moz.build | 1 + 5 files changed, 194 insertions(+) create mode 100644 toolkit/modules/AddonWatcher.jsm diff --git a/browser/components/nsBrowserGlue.js b/browser/components/nsBrowserGlue.js index 99027513b91..f0cfaeff2be 100644 --- a/browser/components/nsBrowserGlue.js +++ b/browser/components/nsBrowserGlue.js @@ -148,6 +148,9 @@ XPCOMUtils.defineLazyModuleGetter(this, "WebChannel", XPCOMUtils.defineLazyModuleGetter(this, "ReaderParent", "resource:///modules/ReaderParent.jsm"); +XPCOMUtils.defineLazyModuleGetter(this, "AddonWatcher", + "resource://gre/modules/AddonWatcher.jsm"); + const PREF_PLUGINS_NOTIFYUSER = "plugins.update.notifyUser"; const PREF_PLUGINS_UPDATEURL = "plugins.update.url"; @@ -587,6 +590,76 @@ BrowserGlue.prototype = { this._distributionCustomizer.applyPrefDefaults(); }, + _notifySlowAddon: function BG_notifySlowAddon(addonId) { + let addonCallback = function(addon) { + if (!addon) { + Cu.reportError("couldn't look up addon: " + addonId); + return; + } + let win = RecentWindow.getMostRecentBrowserWindow(); + + if (!win) { + return; + } + + let brandBundle = win.document.getElementById("bundle_brand"); + let brandShortName = brandBundle.getString("brandShortName"); + let message = win.gNavigatorBundle.getFormattedString("addonwatch.slow", [addon.name, brandShortName]); + let notificationBox = win.document.getElementById("global-notificationbox"); + let notificationId = 'addon-slow:' + addonId; + let notification = notificationBox.getNotificationWithValue(notificationId); + if(notification) { + notification.label = message; + } else { + let buttons = [ + { + label: win.gNavigatorBundle.getFormattedString("addonwatch.disable.label", [addon.name]), + accessKey: win.gNavigatorBundle.getString("addonwatch.disable.accesskey"), + callback: function() { + addon.userDisabled = true; + if (addon.pendingOperations != addon.PENDING_NONE) { + let restartMessage = win.gNavigatorBundle.getFormattedString("addonwatch.restart.message", [addon.name, brandShortName]); + let restartButton = [ + { + label: win.gNavigatorBundle.getFormattedString("addonwatch.restart.label", [brandShortName]), + accessKey: win.gNavigatorBundle.getString("addonwatch.restart.accesskey"), + callback: function() { + let appStartup = Cc["@mozilla.org/toolkit/app-startup;1"] + .getService(Ci.nsIAppStartup); + appStartup.quit(appStartup.eForceQuit | appStartup.eRestart); + } + } + ]; + const priority = notificationBox.PRIORITY_WARNING_MEDIUM; + notificationBox.appendNotification(restartMessage, "restart-" + addonId, "", + priority, restartButton); + } + } + }, + { + label: win.gNavigatorBundle.getString("addonwatch.ignoreSession.label"), + accessKey: win.gNavigatorBundle.getString("addonwatch.ignoreSession.accesskey"), + callback: function() { + AddonWatcher.ignoreAddonForSession(addonId); + } + }, + { + label: win.gNavigatorBundle.getString("addonwatch.ignorePerm.label"), + accessKey: win.gNavigatorBundle.getString("addonwatch.ignorePerm.accesskey"), + callback: function() { + AddonWatcher.ignoreAddonPermanently(addonId); + } + }, + ]; + + const priority = notificationBox.PRIORITY_WARNING_MEDIUM; + notificationBox.appendNotification(message, notificationId, "", + priority, buttons); + } + }; + AddonManager.getAddonByID(addonId, addonCallback); + }, + // runs on startup, before the first command line handler is invoked // (i.e. before the first window is opened) _finalUIStartup: function BG__finalUIStartup() { @@ -642,6 +715,8 @@ BrowserGlue.prototype = { #endif Services.obs.notifyObservers(null, "browser-ui-startup-complete", ""); + + AddonWatcher.init(this._notifySlowAddon); }, _checkForOldBuildUpdates: function () { @@ -907,6 +982,7 @@ BrowserGlue.prototype = { #endif webrtcUI.uninit(); FormValidationHandler.uninit(); + AddonWatcher.uninit(); }, _initServiceDiscovery: function () { diff --git a/browser/locales/en-US/chrome/browser/browser.properties b/browser/locales/en-US/chrome/browser/browser.properties index f3cde721cee..d940a3e9daf 100644 --- a/browser/locales/en-US/chrome/browser/browser.properties +++ b/browser/locales/en-US/chrome/browser/browser.properties @@ -40,6 +40,17 @@ addonDownloadRestart=Restart Download;Restart Downloads addonDownloadRestart.accessKey=R addonDownloadCancelTooltip=Cancel +addonwatch.slow=%1$S might be making %2$S run slowly +addonwatch.disable.label=Disable %S +addonwatch.disable.accesskey=D +addonwatch.ignoreSession.label=Ignore for now +addonwatch.ignoreSession.accesskey=I +addonwatch.ignorePerm.label=Ignore permanently +addonwatch.ignorePerm.accesskey=p +addonwatch.restart.message=To disable %1$S you must restart %2$S +addonwatch.restart.label=Restart %S +addonwatch.restart.accesskey=R + # LOCALIZATION NOTE (addonsInstalled, addonsInstalledNeedsRestart): # Semicolon-separated list of plural forms. See: # http://developer.mozilla.org/en/docs/Localization_and_Plurals diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 0f47f36b1ce..e3312fdd1a4 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -4477,6 +4477,16 @@ pref("dom.mozSettings.SettingsService.verbose.enabled", false); // readwrite. pref("dom.mozSettings.allowForceReadOnly", false); +// The interval at which to check for slow running addons +#ifdef NIGHTLY_BUILD +pref("browser.addon-watch.interval", 15000); +#else +pref("browser.addon-watch.interval", -1); +#endif +pref("browser.addon-watch.ignore", "[\"mochikit@mozilla.org\",\"special-powers@mozilla.org\"]"); +// the percentage of time addons are allowed to use without being labeled slow +pref("browser.addon-watch.percentage-limit", 5); + // RequestSync API is disabled by default. pref("dom.requestSync.enabled", false); diff --git a/toolkit/modules/AddonWatcher.jsm b/toolkit/modules/AddonWatcher.jsm new file mode 100644 index 00000000000..d85016db596 --- /dev/null +++ b/toolkit/modules/AddonWatcher.jsm @@ -0,0 +1,96 @@ +// -*- indent-tabs-mode: nil; js-indent-level: 2 -*- +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this file, + * You can obtain one at http://mozilla.org/MPL/2.0/. */ + +"use strict"; + +this.EXPORTED_SYMBOLS = ["AddonWatcher"]; + +const { classes: Cc, interfaces: Ci, utils: Cu } = Components; + +Cu.import("resource://gre/modules/XPCOMUtils.jsm"); + +XPCOMUtils.defineLazyModuleGetter(this, "Preferences", + "resource://gre/modules/Preferences.jsm"); + +let AddonWatcher = { + _lastAddonTime: {}, + _timer: Cc["@mozilla.org/timer;1"].createInstance(Ci.nsITimer), + _callback: null, + _interval: 1500, + _ignoreList: null, + init: function(callback) { + if (!callback) { + return; + } + + if (this._callback) { + return; + } + + this._interval = Preferences.get("browser.addon-watch.interval", 15000); + if (this._interval == -1) { + return; + } + + this._callback = callback; + try { + this._ignoreList = new Set(JSON.parse(Preferences.get("browser.addon-watch.ignore", null))); + } catch (ex) { + // probably some malformed JSON, ignore and carry on + this._ignoreList = new Set(); + } + this._timer.initWithCallback(this._checkAddons.bind(this), this._interval, Ci.nsITimer.TYPE_REPEATING_SLACK); + }, + uninit: function() { + if (this._timer) { + this._timer.cancel(); + this._timer = null; + } + }, + _checkAddons: function() { + let compartmentInfo = Cc["@mozilla.org/compartment-info;1"] + .getService(Ci.nsICompartmentInfo); + let compartments = compartmentInfo.getCompartments(); + let count = compartments.length; + let addons = {}; + for (let i = 0; i < count; i++) { + let compartment = compartments.queryElementAt(i, Ci.nsICompartment); + if (compartment.addonId) { + if (addons[compartment.addonId]) { + addons[compartment.addonId] += compartment.time; + } else { + addons[compartment.addonId] = compartment.time; + } + } + } + let limit = this._interval * Preferences.get("browser.addon-watch.percentage-limit", 75) * 10; + for (let addonId in addons) { + if (!this._ignoreList.has(addonId)) { + if (!this._lastAddonTime[addonId]) { + this._lastAddonTime[addonId] = 0; + } + if ((addons[addonId] - this._lastAddonTime[addonId]) > limit) { + this._callback(addonId); + } + this._lastAddonTime[addonId] = addons[addonId]; + } + } + }, + ignoreAddonForSession: function(addonid) { + this._ignoreList.add(addonid); + }, + ignoreAddonPermanently: function(addonid) { + this._ignoreList.add(addonid); + try { + let ignoreList = JSON.parse(Preferences.get("browser.addon-watch.ignore", "[]")) + if (!ignoreList.includes(addonid)) { + ignoreList.push(addonid); + Preferences.set("browser.addon-watch.ignore", JSON.stringify(ignoreList)); + } + } catch (ex) { + Preferences.set("browser.addon-watch.ignore", JSON.stringify([addonid])); + } + } +}; diff --git a/toolkit/modules/moz.build b/toolkit/modules/moz.build index 584778a7ccb..b6185800622 100644 --- a/toolkit/modules/moz.build +++ b/toolkit/modules/moz.build @@ -12,6 +12,7 @@ MOCHITEST_CHROME_MANIFESTS += ['tests/chrome/chrome.ini'] SPHINX_TREES['toolkit_modules'] = 'docs' EXTRA_JS_MODULES += [ + 'AddonWatcher.jsm', 'Battery.jsm', 'BinarySearch.jsm', 'BrowserUtils.jsm', From f7ec1edfe04ea1f3f99e4e7fa0b890f0e0bcd8a1 Mon Sep 17 00:00:00 2001 From: Steve Fink Date: Tue, 24 Feb 2015 15:09:46 -0800 Subject: [PATCH 45/68] Bug 1133909 check-style bustage resulting in a CLOSED TREE - alphabetize the includes, a=KWierso --- js/src/jit/ExecutableAllocator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/js/src/jit/ExecutableAllocator.h b/js/src/jit/ExecutableAllocator.h index cfba195c13a..779c7f523f5 100644 --- a/js/src/jit/ExecutableAllocator.h +++ b/js/src/jit/ExecutableAllocator.h @@ -33,9 +33,9 @@ #include "jit/arm/Simulator-arm.h" #include "jit/mips/Simulator-mips.h" +#include "js/GCAPI.h" #include "js/HashTable.h" #include "js/Vector.h" -#include "js/GCAPI.h" #ifdef JS_CPU_SPARC #ifdef __linux__ // bugzilla 502369 From a39b7dafd3ab2b5f11a09f47ed4030ccecef88d4 Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Tue, 24 Feb 2015 17:51:25 -0600 Subject: [PATCH 46/68] Bug 1134293. Report the bounds of a tree body as needing component alpha and support disable component alpha in the text it might draw if asked. r=roc --- layout/xul/tree/nsTreeBodyFrame.cpp | 43 +++++++++++++++++++++++------ 1 file changed, 35 insertions(+), 8 deletions(-) diff --git a/layout/xul/tree/nsTreeBodyFrame.cpp b/layout/xul/tree/nsTreeBodyFrame.cpp index a2a2981822d..128bad41d77 100644 --- a/layout/xul/tree/nsTreeBodyFrame.cpp +++ b/layout/xul/tree/nsTreeBodyFrame.cpp @@ -2773,12 +2773,40 @@ nsTreeBodyFrame::HandleEvent(nsPresContext* aPresContext, return NS_OK; } -static void -PaintTreeBody(nsIFrame* aFrame, nsRenderingContext* aCtx, - const nsRect& aDirtyRect, nsPoint aPt) -{ - static_cast(aFrame)->PaintTreeBody(*aCtx, aDirtyRect, aPt); -} +class nsDisplayTreeBody MOZ_FINAL : public nsDisplayItem { +public: + nsDisplayTreeBody(nsDisplayListBuilder* aBuilder, nsFrame* aFrame) : + nsDisplayItem(aBuilder, aFrame), + mDisableSubpixelAA(false) { + MOZ_COUNT_CTOR(nsDisplayTreeBody); + } +#ifdef NS_BUILD_REFCNT_LOGGING + virtual ~nsDisplayTreeBody() { + MOZ_COUNT_DTOR(nsDisplayTreeBody); + } +#endif + + virtual void Paint(nsDisplayListBuilder* aBuilder, + nsRenderingContext* aCtx) MOZ_OVERRIDE + { + gfxContext* ctx = aCtx->ThebesContext(); + gfxContextAutoDisableSubpixelAntialiasing disable(ctx, mDisableSubpixelAA); + static_cast(mFrame)-> + PaintTreeBody(*aCtx, mVisibleRect, ToReferenceFrame()); + } + NS_DISPLAY_DECL_NAME("XULTreeBody", TYPE_XUL_TREE_BODY) + + virtual nsRect GetComponentAlphaBounds(nsDisplayListBuilder* aBuilder) MOZ_OVERRIDE + { + bool snap; + return GetBounds(aBuilder, &snap); + } + virtual void DisableComponentAlpha() MOZ_OVERRIDE { + mDisableSubpixelAA = true; + } + + bool mDisableSubpixelAA; +}; // Painting routines void @@ -2799,8 +2827,7 @@ nsTreeBodyFrame::BuildDisplayList(nsDisplayListBuilder* aBuilder, return; aLists.Content()->AppendNewToTop(new (aBuilder) - nsDisplayGeneric(aBuilder, this, ::PaintTreeBody, "XULTreeBody", - nsDisplayItem::TYPE_XUL_TREE_BODY)); + nsDisplayTreeBody(aBuilder, this)); } void From d56b851467d0eb8774a99a164b7348fdc39007ef Mon Sep 17 00:00:00 2001 From: Chris Manchester Date: Tue, 24 Feb 2015 15:52:52 -0800 Subject: [PATCH 47/68] Bug 1136378 - Use a browser's outerWindowId property rather than a CPOW to identify marionette's content listeners.;r=mconley --- testing/marionette/marionette-server.js | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/testing/marionette/marionette-server.js b/testing/marionette/marionette-server.js index b38fb7ed2c6..f4ace3c193f 100644 --- a/testing/marionette/marionette-server.js +++ b/testing/marionette/marionette-server.js @@ -1447,16 +1447,11 @@ MarionetteServerConnection.prototype = { return this._browserIds.get(permKey); } - let contentWindow = browser.contentWindowAsCPOW; - if (contentWindow !== null && !Cu.isDeadWrapper(contentWindow)) { - let winId = contentWindow.QueryInterface(Ci.nsIInterfaceRequestor) - .getInterface(Ci.nsIDOMWindowUtils) - .outerWindowID; - if (winId) { - winId += ""; - this._browserIds.set(permKey, winId); - return winId; - } + let winId = browser.outerWindowID; + if (winId) { + winId += ""; + this._browserIds.set(permKey, winId); + return winId; } return null; }, From 5755021607419b80229816de0d04b771a2609d2e Mon Sep 17 00:00:00 2001 From: "Byron Campen [:bwc]" Date: Mon, 23 Feb 2015 15:19:17 -0800 Subject: [PATCH 48/68] Bug 1135902: Set stream id on fake media streams. r=drno --- media/webrtc/signaling/test/FakeMediaStreams.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/media/webrtc/signaling/test/FakeMediaStreams.h b/media/webrtc/signaling/test/FakeMediaStreams.h index a7afecbe1b2..b7afbf30e42 100644 --- a/media/webrtc/signaling/test/FakeMediaStreams.h +++ b/media/webrtc/signaling/test/FakeMediaStreams.h @@ -265,7 +265,13 @@ public: explicit Fake_DOMMediaStream(Fake_MediaStream *stream = nullptr) : mMediaStream(stream ? stream : new Fake_MediaStream()) , mVideoTrack(new Fake_MediaStreamTrack(true, this)) - , mAudioTrack(new Fake_MediaStreamTrack(false, this)) {} + , mAudioTrack(new Fake_MediaStreamTrack(false, this)) + { + static size_t counter = 0; + std::ostringstream os; + os << counter++; + mID = os.str(); + } NS_DECL_THREADSAFE_ISUPPORTS From f8f7b1d6cc048ad00ce22300a8eebabf83caf8c1 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Tue, 24 Feb 2015 15:58:25 -0800 Subject: [PATCH 49/68] Backed out 2 changesets (bug 1134891) for bc1 orange on a CLOSED TREE Backed out changeset 7b021e23ff21 (bug 1134891) Backed out changeset ec627a9f91c1 (bug 1134891) --- .../printingui/mac/nsPrintProgress.cpp | 54 +++++++++++++++---- .../printingui/unixshared/nsPrintProgress.cpp | 34 ++---------- .../printingui/win/nsPrintProgress.cpp | 29 ++-------- 3 files changed, 52 insertions(+), 65 deletions(-) diff --git a/embedding/components/printingui/mac/nsPrintProgress.cpp b/embedding/components/printingui/mac/nsPrintProgress.cpp index 29c52daf688..a35b21a5157 100644 --- a/embedding/components/printingui/mac/nsPrintProgress.cpp +++ b/embedding/components/printingui/mac/nsPrintProgress.cpp @@ -42,21 +42,55 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent, nsIObserver *openDialogObserver, bool *notifyOnOpen) { - MOZ_ASSERT_UNREACHABLE("The nsPrintingPromptService::ShowProgress " - "implementation for OS X returns " - "NS_ERROR_NOT_IMPLEMENTED, so we should never get " - "here."); - return NS_ERROR_NOT_IMPLEMENTED; + m_observer = openDialogObserver; + + nsresult rv = NS_ERROR_FAILURE; + + if (m_dialog) + return NS_ERROR_ALREADY_INITIALIZED; + + if (!dialogURL || !*dialogURL) + return NS_ERROR_INVALID_ARG; + + if (parent) + { + // Set up window.arguments[0]... + nsCOMPtr array; + rv = NS_NewISupportsArray(getter_AddRefs(array)); + NS_ENSURE_SUCCESS(rv, rv); + + nsCOMPtr ifptr = + do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, rv); + + ifptr->SetData(static_cast(this)); + ifptr->SetDataIID(&NS_GET_IID(nsIPrintProgress)); + + array->AppendElement(ifptr); + + array->AppendElement(parameters); + + // Open the dialog. + nsCOMPtr newWindow; + rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), + NS_LITERAL_STRING("_blank"), + NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), + array, getter_AddRefs(newWindow)); + if (NS_SUCCEEDED(rv)) { + *notifyOnOpen = true; + } + } + + return rv; } /* void closeProgressDialog (in boolean forceClose); */ NS_IMETHODIMP nsPrintProgress::CloseProgressDialog(bool forceClose) { - MOZ_ASSERT_UNREACHABLE("The nsPrintingPromptService::ShowProgress " - "implementation for OS X returns " - "NS_ERROR_NOT_IMPLEMENTED, so we should never get " - "here."); - return NS_ERROR_NOT_IMPLEMENTED; + m_closeProgress = true; + // XXX Casting bool to nsresult + return OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, + static_cast(forceClose)); } /* nsIPrompt GetPrompter (); */ diff --git a/embedding/components/printingui/unixshared/nsPrintProgress.cpp b/embedding/components/printingui/unixshared/nsPrintProgress.cpp index 426da9d46eb..3df417c84e1 100644 --- a/embedding/components/printingui/unixshared/nsPrintProgress.cpp +++ b/embedding/components/printingui/unixshared/nsPrintProgress.cpp @@ -6,16 +6,10 @@ #include "nsPrintProgress.h" #include "nsIBaseWindow.h" -#include "nsIDocShell.h" -#include "nsIDocShellTreeOwner.h" -#include "nsIInterfaceRequestorUtils.h" #include "nsISupportsArray.h" -#include "nsIXULWindow.h" #include "nsXPCOM.h" #include "nsISupportsPrimitives.h" #include "nsIComponentManager.h" -#include "nsPIDOMWindow.h" - NS_IMPL_ADDREF(nsPrintProgress) NS_IMPL_RELEASE(nsPrintProgress) @@ -77,32 +71,12 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent, array->AppendElement(parameters); - // We will set the opener of the dialog to be the nsIDOMWindow for the - // browser XUL window itself, as opposed to the content. That way, the - // progress window has access to the opener. - nsCOMPtr pParentWindow = do_QueryInterface(parent); - NS_ENSURE_STATE(pParentWindow); - - nsCOMPtr docShell = pParentWindow->GetDocShell(); - NS_ENSURE_STATE(docShell); - - nsCOMPtr owner; - docShell->GetTreeOwner(getter_AddRefs(owner)); - - nsCOMPtr ownerXULWindow = do_GetInterface(owner); - nsCOMPtr ownerWindow = do_GetInterface(ownerXULWindow); - NS_ENSURE_STATE(ownerWindow); - - MOZ_ASSERT_UNREACHABLE("This is a test to see if this can even compile. " - "I don't remember if C++ is this cool."); - // Open the dialog. nsCOMPtr newWindow; - - rv = ownerWindow->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), - NS_LITERAL_STRING("_blank"), - NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), - array, getter_AddRefs(newWindow)); + rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), + NS_LITERAL_STRING("_blank"), + NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), + array, getter_AddRefs(newWindow)); } return rv; diff --git a/embedding/components/printingui/win/nsPrintProgress.cpp b/embedding/components/printingui/win/nsPrintProgress.cpp index 1edb75b45f7..d711bddb132 100644 --- a/embedding/components/printingui/win/nsPrintProgress.cpp +++ b/embedding/components/printingui/win/nsPrintProgress.cpp @@ -6,16 +6,11 @@ #include "nsPrintProgress.h" #include "nsIBaseWindow.h" -#include "nsIDocShell.h" -#include "nsIDocShellTreeOwner.h" -#include "nsIInterfaceRequestorUtils.h" #include "nsISupportsArray.h" -#include "nsIXULWindow.h" #include "nsXPCOM.h" #include "nsISupportsPrimitives.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" -#include "nsPIDOMWindow.h" #if 0 NS_IMPL_ADDREF(nsPrintProgress) @@ -105,28 +100,12 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent, array->AppendElement(parameters); - // We will set the opener of the dialog to be the nsIDOMWindow for the - // browser XUL window itself, as opposed to the content. That way, the - // progress window has access to the opener. - nsCOMPtr pParentWindow = do_QueryInterface(parent); - NS_ENSURE_STATE(pParentWindow); - - nsCOMPtr docShell = pParentWindow->GetDocShell(); - NS_ENSURE_STATE(docShell); - - nsCOMPtr owner; - docShell->GetTreeOwner(getter_AddRefs(owner)); - - nsCOMPtr ownerXULWindow = do_GetInterface(owner); - nsCOMPtr ownerWindow = do_GetInterface(ownerXULWindow); - NS_ENSURE_STATE(ownerWindow); - // Open the dialog. nsCOMPtr newWindow; - rv = ownerWindow->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), - NS_LITERAL_STRING("_blank"), - NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), - array, getter_AddRefs(newWindow)); + rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), + NS_LITERAL_STRING("_blank"), + NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), + array, getter_AddRefs(newWindow)); } return rv; From 87d554fb35661613b0e401d3f03f0994f899ae33 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Tue, 24 Feb 2015 17:32:00 -0800 Subject: [PATCH 50/68] Backed out changeset 58d13a71c5dc (bug 1135912) for reftest bustage on a CLOSED TREE --- widget/cocoa/nsNativeThemeCocoa.mm | 2 -- 1 file changed, 2 deletions(-) diff --git a/widget/cocoa/nsNativeThemeCocoa.mm b/widget/cocoa/nsNativeThemeCocoa.mm index 66072103497..893d10c1486 100644 --- a/widget/cocoa/nsNativeThemeCocoa.mm +++ b/widget/cocoa/nsNativeThemeCocoa.mm @@ -3494,8 +3494,6 @@ nsNativeThemeCocoa::WidgetStateChanged(nsIFrame* aFrame, uint8_t aWidgetType, case NS_THEME_PROGRESSBAR_VERTICAL: case NS_THEME_METERBAR: case NS_THEME_METERBAR_CHUNK: - case NS_THEME_MAC_VIBRANCY_LIGHT: - case NS_THEME_MAC_VIBRANCY_DARK: *aShouldRepaint = false; return NS_OK; } From cc0aeb80b6df37c3151b56f6e2fe8f537150bc99 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Tue, 24 Feb 2015 17:32:37 -0800 Subject: [PATCH 51/68] Backed out 3 changesets (bug 961887) for reftest failures on a CLOSED TREE Backed out changeset 1684d29858e1 (bug 961887) Backed out changeset 97c8184c3058 (bug 961887) Backed out changeset f02c5c1f7704 (bug 961887) --- layout/base/FrameLayerBuilder.cpp | 296 ++++++------------ layout/base/FrameLayerBuilder.h | 15 +- layout/base/nsDisplayList.cpp | 13 +- layout/reftests/bugs/961887-1-ref.html | 23 -- layout/reftests/bugs/961887-1.html | 30 -- layout/reftests/bugs/961887-2-ref.html | 24 -- layout/reftests/bugs/961887-2.html | 32 -- layout/reftests/bugs/961887-3-ref.html | 16 - layout/reftests/bugs/961887-3.html | 51 --- layout/reftests/bugs/reftest.list | 9 +- .../percent-overflow-sizing/reftest.list | 2 +- 11 files changed, 111 insertions(+), 400 deletions(-) delete mode 100644 layout/reftests/bugs/961887-1-ref.html delete mode 100644 layout/reftests/bugs/961887-1.html delete mode 100644 layout/reftests/bugs/961887-2-ref.html delete mode 100644 layout/reftests/bugs/961887-2.html delete mode 100644 layout/reftests/bugs/961887-3-ref.html delete mode 100644 layout/reftests/bugs/961887-3.html diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 306cb8d5947..fc22b419dcd 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -242,56 +242,6 @@ static inline MaskLayerImageCache* GetMaskLayerImageCache() return gMaskLayerImageCache; } -/** - * A wrapper for nsIntRegion that can express infinite regions. - */ -struct PossiblyInfiniteRegion -{ - PossiblyInfiniteRegion() : mIsInfinite(false) {} - MOZ_IMPLICIT PossiblyInfiniteRegion(const nsIntRegion& aRegion) - : mRegion(aRegion) - , mIsInfinite(false) - {} - MOZ_IMPLICIT PossiblyInfiniteRegion(const nsIntRect& aRect) - : mRegion(aRect) - , mIsInfinite(false) - {} - - // Create an infinite region. - static PossiblyInfiniteRegion InfiniteRegion() - { - PossiblyInfiniteRegion r; - r.mIsInfinite = true; - return r; - } - - bool IsInfinite() const { return mIsInfinite; } - bool Intersects(const nsIntRegion& aRegion) const - { - if (IsInfinite()) { - return true; - } - return !mRegion.Intersect(aRegion).IsEmpty(); - } - - void AccumulateAndSimplifyOutward(const PossiblyInfiniteRegion& aRegion) - { - if (!IsInfinite()) { - if (aRegion.IsInfinite()) { - mIsInfinite = true; - mRegion.SetEmpty(); - } else { - mRegion.OrWith(aRegion.mRegion); - mRegion.SimplifyOutward(8); - } - } - } - -protected: - nsIntRegion mRegion; - bool mIsInfinite; -}; - /** * We keep a stack of these to represent the PaintedLayers that are * currently available to have display items added to. @@ -318,7 +268,8 @@ public: mOpaqueForAnimatedGeometryRootParent(false), mImage(nullptr), mCommonClipCount(-1), - mNewChildLayersIndex(-1) + mNewChildLayersIndex(-1), + mVisibleAboveRegionIsInfinite(false) {} #ifdef MOZ_DUMP_PAINTING @@ -370,9 +321,52 @@ public: */ already_AddRefed CanOptimizeImageLayer(nsDisplayListBuilder* aBuilder); + void AddVisibleAboveRegion(const nsIntRegion& aAbove) + { + if (!mVisibleAboveRegionIsInfinite) { + mVisibleAboveRegion.Or(mVisibleAboveRegion, aAbove); + mVisibleAboveRegion.SimplifyOutward(8); + } + } + + void CopyAboveRegion(PaintedLayerData* aOther) + { + if (mVisibleAboveRegionIsInfinite) { + return; + } + + // If aOther has a draw region and is subject to async transforms then the + // layer can potentially be moved arbitrarily on the compositor. So we + // should avoid moving display items from on top of the layer to below the + // layer, which we do by calling SetVisibleAboveRegionIsInfinite. Note that + // if the draw region is empty (such as when aOther has only event-regions + // items) then we don't need to do this. + bool aOtherCanDrawAnywhere = aOther->IsSubjectToAsyncTransforms() + && !aOther->mVisibleRegion.IsEmpty(); + + if (aOther->mVisibleAboveRegionIsInfinite || aOtherCanDrawAnywhere) { + SetVisibleAboveRegionIsInfinite(); + } else { + mVisibleAboveRegion.Or(mVisibleAboveRegion, aOther->mVisibleAboveRegion); + mVisibleAboveRegion.Or(mVisibleAboveRegion, aOther->mVisibleRegion); + mVisibleAboveRegion.SimplifyOutward(8); + } + } + + void SetVisibleAboveRegionIsInfinite() + { + mVisibleAboveRegionIsInfinite = true; + mVisibleAboveRegion.SetEmpty(); + } + + bool VisibleAboveRegionIntersects(const nsIntRect& aRect) const + { + return mVisibleAboveRegionIsInfinite || mVisibleAboveRegion.Intersects(aRect); + } + bool VisibleAboveRegionIntersects(const nsIntRegion& aRegion) const { - return mVisibleAboveRegion.Intersects(aRegion); + return mVisibleAboveRegionIsInfinite || !mVisibleAboveRegion.Intersect(aRegion).IsEmpty(); } bool VisibleRegionIntersects(const nsIntRect& aRect) const @@ -508,6 +502,8 @@ public: * The union of all the bounds of the display items in this layer. */ nsIntRect mBounds; + +private: /** * The region of visible content above the layer and below the * next PaintedLayerData currently in the stack, if any. Note that not @@ -515,7 +511,12 @@ public: * Same coordinate system as mVisibleRegion. * This is a conservative approximation: it contains the true region. */ - PossiblyInfiniteRegion mVisibleAboveRegion; + nsIntRegion mVisibleAboveRegion; + /** + * True if mVisibleAboveRegion should be treated as infinite, and all + * display items should be considered 'above' this layer. + */ + bool mVisibleAboveRegionIsInfinite; }; @@ -574,8 +575,7 @@ public: const nsRect& aContainerBounds, ContainerLayer* aContainerLayer, const ContainerLayerParameters& aParameters, - bool aFlattenToSingleLayer, - nscolor aBackgroundColor) : + bool aFlattenToSingleLayer) : mBuilder(aBuilder), mManager(aManager), mLayerBuilder(aLayerBuilder), mContainerFrame(aContainerFrame), @@ -583,7 +583,6 @@ public: mContainerBounds(aContainerBounds), mParameters(aParameters), mNextFreeRecycledPaintedLayer(0), - mContainerUniformBackgroundColor(aBackgroundColor), mFlattenToSingleLayer(aFlattenToSingleLayer) { nsPresContext* presContext = aContainerFrame->PresContext(); @@ -734,15 +733,12 @@ protected: PaintedLayer* aNewLayer); /** - * Try to determine whether a layer with visible region aTargetVisibleRegion + * Try to determine whether the PaintedLayer at aPaintedLayerIndex * has a single opaque color behind it, over the entire bounds of its visible - * region. The target layer is assumed to be on top of all thebes layers in - * the thebes layer data stack that have a stack index < aUnderPaintedLayerIndex. - * If successful, return the color, otherwise return NS_RGBA(0,0,0,0). - * aTargetVisibleRegion is relative to the the container reference frame. + * region. + * If successful, return that color, otherwise return NS_RGBA(0,0,0,0). */ - nscolor FindOpaqueBackgroundColorFor(const nsIntRegion& aTargetVisibleRegion, - int32_t aUnderPaintedLayerIndex); + nscolor FindOpaqueBackgroundColorFor(int32_t aPaintedLayerIndex); /** * Find the fixed-pos frame, if any, containing (or equal to) * aAnimatedGeometryRoot. Only return a fixed-pos frame if its viewport @@ -860,31 +856,6 @@ protected: bool ChooseAnimatedGeometryRoot(const nsDisplayList& aList, const nsIFrame **aAnimatedGeometryRoot); - /** - * When adding a new layer above the topmost PaintedLayerData layer in our - * PaintedLayerDataStack, update the visible above region of the topmost - * PaintedLayerData item. - * @param aVisibleRect The visible rect of the newly-added display item - * @param aCanMoveFreely Whether the visible area of the item can change - * without new layer building. - * @param aClipRectIfAny A clip rect, if the layer is clipped, or nullptr. - */ - void UpdateVisibleAboveRegionForNewItem(const nsIntRect& aVisibleRect, - bool aCanMoveFreely, - const nsIntRect* aClipRectIfAny); - - /** - * When popping aData from the PaintedLayerDataStack, update the next - * PaintedLayerData item's visible above region to take the popped layer - * into account. - * @param aData The layer data that is getting popped from - * the stack. - * @param aNextPaintedLayerData The next lower item in the stack, or nullptr - * if there is none. - */ - void UpdateVisibleAboveRegionOnPop(PaintedLayerData* aData, - PaintedLayerData* aNextPaintedLayerData); - nsDisplayListBuilder* mBuilder; LayerManager* mManager; FrameLayerBuilder* mLayerBuilder; @@ -916,20 +887,8 @@ protected: nsTArray > mRecycledPaintedLayers; nsDataHashtable, nsRefPtr > mRecycledMaskImageLayers; - /** - * The visible region of all visible content in this container layer under - * first PaintedLayerData layer in the PaintedLayerDataStack. - */ - PossiblyInfiniteRegion mVisibleAboveBackgroundRegion; uint32_t mNextFreeRecycledPaintedLayer; nscoord mAppUnitsPerDevPixel; - /** - * The uniform opaque color from behind this container layer, or - * NS_RGBA(0,0,0,0) if the background behind this container layer is not - * uniform and opaque. This color can be pulled into ThebesLayers that are - * directly above the background. - */ - nscolor mContainerUniformBackgroundColor; bool mSnappingEnabled; bool mFlattenToSingleLayer; /** @@ -1882,19 +1841,19 @@ ContainerState::SetOuterVisibleRegionForLayer(Layer* aLayer, } nscolor -ContainerState::FindOpaqueBackgroundColorFor(const nsIntRegion& aTargetVisibleRegion, - int32_t aUnderPaintedLayerIndex) +ContainerState::FindOpaqueBackgroundColorFor(int32_t aPaintedLayerIndex) { - for (int32_t i = aUnderPaintedLayerIndex - 1; i >= 0; --i) { + PaintedLayerData* target = mPaintedLayerDataStack[aPaintedLayerIndex]; + for (int32_t i = aPaintedLayerIndex - 1; i >= 0; --i) { PaintedLayerData* candidate = mPaintedLayerDataStack[i]; - if (candidate->VisibleAboveRegionIntersects(aTargetVisibleRegion)) { + if (candidate->VisibleAboveRegionIntersects(target->mVisibleRegion)) { // Some non-PaintedLayer content between target and candidate; this is // hopeless - return NS_RGBA(0,0,0,0); + break; } nsIntRegion intersection; - intersection.And(candidate->mVisibleRegion, aTargetVisibleRegion); + intersection.And(candidate->mVisibleRegion, target->mVisibleRegion); if (intersection.IsEmpty()) { // The layer doesn't intersect our target, ignore it and move on continue; @@ -1902,7 +1861,7 @@ ContainerState::FindOpaqueBackgroundColorFor(const nsIntRegion& aTargetVisibleRe // The candidate intersects our target. If any layer has a solid-color // area behind our target, this must be it. Scan its display items. - nsIntRect deviceRect = aTargetVisibleRegion.GetBounds(); + nsIntRect deviceRect = target->mVisibleRegion.GetBounds(); nsRect appUnitRect = deviceRect.ToAppUnits(mAppUnitsPerDevPixel); appUnitRect.ScaleInverseRoundOut(mParameters.mXScale, mParameters.mYScale); @@ -1919,7 +1878,7 @@ ContainerState::FindOpaqueBackgroundColorFor(const nsIntRegion& aTargetVisibleRe continue; if (!snappedBounds.Contains(deviceRect)) - return NS_RGBA(0,0,0,0); + break; } else { // The layer's visible rect is already (close enough to) pixel @@ -1928,7 +1887,7 @@ ContainerState::FindOpaqueBackgroundColorFor(const nsIntRegion& aTargetVisibleRe continue; if (!bounds.Contains(appUnitRect)) - return NS_RGBA(0,0,0,0); + break; } if (item->IsInvisibleInRect(appUnitRect)) { @@ -1939,21 +1898,18 @@ ContainerState::FindOpaqueBackgroundColorFor(const nsIntRegion& aTargetVisibleRe mParameters.mXScale, mParameters.mYScale, mAppUnitsPerDevPixel)) { - return NS_RGBA(0,0,0,0); + break; } nscolor color; if (item->IsUniform(mBuilder, &color) && NS_GET_A(color) == 255) return color; - return NS_RGBA(0,0,0,0); + break; } + break; } - if (mVisibleAboveBackgroundRegion.Intersects(aTargetVisibleRegion)) { - // Some non-Thebes content is between container background and target. - return NS_RGBA(0,0,0,0); - } - return mContainerUniformBackgroundColor; + return NS_RGBA(0,0,0,0); } void @@ -2196,7 +2152,7 @@ ContainerState::PopPaintedLayerData() if (layer == data->mLayer) { nscolor backgroundColor = NS_RGBA(0,0,0,0); if (!isOpaque) { - backgroundColor = FindOpaqueBackgroundColorFor(data->mVisibleRegion, lastIndex); + backgroundColor = FindOpaqueBackgroundColorFor(lastIndex); if (NS_GET_A(backgroundColor) == 255) { isOpaque = true; } @@ -2308,13 +2264,13 @@ ContainerState::PopPaintedLayerData() layer->SetEventRegions(regions); } - // Since we're going to pop off the last PaintedLayerData, the - // mVisibleAboveRegion of the second-to-last item will need to include - // the regions of the last item. If we're emptying the PaintedLayerDataStack, - // we instead need to accumulate the regions into the container's - // mVisibleAboveBackgroundRegion. - UpdateVisibleAboveRegionOnPop(data, - lastIndex > 0 ? mPaintedLayerDataStack[lastIndex - 1].get() : nullptr); + if (lastIndex > 0) { + // Since we're going to pop off the last PaintedLayerData, the + // mVisibleAboveRegion of the second-to-last item will need to include + // the regions of the last item. + PaintedLayerData* nextData = mPaintedLayerDataStack[lastIndex - 1]; + nextData->CopyAboveRegion(data); + } mPaintedLayerDataStack.RemoveElementAt(lastIndex); } @@ -2764,51 +2720,6 @@ ContainerState::ComputeOpaqueRect(nsDisplayItem* aItem, return opaquePixels; } -void -ContainerState::UpdateVisibleAboveRegionForNewItem(const nsIntRect& aVisibleRect, - bool aCanMoveFreely, - const nsIntRect* aClipRectIfAny) -{ - PaintedLayerData* data = GetTopPaintedLayerData(); - PossiblyInfiniteRegion& visibleAboveRegion = data - ? data->mVisibleAboveRegion : mVisibleAboveBackgroundRegion; - - if (aCanMoveFreely) { - // Prerendered transform items can be updated without layer building - // (async animations or an empty transaction), so we need to put items - // that the transform item can potentially move under into a layer above - // this item. We do this by making the visible above region infinite. - // If we have a clip, the transform can't escape from the clip rect, and - // the clip rect can't change without new layer building. In that case we - // can add just the clip rect to the visible above region. - visibleAboveRegion.AccumulateAndSimplifyOutward( - aClipRectIfAny ? *aClipRectIfAny : PossiblyInfiniteRegion::InfiniteRegion()); - } else { - visibleAboveRegion.AccumulateAndSimplifyOutward(aVisibleRect); - } -} - -void -ContainerState::UpdateVisibleAboveRegionOnPop(PaintedLayerData* aData, - PaintedLayerData* aNextPaintedLayerData) -{ - PossiblyInfiniteRegion& visibleAboveRegion = aNextPaintedLayerData ? - aNextPaintedLayerData->mVisibleAboveRegion : mVisibleAboveBackgroundRegion; - - // If aData has a draw region and is subject to async transforms then the - // layer can potentially be moved arbitrarily on the compositor. So we - // should avoid moving display items from on top of the layer to below the - // layer, which we do by making the visibleAboveRegion infinite. Note that - // if the visible region is empty (such as when aData has only event-regions - // items) then we don't need to do this. - if (aData->IsSubjectToAsyncTransforms() && !aData->mVisibleRegion.IsEmpty()) { - visibleAboveRegion.AccumulateAndSimplifyOutward(PossiblyInfiniteRegion::InfiniteRegion()); - } else { - visibleAboveRegion.AccumulateAndSimplifyOutward(aData->mVisibleAboveRegion); - visibleAboveRegion.AccumulateAndSimplifyOutward(aData->mVisibleRegion); - } -} - /* * Iterate through the non-clip items in aList and its descendants. * For each item we compute the effective clip rect. Each item is assigned @@ -2999,16 +2910,6 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList) continue; } - // 3D-transformed layers don't necessarily draw in the order in which - // they're added to their parent container layer. - bool mayDrawOutOfOrder = itemType == nsDisplayItem::TYPE_TRANSFORM && - (item->Frame()->Preserves3D() || item->Frame()->Preserves3DChildren()); - - // Pull up a uniform background color into the layer if possible. - mParameters.mBackgroundColor = (prerenderedTransform || mayDrawOutOfOrder) - ? NS_RGBA(0,0,0,0) - : FindOpaqueBackgroundColorFor(itemVisibleRect, mPaintedLayerDataStack.Length()); - // Just use its layer. // Set layerContentsVisibleRect.width/height to -1 to indicate we // currently don't know. If BuildContainerLayerFor gets called by @@ -3052,13 +2953,27 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList) } else { ownLayer->SetClipRect(nullptr); } - - // Update the "visible above region" of the topmost PaintedLayerData item - // (or of the container's background) so that FindPaintedLayerFor and - // FindOpaqueBackgroundColorFor are aware of this item, even though it's - // not in the PaintedLayerDataStack. - UpdateVisibleAboveRegionForNewItem(itemVisibleRect, prerenderedTransform, - itemClip.HasClip() ? &clipRect : nullptr); + PaintedLayerData* data = GetTopPaintedLayerData(); + if (data) { + // Prerendered transform items can be updated without layer building + // (async animations or an empty transaction), so we need to put items + // that the transform item can potentially move under into a layer + // above this item. + if (prerenderedTransform) { + if (!itemClip.HasClip()) { + // The transform item can move anywhere, treat all other content + // as being above this item. + data->SetVisibleAboveRegionIsInfinite(); + } else { + // The transform can't escape from the clip rect, and the clip + // rect can't change without new layer building. Treat all content + // that intersects the clip rect as being above this item. + data->AddVisibleAboveRegion(clipRect); + } + } else { + data->AddVisibleAboveRegion(itemVisibleRect); + } + } // rounded rectangle clipping using mask layers // (must be done after visible rect is set on layer) @@ -4109,18 +4024,11 @@ FrameLayerBuilder::BuildContainerLayerFor(nsDisplayListBuilder* aBuilder, { flattenToSingleLayer = true; } - - nscolor backgroundColor = NS_RGBA(0,0,0,0); - if (aFlags & CONTAINER_ALLOW_PULL_BACKGROUND_COLOR) { - backgroundColor = aParameters.mBackgroundColor; - } - uint32_t flags; while (true) { ContainerState state(aBuilder, aManager, aManager->GetLayerBuilder(), aContainerFrame, aContainerItem, bounds, - containerLayer, scaleParameters, flattenToSingleLayer, - backgroundColor); + containerLayer, scaleParameters, flattenToSingleLayer); state.ProcessDisplayItems(aChildren); diff --git a/layout/base/FrameLayerBuilder.h b/layout/base/FrameLayerBuilder.h index 9b35c093c89..4a5a2186098 100644 --- a/layout/base/FrameLayerBuilder.h +++ b/layout/base/FrameLayerBuilder.h @@ -57,7 +57,6 @@ struct ContainerLayerParameters { : mXScale(1) , mYScale(1) , mLayerContentsVisibleRect(nullptr) - , mBackgroundColor(NS_RGBA(0,0,0,0)) , mInTransformedSubtree(false) , mInActiveTransformedSubtree(false) , mDisableSubpixelAntialiasingInDescendants(false) @@ -67,7 +66,6 @@ struct ContainerLayerParameters { : mXScale(aXScale) , mYScale(aYScale) , mLayerContentsVisibleRect(nullptr) - , mBackgroundColor(NS_RGBA(0,0,0,0)) , mInTransformedSubtree(false) , mInActiveTransformedSubtree(false) , mDisableSubpixelAntialiasingInDescendants(false) @@ -80,7 +78,6 @@ struct ContainerLayerParameters { , mYScale(aYScale) , mLayerContentsVisibleRect(nullptr) , mOffset(aOffset) - , mBackgroundColor(aParent.mBackgroundColor) , mInTransformedSubtree(aParent.mInTransformedSubtree) , mInActiveTransformedSubtree(aParent.mInActiveTransformedSubtree) , mDisableSubpixelAntialiasingInDescendants(aParent.mDisableSubpixelAntialiasingInDescendants) @@ -97,7 +94,6 @@ struct ContainerLayerParameters { */ nsIntPoint mOffset; - nscolor mBackgroundColor; bool mInTransformedSubtree; bool mInActiveTransformedSubtree; bool mDisableSubpixelAntialiasingInDescendants; @@ -201,16 +197,7 @@ public: void DidEndTransaction(); enum { - CONTAINER_NOT_CLIPPED_BY_ANCESTORS = 0x01, - - /** - * Set this when pulling an opaque background color from behind the - * container layer into the container doesn't change the visual results, - * given the effects you're going to apply to the container layer. - * For example, this is compatible with opacity or clipping/masking, but - * not with non-OVER blend modes or filters. - */ - CONTAINER_ALLOW_PULL_BACKGROUND_COLOR = 0x02 + CONTAINER_NOT_CLIPPED_BY_ANCESTORS = 0x01 }; /** * Build a container layer for a display item that contains a child diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 2f7f6c05ede..6b663482f4a 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -3811,8 +3811,7 @@ nsDisplayOpacity::BuildLayer(nsDisplayListBuilder* aBuilder, const ContainerLayerParameters& aContainerParameters) { nsRefPtr container = aManager->GetLayerBuilder()-> BuildContainerLayerFor(aBuilder, aManager, mFrame, this, &mList, - aContainerParameters, nullptr, - FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR); + aContainerParameters, nullptr); if (!container) return nullptr; @@ -4121,8 +4120,7 @@ nsDisplayOwnLayer::BuildLayer(nsDisplayListBuilder* aBuilder, const ContainerLayerParameters& aContainerParameters) { nsRefPtr layer = aManager->GetLayerBuilder()-> BuildContainerLayerFor(aBuilder, aManager, mFrame, this, &mList, - aContainerParameters, nullptr, - FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR); + aContainerParameters, nullptr); if (mFlags & VERTICAL_SCROLLBAR) { layer->SetScrollbarData(mScrollTarget, Layer::ScrollDirection::VERTICAL); } @@ -4520,8 +4518,7 @@ nsDisplayScrollLayer::BuildLayer(nsDisplayListBuilder* aBuilder, return aManager->GetLayerBuilder()-> BuildContainerLayerFor(aBuilder, aManager, mFrame, this, &mList, - params, nullptr, - FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR); + params, nullptr); } UniquePtr @@ -5524,7 +5521,6 @@ already_AddRefed nsDisplayTransform::BuildLayer(nsDisplayListBuilder *aBu uint32_t flags = ShouldPrerender(aBuilder) ? FrameLayerBuilder::CONTAINER_NOT_CLIPPED_BY_ANCESTORS : 0; - flags |= FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR; nsRefPtr container = aManager->GetLayerBuilder()-> BuildContainerLayerFor(aBuilder, aManager, mFrame, this, mStoredList.GetChildren(), aContainerParameters, &newTransformMatrix, flags); @@ -5981,8 +5977,7 @@ nsDisplayVR::BuildLayer(nsDisplayListBuilder* aBuilder, const ContainerLayerParameters& aContainerParameters) { ContainerLayerParameters newContainerParameters = aContainerParameters; - uint32_t flags = FrameLayerBuilder::CONTAINER_NOT_CLIPPED_BY_ANCESTORS | - FrameLayerBuilder::CONTAINER_ALLOW_PULL_BACKGROUND_COLOR; + uint32_t flags = FrameLayerBuilder::CONTAINER_NOT_CLIPPED_BY_ANCESTORS; nsRefPtr container = aManager->GetLayerBuilder()-> BuildContainerLayerFor(aBuilder, aManager, mFrame, this, &mList, newContainerParameters, nullptr, flags); diff --git a/layout/reftests/bugs/961887-1-ref.html b/layout/reftests/bugs/961887-1-ref.html deleted file mode 100644 index 78673a82280..00000000000 --- a/layout/reftests/bugs/961887-1-ref.html +++ /dev/null @@ -1,23 +0,0 @@ - -Don't pull background colors of container layers through DrawAboveRegions of ThebesLayers - - -
-
-
-
diff --git a/layout/reftests/bugs/961887-1.html b/layout/reftests/bugs/961887-1.html deleted file mode 100644 index 65ff8d242cc..00000000000 --- a/layout/reftests/bugs/961887-1.html +++ /dev/null @@ -1,30 +0,0 @@ - -Don't pull background colors of container layers through DrawAboveRegions of ThebesLayers - - -
- -
-
- - diff --git a/layout/reftests/bugs/961887-2-ref.html b/layout/reftests/bugs/961887-2-ref.html deleted file mode 100644 index e484b399f9e..00000000000 --- a/layout/reftests/bugs/961887-2-ref.html +++ /dev/null @@ -1,24 +0,0 @@ - - - -Make sure that we don't pull background colors into container layers that have effects applied on them - - - -
-
-
-
diff --git a/layout/reftests/bugs/961887-2.html b/layout/reftests/bugs/961887-2.html deleted file mode 100644 index 6d499740aa2..00000000000 --- a/layout/reftests/bugs/961887-2.html +++ /dev/null @@ -1,32 +0,0 @@ - - - -Make sure that we don't pull background colors into container layers that have effects applied on them - - - -
-
-
-
diff --git a/layout/reftests/bugs/961887-3-ref.html b/layout/reftests/bugs/961887-3-ref.html deleted file mode 100644 index 0d9b3cb30dd..00000000000 --- a/layout/reftests/bugs/961887-3-ref.html +++ /dev/null @@ -1,16 +0,0 @@ - - - -Test container background searching with clipped display items - - - -
diff --git a/layout/reftests/bugs/961887-3.html b/layout/reftests/bugs/961887-3.html deleted file mode 100644 index b70f03a1881..00000000000 --- a/layout/reftests/bugs/961887-3.html +++ /dev/null @@ -1,51 +0,0 @@ - - - -Test container background searching with clipped display items - - - -
-
-
-
-
-
-
-
-
diff --git a/layout/reftests/bugs/reftest.list b/layout/reftests/bugs/reftest.list index ecb01074503..573f671dd3b 100644 --- a/layout/reftests/bugs/reftest.list +++ b/layout/reftests/bugs/reftest.list @@ -1658,9 +1658,9 @@ skip-if(Android||B2G) random-if(winWidget) == 632781-verybig.html 632781-ref.htm fuzzy-if(d2d&&/^Windows\x20NT\x206\.2/.test(http.oscpu),1,559) == 633344-1.html 633344-1-ref.html # bug 1103623 == 634232-1.html 634232-1-ref.html fails-if(Android&&AndroidVersion<17&&AndroidVersion!=10) == 635302-1.html 635302-1-ref.html -fuzzy(1,68) skip-if(B2G) fails-if(Android) == 635373-1.html 635373-1-ref.html -skip-if(B2G) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,61) == 635373-2.html 635373-2-ref.html -skip-if(B2G) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,60) == 635373-3.html 635373-3-ref.html +skip-if(B2G) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,11) == 635373-1.html 635373-1-ref.html +skip-if(B2G) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,15) == 635373-2.html 635373-2-ref.html +skip-if(B2G) random-if(d2d) fails-if(Android) fuzzy-if(winWidget&&!d2d,1,15) == 635373-3.html 635373-3-ref.html HTTP(..) == 635639-1.html 635639-1-ref.html HTTP(..) == 635639-2.html 635639-2-ref.html random == 637597-1.html 637597-1-ref.html # bug 637597 was never really fixed! @@ -1803,9 +1803,6 @@ fuzzy-if(B2G,1,7) == 942672-1.html 942672-1-ref.html == 950436-1.html 950436-1-ref.html == 957770-1.svg 957770-1-ref.svg == 960277-1.html 960277-1-ref.html -== 961887-1.html 961887-1-ref.html -== 961887-2.html 961887-2-ref.html -== 961887-3.html 961887-3-ref.html pref(layout.css.overflow-clip-box.enabled,true) fuzzy(50,145) == 966992-1.html 966992-1-ref.html skip-if(Android) == 966510-1.html 966510-1-ref.html # scrollable elements other than the root probably won't work well on android until bug 776030 is fixed skip-if(Android) == 966510-2.html 966510-2-ref.html # same as above diff --git a/layout/reftests/percent-overflow-sizing/reftest.list b/layout/reftests/percent-overflow-sizing/reftest.list index 25fe07045e8..e2eb72688da 100644 --- a/layout/reftests/percent-overflow-sizing/reftest.list +++ b/layout/reftests/percent-overflow-sizing/reftest.list @@ -11,7 +11,7 @@ skip-if(B2G) fails-if(Android&&browserIsRemote) == hScrollAbsHeightQuirks.html g skip-if(B2G) fails-if(Android&&browserIsRemote) == hScrollSimpleHeightD.html greenboxhbar.html # bug 650591, 732565 # bug 773482 skip-if(B2G) fails-if(Android&&browserIsRemote) == hScrollSimpleHeightQuirks-1D.html greenboxhbar.html # bug 650591, 732565 # bug 773482 skip-if(B2G) fails-if(Android&&browserIsRemote) == hScrollSimpleHeightQuirks-2D.html greenboxhbar.html # bug 650591, 732565 # bug 773482 -fuzzy-if(B2G,1,11) fails-if(Android&&browserIsRemote) == hScrollSimpleHeightQuirks-3D.html greenboxhbar.html # bug 650591, 732565, 1136304 +fails-if(Android&&browserIsRemote) == hScrollSimpleHeightQuirks-3D.html greenboxhbar.html # bug 650591, 732565 skip-if(B2G) fails-if(Android&&browserIsRemote) == hScrollAbsHeightD.html greenboxhbar.html # bug 650591, 732565 # bug 773482 skip-if(B2G) fails-if(Android&&browserIsRemote) == hScrollAbsHeightQuirksD.html greenboxhbar.html # bug 650591, 732565 # bug 773482 == simpleMinHeight100D.html greenbox.html From afd2bc83d0212d27101f26a4648b94b8cdaf0acf Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Wed, 25 Feb 2015 09:02:49 +0900 Subject: [PATCH 52/68] Bug 1136456 - Remove leftovers from TIERS support in mozbuild.frontend.reader. r=gps --- python/mozbuild/mozbuild/frontend/reader.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py index c721f366125..6e7d32ae38b 100644 --- a/python/mozbuild/mozbuild/frontend/reader.py +++ b/python/mozbuild/mozbuild/frontend/reader.py @@ -736,7 +736,7 @@ class BuildReader(object): read, a new Context is created and emitted. """ path = mozpath.join(self.config.topsrcdir, 'moz.build') - return self.read_mozbuild(path, self.config, read_tiers=True) + return self.read_mozbuild(path, self.config) def all_mozbuild_paths(self): """Iterator over all available moz.build files. @@ -872,8 +872,7 @@ class BuildReader(object): for name, key, value in assignments: yield p, name, key, value - def read_mozbuild(self, path, config, read_tiers=False, descend=True, - metadata={}): + def read_mozbuild(self, path, config, descend=True, metadata={}): """Read and process a mozbuild file, descending into children. This starts with a single mozbuild file, executes it, and descends into @@ -884,10 +883,6 @@ class BuildReader(object): directory, we will open the moz.build file located in that directory in a new Sandbox and process it. - If read_tiers is True (it should only be True for the top-level - mozbuild file in a project), the TIERS variable will be used for - traversal as well. - If descend is True (the default), we will descend into child directories and files per variable values. @@ -900,8 +895,8 @@ class BuildReader(object): """ self._execution_stack.append(path) try: - for s in self._read_mozbuild(path, config, read_tiers=read_tiers, - descend=descend, metadata=metadata): + for s in self._read_mozbuild(path, config, descend=descend, + metadata=metadata): yield s except BuildReaderError as bre: @@ -927,7 +922,7 @@ class BuildReader(object): raise BuildReaderError(list(self._execution_stack), sys.exc_info()[2], other_error=e) - def _read_mozbuild(self, path, config, read_tiers, descend, metadata): + def _read_mozbuild(self, path, config, descend, metadata): path = mozpath.normpath(path) log(self._log, logging.DEBUG, 'read_mozbuild', {'path': path}, 'Reading file: {path}') @@ -1051,7 +1046,7 @@ class BuildReader(object): continue for res in self.read_mozbuild(child_path, context.config, - read_tiers=False, metadata=child_metadata): + metadata=child_metadata): yield res self._execution_stack.pop() From 95caa5f2591e4e07941c22af9ec8941fb0ba9581 Mon Sep 17 00:00:00 2001 From: Mike Hommey Date: Tue, 24 Feb 2015 09:30:07 +0900 Subject: [PATCH 53/68] Bug 1135942 - Enable MMX/SSE code unconditionally in libsoundtouch, it does runtime detection anyways. r=padenot --- media/libsoundtouch/src/soundtouch_config.h | 12 ------------ 1 file changed, 12 deletions(-) diff --git a/media/libsoundtouch/src/soundtouch_config.h b/media/libsoundtouch/src/soundtouch_config.h index 9275ba8e6ec..469bb822af0 100644 --- a/media/libsoundtouch/src/soundtouch_config.h +++ b/media/libsoundtouch/src/soundtouch_config.h @@ -5,15 +5,3 @@ #else #define SOUNDTOUCH_INTEGER_SAMPLES 1 #endif - -#ifndef MOZILLA_PRESUME_SSE -#ifdef MOZ_SAMPLE_TYPE_FLOAT32 -#define SOUNDTOUCH_DISABLE_X86_OPTIMIZATIONS 1 -#endif -#endif - -#ifndef MOZILLA_PRESUME_MMX -#ifdef MOZ_SAMPLE_TYPE_S16 -#define SOUNDTOUCH_DISABLE_X86_OPTIMIZATIONS 1 -#endif -#endif From 486b737a48e8d043f64be83ed473cc98c9f41342 Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Tue, 24 Feb 2015 19:03:25 -0500 Subject: [PATCH 54/68] Bug 1136389 - Fix qcms num in/out channels mismatch. r=jrmuizel --- gfx/qcms/iccread.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gfx/qcms/iccread.c b/gfx/qcms/iccread.c index c17f1c193e7..77a92585161 100644 --- a/gfx/qcms/iccread.c +++ b/gfx/qcms/iccread.c @@ -547,7 +547,7 @@ static struct lutmABType *read_tag_lutmABType(struct mem_source *src, struct tag } num_in_channels = read_u8(src, offset + 8); - num_out_channels = read_u8(src, offset + 8); + num_out_channels = read_u8(src, offset + 9); if (num_in_channels > MAX_CHANNELS || num_out_channels > MAX_CHANNELS) return NULL; From 8e7100fac44ae9665c172f5439160856cb0f898b Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Mon, 23 Feb 2015 14:09:56 -0500 Subject: [PATCH 55/68] Bug 1135677 - Deal with overflowing rects. r=bas --- gfx/2d/BaseRect.h | 4 ++-- gfx/tests/gtest/TestRect.cpp | 22 ++++++++++++++++++++++ 2 files changed, 24 insertions(+), 2 deletions(-) diff --git a/gfx/2d/BaseRect.h b/gfx/2d/BaseRect.h index 0b6810cfddd..85a1532910a 100644 --- a/gfx/2d/BaseRect.h +++ b/gfx/2d/BaseRect.h @@ -111,8 +111,8 @@ struct BaseRect { Sub result; result.x = std::max(x, aRect.x); result.y = std::max(y, aRect.y); - result.width = std::min(XMost(), aRect.XMost()) - result.x; - result.height = std::min(YMost(), aRect.YMost()) - result.y; + result.width = std::min(x - result.x + width, aRect.x - result.x + aRect.width); + result.height = std::min(y - result.y + height, aRect.y - result.y + aRect.height); if (result.width < 0 || result.height < 0) { result.SizeTo(0, 0); } diff --git a/gfx/tests/gtest/TestRect.cpp b/gfx/tests/gtest/TestRect.cpp index 4d7f3722a67..d98d54b5de0 100644 --- a/gfx/tests/gtest/TestRect.cpp +++ b/gfx/tests/gtest/TestRect.cpp @@ -400,6 +400,25 @@ TestFiniteGfx() return true; } +// We want to test nsRect values that are still in range but where +// the implementation is at risk of overflowing +template +static bool +TestBug1135677() +{ + RectType rect1(1073741344, 1073741344, 1073756696, 1073819936); + RectType rect2(1073741820, 1073741820, 14400, 77640); + RectType dest; + + dest = rect1.Intersect(rect2); + + EXPECT_TRUE(dest.x == 1073741820 && dest.y == 1073741820 && + dest.width == 14400 && dest.height == 77640) << + "[1] Operation should not overflow internally."; + + return true; +} + TEST(Gfx, nsRect) { TestConstructors(); TestEqualityOperator(); @@ -407,6 +426,7 @@ TEST(Gfx, nsRect) { TestIntersects(); TestIntersection(); TestUnion(); + TestBug1135677(); } TEST(Gfx, nsIntRect) { @@ -416,6 +436,7 @@ TEST(Gfx, nsIntRect) { TestIntersects(); TestIntersection(); TestUnion(); + TestBug1135677(); } TEST(Gfx, gfxRect) { @@ -425,5 +446,6 @@ TEST(Gfx, gfxRect) { TestIntersects(); TestIntersection(); TestUnion(); + TestBug1135677(); TestFiniteGfx(); } From cd2be197a6e1303981f30e4a1c80094bf5f687b7 Mon Sep 17 00:00:00 2001 From: Benoit Girard Date: Wed, 18 Feb 2015 15:27:40 -0500 Subject: [PATCH 56/68] Bug 1134762 - Clean-up UseFastPath logic to avoid OOM error. r=kats --- gfx/layers/client/ClientTiledPaintedLayer.cpp | 71 ++++++++++--------- gfx/layers/client/ClientTiledPaintedLayer.h | 7 ++ gfx/thebes/gfxPrefs.h | 2 +- layout/base/crashtests/crashtests.list | 2 +- 4 files changed, 48 insertions(+), 34 deletions(-) diff --git a/gfx/layers/client/ClientTiledPaintedLayer.cpp b/gfx/layers/client/ClientTiledPaintedLayer.cpp index da0ff3cd4a8..25c58a870ac 100644 --- a/gfx/layers/client/ClientTiledPaintedLayer.cpp +++ b/gfx/layers/client/ClientTiledPaintedLayer.cpp @@ -219,6 +219,12 @@ ClientTiledPaintedLayer::IsScrollingOnCompositor(const FrameMetrics& aParentMetr bool ClientTiledPaintedLayer::UseFastPath() { + // The fast path doesn't allow rendering at low resolution. It will draw the low-res + // area at full resolution and cause OOM. + if (gfxPrefs::UseLowPrecisionBuffer()) { + return false; + } + LayerMetricsWrapper scrollAncestor; GetAncestorLayers(&scrollAncestor, nullptr); if (!scrollAncestor) { @@ -227,16 +233,35 @@ ClientTiledPaintedLayer::UseFastPath() const FrameMetrics& parentMetrics = scrollAncestor.Metrics(); bool multipleTransactionsNeeded = gfxPlatform::GetPlatform()->UseProgressivePaint() - || gfxPrefs::UseLowPrecisionBuffer() || !parentMetrics.GetCriticalDisplayPort().IsEmpty(); bool isFixed = GetIsFixedPosition() || GetParent()->GetIsFixedPosition(); bool isScrollable = parentMetrics.IsScrollable(); - return !multipleTransactionsNeeded || isFixed || !isScrollable -#if !defined(MOZ_WIDGET_ANDROID) || defined(MOZ_ANDROID_APZ) - || !IsScrollingOnCompositor(parentMetrics) + return !multipleTransactionsNeeded || isFixed || !isScrollable; +} + +bool +ClientTiledPaintedLayer::UseProgressiveDraw() { + // Don't draw progressively in a reftest scenario (that's what the HasShadowTarget() check is for). + if (!gfxPlatform::GetPlatform()->UseProgressivePaint() || ClientManager()->HasShadowTarget()) { + return false; + } + + // XXX We probably want to disable progressive drawing for non active APZ layers in the future + // but we should wait for a proper test case before making this change. + +#if 0 //!defined(MOZ_WIDGET_ANDROID) || defined(MOZ_ANDROID_APZ) + LayerMetricsWrapper scrollAncestor; + GetAncestorLayers(&scrollAncestor, nullptr); + if (!scrollAncestor) { + return true; + } + const FrameMetrics& parentMetrics = scrollAncestor.Metrics(); + + return !IsScrollingOnCompositor(parentMetrics); +#else + return true; #endif - ; } bool @@ -251,10 +276,8 @@ ClientTiledPaintedLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion, return false; } - // Only draw progressively when the resolution is unchanged, and we're not - // in a reftest scenario (that's what the HasShadowManager() check is for). - if (gfxPlatform::GetPlatform()->UseProgressivePaint() && - !ClientManager()->HasShadowTarget() && + // Only draw progressively when the resolution is unchanged + if (UseProgressiveDraw() && mContentClient->mTiledBuffer.GetFrameResolution() == mPaintData.mResolution) { // Store the old valid region, then clear it before painting. // We clip the old valid region to the visible region, as it only gets @@ -418,36 +441,20 @@ ClientTiledPaintedLayer::RenderLayer() ToClientLayer(GetMaskLayer())->RenderLayer(); } - // For more complex cases we need to calculate a bunch of metrics before we - // can do the paint. - BeginPaint(); - if (mPaintData.mPaintFinished) { - return; - } - // In some cases we can take a fast path and just be done with it. if (UseFastPath()) { TILING_LOG("TILING %p: Taking fast-path\n", this); mValidRegion = neededRegion; - - // Make sure that tiles that fall outside of the visible region or outside of the - // critical displayport are discarded on the first update. Also make sure that we - // only draw stuff inside the critical displayport on the first update. - if (!mPaintData.mCriticalDisplayPort.IsEmpty()) { - mValidRegion.And(mValidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort)); - invalidRegion.And(invalidRegion, LayerIntRect::ToUntyped(mPaintData.mCriticalDisplayPort)); - } - - if (invalidRegion.IsEmpty()) { - EndPaint(); - return; - } - - mContentClient->mTiledBuffer.SetFrameResolution(mPaintData.mResolution); mContentClient->mTiledBuffer.PaintThebes(mValidRegion, invalidRegion, callback, data); ClientManager()->Hold(this); mContentClient->UseTiledLayerBuffer(TiledContentClient::TILED_BUFFER); - EndPaint(); + return; + } + + // For more complex cases we need to calculate a bunch of metrics before we + // can do the paint. + BeginPaint(); + if (mPaintData.mPaintFinished) { return; } diff --git a/gfx/layers/client/ClientTiledPaintedLayer.h b/gfx/layers/client/ClientTiledPaintedLayer.h index de937a1fd60..cbb6fc61910 100644 --- a/gfx/layers/client/ClientTiledPaintedLayer.h +++ b/gfx/layers/client/ClientTiledPaintedLayer.h @@ -106,6 +106,13 @@ private: */ bool IsScrollingOnCompositor(const FrameMetrics& aParentMetrics); + /** + * Check if we should use progressive draw on this layer. We will + * disable progressive draw based on a preference or if the layer + * is not being scrolled. + */ + bool UseProgressiveDraw(); + /** * Helper function to do the high-precision paint. * This function returns true if it updated the paint buffer. diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h index 8f672f20a21..a72c56f943d 100644 --- a/gfx/thebes/gfxPrefs.h +++ b/gfx/thebes/gfxPrefs.h @@ -312,7 +312,7 @@ private: DECL_GFX_PREF(Once, "layers.d3d11.force-warp", LayersD3D11ForceWARP, bool, false); DECL_GFX_PREF(Once, "layers.prefer-d3d9", LayersPreferD3D9, bool, false); DECL_GFX_PREF(Once, "layers.prefer-opengl", LayersPreferOpenGL, bool, false); - DECL_GFX_PREF(Once, "layers.progressive-paint", ProgressivePaintDoNotUseDirectly, bool, false); + DECL_GFX_PREF(Live, "layers.progressive-paint", ProgressivePaintDoNotUseDirectly, bool, false); DECL_GFX_PREF(Once, "layers.uniformity-info", UniformityInfo, bool, false); DECL_GFX_PREF(Once, "layers.gralloc.disable", DisableGralloc, bool, false); diff --git a/layout/base/crashtests/crashtests.list b/layout/base/crashtests/crashtests.list index 7588c3ed7b9..50e5885131b 100644 --- a/layout/base/crashtests/crashtests.list +++ b/layout/base/crashtests/crashtests.list @@ -433,7 +433,7 @@ load 835056.html load 836990-1.html load 840480.html load 847242.html -load 852293.html +pref(layers.progressive-paint,false) pref(layers.low-precision-buffer,false) load 852293.html load 860579-1.html pref(layers.force-active,true) load 859526-1.html pref(layers.force-active,true) load 859630-1.html From 5ddf815a31b6aa68af9781e34fa83c56fb3e0b1e Mon Sep 17 00:00:00 2001 From: Gregory Szorc Date: Tue, 24 Feb 2015 13:05:59 -0800 Subject: [PATCH 57/68] Bug 1134072 - Support for sub-contexts; r=glandium As content in moz.build files has grown, it has become clear that storing everything in one global namespace (the "context") per moz.build file will not scale. This approach (which is carried over from Makefile.in patterns) limits our ability to do things like declare multiple instances of things (like libraries) per file. A few months ago, templates were introduced to moz.build files. These started the process of introducing separate contexts / containers in each moz.build file. But it stopped short of actually emitting multiple contexts per container. Instead, results were merged with the main context. This patch takes sub-contexts to the next level. Introduced is the "SubContext" class. It is a Context derived from another context. SubContexts are special in that they are context managers. With the context manager is entered, the SubContext becomes the main context associated with the executing sandbox, temporarily masking the existence of the main context. This means that UPPERCASE variable accesses and writes will be handled by the active SubContext. This allows SubContext instances to define different sets of variables. When a SubContext is spawned, it is attached to the sandbox executing it. The moz.build reader will now emit not only the main context, but also every SubContext that was derived from it. To aid with the creation and declaration of sub-contexts, we introduce the SUBCONTEXTS variable. This variable holds a list of classes that define sub-contexts. Sub-contexts behave a lot like templates. Their class names becomes the symbol name in the sandbox. --- python/mozbuild/mozbuild/frontend/context.py | 61 +++++++++++++++++-- python/mozbuild/mozbuild/frontend/reader.py | 18 +++++- python/mozbuild/mozbuild/frontend/sandbox.py | 38 +++++++++++- python/mozbuild/mozbuild/sphinx.py | 15 +++++ .../mozbuild/test/frontend/test_context.py | 7 +++ 5 files changed, 130 insertions(+), 9 deletions(-) diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py index f4265334659..28abf734dfd 100644 --- a/python/mozbuild/mozbuild/frontend/context.py +++ b/python/mozbuild/mozbuild/frontend/context.py @@ -60,11 +60,11 @@ class Context(KeyedDefaultDict): lots of empty/default values, you have a data structure with only the values that were read or touched. - Instances of variables classes are created by invoking class_name(), - except when class_name derives from ContextDerivedValue, in which - case class_name(instance_of_the_context) is invoked. - A value is added to those calls when instances are created during - assignment (setitem). + Instances of variables classes are created by invoking ``class_name()``, + except when class_name derives from ``ContextDerivedValue`` or + ``SubContext``, in which case ``class_name(instance_of_the_context)`` or + ``class_name(self)`` is invoked. A value is added to those calls when + instances are created during assignment (setitem). allowed_variables is a dict of the variables that can be set and read in this context instance. Keys in this dict are the strings representing keys @@ -84,6 +84,7 @@ class Context(KeyedDefaultDict): self._all_paths = [] self.config = config self.execution_time = 0 + self._sandbox = None KeyedDefaultDict.__init__(self, self._factory) def push_source(self, path): @@ -272,6 +273,35 @@ class TemplateContext(Context): return Context._validate(self, key, value, True) +class SubContext(Context, ContextDerivedValue): + """A Context derived from another Context. + + Sub-contexts are intended to be used as context managers. + + Sub-contexts inherit paths and other relevant state from the parent + context. + """ + def __init__(self, parent): + assert isinstance(parent, Context) + + Context.__init__(self, allowed_variables=self.VARIABLES, + config=parent.config) + + # Copy state from parent. + for p in parent.source_stack: + self.push_source(p) + self._sandbox = parent._sandbox + + def __enter__(self): + if not self._sandbox or self._sandbox() is None: + raise Exception('a sandbox is required') + + self._sandbox().push_subcontext(self) + + def __exit__(self, exc_type, exc_value, traceback): + self._sandbox().pop_subcontext(self) + + class FinalTargetValue(ContextDerivedValue, unicode): def __new__(cls, context, value=""): if not value: @@ -366,6 +396,27 @@ def ContextDerivedTypedList(type, base_class=List): return _TypedList +# This defines functions that create sub-contexts. +# +# Values are classes that are SubContexts. The class name will be turned into +# a function that when called emits an instance of that class. +# +# Arbitrary arguments can be passed to the class constructor. The first +# argument is always the parent context. It is up to each class to perform +# argument validation. +SUBCONTEXTS = [ +] + +for cls in SUBCONTEXTS: + if not issubclass(cls, SubContext): + raise ValueError('SUBCONTEXTS entry not a SubContext class: %s' % cls) + + if not hasattr(cls, 'VARIABLES'): + raise ValueError('SUBCONTEXTS entry does not have VARIABLES: %s' % cls) + +SUBCONTEXTS = {cls.__name__: cls for cls in SUBCONTEXTS} + + # This defines the set of mutable global variables. # # Each variable is a tuple of: diff --git a/python/mozbuild/mozbuild/frontend/reader.py b/python/mozbuild/mozbuild/frontend/reader.py index 6e7d32ae38b..330bab3d6dc 100644 --- a/python/mozbuild/mozbuild/frontend/reader.py +++ b/python/mozbuild/mozbuild/frontend/reader.py @@ -62,6 +62,7 @@ from .context import ( VARIABLES, DEPRECATION_HINTS, SPECIAL_VARIABLES, + SUBCONTEXTS, TemplateContext, ) @@ -140,12 +141,14 @@ class MozbuildSandbox(Sandbox): return SPECIAL_VARIABLES[key][0](self._context) if key in FUNCTIONS: return self._create_function(FUNCTIONS[key]) + if key in SUBCONTEXTS: + return self._create_subcontext(SUBCONTEXTS[key]) if key in self.templates: return self._create_template_function(self.templates[key]) return Sandbox.__getitem__(self, key) def __setitem__(self, key, value): - if key in SPECIAL_VARIABLES or key in FUNCTIONS: + if key in SPECIAL_VARIABLES or key in FUNCTIONS or key in SUBCONTEXTS: raise KeyError() if key in self.exports: self._context[key] = value @@ -310,6 +313,14 @@ class MozbuildSandbox(Sandbox): self.templates[name] = func, code, self._context.current_path + @memoize + def _create_subcontext(self, cls): + """Return a function object that creates SubContext instances.""" + def fn(*args, **kwargs): + return cls(self._context, *args, **kwargs) + + return fn + @memoize def _create_function(self, function_def): """Returns a function object for use within the sandbox for the given @@ -1003,11 +1014,12 @@ class BuildReader(object): for gyp_context in gyp_contexts: context['DIRS'].append(mozpath.relpath(gyp_context.objdir, context.objdir)) + sandbox.subcontexts.append(gyp_context) yield context - for gyp_context in gyp_contexts: - yield gyp_context + for subcontext in sandbox.subcontexts: + yield subcontext # Traverse into referenced files. diff --git a/python/mozbuild/mozbuild/frontend/sandbox.py b/python/mozbuild/mozbuild/frontend/sandbox.py index ead4605dfa5..c793d400404 100644 --- a/python/mozbuild/mozbuild/frontend/sandbox.py +++ b/python/mozbuild/mozbuild/frontend/sandbox.py @@ -22,6 +22,7 @@ from __future__ import unicode_literals import copy import os import sys +import weakref from contextlib import contextmanager @@ -116,12 +117,22 @@ class Sandbox(dict): assert isinstance(self._builtins, ReadOnlyDict) assert isinstance(context, Context) - self._context = context + # Contexts are modeled as a stack because multiple context managers + # may be active. + self._active_contexts = [context] + + # Seen sub-contexts. Will be populated with other Context instances + # that were related to execution of this instance. + self.subcontexts = [] # We need to record this because it gets swallowed as part of # evaluation. self._last_name_error = None + @property + def _context(self): + return self._active_contexts[-1] + def exec_file(self, path): """Execute code at a path in the sandbox. @@ -153,6 +164,9 @@ class Sandbox(dict): if path: self._context.push_source(path) + old_sandbox = self._context._sandbox + self._context._sandbox = weakref.ref(self) + # We don't have to worry about bytecode generation here because we are # too low-level for that. However, we could add bytecode generation via # the marshall module if parsing performance were ever an issue. @@ -190,9 +204,31 @@ class Sandbox(dict): raise SandboxExecutionError(self._context.source_stack, exc[0], exc[1], exc[2]) finally: + self._context._sandbox = old_sandbox if path: self._context.pop_source() + def push_subcontext(self, context): + """Push a SubContext onto the execution stack. + + When called, the active context will be set to the specified context, + meaning all variable accesses will go through it. We also record this + SubContext as having been executed as part of this sandbox. + """ + self._active_contexts.append(context) + if context not in self.subcontexts: + self.subcontexts.append(context) + + def pop_subcontext(self, context): + """Pop a SubContext off the execution stack. + + SubContexts must be pushed and popped in opposite order. This is + validated as part of the function call to ensure proper consumer API + use. + """ + popped = self._active_contexts.pop() + assert popped == context + def __getitem__(self, key): if key.isupper(): try: diff --git a/python/mozbuild/mozbuild/sphinx.py b/python/mozbuild/mozbuild/sphinx.py index 756ac99ce3d..6d73fb40e32 100644 --- a/python/mozbuild/mozbuild/sphinx.py +++ b/python/mozbuild/mozbuild/sphinx.py @@ -101,6 +101,21 @@ def special_reference(v, func, typ, doc): def format_module(m): lines = [] + + for subcontext, cls in sorted(m.SUBCONTEXTS.items()): + lines.extend([ + '.. _mozbuild_subcontext_%s:' % subcontext, + '', + 'Sub-Context: %s' % subcontext, + '=============' + '=' * len(subcontext), + '', + prepare_docstring(cls.__doc__)[0], + '', + ]) + + for k, v in sorted(cls.VARIABLES.items()): + lines.extend(variable_reference(k, *v)) + lines.extend([ 'Variables', '=========', diff --git a/python/mozbuild/mozbuild/test/frontend/test_context.py b/python/mozbuild/mozbuild/test/frontend/test_context.py index 7a1f1d93707..e9698b68d39 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_context.py +++ b/python/mozbuild/mozbuild/test/frontend/test_context.py @@ -11,6 +11,7 @@ from mozbuild.frontend.context import ( Context, FUNCTIONS, SPECIAL_VARIABLES, + SUBCONTEXTS, VARIABLES, ) @@ -256,6 +257,12 @@ class TestSymbols(unittest.TestCase): for func, typ, doc in SPECIAL_VARIABLES.values(): self._verify_doc(doc) + for name, cls in SUBCONTEXTS.items(): + self._verify_doc(cls.__doc__) + + for name, v in cls.VARIABLES.items(): + self._verify_doc(v[2]) + if __name__ == '__main__': main() From c29abd2de8ec2884b0cf997a4547751ddedbcd60 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 25 Feb 2015 15:26:23 +1100 Subject: [PATCH 58/68] Bug 1135535 part 1 - Suppress C4805 unsafe mix type warnings in js/src and mark that warning an error on MSVC. r=luke Suppress warnings: js\src\asmjs/AsmJSModule.cpp(2060) : error C4805: '!=' : unsafe mix of type 'const uint32_t' and type 'bool' in operation js\src\jit/BaselineDebugModeOSR.cpp(650) : error C4805: '==' : unsafe mix of type 'bool' and type 'js::Debugger::IsObserving' in operation js\src\jit/BaselineDebugModeOSR.cpp(670) : error C4805: '==' : unsafe mix of type 'bool' and type 'js::Debugger::IsObserving' in operation js\src\jit/shared/Assembler-x86-shared.h(2434) : error C4805: '|' : unsafe mix of type 'bool' and type 'int' in operation js\src\vm/Debugger.cpp(2042) : error C4805: '==' : unsafe mix of type 'bool' and type 'js::Debugger::IsObserving' in operation js\src\vm/Debugger.cpp(2063) : error C4805: '==' : unsafe mix of type 'bool' and type 'js::Debugger::IsObserving' in operation js\src\vm/ScopeObject.cpp(823) : error C4805: '|' : unsafe mix of type 'int' and type 'bool' in operation js\src\vm/SPSProfiler.cpp(81) : error C4805: '==' : unsafe mix of type 'uint32_t' and type 'bool' in operation --- js/src/moz.build | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/js/src/moz.build b/js/src/moz.build index cc4400d79b6..39a29959d7e 100644 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -494,6 +494,10 @@ if CONFIG['_MSC_VER']: # Prevent floating point errors caused by VC++ optimizations # XXX We should add this to CXXFLAGS, too? CFLAGS += ['-fp:precise'] + # C4805 warns mixing bool with other integral types in computation. + # But given the conversion from bool is specified, and this is a + # pattern widely used in code in js/src, suppress this warning here. + CXXFLAGS += ['-wd4805'] if CONFIG['OS_ARCH'] not in ('WINNT', 'HP-UX'): OS_LIBS += [ From d74250cfc9fecdb605ad1293775da9255c01fd93 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 25 Feb 2015 15:26:23 +1100 Subject: [PATCH 59/68] Bug 1135535 part 2 - Fix C4067 unexpected token in js/src and mark this warning an error on MSVC. r=luke Fix warning: js/src/frontend/Parser.cpp(2571) : error C4067: unexpected tokens following preprocessor directive - expected a newline --- js/src/frontend/Parser.cpp | 2 +- js/src/moz.build | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/js/src/frontend/Parser.cpp b/js/src/frontend/Parser.cpp index 286f2e7538a..172eb200d87 100644 --- a/js/src/frontend/Parser.cpp +++ b/js/src/frontend/Parser.cpp @@ -2568,7 +2568,7 @@ Parser::functionArgsAndBodyGeneric(Node pn, HandleFunction fun, Fu } funbox->bufEnd = pos().begin + 1; } else { -#if not JS_HAS_EXPR_CLOSURES +#if !JS_HAS_EXPR_CLOSURES MOZ_ASSERT(kind == Arrow); #endif if (tokenStream.hadError()) diff --git a/js/src/moz.build b/js/src/moz.build index 39a29959d7e..d9cf4a296f2 100644 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -498,6 +498,7 @@ if CONFIG['_MSC_VER']: # But given the conversion from bool is specified, and this is a # pattern widely used in code in js/src, suppress this warning here. CXXFLAGS += ['-wd4805'] + CXXFLAGS += ['-we4067'] if CONFIG['OS_ARCH'] not in ('WINNT', 'HP-UX'): OS_LIBS += [ From 241d97a7ed5557ce8373663bcda640f45a7625e2 Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 25 Feb 2015 15:26:23 +1100 Subject: [PATCH 60/68] Bug 1135535 part 3 - Fix C4258 definition ignored warnings and mark it an error in js/src on MSVC. r=luke Fix warnings: js\src\vm/UnboxedObject.cpp(212) : error C4258: 'i' : definition from the for loop is ignored; the definition from the enclosing scope is used js\src\vm/UnboxedObject.cpp(209) : definition of 'i' ignored js\src\vm/UnboxedObject.cpp(204) : definition of 'i' used js\src\vm/UnboxedObject.cpp(213) : error C4258: 'i' : definition from the for loop is ignored; the definition from the enclosing scope is used js\src\vm/UnboxedObject.cpp(209) : definition of 'i' ignored js\src\vm/UnboxedObject.cpp(204) : definition of 'i' used --- js/src/moz.build | 2 +- js/src/vm/UnboxedObject.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/js/src/moz.build b/js/src/moz.build index d9cf4a296f2..8207ec0845a 100644 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -498,7 +498,7 @@ if CONFIG['_MSC_VER']: # But given the conversion from bool is specified, and this is a # pattern widely used in code in js/src, suppress this warning here. CXXFLAGS += ['-wd4805'] - CXXFLAGS += ['-we4067'] + CXXFLAGS += ['-we4067', '-we4258'] if CONFIG['OS_ARCH'] not in ('WINNT', 'HP-UX'): OS_LIBS += [ diff --git a/js/src/vm/UnboxedObject.cpp b/js/src/vm/UnboxedObject.cpp index 27e2dc2ebca..7a421d7af79 100644 --- a/js/src/vm/UnboxedObject.cpp +++ b/js/src/vm/UnboxedObject.cpp @@ -248,8 +248,8 @@ UnboxedLayout::makeNativeGroup(JSContext *cx, ObjectGroup *group) TypeSet::TypeList types; if (!property->types.enumerateTypes(&types)) return false; - for (size_t i = 0; i < types.length(); i++) - AddTypePropertyId(cx, nativeGroup, property->id, types[i]); + for (size_t j = 0; j < types.length(); j++) + AddTypePropertyId(cx, nativeGroup, property->id, types[j]); HeapTypeSet *nativeProperty = nativeGroup->maybeGetProperty(property->id); if (nativeProperty->canSetDefinite(i)) nativeProperty->setDefinite(i); From 6299c8640fc835cf162cedb54d2702dbd60322fe Mon Sep 17 00:00:00 2001 From: Xidorn Quan Date: Wed, 25 Feb 2015 15:26:23 +1100 Subject: [PATCH 61/68] Bug 1135535 part 4 - Fix C4275 dll-interface warning and mark this warning as error in js/src on MSVC. r=luke Fix warning: js\src\jswrapper.h(58) : error C4275: non dll-interface class 'js::DirectProxyHandler' used as base for dll-interface class 'js::Wrapper' obj-firefox\dist\include\js/Proxy.h(358) : see declaration of 'js::DirectProxyHandler' js\src\jswrapper.h(57) : see declaration of 'js::Wrapper' --- js/public/Proxy.h | 2 +- js/src/moz.build | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/js/public/Proxy.h b/js/public/Proxy.h index 8ccedfaad93..1fad5618a73 100644 --- a/js/public/Proxy.h +++ b/js/public/Proxy.h @@ -355,7 +355,7 @@ class JS_FRIEND_API(BaseProxyHandler) * to add an override in CrossCompartmentWrapper. If you don't, you risk * compartment mismatches. See bug 945826 comment 0. */ -class JS_PUBLIC_API(DirectProxyHandler) : public BaseProxyHandler +class JS_FRIEND_API(DirectProxyHandler) : public BaseProxyHandler { public: explicit MOZ_CONSTEXPR DirectProxyHandler(const void *aFamily, bool aHasPrototype = false, diff --git a/js/src/moz.build b/js/src/moz.build index 8207ec0845a..c3223ec9173 100644 --- a/js/src/moz.build +++ b/js/src/moz.build @@ -498,7 +498,7 @@ if CONFIG['_MSC_VER']: # But given the conversion from bool is specified, and this is a # pattern widely used in code in js/src, suppress this warning here. CXXFLAGS += ['-wd4805'] - CXXFLAGS += ['-we4067', '-we4258'] + CXXFLAGS += ['-we4067', '-we4258', '-we4275'] if CONFIG['OS_ARCH'] not in ('WINNT', 'HP-UX'): OS_LIBS += [ From 4f357b459f3df779dfbacc3a707fdc53f635473c Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Tue, 24 Feb 2015 18:34:16 -0500 Subject: [PATCH 62/68] Bug 1134891 - Make the print progress dialog for Windows and Linux be opened by the browser window's nsIDOMWindow instead of the content window. r=smaug. --- .../printingui/unixshared/nsPrintProgress.cpp | 31 ++++++++++++++++--- .../printingui/win/nsPrintProgress.cpp | 29 ++++++++++++++--- 2 files changed, 52 insertions(+), 8 deletions(-) diff --git a/embedding/components/printingui/unixshared/nsPrintProgress.cpp b/embedding/components/printingui/unixshared/nsPrintProgress.cpp index 3df417c84e1..66f04b5cd2f 100644 --- a/embedding/components/printingui/unixshared/nsPrintProgress.cpp +++ b/embedding/components/printingui/unixshared/nsPrintProgress.cpp @@ -6,10 +6,16 @@ #include "nsPrintProgress.h" #include "nsIBaseWindow.h" +#include "nsIDocShell.h" +#include "nsIDocShellTreeOwner.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsISupportsArray.h" +#include "nsIXULWindow.h" #include "nsXPCOM.h" #include "nsISupportsPrimitives.h" #include "nsIComponentManager.h" +#include "nsPIDOMWindow.h" + NS_IMPL_ADDREF(nsPrintProgress) NS_IMPL_RELEASE(nsPrintProgress) @@ -71,12 +77,29 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent, array->AppendElement(parameters); + // We will set the opener of the dialog to be the nsIDOMWindow for the + // browser XUL window itself, as opposed to the content. That way, the + // progress window has access to the opener. + nsCOMPtr pParentWindow = do_QueryInterface(parent); + NS_ENSURE_STATE(pParentWindow); + + nsCOMPtr docShell = pParentWindow->GetDocShell(); + NS_ENSURE_STATE(docShell); + + nsCOMPtr owner; + docShell->GetTreeOwner(getter_AddRefs(owner)); + + nsCOMPtr ownerXULWindow = do_GetInterface(owner); + nsCOMPtr ownerWindow = do_GetInterface(ownerXULWindow); + NS_ENSURE_STATE(ownerWindow); + // Open the dialog. nsCOMPtr newWindow; - rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), - NS_LITERAL_STRING("_blank"), - NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), - array, getter_AddRefs(newWindow)); + + rv = ownerWindow->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), + NS_LITERAL_STRING("_blank"), + NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), + array, getter_AddRefs(newWindow)); } return rv; diff --git a/embedding/components/printingui/win/nsPrintProgress.cpp b/embedding/components/printingui/win/nsPrintProgress.cpp index d711bddb132..1edb75b45f7 100644 --- a/embedding/components/printingui/win/nsPrintProgress.cpp +++ b/embedding/components/printingui/win/nsPrintProgress.cpp @@ -6,11 +6,16 @@ #include "nsPrintProgress.h" #include "nsIBaseWindow.h" +#include "nsIDocShell.h" +#include "nsIDocShellTreeOwner.h" +#include "nsIInterfaceRequestorUtils.h" #include "nsISupportsArray.h" +#include "nsIXULWindow.h" #include "nsXPCOM.h" #include "nsISupportsPrimitives.h" #include "nsIComponentManager.h" #include "nsIServiceManager.h" +#include "nsPIDOMWindow.h" #if 0 NS_IMPL_ADDREF(nsPrintProgress) @@ -100,12 +105,28 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent, array->AppendElement(parameters); + // We will set the opener of the dialog to be the nsIDOMWindow for the + // browser XUL window itself, as opposed to the content. That way, the + // progress window has access to the opener. + nsCOMPtr pParentWindow = do_QueryInterface(parent); + NS_ENSURE_STATE(pParentWindow); + + nsCOMPtr docShell = pParentWindow->GetDocShell(); + NS_ENSURE_STATE(docShell); + + nsCOMPtr owner; + docShell->GetTreeOwner(getter_AddRefs(owner)); + + nsCOMPtr ownerXULWindow = do_GetInterface(owner); + nsCOMPtr ownerWindow = do_GetInterface(ownerXULWindow); + NS_ENSURE_STATE(ownerWindow); + // Open the dialog. nsCOMPtr newWindow; - rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), - NS_LITERAL_STRING("_blank"), - NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), - array, getter_AddRefs(newWindow)); + rv = ownerWindow->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), + NS_LITERAL_STRING("_blank"), + NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), + array, getter_AddRefs(newWindow)); } return rv; From b3755913747016e1f143b512d3a6c6a0b5605eff Mon Sep 17 00:00:00 2001 From: Mike Conley Date: Mon, 23 Feb 2015 18:01:52 -0500 Subject: [PATCH 63/68] Bug 1134891 - Print progress code paths for OS X should be unreachable. r=trivial. These code paths should never be reached, since nsPrintingPromptService returns NS_ERROR_NOT_IMPLEMENTED for ShowProgress. Bug 1135901 has been filed to remove this dead code entirely. --- .../printingui/mac/nsPrintProgress.cpp | 54 ++++--------------- 1 file changed, 10 insertions(+), 44 deletions(-) diff --git a/embedding/components/printingui/mac/nsPrintProgress.cpp b/embedding/components/printingui/mac/nsPrintProgress.cpp index a35b21a5157..29c52daf688 100644 --- a/embedding/components/printingui/mac/nsPrintProgress.cpp +++ b/embedding/components/printingui/mac/nsPrintProgress.cpp @@ -42,55 +42,21 @@ NS_IMETHODIMP nsPrintProgress::OpenProgressDialog(nsIDOMWindow *parent, nsIObserver *openDialogObserver, bool *notifyOnOpen) { - m_observer = openDialogObserver; - - nsresult rv = NS_ERROR_FAILURE; - - if (m_dialog) - return NS_ERROR_ALREADY_INITIALIZED; - - if (!dialogURL || !*dialogURL) - return NS_ERROR_INVALID_ARG; - - if (parent) - { - // Set up window.arguments[0]... - nsCOMPtr array; - rv = NS_NewISupportsArray(getter_AddRefs(array)); - NS_ENSURE_SUCCESS(rv, rv); - - nsCOMPtr ifptr = - do_CreateInstance(NS_SUPPORTS_INTERFACE_POINTER_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, rv); - - ifptr->SetData(static_cast(this)); - ifptr->SetDataIID(&NS_GET_IID(nsIPrintProgress)); - - array->AppendElement(ifptr); - - array->AppendElement(parameters); - - // Open the dialog. - nsCOMPtr newWindow; - rv = parent->OpenDialog(NS_ConvertASCIItoUTF16(dialogURL), - NS_LITERAL_STRING("_blank"), - NS_LITERAL_STRING("chrome,titlebar,dependent,centerscreen"), - array, getter_AddRefs(newWindow)); - if (NS_SUCCEEDED(rv)) { - *notifyOnOpen = true; - } - } - - return rv; + MOZ_ASSERT_UNREACHABLE("The nsPrintingPromptService::ShowProgress " + "implementation for OS X returns " + "NS_ERROR_NOT_IMPLEMENTED, so we should never get " + "here."); + return NS_ERROR_NOT_IMPLEMENTED; } /* void closeProgressDialog (in boolean forceClose); */ NS_IMETHODIMP nsPrintProgress::CloseProgressDialog(bool forceClose) { - m_closeProgress = true; - // XXX Casting bool to nsresult - return OnStateChange(nullptr, nullptr, nsIWebProgressListener::STATE_STOP, - static_cast(forceClose)); + MOZ_ASSERT_UNREACHABLE("The nsPrintingPromptService::ShowProgress " + "implementation for OS X returns " + "NS_ERROR_NOT_IMPLEMENTED, so we should never get " + "here."); + return NS_ERROR_NOT_IMPLEMENTED; } /* nsIPrompt GetPrompter (); */ From 2138def09bfe685962e90969194f8cdc1541adbc Mon Sep 17 00:00:00 2001 From: Timothy Nikkel Date: Tue, 24 Feb 2015 22:59:43 -0600 Subject: [PATCH 64/68] Bug 1102896. Save and restore the subpixel AA settings of the draw target when drawing an inactive layer manager so they don't get clobbered. r=mattwoodrow --- layout/base/FrameLayerBuilder.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index fc22b419dcd..bdee546dd26 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -4319,9 +4319,8 @@ FrameLayerBuilder::PaintItems(nsTArray& aItems, float aXScale, float aYScale, int32_t aCommonClipCount) { -#ifdef MOZ_DUMP_PAINTING DrawTarget& aDrawTarget = *aRC->GetDrawTarget(); -#endif + int32_t appUnitsPerDevPixel = aPresContext->AppUnitsPerDevPixel(); nsRect boundRect = aRect.ToAppUnits(appUnitsPerDevPixel); boundRect.MoveBy(NSIntPixelsToAppUnits(aOffset.x, appUnitsPerDevPixel), @@ -4371,7 +4370,9 @@ FrameLayerBuilder::PaintItems(nsTArray& aItems, } if (cdi->mInactiveLayerManager) { + bool saved = aDrawTarget.GetPermitSubpixelAA(); PaintInactiveLayer(aBuilder, cdi->mInactiveLayerManager, cdi->mItem, aContext, aRC); + aDrawTarget.SetPermitSubpixelAA(saved); } else { nsIFrame* frame = cdi->mItem->Frame(); frame->AddStateBits(NS_FRAME_PAINTED_THEBES); From 5a0c258a720278d76a1aa6c70141dc15afb3086f Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 24 Feb 2015 21:05:07 -0800 Subject: [PATCH 65/68] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/486d81584dd6 Author: Kevin Grandon Desc: Merge pull request #28428 from KevinGrandon/bug_1136370_pseudo_locales_in_eng_builds Bug 1136370 - Enable pseudolocales by default for eng builds ======== https://hg.mozilla.org/integration/gaia-central/rev/326add93ec86 Author: Kevin Grandon Desc: Bug 1136370 - Enable pseudolocales by default for eng builds --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 6b0a3936c8c..1b403a54733 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "e4a5a54c0891a1cc964b2d94918408f2625c7aaa", + "git_revision": "3a57533fa8a6cbc4c99409103efeff211a838d04", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "b70c6689d3ded57b3dd70c77b42427e7b77b81ea", + "revision": "486d81584dd63eaea78189928725e3f82f77ebfd", "repo_path": "integration/gaia-central" } From 8fab2cbb0edb35db8953c0bab01207234a12c673 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 24 Feb 2015 21:07:32 -0800 Subject: [PATCH 66/68] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index 89f265a8f88..aa4da1e29a3 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 153fb1dcd0e..80a843e72a5 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 3571385d194..0ce0abf3a06 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index fd52972b518..87ffdcf9ec2 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 153fb1dcd0e..80a843e72a5 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index 7b8fc6a4ceb..cd8e9a25bbd 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 2ab47cca30b..3a8ab87333c 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index 0bc155ef124..e23a1e3b51e 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 86b50aab587..3b03689a207 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - + From 10c86c5dc0d5a6c7204982bd17378cf979fc51fb Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 24 Feb 2015 21:31:46 -0800 Subject: [PATCH 67/68] Bumping gaia.json for 2 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/6b12bdb3c5f2 Author: George Desc: Merge pull request #28245 from cctuan/955997 Bug 955997 - Running webapp-manifests.js on node.js ======== https://hg.mozilla.org/integration/gaia-central/rev/f22390589fdb Author: cctuan Desc: Bug 955997 - Running webapp-manifests.js on node.js, r=ricky --- b2g/config/gaia.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/b2g/config/gaia.json b/b2g/config/gaia.json index 1b403a54733..58e5d7c5d19 100644 --- a/b2g/config/gaia.json +++ b/b2g/config/gaia.json @@ -1,9 +1,9 @@ { "git": { - "git_revision": "3a57533fa8a6cbc4c99409103efeff211a838d04", + "git_revision": "cc235a867161e0000ea55a4f009b3be19021f066", "remote": "https://git.mozilla.org/releases/gaia.git", "branch": "" }, - "revision": "486d81584dd63eaea78189928725e3f82f77ebfd", + "revision": "6b12bdb3c5f22c6ec98bd43cdcae2d0a6d6a0d1e", "repo_path": "integration/gaia-central" } From d85a3d1c7c41c3c247690b2e4980e9028a61cb63 Mon Sep 17 00:00:00 2001 From: B2G Bumper Bot Date: Tue, 24 Feb 2015 21:34:15 -0800 Subject: [PATCH 68/68] Bumping manifests a=b2g-bump --- b2g/config/dolphin/sources.xml | 2 +- b2g/config/emulator-ics/sources.xml | 2 +- b2g/config/emulator-jb/sources.xml | 2 +- b2g/config/emulator-kk/sources.xml | 2 +- b2g/config/emulator/sources.xml | 2 +- b2g/config/flame-kk/sources.xml | 2 +- b2g/config/flame/sources.xml | 2 +- b2g/config/nexus-4/sources.xml | 2 +- b2g/config/nexus-5-l/sources.xml | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/b2g/config/dolphin/sources.xml b/b2g/config/dolphin/sources.xml index aa4da1e29a3..04331556e5a 100644 --- a/b2g/config/dolphin/sources.xml +++ b/b2g/config/dolphin/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator-ics/sources.xml b/b2g/config/emulator-ics/sources.xml index 80a843e72a5..cecb677005f 100644 --- a/b2g/config/emulator-ics/sources.xml +++ b/b2g/config/emulator-ics/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/emulator-jb/sources.xml b/b2g/config/emulator-jb/sources.xml index 0ce0abf3a06..8155f1cf895 100644 --- a/b2g/config/emulator-jb/sources.xml +++ b/b2g/config/emulator-jb/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/emulator-kk/sources.xml b/b2g/config/emulator-kk/sources.xml index 87ffdcf9ec2..16fbdaf197d 100644 --- a/b2g/config/emulator-kk/sources.xml +++ b/b2g/config/emulator-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/emulator/sources.xml b/b2g/config/emulator/sources.xml index 80a843e72a5..cecb677005f 100644 --- a/b2g/config/emulator/sources.xml +++ b/b2g/config/emulator/sources.xml @@ -19,7 +19,7 @@ - + diff --git a/b2g/config/flame-kk/sources.xml b/b2g/config/flame-kk/sources.xml index cd8e9a25bbd..283f1a19a7f 100644 --- a/b2g/config/flame-kk/sources.xml +++ b/b2g/config/flame-kk/sources.xml @@ -15,7 +15,7 @@ - + diff --git a/b2g/config/flame/sources.xml b/b2g/config/flame/sources.xml index 3a8ab87333c..f964892a2f1 100644 --- a/b2g/config/flame/sources.xml +++ b/b2g/config/flame/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-4/sources.xml b/b2g/config/nexus-4/sources.xml index e23a1e3b51e..303bc1aee78 100644 --- a/b2g/config/nexus-4/sources.xml +++ b/b2g/config/nexus-4/sources.xml @@ -17,7 +17,7 @@ - + diff --git a/b2g/config/nexus-5-l/sources.xml b/b2g/config/nexus-5-l/sources.xml index 3b03689a207..521de3acfba 100644 --- a/b2g/config/nexus-5-l/sources.xml +++ b/b2g/config/nexus-5-l/sources.xml @@ -15,7 +15,7 @@ - +