Commit ee02ddae authored by Sebastian Hengst's avatar Sebastian Hengst
Browse files

merge autoland to mozilla-central. r=merge a=merge

parents 678b6b50 52c96296
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -6099,8 +6099,10 @@
              Services.focus.activeWindow)
            window.focus();

          // Don't need to act if the tab is already selected:
          if (tabForEvent.selected)
          // Don't need to act if the tab is already selected or if there isn't
          // a tab for the event (e.g. for the webextensions options_ui remote
          // browsers embedded in the "about:addons" page):
          if (!tabForEvent || tabForEvent.selected)
            return;

          // We always switch tabs for beforeunload tab-modal prompts.
+1 −0
Original line number Diff line number Diff line
@@ -93,6 +93,7 @@ skip-if = (os == 'win' && !debug) # bug 1352668
skip-if = debug || asan # Bug 1354681
[browser_ext_openPanel.js]
[browser_ext_optionsPage_browser_style.js]
[browser_ext_optionsPage_modals.js]
[browser_ext_optionsPage_privileges.js]
[browser_ext_pageAction_context.js]
[browser_ext_pageAction_contextMenu.js]
+94 −0
Original line number Diff line number Diff line
/* -*- Mode: indent-tabs-mode: nil; js-indent-level: 2 -*- */
/* vim: set sts=2 sw=2 et tw=80: */
"use strict";

add_task(async function test_tab_options_modals() {
  function backgroundScript() {
    browser.runtime.openOptionsPage();
  }

  function optionsScript() {
    try {
      alert("WebExtensions OptionsUI Page Modal");

      browser.test.notifyPass("options-ui-modals");
    } catch (error) {
      browser.test.log(`Error: ${error} :: ${error.stack}`);
      browser.test.notifyFail("options-ui-modals");
    }
  }

  let extension = ExtensionTestUtils.loadExtension({
    useAddonManager: "temporary",

    manifest: {
      "permissions": ["tabs"],
      "options_ui": {
        "page": "options.html",
      },
    },
    files: {
      "options.html": `<!DOCTYPE html>
        <html>
          <head>
            <meta charset="utf-8">
            <script src="options.js" type="text/javascript"></script>
          </head>
        </html>`,
      "options.js": optionsScript,
    },
    background: backgroundScript,
  });

  await BrowserTestUtils.openNewForegroundTab(gBrowser, "about:addons");

  await extension.startup();

  const onceModalOpened = new Promise(resolve => {
    const aboutAddonsBrowser = gBrowser.selectedBrowser;

    aboutAddonsBrowser.addEventListener("DOMWillOpenModalDialog", function onModalDialog(event) {
      if (Cu.isCrossProcessWrapper(event.target)) {
        // This event fires in both the content and chrome processes. We
        // want to ignore the one in the content process.
        return;
      }

      aboutAddonsBrowser.removeEventListener("DOMWillOpenModalDialog", onModalDialog, true);
      resolve();
    }, true);
  });

  info("Wait the options_ui modal to be opened");
  await onceModalOpened;

  const optionsBrowser = gBrowser.selectedBrowser.contentDocument
                                 .getElementById("addon-options");

  let stack;

  // For remote extensions, the stack that contains the tabmodalprompt elements
  // is the parent of the extensions options_ui browser element, otherwise it would
  // be the parent of the currently selected tabbrowser's browser.
  if (optionsBrowser.isRemoteBrowser) {
    stack = optionsBrowser.parentNode;
  } else {
    stack = gBrowser.selectedBrowser.parentNode;
  }

  let dialogs = stack.querySelectorAll("tabmodalprompt");

  Assert.equal(dialogs.length, 1, "Expect a tab modal opened for the about addons tab");

  info("Close the tab modal prompt");
  dialogs[0].onButtonClick(0);

  await extension.awaitFinish("options-ui-modals");

  Assert.equal(stack.querySelectorAll("tabmodalprompt").length, 0,
               "Expect the tab modal to be closed");

  await BrowserTestUtils.removeTab(gBrowser.selectedTab);

  await extension.unload();
});
+3 −29
Original line number Diff line number Diff line
@@ -10,7 +10,7 @@ case "$target" in
    dnl $android_platform will be set for us by Python configure.
    CPPFLAGS="-idirafter $android_platform/usr/include $CPPFLAGS"
    CFLAGS="-fno-short-enums -fno-exceptions $CFLAGS"
    CXXFLAGS="-fno-short-enums -fno-exceptions $CXXFLAGS"
    CXXFLAGS="-fno-short-enums -fno-exceptions $CXXFLAGS $stlport_cppflags"
    ASFLAGS="-idirafter $android_platform/usr/include -DANDROID $ASFLAGS"

    dnl Add --allow-shlib-undefined, because libGLESv2 links to an
@@ -57,40 +57,19 @@ AC_DEFUN([MOZ_ANDROID_STLPORT],
[

if test "$OS_TARGET" = "Android"; then
    if test -z "$STLPORT_CPPFLAGS$STLPORT_LIBS"; then
    if test -z "$STLPORT_LIBS"; then
        # android-ndk-r8b and later
        ndk_base="$android_ndk/sources/cxx-stl"
        cxx_base="$ndk_base/llvm-libc++"
        cxx_libs="$cxx_base/libs/$ANDROID_CPU_ARCH"
        cxx_libs="$android_ndk/sources/cxx-stl/llvm-libc++/libs/$ANDROID_CPU_ARCH"
        # NDK r12 removed the arm/thumb library split and just made
        # everything thumb by default.  Attempt to compensate.
        if test "$MOZ_THUMB2" = 1 -a -d "$cxx_libs/thumb"; then
            cxx_libs="$cxx_libs/thumb"
        fi
        cxx_include="$cxx_base/libcxx/include"
        cxxabi_base="$ndk_base/llvm-libc++abi"
        cxxabi_include="$cxxabi_base/libcxxabi/include"

        if ! test -e "$cxx_libs/libc++_static.a"; then
            AC_MSG_ERROR([Couldn't find path to llvm-libc++ in the android ndk])
        fi

        if ! test -e "$cxx_include"; then
            # NDK r13 removes the inner "libcxx" directory.
            cxx_include="$cxx_base/include"
            if ! test -e "$cxx_include"; then
                AC_MSG_ERROR([Couldn't find path to libc++ includes in the android ndk])
            fi
        fi

        if ! test -e "$cxxabi_include"; then
            # NDK r13 removes the inner "libcxxabi" directory.
            cxxabi_include="$cxxabi_base/include"
            if ! test -e "$cxxabi_include"; then
                AC_MSG_ERROR([Couldn't find path to libc++abi includes in the android ndk])
            fi
        fi

        STLPORT_LIBS="-L$cxx_libs -lc++_static"
        # NDK r12 split the libc++ runtime libraries into pieces.
        for lib in c++abi unwind android_support; do
@@ -98,12 +77,7 @@ if test "$OS_TARGET" = "Android"; then
                 STLPORT_LIBS="$STLPORT_LIBS -l${lib}"
            fi
        done
        # Add android/support/include/ for prototyping long double math
        # functions, locale-specific C library functions, multibyte support,
        # etc.
        STLPORT_CPPFLAGS="-I$cxx_include -I$android_ndk/sources/android/support/include -I$cxxabi_include"
    fi
    CXXFLAGS="$CXXFLAGS $STLPORT_CPPFLAGS"
fi
AC_SUBST([STLPORT_LIBS])

+77 −15
Original line number Diff line number Diff line
@@ -23,9 +23,9 @@ js_option('--with-android-version',
          help='android platform version',
          default=min_android_version)

@depends('--with-android-version', min_android_version)
@depends('--with-android-version', min_android_version, '--help')
@imports(_from='__builtin__', _import='ValueError')
def android_version(value, min_version):
def android_version(value, min_version, _):
    if not value:
        # Someone has passed --without-android-version.
        die('--with-android-version cannot be disabled.')
@@ -43,8 +43,10 @@ def android_version(value, min_version):

add_old_configure_assignment('android_version', android_version)

@depends('--with-android-ndk', build_project)
def ndk(value, build_project):
@depends('--with-android-ndk', build_project, '--help')
def ndk(value, build_project, help):
    if help:
        return
    if build_project == 'mobile/android' and not value:
        die('You must specify --with-android-ndk=/path/to/ndk when '
            'building mobile/android')
@@ -95,10 +97,10 @@ def ndk_minor_version(ndk_version):

set_config('ANDROID_NDK_MINOR_VERSION', ndk_minor_version);

@depends(target, android_version, ndk)
@depends(target, android_version, ndk, '--help')
@checking('for android platform directory')
@imports(_from='os.path', _import='isdir')
def android_platform(target, android_version, ndk):
def android_platform(target, android_version, ndk, _):
    if target.os != 'Android':
        return

@@ -138,11 +140,11 @@ def extra_toolchain_flags(platform_dir):
    return ['-idirafter',
            os.path.join(platform_dir, 'usr', 'include')]

@depends(target, host, ndk, '--with-android-toolchain')
@depends(target, host, ndk, '--with-android-toolchain', '--help')
@checking('for the Android toolchain directory', lambda x: x or 'not found')
@imports(_from='os.path', _import='isdir')
@imports(_from='mozbuild.shellutil', _import='quote')
def android_toolchain(target, host, ndk, toolchain):
def android_toolchain(target, host, ndk, toolchain, _):
    if not ndk:
        return
    if toolchain:
@@ -175,14 +177,74 @@ def android_toolchain(target, host, ndk, toolchain):

set_config('ANDROID_TOOLCHAIN', android_toolchain)

@depends(target, android_toolchain)
def android_toolchain_prefix(target, toolchain):
    if toolchain:
@depends(target)
def android_toolchain_prefix_base(target):
    if target.cpu == 'x86':
        # Ideally, the --target should just have the right x86 variant
        # in the first place.
            return '%s/bin/i686-linux-android-' % toolchain
        return '%s/bin/%s-' % (toolchain, target.toolchain)
        return 'i686-linux-android'
    return target.toolchain

@depends(android_toolchain_prefix_base, android_toolchain)
def android_toolchain_prefix(prefix_base, toolchain):
    if toolchain:
        return '%s/bin/%s-' % (toolchain, prefix_base)

imply_option('--with-toolchain-prefix', android_toolchain_prefix,
             reason='--with-android-ndk')

option(env='STLPORT_CPPFLAGS',
       nargs=1,
       help='Options compiler should pass for standard C++ library')

@depends('STLPORT_CPPFLAGS', ndk, '--help')
@imports(_from='os.path', _import='isdir')
def stlport_cppflags(value, ndk, _):
    if value and len(value):
        return value
    if not ndk:
        return

    ndk_base = os.path.join(ndk, 'sources', 'cxx-stl')
    cxx_base = os.path.join(ndk_base, 'llvm-libc++')
    cxx_include = os.path.join(cxx_base, 'libcxx', 'include')
    cxxabi_base = os.path.join(ndk_base, 'llvm-libc++abi')
    cxxabi_include = os.path.join(cxxabi_base, 'libcxxabi', 'include')

    if not isdir(cxx_include):
        # NDK r13 removes the inner "libcxx" directory.
        cxx_include = os.path.join(cxx_base, 'include')
        if not isdir(cxx_include):
            die("Couldn't find path to libc++ includes in the android ndk")

    if not isdir(cxxabi_include):
        # NDK r13 removes the inner "libcxxabi" directory.
        cxxabi_include = os.path.join(cxxabi_base, 'include')
        if not isdir(cxxabi_include):
            die("Couldn't find path to libc++abi includes in the android ndk")

    # Add android/support/include/ for prototyping long double math
    # functions, locale-specific C library functions, multibyte support,
    # etc.
    return "-I%s -I%s -I%s" % (cxx_include,
                               os.path.join(ndk, 'sources', 'android',
                                            'support', 'include'),
                               cxxabi_include)

add_old_configure_assignment('stlport_cppflags', stlport_cppflags)

@depends(stlport_cppflags, android_platform, android_toolchain,
         android_toolchain_prefix_base, '--help')
def bindgen_cflags_defaults(stlport_cppflags, android_platform, toolchain,
                            toolchain_prefix, _):
    if not stlport_cppflags:
        return

    gcc_include = os.path.join(toolchain, 'lib', 'gcc', toolchain_prefix, '4.9')

    cflags_format = "%s -isystem %s -gcc-toolchain %s -I%s -I%s"
    return cflags_format % (stlport_cppflags,
                            os.path.join(android_platform, 'usr', 'include'),
                            toolchain,
                            os.path.join(gcc_include, 'include'),
                            os.path.join(gcc_include, 'include-fixed'))
Loading