author Iain Ireland <>
Fri, 11 Jan 2019 18:05:36 +0000
changeset 453523 025feea5945bffc625e9cca2e23be51ee8670315
parent 451030 df01499f9fdf1f10f77e25861736d71eec51f693
child 466816 440350958e77ea77422d48538416a113c1e3d888
permissions -rw-r--r--
Bug 1480390: Move ForOfIterClose logic inside TryNoteIter r=tcampbell This patch was intended to be a pure refactoring of existing code with no side-effects, moving the logic for handling for-of/for-of-iterclose trynotes inside TryNoteIter to avoid duplicating logic in all users of TryNoteIter. However, it turns out that there was a subtle preexisting bug in TryNoteIter that is fixed by the refactoring. Specifically, the logic to skip from a for-of-iterclose to its enclosing for-of must run before the logic to skip trynotes based on stack depth. Otherwise, the stack depth code may filter out the enclosing for-of (see the attached test case for an example) and we will skip too many try-notes. Differential Revision:

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# 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

# Java detection
# ========================================================
option('--with-java-bin-path', nargs=1,
       help='Location of Java binaries (java, jarsigner, keytool)')

@imports(_from='os', _import='environ')
def java_search_paths(path):
    if path:
        # Look for javac and jar in the specified path.
        return path
    # With no path specified, look for javac and jar in $JAVA_HOME (if set)
    # and $PATH.
    if 'JAVA_HOME' in environ:
        return [os.path.join(environ['JAVA_HOME'], 'bin'),
                environ.get('PATH', '')]
    return [environ.get('PATH')]

# Finds the given java tool, failing with a custom error message if we can't
# find it.

def check_java_tool(tool):
    check = check_prog(tool.upper(), (tool,), paths=java_search_paths,

    def require_tool(result):
        if result is None:
            die("The program %s was not found.  Set $JAVA_HOME to your Java "
                "SDK directory or use '--with-java-bin-path={java-bin-dir}'"
                % tool)
        return result

    return require_tool


# Java Code Coverage
# ========================================================
option('--enable-java-coverage', env='MOZ_JAVA_CODE_COVERAGE', help='Enable Java code coverage')

set_config('MOZ_JAVA_CODE_COVERAGE', depends('--enable-java-coverage')(lambda v: bool(v)))