author | Carsten "Tomcat" Book <cbook@mozilla.com> |
Tue, 15 Mar 2016 10:43:02 +0100 | |
changeset 288737 | 5e14887312d4523ab59c3f6c6c94a679cf42b496 |
parent 288736 | 4adc4cef81179df18fe4e7e8463e4240aca3ae95 (current diff) |
parent 288710 | a2575708048d15d18c068c88d2fb5a5a30093b08 (diff) |
child 288738 | 7d9d6c06bf9ed5ebb30815c15306069d6fecf11a |
child 288850 | dd0baa33759d1246c7632750a570d085e695b670 |
push id | 73535 |
push user | cbook@mozilla.com |
push date | Tue, 15 Mar 2016 09:44:50 +0000 |
treeherder | mozilla-inbound@7d9d6c06bf9e [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | merge |
milestone | 48.0a1 |
first release with | nightly linux32
5e14887312d4
/
48.0a1
/
20160315030230
/
files
nightly linux64
5e14887312d4
/
48.0a1
/
20160315030230
/
files
nightly mac
5e14887312d4
/
48.0a1
/
20160315030230
/
files
nightly win32
5e14887312d4
/
48.0a1
/
20160315030230
/
files
nightly win64
5e14887312d4
/
48.0a1
/
20160315030230
/
files
|
last release without | nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
|
releases | nightly linux32
48.0a1
/
20160315030230
/
pushlog to previous
nightly linux64
48.0a1
/
20160315030230
/
pushlog to previous
nightly mac
48.0a1
/
20160315030230
/
pushlog to previous
nightly win32
48.0a1
/
20160315030230
/
pushlog to previous
nightly win64
48.0a1
/
20160315030230
/
pushlog to previous
|
--- a/accessible/generic/DocAccessible.cpp +++ b/accessible/generic/DocAccessible.cpp @@ -1386,18 +1386,31 @@ DocAccessible::ProcessInvalidationList() { // Invalidate children of container accessible for each element in // invalidation list. Allow invalidation list insertions while container // children are recached. for (uint32_t idx = 0; idx < mInvalidationList.Length(); idx++) { nsIContent* content = mInvalidationList[idx]; if (!HasAccessible(content)) { Accessible* container = GetContainerAccessible(content); - if (container) - UpdateTreeOnInsertion(container); + if (container) { + TreeWalker walker(container); + if (container->IsAcceptableChild(content) && walker.Seek(content)) { + Accessible* child = + GetAccService()->GetOrCreateAccessible(content, container); + if (child) { + AutoTreeMutation mMut(container); + RefPtr<AccReorderEvent> reorderEvent = + new AccReorderEvent(container); + container->InsertAfter(child, walker.Prev()); + uint32_t flags = UpdateTreeInternal(child, true, reorderEvent); + FireEventsOnInsertion(container, reorderEvent, flags); + } + } + } } } mInvalidationList.Clear(); } Accessible* DocAccessible::GetAccessibleEvenIfNotInMap(nsINode* aNode) const @@ -1825,37 +1838,45 @@ DocAccessible::ProcessContentInserted(Ac MOZ_ASSERT_UNREACHABLE("accessible was rejected"); } #ifdef A11Y_LOG logging::TreeInfo("children after insertion", logging::eVerbose, aContainer); #endif + FireEventsOnInsertion(aContainer, reorderEvent, updateFlags); +} + +void +DocAccessible::FireEventsOnInsertion(Accessible* aContainer, + AccReorderEvent* aReorderEvent, + uint32_t aUpdateFlags) +{ // Content insertion did not cause an accessible tree change. - if (updateFlags == eNoAccessible) { + if (aUpdateFlags == eNoAccessible) { return; } // Check to see if change occurred inside an alert, and fire an EVENT_ALERT // if it did. - if (!(updateFlags & eAlertAccessible) && + if (!(aUpdateFlags & eAlertAccessible) && (aContainer->IsAlert() || aContainer->IsInsideAlert())) { Accessible* ancestor = aContainer; do { if (ancestor->IsAlert()) { FireDelayedEvent(nsIAccessibleEvent::EVENT_ALERT, ancestor); break; } } while ((ancestor = ancestor->Parent())); } MaybeNotifyOfValueChange(aContainer); - FireDelayedEvent(reorderEvent); + FireDelayedEvent(aReorderEvent); } void DocAccessible::UpdateTreeOnInsertion(Accessible* aContainer) { for (uint32_t idx = 0; idx < aContainer->ContentChildCount(); idx++) { Accessible* child = aContainer->ContentChildAt(idx); child->SetSurvivingInUpdate(true);
--- a/accessible/generic/DocAccessible.h +++ b/accessible/generic/DocAccessible.h @@ -182,16 +182,19 @@ public: DocAccessible* GetChildDocumentAt(uint32_t aIndex) const { return mChildDocuments.SafeElementAt(aIndex, nullptr); } /** * Fire accessible event asynchronously. */ void FireDelayedEvent(AccEvent* aEvent); void FireDelayedEvent(uint32_t aEventType, Accessible* aTarget); + void FireEventsOnInsertion(Accessible* aContainer, + AccReorderEvent* aReorderEvent, + uint32_t aUpdateFlags); /** * Fire value change event on the given accessible if applicable. */ void MaybeNotifyOfValueChange(Accessible* aAccessible); /** * Get/set the anchor jump.
--- a/addon-sdk/source/test/test-content-sync-worker.js +++ b/addon-sdk/source/test/test-content-sync-worker.js @@ -901,17 +901,17 @@ exports["test:console method log functio console.log(function foo(bar) { return bar + bar }); self.postMessage(); }, onMessage: () => { assert.deepEqual(logs, [ "function Function() { [native code] }", "(foo) => foo * foo", - "function foo(bar) { \"use strict\"; return bar + bar }" + "function foo(bar) { return bar + bar }" ]); done(); } }); } );
--- a/addon-sdk/source/test/test-content-worker.js +++ b/addon-sdk/source/test/test-content-worker.js @@ -936,17 +936,17 @@ exports["test:console method log functio self.postMessage(); }, onMessage: () => { system.off('console-api-log-event', onMessage); assert.deepEqual(logs, [ "function Function() { [native code] }", "(foo) => foo * foo", - "function foo(bar) { \"use strict\"; return bar + bar }" + "function foo(bar) { return bar + bar }" ]); done(); } }); } );
--- a/b2g/chrome/content/shell.js +++ b/b2g/chrome/content/shell.js @@ -40,17 +40,16 @@ Cu.import('resource://gre/modules/AboutS XPCOMUtils.defineLazyModuleGetter(this, "SystemAppProxy", "resource://gre/modules/SystemAppProxy.jsm"); XPCOMUtils.defineLazyModuleGetter(this, "Screenshot", "resource://gre/modules/Screenshot.jsm"); Cu.import('resource://gre/modules/Webapps.jsm'); -DOMApplicationRegistry.allAppsLaunchable = true; XPCOMUtils.defineLazyServiceGetter(Services, 'env', '@mozilla.org/process/environment;1', 'nsIEnvironment'); XPCOMUtils.defineLazyServiceGetter(Services, 'ss', '@mozilla.org/content/style-sheet-service;1', 'nsIStyleSheetService');
--- a/b2g/components/test/mochitest/test_aboutserviceworkers.html +++ b/b2g/components/test/mochitest/test_aboutserviceworkers.html @@ -199,17 +199,16 @@ function installApp() { } req.onerror = reject; }); } function setup() { info("Setting up"); return new Promise((resolve, reject) => { - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set": [ ["dom.mozBrowserFramesEnabled", true], ["dom.serviceWorkers.exemptFromPerDomainMax", true], ["dom.serviceWorkers.enabled", true], ["dom.serviceWorkers.testing.enabled", true], ]}, () => { SpecialPowers.pushPermissions([ { "type": "webapps-manage", "allow": 1, "context": document },
--- a/b2g/installer/Makefile.in +++ b/b2g/installer/Makefile.in @@ -94,18 +94,18 @@ ifneq (,$(filter WINNT Darwin Android,$( DEFINES += -DMOZ_SHARED_MOZGLUE=1 endif ifneq (,$(filter rtsp,$(NECKO_PROTOCOLS))) DEFINES += -DMOZ_RTSP endif DEFINES += -DMOZ_ICU_VERSION=$(MOZ_ICU_VERSION) -ifdef MOZ_NATIVE_ICU -DEFINES += -DMOZ_NATIVE_ICU +ifdef MOZ_SYSTEM_ICU +DEFINES += -DMOZ_SYSTEM_ICU endif ifdef MOZ_SHARED_ICU DEFINES += -DMOZ_SHARED_ICU endif DEFINES += -DMOZ_ICU_DBG_SUFFIX=$(MOZ_ICU_DBG_SUFFIX) ifdef MOZ_WIDGET_GTK DEFINES += -DMOZ_GTK=1
--- a/b2g/installer/package-manifest.in +++ b/b2g/installer/package-manifest.in @@ -66,17 +66,17 @@ @BINPATH@/@MSVC_C_RUNTIME_DLL@ @BINPATH@/@MSVC_CXX_RUNTIME_DLL@ #endif #if MOZ_PACKAGE_WIN_UCRT_DLLS @BINPATH@/api-ms-win-*.dll @BINPATH@/ucrtbase.dll #endif #endif -#ifndef MOZ_NATIVE_ICU +#ifndef MOZ_SYSTEM_ICU #ifdef MOZ_SHARED_ICU #ifdef XP_WIN @BINPATH@/icudt@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll @BINPATH@/icuin@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll @BINPATH@/icuuc@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll #elif defined(XP_MACOSX) @BINPATH@/libicudata.@MOZ_ICU_VERSION@.dylib @BINPATH@/libicui18n.@MOZ_ICU_VERSION@.dylib
--- a/browser/app/permissions +++ b/browser/app/permissions @@ -9,13 +9,12 @@ # UITour origin uitour 1 https://www.mozilla.org origin uitour 1 https://self-repair.mozilla.org origin uitour 1 https://support.mozilla.org origin uitour 1 about:home # XPInstall origin install 1 https://addons.mozilla.org -origin install 1 https://marketplace.firefox.com # Remote troubleshooting origin remote-troubleshooting 1 https://input.mozilla.org origin remote-troubleshooting 1 https://support.mozilla.org
--- a/browser/installer/Makefile.in +++ b/browser/installer/Makefile.in @@ -26,22 +26,22 @@ endif ifdef MOZ_WIDGET_GTK DEFINES += -DMOZ_GTK=1 ifdef MOZ_ENABLE_GTK3 DEFINES += -DMOZ_GTK3=1 endif endif -ifdef MOZ_NATIVE_NSPR -DEFINES += -DMOZ_NATIVE_NSPR=1 +ifdef MOZ_SYSTEM_NSPR +DEFINES += -DMOZ_SYSTEM_NSPR=1 endif -ifdef MOZ_NATIVE_NSS -DEFINES += -DMOZ_NATIVE_NSS=1 +ifdef MOZ_SYSTEM_NSS +DEFINES += -DMOZ_SYSTEM_NSS=1 endif ifdef NSS_DISABLE_DBM DEFINES += -DNSS_DISABLE_DBM=1 endif DEFINES += -DJAREXT= @@ -113,18 +113,18 @@ LPROJ_ROOT = $(firstword $(subst -, ,$(A ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) ifeq (zh-TW,$(AB_CD)) LPROJ_ROOT := $(subst -,_,$(AB_CD)) endif endif DEFINES += -DLPROJ_ROOT=$(LPROJ_ROOT) DEFINES += -DMOZ_ICU_VERSION=$(MOZ_ICU_VERSION) -ifdef MOZ_NATIVE_ICU -DEFINES += -DMOZ_NATIVE_ICU +ifdef MOZ_SYSTEM_ICU +DEFINES += -DMOZ_SYSTEM_ICU endif ifdef MOZ_SHARED_ICU DEFINES += -DMOZ_SHARED_ICU endif DEFINES += -DMOZ_ICU_DBG_SUFFIX=$(MOZ_ICU_DBG_SUFFIX) ifdef CLANG_CXX DEFINES += -DCLANG_CXX endif
--- a/browser/installer/package-manifest.in +++ b/browser/installer/package-manifest.in @@ -63,17 +63,17 @@ @BINPATH@/@DLL_PREFIX@mozglue@DLL_SUFFIX@ #endif #ifndef MOZ_STATIC_JS @BINPATH@/@DLL_PREFIX@mozjs@DLL_SUFFIX@ #endif #ifdef MOZ_DMD @BINPATH@/@DLL_PREFIX@dmd@DLL_SUFFIX@ #endif -#ifndef MOZ_NATIVE_NSPR +#ifndef MOZ_SYSTEM_NSPR #ifndef MOZ_FOLD_LIBS @BINPATH@/@DLL_PREFIX@nspr4@DLL_SUFFIX@ @BINPATH@/@DLL_PREFIX@plc4@DLL_SUFFIX@ @BINPATH@/@DLL_PREFIX@plds4@DLL_SUFFIX@ #endif #endif #ifdef XP_MACOSX @BINPATH@/XUL @@ -92,17 +92,17 @@ @BINPATH@/@MSVC_C_RUNTIME_DLL@ @BINPATH@/@MSVC_CXX_RUNTIME_DLL@ #endif #if MOZ_PACKAGE_WIN_UCRT_DLLS @BINPATH@/api-ms-win-*.dll @BINPATH@/ucrtbase.dll #endif #endif -#ifndef MOZ_NATIVE_ICU +#ifndef MOZ_SYSTEM_ICU #ifdef MOZ_SHARED_ICU #ifdef XP_WIN @BINPATH@/icudt@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll @BINPATH@/icuin@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll @BINPATH@/icuuc@MOZ_ICU_DBG_SUFFIX@@MOZ_ICU_VERSION@.dll #elif defined(XP_MACOSX) @BINPATH@/libicudata.@MOZ_ICU_VERSION@.dylib @BINPATH@/libicui18n.@MOZ_ICU_VERSION@.dylib @@ -127,17 +127,17 @@ @BINPATH@/@MOZ_APP_NAME@-bin @BINPATH@/@MOZ_APP_NAME@ #endif @RESPATH@/application.ini #ifdef MOZ_UPDATER @RESPATH@/update-settings.ini #endif @RESPATH@/platform.ini -#ifndef MOZ_NATIVE_SQLITE +#ifndef MOZ_SYSTEM_SQLITE #ifndef MOZ_FOLD_LIBS @BINPATH@/@DLL_PREFIX@mozsqlite3@DLL_SUFFIX@ #endif #endif @BINPATH@/@DLL_PREFIX@lgpllibs@DLL_SUFFIX@ #ifdef MOZ_FFVPX @BINPATH@/@DLL_PREFIX@mozavutil@DLL_SUFFIX@ @BINPATH@/@DLL_PREFIX@mozavcodec@DLL_SUFFIX@ @@ -759,17 +759,17 @@ @RESPATH@/components/dom_svg.xpt @RESPATH@/components/dom_smil.xpt ; [Personal Security Manager] ; ; NSS libraries are signed in the staging directory, ; meaning their .chk files are created there directly. ; -#ifndef MOZ_NATIVE_NSS +#ifndef MOZ_SYSTEM_NSS @BINPATH@/@DLL_PREFIX@freebl3@DLL_SUFFIX@ @BINPATH@/@DLL_PREFIX@nss3@DLL_SUFFIX@ @BINPATH@/@DLL_PREFIX@nssckbi@DLL_SUFFIX@ #ifndef NSS_DISABLE_DBM @BINPATH@/@DLL_PREFIX@nssdbm3@DLL_SUFFIX@ #endif #ifndef MOZ_FOLD_LIBS @BINPATH@/@DLL_PREFIX@nssutil3@DLL_SUFFIX@
--- a/browser/modules/FormSubmitObserver.jsm +++ b/browser/modules/FormSubmitObserver.jsm @@ -113,27 +113,28 @@ FormSubmitObserver.prototype = let element = aInvalidElements.queryElementAt(0, Ci.nsISupports); if (!(element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement || element instanceof HTMLSelectElement || element instanceof HTMLButtonElement)) { return; } + // Update validation message before showing notification + this._validationMessage = element.validationMessage; + // Don't connect up to the same element more than once. if (this._element == element) { this._showPopup(element); return; } this._element = element; element.focus(); - this._validationMessage = element.validationMessage; - // Watch for input changes which may change the validation message. element.addEventListener("input", this, false); // Watch for focus changes so we can disconnect our listeners and // hide the popup. element.addEventListener("blur", this, false); this._showPopup(element);
--- a/build/autoconf/android.m4 +++ b/build/autoconf/android.m4 @@ -198,17 +198,17 @@ if test "$OS_TARGET" = "Android" -a -z " ANDROID_CPU_ARCH=armeabi-v7a ;; arm-*) ANDROID_CPU_ARCH=armeabi ;; x86-*) ANDROID_CPU_ARCH=x86 ;; - mips-*) # When target_cpu is mipsel, CPU_ARCH is mips + mips32-*) # When target_cpu is mipsel, CPU_ARCH is mips32 ANDROID_CPU_ARCH=mips ;; esac AC_SUBST(ANDROID_CPU_ARCH) fi ])
--- a/build/autoconf/ffi.m4 +++ b/build/autoconf/ffi.m4 @@ -1,36 +1,36 @@ dnl This Source Code Form is subject to the terms of the Mozilla Public dnl License, v. 2.0. If a copy of the MPL was not distributed with this dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. AC_DEFUN([MOZ_CONFIG_FFI], [ MOZ_ARG_ENABLE_BOOL(system-ffi, [ --enable-system-ffi Use system libffi (located with pkgconfig)], - MOZ_NATIVE_FFI=1 ) + MOZ_SYSTEM_FFI=1 ) -if test -n "$MOZ_NATIVE_FFI"; then +if test -n "$MOZ_SYSTEM_FFI"; then # Vanilla libffi 3.0.9 needs a few patches from upcoming version 3.0.10 # for non-GCC compilers. if test -z "$GNU_CC"; then PKG_CHECK_MODULES(MOZ_FFI, libffi > 3.0.9) else PKG_CHECK_MODULES(MOZ_FFI, libffi >= 3.0.9) fi fi -AC_SUBST(MOZ_NATIVE_FFI) +AC_SUBST(MOZ_SYSTEM_FFI) ]) AC_DEFUN([MOZ_SUBCONFIGURE_FFI], [ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then - if test "$BUILD_CTYPES" -a -z "$MOZ_NATIVE_FFI"; then + if test "$BUILD_CTYPES" -a -z "$MOZ_SYSTEM_FFI"; then # Run the libffi 'configure' script. ac_configure_args="--disable-shared --enable-static --disable-raw-api" if test "$MOZ_DEBUG"; then ac_configure_args="$ac_configure_args --enable-debug" fi if test "$DSO_PIC_CFLAGS"; then ac_configure_args="$ac_configure_args --with-pic" fi @@ -64,32 +64,16 @@ if test -z "$BUILDING_JS" -o -n "$JS_STA ;; *) ac_configure_args="$ac_configure_args \ CC=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh$flags\" \ CXX=\"$_topsrcdir/js/src/ctypes/libffi/msvcc.sh$flags\"" ;; esac fi - if test "$SOLARIS_SUNPRO_CC"; then - # Always use gcc for libffi on Solaris - if test ! "$HAVE_64BIT_BUILD"; then - ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m32 LD= LDFLAGS=" - else - ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-m64 LD= LDFLAGS=" - fi - fi - if test "$AIX_IBM_XLC"; then - # Always use gcc for libffi on IBM AIX5/AIX6 - if test ! "$HAVE_64BIT_BUILD"; then - ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix32" - else - ac_configure_args="$ac_configure_args CC=gcc CFLAGS=-maix64" - fi - fi # Use a separate cache file for libffi, since it does things differently # from our configure. old_config_files=$CONFIG_FILES unset CONFIG_FILES AC_OUTPUT_SUBDIRS(js/src/ctypes/libffi) ac_configure_args="$_SUBDIR_CONFIG_ARGS" CONFIG_FILES=$old_config_files
--- a/build/autoconf/icu.m4 +++ b/build/autoconf/icu.m4 @@ -5,31 +5,31 @@ dnl file, You can obtain one at http://m dnl Set the MOZ_ICU_VERSION variable to denote the current version of the dnl ICU library, and also the MOZ_SHARED_ICU which would be true if we are dnl linking against a shared library of ICU, either one that we build from dnl our copy of ICU or the system provided library. AC_DEFUN([MOZ_CONFIG_ICU], [ ICU_LIB_NAMES= -MOZ_NATIVE_ICU= +MOZ_SYSTEM_ICU= MOZ_ARG_WITH_BOOL(system-icu, [ --with-system-icu Use system ICU (located with pkgconfig)], - MOZ_NATIVE_ICU=1) + MOZ_SYSTEM_ICU=1) -if test -n "$MOZ_NATIVE_ICU"; then +if test -n "$MOZ_SYSTEM_ICU"; then PKG_CHECK_MODULES(MOZ_ICU, icu-i18n >= 50.1) MOZ_SHARED_ICU=1 else MOZ_ICU_INCLUDES="/intl/icu/source/common /intl/icu/source/i18n" fi AC_SUBST_LIST(MOZ_ICU_INCLUDES) -AC_SUBST(MOZ_NATIVE_ICU) +AC_SUBST(MOZ_SYSTEM_ICU) MOZ_ARG_WITH_STRING(intl-api, [ --with-intl-api, --with-intl-api=build, --without-intl-api Determine the status of the ECMAScript Internationalization API. The first (or lack of any of these) builds and exposes the API. The second builds it but doesn't use ICU or expose the API to script. The third doesn't build ICU at all.], _INTL_API=$withval) @@ -78,24 +78,24 @@ if test -n "$USE_ICU"; then AC_MSG_ERROR([cannot determine icu version number from uvernum.h header file $lineno]) fi MOZ_ICU_VERSION="$version" if test "$OS_TARGET" = WINNT; then MOZ_SHARED_ICU=1 fi - if test -z "${JS_STANDALONE}" -a -n "${JS_SHARED_LIBRARY}${MOZ_NATIVE_ICU}"; then + if test -z "${JS_STANDALONE}" -a -n "${JS_SHARED_LIBRARY}${MOZ_SYSTEM_ICU}"; then MOZ_SHARED_ICU=1 fi AC_SUBST(MOZ_ICU_VERSION) AC_SUBST(MOZ_SHARED_ICU) - if test -z "$MOZ_NATIVE_ICU"; then + if test -z "$MOZ_SYSTEM_ICU"; then case "$OS_TARGET" in WINNT) ICU_LIB_NAMES="icuin icuuc icudt" MOZ_ICU_DBG_SUFFIX= if test -n "$MOZ_DEBUG" -a -z "$MOZ_NO_DEBUG_RTL"; then MOZ_ICU_DBG_SUFFIX=d fi ;; @@ -108,34 +108,34 @@ if test -n "$USE_ICU"; then fi fi AC_SUBST(MOZ_ICU_DBG_SUFFIX) AC_SUBST(ENABLE_INTL_API) AC_SUBST(USE_ICU) AC_SUBST_LIST(ICU_LIB_NAMES) -if test -n "$USE_ICU" -a -z "$MOZ_NATIVE_ICU"; then +if test -n "$USE_ICU" -a -z "$MOZ_SYSTEM_ICU"; then dnl We build ICU as a static library for non-shared js builds and as a shared library for shared js builds. if test -z "$MOZ_SHARED_ICU"; then AC_DEFINE(U_STATIC_IMPLEMENTATION) fi dnl Source files that use ICU should have control over which parts of the ICU dnl namespace they want to use. AC_DEFINE(U_USING_ICU_NAMESPACE,0) fi ]) AC_DEFUN([MOZ_SUBCONFIGURE_ICU], [ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then - if test -n "$USE_ICU" -a -z "$MOZ_NATIVE_ICU"; then + if test -n "$USE_ICU" -a -z "$MOZ_SYSTEM_ICU"; then # Set ICU compile options ICU_CPPFLAGS="" # don't use icu namespace automatically in client code ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_USING_ICU_NAMESPACE=0" # don't include obsolete header files ICU_CPPFLAGS="$ICU_CPPFLAGS -DU_NO_DEFAULT_INCLUDE_UTF_HEADERS=1" # remove chunks of the library that we don't need (yet) ICU_CPPFLAGS="$ICU_CPPFLAGS -DUCONFIG_NO_LEGACY_CONVERSION"
--- a/build/autoconf/jemalloc.m4 +++ b/build/autoconf/jemalloc.m4 @@ -3,17 +3,17 @@ dnl License, v. 2.0. If a copy of the MP dnl file, You can obtain one at http://mozilla.org/MPL/2.0/. AC_DEFUN([MOZ_SUBCONFIGURE_JEMALLOC], [ if test -z "$BUILDING_JS" -o -n "$JS_STANDALONE"; then # Run jemalloc configure script - if test -z "$MOZ_NATIVE_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC4" -o -n "$MOZ_REPLACE_MALLOC"; then + if test -z "$MOZ_SYSTEM_JEMALLOC" -a "$MOZ_MEMORY" && test -n "$MOZ_JEMALLOC4" -o -n "$MOZ_REPLACE_MALLOC"; then ac_configure_args="--build=$build --host=$target --enable-stats --with-jemalloc-prefix=je_ --disable-valgrind" # We're using memalign for _aligned_malloc in memory/build/mozmemory_wrap.c # on Windows, so just export memalign on all platforms. ac_configure_args="$ac_configure_args ac_cv_func_memalign=yes" if test -n "$MOZ_REPLACE_MALLOC"; then # When using replace_malloc, we always want valloc exported from jemalloc. ac_configure_args="$ac_configure_args ac_cv_func_valloc=yes" if test "${OS_ARCH}" = Darwin; then
--- a/build/autoconf/nspr-build.m4 +++ b/build/autoconf/nspr-build.m4 @@ -132,20 +132,20 @@ if test -n "$BUILDING_JS"; then fi # A (sub)configure invoked by the toplevel configure will always receive # --with-nspr-libs on the command line. It will never need to figure out # anything itself. if test -n "$_IS_OUTER_CONFIGURE"; then if test -n "$_USE_SYSTEM_NSPR"; then - AM_PATH_NSPR($NSPR_MINVER, [MOZ_NATIVE_NSPR=1], [AC_MSG_ERROR([you do not have NSPR installed or your version is older than $NSPR_MINVER.])]) + AM_PATH_NSPR($NSPR_MINVER, [MOZ_SYSTEM_NSPR=1], [AC_MSG_ERROR([you do not have NSPR installed or your version is older than $NSPR_MINVER.])]) fi -if test -n "$MOZ_NATIVE_NSPR" -o -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then +if test -n "$MOZ_SYSTEM_NSPR" -o -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then _SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $NSPR_CFLAGS" AC_TRY_COMPILE([#include "prtypes.h"], [#ifndef PR_STATIC_ASSERT #error PR_STATIC_ASSERT not defined or requires including prtypes.h #endif], , AC_MSG_ERROR([system NSPR does not support PR_STATIC_ASSERT or including prtypes.h does not provide it])) @@ -173,18 +173,18 @@ elif test -z "$JS_POSIX_NSPR"; then fi fi AC_SUBST_LIST(NSPR_CFLAGS) AC_SUBST(NSPR_INCLUDE_DIR) AC_SUBST(NSPR_LIB_DIR) NSPR_PKGCONF_CHECK="nspr" -if test -n "$MOZ_NATIVE_NSPR"; then - # piggy back on $MOZ_NATIVE_NSPR to set a variable for the nspr check for js.pc +if test -n "$MOZ_SYSTEM_NSPR"; then + # piggy back on $MOZ_SYSTEM_NSPR to set a variable for the nspr check for js.pc NSPR_PKGCONF_CHECK="nspr >= $NSPR_MINVER" _SAVE_CFLAGS=$CFLAGS CFLAGS="$CFLAGS $NSPR_CFLAGS" AC_TRY_COMPILE([#include "prlog.h"], [#ifndef PR_STATIC_ASSERT #error PR_STATIC_ASSERT not defined #endif],
--- a/build/autoconf/zlib.m4 +++ b/build/autoconf/zlib.m4 @@ -21,34 +21,34 @@ if test -z "$MOZ_ZLIB_LIBS$MOZ_ZLIB_CFLA if test -n "${ZLIB_DIR}" -a "${ZLIB_DIR}" != "yes"; then MOZ_ZLIB_CFLAGS="-I${ZLIB_DIR}/include" MOZ_ZLIB_LIBS="-L${ZLIB_DIR}/lib" CFLAGS="$MOZ_ZLIB_CFLAGS $CFLAGS" LDFLAGS="$MOZ_ZLIB_LIBS $LDFLAGS" fi if test -z "$ZLIB_DIR" -o "$ZLIB_DIR" = no; then - MOZ_NATIVE_ZLIB= + MOZ_SYSTEM_ZLIB= else - AC_CHECK_LIB(z, gzread, [MOZ_NATIVE_ZLIB=1 MOZ_ZLIB_LIBS="$MOZ_ZLIB_LIBS -lz"], - [MOZ_NATIVE_ZLIB=]) - if test "$MOZ_NATIVE_ZLIB" = 1; then + AC_CHECK_LIB(z, gzread, [MOZ_SYSTEM_ZLIB=1 MOZ_ZLIB_LIBS="$MOZ_ZLIB_LIBS -lz"], + [MOZ_SYSTEM_ZLIB=]) + if test "$MOZ_SYSTEM_ZLIB" = 1; then MOZZLIBNUM=`echo $MOZZLIB | awk -F. changequote(<<, >>)'{printf "0x%x\n", (((<<$>>1 * 16 + <<$>>2) * 16) + <<$>>3) * 16 + <<$>>4}'changequote([, ])` AC_TRY_COMPILE([ #include <stdio.h> #include <string.h> #include <zlib.h> ], [ #if ZLIB_VERNUM < $MOZZLIBNUM #error "Insufficient zlib version ($MOZZLIBNUM required)." #endif ], - MOZ_NATIVE_ZLIB=1, + MOZ_SYSTEM_ZLIB=1, AC_MSG_ERROR([Insufficient zlib version for --with-system-zlib ($MOZZLIB required)])) fi fi CFLAGS=$_SAVE_CFLAGS LDFLAGS=$_SAVE_LDFLAGS LIBS=$_SAVE_LIBS fi AC_SUBST_LIST(MOZ_ZLIB_CFLAGS) AC_SUBST_LIST(MOZ_ZLIB_LIBS) -AC_SUBST(MOZ_NATIVE_ZLIB) +AC_SUBST(MOZ_SYSTEM_ZLIB) ])
--- a/build/moz.configure/init.configure +++ b/build/moz.configure/init.configure @@ -110,24 +110,34 @@ def mozconfig(current_project, mozconfig # Hacks related to old-configure # ============================== @depends('--help') def old_configure_assignments(help): return [] +@depends('--help') +def extra_old_configure_args(help): + return [] + @template def add_old_configure_assignment(var, value): @depends(old_configure_assignments) @advanced def add_assignment(assignments): from mozbuild.shellutil import quote assignments.append('%s=%s' % (var, quote(value))) +@template +def add_old_configure_arg(arg): + @depends(extra_old_configure_args) + def add_arg(args): + args.append(arg) + option(env='PYTHON', nargs=1, help='Python interpreter') # Setup python virtualenv # ============================================================== @depends('PYTHON', check_build_environment, mozconfig) @advanced def virtualenv_python(env_python, build_env, mozconfig): @@ -228,20 +238,196 @@ def mozconfig_options(mozconfig): # but at the moment, moz.configure has no knowledge of the options # that may appear there. We'll opt-in when we move things from # old-configure.in, which will be tedious but necessary until we # can discriminate what old-configure.in supports. del command_line_helper +# Mozilla-Build +# ============================================================== option(env='MOZILLABUILD', nargs=1, help='Path to Mozilla Build (Windows-only)') +# It feels dirty replicating this from python/mozbuild/mozbuild/mozconfig.py, +# but the end goal being that the configure script would go away... +@depends('MOZILLABUILD') +@advanced +def shell(mozillabuild): + import sys + shell = 'sh' + if mozillabuild: + shell = mozillabuild[0] + '/msys/bin/sh' + if sys.platform == 'win32': + shell = shell + '.exe' + return shell + + +# Host and target systems +# ============================================================== +option('--host', nargs=1, help='Define the system type performing the build') + +option('--target', nargs=1, + help='Define the system type where the resulting executables will be ' + 'used') + +@template +def split_triplet(triplet): + # The standard triplet is defined as + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM + # There is also a quartet form: + # CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM + # But we can consider the "KERNEL-OPERATING_SYSTEM" as one. + cpu, manufacturer, os = triplet.split('-', 2) + + # Autoconf uses config.sub to validate and canonicalize those triplets, + # but the granularity of its results has never been satisfying to our + # use, so we've had our own, different, canonicalization. We've also + # historically not been very consistent with how we use the canonicalized + # values. Hopefully, this will help us make things better. + # The tests are inherited from our decades-old autoconf-based configure, + # which can probably be improved/cleaned up because they are based on a + # mix of uname and config.guess output, while we now only use the latter, + # which presumably has a cleaner and leaner output. Let's refine later. + os = os.replace('/', '_') + if 'android' in os: + canonical_os = 'Android' + canonical_kernel = 'Linux' + elif os.startswith('linux'): + canonical_os = 'GNU' + canonical_kernel = 'Linux' + elif os.startswith('kfreebsd') and os.endswith('-gnu'): + canonical_os = 'GNU' + canonical_kernel = 'kFreeBSD' + elif os.startswith('gnu'): + canonical_os = canonical_kernel = 'GNU' + elif os.startswith('mingw'): + canonical_os = canonical_kernel = 'WINNT' + elif os.startswith('darwin'): + canonical_os = canonical_kernel = 'Darwin' + elif os.startswith('dragonfly'): + canonical_os = canonical_kernel = 'DragonFly' + elif os.startswith('freebsd'): + canonical_os = canonical_kernel = 'FreeBSD' + elif os.startswith('netbsd'): + canonical_os = canonical_kernel = 'NetBSD' + elif os.startswith('openbsd'): + canonical_os = canonical_kernel = 'OpenBSD' + else: + error('Unknown OS: %s' % os) + + # The CPU granularity is probably not enough. Moving more things from + # old-configure will tell us if we need more + if cpu.endswith('86') or (cpu.startswith('i') and '86' in cpu): + canonical_cpu = 'x86' + elif cpu in ('s390', 's390x', 'x86_64', 'ia64'): + canonical_cpu = cpu + elif cpu in ('powerpc64', 'ppc64', 'powerpc64le', 'ppc64le'): + canonical_cpu = 'ppc64' + elif cpu in ('powerpc', 'ppc', 'rs6000') or cpu.startswith('powerpc'): + canonical_cpu = 'ppc' + elif cpu in ('Alpha', 'alpha', 'ALPHA'): + canonical_cpu = 'Alpha' + elif cpu.startswith('hppa') or cpu == 'parisc': + canonical_cpu = 'hppa' + elif cpu.startswith('sparc') or cpu == 'sun4u': + canonical_cpu = 'sparc' + elif cpu.startswith('arm'): + canonical_cpu = 'arm' + elif cpu in ('mips', 'mipsel'): + canonical_cpu = 'mips32' + elif cpu in ('mips64', 'mips64el'): + canonical_cpu = 'mips64' + elif cpu.startswith('aarch64'): + canonical_cpu = 'aarch64' + else: + canonical_cpu = cpu + + return namespace( + alias=triplet, + cpu=canonical_cpu, + kernel=canonical_kernel, + os=canonical_os, + raw_cpu=cpu, + ) + + +@depends('--host', shell) +@advanced +def host(value, shell): + if not value: + import subprocess + config_guess = os.path.join(os.path.dirname(__file__), '..', + 'autoconf', 'config.guess') + host = subprocess.check_output([shell, config_guess]).strip() + else: + host = value[0] + + return split_triplet(host) + + +@depends('--target', host) +def target(value, host): + if not value: + return host + return split_triplet(value[0]) + + +@depends(host, target) +def host_and_target_for_old_configure(host, target): + # Autoconf needs these set + add_old_configure_arg('--host=%s' % host.alias) + add_old_configure_arg('--target=%s' % target.alias) + + +# These variables are for compatibility with the current moz.builds and +# old-configure. Eventually, we'll want to canonicalize better. +@depends(target) +def target_variables(target): + if target.kernel == 'kFreeBSD': + os_target = 'GNU/kFreeBSD' + os_arch = 'GNU_kFreeBSD' + elif target.kernel == 'Linux' and target.os == 'GNU': + os_target = target.kernel + os_arch = target.kernel + else: + os_target = target.os + os_arch = target.kernel + add_old_configure_assignment('OS_TARGET', os_target) + set_config('OS_TARGET', os_target) + add_old_configure_assignment('OS_ARCH', os_arch) + set_config('OS_ARCH', os_arch) + + if target.os == 'Darwin' and target.cpu == 'x86': + os_test = 'i386' + else: + os_test = target.raw_cpu + add_old_configure_assignment('OS_TEST', os_test) + set_config('OS_TEST', os_test) + + add_old_configure_assignment('CPU_ARCH', target.cpu) + set_config('CPU_ARCH', target.cpu) + + if target.cpu in ('x86', 'x86_64'): + set_config('INTEL_ARCHITECTURE', '1') + +@depends(host) +def host_variables(host): + if host.kernel == 'kFreeBSD': + os_arch = 'GNU_kFreeBSD' + else: + os_arch = host.kernel + add_old_configure_assignment('HOST_OS_ARCH', os_arch) + set_config('HOST_OS_ARCH', os_arch) + + +# The application/project to build +# ============================================================== option('--enable-application', nargs=1, env='MOZ_BUILD_APP', help='Application to build. Same as --enable-project.') @depends('--enable-application', '--help') def application(app, help): if app: imply_option(app.format('--enable-project')) @@ -280,26 +466,20 @@ def include_project_configure(project, e def build_project(include_project_configure, build_env, help): ret = os.path.dirname(os.path.relpath(include_project_configure, build_env['TOPSRCDIR'])) add_old_configure_assignment('MOZ_BUILD_APP', ret) return ret # This is temporary until js/src/configure and configure are merged. -@depends(build_project) -def extra_old_configure_args(build_project): - if build_project != 'js': - return [] - return False - # Use instead of option() in js/moz.configure @template def js_option(*args, **kwargs): opt = option(*args, **kwargs) - @depends(opt.option, extra_old_configure_args) - def js_option(value, extra_old_configure_args): - if extra_old_configure_args is not False: - extra_old_configure_args.append(value.format(opt.option)) + @depends(opt.option, build_project) + def js_option(value, build_project): + if build_project != 'js': + add_old_configure_arg(value.format(opt.option)) include(include_project_configure)
--- a/build/moz.configure/old.configure +++ b/build/moz.configure/old.configure @@ -1,29 +1,14 @@ # -*- Mode: python; c-basic-offset: 4; 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 http://mozilla.org/MPL/2.0/. -# It feels dirty replicating this from python/mozbuild/mozbuild/mozconfig.py, -# but the end goal being that the configure script would go away... -@depends('MOZILLABUILD') -@advanced -def shell(mozillabuild): - import sys - - shell = 'sh' - if mozillabuild: - shell = mozillabuild[0] + '/msys/bin/sh' - if sys.platform == 'win32': - shell = shell + '.exe' - return shell - - @template @advanced def encoded_open(path, mode): import codecs import sys encoding = 'mbcs' if sys.platform == 'win32' else 'utf-8' return codecs.open(path, mode, encoding) @@ -50,23 +35,32 @@ def autoconf(mozconfig, autoconf): for ac in (mozconfig_autoconf, autoconf, 'autoconf-2.13', 'autoconf2.13', 'autoconf213'): if ac: autoconf = find_program(ac) if autoconf: break else: fink = find_program('fink') - if find: + if fink: autoconf = os.path.normpath(os.path.join( fink, '..', '..', 'lib', 'autoconf2.13', 'bin', 'autoconf')) + else: + brew = find_program('brew') + if brew: + autoconf = os.path.normpath(os.path.join( + brew, '..', '..', 'Cellar', 'autoconf213', '2.13', 'bin', + 'autoconf213')) if not autoconf: error('Could not find autoconf 2.13') + if not os.path.exists(autoconf): + error('Could not find autoconf 2.13 at %s' % (autoconf,)) + set_config('AUTOCONF', autoconf) return autoconf @depends('OLD_CONFIGURE', mozconfig, autoconf, check_build_environment, shell, old_configure_assignments) @advanced def prepare_configure(old_configure, mozconfig, autoconf, build_env, shell, @@ -275,20 +269,18 @@ def old_configure_options(*options): '--enable-webrtc', '--enable-websms-backend', '--enable-webspeech', '--enable-webspeechtestbackend', '--enable-wmf', '--enable-xterm-updates', '--enable-xul', '--enable-zipwriter', - '--host', '--no-create', '--prefix', - '--target', '--with-adjust-sdk-keyfile', '--with-android-cxx-stl', '--with-android-distribution-directory', '--with-android-gnu-compiler-version', '--with-android-max-sdk', '--with-android-min-sdk', '--with-android-ndk', '--with-android-sdk', @@ -324,16 +316,17 @@ def old_configure_options(*options): '--with-jitreport-granularity', '--with-l10n-base', '--with-libxul-sdk', '--with-linux-headers', '--with-macbundlename-prefix', '--with-macos-private-frameworks', '--with-macos-sdk', '--with-mozilla-api-keyfile', + '--with-nspr-prefix', '--with-nspr-cflags', '--with-nspr-libs', '--with-pthreads', '--with-qemu-exe', '--with-qtdir', '--with-servo', '--with-sixgill', '--with-soft-float',
--- a/build/moz.configure/util.configure +++ b/build/moz.configure/util.configure @@ -95,8 +95,16 @@ def deprecated_option(*args, **kwargs): def decorator(func): @depends(opt.option) def deprecated(value): if value.origin != 'default': return func(value) return deprecated return decorator + + +# from mozbuild.util import ReadOnlyNamespace as namespace +@template +@advanced +def namespace(**kwargs): + from mozbuild.util import ReadOnlyNamespace + return ReadOnlyNamespace(**kwargs)
deleted file mode 100644 --- a/build/unix/add_phony_targets.py +++ /dev/null @@ -1,33 +0,0 @@ -import pymake.data -import pymake.parser -import pymake.parserdata -import sys - -''' -Modifies the output of Sun Studio's -xM to look more like the output -of gcc's -MD -MP, adding phony targets for dependencies. -''' - - -def add_phony_targets(path): - print path - deps = set() - targets = set() - for stmt in pymake.parser.parsefile(path): - if isinstance(stmt, pymake.parserdata.Rule): - assert isinstance(stmt.depexp, pymake.data.StringExpansion) - assert isinstance(stmt.targetexp, pymake.data.StringExpansion) - for d in stmt.depexp.s.split(): - deps.add(d) - for t in stmt.targetexp.s.split(): - targets.add(t) - phony_targets = deps - targets - if not phony_targets: - return - with open(path, 'a') as f: - f.writelines('%s:\n' % d for d in phony_targets) - - -if __name__ == '__main__': - for f in sys.argv[1:]: - add_phony_targets(f)
deleted file mode 100644 --- a/build/unix/gnu-ld-scripts/components-mapfile +++ /dev/null @@ -1,7 +0,0 @@ -{ - global: - NSModule; - NSGetModule; - __RLD_MAP; - local: *; -};
--- a/caps/nsScriptSecurityManager.cpp +++ b/caps/nsScriptSecurityManager.cpp @@ -497,17 +497,17 @@ nsScriptSecurityManager::ContentSecurity return true; // fail open to not break sites. } if (reportViolation) { nsAutoString fileName; unsigned lineNum = 0; NS_NAMED_LITERAL_STRING(scriptSample, "call to eval() or related function blocked by CSP"); - JS::UniqueChars scriptFilename; + JS::AutoFilename scriptFilename; if (JS::DescribeScriptedCaller(cx, &scriptFilename, &lineNum)) { if (const char *file = scriptFilename.get()) { CopyUTF8toUTF16(nsDependentCString(file), fileName); } } else { MOZ_ASSERT(!JS_IsExceptionPending(cx)); } csp->LogViolationDetails(nsIContentSecurityPolicy::VIOLATION_TYPE_EVAL,
--- a/config/Makefile.in +++ b/config/Makefile.in @@ -36,24 +36,24 @@ ifdef WRAP_SYSTEM_INCLUDES export-preqs = \ $(call mkdir_deps,system_wrappers) \ $(NULL) export:: $(export-preqs) $(PYTHON) -m mozbuild.action.preprocessor $(DEFINES) $(ACDEFINES) \ -DMOZ_TREE_CAIRO=$(MOZ_TREE_CAIRO) \ -DMOZ_TREE_PIXMAN=$(MOZ_TREE_PIXMAN) \ - -DMOZ_NATIVE_HUNSPELL=$(MOZ_NATIVE_HUNSPELL) \ - -DMOZ_NATIVE_BZ2=$(MOZ_NATIVE_BZ2) \ - -DMOZ_NATIVE_ZLIB=$(MOZ_NATIVE_ZLIB) \ - -DMOZ_NATIVE_PNG=$(MOZ_NATIVE_PNG) \ - -DMOZ_NATIVE_JPEG=$(MOZ_NATIVE_JPEG) \ - -DMOZ_NATIVE_LIBEVENT=$(MOZ_NATIVE_LIBEVENT) \ - -DMOZ_NATIVE_LIBVPX=$(MOZ_NATIVE_LIBVPX) \ - -DMOZ_NATIVE_ICU=$(MOZ_NATIVE_ICU) \ + -DMOZ_SYSTEM_HUNSPELL=$(MOZ_SYSTEM_HUNSPELL) \ + -DMOZ_SYSTEM_BZ2=$(MOZ_SYSTEM_BZ2) \ + -DMOZ_SYSTEM_ZLIB=$(MOZ_SYSTEM_ZLIB) \ + -DMOZ_SYSTEM_PNG=$(MOZ_SYSTEM_PNG) \ + -DMOZ_SYSTEM_JPEG=$(MOZ_SYSTEM_JPEG) \ + -DMOZ_SYSTEM_LIBEVENT=$(MOZ_SYSTEM_LIBEVENT) \ + -DMOZ_SYSTEM_LIBVPX=$(MOZ_SYSTEM_LIBVPX) \ + -DMOZ_SYSTEM_ICU=$(MOZ_SYSTEM_ICU) \ $(srcdir)/system-headers | $(PERL) $(topsrcdir)/nsprpub/config/make-system-wrappers.pl system_wrappers $(INSTALL) system_wrappers $(DIST) GARBAGE_DIRS += system_wrappers endif ifdef WRAP_STL_INCLUDES ifdef GNU_CXX
--- a/config/check_spidermonkey_style.py +++ b/config/check_spidermonkey_style.py @@ -61,17 +61,16 @@ included_inclnames_to_ignore = set([ 'ffi.h', # generated in ctypes/libffi/ 'devtools/sharkctl.h', # we ignore devtools/ in general 'devtools/Instruments.h', # we ignore devtools/ in general 'double-conversion.h', # strange MFBT case 'javascript-trace.h', # generated in $OBJDIR if HAVE_DTRACE is defined 'jsautokw.h', # generated in $OBJDIR 'jscustomallocator.h', # provided by embedders; allowed to be missing 'js-config.h', # generated in $OBJDIR - 'fdlibm.h', # fdlibm 'pratom.h', # NSPR 'prcvar.h', # NSPR 'prerror.h', # NSPR 'prinit.h', # NSPR 'prlink.h', # NSPR 'prlock.h', # NSPR 'prprf.h', # NSPR 'prthread.h', # NSPR @@ -222,52 +221,53 @@ class FileKind(object): def check_style(): # We deal with two kinds of name. # - A "filename" is a full path to a file from the repository root. # - An "inclname" is how a file is referred to in a #include statement. # # Examples (filename -> inclname) - # - "mfbt/Attributes.h" -> "mozilla/Attributes.h" - # - "mfbt/decimal/Decimal.h -> "mozilla/Decimal.h" - # - "js/public/Vector.h" -> "js/Vector.h" - # - "js/src/vm/String.h" -> "vm/String.h" + # - "mfbt/Attributes.h" -> "mozilla/Attributes.h" + # - "mfbt/decimal/Decimal.h -> "mozilla/Decimal.h" + # - "mozglue/misc/TimeStamp.h -> "mozilla/TimeStamp.h" + # - "memory/mozalloc/mozalloc.h -> "mozilla/mozalloc.h" + # - "js/public/Vector.h" -> "js/Vector.h" + # - "js/src/vm/String.h" -> "vm/String.h" - mfbt_inclnames = set() # type: set(inclname) - mozalloc_inclnames = set() # type: set(inclname) - js_names = dict() # type: dict(filename, inclname) + non_js_dirnames = ('mfbt/', + 'memory/mozalloc/', + 'mozglue/') # type: tuple(str) + non_js_inclnames = set() # type: set(inclname) + js_names = dict() # type: dict(filename, inclname) # Select the appropriate files. for filename in get_all_toplevel_filenames(): - if filename.startswith('mfbt/') and filename.endswith('.h'): - inclname = 'mozilla/' + filename.split('/')[-1] - mfbt_inclnames.add(inclname) - - if filename.startswith('memory/mozalloc/') and filename.endswith('.h'): - inclname = 'mozilla/' + filename.split('/')[-1] - mozalloc_inclnames.add(inclname) + for non_js_dir in non_js_dirnames: + if filename.startswith(non_js_dir) and filename.endswith('.h'): + inclname = 'mozilla/' + filename.split('/')[-1] + non_js_inclnames.add(inclname) if filename.startswith('js/public/') and filename.endswith('.h'): inclname = 'js/' + filename[len('js/public/'):] js_names[filename] = inclname if filename.startswith('js/src/') and \ not filename.startswith(tuple(ignored_js_src_dirs)) and \ filename.endswith(('.c', '.cpp', '.h', '.tbl', '.msg')): inclname = filename[len('js/src/'):] js_names[filename] = inclname - all_inclnames = mfbt_inclnames | mozalloc_inclnames | set(js_names.values()) + all_inclnames = non_js_inclnames | set(js_names.values()) edges = dict() # type: dict(inclname, set(inclname)) # We don't care what's inside the MFBT and MOZALLOC files, but because they # are #included from JS files we have to add them to the inclusion graph. - for inclname in mfbt_inclnames | mozalloc_inclnames: + for inclname in non_js_inclnames: edges[inclname] = set() # Process all the JS files. for filename in js_names.keys(): inclname = js_names[filename] file_kind = FileKind.get(filename) if file_kind == FileKind.C or file_kind == FileKind.CPP or \ file_kind == FileKind.H or file_kind == FileKind.INL_H:
--- a/config/config.mk +++ b/config/config.mk @@ -148,24 +148,17 @@ ifneq (,$(MOZ_DEBUG)$(MOZ_DEBUG_SYMBOLS) endif else _DEBUG_ASFLAGS += $(MOZ_DEBUG_FLAGS) endif _DEBUG_CFLAGS += $(MOZ_DEBUG_FLAGS) _DEBUG_LDFLAGS += $(MOZ_DEBUG_LDFLAGS) endif -ifeq ($(YASM),$(AS)) -# yasm doesn't like the GNU as flags we may already have in ASFLAGS, so reset. -ASFLAGS := $(_DEBUG_ASFLAGS) -# yasm doesn't like -c -AS_DASH_C_FLAG= -else ASFLAGS += $(_DEBUG_ASFLAGS) -endif OS_CFLAGS += $(_DEBUG_CFLAGS) OS_CXXFLAGS += $(_DEBUG_CFLAGS) OS_LDFLAGS += $(_DEBUG_LDFLAGS) # XXX: What does this? Bug 482434 filed for better explanation. ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_) ifndef MOZ_DEBUG
deleted file mode 100644 --- a/config/external/fdlibm/moz.build +++ /dev/null @@ -1,14 +0,0 @@ -# -*- Mode: python; c-basic-offset: 4; 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 http://mozilla.org/MPL/2.0/. - -Library('fdlibm') - -with Files('**'): - BUG_COMPONENT = ('Core', 'JavaScript Engine') - -DIRS += [ - '../../../modules/fdlibm', -]
--- a/config/external/ffi/Makefile.in +++ b/config/external/ffi/Makefile.in @@ -1,12 +1,12 @@ # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -ifndef MOZ_NATIVE_FFI +ifndef MOZ_SYSTEM_FFI include $(topsrcdir)/config/config.mk $(STATIC_LIBS): $(MAKE) -C $(DEPTH)/js/src/ctypes/libffi endif
--- a/config/external/ffi/moz.build +++ b/config/external/ffi/moz.build @@ -1,17 +1,17 @@ # -*- Mode: python; c-basic-offset: 4; 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 http://mozilla.org/MPL/2.0/. Library('ffi') -if CONFIG['MOZ_NATIVE_FFI']: +if CONFIG['MOZ_SYSTEM_FFI']: OS_LIBS += CONFIG['MOZ_FFI_LIBS'] else: if CONFIG['_MSC_VER']: prefix = 'lib' else: prefix = '' USE_LIBS += [ 'static:/js/src/ctypes/libffi/.libs/%sffi' % prefix,
--- a/config/external/icu/Makefile.in +++ b/config/external/icu/Makefile.in @@ -1,15 +1,15 @@ # 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/. # Ensure that this happens before including rules.mk ifdef USE_ICU - ifndef MOZ_NATIVE_ICU + ifndef MOZ_SYSTEM_ICU # Library names: On Windows, ICU uses modified library names for static # and debug libraries. ifdef MOZ_SHARED_ICU ifeq ($(OS_ARCH),WINNT) ICU_FILES := $(foreach libname,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib/$(libname)$(MOZ_ICU_DBG_SUFFIX)$(MOZ_ICU_VERSION).dll) else # ! WINNT ifeq ($(OS_ARCH),Darwin) ICU_FILES := $(foreach libname,$(ICU_LIB_NAMES),$(DEPTH)/intl/icu/target/lib/$(DLL_PREFIX)$(libname).$(MOZ_ICU_VERSION)$(DLL_SUFFIX)) @@ -24,23 +24,23 @@ ifdef USE_ICU ICU_TARGET := target endif else # !MOZ_SHARED_ICU ifeq ($(OS_ARCH),WINNT) ICU_LIB_RENAME = $(foreach libname,$(ICU_LIB_NAMES),\ cp -p $(DEPTH)/intl/icu/target/lib/s$(libname)$(MOZ_ICU_DBG_SUFFIX).lib $(DEPTH)/intl/icu/target/lib/$(libname)$(MOZ_ICU_DBG_SUFFIX).lib;) endif endif # MOZ_SHARED_ICU - endif # !MOZ_NATIVE_ICU + endif # !MOZ_SYSTEM_ICU endif # USE_ICU include $(topsrcdir)/config/rules.mk ifdef USE_ICU -ifndef MOZ_NATIVE_ICU +ifndef MOZ_SYSTEM_ICU target:: buildicu $(STATIC_LIBS): buildicu # - Force ICU to use the standard suffix for object files because expandlibs # will discard all files with a non-standard suffix (bug 857450). # - Options for genrb: -k strict parsing; -R omit collation tailoring rules. buildicu:: # ICU's build system is full of races, so force non-parallel build.
--- a/config/external/icu/moz.build +++ b/config/external/icu/moz.build @@ -1,17 +1,17 @@ # -*- Mode: python; c-basic-offset: 4; 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 http://mozilla.org/MPL/2.0/. Library('icu') -if CONFIG['MOZ_NATIVE_ICU']: +if CONFIG['MOZ_SYSTEM_ICU']: OS_LIBS += CONFIG['MOZ_ICU_LIBS'] else: # Order needs to be preserved for l in CONFIG['ICU_LIB_NAMES']: USE_LIBS += ['%s/intl/icu/target/lib/%s%s' % ( 'static:' if not CONFIG['MOZ_SHARED_ICU'] else '', l, CONFIG['MOZ_ICU_DBG_SUFFIX']
--- a/config/external/moz.build +++ b/config/external/moz.build @@ -5,40 +5,40 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. external_dirs = [] DIRS += [ 'lgpllibs', 'sqlite', ] -if not CONFIG['MOZ_NATIVE_JPEG']: +if not CONFIG['MOZ_SYSTEM_JPEG']: external_dirs += ['media/libjpeg'] if CONFIG['MOZ_UPDATER']: - if not CONFIG['MOZ_NATIVE_BZ2']: + if not CONFIG['MOZ_SYSTEM_BZ2']: external_dirs += ['modules/libbz2'] # There's no "native" brotli or woff2 yet, but probably in the future... external_dirs += ['modules/brotli'] external_dirs += ['modules/woff2'] if CONFIG['MOZ_VORBIS']: external_dirs += ['media/libvorbis'] if CONFIG['MOZ_TREMOR']: external_dirs += ['media/libtremor'] if CONFIG['MOZ_WEBM_ENCODER']: external_dirs += ['media/libmkv'] -if not CONFIG['MOZ_NATIVE_LIBVPX']: +if not CONFIG['MOZ_SYSTEM_LIBVPX']: external_dirs += ['media/libvpx'] -if not CONFIG['MOZ_NATIVE_PNG']: +if not CONFIG['MOZ_SYSTEM_PNG']: external_dirs += ['media/libpng'] if CONFIG['CPU_ARCH'] == 'arm': external_dirs += ['media/openmax_dl'] if CONFIG['MOZ_WEBSPEECH_POCKETSPHINX']: external_dirs += [ 'media/sphinxbase',
--- a/config/external/nss/Makefile.in +++ b/config/external/nss/Makefile.in @@ -1,14 +1,14 @@ # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -ifndef MOZ_NATIVE_NSS +ifndef MOZ_SYSTEM_NSS CC_WRAPPER = CXX_WRAPPER = default:: include $(topsrcdir)/config/makefiles/functions.mk @@ -114,17 +114,17 @@ DEFAULT_GMAKE_FLAGS += DIST=$(ABS_DIST) DEFAULT_GMAKE_FLAGS += NSPR_INCLUDE_DIR=$(NSPR_INCLUDE_DIR) DEFAULT_GMAKE_FLAGS += NSPR_LIB_DIR=$(NSPR_LIB_DIR) DEFAULT_GMAKE_FLAGS += MOZILLA_CLIENT=1 DEFAULT_GMAKE_FLAGS += NO_MDUPDATE=1 DEFAULT_GMAKE_FLAGS += NSS_ENABLE_ECC=1 ifeq ($(OS_ARCH)_$(GNU_CC),WINNT_1) DEFAULT_GMAKE_FLAGS += OS_DLLFLAGS='-static-libgcc' NSPR31_LIB_PREFIX=lib endif -ifndef MOZ_NATIVE_SQLITE +ifndef MOZ_SYSTEM_SQLITE ifdef MOZ_FOLD_LIBS DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=nss3 else DEFAULT_GMAKE_FLAGS += SQLITE_LIB_NAME=mozsqlite3 DEFAULT_GMAKE_FLAGS += SQLITE_LIB_DIR=$(ABS_DIST)/../config/external/sqlite endif # MOZ_FOLD_LIBS DEFAULT_GMAKE_FLAGS += SQLITE_INCLUDE_DIR=$(ABS_DIST)/include endif
--- a/config/external/nss/crmf/moz.build +++ b/config/external/nss/crmf/moz.build @@ -1,17 +1,17 @@ # -*- Mode: python; c-basic-offset: 4; 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 http://mozilla.org/MPL/2.0/. Library('crmf') -if CONFIG['MOZ_NATIVE_NSS']: +if CONFIG['MOZ_SYSTEM_NSS']: OS_LIBS += [l for l in CONFIG['NSS_LIBS'] if l.startswith('-L')] OS_LIBS += ['-lcrmf'] else: USE_LIBS += [ # The dependency on nss is not real, but is required to force the # parent directory being built before this one. This has no # practical effect on linkage, since the only thing linking crmf # will need nss anyways.
--- a/config/external/nss/moz.build +++ b/config/external/nss/moz.build @@ -1,17 +1,17 @@ # -*- Mode: python; c-basic-offset: 4; 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 http://mozilla.org/MPL/2.0/. DIRS += ['crmf'] -if CONFIG['MOZ_NATIVE_NSS']: +if CONFIG['MOZ_SYSTEM_NSS']: Library('nss') OS_LIBS += CONFIG['NSS_LIBS'] elif CONFIG['MOZ_FOLD_LIBS']: GeckoSharedLibrary('nss', linkage=None) # TODO: The library name can be changed when bug 845217 is fixed. SHARED_LIBRARY_NAME = 'nss3' SDK_LIBRARY = True
--- a/config/external/nss/nss.symbols +++ b/config/external/nss/nss.symbols @@ -325,16 +325,17 @@ PK11_DigestBegin PK11_DigestFinal PK11_DigestOp PK11_DoesMechanism PK11_Encrypt PK11_ExportDERPrivateKeyInfo PK11_ExportEncryptedPrivKeyInfo PK11_ExtractKeyValue PK11_FindCertFromNickname +PK11_FindCertInSlot PK11_FindCertsFromEmailAddress PK11_FindCertsFromNickname PK11_FindKeyByAnyCert PK11_FindKeyByDERCert PK11_FindKeyByKeyID PK11_FindSlotByName PK11_FindSlotsByNames PK11_FreeSlot @@ -543,16 +544,17 @@ SECMOD_AddNewModuleEx SECMOD_CancelWait SECMOD_CanDeleteInternalModule SECMOD_CloseUserDB SECMOD_CreateModule SECMOD_DeleteInternalModule SECMOD_DeleteModule SECMOD_DestroyModule SECMOD_FindModule +SECMOD_FindSlot SECMOD_GetDeadModuleList SECMOD_GetDefaultModuleList SECMOD_GetDefaultModuleListLock SECMOD_GetInternalModule SECMOD_GetModuleSpecList SECMOD_GetReadLock SECMOD_HasRemovableSlots SECMOD_InternaltoPubMechFlags
--- a/config/external/sqlite/moz.build +++ b/config/external/sqlite/moz.build @@ -1,15 +1,15 @@ # -*- Mode: python; c-basic-offset: 4; 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 http://mozilla.org/MPL/2.0/. -if CONFIG['MOZ_NATIVE_SQLITE']: +if CONFIG['MOZ_SYSTEM_SQLITE']: Library('sqlite') OS_LIBS += CONFIG['SQLITE_LIBS'] else: DIRS += ['../../../db/sqlite3/src'] if CONFIG['MOZ_FOLD_LIBS']: Library('sqlite') # When folding libraries, sqlite is actually in the nss library. USE_LIBS += [
--- a/config/external/zlib/moz.build +++ b/config/external/zlib/moz.build @@ -1,17 +1,17 @@ # -*- Mode: python; c-basic-offset: 4; 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 http://mozilla.org/MPL/2.0/. Library('zlib') -if CONFIG['MOZ_NATIVE_ZLIB']: +if CONFIG['MOZ_SYSTEM_ZLIB']: OS_LIBS += CONFIG['MOZ_ZLIB_LIBS'] else: if CONFIG['ZLIB_IN_MOZGLUE']: # Can't do this until mozglue is handled by moz.build instead of # config/rules.mk. # USE_LIBS += [ # 'mozglue' # ]
--- a/config/rules.mk +++ b/config/rules.mk @@ -202,22 +202,16 @@ endif # !GNU_CC endif # WINNT ifeq (arm-Darwin,$(CPU_ARCH)-$(OS_TARGET)) ifdef PROGRAM MOZ_PROGRAM_LDFLAGS += -Wl,-rpath -Wl,@executable_path/Frameworks endif endif -ifeq ($(SOLARIS_SUNPRO_CXX),1) -ifeq (86,$(findstring 86,$(OS_TEST))) -OS_LDFLAGS += -M $(MOZILLA_DIR)/config/solaris_ia32.map -endif # x86 -endif # Solaris Sun Studio C++ - ifeq ($(HOST_OS_ARCH),WINNT) HOST_PDBFILE=$(basename $(@F)).pdb HOST_PDB_FLAG ?= -Fd$(HOST_PDBFILE) HOST_CFLAGS += $(HOST_PDB_FLAG) HOST_CXXFLAGS += $(HOST_PDB_FLAG) endif # Don't build SIMPLE_PROGRAMS during the MOZ_PROFILE_GENERATE pass @@ -231,17 +225,18 @@ TARGETS = $(LIBRARY) $(SHARED_LIBRARY) endif COBJS = $(notdir $(CSRCS:.c=.$(OBJ_SUFFIX))) SOBJS = $(notdir $(SSRCS:.S=.$(OBJ_SUFFIX))) # CPPSRCS can have different extensions (eg: .cpp, .cc) CPPOBJS = $(notdir $(addsuffix .$(OBJ_SUFFIX),$(basename $(CPPSRCS)))) CMOBJS = $(notdir $(CMSRCS:.m=.$(OBJ_SUFFIX))) CMMOBJS = $(notdir $(CMMSRCS:.mm=.$(OBJ_SUFFIX))) -ASOBJS = $(notdir $(ASFILES:.$(ASM_SUFFIX)=.$(OBJ_SUFFIX))) +# ASFILES can have different extensions (.s, .asm) +ASOBJS = $(notdir $(addsuffix .$(OBJ_SUFFIX),$(basename $(ASFILES)))) RSOBJS = $(addprefix lib,$(notdir $(RSSRCS:.rs=.$(LIB_SUFFIX)))) ifndef OBJS _OBJS = $(COBJS) $(SOBJS) $(CPPOBJS) $(CMOBJS) $(CMMOBJS) $(ASOBJS) $(RSOBJS) OBJS = $(strip $(_OBJS)) endif HOST_COBJS = $(addprefix host_,$(notdir $(HOST_CSRCS:.c=.$(OBJ_SUFFIX)))) # HOST_CPPOBJS can have different extensions (eg: .cpp, .cc) @@ -287,24 +282,16 @@ endif ifdef SIMPLE_PROGRAMS GARBAGE += $(SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX)) endif ifdef HOST_SIMPLE_PROGRAMS GARBAGE += $(HOST_SIMPLE_PROGRAMS:%=%.$(OBJ_SUFFIX)) endif -# -# the Solaris WorkShop template repository cache. it occasionally can get -# out of sync, so targets like clobber should kill it. -# -ifeq ($(SOLARIS_SUNPRO_CXX),1) -GARBAGE_DIRS += SunWS_cache -endif - ifdef MOZ_UPDATE_XTERM # Its good not to have a newline at the end of the titlebar string because it # makes the make -s output easier to read. Echo -n does not work on all # platforms, but we can trick printf into doing it. ifeq (.,$(relativesrcdir)) UPDATE_TITLE = printf '\033]0;%s in %s\007' $(1) $(2) ; else UPDATE_TITLE = printf '\033]0;%s in %s\007' $(1) $(relativesrcdir)/$(2) ; @@ -858,35 +845,16 @@ ifdef MOZ_PROFILE_GENERATE touch -t `date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink endif endif # WINNT && !GCC chmod +x $@ ifdef ENABLE_STRIP $(STRIP) $(STRIP_FLAGS) $@ endif -ifeq ($(SOLARIS_SUNPRO_CC),1) -_MDDEPFILE = $(MDDEPDIR)/$(@F).pp - -define MAKE_DEPS_AUTO_CC -if test -d $(@D); then \ - echo 'Building deps for $< using Sun Studio cc'; \ - $(CC) $(COMPILE_CFLAGS) -xM $< >$(_MDDEPFILE) ; \ - $(PYTHON) $(MOZILLA_DIR)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \ -fi -endef -define MAKE_DEPS_AUTO_CXX -if test -d $(@D); then \ - echo 'Building deps for $< using Sun Studio CC'; \ - $(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \ - $(PYTHON) $(MOZILLA_DIR)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \ -fi -endef -endif # Sun Studio on Solaris - # The object file is in the current directory, and the source file can be any # relative path. This macro adds the dependency obj: src for each source file. # This dependency must be first for the $< flag to work correctly, and the # rules that have commands for these targets must not list any other # prerequisites, or they will override the $< variable. define src_objdep $(basename $2$(notdir $1)).$(OBJ_SUFFIX): $1 $$(call mkdir_deps,$$(MDDEPDIR)) endef @@ -916,17 +884,16 @@ src_libdep = $(call mk_libname,$1): $1 $ $(ELOG) $(HOST_CC) $(HOST_OUTOPTION)$@ -c $(HOST_CFLAGS) $(HOST_CMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS) $(HOST_CMMOBJS): $(REPORT_BUILD) $(ELOG) $(HOST_CXX) $(HOST_OUTOPTION)$@ -c $(HOST_CXXFLAGS) $(HOST_CMMFLAGS) $(INCLUDES) $(NSPR_CFLAGS) $(_VPATH_SRCS) $(COBJS): $(REPORT_BUILD) - @$(MAKE_DEPS_AUTO_CC) $(ELOG) $(CC) $(OUTOPTION)$@ -c $(COMPILE_CFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS) # DEFINES and ACDEFINES are needed here to enable conditional compilation of Q_OBJECTs: # 'moc' only knows about #defines it gets on the command line (-D...), not in # included headers like mozilla-config.h $(filter moc_%.cpp,$(CPPSRCS)): moc_%.cpp: %.h $(REPORT_BUILD) $(ELOG) $(MOC) $(DEFINES) $(ACDEFINES) $< $(OUTOPTION)$@ @@ -957,27 +924,24 @@ endif $(SOBJS): $(REPORT_BUILD) $(AS) -o $@ $(ASFLAGS) $($(notdir $<)_FLAGS) $(LOCAL_INCLUDES) $(TARGET_LOCAL_INCLUDES) -c $< $(CPPOBJS): $(REPORT_BUILD) $(call BUILDSTATUS,OBJECT_FILE $@) - @$(MAKE_DEPS_AUTO_CXX) $(ELOG) $(CCC) $(OUTOPTION)$@ -c $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS) $(CMMOBJS): $(REPORT_BUILD) - @$(MAKE_DEPS_AUTO_CXX) $(ELOG) $(CCC) -o $@ -c $(COMPILE_CXXFLAGS) $(COMPILE_CMMFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS) $(CMOBJS): $(REPORT_BUILD) - @$(MAKE_DEPS_AUTO_CC) $(ELOG) $(CC) -o $@ -c $(COMPILE_CFLAGS) $(COMPILE_CMFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS) $(filter %.s,$(CPPSRCS:%.cpp=%.s)): %.s: %.cpp $(call mkdir_deps,$(MDDEPDIR)) $(REPORT_BUILD) $(CCC) -S $(COMPILE_CXXFLAGS) $($(notdir $<)_FLAGS) $(TARGET_LOCAL_INCLUDES) $(_VPATH_SRCS) $(filter %.s,$(CPPSRCS:%.cc=%.s)): %.s: %.cc $(call mkdir_deps,$(MDDEPDIR)) $(REPORT_BUILD)
deleted file mode 100644 --- a/config/solaris_ia32.map +++ /dev/null @@ -1,5 +0,0 @@ -# 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/. - -hwcap_1 = OVERRIDE;
--- a/config/system-headers +++ b/config/system-headers @@ -569,17 +569,17 @@ iostream.h istream iterator JavaControl.h JavaEmbedding/JavaControl.h JavaVM/jni.h JManager.h JNIEnvTests.h jni.h -#if MOZ_NATIVE_JPEG==1 +#if MOZ_SYSTEM_JPEG==1 jpeglib.h #endif JVMManagerTests.h Kerberos/Kerberos.h kernel/image.h kernel/OS.h LAction.h langinfo.h @@ -1258,40 +1258,40 @@ X11/Xlocale.h X11/Xos.h X11/Xutil.h zmouse.h soundtouch/SoundTouch.h soundtouch/SoundTouchFactory.h #if MOZ_LIBAV_FFT==1 libavcodec/avfft.h #endif -#if MOZ_NATIVE_PNG==1 +#if MOZ_SYSTEM_PNG==1 png.h #endif -#if MOZ_NATIVE_ZLIB==1 +#if MOZ_SYSTEM_ZLIB==1 zlib.h #endif #ifdef MOZ_ENABLE_STARTUP_NOTIFICATION libsn/sn.h libsn/sn-common.h libsn/sn-launchee.h libsn/sn-launcher.h libsn/sn-monitor.h libsn/sn-util.h #endif -#if MOZ_NATIVE_HUNSPELL==1 +#if MOZ_SYSTEM_HUNSPELL==1 hunspell.hxx #endif -#if MOZ_NATIVE_BZ2==1 +#if MOZ_SYSTEM_BZ2==1 bzlib.h #endif #ifdef MOZ_ENABLE_GIO gio/gio.h #endif -#if MOZ_NATIVE_LIBEVENT==1 +#if MOZ_SYSTEM_LIBEVENT==1 event.h #else sys/event.h #endif #ifdef MOZ_ENABLE_LIBPROXY proxy.h #endif #ifdef MOZ_ENABLE_CONTENTMANAGER @@ -1300,17 +1300,17 @@ SelectMultipleContentItemsPage.h QtSparql/qsparqlconnection.h QtSparql/qsparqlquery.h QtSparql/qsparqlresult.h #endif #if MOZ_TREE_PIXMAN!=1 pixman.h #endif -#if MOZ_NATIVE_LIBVPX==1 +#if MOZ_SYSTEM_LIBVPX==1 vpx/svc_context.h vpx/vpx_codec.h vpx/vpx_decoder.h vpx/vpx_encoder.h vpx/vp8cx.h vpx/vp8dx.h vpx_mem/vpx_mem.h #endif
--- a/db/sqlite3/src/moz.build +++ b/db/sqlite3/src/moz.build @@ -73,18 +73,14 @@ if CONFIG['OS_TARGET'] == 'Android': DEFINES['SQLITE_DEFAULT_FILE_PERMISSIONS'] = '0600' # Force using malloc_usable_size when building with jemalloc because _msize # causes assertions on Win64. See bug 719579. if CONFIG['OS_ARCH'] == 'WINNT' and CONFIG['MOZ_MEMORY']: DEFINES['HAVE_MALLOC_USABLE_SIZE'] = True DEFINES['SQLITE_WITHOUT_MSIZE'] = True -# disable PGO for Sun Studio -if CONFIG['SOLARIS_SUNPRO_CC']: - NO_PGO = True - # Suppress warnings in third-party code. if CONFIG['GNU_CC']: CFLAGS += [ '-Wno-sign-compare', '-Wno-type-limits', ]
--- a/devtools/shared/apps/tests/test_webapps_actor.html +++ b/devtools/shared/apps/tests/test_webapps_actor.html @@ -66,17 +66,16 @@ const CERTIFIED_APP_ID = "test-certified const CERTIFIED_APP_ORIGIN = "app://" + CERTIFIED_APP_ID; const CERTIFIED_APP_MANIFEST = CERTIFIED_APP_ORIGIN + "/manifest.webapp"; const SYSTEM_APP_ID = "test-system-id"; var steps = [ function() { info("== SETUP =="); // Set up - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.addPermission("webapps-manage", true, document); SpecialPowers.addPermission("browser", true, document); SpecialPowers.addPermission("embed-apps", true, document); // Required on firefox as these prefs are only set on b2g: SpecialPowers.pushPrefEnv({ set: [["dom.mozBrowserFramesEnabled", true], ["security.apps.privileged.CSP.default",
--- a/devtools/shared/apps/tests/unit/head_apps.js +++ b/devtools/shared/apps/tests/unit/head_apps.js @@ -75,20 +75,17 @@ function setup() { // The webapps dir isn't registered on b2g xpcshell tests, // we have to manually set it to the directory service. do_get_webappsdir(); // We also need a valid nsIXulAppInfo service as Webapps.jsm is querying it Components.utils.import("resource://testing-common/AppInfo.jsm"); updateAppInfo(); - // We have to toggle this flag in order to have apps being listed in getAll - // as only launchable apps are returned Components.utils.import('resource://gre/modules/Webapps.jsm'); - DOMApplicationRegistry.allAppsLaunchable = true; // Enable launch/close method of the webapps actor let {WebappsActor} = require("devtools/server/actors/webapps"); WebappsActor.prototype.supportsLaunch = true; } function do_get_webappsdir() { var webappsDir = Services.dirsvc.get("ProfD", Ci.nsILocalFile);
--- a/docshell/base/nsDocShell.cpp +++ b/docshell/base/nsDocShell.cpp @@ -13486,16 +13486,21 @@ public: nsIInputStream* aPostDataStream, nsIInputStream* aHeadersDataStream, bool aIsTrusted); NS_IMETHOD Run() { nsAutoPopupStatePusher popupStatePusher(mPopupState); + // We need to set up an AutoJSAPI here for the following reason: When we do + // OnLinkClickSync we'll eventually end up in nsGlobalWindow::OpenInternal + // which only does popup blocking if !LegacyIsCallerChromeOrNativeCode(). + // So we need to fake things so that we don't look like native code as far + // as LegacyIsCallerNativeCode() is concerned. AutoJSAPI jsapi; if (mIsTrusted || jsapi.Init(mContent->OwnerDoc()->GetScopeObject())) { mHandler->OnLinkClickSync(mContent, mURI, mTargetSpec.get(), mFileName, mPostDataStream, mHeadersDataStream, nullptr, nullptr); } return NS_OK;
--- a/dom/activities/tests/mochi/test_dev_mode_activity.html +++ b/dom/activities/tests/mochi/test_dev_mode_activity.html @@ -158,18 +158,16 @@ var obsService = Cc["@mozilla.org/observ obsService.addObserver(continueTest, "new-activity-registered-success", false); obsService.addObserver(continueTest, "new-activity-registered-failure", false); /** * Test dev mode activity. */ function runTest() { - SpecialPowers.setAllAppsLaunchable(true); - SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; // Check how many apps we are starting with. var request = navigator.mozApps.mgmt.getAll();
--- a/dom/activities/tests/mochi/test_same_name_multiple_filters.html +++ b/dom/activities/tests/mochi/test_same_name_multiple_filters.html @@ -119,18 +119,16 @@ function continueTest() { try { gGenerator.next(); } catch (e if e instanceof StopIteration) { finish(); } } function runTest() { - SpecialPowers.setAllAppsLaunchable(true); - SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; // Check how many apps we are starting with. var request = navigator.mozApps.mgmt.getAll();
--- a/dom/apps/Webapps.jsm +++ b/dom/apps/Webapps.jsm @@ -191,17 +191,16 @@ this.DOMApplicationRegistry = { get kPackaged() { return "packaged"; }, get kHosted() { return "hosted"; }, get kHostedAppcache() { return "hosted-appcache"; }, get kAndroid() { return "android-native"; }, // Path to the webapps.json file where we store the registry data. appsFile: null, webapps: { }, - allAppsLaunchable: false, _updateHandlers: [ ], _pendingUninstalls: {}, _contentActions: new Map(), dirKey: DIRECTORY_NAME, init: function() { // Keep the messages in sync with the lazy-loading in browser.js (bug 1171013). this.messages = ["Webapps:Install", @@ -1271,20 +1270,16 @@ this.DOMApplicationRegistry = { formatMessage: function(aData) { let msg = aData; delete msg["mm"]; return msg; }, receiveMessage: function(aMessage) { - // nsIPrefBranch throws if pref does not exist, faster to simply write - // the pref instead of first checking if it is false. - Services.prefs.setBoolPref("dom.mozApps.used", true); - let msg = aMessage.data || {}; let mm = aMessage.target; msg.mm = mm; let principal = aMessage.principal; let checkPermission = function(aPermission) { if (!permMgr.testPermissionFromPrincipal(principal, aPermission)) { @@ -2542,18 +2537,17 @@ this.DOMApplicationRegistry = { let checkManifest = (function() { if (!app.manifest) { sendError("MANIFEST_PARSE_ERROR"); return false; } // Disallow reinstalls from the same manifest url for now. for (let id in this.webapps) { - if (this.webapps[id].manifestURL == app.manifestURL && - this._isLaunchable(this.webapps[id])) { + if (this.webapps[id].manifestURL == app.manifestURL) { sendError("REINSTALL_FORBIDDEN"); return false; } } if (!AppsUtils.checkManifest(app.manifest, app)) { sendError("INVALID_MANIFEST"); return false; @@ -2674,17 +2668,17 @@ this.DOMApplicationRegistry = { } } let checkUpdateManifest = (function() { let manifest = app.updateManifest; // Disallow reinstalls from the same manifest URL for now. let id = this._appIdForManifestURL(app.manifestURL); - if (id !== null && this._isLaunchable(this.webapps[id])) { + if (id !== null) { sendError("REINSTALL_FORBIDDEN"); return false; } if (!(AppsUtils.checkManifest(manifest, app) && manifest.package_path)) { sendError("INVALID_MANIFEST"); return false; } @@ -3136,23 +3130,17 @@ this.DOMApplicationRegistry = { aData.isPackage ? appObject.updateManifest = jsonManifest : appObject.manifest = jsonManifest; MessageBroadcaster.broadcastMessage("Webapps:AddApp", { id: id, app: appObject }); if (!aData.isPackage) { this.updateAppHandlers(null, app.manifest, app); if (aInstallSuccessCallback) { - try { - yield aInstallSuccessCallback(app, app.manifest); - } catch (e) { - // Ignore exceptions during the local installation of - // an app. If it fails, the app will anyway be considered - // as not installed because isLaunchable will return false. - } + yield aInstallSuccessCallback(app, app.manifest); } } // The presence of a requestID means that we have a page to update. if (aData.isPackage && aData.apkInstall && !aData.requestID) { // Skip directly to onInstallSuccessAck, since there isn't // a WebappsRegistry to receive Webapps:Install:Return:OK and respond // Webapps:Install:Return:Ack when an app is being auto-installed. @@ -3232,23 +3220,17 @@ this.DOMApplicationRegistry = { kind: this.webapps[aId].kind }, true); } this.updateDataStore(this.webapps[aId].localId, aNewApp.origin, aNewApp.manifestURL, aManifest); if (aInstallSuccessCallback) { - try { - yield aInstallSuccessCallback(aNewApp, aManifest, zipFile.path); - } catch (e) { - // Ignore exceptions during the local installation of - // an app. If it fails, the app will anyway be considered - // as not installed because isLaunchable will return false. - } + yield aInstallSuccessCallback(aNewApp, aManifest, zipFile.path); } MessageBroadcaster.broadcastMessage("Webapps:UpdateState", { app: app, manifest: aManifest, manifestURL: aNewApp.manifestURL }); @@ -4013,17 +3995,17 @@ this.DOMApplicationRegistry = { } // Nothing else to do for an update... since the // origin can't change we don't need to move the // app nor can we have a duplicated origin } else { debug("Setting origin to " + uri.prePath + " for " + aOldApp.manifestURL); let newId = uri.prePath.substring(6); // "app://".length - if (newId in this.webapps && this._isLaunchable(this.webapps[newId])) { + if (newId in this.webapps) { throw "DUPLICATE_ORIGIN"; } aOldApp.origin = uri.prePath; // Update the registry. let oldId = aOldApp.id; if (oldId == newId) { // This could happen when we have an app in the registry @@ -4292,18 +4274,17 @@ this.DOMApplicationRegistry = { aMm.sendAsyncMessage("Webapps:GetSelf:Return:OK", this.formatMessage(aData)); return; } let tmp = []; for (let id in this.webapps) { if (this.webapps[id].origin == aData.origin && - this.webapps[id].localId == aData.appId && - this._isLaunchable(this.webapps[id])) { + this.webapps[id].localId == aData.appId) { let app = AppsUtils.cloneAppObject(this.webapps[id]); aData.apps.push(app); tmp.push({ id: id }); break; } } if (!aData.apps.length) { @@ -4318,18 +4299,17 @@ this.DOMApplicationRegistry = { }); }, checkInstalled: function(aData, aMm) { aData.app = null; let tmp = []; for (let appId in this.webapps) { - if (this.webapps[appId].manifestURL == aData.manifestURL && - this._isLaunchable(this.webapps[appId])) { + if (this.webapps[appId].manifestURL == aData.manifestURL) { aData.app = AppsUtils.cloneAppObject(this.webapps[appId]); tmp.push({ id: appId }); break; } } this._readManifests(tmp).then((aResult) => { for (let i = 0; i < aResult.length; i++) { @@ -4340,46 +4320,32 @@ this.DOMApplicationRegistry = { }); }, getInstalled: function(aData, aMm) { aData.apps = []; let tmp = []; for (let id in this.webapps) { - if (this.webapps[id].installOrigin == aData.origin && - this._isLaunchable(this.webapps[id])) { + if (this.webapps[id].installOrigin == aData.origin) { aData.apps.push(AppsUtils.cloneAppObject(this.webapps[id])); tmp.push({ id: id }); } } this._readManifests(tmp).then((aResult) => { for (let i = 0; i < aResult.length; i++) aData.apps[i].manifest = aResult[i].manifest; aMm.sendAsyncMessage("Webapps:GetInstalled:Return:OK", this.formatMessage(aData)); }); }, getNotInstalled: function(aData, aMm) { aData.apps = []; - let tmp = []; - - for (let id in this.webapps) { - if (!this._isLaunchable(this.webapps[id])) { - aData.apps.push(AppsUtils.cloneAppObject(this.webapps[id])); - tmp.push({ id: id }); - } - } - - this._readManifests(tmp).then((aResult) => { - for (let i = 0; i < aResult.length; i++) - aData.apps[i].manifest = aResult[i].manifest; - aMm.sendAsyncMessage("Webapps:GetNotInstalled:Return:OK", this.formatMessage(aData)); - }); + aMm.sendAsyncMessage("Webapps:GetNotInstalled:Return:OK", this.formatMessage(aData)); }, getIcon: function(aData, aMm) { let sendError = (aError) => { debug("getIcon error: " + aError); aData.error = aError; aMm.sendAsyncMessage("Webapps:GetIcon:Return", this.formatMessage(aData)); }; @@ -4798,20 +4764,16 @@ this.DOMApplicationRegistry = { updateDataStoreEntriesFromLocalId: function(aLocalId) { let app = appsService.getAppByLocalId(aLocalId); if (app) { this.updateDataStoreForApp(app.id); } }, - _isLaunchable: function(aApp) { - return true; - }, - _notifyCategoryAndObservers: function(subject, topic, data, msg) { const serviceMarker = "service,"; // First create observers from the category manager. let cm = Cc["@mozilla.org/categorymanager;1"].getService(Ci.nsICategoryManager); let enumerator = cm.enumerateCategory(topic);
--- a/dom/apps/tests/chrome.ini +++ b/dom/apps/tests/chrome.ini @@ -11,17 +11,16 @@ support-files = install_and_redirect_helper.xul [test_apps_service.xul] [test_bug_765063.xul] [test_bug_771294.xul] [test_bug_945152.html] skip-if = os != 'linux' [test_cross_origin.xul] -[test_getNotInstalled.xul] [test_install_app.xul] [test_install_errors.xul] [test_install_utf8.xul] [test_launch_paths.xul] [test_list_api.xul] [test_manifest_helper.xul] [test_operator_app_install.js] [test_operator_app_install.xul]
--- a/dom/apps/tests/file_bug_779982.js +++ b/dom/apps/tests/file_bug_779982.js @@ -1,10 +1,9 @@ SimpleTest.waitForExplicitFinish(); -SpecialPowers.setAllAppsLaunchable(true); var fileTestOnCurrentOrigin = 'http://example.org/tests/dom/apps/tests/file_bug_779982.html'; var gData = [ // APP 1 { app: 'http://example.org/manifest.webapp', action: 'getSelf',
--- a/dom/apps/tests/file_test_widget.js +++ b/dom/apps/tests/file_test_widget.js @@ -188,17 +188,16 @@ var tests = [ // Preferences function() { SpecialPowers.pushPrefEnv({"set": [["dom.mozBrowserFramesEnabled", true], ["dom.enable_widgets", true]]}, runTest); }, // No confirmation needed when an app is installed function() { - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.autoConfirmAppInstall(() => { SpecialPowers.autoConfirmAppUninstall(runTest); }); }, // Installing the app ()=>installApp(gWidgetManifestURL),
--- a/dom/apps/tests/head.js +++ b/dom/apps/tests/head.js @@ -3,29 +3,16 @@ var { classes: Cc, interfaces: Ci, utils: Cu, results: Cr } = Components; Cu.import("resource://gre/modules/XPCOMUtils.jsm"); function runAll(steps) { SimpleTest.waitForExplicitFinish(); - /** - * On Mac, apps aren't considered launchable right after they've been - * installed because the OS takes some time to detect them (so - * nsIMacWebAppUtils::pathForAppWithIdentifier() returns null). - * That causes methods like mgmt.getAll() to exclude the app from their - * results, even though the app is installed and is in the registry. - * See the tests under toolkit/webapps for a viable solution. - * - * To work around this problem, set allAppsLaunchable to true, which makes - * all apps considered as launchable. - */ - SpecialPowers.setAllAppsLaunchable(true); - // Clone the array so we don't modify the original. steps = steps.concat(); function next() { if (steps.length) { steps.shift()(next); } else { SimpleTest.finish();
--- a/dom/apps/tests/test_app_addons.html +++ b/dom/apps/tests/test_app_addons.html @@ -99,17 +99,16 @@ function installApp(manifestURL, expecte } } } req.onerror = mozAppsError; } function runTest() { // Set up. - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.allowUnsignedAddons(); SpecialPowers.debugUserCustomizations(true); SpecialPowers.pushPrefEnv({'set': [ ["dom.mozBrowserFramesEnabled", true], ["dom.apps.customization.enabled", true], ]},continueTest); yield undefined;
--- a/dom/apps/tests/test_app_blocklist.html +++ b/dom/apps/tests/test_app_blocklist.html @@ -108,18 +108,16 @@ function installApp(manifestURL) { req.onerror = mozAppsError; return req; } /** * Test blocking of an add-on. */ function runTest() { - SpecialPowers.setAllAppsLaunchable(true); - SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; request = navigator.mozApps.mgmt.getAll(); request.onerror = cbError;
--- a/dom/apps/tests/test_app_enabled.html +++ b/dom/apps/tests/test_app_enabled.html @@ -48,18 +48,16 @@ function cbError(aEvent) { } SimpleTest.waitForExplicitFinish(); /** * Flip the `enabled` state of an app back and forth. */ function runTest() { - SpecialPowers.setAllAppsLaunchable(true); - SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; request = navigator.mozApps.mgmt.getAll(); request.onerror = cbError;
--- a/dom/apps/tests/test_app_update.html +++ b/dom/apps/tests/test_app_update.html @@ -56,17 +56,16 @@ https://bugzilla.mozilla.org/show_bug.cg function xhrAbort(url) { ok(false, "XHR abort loading " + url); finish(); } function runTest() { // Set up. - SpecialPowers.setAllAppsLaunchable(true); // Test Bug 927699 - navigator.mozApps.install(url) lets NS_ERROR_FAILURE // onto the web var request = navigator.mozApps.install(""); request.onerror = function() { ok(request.error.name == "INVALID_URL", "Got expected INVALID_URL"); continueTest(); }; request.onsuccess = mozAppsError;
--- a/dom/apps/tests/test_bug_1168300.html +++ b/dom/apps/tests/test_bug_1168300.html @@ -35,17 +35,16 @@ https://bugzilla.mozilla.org/show_bug.cg function mozAppsError() { ok(false, "mozApps error: " + this.error.name); SimpleTest.finish(); } function runTest() { // Set up. - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; let request = navigator.mozApps.install(url); request.onerror = mozAppsError;
--- a/dom/apps/tests/test_bug_765063.xul +++ b/dom/apps/tests/test_bug_765063.xul @@ -15,18 +15,16 @@ <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=741549" target="_blank">Mozilla Bug 765063</a> </body> <script> SimpleTest.waitForExplicitFinish(); -SpecialPowers.setAllAppsLaunchable(true); - var mmListener = { receiveMessage: function(aMessage) { ppmm.removeMessageListener("Webapps:Install", mmListener); var msg = aMessage.json; var ioService = Components.classes["@mozilla.org/network/io-service;1"] .getService(Components.interfaces.nsIIOService); var uri = ioService.newURI(msg.from, null, null);
--- a/dom/apps/tests/test_bug_771294.xul +++ b/dom/apps/tests/test_bug_771294.xul @@ -14,18 +14,16 @@ <body xmlns="http://www.w3.org/1999/xhtml"> <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=771294" target="_blank">Mozilla Bug 771294</a> </body> <script> SimpleTest.waitForExplicitFinish(); -SpecialPowers.setAllAppsLaunchable(true); - Cu.import("resource://gre/modules/Services.jsm"); Cu.import("resource://gre/modules/PopupNotifications.jsm"); let PopupNotifications = window.top.QueryInterface(Ci.nsIInterfaceRequestor) .getInterface(Ci.nsIWebNavigation) .QueryInterface(Ci.nsIDocShell) .chromeEventHandler.ownerDocument.defaultView .PopupNotifications;
--- a/dom/apps/tests/test_bug_795164.html +++ b/dom/apps/tests/test_bug_795164.html @@ -36,17 +36,16 @@ https://bugzilla.mozilla.org/show_bug.cg function mozAppsError() { ok(false, "mozApps error: " + this.error.name); SimpleTest.finish(); } function runTest() { // Set up. - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; // Keeping track of the number of times `mozApps.mgmt.onuninstall` gets triggered let uninstallCount = 0;
--- a/dom/apps/tests/test_bug_945152.html +++ b/dom/apps/tests/test_bug_945152.html @@ -42,17 +42,16 @@ https://bugzilla.mozilla.org/show_bug.cg function xhrAbort(url) { ok(false, "XHR abort loading " + url); finish(); } function runTest() { // Set up. - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({ "set": [ ["dom.mozBrowserFramesEnabled", true], ["dom.mapped_arraybuffer.enabled", true] ] }, continueTest); yield undefined;
--- a/dom/apps/tests/test_checkInstalled.html +++ b/dom/apps/tests/test_checkInstalled.html @@ -48,18 +48,16 @@ function finish() { function cbError(aError) { ok(false, "Error callback invoked " + aError.target.error.name); finish(); } SimpleTest.waitForExplicitFinish(); function runTest() { - SpecialPowers.setAllAppsLaunchable(true); - SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; var request = navigator.mozApps.install(gManifestURL); request.onerror = cbError;
deleted file mode 100644 --- a/dom/apps/tests/test_getNotInstalled.xul +++ /dev/null @@ -1,139 +0,0 @@ -<?xml version="1.0"?> - -<!-- Any copyright is dedicated to the Public Domain. - - http://creativecommons.org/publicdomain/zero/1.0/ --> - -<?xml-stylesheet type="text/css" href="chrome://global/skin"?> -<?xml-stylesheet type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css"?> - -<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" - title="Mozilla Bug 781379"> - <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> - <script type="application/javascript" src="head.js"/> - <!-- test results are displayed in the html:body --> - <body xmlns="http://www.w3.org/1999/xhtml"> - <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=741549" - target="_blank">Mozilla Bug 781379</a> - </body> - -<script type="application/javascript;version=1.8"> - -Cu.import("resource://gre/modules/Webapps.jsm"); - -// We use a different origin than other webapps test files because we compare -// the number of apps before and after installing this one; and if a test file -// installs our app and then doesn't uninstall it (f.e. because it isn't written -// to clean up after itself, or because it throws an exception or times out), -// then this test will *reinstall* the app, and the number of apps won't change, -// which will look like a failure in this test although it's actually a failure -// in the other one. -// -// Using a different origin here isn't a foolproof solution, as another test -// could start using it. Reviewer vigilance is required! And to anyone reading -// this: don't use this origin without good reason and due consideration for -// the potential consequences! -// -// Alternately, we could define a test-specific domain, getNotInstalled.com, -// in source/build/pgo/server-locations.txt. But that seems like overkill, -// and this problem will go away once we support multiple apps per origin, -// since then we can make this test install its own personal webapp from any -// origin. -// -let url = "http://example.com/chrome/dom/apps/tests/apps/basic.webapp"; - -let app, notInstalled, _isLaunchable; - -let steps = [ - monkeyPatchDOMApplicationRegistry, - getNotInstalled, - installApp, - compareNotInstalled, - unmonkeyPatchDOMApplicationRegistry, - uninstallApp, -]; - -runAll(steps); - -// Monkey patch DOMApplicationRegistry._isLaunchable for testing. -// This way, we don't have to create a platform specific application with a -// status other than "installed". -function monkeyPatchDOMApplicationRegistry(next) { - _isLaunchable = DOMApplicationRegistry._isLaunchable; - DOMApplicationRegistry._isLaunchable = function mockIsLaunchable(aOrigin) { - return false; - } - next(); -} - -// Call navigator.mozApps.mgmt.getNotInstalled and save the result. -function getNotInstalled(next) { - window.navigator.mozApps.mgmt.getNotInstalled().onsuccess = - function onGetNotInstalled() { - notInstalled = this.result.length; - next(); - }; -} - -// Add an app to the appregistry -function installApp(next) { - confirmNextPopup(); - navigator.mozApps.install(url, null).onsuccess = function onInstall() { - app = this.result; - next(); - }; -} - -// Call navigator.mozApps.mgmt.getNotInstalled and make sure there is one more. -function compareNotInstalled(next) { - let results; - function getNotInstalledError() { - ok(false, "window.mozApps.mgmt.getNotInstalled onerror called"); - next(); - } - function getNotInstalledSuccess() { - ok(true, "window.mozApps.mgmt.getNotInstalled onsuccess called"); - is(this.result.length, notInstalled + 1, - "should get one more notInstalled app"); - - if (this.result.length > 0) { - is(this.result[this.result.length-1].origin, "http://example.com", - "getNotInstalled returned the expected app"); - } - next(); - } - - let type = typeof window.navigator.mozApps.getNotInstalled; - is(type, "undefined", "getNotInstalled moved from window.navigator"); - type = typeof window.navigator.mozApps.mgmt.getNotInstalled; - if (type === "function") { - is(type, "function", "getNotInstalled moved to window.navigator.mgmt"); - results = window.navigator.mozApps.mgmt.getNotInstalled(); - results.onerror = getNotInstalledError; - results.onsuccess = getNotInstalledSuccess; - } else { - ok(false, "getNotInstalled not a function"); - next(); - } -} - -function unmonkeyPatchDOMApplicationRegistry(next) { - if (typeof _isLaunchable === "function") { - DOMApplicationRegistry._isLaunchable = _isLaunchable; - ok(true, "restored DOMApplicationRegistry._isLaunchable"); - } else { - ok(false, "can't restore DOMApplicationRegistry._isLaunchable"); - } - next(); -} - -// Remove the app from the appregistry -function uninstallApp(next) { - confirmNextPopup(); - window.navigator.mozApps.mgmt.uninstall(app).onsuccess = function onUninstall() { - app = null; - next(); - } -} - -</script> -</window>
--- a/dom/apps/tests/test_iac.html +++ b/dom/apps/tests/test_iac.html @@ -144,17 +144,16 @@ function launchApp(app) { domParent.appendChild(iframe); SpecialPowers.wrap(iframe.contentWindow).location = app.origin + app.manifest.launch_path; }); } const tests = [() => { info("Test start"); - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.autoConfirmAppInstall(() => { SpecialPowers.autoConfirmAppUninstall(next); }); }, () => { info("Installing subscriber app"); installApp("subscriber/update.webapp").then(app => { subscriber = app; next();
--- a/dom/apps/tests/test_import_export.html +++ b/dom/apps/tests/test_import_export.html @@ -76,18 +76,16 @@ function cbError(aEvent) { } SimpleTest.waitForExplicitFinish(); /** * Test exporting and importing hosted and packaged apps. */ function runTest() { - SpecialPowers.setAllAppsLaunchable(true); - SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; // Check how many apps we are starting with. request = navigator.mozApps.mgmt.getAll();
--- a/dom/apps/tests/test_install_dev_mode.html +++ b/dom/apps/tests/test_install_dev_mode.html @@ -55,18 +55,16 @@ function cbSuccess(aMsg) { } SimpleTest.waitForExplicitFinish(); /** * Install 2 apps from the same origin and uninstall them. */ function runTest() { - SpecialPowers.setAllAppsLaunchable(true); - SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; request = navigator.mozApps.mgmt.getAll(); request.onerror = cbError;
--- a/dom/apps/tests/test_install_multiple_apps_origin.html +++ b/dom/apps/tests/test_install_multiple_apps_origin.html @@ -48,18 +48,16 @@ function cbError(aEvent) { } SimpleTest.waitForExplicitFinish(); /** * Install 2 apps from the same origin and uninstall them. */ function runTest() { - SpecialPowers.setAllAppsLaunchable(true); - var manifestURL1 = gManifestURL + "&app=1"; var manifestURL2 = gManifestURL + "&app=2"; SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined;
--- a/dom/apps/tests/test_install_receipts.html +++ b/dom/apps/tests/test_install_receipts.html @@ -48,18 +48,16 @@ function finish() { function cbError(aError) { ok(false, "Error callback invoked " + aError); finish(); } SimpleTest.waitForExplicitFinish(); function runTest() { - SpecialPowers.setAllAppsLaunchable(true); - SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; // Test install with three valid receipts let valid_receipt1 = 'eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJwcm9kdWN0IjogeyJ1cmwiOiAiaHR0cHM6Ly93d3cubW96aWxsYS5vcmciLCAic3RvcmVkYXRhIjogIjUxNjkzMTQzNTYifSwgInJlaXNzdWUiOiAiaHR0cDovL21vY2hpLnRlc3Q6ODg4OC9yZWlzc3VlLzUxNjkzMTQzNTYiLCAidXNlciI6IHsidHlwZSI6ICJkaXJlY3RlZC1pZGVudGlmaWVyIiwgInZhbHVlIjogIjRmYjM1MTUxLTJiOWItNGJhMi04MjgzLWM0OWQzODE2NDBiZCJ9LCAidmVyaWZ5IjogImh0dHA6Ly9tb2NoaS50ZXN0Ojg4ODgvdmVyaWZ5LzUxNjkzMTQzNTYiLCAiaXNzIjogImh0dHA6Ly9tb2NoaS50ZXN0Ojg4ODgiLCAiaWF0IjogMTMxMzYwMTg4LCAidHlwIjogInB1cmNoYXNlLXJlY2VpcHQiLCAibmJmIjogMTMxMzYwMTg1LCAiZGV0YWlsIjogImh0dHA6Ly9tb2NoaS50ZXN0Ojg4ODgvcmVjZWlwdC81MTY5MzE0MzU2In0.eZpTEnCLUR3iP3rm9WyJOqx1k66mQaAxqcrvX11r5E0';
--- a/dom/apps/tests/test_langpacks.html +++ b/dom/apps/tests/test_langpacks.html @@ -88,17 +88,16 @@ function installApp(manifestURL) { } } } req.onerror = mozAppsError; } function runTest() { // Set up. - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({'set': [ ["dom.mozBrowserFramesEnabled", true], ["dom.apps.allow_unsigned_langpacks", true] ]},continueTest); yield undefined; SpecialPowers.pushPermissions( [{ "type": "webapps-manage", "allow": 1, "context": document }, { "type": "embed-apps", "allow": 1, "context": document },
--- a/dom/apps/tests/test_marketplace_pkg_install.html +++ b/dom/apps/tests/test_marketplace_pkg_install.html @@ -123,17 +123,16 @@ function installApp(installOrigin, manif domParent.removeChild(ifr); }); domParent.appendChild(ifr); } PackagedTestHelper.setSteps([ function() { - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.addPermission("webapps-manage", true, document); SpecialPowers.addPermission("browser", true, document); SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(() => SpecialPowers.pushPrefEnv({set: [["dom.mozBrowserFramesEnabled", true]]}, PackagedTestHelper.next))); },
--- a/dom/apps/tests/test_packaged_app_asmjs.html +++ b/dom/apps/tests/test_packaged_app_asmjs.html @@ -120,17 +120,16 @@ function testNoPrecompile(aPrecompile, a }; }; }); } function runTest() { // Set up. - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({'set': [["dom.mozBrowserFramesEnabled", true]]}, continueTest); yield undefined; SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest);
--- a/dom/apps/tests/test_packaged_app_install.html +++ b/dom/apps/tests/test_packaged_app_install.html @@ -82,17 +82,16 @@ var gIconData = var gIconSize = 15; SimpleTest.waitForExplicitFinish(); SimpleTest.requestFlakyTimeout("untriaged"); var steps = [ function() { // Set up - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.addPermission("webapps-manage", true, document); info("Set up"); PackagedTestHelper.next(); }, function() { info("autoConfirmAppInstall"); SpecialPowers.autoConfirmAppInstall(PackagedTestHelper.next); },
--- a/dom/apps/tests/test_packaged_app_update.html +++ b/dom/apps/tests/test_packaged_app_update.html @@ -137,17 +137,16 @@ function validatePermissions(aList, aDon "Permission " + permission + " should be " + aList[permission]); } } var steps = [ function() { // Set up - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.addPermission("webapps-manage", true, document); info("Set up"); // Note that without useCurrentProfile the permissions just aren't added. SpecialPowers.pushPermissions( [{'type': 'permissions', 'allow': true, 'context': document}], function() { SpecialPowers.pushPrefEnv( {"set": [["dom.mozPermissionSettings.enabled", true],
--- a/dom/apps/tests/test_receipt_operations.html +++ b/dom/apps/tests/test_receipt_operations.html @@ -48,18 +48,16 @@ function finish() { function cbError(aEvent) { ok(false, "Error callback invoked " + aEvent.target.error.name); finish(); } SimpleTest.waitForExplicitFinish(); function runTest() { - SpecialPowers.setAllAppsLaunchable(true); - SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; var request = navigator.mozApps.install(gManifestURL); request.onerror = cbError;
--- a/dom/apps/tests/test_signed_pkg_install.html +++ b/dom/apps/tests/test_signed_pkg_install.html @@ -90,17 +90,16 @@ var steps = [ // Set up info("Test Initial Setup"); gSignedAppOriginsStr = SpecialPowers.getCharPref("dom.mozApps.signed_apps_installable_from"); var signedAppOriginsStr = gSignedAppOriginsStr.concat("," + gInstallOrigin.slice(0, -1)); SpecialPowers.pushPrefEnv({'set': [['dom.mozApps.signed_apps_installable_from', signedAppOriginsStr]]}, function() { var url = SimpleTest.getTestFileURL("chromeAddCert.js"); var script = SpecialPowers.loadChromeScript(url); script.addMessageListener("addCertCompleted", function() { - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.addPermission("webapps-manage", true, document); info("Test CA Certificate Selected"); PackagedTestHelper.next(); script.destroy(); }); }); }, function() {
--- a/dom/apps/tests/test_theme_role.html +++ b/dom/apps/tests/test_theme_role.html @@ -51,18 +51,16 @@ function cbError(aEvent) { } SimpleTest.waitForExplicitFinish(); /** * Checks that no apps that are not certified can be installed as themes. */ function runTest() { - SpecialPowers.setAllAppsLaunchable(true); - SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; // Test that a hosted app can't be a theme. info("Hosted apps can't be themes."); var request = navigator.mozApps.install(gHostedURL, { }); request.onerror = function() { is(request.error.name, "INVALID_ROLE");
--- a/dom/apps/tests/test_third_party_homescreen.html +++ b/dom/apps/tests/test_third_party_homescreen.html @@ -141,18 +141,16 @@ function cbError(aEvent) { } SimpleTest.waitForExplicitFinish(); /** * Test third-party homescreen (permission |homescreen-webapps-manage|) */ function runTest() { - SpecialPowers.setAllAppsLaunchable(true); - SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; // Install a app. var request = navigator.mozApps.install(gManifestURL, { });
--- a/dom/apps/tests/test_uninstall_errors.html +++ b/dom/apps/tests/test_uninstall_errors.html @@ -36,17 +36,16 @@ https://bugzilla.mozilla.org/show_bug.cg function mozAppsError() { ok(false, "mozApps error: " + this.error.name); SimpleTest.finish(); } function runTest() { // Set up. - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; let request = navigator.mozApps.install(url1); request.onerror = mozAppsError;
--- a/dom/apps/tests/test_web_app_install.html +++ b/dom/apps/tests/test_web_app_install.html @@ -98,18 +98,16 @@ function iconTest(app, iconSize, entryPo } SimpleTest.waitForExplicitFinish(); /** * Install a web app from a manifest with application/manifest+json MIME type. */ function runTest() { - SpecialPowers.setAllAppsLaunchable(true); - var manifestURL = "http://test/tests/dom/apps/tests/file_manifest.json"; SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined;
--- a/dom/base/DOMRequest.cpp +++ b/dom/base/DOMRequest.cpp @@ -9,16 +9,17 @@ #include "DOMError.h" #include "nsThreadUtils.h" #include "DOMCursor.h" #include "mozilla/ErrorResult.h" #include "mozilla/dom/Event.h" #include "mozilla/dom/Promise.h" #include "mozilla/dom/ScriptSettings.h" #include "jsfriendapi.h" +#include "nsContentUtils.h" using mozilla::dom::AnyCallback; using mozilla::dom::DOMError; using mozilla::dom::DOMRequest; using mozilla::dom::DOMRequestService; using mozilla::dom::DOMCursor; using mozilla::dom::Promise; using mozilla::dom::AutoJSAPI; @@ -292,35 +293,34 @@ DOMRequestService::FireDetailedError(nsI static_cast<DOMRequest*>(aRequest)->FireDetailedError(err); return NS_OK; } class FireSuccessAsyncTask : public nsRunnable { - FireSuccessAsyncTask(JSContext* aCx, - DOMRequest* aRequest, + FireSuccessAsyncTask(DOMRequest* aRequest, const JS::Value& aResult) : mReq(aRequest), - mResult(aCx, aResult) + mResult(nsContentUtils::RootingCxForThread(), aResult) { } public: // Due to the fact that initialization can fail during shutdown (since we // can't fetch a js context), set up an initiatization function to make sure // we can return the failure appropriately static nsresult Dispatch(DOMRequest* aRequest, const JS::Value& aResult) { - mozilla::ThreadsafeAutoSafeJSContext cx; - RefPtr<FireSuccessAsyncTask> asyncTask = new FireSuccessAsyncTask(cx, aRequest, aResult); + RefPtr<FireSuccessAsyncTask> asyncTask = + new FireSuccessAsyncTask(aRequest, aResult); MOZ_ALWAYS_TRUE(NS_SUCCEEDED(NS_DispatchToCurrentThread(asyncTask))); return NS_OK; } NS_IMETHODIMP Run() { mReq->FireSuccess(JS::Handle<JS::Value>::fromMarkedLocation(mResult.address()));
--- a/dom/base/ScriptSettings.cpp +++ b/dom/base/ScriptSettings.cpp @@ -820,31 +820,9 @@ ThreadsafeAutoJSContext::operator JSCont } AutoSafeJSContext::AutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL) : AutoJSContext(true MOZ_GUARD_OBJECT_NOTIFIER_PARAM_TO_PARENT) , mAc(mCx, xpc::UnprivilegedJunkScope()) { } -ThreadsafeAutoSafeJSContext::ThreadsafeAutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL) -{ - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - - if (NS_IsMainThread()) { - mCx = nullptr; - mAutoSafeJSContext.emplace(); - } else { - mCx = mozilla::dom::workers::GetCurrentThreadJSContext(); - mRequest.emplace(mCx); - } -} - -ThreadsafeAutoSafeJSContext::operator JSContext*() const -{ - if (mCx) { - return mCx; - } else { - return *mAutoSafeJSContext; - } -} - } // namespace mozilla
--- a/dom/base/ScriptSettings.h +++ b/dom/base/ScriptSettings.h @@ -463,27 +463,11 @@ private: */ class MOZ_RAII AutoSafeJSContext : public AutoJSContext { public: explicit AutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM); private: JSAutoCompartment mAc; }; -/** - * Like AutoSafeJSContext but can be used safely on worker threads. - */ -class MOZ_RAII ThreadsafeAutoSafeJSContext { -public: - explicit ThreadsafeAutoSafeJSContext(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM); - operator JSContext*() const; - -private: - JSContext* mCx; // Used on workers. Null means mainthread. - Maybe<JSAutoRequest> mRequest; // Used on workers. - Maybe<AutoSafeJSContext> mAutoSafeJSContext; // Used on main thread. - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER -}; - - } // namespace mozilla #endif // mozilla_dom_ScriptSettings_h
--- a/dom/base/WebSocket.cpp +++ b/dom/base/WebSocket.cpp @@ -1232,17 +1232,17 @@ WebSocket::Constructor(const GlobalObjec // In workers we have to keep the worker alive using a feature in order to // dispatch messages correctly. if (!webSocket->mImpl->RegisterFeature()) { aRv.Throw(NS_ERROR_FAILURE); return nullptr; } unsigned lineno, column; - JS::UniqueChars file; + JS::AutoFilename file; if (!JS::DescribeScriptedCaller(aGlobal.Context(), &file, &lineno, &column)) { NS_WARNING("Failed to get line number and filename in workers."); } RefPtr<InitRunnable> runnable = new InitRunnable(webSocket->mImpl, aUrl, protocolArray, nsAutoCString(file.get()), lineno, column, aRv, @@ -1468,17 +1468,17 @@ WebSocketImpl::Init(JSContext* aCx, if (mWorkerPrivate) { mScriptFile = aScriptFile; mScriptLine = aScriptLine; mScriptColumn = aScriptColumn; } else { MOZ_ASSERT(aCx); unsigned lineno, column; - JS::UniqueChars file; + JS::AutoFilename file; if (JS::DescribeScriptedCaller(aCx, &file, &lineno, &column)) { mScriptFile = file.get(); mScriptLine = lineno; mScriptColumn = column; } } // If we don't have aCx, we are window-less, so we don't have a
--- a/dom/base/nsGlobalWindow.cpp +++ b/dom/base/nsGlobalWindow.cpp @@ -10654,17 +10654,17 @@ nsGlobalWindow::ShowSlowScriptDialog() } // If our document is not active, just kill the script: we've been unloaded if (!AsInner()->HasActiveDocument()) { return KillSlowScript; } // Check if we should offer the option to debug - JS::UniqueChars filename; + JS::AutoFilename filename; unsigned lineno; bool hasFrame = JS::DescribeScriptedCaller(cx, &filename, &lineno); // Record the slow script event if we haven't done so already for this inner window // (which represents a particular page to the user). if (!mHasHadSlowScript) { Telemetry::Accumulate(Telemetry::SLOW_SCRIPT_PAGE_COUNT, 1); } @@ -11437,16 +11437,20 @@ nsGlobalWindow::OpenInternal(const nsASt // Popups from apps are never blocked. bool isApp = false; if (mDoc) { isApp = mDoc->NodePrincipal()->GetAppStatus() >= nsIPrincipal::APP_STATUS_INSTALLED; } + // XXXbz When this gets fixed to not use LegacyIsCallerNativeCode() + // (indirectly) maybe we can nix the AutoJSAPI usage OnLinkClickEvent::Run. + // But note that if you change this to GetEntryGlobal(), say, then + // OnLinkClickEvent::Run will need a full-blown AutoEntryScript. const bool checkForPopup = !nsContentUtils::LegacyIsCallerChromeOrNativeCode() && !isApp && !aDialog && !WindowExists(aName, !aCalledNoScript); // Note: it's very important that this be an nsXPIDLCString, since we want // .get() on it to return nullptr until we write stuff to it. The window // watcher expects a null URL string if there is no URL to load. nsXPIDLCString url; nsresult rv = NS_OK;
--- a/dom/base/nsJSUtils.cpp +++ b/dom/base/nsJSUtils.cpp @@ -32,30 +32,30 @@ #include "mozilla/dom/ScriptSettings.h" using namespace mozilla::dom; bool nsJSUtils::GetCallingLocation(JSContext* aContext, nsACString& aFilename, uint32_t* aLineno, uint32_t* aColumn) { - JS::UniqueChars filename; + JS::AutoFilename filename; if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, aColumn)) { return false; } aFilename.Assign(filename.get()); return true; } bool nsJSUtils::GetCallingLocation(JSContext* aContext, nsAString& aFilename, uint32_t* aLineno, uint32_t* aColumn) { - JS::UniqueChars filename; + JS::AutoFilename filename; if (!JS::DescribeScriptedCaller(aContext, &filename, aLineno, aColumn)) { return false; } aFilename.Assign(NS_ConvertUTF8toUTF16(filename.get())); return true; }
--- a/dom/browser-element/mochitest/browserElement_AllowEmbedAppsInNestedOOIframe.js +++ b/dom/browser-element/mochitest/browserElement_AllowEmbedAppsInNestedOOIframe.js @@ -5,18 +5,16 @@ // process if nested-oop is enabled "use strict"; SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); -SpecialPowers.setAllAppsLaunchable(true); - function runTest() { var iframe = document.createElement('iframe'); iframe.setAttribute('mozbrowser', 'true'); iframe.addEventListener('mozbrowsershowmodalprompt', function(e) { is(e.detail.message == 'app', true, e.detail.message); SimpleTest.finish(); });
--- a/dom/browser-element/mochitest/browserElement_AppFramePermission.js +++ b/dom/browser-element/mochitest/browserElement_AppFramePermission.js @@ -3,18 +3,16 @@ // Bug 777384 - Test mozapp permission. "use strict"; SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); -SpecialPowers.setAllAppsLaunchable(true); - function testAppElement(expectAnApp, callback) { var iframe = document.createElement('iframe'); iframe.setAttribute('mozbrowser', 'true'); iframe.setAttribute('mozapp', 'http://example.org/manifest.webapp'); iframe.addEventListener('mozbrowsershowmodalprompt', function(e) { is(e.detail.message == 'app', expectAnApp, e.detail.message); SimpleTest.executeSoon(callback); });
--- a/dom/browser-element/mochitest/browserElement_DisallowEmbedAppsInOOP.js +++ b/dom/browser-element/mochitest/browserElement_DisallowEmbedAppsInOOP.js @@ -9,18 +9,16 @@ // app. "use strict"; SimpleTest.waitForExplicitFinish(); browserElementTestHelpers.setEnabledPref(true); browserElementTestHelpers.addPermission(); -SpecialPowers.setAllAppsLaunchable(true); - function runTest() { var canEmbedApp = !browserElementTestHelpers.getOOPByDefaultPref(); var iframe = document.createElement('iframe'); iframe.setAttribute('mozbrowser', 'true'); iframe.addEventListener('mozbrowsershowmodalprompt', function(e) { is(e.detail.message == 'app', canEmbedApp, e.detail.message); SimpleTest.finish();
--- a/dom/browser-element/mochitest/browserElement_MultipleAudioChannels.js +++ b/dom/browser-element/mochitest/browserElement_MultipleAudioChannels.js @@ -119,17 +119,16 @@ function runNextTest() { showTestInfo(isEnabledOOP); runTest(isEnabledOOP); } else { SimpleTest.finish(); } } function startTest() { - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; runNextTest(); yield undefined;
--- a/dom/browser-element/mochitest/browserElement_NotifyChannel.js +++ b/dom/browser-element/mochitest/browserElement_NotifyChannel.js @@ -112,17 +112,16 @@ function runNextTest() { var isEnabledOOP = tests.shift(); runTest(isEnabledOOP); } else { SimpleTest.finish(); } } function runTests() { - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; runNextTest(); yield undefined;
--- a/dom/cache/test/mochitest/test_cache_clear_on_app_uninstall.html +++ b/dom/cache/test/mochitest/test_cache_clear_on_app_uninstall.html @@ -18,17 +18,16 @@ SimpleTest.waitForExplicitFinish(); const gOrigin = 'http://mochi.test:8888/tests/dom/cache/test/mochitest/app'; const appManifestURL = gOrigin + '/manifest.webapp'; let gApp; function setup() { return new Promise((resolve, reject) => { - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({'set': [ ['dom.mozBrowserFramesEnabled', true], ['dom.serviceWorkers.exemptFromPerDomainMax', true], ['dom.serviceWorkers.enabled', true], ['dom.serviceWorkers.testing.enabled', true], ['dom.caches.enabled', true], ]}, () => { SpecialPowers.pushPermissions([
--- a/dom/canvas/WebGLProgram.cpp +++ b/dom/canvas/WebGLProgram.cpp @@ -337,17 +337,16 @@ QueryProgramInfo(WebGLProgram* prog, gl: return info.forget(); } //////////////////////////////////////////////////////////////////////////////// webgl::LinkedProgramInfo::LinkedProgramInfo(WebGLProgram* prog) : prog(prog) - , fragDataMap(nullptr) { } //////////////////////////////////////////////////////////////////////////////// // WebGLProgram static GLuint CreateProgram(gl::GLContext* gl) { @@ -564,18 +563,19 @@ WebGLProgram::GetFragDataLocation(const if (!IsLinked()) { mContext->ErrorInvalidOperation("getFragDataLocation: `program` must be linked."); return -1; } const NS_LossyConvertUTF16toASCII userName(userName_wide); nsCString mappedName; - if (!LinkInfo()->FindFragData(userName, &mappedName)) - return -1; + if (!FindActiveOutputMappedNameByUserName(userName, &mappedName)) { + mappedName = userName; + } gl::GLContext* gl = mContext->GL(); gl->MakeCurrent(); return gl->fGetFragDataLocation(mGLName, mappedName.BeginReading()); } void @@ -1046,16 +1046,27 @@ WebGLProgram::LinkAndUpdate() MOZ_ASSERT(mMostRecentLinkInfo); if (!mMostRecentLinkInfo) mLinkLog.AssignLiteral("Failed to gather program info."); return mMostRecentLinkInfo; } bool +WebGLProgram::FindActiveOutputMappedNameByUserName(const nsACString& userName, + nsCString* const out_mappedName) const +{ + if (mFragShader->FindActiveOutputMappedNameByUserName(userName, out_mappedName)) { + return true; + } + + return false; +} + +bool WebGLProgram::FindAttribUserNameByMappedName(const nsACString& mappedName, nsDependentCString* const out_userName) const { if (mVertShader->FindAttribUserNameByMappedName(mappedName, out_userName)) return true; return false; }
--- a/dom/canvas/WebGLProgram.h +++ b/dom/canvas/WebGLProgram.h @@ -62,17 +62,16 @@ struct LinkedProgramInfo final std::vector<RefPtr<WebGLActiveInfo>> activeUniforms; std::vector<RefPtr<WebGLActiveInfo>> transformFeedbackVaryings; // Needed for Get{Attrib,Uniform}Location. The keys for these are non-mapped // user-facing `GLActiveInfo::name`s, without any final "[0]". std::map<nsCString, const WebGLActiveInfo*> attribMap; std::map<nsCString, const WebGLActiveInfo*> uniformMap; std::map<nsCString, const WebGLActiveInfo*> transformFeedbackVaryingsMap; - std::map<nsCString, const nsCString>* fragDataMap; std::vector<RefPtr<UniformBlockInfo>> uniformBlocks; // Needed for draw call validation. std::set<GLuint> activeAttribLocs; explicit LinkedProgramInfo(WebGLProgram* prog); @@ -107,27 +106,16 @@ struct LinkedProgramInfo final *out_info = uniformBlocks[i].get(); return true; } } return false; } - bool FindFragData(const nsCString& baseUserName, - nsCString* const out_baseMappedName) const - { - if (!fragDataMap) { - *out_baseMappedName = baseUserName; - return true; - } - - MOZ_CRASH("Not implemented."); - } - bool HasActiveAttrib(GLuint loc) const { auto itr = activeAttribLocs.find(loc); return itr != activeAttribLocs.end(); } }; } // namespace webgl @@ -169,16 +157,18 @@ public: void UniformBlockBinding(GLuint uniformBlockIndex, GLuint uniformBlockBinding) const; bool LinkProgram(); bool UseProgram() const; void ValidateProgram() const; //////////////// + bool FindActiveOutputMappedNameByUserName(const nsACString& userName, + nsCString* const out_mappedName) const; bool FindAttribUserNameByMappedName(const nsACString& mappedName, nsDependentCString* const out_userName) const; bool FindVaryingByMappedName(const nsACString& mappedName, nsCString* const out_userName, bool* const out_isArray) const; bool FindUniformByMappedName(const nsACString& mappedName, nsCString* const out_userName, bool* const out_isArray) const;
--- a/dom/canvas/WebGLShader.cpp +++ b/dom/canvas/WebGLShader.cpp @@ -325,16 +325,32 @@ WebGLShader::BindAttribLocation(GLuint p const std::string* mappedNameStr = &userNameStr; if (mValidator) mValidator->FindAttribMappedNameByUserName(userNameStr, &mappedNameStr); mContext->gl->fBindAttribLocation(prog, index, mappedNameStr->c_str()); } bool +WebGLShader::FindActiveOutputMappedNameByUserName(const nsACString& userName, + nsCString* const out_mappedName) const +{ + if (!mValidator) + return false; + + const std::string userNameStr(userName.BeginReading()); + const std::string* mappedNameStr; + if (!mValidator->FindActiveOutputMappedNameByUserName(userNameStr, &mappedNameStr)) + return false; + + *out_mappedName = mappedNameStr->c_str(); + return true; +} + +bool WebGLShader::FindAttribUserNameByMappedName(const nsACString& mappedName, nsDependentCString* const out_userName) const { if (!mValidator) return false; const std::string mappedNameStr(mappedName.BeginReading()); const std::string* userNameStr;
--- a/dom/canvas/WebGLShader.h +++ b/dom/canvas/WebGLShader.h @@ -47,16 +47,18 @@ public: void GetShaderTranslatedSource(nsAString* out) const; void ShaderSource(const nsAString& source); // Util funcs bool CanLinkTo(const WebGLShader* prev, nsCString* const out_log) const; size_t CalcNumSamplerUniforms() const; size_t NumAttributes() const; void BindAttribLocation(GLuint prog, const nsCString& userName, GLuint index) const; + bool FindActiveOutputMappedNameByUserName(const nsACString& userName, + nsCString* const out_mappedName) const; bool FindAttribUserNameByMappedName(const nsACString& mappedName, nsDependentCString* const out_userName) const; bool FindVaryingByMappedName(const nsACString& mappedName, nsCString* const out_userName, bool* const out_isArray) const; bool FindUniformByMappedName(const nsACString& mappedName, nsCString* const out_userName, bool* const out_isArray) const;
--- a/dom/canvas/WebGLShaderValidator.cpp +++ b/dom/canvas/WebGLShaderValidator.cpp @@ -392,16 +392,31 @@ ShaderValidator::FindAttribUserNameByMap return true; } } return false; } bool +ShaderValidator::FindActiveOutputMappedNameByUserName(const std::string& userName, + const std::string** const out_mappedName) const +{ + const std::vector<sh::OutputVariable>& varibles = *ShGetOutputVariables(mHandle); + for (auto itr = varibles.begin(); itr != varibles.end(); ++itr) { + if (itr->name == userName) { + *out_mappedName = &(itr->mappedName); + return true; + } + } + + return false; +} + +bool ShaderValidator::FindAttribMappedNameByUserName(const std::string& userName, const std::string** const out_mappedName) const { const std::vector<sh::Attribute>& attribs = *ShGetAttributes(mHandle); for (auto itr = attribs.begin(); itr != attribs.end(); ++itr) { if (itr->name == userName) { *out_mappedName = &(itr->mappedName); return true;
--- a/dom/canvas/WebGLShaderValidator.h +++ b/dom/canvas/WebGLShaderValidator.h @@ -43,16 +43,19 @@ public: void GetOutput(nsACString* out) const; bool CanLinkTo(const ShaderValidator* prev, nsCString* const out_log) const; size_t CalcNumSamplerUniforms() const; size_t NumAttributes() const; bool FindAttribUserNameByMappedName(const std::string& mappedName, const std::string** const out_userName) const; + bool FindActiveOutputMappedNameByUserName(const std::string& userName, + const std::string** const out_mappedName) const; + bool FindAttribMappedNameByUserName(const std::string& userName, const std::string** const out_mappedName) const; bool FindVaryingMappedNameByUserName(const std::string& userName, const std::string** const out_mappedName) const; bool FindVaryingByMappedName(const std::string& mappedName, std::string* const out_userName,
--- a/dom/datastore/tests/test_app_install.html +++ b/dom/datastore/tests/test_app_install.html @@ -44,17 +44,16 @@ ok(false, "Error callback invoked"); finish(); } function runTest() { ok("getDataStores" in navigator, "getDataStores exists"); is(typeof navigator.getDataStores, "function", "getDataStores exists and it's a function"); - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; var request = navigator.mozApps.install(gHostedManifestURL); request.onerror = cbError;
--- a/dom/datastore/tests/test_arrays.html +++ b/dom/datastore/tests/test_arrays.html @@ -83,17 +83,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_basic.html +++ b/dom/datastore/tests/test_basic.html @@ -83,17 +83,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_basic_worker.html +++ b/dom/datastore/tests/test_basic_worker.html @@ -83,17 +83,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest) }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_bug1008044.html +++ b/dom/datastore/tests/test_bug1008044.html @@ -84,17 +84,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_bug1058108.html +++ b/dom/datastore/tests/test_bug1058108.html @@ -83,17 +83,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_bug924104.html +++ b/dom/datastore/tests/test_bug924104.html @@ -83,17 +83,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_bug957086.html +++ b/dom/datastore/tests/test_bug957086.html @@ -88,17 +88,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(runTest); },
--- a/dom/datastore/tests/test_bug976311.html +++ b/dom/datastore/tests/test_bug976311.html @@ -88,17 +88,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_bug986056.html +++ b/dom/datastore/tests/test_bug986056.html @@ -81,17 +81,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set": [["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_certifiedApp.html +++ b/dom/datastore/tests/test_certifiedApp.html @@ -90,17 +90,16 @@ runTest(); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_changes.html +++ b/dom/datastore/tests/test_changes.html @@ -127,17 +127,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set": [["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_duplicate.html +++ b/dom/datastore/tests/test_duplicate.html @@ -83,17 +83,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_keys.html +++ b/dom/datastore/tests/test_keys.html @@ -83,17 +83,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_notify_system_message.html +++ b/dom/datastore/tests/test_notify_system_message.html @@ -82,17 +82,16 @@ ["dom.datastore.sysMsgOnChangeLongTimeoutSec", 3], ["dom.sysmsg.enabled", true], ["dom.testing.ignore_ipc_principal", true], ["dom.testing.datastore_enabled_for_hosted_apps", true], ["dom.mozBrowserFramesEnabled", true]]}, runTest); }, function() { - SpecialPowers.setAllAppsLaunchable(true); // No confirmation needed when an app is installed. SpecialPowers.autoConfirmAppInstall(() => { SpecialPowers.autoConfirmAppUninstall(runTest); }); }, function() { if (SpecialPowers.isMainProcess()) {
--- a/dom/datastore/tests/test_oop.html +++ b/dom/datastore/tests/test_oop.html @@ -84,17 +84,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_oop_events.html +++ b/dom/datastore/tests/test_oop_events.html @@ -112,17 +112,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_readonly.html +++ b/dom/datastore/tests/test_readonly.html @@ -31,17 +31,16 @@ finish(); } function runTest() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.autoConfirmAppInstall(continueTest); yield undefined; SpecialPowers.autoConfirmAppUninstall(continueTest); yield undefined; var request = navigator.mozApps.install(gHostedManifestURL); request.onerror = cbError;
--- a/dom/datastore/tests/test_transactions.html +++ b/dom/datastore/tests/test_transactions.html @@ -83,17 +83,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/datastore/tests/test_worker_close.html +++ b/dom/datastore/tests/test_worker_close.html @@ -83,17 +83,16 @@ ["dom.testing.datastore_enabled_for_hosted_apps", true]]}, runTest); }, function() { if (SpecialPowers.isMainProcess()) { SpecialPowers.Cu.import("resource://gre/modules/DataStoreChangeNotifier.jsm"); } - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTest); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTest)); },
--- a/dom/downloads/tests/shim_app_as_test.js +++ b/dom/downloads/tests/shim_app_as_test.js @@ -161,17 +161,16 @@ info("pushing preferences: " + gOptions.extraPrefs.set); SpecialPowers.pushPrefEnv({ "set": gOptions.extraPrefs.set }, runTests); }, function() { info("enabling use of mozbrowser"); - //SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.setBoolPref("dom.mozBrowserFramesEnabled", true); runTests(); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(function() { SpecialPowers.autoConfirmAppUninstall(runTests);
--- a/dom/html/nsBrowserElement.cpp +++ b/dom/html/nsBrowserElement.cpp @@ -260,18 +260,19 @@ nsBrowserElement::Download(const nsAStri nsCOMPtr<nsIDOMDOMRequest> req; nsCOMPtr<nsIXPConnectWrappedJS> wrappedObj = do_QueryInterface(mBrowserElementAPI); MOZ_ASSERT(wrappedObj, "Failed to get wrapped JS from XPCOM component."); AutoJSAPI jsapi; jsapi.Init(wrappedObj->GetJSObject()); JSContext* cx = jsapi.cx(); JS::Rooted<JS::Value> options(cx); + aRv.MightThrowJSException(); if (!ToJSValue(cx, aOptions, &options)) { - aRv.Throw(NS_ERROR_OUT_OF_MEMORY); + aRv.StealExceptionFromJSContext(cx); return nullptr; } nsresult rv = mBrowserElementAPI->Download(aUrl, options, getter_AddRefs(req)); if (NS_WARN_IF(NS_FAILED(rv))) { aRv.Throw(NS_ERROR_DOM_INVALID_STATE_ERR); return nullptr; } @@ -759,18 +760,19 @@ nsBrowserElement::ExecuteScript(const ns nsCOMPtr<nsIDOMDOMRequest> req; nsCOMPtr<nsIXPConnectWrappedJS> wrappedObj = do_QueryInterface(mBrowserElementAPI); MOZ_ASSERT(wrappedObj, "Failed to get wrapped JS from XPCOM component."); AutoJSAPI jsapi; jsapi.Init(wrappedObj->GetJSObject()); JSContext* cx = jsapi.cx(); JS::Rooted<JS::Value> options(cx); + aRv.MightThrowJSException(); if (!ToJSValue(cx, aOptions, &options)) { - aRv.Throw(NS_ERROR_OUT_OF_MEMORY); + aRv.StealExceptionFromJSContext(cx); return nullptr; } nsresult rv = mBrowserElementAPI->ExecuteScript(aScript, options, getter_AddRefs(req)); if (NS_FAILED(rv)) { if (rv == NS_ERROR_INVALID_ARG) { aRv.Throw(NS_ERROR_DOM_INVALID_ACCESS_ERR);
--- a/dom/indexedDB/IDBFactory.cpp +++ b/dom/indexedDB/IDBFactory.cpp @@ -719,35 +719,27 @@ IDBFactory::OpenInternal(nsIPrincipal* a } MOZ_ASSERT(threadLocal); MOZ_ASSERT(!threadLocal->mIndexedDBThreadLocal); threadLocal->mIndexedDBThreadLocal = newIDBThreadLocal.forget(); } } - AutoJSAPI autoJS; RefPtr<IDBOpenDBRequest> request; if (mWindow) { - AutoJSContext cx; - if (NS_WARN_IF(!autoJS.Init(mWindow, cx))) { - IDB_REPORT_INTERNAL_ERR(); - aRv.Throw(NS_ERROR_DOM_INDEXEDDB_UNKNOWN_ERR); - return nullptr; - } - - JS::Rooted<JSObject*> scriptOwner(cx, - static_cast<nsGlobalWindow*>(reinterpret_cast<nsPIDOMWindow<nsISupports>*>(mWindow.get()))->FastGetGlobalJSObject()); + JS::Rooted<JSObject*> scriptOwner(nsContentUtils::RootingCxForThread(), + nsGlobalWindow::Cast(mWindow.get())->FastGetGlobalJSObject()); MOZ_ASSERT(scriptOwner); request = IDBOpenDBRequest::CreateForWindow(this, mWindow, scriptOwner); } else { - autoJS.Init(mOwningObject.get()); - JS::Rooted<JSObject*> scriptOwner(autoJS.cx(), mOwningObject); + JS::Rooted<JSObject*> scriptOwner(nsContentUtils::RootingCxForThread(), + mOwningObject); request = IDBOpenDBRequest::CreateForJS(this, scriptOwner); if (!request) { MOZ_ASSERT(!NS_IsMainThread()); aRv.ThrowUncatchableException(); return nullptr; } }
--- a/dom/indexedDB/moz.build +++ b/dom/indexedDB/moz.build @@ -93,16 +93,20 @@ include('/ipc/chromium/chromium-config.m FINAL_LIBRARY = 'xul' if CONFIG['GNU_CC']: # Suppress gcc warning about a comparison being always false due to the # range of the data type SOURCES['Key.cpp'].flags += ['-Wno-error=type-limits'] +if CONFIG['_MSC_VER']: + # This is intended as a temporary hack to support building with VS2015. + CXXFLAGS += ['-wd4577'] + LOCAL_INCLUDES += [ '/db/sqlite3/src', '/dom/base', '/dom/storage', '/dom/workers', '/ipc/glue', '/xpcom/build', '/xpcom/threads',
--- a/dom/indexedDB/test/webapp_clearBrowserData.js +++ b/dom/indexedDB/test/webapp_clearBrowserData.js @@ -110,18 +110,16 @@ function testSteps() function start() { SpecialPowers.addPermission("browser", true, document); SpecialPowers.addPermission("browser", true, { manifestURL: manifestURL }); SpecialPowers.addPermission("embed-apps", true, document); SpecialPowers.addPermission("indexedDB", true, { manifestURL: manifestURL }); - SpecialPowers.setAllAppsLaunchable(true); - window.addEventListener("unload", function cleanup(event) { if (event.target == document) { window.removeEventListener("unload", cleanup, false); SpecialPowers.removePermission("browser", location.href); SpecialPowers.removePermission("browser", location.protocol + "//" + appDomain); SpecialPowers.removePermission("embed-apps", location.href);
--- a/dom/ipc/tests/test_permission_helper.js +++ b/dom/ipc/tests/test_permission_helper.js @@ -26,18 +26,16 @@ const embedAppHostedManifestURL = window var embedApp; // Used to add listener for ipc:content-shutdown that // will be triggered after ContentParent::DeallocateTabId var gScript = SpecialPowers.loadChromeScript(SimpleTest.getTestFileURL('test_permission_framescript.js')); // Delay reporting a result until after finish() got called SimpleTest.waitForExplicitFinish(); -// Allow tests to disable the per platform app validity checks -SpecialPowers.setAllAppsLaunchable(true); // Run tests in order function runTests() { if (!tests.length) { ok(true, "pass all tests!"); SimpleTest.finish(); return; }
--- a/dom/media/DecoderTraits.cpp +++ b/dom/media/DecoderTraits.cpp @@ -50,16 +50,18 @@ #include "WaveDecoder.h" #include "WaveDemuxer.h" #include "WaveReader.h" #include "ADTSDecoder.h" #include "ADTSDemuxer.h" +#include "nsPluginHost.h" + namespace mozilla { template <class String> static bool CodecListContains(char const *const * aCodecs, const String& aCodec) { for (int32_t i = 0; aCodecs[i]; ++i) { @@ -349,16 +351,28 @@ bool DecoderTraits::ShouldHandleMediaTyp if (IsWaveType(nsDependentCString(aMIMEType))) { // We should not return true for Wave types, since there are some // Wave codecs actually in use in the wild that we don't support, and // we should allow those to be handled by plugins or helper apps. // Furthermore people can play Wave files on most platforms by other // means. return false; } + + // If an external plugin which can handle quicktime video is available + // (and not disabled), prefer it over native playback as there several + // codecs found in the wild that we do not handle. + if (nsDependentCString(aMIMEType).EqualsASCII("video/quicktime")) { + RefPtr<nsPluginHost> pluginHost = nsPluginHost::GetInst(); + if (pluginHost && + pluginHost->HavePluginForType(nsDependentCString(aMIMEType))) { + return false; + } + } + return CanHandleMediaType(aMIMEType, false, EmptyString()) != CANPLAY_NO; } /* static */ CanPlayStatus DecoderTraits::CanHandleCodecsType(const char* aMIMEType, const nsAString& aRequestedCodecs) {
--- a/dom/media/MediaDecoderStateMachine.cpp +++ b/dom/media/MediaDecoderStateMachine.cpp @@ -170,31 +170,36 @@ static TimeDuration UsecsToDuration(int6 } static int64_t DurationToUsecs(TimeDuration aDuration) { return static_cast<int64_t>(aDuration.ToSeconds() * USECS_PER_S); } static const uint32_t MIN_VIDEO_QUEUE_SIZE = 3; static const uint32_t MAX_VIDEO_QUEUE_SIZE = 10; +#ifdef MOZ_APPLEMEDIA +static const uint32_t HW_VIDEO_QUEUE_SIZE = 10; +#else +static const uint32_t HW_VIDEO_QUEUE_SIZE = 3; +#endif static const uint32_t VIDEO_QUEUE_SEND_TO_COMPOSITOR_SIZE = 9999; static uint32_t sVideoQueueDefaultSize = MAX_VIDEO_QUEUE_SIZE; -static uint32_t sVideoQueueHWAccelSize = MIN_VIDEO_QUEUE_SIZE; +static uint32_t sVideoQueueHWAccelSize = HW_VIDEO_QUEUE_SIZE; static uint32_t sVideoQueueSendToCompositorSize = VIDEO_QUEUE_SEND_TO_COMPOSITOR_SIZE; static void InitVideoQueuePrefs() { MOZ_ASSERT(NS_IsMainThread()); static bool sPrefInit = false; if (!sPrefInit) { sPrefInit = true; sVideoQueueDefaultSize = Preferences::GetUint( "media.video-queue.default-size", MAX_VIDEO_QUEUE_SIZE); sVideoQueueHWAccelSize = Preferences::GetUint( - "media.video-queue.hw-accel-size", MIN_VIDEO_QUEUE_SIZE); + "media.video-queue.hw-accel-size", HW_VIDEO_QUEUE_SIZE); sVideoQueueSendToCompositorSize = Preferences::GetUint( "media.video-queue.send-to-compositor-size", VIDEO_QUEUE_SEND_TO_COMPOSITOR_SIZE); } } MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder, MediaDecoderReader* aReader, bool aRealTime) :
--- a/dom/media/platforms/apple/AppleVDADecoder.cpp +++ b/dom/media/platforms/apple/AppleVDADecoder.cpp @@ -590,38 +590,44 @@ AppleVDADecoder::CreateDecoderSpecificat ArrayLength(decoderKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); } CFDictionaryRef AppleVDADecoder::CreateOutputConfiguration() { - // Output format type: - SInt32 PixelFormatTypeValue = kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange; - AutoCFRelease<CFNumberRef> PixelFormatTypeNumber = - CFNumberCreate(kCFAllocatorDefault, - kCFNumberSInt32Type, - &PixelFormatTypeValue); - if (mUseSoftwareImages) { + // Output format type: + SInt32 PixelFormatTypeValue = + kCVPixelFormatType_420YpCbCr8BiPlanarVideoRange; + AutoCFRelease<CFNumberRef> PixelFormatTypeNumber = + CFNumberCreate(kCFAllocatorDefault, + kCFNumberSInt32Type, + &PixelFormatTypeValue); const void* outputKeys[] = { kCVPixelBufferPixelFormatTypeKey }; const void* outputValues[] = { PixelFormatTypeNumber }; static_assert(ArrayLength(outputKeys) == ArrayLength(outputValues), "Non matching keys/values array size"); return CFDictionaryCreate(kCFAllocatorDefault, outputKeys, outputValues, ArrayLength(outputKeys), &kCFTypeDictionaryKeyCallBacks, &kCFTypeDictionaryValueCallBacks); } #ifndef MOZ_WIDGET_UIKIT + // Output format type: + SInt32 PixelFormatTypeValue = kCVPixelFormatType_422YpCbCr8; + AutoCFRelease<CFNumberRef> PixelFormatTypeNumber = + CFNumberCreate(kCFAllocatorDefault, + kCFNumberSInt32Type, + &PixelFormatTypeValue); // Construct IOSurface Properties const void* IOSurfaceKeys[] = { MacIOSurfaceLib::kPropIsGlobal }; const void* IOSurfaceValues[] = { kCFBooleanTrue }; static_assert(ArrayLength(IOSurfaceKeys) == ArrayLength(IOSurfaceValues), "Non matching keys/values array size"); // Contruct output configuration. AutoCFRelease<CFDictionaryRef> IOSurfaceProperties =
--- a/dom/media/webrtc/moz.build +++ b/dom/media/webrtc/moz.build @@ -87,10 +87,12 @@ if CONFIG['GNU_CC'] or CONFIG['CLANG_CL' '-Wno-error=attributes' ] FINAL_LIBRARY = 'xul' if CONFIG['_MSC_VER']: CXXFLAGS += [ '-wd4275', # non dll-interface class used as base for dll-interface class + '-wd4312', # This is intended as a temporary hack to support building with VS2015 + # 'reinterpret_cast': conversion from 'DWORD' to 'HANDLE' of greater size ] DEFINES['__PRETTY_FUNCTION__'] = '__FUNCSIG__'
--- a/dom/messages/test/test_sysmsg_registration.html +++ b/dom/messages/test/test_sysmsg_registration.html @@ -135,17 +135,16 @@ function testBroadcastMessage(aMessage, .catch(cbError); } /** * TESTS */ let steps = [() => { Services.obs.notifyObservers(null, "webapps-registry-ready", null); - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.autoConfirmAppInstall(next); }, () => { SpecialPowers.autoConfirmAppUninstall(next); }, () => { // Check how many apps we are starting with. let request = navigator.mozApps.mgmt.getAll(); request.onerror = cbError; request.onsuccess = () => {
--- a/dom/network/TCPServerSocket.cpp +++ b/dom/network/TCPServerSocket.cpp @@ -117,19 +117,16 @@ TCPServerSocket::Close() if (mServerSocket) { mServerSocket->Close(); } } void TCPServerSocket::FireEvent(const nsAString& aType, TCPSocket* aSocket) { - AutoJSAPI api; - api.Init(GetOwnerGlobal()); - TCPServerSocketEventInit init; init.mBubbles = false; init.mCancelable = false; init.mSocket = aSocket; RefPtr<TCPServerSocketEvent> event = TCPServerSocketEvent::Constructor(this, aType, init); event->SetTrusted(true);
--- a/dom/plugins/ipc/moz.build +++ b/dom/plugins/ipc/moz.build @@ -142,8 +142,13 @@ DEFINES['FORCE_PR_LOG'] = True if CONFIG['MOZ_WIDGET_TOOLKIT'] != 'gtk3': CXXFLAGS += CONFIG['TK_CFLAGS'] else: # Force build against gtk+2 for struct offsets and such. CXXFLAGS += CONFIG['MOZ_GTK2_CFLAGS'] CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] + +if CONFIG['_MSC_VER']: + # This is intended as a temporary hack to support building with VS2015. + # conversion from 'X' to 'Y' requires a narrowing conversion + CXXFLAGS += ['-wd4838']
--- a/dom/plugins/test/testplugin/testplugin.mozbuild +++ b/dom/plugins/test/testplugin/testplugin.mozbuild @@ -64,8 +64,13 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] in ('gtk OS_LIBS += CONFIG['XEXT_LIBS'] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt': CXXFLAGS += CONFIG['MOZ_QT_CFLAGS'] CFLAGS += CONFIG['MOZ_QT_CFLAGS'] OS_LIBS += CONFIG['MOZ_QT_LIBS'] OS_LIBS += CONFIG['XLDFLAGS'] OS_LIBS += CONFIG['XLIBS'] + +if CONFIG['_MSC_VER']: + # This is intended as a temporary hack to support building with VS2015. + # conversion from 'X' to 'Y' requires a narrowing conversion + CXXFLAGS += ['-wd4838']
new file mode 100644 --- /dev/null +++ b/dom/presentation/PresentationLog.h @@ -0,0 +1,26 @@ +/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ +/* vim: set ts=8 sts=2 et sw=2 tw=80: */ +/* This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ + +#ifndef mozilla_dom_PresentationLog_h +#define mozilla_dom_PresentationLog_h + +/* + * NSPR_LOG_MODULES=Presentation:5 + * For detail, see PresentationService.cpp + */ +namespace mozilla { +namespace dom { +extern mozilla::LazyLogModule gPresentationLog; +} +} + +#undef PRES_ERROR +#define PRES_ERROR(...) MOZ_LOG(mozilla::dom::gPresentationLog, mozilla::LogLevel::Error, (__VA_ARGS__)) + +#undef PRES_DEBUG +#define PRES_DEBUG(...) MOZ_LOG(mozilla::dom::gPresentationLog, mozilla::LogLevel::Debug, (__VA_ARGS__)) + +#endif // mozilla_dom_PresentationLog_h
--- a/dom/presentation/PresentationService.cpp +++ b/dom/presentation/PresentationService.cpp @@ -13,16 +13,17 @@ #include "nsIPresentationDevicePrompt.h" #include "nsIPresentationListener.h" #include "nsIPresentationRequestUIGlue.h" #include "nsIPresentationSessionRequest.h" #include "nsNetUtil.h" #include "nsServiceManagerUtils.h" #include "nsThreadUtils.h" #include "nsXULAppAPI.h" +#include "PresentationLog.h" #include "PresentationService.h" using namespace mozilla; using namespace mozilla::dom; namespace mozilla { namespace dom { @@ -43,16 +44,18 @@ public: private: virtual ~PresentationDeviceRequest(); nsString mRequestUrl; nsString mId; nsString mOrigin; }; +LazyLogModule gPresentationLog("Presentation"); + } // namespace dom } // namespace mozilla NS_IMPL_ISUPPORTS(PresentationDeviceRequest, nsIPresentationDeviceRequest) PresentationDeviceRequest::PresentationDeviceRequest(const nsAString& aRequestUrl, const nsAString& aId, const nsAString& aOrigin)
--- a/dom/presentation/PresentationSessionInfo.cpp +++ b/dom/presentation/PresentationSessionInfo.cpp @@ -17,39 +17,33 @@ #include "nsIFrameLoader.h" #include "nsIMutableArray.h" #include "nsINetAddr.h" #include "nsISocketTransport.h" #include "nsISupportsPrimitives.h" #include "nsNetCID.h" #include "nsServiceManagerUtils.h" #include "nsThreadUtils.h" +#include "PresentationLog.h" #include "PresentationService.h" #include "PresentationSessionInfo.h" #ifdef MOZ_WIDGET_ANDROID #include "nsIPresentationNetworkHelper.h" #endif // MOZ_WIDGET_ANDROID #ifdef MOZ_WIDGET_GONK #include "nsINetworkInterface.h" #include "nsINetworkManager.h" #endif using namespace mozilla; using namespace mozilla::dom; using namespace mozilla::services; - -static LazyLogModule gPresentationSessionInfoLog("PresentationSessionInfo"); - -#undef LOG -#define LOG(...) MOZ_LOG(gPresentationSessionInfoLog, mozilla::LogLevel::Error, (__VA_ARGS__)) - - /* * Implementation of PresentationChannelDescription */ namespace mozilla { namespace dom { #ifdef MOZ_WIDGET_ANDROID @@ -100,17 +94,17 @@ PresentationNetworkHelper::GetWifiIPAddr } return networkHelper->GetWifiIPAddress(this); } NS_IMETHODIMP PresentationNetworkHelper::OnError(const nsACString & aReason) { - LOG("PresentationNetworkHelper::OnError: %s", + PRES_ERROR("PresentationNetworkHelper::OnError: %s", nsPromiseFlatCString(aReason).get()); return NS_OK; } NS_IMETHODIMP PresentationNetworkHelper::OnGetWifiIPAddress(const nsACString& aIPAddress) { MOZ_ASSERT(mInfo); @@ -455,16 +449,22 @@ PresentationControllingInfo::Init(nsIPre return rv; } rv = mServerSocket->AsyncListen(this); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } + int32_t port; + rv = mServerSocket->GetPort(&port); + if (!NS_WARN_IF(NS_FAILED(rv))) { + PRES_DEBUG("%s:ServerSocket created.port[%d]\n",__func__, port); + } + return NS_OK; } void PresentationControllingInfo::Shutdown(nsresult aReason) { PresentationSessionInfo::Shutdown(aReason); @@ -525,16 +525,24 @@ PresentationControllingInfo::GetAddress( RefPtr<PresentationNetworkHelper> networkHelper = new PresentationNetworkHelper(this, &PresentationControllingInfo::OnGetAddress); nsresult rv = networkHelper->GetWifiIPAddress(); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } +#elif defined(MOZ_MULET) + // In simulator,we need to use the "127.0.0.1" as target address. + NS_DispatchToMainThread( + NS_NewRunnableMethodWithArg<nsCString>( + this, + &PresentationControllingInfo::OnGetAddress, + "127.0.0.1")); + #else // TODO Get host IP via other platforms. NS_DispatchToMainThread( NS_NewRunnableMethodWithArg<nsCString>( this, &PresentationControllingInfo::OnGetAddress, EmptyCString())); @@ -623,25 +631,31 @@ PresentationControllingInfo::NotifyClose return NS_OK; } // nsIServerSocketListener NS_IMETHODIMP PresentationControllingInfo::OnSocketAccepted(nsIServerSocket* aServerSocket, nsISocketTransport* aTransport) { + int32_t port; + nsresult rv = aTransport->GetPort(&port); + if (!NS_WARN_IF(NS_FAILED(rv))) { + PRES_DEBUG("%s:receive from port[%d]\n",__func__, port); + } + MOZ_ASSERT(NS_IsMainThread()); // Initialize |mTransport| and use |this| as the callback. mTransport = do_CreateInstance(PRESENTATION_SESSION_TRANSPORT_CONTRACTID); if (NS_WARN_IF(!mTransport)) { return ReplyError(NS_ERROR_DOM_OPERATION_ERR); } - nsresult rv = mTransport->InitWithSocketTransport(aTransport, this); + rv = mTransport->InitWithSocketTransport(aTransport, this); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; } // Enable data notification if the listener has been registered. if (mListener) { return mTransport->EnableDataNotification(); }
--- a/dom/presentation/PresentationSessionTransport.cpp +++ b/dom/presentation/PresentationSessionTransport.cpp @@ -14,16 +14,17 @@ #include "nsIScriptableInputStream.h" #include "nsISocketTransport.h" #include "nsISocketTransportService.h" #include "nsISupportsPrimitives.h" #include "nsNetUtil.h" #include "nsServiceManagerUtils.h" #include "nsStreamUtils.h" #include "nsThreadUtils.h" +#include "PresentationLog.h" #include "PresentationSessionTransport.h" #define BUFFER_SIZE 65536 using namespace mozilla; using namespace mozilla::dom; class CopierCallbacks final : public nsIRequestObserver @@ -149,16 +150,18 @@ PresentationSessionTransport::InitWithCh } nsAutoCString serverHost; supportStr->GetData(serverHost); if (serverHost.IsEmpty()) { return NS_ERROR_INVALID_ARG; } + PRES_DEBUG("%s:ServerHost[%s],ServerPort[%d]\n", __func__, serverHost.get(), serverPort); + SetReadyState(CONNECTING); nsCOMPtr<nsISocketTransportService> sts = do_GetService(NS_SOCKETTRANSPORTSERVICE_CONTRACTID); if (NS_WARN_IF(!sts)) { return NS_ERROR_NOT_AVAILABLE; } rv = sts->CreateTransport(nullptr, 0, serverHost, serverPort, nullptr, @@ -355,16 +358,18 @@ PresentationSessionTransport::Send(nsIIn EnsureCopying(); return NS_OK; } NS_IMETHODIMP PresentationSessionTransport::Close(nsresult aReason) { + PRES_DEBUG("%s:reason[%x]\n", __func__, aReason); + if (mReadyState == CLOSED || mReadyState == CLOSING) { return NS_OK; } mCloseStatus = aReason; SetReadyState(CLOSING); uint32_t count = 0; @@ -396,16 +401,18 @@ PresentationSessionTransport::SetReadySt // nsITransportEventSink NS_IMETHODIMP PresentationSessionTransport::OnTransportStatus(nsITransport* aTransport, nsresult aStatus, int64_t aProgress, int64_t aProgressMax) { + PRES_DEBUG("%s:aStatus[%x]\n", __func__, aStatus); + MOZ_ASSERT(NS_IsMainThread()); if (aStatus != NS_NET_STATUS_CONNECTED_TO) { return NS_OK; } SetReadyState(OPEN); @@ -444,16 +451,18 @@ PresentationSessionTransport::OnStartReq return NS_OK; } NS_IMETHODIMP PresentationSessionTransport::OnStopRequest(nsIRequest* aRequest, nsISupports* aContext, nsresult aStatusCode) { + PRES_DEBUG("%s:aStatusCode[%x]\n", __func__, aStatusCode); + MOZ_ASSERT(NS_IsMainThread()); uint32_t count; nsresult rv = mMultiplexStream->GetCount(&count); if (NS_WARN_IF(NS_FAILED(rv))) { return rv; }
--- a/dom/promise/Promise.cpp +++ b/dom/promise/Promise.cpp @@ -1757,31 +1757,31 @@ private: mozilla::DropJSObjects(this); } public: void SetValue(uint32_t index, const JS::Handle<JS::Value> aValue) { MOZ_ASSERT(mCountdown > 0); - ThreadsafeAutoSafeJSContext cx; - JSAutoCompartment ac(cx, mValues); - { - - AutoDontReportUncaught silenceReporting(cx); - JS::Rooted<JS::Value> value(cx, aValue); - JS::Rooted<JSObject*> values(cx, mValues); - if (!JS_WrapValue(cx, &value) || - !JS_DefineElement(cx, values, index, value, JSPROP_ENUMERATE)) { - MOZ_ASSERT(JS_IsExceptionPending(cx)); - JS::Rooted<JS::Value> exn(cx); - JS_GetPendingException(cx, &exn); - - mPromise->MaybeReject(cx, exn); - } + AutoJSAPI jsapi; + if (!jsapi.Init(mValues)) { + return; + } + jsapi.TakeOwnershipOfErrorReporting(); + JSContext* cx = jsapi.cx(); + + JS::Rooted<JS::Value> value(cx, aValue); + JS::Rooted<JSObject*> values(cx, mValues); + if (!JS_WrapValue(cx, &value) || + !JS_DefineElement(cx, values, index, value, JSPROP_ENUMERATE)) { + MOZ_ASSERT(JS_IsExceptionPending(cx)); + JS::Rooted<JS::Value> exn(cx); + jsapi.StealException(&exn); + mPromise->MaybeReject(cx, exn); } --mCountdown; if (mCountdown == 0) { JS::Rooted<JS::Value> result(cx, JS::ObjectValue(*mValues)); mPromise->MaybeResolve(cx, result); } }
--- a/dom/requestsync/tests/test_basic_app.html +++ b/dom/requestsync/tests/test_basic_app.html @@ -81,17 +81,16 @@ SpecialPowers.pushPrefEnv({"set": [["dom.requestSync.enabled", true], ["dom.requestSync.minInterval", 1], ["dom.ignore_webidl_scope_checks", true], ["dom.testing.ignore_ipc_principal", true]]}, runTests); }, function() { SpecialPowers.importInMainProcess("resource://gre/modules/RequestSyncService.jsm"); - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({"set":[["dom.mozBrowserFramesEnabled", true]]}, runTests); }, // No confirmation needed when an app is installed function() { SpecialPowers.autoConfirmAppInstall(() => SpecialPowers.autoConfirmAppUninstall(runTests)); },
--- a/dom/security/test/csp/test_bug949549.html +++ b/dom/security/test/csp/test_bug949549.html @@ -21,17 +21,16 @@ SimpleTest.waitForExplicitFinish(); var app; var principal; function setupTest() { // We have to install an app in order for the app URL to be valid // (otherwise we get a "DummyChannel" that throws NS_NOT_IMPLEMENTED) - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.addPermission("webapps-manage", true, document); SpecialPowers.autoConfirmAppInstall(function () { let req = navigator.mozApps.install(gManifestURL); req.onsuccess = function () { app = this.result; runTest(); } });
--- a/dom/svg/SVGTransformableElement.cpp +++ b/dom/svg/SVGTransformableElement.cpp @@ -58,25 +58,36 @@ SVGTransformableElement::GetAttributeCha if (aAttribute == nsGkAtoms::transform || aAttribute == nsGkAtoms::mozAnimateMotionDummyAttr) { nsIFrame* frame = const_cast<SVGTransformableElement*>(this)->GetPrimaryFrame(); NS_UpdateHint(retval, nsChangeHint_InvalidateRenderingObservers); if (!frame || (frame->GetStateBits() & NS_FRAME_IS_NONDISPLAY)) { return retval; } + + bool isAdditionOrRemoval = false; if (aModType == nsIDOMMutationEvent::ADDITION || - aModType == nsIDOMMutationEvent::REMOVAL || - (aModType == nsIDOMMutationEvent::MODIFICATION && - !(mTransforms && mTransforms->HasTransform()))) { + aModType == nsIDOMMutationEvent::REMOVAL) { + isAdditionOrRemoval = true; + } else { + MOZ_ASSERT(aModType == nsIDOMMutationEvent::MODIFICATION, + "Unknown modification type."); + if (!mTransforms || + !mTransforms->HasTransform() || + !mTransforms->HadTransformBeforeLastBaseValChange()) { + // New or old value is empty; this is effectively addition or removal. + isAdditionOrRemoval = true; + } + } + + if (isAdditionOrRemoval) { // Reconstruct the frame tree to handle stacking context changes: NS_UpdateHint(retval, nsChangeHint_ReconstructFrame); } else { - MOZ_ASSERT(aModType == nsIDOMMutationEvent::MODIFICATION, - "Unknown modification type."); // We just assume the old and new transforms are different. NS_UpdateHint(retval, NS_CombineHint(nsChangeHint_UpdatePostTransformOverflow, nsChangeHint_UpdateTransformLayer)); } } return retval; }
--- a/dom/svg/nsSVGAnimatedTransformList.cpp +++ b/dom/svg/nsSVGAnimatedTransformList.cpp @@ -41,34 +41,40 @@ nsSVGAnimatedTransformList::SetBaseValue // We must send this notification *before* changing mBaseVal! If the length // of our baseVal is being reduced, our baseVal's DOM wrapper list may have // to remove DOM items from itself, and any removed DOM items need to copy // their internal counterpart values *before* we change them. // domWrapper->InternalBaseValListWillChangeLengthTo(aValue.Length()); } + // (This bool will be copied to our member-var, if attr-change succeeds.) + bool hadTransform = HasTransform(); + // We don't need to call DidChange* here - we're only called by // nsSVGElement::ParseAttribute under Element::SetAttr, // which takes care of notifying. nsresult rv = mBaseVal.CopyFrom(aValue); if (NS_FAILED(rv) && domWrapper) { // Attempting to increase mBaseVal's length failed - reduce domWrapper // back to the same length: domWrapper->InternalBaseValListWillChangeLengthTo(mBaseVal.Length()); } else { mIsAttrSet = true; + mHadTransformBeforeLastBaseValChange = hadTransform; } return rv; } void nsSVGAnimatedTransformList::ClearBaseValue() { + mHadTransformBeforeLastBaseValChange = HasTransform(); + SVGAnimatedTransformList *domWrapper = SVGAnimatedTransformList::GetDOMWrapperIfExists(this); if (domWrapper) { // We must send this notification *before* changing mBaseVal! (See above.) domWrapper->InternalBaseValListWillChangeLengthTo(0); } mBaseVal.Clear(); mIsAttrSet = false;
--- a/dom/svg/nsSVGAnimatedTransformList.h +++ b/dom/svg/nsSVGAnimatedTransformList.h @@ -39,17 +39,19 @@ class SVGTransform; */ class nsSVGAnimatedTransformList { // friends so that they can get write access to mBaseVal friend class dom::SVGTransform; friend class DOMSVGTransformList; public: - nsSVGAnimatedTransformList() : mIsAttrSet(false) { } + nsSVGAnimatedTransformList() + : mIsAttrSet(false), + mHadTransformBeforeLastBaseValChange(false) { } /** * Because it's so important that mBaseVal and its DOMSVGTransformList wrapper * (if any) be kept in sync (see the comment in * SVGAnimatedTransformList::InternalBaseValListWillChangeTo), this method * returns a const reference. Only our friend classes may get mutable * references to mBaseVal. */ @@ -87,29 +89,46 @@ public: */ bool HasTransform() const { return (mAnimVal && !mAnimVal->IsEmpty()) || !mBaseVal.IsEmpty(); } bool IsAnimating() const { return !!mAnimVal; } + /** + * Returns true iff "HasTransform" returned true just before our most recent + * SetBaseValue/SetBaseValueString/ClearBaseValue change. + * + * (This is used as part of an optimization in + * SVGTransformableElement::GetAttributeChangeHint. That function reports an + * inexpensive nsChangeHint when a transform has just modified -- but this + * accessor lets it detect cases where the "modification" is actually adding + * a transform where we previously had none. These cases require a more + * thorough nsChangeHint.) + */ + bool HadTransformBeforeLastBaseValChange() const { + return mHadTransformBeforeLastBaseValChange; + } + /// Callers own the returned nsISMILAttr nsISMILAttr* ToSMILAttr(nsSVGElement* aSVGElement); private: // mAnimVal is a pointer to allow us to determine if we're being animated or // not. Making it a non-pointer member and using mAnimVal.IsEmpty() to check // if we're animating is not an option, since that would break animation *to* // the empty string (<set to="">). SVGTransformList mBaseVal; nsAutoPtr<SVGTransformList> mAnimVal; bool mIsAttrSet; + // (See documentation for accessor, HadTransformBeforeLastBaseValChange.) + bool mHadTransformBeforeLastBaseValChange; struct SMILAnimatedTransformList : public nsISMILAttr { public: SMILAnimatedTransformList(nsSVGAnimatedTransformList* aVal, nsSVGElement* aSVGElement) : mVal(aVal) , mElement(aSVGElement)
--- a/dom/tests/mochitest/fetch/test_fetch_app_protocol.html +++ b/dom/tests/mochitest/fetch/test_fetch_app_protocol.html @@ -19,17 +19,16 @@ SimpleTest.waitForExplicitFinish(); const appManifestURL = 'http://mochi.test:8888/tests/dom/tests/mochitest/fetch/app-protocol/update.webapp'; let gApp; function setup() { info('Setting up'); return new Promise((resolve, reject) => { - SpecialPowers.setAllAppsLaunchable(true); SpecialPowers.pushPrefEnv({'set': [ ['dom.mozBrowserFramesEnabled', true] ]}, () => { SpecialPowers.pushPermissions([ { 'type': 'webapps-manage', 'allow': 1, 'context': document }, { 'type': 'browser', 'allow': 1, 'context': document }, { 'type': 'embed-apps', 'allow': 1, 'context': document } ], () => {
--- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -829,17 +829,17 @@ var interfaceNamesInGlobalScope = {name: "MozPowerManager", b2g: true, permission: "power"}, // IMPORTANT: Do not change this list without review from a DOM peer! "mozRTCIceCandidate", // IMPORTANT: Do not change this list without review from a DOM peer! "mozRTCPeerConnection", // IMPORTANT: Do not change this list without review from a DOM peer! "mozRTCSessionDescription", // IMPORTANT: Do not change this list without review from a DOM peer! - "MozSettingsEvent", + {name: "MozSettingsEvent", permission: ["settings-api-read"]}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "MozSettingsTransactionEvent", permission: ["settings-api-read"]}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "MozSpeakerManager", b2g: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "MozTimeManager", b2g: true}, // IMPORTANT: Do not change this list without review from a DOM peer! {name: "MozWakeLock", b2g: true},
--- a/dom/tests/mochitest/localstorage/test_clear_browser_data.html +++ b/dom/tests/mochitest/localstorage/test_clear_browser_data.html @@ -71,19 +71,16 @@ SimpleTest.registerCleanupFunction(() => gWitnessStorage.sessionStorage.clear(); permManager.removeFromPrincipal(window.document.nodePrincipal, "webapps-manage", Ci.nsIPermissionManager.ALLOW_ACTION); permManager.removeFromPrincipal(window.document.nodePrincipal, "browser", Ci.nsIPermissionManager.ALLOW_ACTION); }); -// We want to simulate that all apps are launchable, for testing purpose. -SpecialPowers.setAllAppsLaunchable(true); - // URL of the manifest of the app we want to install. const gManifestURL = "http://www.example.com/chrome/dom/apps/tests/apps/basic.webapp"; // ID of the installed app. var gTestAppId = 0; // Cookies currently in the system. var gCurrentCookiesCount = 0; // Storages from a non-app to make sure we do not remove cookies from everywhere. var gWitnessStorage = {};
--- a/dom/tests/mochitest/notification/NotificationTest.js +++ b/dom/tests/mochitest/notification/NotificationTest.js @@ -4,17 +4,16 @@ var NotificationTest = (function () { function info(msg, name) { SimpleTest.info("::Notification Tests::" + (name || ""), msg); } function setup_testing_env() { SimpleTest.waitForExplicitFinish(); // turn on testing pref (used by notification.cpp, and mock the alerts SpecialPowers.setBoolPref("notification.prompt.testing", true); - SpecialPowers.setAllAppsLaunchable(true); } function teardown_testing_env() { SimpleTest.finish(); } function executeTests(tests, callback) { // context is `this` object in test functions
--- a/dom/webidl/MozSettingsEvent.webidl +++ b/dom/webidl/MozSettingsEvent.webidl @@ -1,15 +1,16 @@ /* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this file, * You can obtain one at http://mozilla.org/MPL/2.0/. */ -[Constructor(DOMString type, optional MozSettingsEventInit eventInitDict)] +[Constructor(DOMString type, optional MozSettingsEventInit eventInitDict), + CheckAnyPermissions="settings-api-read settings-api-write"] interface MozSettingsEvent : Event { readonly attribute DOMString? settingName; readonly attribute any settingValue; }; dictionary MozSettingsEventInit : EventInit {
--- a/dom/workers/RuntimeService.cpp +++ b/dom/workers/RuntimeService.cpp @@ -616,17 +616,17 @@ ContentSecurityPolicyAllows(JSContext* a { WorkerPrivate* worker = GetWorkerPrivateFromContext(aCx); worker->AssertIsOnWorkerThread(); if (worker->GetReportCSPViolations()) { nsString fileName; uint32_t lineNum = 0; - JS::UniqueChars file; + JS::AutoFilename file; if (JS::DescribeScriptedCaller(aCx, &file, &lineNum) && file.get()) { fileName = NS_ConvertUTF8toUTF16(file.get()); } else { MOZ_ASSERT(!JS_IsExceptionPending(aCx)); } RefPtr<LogViolationDetailsRunnable> runnable = new LogViolationDetailsRunnable(worker, fileName, lineNum);
--- a/dom/workers/WorkerPrivate.cpp +++ b/dom/workers/WorkerPrivate.cpp @@ -4291,17 +4291,17 @@ WorkerPrivate::GetLoadInfo(JSContext* aC loadInfo.mStorageAllowed = access > nsContentUtils::StorageAccess::eDeny; loadInfo.mPrivateBrowsing = nsContentUtils::IsInPrivateBrowsing(document); } else { // Not a window MOZ_ASSERT(isChrome); // We're being created outside of a window. Need to figure out the script // that is creating us in order for us to use relative URIs later on. - JS::UniqueChars fileName; + JS::AutoFilename fileName; if (JS::DescribeScriptedCaller(aCx, &fileName)) { // In most cases, fileName is URI. In a few other cases // (e.g. xpcshell), fileName is a file path. Ideally, we would // prefer testing whether fileName parses as an URI and fallback // to file path in case of error, but Windows file paths have // the interesting property that they can be parsed as bogus // URIs (e.g. C:/Windows/Tmp is interpreted as scheme "C", // hostname "Windows", path "Tmp"), which defeats this algorithm.
--- a/dom/workers/WorkerScope.cpp +++ b/dom/workers/WorkerScope.cpp @@ -902,17 +902,17 @@ WorkerDebuggerGlobalScope::SetImmediate( { mWorkerPrivate->SetDebuggerImmediate(aHandler, aRv); } void WorkerDebuggerGlobalScope::ReportError(JSContext* aCx, const nsAString& aMessage) { - JS::UniqueChars chars; + JS::AutoFilename chars; uint32_t lineno = 0; JS::DescribeScriptedCaller(aCx, &chars, &lineno); nsString filename(NS_ConvertUTF8toUTF16(chars.get())); mWorkerPrivate->ReportErrorToDebugger(filename, lineno, aMessage); } Console* WorkerDebuggerGlobalScope::GetConsole(ErrorResult& aRv)
--- a/embedding/components/windowwatcher/nsWindowWatcher.cpp +++ b/embedding/components/windowwatcher/nsWindowWatcher.cpp @@ -625,16 +625,19 @@ nsWindowWatcher::OpenWindowInternal(mozI CalcSizeSpec(features.get(), sizeSpec); nsCOMPtr<nsIScriptSecurityManager> sm( do_GetService(NS_SCRIPTSECURITYMANAGER_CONTRACTID)); bool isCallerChrome = nsContentUtils::LegacyIsCallerChromeOrNativeCode() && !openedFromRemoteTab; + // XXXbz Why is an AutoJSAPI good enough here? Wouldn't AutoEntryScript (so + // we affect the entry global) make more sense? Or do we just want to affect + // GetSubjectPrincipal()? dom::AutoJSAPI jsapiChromeGuard; bool windowTypeIsChrome = chromeFlags & nsIWebBrowserChrome::CHROME_OPENAS_CHROME; if (isCallerChrome && !hasChromeParent && !windowTypeIsChrome) { // open() is called from chrome on a non-chrome window, initialize an // AutoJSAPI with the callee to prevent the caller's privileges from leaking // into code that runs while opening the new window.
--- a/extensions/spellcheck/hunspell/moz.build +++ b/extensions/spellcheck/hunspell/moz.build @@ -1,12 +1,12 @@ # -*- Mode: python; c-basic-offset: 4; 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 http://mozilla.org/MPL/2.0/. DIRS += ['glue'] -if not CONFIG['MOZ_NATIVE_HUNSPELL']: +if not CONFIG['MOZ_SYSTEM_HUNSPELL']: DIRS += ['src'] if CONFIG['ENABLE_TESTS']: XPCSHELL_TESTS_MANIFESTS += ['tests/unit/xpcshell.ini']
--- a/extensions/spellcheck/tests/chrome/test_add_remove_dictionaries.xul +++ b/extensions/spellcheck/tests/chrome/test_add_remove_dictionaries.xul @@ -3,16 +3,20 @@ <window title="Add and remove dictionaries test" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" onload="RunTest();"> <script type="application/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> + <!-- test results are displayed in the html:body --> + <body xmlns="http://www.w3.org/1999/xhtml"> + </body> + <script type="application/javascript"> <![CDATA[ SimpleTest.waitForExplicitFinish(); function getMisspelledWords(editor) { return editor.selectionController.getSelection(Components.interfaces.nsISelectionController.SELECTION_SPELLCHECK).toString(); }
--- a/gfx/2d/Logging.h +++ b/gfx/2d/Logging.h @@ -540,16 +540,17 @@ typedef Log<LOG_CRITICAL, CriticalLogger // This is a shortcut for errors we want logged in crash reports/about support // but we do not want asserting. These are available in all builds, so it is // not worth trying to do magic to avoid matching the syntax of gfxCriticalError. // So, this one is used as // gfxCriticalNote << "Something to report and not assert"; // while the critical error is // gfxCriticalError() << "Something to report and assert"; #define gfxCriticalNote gfxCriticalError(gfxCriticalError::DefaultOptions(false)) +#define gfxCriticalNoteOnce static gfxCriticalError GFX_LOGGING_GLUE(sOnceAtLine,__LINE__) = gfxCriticalNote // The "once" versions will only trigger the first time through. You can do this: // gfxCriticalErrorOnce() << "This message only shows up once; // instead of the usual: // static bool firstTime = true; // if (firstTime) { // firstTime = false; // gfxCriticalError() << "This message only shows up once;
--- a/gfx/layers/Compositor.h +++ b/gfx/layers/Compositor.h @@ -4,16 +4,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef MOZILLA_GFX_COMPOSITOR_H #define MOZILLA_GFX_COMPOSITOR_H #include "Units.h" // for ScreenPoint #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/RefPtr.h" // for already_AddRefed, RefCounted +#include "mozilla/gfx/2D.h" // for DrawTarget #include "mozilla/gfx/MatrixFwd.h" // for Matrix4x4 #include "mozilla/gfx/Point.h" // for IntSize, Point #include "mozilla/gfx/Rect.h" // for Rect, IntRect #include "mozilla/gfx/Types.h" // for Float #include "mozilla/layers/CompositorTypes.h" // for DiagnosticTypes, etc #include "mozilla/layers/FenceUtils.h" // for FenceHandle #include "mozilla/layers/LayersTypes.h" // for LayersBackend #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc
--- a/gfx/layers/CopyableCanvasLayer.cpp +++ b/gfx/layers/CopyableCanvasLayer.cpp @@ -13,16 +13,17 @@ #include "gfxPattern.h" // for gfxPattern, etc #include "gfxPlatform.h" // for gfxPlatform, gfxImageFormat #include "gfxRect.h" // for gfxRect #include "gfxUtils.h" // for gfxUtils #include "gfx2DGlue.h" // for thebes --> moz2d transition #include "mozilla/gfx/BaseSize.h" // for BaseSize #include "mozilla/gfx/Tools.h" #include "mozilla/gfx/Point.h" // for IntSize +#include "mozilla/layers/AsyncCanvasRenderer.h" #include "mozilla/layers/PersistentBufferProvider.h" #include "nsDebug.h" // for NS_ASSERTION, NS_WARNING, etc #include "nsISupportsImpl.h" // for gfxContext::AddRef, etc #include "nsRect.h" // for mozilla::gfx::IntRect #include "gfxUtils.h" #include "client/TextureClientSharedSurface.h" namespace mozilla {
--- a/gfx/layers/ImageDataSerializer.h +++ b/gfx/layers/ImageDataSerializer.h @@ -8,16 +8,17 @@ #ifndef GFX_LAYERS_BLOBSURFACE_H #define GFX_LAYERS_BLOBSURFACE_H #include <stdint.h> // for uint8_t, uint32_t #include "mozilla/Attributes.h" // for MOZ_STACK_CLASS #include "mozilla/RefPtr.h" // for already_AddRefed #include "mozilla/gfx/Point.h" // for IntSize #include "mozilla/gfx/Types.h" // for SurfaceFormat +#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor namespace mozilla { namespace gfx { class DataSourceSurface; class DrawTarget; } // namespace gfx } // namespace mozilla
--- a/gfx/layers/LayerScope.h +++ b/gfx/layers/LayerScope.h @@ -4,27 +4,30 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef GFX_LAYERSCOPE_H #define GFX_LAYERSCOPE_H #include <stdint.h> #include <mozilla/UniquePtr.h> +#include "gfxMatrix.h" namespace mozilla { namespace gl { class GLContext; } namespace layers { + namespace layerscope { class Packet; } struct EffectChain; class LayerComposite; +class TextureHost; class LayerScope { public: static void DrawBegin(); static void SetRenderOffset(float aX, float aY); static void SetLayerTransform(const gfx::Matrix4x4& aMatrix); static void SetDrawRects(size_t aRects, const gfx::Rect* aLayerRects,
--- a/gfx/layers/apz/src/CheckerboardEvent.h +++ b/gfx/layers/apz/src/CheckerboardEvent.h @@ -5,16 +5,17 @@ #ifndef mozilla_layers_CheckerboardEvent_h #define mozilla_layers_CheckerboardEvent_h #include "mozilla/Monitor.h" #include "mozilla/TimeStamp.h" #include <sstream> #include "Units.h" +#include <vector> namespace mozilla { namespace layers { /** * This class records information relevant to one "checkerboard event", which is * a contiguous set of frames where a given APZC was checkerboarding. The intent * of this class is to record enough information that it can provide actionable
--- a/gfx/layers/apz/src/DragTracker.h +++ b/gfx/layers/apz/src/DragTracker.h @@ -2,16 +2,17 @@ /* This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_layers_DragTracker_h #define mozilla_layers_DragTracker_h #include "mozilla/EventForwards.h" +#include "mozilla/Maybe.h" namespace mozilla { class MouseInput; namespace layers { // DragTracker simply tracks a sequence of mouse inputs and allows us to tell
--- a/gfx/layers/apz/src/HitTestingTreeNode.cpp +++ b/gfx/layers/apz/src/HitTestingTreeNode.cpp @@ -7,16 +7,17 @@ #include "HitTestingTreeNode.h" #include "AsyncPanZoomController.h" // for AsyncPanZoomController #include "LayersLogging.h" // for Stringify #include "mozilla/gfx/Point.h" // for Point4D #include "mozilla/layers/APZThreadUtils.h" // for AssertOnCompositorThread #include "mozilla/layers/APZUtils.h" // for CompleteAsyncTransform #include "mozilla/layers/AsyncCompositionManager.h" // for ViewTransform::operator Matrix4x4() +#include "mozilla/layers/AsyncDragMetrics.h" // for AsyncDragMetrics #include "nsPrintfCString.h" // for nsPrintfCString #include "UnitTransforms.h" // for ViewAs namespace mozilla { namespace layers { HitTestingTreeNode::HitTestingTreeNode(AsyncPanZoomController* aApzc, bool aIsPrimaryHolder,
--- a/gfx/layers/apz/src/InputBlockState.h +++ b/gfx/layers/apz/src/InputBlockState.h @@ -4,19 +4,21 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef mozilla_layers_InputBlockState_h #define mozilla_layers_InputBlockState_h #include "InputData.h" // for MultiTouchInput #include "mozilla/gfx/Matrix.h" // for Matrix4x4 +#include "mozilla/layers/APZUtils.h" // for TouchBehaviorFlags #include "mozilla/layers/AsyncDragMetrics.h" #include "nsAutoPtr.h" // for nsRefPtr #include "nsTArray.h" // for nsTArray +#include "TouchCounter.h" namespace mozilla { namespace layers { class AsyncPanZoomController; class OverscrollHandoffChain; class CancelableBlockState; class TouchBlockState;
--- a/gfx/layers/apz/src/InputQueue.h +++ b/gfx/layers/apz/src/InputQueue.h @@ -8,16 +8,17 @@ #include "APZUtils.h" #include "DragTracker.h" #include "InputData.h" #include "mozilla/EventForwards.h" #include "mozilla/UniquePtr.h" #include "nsAutoPtr.h" #include "nsTArray.h" +#include "TouchCounter.h" namespace mozilla { class InputData; class MultiTouchInput; class ScrollWheelInput; namespace layers {
--- a/gfx/layers/apz/test/mochitest/helper_bug982141.html +++ b/gfx/layers/apz/test/mochitest/helper_bug982141.html @@ -77,27 +77,32 @@ https://bugzilla.mozilla.org/show_bug.cg "expected scroll frame data for scroll id " + childScrollId); SimpleTest.ok("displayport" in correspondingContentPaint[childScrollId], "expected a displayport for scroll id " + childScrollId); var childDisplayport = correspondingContentPaint[childScrollId]["displayport"]; var dpFields = childDisplayport.replace(/[()\s]+/g, '').split(','); SimpleTest.is(dpFields.length, 4, "expected displayport string of form (x,y,w,h)"); var dpWidth = dpFields[2]; var dpHeight = dpFields[3]; - SimpleTest.ok(dpWidth >= 50 && dpHeight >= 50, + var subframe = document.getElementById('subframe'); + // The clientWidth and clientHeight may be less than 50 if there are scrollbars showing. + // In general they will be (50 - <scrollbarwidth>, 50 - <scrollbarheight>). + SimpleTest.ok(subframe.clientWidth > 0, "Expected a non-zero clientWidth, got: " + subframe.clientWidth); + SimpleTest.ok(subframe.clientHeight > 0, "Expected a non-zero clientHeight, got: " + subframe.clientHeight); + SimpleTest.ok(dpWidth >= subframe.clientWidth && dpHeight >= subframe.clientHeight, "expected a displayport at least as large as the scrollable element, got " + childDisplayport); window.opener.finishTest(); } </script> </head> <body style="overflow: hidden;"><!-- This combined with the user-scalable=no ensures the root frame is not scrollable --> <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=982141">Mozilla Bug 982141</a> <!-- A scrollable subframe, with enough content to make it have a nonzero scroll range --> - <div style="height: 50px; width: 50px; overflow: scroll"> + <div id="subframe" style="height: 50px; width: 50px; overflow: scroll"> <div style="width: 100px"> Wide content so that the vertical scrollbar for the parent div doesn't eat into the 50px width and reduce the width of the displayport. </div> Line 1<br> Line 2<br> Line 3<br>
--- a/gfx/layers/apz/util/APZCCallbackHelper.cpp +++ b/gfx/layers/apz/util/APZCCallbackHelper.cpp @@ -33,19 +33,20 @@ namespace mozilla { namespace layers { using dom::TabParent; uint64_t APZCCallbackHelper::sLastTargetAPZCNotificationInputBlock = uint64_t(-1); -static void -AdjustDisplayPortForScrollDelta(mozilla::layers::FrameMetrics& aFrameMetrics, - const CSSPoint& aActualScrollOffset) +void +APZCCallbackHelper::AdjustDisplayPortForScrollDelta( + mozilla::layers::FrameMetrics& aFrameMetrics, + const CSSPoint& aActualScrollOffset) { // Correct the display-port by the difference between the requested scroll // offset and the resulting scroll offset after setting the requested value. ScreenPoint shift = (aFrameMetrics.GetScrollOffset() - aActualScrollOffset) * aFrameMetrics.DisplayportPixelsPerCSSPixel(); ScreenMargin margins = aFrameMetrics.GetDisplayPortMargins(); margins.left -= shift.x; @@ -90,19 +91,17 @@ ScrollFrameTo(nsIScrollableFrame* aFrame targetScrollPosition.x = geckoScrollPosition.x; } // If the scrollable frame is currently in the middle of an async or smooth // scroll then we don't want to interrupt it (see bug 961280). // Also if the scrollable frame got a scroll request from a higher priority origin // since the last layers update, then we don't want to push our scroll request // because we'll clobber that one, which is bad. - bool scrollInProgress = aFrame->IsProcessingAsyncScroll() - || nsLayoutUtils::CanScrollOriginClobberApz(aFrame->LastScrollOrigin()) - || aFrame->LastSmoothScrollOrigin(); + bool scrollInProgress = APZCCallbackHelper::IsScrollInProgress(aFrame); if (!scrollInProgress) { aFrame->ScrollToCSSPixelsApproximate(targetScrollPosition, nsGkAtoms::apz); geckoScrollPosition = CSSPoint::FromAppUnits(aFrame->GetScrollPosition()); aSuccessOut = true; } // Return the final scroll position after setting it so that anything that relies // on it can have an accurate value. Note that even if we set it above re-querying it // is a good idea because it may have gotten clamped or rounded. @@ -140,17 +139,17 @@ ScrollFrame(nsIContent* aContent, // layer is a scroll info layer, we leave the margins as-is and they will // be interpreted as relative to the content scroll offset. if (nsIFrame* frame = aContent->GetPrimaryFrame()) { frame->SchedulePaint(); } } else { // Correct the display port due to the difference between mScrollOffset and the // actual scroll offset. - AdjustDisplayPortForScrollDelta(aMetrics, actualScrollOffset); + APZCCallbackHelper::AdjustDisplayPortForScrollDelta(aMetrics, actualScrollOffset); } } else { // For whatever reason we couldn't update the scroll offset on the scroll frame, // which means the data APZ used for its displayport calculation is stale. Fall // back to a sane default behaviour. Note that we don't tile-align the recentered // displayport because tile-alignment depends on the scroll position, and the // scroll position here is out of our control. See bug 966507 comment 21 for a // more detailed explanation. @@ -939,11 +938,19 @@ APZCCallbackHelper::SuppressDisplayport( } bool APZCCallbackHelper::IsDisplayportSuppressed() { return sActiveSuppressDisplayport > 0; } +/* static */ bool +APZCCallbackHelper::IsScrollInProgress(nsIScrollableFrame* aFrame) +{ + return aFrame->IsProcessingAsyncScroll() + || nsLayoutUtils::CanScrollOriginClobberApz(aFrame->LastScrollOrigin()) + || aFrame->LastSmoothScrollOrigin(); +} + } // namespace layers } // namespace mozilla
--- a/gfx/layers/apz/util/APZCCallbackHelper.h +++ b/gfx/layers/apz/util/APZCCallbackHelper.h @@ -10,16 +10,17 @@ #include "mozilla/EventForwards.h" #include "mozilla/Function.h" #include "mozilla/layers/APZUtils.h" #include "nsIDOMWindowUtils.h" class nsIContent; class nsIDocument; class nsIPresShell; +class nsIScrollableFrame; class nsIWidget; template<class T> struct already_AddRefed; template<class T> class nsCOMPtr; namespace mozilla { namespace layers { typedef function<void(uint64_t, const nsTArray<TouchBehaviorFlags>&)> @@ -168,16 +169,27 @@ public: * use it to trigger a repaint once suppression is disabled. Without that * the displayport may get left at the suppressed size for an extended * period of time and result in unnecessary checkerboarding (see bug * 1255054). */ static void SuppressDisplayport(const bool& aEnabled, const nsCOMPtr<nsIPresShell>& aShell); static bool IsDisplayportSuppressed(); + static void + AdjustDisplayPortForScrollDelta(mozilla::layers::FrameMetrics& aFrameMetrics, + const CSSPoint& aActualScrollOffset); + + /* + * Check if the scrollable frame is currently in the middle of an async + * or smooth scroll. We want to discard certain scroll input if this is + * true to prevent clobbering higher priority origins. + */ + static bool + IsScrollInProgress(nsIScrollableFrame* aFrame); private: static uint64_t sLastTargetAPZCNotificationInputBlock; }; } // namespace layers } // namespace mozilla #endif /* mozilla_layers_APZCCallbackHelper_h */
--- a/gfx/layers/apz/util/CheckerboardReportService.cpp +++ b/gfx/layers/apz/util/CheckerboardReportService.cpp @@ -7,16 +7,17 @@ #include "gfxPrefs.h" // for gfxPrefs #include "jsapi.h" // for JS_Now #include "MainThreadUtils.h" // for NS_IsMainThread #include "mozilla/Assertions.h" // for MOZ_ASSERT #include "mozilla/ClearOnShutdown.h" // for ClearOnShutdown #include "mozilla/dom/CheckerboardReportServiceBinding.h" // for dom::CheckerboardReports #include "nsContentUtils.h" // for nsContentUtils +#include "nsXULAppAPI.h" namespace mozilla { namespace layers { /*static*/ StaticRefPtr<CheckerboardEventStorage> CheckerboardEventStorage::sInstance; /*static*/ already_AddRefed<CheckerboardEventStorage> CheckerboardEventStorage::GetInstance()
--- a/gfx/layers/client/ClientLayerManager.cpp +++ b/gfx/layers/client/ClientLayerManager.cpp @@ -553,17 +553,17 @@ ClientLayerManager::FlushRendering() remoteRenderer->SendFlushRendering(); } } } void ClientLayerManager::UpdateTextureFactoryIdentifier(const TextureFactoryIdentifier& aNewIdentifier) { - mForwarder->UpdateTextureFactoryIdentifier(aNewIdentifier); + mForwarder->IdentifyTextureHost(aNewIdentifier); } void ClientLayerManager::SendInvalidRegion(const nsIntRegion& aRegion) { if (mWidget) { if (CompositorChild* remoteRenderer = mWidget->GetRemoteRenderer()) { remoteRenderer->SendNotifyRegionInvalidated(aRegion);
--- a/gfx/layers/client/ClientTiledPaintedLayer.cpp +++ b/gfx/layers/client/ClientTiledPaintedLayer.cpp @@ -19,16 +19,20 @@ #include "mozilla/mozalloc.h" // for operator delete, etc #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc #include "LayersLogging.h" #include "mozilla/layers/SingleTiledContentClient.h" namespace mozilla { namespace layers { +using gfx::Rect; +using gfx::IntRect; +using gfx::IntSize; + ClientTiledPaintedLayer::ClientTiledPaintedLayer(ClientLayerManager* const aManager, ClientLayerManager::PaintedLayerCreationHint aCreationHint) : PaintedLayer(aManager, static_cast<ClientLayer*>(this), aCreationHint) , mContentClient() , mHaveSingleTiledContentClient(false) { MOZ_COUNT_CTOR(ClientTiledPaintedLayer); mPaintData.mLastScrollOffset = ParentLayerPoint(0, 0); @@ -289,41 +293,44 @@ ClientTiledPaintedLayer::UseProgressiveD } bool ClientTiledPaintedLayer::RenderHighPrecision(nsIntRegion& aInvalidRegion, const nsIntRegion& aVisibleRegion, LayerManager::DrawPaintedLayerCallback aCallback, void* aCallbackData) { - // If we have no high-precision stuff to draw, or we have started drawing low-precision - // already, then we shouldn't do anything there. - if (aInvalidRegion.IsEmpty() || mPaintData.mLowPrecisionPaintCount != 0) { + // If we have started drawing low-precision already, then we + // shouldn't do anything there. + if (mPaintData.mLowPrecisionPaintCount != 0) { return false; } - // Only draw progressively when the resolution is unchanged - if (UseProgressiveDraw() && + // Only draw progressively when there is something to paint and the + // resolution is unchanged + if (!aInvalidRegion.IsEmpty() && + UseProgressiveDraw() && mContentClient->GetTiledBuffer()->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 // used to decide stale content (currently valid and previously visible) nsIntRegion oldValidRegion = mContentClient->GetTiledBuffer()->GetValidRegion(); oldValidRegion.And(oldValidRegion, aVisibleRegion); if (mPaintData.mCriticalDisplayPort) { oldValidRegion.And(oldValidRegion, mPaintData.mCriticalDisplayPort->ToUnknownRect()); } TILING_LOG("TILING %p: Progressive update with old valid region %s\n", this, Stringify(oldValidRegion).c_str()); return mContentClient->GetTiledBuffer()->ProgressiveUpdate(mValidRegion, aInvalidRegion, oldValidRegion, &mPaintData, aCallback, aCallbackData); } - // Otherwise do a non-progressive paint + // Otherwise do a non-progressive paint. We must do this even when + // the region to paint is empty as the valid region may have shrunk. mValidRegion = aVisibleRegion; if (mPaintData.mCriticalDisplayPort) { mValidRegion.And(mValidRegion, mPaintData.mCriticalDisplayPort->ToUnknownRect()); } TILING_LOG("TILING %p: Non-progressive paint invalid region %s\n", this, Stringify(aInvalidRegion).c_str()); TILING_LOG("TILING %p: Non-progressive paint new valid region %s\n", this, Stringify(mValidRegion).c_str());
--- a/gfx/layers/client/TiledContentClient.cpp +++ b/gfx/layers/client/TiledContentClient.cpp @@ -904,57 +904,57 @@ ClientMultiTiledLayerBuffer::PaintThebes mCallback = aCallback; mCallbackData = aCallbackData; #ifdef GFX_TILEDLAYER_PREF_WARNINGS long start = PR_IntervalNow(); #endif - // If this region is empty XMost() - 1 will give us a negative value. - NS_ASSERTION(!aPaintRegion.GetBounds().IsEmpty(), "Empty paint region\n"); + if (!gfxPrefs::TiledDrawTargetEnabled()) { + if (!aPaintRegion.IsEmpty()) { + + RefPtr<gfxContext> ctxt; + + const IntRect bounds = aPaintRegion.GetBounds(); + { + PROFILER_LABEL("ClientMultiTiledLayerBuffer", "PaintThebesSingleBufferAlloc", + js::ProfileEntry::Category::GRAPHICS); + + mSinglePaintDrawTarget = + gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget( + gfx::IntSize(ceilf(bounds.width * mResolution), + ceilf(bounds.height * mResolution)), + gfxPlatform::GetPlatform()->Optimal2DFormatForContent( + GetContentType())); - if (!gfxPrefs::TiledDrawTargetEnabled()) { - RefPtr<gfxContext> ctxt; + if (!mSinglePaintDrawTarget) { + return; + } + + ctxt = new gfxContext(mSinglePaintDrawTarget); - const IntRect bounds = aPaintRegion.GetBounds(); - { - PROFILER_LABEL("ClientMultiTiledLayerBuffer", "PaintThebesSingleBufferAlloc", + mSinglePaintBufferOffset = nsIntPoint(bounds.x, bounds.y); + } + ctxt->NewPath(); + ctxt->SetMatrix( + ctxt->CurrentMatrix().Scale(mResolution, mResolution). + Translate(-bounds.x, -bounds.y)); +#ifdef GFX_TILEDLAYER_PREF_WARNINGS + if (PR_IntervalNow() - start > 3) { + printf_stderr("Slow alloc %i\n", PR_IntervalNow() - start); + } + start = PR_IntervalNow(); +#endif + PROFILER_LABEL("ClientMultiTiledLayerBuffer", "PaintThebesSingleBufferDraw", js::ProfileEntry::Category::GRAPHICS); - mSinglePaintDrawTarget = - gfxPlatform::GetPlatform()->CreateOffscreenContentDrawTarget( - gfx::IntSize(ceilf(bounds.width * mResolution), - ceilf(bounds.height * mResolution)), - gfxPlatform::GetPlatform()->Optimal2DFormatForContent( - GetContentType())); - - if (!mSinglePaintDrawTarget) { - return; - } - - ctxt = new gfxContext(mSinglePaintDrawTarget); - - mSinglePaintBufferOffset = nsIntPoint(bounds.x, bounds.y); + mCallback(mPaintedLayer, ctxt, aPaintRegion, aDirtyRegion, + DrawRegionClip::NONE, nsIntRegion(), mCallbackData); } - ctxt->NewPath(); - ctxt->SetMatrix( - ctxt->CurrentMatrix().Scale(mResolution, mResolution). - Translate(-bounds.x, -bounds.y)); -#ifdef GFX_TILEDLAYER_PREF_WARNINGS - if (PR_IntervalNow() - start > 3) { - printf_stderr("Slow alloc %i\n", PR_IntervalNow() - start); - } - start = PR_IntervalNow(); -#endif - PROFILER_LABEL("ClientMultiTiledLayerBuffer", "PaintThebesSingleBufferDraw", - js::ProfileEntry::Category::GRAPHICS); - - mCallback(mPaintedLayer, ctxt, aPaintRegion, aDirtyRegion, - DrawRegionClip::NONE, nsIntRegion(), mCallbackData); } #ifdef GFX_TILEDLAYER_PREF_WARNINGS if (PR_IntervalNow() - start > 30) { const IntRect bounds = aPaintRegion.GetBounds(); printf_stderr("Time to draw %i: %i, %i, %i, %i\n", PR_IntervalNow() - start, bounds.x, bounds.y, bounds.width, bounds.height); if (aPaintRegion.IsComplex()) { printf_stderr("Complex region\n"); @@ -1120,89 +1120,91 @@ void ClientMultiTiledLayerBuffer::Update // release tiles that we are not going to reuse before allocating new ones // to avoid allocating unnecessarily. oldRetainedTiles[oldIndex].DiscardBuffers(); } } oldRetainedTiles.Clear(); - for (size_t i = 0; i < newTileCount; ++i) { - const TileIntPoint tilePosition = newTiles.TilePosition(i); - - IntPoint tileOffset = GetTileOffset(tilePosition); - nsIntRegion tileDrawRegion = IntRect(tileOffset, scaledTileSize); - tileDrawRegion.AndWith(aPaintRegion); - - if (tileDrawRegion.IsEmpty()) { - continue; - } - - TileClient& tile = mRetainedTiles[i]; - if (!ValidateTile(tile, GetTileOffset(tilePosition), tileDrawRegion)) { - gfxCriticalError() << "ValidateTile failed"; - } - } - - if (gfxPrefs::TiledDrawTargetEnabled() && mMoz2DTiles.size() > 0) { - gfx::TileSet tileset; - for (size_t i = 0; i < mMoz2DTiles.size(); ++i) { - mMoz2DTiles[i].mTileOrigin -= mTilingOrigin; - } - tileset.mTiles = &mMoz2DTiles[0]; - tileset.mTileCount = mMoz2DTiles.size(); - RefPtr<DrawTarget> drawTarget = gfx::Factory::CreateTiledDrawTarget(tileset); - drawTarget->SetTransform(Matrix()); + if (!aPaintRegion.IsEmpty()) { + for (size_t i = 0; i < newTileCount; ++i) { + const TileIntPoint tilePosition = newTiles.TilePosition(i); - RefPtr<gfxContext> ctx = new gfxContext(drawTarget); - ctx->SetMatrix( - ctx->CurrentMatrix().Scale(mResolution, mResolution).Translate(ThebesPoint(-mTilingOrigin))); - - mCallback(mPaintedLayer, ctx, aPaintRegion, aDirtyRegion, - DrawRegionClip::DRAW, nsIntRegion(), mCallbackData); - mMoz2DTiles.clear(); - // Reset: - mTilingOrigin = IntPoint(std::numeric_limits<int32_t>::max(), - std::numeric_limits<int32_t>::max()); - } - - bool edgePaddingEnabled = gfxPrefs::TileEdgePaddingEnabled(); - - for (uint32_t i = 0; i < mRetainedTiles.Length(); ++i) { - TileClient& tile = mRetainedTiles[i]; - - // Only worry about padding when not doing low-res because it simplifies - // the math and the artifacts won't be noticable - // Edge padding prevents sampling artifacts when compositing. - if (edgePaddingEnabled && mResolution == 1 && - tile.mFrontBuffer && tile.mFrontBuffer->IsLocked()) { - - const TileIntPoint tilePosition = newTiles.TilePosition(i); IntPoint tileOffset = GetTileOffset(tilePosition); - // Strictly speakig we want the unscaled rect here, but it doesn't matter - // because we only run this code when the resolution is equal to 1. - IntRect tileRect = IntRect(tileOffset.x, tileOffset.y, - GetTileSize().width, GetTileSize().height); - nsIntRegion tileDrawRegion = IntRect(tileOffset, scaledTileSize); tileDrawRegion.AndWith(aPaintRegion); - nsIntRegion tileValidRegion = mValidRegion; - tileValidRegion.OrWith(tileDrawRegion); + if (tileDrawRegion.IsEmpty()) { + continue; + } - // We only need to pad out if the tile has area that's not valid - if (!tileValidRegion.Contains(tileRect)) { - tileValidRegion = tileValidRegion.Intersect(tileRect); - // translate the region into tile space and pad - tileValidRegion.MoveBy(-IntPoint(tileOffset.x, tileOffset.y)); - RefPtr<DrawTarget> drawTarget = tile.mFrontBuffer->BorrowDrawTarget(); - PadDrawTargetOutFromRegion(drawTarget, tileValidRegion); + TileClient& tile = mRetainedTiles[i]; + if (!ValidateTile(tile, GetTileOffset(tilePosition), tileDrawRegion)) { + gfxCriticalError() << "ValidateTile failed"; } } - UnlockTile(tile); + + if (gfxPrefs::TiledDrawTargetEnabled() && mMoz2DTiles.size() > 0) { + gfx::TileSet tileset; + for (size_t i = 0; i < mMoz2DTiles.size(); ++i) { + mMoz2DTiles[i].mTileOrigin -= mTilingOrigin; + } + tileset.mTiles = &mMoz2DTiles[0]; + tileset.mTileCount = mMoz2DTiles.size(); + RefPtr<DrawTarget> drawTarget = gfx::Factory::CreateTiledDrawTarget(tileset); + drawTarget->SetTransform(Matrix()); + + RefPtr<gfxContext> ctx = new gfxContext(drawTarget); + ctx->SetMatrix( + ctx->CurrentMatrix().Scale(mResolution, mResolution).Translate(ThebesPoint(-mTilingOrigin))); + + mCallback(mPaintedLayer, ctx, aPaintRegion, aDirtyRegion, + DrawRegionClip::DRAW, nsIntRegion(), mCallbackData); + mMoz2DTiles.clear(); + // Reset: + mTilingOrigin = IntPoint(std::numeric_limits<int32_t>::max(), + std::numeric_limits<int32_t>::max()); + } + + bool edgePaddingEnabled = gfxPrefs::TileEdgePaddingEnabled(); + + for (uint32_t i = 0; i < mRetainedTiles.Length(); ++i) { + TileClient& tile = mRetainedTiles[i]; + + // Only worry about padding when not doing low-res because it simplifies + // the math and the artifacts won't be noticable + // Edge padding prevents sampling artifacts when compositing. + if (edgePaddingEnabled && mResolution == 1 && + tile.mFrontBuffer && tile.mFrontBuffer->IsLocked()) { + + const TileIntPoint tilePosition = newTiles.TilePosition(i); + IntPoint tileOffset = GetTileOffset(tilePosition); + // Strictly speakig we want the unscaled rect here, but it doesn't matter + // because we only run this code when the resolution is equal to 1. + IntRect tileRect = IntRect(tileOffset.x, tileOffset.y, + GetTileSize().width, GetTileSize().height); + + nsIntRegion tileDrawRegion = IntRect(tileOffset, scaledTileSize); + tileDrawRegion.AndWith(aPaintRegion); + + nsIntRegion tileValidRegion = mValidRegion; + tileValidRegion.OrWith(tileDrawRegion); + + // We only need to pad out if the tile has area that's not valid + if (!tileValidRegion.Contains(tileRect)) { + tileValidRegion = tileValidRegion.Intersect(tileRect); + // translate the region into tile space and pad + tileValidRegion.MoveBy(-IntPoint(tileOffset.x, tileOffset.y)); + RefPtr<DrawTarget> drawTarget = tile.mFrontBuffer->BorrowDrawTarget(); + PadDrawTargetOutFromRegion(drawTarget, tileValidRegion); + } + } + UnlockTile(tile); + } } mTiles = newTiles; mValidRegion = newValidRegion; mPaintedRegion.OrWith(aPaintRegion); } bool
--- a/gfx/layers/composite/ContainerLayerComposite.cpp +++ b/gfx/layers/composite/ContainerLayerComposite.cpp @@ -3,16 +3,17 @@ * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "ContainerLayerComposite.h" #include <algorithm> // for min #include "apz/src/AsyncPanZoomController.h" // for AsyncPanZoomController #include "FrameMetrics.h" // for FrameMetrics #include "Units.h" // for LayerRect, LayerPixel, etc +#include "CompositableHost.h" // for CompositableHost #include "gfxEnv.h" // for gfxEnv #include "gfxPrefs.h" // for gfxPrefs #include "mozilla/Assertions.h" // for MOZ_ASSERT, etc #include "mozilla/RefPtr.h" // for RefPtr #include "mozilla/UniquePtr.h" // for UniquePtr #include "mozilla/gfx/BaseRect.h" // for BaseRect #include "mozilla/gfx/Matrix.h" // for Matrix4x4 #include "mozilla/gfx/Point.h" // for Point, IntPoint @@ -25,16 +26,17 @@ #include "mozilla/layers/LayerMetricsWrapper.h" // for LayerMetricsWrapper #include "mozilla/mozalloc.h" // for operator delete, etc #include "mozilla/RefPtr.h" // for nsRefPtr #include "nsDebug.h" // for NS_ASSERTION #include "nsISupportsImpl.h" // for MOZ_COUNT_CTOR, etc #include "nsISupportsUtils.h" // for NS_ADDREF, NS_RELEASE #include "nsRegion.h" // for nsIntRegion #include "nsTArray.h" // for AutoTArray +#include <stack> #include "TextRenderer.h" // for TextRenderer #include <vector> #include "VRManager.h" // for VRManager #include "GeckoProfiler.h" // for GeckoProfiler #ifdef MOZ_ENABLE_PROFILER_SPS #include "ProfilerMarkers.h" // for ProfilerMarkers #endif
--- a/gfx/layers/ipc/CompositableForwarder.h +++ b/gfx/layers/ipc/CompositableForwarder.h @@ -131,19 +131,16 @@ public: virtual void UseComponentAlphaTextures(CompositableClient* aCompositable, TextureClient* aClientOnBlack, TextureClient* aClientOnWhite) = 0; virtual void SendPendingAsyncMessges() = 0; void IdentifyTextureHost(const TextureFactoryIdentifier& aIdentifier); - void UpdateTextureFactoryIdentifier(const TextureFactoryIdentifier& aNewIdentifier) { - mTextureFactoryIdentifier = aNewIdentifier; - } virtual int32_t GetMaxTextureSize() const override { return mTextureFactoryIdentifier.mMaxTextureSize; } bool IsOnCompositorSide() const override { return false; } /**
--- a/gfx/layers/opengl/TextureClientOGL.cpp +++ b/gfx/layers/opengl/TextureClientOGL.cpp @@ -76,19 +76,16 @@ AndroidSurfaceTextureData::CreateTexture { MOZ_ASSERT(XRE_IsParentProcess(), "Can't pass an android surfaces between processes."); if (!aSurfTex || !XRE_IsParentProcess()) { return nullptr; } - // XXX - This is quite sad and slow. - aFlags |= TextureFlags::DEALLOCATE_CLIENT; - if (aOriginPos == gl::OriginPos::BottomLeft) { aFlags |= TextureFlags::ORIGIN_BOTTOM_LEFT; } return TextureClient::CreateWithData( new AndroidSurfaceTextureData(aSurfTex, aSize), aFlags, aAllocator );
--- a/gfx/qcms/moz.build +++ b/gfx/qcms/moz.build @@ -34,30 +34,16 @@ if '86' in CONFIG['OS_TEST']: use_sse1 = True elif 'ppc' in CONFIG['CPU_ARCH']: if CONFIG['GNU_CC']: use_altivec = True if use_sse1: SOURCES += ['transform-sse1.c'] SOURCES['transform-sse1.c'].flags += CONFIG['SSE_FLAGS'] - if CONFIG['SOLARIS_SUNPRO_CC']: - if '64' in CONFIG['OS_TEST']: - # Sun Studio doesn't work correctly for x86 intristics - # with -m64 and without optimization. - SOURCES['transform-sse1.c'].flags += ['-xO4'] - else: - SOURCES['transform-sse1.c'].flags += ['-xarch=sse'] if use_sse2: SOURCES += ['transform-sse2.c'] SOURCES['transform-sse2.c'].flags += CONFIG['SSE2_FLAGS'] - if CONFIG['SOLARIS_SUNPRO_CC']: - if '64' in CONFIG['OS_TEST']: - # Sun Studio doesn't work correctly for x86 intristics - # with -m64 and without optimization. - SOURCES['transform-sse2.c'].flags += ['-xO4'] - else: - SOURCES['transform-sse2.c'].flags += ['-xarch=sse2'] if use_altivec: SOURCES += ['transform-altivec.c'] SOURCES['transform-altivec.c'].flags += ['-maltivec']
--- a/gfx/thebes/gfxPrefs.h +++ b/gfx/thebes/gfxPrefs.h @@ -170,16 +170,17 @@ private: DECL_GFX_PREF(Live, "apz.overscroll.enabled", APZOverscrollEnabled, bool, false); DECL_GFX_PREF(Live, "apz.overscroll.min_pan_distance_ratio", APZMinPanDistanceRatio, float, 1.0f); DECL_GFX_PREF(Live, "apz.overscroll.spring_friction", APZOverscrollSpringFriction, float, 0.015f); DECL_GFX_PREF(Live, "apz.overscroll.spring_stiffness", APZOverscrollSpringStiffness, float, 0.001f); DECL_GFX_PREF(Live, "apz.overscroll.stop_distance_threshold", APZOverscrollStopDistanceThreshold, float, 5.0f); DECL_GFX_PREF(Live, "apz.overscroll.stop_velocity_threshold", APZOverscrollStopVelocityThreshold, float, 0.01f); DECL_GFX_PREF(Live, "apz.overscroll.stretch_factor", APZOverscrollStretchFactor, float, 0.5f); DECL_GFX_PREF(Live, "apz.paint_skipping.enabled", APZPaintSkipping, bool, true); + DECL_GFX_PREF(Live, "apz.peek_messages.enabled", APZPeekMessages, bool, true); DECL_GFX_PREF(Live, "apz.printtree", APZPrintTree, bool, false); DECL_GFX_PREF(Live, "apz.record_checkerboarding", APZRecordCheckerboarding, bool, false); DECL_GFX_PREF(Live, "apz.test.logging_enabled", APZTestLoggingEnabled, bool, false); DECL_GFX_PREF(Live, "apz.touch_move_tolerance", APZTouchMoveTolerance, float, 0.0); DECL_GFX_PREF(Live, "apz.touch_start_tolerance", APZTouchStartTolerance, float, 1.0f/4.5f); DECL_GFX_PREF(Live, "apz.velocity_bias", APZVelocityBias, float, 1.0f); DECL_GFX_PREF(Live, "apz.velocity_relevance_time_ms", APZVelocityRelevanceTime, uint32_t, 150); DECL_GFX_PREF(Live, "apz.x_skate_highmem_adjust", APZXSkateHighMemAdjust, float, 0.0f);
--- a/gfx/vr/moz.build +++ b/gfx/vr/moz.build @@ -52,8 +52,14 @@ CFLAGS += CONFIG['MOZ_CAIRO_CFLAGS'] CFLAGS += CONFIG['TK_CFLAGS'] include('/ipc/chromium/chromium-config.mozbuild') FINAL_LIBRARY = 'xul' if CONFIG['GNU_CXX']: CXXFLAGS += ['-Wshadow'] + +# This is intended as a temporary hack to enable VS2015 builds. +if CONFIG['_MSC_VER']: + # ovr_capi_dynamic.h '<unnamed-tag>': Alignment specifier is less than + # actual alignment (8), and will be ignored + CXXFLAGS += ['-wd4359']
--- a/image/decoders/nsGIFDecoder2.cpp +++ b/image/decoders/nsGIFDecoder2.cpp @@ -200,30 +200,28 @@ nsGIFDecoder2::BeginImageFrame(const Int SurfacePipeFlags pipeFlags = aIsInterlaced ? SurfacePipeFlags::DEINTERLACE : SurfacePipeFlags(); Maybe<SurfacePipe> pipe; if (mGIFStruct.images_decoded == 0) { // This is the first frame. We may be downscaling, so compute the target - // size and target frame rect. + // size. IntSize targetSize = mDownscaler ? mDownscaler->TargetSize() : GetSize(); - IntRect targetFrameRect = mDownscaler ? IntRect(IntPoint(), targetSize) - : aFrameRect; // The first frame may be displayed progressively. pipeFlags |= SurfacePipeFlags::PROGRESSIVE_DISPLAY; // The first frame is always decoded into an RGB surface. pipe = SurfacePipeFactory::CreateSurfacePipe(this, mGIFStruct.images_decoded, GetSize(), targetSize, - targetFrameRect, format, pipeFlags); + aFrameRect, format, pipeFlags); } else { // This is an animation frame (and not the first). To minimize the memory // usage of animations, the image data is stored in paletted form. MOZ_ASSERT(!mDownscaler); pipe = SurfacePipeFactory::CreatePalettedSurfacePipe(this, mGIFStruct.images_decoded, GetSize(), aFrameRect, format, aDepth, pipeFlags);
--- a/intl/unicharutil/util/internal/moz.build +++ b/intl/unicharutil/util/internal/moz.build @@ -18,8 +18,14 @@ LOCAL_INCLUDES += [ '..', ] if CONFIG['ENABLE_INTL_API']: CXXFLAGS += CONFIG['MOZ_ICU_CFLAGS'] LOCAL_INCLUDES += CONFIG['MOZ_ICU_INCLUDES'] DIST_INSTALL = True + +if CONFIG['_MSC_VER']: + # This is intended as a temporary hack to support building with VS2015. + # 'noexcept' used with no exception handling mode specified; + # termination on exception is not guaranteed. Specify /EHsc + CXXFLAGS += ['-wd4577']
--- a/ipc/chromium/moz.build +++ b/ipc/chromium/moz.build @@ -68,17 +68,17 @@ if os_win: 'src/base/time_win.cc', 'src/base/waitable_event_watcher_win.cc', 'src/base/waitable_event_win.cc', 'src/base/win_util.cc', 'src/chrome/common/ipc_channel_win.cc', 'src/chrome/common/process_watcher_win.cc', 'src/chrome/common/transport_dib_win.cc', ] -elif not CONFIG['MOZ_NATIVE_LIBEVENT']: +elif not CONFIG['MOZ_SYSTEM_LIBEVENT']: DIRS += ['src/third_party'] if os_posix: UNIFIED_SOURCES += [ 'src/base/condition_variable_posix.cc', 'src/base/file_descriptor_shuffle.cc', 'src/base/file_util_posix.cc', 'src/base/lock_impl_posix.cc',
--- a/ipc/chromium/src/third_party/libeventcommon.mozbuild +++ b/ipc/chromium/src/third_party/libeventcommon.mozbuild @@ -23,15 +23,15 @@ else: libevent_include_suffix = 'bsd' else: os_linux = 1 if CONFIG['OS_TARGET'] == 'Android': libevent_include_suffix = 'android' else: libevent_include_suffix = 'linux' -if os_posix and not CONFIG['MOZ_NATIVE_LIBEVENT']: +if os_posix and not CONFIG['MOZ_SYSTEM_LIBEVENT']: DEFINES['HAVE_CONFIG_H'] = True LOCAL_INCLUDES += sorted([ 'libevent', 'libevent/include', 'libevent/' + libevent_include_suffix, ])
--- a/ipc/chromium/src/third_party/moz.build +++ b/ipc/chromium/src/third_party/moz.build @@ -5,17 +5,17 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. libevent_path_prefix = '.' include(libevent_path_prefix + '/libeventcommon.mozbuild') if os_win: error('should not reach here on Windows') -if CONFIG['MOZ_NATIVE_LIBEVENT']: +if CONFIG['MOZ_SYSTEM_LIBEVENT']: error('should not reach here if we are using a native libevent') UNIFIED_SOURCES += [ 'libevent/buffer.c', 'libevent/bufferevent.c', 'libevent/bufferevent_ratelim.c', 'libevent/bufferevent_sock.c', 'libevent/event.c',
--- a/ipc/glue/MessageChannel.cpp +++ b/ipc/glue/MessageChannel.cpp @@ -971,16 +971,27 @@ MessageChannel::OnMessageReceivedFromLin // If we compressed away the previous message, we'll re-use // its pending task. mWorkerLoop->PostTask(FROM_HERE, new DequeueTask(mDequeueOneTask)); } } } void +MessageChannel::PeekMessages(msgid_t aMsgId, mozilla::function<void(const Message& aMsg)> aInvoke) { + for (MessageQueue::iterator it = mPending.begin(); it != mPending.end(); it++) { + Message &msg = *it; + + if (msg.type() == aMsgId) { + aInvoke(msg); + } + } +} + +void MessageChannel::ProcessPendingRequests(AutoEnterTransaction& aTransaction) { IPC_LOG("ProcessPendingRequests for seqno=%d, xid=%d", aTransaction.SequenceNumber(), aTransaction.TransactionID()); // Loop until there aren't any more priority messages to process. for (;;) { // If we canceled during ProcessPendingRequest, then we need to leave
--- a/ipc/glue/MessageChannel.h +++ b/ipc/glue/MessageChannel.h @@ -6,16 +6,17 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef ipc_glue_MessageChannel_h #define ipc_glue_MessageChannel_h 1 #include "base/basictypes.h" #include "base/message_loop.h" +#include "mozilla/Function.h" #include "mozilla/DebugOnly.h" #include "mozilla/Monitor.h" #include "mozilla/Vector.h" #include "mozilla/WeakPtr.h" #if defined(OS_WIN) #include "mozilla/ipc/Neutering.h" #endif // defined(OS_WIN) #include "mozilla/ipc/Transport.h" @@ -104,16 +105,21 @@ class MessageChannel : HasResultCodes void CloseWithTimeout(); void SetAbortOnError(bool abort) { mAbortOnError = abort; } + // Call aInvoke for each pending message of type aId. + // XXX: You must get permission from an IPC peer to use this function + // since it requires custom deserialization and re-orders events. + void PeekMessages(Message::msgid_t aId, mozilla::function<void(const Message& aMsg)> aInvoke); + // Misc. behavioral traits consumers can request for this channel enum ChannelFlags { REQUIRE_DEFAULT = 0, // Windows: if this channel operates on the UI thread, indicates // WindowsMessageLoop code should enable deferred native message // handling to prevent deadlocks. Should only be used for protocols // that manage child processes which might create native UI, like // plugins.
--- a/js/src/asmjs/AsmJS.cpp +++ b/js/src/asmjs/AsmJS.cpp @@ -2625,42 +2625,37 @@ class MOZ_STACK_CLASS FunctionValidator fn_(fn), locals_(m.cx()), breakLabels_(m.cx()), continueLabels_(m.cx()), blockDepth_(0), hasAlreadyReturned_(false) {} - ~FunctionValidator() { - if (m_.hasAlreadyFailed()) - return; - MOZ_ASSERT(!blockDepth_); - MOZ_ASSERT(breakableStack_.empty()); - MOZ_ASSERT(continuableStack_.empty()); - MOZ_ASSERT(breakLabels_.empty()); - MOZ_ASSERT(continueLabels_.empty()); - } - ModuleValidator& m() const { return m_; } ExclusiveContext* cx() const { return m_.cx(); } ParseNode* fn() const { return fn_; } bool init(PropertyName* name, unsigned line) { if (!locals_.init() || !breakLabels_.init() || !continueLabels_.init()) return false; if (!m_.mg().startFuncDef(line, &fg_)) return false; encoder_.emplace(fg_.bytes()); return true; } bool finish(uint32_t funcIndex, unsigned generateTime) { + MOZ_ASSERT(!blockDepth_); + MOZ_ASSERT(breakableStack_.empty()); + MOZ_ASSERT(continuableStack_.empty()); + MOZ_ASSERT(breakLabels_.empty()); + MOZ_ASSERT(continueLabels_.empty()); return m_.mg().finishFuncDef(funcIndex, generateTime, &fg_); } bool fail(ParseNode* pn, const char* str) { return m_.fail(pn, str); } bool failf(ParseNode* pn, const char* fmt, ...) { @@ -8419,37 +8414,16 @@ js::IsAsmJSModuleLoadedFromCache(JSConte args.rval().set(BooleanValue(loadedFromCache)); return true; } /*****************************************************************************/ // asm.js toString/toSource support -static bool -AppendUseStrictSource(JSContext* cx, HandleFunction fun, Handle<JSFlatString*> src, StringBuffer& out) -{ - // We need to add "use strict" in the body right after the opening - // brace. - size_t bodyStart = 0, bodyEnd; - - // No need to test for functions created with the Function ctor as - // these don't implicitly inherit the "use strict" context. Strict mode is - // enabled for functions created with the Function ctor only if they begin with - // the "use strict" directive, but these functions won't validate as asm.js - // modules. - - if (!FindBody(cx, fun, src, &bodyStart, &bodyEnd)) - return false; - - return out.appendSubstring(src, 0, bodyStart) && - out.append("\n\"use strict\";\n") && - out.appendSubstring(src, bodyStart, src->length() - bodyStart); -} - JSString* js::AsmJSModuleToString(JSContext* cx, HandleFunction fun, bool addParenToLambda) { MOZ_ASSERT(IsAsmJSModule(fun)); AsmJSModule& module = AsmJSModuleToModuleObject(fun)->module().asAsmJS(); uint32_t begin = module.srcStart(); uint32_t end = module.srcEndAfterCurly(); @@ -8496,23 +8470,18 @@ js::AsmJSModuleToString(JSContext* cx, H if (!out.append(") {\n")) return nullptr; } Rooted<JSFlatString*> src(cx, source->substring(cx, begin, end)); if (!src) return nullptr; - if (module.strict()) { - if (!AppendUseStrictSource(cx, fun, src, out)) - return nullptr; - } else { - if (!out.append(src)) - return nullptr; - } + if (!out.append(src)) + return nullptr; if (funCtor && !out.append("\n}")) return nullptr; } if (addParenToLambda && fun->isLambda() && !out.append(")")) return nullptr; @@ -8546,37 +8515,21 @@ js::AsmJSFunctionToString(JSContext* cx, return nullptr; if (!out.append("() {\n [sourceless code]\n}")) return nullptr; } else { // asm.js functions cannot have been created with a Function constructor // as they belong within a module. MOZ_ASSERT(!(begin == 0 && end == source->length() && source->argumentsNotIncluded())); - if (module.strict()) { - // AppendUseStrictSource expects its input to start right after the - // function name, so split the source chars from the src into two parts: - // the function name and the rest (arguments + body). - - // asm.js functions can't be anonymous - MOZ_ASSERT(fun->atom()); - if (!out.append(fun->atom())) - return nullptr; - - size_t nameEnd = begin + fun->atom()->length(); - Rooted<JSFlatString*> src(cx, source->substring(cx, nameEnd, end)); - if (!src || !AppendUseStrictSource(cx, fun, src, out)) - return nullptr; - } else { - Rooted<JSFlatString*> src(cx, source->substring(cx, begin, end)); - if (!src) - return nullptr; - if (!out.append(src)) - return nullptr; - } + Rooted<JSFlatString*> src(cx, source->substring(cx, begin, end)); + if (!src) + return nullptr; + if (!out.append(src)) + return nullptr; } return out.finishString(); } /*****************************************************************************/ // asm.js heap
--- a/js/src/asmjs/Wasm.cpp +++ b/js/src/asmjs/Wasm.cpp @@ -1576,18 +1576,22 @@ wasm::Eval(JSContext* cx, Handle<TypedAr Vector<uint8_t> copy(cx); if (code->bufferUnshared()->hasInlineData()) { if (!copy.append(bytes, length)) return false; bytes = copy.begin(); } - UniqueChars file; - if (!DescribeScriptedCaller(cx, &file)) + JS::AutoFilename filename; + if (!DescribeScriptedCaller(cx, &filename)) + return false; + + UniqueChars file = DuplicateString(filename.get()); + if (!file) return false; ImportNameVector importNames; UniqueExportMap exportMap; Rooted<ArrayBufferObject*> heap(cx); Rooted<WasmModuleObject*> moduleObj(cx); if (!DecodeModule(cx, Move(file), bytes, length, &importNames, &exportMap, &heap, &moduleObj)) {
--- a/js/src/asmjs/WasmTypes.cpp +++ b/js/src/asmjs/WasmTypes.cpp @@ -13,18 +13,16 @@ * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "asmjs/WasmTypes.h" -#include "fdlibm.h" - #include "jslibmath.h" #include "jsmath.h" #include "asmjs/Wasm.h" #include "asmjs/WasmModule.h" #include "js/Conversions.h" #include "vm/Interpreter.h" @@ -231,40 +229,40 @@ wasm::AddressOf(SymbolicAddress imm, Exc #endif case SymbolicAddress::ModD: return FuncCast(NumberMod, Args_Double_DoubleDouble); case SymbolicAddress::SinD: #ifdef _WIN64 // Workaround a VS 2013 sin issue, see math_sin_uncached. return FuncCast<double (double)>(js::math_sin_uncached, Args_Double_Double); #else - return FuncCast<double (double)>(fdlibm::sin, Args_Double_Double); + return FuncCast<double (double)>(sin, Args_Double_Double); #endif case SymbolicAddress::CosD: - return FuncCast<double (double)>(fdlibm::cos, Args_Double_Double); + return FuncCast<double (double)>(cos, Args_Double_Double); case SymbolicAddress::TanD: - return FuncCast<double (double)>(fdlibm::tan, Args_Double_Double); + return FuncCast<double (double)>(tan, Args_Double_Double); case SymbolicAddress::ASinD: - return FuncCast<double (double)>(fdlibm::asin, Args_Double_Double); + return FuncCast<double (double)>(asin, Args_Double_Double); case SymbolicAddress::ACosD: - return FuncCast<double (double)>(fdlibm::acos, Args_Double_Double); + return FuncCast<double (double)>(acos, Args_Double_Double); case SymbolicAddress::ATanD: - return FuncCast<double (double)>(fdlibm::atan, Args_Double_Double); + return FuncCast<double (double)>(atan, Args_Double_Double); case SymbolicAddress::CeilD: - return FuncCast<double (double)>(fdlibm::ceil, Args_Double_Double); + return FuncCast<double (double)>(ceil, Args_Double_Double); case SymbolicAddress::CeilF: - return FuncCast<float (float)>(fdlibm::ceilf, Args_Float32_Float32); + return FuncCast<float (float)>(ceilf, Args_Float32_Float32); case SymbolicAddress::FloorD: - return FuncCast<double (double)>(fdlibm::floor, Args_Double_Double); + return FuncCast<double (double)>(floor, Args_Double_Double); case SymbolicAddress::FloorF: - return FuncCast<float (float)>(fdlibm::floorf, Args_Float32_Float32); + return FuncCast<float (float)>(floorf, Args_Float32_Float32); case SymbolicAddress::ExpD: - return FuncCast<double (double)>(fdlibm::exp, Args_Double_Double); + return FuncCast<double (double)>(exp, Args_Double_Double); case SymbolicAddress::LogD: - return FuncCast<double (double)>(fdlibm::log, Args_Double_Double); + return FuncCast<double (double)>(log, Args_Double_Double); case SymbolicAddress::PowD: return FuncCast(ecmaPow, Args_Double_DoubleDouble); case SymbolicAddress::ATan2D: return FuncCast(ecmaAtan2, Args_Double_DoubleDouble); case SymbolicAddress::Limit: break; }
--- a/js/src/builtin/Object.cpp +++ b/js/src/builtin/Object.cpp @@ -378,20 +378,16 @@ js::obj_valueOf(JSContext* cx, unsigned return true; } static bool obj_setPrototypeOf(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); - RootedObject setPrototypeOf(cx, &args.callee()); - if (!GlobalObject::warnOnceAboutPrototypeMutation(cx, setPrototypeOf)) - return false; - if (args.length() < 2) { JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_MORE_ARGS_NEEDED, "Object.setPrototypeOf", "1", ""); return false; } /* Step 1-2. */ if (args[0].isNullOrUndefined()) { @@ -1049,23 +1045,16 @@ namespace js { size_t sSetProtoCalled = 0; } // namespace js static bool ProtoSetter(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); - // Do this here, rather than after the this-check so even likely-buggy - // use of the __proto__ setter on unacceptable values, where no subsequent - // use occurs on an acceptable value, will trigger a warning. - RootedObject callee(cx, &args.callee()); - if (!GlobalObject::warnOnceAboutPrototypeMutation(cx, callee)) - return false; - HandleValue thisv = args.thisv(); if (thisv.isNullOrUndefined()) { ReportIncompatible(cx, args); return false; } if (thisv.isPrimitive()) { // Mutating a boxed primitive's [[Prototype]] has no side effects. args.rval().setUndefined();
--- a/js/src/builtin/SIMD.cpp +++ b/js/src/builtin/SIMD.cpp @@ -213,16 +213,18 @@ static const JSFunctionSpec TypeDescript JS_SELF_HOSTED_FN("toSource", "DescrToSource", 0, 0), JS_SELF_HOSTED_FN("array", "ArrayShorthand", 1, 0), JS_SELF_HOSTED_FN("equivalent", "TypeDescrEquivalent", 1, 0), JS_FS_END }; // Shared TypedObject methods for all SIMD types. static const JSFunctionSpec SimdTypedObjectMethods[] = { + JS_SELF_HOSTED_FN("toString", "SimdToString", 0, 0), + JS_SELF_HOSTED_FN("valueOf", "SimdValueOf", 0, 0), JS_SELF_HOSTED_FN("toSource", "SimdToSource", 0, 0), JS_FS_END }; // Provide JSJitInfo structs for those types that are supported by Ion. // The controlling SIMD type is encoded as the InlinableNative primary opcode. // The SimdOperation within the type is encoded in the .depth field. // @@ -1251,59 +1253,131 @@ Select(JSContext* cx, unsigned argc, Val Elem result[V::lanes]; for (unsigned i = 0; i < V::lanes; i++) result[i] = mask[i] ? tv[i] : fv[i]; return StoreResult<V>(cx, args, result); } -template<class VElem, unsigned NumElem> +// Get an integer array index from a function argument. Coerce if necessary. +// +// When a JS function argument represents an integer index into an array, it is +// laundered like this: +// +// 1. numericIndex = ToNumber(argument) (may throw TypeError) +// 2. intIndex = ToInteger(numericIndex) +// 3. if intIndex != numericIndex throw RangeError +// +// This function additionally bounds the range to the non-negative contiguous +// integers: +// +// 4. if intIndex < 0 or intIndex > 2^53 throw RangeError +// +// Return true and set |*index| to the integer value if |argument| is a valid +// array index argument. Otherwise report an TypeError or RangeError and return +// false. +// +// The returned index will always be in the range 0 <= *index <= 2^53. static bool -TypedArrayFromArgs(JSContext* cx, const CallArgs& args, - MutableHandleObject typedArray, int32_t* byteStart) +ArgumentToIntegerIndex(JSContext* cx, JS::HandleValue v, uint64_t* index) +{ + // Fast common case. + if (v.isInt32()) { + int32_t i = v.toInt32(); + if (i >= 0) { + *index = i; + return true; + } + } + + // Slow case. Use ToNumber() to coerce. This may throw a TypeError. + double d; + if (!ToNumber(cx, v, &d)) + return false; + + // Check that |d| is an integer in the valid range. + // + // Not all floating point integers fit in the range of a uint64_t, so we + // need a rough range check before the real range check in our caller. We + // could limit indexes to UINT64_MAX, but this would mean that our callers + // have to be very careful about integer overflow. The contiguous integer + // floating point numbers end at 2^53, so make that our upper limit. If we + // ever support arrays with more than 2^53 elements, this will need to + // change. + // + // Reject infinities, NaNs, and numbers outside the contiguous integer range + // with a RangeError. + + // Write relation so NaNs throw a RangeError. + if (!(0 <= d && d <= (uint64_t(1) << 53))) { + JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_INDEX); + return false; + } + + // Check that d is an integer, throw a RangeError if not. + // Note that this conversion could invoke undefined behaviour without the + // range check above. + uint64_t i(d); + if (d != double(i)) { + JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_INDEX); + return false; + } + + *index = i; + return true; +} + +// Look for arguments (ta, idx) where ta is a TypedArray and idx is a +// non-negative integer. +// Check that accessBytes can be accessed starting from index idx in the array. +// Return the array handle in typedArray and idx converted to a byte offset in byteStart. +static bool +TypedArrayFromArgs(JSContext* cx, const CallArgs& args, uint32_t accessBytes, + MutableHandleObject typedArray, size_t* byteStart) { if (!args[0].isObject()) return ErrorBadArgs(cx); JSObject& argobj = args[0].toObject(); if (!argobj.is<TypedArrayObject>()) return ErrorBadArgs(cx); typedArray.set(&argobj); - int32_t index; - if (!ToInt32(cx, args[1], &index)) + uint64_t index; + if (!ArgumentToIntegerIndex(cx, args[1], &index)) return false; - *byteStart = index * typedArray->as<TypedArrayObject>().bytesPerElement(); - if (*byteStart < 0 || (uint32_t(*byteStart) + NumElem * sizeof(VElem)) > - typedArray->as<TypedArrayObject>().byteLength()) - { + // Do the range check in 64 bits even when size_t is 32 bits. + // This can't overflow because index <= 2^53. + uint64_t bytes = index * typedArray->as<TypedArrayObject>().bytesPerElement(); + if ((bytes + accessBytes) > typedArray->as<TypedArrayObject>().byteLength()) { // Keep in sync with AsmJS OnOutOfBounds function. JS_ReportErrorNumber(cx, GetErrorMessage, nullptr, JSMSG_BAD_INDEX); return false; } + *byteStart = bytes; return true; } template<class V, unsigned NumElem> static bool Load(JSContext* cx, unsigned argc, Value* vp) { typedef typename V::Elem Elem; CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 2) return ErrorBadArgs(cx); - int32_t byteStart; + size_t byteStart; RootedObject typedArray(cx); - if (!TypedArrayFromArgs<Elem, NumElem>(cx, args, &typedArray, &byteStart)) + if (!TypedArrayFromArgs(cx, args, sizeof(Elem) * NumElem, &typedArray, &byteStart)) return false; Rooted<TypeDescr*> typeDescr(cx, GetTypeDescr<V>(cx)); if (!typeDescr) return false; Rooted<TypedObject*> result(cx, TypedObject::createZeroed(cx, typeDescr, 0)); if (!result) @@ -1323,19 +1397,19 @@ static bool Store(JSContext* cx, unsigned argc, Value* vp) { typedef typename V::Elem Elem; CallArgs args = CallArgsFromVp(argc, vp); if (args.length() != 3) return ErrorBadArgs(cx); - int32_t byteStart; + size_t byteStart; RootedObject typedArray(cx); - if (!TypedArrayFromArgs<Elem, NumElem>(cx, args, &typedArray, &byteStart)) + if (!TypedArrayFromArgs(cx, args, sizeof(Elem) * NumElem, &typedArray, &byteStart)) return false; if (!IsVectorObject<V>(args[2])) return ErrorBadArgs(cx); Elem* src = TypedObjectMemory<Elem*>(args[2]); SharedMem<Elem*> dst = typedArray->as<TypedArrayObject>().viewDataEither().addBytes(byteStart).cast<Elem*>();
--- a/js/src/builtin/TestingFunctions.cpp +++ b/js/src/builtin/TestingFunctions.cpp @@ -2830,17 +2830,17 @@ EvalReturningScope(JSContext* cx, unsign AutoStableStringChars strChars(cx); if (!strChars.initTwoByte(cx, str)) return false; mozilla::Range<const char16_t> chars = strChars.twoByteRange(); size_t srclen = chars.length(); const char16_t* src = chars.start().get(); - JS::UniqueChars filename; + JS::AutoFilename filename; unsigned lineno; JS::DescribeScriptedCaller(cx, &filename, &lineno); JS::CompileOptions options(cx); options.setFileAndLine(filename.get(), lineno); options.setNoScriptRval(true); @@ -2916,17 +2916,17 @@ ShellCloneAndExecuteScript(JSContext* cx AutoStableStringChars strChars(cx); if (!strChars.initTwoByte(cx, str)) return false; mozilla::Range<const char16_t> chars = strChars.twoByteRange(); size_t srclen = chars.length(); const char16_t* src = chars.start().get(); - JS::UniqueChars filename; + JS::AutoFilename filename; unsigned lineno; JS::DescribeScriptedCaller(cx, &filename, &lineno); JS::CompileOptions options(cx); options.setFileAndLine(filename.get(), lineno); options.setNoScriptRval(true);
--- a/js/src/builtin/TypedObject.js +++ b/js/src/builtin/TypedObject.js @@ -685,153 +685,188 @@ function SimdTypeToLength(type) { case JS_SIMDTYPEREPR_BOOL64X2: return 2; } assert(false, "Unhandled type constant"); return undefined; } -function SimdToSource() { +// This implements SIMD.*.prototype.valueOf(). +// Once we have proper value semantics for SIMD types, this function should just +// perform a type check and return this. +// For now, throw a TypeError unconditionally since valueOf() was probably +// called from ToNumber() which is supposed to throw when attempting to convert +// a SIMD value to a number. +function SimdValueOf() { if (!IsObject(this) || !ObjectIsTypedObject(this)) - ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "SIMD", "toSource", typeof this); + ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "SIMD", "valueOf", typeof this); var descr = TypedObjectTypeDescr(this); if (DESCR_KIND(descr) != JS_TYPEREPR_SIMD_KIND) - ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "SIMD", "toSource", typeof this); + ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "SIMD", "valueOf", typeof this); + + ThrowTypeError(JSMSG_SIMD_TO_NUMBER); +} + +function SimdToSource() { + if (!IsObject(this) || !ObjectIsTypedObject(this)) + ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "SIMD.*", "toSource", typeof this); + + var descr = TypedObjectTypeDescr(this); + + if (DESCR_KIND(descr) != JS_TYPEREPR_SIMD_KIND) + ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "SIMD.*", "toSource", typeof this); + + return SimdFormatString(descr, this); +} + +function SimdToString() { + if (!IsObject(this) || !ObjectIsTypedObject(this)) + ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "SIMD.*", "toString", typeof this); + + var descr = TypedObjectTypeDescr(this); + + if (DESCR_KIND(descr) != JS_TYPEREPR_SIMD_KIND) + ThrowTypeError(JSMSG_INCOMPATIBLE_PROTO, "SIMD.*", "toString", typeof this); + + return SimdFormatString(descr, this); +} + +function SimdFormatString(descr, typedObj) { var typerepr = DESCR_TYPE(descr); var protoString = SimdProtoString(typerepr); switch (typerepr) { case JS_SIMDTYPEREPR_INT8X16: { - var s1 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 0); - var s2 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 1); - var s3 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 2); - var s4 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 3); - var s5 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 4); - var s6 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 5); - var s7 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 6); - var s8 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 7); - var s9 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 8); - var s10 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 9); - var s11 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 10); - var s12 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 11); - var s13 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 12); - var s14 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 13); - var s15 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 14); - var s16 = callFunction(std_SIMD_Int8x16_extractLane, null, this, 15); + var s1 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 0); + var s2 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 1); + var s3 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 2); + var s4 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 3); + var s5 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 4); + var s6 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 5); + var s7 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 6); + var s8 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 7); + var s9 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 8); + var s10 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 9); + var s11 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 10); + var s12 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 11); + var s13 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 12); + var s14 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 13); + var s15 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 14); + var s16 = callFunction(std_SIMD_Int8x16_extractLane, null, typedObj, 15); return `SIMD.${protoString}(${s1}, ${s2}, ${s3}, ${s4}, ${s5}, ${s6}, ${s7}, ${s8}, ${s9}, ${s10}, ${s11}, ${s12}, ${s13}, ${s14}, ${s15}, ${s16})`; } case JS_SIMDTYPEREPR_INT16X8: { - var s1 = callFunction(std_SIMD_Int16x8_extractLane, null, this, 0); - var s2 = callFunction(std_SIMD_Int16x8_extractLane, null, this, 1); - var s3 = callFunction(std_SIMD_Int16x8_extractLane, null, this, 2); - var s4 = callFunction(std_SIMD_Int16x8_extractLane, null, this, 3); - var s5 = callFunction(std_SIMD_Int16x8_extractLane, null, this, 4); - var s6 = callFunction(std_SIMD_Int16x8_extractLane, null, this, 5); - var s7 = callFunction(std_SIMD_Int16x8_extractLane, null, this, 6); - var s8 = callFunction(std_SIMD_Int16x8_extractLane, null, this, 7); + var s1 = callFunction(std_SIMD_Int16x8_extractLane, null, typedObj, 0); + var s2 = callFunction(std_SIMD_Int16x8_extractLane, null, typedObj, 1); + var s3 = callFunction(std_SIMD_Int16x8_extractLane, null, typedObj, 2); + var s4 = callFunction(std_SIMD_Int16x8_extractLane, null, typedObj, 3); + var s5 = callFunction(std_SIMD_Int16x8_extractLane, null, typedObj, 4); + var s6 = callFunction(std_SIMD_Int16x8_extractLane, null, typedObj, 5); + var s7 = callFunction(std_SIMD_Int16x8_extractLane, null, typedObj, 6); + var s8 = callFunction(std_SIMD_Int16x8_extractLane, null, typedObj, 7); return `SIMD.${protoString}(${s1}, ${s2}, ${s3}, ${s4}, ${s5}, ${s6}, ${s7}, ${s8})`; } case JS_SIMDTYPEREPR_INT32X4: { - var x = callFunction(std_SIMD_Int32x4_extractLane, null, this, 0); - var y = callFunction(std_SIMD_Int32x4_extractLane, null, this, 1); - var z = callFunction(std_SIMD_Int32x4_extractLane, null, this, 2); - var w = callFunction(std_SIMD_Int32x4_extractLane, null, this, 3); + var x = callFunction(std_SIMD_Int32x4_extractLane, null, typedObj, 0); + var y = callFunction(std_SIMD_Int32x4_extractLane, null, typedObj, 1); + var z = callFunction(std_SIMD_Int32x4_extractLane, null, typedObj, 2); + var w = callFunction(std_SIMD_Int32x4_extractLane, null, typedObj, 3); return `SIMD.${protoString}(${x}, ${y}, ${z}, ${w})`; } case JS_SIMDTYPEREPR_UINT8X16: { - var s1 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 0); - var s2 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 1); - var s3 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 2); - var s4 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 3); - var s5 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 4); - var s6 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 5); - var s7 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 6); - var s8 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 7); - var s9 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 8); - var s10 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 9); - var s11 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 10); - var s12 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 11); - var s13 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 12); - var s14 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 13); - var s15 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 14); - var s16 = callFunction(std_SIMD_Uint8x16_extractLane, null, this, 15); + var s1 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 0); + var s2 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 1); + var s3 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 2); + var s4 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 3); + var s5 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 4); + var s6 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 5); + var s7 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 6); + var s8 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 7); + var s9 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 8); + var s10 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 9); + var s11 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 10); + var s12 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 11); + var s13 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 12); + var s14 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 13); + var s15 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 14); + var s16 = callFunction(std_SIMD_Uint8x16_extractLane, null, typedObj, 15); return `SIMD.${protoString}(${s1}, ${s2}, ${s3}, ${s4}, ${s5}, ${s6}, ${s7}, ${s8}, ${s9}, ${s10}, ${s11}, ${s12}, ${s13}, ${s14}, ${s15}, ${s16})`; } case JS_SIMDTYPEREPR_UINT16X8: { - var s1 = callFunction(std_SIMD_Uint16x8_extractLane, null, this, 0); - var s2 = callFunction(std_SIMD_Uint16x8_extractLane, null, this, 1); - var s3 = callFunction(std_SIMD_Uint16x8_extractLane, null, this, 2); - var s4 = callFunction(std_SIMD_Uint16x8_extractLane, null, this, 3); - var s5 = callFunction(std_SIMD_Uint16x8_extractLane, null, this, 4); - var s6 = callFunction(std_SIMD_Uint16x8_extractLane, null, this, 5); - var s7 = callFunction(std_SIMD_Uint16x8_extractLane, null, this, 6); - var s8 = callFunction(std_SIMD_Uint16x8_extractLane, null, this, 7); + var s1 = callFunction(std_SIMD_Uint16x8_extractLane, null, typedObj, 0); + var s2 = callFunction(std_SIMD_Uint16x8_extractLane, null, typedObj, 1); + var s3 = callFunction(std_SIMD_Uint16x8_extractLane, null, typedObj, 2); + var s4 = callFunction(std_SIMD_Uint16x8_extractLane, null, typedObj, 3); + var s5 = callFunction(std_SIMD_Uint16x8_extractLane, null, typedObj, 4); + var s6 = callFunction(std_SIMD_Uint16x8_extractLane, null, typedObj, 5); + var s7 = callFunction(std_SIMD_Uint16x8_extractLane, null, typedObj, 6); + var s8 = callFunction(std_SIMD_Uint16x8_extractLane, null, typedObj, 7); return `SIMD.${protoString}(${s1}, ${s2}, ${s3}, ${s4}, ${s5}, ${s6}, ${s7}, ${s8})`; } case JS_SIMDTYPEREPR_UINT32X4: { - var x = callFunction(std_SIMD_Uint32x4_extractLane, null, this, 0); - var y = callFunction(std_SIMD_Uint32x4_extractLane, null, this, 1); - var z = callFunction(std_SIMD_Uint32x4_extractLane, null, this, 2); - var w = callFunction(std_SIMD_Uint32x4_extractLane, null, this, 3); + var x = callFunction(std_SIMD_Uint32x4_extractLane, null, typedObj, 0); + var y = callFunction(std_SIMD_Uint32x4_extractLane, null, typedObj, 1); + var z = callFunction(std_SIMD_Uint32x4_extractLane, null, typedObj, 2); + var w = callFunction(std_SIMD_Uint32x4_extractLane, null, typedObj, 3); return `SIMD.${protoString}(${x}, ${y}, ${z}, ${w})`; } case JS_SIMDTYPEREPR_FLOAT32X4: { - var x = callFunction(std_SIMD_Float32x4_extractLane, null, this, 0); - var y = callFunction(std_SIMD_Float32x4_extractLane, null, this, 1); - var z = callFunction(std_SIMD_Float32x4_extractLane, null, this, 2); - var w = callFunction(std_SIMD_Float32x4_extractLane, null, this, 3); + var x = callFunction(std_SIMD_Float32x4_extractLane, null, typedObj, 0); + var y = callFunction(std_SIMD_Float32x4_extractLane, null, typedObj, 1); + var z = callFunction(std_SIMD_Float32x4_extractLane, null, typedObj, 2); + var w = callFunction(std_SIMD_Float32x4_extractLane, null, typedObj, 3); return `SIMD.${protoString}(${x}, ${y}, ${z}, ${w})`; } case JS_SIMDTYPEREPR_FLOAT64X2: { - var x = callFunction(std_SIMD_Float64x2_extractLane, null, this, 0); - var y = callFunction(std_SIMD_Float64x2_extractLane, null, this, 1); + var x = callFunction(std_SIMD_Float64x2_extractLane, null, typedObj, 0); + var y = callFunction(std_SIMD_Float64x2_extractLane, null, typedObj, 1); return `SIMD.${protoString}(${x}, ${y})`; } case JS_SIMDTYPEREPR_BOOL8X16: { - var s1 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 0); - var s2 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 1); - var s3 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 2); - var s4 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 3); - var s5 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 4); - var s6 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 5); - var s7 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 6); - var s8 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 7); - var s9 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 8); - var s10 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 9); - var s11 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 10); - var s12 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 11); - var s13 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 12); - var s14 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 13); - var s15 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 14); - var s16 = callFunction(std_SIMD_Bool8x16_extractLane, null, this, 15); + var s1 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 0); + var s2 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 1); + var s3 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 2); + var s4 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 3); + var s5 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 4); + var s6 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 5); + var s7 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 6); + var s8 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 7); + var s9 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 8); + var s10 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 9); + var s11 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 10); + var s12 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 11); + var s13 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 12); + var s14 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 13); + var s15 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 14); + var s16 = callFunction(std_SIMD_Bool8x16_extractLane, null, typedObj, 15); return `SIMD.${protoString}(${s1}, ${s2}, ${s3}, ${s4}, ${s5}, ${s6}, ${s7}, ${s8}, ${s9}, ${s10}, ${s11}, ${s12}, ${s13}, ${s14}, ${s15}, ${s16})`; } case JS_SIMDTYPEREPR_BOOL16X8: { - var s1 = callFunction(std_SIMD_Bool16x8_extractLane, null, this, 0); - var s2 = callFunction(std_SIMD_Bool16x8_extractLane, null, this, 1); - var s3 = callFunction(std_SIMD_Bool16x8_extractLane, null, this, 2); - var s4 = callFunction(std_SIMD_Bool16x8_extractLane, null, this, 3); - var s5 = callFunction(std_SIMD_Bool16x8_extractLane, null, this, 4); - var s6 = callFunction(std_SIMD_Bool16x8_extractLane, null, this, 5); - var s7 = callFunction(std_SIMD_Bool16x8_extractLane, null, this, 6); - var s8 = callFunction(std_SIMD_Bool16x8_extractLane, null, this, 7); + var s1 = callFunction(std_SIMD_Bool16x8_extractLane, null, typedObj, 0); + var s2 = callFunction(std_SIMD_Bool16x8_extractLane, null, typedObj, 1); + var s3 = callFunction(std_SIMD_Bool16x8_extractLane, null, typedObj, 2); + var s4 = callFunction(std_SIMD_Bool16x8_extractLane, null, typedObj, 3); + var s5 = callFunction(std_SIMD_Bool16x8_extractLane, null, typedObj, 4); + var s6 = callFunction(std_SIMD_Bool16x8_extractLane, null, typedObj, 5); + var s7 = callFunction(std_SIMD_Bool16x8_extractLane, null, typedObj, 6); + var s8 = callFunction(std_SIMD_Bool16x8_extractLane, null, typedObj, 7); return `SIMD.${protoString}(${s1}, ${s2}, ${s3}, ${s4}, ${s5}, ${s6}, ${s7}, ${s8})`; } case JS_SIMDTYPEREPR_BOOL32X4: { - var x = callFunction(std_SIMD_Bool32x4_extractLane, null, this, 0); - var y = callFunction(std_SIMD_Bool32x4_extractLane, null, this, 1); - var z = callFunction(std_SIMD_Bool32x4_extractLane, null, this, 2); - var w = callFunction(std_SIMD_Bool32x4_extractLane, null, this, 3); + var x = callFunction(std_SIMD_Bool32x4_extractLane, null, typedObj, 0); + var y = callFunction(std_SIMD_Bool32x4_extractLane, null, typedObj, 1); + var z = callFunction(std_SIMD_Bool32x4_extractLane, null, typedObj, 2); + var w = callFunction(std_SIMD_Bool32x4_extractLane, null, typedObj, 3); return `SIMD.${protoString}(${x}, ${y}, ${z}, ${w})`; } case JS_SIMDTYPEREPR_BOOL64X2: { - var x = callFunction(std_SIMD_Bool64x2_extractLane, null, this, 0); - var y = callFunction(std_SIMD_Bool64x2_extractLane, null, this, 1); + var x = callFunction(std_SIMD_Bool64x2_extractLane, null, typedObj, 0); + var y = callFunction(std_SIMD_Bool64x2_extractLane, null, typedObj, 1); return `SIMD.${protoString}(${x}, ${y})`; } } assert(false, "unexpected SIMD kind"); return '?'; } ///////////////////////////////////////////////////////////////////////////
--- a/js/src/doc/Debugger/Debugger.md +++ b/js/src/doc/Debugger/Debugger.md @@ -249,55 +249,16 @@ compartment. API observe activity in only those globals that are reachable by the API's user, thus imposing capability-based restrictions on a `Debugger`'s reach. However, the `onNewGlobalObject` method allows the API user to monitor all global object creation that occurs anywhere within the JavaScript system (the "JSRuntime", in SpiderMonkey terms), thereby escaping the capability-based limits. For this reason, `onNewGlobalObject` is only available to privileged code. -<code>onIonCompilation(<i>graph</i>)</code> -: A new IonMonkey compilation result is attached to a script instance of - the Debuggee, the <i>graph</i> contains the internal intermediate - representations of the compiler. - - The value <i>graph</i> is an object composed of the following properties: - - `json` - : String containing a JSON of the intermediate representation used by - the compiler. This JSON string content is composed of 2 intermediate - representation of the graph, a `mir` (Middle-level IR), and a - `lir` (Low-level IR). - - Both have a property `blocks`, which is an array of basic - blocks in [SSA form][ssa-form] which are used to construct the - control flow graph. All elements of these arrays are objects which - have a `number`, and an `instructions` properties. - - The MIR blocks have additional properties such as the - `predecessors` and `successors` of each block, which can - be used to reconstruct the control flow graph, with the - `number` properties of the blocks. - - The `instructions` properties are array of objects which have - an `id` and an `opcode`. The `id` corresponds to the - [SSA form][ssa-form] identifier (number) of each instruction, and the - `opcode` is a string which represents the instruction. - - This JSON string contains even more detailed internal information - which remains undocummented, as it is potentially subject to - frequent modifications. - - `scripts` - : Array of [`Debugger.Script`][script] instances. For a block at - `mir.blocks[i]` or `lir.blocks[i]` in the JSON, `scripts[i]` is the - [`Debugger.Script`][script] containing that block's code. - - This method's return value is ignored. - ## Function Properties of the Debugger Prototype Object The functions described below may only be called with a `this` value referring to a `Debugger` instance; they may not be used as methods of other kinds of objects.
--- a/js/src/doc/Debugger/config.sh +++ b/js/src/doc/Debugger/config.sh @@ -59,10 +59,9 @@ resource 'img-chrome-pref' enable resource 'img-scratchpad-browser' scratchpad-browser-environment.png $RBASE/7229/scratchpad-browser-environment.png resource 'img-example-alert' debugger-alert.png $RBASE/7231/debugger-alert.png resource 'img-alloc-plot' alloc-plot-console.png $RBASE/8461/alloc-plot-console.png # External links: absolute-label 'protocol' https://wiki.mozilla.org/Remote_Debugging_Protocol "Remote Debugging Protocol" absolute-label 'saved-frame' https://developer.mozilla.org/en-US/docs/Mozilla/Projects/SpiderMonkey/SavedFrame "SavedFrame" absolute-label 'bernoulli-trial' https://en.wikipedia.org/wiki/Bernoulli_trial "Bernoulli Trial" -absolute-label 'ssa-form' https://en.wikipedia.org/wiki/Static_single_assignment_form "SSA form" absolute-label 'promise-debugging' https://mxr.mozilla.org/mozilla-central/source/dom/webidl/PromiseDebugging.webidl?rev=331d71cabe1e "PromiseDebugging.webidl"
--- a/js/src/jit-test/tests/asm.js/testBug1099216.js +++ b/js/src/jit-test/tests/asm.js/testBug1099216.js @@ -2,57 +2,60 @@ if (typeof SIMD === 'undefined' || !isSi print("won't run tests as simd extensions aren't activated yet"); quit(0); } (function(global) { "use asm"; var frd = global.Math.fround; var fx4 = global.SIMD.Float32x4; + var fc4 = fx4.check; var fsp = fx4.splat; function s(){} - function d(x){x=fx4(x);} + function d(x){x=fc4(x);} function e() { var x = frd(0); x = frd(x / x); s(); d(fsp(x)); } return e; })(this)(); (function(m) { "use asm" var k = m.SIMD.Bool32x4 var g = m.SIMD.Int32x4 + var gc = g.check; var h = g.select function f() { var x = k(0, 0, 0, 0) var y = g(1, 2, 3, 4) - return g(h(x, y, y)) + return gc(h(x, y, y)) } return f; })(this)(); t = (function(global) { "use asm" var toF = global.Math.fround var f4 = global.SIMD.Float32x4 + var f4c = f4.check function p(x, y, width, value, max_iterations) { x = x | 0 y = y | 0 width = width | 0 value = value | 0 max_iterations = max_iterations | 0 } function m(xf, yf, yd, max_iterations) { xf = toF(xf) yf = toF(yf) yd = toF(yd) max_iterations = max_iterations | 0 var _ = f4(0, 0, 0, 0), c_im4 = f4(0, 0, 0, 0) c_im4 = f4(yf, yd, yd, yf) - return f4(c_im4); + return f4c(c_im4); } return {p:p,m:m}; })(this) t.p(); t.m();
new file mode 100644 --- /dev/null +++ b/js/src/jit-test/tests/asm.js/testBug1255954.js @@ -0,0 +1,12 @@ +const USE_ASM = '"use asm";'; +if (!('oomTest' in this)) + quit(); +function asmCompile() { + var f = Function.apply(null, arguments); +} +oomTest(() => { + try { + function f(b) {} + } catch (exc0) {} + f(asmCompile(USE_ASM + "function f() { var i=42; return i|0; for(;1;) {} return 0 } return f")); +});
--- a/js/src/jit-test/tests/asm.js/testSource.js +++ b/js/src/jit-test/tests/asm.js/testSource.js @@ -235,30 +235,29 @@ if (isAsmJSCompilationAvailable() && isC var m = new Function('glob', 'ffi', 'heap', bodyOnly); assertEq(isAsmJSModuleLoadedFromCache(m), true); assertEq(m.toString(), "function anonymous(glob, ffi, heap) {\n" + bodyOnly + "\n}"); assertEq(m.toSource(), "(function anonymous(glob, ffi, heap) {\n" + bodyOnly + "\n})"); } })(); -/* Implicit "use strict" context in modules */ +/* Modules in "use strict" context */ (function() { -var funcHeader = 'function (glob, ffi, heap) {', - funcBody = '\n"use asm";\n\ - function g() {}\n\ - return g;\n\n' - funcFooter = '}', - funcSource = funcHeader + funcBody + funcFooter - useStrict = '\n"use strict";\n'; +var funcSource = + `function (glob, ffi, heap) { + "use asm"; + function g() {} + return g; + }`; var f4 = eval("\"use strict\";\n(" + funcSource + ")"); -var expectedToString = funcHeader + useStrict + funcBody + funcFooter +var expectedToString = funcSource; var expectedToSource = '(' + expectedToString + ')' assertEq(f4.toString(), expectedToString); assertEq(f4.toSource(), expectedToSource); if (isAsmJSCompilationAvailable() && isCachingEnabled()) { var f5 = eval("\"use strict\";\n(" + funcSource + ")"); assertEq(isAsmJSModuleLoadedFromCache(f5), true); @@ -335,69 +334,66 @@ if (isAsmJSCompilationAvailable() && isC eval('var x = 42;' + moduleDecl); m = g3(); assertEq(isAsmJSModuleLoadedFromCache(g3), true); checkFuncSrc(m); } })(); -/* Implicit "use strict" context in functions */ +/* Functions in "use strict" context */ (function () { var funcCode = 'function g(x) {\n\ x=x|0;\n\ return x + 1 | 0;}'; var moduleCode = 'function () {\n\ "use asm";\n' + funcCode + '\n\ return g;\n\ }', useStrict = '"use strict";'; var f5 = eval(useStrict + ";\n(" + moduleCode + "())"); -var expectedToString = funcCode.replace('{', '{\n' + useStrict + '\n') +var expectedToString = funcCode; var expectedToSource = expectedToString assertEq(f5.toString(), expectedToString); assertEq(f5.toSource(), expectedToSource); if (isAsmJSCompilationAvailable() && isCachingEnabled()) { var mf5 = eval("\"use strict\";\n(" + moduleCode + ")"); assertEq(isAsmJSModuleLoadedFromCache(mf5), true); var f5 = mf5(); assertEq(f5.toString(), expectedToString); assertEq(f5.toSource(), expectedToSource); } })(); -/* Implicit "use strict" context in functions with dynamic linking failure */ +/* Functions in "use strict" context with dynamic linking failure */ (function () { var funcCode = 'function g(x) {\n\ x=x|0;\n\ return x + 1 | 0;}'; var moduleCode = 'function (glob) {\n\ "use asm";\n\ var fround = glob.Math.fround;\n\ ' + funcCode + '\n\ return g;\n\ }', useStrict = '"use strict";'; var f6 = eval(useStrict + ";\n(" + moduleCode + "({Math:{}}))"); -var expectedToString = funcCode.replace('{', '{\n' + useStrict + '\n') -var expectedToSource = expectedToString - -assertEq(f6.toString(), expectedToString); -assertEq(f6.toSource(), expectedToSource); +assertEq(f6.toString(), funcCode); +assertEq(f6.toSource(), funcCode); if (isAsmJSCompilationAvailable() && isCachingEnabled()) { var mf6 = eval("\"use strict\";\n(" + moduleCode + ")"); assertEq(isAsmJSModuleLoadedFromCache(mf6), true); var f6 = mf6({Math:{}}); - assertEq(f6.toString(), expectedToString); - assertEq(f6.toSource(), expectedToSource); + assertEq(f6.toString(), funcCode); + assertEq(f6.toSource(), funcCode); } })();
deleted file mode 100644 --- a/js/src/jit-test/tests/basic/function-tosource-strict.js +++ /dev/null @@ -1,12 +0,0 @@ -function outer() { - "use strict"; - function inner() {} - return inner; -} -assertEq(outer().toString().indexOf("use strict") != -1, true); -function outer2() { - "use strict"; - function inner() blah; - return inner; -} -assertEq(outer2().toString().indexOf("/* use strict */") != -1, true);
deleted file mode 100644 --- a/js/src/jit-test/tests/debug/bug1204726.js +++ /dev/null @@ -1,14 +0,0 @@ - -setJitCompilerOption("ion.warmup.trigger", 1); -gczeal(4); -function test() { - for (var res = false; !res; res = inIon()) {}; -} -var g = newGlobal(); -g.parent = this; -g.eval(` - var dbg = new Debugger(); - var parentw = dbg.addDebuggee(parent); - dbg.onIonCompilation = function (graph) {}; -`); -test();
new file mode 100644 --- /dev/null +++ b/js/src/jit-test/tests/debug/prologueFailure-01.js @@ -0,0 +1,32 @@ +g = newGlobal(); +g.parent = this; + +function installHook() { + let calledTimes = 0; + function hook() { + calledTimes++; + + // Allow the new.target.prototype get to throw. + if (calledTimes === 1) + return undefined; + + return { + return: undefined + }; + } + + Debugger(parent).onExceptionUnwind = hook; +} + + +g.eval("(" + installHook + ")()"); + +var handler = { + get(t, p) { + throw new TypeError; + } +}; + + +var f = new Proxy(function(){}, handler); +new f();
new file mode 100644 --- /dev/null +++ b/js/src/jit-test/tests/debug/prologueFailure-02.js @@ -0,0 +1,49 @@ +g = newGlobal(); +g.parent = this; + +function installHook() { + let calledTimes = 0; + function hook(frame) { + calledTimes++; + switch (calledTimes) { + case 1: + // Proxy get trap + assertEq(frame.type, "call"); + assertEq(frame.script.displayName.includes("get"), true); + break; + case 2: + // wrapper function. There is no entry for notRun + assertEq(frame.type, "call"); + assertEq(frame.script.displayName.includes("wrapper"), true); + break; + case 3: + assertEq(frame.type, "global"); + // Force the top-level to return cleanly, so that we can tell + // assertion failures from the intended throwing. + return { return: undefined }; + + default: + // that's the whole chain. + assertEq(false, true); + } + } + + Debugger(parent).onExceptionUnwind = hook; +} + + +g.eval("(" + installHook + ")()"); + +var handler = { + get(t, p) { + throw new TypeError; + } +}; + +function notRun() {} + +function wrapper() { + var f = new Proxy(notRun, handler); + new f(); +} +wrapper();
deleted file mode 100644 --- a/js/src/jit-test/tests/ion/bug1199952.js +++ /dev/null @@ -1,23 +0,0 @@ -var g = newGlobal(); -g.parent = this; -g.eval(` - var dbg = new Debugger(); - var parentw = dbg.addDebuggee(parent); - dbg.onIonCompilation = function (graph) {}; -`); -gczeal(7,1); -var findNearestDateBefore = function(start, predicate) { - var current = start; - var month = 1000 * 60 * 60 * 24 * 30; - for (var step = month; step > 0; step = Math.floor(step / 3)) { - !predicate(current); - current = new Date(current.getTime() + step); - } -}; -var juneDate = new Date(2000, 5, 20, 0, 0, 0, 0); -var decemberDate = new Date(2000, 11, 20, 0, 0, 0, 0); -var juneOffset = juneDate.getTimezoneOffset(); -var decemberOffset = decemberDate.getTimezoneOffset(); -var isSouthernHemisphere = (juneOffset > decemberOffset); -var winterTime = isSouthernHemisphere ? juneDate : decemberDate; -var dstStart = findNearestDateBefore(winterTime, function (date) {});
new file mode 100644 --- /dev/null +++ b/js/src/jit-test/tests/ion/pgo-bug1252120.js @@ -0,0 +1,14 @@ +// |jit-test| --ion-pgo=on; + +target = handler = {} +for (p of[new Proxy(target, handler)]) + evaluate("foo()"); +function foo() { + symbols = [Symbol] + values = [NaN] + for (comparator of[""]) + for (b of values) assertEq; + for (comparator of[""]) + for (a of symbols) + for (b of values) assertEq; +}
deleted file mode 100644 --- a/js/src/jit-test/tests/self-test/findPath-bug1234428.js +++ /dev/null @@ -1,23 +0,0 @@ -// 1. --ion-eager causes all functions to be compiled with IonMonkey before -// executing them. -// 2. Registering the onIonCompilation hook on the Debugger causes -// the JSScript of the function C to be wrapped in the Debugger compartment. -// 3. The JSScript hold a pointer to its function C. -// 4. The function C, hold its environment. -// 5. The environment holds the Object o. -g = newGlobal(); -g.parent = this; -g.eval(` - dbg = Debugger(parent); - dbg.onIonCompilation = function () {}; -`); - -function foo() { - eval(` - var o = {}; - function C() {}; - new C; - findPath(o, o); - `); -} -foo();
--- a/js/src/jit-test/tests/wasm/basic.js +++ b/js/src/jit-test/tests/wasm/basic.js @@ -338,16 +338,18 @@ assertThrowsInstanceOf(() => f(), Intern var code = '(module (import "one" "" (result i32)) (import "two" "" (result i32)) (func (result i32) (i32.const 3)) (func (result i32) (i32.const 4)) (func (result i32) BODY) (export "" 2))'; var imports = {one:()=>1, two:()=>2}; assertEq(wasmEvalText(code.replace('BODY', '(call_import 0)'), imports)(), 1); assertEq(wasmEvalText(code.replace('BODY', '(call_import 1)'), imports)(), 2); assertEq(wasmEvalText(code.replace('BODY', '(call 0)'), imports)(), 3); assertEq(wasmEvalText(code.replace('BODY', '(call 1)'), imports)(), 4); +assertEq(wasmEvalText(`(module (import "evalcx" "" (param i32) (result i32)) (func (result i32) (call_import 0 (i32.const 0))) (export "" 0))`, {evalcx})(), 0); + var {v2i, i2i, i2v} = wasmEvalText(`(module (type (func (result i32))) (type (func (param i32) (result i32))) (type (func (param i32))) (func (type 0) (i32.const 13)) (func (type 0) (i32.const 42)) (func (type 1) (i32.add (get_local 0) (i32.const 1))) (func (type 1) (i32.add (get_local 0) (i32.const 2)))
--- a/js/src/jit/CodeGenerator.cpp +++ b/js/src/jit/CodeGenerator.cpp @@ -8327,16 +8327,18 @@ CodeGenerator::generateAsmJS(wasm::FuncO // Note the end of the inline code and start of the OOL code. gen->perfSpewer().noteEndInlineCode(masm); #endif if (!generateOutOfLineCode()) return false; masm.flush(); + if (masm.oom()) + return false; offsets->end = masm.currentOffset(); MOZ_ASSERT(!masm.failureLabel()->used()); MOZ_ASSERT(snapshots_.listSize() == 0); MOZ_ASSERT(snapshots_.RVATableSize() == 0); MOZ_ASSERT(recovers_.size() == 0); MOZ_ASSERT(bailouts_.empty());
--- a/js/src/jit/Ion.cpp +++ b/js/src/jit/Ion.cpp @@ -49,16 +49,17 @@ #include "jscompartmentinlines.h" #include "jsobjinlines.h" #include "jsscriptinlines.h" #include "jit/JitFrames-inl.h" #include "jit/shared/Lowering-shared-inl.h" #include "vm/Debugger-inl.h" #include "vm/ScopeObject-inl.h" +#include "vm/Stack-inl.h" using namespace js; using namespace js::jit; // Assert that JitCode is gc::Cell aligned. JS_STATIC_ASSERT(sizeof(JitCode) % gc::CellSize == 0); static MOZ_THREAD_LOCAL(JitContext*) TlsJitContext; @@ -432,80 +433,16 @@ JitCompartment::ensureIonStubsExist(JSCo stringConcatStub_ = generateStringConcatStub(cx); if (!stringConcatStub_) return false; } return true; } -struct OnIonCompilationInfo { - size_t numBlocks; - size_t scriptIndex; - LifoAlloc alloc; - LSprinter graph; - - OnIonCompilationInfo() - : numBlocks(0), - scriptIndex(0), - alloc(4096), - graph(&alloc) - { } - - bool filled() const { - return numBlocks != 0; - } -}; - -typedef Vector<OnIonCompilationInfo> OnIonCompilationVector; - -// This function initializes the values which are given to the Debugger -// onIonCompilation hook, if the compilation was successful, and if Ion -// compilations of this compartment are watched by any debugger. -// -// This function must be called in the same AutoEnterAnalysis section as the -// CodeGenerator::link. Failing to do so might leave room to interleave other -// allocations which can invalidate any JSObject / JSFunction referenced by the -// MIRGraph. -// -// This function ignores any allocation failure and returns whether the -// Debugger::onIonCompilation should be called. -static inline void -PrepareForDebuggerOnIonCompilationHook(JSContext* cx, jit::MIRGraph& graph, - MutableHandle<ScriptVector> scripts, - OnIonCompilationInfo* info) -{ - info->numBlocks = 0; - if (!Debugger::observesIonCompilation(cx)) - return; - - // fireOnIonCompilation failures are ignored, do the same here. - info->scriptIndex = scripts.length(); - if (!scripts.reserve(graph.numBlocks() + scripts.length())) { - cx->clearPendingException(); - return; - } - - // Collect the list of scripts which are inlined in the MIRGraph. - info->numBlocks = graph.numBlocks(); - for (jit::MBasicBlockIterator block(graph.begin()); block != graph.end(); block++) - scripts.infallibleAppend(block->info().script()); - - // Spew the JSON graph made for the Debugger at the end of the LifoAlloc - // used by the compiler. This would not prevent unexpected GC from the - // compartment of the Debuggee, but do them as part of the compartment of - // the Debugger when the content is copied over to a JSString. - jit::JSONSpewer spewer(info->graph); - spewer.spewDebuggerGraph(&graph); - if (info->graph.hadOutOfMemory()) { - scripts.resize(info->scriptIndex); - info->numBlocks = 0; - } -} - void jit::FinishOffThreadBuilder(JSContext* cx, IonBuilder* builder) { MOZ_ASSERT(HelperThreadState().isLocked()); // Clean the references to the pending IonBuilder, if we just finished it. if (builder->script()->baselineScript()->hasPendingIonBuilder() && builder->script()->baselineScript()->pendingIonBuilder() == builder) @@ -548,48 +485,45 @@ FinishAllOffThreadCompilations(JSCompart if (builder->compartment == CompileCompartment::get(comp)) { FinishOffThreadBuilder(nullptr, builder); HelperThreadState().remove(finished, &i); } } } static bool -LinkCodeGen(JSContext* cx, IonBuilder* builder, CodeGenerator *codegen, - MutableHandle<ScriptVector> scripts, OnIonCompilationInfo* info) +LinkCodeGen(JSContext* cx, IonBuilder* builder, CodeGenerator *codegen) { RootedScript script(cx, builder->script()); TraceLoggerThread* logger = TraceLoggerForMainThread(cx->runtime()); TraceLoggerEvent event(logger, TraceLogger_AnnotateScripts, script); AutoTraceLog logScript(logger, event); AutoTraceLog logLink(logger, TraceLogger_IonLinking); if (!codegen->link(cx, builder->constraints())) return false; - PrepareForDebuggerOnIonCompilationHook(cx, builder->graph(), scripts, info); return true; } static bool -LinkBackgroundCodeGen(JSContext* cx, IonBuilder* builder, - MutableHandle<ScriptVector> scripts, OnIonCompilationInfo* info) +LinkBackgroundCodeGen(JSContext* cx, IonBuilder* builder) { CodeGenerator* codegen = builder->backgroundCodegen(); if (!codegen) return false; JitContext jctx(cx, &builder->alloc()); // Root the assembler until the builder is finished below. As it was // constructed off thread, the assembler has not been rooted previously, // though any GC activity would discard the builder. MacroAssembler::AutoRooter masm(cx, &codegen->masm); - return LinkCodeGen(cx, builder, codegen, scripts, info); + return LinkCodeGen(cx, builder, codegen); } void jit::LazyLink(JSContext* cx, HandleScript calleeScript) { IonBuilder* builder; { @@ -599,40 +533,33 @@ jit::LazyLink(JSContext* cx, HandleScrip MOZ_ASSERT(calleeScript->hasBaselineScript()); builder = calleeScript->baselineScript()->pendingIonBuilder(); calleeScript->baselineScript()->removePendingIonBuilder(calleeScript); // Remove from pending. builder->removeFrom(HelperThreadState().ionLazyLinkList()); } - // See PrepareForDebuggerOnIonCompilationHook - Rooted<ScriptVector> debugScripts(cx, ScriptVector(cx)); - OnIonCompilationInfo info; - { AutoEnterAnalysis enterTypes(cx); - if (!LinkBackgroundCodeGen(cx, builder, &debugScripts, &info)) { + if (!LinkBackgroundCodeGen(cx, builder)) { // Silently ignore OOM during code generation. The assembly code // doesn't has code to handle it after linking happened. So it's // not OK to throw a catchable exception from there. cx->clearPendingException(); // Reset the TypeZone's compiler output for this script, if any. InvalidateCompilerOutputsForScript(cx, calleeScript); } } { AutoLockHelperThreadState lock; FinishOffThreadBuilder(cx, builder); } - - if (info.filled()) - Debugger::onIonCompilation(cx, debugScripts, info.graph); } uint8_t* jit::LazyLinkTopActivation(JSContext* cx) { // First frame should be an exit frame. JitFrameIterator it(cx); LazyLinkExitFrameLayout* ll = it.exitFrame()->as<LazyLinkExitFrameLayout>(); @@ -2248,37 +2175,30 @@ IonCompile(JSContext* cx, JSScript* scri // The allocator and associated data will be destroyed after being // processed in the finishedOffThreadCompilations list. autoDelete.forget(); return AbortReason_NoAbort; } - // See PrepareForDebuggerOnIonCompilationHook - Rooted<ScriptVector> debugScripts(cx, ScriptVector(cx)); - OnIonCompilationInfo debugInfo; - { ScopedJSDeletePtr<CodeGenerator> codegen; AutoEnterAnalysis enter(cx); codegen = CompileBackEnd(builder); if (!codegen) { JitSpew(JitSpew_IonAbort, "Failed during back-end compilation."); if (cx->isExceptionPending()) return AbortReason_Error; return AbortReason_Disable; } - succeeded = LinkCodeGen(cx, builder, codegen, &debugScripts, &debugInfo); + succeeded = LinkCodeGen(cx, builder, codegen); } - if (debugInfo.filled()) - Debugger::onIonCompilation(cx, debugScripts, debugInfo.graph); - if (succeeded) return AbortReason_NoAbort; if (cx->isExceptionPending()) return AbortReason_Error; return AbortReason_Disable; } static bool
--- a/js/src/jit/IonAnalysis.cpp +++ b/js/src/jit/IonAnalysis.cpp @@ -1900,17 +1900,18 @@ jit::RenumberBlocks(MIRGraph& graph) block->setId(id++); return true; } // A utility for code which deletes blocks. Renumber the remaining blocks, // recompute dominators, and optionally recompute AliasAnalysis dependencies. bool -jit::AccountForCFGChanges(MIRGenerator* mir, MIRGraph& graph, bool updateAliasAnalysis) +jit::AccountForCFGChanges(MIRGenerator* mir, MIRGraph& graph, bool updateAliasAnalysis, + bool underValueNumberer) { // Renumber the blocks and clear out the old dominator info. size_t id = 0; for (ReversePostorderIterator i(graph.rpoBegin()), e(graph.rpoEnd()); i != e; ++i) { i->clearDominatorInfo(); i->setId(id++); } @@ -1919,17 +1920,17 @@ jit::AccountForCFGChanges(MIRGenerator* return false; // If needed, update alias analysis dependencies. if (updateAliasAnalysis) { if (!AliasAnalysis(mir, graph).analyze()) return false; } - AssertExtendedGraphCoherency(graph); + AssertExtendedGraphCoherency(graph, underValueNumberer); return true; } // Remove all blocks not marked with isMarked(). Unmark all remaining blocks. // Alias analysis dependencies may be invalid after calling this function. bool jit::RemoveUnmarkedBlocks(MIRGenerator* mir, MIRGraph& graph, uint32_t numMarkedBlocks) { @@ -2545,17 +2546,17 @@ AssertResumePointDominatedByOperands(MRe continue; MOZ_ASSERT(op->block()->dominates(resume->block()), "Resume point is not dominated by its operands"); } } #endif // DEBUG void -jit::AssertExtendedGraphCoherency(MIRGraph& graph) +jit::AssertExtendedGraphCoherency(MIRGraph& graph, bool underValueNumberer) { // Checks the basic GraphCoherency but also other conditions that // do not hold immediately (such as the fact that critical edges // are split) #ifdef DEBUG if (!JitOptions.checkGraphConsistency) return; @@ -2569,18 +2570,25 @@ jit::AssertExtendedGraphCoherency(MIRGra MOZ_ASSERT(block->id() == idx++); // No critical edges: if (block->numSuccessors() > 1) for (size_t i = 0; i < block->numSuccessors(); i++) MOZ_ASSERT(block->getSuccessor(i)->numPredecessors() == 1); if (block->isLoopHeader()) { - MOZ_ASSERT(block->numPredecessors() == 2); - MBasicBlock* backedge = block->getPredecessor(1); + if (underValueNumberer && block->numPredecessors() == 3) { + // Fixup block. + MOZ_ASSERT(block->getPredecessor(1)->numPredecessors() == 0); + MOZ_ASSERT(graph.osrBlock(), + "Fixup blocks should only exists if we have an osr block."); + } else { + MOZ_ASSERT(block->numPredecessors() == 2); + } + MBasicBlock* backedge = block->backedge(); MOZ_ASSERT(backedge->id() >= block->id()); MOZ_ASSERT(backedge->numSuccessors() == 1); MOZ_ASSERT(backedge->getSuccessor(0) == *block); } if (!block->phisEmpty()) { for (size_t i = 0; i < block->numPredecessors(); i++) { MBasicBlock* pred = block->getPredecessor(i);
--- a/js/src/jit/IonAnalysis.h +++ b/js/src/jit/IonAnalysis.h @@ -55,17 +55,18 @@ ApplyTypeInformation(MIRGenerator* mir, bool MakeMRegExpHoistable(MIRGraph& graph); bool RenumberBlocks(MIRGraph& graph); bool -AccountForCFGChanges(MIRGenerator* mir, MIRGraph& graph, bool updateAliasAnalysis); +AccountForCFGChanges(MIRGenerator* mir, MIRGraph& graph, bool updateAliasAnalysis, + bool underValueNumberer = false); bool RemoveUnmarkedBlocks(MIRGenerator* mir, MIRGraph& graph, uint32_t numMarkedBlocks); void ClearDominatorTree(MIRGraph& graph); bool @@ -76,17 +77,17 @@ BuildPhiReverseMapping(MIRGraph& graph); void AssertBasicGraphCoherency(MIRGraph& graph); void AssertGraphCoherency(MIRGraph& graph); void -AssertExtendedGraphCoherency(MIRGraph& graph); +AssertExtendedGraphCoherency(MIRGraph& graph, bool underValueNumberer = false); bool EliminateRedundantChecks(MIRGraph& graph); bool AddKeepAliveInstructions(MIRGraph& graph); class MDefinition;
--- a/js/src/jit/JSONSpewer.cpp +++ b/js/src/jit/JSONSpewer.cpp @@ -1,14 +1,16 @@ /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- * vim: set ts=8 sts=4 et sw=4 tw=99: * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ +#ifdef JS_JITSPEW + #include "jit/JSONSpewer.h" #include <stdarg.h> #include "jit/BacktrackingAllocator.h" #include "jit/LIR.h" #include "jit/MIR.h" #include "jit/MIRGraph.h" @@ -398,16 +400,9 @@ JSONSpewer::endPass() void JSONSpewer::endFunction() { endList(); endObject(); } -void -JSONSpewer::spewDebuggerGraph(MIRGraph* graph) -{ - beginObject(); - spewMIR(graph); - spewLIR(graph); - endObject(); -} +#endif /* JS_JITSPEW */
--- a/js/src/jit/JSONSpewer.h +++ b/js/src/jit/JSONSpewer.h @@ -2,16 +2,18 @@ * vim: set ts=8 sts=4 et sw=4 tw=99: * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef jit_JSONSpewer_h #define jit_JSONSpewer_h +#ifdef JS_JITSPEW + #include <stdio.h> #include "js/TypeDecls.h" #include "vm/Printer.h" namespace js { namespace jit { @@ -55,16 +57,16 @@ class JSONSpewer void spewMDef(MDefinition* def); void spewMResumePoint(MResumePoint* rp); void spewMIR(MIRGraph* mir); void spewLIns(LNode* ins); void spewLIR(MIRGraph* mir); void spewRanges(BacktrackingAllocator* regalloc); void endPass(); void endFunction(); - - void spewDebuggerGraph(MIRGraph* mir); }; } // namespace jit } // namespace js +#endif /* JS_JITSPEW */ + #endif /* jit_JSONSpewer_h */
--- a/js/src/jit/JitSpewer.cpp +++ b/js/src/jit/JitSpewer.cpp @@ -17,16 +17,19 @@ #endif #include "jsprf.h" #include "jit/Ion.h" #include "jit/MIR.h" #include "jit/MIRGenerator.h" +#include "threading/LockGuard.h" +#include "threading/Mutex.h" + #include "vm/HelperThreads.h" #ifndef JIT_SPEW_DIR # if defined(_WIN32) # define JIT_SPEW_DIR "" # elif defined(__ANDROID__) # define JIT_SPEW_DIR "/data/local/tmp/" # else @@ -35,17 +38,17 @@ #endif using namespace js; using namespace js::jit; class IonSpewer { private: - PRLock* outputLock_; + Mutex outputLock_; Fprinter c1Output_; Fprinter jsonOutput_; bool firstFunction_; bool asyncLogging_; bool inited_; void release(); @@ -68,33 +71,16 @@ class IonSpewer } bool getAsyncLogging() { return asyncLogging_; } void beginFunction(); void spewPass(GraphSpewer* gs); void endFunction(GraphSpewer* gs); - - // Lock used to sequentialized asynchronous compilation output. - void lockOutput() { - PR_Lock(outputLock_); - } - void unlockOutput() { - PR_Unlock(outputLock_); - } -}; - -class MOZ_RAII AutoLockIonSpewerOutput -{ - private: - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER - public: - explicit AutoLockIonSpewerOutput(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM); - ~AutoLockIonSpewerOutput(); }; // IonSpewer singleton. static IonSpewer ionspewer; static bool LoggingChecked = false; static_assert(JitSpew_Terminator <= 64, "Increase the size of the LoggingBits global."); static uint64_t LoggingBits = 0; @@ -163,19 +149,16 @@ jit::EnableIonDebugAsyncLogging() void IonSpewer::release() { if (c1Output_.isInitialized()) c1Output_.finish(); if (jsonOutput_.isInitialized()) jsonOutput_.finish(); - if (outputLock_) - PR_DestroyLock(outputLock_); - outputLock_ = nullptr; inited_ = false; } bool IonSpewer::init() { if (inited_) return true; @@ -205,68 +188,55 @@ IonSpewer::init() len = JS_snprintf(c1Buffer, bufferLength, JIT_SPEW_DIR "/ion%" PRIuSIZE ".cfg", pid); if (bufferLength <= len) { fprintf(stderr, "Warning: IonSpewer::init: Cannot serialize file name."); return false; } c1Filename = c1Buffer; } - outputLock_ = PR_NewLock(); - if (!outputLock_ || - !c1Output_.init(c1Filename) || + if (!c1Output_.init(c1Filename) || !jsonOutput_.init(jsonFilename)) { release(); return false; } jsonOutput_.printf("{\n \"functions\": [\n"); firstFunction_ = true; inited_ = true; return true; } -AutoLockIonSpewerOutput::AutoLockIonSpewerOutput(MOZ_GUARD_OBJECT_NOTIFIER_ONLY_PARAM_IN_IMPL) -{ - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - ionspewer.lockOutput(); -} - -AutoLockIonSpewerOutput::~AutoLockIonSpewerOutput() -{ - ionspewer.unlockOutput(); -} - void IonSpewer::beginFunction() { // If we are doing a synchronous logging then we spew everything as we go, // as this is useful in case of failure during the compilation. On the other // hand, it is recommended to disabled off main thread compilation. if (!getAsyncLogging() && !firstFunction_) { - AutoLockIonSpewerOutput outputLock; + LockGuard<Mutex> guard(outputLock_); jsonOutput_.put(","); // separate functions } } void IonSpewer::spewPass(GraphSpewer* gs) { if (!getAsyncLogging()) { - AutoLockIonSpewerOutput outputLock; + LockGuard<Mutex> guard(outputLock_); gs->dump(c1Output_, jsonOutput_); } } void IonSpewer::endFunction(GraphSpewer* gs) { - AutoLockIonSpewerOutput outputLock; + LockGuard<Mutex> guard(outputLock_); if (getAsyncLogging() && !firstFunction_) jsonOutput_.put(","); // separate functions gs->dump(c1Output_, jsonOutput_); firstFunction_ = false; } IonSpewer::~IonSpewer()
--- a/js/src/jit/JitSpewer.h +++ b/js/src/jit/JitSpewer.h @@ -9,18 +9,21 @@ #include "mozilla/DebugOnly.h" #include "mozilla/IntegerPrintfMacros.h" #include <stdarg.h> #include "jit/C1Spewer.h" #include "jit/JSONSpewer.h" + #include "js/RootingAPI.h" +#include "vm/Printer.h" + namespace js { namespace jit { // New channels may be added below. #define JITSPEW_CHANNEL_LIST(_) \ /* Information during sinking */ \ _(Prune) \ /* Information during escape analysis */\ @@ -96,17 +99,20 @@ namespace jit { enum JitSpewChannel { #define JITSPEW_CHANNEL(name) JitSpew_##name, JITSPEW_CHANNEL_LIST(JITSPEW_CHANNEL) #undef JITSPEW_CHANNEL JitSpew_Terminator }; +class BacktrackingAllocator; +class MDefinition; class MIRGenerator; +class MIRGraph; class TempAllocator; // The JitSpewer is only available on debug builds. // None of the global functions have effect on non-debug builds. static const int NULL_ID = -1; #ifdef JS_JITSPEW
--- a/js/src/jit/MIRGraph.h +++ b/js/src/jit/MIRGraph.h @@ -424,17 +424,21 @@ class MBasicBlock : public TempObject, p return instructions_.rend(); } bool isLoopHeader() const { return kind_ == LOOP_HEADER; } bool hasUniqueBackedge() const { MOZ_ASSERT(isLoopHeader()); MOZ_ASSERT(numPredecessors() >= 2); - return numPredecessors() == 2; + if (numPredecessors() == 2) + return true; + if (numPredecessors() == 3) // fixup block added by ValueNumbering phase. + return getPredecessor(1)->numPredecessors() == 0; + return false; } MBasicBlock* backedge() const { MOZ_ASSERT(hasUniqueBackedge()); return getPredecessor(numPredecessors() - 1); } MBasicBlock* loopHeaderOfBackedge() const { MOZ_ASSERT(isLoopBackedge()); return getSuccessor(numSuccessors() - 1); @@ -471,16 +475,19 @@ class MBasicBlock : public TempObject, p MOZ_ASSERT(!mark_, "Marking already-marked block"); markUnchecked(); } void markUnchecked() { mark_ = true; } void unmark() { MOZ_ASSERT(mark_, "Unarking unmarked block"); + unmarkUnchecked(); + } + void unmarkUnchecked() { mark_ = false; } MBasicBlock* immediateDominator() const { return immediateDominator_; } void setImmediateDominator(MBasicBlock* dom) {
--- a/js/src/jit/ValueNumbering.cpp +++ b/js/src/jit/ValueNumbering.cpp @@ -515,24 +515,22 @@ ValueNumberer::removePredecessorAndClean // We'll be removing a predecessor, so anything we know about phis in this // block will be wrong. for (MPhiIterator iter(block->phisBegin()), end(block->phisEnd()); iter != end; ++iter) values_.forget(*iter); // If this is a loop header, test whether it will become an unreachable // loop, or whether it needs special OSR-related fixups. bool isUnreachableLoop = false; - MBasicBlock* origBackedgeForOSRFixup = nullptr; if (block->isLoopHeader()) { if (block->loopPredecessor() == pred) { if (MOZ_UNLIKELY(hasNonDominatingPredecessor(block, pred))) { JitSpew(JitSpew_GVN, " " "Loop with header block%u is now only reachable through an " "OSR entry into the middle of the loop!!", block->id()); - origBackedgeForOSRFixup = block->backedge(); } else { // Deleting the entry into the loop makes the loop unreachable. isUnreachableLoop = true; JitSpew(JitSpew_GVN, " " "Loop with header block%u is no longer reachable", block->id()); } #ifdef JS_JITSPEW @@ -601,21 +599,16 @@ ValueNumberer::removePredecessorAndClean "Instruction with resume point in block without entry resume point"); } #endif } // Use the mark to note that we've already removed all its predecessors, // and we know it's unreachable. block->mark(); - } else if (MOZ_UNLIKELY(origBackedgeForOSRFixup != nullptr)) { - // The loop is no only reachable through OSR into the middle. Fix it - // up so that the CFG can remain valid. - if (!fixupOSROnlyLoop(block, origBackedgeForOSRFixup)) - return false; } return true; } // Return a simplified form of |def|, if we can. MDefinition* ValueNumberer::simplified(MDefinition* def) const @@ -1074,16 +1067,40 @@ ValueNumberer::visitGraph() // This block a dominator tree root. Proceed to the next one. ++iter; } } totalNumVisited_ = 0; return true; } +bool +ValueNumberer::insertOSRFixups() +{ + ReversePostorderIterator end(graph_.end()); + for (ReversePostorderIterator iter(graph_.begin()); iter != end; ) { + MBasicBlock* block = *iter++; + + // Only add fixup block above for loops which can be reached from OSR. + if (!block->isLoopHeader()) + continue; + + // If the loop header is not self-dominated, then this loop does not + // have to deal with a second entry point, so there is no need to add a + // second entry point with a fixup block. + if (block->immediateDominator() != block) + continue; + + if (!fixupOSROnlyLoop(block, block->backedge())) + return false; + } + + return true; +} + // OSR fixups serve the purpose of representing the non-OSR entry into a loop // when the only real entry is an OSR entry into the middle. However, if the // entry into the middle is subsequently folded away, the loop may actually // have become unreachable. Mark-and-sweep all blocks to remove all such code. bool ValueNumberer::cleanupOSRFixups() { // Mark. Vector<MBasicBlock*, 0, JitAllocPolicy> worklist(graph_.alloc()); @@ -1096,32 +1113,54 @@ bool ValueNumberer::cleanupOSRFixups() MBasicBlock* block = worklist.popCopy(); for (size_t i = 0, e = block->numSuccessors(); i != e; ++i) { MBasicBlock* succ = block->getSuccessor(i); if (!succ->isMarked()) { ++numMarked; succ->mark(); if (!worklist.append(succ)) return false; + } else if (succ->isLoopHeader() && + succ->loopPredecessor() == block && + succ->numPredecessors() == 3) + { + // Unmark fixup blocks if the loop predecessor is marked after + // the loop header. + succ->getPredecessor(1)->unmarkUnchecked(); } } - // The one special thing we do during this mark pass is to mark - // loop predecessors of reachable blocks as reachable. These blocks are - // the OSR fixups blocks which need to remain if the loop remains, - // though they can be removed if the loop is removed. + + // OSR fixup blocks are needed if and only if the loop header is + // reachable from its backedge (via the OSR block) and not from its + // original loop predecessor. + // + // Thus OSR fixup blocks are removed if the loop header is not + // reachable, or if the loop header is reachable from both its backedge + // and its original loop predecessor. if (block->isLoopHeader()) { - MBasicBlock* pred = block->loopPredecessor(); - if (!pred->isMarked() && pred->numPredecessors() == 0) { - MOZ_ASSERT(pred->numSuccessors() == 1, + MBasicBlock* maybeFixupBlock = nullptr; + if (block->numPredecessors() == 2) { + maybeFixupBlock = block->getPredecessor(0); + } else { + MOZ_ASSERT(block->numPredecessors() == 3); + if (!block->loopPredecessor()->isMarked()) + maybeFixupBlock = block->getPredecessor(1); + } + + if (maybeFixupBlock && + !maybeFixupBlock->isMarked() && + maybeFixupBlock->numPredecessors() == 0) + { + MOZ_ASSERT(maybeFixupBlock->numSuccessors() == 1, "OSR fixup block should have exactly one successor"); - MOZ_ASSERT(pred != graph_.entryBlock(), + MOZ_ASSERT(maybeFixupBlock != graph_.entryBlock(), "OSR fixup block shouldn't be the entry block"); - MOZ_ASSERT(pred != graph_.osrBlock(), + MOZ_ASSERT(maybeFixupBlock != graph_.osrBlock(), "OSR fixup block shouldn't be the OSR entry block"); - pred->mark(); + maybeFixupBlock->mark(); } } } // A