From 0b2e75f4beb198ed740c5fe0697f0d1609662024 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 28 Nov 2014 11:34:06 +1300 Subject: [PATCH 01/58] Bug 734229 - Partially address by refusing to re-negotiate on NTLM. r=mayhemer, r=keeler Now only one NTLM Negotiate packet will be sent per connection, rather than again after a failed authentication. The problem situation is triggered due to failed Negotiate authentication, and is probably more complex. Pair-programmed-with: Garming Sam --- security/manager/ssl/src/nsNTLMAuthModule.cpp | 34 +++++++++++++------ security/manager/ssl/src/nsNTLMAuthModule.h | 1 + 2 files changed, 25 insertions(+), 10 deletions(-) diff --git a/security/manager/ssl/src/nsNTLMAuthModule.cpp b/security/manager/ssl/src/nsNTLMAuthModule.cpp index 80bc6bfff48..fe2fad35997 100644 --- a/security/manager/ssl/src/nsNTLMAuthModule.cpp +++ b/security/manager/ssl/src/nsNTLMAuthModule.cpp @@ -1002,6 +1002,7 @@ nsNTLMAuthModule::Init(const char *serviceName, mDomain = domain; mUsername = username; mPassword = password; + mNTLMNegotiateSent = false; static bool sTelemetrySent = false; if (!sTelemetrySent) { @@ -1030,16 +1031,29 @@ nsNTLMAuthModule::GetNextToken(const void *inToken, if (PK11_IsFIPS()) return NS_ERROR_NOT_AVAILABLE; - // if inToken is non-null, then assume it contains a type 2 message... - if (inToken) - { - LogToken("in-token", inToken, inTokenLen); - rv = GenerateType3Msg(mDomain, mUsername, mPassword, inToken, - inTokenLen, outToken, outTokenLen); - } - else - { - rv = GenerateType1Msg(outToken, outTokenLen); + if (mNTLMNegotiateSent) { + // if inToken is non-null, and we have sent the NTLMSSP_NEGOTIATE (type 1), + // then the NTLMSSP_CHALLENGE (type 2) is expected + if (inToken) { + LogToken("in-token", inToken, inTokenLen); + // Now generate the NTLMSSP_AUTH (type 3) + rv = GenerateType3Msg(mDomain, mUsername, mPassword, inToken, + inTokenLen, outToken, outTokenLen); + } else { + LOG(("NTLMSSP_NEGOTIATE already sent and presumably " + "rejected by the server, refusing to send another")); + rv = NS_ERROR_UNEXPECTED; + } + } else { + if (inToken) { + LOG(("NTLMSSP_NEGOTIATE not sent but NTLM reply already received?!?")); + rv = NS_ERROR_UNEXPECTED; + } else { + rv = GenerateType1Msg(outToken, outTokenLen); + if (NS_SUCCEEDED(rv)) { + mNTLMNegotiateSent = true; + } + } } #ifdef PR_LOGGING diff --git a/security/manager/ssl/src/nsNTLMAuthModule.h b/security/manager/ssl/src/nsNTLMAuthModule.h index 6e14c6d4f15..27bf2999f01 100644 --- a/security/manager/ssl/src/nsNTLMAuthModule.h +++ b/security/manager/ssl/src/nsNTLMAuthModule.h @@ -28,6 +28,7 @@ private: nsString mDomain; nsString mUsername; nsString mPassword; + bool mNTLMNegotiateSent; }; #define NS_NTLMAUTHMODULE_CONTRACTID \ From 5c47478200a796ac697f90c338f2b4e568cf941b Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Wed, 29 Apr 2015 10:50:00 -0400 Subject: [PATCH 02/58] Bug 856404 - Don't default HOST_* variables to target ones when cross compiling. r=ted --- nsprpub/configure | 32 -------------------------------- nsprpub/configure.in | 34 ---------------------------------- 2 files changed, 66 deletions(-) diff --git a/nsprpub/configure b/nsprpub/configure index 5ccdf23209c..d07ce137b28 100755 --- a/nsprpub/configure +++ b/nsprpub/configure @@ -2666,19 +2666,6 @@ fi if test -n "$gonkdir" ; then - if test -z "$HOST_CPPFLAGS" ; then - HOST_CPPFLAGS=" " - fi - if test -z "$HOST_CFLAGS" ; then - HOST_CFLAGS=" " - fi - if test -z "$HOST_CXXFLAGS" ; then - HOST_CXXFLAGS=" " - fi - if test -z "$HOST_LDFLAGS" ; then - HOST_LDFLAGS=" " - fi - $as_echo "#define ANDROID 1" >>confdefs.h else @@ -2763,19 +2750,6 @@ $as_echo "$android_platform" >&6; } CXXFLAGS="-mandroid -I$android_platform/usr/include -fpic -fno-short-enums -fno-exceptions $CXXFLAGS" LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS" - if test -z "$HOST_CPPFLAGS" ; then - HOST_CPPFLAGS=" " - fi - if test -z "$HOST_CFLAGS" ; then - HOST_CFLAGS=" " - fi - if test -z "$HOST_CXXFLAGS" ; then - HOST_CXXFLAGS=" " - fi - if test -z "$HOST_LDFLAGS" ; then - HOST_LDFLAGS=" " - fi - $as_echo "#define ANDROID 1" >>confdefs.h ;; @@ -4621,12 +4595,6 @@ test -n "$HOST_CC" || HOST_CC="""" fi { $as_echo "$as_me:${as_lineno-$LINENO}: result: $HOST_CC" >&5 $as_echo "$HOST_CC" >&6; } - if test -z "$HOST_CFLAGS"; then - HOST_CFLAGS="$CFLAGS" - fi - if test -z "$HOST_LDFLAGS"; then - HOST_LDFLAGS="$LDFLAGS" - fi CC="$HOST_CC" CFLAGS="$HOST_CFLAGS" diff --git a/nsprpub/configure.in b/nsprpub/configure.in index dac9b31cc5d..f236f7a8374 100644 --- a/nsprpub/configure.in +++ b/nsprpub/configure.in @@ -160,20 +160,6 @@ AC_ARG_WITH(gonk, if test -n "$gonkdir" ; then dnl Most things are directly configured by env vars when building for gonk - dnl prevent cross compile section from using these flags as host flags - if test -z "$HOST_CPPFLAGS" ; then - HOST_CPPFLAGS=" " - fi - if test -z "$HOST_CFLAGS" ; then - HOST_CFLAGS=" " - fi - if test -z "$HOST_CXXFLAGS" ; then - HOST_CXXFLAGS=" " - fi - if test -z "$HOST_LDFLAGS" ; then - HOST_LDFLAGS=" " - fi - AC_DEFINE(ANDROID) else case "$target" in @@ -257,20 +243,6 @@ case "$target" in CXXFLAGS="-mandroid -I$android_platform/usr/include -fpic -fno-short-enums -fno-exceptions $CXXFLAGS" LDFLAGS="-mandroid -L$android_platform/usr/lib -Wl,-rpath-link=$android_platform/usr/lib --sysroot=$android_platform $LDFLAGS" - dnl prevent cross compile section from using these flags as host flags - if test -z "$HOST_CPPFLAGS" ; then - HOST_CPPFLAGS=" " - fi - if test -z "$HOST_CFLAGS" ; then - HOST_CFLAGS=" " - fi - if test -z "$HOST_CXXFLAGS" ; then - HOST_CXXFLAGS=" " - fi - if test -z "$HOST_LDFLAGS" ; then - HOST_LDFLAGS=" " - fi - AC_DEFINE(ANDROID) ;; esac @@ -653,12 +625,6 @@ if test "$target" != "$host"; then AC_MSG_ERROR([no acceptable cc found in \$PATH]) fi AC_MSG_RESULT([$HOST_CC]) - if test -z "$HOST_CFLAGS"; then - HOST_CFLAGS="$CFLAGS" - fi - if test -z "$HOST_LDFLAGS"; then - HOST_LDFLAGS="$LDFLAGS" - fi CC="$HOST_CC" CFLAGS="$HOST_CFLAGS" From 0baecf0b746705909731f0c7817eb59316b1c4a4 Mon Sep 17 00:00:00 2001 From: Brian O'Keefe Date: Thu, 26 Feb 2015 16:53:31 -0500 Subject: [PATCH 03/58] Bug 786520 - Install things to $(DIST)/branding from moz.build instead of manual rules in Makefile.ins. r=mshal --- Makefile.in | 2 +- browser/branding/aurora/Makefile.in | 48 ------------------- browser/branding/aurora/moz.build | 5 +- browser/branding/branding-common.mozbuild | 43 +++++++++++++++++ browser/branding/nightly/Makefile.in | 48 ------------------- browser/branding/nightly/moz.build | 5 +- browser/branding/official/Makefile.in | 48 ------------------- browser/branding/official/moz.build | 5 +- browser/branding/unofficial/Makefile.in | 48 ------------------- browser/branding/unofficial/moz.build | 5 +- .../mozbuild/backend/recursivemake.py | 21 ++++++++ python/mozbuild/mozbuild/frontend/context.py | 21 ++++++++ python/mozbuild/mozbuild/frontend/data.py | 14 ++++++ python/mozbuild/mozbuild/frontend/emitter.py | 5 ++ .../test/backend/data/branding-files/bar.ico | 0 .../test/backend/data/branding-files/foo.ico | 0 .../backend/data/branding-files/moz.build | 14 ++++++ .../backend/data/branding-files/sub/quux.png | 0 .../test/backend/test_recursivemake.py | 13 +++++ .../frontend/data/branding-files/moz.build | 15 ++++++ .../mozbuild/test/frontend/test_emitter.py | 18 +++++++ xulrunner/app/Makefile.in | 13 ----- xulrunner/app/moz.build | 14 ++++++ 23 files changed, 183 insertions(+), 222 deletions(-) delete mode 100644 browser/branding/aurora/Makefile.in create mode 100644 browser/branding/branding-common.mozbuild delete mode 100644 browser/branding/nightly/Makefile.in delete mode 100644 browser/branding/official/Makefile.in delete mode 100644 browser/branding/unofficial/Makefile.in create mode 100644 python/mozbuild/mozbuild/test/backend/data/branding-files/bar.ico create mode 100644 python/mozbuild/mozbuild/test/backend/data/branding-files/foo.ico create mode 100644 python/mozbuild/mozbuild/test/backend/data/branding-files/moz.build create mode 100644 python/mozbuild/mozbuild/test/backend/data/branding-files/sub/quux.png create mode 100644 python/mozbuild/mozbuild/test/frontend/data/branding-files/moz.build diff --git a/Makefile.in b/Makefile.in index ee49503acc6..40da7d2a1c4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -95,7 +95,7 @@ include backend.RecursiveMakeBackend.pp default:: backend.RecursiveMakeBackend install_manifests := \ - $(addprefix dist/,bin idl include public private sdk xpi-stage) \ + $(addprefix dist/,bin branding idl include public private sdk xpi-stage) \ _tests \ $(NULL) install_manifest_depends = \ diff --git a/browser/branding/aurora/Makefile.in b/browser/branding/aurora/Makefile.in deleted file mode 100644 index 6fea2c9dc53..00000000000 --- a/browser/branding/aurora/Makefile.in +++ /dev/null @@ -1,48 +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/. - -include $(topsrcdir)/config/config.mk - -ifeq ($(MOZ_WIDGET_TOOLKIT),windows) -BRANDING_FILES := \ - firefox.ico \ - document.ico \ - branding.nsi \ - appname.bmp \ - bgintro.bmp \ - clock.bmp \ - particles.bmp \ - pencil.bmp \ - pencil-rtl.bmp \ - wizHeader.bmp \ - wizHeaderRTL.bmp \ - wizWatermark.bmp \ - newwindow.ico \ - newtab.ico \ - pbmode.ico \ - $(NULL) -endif - -ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) -BRANDING_FILES := \ - background.png \ - firefox.icns \ - disk.icns \ - document.icns \ - dsstore \ - $(NULL) -endif - -ifdef MOZ_WIDGET_GTK -BRANDING_FILES := \ - default16.png \ - default32.png \ - default48.png \ - mozicon128.png \ - $(NULL) -endif - -BRANDING_DEST := $(DIST)/branding -BRANDING_TARGET := export -INSTALL_TARGETS += BRANDING diff --git a/browser/branding/aurora/moz.build b/browser/branding/aurora/moz.build index ee56b1fecc1..3e58719c85a 100644 --- a/browser/branding/aurora/moz.build +++ b/browser/branding/aurora/moz.build @@ -9,7 +9,4 @@ DIRS += ['content', 'locales'] DIST_SUBDIR = 'browser' export('DIST_SUBDIR') -JS_PREFERENCE_FILES += [ - 'pref/firefox-branding.js', -] - +include('../branding-common.mozbuild') diff --git a/browser/branding/branding-common.mozbuild b/browser/branding/branding-common.mozbuild new file mode 100644 index 00000000000..524ff3046a8 --- /dev/null +++ b/browser/branding/branding-common.mozbuild @@ -0,0 +1,43 @@ +# -*- 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/. + +JS_PREFERENCE_FILES += [ + 'pref/firefox-branding.js', +] + +if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'windows': + BRANDING_FILES += [ + 'appname.bmp', + 'bgintro.bmp', + 'branding.nsi', + 'clock.bmp', + 'document.ico', + 'firefox.ico', + 'newtab.ico', + 'newwindow.ico', + 'particles.bmp', + 'pbmode.ico', + 'pencil-rtl.bmp', + 'pencil.bmp', + 'wizHeader.bmp', + 'wizHeaderRTL.bmp', + 'wizWatermark.bmp', + ] +elif CONFIG['MOZ_WIDGET_TOOLKIT'] == 'cocoa': + BRANDING_FILES += [ + 'background.png', + 'disk.icns', + 'document.icns', + 'dsstore', + 'firefox.icns', + ] +elif CONFIG['MOZ_WIDGET_GTK']: + BRANDING_FILES += [ + 'default16.png', + 'default32.png', + 'default48.png', + 'mozicon128.png', + ] diff --git a/browser/branding/nightly/Makefile.in b/browser/branding/nightly/Makefile.in deleted file mode 100644 index 6fea2c9dc53..00000000000 --- a/browser/branding/nightly/Makefile.in +++ /dev/null @@ -1,48 +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/. - -include $(topsrcdir)/config/config.mk - -ifeq ($(MOZ_WIDGET_TOOLKIT),windows) -BRANDING_FILES := \ - firefox.ico \ - document.ico \ - branding.nsi \ - appname.bmp \ - bgintro.bmp \ - clock.bmp \ - particles.bmp \ - pencil.bmp \ - pencil-rtl.bmp \ - wizHeader.bmp \ - wizHeaderRTL.bmp \ - wizWatermark.bmp \ - newwindow.ico \ - newtab.ico \ - pbmode.ico \ - $(NULL) -endif - -ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) -BRANDING_FILES := \ - background.png \ - firefox.icns \ - disk.icns \ - document.icns \ - dsstore \ - $(NULL) -endif - -ifdef MOZ_WIDGET_GTK -BRANDING_FILES := \ - default16.png \ - default32.png \ - default48.png \ - mozicon128.png \ - $(NULL) -endif - -BRANDING_DEST := $(DIST)/branding -BRANDING_TARGET := export -INSTALL_TARGETS += BRANDING diff --git a/browser/branding/nightly/moz.build b/browser/branding/nightly/moz.build index ee56b1fecc1..3e58719c85a 100644 --- a/browser/branding/nightly/moz.build +++ b/browser/branding/nightly/moz.build @@ -9,7 +9,4 @@ DIRS += ['content', 'locales'] DIST_SUBDIR = 'browser' export('DIST_SUBDIR') -JS_PREFERENCE_FILES += [ - 'pref/firefox-branding.js', -] - +include('../branding-common.mozbuild') diff --git a/browser/branding/official/Makefile.in b/browser/branding/official/Makefile.in deleted file mode 100644 index 6fea2c9dc53..00000000000 --- a/browser/branding/official/Makefile.in +++ /dev/null @@ -1,48 +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/. - -include $(topsrcdir)/config/config.mk - -ifeq ($(MOZ_WIDGET_TOOLKIT),windows) -BRANDING_FILES := \ - firefox.ico \ - document.ico \ - branding.nsi \ - appname.bmp \ - bgintro.bmp \ - clock.bmp \ - particles.bmp \ - pencil.bmp \ - pencil-rtl.bmp \ - wizHeader.bmp \ - wizHeaderRTL.bmp \ - wizWatermark.bmp \ - newwindow.ico \ - newtab.ico \ - pbmode.ico \ - $(NULL) -endif - -ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) -BRANDING_FILES := \ - background.png \ - firefox.icns \ - disk.icns \ - document.icns \ - dsstore \ - $(NULL) -endif - -ifdef MOZ_WIDGET_GTK -BRANDING_FILES := \ - default16.png \ - default32.png \ - default48.png \ - mozicon128.png \ - $(NULL) -endif - -BRANDING_DEST := $(DIST)/branding -BRANDING_TARGET := export -INSTALL_TARGETS += BRANDING diff --git a/browser/branding/official/moz.build b/browser/branding/official/moz.build index ee56b1fecc1..3e58719c85a 100644 --- a/browser/branding/official/moz.build +++ b/browser/branding/official/moz.build @@ -9,7 +9,4 @@ DIRS += ['content', 'locales'] DIST_SUBDIR = 'browser' export('DIST_SUBDIR') -JS_PREFERENCE_FILES += [ - 'pref/firefox-branding.js', -] - +include('../branding-common.mozbuild') diff --git a/browser/branding/unofficial/Makefile.in b/browser/branding/unofficial/Makefile.in deleted file mode 100644 index 6fea2c9dc53..00000000000 --- a/browser/branding/unofficial/Makefile.in +++ /dev/null @@ -1,48 +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/. - -include $(topsrcdir)/config/config.mk - -ifeq ($(MOZ_WIDGET_TOOLKIT),windows) -BRANDING_FILES := \ - firefox.ico \ - document.ico \ - branding.nsi \ - appname.bmp \ - bgintro.bmp \ - clock.bmp \ - particles.bmp \ - pencil.bmp \ - pencil-rtl.bmp \ - wizHeader.bmp \ - wizHeaderRTL.bmp \ - wizWatermark.bmp \ - newwindow.ico \ - newtab.ico \ - pbmode.ico \ - $(NULL) -endif - -ifeq ($(MOZ_WIDGET_TOOLKIT),cocoa) -BRANDING_FILES := \ - background.png \ - firefox.icns \ - disk.icns \ - document.icns \ - dsstore \ - $(NULL) -endif - -ifdef MOZ_WIDGET_GTK -BRANDING_FILES := \ - default16.png \ - default32.png \ - default48.png \ - mozicon128.png \ - $(NULL) -endif - -BRANDING_DEST := $(DIST)/branding -BRANDING_TARGET := export -INSTALL_TARGETS += BRANDING diff --git a/browser/branding/unofficial/moz.build b/browser/branding/unofficial/moz.build index ee56b1fecc1..3e58719c85a 100644 --- a/browser/branding/unofficial/moz.build +++ b/browser/branding/unofficial/moz.build @@ -9,7 +9,4 @@ DIRS += ['content', 'locales'] DIST_SUBDIR = 'browser' export('DIST_SUBDIR') -JS_PREFERENCE_FILES += [ - 'pref/firefox-branding.js', -] - +include('../branding-common.mozbuild') diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index 371c259a085..2138e593bad 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -28,6 +28,7 @@ import mozpack.path as mozpath from .common import CommonBackend from ..frontend.data import ( AndroidEclipseProjectData, + BrandingFiles, ConfigFileSubstitution, ContextDerived, ContextWrapped, @@ -377,6 +378,7 @@ class RecursiveMakeBackend(CommonBackend): self._install_manifests = { k: InstallManifest() for k in [ 'dist_bin', + 'dist_branding', 'dist_idl', 'dist_include', 'dist_public', @@ -493,6 +495,9 @@ class RecursiveMakeBackend(CommonBackend): elif isinstance(obj, Resources): self._process_resources(obj, obj.resources, backend_file) + elif isinstance(obj, BrandingFiles): + self._process_branding_files(obj, obj.files, backend_file) + elif isinstance(obj, JsPreferenceFile): if obj.path.startswith('/'): backend_file.write('PREF_JS_EXPORTS += $(topsrcdir)%s\n' % obj.path) @@ -940,6 +945,22 @@ INSTALL_TARGETS += %(prefix)s if not os.path.exists(source): raise Exception('File listed in RESOURCE_FILES does not exist: %s' % source) + def _process_branding_files(self, obj, files, backend_file): + for source, dest, flags in self._walk_hierarchy(obj, files): + if flags and flags.source: + source = mozpath.normpath(mozpath.join(obj.srcdir, flags.source)) + if not os.path.exists(source): + raise Exception('File listed in BRANDING_FILES does not exist: %s' % source) + + self._install_manifests['dist_branding'].add_symlink(source, dest) + + # Also emit the necessary rules to create $(DIST)/branding during partial + # tree builds. The locale makefiles rely on this working. + backend_file.write('NONRECURSIVE_TARGETS += export\n') + backend_file.write('NONRECURSIVE_TARGETS_export += branding\n') + backend_file.write('NONRECURSIVE_TARGETS_export_branding_DIRECTORY = $(DEPTH)\n') + backend_file.write('NONRECURSIVE_TARGETS_export_branding_TARGETS += install-dist/branding\n') + def _process_installation_target(self, obj, backend_file): # A few makefiles need to be able to override the following rules via # make XPI_NAME=blah commands, so we default to the lazy evaluation as diff --git a/python/mozbuild/mozbuild/frontend/context.py b/python/mozbuild/mozbuild/frontend/context.py index 5ab86e2618f..aa53ee1975a 100644 --- a/python/mozbuild/mozbuild/frontend/context.py +++ b/python/mozbuild/mozbuild/frontend/context.py @@ -953,6 +953,27 @@ VARIABLES = { This variable can only be used on Linux. """, None), + 'BRANDING_FILES': (HierarchicalStringListWithFlagsFactory({'source': unicode}), list, + """List of files to be installed into the branding directory. + + ``BRANDING_FILES`` will copy (or symlink, if the platform supports it) + the contents of its files to the ``dist/branding`` directory. Files that + are destined for a subdirectory can be specified by accessing a field. + For example, to export ``foo.png`` to the top-level directory and + ``bar.png`` to the directory ``images/subdir``, append to + ``BRANDING_FILES`` like so:: + + BRANDING_FILES += ['foo.png'] + BRANDING_FILES.images.subdir += ['bar.png'] + + If the source and destination have different file names, add the + destination name to the list and set the ``source`` property on the + entry, like so:: + + BRANDING_FILES.dir += ['baz.png'] + BRANDING_FILES.dir['baz.png'].source = 'quux.png' + """, None), + 'RESOURCE_FILES': (HierarchicalStringListWithFlagsFactory({'preprocess': bool}), list, """List of resources to be exported, and in which subdirectories. diff --git a/python/mozbuild/mozbuild/frontend/data.py b/python/mozbuild/mozbuild/frontend/data.py index f80a15d4ec9..c59fc6840dc 100644 --- a/python/mozbuild/mozbuild/frontend/data.py +++ b/python/mozbuild/mozbuild/frontend/data.py @@ -248,6 +248,20 @@ class Resources(ContextDerived): defs.update(defines) self.defines = defs +class BrandingFiles(ContextDerived): + """Sandbox container object for BRANDING_FILES, which is a + HierarchicalStringList. + + We need an object derived from ContextDerived for use in the backend, so + this object fills that role. It just has a reference to the underlying + HierarchicalStringList, which is created when parsing BRANDING_FILES. + """ + __slots__ = ('files') + + def __init__(self, sandbox, files): + ContextDerived.__init__(self, sandbox) + self.files = files + class JsPreferenceFile(ContextDerived): """Context derived container object for a Javascript preference file. diff --git a/python/mozbuild/mozbuild/frontend/emitter.py b/python/mozbuild/mozbuild/frontend/emitter.py index 66ceeec2f6e..cf4685dc055 100644 --- a/python/mozbuild/mozbuild/frontend/emitter.py +++ b/python/mozbuild/mozbuild/frontend/emitter.py @@ -25,6 +25,7 @@ import reftest import mozinfo from .data import ( + BrandingFiles, ConfigFileSubstitution, ContextWrapped, Defines, @@ -664,6 +665,10 @@ class TreeMetadataEmitter(LoggingMixin): yield DistFiles(context, dist_files, context['FINAL_TARGET']) + branding_files = context.get('BRANDING_FILES') + if branding_files: + yield BrandingFiles(context, branding_files) + self._handle_libraries(context) for obj in self._process_test_manifests(context): diff --git a/python/mozbuild/mozbuild/test/backend/data/branding-files/bar.ico b/python/mozbuild/mozbuild/test/backend/data/branding-files/bar.ico new file mode 100644 index 00000000000..e69de29bb2d diff --git a/python/mozbuild/mozbuild/test/backend/data/branding-files/foo.ico b/python/mozbuild/mozbuild/test/backend/data/branding-files/foo.ico new file mode 100644 index 00000000000..e69de29bb2d diff --git a/python/mozbuild/mozbuild/test/backend/data/branding-files/moz.build b/python/mozbuild/mozbuild/test/backend/data/branding-files/moz.build new file mode 100644 index 00000000000..c515db46d94 --- /dev/null +++ b/python/mozbuild/mozbuild/test/backend/data/branding-files/moz.build @@ -0,0 +1,14 @@ +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ + +BRANDING_FILES += [ + 'app.ico', + 'bar.ico', + 'sub/quux.png', +] +BRANDING_FILES['app.ico'].source = 'bar.ico' + +BRANDING_FILES.icons += [ + 'foo.ico', +] + diff --git a/python/mozbuild/mozbuild/test/backend/data/branding-files/sub/quux.png b/python/mozbuild/mozbuild/test/backend/data/branding-files/sub/quux.png new file mode 100644 index 00000000000..e69de29bb2d diff --git a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py index 10b2273d030..c28821f11e8 100644 --- a/python/mozbuild/mozbuild/test/backend/test_recursivemake.py +++ b/python/mozbuild/mozbuild/test/backend/test_recursivemake.py @@ -405,6 +405,19 @@ class TestRecursiveMakeBackend(BackendTester): self.assertIn('res/tests/test.manifest', m) self.assertIn('res/tests/extra.manifest', m) + def test_branding_files(self): + """Ensure BRANDING_FILES is handled properly.""" + env = self._consume('branding-files', RecursiveMakeBackend) + + #BRANDING_FILES should appear in the dist_branding install manifest. + m = InstallManifest(path=os.path.join(env.topobjdir, + '_build_manifests', 'install', 'dist_branding')) + self.assertEqual(len(m), 4) + self.assertIn('app.ico', m) + self.assertIn('bar.ico', m) + self.assertIn('quux.png', m) + self.assertIn('icons/foo.ico', m) + def test_js_preference_files(self): """Ensure PREF_JS_EXPORTS is written out correctly.""" env = self._consume('js_preference_files', RecursiveMakeBackend) diff --git a/python/mozbuild/mozbuild/test/frontend/data/branding-files/moz.build b/python/mozbuild/mozbuild/test/frontend/data/branding-files/moz.build new file mode 100644 index 00000000000..13354e272f5 --- /dev/null +++ b/python/mozbuild/mozbuild/test/frontend/data/branding-files/moz.build @@ -0,0 +1,15 @@ +# Any copyright is dedicated to the Public Domain. +# http://creativecommons.org/publicdomain/zero/1.0/ + +BRANDING_FILES += [ + 'app.ico', + 'bar.ico', + 'baz.png', + 'foo.xpm', +] +BRANDING_FILES['app.ico'].source = 'test/bar.ico' + +BRANDING_FILES.icons += [ + 'quux.icns', +] + diff --git a/python/mozbuild/mozbuild/test/frontend/test_emitter.py b/python/mozbuild/mozbuild/test/frontend/test_emitter.py index e0f4a8e3ec0..492b5299544 100644 --- a/python/mozbuild/mozbuild/test/frontend/test_emitter.py +++ b/python/mozbuild/mozbuild/test/frontend/test_emitter.py @@ -10,6 +10,7 @@ import unittest from mozunit import main from mozbuild.frontend.data import ( + BrandingFiles, ConfigFileSubstitution, Defines, DistFiles, @@ -345,6 +346,23 @@ class TestEmitterBasic(unittest.TestCase): overwrite = resources._children['overwrite'] self.assertEqual(overwrite._strings, ['new.res']) + def test_branding_files(self): + reader = self.reader('branding-files') + objs = self.read_topsrcdir(reader) + + self.assertEqual(len(objs), 1) + self.assertIsInstance(objs[0], BrandingFiles) + + files = objs[0].files + + self.assertEqual(files._strings, ['app.ico', 'bar.ico', 'baz.png', 'foo.xpm']) + self.assertEqual(files['app.ico'].source, 'test/bar.ico') + + self.assertIn('icons', files._children) + icons = files._children['icons'] + + self.assertEqual(icons._strings, ['quux.icns']) + def test_preferences_js(self): reader = self.reader('js_preference_files') objs = self.read_topsrcdir(reader) diff --git a/xulrunner/app/Makefile.in b/xulrunner/app/Makefile.in index 8486ebb2d96..98e377d69c8 100644 --- a/xulrunner/app/Makefile.in +++ b/xulrunner/app/Makefile.in @@ -38,19 +38,6 @@ endif #export:: brand.dtd.in # $(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $^ -o brand.dtd) -export:: - $(NSINSTALL) -D $(DIST)/branding -ifeq ($(OS_ARCH),WINNT) - cp $(srcdir)/xulrunner.ico $(DIST)/branding/xulrunner.ico - cp $(srcdir)/xulrunner.ico $(DIST)/branding/app.ico - cp $(srcdir)/document.ico $(DIST)/branding/document.ico -endif -ifdef MOZ_WIDGET_GTK - cp $(srcdir)/default16.png $(DIST)/branding/default16.png - cp $(srcdir)/default32.png $(DIST)/branding/default32.png - cp $(srcdir)/default48.png $(DIST)/branding/default48.png -endif - ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) FRAMEWORK_NAME = XUL diff --git a/xulrunner/app/moz.build b/xulrunner/app/moz.build index 541738e2cb2..791bdba9bd9 100644 --- a/xulrunner/app/moz.build +++ b/xulrunner/app/moz.build @@ -60,3 +60,17 @@ JS_PREFERENCE_FILES += [ 'xulrunner.js', ] +if CONFIG['OS_ARCH'] == 'WINNT': + BRANDING_FILES += [ + 'app.ico', + 'document.ico', + 'xulrunner.ico', + ] + BRANDING_FILES['app.ico'].source = 'xulrunner.ico' + +if CONFIG['MOZ_WIDGET_GTK']: + BRANDING_FILES += [ + 'default16.png', + 'default32.png', + 'default48.png', + ] From eea0754129f953cd51dd291bc6a0b0ac4c6f4be7 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 29 Apr 2015 09:11:00 -0400 Subject: [PATCH 04/58] Bug 1112014 - Avoid false negatives in CssPropertySupportsType. r=heycam IGNORE IDL --- layout/inspector/inDOMUtils.cpp | 139 ++++++++++++++++++++++--- layout/inspector/inIDOMUtils.idl | 3 - layout/style/nsCSSParser.cpp | 16 ++- layout/style/test/mochitest.ini | 1 + layout/style/test/test_bug1112014.html | 121 +++++++++++++++++++++ 5 files changed, 254 insertions(+), 26 deletions(-) create mode 100644 layout/style/test/test_bug1112014.html diff --git a/layout/inspector/inDOMUtils.cpp b/layout/inspector/inDOMUtils.cpp index 042fb17169a..88b44556e5f 100644 --- a/layout/inspector/inDOMUtils.cpp +++ b/layout/inspector/inDOMUtils.cpp @@ -653,6 +653,125 @@ inDOMUtils::CssPropertyIsShorthand(const nsAString& aProperty, bool *_retval) return NS_OK; } +// A helper function that determines whether the given property +// supports the given type. +static bool +PropertySupportsVariant(nsCSSProperty aPropertyID, uint32_t aVariant) +{ + if (nsCSSProps::IsShorthand(aPropertyID)) { + // We need a special case for border here, because while it resets + // border-image, it can't actually parse an image. + if (aPropertyID == eCSSProperty_border) { + return (aVariant & (VARIANT_COLOR | VARIANT_LENGTH)) != 0; + } + + for (const nsCSSProperty* props = nsCSSProps::SubpropertyEntryFor(aPropertyID); + *props != eCSSProperty_UNKNOWN; ++props) { + if (PropertySupportsVariant(*props, aVariant)) { + return true; + } + } + return false; + } + + // Properties that are parsed by functions must have their + // attributes hand-maintained here. + if (nsCSSProps::PropHasFlags(aPropertyID, CSS_PROPERTY_VALUE_PARSER_FUNCTION) || + nsCSSProps::PropertyParseType(aPropertyID) == CSS_PROPERTY_PARSE_FUNCTION) { + // These must all be special-cased. + uint32_t supported; + switch (aPropertyID) { + case eCSSProperty_border_image_slice: + case eCSSProperty_grid_template: + case eCSSProperty_grid: + supported = VARIANT_PN; + break; + + case eCSSProperty_border_image_outset: + supported = VARIANT_LN; + break; + + case eCSSProperty_border_image_width: + case eCSSProperty_stroke_dasharray: + supported = VARIANT_LPN; + break; + + case eCSSProperty_border_top_left_radius: + case eCSSProperty_border_top_right_radius: + case eCSSProperty_border_bottom_left_radius: + case eCSSProperty_border_bottom_right_radius: + case eCSSProperty_background_position: + case eCSSProperty_background_size: + case eCSSProperty_grid_auto_columns: + case eCSSProperty_grid_auto_rows: + case eCSSProperty_grid_template_columns: + case eCSSProperty_grid_template_rows: + case eCSSProperty_object_position: + case eCSSProperty_scroll_snap_coordinate: + case eCSSProperty_scroll_snap_destination: + case eCSSProperty_transform_origin: + case eCSSProperty_perspective_origin: + case eCSSProperty__moz_outline_radius_topLeft: + case eCSSProperty__moz_outline_radius_topRight: + case eCSSProperty__moz_outline_radius_bottomLeft: + case eCSSProperty__moz_outline_radius_bottomRight: + supported = VARIANT_LP; + break; + + case eCSSProperty_border_bottom_colors: + case eCSSProperty_border_left_colors: + case eCSSProperty_border_right_colors: + case eCSSProperty_border_top_colors: + supported = VARIANT_COLOR; + break; + + case eCSSProperty_text_shadow: + case eCSSProperty_box_shadow: + supported = VARIANT_LENGTH | VARIANT_COLOR; + break; + + case eCSSProperty_border_spacing: + supported = VARIANT_LENGTH; + break; + + case eCSSProperty_content: + case eCSSProperty_cursor: + case eCSSProperty_clip_path: + supported = VARIANT_URL; + break; + + case eCSSProperty_fill: + case eCSSProperty_stroke: + supported = VARIANT_COLOR | VARIANT_URL; + break; + + case eCSSProperty_image_orientation: + supported = VARIANT_ANGLE; + break; + + case eCSSProperty_filter: + supported = VARIANT_URL; + break; + + case eCSSProperty_grid_column_start: + case eCSSProperty_grid_column_end: + case eCSSProperty_grid_row_start: + case eCSSProperty_grid_row_end: + case eCSSProperty_font_weight: + supported = VARIANT_NUMBER; + break; + + default: + supported = 0; + break; + } + + return (supported & aVariant) != 0; + } + + return (nsCSSProps::ParserVariant(aPropertyID) & aVariant) != 0; +} + NS_IMETHODIMP inDOMUtils::CssPropertySupportsType(const nsAString& aProperty, uint32_t aType, bool *_retval) @@ -663,6 +782,11 @@ inDOMUtils::CssPropertySupportsType(const nsAString& aProperty, uint32_t aType, return NS_ERROR_FAILURE; } + if (propertyID >= eCSSProperty_COUNT) { + *_retval = false; + return NS_OK; + } + uint32_t variant; switch (aType) { case TYPE_LENGTH: @@ -704,20 +828,7 @@ inDOMUtils::CssPropertySupportsType(const nsAString& aProperty, uint32_t aType, return NS_ERROR_NOT_AVAILABLE; } - if (!nsCSSProps::IsShorthand(propertyID)) { - *_retval = nsCSSProps::ParserVariant(propertyID) & variant; - return NS_OK; - } - - for (const nsCSSProperty* props = nsCSSProps::SubpropertyEntryFor(propertyID); - *props != eCSSProperty_UNKNOWN; ++props) { - if (nsCSSProps::ParserVariant(*props) & variant) { - *_retval = true; - return NS_OK; - } - } - - *_retval = false; + *_retval = PropertySupportsVariant(propertyID, variant); return NS_OK; } diff --git a/layout/inspector/inIDOMUtils.idl b/layout/inspector/inIDOMUtils.idl index 68df23d51db..8e9aa4bbcf0 100644 --- a/layout/inspector/inIDOMUtils.idl +++ b/layout/inspector/inIDOMUtils.idl @@ -103,9 +103,6 @@ interface inIDOMUtils : nsISupports // For shorthands, checks whether there's a corresponding longhand property // that accepts values of this type. Throws on unsupported properties or // unknown types. - // - // This function may incorrectly return false for properties that use custom - // parsing functions instead of table-driven parsing. const unsigned long TYPE_LENGTH = 0; const unsigned long TYPE_PERCENTAGE = 1; const unsigned long TYPE_COLOR = 2; diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index 095de41f451..b6be119bdbf 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1212,7 +1212,6 @@ protected: // sites. bool mDidUnprefixWebkitBoxInEarlierDecl; // not :1 so we can use AutoRestore -#ifdef DEBUG // True if any parsing of URL values requires a sheet principal to have // been passed in the nsCSSScanner constructor. This is usually the case. // It can be set to false, for example, when we create an nsCSSParser solely @@ -1221,7 +1220,6 @@ protected: // not be set to false if any nsCSSValues created during parsing can escape // out of the parser. bool mSheetPrincipalRequired; -#endif // Stack of rule groups; used for @media and such. InfallibleTArray > mGroupStack; @@ -1300,9 +1298,7 @@ CSSParserImpl::CSSParserImpl() mInFailingSupportsRule(false), mSuppressErrors(false), mDidUnprefixWebkitBoxInEarlierDecl(false), -#ifdef DEBUG mSheetPrincipalRequired(true), -#endif mNextFree(nullptr) { } @@ -7611,9 +7607,13 @@ bool CSSParserImpl::SetValueToURL(nsCSSValue& aValue, const nsString& aURL) { if (!mSheetPrincipal) { - NS_ASSERTION(!mSheetPrincipalRequired, - "Codepaths that expect to parse URLs MUST pass in an " - "origin principal"); + if (!mSheetPrincipalRequired) { + /* Pretend to succeed. */ + return true; + } + + NS_NOTREACHED("Codepaths that expect to parse URLs MUST pass in an " + "origin principal"); return false; } @@ -15379,7 +15379,6 @@ CSSParserImpl::IsValueValidForProperty(const nsCSSProperty aPropID, css::ErrorReporter reporter(scanner, mSheet, mChildLoader, nullptr); InitScanner(scanner, reporter, nullptr, nullptr, nullptr); -#ifdef DEBUG // We normally would need to pass in a sheet principal to InitScanner, // because we might parse a URL value. However, we will never use the // parsed nsCSSValue (and so whether we have a sheet principal or not @@ -15388,7 +15387,6 @@ CSSParserImpl::IsValueValidForProperty(const nsCSSProperty aPropID, // that it's safe to skip the assertion. AutoRestore autoRestore(mSheetPrincipalRequired); mSheetPrincipalRequired = false; -#endif nsAutoSuppressErrors suppressErrors(this); diff --git a/layout/style/test/mochitest.ini b/layout/style/test/mochitest.ini index c3f994e1321..37faac038bd 100644 --- a/layout/style/test/mochitest.ini +++ b/layout/style/test/mochitest.ini @@ -110,6 +110,7 @@ support-files = file_bug829816.css support-files = file_bug1055933_circle-xxl.png [test_bug1089417.html] support-files = file_bug1089417_iframe.html +[test_bug1112014.html] [test_cascade.html] [test_ch_ex_no_infloops.html] [test_compute_data_with_start_struct.html] diff --git a/layout/style/test/test_bug1112014.html b/layout/style/test/test_bug1112014.html new file mode 100644 index 00000000000..ba1d2f017cb --- /dev/null +++ b/layout/style/test/test_bug1112014.html @@ -0,0 +1,121 @@ + + + + + + Test for Bug 1112014 + + + + + +Mozilla Bug 1112014 +

+ +
+
+ + From 99e08b8da383ef0ff6d67038c6b01e70251a1794 Mon Sep 17 00:00:00 2001 From: Matt Woodrow Date: Thu, 30 Apr 2015 09:49:49 +1200 Subject: [PATCH 05/58] Bug 1155608 - Blacklist Intel G45 hardware decoding. r=k17e --- widget/GfxDriverInfo.cpp | 3 +++ widget/GfxDriverInfo.h | 1 + widget/windows/GfxInfo.cpp | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/widget/GfxDriverInfo.cpp b/widget/GfxDriverInfo.cpp index 62c3158c365..6bbc72d2895 100644 --- a/widget/GfxDriverInfo.cpp +++ b/widget/GfxDriverInfo.cpp @@ -261,6 +261,9 @@ const GfxDeviceFamily* GfxDriverInfo::GetDeviceFamily(DeviceFamily id) APPEND_DEVICE(0x2e32); APPEND_DEVICE(0x2a02); break; + case Bug1155608: + APPEND_DEVICE(0x2e22); /* IntelG45_1 */ + break; case AMDRadeonHD5800: APPEND_DEVICE(0x6899); break; diff --git a/widget/GfxDriverInfo.h b/widget/GfxDriverInfo.h index 195a0753695..5bb1422fc5d 100644 --- a/widget/GfxDriverInfo.h +++ b/widget/GfxDriverInfo.h @@ -89,6 +89,7 @@ enum DeviceFamily { AMDRadeonHD5800, Bug1137716, Bug1116812, + Bug1155608, DeviceFamilyMax }; diff --git a/widget/windows/GfxInfo.cpp b/widget/windows/GfxInfo.cpp index 1a8001d6ec5..954968a78b0 100644 --- a/widget/windows/GfxInfo.cpp +++ b/widget/windows/GfxInfo.cpp @@ -1107,6 +1107,11 @@ GfxInfo::GetGfxDriverInfo() nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, DRIVER_LESS_THAN, V(8,15,10,2622)); + APPEND_TO_DRIVER_BLOCKLIST2(DRIVER_OS_WINDOWS_7, + (nsAString&)GfxDriverInfo::GetDeviceVendor(VendorIntel), (GfxDeviceFamily*)GfxDriverInfo::GetDeviceFamily(Bug1155608), + nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, + DRIVER_LESS_THAN_OR_EQUAL, V(8,15,10,2869)); + APPEND_TO_DRIVER_BLOCKLIST2(DRIVER_OS_ALL, (nsAString&)GfxDriverInfo::GetDeviceVendor(VendorNVIDIA), (GfxDeviceFamily*)GfxDriverInfo::GetDeviceFamily(Nvidia8800GTS), nsIGfxInfo::FEATURE_HARDWARE_VIDEO_DECODING, nsIGfxInfo::FEATURE_BLOCKED_DRIVER_VERSION, From 889a42a69429ccee4580b1c3eda435ac952394c1 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Wed, 29 Apr 2015 18:35:00 -0400 Subject: [PATCH 06/58] Bug 1158837 - Ensure the start and end nodes are non-null before using them. r=roc --- editor/libeditor/nsHTMLEditRules.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/editor/libeditor/nsHTMLEditRules.cpp b/editor/libeditor/nsHTMLEditRules.cpp index b7f5e17e3cf..02d6c7ae2a3 100644 --- a/editor/libeditor/nsHTMLEditRules.cpp +++ b/editor/libeditor/nsHTMLEditRules.cpp @@ -488,6 +488,8 @@ nsHTMLEditRules::AfterEditInner(EditAction action, // also do this for original selection endpoints. NS_ENSURE_STATE(mHTMLEditor); + NS_ENSURE_STATE(mRangeItem->startNode); + NS_ENSURE_STATE(mRangeItem->endNode); nsWSRunObject(mHTMLEditor, mRangeItem->startNode, mRangeItem->startOffset).AdjustWhitespace(); // we only need to handle old selection endpoint if it was different from start From 60e1c95475160c0556bf9239f1f99991a47b8b31 Mon Sep 17 00:00:00 2001 From: Doug Turner Date: Tue, 28 Apr 2015 09:44:00 -0400 Subject: [PATCH 07/58] Bug 1159310 - Remember the push count and last push time for push events. r=kit --- dom/interfaces/push/nsIPushObserverNotification.idl | 12 +++++++++++- dom/push/PushService.jsm | 11 ++++++++++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/dom/interfaces/push/nsIPushObserverNotification.idl b/dom/interfaces/push/nsIPushObserverNotification.idl index 7f6eb362be8..4876dcf9103 100644 --- a/dom/interfaces/push/nsIPushObserverNotification.idl +++ b/dom/interfaces/push/nsIPushObserverNotification.idl @@ -9,7 +9,7 @@ * A push message received by an `nsIPushNotificationService`, used as the * subject of a `push-notification` observer notification. */ -[scriptable, uuid(66a87970-6dc9-46e0-ac61-adb4a13791de)] +[scriptable, uuid(56f57607-28b6-44b0-aa56-3d4d3c88be15)] interface nsIPushObserverNotification : nsISupports { /* The URL that receives push messages from an application server. */ @@ -27,4 +27,14 @@ interface nsIPushObserverNotification : nsISupports * may be discarded. */ attribute string data; + + /** + * How many times has a push event occured against this pushEndpoint + */ + attribute long long pushCount; + + /** + * The last time a push occured against this this pushEndpoint + */ + attribute long long lastPush; }; diff --git a/dom/push/PushService.jsm b/dom/push/PushService.jsm index 54c07b1da88..97724c0368a 100644 --- a/dom/push/PushService.jsm +++ b/dom/push/PushService.jsm @@ -1334,6 +1334,8 @@ this.PushService = { aPushRecord.version < aLatestVersion) { debug("Version changed, notifying app and updating DB"); aPushRecord.version = aLatestVersion; + aPushRecord.pushCount = aPushRecord.pushCount + 1; + aPushRecord.lastPush = new Date().getTime(); this._notifyApp(aPushRecord); this._updatePushRecord(aPushRecord) .then( @@ -1398,6 +1400,9 @@ this.PushService = { notification.pushEndpoint = aPushRecord.pushEndpoint; notification.version = aPushRecord.version; notification.data = ""; + notification.lastPush = aPushRecord.lastPush; + notification.pushCount = aPushRecord.pushCount; + Services.obs.notifyObservers( notification, "push-notification", @@ -1538,6 +1543,8 @@ this.PushService = { pushEndpoint: data.pushEndpoint, pageURL: aPageRecord.pageURL, scope: aPageRecord.scope, + pushCount: 0, + lastPush: 0, version: null }; @@ -1666,7 +1673,9 @@ this.PushService = { if (pushRecord) { registration = { pushEndpoint: pushRecord.pushEndpoint, - version: pushRecord.version + version: pushRecord.version, + lastPush: pushRecord.lastPush, + pushCount: pushRecord.pushCount }; } resolve(registration); From bead71165eebda68ebe9bc84c19df83794e21afc Mon Sep 17 00:00:00 2001 From: Kit Cambridge Date: Wed, 29 Apr 2015 05:31:00 -0400 Subject: [PATCH 08/58] Bug 1159310 - Update the storage xpcshell tests. r=dougt --- .../xpcshell/test_notification_incomplete.js | 16 +++++++++++++++- .../test/xpcshell/test_registration_success.js | 10 ++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/dom/push/test/xpcshell/test_notification_incomplete.js b/dom/push/test/xpcshell/test_notification_incomplete.js index b7f065f5ac6..26c11f59a97 100644 --- a/dom/push/test/xpcshell/test_notification_incomplete.js +++ b/dom/push/test/xpcshell/test_notification_incomplete.js @@ -105,5 +105,19 @@ add_task(function* test_notification_incomplete() { let storeRecords = yield promiseDB.getAllChannelIDs(); storeRecords.sort(({pushEndpoint: a}, {pushEndpoint: b}) => compareAscending(a, b)); - deepEqual(records, storeRecords, 'Should not update malformed records'); + recordsAreEqual(records, storeRecords); }); + +function recordIsEqual(a, b) { + strictEqual(a.channelID, b.channelID, 'Wrong channel ID in record'); + strictEqual(a.pushEndpoint, b.pushEndpoint, 'Wrong push endpoint in record'); + strictEqual(a.scope, b.scope, 'Wrong scope in record'); + strictEqual(a.version, b.version, 'Wrong version in record'); +} + +function recordsAreEqual(a, b) { + equal(a.length, b.length, 'Mismatched record count'); + for (let i = 0; i < a.length; i++) { + recordIsEqual(a[i], b[i]); + } +} diff --git a/dom/push/test/xpcshell/test_registration_success.js b/dom/push/test/xpcshell/test_registration_success.js index b3c03e730e2..738828c51b8 100644 --- a/dom/push/test/xpcshell/test_registration_success.js +++ b/dom/push/test/xpcshell/test_registration_success.js @@ -60,8 +60,10 @@ add_task(function* test_registration_success() { let registration = yield PushNotificationService.registration( 'https://example.net/a'); - deepEqual(registration, { - pushEndpoint: 'https://example.com/update/same-manifest/1', - version: 5 - }, 'Should include registrations for all pages with this manifest'); + equal( + registration.pushEndpoint, + 'https://example.com/update/same-manifest/1', + 'Wrong push endpoint for scope' + ); + equal(registration.version, 5, 'Wrong version for scope'); }); From 604034b516919fc77f71f054be00ed18c2fe9aa1 Mon Sep 17 00:00:00 2001 From: Dave Hunt Date: Thu, 30 Apr 2015 02:33:00 -0400 Subject: [PATCH 09/58] Bug 1160087 - [moznetwork] Add command line interface. r=wlach --- .../moznetwork/moznetwork/moznetwork.py | 22 +++++++++++++++++-- testing/mozbase/moznetwork/setup.py | 4 +++- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/testing/mozbase/moznetwork/moznetwork/moznetwork.py b/testing/mozbase/moznetwork/moznetwork/moznetwork.py index c35181ad5d9..cf66155ef87 100644 --- a/testing/mozbase/moznetwork/moznetwork/moznetwork.py +++ b/testing/mozbase/moznetwork/moznetwork/moznetwork.py @@ -2,16 +2,20 @@ # 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/. -import socket +import argparse import array import re +import socket import struct import subprocess +import sys + import mozinfo if mozinfo.isLinux: import fcntl + class NetworkError(Exception): """Exception thrown when unable to obtain interface or IP.""" @@ -34,12 +38,13 @@ def _get_interface_list(): ))[0] namestr = names.tostring() return [(namestr[i:i + 32].split('\0', 1)[0], - socket.inet_ntoa(namestr[i + 20:i + 24]))\ + socket.inet_ntoa(namestr[i + 20:i + 24])) for i in range(0, outbytes, struct_size)] except IOError: raise NetworkError('Unable to call ioctl with SIOCGIFCONF') + def _proc_matches(args, regex): """Helper returns the matches of regex in the output of a process created with the given arguments""" @@ -48,6 +53,7 @@ def _proc_matches(args, regex): stderr=subprocess.STDOUT).stdout.read() return re.findall(regex, output) + def _parse_ifconfig(): """Parse the output of running ifconfig on mac in cases other methods have failed""" @@ -77,6 +83,7 @@ def _parse_ifconfig(): except IndexError: return None + def get_ip(): """Provides an available network interface address, for example "192.168.1.3". @@ -112,3 +119,14 @@ def get_ip(): def get_lan_ip(): """Deprecated. Please use get_ip() instead.""" return get_ip() + + +def cli(args=sys.argv[1:]): + parser = argparse.ArgumentParser( + description='Retrieve IP address') + parser.parse_args() + print 'IP address: %s' % get_ip() + + +if __name__ == '__main__': + cli() diff --git a/testing/mozbase/moznetwork/setup.py b/testing/mozbase/moznetwork/setup.py index 60f02f27aa1..ec410f5426f 100644 --- a/testing/mozbase/moznetwork/setup.py +++ b/testing/mozbase/moznetwork/setup.py @@ -21,5 +21,7 @@ setup(name='moznetwork', packages=['moznetwork'], include_package_data=True, zip_safe=False, - install_requires=deps + install_requires=deps, + entry_points={'console_scripts': [ + 'moznetwork = moznetwork:cli']}, ) From 920d9edf983b54e836c2718b8db33aa6c778c4c1 Mon Sep 17 00:00:00 2001 From: Florian Scholz Date: Fri, 1 May 2015 12:32:53 +0200 Subject: [PATCH 10/58] Bug 1153825 - Fix length properties of (Weak){Map,Set} constructors; r=evilpie --- js/src/builtin/MapObject.cpp | 2 +- js/src/builtin/WeakSetObject.cpp | 2 +- js/src/jit-test/tests/collections/Map-surfaces-1.js | 2 +- js/src/jit-test/tests/collections/Set-surfaces-1.js | 2 +- js/src/jit-test/tests/collections/WeakMap-surfaces.js | 2 +- js/src/jit-test/tests/collections/WeakSet-surface.js | 2 +- js/src/jsweakmap.cpp | 2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff --git a/js/src/builtin/MapObject.cpp b/js/src/builtin/MapObject.cpp index 358eb90f91d..4d37edffae9 100644 --- a/js/src/builtin/MapObject.cpp +++ b/js/src/builtin/MapObject.cpp @@ -1060,7 +1060,7 @@ InitClass(JSContext* cx, Handle global, const Class* clasp, JSPro return nullptr; proto->setPrivate(nullptr); - Rooted ctor(cx, global->createConstructor(cx, construct, ClassName(key, cx), 1)); + Rooted ctor(cx, global->createConstructor(cx, construct, ClassName(key, cx), 0)); if (!ctor || !LinkConstructorAndPrototype(cx, ctor, proto) || !DefinePropertiesAndFunctions(cx, proto, properties, methods) || diff --git a/js/src/builtin/WeakSetObject.cpp b/js/src/builtin/WeakSetObject.cpp index 0f5d2d2b47e..a6eb1acfa4e 100644 --- a/js/src/builtin/WeakSetObject.cpp +++ b/js/src/builtin/WeakSetObject.cpp @@ -51,7 +51,7 @@ WeakSetObject::initClass(JSContext* cx, JSObject* obj) return nullptr; proto->setReservedSlot(WEAKSET_MAP_SLOT, UndefinedValue()); - Rooted ctor(cx, global->createConstructor(cx, construct, ClassName(JSProto_WeakSet, cx), 1)); + Rooted ctor(cx, global->createConstructor(cx, construct, ClassName(JSProto_WeakSet, cx), 0)); if (!ctor || !LinkConstructorAndPrototype(cx, ctor, proto) || !DefinePropertiesAndFunctions(cx, proto, properties, methods) || diff --git a/js/src/jit-test/tests/collections/Map-surfaces-1.js b/js/src/jit-test/tests/collections/Map-surfaces-1.js index 2691f95e0d4..827dd7b1ef7 100644 --- a/js/src/jit-test/tests/collections/Map-surfaces-1.js +++ b/js/src/jit-test/tests/collections/Map-surfaces-1.js @@ -9,7 +9,7 @@ assertEq(desc.writable, true); assertEq(typeof Map, 'function'); assertEq(Object.keys(Map).length, 0); -assertEq(Map.length, 1); +assertEq(Map.length, 0); assertEq(Map.name, "Map"); assertEq(Object.getPrototypeOf(Map.prototype), Object.prototype); diff --git a/js/src/jit-test/tests/collections/Set-surfaces-1.js b/js/src/jit-test/tests/collections/Set-surfaces-1.js index 98f0e6f16d7..cd8573868c9 100644 --- a/js/src/jit-test/tests/collections/Set-surfaces-1.js +++ b/js/src/jit-test/tests/collections/Set-surfaces-1.js @@ -9,7 +9,7 @@ assertEq(desc.writable, true); assertEq(typeof Set, 'function'); assertEq(Object.keys(Set).length, 0); -assertEq(Set.length, 1); +assertEq(Set.length, 0); assertEq(Set.name, "Set"); assertEq(Object.getPrototypeOf(Set.prototype), Object.prototype); diff --git a/js/src/jit-test/tests/collections/WeakMap-surfaces.js b/js/src/jit-test/tests/collections/WeakMap-surfaces.js index 06a93556a17..678c9a59fa7 100644 --- a/js/src/jit-test/tests/collections/WeakMap-surfaces.js +++ b/js/src/jit-test/tests/collections/WeakMap-surfaces.js @@ -7,7 +7,7 @@ assertEq(desc.writable, true); assertEq(typeof WeakMap, 'function'); assertEq(Object.keys(WeakMap).length, 0); -assertEq(WeakMap.length, 1); +assertEq(WeakMap.length, 0); assertEq(WeakMap.name, "WeakMap"); assertEq(Object.getPrototypeOf(WeakMap.prototype), Object.prototype); diff --git a/js/src/jit-test/tests/collections/WeakSet-surface.js b/js/src/jit-test/tests/collections/WeakSet-surface.js index 22eb937e386..253ff4646ef 100644 --- a/js/src/jit-test/tests/collections/WeakSet-surface.js +++ b/js/src/jit-test/tests/collections/WeakSet-surface.js @@ -7,7 +7,7 @@ assertEq(desc.writable, true); assertEq(typeof WeakSet, 'function'); assertEq(Object.keys(WeakSet).length, 0); -assertEq(WeakSet.length, 1); +assertEq(WeakSet.length, 0); assertEq(WeakSet.name, "WeakSet"); assertEq(Object.getPrototypeOf(WeakSet.prototype), Object.prototype); diff --git a/js/src/jsweakmap.cpp b/js/src/jsweakmap.cpp index 02707621494..f61509a864c 100644 --- a/js/src/jsweakmap.cpp +++ b/js/src/jsweakmap.cpp @@ -646,7 +646,7 @@ InitWeakMapClass(JSContext* cx, HandleObject obj, bool defineMembers) return nullptr; RootedFunction ctor(cx, global->createConstructor(cx, WeakMap_construct, - cx->names().WeakMap, 1)); + cx->names().WeakMap, 0)); if (!ctor) return nullptr; From e16d8a336129bb41a9629e58feaa576ca195427e Mon Sep 17 00:00:00 2001 From: Tom Schuster Date: Fri, 1 May 2015 12:32:53 +0200 Subject: [PATCH 11/58] Bug 1158463 - Reorder property creation in js::FromPropertyDescriptorToObject. r=Waldo --- .../jit-test/tests/arrays/sort-getter-only.js | 6 +-- .../collections/Array-of-nonconfigurable-2.js | 6 +-- ...stDirectProxyGetOwnPropertyDescriptor11.js | 6 +-- ...stIndirectProxyGetOwnPropertyDescriptor.js | 6 +-- js/src/jsobj.cpp | 38 +++++++++++++------ .../ecma_6/Object/getOwnPropertyDescriptor.js | 12 +++--- .../Object/property-descriptor-order.js | 17 +++++++++ js/src/tests/ecma_6/Symbol/property-basics.js | 6 +-- .../ecma_6/Symbol/property-reflection.js | 12 +++--- js/src/tests/ecma_6/TypedArray/of.js | 6 +-- 10 files changed, 74 insertions(+), 41 deletions(-) create mode 100644 js/src/tests/ecma_6/Object/property-descriptor-order.js diff --git a/js/src/jit-test/tests/arrays/sort-getter-only.js b/js/src/jit-test/tests/arrays/sort-getter-only.js index c799de03ff2..d17e8556d66 100644 --- a/js/src/jit-test/tests/arrays/sort-getter-only.js +++ b/js/src/jit-test/tests/arrays/sort-getter-only.js @@ -5,10 +5,10 @@ load(libdir + "asserts.js"); var a = ["A", , "B", "C", "D"]; var normalArrayElementDesc = Object.getOwnPropertyDescriptor(a, 0); var getterDesc = { - configurable: false, - enumerable: true, get: function () { return "F"; }, - set: undefined + set: undefined, + enumerable: true, + configurable: false }; Object.defineProperty(a, 1, getterDesc); diff --git a/js/src/jit-test/tests/collections/Array-of-nonconfigurable-2.js b/js/src/jit-test/tests/collections/Array-of-nonconfigurable-2.js index 4b469c47940..f5c783714aa 100644 --- a/js/src/jit-test/tests/collections/Array-of-nonconfigurable-2.js +++ b/js/src/jit-test/tests/collections/Array-of-nonconfigurable-2.js @@ -9,8 +9,8 @@ function C() { } try { Array.of.call(C, 1); } catch (e) {} assertDeepEq(Object.getOwnPropertyDescriptor(obj, 0), { - configurable: false, - enumerable: false, value: "v", - writable: false + writable: false, + enumerable: false, + configurable: false }); diff --git a/js/src/jit-test/tests/proxy/testDirectProxyGetOwnPropertyDescriptor11.js b/js/src/jit-test/tests/proxy/testDirectProxyGetOwnPropertyDescriptor11.js index 1588dd15b12..7af839477d7 100644 --- a/js/src/jit-test/tests/proxy/testDirectProxyGetOwnPropertyDescriptor11.js +++ b/js/src/jit-test/tests/proxy/testDirectProxyGetOwnPropertyDescriptor11.js @@ -7,8 +7,8 @@ var p = new Proxy({}, { }); var desc = Object.getOwnPropertyDescriptor(p, "x"); assertDeepEq(desc, { - configurable: true, - enumerable: false, value: undefined, - writable: false + writable: false, + enumerable: false, + configurable: true }); diff --git a/js/src/jit-test/tests/proxy/testIndirectProxyGetOwnPropertyDescriptor.js b/js/src/jit-test/tests/proxy/testIndirectProxyGetOwnPropertyDescriptor.js index da26c08dd72..923d0a0f6ad 100644 --- a/js/src/jit-test/tests/proxy/testIndirectProxyGetOwnPropertyDescriptor.js +++ b/js/src/jit-test/tests/proxy/testIndirectProxyGetOwnPropertyDescriptor.js @@ -5,8 +5,8 @@ load(libdir + "asserts.js"); var p = Proxy.create({ getOwnPropertyDescriptor() { return {}; } }); var desc = Object.getOwnPropertyDescriptor(p, "x"); assertDeepEq(desc, { - configurable: false, - enumerable: false, value: undefined, - writable: false + writable: false, + enumerable: false, + configurable: false }); diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index b2e3ab51d41..f45508eeb2d 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -127,9 +127,11 @@ js::InformalValueTypeName(const Value& v) return "value"; } +// ES6 draft rev37 6.2.4.4 FromPropertyDescriptor bool js::FromPropertyDescriptor(JSContext* cx, Handle desc, MutableHandleValue vp) { + // Step 1. if (!desc.object()) { vp.setUndefined(); return true; @@ -142,31 +144,28 @@ bool js::FromPropertyDescriptorToObject(JSContext* cx, Handle desc, MutableHandleValue vp) { + // Step 2-3. RootedObject obj(cx, NewBuiltinClassInstance(cx)); if (!obj) return false; const JSAtomState& names = cx->names(); - RootedValue v(cx); - if (desc.hasConfigurable()) { - v.setBoolean(desc.configurable()); - if (!DefineProperty(cx, obj, names.configurable, v)) - return false; - } - if (desc.hasEnumerable()) { - v.setBoolean(desc.enumerable()); - if (!DefineProperty(cx, obj, names.enumerable, v)) - return false; - } + + // Step 4. if (desc.hasValue()) { if (!DefineProperty(cx, obj, names.value, desc.value())) return false; } + + // Step 5. + RootedValue v(cx); if (desc.hasWritable()) { v.setBoolean(desc.writable()); if (!DefineProperty(cx, obj, names.writable, v)) return false; } + + // Step 6. if (desc.hasGetterObject()) { if (JSObject* get = desc.getterObject()) v.setObject(*get); @@ -175,6 +174,8 @@ js::FromPropertyDescriptorToObject(JSContext* cx, Handle des if (!DefineProperty(cx, obj, names.get, v)) return false; } + + // Step 7. if (desc.hasSetterObject()) { if (JSObject* set = desc.setterObject()) v.setObject(*set); @@ -183,6 +184,21 @@ js::FromPropertyDescriptorToObject(JSContext* cx, Handle des if (!DefineProperty(cx, obj, names.set, v)) return false; } + + // Step 8. + if (desc.hasEnumerable()) { + v.setBoolean(desc.enumerable()); + if (!DefineProperty(cx, obj, names.enumerable, v)) + return false; + } + + // Step 9. + if (desc.hasConfigurable()) { + v.setBoolean(desc.configurable()); + if (!DefineProperty(cx, obj, names.configurable, v)) + return false; + } + vp.setObject(*obj); return true; } diff --git a/js/src/tests/ecma_6/Object/getOwnPropertyDescriptor.js b/js/src/tests/ecma_6/Object/getOwnPropertyDescriptor.js index 52d5762c3bf..7aaba7b5eef 100644 --- a/js/src/tests/ecma_6/Object/getOwnPropertyDescriptor.js +++ b/js/src/tests/ecma_6/Object/getOwnPropertyDescriptor.js @@ -18,17 +18,17 @@ if (typeof Symbol === "function") { } assertDeepEq(Object.getOwnPropertyDescriptor("foo", "length"), { - configurable: false, - enumerable: false, value: 3, - writable: false + writable: false, + enumerable: false, + configurable: false }); assertDeepEq(Object.getOwnPropertyDescriptor("foo", 0), { - configurable: false, - enumerable: true, value: "f", - writable: false + writable: false, + enumerable: true, + configurable: false }); if (typeof reportCompare === "function") diff --git a/js/src/tests/ecma_6/Object/property-descriptor-order.js b/js/src/tests/ecma_6/Object/property-descriptor-order.js new file mode 100644 index 00000000000..337d247daee --- /dev/null +++ b/js/src/tests/ecma_6/Object/property-descriptor-order.js @@ -0,0 +1,17 @@ +var names = Object.getOwnPropertyNames(Object.getOwnPropertyDescriptor({foo: 0}, "foo")); +assertDeepEq(names, ["value", "writable", "enumerable", "configurable"]); + +names = Object.getOwnPropertyNames(Object.getOwnPropertyDescriptor({get foo(){}}, "foo")); +assertDeepEq(names, ["get", "set", "enumerable", "configurable"]); + +var proxy = new Proxy({}, { + defineProperty(target, key, desc) { + var names = Object.getOwnPropertyNames(desc); + assertDeepEq(names, ["set", "configurable"]); + return true; + } +}); + +Object.defineProperty(proxy, "foo", {configurable: true, set: function() {}}); + +reportCompare(true, true); diff --git a/js/src/tests/ecma_6/Symbol/property-basics.js b/js/src/tests/ecma_6/Symbol/property-basics.js index a38fa717abb..63bcb3867c3 100644 --- a/js/src/tests/ecma_6/Symbol/property-basics.js +++ b/js/src/tests/ecma_6/Symbol/property-basics.js @@ -25,10 +25,10 @@ for (var sym of symbols) { assertEq(obj.hasOwnProperty(sym), true); assertEq(obj[sym], "ok"); assertDeepEq(Object.getOwnPropertyDescriptor(obj, sym), { - configurable: true, - enumerable: true, value: "ok", - writable: true + writable: true, + enumerable: true, + configurable: true }); // assign again, observe value is overwritten diff --git a/js/src/tests/ecma_6/Symbol/property-reflection.js b/js/src/tests/ecma_6/Symbol/property-reflection.js index a70a43fb988..5bdecf66321 100644 --- a/js/src/tests/ecma_6/Symbol/property-reflection.js +++ b/js/src/tests/ecma_6/Symbol/property-reflection.js @@ -21,17 +21,17 @@ var descs = new D; var s1 = Symbol("s1"); var hits = 0; descs[s1] = { - configurable: true, - enumerable: true, get: () => hits++, - set: undefined + set: undefined, + enumerable: true, + configurable: true }; var s2 = Symbol("s2"); descs[s2] = { - configurable: true, - enumerable: false, value: {}, - writable: true + writable: true, + enumerable: false, + configurable: true }; var s3 = Symbol("s3"); D.prototype[s3] = {value: "FAIL"}; diff --git a/js/src/tests/ecma_6/TypedArray/of.js b/js/src/tests/ecma_6/TypedArray/of.js index 9304f624e5f..8fdbe45568f 100644 --- a/js/src/tests/ecma_6/TypedArray/of.js +++ b/js/src/tests/ecma_6/TypedArray/of.js @@ -14,10 +14,10 @@ for (var constructor of constructors) { assertEq(constructor.of.length, 0); assertDeepEq(Object.getOwnPropertyDescriptor(constructor.__proto__, "of"), { - configurable: true, - enumerable: false, value: constructor.of, - writable: true + writable: true, + enumerable: false, + configurable: true }); // Basic tests. From 270fbaef215b62dae6121bd4706aef7bc19b67a0 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Fri, 1 May 2015 16:26:10 +0100 Subject: [PATCH 12/58] Bug 1159714 - Templatise AutoVectorRooter implementation r=terrence --- dom/base/nsJSEnvironment.h | 4 +- js/public/Class.h | 4 +- js/src/NamespaceImports.h | 24 ++--- js/src/ds/IdValuePair.h | 4 +- js/src/gc/RootMarking.cpp | 12 +-- js/src/jsapi.h | 107 +++++++---------------- js/src/jscntxt.h | 41 +-------- js/src/jscompartment.h | 4 +- js/src/jsobj.h | 2 +- js/src/jsobjinlines.h | 13 +-- js/src/jspubtd.h | 17 +++- js/src/vm/String.h | 6 +- js/xpconnect/wrappers/FilteringWrapper.h | 4 +- 13 files changed, 82 insertions(+), 160 deletions(-) diff --git a/dom/base/nsJSEnvironment.h b/dom/base/nsJSEnvironment.h index 4f2dfadf923..d3fd773d8e8 100644 --- a/dom/base/nsJSEnvironment.h +++ b/dom/base/nsJSEnvironment.h @@ -22,7 +22,9 @@ class nsICycleCollectorListener; class nsScriptNameSpaceManager; namespace JS { -class AutoValueVector; +template +class AutoVectorRooter; +typedef AutoVectorRooter AutoValueVector; } namespace mozilla { diff --git a/js/public/Class.h b/js/public/Class.h index f900e68901a..e29ff0a91b2 100644 --- a/js/public/Class.h +++ b/js/public/Class.h @@ -42,7 +42,9 @@ extern JS_FRIEND_DATA(const js::Class* const) FunctionClassPtr; namespace JS { -class AutoIdVector; +template +class AutoVectorRooter; +typedef AutoVectorRooter AutoIdVector; /* * Per ES6, the [[DefineOwnProperty]] internal method has three different diff --git a/js/src/NamespaceImports.h b/js/src/NamespaceImports.h index 84e0a0e494a..8a792a692a0 100644 --- a/js/src/NamespaceImports.h +++ b/js/src/NamespaceImports.h @@ -28,11 +28,13 @@ class TwoByteCharsZ; class UTF8Chars; class UTF8CharsZ; -class AutoFunctionVector; -class AutoIdVector; -class AutoObjectVector; -class AutoScriptVector; -class AutoValueVector; +template +class AutoVectorRooter; +typedef AutoVectorRooter AutoValueVector; +typedef AutoVectorRooter AutoIdVector; +typedef AutoVectorRooter AutoObjectVector; +typedef AutoVectorRooter AutoFunctionVector; +typedef AutoVectorRooter AutoVector; class AutoIdArray; @@ -75,17 +77,17 @@ using JS::TwoByteCharsZ; using JS::UTF8Chars; using JS::UTF8CharsZ; -using JS::AutoFunctionVector; -using JS::AutoIdVector; -using JS::AutoObjectVector; -using JS::AutoScriptVector; -using JS::AutoValueVector; +using JS::AutoVectorRooter; +typedef AutoVectorRooter AutoValueVector; +typedef AutoVectorRooter AutoIdVector; +typedef AutoVectorRooter AutoObjectVector; +typedef AutoVectorRooter AutoFunctionVector; +typedef AutoVectorRooter AutoScriptVector; using JS::AutoIdArray; using JS::AutoHashMapRooter; using JS::AutoHashSetRooter; -using JS::AutoVectorRooter; using JS::RootedGeneric; using JS::CallArgs; diff --git a/js/src/ds/IdValuePair.h b/js/src/ds/IdValuePair.h index 2fa220d6930..2ac9b59f30e 100644 --- a/js/src/ds/IdValuePair.h +++ b/js/src/ds/IdValuePair.h @@ -30,12 +30,12 @@ struct IdValuePair {} }; -class MOZ_STACK_CLASS AutoIdValueVector : public AutoVectorRooter +class MOZ_STACK_CLASS AutoIdValueVector : public JS::AutoVectorRooterBase { public: explicit AutoIdValueVector(ContextFriendFields* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, IDVALVECTOR) + : AutoVectorRooterBase(cx, IDVALVECTOR) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; } diff --git a/js/src/gc/RootMarking.cpp b/js/src/gc/RootMarking.cpp index 331dd8670b4..a9f685ea896 100644 --- a/js/src/gc/RootMarking.cpp +++ b/js/src/gc/RootMarking.cpp @@ -151,13 +151,13 @@ AutoGCRooter::trace(JSTracer* trc) case VALVECTOR: { AutoValueVector::VectorImpl& vector = static_cast(this)->vector; - TraceRootRange(trc, vector.length(), vector.begin(), "js::AutoValueVector.vector"); + TraceRootRange(trc, vector.length(), vector.begin(), "JS::AutoValueVector.vector"); return; } case IDVECTOR: { AutoIdVector::VectorImpl& vector = static_cast(this)->vector; - TraceRootRange(trc, vector.length(), vector.begin(), "js::AutoIdVector.vector"); + TraceRootRange(trc, vector.length(), vector.begin(), "JS::AutoIdVector.vector"); return; } @@ -179,13 +179,7 @@ AutoGCRooter::trace(JSTracer* trc) case OBJVECTOR: { AutoObjectVector::VectorImpl& vector = static_cast(this)->vector; - TraceRootRange(trc, vector.length(), vector.begin(), "js::AutoObjectVector.vector"); - return; - } - - case FUNVECTOR: { - AutoFunctionVector::VectorImpl& vector = static_cast(this)->vector; - TraceRootRange(trc, vector.length(), vector.begin(), "js::AutoFunctionVector.vector"); + TraceRootRange(trc, vector.length(), vector.begin(), "JS::AutoObjectVector.vector"); return; } diff --git a/js/src/jsapi.h b/js/src/jsapi.h index bb4b419113c..854770ca944 100644 --- a/js/src/jsapi.h +++ b/js/src/jsapi.h @@ -94,20 +94,20 @@ class AutoValueArray : public AutoGCRooter }; template -class AutoVectorRooter : protected AutoGCRooter +class AutoVectorRooterBase : protected AutoGCRooter { typedef js::Vector VectorImpl; VectorImpl vector; public: - explicit AutoVectorRooter(JSContext* cx, ptrdiff_t tag + explicit AutoVectorRooterBase(JSContext* cx, ptrdiff_t tag MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : AutoGCRooter(cx, tag), vector(cx) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; } - explicit AutoVectorRooter(js::ContextFriendFields* cx, ptrdiff_t tag + explicit AutoVectorRooterBase(js::ContextFriendFields* cx, ptrdiff_t tag MOZ_GUARD_OBJECT_NOTIFIER_PARAM) : AutoGCRooter(cx, tag), vector(cx) { @@ -123,7 +123,7 @@ class AutoVectorRooter : protected AutoGCRooter bool append(const T& v) { return vector.append(v); } bool appendN(const T& v, size_t len) { return vector.appendN(v, len); } bool append(const T* ptr, size_t len) { return vector.append(ptr, len); } - bool appendAll(const AutoVectorRooter& other) { + bool appendAll(const AutoVectorRooterBase& other) { return vector.appendAll(other.vector); } @@ -190,6 +190,33 @@ class AutoVectorRooter : protected AutoGCRooter MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; +template +class MOZ_STACK_CLASS AutoVectorRooter : public AutoVectorRooterBase +{ + public: + explicit AutoVectorRooter(JSContext* cx + MOZ_GUARD_OBJECT_NOTIFIER_PARAM) + : AutoVectorRooterBase(cx, this->GetTag(T())) + { + MOZ_GUARD_OBJECT_NOTIFIER_INIT; + } + + explicit AutoVectorRooter(js::ContextFriendFields* cx + MOZ_GUARD_OBJECT_NOTIFIER_PARAM) + : AutoVectorRooterBase(cx, this->GetTag(T())) + { + MOZ_GUARD_OBJECT_NOTIFIER_INIT; + } + + MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER +}; + +typedef AutoVectorRooter AutoValueVector; +typedef AutoVectorRooter AutoIdVector; +typedef AutoVectorRooter AutoObjectVector; +typedef AutoVectorRooter AutoFunctionVector; +typedef AutoVectorRooter AutoScriptVector; + template class AutoHashMapRooter : protected AutoGCRooter { @@ -423,78 +450,6 @@ class AutoHashSetRooter : protected AutoGCRooter MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER }; -class MOZ_STACK_CLASS AutoValueVector : public AutoVectorRooter -{ - public: - explicit AutoValueVector(JSContext* cx - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, VALVECTOR) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - } - - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER -}; - -class AutoIdVector : public AutoVectorRooter -{ - public: - explicit AutoIdVector(JSContext* cx - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, IDVECTOR) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - } - - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER -}; - -class AutoObjectVector : public AutoVectorRooter -{ - public: - explicit AutoObjectVector(JSContext* cx - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, OBJVECTOR) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - } - - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER -}; - -class AutoFunctionVector : public AutoVectorRooter -{ - public: - explicit AutoFunctionVector(JSContext* cx - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, FUNVECTOR) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - } - - explicit AutoFunctionVector(js::ContextFriendFields* cx - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, FUNVECTOR) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - } - - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER -}; - -class AutoScriptVector : public AutoVectorRooter -{ - public: - explicit AutoScriptVector(JSContext* cx - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, SCRIPTVECTOR) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - } - - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER -}; - /* * Custom rooting behavior for internal and external clients. */ diff --git a/js/src/jscntxt.h b/js/src/jscntxt.h index 9b35f9b21b0..68faa7a2d2e 100644 --- a/js/src/jscntxt.h +++ b/js/src/jscntxt.h @@ -659,44 +659,9 @@ CheckForInterrupt(JSContext* cx) /************************************************************************/ -class AutoStringVector : public AutoVectorRooter -{ - public: - explicit AutoStringVector(JSContext* cx - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, STRINGVECTOR) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - } - - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER -}; - -class AutoPropertyNameVector : public AutoVectorRooter -{ - public: - explicit AutoPropertyNameVector(JSContext* cx - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, STRINGVECTOR) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - } - - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER -}; - -class AutoShapeVector : public AutoVectorRooter -{ - public: - explicit AutoShapeVector(JSContext* cx - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, SHAPEVECTOR) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - } - - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER -}; +typedef JS::AutoVectorRooter AutoStringVector; +typedef JS::AutoVectorRooter AutoPropertyNameVector; +typedef JS::AutoVectorRooter AutoShapeVector; class AutoObjectObjectHashMap : public AutoHashMapRooter { diff --git a/js/src/jscompartment.h b/js/src/jscompartment.h index efe69ee9c97..29716759bcc 100644 --- a/js/src/jscompartment.h +++ b/js/src/jscompartment.h @@ -731,12 +731,12 @@ struct WrapperValue Value value; }; -class AutoWrapperVector : public AutoVectorRooter +class AutoWrapperVector : public JS::AutoVectorRooterBase { public: explicit AutoWrapperVector(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, WRAPVECTOR) + : AutoVectorRooterBase(cx, WRAPVECTOR) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; } diff --git a/js/src/jsobj.h b/js/src/jsobj.h index 46b4972efed..35828e5e9af 100644 --- a/js/src/jsobj.h +++ b/js/src/jsobj.h @@ -33,7 +33,7 @@ struct ClassInfo; namespace js { -class AutoPropertyDescriptorVector; +typedef AutoVectorRooter AutoPropertyDescriptorVector; class GCMarker; class Nursery; diff --git a/js/src/jsobjinlines.h b/js/src/jsobjinlines.h index bbbcaf31578..4c81c0cc004 100644 --- a/js/src/jsobjinlines.h +++ b/js/src/jsobjinlines.h @@ -571,18 +571,7 @@ IsInternalFunctionObject(JSObject* funobj) return fun->isLambda() && fun->isInterpreted() && !fun->environment(); } -class AutoPropertyDescriptorVector : public AutoVectorRooter -{ - public: - explicit AutoPropertyDescriptorVector(JSContext* cx - MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, DESCVECTOR) - { - MOZ_GUARD_OBJECT_NOTIFIER_INIT; - } - - MOZ_DECL_USE_GUARD_OBJECT_NOTIFIER -}; +typedef AutoVectorRooter AutoPropertyDescriptorVector; /* * Make an object with the specified prototype. If parent is null, it will diff --git a/js/src/jspubtd.h b/js/src/jspubtd.h index 86a2a95196e..4783b6407fb 100644 --- a/js/src/jspubtd.h +++ b/js/src/jspubtd.h @@ -26,7 +26,9 @@ namespace JS { -class AutoIdVector; +template +class AutoVectorRooter; +typedef AutoVectorRooter AutoIdVector; class CallArgs; template @@ -37,12 +39,14 @@ class JS_FRIEND_API(ReadOnlyCompileOptions); class JS_FRIEND_API(OwningCompileOptions); class JS_PUBLIC_API(CompartmentOptions); +class Value; struct Zone; } /* namespace JS */ namespace js { struct ContextFriendFields; +class Shape; } // namespace js /* @@ -265,10 +269,17 @@ class JS_PUBLIC_API(AutoGCRooter) OBJU32HASHMAP=-23, /* js::AutoObjectUnsigned32HashMap */ OBJHASHSET = -24, /* js::AutoObjectHashSet */ JSONPARSER = -25, /* js::JSONParser */ - CUSTOM = -26, /* js::CustomAutoRooter */ - FUNVECTOR = -27 /* js::AutoFunctionVector */ + CUSTOM = -26 /* js::CustomAutoRooter */ }; + static ptrdiff_t GetTag(const Value& value) { return VALVECTOR; } + static ptrdiff_t GetTag(const jsid& id) { return IDVECTOR; } + static ptrdiff_t GetTag(JSObject* obj) { return OBJVECTOR; } + static ptrdiff_t GetTag(JSScript* script) { return SCRIPTVECTOR; } + static ptrdiff_t GetTag(JSString* string) { return STRINGVECTOR; } + static ptrdiff_t GetTag(js::Shape* shape) { return SHAPEVECTOR; } + static ptrdiff_t GetTag(const JSPropertyDescriptor& pd) { return DESCVECTOR; } + private: AutoGCRooter ** const stackTop; diff --git a/js/src/vm/String.h b/js/src/vm/String.h index ee14eef9b1a..3ffd1805c22 100644 --- a/js/src/vm/String.h +++ b/js/src/vm/String.h @@ -1132,13 +1132,13 @@ NameToId(PropertyName* name) return NON_INTEGER_ATOM_TO_JSID(name); } -class AutoNameVector : public AutoVectorRooter +class AutoNameVector : public JS::AutoVectorRooterBase { - typedef AutoVectorRooter BaseType; + typedef AutoVectorRooterBase BaseType; public: explicit AutoNameVector(JSContext* cx MOZ_GUARD_OBJECT_NOTIFIER_PARAM) - : AutoVectorRooter(cx, NAMEVECTOR) + : AutoVectorRooterBase(cx, NAMEVECTOR) { MOZ_GUARD_OBJECT_NOTIFIER_INIT; } diff --git a/js/xpconnect/wrappers/FilteringWrapper.h b/js/xpconnect/wrappers/FilteringWrapper.h index 4e078fe0daa..20bdfc5831a 100644 --- a/js/xpconnect/wrappers/FilteringWrapper.h +++ b/js/xpconnect/wrappers/FilteringWrapper.h @@ -15,7 +15,9 @@ struct JSPropertyDescriptor; namespace JS { -class AutoIdVector; +template +class AutoVectorRooter; +typedef AutoVectorRooter AutoIdVector; } namespace xpc { From 0d79eaae5da5dd826947aaa6eae08e9258078006 Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Fri, 1 May 2015 16:26:10 +0100 Subject: [PATCH 13/58] Bug 1155618 - Fix some places where OOM errors are not reported to the context r=terrence --- js/src/gc/Allocator.cpp | 5 ++++- js/src/jscompartment.cpp | 27 ++++++++++++++++++--------- js/src/jscompartment.h | 2 +- js/src/jsgc.cpp | 4 +++- js/src/jsiter.cpp | 7 +++++-- js/src/jsiter.h | 2 +- js/src/jsscript.cpp | 4 +++- js/src/vm/CharacterEncoding.cpp | 4 +++- js/src/vm/ObjectGroup.cpp | 10 ++++++++-- js/src/vm/RegExpObject.cpp | 3 +++ js/src/vm/Runtime-inl.h | 5 ++++- js/src/vm/Shape.cpp | 8 ++++++-- js/src/vm/Stack-inl.h | 4 +++- 13 files changed, 62 insertions(+), 23 deletions(-) diff --git a/js/src/gc/Allocator.cpp b/js/src/gc/Allocator.cpp index b3f137f4e58..9fbef0430bd 100644 --- a/js/src/gc/Allocator.cpp +++ b/js/src/gc/Allocator.cpp @@ -72,7 +72,10 @@ GCRuntime::checkAllocatorState(JSContext* cx, AllocKind kind) // For testing out of memory conditions if (js::oom::ShouldFailWithOOM()) { - ReportOutOfMemory(cx); + // If we are doing a fallible allocation, percolate up the OOM + // instead of reporting it. + if (allowGC) + ReportOutOfMemory(cx); return false; } diff --git a/js/src/jscompartment.cpp b/js/src/jscompartment.cpp index b1e318db970..f1f967005e8 100644 --- a/js/src/jscompartment.cpp +++ b/js/src/jscompartment.cpp @@ -101,29 +101,38 @@ JSCompartment::~JSCompartment() } bool -JSCompartment::init(JSContext* cx) +JSCompartment::init(JSContext* maybecx) { /* + * maybecx is null when called to create the atoms compartment from + * JSRuntime::init(). + * * As a hack, we clear our timezone cache every time we create a new * compartment. This ensures that the cache is always relatively fresh, but * shouldn't interfere with benchmarks which create tons of date objects * (unless they also create tons of iframes, which seems unlikely). */ - if (cx) - cx->runtime()->dateTimeInfo.updateTimeZoneAdjustment(); + if (maybecx) + maybecx->runtime()->dateTimeInfo.updateTimeZoneAdjustment(); - if (!crossCompartmentWrappers.init(0)) + if (!crossCompartmentWrappers.init(0)) { + if (maybecx) + ReportOutOfMemory(maybecx); + return false; + } + + if (!regExps.init(maybecx)) return false; - if (!regExps.init(cx)) - return false; - - enumerators = NativeIterator::allocateSentinel(cx); + enumerators = NativeIterator::allocateSentinel(maybecx); if (!enumerators) return false; - if (!savedStacks_.init()) + if (!savedStacks_.init()) { + if (maybecx) + ReportOutOfMemory(maybecx); return false; + } return true; } diff --git a/js/src/jscompartment.h b/js/src/jscompartment.h index 29716759bcc..30db3b28865 100644 --- a/js/src/jscompartment.h +++ b/js/src/jscompartment.h @@ -377,7 +377,7 @@ struct JSCompartment JSCompartment(JS::Zone* zone, const JS::CompartmentOptions& options); ~JSCompartment(); - bool init(JSContext* cx); + bool init(JSContext* maybecx); /* Mark cross-compartment wrappers. */ void markCrossCompartmentWrappers(JSTracer* trc); diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index 238862a2c92..d191f94dc1c 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -6456,8 +6456,10 @@ js::NewCompartment(JSContext* cx, Zone* zone, JSPrincipals* principals, const JSPrincipals* trusted = rt->trustedPrincipals(); bool isSystem = principals && principals == trusted; - if (!zone->init(isSystem)) + if (!zone->init(isSystem)) { + ReportOutOfMemory(cx); return nullptr; + } } ScopedJSDeletePtr compartment(cx->new_(zone, options)); diff --git a/js/src/jsiter.cpp b/js/src/jsiter.cpp index 041958b7f08..f29551c3c40 100644 --- a/js/src/jsiter.cpp +++ b/js/src/jsiter.cpp @@ -543,11 +543,14 @@ NativeIterator::allocateIterator(JSContext* cx, uint32_t slength, const AutoIdVe } NativeIterator* -NativeIterator::allocateSentinel(JSContext* cx) +NativeIterator::allocateSentinel(JSContext* maybecx) { NativeIterator* ni = js_pod_malloc(); - if (!ni) + if (!ni) { + if (maybecx) + ReportOutOfMemory(maybecx); return nullptr; + } PodZero(ni); diff --git a/js/src/jsiter.h b/js/src/jsiter.h index cbd64c67d4d..32e72982e24 100644 --- a/js/src/jsiter.h +++ b/js/src/jsiter.h @@ -102,7 +102,7 @@ struct NativeIterator prev_ = nullptr; } - static NativeIterator* allocateSentinel(JSContext* cx); + static NativeIterator* allocateSentinel(JSContext* maybecx); static NativeIterator* allocateIterator(JSContext* cx, uint32_t slength, const js::AutoIdVector& props); void init(JSObject* obj, JSObject* iterObj, unsigned flags, uint32_t slength, uint32_t key); diff --git a/js/src/jsscript.cpp b/js/src/jsscript.cpp index 50ae5c412fc..2e11e1238c8 100644 --- a/js/src/jsscript.cpp +++ b/js/src/jsscript.cpp @@ -1592,8 +1592,10 @@ ScriptSource::chars(JSContext* cx, UncompressedSourceCache::AutoHoldEntry& holde const size_t nbytes = sizeof(char16_t) * (length_ + 1); char16_t* decompressed = static_cast(js_malloc(nbytes)); - if (!decompressed) + if (!decompressed) { + JS_ReportOutOfMemory(cx); return nullptr; + } if (!DecompressString((const unsigned char*) compressedData(), compressedBytes(), reinterpret_cast(decompressed), nbytes)) { diff --git a/js/src/vm/CharacterEncoding.cpp b/js/src/vm/CharacterEncoding.cpp index 1ffaf8e0455..8f021edd521 100644 --- a/js/src/vm/CharacterEncoding.cpp +++ b/js/src/vm/CharacterEncoding.cpp @@ -340,8 +340,10 @@ InflateUTF8StringHelper(JSContext* cx, const UTF8Chars src, CountAction countAct return TwoByteCharsZ(); char16_t* dst = cx->pod_malloc(*outlen + 1); // +1 for NUL - if (!dst) + if (!dst) { + ReportOutOfMemory(cx); return TwoByteCharsZ(); + } if (isAscii) { size_t srclen = src.length(); diff --git a/js/src/vm/ObjectGroup.cpp b/js/src/vm/ObjectGroup.cpp index e7918fa8cc6..77522d83a62 100644 --- a/js/src/vm/ObjectGroup.cpp +++ b/js/src/vm/ObjectGroup.cpp @@ -473,6 +473,7 @@ ObjectGroup::defaultNewGroup(ExclusiveContext* cx, const Class* clasp, if (!table || !table->init()) { js_delete(table); table = nullptr; + ReportOutOfMemory(cx); return nullptr; } } @@ -524,8 +525,10 @@ ObjectGroup::defaultNewGroup(ExclusiveContext* cx, const Class* clasp, if (!group) return nullptr; - if (!table->add(p, ObjectGroupCompartment::NewEntry(group, associated))) + if (!table->add(p, ObjectGroupCompartment::NewEntry(group, associated))) { + ReportOutOfMemory(cx); return nullptr; + } ObjectGroupCompartment::newTablePostBarrier(cx, table, clasp, proto, associated); @@ -581,6 +584,7 @@ ObjectGroup::lazySingletonGroup(ExclusiveContext* cx, const Class* clasp, Tagged if (!table) { table = cx->new_(); if (!table || !table->init()) { + ReportOutOfMemory(cx); js_delete(table); table = nullptr; return nullptr; @@ -605,8 +609,10 @@ ObjectGroup::lazySingletonGroup(ExclusiveContext* cx, const Class* clasp, Tagged if (!group) return nullptr; - if (!table->add(p, ObjectGroupCompartment::NewEntry(group, nullptr))) + if (!table->add(p, ObjectGroupCompartment::NewEntry(group, nullptr))) { + ReportOutOfMemory(cx); return nullptr; + } ObjectGroupCompartment::newTablePostBarrier(cx, table, clasp, proto, nullptr); diff --git a/js/src/vm/RegExpObject.cpp b/js/src/vm/RegExpObject.cpp index e50ff21c6ec..ba23f4fd238 100644 --- a/js/src/vm/RegExpObject.cpp +++ b/js/src/vm/RegExpObject.cpp @@ -900,6 +900,9 @@ RegExpCompartment::init(JSContext* cx) void RegExpCompartment::sweep(JSRuntime* rt) { + if (!set_.initialized()) + return; + for (Set::Enum e(set_); !e.empty(); e.popFront()) { RegExpShared* shared = e.front(); diff --git a/js/src/vm/Runtime-inl.h b/js/src/vm/Runtime-inl.h index af11943dbad..894eb4aae75 100644 --- a/js/src/vm/Runtime-inl.h +++ b/js/src/vm/Runtime-inl.h @@ -60,8 +60,11 @@ NewObjectCache::newObjectFromHit(JSContext* cx, EntryIndex entryIndex, gc::Initi NativeObject* obj = static_cast(Allocate(cx, entry->kind, 0, heap, group->clasp())); - if (!obj) + if (!obj) { + // It's expected that this can return nullptr. + cx->recoverFromOutOfMemory(); return nullptr; + } copyCachedToObject(obj, templateObj, entry->kind); diff --git a/js/src/vm/Shape.cpp b/js/src/vm/Shape.cpp index 777b7e8ef65..40b10a05422 100644 --- a/js/src/vm/Shape.cpp +++ b/js/src/vm/Shape.cpp @@ -1247,8 +1247,10 @@ BaseShape::getUnowned(ExclusiveContext* cx, StackBaseShape& base) { BaseShapeSet& table = cx->compartment()->baseShapes; - if (!table.initialized() && !table.init()) + if (!table.initialized() && !table.init()) { + ReportOutOfMemory(cx); return nullptr; + } DependentAddPtr p(cx, table, base); if (p) @@ -1480,8 +1482,10 @@ EmptyShape::getInitialShape(ExclusiveContext* cx, const Class* clasp, TaggedProt InitialShapeSet& table = cx->compartment()->initialShapes; - if (!table.initialized() && !table.init()) + if (!table.initialized() && !table.init()) { + ReportOutOfMemory(cx); return nullptr; + } typedef InitialShapeEntry::Lookup Lookup; DependentAddPtr diff --git a/js/src/vm/Stack-inl.h b/js/src/vm/Stack-inl.h index ae6b6f58a23..f899e4937eb 100644 --- a/js/src/vm/Stack-inl.h +++ b/js/src/vm/Stack-inl.h @@ -263,8 +263,10 @@ InterpreterStack::allocateFrame(JSContext* cx, size_t size) } uint8_t* buffer = reinterpret_cast(allocator_.alloc(size)); - if (!buffer) + if (!buffer) { + ReportOutOfMemory(cx); return nullptr; + } frameCount_++; return buffer; From 01ae8d28d8ba5078026c637e3a8a7dd28a0dff4e Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Fri, 1 May 2015 16:26:10 +0100 Subject: [PATCH 14/58] Bug 1155618 - Fix places where OOM errors are not reported to the context in js::DependentAddPtr r=terrence --- js/src/jshashutil.h | 8 ++++++-- js/src/vm/Debugger.cpp | 16 ++++------------ js/src/vm/ObjectGroup.cpp | 3 ++- js/src/vm/SavedStacks.cpp | 4 +--- 4 files changed, 13 insertions(+), 18 deletions(-) diff --git a/js/src/jshashutil.h b/js/src/jshashutil.h index e26f31d5108..a7e9a151455 100644 --- a/js/src/jshashutil.h +++ b/js/src/jshashutil.h @@ -31,11 +31,15 @@ struct DependentAddPtr {} template - bool add(const ExclusiveContext* cx, T& table, const KeyInput& key, const ValueInput& value) { + bool add(ExclusiveContext* cx, T& table, const KeyInput& key, const ValueInput& value) { bool gcHappened = originalGcNumber != cx->zone()->gcNumber(); if (gcHappened) addPtr = table.lookupForAdd(key); - return table.relookupOrAdd(addPtr, key, value); + if (!table.relookupOrAdd(addPtr, key, value)) { + ReportOutOfMemory(cx); + return false; + } + return true; } diff --git a/js/src/vm/Debugger.cpp b/js/src/vm/Debugger.cpp index 17509dd6d22..b04944b19dc 100644 --- a/js/src/vm/Debugger.cpp +++ b/js/src/vm/Debugger.cpp @@ -788,10 +788,8 @@ Debugger::wrapEnvironment(JSContext* cx, Handle env, MutableHandleValue rv return false; envobj->setPrivateGCThing(env); envobj->setReservedSlot(JSSLOT_DEBUGENV_OWNER, ObjectValue(*object)); - if (!p.add(cx, environments, env, envobj)) { - ReportOutOfMemory(cx); + if (!p.add(cx, environments, env, envobj)) return false; - } CrossCompartmentKey key(CrossCompartmentKey::DebuggerEnvironment, object, env); if (!object->compartment()->putWrapper(cx, key, ObjectValue(*envobj))) { @@ -832,10 +830,8 @@ Debugger::wrapDebuggeeValue(JSContext* cx, MutableHandleValue vp) dobj->setPrivateGCThing(obj); dobj->setReservedSlot(JSSLOT_DEBUGOBJECT_OWNER, ObjectValue(*object)); - if (!p.add(cx, objects, obj, dobj)) { - ReportOutOfMemory(cx); + if (!p.add(cx, objects, obj, dobj)) return false; - } if (obj->compartment() != object->compartment()) { CrossCompartmentKey key(CrossCompartmentKey::DebuggerObject, object, obj); @@ -4349,10 +4345,8 @@ Debugger::wrapScript(JSContext* cx, HandleScript script) if (!scriptobj) return nullptr; - if (!p.add(cx, scripts, script, scriptobj)) { - ReportOutOfMemory(cx); + if (!p.add(cx, scripts, script, scriptobj)) return nullptr; - } CrossCompartmentKey key(CrossCompartmentKey::DebuggerScript, object, script); if (!object->compartment()->putWrapper(cx, key, ObjectValue(*scriptobj))) { @@ -5370,10 +5364,8 @@ Debugger::wrapSource(JSContext* cx, HandleScriptSource source) if (!sourceobj) return nullptr; - if (!p.add(cx, sources, source, sourceobj)) { - ReportOutOfMemory(cx); + if (!p.add(cx, sources, source, sourceobj)) return nullptr; - } CrossCompartmentKey key(CrossCompartmentKey::DebuggerSource, object, source); if (!object->compartment()->putWrapper(cx, key, ObjectValue(*sourceobj))) { diff --git a/js/src/vm/ObjectGroup.cpp b/js/src/vm/ObjectGroup.cpp index 77522d83a62..9e47dc52b26 100644 --- a/js/src/vm/ObjectGroup.cpp +++ b/js/src/vm/ObjectGroup.cpp @@ -843,7 +843,8 @@ ObjectGroup::setGroupToHomogenousArray(ExclusiveContext* cx, JSObject* obj, AddTypePropertyId(cx, group, nullptr, JSID_VOID, elementType); key.proto = objProto; - (void) p.add(cx, *table, key, group); + if (!p.add(cx, *table, key, group)) + cx->recoverFromOutOfMemory(); } } diff --git a/js/src/vm/SavedStacks.cpp b/js/src/vm/SavedStacks.cpp index 573ee09b8cd..a8f9da0a733 100644 --- a/js/src/vm/SavedStacks.cpp +++ b/js/src/vm/SavedStacks.cpp @@ -1037,10 +1037,8 @@ SavedStacks::getOrCreateSavedFrame(JSContext* cx, SavedFrame::HandleLookup looku if (!frame) return nullptr; - if (!p.add(cx, frames, lookupInstance, frame)) { - ReportOutOfMemory(cx); + if (!p.add(cx, frames, lookupInstance, frame)) return nullptr; - } return frame; } From 77fbad3ef58f17e34c7a24b27bbf0d347c76ae3b Mon Sep 17 00:00:00 2001 From: Jon Coppeard Date: Fri, 1 May 2015 16:26:11 +0100 Subject: [PATCH 15/58] Bug 1155618 - Fix tracelogger destructor that touches possibly uninitialised hash table r=benj --- js/src/vm/TraceLogging.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/src/vm/TraceLogging.cpp b/js/src/vm/TraceLogging.cpp index af31192cf6b..a9609ac6aa4 100644 --- a/js/src/vm/TraceLogging.cpp +++ b/js/src/vm/TraceLogging.cpp @@ -185,10 +185,10 @@ TraceLoggerThread::~TraceLoggerThread() graph = nullptr; } - for (TextIdHashMap::Range r = extraTextId.all(); !r.empty(); r.popFront()) - js_delete(r.front().value()); - extraTextId.finish(); - pointerMap.finish(); + if (extraTextId.initialized()) { + for (TextIdHashMap::Range r = extraTextId.all(); !r.empty(); r.popFront()) + js_delete(r.front().value()); + } } bool From 2434616787e529c02e533e7a674fd2026dea044e Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Thu, 23 Apr 2015 01:25:00 -0400 Subject: [PATCH 16/58] Bug 1154478 - Rename gfxPrefs::LayoutEventRegionsEnabled to LayoutEventRegionsEnabledDoNotUseDirectly. r=kats --- gfx/thebes/gfxPrefs.h | 2 +- layout/base/nsDisplayList.h | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/gfx/thebes/gfxPrefs.h b/gfx/thebes/gfxPrefs.h index 2319074128e..c9020cfa7d8 100644 --- a/gfx/thebes/gfxPrefs.h +++ b/gfx/thebes/gfxPrefs.h @@ -343,7 +343,7 @@ private: DECL_GFX_PREF(Live, "layout.css.scroll-snap.prediction-sensitivity", ScrollSnapPredictionSensitivity, float, 0.750f); DECL_GFX_PREF(Once, "layout.css.touch_action.enabled", TouchActionEnabled, bool, false); DECL_GFX_PREF(Live, "layout.display-list.dump", LayoutDumpDisplayList, bool, false); - DECL_GFX_PREF(Live, "layout.event-regions.enabled", LayoutEventRegionsEnabled, bool, false); + DECL_GFX_PREF(Live, "layout.event-regions.enabled", LayoutEventRegionsEnabledDoNotUseDirectly, bool, false); DECL_GFX_PREF(Once, "layout.frame_rate", LayoutFrameRate, int32_t, -1); DECL_GFX_PREF(Once, "layout.paint_rects_separately", LayoutPaintRectsSeparately, bool, true); diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 25b5e61d2cd..2046ccbb775 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -347,7 +347,9 @@ public: bool IsBuildingLayerEventRegions() { if (mMode == PAINTING) { - return (gfxPrefs::LayoutEventRegionsEnabled() || + // Note: this is the only place that gets to query LayoutEventRegionsEnabled + // 'directly' - other code should call this function. + return (gfxPrefs::LayoutEventRegionsEnabledDoNotUseDirectly() || gfxPrefs::AsyncPanZoomEnabled()); } return false; From 8e117d2818b0bfcb4707b7ad6bed6cd1250a5fb0 Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Fri, 1 May 2015 11:40:52 -0400 Subject: [PATCH 17/58] Bug 1159971 re-enable altsvc r=hurley --- modules/libpref/init/all.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 54e23192a0b..73ffea40f52 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1335,8 +1335,8 @@ pref("network.http.spdy.default-concurrent", 100); // alt-svc allows separation of transport routing from // the origin host without using a proxy. -pref("network.http.altsvc.enabled", false); -pref("network.http.altsvc.oe", false); +pref("network.http.altsvc.enabled", true); +pref("network.http.altsvc.oe", true); pref("network.http.diagnostics", false); From 5af84baf2f3a1baddcc19cb29c553d4340d7bdcb Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 1 May 2015 11:42:37 -0400 Subject: [PATCH 18/58] Bug 1159742. Get rid of the pref annotation from test_interfaces, since it basically corresponds to disabling the test. r=jst --- .../mochitest/general/test_interfaces.html | 33 ++++++------ .../test_serviceworker_interfaces.js | 52 +++++++----------- dom/workers/test/test_worker_interfaces.js | 54 ++++++++----------- 3 files changed, 58 insertions(+), 81 deletions(-) diff --git a/dom/tests/mochitest/general/test_interfaces.html b/dom/tests/mochitest/general/test_interfaces.html index f9dc582b4e4..21ad5985a52 100644 --- a/dom/tests/mochitest/general/test_interfaces.html +++ b/dom/tests/mochitest/general/test_interfaces.html @@ -923,7 +923,7 @@ var interfaceNamesInGlobalScope = // IMPORTANT: Do not change this list without review from a DOM peer! "SettingsManager", // IMPORTANT: Do not change this list without review from a DOM peer! - {name: "ShadowRoot", pref: "dom.webcomponents.enabled"}, + "ShadowRoot", // Bogus, but the test harness forces it on. See bug 1159768. // IMPORTANT: Do not change this list without review from a DOM peer! "SharedWorker", // IMPORTANT: Do not change this list without review from a DOM peer! @@ -1381,7 +1381,6 @@ var interfaceNamesInGlobalScope = // IMPORTANT: Do not change the list above without review from a DOM peer! function createInterfaceMap(isXBLScope) { - var prefs = SpecialPowers.Services.prefs; var version = SpecialPowers.Cc["@mozilla.org/xre/app-info;1"].getService(SpecialPowers.Ci.nsIXULAppInfo).version; var isNightly = version.endsWith("a1"); var isRelease = !version.includes("a"); @@ -1406,21 +1405,23 @@ function createInterfaceMap(isXBLScope) { for (var entry of interfaces) { if (typeof(entry) === "string") { interfaceMap[entry] = true; - } else if ((entry.nightly === !isNightly) || - (entry.xbl === !isXBLScope) || - (entry.desktop === !isDesktop) || - (entry.b2g === !isB2G) || - (entry.windows === !isWindows) || - (entry.mac === !isMac) || - (entry.linux === !isLinux) || - (entry.android === !isAndroid) || - (entry.release === !isRelease) || - (entry.pref && !prefs.getBoolPref(entry.pref)) || - (entry.permission && !hasPermission(entry.permission)) || - entry.disabled) { - interfaceMap[entry.name] = false; } else { - interfaceMap[entry.name] = true; + ok(!("pref" in entry), "Bogus pref annotation for " + entry.name); + if ((entry.nightly === !isNightly) || + (entry.xbl === !isXBLScope) || + (entry.desktop === !isDesktop) || + (entry.b2g === !isB2G) || + (entry.windows === !isWindows) || + (entry.mac === !isMac) || + (entry.linux === !isLinux) || + (entry.android === !isAndroid) || + (entry.release === !isRelease) || + (entry.permission && !hasPermission(entry.permission)) || + entry.disabled) { + interfaceMap[entry.name] = false; + } else { + interfaceMap[entry.name] = true; + } } } } diff --git a/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js b/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js index 92aeeba4d1c..13caa0baf8a 100644 --- a/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js +++ b/dom/workers/test/serviceworkers/test_serviceworker_interfaces.js @@ -192,7 +192,7 @@ var interfaceNamesInGlobalScope = ]; // IMPORTANT: Do not change the list above without review from a DOM peer! -function createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G) { +function createInterfaceMap(permissionMap, version, userAgent, isB2G) { var isNightly = version.endsWith("a1"); var isRelease = !version.includes("a"); var isDesktop = !/Mobile|Tablet/.test(userAgent); @@ -205,16 +205,18 @@ function createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G) { for (var entry of interfaces) { if (typeof(entry) === "string") { interfaceMap[entry] = true; - } else if ((entry.nightly === !isNightly) || - (entry.desktop === !isDesktop) || - (entry.android === !isAndroid) || - (entry.b2g === !isB2G) || - (entry.release === !isRelease) || - (entry.pref && !prefMap[entry.pref]) || - (entry.permission && !permissionMap[entry.permission])) { - interfaceMap[entry.name] = false; } else { - interfaceMap[entry.name] = true; + ok(!("pref" in entry), "Bogus pref annotation for " + entry.name); + if ((entry.nightly === !isNightly) || + (entry.desktop === !isDesktop) || + (entry.android === !isAndroid) || + (entry.b2g === !isB2G) || + (entry.release === !isRelease) || + (entry.permission && !permissionMap[entry.permission])) { + interfaceMap[entry.name] = false; + } else { + interfaceMap[entry.name] = true; + } } } } @@ -225,8 +227,8 @@ function createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G) { return interfaceMap; } -function runTest(prefMap, permissionMap, version, userAgent, isB2G) { - var interfaceMap = createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G); +function runTest(permissionMap, version, userAgent, isB2G) { + var interfaceMap = createInterfaceMap(permissionMap, version, userAgent, isB2G); for (var name of Object.getOwnPropertyNames(self)) { // An interface name should start with an upper case character. if (!/^[A-Z]/.test(name)) { @@ -249,18 +251,6 @@ function runTest(prefMap, permissionMap, version, userAgent, isB2G) { "The following interface(s) are not enumerated: " + Object.keys(interfaceMap).join(", ")); } -function appendPrefs(prefs, interfaces) { - for (var entry of interfaces) { - if (entry.pref !== undefined && prefs.indexOf(entry.pref) === -1) { - prefs.push(entry.pref); - } - } -} - -var prefs = []; -appendPrefs(prefs, ecmaGlobals); -appendPrefs(prefs, interfaceNamesInGlobalScope); - function appendPermissions(permissions, interfaces) { for (var entry of interfaces) { if (entry.permission !== undefined && @@ -274,14 +264,12 @@ var permissions = []; appendPermissions(permissions, ecmaGlobals); appendPermissions(permissions, interfaceNamesInGlobalScope); -workerTestGetPrefs(prefs, function(prefMap) { - workerTestGetPermissions(permissions, function(permissionMap) { - workerTestGetVersion(function(version) { - workerTestGetUserAgent(function(userAgent) { - workerTestGetIsB2G(function(isB2G) { - runTest(prefMap, permissionMap, version, userAgent, isB2G); - workerTestDone(); - }); +workerTestGetPermissions(permissions, function(permissionMap) { + workerTestGetVersion(function(version) { + workerTestGetUserAgent(function(userAgent) { + workerTestGetIsB2G(function(isB2G) { + runTest(permissionMap, version, userAgent, isB2G); + workerTestDone(); }); }); }); diff --git a/dom/workers/test/test_worker_interfaces.js b/dom/workers/test/test_worker_interfaces.js index e7aa419a45c..01aebda8db8 100644 --- a/dom/workers/test/test_worker_interfaces.js +++ b/dom/workers/test/test_worker_interfaces.js @@ -180,7 +180,7 @@ var interfaceNamesInGlobalScope = ]; // IMPORTANT: Do not change the list above without review from a DOM peer! -function createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G) { +function createInterfaceMap(permissionMap, version, userAgent, isB2G) { var isNightly = version.endsWith("a1"); var isRelease = !version.includes("a"); var isDesktop = !/Mobile|Tablet/.test(userAgent); @@ -193,17 +193,19 @@ function createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G) { for (var entry of interfaces) { if (typeof(entry) === "string") { interfaceMap[entry] = true; - } else if ((entry.nightly === !isNightly) || - (entry.desktop === !isDesktop) || - (entry.android === !isAndroid) || - (entry.b2g === !isB2G) || - (entry.release === !isRelease) || - (entry.pref && !prefMap[entry.pref]) || - (entry.permission && !permissionMap[entry.permission]) || - entry.disabled) { - interfaceMap[entry.name] = false; } else { - interfaceMap[entry.name] = true; + ok(!("pref" in entry), "Bogus pref annotation for " + entry.name); + if ((entry.nightly === !isNightly) || + (entry.desktop === !isDesktop) || + (entry.android === !isAndroid) || + (entry.b2g === !isB2G) || + (entry.release === !isRelease) || + (entry.permission && !permissionMap[entry.permission]) || + entry.disabled) { + interfaceMap[entry.name] = false; + } else { + interfaceMap[entry.name] = true; + } } } } @@ -214,8 +216,8 @@ function createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G) { return interfaceMap; } -function runTest(prefMap, permissionMap, version, userAgent, isB2G) { - var interfaceMap = createInterfaceMap(prefMap, permissionMap, version, userAgent, isB2G); +function runTest(permissionMap, version, userAgent, isB2G) { + var interfaceMap = createInterfaceMap(permissionMap, version, userAgent, isB2G); for (var name of Object.getOwnPropertyNames(self)) { // An interface name should start with an upper case character. if (!/^[A-Z]/.test(name)) { @@ -238,18 +240,6 @@ function runTest(prefMap, permissionMap, version, userAgent, isB2G) { "The following interface(s) are not enumerated: " + Object.keys(interfaceMap).join(", ")); } -function appendPrefs(prefs, interfaces) { - for (var entry of interfaces) { - if (entry.pref !== undefined && prefs.indexOf(entry.pref) === -1) { - prefs.push(entry.pref); - } - } -} - -var prefs = []; -appendPrefs(prefs, ecmaGlobals); -appendPrefs(prefs, interfaceNamesInGlobalScope); - function appendPermissions(permissions, interfaces) { for (var entry of interfaces) { if (entry.permission !== undefined && @@ -263,14 +253,12 @@ var permissions = []; appendPermissions(permissions, ecmaGlobals); appendPermissions(permissions, interfaceNamesInGlobalScope); -workerTestGetPrefs(prefs, function(prefMap) { - workerTestGetPermissions(permissions, function(permissionMap) { - workerTestGetVersion(function(version) { - workerTestGetUserAgent(function(userAgent) { - workerTestGetIsB2G(function(isB2G) { - runTest(prefMap, permissionMap, version, userAgent, isB2G); - workerTestDone(); - }); +workerTestGetPermissions(permissions, function(permissionMap) { + workerTestGetVersion(function(version) { + workerTestGetUserAgent(function(userAgent) { + workerTestGetIsB2G(function(isB2G) { + runTest(permissionMap, version, userAgent, isB2G); + workerTestDone(); }); }); }); From 6d087372476791812785afedad69c2bebf34ca0c Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 1 May 2015 11:42:37 -0400 Subject: [PATCH 19/58] Bug 1160215. Get rid of the now-unused workerTestGetPrefs bits. r=bkelly --- .../test/serviceworkers/serviceworker_wrapper.js | 15 --------------- dom/workers/test/worker_driver.js | 12 ------------ dom/workers/test/worker_wrapper.js | 15 --------------- 3 files changed, 42 deletions(-) diff --git a/dom/workers/test/serviceworkers/serviceworker_wrapper.js b/dom/workers/test/serviceworkers/serviceworker_wrapper.js index 31845094893..afc08cfb003 100644 --- a/dom/workers/test/serviceworkers/serviceworker_wrapper.js +++ b/dom/workers/test/serviceworkers/serviceworker_wrapper.js @@ -31,21 +31,6 @@ function workerTestDone() { client.postMessage({ type: 'finish' }); } -function workerTestGetPrefs(prefs, cb) { - addEventListener('message', function workerTestGetPrefsCB(e) { - if (e.data.type != 'returnPrefs' || - !workerTestArrayEquals(prefs, e.data.prefs)) { - return; - } - removeEventListener('message', workerTestGetPrefsCB); - cb(e.data.result); - }); - client.postMessage({ - type: 'getPrefs', - prefs: prefs - }); -} - function workerTestGetPermissions(permissions, cb) { addEventListener('message', function workerTestGetPermissionsCB(e) { if (e.data.type != 'returnPermissions' || diff --git a/dom/workers/test/worker_driver.js b/dom/workers/test/worker_driver.js index 810e2549885..ff2782b6b6e 100644 --- a/dom/workers/test/worker_driver.js +++ b/dom/workers/test/worker_driver.js @@ -19,7 +19,6 @@ // There are also some functions for requesting information that requires // SpecialPowers or other main-thread-only resources: // -// workerTestGetPrefs() - request an array of prefs value from the main thread // workerTestGetPermissions() - request an array permissions from the MT // workerTestGetVersion() - request the current version string from the MT // workerTestGetUserAgent() - request the user agent string from the MT @@ -37,17 +36,6 @@ function workerTestExec(script) { } else if (event.data.type == 'status') { ok(event.data.status, event.data.msg); - } else if (event.data.type == 'getPrefs') { - var result = {}; - event.data.prefs.forEach(function(pref) { - result[pref] = SpecialPowers.Services.prefs.getBoolPref(pref); - }); - worker.postMessage({ - type: 'returnPrefs', - prefs: event.data.prefs, - result: result - }); - } else if (event.data.type == 'getPermissions') { var result = {}; event.data.permissions.forEach(function(permission) { diff --git a/dom/workers/test/worker_wrapper.js b/dom/workers/test/worker_wrapper.js index 9077a4dc2bd..4f1acd2df2b 100644 --- a/dom/workers/test/worker_wrapper.js +++ b/dom/workers/test/worker_wrapper.js @@ -30,21 +30,6 @@ function workerTestDone() { postMessage({ type: 'finish' }); } -function workerTestGetPrefs(prefs, cb) { - addEventListener('message', function workerTestGetPrefsCB(e) { - if (e.data.type != 'returnPrefs' || - !workerTestArrayEquals(prefs, e.data.prefs)) { - return; - } - removeEventListener('message', workerTestGetPrefsCB); - cb(e.data.result); - }); - postMessage({ - type: 'getPrefs', - prefs: prefs - }); -} - function workerTestGetPermissions(permissions, cb) { addEventListener('message', function workerTestGetPermissionsCB(e) { if (e.data.type != 'returnPermissions' || From a833e024356038d823ff7cd822b7320c617f4802 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Thu, 30 Apr 2015 23:06:35 -0400 Subject: [PATCH 20/58] Bug 947753 - Make test_drawWindow_widget_layers.html wait for the opened window to be visible. r=dbaron Without this change, the test would fail because OMTC windows on OS X refuse to composite until they're visible. --- .../chrome/test_drawWindow_widget_layers.html | 18 +++++++++++------- dom/canvas/test/file_drawWindow_common.js | 5 +++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/dom/canvas/test/chrome/test_drawWindow_widget_layers.html b/dom/canvas/test/chrome/test_drawWindow_widget_layers.html index 9ff1f9f873d..a1f357f5a74 100644 --- a/dom/canvas/test/chrome/test_drawWindow_widget_layers.html +++ b/dom/canvas/test/chrome/test_drawWindow_widget_layers.html @@ -19,18 +19,22 @@ return; } + // Add a little bottom padding to the window so that we don't capture the + // rounded corners at the bottom, which our GL drawing code on OS X draws + // for regular windows. + // (The reftest framework doesn't have this problem because it doesn't use + // a regular window with a titlebar, so there are no rounded corners.) + const WINDOW_INNER_WIDTH = CANVAS_WIDTH; + const WINDOW_INNER_HEIGHT = CANVAS_HEIGHT + 10; + // Need to open as a toplevel chrome window so that // DRAWWINDOW_USE_WIDGET_LAYERS is honored. sourceWindow = window.open("file_drawWindow_source.html", "", - "chrome,width=200,height=100"); - sourceWindow.addEventListener("load", runTests, false); + `chrome,width=${WINDOW_INNER_WIDTH},height=${WINDOW_INNER_HEIGHT}`); + SimpleTest.waitForFocus(runTests, sourceWindow); } - function runTests(event) { - if (event.target != sourceWindow.document) { - return; - } - + function runTests() { var cxInterfaceWrap = SpecialPowers.wrap(CanvasRenderingContext2D); var flags = cxInterfaceWrap.DRAWWINDOW_USE_WIDGET_LAYERS | cxInterfaceWrap.DRAWWINDOW_DRAW_CARET | diff --git a/dom/canvas/test/file_drawWindow_common.js b/dom/canvas/test/file_drawWindow_common.js index 822b499a0f9..2f4c385d3a5 100644 --- a/dom/canvas/test/file_drawWindow_common.js +++ b/dom/canvas/test/file_drawWindow_common.js @@ -1,6 +1,7 @@ +const CANVAS_WIDTH = 200; +const CANVAS_HEIGHT = 100; + function runDrawWindowTests(win, drawWindowFlags, transparentBackground) { - const CANVAS_WIDTH = 200; - const CANVAS_HEIGHT = 100; function make_canvas() { var canvas = document.createElement("canvas"); From 83c0ef806e23b0c8f6d6707a9e559106eafed934 Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Wed, 22 Apr 2015 17:13:45 -0400 Subject: [PATCH 21/58] Bug 947753 - Make sure nsChildView::ComputeShouldAccelerate returns true even if it's called before layout lets the window know about whether it's transparent. r=smichaud --- widget/cocoa/nsCocoaWindow.mm | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/widget/cocoa/nsCocoaWindow.mm b/widget/cocoa/nsCocoaWindow.mm index 35ec62c0505..5d125d7cd5c 100644 --- a/widget/cocoa/nsCocoaWindow.mm +++ b/widget/cocoa/nsCocoaWindow.mm @@ -456,20 +456,19 @@ nsresult nsCocoaWindow::CreateNativeWindow(const NSRect &aRect, if (mWindowType == eWindowType_invisible) { [mWindow setLevel:kCGDesktopWindowLevelKey]; - } else if (mWindowType == eWindowType_popup) { - SetPopupWindowLevel(); - [mWindow setHasShadow:YES]; } - [mWindow setBackgroundColor:[NSColor clearColor]]; -#ifdef MOZ_B2G - // In B2G, we don't create popups and we need OMTC to work (because out of - // process compositing depends on it). Therefore, we don't need our windows - // to be transparent. - [mWindow setOpaque:YES]; -#else - [mWindow setOpaque:NO]; -#endif + if (mWindowType == eWindowType_popup) { + SetPopupWindowLevel(); + [mWindow setHasShadow:YES]; + [mWindow setBackgroundColor:[NSColor clearColor]]; + [mWindow setOpaque:NO]; + } else { + // Make sure that regular windows are opaque from the start, so that + // nsChildView::ComputeShouldAccelerate returns true for them. + [mWindow setOpaque:YES]; + } + [mWindow setContentMinSize:NSMakeSize(60, 60)]; [mWindow disableCursorRects]; From ada362c2c69528170240de35093ad5e86cae5d23 Mon Sep 17 00:00:00 2001 From: "L. David Baron" Date: Thu, 16 Apr 2015 18:36:29 -0700 Subject: [PATCH 22/58] Bug 947753 / Bug 1122526 - Don't claim to support off-main-thread animations when the nearest widget is not using OMT compositing. r=birtles This moves the test for whether off-main-thread compositor is enabled *earlier* in CanPerformOnCompositorThread, since CanAnimatePropertyOnCompositor is called only from CanPerformOnCompositorThread. This change means we're using a more accurate test for whether we actually have off-main-thread compositing than the pref, since in some cases we won't use off-main-thread compositing for certain widgets (e.g., transparent widgets on Windows) even when the pref is enabled. --- layout/style/AnimationCommon.cpp | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/layout/style/AnimationCommon.cpp b/layout/style/AnimationCommon.cpp index 4bb8c9ce3d4..0d12186c380 100644 --- a/layout/style/AnimationCommon.cpp +++ b/layout/style/AnimationCommon.cpp @@ -506,15 +506,6 @@ AnimationCollection::CanAnimatePropertyOnCompositor( CanAnimateFlags aFlags) { bool shouldLog = nsLayoutUtils::IsAnimationLoggingEnabled(); - if (!gfxPlatform::OffMainThreadCompositingEnabled()) { - if (shouldLog) { - nsCString message; - message.AppendLiteral("Performance warning: Compositor disabled"); - LogAsyncAnimationFailure(message); - } - return false; - } - nsIFrame* frame = nsLayoutUtils::GetStyleFrame(aElement); if (IsGeometricProperty(aProperty)) { if (shouldLog) { @@ -582,6 +573,19 @@ AnimationCollection::CanPerformOnCompositorThread( return false; } + nsIWidget* widget = frame->GetNearestWidget(); + if (!widget || + widget->GetLayerManager()->GetBackendType() != + layers::LayersBackend::LAYERS_CLIENT) { + // No widget (huh?), or a widget not using off-main-thread compositor. + if (nsLayoutUtils::IsAnimationLoggingEnabled()) { + nsCString message; + message.AppendLiteral("Performance warning: Compositor disabled"); + LogAsyncAnimationFailure(message); + } + return false; + } + if (mElementProperty != nsGkAtoms::transitionsProperty && mElementProperty != nsGkAtoms::animationsProperty) { if (nsLayoutUtils::IsAnimationLoggingEnabled()) { From 4f43742e9b76b11df4816ffee904e08fd9e422df Mon Sep 17 00:00:00 2001 From: Markus Stange Date: Thu, 30 Apr 2015 14:54:48 -0400 Subject: [PATCH 23/58] Bug 1147194 - Do scroll info layer hoisting when building the display list. r=tn --- layout/base/FrameLayerBuilder.cpp | 98 +---------------------------- layout/base/FrameLayerBuilder.h | 10 +-- layout/base/nsDisplayList.cpp | 52 ++++++++++----- layout/base/nsDisplayList.h | 22 +++++-- layout/generic/nsFrame.cpp | 6 ++ layout/generic/nsGfxScrollFrame.cpp | 32 +++++----- 6 files changed, 78 insertions(+), 142 deletions(-) diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index f2ea7889047..eb909854cca 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -546,7 +546,6 @@ struct NewLayerEntry { // This rect is in the layer's own coordinate space. The computed visible // region for the layer cannot extend beyond this rect. nsIntRect mLayerContentsVisibleRect; - nsTArray mScrollInfoItems; bool mHideAllLayersBelow; // When mOpaqueForAnimatedGeometryRootParent is true, the opaque region of // this layer is opaque in the same position even subject to the animation of @@ -919,11 +918,6 @@ public: CollectOldLayers(); } - ~ContainerState() - { - MOZ_ASSERT(mHoistedItems.IsEmpty()); - } - /** * This is the method that actually walks a display list and builds * the child layers. @@ -1001,16 +995,6 @@ public: const nsIntRegion& aOuterVisibleRegion, const nsIntRect* aLayerContentsVisibleRect = nullptr) const; - void AddHoistedItem(nsDisplayScrollInfoLayer* aItem) - { - mHoistedItems.AppendElement(aItem); - } - - void AddHoistedItems(const nsTArray& aItems) - { - mHoistedItems.AppendElements(aItems); - } - /** * Try to determine whether the PaintedLayer aData has a single opaque color * covering aRect. If successful, return that color, otherwise return @@ -1221,11 +1205,6 @@ protected: nscoord mAppUnitsPerDevPixel; bool mSnappingEnabled; bool mFlattenToSingleLayer; - /** - * In some cases we need to hoist nsDisplayScrollInfoLayer items out from a - * nested inactive container. This holds the items hoisted up from children. - */ - nsTArray mHoistedItems; }; class PaintedDisplayItemLayerUserData : public LayerUserData @@ -1394,7 +1373,7 @@ FrameLayerBuilder::Shutdown() void FrameLayerBuilder::Init(nsDisplayListBuilder* aBuilder, LayerManager* aManager, - PaintedLayerData* aLayerData, ContainerState* aContainingContainerState) + PaintedLayerData* aLayerData) { mDisplayListBuilder = aBuilder; mRootPresContext = aBuilder->RootReferenceFrame()->PresContext()->GetRootPresContext(); @@ -1402,7 +1381,6 @@ FrameLayerBuilder::Init(nsDisplayListBuilder* aBuilder, LayerManager* aManager, mInitialDOMGeneration = mRootPresContext->GetDOMGeneration(); } mContainingPaintedLayer = aLayerData; - mContainingContainerState = aContainingContainerState; aManager->SetUserData(&gLayerManagerLayerBuilder, this); } @@ -2824,8 +2802,6 @@ void ContainerState::FinishPaintedLayerData(PaintedLayerData& aData, FindOpaqueB mNewChildLayers[data->mNewChildLayersIndex].mLayer = paintedLayer.forget(); } - MOZ_ASSERT(mHoistedItems.IsEmpty()); - for (auto& item : data->mAssignedDisplayItems) { MOZ_ASSERT(item.mItem->GetType() != nsDisplayItem::TYPE_LAYER_EVENT_REGIONS); @@ -2836,8 +2812,6 @@ void ContainerState::FinishPaintedLayerData(PaintedLayerData& aData, FindOpaqueB } NewLayerEntry* newLayerEntry = &mNewChildLayers[data->mNewChildLayersIndex]; - newLayerEntry->mScrollInfoItems.SwapElements(mHoistedItems); - nsRefPtr layer; nsRefPtr imageContainer = data->CanOptimizeImageLayer(mBuilder); @@ -3460,21 +3434,6 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList) } } - nsDisplayItem::Type itemType = item->GetType(); - if (itemType == nsDisplayItem::TYPE_SCROLL_INFO_LAYER && - mLayerBuilder->GetContainingContainerState()) { - // We have encountered a scrollable area inside a nested (inactive) - // layer manager, so we need to hoist the item out into the parent; that - // way we will still generate a scrollinfo layer for it and the APZ can - // drive main-thread sync scrolling. - // Note: |item| is removed from aList and will be attached into the parent - // list, so we don't delete it here. - nsDisplayScrollInfoLayer* scrollInfoItem = static_cast(item); - scrollInfoItem->MarkHoisted(); - mLayerBuilder->GetContainingContainerState()->AddHoistedItem(scrollInfoItem); - continue; - } - nsDisplayList* itemSameCoordinateSystemChildren = item->GetSameCoordinateSystemChildren(); if (item->ShouldFlattenAway(mBuilder)) { @@ -3494,6 +3453,7 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList) bool snap; nsRect itemContent = item->GetBounds(mBuilder, &snap); + nsDisplayItem::Type itemType = item->GetType(); if (itemType == nsDisplayItem::TYPE_LAYER_EVENT_REGIONS) { nsDisplayLayerEventRegions* eventRegions = static_cast(item); @@ -3986,7 +3946,7 @@ FrameLayerBuilder::AddPaintedDisplayItem(PaintedLayerData* aLayerData, if (tempManager) { FLB_LOG_PAINTED_LAYER_DECISION(aLayerData, "Creating nested FLB for item %p\n", aItem); FrameLayerBuilder* layerBuilder = new FrameLayerBuilder(); - layerBuilder->Init(mDisplayListBuilder, tempManager, aLayerData, &aContainerState); + layerBuilder->Init(mDisplayListBuilder, tempManager, aLayerData); tempManager->BeginTransaction(); if (mRetainingManager) { @@ -4412,58 +4372,6 @@ ContainerState::Finish(uint32_t* aTextContentFlags, LayerManagerData* aData, mContainerLayer->RepositionChild(layer, prevChild); } } - - ContainerState* containingContainerState = mLayerBuilder->GetContainingContainerState(); - if (containingContainerState) { - containingContainerState->AddHoistedItems(mNewChildLayers[i].mScrollInfoItems); - } else { - // Build layers for all mNewChildLayers[i].mScrollInfoItems and insert - // them after layer. - for (nsDisplayScrollInfoLayer* item : mNewChildLayers[i].mScrollInfoItems) { - LayerState layerState = item->GetLayerState(mBuilder, mManager, mParameters); - MOZ_ASSERT(layerState == LAYER_ACTIVE_EMPTY); - nsRefPtr scrollInfoLayer = item->BuildLayer(mBuilder, mManager, mParameters); - if (!scrollInfoLayer) { - item->~nsDisplayScrollInfoLayer(); - continue; - } - - mLayerBuilder->AddLayerDisplayItem(scrollInfoLayer, item, layerState, - nsPoint(), nullptr); - - const nsIFrame* animatedGeometryRoot = - nsLayoutUtils::GetAnimatedGeometryRootFor(item, mBuilder, mManager); - bool shouldFixToViewport = !animatedGeometryRoot->GetParent() && - item->ShouldFixToViewport(mManager); - const nsIFrame* fixedPosFrame = - FindFixedPosFrameForLayerData(animatedGeometryRoot, shouldFixToViewport); - - NewLayerEntry scrollInfoLayerEntry; - scrollInfoLayerEntry.mLayer = scrollInfoLayer; - scrollInfoLayerEntry.mAnimatedGeometryRoot = animatedGeometryRoot; - scrollInfoLayerEntry.mFixedPosFrameForLayerData = fixedPosFrame; - scrollInfoLayerEntry.mOpaqueForAnimatedGeometryRootParent = false; - scrollInfoLayerEntry.mBaseFrameMetrics = - item->ComputeFrameMetrics(scrollInfoLayer, mParameters); - SetupScrollingMetadata(&scrollInfoLayerEntry); - - if (!scrollInfoLayer->GetParent()) { - // This is not currently a child of the container, so just add it - // now. - mContainerLayer->InsertAfter(scrollInfoLayer, layer); - } else { - NS_ASSERTION(scrollInfoLayer->GetParent() == mContainerLayer, - "scrollInfoLayer shouldn't be the child of some other container"); - if (scrollInfoLayer->GetPrevSibling() != layer) { - mContainerLayer->RepositionChild(scrollInfoLayer, layer); - } - } - - layer = scrollInfoLayer; - item->~nsDisplayScrollInfoLayer(); - } - mNewChildLayers[i].mScrollInfoItems.Clear(); - } } // Remove old layers that have become unused. diff --git a/layout/base/FrameLayerBuilder.h b/layout/base/FrameLayerBuilder.h index fd204e7c145..cc0cd0effb6 100644 --- a/layout/base/FrameLayerBuilder.h +++ b/layout/base/FrameLayerBuilder.h @@ -190,8 +190,7 @@ public: static void Shutdown(); void Init(nsDisplayListBuilder* aBuilder, LayerManager* aManager, - PaintedLayerData* aLayerData = nullptr, - ContainerState* aContainingContainerState = nullptr); + PaintedLayerData* aLayerData = nullptr); /** * Call this to notify that we have just started a transaction on the @@ -672,11 +671,6 @@ public: return !mContainingPaintedLayer && mRetainingManager; } - ContainerState* GetContainingContainerState() - { - return mContainingContainerState; - } - /** * Attempt to build the most compressed layer tree possible, even if it means * throwing away existing retained buffers. @@ -728,8 +722,6 @@ protected: */ PaintedLayerData* mContainingPaintedLayer; - ContainerState* mContainingContainerState; - /** * Saved generation counter so we can detect DOM changes. */ diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index bd0943ce035..b8af6acbc4e 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -601,10 +601,12 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame, mWillChangeBudgetCalculated(false), mDirtyRect(-1,-1,-1,-1), mGlassDisplayItem(nullptr), + mScrollInfoItemsForHoisting(nullptr), mMode(aMode), mCurrentScrollParentId(FrameMetrics::NULL_SCROLL_ID), mCurrentScrollbarTarget(FrameMetrics::NULL_SCROLL_ID), mCurrentScrollbarFlags(0), + mSVGEffectsBuildingDepth(0), mBuildCaret(aBuildCaret), mIgnoreSuppression(false), mHadToIgnoreSuppression(false), @@ -1217,6 +1219,37 @@ nsDisplayListBuilder::IsInWillChangeBudget(nsIFrame* aFrame) const { return onBudget; } +void +nsDisplayListBuilder::EnterSVGEffectsContents(nsDisplayList* aHoistedItemsStorage) +{ + MOZ_ASSERT(mSVGEffectsBuildingDepth >= 0); + MOZ_ASSERT(aHoistedItemsStorage); + if (mSVGEffectsBuildingDepth == 0) { + MOZ_ASSERT(!mScrollInfoItemsForHoisting); + mScrollInfoItemsForHoisting = aHoistedItemsStorage; + } + mSVGEffectsBuildingDepth++; +} + +void +nsDisplayListBuilder::ExitSVGEffectsContents() +{ + mSVGEffectsBuildingDepth--; + MOZ_ASSERT(mSVGEffectsBuildingDepth >= 0); + MOZ_ASSERT(mScrollInfoItemsForHoisting); + if (mSVGEffectsBuildingDepth == 0) { + mScrollInfoItemsForHoisting = nullptr; + } +} + +void +nsDisplayListBuilder::AppendNewScrollInfoItemForHoisting(nsDisplayScrollInfoLayer* aScrollInfoItem) +{ + MOZ_ASSERT(ShouldBuildScrollInfoItemsForHoisting()); + MOZ_ASSERT(mScrollInfoItemsForHoisting); + mScrollInfoItemsForHoisting->AppendNewToTop(aScrollInfoItem); +} + void nsDisplayListSet::MoveTo(const nsDisplayListSet& aDestination) const { aDestination.BorderBackground()->AppendToTop(BorderBackground()); @@ -4303,7 +4336,6 @@ nsDisplayScrollInfoLayer::nsDisplayScrollInfoLayer( , mScrollFrame(aScrollFrame) , mScrolledFrame(aScrolledFrame) , mScrollParentId(aBuilder->GetCurrentScrollParentId()) - , mHoisted(false) { #ifdef NS_BUILD_REFCNT_LOGGING MOZ_COUNT_CTOR(nsDisplayScrollInfoLayer); @@ -4325,11 +4357,7 @@ nsDisplayScrollInfoLayer::BuildLayer(nsDisplayListBuilder* aBuilder, // In general for APZ with event-regions we no longer have a need for // scrollinfo layers. However, in some cases, there might be content that // cannot be layerized, and so needs to scroll synchronously. To handle those - // cases (which are indicated by setting mHoisted to true), we still want to - // generate scrollinfo layers. - if (!mHoisted) { - return nullptr; - } + // cases, we still want to generate scrollinfo layers. ContainerLayerParameters params = aContainerParameters; if (mScrolledFrame->GetContent() && @@ -4348,17 +4376,7 @@ nsDisplayScrollInfoLayer::GetLayerState(nsDisplayListBuilder* aBuilder, LayerManager* aManager, const ContainerLayerParameters& aParameters) { - // See comment in BuildLayer - return mHoisted - ? LAYER_ACTIVE_EMPTY - : LAYER_NONE; -} - -bool -nsDisplayScrollInfoLayer::ShouldFlattenAway(nsDisplayListBuilder* aBuilder) -{ - // See comment in BuildLayer - return !mHoisted; + return LAYER_ACTIVE_EMPTY; } UniquePtr diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 2046ccbb775..fc2ee283f8d 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -40,6 +40,7 @@ class nsRenderingContext; class nsDisplayTableItem; class nsISelection; class nsDisplayLayerEventRegions; +class nsDisplayScrollInfoLayer; class nsCaret; namespace mozilla { @@ -845,6 +846,14 @@ public: const nsIFrame* aStopAtAncestor, nsIFrame** aOutResult); + void EnterSVGEffectsContents(nsDisplayList* aHoistedItemsStorage); + void ExitSVGEffectsContents(); + + bool ShouldBuildScrollInfoItemsForHoisting() const + { return mSVGEffectsBuildingDepth > 0; } + + void AppendNewScrollInfoItemForHoisting(nsDisplayScrollInfoLayer* aScrollInfoItem); + private: void MarkOutOfFlowFrameForDisplay(nsIFrame* aDirtyFrame, nsIFrame* aFrame, const nsRect& aDirtyRect); @@ -928,12 +937,19 @@ private: nsIntRegion mWindowDraggingRegion; // The display item for the Windows window glass background, if any nsDisplayItem* mGlassDisplayItem; + // A temporary list that we append scroll info items to while building + // display items for the contents of frames with SVG effects. + // Only non-null when ShouldBuildScrollInfoItemsForHoisting() is true. + // This is a pointer and not a real nsDisplayList value because the + // nsDisplayList class is defined below this class, so we can't use it here. + nsDisplayList* mScrollInfoItemsForHoisting; nsTArray mDisplayItemClipsToDestroy; Mode mMode; ViewID mCurrentScrollParentId; ViewID mCurrentScrollbarTarget; uint32_t mCurrentScrollbarFlags; BlendModeSet mContainedBlendModes; + int32_t mSVGEffectsBuildingDepth; bool mBuildCaret; bool mIgnoreSuppression; bool mHadToIgnoreSuppression; @@ -3208,20 +3224,18 @@ public: LayerManager* aManager, const ContainerLayerParameters& aParameters) override; - virtual bool ShouldFlattenAway(nsDisplayListBuilder* aBuilder) override; + virtual bool ShouldFlattenAway(nsDisplayListBuilder* aBuilder) override + { return false; } virtual void WriteDebugInfo(std::stringstream& aStream) override; mozilla::UniquePtr ComputeFrameMetrics(Layer* aLayer, const ContainerLayerParameters& aContainerParameters); - void MarkHoisted() { mHoisted = true; } - protected: nsIFrame* mScrollFrame; nsIFrame* mScrolledFrame; ViewID mScrollParentId; - bool mHoisted; }; /** diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index dd078eff43c..d53391b54a9 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -1990,9 +1990,11 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, bool usingSVGEffects = nsSVGIntegrationUtils::UsingEffectsForFrame(this); nsRect dirtyRectOutsideSVGEffects = dirtyRect; + nsDisplayList hoistedScrollInfoItemsStorage; if (usingSVGEffects) { dirtyRect = nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(this, dirtyRect); + aBuilder->EnterSVGEffectsContents(&hoistedScrollInfoItemsStorage); } bool useOpacity = HasVisualOpacity() && !nsSVGUtils::CanOptimizeOpacity(this); @@ -2126,6 +2128,10 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder, /* List now emptied, so add the new list to the top. */ resultList.AppendNewToTop( new (aBuilder) nsDisplaySVGEffects(aBuilder, this, &resultList)); + // Also add the hoisted scroll info items. We need those for APZ scrolling + // because nsDisplaySVGEffects items can't build active layers. + aBuilder->ExitSVGEffectsContents(); + resultList.AppendToTop(&hoistedScrollInfoItemsStorage); } /* Else, if the list is non-empty and there is CSS group opacity without SVG * effects, wrap it up in an opacity item. diff --git a/layout/generic/nsGfxScrollFrame.cpp b/layout/generic/nsGfxScrollFrame.cpp index 08333e447d3..e4f7b5f6d1e 100644 --- a/layout/generic/nsGfxScrollFrame.cpp +++ b/layout/generic/nsGfxScrollFrame.cpp @@ -3007,26 +3007,24 @@ ScrollFrameHelper::BuildDisplayList(nsDisplayListBuilder* aBuilder, inactiveRegionItem->AddInactiveScrollPort(mScrollPort + aBuilder->ToReferenceFrame(mOuter)); } - // In case we are not using displayport or the nsDisplayScrollLayers are - // flattened during visibility computation, we still need to export the - // metadata about this scroll box to the compositor process. - nsDisplayScrollInfoLayer* layerItem = new (aBuilder) nsDisplayScrollInfoLayer( - aBuilder, mScrolledFrame, mOuter); - - nsDisplayList* positionedDescendants = scrolledContent.PositionedDescendants(); - nsDisplayList* destinationList = nullptr; - int32_t zindex = - MaxZIndexInListOfItemsContainedInFrame(positionedDescendants, mOuter); - if (zindex >= 0) { - layerItem->SetOverrideZIndex(zindex); - destinationList = positionedDescendants; - } else { - destinationList = scrolledContent.Outlines(); - } if (inactiveRegionItem) { + nsDisplayList* positionedDescendants = scrolledContent.PositionedDescendants(); + nsDisplayList* destinationList = nullptr; + int32_t zindex = + MaxZIndexInListOfItemsContainedInFrame(positionedDescendants, mOuter); + if (zindex >= 0) { + destinationList = positionedDescendants; + } else { + destinationList = scrolledContent.Outlines(); + } destinationList->AppendNewToTop(inactiveRegionItem); } - destinationList->AppendNewToTop(layerItem); + + if (aBuilder->ShouldBuildScrollInfoItemsForHoisting()) { + aBuilder->AppendNewScrollInfoItemForHoisting( + new (aBuilder) nsDisplayScrollInfoLayer(aBuilder, mScrolledFrame, + mOuter)); + } } // Now display overlay scrollbars and the resizer, if we have one. AppendScrollPartsTo(aBuilder, aDirtyRect, scrolledContent, usingDisplayport, From 40e53378a401aafe770b5234a710d4901b74255a Mon Sep 17 00:00:00 2001 From: Brian O'Keefe Date: Thu, 23 Apr 2015 18:43:06 -0400 Subject: [PATCH 24/58] Bug 978591 - Remove per-directory uses of MOZ_CHROME_FILE_FORMAT. r=glandium --- python/mozbuild/mozbuild/backend/recursivemake.py | 1 + testing/mochitest/Makefile.in | 1 - testing/specialpowers/Makefile.in | 1 - 3 files changed, 1 insertion(+), 2 deletions(-) diff --git a/python/mozbuild/mozbuild/backend/recursivemake.py b/python/mozbuild/mozbuild/backend/recursivemake.py index 2138e593bad..c64e73914cc 100644 --- a/python/mozbuild/mozbuild/backend/recursivemake.py +++ b/python/mozbuild/mozbuild/backend/recursivemake.py @@ -135,6 +135,7 @@ DEPRECATED_VARIABLES = [ 'MOCHITEST_FILES_PARTS', 'MOCHITEST_METRO_FILES', 'MOCHITEST_ROBOCOP_FILES', + 'MOZ_CHROME_FILE_FORMAT', 'SHORT_LIBNAME', 'TESTING_JS_MODULES', 'TESTING_JS_MODULE_DIR', diff --git a/testing/mochitest/Makefile.in b/testing/mochitest/Makefile.in index 7f30eab97a4..dbba13a599b 100644 --- a/testing/mochitest/Makefile.in +++ b/testing/mochitest/Makefile.in @@ -3,7 +3,6 @@ # 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/. -MOZ_CHROME_FILE_FORMAT = jar _DEST_DIR = $(DEPTH)/_tests/$(relativesrcdir) diff --git a/testing/specialpowers/Makefile.in b/testing/specialpowers/Makefile.in index bc041636c2d..b20132f62ba 100644 --- a/testing/specialpowers/Makefile.in +++ b/testing/specialpowers/Makefile.in @@ -3,7 +3,6 @@ # 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/. -MOZ_CHROME_FILE_FORMAT = flat TEST_EXTENSIONS_DIR = $(DEPTH)/testing/specialpowers From 99dc6ddbede60bae16b5947aa198ed0bdad21b43 Mon Sep 17 00:00:00 2001 From: Andy Pusch Date: Wed, 22 Apr 2015 00:21:00 -0400 Subject: [PATCH 25/58] Bug 1003731 - Removal of transliteration. r=hsivonen IGNORE IDL --- intl/uconv/tests/unit/test_bug365345.js | 52 - intl/uconv/tests/unit/xpcshell.ini | 1 - intl/unicharutil/nsEntityConverter.cpp | 210 +- intl/unicharutil/nsEntityConverter.h | 67 +- intl/unicharutil/nsIEntityConverter.idl | 2 +- .../tables/htmlEntityVersions.properties | 18 - intl/unicharutil/tables/moz.build | 2 - .../tables/transliterate.properties | 2893 ----------------- intl/unicharutil/tests/moz.build | 2 - .../tests/unit/test_bug_427350_1.js | 56 - intl/unicharutil/tests/unit/xpcshell.ini | 2 - widget/nsPrimitiveHelpers.cpp | 44 +- 12 files changed, 119 insertions(+), 3230 deletions(-) delete mode 100644 intl/uconv/tests/unit/test_bug365345.js delete mode 100644 intl/unicharutil/tables/htmlEntityVersions.properties delete mode 100644 intl/unicharutil/tables/transliterate.properties mode change 100644 => 100755 intl/unicharutil/tests/moz.build delete mode 100644 intl/unicharutil/tests/unit/test_bug_427350_1.js mode change 100644 => 100755 intl/unicharutil/tests/unit/xpcshell.ini diff --git a/intl/uconv/tests/unit/test_bug365345.js b/intl/uconv/tests/unit/test_bug365345.js deleted file mode 100644 index 9fb5745c7f2..00000000000 --- a/intl/uconv/tests/unit/test_bug365345.js +++ /dev/null @@ -1,52 +0,0 @@ -/* Tests conversion of unrepresented characters that should be transliterated - * to spaces (bug 365345), and some others from transliterate.properties while - * I'm here - */ - -const inSpace = "Hello Space"; -const inEnSpace = "Hello\u2002EnSpace"; -const inEmSpace = "Hello\u2003EmSpace"; -const inEuro = "Hello\u20ACEuro"; -const inTamil1000 = "Hello\u0BF2Tamil1000"; -const inMonospace9 = "Hello\ud835\udfffMonospace9"; - -const expectedSpace = "Hello Space"; -const expectedEnSpace = "Hello EnSpace"; -const expectedEmSpace = "Hello EmSpace"; -const expectedEuro = "HelloEUREuro"; -const expectedTamil1000 = "Hello[1000]Tamil1000"; -const expectedMonospace9 = "Hello9Monospace9"; - -const EntityAfterCharsetConv = 512; -const transliterate = 8; - -const charset = "ISO-8859-2"; - -function run_test() { - var SaveAsCharset = - Components.Constructor("@mozilla.org/intl/saveascharset;1", - "nsISaveAsCharset", - "Init"); - - var converter = new SaveAsCharset(charset, - EntityAfterCharsetConv, - transliterate); - - var outSpace = converter.Convert(inSpace); - do_check_eq(outSpace, expectedSpace); - - var outEnSpace = converter.Convert(inEnSpace); - do_check_eq(outEnSpace, expectedEnSpace); - - var outEmSpace = converter.Convert(inEmSpace); - do_check_eq(outEmSpace, expectedEmSpace); - - var outEuro = converter.Convert(inEuro); - do_check_eq(outEuro, expectedEuro); - - var outTamil1000 = converter.Convert(inTamil1000); - do_check_eq(outTamil1000, expectedTamil1000); - - var outMonospace9 = converter.Convert(inMonospace9); - do_check_eq(outMonospace9, expectedMonospace9); -} diff --git a/intl/uconv/tests/unit/xpcshell.ini b/intl/uconv/tests/unit/xpcshell.ini index 1bbf53a5980..a7da6a25f46 100644 --- a/intl/uconv/tests/unit/xpcshell.ini +++ b/intl/uconv/tests/unit/xpcshell.ini @@ -14,7 +14,6 @@ support-files = [test_bug317216.js] [test_bug321379.js] [test_bug340714.js] -[test_bug365345.js] [test_bug381412.Big5-HKSCS.js] [test_bug381412.Big5.js] [test_bug381412.euc-kr.js] diff --git a/intl/unicharutil/nsEntityConverter.cpp b/intl/unicharutil/nsEntityConverter.cpp index ad3aaa0f223..94853df7497 100644 --- a/intl/unicharutil/nsEntityConverter.cpp +++ b/intl/unicharutil/nsEntityConverter.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* -*- Mode: C++; 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/. */ @@ -13,137 +13,75 @@ // // implementation methods // -nsEntityConverter::nsEntityConverter() : - mVersionList(nullptr), - mVersionListLength(0) -{ -} +nsEntityConverter::nsEntityConverter() { } -nsEntityConverter::~nsEntityConverter() -{ - if (mVersionList) - delete [] mVersionList; -} - -NS_IMETHODIMP -nsEntityConverter::LoadVersionPropertyFile() -{ - NS_NAMED_LITERAL_CSTRING(url, "resource://gre/res/entityTables/htmlEntityVersions.properties"); - - nsCOMPtr bundleService = - mozilla::services::GetStringBundleService(); - if (!bundleService) - return NS_ERROR_FAILURE; - - nsCOMPtr entities; - nsresult rv = bundleService->CreateBundle(url.get(), getter_AddRefs(entities)); - if (NS_FAILED(rv)) return rv; - - nsresult result; - - nsAutoString key; - nsXPIDLString value; - rv = entities->GetStringFromName(MOZ_UTF16("length"), - getter_Copies(value)); - NS_ASSERTION(NS_SUCCEEDED(rv),"nsEntityConverter: malformed entity table\n"); - if (NS_FAILED(rv)) return rv; - - mVersionListLength = nsAutoString(value).ToInteger(&result); - NS_ASSERTION(32 >= mVersionListLength,"nsEntityConverter: malformed entity table\n"); - if (32 < mVersionListLength) return NS_ERROR_FAILURE; - - mVersionList = new nsEntityVersionList[mVersionListLength]; - if (!mVersionList) return NS_ERROR_OUT_OF_MEMORY; - - for (uint32_t i = 0; i < mVersionListLength && NS_SUCCEEDED(rv); i++) { - key.SetLength(0); - key.AppendInt(i+1, 10); - rv = entities->GetStringFromName(key.get(), getter_Copies(value)); - uint32_t len = value.Length(); - if (kVERSION_STRING_LEN < len) return NS_ERROR_UNEXPECTED; - - memcpy(mVersionList[i].mEntityListName, value.get(), len*sizeof(char16_t)); - mVersionList[i].mEntityListName[len] = 0; - mVersionList[i].mVersion = (1 << i); - } - - return NS_OK; -} - -already_AddRefed -nsEntityConverter::LoadEntityBundle(uint32_t version) -{ - nsAutoCString url(NS_LITERAL_CSTRING("resource://gre/res/entityTables/")); - nsresult rv; - - nsCOMPtr bundleService = - do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); - NS_ENSURE_SUCCESS(rv, nullptr); - - const char16_t *versionName = GetVersionName(version); - NS_ENSURE_TRUE(versionName, nullptr); - - // all property file names are ASCII, like "html40Latin1" so this is safe - LossyAppendUTF16toASCII(versionName, url); - url.AppendLiteral(".properties"); - - nsCOMPtr bundle; - rv = bundleService->CreateBundle(url.get(), getter_AddRefs(bundle)); - NS_ENSURE_SUCCESS(rv, nullptr); - - return bundle.forget(); -} - -const char16_t* -nsEntityConverter:: GetVersionName(uint32_t versionNumber) -{ - for (uint32_t i = 0; i < mVersionListLength; i++) { - if (versionNumber == mVersionList[i].mVersion) - return mVersionList[i].mEntityListName; - } - - return nullptr; -} +nsEntityConverter::~nsEntityConverter() { } nsIStringBundle* nsEntityConverter:: GetVersionBundleInstance(uint32_t versionNumber) { - if (!mVersionList) { - // load the property file which contains available version names - // and generate a list of version/name pair - if (NS_FAILED(LoadVersionPropertyFile())) - return nullptr; - } - - uint32_t i; - for (i = 0; i < mVersionListLength; i++) { - if (versionNumber == mVersionList[i].mVersion) { - if (!mVersionList[i].mEntities) - { // not loaded - // load the property file - mVersionList[i].mEntities = LoadEntityBundle(versionNumber); - NS_ASSERTION(mVersionList[i].mEntities, "LoadEntityBundle failed"); - } - return mVersionList[i].mEntities.get(); + switch(versionNumber){ + case nsIEntityConverter::html40Latin1: + if (!mHTML40Latin1Bundle) { + mHTML40Latin1Bundle = LoadEntityBundle(kHTML40LATIN1); + MOZ_ASSERT(mHTML40Latin1Bundle, "LoadEntityBundle failed"); } + return mHTML40Latin1Bundle; + case nsIEntityConverter::html40Symbols: + if (!mHTML40SymbolsBundle) { + mHTML40SymbolsBundle = LoadEntityBundle(kHTML40SYMBOLS); + MOZ_ASSERT(mHTML40SymbolsBundle, "LoadEntityBundle failed"); + } + return mHTML40SymbolsBundle; + case nsIEntityConverter::html40Special: + if (!mHTML40SpecialBundle) { + mHTML40SpecialBundle = LoadEntityBundle(kHTML40SPECIAL); + MOZ_ASSERT(mHTML40SpecialBundle, "LoadEntityBundle failed"); + } + return mHTML40SpecialBundle; + case nsIEntityConverter::mathml20: + if (!mMathML20Bundle) { + mMathML20Bundle = LoadEntityBundle(kMATHML20); + MOZ_ASSERT(mMathML20Bundle, "LoadEntityBundle failed"); + } + return mMathML20Bundle; + default: + return nullptr; } - - return nullptr; } +already_AddRefed +nsEntityConverter:: LoadEntityBundle(const char *fileName) +{ + NS_ENSURE_TRUE(fileName, nullptr); + + nsAutoCString url("resource://gre/res/entityTables/"); + nsresult rv; + + nsCOMPtr bundleService = + do_GetService(NS_STRINGBUNDLE_CONTRACTID, &rv); + NS_ENSURE_SUCCESS(rv, nullptr); + + url.Append(fileName); + + nsCOMPtr bundle; + rv = bundleService->CreateBundle(url.get(), getter_AddRefs(bundle)); + NS_ENSURE_SUCCESS(rv, nullptr); + + return bundle.forget(); +} // // nsISupports methods // NS_IMPL_ISUPPORTS(nsEntityConverter,nsIEntityConverter) - // // nsIEntityConverter // NS_IMETHODIMP nsEntityConverter::ConvertToEntity(char16_t character, uint32_t entityVersion, char **_retval) -{ +{ return ConvertUTF32ToEntity((uint32_t)character, entityVersion, _retval); } @@ -151,18 +89,22 @@ NS_IMETHODIMP nsEntityConverter::ConvertUTF32ToEntity(uint32_t character, uint32_t entityVersion, char **_retval) { NS_ASSERTION(_retval, "null ptr- _retval"); - if(nullptr == _retval) + if (nullptr == _retval) { return NS_ERROR_NULL_POINTER; + } *_retval = nullptr; for (uint32_t mask = 1, mask2 = 0xFFFFFFFFL; (0!=(entityVersion & mask2)); mask<<=1, mask2<<=1) { - if (0 == (entityVersion & mask)) + if (0 == (entityVersion & mask)) { continue; - nsIStringBundle* entities = GetVersionBundleInstance(entityVersion & mask); - NS_ASSERTION(entities, "Cannot get the property file"); + } - if (!entities) + nsIStringBundle* entities = GetVersionBundleInstance(entityVersion & mask); + NS_ASSERTION(entities, "Cannot get the entity"); + + if (!entities) { continue; + } nsAutoString key(NS_LITERAL_STRING("entity.")); key.AppendInt(character,10); @@ -171,13 +113,10 @@ nsEntityConverter::ConvertUTF32ToEntity(uint32_t character, uint32_t entityVersi nsresult rv = entities->GetStringFromName(key.get(), getter_Copies(value)); if (NS_SUCCEEDED(rv)) { *_retval = ToNewCString(value); - if(nullptr == *_retval) - return NS_ERROR_OUT_OF_MEMORY; - else - return NS_OK; + return NS_OK; } } - return NS_ERROR_ILLEGAL_VALUE; + return NS_ERROR_ILLEGAL_VALUE; } NS_IMETHODIMP @@ -194,30 +133,28 @@ nsEntityConverter::ConvertToEntities(const char16_t *inString, uint32_t entityVe uint32_t len = NS_strlen(inString); for (uint32_t i = 0; i < len; i++) { nsAutoString key(NS_LITERAL_STRING("entity.")); - if (NS_IS_HIGH_SURROGATE(inString[i]) && - i + 2 < len && - NS_IS_LOW_SURROGATE(inString[i + 1])) { + if (NS_IS_HIGH_SURROGATE(inString[i]) && i + 2 < len && NS_IS_LOW_SURROGATE(inString[i + 1])) { key.AppendInt(SURROGATE_TO_UCS4(inString[i], inString[i+1]), 10); ++i; - } - else { + } else { key.AppendInt(inString[i],10); } - + nsXPIDLString value; const char16_t *entity = nullptr; for (uint32_t mask = 1, mask2 = 0xFFFFFFFFL; (0!=(entityVersion & mask2)); mask<<=1, mask2<<=1) { - if (0 == (entityVersion & mask)) - continue; + if (0 == (entityVersion & mask)) { + continue; + } nsIStringBundle* entities = GetVersionBundleInstance(entityVersion & mask); NS_ASSERTION(entities, "Cannot get the property file"); - if (!entities) - continue; + if (!entities) { + continue; + } - nsresult rv = entities->GetStringFromName(key.get(), - getter_Copies(value)); + nsresult rv = entities->GetStringFromName(key.get(), getter_Copies(value)); if (NS_SUCCEEDED(rv)) { entity = value.get(); break; @@ -225,15 +162,12 @@ nsEntityConverter::ConvertToEntities(const char16_t *inString, uint32_t entityVe } if (entity) { outString.Append(entity); - } - else { + } else { outString.Append(&inString[i], 1); } } *_retval = ToNewUnicode(outString); - if (!*_retval) - return NS_ERROR_OUT_OF_MEMORY; return NS_OK; } diff --git a/intl/unicharutil/nsEntityConverter.h b/intl/unicharutil/nsEntityConverter.h index f033d961dfb..cb78d9bfe78 100644 --- a/intl/unicharutil/nsEntityConverter.h +++ b/intl/unicharutil/nsEntityConverter.h @@ -10,59 +10,40 @@ #include "nsIStringBundle.h" #include "nsCOMPtr.h" -#define kVERSION_STRING_LEN 128 - -class nsEntityVersionList -{ -public: - nsEntityVersionList() {} - - uint32_t mVersion; - char16_t mEntityListName[kVERSION_STRING_LEN+1]; - nsCOMPtr mEntities; -}; - class nsEntityConverter: public nsIEntityConverter { public: - - // - // implementation methods - // - nsEntityConverter(); + // + // implementation methods + // + nsEntityConverter(); - // - // nsISupports - // - NS_DECL_ISUPPORTS + // + // nsISupports + // + NS_DECL_ISUPPORTS - // - // nsIEntityConverter - // - NS_IMETHOD ConvertUTF32ToEntity(uint32_t character, uint32_t entityVersion, char **_retval) override; - NS_IMETHOD ConvertToEntity(char16_t character, uint32_t entityVersion, char **_retval) override; - - NS_IMETHOD ConvertToEntities(const char16_t *inString, uint32_t entityVersion, char16_t **_retval) override; + NS_IMETHOD ConvertUTF32ToEntity(uint32_t character, uint32_t entityVersion, char **_retval) override; + NS_IMETHOD ConvertToEntity(char16_t character, uint32_t entityVersion, char **_retval) override; + NS_IMETHOD ConvertToEntities(const char16_t *inString, uint32_t entityVersion, char16_t **_retval) override; protected: + // map version number to a string bundle + nsIStringBundle* GetVersionBundleInstance(uint32_t versionNumber); - // load a version property file and generate a version list (number/name pair) - NS_IMETHOD LoadVersionPropertyFile(); + // load a string bundle file + already_AddRefed LoadEntityBundle(const char *fileName); - // map version number to version string - const char16_t* GetVersionName(uint32_t versionNumber); + const char* kHTML40LATIN1 = "html40Latin1.properties"; + const char* kHTML40SYMBOLS = "html40Symbols.properties"; + const char* kHTML40SPECIAL = "html40Special.properties"; + const char* kMATHML20 = "mathml20.properties"; + nsCOMPtr mHTML40Latin1Bundle; + nsCOMPtr mHTML40SymbolsBundle; + nsCOMPtr mHTML40SpecialBundle; + nsCOMPtr mMathML20Bundle; - // map version number to a string bundle - nsIStringBundle* GetVersionBundleInstance(uint32_t versionNumber); - - // load a string bundle file - already_AddRefed LoadEntityBundle(uint32_t version); - - - nsEntityVersionList *mVersionList; // array of version number/name pairs - uint32_t mVersionListLength; // number of supported versions - - virtual ~nsEntityConverter(); + virtual ~nsEntityConverter(); }; #endif diff --git a/intl/unicharutil/nsIEntityConverter.idl b/intl/unicharutil/nsIEntityConverter.idl index 9424a5c50dc..865ef3dc306 100644 --- a/intl/unicharutil/nsIEntityConverter.idl +++ b/intl/unicharutil/nsIEntityConverter.idl @@ -18,7 +18,7 @@ interface nsIEntityConverter : nsISupports const unsigned long html40Latin1 = 1; const unsigned long html40Symbols = 2; const unsigned long html40Special = 4; // excludes ", &, <, > - const unsigned long transliterate = 8; + const unsigned long transliterate = 8; // Obsolete const unsigned long mathml20 = 16; const unsigned long html32 = html40Latin1; const unsigned long html40 = html40Latin1+html40Symbols+html40Special; diff --git a/intl/unicharutil/tables/htmlEntityVersions.properties b/intl/unicharutil/tables/htmlEntityVersions.properties deleted file mode 100644 index 3690414e933..00000000000 --- a/intl/unicharutil/tables/htmlEntityVersions.properties +++ /dev/null @@ -1,18 +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/. - - -# LOCALIZATION NOTE: FILE -# This file associates internal names of entity lists to integers. -# Do not translate anything in this file - -# list supported versions number/name pair -# length should not be greater than 32 -length=5 -1=html40Latin1 -2=html40Symbols -3=html40Special -4=transliterate -5=mathml20 diff --git a/intl/unicharutil/tables/moz.build b/intl/unicharutil/tables/moz.build index b375b635c7d..56e672850f9 100644 --- a/intl/unicharutil/tables/moz.build +++ b/intl/unicharutil/tables/moz.build @@ -5,12 +5,10 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. RESOURCE_FILES.entityTables = [ - 'htmlEntityVersions.properties', 'html40Latin1.properties', 'html40Symbols.properties', 'html40Special.properties', 'mathml20.properties', - 'transliterate.properties', ] if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'qt': diff --git a/intl/unicharutil/tables/transliterate.properties b/intl/unicharutil/tables/transliterate.properties deleted file mode 100644 index d725d84aa5b..00000000000 --- a/intl/unicharutil/tables/transliterate.properties +++ /dev/null @@ -1,2893 +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/. - -# -# THIS FILE IS GENERATED BY mozilla/intl/unicharutil/tools/gentransliterate.pl -# PLEASE DO NOT MODIFY THIS FILE BY HAND -# -entity.list.name=transliterate -entity.169=(c) -# -# -# Here are the windows-1252 characters from the range 0x80 - 0x9F -# -entity.8364=EUR -entity.8218=, -entity.402=f -entity.8222=" -entity.8224=+ -entity.8225=++ -entity.710=^ -entity.8240=0/00 -entity.8249=< -entity.338=OE -entity.8216=' -entity.8217=' -entity.8220=" -entity.8221=" -entity.8226=. -entity.8211=-- -entity.8212=--- -entity.732=~ -entity.8250=> -entity.339=oe -entity.8192=\u0020 -entity.8193=\u0020 -entity.8208=- -entity.8209=- -entity.8210=- -entity.8213=-- -entity.8203= -entity.8289= -entity.8290= -entity.8518=d -entity.8722=- -entity.1470=- -entity.1472=| -entity.1475=: -entity.1523=' -entity.1524=" -## -## End of hand coded section -## Below are generated from the unicode character database -## -entity.160=\u0020 -entity.170=^(a) -entity.178=^(2) -entity.179=^(3) -entity.185=^(1) -entity.186=^(o) -entity.188=1/4 -entity.189=1/2 -entity.190=3/4 -entity.192=A` -entity.193=A' -entity.194=A^ -entity.195=A~ -entity.196=A" -entity.197=A* -entity.199=C, -entity.200=E` -entity.201=E' -entity.202=E^ -entity.203=E" -entity.204=I` -entity.205=I' -entity.206=I^ -entity.207=I" -entity.209=N~ -entity.210=O` -entity.211=O' -entity.212=O^ -entity.213=O~ -entity.214=O" -entity.217=U` -entity.218=U' -entity.219=U^ -entity.220=U" -entity.221=Y' -entity.224=a` -entity.225=a' -entity.226=a^ -entity.227=a~ -entity.228=a" -entity.229=a* -entity.231=c, -entity.232=e` -entity.233=e' -entity.234=e^ -entity.235=e" -entity.236=i` -entity.237=i' -entity.238=i^ -entity.239=i" -entity.241=n~ -entity.242=o` -entity.243=o' -entity.244=o^ -entity.245=o~ -entity.246=o" -entity.249=u` -entity.250=u' -entity.251=u^ -entity.252=u" -entity.253=y' -entity.255=y" -entity.256=A- -entity.257=a- -entity.258=A( -entity.259=a( -entity.260=A; -entity.261=a; -entity.262=C' -entity.263=c' -entity.264=C^ -entity.265=c^ -entity.266=C. -entity.267=c. -entity.268=C( -entity.269=c( -entity.270=D( -entity.271=d( -entity.274=E- -entity.275=e- -entity.276=E( -entity.277=e( -entity.278=E. -entity.279=e. -entity.280=E; -entity.281=e; -entity.282=E( -entity.283=e( -entity.284=G^ -entity.285=g^ -entity.286=G( -entity.287=g( -entity.288=G. -entity.289=g. -entity.290=G, -entity.291=g, -entity.292=H^ -entity.293=h^ -entity.296=I~ -entity.297=i~ -entity.298=I- -entity.299=i- -entity.300=I( -entity.301=i( -entity.302=I; -entity.303=i; -entity.304=I. -entity.306=IJ -entity.307=ij -entity.308=J^ -entity.309=j^ -entity.310=K, -entity.311=k, -entity.313=L' -entity.314=l' -entity.315=L, -entity.316=l, -entity.317=L( -entity.318=l( -entity.319=L. -entity.320=l. -entity.323=N' -entity.324=n' -entity.325=N, -entity.326=n, -entity.327=N( -entity.328=n( -entity.329='n -entity.332=O- -entity.333=o- -entity.334=O( -entity.335=o( -entity.336=O" -entity.337=o" -entity.340=R' -entity.341=r' -entity.342=R, -entity.343=r, -entity.344=R( -entity.345=r( -entity.346=S' -entity.347=s' -entity.348=S^ -entity.349=s^ -entity.350=S, -entity.351=s, -entity.352=S( -entity.353=s( -entity.354=T, -entity.355=t, -entity.356=T( -entity.357=t( -entity.360=U~ -entity.361=u~ -entity.362=U- -entity.363=u- -entity.364=U( -entity.365=u( -entity.366=U* -entity.367=u* -entity.368=U" -entity.369=u" -entity.370=U; -entity.371=u; -entity.372=W^ -entity.373=w^ -entity.374=Y^ -entity.375=y^ -entity.376=Y" -entity.377=Z' -entity.378=z' -entity.379=Z. -entity.380=z. -entity.381=Z( -entity.382=z( -entity.383=s -entity.416=O+ -entity.417=o+ -entity.431=U+ -entity.432=u+ -entity.452=DZ( -entity.453=Dz( -entity.454=dz( -entity.455=LJ -entity.456=Lj -entity.457=lj -entity.458=NJ -entity.459=Nj -entity.460=nj -entity.461=A( -entity.462=a( -entity.463=I( -entity.464=i( -entity.465=O( -entity.466=o( -entity.467=U( -entity.468=u( -entity.469=U"- -entity.470=u"- -entity.471=U"' -entity.472=u"' -entity.473=U"( -entity.474=u"( -entity.475=U"` -entity.476=u"` -entity.478=A"- -entity.479=a"- -entity.480=A.- -entity.481=a.- -entity.482=AE- -entity.483=ae- -entity.486=G( -entity.487=g( -entity.488=K( -entity.489=k( -entity.490=O; -entity.491=o; -entity.492=O;- -entity.493=o;- -entity.494=EZH( -entity.495=ezh( -entity.496=j( -entity.497=DZ -entity.498=Dz -entity.499=dz -entity.500=G' -entity.501=g' -entity.504=N` -entity.505=n` -entity.506=A*' -entity.507=a*' -entity.508=AE' -entity.509=ae' -entity.510=O/' -entity.511=o/' -entity.512=A`` -entity.513=a`` -entity.514=A( -entity.515=a( -entity.516=E`` -entity.517=e`` -entity.518=E( -entity.519=e( -entity.520=I`` -entity.521=i`` -entity.522=I( -entity.523=i( -entity.524=O`` -entity.525=o`` -entity.526=O( -entity.527=o( -entity.528=R`` -entity.529=r`` -entity.530=R( -entity.531=r( -entity.532=U`` -entity.533=u`` -entity.534=U( -entity.535=u( -entity.536=S, -entity.537=s, -entity.538=T, -entity.539=t, -entity.542=H( -entity.543=h( -entity.550=A. -entity.551=a. -entity.552=E, -entity.553=e, -entity.554=O"- -entity.555=o"- -entity.556=O~- -entity.557=o~- -entity.558=O. -entity.559=o. -entity.560=O.- -entity.561=o.- -entity.562=Y- -entity.563=y- -entity.688=^(h) -entity.690=^(j) -entity.691=^(r) -entity.695=^(w) -entity.696=^(y) -entity.737=^(l) -entity.738=^(s) -entity.739=^(x) -entity.1632=0 -entity.1633=1 -entity.1634=2 -entity.1635=3 -entity.1636=4 -entity.1637=5 -entity.1638=6 -entity.1639=7 -entity.1640=8 -entity.1641=9 -entity.1776=0 -entity.1777=1 -entity.1778=2 -entity.1779=3 -entity.1780=4 -entity.1781=5 -entity.1782=6 -entity.1783=7 -entity.1784=8 -entity.1785=9 -entity.1984=0 -entity.1985=1 -entity.1986=2 -entity.1987=3 -entity.1988=4 -entity.1989=5 -entity.1990=6 -entity.1991=7 -entity.1992=8 -entity.1993=9 -entity.2406=0 -entity.2407=1 -entity.2408=2 -entity.2409=3 -entity.2410=4 -entity.2411=5 -entity.2412=6 -entity.2413=7 -entity.2414=8 -entity.2415=9 -entity.2534=0 -entity.2535=1 -entity.2536=2 -entity.2537=3 -entity.2538=4 -entity.2539=5 -entity.2540=6 -entity.2541=7 -entity.2542=8 -entity.2543=9 -entity.2548=[1/16] -entity.2549=[1/8] -entity.2550=[3/16] -entity.2551=[1/4] -entity.2552=[3/4] -entity.2553=[16] -entity.2662=0 -entity.2663=1 -entity.2664=2 -entity.2665=3 -entity.2666=4 -entity.2667=5 -entity.2668=6 -entity.2669=7 -entity.2670=8 -entity.2671=9 -entity.2790=0 -entity.2791=1 -entity.2792=2 -entity.2793=3 -entity.2794=4 -entity.2795=5 -entity.2796=6 -entity.2797=7 -entity.2798=8 -entity.2799=9 -entity.2918=0 -entity.2919=1 -entity.2920=2 -entity.2921=3 -entity.2922=4 -entity.2923=5 -entity.2924=6 -entity.2925=7 -entity.2926=8 -entity.2927=9 -entity.2930=[1/4] -entity.2931=[1/2] -entity.2932=[3/4] -entity.2933=[1/16] -entity.2934=[1/8] -entity.2935=[3/16] -entity.3046=0 -entity.3047=1 -entity.3048=2 -entity.3049=3 -entity.3050=4 -entity.3051=5 -entity.3052=6 -entity.3053=7 -entity.3054=8 -entity.3055=9 -entity.3056=[10] -entity.3057=[100] -entity.3058=[1000] -entity.3174=0 -entity.3175=1 -entity.3176=2 -entity.3177=3 -entity.3178=4 -entity.3179=5 -entity.3180=6 -entity.3181=7 -entity.3182=8 -entity.3183=9 -entity.3192=[0] -entity.3193=[1] -entity.3194=[2] -entity.3195=[3] -entity.3196=[1] -entity.3197=[2] -entity.3198=[3] -entity.3302=0 -entity.3303=1 -entity.3304=2 -entity.3305=3 -entity.3306=4 -entity.3307=5 -entity.3308=6 -entity.3309=7 -entity.3310=8 -entity.3311=9 -entity.3430=0 -entity.3431=1 -entity.3432=2 -entity.3433=3 -entity.3434=4 -entity.3435=5 -entity.3436=6 -entity.3437=7 -entity.3438=8 -entity.3439=9 -entity.3440=[10] -entity.3441=[100] -entity.3442=[1000] -entity.3443=[1/4] -entity.3444=[1/2] -entity.3445=[3/4] -entity.3558=0 -entity.3559=1 -entity.3560=2 -entity.3561=3 -entity.3562=4 -entity.3563=5 -entity.3564=6 -entity.3565=7 -entity.3566=8 -entity.3567=9 -entity.3664=0 -entity.3665=1 -entity.3666=2 -entity.3667=3 -entity.3668=4 -entity.3669=5 -entity.3670=6 -entity.3671=7 -entity.3672=8 -entity.3673=9 -entity.3792=0 -entity.3793=1 -entity.3794=2 -entity.3795=3 -entity.3796=4 -entity.3797=5 -entity.3798=6 -entity.3799=7 -entity.3800=8 -entity.3801=9 -entity.3872=0 -entity.3873=1 -entity.3874=2 -entity.3875=3 -entity.3876=4 -entity.3877=5 -entity.3878=6 -entity.3879=7 -entity.3880=8 -entity.3881=9 -entity.3882=[1/2] -entity.3883=[3/2] -entity.3884=[5/2] -entity.3885=[7/2] -entity.3886=[9/2] -entity.3887=[11/2] -entity.3888=[13/2] -entity.3889=[15/2] -entity.3890=[17/2] -entity.3891=[-1/2] -entity.4160=0 -entity.4161=1 -entity.4162=2 -entity.4163=3 -entity.4164=4 -entity.4165=5 -entity.4166=6 -entity.4167=7 -entity.4168=8 -entity.4169=9 -entity.4240=0 -entity.4241=1 -entity.4242=2 -entity.4243=3 -entity.4244=4 -entity.4245=5 -entity.4246=6 -entity.4247=7 -entity.4248=8 -entity.4249=9 -entity.4969=[1] -entity.4970=[2] -entity.4971=[3] -entity.4972=[4] -entity.4973=[5] -entity.4974=[6] -entity.4975=[7] -entity.4976=[8] -entity.4977=[9] -entity.4978=[10] -entity.4979=[20] -entity.4980=[30] -entity.4981=[40] -entity.4982=[50] -entity.4983=[60] -entity.4984=[70] -entity.4985=[80] -entity.4986=[90] -entity.4987=[100] -entity.4988=[10000] -entity.5870=[17] -entity.5871=[18] -entity.5872=[19] -entity.6112=0 -entity.6113=1 -entity.6114=2 -entity.6115=3 -entity.6116=4 -entity.6117=5 -entity.6118=6 -entity.6119=7 -entity.6120=8 -entity.6121=9 -entity.6128=[0] -entity.6129=[1] -entity.6130=[2] -entity.6131=[3] -entity.6132=[4] -entity.6133=[5] -entity.6134=[6] -entity.6135=[7] -entity.6136=[8] -entity.6137=[9] -entity.6160=0 -entity.6161=1 -entity.6162=2 -entity.6163=3 -entity.6164=4 -entity.6165=5 -entity.6166=6 -entity.6167=7 -entity.6168=8 -entity.6169=9 -entity.6470=0 -entity.6471=1 -entity.6472=2 -entity.6473=3 -entity.6474=4 -entity.6475=5 -entity.6476=6 -entity.6477=7 -entity.6478=8 -entity.6479=9 -entity.6608=0 -entity.6609=1 -entity.6610=2 -entity.6611=3 -entity.6612=4 -entity.6613=5 -entity.6614=6 -entity.6615=7 -entity.6616=8 -entity.6617=9 -entity.6618=[1] -entity.6784=0 -entity.6785=1 -entity.6786=2 -entity.6787=3 -entity.6788=4 -entity.6789=5 -entity.6790=6 -entity.6791=7 -entity.6792=8 -entity.6793=9 -entity.6800=0 -entity.6801=1 -entity.6802=2 -entity.6803=3 -entity.6804=4 -entity.6805=5 -entity.6806=6 -entity.6807=7 -entity.6808=8 -entity.6809=9 -entity.6992=0 -entity.6993=1 -entity.6994=2 -entity.6995=3 -entity.6996=4 -entity.6997=5 -entity.6998=6 -entity.6999=7 -entity.7000=8 -entity.7001=9 -entity.7088=0 -entity.7089=1 -entity.7090=2 -entity.7091=3 -entity.7092=4 -entity.7093=5 -entity.7094=6 -entity.7095=7 -entity.7096=8 -entity.7097=9 -entity.7232=0 -entity.7233=1 -entity.7234=2 -entity.7235=3 -entity.7236=4 -entity.7237=5 -entity.7238=6 -entity.7239=7 -entity.7240=8 -entity.7241=9 -entity.7248=0 -entity.7249=1 -entity.7250=2 -entity.7251=3 -entity.7252=4 -entity.7253=5 -entity.7254=6 -entity.7255=7 -entity.7256=8 -entity.7257=9 -entity.7468=^(A) -entity.7470=^(B) -entity.7472=^(D) -entity.7473=^(E) -entity.7475=^(G) -entity.7476=^(H) -entity.7477=^(I) -entity.7478=^(J) -entity.7479=^(K) -entity.7480=^(L) -entity.7481=^(M) -entity.7482=^(N) -entity.7484=^(O) -entity.7486=^(P) -entity.7487=^(R) -entity.7488=^(T) -entity.7489=^(U) -entity.7490=^(W) -entity.7491=^(a) -entity.7495=^(b) -entity.7496=^(d) -entity.7497=^(e) -entity.7501=^(g) -entity.7503=^(k) -entity.7504=^(m) -entity.7506=^(o) -entity.7510=^(p) -entity.7511=^(t) -entity.7512=^(u) -entity.7515=^(v) -entity.7522=v(i) -entity.7523=v(r) -entity.7524=v(u) -entity.7525=v(v) -entity.7580=^(c) -entity.7584=^(f) -entity.7611=^(z) -entity.7680=A* -entity.7681=a* -entity.7682=B. -entity.7683=b. -entity.7684=B. -entity.7685=b. -entity.7686=B_ -entity.7687=b_ -entity.7688=C,' -entity.7689=c,' -entity.7690=D. -entity.7691=d. -entity.7692=D. -entity.7693=d. -entity.7694=D_ -entity.7695=d_ -entity.7696=D, -entity.7697=d, -entity.7698=D^ -entity.7699=d^ -entity.7700=E-` -entity.7701=e-` -entity.7702=E-' -entity.7703=e-' -entity.7704=E^ -entity.7705=e^ -entity.7706=E~ -entity.7707=e~ -entity.7708=E,( -entity.7709=e,( -entity.7710=F. -entity.7711=f. -entity.7712=G- -entity.7713=g- -entity.7714=H. -entity.7715=h. -entity.7716=H. -entity.7717=h. -entity.7718=H" -entity.7719=h" -entity.7720=H, -entity.7721=h, -entity.7722=H( -entity.7723=h( -entity.7724=I~ -entity.7725=i~ -entity.7726=I"' -entity.7727=i"' -entity.7728=K' -entity.7729=k' -entity.7730=K. -entity.7731=k. -entity.7732=K_ -entity.7733=k_ -entity.7734=L. -entity.7735=l. -entity.7736=L.- -entity.7737=l.- -entity.7738=L_ -entity.7739=l_ -entity.7740=L^ -entity.7741=l^ -entity.7742=M' -entity.7743=m' -entity.7744=M. -entity.7745=m. -entity.7746=M. -entity.7747=m. -entity.7748=N. -entity.7749=n. -entity.7750=N. -entity.7751=n. -entity.7752=N_ -entity.7753=n_ -entity.7754=N^ -entity.7755=n^ -entity.7756=O~' -entity.7757=o~' -entity.7758=O~" -entity.7759=o~" -entity.7760=O-` -entity.7761=o-` -entity.7762=O-' -entity.7763=o-' -entity.7764=P' -entity.7765=p' -entity.7766=P. -entity.7767=p. -entity.7768=R. -entity.7769=r. -entity.7770=R. -entity.7771=r. -entity.7772=R.- -entity.7773=r.- -entity.7774=R_ -entity.7775=r_ -entity.7776=S. -entity.7777=s. -entity.7778=S. -entity.7779=s. -entity.7780=S'. -entity.7781=s'. -entity.7782=S(. -entity.7783=s(. -entity.7784=S.. -entity.7785=s.. -entity.7786=T. -entity.7787=t. -entity.7788=T. -entity.7789=t. -entity.7790=T_ -entity.7791=t_ -entity.7792=T^ -entity.7793=t^ -entity.7794=U" -entity.7795=u" -entity.7796=U~ -entity.7797=u~ -entity.7798=U^ -entity.7799=u^ -entity.7800=U~' -entity.7801=u~' -entity.7802=U-" -entity.7803=u-" -entity.7804=V~ -entity.7805=v~ -entity.7806=V. -entity.7807=v. -entity.7808=W` -entity.7809=w` -entity.7810=W' -entity.7811=w' -entity.7812=W" -entity.7813=w" -entity.7814=W. -entity.7815=w. -entity.7816=W. -entity.7817=w. -entity.7818=X. -entity.7819=x. -entity.7820=X" -entity.7821=x" -entity.7822=Y. -entity.7823=y. -entity.7824=Z^ -entity.7825=z^ -entity.7826=Z. -entity.7827=z. -entity.7828=Z_ -entity.7829=z_ -entity.7830=h_ -entity.7831=t" -entity.7832=w* -entity.7833=y* -entity.7834=a* -entity.7840=A. -entity.7841=a. -entity.7842=A? -entity.7843=a? -entity.7844=A^' -entity.7845=a^' -entity.7846=A^` -entity.7847=a^` -entity.7848=A^? -entity.7849=a^? -entity.7850=A^~ -entity.7851=a^~ -entity.7852=A^. -entity.7853=a^. -entity.7854=A(' -entity.7855=a(' -entity.7856=A(` -entity.7857=a(` -entity.7858=A(? -entity.7859=a(? -entity.7860=A(~ -entity.7861=a(~ -entity.7862=A(. -entity.7863=a(. -entity.7864=E. -entity.7865=e. -entity.7866=E? -entity.7867=e? -entity.7868=E~ -entity.7869=e~ -entity.7870=E^' -entity.7871=e^' -entity.7872=E^` -entity.7873=e^` -entity.7874=E^? -entity.7875=e^? -entity.7876=E^~ -entity.7877=e^~ -entity.7878=E^. -entity.7879=e^. -entity.7880=I? -entity.7881=i? -entity.7882=I. -entity.7883=i. -entity.7884=O. -entity.7885=o. -entity.7886=O? -entity.7887=o? -entity.7888=O^' -entity.7889=o^' -entity.7890=O^` -entity.7891=o^` -entity.7892=O^? -entity.7893=o^? -entity.7894=O^~ -entity.7895=o^~ -entity.7896=O^. -entity.7897=o^. -entity.7898=O+' -entity.7899=o+' -entity.7900=O+` -entity.7901=o+` -entity.7902=O+? -entity.7903=o+? -entity.7904=O+~ -entity.7905=o+~ -entity.7906=O+. -entity.7907=o+. -entity.7908=U. -entity.7909=u. -entity.7910=U? -entity.7911=u? -entity.7912=U+' -entity.7913=u+' -entity.7914=U+` -entity.7915=u+` -entity.7916=U+? -entity.7917=u+? -entity.7918=U+~ -entity.7919=u+~ -entity.7920=U+. -entity.7921=u+. -entity.7922=Y` -entity.7923=y` -entity.7924=Y. -entity.7925=y. -entity.7926=Y? -entity.7927=y? -entity.7928=Y~ -entity.7929=y~ -entity.8194=\u0020 -entity.8195=\u0020 -entity.8196=\u0020 -entity.8197=\u0020 -entity.8198=\u0020 -entity.8199=\u0020 -entity.8200=\u0020 -entity.8201=\u0020 -entity.8202=\u0020 -entity.8228=. -entity.8229=.. -entity.8230=... -entity.8239=\u0020 -entity.8252=!! -entity.8263=?? -entity.8264=?! -entity.8265=!? -entity.8287=\u0020 -entity.8304=^(0) -entity.8305=^(i) -entity.8308=^(4) -entity.8309=^(5) -entity.8310=^(6) -entity.8311=^(7) -entity.8312=^(8) -entity.8313=^(9) -entity.8314=^(+) -entity.8316=^(=) -entity.8317=^(() -entity.8318=^()) -entity.8319=^(n) -entity.8320=v(0) -entity.8321=v(1) -entity.8322=v(2) -entity.8323=v(3) -entity.8324=v(4) -entity.8325=v(5) -entity.8326=v(6) -entity.8327=v(7) -entity.8328=v(8) -entity.8329=v(9) -entity.8330=v(+) -entity.8332=v(=) -entity.8333=v(() -entity.8334=v()) -entity.8336=v(a) -entity.8337=v(e) -entity.8338=v(o) -entity.8339=v(x) -entity.8340=schwa -entity.8341=v(h) -entity.8342=v(k) -entity.8343=v(l) -entity.8344=v(m) -entity.8345=v(n) -entity.8346=v(p) -entity.8347=v(s) -entity.8348=v(t) -entity.8360=Rs -entity.8448=a/c -entity.8449=a/s -entity.8450=C -entity.8453=c/o -entity.8454=c/u -entity.8458=g -entity.8459=H -entity.8460=H -entity.8461=H -entity.8462=h -entity.8464=I -entity.8465=I -entity.8466=L -entity.8467=l -entity.8469=N -entity.8470=No -entity.8473=P -entity.8474=Q -entity.8475=R -entity.8476=R -entity.8477=R -entity.8480=^(SM) -entity.8481=TEL -entity.8482=^(TM) -entity.8484=Z -entity.8488=Z -entity.8492=B -entity.8493=C -entity.8495=e -entity.8496=E -entity.8497=F -entity.8499=M -entity.8500=o -entity.8505=i -entity.8507=FAX -entity.8517=D -entity.8518=d -entity.8519=e -entity.8520=i -entity.8521=j -entity.8528=1/7 -entity.8529=1/9 -entity.8530=1/10 -entity.8531=1/3 -entity.8532=2/3 -entity.8533=1/5 -entity.8534=2/5 -entity.8535=3/5 -entity.8536=4/5 -entity.8537=1/6 -entity.8538=5/6 -entity.8539=1/8 -entity.8540=3/8 -entity.8541=5/8 -entity.8542=7/8 -entity.8543=1/ -entity.8544=I -entity.8545=II -entity.8546=III -entity.8547=IV -entity.8548=V -entity.8549=VI -entity.8550=VII -entity.8551=VIII -entity.8552=IX -entity.8553=X -entity.8554=XI -entity.8555=XII -entity.8556=L -entity.8557=C -entity.8558=D -entity.8559=M -entity.8560=i -entity.8561=ii -entity.8562=iii -entity.8563=iv -entity.8564=v -entity.8565=vi -entity.8566=vii -entity.8567=viii -entity.8568=ix -entity.8569=x -entity.8570=xi -entity.8571=xii -entity.8572=l -entity.8573=c -entity.8574=d -entity.8575=m -entity.8576=[1000] -entity.8577=[5000] -entity.8578=[10000] -entity.8581=[6] -entity.8582=[50] -entity.8583=[50000] -entity.8584=[100000] -entity.8585=0/3 -entity.9312=(1) -entity.9313=(2) -entity.9314=(3) -entity.9315=(4) -entity.9316=(5) -entity.9317=(6) -entity.9318=(7) -entity.9319=(8) -entity.9320=(9) -entity.9321=(10) -entity.9322=(11) -entity.9323=(12) -entity.9324=(13) -entity.9325=(14) -entity.9326=(15) -entity.9327=(16) -entity.9328=(17) -entity.9329=(18) -entity.9330=(19) -entity.9331=(20) -entity.9332=(1) -entity.9333=(2) -entity.9334=(3) -entity.9335=(4) -entity.9336=(5) -entity.9337=(6) -entity.9338=(7) -entity.9339=(8) -entity.9340=(9) -entity.9341=(10) -entity.9342=(11) -entity.9343=(12) -entity.9344=(13) -entity.9345=(14) -entity.9346=(15) -entity.9347=(16) -entity.9348=(17) -entity.9349=(18) -entity.9350=(19) -entity.9351=(20) -entity.9352=1. -entity.9353=2. -entity.9354=3. -entity.9355=4. -entity.9356=5. -entity.9357=6. -entity.9358=7. -entity.9359=8. -entity.9360=9. -entity.9361=10. -entity.9362=11. -entity.9363=12. -entity.9364=13. -entity.9365=14. -entity.9366=15. -entity.9367=16. -entity.9368=17. -entity.9369=18. -entity.9370=19. -entity.9371=20. -entity.9372=(a) -entity.9373=(b) -entity.9374=(c) -entity.9375=(d) -entity.9376=(e) -entity.9377=(f) -entity.9378=(g) -entity.9379=(h) -entity.9380=(i) -entity.9381=(j) -entity.9382=(k) -entity.9383=(l) -entity.9384=(m) -entity.9385=(n) -entity.9386=(o) -entity.9387=(p) -entity.9388=(q) -entity.9389=(r) -entity.9390=(s) -entity.9391=(t) -entity.9392=(u) -entity.9393=(v) -entity.9394=(w) -entity.9395=(x) -entity.9396=(y) -entity.9397=(z) -entity.9398=(A) -entity.9399=(B) -entity.9400=(C) -entity.9401=(D) -entity.9402=(E) -entity.9403=(F) -entity.9404=(G) -entity.9405=(H) -entity.9406=(I) -entity.9407=(J) -entity.9408=(K) -entity.9409=(L) -entity.9410=(M) -entity.9411=(N) -entity.9412=(O) -entity.9413=(P) -entity.9414=(Q) -entity.9415=(R) -entity.9416=(S) -entity.9417=(T) -entity.9418=(U) -entity.9419=(V) -entity.9420=(W) -entity.9421=(X) -entity.9422=(Y) -entity.9423=(Z) -entity.9424=(a) -entity.9425=(b) -entity.9426=(c) -entity.9427=(d) -entity.9428=(e) -entity.9429=(f) -entity.9430=(g) -entity.9431=(h) -entity.9432=(i) -entity.9433=(j) -entity.9434=(k) -entity.9435=(l) -entity.9436=(m) -entity.9437=(n) -entity.9438=(o) -entity.9439=(p) -entity.9440=(q) -entity.9441=(r) -entity.9442=(s) -entity.9443=(t) -entity.9444=(u) -entity.9445=(v) -entity.9446=(w) -entity.9447=(x) -entity.9448=(y) -entity.9449=(z) -entity.9450=(0) -entity.9451=(11) -entity.9452=(12) -entity.9453=(13) -entity.9454=(14) -entity.9455=(15) -entity.9456=(16) -entity.9457=(17) -entity.9458=(18) -entity.9459=(19) -entity.9460=(20) -entity.9461=(1) -entity.9462=(2) -entity.9463=(3) -entity.9464=(4) -entity.9465=(5) -entity.9466=(6) -entity.9467=(7) -entity.9468=(8) -entity.9469=(9) -entity.9470=(10) -entity.9471=(0) -entity.10102=(1) -entity.10103=(2) -entity.10104=(3) -entity.10105=(4) -entity.10106=(5) -entity.10107=(6) -entity.10108=(7) -entity.10109=(8) -entity.10110=(9) -entity.10111=(10) -entity.10112=(1) -entity.10113=(2) -entity.10114=(3) -entity.10115=(4) -entity.10116=(5) -entity.10117=(6) -entity.10118=(7) -entity.10119=(8) -entity.10120=(9) -entity.10121=(10) -entity.10122=(1) -entity.10123=(2) -entity.10124=(3) -entity.10125=(4) -entity.10126=(5) -entity.10127=(6) -entity.10128=(7) -entity.10129=(8) -entity.10130=(9) -entity.10131=(10) -entity.10868=::= -entity.10869=== -entity.10870==== -entity.11388=v(j) -entity.11389=^(V) -entity.11517=[1/2] -entity.12288=\u0020 -entity.12295=[0] -entity.12321=[1] -entity.12322=[2] -entity.12323=[3] -entity.12324=[4] -entity.12325=[5] -entity.12326=[6] -entity.12327=[7] -entity.12328=[8] -entity.12329=[9] -entity.12872=(10) -entity.12873=(20) -entity.12874=(30) -entity.12875=(40) -entity.12876=(50) -entity.12877=(60) -entity.12878=(70) -entity.12879=(80) -entity.12881=(21) -entity.12882=(22) -entity.12883=(23) -entity.12884=(24) -entity.12885=(25) -entity.12886=(26) -entity.12887=(27) -entity.12888=(28) -entity.12889=(29) -entity.12890=(30) -entity.12891=(31) -entity.12892=(32) -entity.12893=(33) -entity.12894=(34) -entity.12895=(35) -entity.12977=(36) -entity.12978=(37) -entity.12979=(38) -entity.12980=(39) -entity.12981=(40) -entity.12982=(41) -entity.12983=(42) -entity.12984=(43) -entity.12985=(44) -entity.12986=(45) -entity.12987=(46) -entity.12988=(47) -entity.12989=(48) -entity.12990=(49) -entity.12991=(50) -entity.42528=0 -entity.42529=1 -entity.42530=2 -entity.42531=3 -entity.42532=4 -entity.42533=5 -entity.42534=6 -entity.42535=7 -entity.42536=8 -entity.42537=9 -entity.42726=[1] -entity.42727=[2] -entity.42728=[3] -entity.42729=[4] -entity.42730=[5] -entity.42731=[6] -entity.42732=[7] -entity.42733=[8] -entity.42734=[9] -entity.42735=[0] -entity.43056=[1/4] -entity.43057=[1/2] -entity.43058=[3/4] -entity.43059=[1/16] -entity.43060=[1/8] -entity.43061=[3/16] -entity.43216=0 -entity.43217=1 -entity.43218=2 -entity.43219=3 -entity.43220=4 -entity.43221=5 -entity.43222=6 -entity.43223=7 -entity.43224=8 -entity.43225=9 -entity.43264=0 -entity.43265=1 -entity.43266=2 -entity.43267=3 -entity.43268=4 -entity.43269=5 -entity.43270=6 -entity.43271=7 -entity.43272=8 -entity.43273=9 -entity.43472=0 -entity.43473=1 -entity.43474=2 -entity.43475=3 -entity.43476=4 -entity.43477=5 -entity.43478=6 -entity.43479=7 -entity.43480=8 -entity.43481=9 -entity.43504=0 -entity.43505=1 -entity.43506=2 -entity.43507=3 -entity.43508=4 -entity.43509=5 -entity.43510=6 -entity.43511=7 -entity.43512=8 -entity.43513=9 -entity.43600=0 -entity.43601=1 -entity.43602=2 -entity.43603=3 -entity.43604=4 -entity.43605=5 -entity.43606=6 -entity.43607=7 -entity.43608=8 -entity.43609=9 -entity.44016=0 -entity.44017=1 -entity.44018=2 -entity.44019=3 -entity.44020=4 -entity.44021=5 -entity.44022=6 -entity.44023=7 -entity.44024=8 -entity.44025=9 -entity.64256=ff -entity.64257=fi -entity.64258=fl -entity.64259=ffi -entity.64260=ffl -entity.64262=st -entity.64297=+ -entity.65101=_ -entity.65102=_ -entity.65103=_ -entity.65104=, -entity.65106=. -entity.65108=; -entity.65109=: -entity.65110=? -entity.65111=! -entity.65113=( -entity.65114=) -entity.65115={ -entity.65116=} -entity.65119=# -entity.65120=& -entity.65121=* -entity.65122=+ -entity.65123=- -entity.65124=< -entity.65125=> -entity.65126== -entity.65128=\u005C -entity.65129=$ -entity.65130=% -entity.65131=@ -entity.65281=! -entity.65282=" -entity.65283=# -entity.65284=$ -entity.65285=% -entity.65286=& -entity.65287=' -entity.65288=( -entity.65289=) -entity.65290=* -entity.65291=+ -entity.65292=, -entity.65293=- -entity.65294=. -entity.65295=/ -entity.65296=0 -entity.65297=1 -entity.65298=2 -entity.65299=3 -entity.65300=4 -entity.65301=5 -entity.65302=6 -entity.65303=7 -entity.65304=8 -entity.65305=9 -entity.65306=: -entity.65307=; -entity.65308=< -entity.65309== -entity.65310=> -entity.65311=? -entity.65312=@ -entity.65313=A -entity.65314=B -entity.65315=C -entity.65316=D -entity.65317=E -entity.65318=F -entity.65319=G -entity.65320=H -entity.65321=I -entity.65322=J -entity.65323=K -entity.65324=L -entity.65325=M -entity.65326=N -entity.65327=O -entity.65328=P -entity.65329=Q -entity.65330=R -entity.65331=S -entity.65332=T -entity.65333=U -entity.65334=V -entity.65335=W -entity.65336=X -entity.65337=Y -entity.65338=Z -entity.65339=[ -entity.65340=\u005C -entity.65341=] -entity.65342=^ -entity.65343=_ -entity.65344=` -entity.65345=a -entity.65346=b -entity.65347=c -entity.65348=d -entity.65349=e -entity.65350=f -entity.65351=g -entity.65352=h -entity.65353=i -entity.65354=j -entity.65355=k -entity.65356=l -entity.65357=m -entity.65358=n -entity.65359=o -entity.65360=p -entity.65361=q -entity.65362=r -entity.65363=s -entity.65364=t -entity.65365=u -entity.65366=v -entity.65367=w -entity.65368=x -entity.65369=y -entity.65370=z -entity.65371={ -entity.65372=| -entity.65373=} -entity.65374=~ -entity.65799=[1] -entity.65800=[2] -entity.65801=[3] -entity.65802=[4] -entity.65803=[5] -entity.65804=[6] -entity.65805=[7] -entity.65806=[8] -entity.65807=[9] -entity.65808=[10] -entity.65809=[20] -entity.65810=[30] -entity.65811=[40] -entity.65812=[50] -entity.65813=[60] -entity.65814=[70] -entity.65815=[80] -entity.65816=[90] -entity.65817=[100] -entity.65818=[200] -entity.65819=[300] -entity.65820=[400] -entity.65821=[500] -entity.65822=[600] -entity.65823=[700] -entity.65824=[800] -entity.65825=[900] -entity.65826=[1000] -entity.65827=[2000] -entity.65828=[3000] -entity.65829=[4000] -entity.65830=[5000] -entity.65831=[6000] -entity.65832=[7000] -entity.65833=[8000] -entity.65834=[9000] -entity.65835=[10000] -entity.65836=[20000] -entity.65837=[30000] -entity.65838=[40000] -entity.65839=[50000] -entity.65840=[60000] -entity.65841=[70000] -entity.65842=[80000] -entity.65843=[90000] -entity.65856=[1/4] -entity.65857=[1/2] -entity.65858=[1] -entity.65859=[5] -entity.65860=[50] -entity.65861=[500] -entity.65862=[5000] -entity.65863=[50000] -entity.65864=[5] -entity.65865=[10] -entity.65866=[50] -entity.65867=[100] -entity.65868=[500] -entity.65869=[1000] -entity.65870=[5000] -entity.65871=[5] -entity.65872=[10] -entity.65873=[50] -entity.65874=[100] -entity.65875=[500] -entity.65876=[1000] -entity.65877=[10000] -entity.65878=[50000] -entity.65879=[10] -entity.65880=[1] -entity.65881=[1] -entity.65882=[1] -entity.65883=[2] -entity.65884=[2] -entity.65885=[2] -entity.65886=[2] -entity.65887=[5] -entity.65888=[10] -entity.65889=[10] -entity.65890=[10] -entity.65891=[10] -entity.65892=[10] -entity.65893=[30] -entity.65894=[50] -entity.65895=[50] -entity.65896=[50] -entity.65897=[50] -entity.65898=[100] -entity.65899=[300] -entity.65900=[500] -entity.65901=[500] -entity.65902=[500] -entity.65903=[500] -entity.65904=[500] -entity.65905=[1000] -entity.65906=[5000] -entity.65907=[5] -entity.65908=[50] -entity.65909=[1/2] -entity.65910=[1/2] -entity.65911=[2/3] -entity.65912=[3/4] -entity.65930=[0] -entity.65931=[1/4] -entity.66273=[1] -entity.66274=[2] -entity.66275=[3] -entity.66276=[4] -entity.66277=[5] -entity.66278=[6] -entity.66279=[7] -entity.66280=[8] -entity.66281=[9] -entity.66282=[10] -entity.66283=[20] -entity.66284=[30] -entity.66285=[40] -entity.66286=[50] -entity.66287=[60] -entity.66288=[70] -entity.66289=[80] -entity.66290=[90] -entity.66291=[100] -entity.66292=[200] -entity.66293=[300] -entity.66294=[400] -entity.66295=[500] -entity.66296=[600] -entity.66297=[700] -entity.66298=[800] -entity.66299=[900] -entity.66336=[1] -entity.66337=[5] -entity.66338=[10] -entity.66339=[50] -entity.66369=[90] -entity.66378=[900] -entity.66513=[1] -entity.66514=[2] -entity.66515=[10] -entity.66516=[20] -entity.66517=[100] -entity.66720=0 -entity.66721=1 -entity.66722=2 -entity.66723=3 -entity.66724=4 -entity.66725=5 -entity.66726=6 -entity.66727=7 -entity.66728=8 -entity.66729=9 -entity.67672=[1] -entity.67673=[2] -entity.67674=[3] -entity.67675=[10] -entity.67676=[20] -entity.67677=[100] -entity.67678=[1000] -entity.67679=[10000] -entity.67705=[1] -entity.67706=[2] -entity.67707=[3] -entity.67708=[4] -entity.67709=[5] -entity.67710=[10] -entity.67711=[20] -entity.67751=[1] -entity.67752=[2] -entity.67753=[3] -entity.67754=[4] -entity.67755=[4] -entity.67756=[5] -entity.67757=[10] -entity.67758=[20] -entity.67759=[100] -entity.67862=[1] -entity.67863=[10] -entity.67864=[20] -entity.67865=[100] -entity.67866=[2] -entity.67867=[3] -entity.68160=[1] -entity.68161=[2] -entity.68162=[3] -entity.68163=[4] -entity.68164=[10] -entity.68165=[20] -entity.68166=[100] -entity.68167=[1000] -entity.68221=[1] -entity.68222=[50] -entity.68253=[1] -entity.68254=[10] -entity.68255=[20] -entity.68331=[1] -entity.68332=[5] -entity.68333=[10] -entity.68334=[20] -entity.68335=[100] -entity.68440=[1] -entity.68441=[2] -entity.68442=[3] -entity.68443=[4] -entity.68444=[10] -entity.68445=[20] -entity.68446=[100] -entity.68447=[1000] -entity.68472=[1] -entity.68473=[2] -entity.68474=[3] -entity.68475=[4] -entity.68476=[10] -entity.68477=[20] -entity.68478=[100] -entity.68479=[1000] -entity.68521=[1] -entity.68522=[2] -entity.68523=[3] -entity.68524=[4] -entity.68525=[10] -entity.68526=[20] -entity.68527=[100] -entity.69216=[1] -entity.69217=[2] -entity.69218=[3] -entity.69219=[4] -entity.69220=[5] -entity.69221=[6] -entity.69222=[7] -entity.69223=[8] -entity.69224=[9] -entity.69225=[10] -entity.69226=[20] -entity.69227=[30] -entity.69228=[40] -entity.69229=[50] -entity.69230=[60] -entity.69231=[70] -entity.69232=[80] -entity.69233=[90] -entity.69234=[100] -entity.69235=[200] -entity.69236=[300] -entity.69237=[400] -entity.69238=[500] -entity.69239=[600] -entity.69240=[700] -entity.69241=[800] -entity.69242=[900] -entity.69243=[1/2] -entity.69244=[1/4] -entity.69245=[1/3] -entity.69246=[2/3] -entity.69714=[1] -entity.69715=[2] -entity.69716=[3] -entity.69717=[4] -entity.69718=[5] -entity.69719=[6] -entity.69720=[7] -entity.69721=[8] -entity.69722=[9] -entity.69723=[10] -entity.69724=[20] -entity.69725=[30] -entity.69726=[40] -entity.69727=[50] -entity.69728=[60] -entity.69729=[70] -entity.69730=[80] -entity.69731=[90] -entity.69732=[100] -entity.69733=[1000] -entity.69734=0 -entity.69735=1 -entity.69736=2 -entity.69737=3 -entity.69738=4 -entity.69739=5 -entity.69740=6 -entity.69741=7 -entity.69742=8 -entity.69743=9 -entity.69872=0 -entity.69873=1 -entity.69874=2 -entity.69875=3 -entity.69876=4 -entity.69877=5 -entity.69878=6 -entity.69879=7 -entity.69880=8 -entity.69881=9 -entity.69942=0 -entity.69943=1 -entity.69944=2 -entity.69945=3 -entity.69946=4 -entity.69947=5 -entity.69948=6 -entity.69949=7 -entity.69950=8 -entity.69951=9 -entity.70096=0 -entity.70097=1 -entity.70098=2 -entity.70099=3 -entity.70100=4 -entity.70101=5 -entity.70102=6 -entity.70103=7 -entity.70104=8 -entity.70105=9 -entity.70113=[1] -entity.70114=[2] -entity.70115=[3] -entity.70116=[4] -entity.70117=[5] -entity.70118=[6] -entity.70119=[7] -entity.70120=[8] -entity.70121=[9] -entity.70122=[10] -entity.70123=[20] -entity.70124=[30] -entity.70125=[40] -entity.70126=[50] -entity.70127=[60] -entity.70128=[70] -entity.70129=[80] -entity.70130=[90] -entity.70131=[100] -entity.70132=[1000] -entity.70384=0 -entity.70385=1 -entity.70386=2 -entity.70387=3 -entity.70388=4 -entity.70389=5 -entity.70390=6 -entity.70391=7 -entity.70392=8 -entity.70393=9 -entity.70864=0 -entity.70865=1 -entity.70866=2 -entity.70867=3 -entity.70868=4 -entity.70869=5 -entity.70870=6 -entity.70871=7 -entity.70872=8 -entity.70873=9 -entity.71248=0 -entity.71249=1 -entity.71250=2 -entity.71251=3 -entity.71252=4 -entity.71253=5 -entity.71254=6 -entity.71255=7 -entity.71256=8 -entity.71257=9 -entity.71360=0 -entity.71361=1 -entity.71362=2 -entity.71363=3 -entity.71364=4 -entity.71365=5 -entity.71366=6 -entity.71367=7 -entity.71368=8 -entity.71369=9 -entity.71904=0 -entity.71905=1 -entity.71906=2 -entity.71907=3 -entity.71908=4 -entity.71909=5 -entity.71910=6 -entity.71911=7 -entity.71912=8 -entity.71913=9 -entity.71914=[10] -entity.71915=[20] -entity.71916=[30] -entity.71917=[40] -entity.71918=[50] -entity.71919=[60] -entity.71920=[70] -entity.71921=[80] -entity.71922=[90] -entity.74752=[2] -entity.74753=[3] -entity.74754=[4] -entity.74755=[5] -entity.74756=[6] -entity.74757=[7] -entity.74758=[8] -entity.74759=[9] -entity.74760=[3] -entity.74761=[4] -entity.74762=[5] -entity.74763=[6] -entity.74764=[7] -entity.74765=[8] -entity.74766=[9] -entity.74767=[4] -entity.74768=[5] -entity.74769=[6] -entity.74770=[7] -entity.74771=[8] -entity.74772=[9] -entity.74773=[1] -entity.74774=[2] -entity.74775=[3] -entity.74776=[4] -entity.74777=[5] -entity.74778=[6] -entity.74779=[7] -entity.74780=[8] -entity.74781=[9] -entity.74782=[1] -entity.74783=[2] -entity.74784=[3] -entity.74785=[4] -entity.74786=[5] -entity.74787=[2] -entity.74788=[3] -entity.74789=[3] -entity.74790=[4] -entity.74791=[5] -entity.74792=[6] -entity.74793=[7] -entity.74794=[8] -entity.74795=[9] -entity.74796=[1] -entity.74797=[2] -entity.74798=[3] -entity.74799=[3] -entity.74800=[4] -entity.74801=[5] -entity.74802=[216000] -entity.74803=[432000] -entity.74804=[1] -entity.74805=[2] -entity.74806=[3] -entity.74807=[3] -entity.74808=[4] -entity.74809=[5] -entity.74810=[3] -entity.74811=[3] -entity.74812=[4] -entity.74813=[4] -entity.74814=[4] -entity.74815=[4] -entity.74816=[6] -entity.74817=[7] -entity.74818=[7] -entity.74819=[7] -entity.74820=[8] -entity.74821=[8] -entity.74822=[9] -entity.74823=[9] -entity.74824=[9] -entity.74825=[9] -entity.74826=[2] -entity.74827=[3] -entity.74828=[4] -entity.74829=[5] -entity.74830=[6] -entity.74831=[1] -entity.74832=[2] -entity.74833=[3] -entity.74834=[4] -entity.74835=[4] -entity.74836=[5] -entity.74837=[5] -entity.74838=[2] -entity.74839=[3] -entity.74840=[1] -entity.74841=[2] -entity.74842=[1/3] -entity.74843=[2/3] -entity.74844=[5/6] -entity.74845=[1/3] -entity.74846=[2/3] -entity.74847=[1/8] -entity.74848=[1/4] -entity.74849=[1/6] -entity.74850=[1/4] -entity.74851=[1/4] -entity.74852=[1/2] -entity.74853=[1/3] -entity.74854=[2/3] -entity.74855=[40] -entity.74856=[50] -entity.74857=[4] -entity.74858=[5] -entity.74859=[6] -entity.74860=[7] -entity.74861=[8] -entity.74862=[9] -entity.92768=0 -entity.92769=1 -entity.92770=2 -entity.92771=3 -entity.92772=4 -entity.92773=5 -entity.92774=6 -entity.92775=7 -entity.92776=8 -entity.92777=9 -entity.93008=0 -entity.93009=1 -entity.93010=2 -entity.93011=3 -entity.93012=4 -entity.93013=5 -entity.93014=6 -entity.93015=7 -entity.93016=8 -entity.93017=9 -entity.93019=[10] -entity.93020=[100] -entity.93021=[10000] -entity.93022=[1000000] -entity.93023=[100000000] -entity.93024=[10000000000] -entity.93025=[1000000000000] -entity.119648=[1] -entity.119649=[2] -entity.119650=[3] -entity.119651=[4] -entity.119652=[5] -entity.119653=[6] -entity.119654=[7] -entity.119655=[8] -entity.119656=[9] -entity.119657=[10] -entity.119658=[20] -entity.119659=[30] -entity.119660=[40] -entity.119661=[50] -entity.119662=[60] -entity.119663=[70] -entity.119664=[80] -entity.119665=[90] -entity.119808=A -entity.119809=B -entity.119810=C -entity.119811=D -entity.119812=E -entity.119813=F -entity.119814=G -entity.119815=H -entity.119816=I -entity.119817=J -entity.119818=K -entity.119819=L -entity.119820=M -entity.119821=N -entity.119822=O -entity.119823=P -entity.119824=Q -entity.119825=R -entity.119826=S -entity.119827=T -entity.119828=U -entity.119829=V -entity.119830=W -entity.119831=X -entity.119832=Y -entity.119833=Z -entity.119834=a -entity.119835=b -entity.119836=c -entity.119837=d -entity.119838=e -entity.119839=f -entity.119840=g -entity.119841=h -entity.119842=i -entity.119843=j -entity.119844=k -entity.119845=l -entity.119846=m -entity.119847=n -entity.119848=o -entity.119849=p -entity.119850=q -entity.119851=r -entity.119852=s -entity.119853=t -entity.119854=u -entity.119855=v -entity.119856=w -entity.119857=x -entity.119858=y -entity.119859=z -entity.119860=A -entity.119861=B -entity.119862=C -entity.119863=D -entity.119864=E -entity.119865=F -entity.119866=G -entity.119867=H -entity.119868=I -entity.119869=J -entity.119870=K -entity.119871=L -entity.119872=M -entity.119873=N -entity.119874=O -entity.119875=P -entity.119876=Q -entity.119877=R -entity.119878=S -entity.119879=T -entity.119880=U -entity.119881=V -entity.119882=W -entity.119883=X -entity.119884=Y -entity.119885=Z -entity.119886=a -entity.119887=b -entity.119888=c -entity.119889=d -entity.119890=e -entity.119891=f -entity.119892=g -entity.119894=i -entity.119895=j -entity.119896=k -entity.119897=l -entity.119898=m -entity.119899=n -entity.119900=o -entity.119901=p -entity.119902=q -entity.119903=r -entity.119904=s -entity.119905=t -entity.119906=u -entity.119907=v -entity.119908=w -entity.119909=x -entity.119910=y -entity.119911=z -entity.119912=A -entity.119913=B -entity.119914=C -entity.119915=D -entity.119916=E -entity.119917=F -entity.119918=G -entity.119919=H -entity.119920=I -entity.119921=J -entity.119922=K -entity.119923=L -entity.119924=M -entity.119925=N -entity.119926=O -entity.119927=P -entity.119928=Q -entity.119929=R -entity.119930=S -entity.119931=T -entity.119932=U -entity.119933=V -entity.119934=W -entity.119935=X -entity.119936=Y -entity.119937=Z -entity.119938=a -entity.119939=b -entity.119940=c -entity.119941=d -entity.119942=e -entity.119943=f -entity.119944=g -entity.119945=h -entity.119946=i -entity.119947=j -entity.119948=k -entity.119949=l -entity.119950=m -entity.119951=n -entity.119952=o -entity.119953=p -entity.119954=q -entity.119955=r -entity.119956=s -entity.119957=t -entity.119958=u -entity.119959=v -entity.119960=w -entity.119961=x -entity.119962=y -entity.119963=z -entity.119964=A -entity.119966=C -entity.119967=D -entity.119970=G -entity.119973=J -entity.119974=K -entity.119977=N -entity.119978=O -entity.119979=P -entity.119980=Q -entity.119982=S -entity.119983=T -entity.119984=U -entity.119985=V -entity.119986=W -entity.119987=X -entity.119988=Y -entity.119989=Z -entity.119990=a -entity.119991=b -entity.119992=c -entity.119993=d -entity.119995=f -entity.119997=h -entity.119998=i -entity.119999=j -entity.120000=k -entity.120001=l -entity.120002=m -entity.120003=n -entity.120005=p -entity.120006=q -entity.120007=r -entity.120008=s -entity.120009=t -entity.120010=u -entity.120011=v -entity.120012=w -entity.120013=x -entity.120014=y -entity.120015=z -entity.120016=A -entity.120017=B -entity.120018=C -entity.120019=D -entity.120020=E -entity.120021=F -entity.120022=G -entity.120023=H -entity.120024=I -entity.120025=J -entity.120026=K -entity.120027=L -entity.120028=M -entity.120029=N -entity.120030=O -entity.120031=P -entity.120032=Q -entity.120033=R -entity.120034=S -entity.120035=T -entity.120036=U -entity.120037=V -entity.120038=W -entity.120039=X -entity.120040=Y -entity.120041=Z -entity.120042=a -entity.120043=b -entity.120044=c -entity.120045=d -entity.120046=e -entity.120047=f -entity.120048=g -entity.120049=h -entity.120050=i -entity.120051=j -entity.120052=k -entity.120053=l -entity.120054=m -entity.120055=n -entity.120056=o -entity.120057=p -entity.120058=q -entity.120059=r -entity.120060=s -entity.120061=t -entity.120062=u -entity.120063=v -entity.120064=w -entity.120065=x -entity.120066=y -entity.120067=z -entity.120068=A -entity.120069=B -entity.120071=D -entity.120072=E -entity.120073=F -entity.120074=G -entity.120077=J -entity.120078=K -entity.120079=L -entity.120080=M -entity.120081=N -entity.120082=O -entity.120083=P -entity.120084=Q -entity.120086=S -entity.120087=T -entity.120088=U -entity.120089=V -entity.120090=W -entity.120091=X -entity.120092=Y -entity.120094=a -entity.120095=b -entity.120096=c -entity.120097=d -entity.120098=e -entity.120099=f -entity.120100=g -entity.120101=h -entity.120102=i -entity.120103=j -entity.120104=k -entity.120105=l -entity.120106=m -entity.120107=n -entity.120108=o -entity.120109=p -entity.120110=q -entity.120111=r -entity.120112=s -entity.120113=t -entity.120114=u -entity.120115=v -entity.120116=w -entity.120117=x -entity.120118=y -entity.120119=z -entity.120120=A -entity.120121=B -entity.120123=D -entity.120124=E -entity.120125=F -entity.120126=G -entity.120128=I -entity.120129=J -entity.120130=K -entity.120131=L -entity.120132=M -entity.120134=O -entity.120138=S -entity.120139=T -entity.120140=U -entity.120141=V -entity.120142=W -entity.120143=X -entity.120144=Y -entity.120146=a -entity.120147=b -entity.120148=c -entity.120149=d -entity.120150=e -entity.120151=f -entity.120152=g -entity.120153=h -entity.120154=i -entity.120155=j -entity.120156=k -entity.120157=l -entity.120158=m -entity.120159=n -entity.120160=o -entity.120161=p -entity.120162=q -entity.120163=r -entity.120164=s -entity.120165=t -entity.120166=u -entity.120167=v -entity.120168=w -entity.120169=x -entity.120170=y -entity.120171=z -entity.120172=A -entity.120173=B -entity.120174=C -entity.120175=D -entity.120176=E -entity.120177=F -entity.120178=G -entity.120179=H -entity.120180=I -entity.120181=J -entity.120182=K -entity.120183=L -entity.120184=M -entity.120185=N -entity.120186=O -entity.120187=P -entity.120188=Q -entity.120189=R -entity.120190=S -entity.120191=T -entity.120192=U -entity.120193=V -entity.120194=W -entity.120195=X -entity.120196=Y -entity.120197=Z -entity.120198=a -entity.120199=b -entity.120200=c -entity.120201=d -entity.120202=e -entity.120203=f -entity.120204=g -entity.120205=h -entity.120206=i -entity.120207=j -entity.120208=k -entity.120209=l -entity.120210=m -entity.120211=n -entity.120212=o -entity.120213=p -entity.120214=q -entity.120215=r -entity.120216=s -entity.120217=t -entity.120218=u -entity.120219=v -entity.120220=w -entity.120221=x -entity.120222=y -entity.120223=z -entity.120224=A -entity.120225=B -entity.120226=C -entity.120227=D -entity.120228=E -entity.120229=F -entity.120230=G -entity.120231=H -entity.120232=I -entity.120233=J -entity.120234=K -entity.120235=L -entity.120236=M -entity.120237=N -entity.120238=O -entity.120239=P -entity.120240=Q -entity.120241=R -entity.120242=S -entity.120243=T -entity.120244=U -entity.120245=V -entity.120246=W -entity.120247=X -entity.120248=Y -entity.120249=Z -entity.120250=a -entity.120251=b -entity.120252=c -entity.120253=d -entity.120254=e -entity.120255=f -entity.120256=g -entity.120257=h -entity.120258=i -entity.120259=j -entity.120260=k -entity.120261=l -entity.120262=m -entity.120263=n -entity.120264=o -entity.120265=p -entity.120266=q -entity.120267=r -entity.120268=s -entity.120269=t -entity.120270=u -entity.120271=v -entity.120272=w -entity.120273=x -entity.120274=y -entity.120275=z -entity.120276=A -entity.120277=B -entity.120278=C -entity.120279=D -entity.120280=E -entity.120281=F -entity.120282=G -entity.120283=H -entity.120284=I -entity.120285=J -entity.120286=K -entity.120287=L -entity.120288=M -entity.120289=N -entity.120290=O -entity.120291=P -entity.120292=Q -entity.120293=R -entity.120294=S -entity.120295=T -entity.120296=U -entity.120297=V -entity.120298=W -entity.120299=X -entity.120300=Y -entity.120301=Z -entity.120302=a -entity.120303=b -entity.120304=c -entity.120305=d -entity.120306=e -entity.120307=f -entity.120308=g -entity.120309=h -entity.120310=i -entity.120311=j -entity.120312=k -entity.120313=l -entity.120314=m -entity.120315=n -entity.120316=o -entity.120317=p -entity.120318=q -entity.120319=r -entity.120320=s -entity.120321=t -entity.120322=u -entity.120323=v -entity.120324=w -entity.120325=x -entity.120326=y -entity.120327=z -entity.120328=A -entity.120329=B -entity.120330=C -entity.120331=D -entity.120332=E -entity.120333=F -entity.120334=G -entity.120335=H -entity.120336=I -entity.120337=J -entity.120338=K -entity.120339=L -entity.120340=M -entity.120341=N -entity.120342=O -entity.120343=P -entity.120344=Q -entity.120345=R -entity.120346=S -entity.120347=T -entity.120348=U -entity.120349=V -entity.120350=W -entity.120351=X -entity.120352=Y -entity.120353=Z -entity.120354=a -entity.120355=b -entity.120356=c -entity.120357=d -entity.120358=e -entity.120359=f -entity.120360=g -entity.120361=h -entity.120362=i -entity.120363=j -entity.120364=k -entity.120365=l -entity.120366=m -entity.120367=n -entity.120368=o -entity.120369=p -entity.120370=q -entity.120371=r -entity.120372=s -entity.120373=t -entity.120374=u -entity.120375=v -entity.120376=w -entity.120377=x -entity.120378=y -entity.120379=z -entity.120380=A -entity.120381=B -entity.120382=C -entity.120383=D -entity.120384=E -entity.120385=F -entity.120386=G -entity.120387=H -entity.120388=I -entity.120389=J -entity.120390=K -entity.120391=L -entity.120392=M -entity.120393=N -entity.120394=O -entity.120395=P -entity.120396=Q -entity.120397=R -entity.120398=S -entity.120399=T -entity.120400=U -entity.120401=V -entity.120402=W -entity.120403=X -entity.120404=Y -entity.120405=Z -entity.120406=a -entity.120407=b -entity.120408=c -entity.120409=d -entity.120410=e -entity.120411=f -entity.120412=g -entity.120413=h -entity.120414=i -entity.120415=j -entity.120416=k -entity.120417=l -entity.120418=m -entity.120419=n -entity.120420=o -entity.120421=p -entity.120422=q -entity.120423=r -entity.120424=s -entity.120425=t -entity.120426=u -entity.120427=v -entity.120428=w -entity.120429=x -entity.120430=y -entity.120431=z -entity.120432=A -entity.120433=B -entity.120434=C -entity.120435=D -entity.120436=E -entity.120437=F -entity.120438=G -entity.120439=H -entity.120440=I -entity.120441=J -entity.120442=K -entity.120443=L -entity.120444=M -entity.120445=N -entity.120446=O -entity.120447=P -entity.120448=Q -entity.120449=R -entity.120450=S -entity.120451=T -entity.120452=U -entity.120453=V -entity.120454=W -entity.120455=X -entity.120456=Y -entity.120457=Z -entity.120458=a -entity.120459=b -entity.120460=c -entity.120461=d -entity.120462=e -entity.120463=f -entity.120464=g -entity.120465=h -entity.120466=i -entity.120467=j -entity.120468=k -entity.120469=l -entity.120470=m -entity.120471=n -entity.120472=o -entity.120473=p -entity.120474=q -entity.120475=r -entity.120476=s -entity.120477=t -entity.120478=u -entity.120479=v -entity.120480=w -entity.120481=x -entity.120482=y -entity.120483=z -entity.120782=0 -entity.120783=1 -entity.120784=2 -entity.120785=3 -entity.120786=4 -entity.120787=5 -entity.120788=6 -entity.120789=7 -entity.120790=8 -entity.120791=9 -entity.120792=0 -entity.120793=1 -entity.120794=2 -entity.120795=3 -entity.120796=4 -entity.120797=5 -entity.120798=6 -entity.120799=7 -entity.120800=8 -entity.120801=9 -entity.120802=0 -entity.120803=1 -entity.120804=2 -entity.120805=3 -entity.120806=4 -entity.120807=5 -entity.120808=6 -entity.120809=7 -entity.120810=8 -entity.120811=9 -entity.120812=0 -entity.120813=1 -entity.120814=2 -entity.120815=3 -entity.120816=4 -entity.120817=5 -entity.120818=6 -entity.120819=7 -entity.120820=8 -entity.120821=9 -entity.120822=0 -entity.120823=1 -entity.120824=2 -entity.120825=3 -entity.120826=4 -entity.120827=5 -entity.120828=6 -entity.120829=7 -entity.120830=8 -entity.120831=9 -entity.125127=[1] -entity.125128=[2] -entity.125129=[3] -entity.125130=[4] -entity.125131=[5] -entity.125132=[6] -entity.125133=[7] -entity.125134=[8] -entity.125135=[9] -entity.127232=0. -entity.127233=0, -entity.127234=1, -entity.127235=2, -entity.127236=3, -entity.127237=4, -entity.127238=5, -entity.127239=6, -entity.127240=7, -entity.127241=8, -entity.127242=9, -entity.127243=(0) -entity.127244=(0) -entity.127248=(A) -entity.127249=(B) -entity.127250=(C) -entity.127251=(D) -entity.127252=(E) -entity.127253=(F) -entity.127254=(G) -entity.127255=(H) -entity.127256=(I) -entity.127257=(J) -entity.127258=(K) -entity.127259=(L) -entity.127260=(M) -entity.127261=(N) -entity.127262=(O) -entity.127263=(P) -entity.127264=(Q) -entity.127265=(R) -entity.127266=(S) -entity.127267=(T) -entity.127268=(U) -entity.127269=(V) -entity.127270=(W) -entity.127271=(X) -entity.127272=(Y) -entity.127273=(Z) -entity.127274=S -entity.127275=(C) -entity.127276=(R) -entity.127277=(CD) -entity.127278=(WZ) -entity.127338=^(MC) -entity.127339=^(MD) diff --git a/intl/unicharutil/tests/moz.build b/intl/unicharutil/tests/moz.build old mode 100644 new mode 100755 index 8cc74f51ad8..4a5706cf1de --- a/intl/unicharutil/tests/moz.build +++ b/intl/unicharutil/tests/moz.build @@ -4,8 +4,6 @@ # 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/. -XPCSHELL_TESTS_MANIFESTS += ['unit/xpcshell.ini'] - GeckoSimplePrograms([ 'NormalizationTest', 'UnicharSelfTest', diff --git a/intl/unicharutil/tests/unit/test_bug_427350_1.js b/intl/unicharutil/tests/unit/test_bug_427350_1.js deleted file mode 100644 index 7d0f8180a0f..00000000000 --- a/intl/unicharutil/tests/unit/test_bug_427350_1.js +++ /dev/null @@ -1,56 +0,0 @@ -/* Tests transliteration of new characters in Unicode 5.1, 5.2, and 6.0 - */ - -const inTeluguFractions = "\u0C78\u0C79\u0C7A\u0C7B\u0C7C\u0C7D\u0C7E"; -const inMalayalamNumbers = "\u0D70\u0D71\u0D72\u0D73\u0D74\u0D75"; - -/* MYANMAR SHAN DIGIT ONE, - SUNDANESE DIGIT TWO, - LEPCHA DIGIT THREE, - OL CHIKI DIGIT FOUR, - VAI DIGIT FIVE, - SAURASHTRA DIGIT SIX - KAYAH LI DIGIT SEVEN - CHAM DIGIT EIGHT - JAVANESE DIGIT NINE - MEETEI MAYEK DIGIT ZERO */ -const inDigits = "\u1091\u1BB2\u1C43\u1C54\uA625\uA8D6\uA907\uAA58\uA9D9\uABF0"; -const inRomanNumerals = "\u2185\u2186\u2187\u2188"; -const inSuperSubscripts = "\u2C7C\u2C7D\u2095\u209C"; - -const expectedTeluguFractions = "[0][1][2][3][1][2][3]"; -const expectedMalayalamNumbers = "[10][100][1000][1/4][1/2][3/4]"; -const expectedDigits = "1234567890"; -const expectedRomanNumerals = "[6][50][50000][100000]"; -const expectedSuperSubscripts = "v(j)^(V)v(h)v(t)"; - -const EntityAfterCharsetConv = 512; -const transliterate = 8; - -const charset = "ISO-8859-1"; - -function run_test() { - var SaveAsCharset = - Components.Constructor("@mozilla.org/intl/saveascharset;1", - "nsISaveAsCharset", - "Init"); - - var converter = new SaveAsCharset(charset, - EntityAfterCharsetConv, - transliterate); - - var outTeluguFractions = converter.Convert(inTeluguFractions); - do_check_eq(outTeluguFractions, expectedTeluguFractions); - - var outMalayalamNumbers = converter.Convert(inMalayalamNumbers); - do_check_eq(outMalayalamNumbers, expectedMalayalamNumbers); - - var outDigits = converter.Convert(inDigits); - do_check_eq(outDigits, expectedDigits); - - var outRomanNumerals = converter.Convert(inRomanNumerals); - do_check_eq(outRomanNumerals, expectedRomanNumerals); - - var outSuperSubscripts = converter.Convert(inSuperSubscripts); - do_check_eq(outSuperSubscripts, expectedSuperSubscripts); -} diff --git a/intl/unicharutil/tests/unit/xpcshell.ini b/intl/unicharutil/tests/unit/xpcshell.ini old mode 100644 new mode 100755 index 622dbcfe413..aab17cacf51 --- a/intl/unicharutil/tests/unit/xpcshell.ini +++ b/intl/unicharutil/tests/unit/xpcshell.ini @@ -2,5 +2,3 @@ head = tail = skip-if = toolkit == 'gonk' - -[test_bug_427350_1.js] diff --git a/widget/nsPrimitiveHelpers.cpp b/widget/nsPrimitiveHelpers.cpp index e141e65c7b5..543fd94fafb 100644 --- a/widget/nsPrimitiveHelpers.cpp +++ b/widget/nsPrimitiveHelpers.cpp @@ -69,11 +69,11 @@ nsPrimitiveHelpers :: CreatePrimitiveForData ( const char* aFlavor, const void* nsCOMPtr primitive = do_CreateInstance(NS_SUPPORTS_STRING_CONTRACTID); if (primitive ) { - if (aDataLen % 2) { + if (aDataLen % 2) { nsAutoArrayPtr buffer(new char[aDataLen + 1]); if (!MOZ_LIKELY(buffer)) return; - + memcpy(buffer, aDataBuff, aDataLen); buffer[aDataLen] = 0; const char16_t* start = reinterpret_cast(buffer.get()); @@ -85,7 +85,7 @@ nsPrimitiveHelpers :: CreatePrimitiveForData ( const char* aFlavor, const void* primitive->SetData(Substring(start, start + (aDataLen / 2))); } NS_ADDREF(*aPrimitive = primitive); - } + } } } // CreatePrimitiveForData @@ -99,7 +99,7 @@ nsPrimitiveHelpers :: CreatePrimitiveForData ( const char* aFlavor, const void* // parameter does not reflect that. // void -nsPrimitiveHelpers :: CreateDataFromPrimitive ( const char* aFlavor, nsISupports* aPrimitive, +nsPrimitiveHelpers :: CreateDataFromPrimitive ( const char* aFlavor, nsISupports* aPrimitive, void** aDataBuff, uint32_t aDataLen ) { if ( !aDataBuff ) @@ -132,11 +132,11 @@ nsPrimitiveHelpers :: CreateDataFromPrimitive ( const char* aFlavor, nsISupports // // Given a unicode buffer (flavor text/unicode), this converts it to plain text using // the appropriate platform charset encoding. |inUnicodeLen| is the length of the input -// string, not the # of bytes in the buffer. The |outPlainTextData| is null terminated, +// string, not the # of bytes in the buffer. The |outPlainTextData| is null terminated, // but its length parameter, |outPlainTextLen|, does not reflect that. // nsresult -nsPrimitiveHelpers :: ConvertUnicodeToPlatformPlainText ( char16_t* inUnicode, int32_t inUnicodeLen, +nsPrimitiveHelpers :: ConvertUnicodeToPlatformPlainText ( char16_t* inUnicode, int32_t inUnicodeLen, char** outPlainTextData, int32_t* outPlainTextLen ) { if ( !outPlainTextData || !outPlainTextLen ) @@ -160,14 +160,14 @@ nsPrimitiveHelpers :: ConvertUnicodeToPlatformPlainText ( char16_t* inUnicode, i rv = converter->Init(platformCharset.get(), nsISaveAsCharset::attr_EntityAfterCharsetConv + nsISaveAsCharset::attr_FallbackQuestionMark, - nsIEntityConverter::transliterate); + 0); NS_ENSURE_SUCCESS(rv, rv); rv = converter->Convert(inUnicode, outPlainTextData); *outPlainTextLen = *outPlainTextData ? strlen(*outPlainTextData) : 0; NS_ASSERTION ( NS_SUCCEEDED(rv), "Error converting unicode to plain text" ); - + return rv; } // ConvertUnicodeToPlatformPlainText @@ -176,12 +176,12 @@ nsPrimitiveHelpers :: ConvertUnicodeToPlatformPlainText ( char16_t* inUnicode, i // ConvertPlatformPlainTextToUnicode // // Given a char buffer (flavor text/plaikn), this converts it to unicode using -// the appropriate platform charset encoding. |outUnicode| is null terminated, +// the appropriate platform charset encoding. |outUnicode| is null terminated, // but its length parameter, |outUnicodeLen|, does not reflect that. |outUnicodeLen| is // the length of the string in characters, not bytes. // nsresult -nsPrimitiveHelpers :: ConvertPlatformPlainTextToUnicode ( const char* inText, int32_t inTextLen, +nsPrimitiveHelpers :: ConvertPlatformPlainTextToUnicode ( const char* inText, int32_t inTextLen, char16_t** outUnicode, int32_t* outUnicodeLen ) { if ( !outUnicode || !outUnicodeLen ) @@ -200,14 +200,14 @@ nsPrimitiveHelpers :: ConvertPlatformPlainTextToUnicode ( const char* inText, in rv = platformCharsetService->GetCharset(kPlatformCharsetSel_PlainTextInClipboard, platformCharset); if (NS_FAILED(rv)) platformCharset.AssignLiteral("windows-1252"); - + decoder = EncodingUtils::DecoderForEncoding(platformCharset); hasConverter = true; } - + // Estimate out length and allocate the buffer based on a worst-case estimate, then do - // the conversion. + // the conversion. decoder->GetMaxLength(inText, inTextLen, outUnicodeLen); // |outUnicodeLen| is number of chars if ( *outUnicodeLen ) { *outUnicode = reinterpret_cast(moz_xmalloc((*outUnicodeLen + 1) * sizeof(char16_t))); @@ -234,20 +234,20 @@ nsPrimitiveHelpers :: ConvertPlatformPlainTextToUnicode ( const char* inText, in // NOTE: this assumes that it can use 'free' to dispose of the old buffer. // nsresult -nsLinebreakHelpers :: ConvertPlatformToDOMLinebreaks ( const char* inFlavor, void** ioData, +nsLinebreakHelpers :: ConvertPlatformToDOMLinebreaks ( const char* inFlavor, void** ioData, int32_t* ioLengthInBytes ) { NS_ASSERTION ( ioData && *ioData && ioLengthInBytes, "Bad Params"); if ( !(ioData && *ioData && ioLengthInBytes) ) return NS_ERROR_INVALID_ARG; - + nsresult retVal = NS_OK; - + if ( strcmp(inFlavor, "text/plain") == 0 ) { char* buffAsChars = reinterpret_cast(*ioData); char* oldBuffer = buffAsChars; - retVal = nsLinebreakConverter::ConvertLineBreaksInSitu ( &buffAsChars, nsLinebreakConverter::eLinebreakAny, - nsLinebreakConverter::eLinebreakContent, + retVal = nsLinebreakConverter::ConvertLineBreaksInSitu ( &buffAsChars, nsLinebreakConverter::eLinebreakAny, + nsLinebreakConverter::eLinebreakContent, *ioLengthInBytes, ioLengthInBytes ); if ( NS_SUCCEEDED(retVal) ) { if ( buffAsChars != oldBuffer ) // check if buffer was reallocated @@ -258,12 +258,12 @@ nsLinebreakHelpers :: ConvertPlatformToDOMLinebreaks ( const char* inFlavor, voi else if ( strcmp(inFlavor, "image/jpeg") == 0 ) { // I'd assume we don't want to do anything for binary data.... } - else { + else { char16_t* buffAsUnichar = reinterpret_cast(*ioData); char16_t* oldBuffer = buffAsUnichar; int32_t newLengthInChars; - retVal = nsLinebreakConverter::ConvertUnicharLineBreaksInSitu ( &buffAsUnichar, nsLinebreakConverter::eLinebreakAny, - nsLinebreakConverter::eLinebreakContent, + retVal = nsLinebreakConverter::ConvertUnicharLineBreaksInSitu ( &buffAsUnichar, nsLinebreakConverter::eLinebreakAny, + nsLinebreakConverter::eLinebreakContent, *ioLengthInBytes / sizeof(char16_t), &newLengthInChars ); if ( NS_SUCCEEDED(retVal) ) { if ( buffAsUnichar != oldBuffer ) // check if buffer was reallocated @@ -272,7 +272,7 @@ nsLinebreakHelpers :: ConvertPlatformToDOMLinebreaks ( const char* inFlavor, voi *ioLengthInBytes = newLengthInChars * sizeof(char16_t); } } - + return retVal; } // ConvertPlatformToDOMLinebreaks From 8cb800a0e97b2c577229f9cf4698033749c62b2d Mon Sep 17 00:00:00 2001 From: Jet Villegas Date: Fri, 24 Apr 2015 17:44:00 -0400 Subject: [PATCH 26/58] Bug 1146561 - Add back the visibility check for Mac plugins. r=jmuizelaar --- layout/generic/nsPluginFrame.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/layout/generic/nsPluginFrame.cpp b/layout/generic/nsPluginFrame.cpp index fc8c5b4d2e7..0d7a37b414b 100644 --- a/layout/generic/nsPluginFrame.cpp +++ b/layout/generic/nsPluginFrame.cpp @@ -1075,7 +1075,7 @@ void nsPluginFrame::DidSetWidgetGeometry() { #if defined(XP_MACOSX) - if (mInstanceOwner) { + if (mInstanceOwner && !IsHidden()) { mInstanceOwner->FixUpPluginWindow(nsPluginInstanceOwner::ePluginPaintEnable); } #else From ea5d7cdd605a778a2e69a2b6748c2beb2a27d227 Mon Sep 17 00:00:00 2001 From: theoneisneo Date: Thu, 2 Apr 2015 01:56:00 -0400 Subject: [PATCH 27/58] Bug 1149872 - Add the missing format specifiers. r=jduell --- intl/icu/source/common/uinvchar.c | 2 +- netwerk/protocol/websocket/WebSocketChannel.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/intl/icu/source/common/uinvchar.c b/intl/icu/source/common/uinvchar.c index f874edd9a27..58f8a233a73 100644 --- a/intl/icu/source/common/uinvchar.c +++ b/intl/icu/source/common/uinvchar.c @@ -429,7 +429,7 @@ uprv_copyEbcdic(const UDataSwapper *ds, while(count>0) { c=*s++; if(c!=0 && ((c=asciiFromEbcdic[c])==0 || !UCHAR_IS_INVARIANT(c))) { - udata_printError(ds, "uprv_copyEbcdic() string[%] contains a variant character in position %d\n", + udata_printError(ds, "uprv_copyEbcdic() string[%d] contains a variant character in position %d\n", length, length-count); *pErrorCode=U_INVALID_CHAR_FOUND; return 0; diff --git a/netwerk/protocol/websocket/WebSocketChannel.cpp b/netwerk/protocol/websocket/WebSocketChannel.cpp index fea823d1508..a11347b4c2f 100644 --- a/netwerk/protocol/websocket/WebSocketChannel.cpp +++ b/netwerk/protocol/websocket/WebSocketChannel.cpp @@ -2703,7 +2703,7 @@ WebSocketChannel::OnProxyAvailable(nsICancelable *aRequest, nsIChannel *aChannel // call DNS callback directly without DNS resolver OnLookupComplete(nullptr, nullptr, NS_ERROR_FAILURE); } else { - LOG(("WebSocketChannel::OnProxyAvailable[%] checking DNS resolution\n", this)); + LOG(("WebSocketChannel::OnProxyAvailable[%p] checking DNS resolution\n", this)); nsresult rv = DoAdmissionDNS(); if (NS_FAILED(rv)) { LOG(("WebSocket OnProxyAvailable [%p] DNS lookup failed\n", this)); From 63c6e0f6034b20d679d790ad64ba18b7e5b4a062 Mon Sep 17 00:00:00 2001 From: ProgramFOX Date: Wed, 29 Apr 2015 16:56:53 +0200 Subject: [PATCH 28/58] Bug 1153602 - SIMD (interpreter): Added more test cases for ReciprocalSqrtApproximation. r=Waldo --- js/src/tests/ecma_7/SIMD/float64x2-arithmetic.js | 3 ++- js/src/tests/ecma_7/SIMD/unary-operations.js | 7 +++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/js/src/tests/ecma_7/SIMD/float64x2-arithmetic.js b/js/src/tests/ecma_7/SIMD/float64x2-arithmetic.js index d23f5cff909..ec96359338f 100644 --- a/js/src/tests/ecma_7/SIMD/float64x2-arithmetic.js +++ b/js/src/tests/ecma_7/SIMD/float64x2-arithmetic.js @@ -52,7 +52,8 @@ function test() { for ([v, w] of [[float64x2(1, 2), float64x2(3, 4)], [float64x2(1.894, 2.8909), float64x2(100.764, 200.987)], [float64x2(-1, -2), float64x2(-14.54, 57)], - [float64x2(+Infinity, -Infinity), float64x2(NaN, -0)]]) + [float64x2(+Infinity, -Infinity), float64x2(NaN, -0)], + [float64x2(Math.pow(2, 31), Math.pow(2, -31)), float64x2(Math.pow(2, -1047), Math.pow(2, -149))]]) { testAdd(v, w); testSub(v, w); diff --git a/js/src/tests/ecma_7/SIMD/unary-operations.js b/js/src/tests/ecma_7/SIMD/unary-operations.js index d8186d08ab1..5a1b2ac3cb9 100644 --- a/js/src/tests/ecma_7/SIMD/unary-operations.js +++ b/js/src/tests/ecma_7/SIMD/unary-operations.js @@ -51,13 +51,16 @@ function testFloat32x4reciprocalApproximation() { function testFloat32x4reciprocalSqrtApproximation() { function reciprocalsqrtf(a) { - return Math.fround(1 / Math.sqrt(a)); + assertEq(Math.fround(a), a); + return Math.fround(1 / Math.fround(Math.sqrt(a))); } var vals = [ [[1, 1, 0.25, 0.25], [1, 1, 2, 2]], [[25, 16, 6.25, 1.5625], [25, 16, 6.25, 1.5625].map(reciprocalsqrtf)], - [[NaN, -0, Infinity, -Infinity], [NaN, -0, Infinity, -Infinity].map(reciprocalsqrtf)] + [[NaN, -0, Infinity, -Infinity], [NaN, -0, Infinity, -Infinity].map(reciprocalsqrtf)], + [[Math.pow(2, 32), Math.pow(2, -32), +0, Math.pow(2, -148)], + [Math.pow(2, -16), Math.pow(2, 16), Infinity, Math.pow(2, 74)]] ]; for (var [v,w] of vals) { From ea10c0a4d5ef305c4106ea002a1065784914791f Mon Sep 17 00:00:00 2001 From: Marco Zehe Date: Thu, 30 Apr 2015 10:26:00 -0400 Subject: [PATCH 29/58] Bug 1159872 - Make IAccessible2::Get_States once again return S_OK when it detects a defunct accessible. r=surkov CLOSED TREE --- accessible/windows/ia2/ia2Accessible.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/accessible/windows/ia2/ia2Accessible.cpp b/accessible/windows/ia2/ia2Accessible.cpp index cd15a963c45..0a4eb5d4153 100644 --- a/accessible/windows/ia2/ia2Accessible.cpp +++ b/accessible/windows/ia2/ia2Accessible.cpp @@ -354,7 +354,7 @@ ia2Accessible::get_states(AccessibleStates* aStates) AccessibleWrap* acc = static_cast(this); if (acc->IsDefunct()) { *aStates = IA2_STATE_DEFUNCT; - return CO_E_OBJNOTCONNECTED; + return S_OK; } uint64_t state; From 2da630d87289ca915e9549df4c33772cf79570d3 Mon Sep 17 00:00:00 2001 From: Olli Pettay Date: Thu, 30 Apr 2015 14:34:05 +0300 Subject: [PATCH 30/58] Bug 1153603 - SMIL/SVG event type-> Event Handler mapping shouldn't affect to Event.type. r=heycam --- dom/base/nsContentUtils.cpp | 24 ++++++++++++++++++++++-- dom/smil/test/test_smilTimeEvents.xhtml | 7 +++++++ 2 files changed, 29 insertions(+), 2 deletions(-) diff --git a/dom/base/nsContentUtils.cpp b/dom/base/nsContentUtils.cpp index 0c36faf6a0d..6a6f64fb77b 100644 --- a/dom/base/nsContentUtils.cpp +++ b/dom/base/nsContentUtils.cpp @@ -639,6 +639,22 @@ nsContentUtils::InitializeModifierStrings() sModifierSeparator = new nsString(modifierSeparator); } +// Because of SVG/SMIL we have several atoms mapped to the same +// id, but we can rely on ID_TO_EVENT to map id to only one atom. +static bool +ShouldAddEventToStringEventTable(const EventNameMapping& aMapping) +{ + switch(aMapping.mId) { +#define ID_TO_EVENT(name_, id_, type_, struct_) \ + case id_: return nsGkAtoms::on##name_ == aMapping.mAtom; +#include "mozilla/EventNameList.h" +#undef ID_TO_EVENT + default: + break; + } + return false; +} + bool nsContentUtils::InitializeEventTable() { NS_ASSERTION(!sAtomEventTable, "EventTable already initialized!"); @@ -651,6 +667,7 @@ nsContentUtils::InitializeEventTable() { #define NON_IDL_EVENT EVENT #include "mozilla/EventNameList.h" #undef WINDOW_ONLY_EVENT +#undef NON_IDL_EVENT #undef EVENT { nullptr } }; @@ -664,8 +681,11 @@ nsContentUtils::InitializeEventTable() { // Subtract one from the length because of the trailing null for (uint32_t i = 0; i < ArrayLength(eventArray) - 1; ++i) { sAtomEventTable->Put(eventArray[i].mAtom, eventArray[i]); - sStringEventTable->Put(Substring(nsDependentAtomString(eventArray[i].mAtom), 2), - eventArray[i]); + if (ShouldAddEventToStringEventTable(eventArray[i])) { + sStringEventTable->Put( + Substring(nsDependentAtomString(eventArray[i].mAtom), 2), + eventArray[i]); + } } return true; diff --git a/dom/smil/test/test_smilTimeEvents.xhtml b/dom/smil/test/test_smilTimeEvents.xhtml index 53b47466e6d..f1e26fe82e3 100644 --- a/dom/smil/test/test_smilTimeEvents.xhtml +++ b/dom/smil/test/test_smilTimeEvents.xhtml @@ -287,6 +287,13 @@ gAnim.addEventListener("beginEvent", handleOnBegin, false); gAnim.addEventListener("repeatEvent", handleOnRepeat, false); gAnim.addEventListener("endEvent", handleOnEnd, false); gCircle.addEventListener("beginEvent", parentHandler, false); + +var expectedEvents = + ["begin", "beginEvent", "repeat", "repeatEvent", "end", "endEvent", "SVGZoom", "zoom"]; + +for (var i = 0; i < expectedEvents.length; ++i) { + is((new Event(expectedEvents[i])).type, expectedEvents[i], "Unexpected event type!"); +} ]]> From b64e5cbce85e0c4e70f8daee2c0f28024a781d04 Mon Sep 17 00:00:00 2001 From: Andrea Marchesini Date: Thu, 30 Apr 2015 15:32:47 +0100 Subject: [PATCH 31/58] Bug 1157627 - about:serviceworkers should show new registered ServiceWorkers. r=nsm --- dom/workers/ServiceWorkerManager.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/dom/workers/ServiceWorkerManager.cpp b/dom/workers/ServiceWorkerManager.cpp index ed356a39efe..1b13ef7707d 100644 --- a/dom/workers/ServiceWorkerManager.cpp +++ b/dom/workers/ServiceWorkerManager.cpp @@ -581,6 +581,7 @@ public: if (newest && mScriptSpec.Equals(newest->ScriptSpec()) && mScriptSpec.Equals(mRegistration->mScriptSpec)) { mRegistration->mPendingUninstall = false; + swm->StoreRegistration(mPrincipal, mRegistration); Succeed(); Done(NS_OK); return; From 59005b2eab6a9298bdf73d4828b0e709b4c94d9b Mon Sep 17 00:00:00 2001 From: Eric Rahm Date: Thu, 30 Apr 2015 15:10:03 -0700 Subject: [PATCH 32/58] Bug 1160267 - JS build files should not declare IMPL_MFBT. r=glandium --- js/src/gdb/moz.build | 5 +---- js/src/jsapi-tests/moz.build | 3 --- js/src/shell/moz.build | 5 +---- 3 files changed, 2 insertions(+), 11 deletions(-) diff --git a/js/src/gdb/moz.build b/js/src/gdb/moz.build index 5d795b16f56..4887b52c3f4 100644 --- a/js/src/gdb/moz.build +++ b/js/src/gdb/moz.build @@ -20,10 +20,7 @@ UNIFIED_SOURCES += [ 'tests/typedef-printers.cpp', ] -# Building against js_static requires that we declare mfbt sybols "exported" -# on its behalf. -for var in ('EXPORT_JS_API', 'IMPL_MFBT'): - DEFINES[var] = True +DEFINES['EXPORT_JS_API'] = True LOCAL_INCLUDES += ['..'] GENERATED_INCLUDES += ['..'] diff --git a/js/src/jsapi-tests/moz.build b/js/src/jsapi-tests/moz.build index e7e3168a13d..f265bac6fa3 100644 --- a/js/src/jsapi-tests/moz.build +++ b/js/src/jsapi-tests/moz.build @@ -100,9 +100,6 @@ if CONFIG['ENABLE_ION']: ] DEFINES['EXPORT_JS_API'] = True -# Building against js_static requires that we declare mfbt sybols "exported" -# on its behalf. -DEFINES['IMPL_MFBT'] = True LOCAL_INCLUDES += ['..'] GENERATED_INCLUDES += ['..'] diff --git a/js/src/shell/moz.build b/js/src/shell/moz.build index efb4ba140e2..d34cf02c5d8 100644 --- a/js/src/shell/moz.build +++ b/js/src/shell/moz.build @@ -16,10 +16,7 @@ UNIFIED_SOURCES += [ 'OSObject.cpp' ] -# Building against js_static requires that we declare mfbt sybols "exported" -# on its behalf. -for var in ('EXPORT_JS_API', 'IMPL_MFBT'): - DEFINES[var] = True +DEFINES['EXPORT_JS_API'] = True if CONFIG['_MSC_VER']: # unnecessary PGO for js shell. But gcc cannot turn off pgo because it is From 16e29d47596f9e569f4d9a3cf9ff50bbfb7124f4 Mon Sep 17 00:00:00 2001 From: Terrence Cole Date: Thu, 30 Apr 2015 11:29:43 -0700 Subject: [PATCH 33/58] Bug 1159428 - Use Value and Id type-based dispatching to simplify barriers; r=jonco --- js/src/gc/Barrier.cpp | 49 +++++++++-------- js/src/gc/Barrier.h | 125 +++++------------------------------------- js/src/gc/Marking.cpp | 13 ----- js/src/gc/Zone.cpp | 6 -- js/src/jsgc.cpp | 2 +- 5 files changed, 42 insertions(+), 153 deletions(-) diff --git a/js/src/gc/Barrier.cpp b/js/src/gc/Barrier.cpp index 6b09f37a4b3..01aca5d3c42 100644 --- a/js/src/gc/Barrier.cpp +++ b/js/src/gc/Barrier.cpp @@ -13,22 +13,10 @@ #include "js/Value.h" #include "vm/Symbol.h" -namespace js { - -struct ReadBarrierFunctor : public VoidDefaultAdaptor { - template void operator()(T* t) { T::readBarrier(t); } -}; - -void -ValueReadBarrier(const Value& value) -{ - MOZ_ASSERT(!CurrentThreadIsIonCompiling()); - DispatchValueTyped(ReadBarrierFunctor(), value); -} - #ifdef DEBUG + bool -HeapSlot::preconditionForSet(NativeObject* owner, Kind kind, uint32_t slot) +js::HeapSlot::preconditionForSet(NativeObject* owner, Kind kind, uint32_t slot) { return kind == Slot ? &owner->getSlotRef(slot) == this @@ -36,7 +24,8 @@ HeapSlot::preconditionForSet(NativeObject* owner, Kind kind, uint32_t slot) } bool -HeapSlot::preconditionForWriteBarrierPost(NativeObject* obj, Kind kind, uint32_t slot, Value target) const +js::HeapSlot::preconditionForWriteBarrierPost(NativeObject* obj, Kind kind, uint32_t slot, + Value target) const { return kind == Slot ? obj->getSlotAddressUnchecked(slot)->get() == target @@ -44,29 +33,45 @@ HeapSlot::preconditionForWriteBarrierPost(NativeObject* obj, Kind kind, uint32_t } bool -RuntimeFromMainThreadIsHeapMajorCollecting(JS::shadow::Zone* shadowZone) +js::RuntimeFromMainThreadIsHeapMajorCollecting(JS::shadow::Zone* shadowZone) { return shadowZone->runtimeFromMainThread()->isHeapMajorCollecting(); } bool -CurrentThreadIsIonCompiling() +js::CurrentThreadIsIonCompiling() { return TlsPerThreadData.get()->ionCompiling; } bool -CurrentThreadIsGCSweeping() +js::CurrentThreadIsGCSweeping() { return js::TlsPerThreadData.get()->gcSweeping; } #endif // DEBUG -bool -StringIsPermanentAtom(JSString* str) +template +template +void +js::ReadBarrierFunctor::operator()(T* t) { - return str->isPermanentAtom(); + InternalGCMethods::readBarrier(t); } +template void js::ReadBarrierFunctor::operator()(JS::Symbol*); +template void js::ReadBarrierFunctor::operator()(JSObject*); +template void js::ReadBarrierFunctor::operator()(JSString*); -} // namespace js +template +template +void +js::PreBarrierFunctor::operator()(T* t) +{ + InternalGCMethods::preBarrier(t); +} +template void js::PreBarrierFunctor::operator()(JS::Symbol*); +template void js::PreBarrierFunctor::operator()(JSObject*); +template void js::PreBarrierFunctor::operator()(JSString*); +template void js::PreBarrierFunctor::operator()(JS::Symbol*); +template void js::PreBarrierFunctor::operator()(JSString*); diff --git a/js/src/gc/Barrier.h b/js/src/gc/Barrier.h index cce5a1e5b02..2bfed126d04 100644 --- a/js/src/gc/Barrier.h +++ b/js/src/gc/Barrier.h @@ -11,6 +11,7 @@ #include "gc/Heap.h" #include "gc/StoreBuffer.h" +#include "js/HeapAPI.h" #include "js/Id.h" #include "js/RootingAPI.h" #include "js/Value.h" @@ -196,9 +197,6 @@ bool CurrentThreadIsGCSweeping(); #endif -bool -StringIsPermanentAtom(JSString* str); - namespace gc { template struct MapTypeToTraceKind {}; @@ -240,55 +238,6 @@ void MarkIdForBarrier(JSTracer* trc, jsid* idp, const char* name); } // namespace gc -// This context is more basal than the GC things being implemented, so C++ does -// not know about the inheritance hierarchy yet. -static inline const gc::TenuredCell* AsTenuredCell(const JSString* str) { - return reinterpret_cast(str); -} -static inline const gc::TenuredCell* AsTenuredCell(const JS::Symbol* sym) { - return reinterpret_cast(sym); -} - -JS::Zone* -ZoneOfObjectFromAnyThread(const JSObject& obj); - -static inline JS::shadow::Zone* -ShadowZoneOfObjectFromAnyThread(JSObject* obj) -{ - return JS::shadow::Zone::asShadowZone(ZoneOfObjectFromAnyThread(*obj)); -} - -static inline JS::shadow::Zone* -ShadowZoneOfStringFromAnyThread(JSString* str) -{ - return JS::shadow::Zone::asShadowZone(AsTenuredCell(str)->zoneFromAnyThread()); -} - -static inline JS::shadow::Zone* -ShadowZoneOfSymbolFromAnyThread(JS::Symbol* sym) -{ - return JS::shadow::Zone::asShadowZone(AsTenuredCell(sym)->zoneFromAnyThread()); -} - -MOZ_ALWAYS_INLINE JS::Zone* -ZoneOfValueFromAnyThread(const JS::Value& value) -{ - MOZ_ASSERT(value.isMarkable()); - if (value.isObject()) - return ZoneOfObjectFromAnyThread(value.toObject()); - return js::gc::TenuredCell::fromPointer(value.toGCThing())->zoneFromAnyThread(); -} - -MOZ_ALWAYS_INLINE JS::Zone* -ZoneOfIdFromAnyThread(const jsid& id) -{ - MOZ_ASSERT(JSID_IS_GCTHING(id)); - return js::gc::TenuredCell::fromPointer(JSID_TO_GCTHING(id).asCell())->zoneFromAnyThread(); -} - -void -ValueReadBarrier(const Value& value); - template struct InternalGCMethods {}; @@ -306,46 +255,23 @@ struct InternalGCMethods static void readBarrier(T* v) { T::readBarrier(v); } }; +template struct PreBarrierFunctor : VoidDefaultAdaptor { + template void operator()(T* t); +}; + +template struct ReadBarrierFunctor : public VoidDefaultAdaptor { + template void operator()(T* t); +}; + template <> struct InternalGCMethods { - static JSRuntime* runtimeFromAnyThread(const Value& v) { - MOZ_ASSERT(v.isMarkable()); - return static_cast(v.toGCThing())->runtimeFromAnyThread(); - } - static JS::shadow::Runtime* shadowRuntimeFromAnyThread(const Value& v) { - return reinterpret_cast(runtimeFromAnyThread(v)); - } - static JSRuntime* runtimeFromMainThread(const Value& v) { - MOZ_ASSERT(v.isMarkable()); - return static_cast(v.toGCThing())->runtimeFromMainThread(); - } - static JS::shadow::Runtime* shadowRuntimeFromMainThread(const Value& v) { - return reinterpret_cast(runtimeFromMainThread(v)); - } - static bool isMarkable(Value v) { return v.isMarkable(); } static void preBarrier(Value v) { - MOZ_ASSERT(!CurrentThreadIsIonCompiling()); - if (v.isString() && StringIsPermanentAtom(v.toString())) - return; - if (v.isMarkable() && shadowRuntimeFromAnyThread(v)->needsIncrementalBarrier()) - preBarrierImpl(ZoneOfValueFromAnyThread(v), v); + DispatchValueTyped(PreBarrierFunctor(), v); } - private: - static void preBarrierImpl(Zone* zone, Value v) { - JS::shadow::Zone* shadowZone = JS::shadow::Zone::asShadowZone(zone); - if (shadowZone->needsIncrementalBarrier()) { - MOZ_ASSERT_IF(v.isMarkable(), shadowRuntimeFromMainThread(v)->needsIncrementalBarrier()); - Value tmp(v); - js::gc::MarkValueForBarrier(shadowZone->barrierTracer(), &tmp, "write barrier"); - MOZ_ASSERT(tmp == v); - } - } - - public: static void postBarrier(Value* vp) { MOZ_ASSERT(!CurrentThreadIsIonCompiling()); if (vp->isObject()) { @@ -373,7 +299,9 @@ struct InternalGCMethods shadowRuntime->gcStoreBufferPtr()->removeRelocatableValueFromAnyThread(vp); } - static void readBarrier(const Value& v) { ValueReadBarrier(v); } + static void readBarrier(const Value& v) { + DispatchValueTyped(ReadBarrierFunctor(), v); + } }; template <> @@ -381,32 +309,7 @@ struct InternalGCMethods { static bool isMarkable(jsid id) { return JSID_IS_STRING(id) || JSID_IS_SYMBOL(id); } - static void preBarrier(jsid id) { - MOZ_ASSERT(!CurrentThreadIsIonCompiling()); - if (JSID_IS_STRING(id) && StringIsPermanentAtom(JSID_TO_STRING(id))) - return; - if (JSID_IS_GCTHING(id) && shadowRuntimeFromAnyThread(id)->needsIncrementalBarrier()) - preBarrierImpl(ZoneOfIdFromAnyThread(id), id); - } - - private: - static JSRuntime* runtimeFromAnyThread(jsid id) { - MOZ_ASSERT(JSID_IS_GCTHING(id)); - return JSID_TO_GCTHING(id).asCell()->runtimeFromAnyThread(); - } - static JS::shadow::Runtime* shadowRuntimeFromAnyThread(jsid id) { - return reinterpret_cast(runtimeFromAnyThread(id)); - } - static void preBarrierImpl(Zone* zone, jsid id) { - JS::shadow::Zone* shadowZone = JS::shadow::Zone::asShadowZone(zone); - if (shadowZone->needsIncrementalBarrier()) { - jsid tmp(id); - js::gc::MarkIdForBarrier(shadowZone->barrierTracer(), &tmp, "id write barrier"); - MOZ_ASSERT(tmp == id); - } - } - - public: + static void preBarrier(jsid id) { DispatchIdTyped(PreBarrierFunctor(), id); } static void postBarrier(jsid* idp) {} static void postBarrierRelocate(jsid* idp) {} static void postBarrierRemove(jsid* idp) {} diff --git a/js/src/gc/Marking.cpp b/js/src/gc/Marking.cpp index d6853ded0c8..2e3bd839dc2 100644 --- a/js/src/gc/Marking.cpp +++ b/js/src/gc/Marking.cpp @@ -526,19 +526,6 @@ js::TraceObjectSlots(JSTracer* trc, NativeObject* obj, uint32_t start, uint32_t } } -void -gc::MarkValueForBarrier(JSTracer* trc, Value* valuep, const char* name) -{ - MOZ_ASSERT(!trc->runtime()->isHeapCollecting()); - TraceManuallyBarrieredEdge(trc, valuep, name); -} - -void -gc::MarkIdForBarrier(JSTracer* trc, jsid* idp, const char* name) -{ - TraceManuallyBarrieredEdge(trc, idp, name); -} - // A typed functor adaptor for TraceRoot. struct TraceRootFunctor { template diff --git a/js/src/gc/Zone.cpp b/js/src/gc/Zone.cpp index 9c0e00dc4f6..746424b5cf0 100644 --- a/js/src/gc/Zone.cpp +++ b/js/src/gc/Zone.cpp @@ -232,12 +232,6 @@ Zone::createJitZone(JSContext* cx) return jitZone_; } -JS::Zone* -js::ZoneOfObjectFromAnyThread(const JSObject& obj) -{ - return obj.zoneFromAnyThread(); -} - bool Zone::hasMarkedCompartments() { diff --git a/js/src/jsgc.cpp b/js/src/jsgc.cpp index d191f94dc1c..628b0862062 100644 --- a/js/src/jsgc.cpp +++ b/js/src/jsgc.cpp @@ -7101,7 +7101,7 @@ JS::IncrementalReferenceBarrier(GCCellPtr thing) if (!thing) return; - if (thing.isString() && StringIsPermanentAtom(thing.toString())) + if (thing.isString() && thing.toString()->isPermanentAtom()) return; #ifdef DEBUG From 881fe344f40b3876c3da8500f6855de7d320a58e Mon Sep 17 00:00:00 2001 From: Milan Sreckovic Date: Fri, 1 May 2015 13:26:38 -0400 Subject: [PATCH 34/58] Bug 1160157: Part 1. Uninitialized statics aren't really uninitialized, but it doesn't read well. r=jmuizelaar --- gfx/thebes/gfxWindowsPlatform.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/gfx/thebes/gfxWindowsPlatform.cpp b/gfx/thebes/gfxWindowsPlatform.cpp index caefb86d38b..eae2a1c4d91 100644 --- a/gfx/thebes/gfxWindowsPlatform.cpp +++ b/gfx/thebes/gfxWindowsPlatform.cpp @@ -1725,8 +1725,8 @@ gfxWindowsPlatform::GetDXGIAdapter() bool DoesD3D11DeviceWork(ID3D11Device *device) { - static bool checked; - static bool result; + static bool checked = false; + static bool result = false; if (checked) return result; @@ -1764,8 +1764,8 @@ bool DoesD3D11DeviceWork(ID3D11Device *device) // with E_OUTOFMEMORY. bool DoesD3D11TextureSharingWork(ID3D11Device *device) { - static bool checked; - static bool result; + static bool checked = false; + static bool result = false; if (checked) return result; From bc476d0e754d21a8ad60054779bdbca122ebdff4 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Fri, 1 May 2015 13:29:44 -0400 Subject: [PATCH 35/58] Bug 1013412 - End wheel transactions as soon as possible if content is doing a prevent-default. r=dvander --- gfx/layers/apz/src/InputBlockState.cpp | 9 +++++++++ gfx/layers/apz/src/InputBlockState.h | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/gfx/layers/apz/src/InputBlockState.cpp b/gfx/layers/apz/src/InputBlockState.cpp index 18e8594e50b..5ca846400cf 100644 --- a/gfx/layers/apz/src/InputBlockState.cpp +++ b/gfx/layers/apz/src/InputBlockState.cpp @@ -181,6 +181,15 @@ WheelBlockState::WheelBlockState(const nsRefPtr& aTarget } } +bool +WheelBlockState::SetContentResponse(bool aPreventDefault) +{ + if (aPreventDefault) { + EndTransaction(); + } + return CancelableBlockState::SetContentResponse(aPreventDefault); +} + bool WheelBlockState::SetConfirmedTargetApzc(const nsRefPtr& aTargetApzc) { diff --git a/gfx/layers/apz/src/InputBlockState.h b/gfx/layers/apz/src/InputBlockState.h index 6070323714b..0e5b7dd4038 100644 --- a/gfx/layers/apz/src/InputBlockState.h +++ b/gfx/layers/apz/src/InputBlockState.h @@ -92,7 +92,7 @@ public: * @return false if this block has already received a response from * web content, true if not. */ - bool SetContentResponse(bool aPreventDefault); + virtual bool SetContentResponse(bool aPreventDefault); /** * Record that content didn't respond in time. @@ -161,6 +161,7 @@ public: bool aTargetConfirmed, const ScrollWheelInput& aEvent); + bool SetContentResponse(bool aPreventDefault) override; bool IsReadyForHandling() const override; bool HasEvents() const override; void DropEvents() override; From 72117d677d4ff1836eb99da0d9e47678f99defc0 Mon Sep 17 00:00:00 2001 From: Kartikaya Gupta Date: Fri, 1 May 2015 13:31:24 -0400 Subject: [PATCH 36/58] Bug 1013412 - Add a test. r=dvander --- dom/events/test/mochitest.ini | 2 + dom/events/test/test_bug1013412.html | 103 +++++++++++++++++++++++++++ 2 files changed, 105 insertions(+) create mode 100644 dom/events/test/test_bug1013412.html diff --git a/dom/events/test/mochitest.ini b/dom/events/test/mochitest.ini index 50ddec77f49..9d4707a47b6 100644 --- a/dom/events/test/mochitest.ini +++ b/dom/events/test/mochitest.ini @@ -186,3 +186,5 @@ support-files = bug1096146_embedded.html [test_offsetxy.html] [test_eventhandler_scoping.html] +[test_bug1013412.html] +skip-if = buildapp == 'b2g' # no wheel events on b2g diff --git a/dom/events/test/test_bug1013412.html b/dom/events/test/test_bug1013412.html new file mode 100644 index 00000000000..c6a6d9ea0a7 --- /dev/null +++ b/dom/events/test/test_bug1013412.html @@ -0,0 +1,103 @@ + + + + + Test for Bug 1013412 + + + + + + +Mozilla Bug 1013412 +

+
+

Scrolling the page should be async, but scrolling over the dark circle should not scroll the page and instead rotate the white ball.

+
+
+
+
+
+
+
+
+
+ + + From 9275df22fbc3d81a8c62d85a201a818479010719 Mon Sep 17 00:00:00 2001 From: Ralph Giles Date: Wed, 29 Apr 2015 11:28:00 -0700 Subject: [PATCH 37/58] Bug 1159840 - Remove libvpx alignment patch. r=kinetik Follow-up testing in suggests that the crash in vp8_diamond_search_sadx4 was caused by unified build breakage, so we may no longer need this. --- media/libvpx/bug1137614.patch | 23 ----------------------- media/libvpx/update.py | 2 -- media/libvpx/vp8/encoder/block.h | 3 +-- 3 files changed, 1 insertion(+), 27 deletions(-) delete mode 100644 media/libvpx/bug1137614.patch diff --git a/media/libvpx/bug1137614.patch b/media/libvpx/bug1137614.patch deleted file mode 100644 index 6f4e3508822..00000000000 --- a/media/libvpx/bug1137614.patch +++ /dev/null @@ -1,23 +0,0 @@ -diff --git a/media/libvpx/vp8/encoder/block.h b/media/libvpx/vp8/encoder/block.h ---- a/media/libvpx/vp8/encoder/block.h -+++ b/media/libvpx/vp8/encoder/block.h -@@ -93,17 +93,18 @@ typedef struct macroblock - int rddiv; - int rdmult; - unsigned int * mb_activity_ptr; - int * mb_norm_activity_ptr; - signed int act_zbin_adj; - signed int last_act_zbin_adj; - - int *mvcost[2]; -- int *mvsadcost[2]; -+ /* MSVC generates code that thinks this is 16-byte aligned */ -+ DECLARE_ALIGNED(16, int*, mvsadcost[2]); - int (*mbmode_cost)[MB_MODE_COUNT]; - int (*intra_uv_mode_cost)[MB_MODE_COUNT]; - int (*bmode_costs)[10][10]; - int *inter_bmode_costs; - int (*token_costs)[COEF_BANDS][PREV_COEF_CONTEXTS] - [MAX_ENTROPY_TOKENS]; - - /* These define limits to motion vector components to prevent diff --git a/media/libvpx/update.py b/media/libvpx/update.py index 1dce1f21d0e..50e36a44896 100755 --- a/media/libvpx/update.py +++ b/media/libvpx/update.py @@ -524,8 +524,6 @@ def apply_patches(): os.system("patch -p3 < apple-clang.patch") # Patch to allow MSVC 2015 to compile libvpx os.system("patch -p3 < msvc2015.patch") - # Patch to fix a crash caused by MSVC 2013 - os.system("patch -p3 < bug1137614.patch") def update_readme(commit): with open('README_MOZILLA') as f: diff --git a/media/libvpx/vp8/encoder/block.h b/media/libvpx/vp8/encoder/block.h index eae00d96026..dd733e55a9d 100644 --- a/media/libvpx/vp8/encoder/block.h +++ b/media/libvpx/vp8/encoder/block.h @@ -98,8 +98,7 @@ typedef struct macroblock signed int last_act_zbin_adj; int *mvcost[2]; - /* MSVC generates code that thinks this is 16-byte aligned */ - DECLARE_ALIGNED(16, int*, mvsadcost[2]); + int *mvsadcost[2]; int (*mbmode_cost)[MB_MODE_COUNT]; int (*intra_uv_mode_cost)[MB_MODE_COUNT]; int (*bmode_costs)[10][10]; From e917d0ffd68fa2a1ddc0acd4478ab7030216bad6 Mon Sep 17 00:00:00 2001 From: Doug Turner Date: Fri, 1 May 2015 10:54:48 -0700 Subject: [PATCH 38/58] Bug 1160316 - Bump IndexedDB name. r=nsm --- dom/push/PushService.jsm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/push/PushService.jsm b/dom/push/PushService.jsm index 97724c0368a..ff8e24b729f 100644 --- a/dom/push/PushService.jsm +++ b/dom/push/PushService.jsm @@ -47,9 +47,9 @@ const prefs = new Preferences("dom.push."); // Set debug first so that all debugging actually works. gDebuggingEnabled = prefs.get("debug"); -const kPUSHDB_DB_NAME = "push"; +const kPUSHDB_DB_NAME = "pushapi"; const kPUSHDB_DB_VERSION = 1; // Change this if the IndexedDB format changes -const kPUSHDB_STORE_NAME = "push"; +const kPUSHDB_STORE_NAME = "pushapi"; const kUDP_WAKEUP_WS_STATUS_CODE = 4774; // WebSocket Close status code sent // by server to signal that it can From 2ec70c0a2719b71531f90a15a31ed4e2855ecaff Mon Sep 17 00:00:00 2001 From: Doug Turner Date: Fri, 1 May 2015 11:01:17 -0700 Subject: [PATCH 39/58] Bug 1160333 - When denying permission, use the string 'PermissionDeniedError'. r=nsm --- dom/push/Push.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dom/push/Push.js b/dom/push/Push.js index a1cbfdae970..a84bec81f7c 100644 --- a/dom/push/Push.js +++ b/dom/push/Push.js @@ -262,7 +262,7 @@ Push.prototype = { }.bind(this), function() { - reject("denied"); + reject("PermissionDeniedError"); } ); }.bind(this)); @@ -286,7 +286,7 @@ Push.prototype = { }.bind(this), function() { - reject("denied"); + reject("PermissionDeniedError"); } ); }.bind(this)); From 6bfd1b77a1f7db9bb1fc878d143089b24bffb1aa Mon Sep 17 00:00:00 2001 From: Ilya Date: Fri, 1 May 2015 11:22:32 -0700 Subject: [PATCH 40/58] Bug 1125816 - Parse FTP directory listings of Windows CE and WEC7 FTP Server r=jduell --- .../streamconv/converters/ParseFTPList.cpp | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/netwerk/streamconv/converters/ParseFTPList.cpp b/netwerk/streamconv/converters/ParseFTPList.cpp index 227d4d83d1f..205d30d8b76 100644 --- a/netwerk/streamconv/converters/ParseFTPList.cpp +++ b/netwerk/streamconv/converters/ParseFTPList.cpp @@ -723,7 +723,13 @@ int ParseFTPList(const char *line, struct list_state *state, * "07-21-00 01:19PM 52275 Name Plate.jpg" * "07-14-00 01:38PM 2250540 Valentineoffprank-HiRes.jpg" */ - if ((numtoks >= 4) && (toklen[0] == 8 || toklen[0] == 10) && toklen[1] == 7 && + // Microsoft FTP server with FtpDirBrowseShowLongDate set returns year + // in 4-digit format: + // "10-10-2014 10:10AM FTP" + // Windows CE FTP server returns time in 24-hour format: + // "05-03-13 22:01 APPS" + if ((numtoks >= 4) && (toklen[0] == 8 || toklen[0] == 10) && + (toklen[1] == 5 || toklen[1] == 7) && (*tokens[2] == '<' || isdigit(*tokens[2])) ) { p = tokens[0]; @@ -734,7 +740,8 @@ int ParseFTPList(const char *line, struct list_state *state, p = tokens[1]; if ( isdigit(p[0]) && isdigit(p[1]) && p[2]==':' && isdigit(p[3]) && isdigit(p[4]) && - (p[5]=='A' || p[5]=='P') && p[6]=='M') + (toklen[1] == 5 || (toklen[1] == 7 && + (p[5]=='A' || p[5]=='P') && p[6]=='M'))) { lstyle = 'W'; if (!state->lstyle) @@ -831,10 +838,13 @@ int ParseFTPList(const char *line, struct list_state *state, result->fe_time.tm_hour = atoi(tokens[1]+0); result->fe_time.tm_min = atoi(tokens[1]+3); - if ((tokens[1][5]) == 'P' && result->fe_time.tm_hour < 12) - result->fe_time.tm_hour += 12; - else if ((tokens[1][5]) == 'A' && result->fe_time.tm_hour == 12) - result->fe_time.tm_hour = 0; + if (toklen[1] == 7) + { + if ((tokens[1][5]) == 'P' && result->fe_time.tm_hour < 12) + result->fe_time.tm_hour += 12; + else if ((tokens[1][5]) == 'A' && result->fe_time.tm_hour == 12) + result->fe_time.tm_hour = 0; + } /* the caller should do this (if dropping "." and ".." is desired) if (result->fe_type == 'd' && result->fe_fname[0] == '.' && From fd8d4771131a85676efaa8d0c8f28ebaeacb6c28 Mon Sep 17 00:00:00 2001 From: Wes Kocher Date: Fri, 1 May 2015 11:26:24 -0700 Subject: [PATCH 41/58] Backed out changeset b242594427fd (bug 1112014) for failing on b2g IGNORE IDL --- layout/inspector/inDOMUtils.cpp | 139 +++---------------------- layout/inspector/inIDOMUtils.idl | 3 + layout/style/nsCSSParser.cpp | 16 +-- layout/style/test/mochitest.ini | 1 - layout/style/test/test_bug1112014.html | 121 --------------------- 5 files changed, 26 insertions(+), 254 deletions(-) delete mode 100644 layout/style/test/test_bug1112014.html diff --git a/layout/inspector/inDOMUtils.cpp b/layout/inspector/inDOMUtils.cpp index 88b44556e5f..042fb17169a 100644 --- a/layout/inspector/inDOMUtils.cpp +++ b/layout/inspector/inDOMUtils.cpp @@ -653,125 +653,6 @@ inDOMUtils::CssPropertyIsShorthand(const nsAString& aProperty, bool *_retval) return NS_OK; } -// A helper function that determines whether the given property -// supports the given type. -static bool -PropertySupportsVariant(nsCSSProperty aPropertyID, uint32_t aVariant) -{ - if (nsCSSProps::IsShorthand(aPropertyID)) { - // We need a special case for border here, because while it resets - // border-image, it can't actually parse an image. - if (aPropertyID == eCSSProperty_border) { - return (aVariant & (VARIANT_COLOR | VARIANT_LENGTH)) != 0; - } - - for (const nsCSSProperty* props = nsCSSProps::SubpropertyEntryFor(aPropertyID); - *props != eCSSProperty_UNKNOWN; ++props) { - if (PropertySupportsVariant(*props, aVariant)) { - return true; - } - } - return false; - } - - // Properties that are parsed by functions must have their - // attributes hand-maintained here. - if (nsCSSProps::PropHasFlags(aPropertyID, CSS_PROPERTY_VALUE_PARSER_FUNCTION) || - nsCSSProps::PropertyParseType(aPropertyID) == CSS_PROPERTY_PARSE_FUNCTION) { - // These must all be special-cased. - uint32_t supported; - switch (aPropertyID) { - case eCSSProperty_border_image_slice: - case eCSSProperty_grid_template: - case eCSSProperty_grid: - supported = VARIANT_PN; - break; - - case eCSSProperty_border_image_outset: - supported = VARIANT_LN; - break; - - case eCSSProperty_border_image_width: - case eCSSProperty_stroke_dasharray: - supported = VARIANT_LPN; - break; - - case eCSSProperty_border_top_left_radius: - case eCSSProperty_border_top_right_radius: - case eCSSProperty_border_bottom_left_radius: - case eCSSProperty_border_bottom_right_radius: - case eCSSProperty_background_position: - case eCSSProperty_background_size: - case eCSSProperty_grid_auto_columns: - case eCSSProperty_grid_auto_rows: - case eCSSProperty_grid_template_columns: - case eCSSProperty_grid_template_rows: - case eCSSProperty_object_position: - case eCSSProperty_scroll_snap_coordinate: - case eCSSProperty_scroll_snap_destination: - case eCSSProperty_transform_origin: - case eCSSProperty_perspective_origin: - case eCSSProperty__moz_outline_radius_topLeft: - case eCSSProperty__moz_outline_radius_topRight: - case eCSSProperty__moz_outline_radius_bottomLeft: - case eCSSProperty__moz_outline_radius_bottomRight: - supported = VARIANT_LP; - break; - - case eCSSProperty_border_bottom_colors: - case eCSSProperty_border_left_colors: - case eCSSProperty_border_right_colors: - case eCSSProperty_border_top_colors: - supported = VARIANT_COLOR; - break; - - case eCSSProperty_text_shadow: - case eCSSProperty_box_shadow: - supported = VARIANT_LENGTH | VARIANT_COLOR; - break; - - case eCSSProperty_border_spacing: - supported = VARIANT_LENGTH; - break; - - case eCSSProperty_content: - case eCSSProperty_cursor: - case eCSSProperty_clip_path: - supported = VARIANT_URL; - break; - - case eCSSProperty_fill: - case eCSSProperty_stroke: - supported = VARIANT_COLOR | VARIANT_URL; - break; - - case eCSSProperty_image_orientation: - supported = VARIANT_ANGLE; - break; - - case eCSSProperty_filter: - supported = VARIANT_URL; - break; - - case eCSSProperty_grid_column_start: - case eCSSProperty_grid_column_end: - case eCSSProperty_grid_row_start: - case eCSSProperty_grid_row_end: - case eCSSProperty_font_weight: - supported = VARIANT_NUMBER; - break; - - default: - supported = 0; - break; - } - - return (supported & aVariant) != 0; - } - - return (nsCSSProps::ParserVariant(aPropertyID) & aVariant) != 0; -} - NS_IMETHODIMP inDOMUtils::CssPropertySupportsType(const nsAString& aProperty, uint32_t aType, bool *_retval) @@ -782,11 +663,6 @@ inDOMUtils::CssPropertySupportsType(const nsAString& aProperty, uint32_t aType, return NS_ERROR_FAILURE; } - if (propertyID >= eCSSProperty_COUNT) { - *_retval = false; - return NS_OK; - } - uint32_t variant; switch (aType) { case TYPE_LENGTH: @@ -828,7 +704,20 @@ inDOMUtils::CssPropertySupportsType(const nsAString& aProperty, uint32_t aType, return NS_ERROR_NOT_AVAILABLE; } - *_retval = PropertySupportsVariant(propertyID, variant); + if (!nsCSSProps::IsShorthand(propertyID)) { + *_retval = nsCSSProps::ParserVariant(propertyID) & variant; + return NS_OK; + } + + for (const nsCSSProperty* props = nsCSSProps::SubpropertyEntryFor(propertyID); + *props != eCSSProperty_UNKNOWN; ++props) { + if (nsCSSProps::ParserVariant(*props) & variant) { + *_retval = true; + return NS_OK; + } + } + + *_retval = false; return NS_OK; } diff --git a/layout/inspector/inIDOMUtils.idl b/layout/inspector/inIDOMUtils.idl index 8e9aa4bbcf0..68df23d51db 100644 --- a/layout/inspector/inIDOMUtils.idl +++ b/layout/inspector/inIDOMUtils.idl @@ -103,6 +103,9 @@ interface inIDOMUtils : nsISupports // For shorthands, checks whether there's a corresponding longhand property // that accepts values of this type. Throws on unsupported properties or // unknown types. + // + // This function may incorrectly return false for properties that use custom + // parsing functions instead of table-driven parsing. const unsigned long TYPE_LENGTH = 0; const unsigned long TYPE_PERCENTAGE = 1; const unsigned long TYPE_COLOR = 2; diff --git a/layout/style/nsCSSParser.cpp b/layout/style/nsCSSParser.cpp index b6be119bdbf..095de41f451 100644 --- a/layout/style/nsCSSParser.cpp +++ b/layout/style/nsCSSParser.cpp @@ -1212,6 +1212,7 @@ protected: // sites. bool mDidUnprefixWebkitBoxInEarlierDecl; // not :1 so we can use AutoRestore +#ifdef DEBUG // True if any parsing of URL values requires a sheet principal to have // been passed in the nsCSSScanner constructor. This is usually the case. // It can be set to false, for example, when we create an nsCSSParser solely @@ -1220,6 +1221,7 @@ protected: // not be set to false if any nsCSSValues created during parsing can escape // out of the parser. bool mSheetPrincipalRequired; +#endif // Stack of rule groups; used for @media and such. InfallibleTArray > mGroupStack; @@ -1298,7 +1300,9 @@ CSSParserImpl::CSSParserImpl() mInFailingSupportsRule(false), mSuppressErrors(false), mDidUnprefixWebkitBoxInEarlierDecl(false), +#ifdef DEBUG mSheetPrincipalRequired(true), +#endif mNextFree(nullptr) { } @@ -7607,13 +7611,9 @@ bool CSSParserImpl::SetValueToURL(nsCSSValue& aValue, const nsString& aURL) { if (!mSheetPrincipal) { - if (!mSheetPrincipalRequired) { - /* Pretend to succeed. */ - return true; - } - - NS_NOTREACHED("Codepaths that expect to parse URLs MUST pass in an " - "origin principal"); + NS_ASSERTION(!mSheetPrincipalRequired, + "Codepaths that expect to parse URLs MUST pass in an " + "origin principal"); return false; } @@ -15379,6 +15379,7 @@ CSSParserImpl::IsValueValidForProperty(const nsCSSProperty aPropID, css::ErrorReporter reporter(scanner, mSheet, mChildLoader, nullptr); InitScanner(scanner, reporter, nullptr, nullptr, nullptr); +#ifdef DEBUG // We normally would need to pass in a sheet principal to InitScanner, // because we might parse a URL value. However, we will never use the // parsed nsCSSValue (and so whether we have a sheet principal or not @@ -15387,6 +15388,7 @@ CSSParserImpl::IsValueValidForProperty(const nsCSSProperty aPropID, // that it's safe to skip the assertion. AutoRestore autoRestore(mSheetPrincipalRequired); mSheetPrincipalRequired = false; +#endif nsAutoSuppressErrors suppressErrors(this); diff --git a/layout/style/test/mochitest.ini b/layout/style/test/mochitest.ini index 37faac038bd..c3f994e1321 100644 --- a/layout/style/test/mochitest.ini +++ b/layout/style/test/mochitest.ini @@ -110,7 +110,6 @@ support-files = file_bug829816.css support-files = file_bug1055933_circle-xxl.png [test_bug1089417.html] support-files = file_bug1089417_iframe.html -[test_bug1112014.html] [test_cascade.html] [test_ch_ex_no_infloops.html] [test_compute_data_with_start_struct.html] diff --git a/layout/style/test/test_bug1112014.html b/layout/style/test/test_bug1112014.html deleted file mode 100644 index ba1d2f017cb..00000000000 --- a/layout/style/test/test_bug1112014.html +++ /dev/null @@ -1,121 +0,0 @@ - - - - - - Test for Bug 1112014 - - - - - -Mozilla Bug 1112014 -

- -
-
- - From f641de24ac051d19873a68d3c37cdcd1191b400d Mon Sep 17 00:00:00 2001 From: Bas Schouten Date: Wed, 29 Apr 2015 09:19:00 -0400 Subject: [PATCH 42/58] Bug 1116812 - Consider DXGI_ERROR_INVALID_CALL a recoverable error for IDXGISwapChain::GetBuffer. r=jrmuizel --- gfx/layers/d3d11/CompositorD3D11.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/gfx/layers/d3d11/CompositorD3D11.cpp b/gfx/layers/d3d11/CompositorD3D11.cpp index 59b1ae40d74..6bb667762b8 100644 --- a/gfx/layers/d3d11/CompositorD3D11.cpp +++ b/gfx/layers/d3d11/CompositorD3D11.cpp @@ -1013,7 +1013,7 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, // this is important because resizing our buffers when mimised will fail and // cause a crash when we're restored. NS_ASSERTION(mHwnd, "Couldn't find an HWND when initialising?"); - if (::IsIconic(mHwnd) || gfxPlatform::GetPlatform()->DidRenderingDeviceReset()) { + if (::IsIconic(mHwnd) || mDevice->GetDeviceRemovedReason() != S_OK) { *aRenderBoundsOut = Rect(); return; } @@ -1086,6 +1086,10 @@ CompositorD3D11::BeginFrame(const nsIntRegion& aInvalidRegion, void CompositorD3D11::EndFrame() { + if (!mDefaultRT) { + return; + } + nsIntSize oldSize = mSize; EnsureSize(); UINT presentInterval = 0; @@ -1217,6 +1221,13 @@ CompositorD3D11::UpdateRenderTarget() nsRefPtr backBuf; hr = mSwapChain->GetBuffer(0, __uuidof(ID3D11Texture2D), (void**)backBuf.StartAssignment()); + if (hr == DXGI_ERROR_INVALID_CALL) { + // This happens on some GPUs/drivers when there's a TDR. + if (mDevice->GetDeviceRemovedReason() != S_OK) { + gfxCriticalError() << "GetBuffer returned invalid call!"; + return; + } + } if (Failed(hr)) { return; } From 5b9a952683b1e966a367069a6de91de3b6759a4b Mon Sep 17 00:00:00 2001 From: Seth Fowler Date: Fri, 1 May 2015 12:37:27 -0700 Subject: [PATCH 43/58] Bug 1158557 - Don't throttle rAF for documents with live static clones. r=smaug --- dom/base/nsDocument.cpp | 24 +++++++++++++++++++++++- dom/base/nsIDocument.h | 9 +++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) diff --git a/dom/base/nsDocument.cpp b/dom/base/nsDocument.cpp index 03b23c98b76..ad44fd21583 100644 --- a/dom/base/nsDocument.cpp +++ b/dom/base/nsDocument.cpp @@ -1636,6 +1636,8 @@ nsIDocument::~nsIDocument() if (mNodeInfoManager) { mNodeInfoManager->DropDocumentReference(); } + + UnlinkOriginalDocumentIfStatic(); } @@ -2093,13 +2095,14 @@ NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN(nsDocument) } tmp->mFirstChild = nullptr; + tmp->UnlinkOriginalDocumentIfStatic(); + NS_IMPL_CYCLE_COLLECTION_UNLINK(mXPathEvaluator) tmp->mCachedRootElement = nullptr; // Avoid a dangling pointer NS_IMPL_CYCLE_COLLECTION_UNLINK(mDisplayDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK(mFirstBaseNodeWithHref) NS_IMPL_CYCLE_COLLECTION_UNLINK(mDOMImplementation) NS_IMPL_CYCLE_COLLECTION_UNLINK(mImageMaps) - NS_IMPL_CYCLE_COLLECTION_UNLINK(mOriginalDocument) NS_IMPL_CYCLE_COLLECTION_UNLINK(mCachedEncoder) NS_IMPL_CYCLE_COLLECTION_UNLINK(mUndoManager) NS_IMPL_CYCLE_COLLECTION_UNLINK(mDocumentTimeline) @@ -3925,6 +3928,11 @@ nsIDocument::TakeFrameRequestCallbacks(FrameRequestCallbackList& aCallbacks) bool nsIDocument::ShouldThrottleFrameRequests() { + if (mStaticCloneCount > 0) { + // Even if we're not visible, a static clone may be, so run at full speed. + return false; + } + if (!mIsShowing) { // We're not showing (probably in a background tab or the bf cache). return true; @@ -10280,6 +10288,9 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer) } else { clonedDoc->mOriginalDocument = this; } + + clonedDoc->mOriginalDocument->mStaticCloneCount++; + int32_t sheetsCount = GetNumberOfStyleSheets(); for (int32_t i = 0; i < sheetsCount; ++i) { nsRefPtr sheet = do_QueryObject(GetStyleSheetAt(i)); @@ -10317,6 +10328,17 @@ nsIDocument::CreateStaticClone(nsIDocShell* aCloneContainer) return clonedDoc.forget(); } +void +nsIDocument::UnlinkOriginalDocumentIfStatic() +{ + if (IsStaticDocument() && mOriginalDocument) { + MOZ_ASSERT(mOriginalDocument->mStaticCloneCount > 0); + mOriginalDocument->mStaticCloneCount--; + mOriginalDocument = nullptr; + } + MOZ_ASSERT(!mOriginalDocument); +} + nsresult nsIDocument::ScheduleFrameRequestCallback(const FrameRequestCallbackHolder& aCallback, int32_t *aHandle) diff --git a/dom/base/nsIDocument.h b/dom/base/nsIDocument.h index 4c25bfda83e..32570c23447 100644 --- a/dom/base/nsIDocument.h +++ b/dom/base/nsIDocument.h @@ -1937,6 +1937,12 @@ public: return mOriginalDocument; } + /** + * If this document is a static clone, let the original document know that + * we're going away and then release our reference to it. + */ + void UnlinkOriginalDocumentIfStatic(); + /** * These are called by the parser as it encounters tags, the end of * said tags, and possible picture sources respectively. These @@ -2861,6 +2867,9 @@ protected: */ int32_t mFrameRequestCallbackCounter; + // Count of live static clones of this document. + uint32_t mStaticCloneCount; + // Array of nodes that have been blocked to prevent user tracking. // They most likely have had their nsIChannel canceled by the URL // classifier. (Safebrowsing) From 54ed4b46e785c3a0721c374a5bcca057e8ef0f1d Mon Sep 17 00:00:00 2001 From: Seth Fowler Date: Fri, 1 May 2015 13:01:51 -0700 Subject: [PATCH 44/58] (No bug) - Correct blatantly lying comment in imgLoader.cpp. r=me DONTBUILD --- image/src/imgLoader.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/image/src/imgLoader.cpp b/image/src/imgLoader.cpp index 977ce20be04..71f973b3085 100644 --- a/image/src/imgLoader.cpp +++ b/image/src/imgLoader.cpp @@ -1439,9 +1439,8 @@ imgLoader::PutIntoCache(const ImageCacheKey& aKey, imgCacheEntry* entry) LOG_STATIC_FUNC_WITH_PARAM(GetImgLog(), "imgLoader::PutIntoCache", "uri", aKey.Spec()); - // Check to see if this request already exists in the cache and is being - // loaded on a different thread. If so, don't allow this entry to be added to - // the cache. + // Check to see if this request already exists in the cache. If so, we'll + // replace the old version. nsRefPtr tmpCacheEntry; if (cache.Get(aKey, getter_AddRefs(tmpCacheEntry)) && tmpCacheEntry) { PR_LOG(GetImgLog(), PR_LOG_DEBUG, From c63887599f701dae2e47a727f291ae5a9f52496f Mon Sep 17 00:00:00 2001 From: Patrick McManus Date: Mon, 13 Apr 2015 15:35:55 -0400 Subject: [PATCH 45/58] bug 1154012 - dev tools and alt-svc r=vporof --- .../chrome/browser/devtools/netmonitor.properties | 4 ++-- toolkit/devtools/webconsole/network-helper.js | 13 +++++++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/browser/locales/en-US/chrome/browser/devtools/netmonitor.properties b/browser/locales/en-US/chrome/browser/devtools/netmonitor.properties index 857822e8116..889734a3562 100644 --- a/browser/locales/en-US/chrome/browser/devtools/netmonitor.properties +++ b/browser/locales/en-US/chrome/browser/devtools/netmonitor.properties @@ -36,8 +36,8 @@ netmonitor.security.state.secure=The connection used to fetch this resource was # LOCALIZATION NOTE (netmonitor.security.state.insecure) # This string is used as an tooltip for request that was performed over insecure -# channel i.e. the connection was not encrypted. -netmonitor.security.state.insecure=The connection used to fetch this resource was not encrypted. +# channel i.e. the connection was not https +netmonitor.security.state.insecure=The connection used to fetch this resource was not secure. # LOCALIZATION NOTE (netmonitor.security.state.broken) # This string is used as an tooltip for request that failed due to security diff --git a/toolkit/devtools/webconsole/network-helper.js b/toolkit/devtools/webconsole/network-helper.js index 006dfa058c8..9f7ac834967 100644 --- a/toolkit/devtools/webconsole/network-helper.js +++ b/toolkit/devtools/webconsole/network-helper.js @@ -577,8 +577,17 @@ let NetworkHelper = { if (!NSSErrorsService.isNSSErrorCode(securityInfo.errorCode)) { const state = securityInfo.securityState; - if (state & wpl.STATE_IS_SECURE) { - // The connection is secure. + let uri = null; + if (httpActivity.channel && httpActivity.channel.URI) { + uri = httpActivity.channel.URI; + } + if (uri && !uri.schemeIs("https") && !uri.schemeIs("wss")) { + // it is not enough to look at the transport security info - schemes other than + // https and wss are subject to downgrade/etc at the scheme level and should + // always be considered insecure + info.state = "insecure"; + } else if (state & wpl.STATE_IS_SECURE) { + // The connection is secure if the scheme is sufficient info.state = "secure"; } else if (state & wpl.STATE_IS_BROKEN) { // The connection is not secure, there was no error but there's some From 5882106bb79aacbe381b7e3eaa1720e9c55690d4 Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Sat, 2 May 2015 00:14:39 +0300 Subject: [PATCH 46/58] Bug 1134596 - Separate nsIOService's network detection from offlineMode r=honzab --- browser/app/profile/firefox.js | 2 +- dom/ipc/ContentChild.cpp | 17 +++- dom/ipc/ContentChild.h | 1 + dom/ipc/ContentParent.cpp | 22 ++++- dom/ipc/ContentParent.h | 1 + dom/ipc/PContent.ipdl | 3 +- netwerk/base/nsIIOService.idl | 18 +++- netwerk/base/nsIOService.cpp | 149 ++++++++++++++++++++++----------- netwerk/base/nsIOService.h | 7 +- netwerk/base/nsNetUtil.h | 7 +- 10 files changed, 171 insertions(+), 56 deletions(-) diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 56619a7f424..d37d0c98cae 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -610,7 +610,7 @@ pref("mousewheel.with_win.action", 1); pref("browser.xul.error_pages.enabled", true); pref("browser.xul.error_pages.expert_bad_cert", false); -// Work Offline is best manually managed by the user. +// If true, network link events will change the value of navigator.onLine pref("network.manage-offline-status", false); // We want to make sure mail URLs are handled externally... diff --git a/dom/ipc/ContentChild.cpp b/dom/ipc/ContentChild.cpp index 62c0350b4ed..046e243eb2d 100644 --- a/dom/ipc/ContentChild.cpp +++ b/dom/ipc/ContentChild.cpp @@ -806,12 +806,15 @@ ContentChild::InitXPCOM() NS_WARNING("Couldn't register console listener for child process"); bool isOffline, isLangRTL; + bool isConnected; ClipboardCapabilities clipboardCaps; DomainPolicyClone domainPolicy; - SendGetXPCOMProcessAttributes(&isOffline, &isLangRTL, &mAvailableDictionaries, + SendGetXPCOMProcessAttributes(&isOffline, &isConnected, + &isLangRTL, &mAvailableDictionaries, &clipboardCaps, &domainPolicy); RecvSetOffline(isOffline); + RecvSetConnectivity(isConnected); RecvBidiKeyboardNotify(isLangRTL); // Create the CPOW manager as soon as possible. @@ -1883,6 +1886,18 @@ ContentChild::RecvSetOffline(const bool& offline) return true; } +bool +ContentChild::RecvSetConnectivity(const bool& connectivity) +{ + nsCOMPtr io(do_GetIOService()); + nsCOMPtr ioInternal(do_QueryInterface(io)); + NS_ASSERTION(ioInternal, "IO Service can not be null"); + + ioInternal->SetConnectivity(connectivity); + + return true; +} + void ContentChild::ActorDestroy(ActorDestroyReason why) { diff --git a/dom/ipc/ContentChild.h b/dom/ipc/ContentChild.h index 139740418ad..a5b0dae1fff 100644 --- a/dom/ipc/ContentChild.h +++ b/dom/ipc/ContentChild.h @@ -294,6 +294,7 @@ public: virtual bool DeallocPRemoteSpellcheckEngineChild(PRemoteSpellcheckEngineChild*) override; virtual bool RecvSetOffline(const bool& offline) override; + virtual bool RecvSetConnectivity(const bool& connectivity) override; virtual bool RecvSpeakerManagerNotify() override; diff --git a/dom/ipc/ContentParent.cpp b/dom/ipc/ContentParent.cpp index 34fade5903e..2990d34a077 100755 --- a/dom/ipc/ContentParent.cpp +++ b/dom/ipc/ContentParent.cpp @@ -405,6 +405,7 @@ bool ContentParent::sNuwaReady = false; #endif #define NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC "ipc:network:set-offline" +#define NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC "ipc:network:set-connectivity" class MemoryReportRequestParent : public PMemoryReportRequestParent { @@ -643,6 +644,7 @@ static const char* sObserverTopics[] = { "xpcom-shutdown", "profile-before-change", NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC, + NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC, "child-memory-reporter-request", "memory-pressure", "child-gc-request", @@ -2935,13 +2937,16 @@ ContentParent::RecvAddNewProcess(const uint32_t& aPid, // Update offline settings. bool isOffline, isLangRTL; + bool isConnected; InfallibleTArray unusedDictionaries; ClipboardCapabilities clipboardCaps; DomainPolicyClone domainPolicy; - RecvGetXPCOMProcessAttributes(&isOffline, &isLangRTL, &unusedDictionaries, + RecvGetXPCOMProcessAttributes(&isOffline, &isConnected, + &isLangRTL, &unusedDictionaries, &clipboardCaps, &domainPolicy); mozilla::unused << content->SendSetOffline(isOffline); + mozilla::unused << content->SendSetConnectivity(isConnected); MOZ_ASSERT(!clipboardCaps.supportsSelectionClipboard() && !clipboardCaps.supportsFindClipboard(), "Unexpected values"); @@ -3032,6 +3037,17 @@ ContentParent::Observe(nsISupports* aSubject, } #ifdef MOZ_NUWA_PROCESS } +#endif + } + else if (!strcmp(aTopic, NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC)) { +#ifdef MOZ_NUWA_PROCESS + if (!(IsNuwaReady() && IsNuwaProcess())) { +#endif + if (!SendSetConnectivity(NS_LITERAL_STRING("true").Equals(aData))) { + return NS_ERROR_NOT_AVAILABLE; + } +#ifdef MOZ_NUWA_PROCESS + } #endif } // listening for alert notifications @@ -3282,6 +3298,7 @@ ContentParent::RecvGetProcessAttributes(ContentParentId* aCpId, bool ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline, + bool* aIsConnected, bool* aIsLangRTL, InfallibleTArray* dictionaries, ClipboardCapabilities* clipboardCaps, @@ -3292,6 +3309,9 @@ ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline, DebugOnly rv = io->GetOffline(aIsOffline); MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting offline?"); + rv = io->GetConnectivity(aIsConnected); + MOZ_ASSERT(NS_SUCCEEDED(rv), "Failed getting connectivity?"); + nsIBidiKeyboard* bidi = nsContentUtils::GetBidiKeyboard(); *aIsLangRTL = false; diff --git a/dom/ipc/ContentParent.h b/dom/ipc/ContentParent.h index 1baad990417..5503fd5ed3e 100644 --- a/dom/ipc/ContentParent.h +++ b/dom/ipc/ContentParent.h @@ -546,6 +546,7 @@ private: bool* aIsForApp, bool* aIsForBrowser) override; virtual bool RecvGetXPCOMProcessAttributes(bool* aIsOffline, + bool* aIsConnected, bool* aIsLangRTL, InfallibleTArray* dictionaries, ClipboardCapabilities* clipboardCaps, diff --git a/dom/ipc/PContent.ipdl b/dom/ipc/PContent.ipdl index 8029729eae4..3a204fcaf7d 100644 --- a/dom/ipc/PContent.ipdl +++ b/dom/ipc/PContent.ipdl @@ -525,6 +525,7 @@ child: RegisterChromeItem(ChromeRegistryItem item); async SetOffline(bool offline); + async SetConnectivity(bool connectivity); async NotifyVisited(URIParams uri); @@ -669,7 +670,7 @@ parent: sync GetProcessAttributes() returns (ContentParentId cpId, bool isForApp, bool isForBrowser); sync GetXPCOMProcessAttributes() - returns (bool isOffline, bool isLangRTL, nsString[] dictionaries, + returns (bool isOffline, bool isConnected, bool isLangRTL, nsString[] dictionaries, ClipboardCapabilities clipboardCaps, DomainPolicyClone domainPolicy); diff --git a/netwerk/base/nsIIOService.idl b/netwerk/base/nsIIOService.idl index f4ba1a20a14..4e386b1b3de 100644 --- a/netwerk/base/nsIIOService.idl +++ b/netwerk/base/nsIIOService.idl @@ -22,7 +22,7 @@ interface nsILoadInfo; * as a convenience to the programmer and in some cases to improve performance * by eliminating intermediate data structures and interfaces. */ -[scriptable, uuid(b1c3c61d-2df9-4240-ae16-0355b51a2770)] +[scriptable, uuid(4286de5a-b2ea-446f-8f70-e2a461f42694)] interface nsIIOService : nsISupports { /** @@ -178,6 +178,11 @@ interface nsIIOService : nsISupports */ attribute boolean offline; + /** + * Returns false if there are no interfaces for a network request + */ + readonly attribute boolean connectivity; + /** * Set whether network appears to be offline for network connections from * a given appID. @@ -269,3 +274,14 @@ interface nsIAppOfflineInfo : nsISupports */ #define NS_IOSERVICE_APP_OFFLINE_STATUS_TOPIC "network:app-offline-status-changed" %} + +[builtinclass, uuid(cd66ffef-3bc3-40de-841a-e2dcbea213a2)] +interface nsIIOServiceInternal : nsISupports +{ + /** + * This is an internal method that should only be called from ContentChild + * in order to pass the connectivity state from the chrome process to the + * content process. It throws if called outside the content process. + */ + void SetConnectivity(in boolean connectivity); +}; diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp index e34c7ba4d6d..860c851ef0a 100644 --- a/netwerk/base/nsIOService.cpp +++ b/netwerk/base/nsIOService.cpp @@ -158,7 +158,8 @@ NS_IMPL_ISUPPORTS(nsAppOfflineInfo, nsIAppOfflineInfo) nsIOService::nsIOService() : mOffline(true) , mOfflineForProfileChange(false) - , mManageOfflineStatus(false) + , mManageLinkStatus(false) + , mConnectivity(true) , mSettingOffline(false) , mSetOfflineValue(false) , mShutdown(false) @@ -284,17 +285,10 @@ nsIOService::InitializeNetworkLinkService() if (mNetworkLinkService) { mNetworkLinkServiceInitialized = true; } - else { - // We can't really determine if the machine has a usable network connection, - // so let's cross our fingers! - mManageOfflineStatus = false; - } - if (mManageOfflineStatus) - OnNetworkLinkEvent(NS_NETWORK_LINK_DATA_UNKNOWN); - else - SetOffline(false); - + // After initializing the networkLinkService, query the connectivity state + OnNetworkLinkEvent(NS_NETWORK_LINK_DATA_UNKNOWN); + return rv; } @@ -323,6 +317,7 @@ NS_IMPL_ISUPPORTS(nsIOService, nsINetUtil, nsISpeculativeConnect, nsIObserver, + nsIIOServiceInternal, nsISupportsWeakReference) //////////////////////////////////////////////////////////////////////////////// @@ -955,7 +950,8 @@ nsIOService::SetOffline(bool offline) mProxyService->ReloadPAC(); // don't care if notification fails - if (observerService) + // Only send the ONLINE notification if there is connectivity + if (observerService && mConnectivity) observerService->NotifyObservers(subject, NS_IOSERVICE_OFFLINE_STATUS_TOPIC, NS_LITERAL_STRING(NS_IOSERVICE_ONLINE).get()); @@ -981,6 +977,72 @@ nsIOService::SetOffline(bool offline) return NS_OK; } +NS_IMETHODIMP +nsIOService::GetConnectivity(bool *aConnectivity) +{ + *aConnectivity = mConnectivity; + return NS_OK; +} + +NS_IMETHODIMP +nsIOService::SetConnectivity(bool aConnectivity) +{ + // This should only be called from ContentChild to pass the connectivity + // value from the chrome process to the content process. + if (XRE_GetProcessType() == GeckoProcessType_Default) { + return NS_ERROR_NOT_AVAILABLE; + } + return SetConnectivityInternal(aConnectivity); +} + + +nsresult +nsIOService::SetConnectivityInternal(bool aConnectivity) +{ + if (mConnectivity == aConnectivity) { + // Nothing to do here. + return NS_OK; + } + mConnectivity = aConnectivity; + + nsCOMPtr observerService = + mozilla::services::GetObserverService(); + if (!observerService) { + return NS_OK; + } + // This notification sends the connectivity to the child processes + if (XRE_GetProcessType() == GeckoProcessType_Default) { + observerService->NotifyObservers(nullptr, + NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC, aConnectivity ? + MOZ_UTF16("true") : + MOZ_UTF16("false")); + } + + if (mOffline) { + // We don't need to send any notifications if we're offline + return NS_OK; + } + + if (aConnectivity) { + // If we were previously offline due to connectivity=false, + // send the ONLINE notification + observerService->NotifyObservers( + static_cast(this), + NS_IOSERVICE_OFFLINE_STATUS_TOPIC, + NS_LITERAL_STRING(NS_IOSERVICE_ONLINE).get()); + } else { + // If we were previously online and lost connectivity + // send the OFFLINE notification + const nsLiteralString offlineString(MOZ_UTF16(NS_IOSERVICE_OFFLINE)); + observerService->NotifyObservers(static_cast(this), + NS_IOSERVICE_GOING_OFFLINE_TOPIC, + offlineString.get()); + observerService->NotifyObservers(static_cast(this), + NS_IOSERVICE_OFFLINE_STATUS_TOPIC, + offlineString.get()); + } + return NS_OK; +} NS_IMETHODIMP nsIOService::AllowPort(int32_t inPort, const char *scheme, bool *_retval) @@ -1209,11 +1271,8 @@ nsIOService::Observe(nsISupports *subject, } else if (!strcmp(topic, kProfileChangeNetRestoreTopic)) { if (mOfflineForProfileChange) { mOfflineForProfileChange = false; - if (!mManageOfflineStatus || - NS_FAILED(OnNetworkLinkEvent(NS_NETWORK_LINK_DATA_UNKNOWN))) { - SetOffline(false); - } - } + SetOffline(false); + } } else if (!strcmp(topic, kProfileDoChange)) { if (data && NS_LITERAL_STRING("startup").Equals(data)) { // Lazy initialization of network link service (see bug 620472) @@ -1221,6 +1280,10 @@ nsIOService::Observe(nsISupports *subject, // Set up the initilization flag regardless the actuall result. // If we fail here, we will fail always on. mNetworkLinkServiceInitialized = true; + + // The browser starts off as offline. We go into online mode after this. + SetOffline(false); + // And now reflect the preference setting nsCOMPtr prefBranch; GetPrefBranch(getter_AddRefs(prefBranch)); @@ -1237,9 +1300,7 @@ nsIOService::Observe(nsISupports *subject, // Break circular reference. mProxyService = nullptr; } else if (!strcmp(topic, NS_NETWORK_LINK_TOPIC)) { - if (!mOfflineForProfileChange && mManageOfflineStatus) { - OnNetworkLinkEvent(NS_ConvertUTF16toUTF8(data).get()); - } + OnNetworkLinkEvent(NS_ConvertUTF16toUTF8(data).get()); } else if (!strcmp(topic, NS_WIDGET_WAKE_OBSERVER_TOPIC)) { // coming back alive from sleep nsCOMPtr observerService = @@ -1383,32 +1444,26 @@ nsIOService::NewSimpleNestedURI(nsIURI* aURI, nsIURI** aResult) NS_IMETHODIMP nsIOService::SetManageOfflineStatus(bool aManage) { - nsresult rv = NS_OK; + mManageLinkStatus = aManage; - // SetManageOfflineStatus must throw when we fail to go from non-managed - // to managed. Usually because there is no link monitoring service - // available. Failure to do this switch is detected by a failure of - // OnNetworkLinkEvent(). When there is no network link available during - // call to InitializeNetworkLinkService(), application is put to offline - // mode. And when we change mMangeOfflineStatus to false on the next line - // we get stuck on being offline even though the link becomes later - // available. - bool wasManaged = mManageOfflineStatus; - mManageOfflineStatus = aManage; + // When detection is not activated, the default connectivity state is true. + if (!mManageLinkStatus) { + SetConnectivityInternal(true); + return NS_OK; + } InitializeNetworkLinkService(); - - if (mManageOfflineStatus && !wasManaged) { - rv = OnNetworkLinkEvent(NS_NETWORK_LINK_DATA_UNKNOWN); - if (NS_FAILED(rv)) - mManageOfflineStatus = false; - } - return rv; + // If the NetworkLinkService is already initialized, it does not call + // OnNetworkLinkEvent. This is needed, when mManageLinkStatus goes from + // false to true. + OnNetworkLinkEvent(NS_NETWORK_LINK_DATA_UNKNOWN); + return NS_OK; } NS_IMETHODIMP -nsIOService::GetManageOfflineStatus(bool* aManage) { - *aManage = mManageOfflineStatus; +nsIOService::GetManageOfflineStatus(bool* aManage) +{ + *aManage = mManageLinkStatus; return NS_OK; } @@ -1422,7 +1477,7 @@ nsIOService::OnNetworkLinkEvent(const char *data) if (mShutdown) return NS_ERROR_NOT_AVAILABLE; - if (!mManageOfflineStatus) { + if (!mManageLinkStatus) { return NS_OK; } @@ -1435,21 +1490,19 @@ nsIOService::OnNetworkLinkEvent(const char *data) // dial option is set to always autodial. If so, then we are // always up for the purposes of offline management. if (autodialEnabled) { + bool isUp = true; #if defined(XP_WIN) // On Windows, we should first check with the OS to see if // autodial is enabled. If it is enabled then we are allowed // to manage the offline state. - if (nsNativeConnectionHelper::IsAutodialEnabled()) { - return SetOffline(false); - } -#else - return SetOffline(false); + isUp = nsNativeConnectionHelper::IsAutodialEnabled(); #endif + return SetConnectivityInternal(isUp); } } } - bool isUp; + bool isUp = true; if (!strcmp(data, NS_NETWORK_LINK_DATA_CHANGED)) { // CHANGED means UP/DOWN didn't change return NS_OK; @@ -1465,7 +1518,7 @@ nsIOService::OnNetworkLinkEvent(const char *data) return NS_OK; } - return SetOffline(!isUp); + return SetConnectivityInternal(isUp); } NS_IMETHODIMP diff --git a/netwerk/base/nsIOService.h b/netwerk/base/nsIOService.h index d8631c667bd..5a5507b7c2f 100644 --- a/netwerk/base/nsIOService.h +++ b/netwerk/base/nsIOService.h @@ -26,6 +26,7 @@ // Intended internal use only for remoting offline/inline events. // See Bug 552829 #define NS_IPC_IOSERVICE_SET_OFFLINE_TOPIC "ipc:network:set-offline" +#define NS_IPC_IOSERVICE_SET_CONNECTIVITY_TOPIC "ipc:network:set-connectivity" static const char gScheme[][sizeof("resource")] = {"chrome", "file", "http", "https", "jar", "data", "resource"}; @@ -49,6 +50,7 @@ class nsIOService final : public nsIIOService2 , public nsINetUtil , public nsISpeculativeConnect , public nsSupportsWeakReference + , public nsIIOServiceInternal { public: NS_DECL_THREADSAFE_ISUPPORTS @@ -57,6 +59,7 @@ public: NS_DECL_NSIOBSERVER NS_DECL_NSINETUTIL NS_DECL_NSISPECULATIVECONNECT + NS_DECL_NSIIOSERVICEINTERNAL // Gets the singleton instance of the IO Service, creating it as needed // Returns nullptr on out of memory or failure to initialize. @@ -86,6 +89,7 @@ private: // - destroy using Release nsIOService(); ~nsIOService(); + nsresult SetConnectivityInternal(bool aConnectivity); nsresult OnNetworkLinkEvent(const char *data); @@ -121,7 +125,8 @@ private: private: bool mOffline; bool mOfflineForProfileChange; - bool mManageOfflineStatus; + bool mManageLinkStatus; + bool mConnectivity; // Used to handle SetOffline() reentrancy. See the comment in // SetOffline() for more details. diff --git a/netwerk/base/nsNetUtil.h b/netwerk/base/nsNetUtil.h index 918cd52fcc2..8d4574712c5 100644 --- a/netwerk/base/nsNetUtil.h +++ b/netwerk/base/nsNetUtil.h @@ -1963,10 +1963,13 @@ inline bool NS_IsOffline() { bool offline = true; + bool connectivity = true; nsCOMPtr ios = do_GetIOService(); - if (ios) + if (ios) { ios->GetOffline(&offline); - return offline; + ios->GetConnectivity(&connectivity); + } + return offline || !connectivity; } inline bool From 85f7fab9de252c4e0808da51abf0d680cd0770ae Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Thu, 26 Mar 2015 13:19:47 +0200 Subject: [PATCH 47/58] Bug 1134596 - Add network.offline-mirrors-connectivity pref to preserve previous behaviour r=honzab --- modules/libpref/init/all.js | 5 +++++ netwerk/base/nsIOService.cpp | 9 ++++++++- netwerk/base/nsIOService.h | 3 +++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/modules/libpref/init/all.js b/modules/libpref/init/all.js index 73ffea40f52..c8c637d351a 100644 --- a/modules/libpref/init/all.js +++ b/modules/libpref/init/all.js @@ -1168,6 +1168,11 @@ pref("network.warnOnAboutNetworking", true); // Example: make IMAP an exposed protocol // pref("network.protocol-handler.expose.imap", true); +// Whether IOService.connectivity and NS_IsOffline depends on connectivity status +pref("network.manage-offline-status", false); +// If set to true, IOService.offline depends on IOService.connectivity +pref("network.offline-mirrors-connectivity", true); + // pref("network.http.version", "1.1"); // default // pref("network.http.version", "1.0"); // uncomment this out in case of problems diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp index 860c851ef0a..cab255c5620 100644 --- a/netwerk/base/nsIOService.cpp +++ b/netwerk/base/nsIOService.cpp @@ -59,6 +59,7 @@ using mozilla::net::IsNeckoChild; #define PORT_PREF(x) PORT_PREF_PREFIX x #define AUTODIAL_PREF "network.autodial-helper.enabled" #define MANAGE_OFFLINE_STATUS_PREF "network.manage-offline-status" +#define OFFLINE_MIRRORS_CONNECTIVITY "network.offline-mirrors-connectivity" // Nb: these have been misnomers since bug 715770 removed the buffer cache. // "network.segment.count" and "network.segment.size" would be better names, @@ -160,6 +161,7 @@ nsIOService::nsIOService() , mOfflineForProfileChange(false) , mManageLinkStatus(false) , mConnectivity(true) + , mOfflineMirrorsConnectivity(true) , mSettingOffline(false) , mSetOfflineValue(false) , mShutdown(false) @@ -227,6 +229,7 @@ nsIOService::Init() NS_WARNING("failed to get observer service"); Preferences::AddBoolVarCache(&sTelemetryEnabled, "toolkit.telemetry.enabled", false); + Preferences::AddBoolVarCache(&mOfflineMirrorsConnectivity, OFFLINE_MIRRORS_CONNECTIVITY, true); gIOService = this; @@ -872,7 +875,11 @@ nsIOService::IsLinkUp() NS_IMETHODIMP nsIOService::GetOffline(bool *offline) { - *offline = mOffline; + if (mOfflineMirrorsConnectivity) { + *offline = mOffline || !mConnectivity; + } else { + *offline = mOffline; + } return NS_OK; } diff --git a/netwerk/base/nsIOService.h b/netwerk/base/nsIOService.h index 5a5507b7c2f..f54662a47d6 100644 --- a/netwerk/base/nsIOService.h +++ b/netwerk/base/nsIOService.h @@ -127,6 +127,9 @@ private: bool mOfflineForProfileChange; bool mManageLinkStatus; bool mConnectivity; + // If true, the connectivity state will be mirrored by IOService.offline + // meaning if !mConnectivity, GetOffline() will return true + bool mOfflineMirrorsConnectivity; // Used to handle SetOffline() reentrancy. See the comment in // SetOffline() for more details. From 63a164ec5be33fef48d43df66ea1b3e66a19cb08 Mon Sep 17 00:00:00 2001 From: Valentin Gosu Date: Fri, 3 Apr 2015 16:23:18 +0300 Subject: [PATCH 48/58] Bug 1134596 - SetOffline(false) in nsIOService::Init r=honzab --- netwerk/base/nsIOService.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/netwerk/base/nsIOService.cpp b/netwerk/base/nsIOService.cpp index cab255c5620..30aae23d2b4 100644 --- a/netwerk/base/nsIOService.cpp +++ b/netwerk/base/nsIOService.cpp @@ -234,6 +234,7 @@ nsIOService::Init() gIOService = this; InitializeNetworkLinkService(); + SetOffline(false); return NS_OK; } From 182e223412acc77bb706f0266f439afa397f9efe Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Wed, 29 Apr 2015 18:54:10 -0400 Subject: [PATCH 49/58] Bug 1152051 - Ensure that destroying an overscroll animation always clears the state Axis tracks about it. r=Cwiiis --- gfx/layers/apz/src/AsyncPanZoomController.cpp | 9 ++++-- gfx/layers/apz/src/Axis.cpp | 29 +++++++++++++------ gfx/layers/apz/src/Axis.h | 15 ++++++++-- 3 files changed, 39 insertions(+), 14 deletions(-) diff --git a/gfx/layers/apz/src/AsyncPanZoomController.cpp b/gfx/layers/apz/src/AsyncPanZoomController.cpp index 1705e83afc7..bbd7cff9726 100644 --- a/gfx/layers/apz/src/AsyncPanZoomController.cpp +++ b/gfx/layers/apz/src/AsyncPanZoomController.cpp @@ -647,8 +647,13 @@ public: : AsyncPanZoomAnimation(TimeDuration::Forever()) , mApzc(aApzc) { - mApzc.mX.SetVelocity(aVelocity.x); - mApzc.mY.SetVelocity(aVelocity.y); + mApzc.mX.StartOverscrollAnimation(aVelocity.x); + mApzc.mY.StartOverscrollAnimation(aVelocity.y); + } + ~OverscrollAnimation() + { + mApzc.mX.EndOverscrollAnimation(); + mApzc.mY.EndOverscrollAnimation(); } virtual bool DoSample(FrameMetrics& aFrameMetrics, diff --git a/gfx/layers/apz/src/Axis.cpp b/gfx/layers/apz/src/Axis.cpp index 92800f61362..e6a154222d7 100644 --- a/gfx/layers/apz/src/Axis.cpp +++ b/gfx/layers/apz/src/Axis.cpp @@ -140,7 +140,7 @@ bool Axis::AdjustDisplacement(ParentLayerCoord aDisplacement, return false; } - StopSamplingOverscrollAnimation(); + ClearOverscrollAnimationState(); ParentLayerCoord displacement = aDisplacement; @@ -182,7 +182,7 @@ ParentLayerCoord Axis::ApplyResistance(ParentLayerCoord aRequestedOverscroll) co void Axis::OverscrollBy(ParentLayerCoord aOverscroll) { MOZ_ASSERT(CanScroll()); - StopSamplingOverscrollAnimation(); + ClearOverscrollAnimationState(); aOverscroll = ApplyResistance(aOverscroll); if (aOverscroll > 0) { #ifdef DEBUG @@ -224,10 +224,23 @@ ParentLayerCoord Axis::GetOverscroll() const { return result; } -void Axis::StopSamplingOverscrollAnimation() { - ParentLayerCoord overscroll = GetOverscroll(); - ClearOverscroll(); - mOverscroll = overscroll; +void Axis::StartOverscrollAnimation(float aVelocity) { + // Make sure any state from a previous animation has been cleared. + MOZ_ASSERT(mFirstOverscrollAnimationSample == 0 && + mLastOverscrollPeak == 0 && + mOverscrollScale == 1); + + SetVelocity(aVelocity); +} + +void Axis::EndOverscrollAnimation() { + ClearOverscrollAnimationState(); +} + +void Axis::ClearOverscrollAnimationState() { + mFirstOverscrollAnimationSample = 0; + mLastOverscrollPeak = 0; + mOverscrollScale = 1.0f; } void Axis::StepOverscrollAnimation(double aStepDurationMilliseconds) { @@ -347,10 +360,8 @@ bool Axis::IsOverscrolled() const { } void Axis::ClearOverscroll() { + ClearOverscrollAnimationState(); mOverscroll = 0; - mFirstOverscrollAnimationSample = 0; - mLastOverscrollPeak = 0; - mOverscrollScale = 1.0f; } ParentLayerCoord Axis::PanStart() const { diff --git a/gfx/layers/apz/src/Axis.h b/gfx/layers/apz/src/Axis.h index ef046fe907e..83cbe9d5784 100644 --- a/gfx/layers/apz/src/Axis.h +++ b/gfx/layers/apz/src/Axis.h @@ -105,12 +105,22 @@ public: */ ParentLayerCoord GetOverscroll() const; + /** + * Start an overscroll animation with the given initial velocity. + */ + void StartOverscrollAnimation(float aVelocity); + /** * Sample the snap-back animation to relieve overscroll. * |aDelta| is the time since the last sample. */ bool SampleOverscrollAnimation(const TimeDuration& aDelta); + /** + * Stop an overscroll animation. + */ + void EndOverscrollAnimation(); + /** * Return whether this axis is overscrolled in either direction. */ @@ -275,9 +285,8 @@ protected: // actual overscroll amount. ParentLayerCoord ApplyResistance(ParentLayerCoord aOverscroll) const; - // Helper function to disable overscroll transformations triggered by - // SampleOverscrollAnimation(). - void StopSamplingOverscrollAnimation(); + // Clear the state associated with an overscroll animation. + void ClearOverscrollAnimationState(); // Helper function for SampleOverscrollAnimation(). void StepOverscrollAnimation(double aStepDurationMilliseconds); From dae9b09192ceed34069b8aeed74a5e412e399ebc Mon Sep 17 00:00:00 2001 From: Botond Ballo Date: Wed, 29 Apr 2015 19:38:02 -0400 Subject: [PATCH 50/58] Bug 1152051 - Gtest. r=Cwiiis,kats --- .../gtest/TestAsyncPanZoomController.cpp | 129 ++++++++++++++---- 1 file changed, 104 insertions(+), 25 deletions(-) diff --git a/gfx/tests/gtest/TestAsyncPanZoomController.cpp b/gfx/tests/gtest/TestAsyncPanZoomController.cpp index 584a0c84608..17bad99042e 100644 --- a/gfx/tests/gtest/TestAsyncPanZoomController.cpp +++ b/gfx/tests/gtest/TestAsyncPanZoomController.cpp @@ -257,6 +257,17 @@ protected: apzc->SetFrameMetrics(TestFrameMetrics()); } + /** + * Get the APZC's scroll range in CSS pixels. + */ + CSSRect GetScrollRange() const + { + const FrameMetrics& metrics = apzc->GetFrameMetrics(); + return CSSRect( + metrics.GetScrollableRect().TopLeft(), + metrics.GetScrollableRect().Size() - metrics.CalculateCompositedSizeInCssPixels()); + } + virtual void TearDown() { apzc->Destroy(); @@ -277,6 +288,49 @@ protected: apzc->UpdateZoomConstraints(ZoomConstraints(false, false, CSSToParentLayerScale(1.0f), CSSToParentLayerScale(1.0f))); } + void PanIntoOverscroll(int& aTime); + + /** + * Sample animations once, 1 ms later than the last sample. + */ + void SampleAnimationOnce() + { + const TimeDuration increment = TimeDuration::FromMilliseconds(1); + ParentLayerPoint pointOut; + ViewTransform viewTransformOut; + testStartTime += increment; + apzc->SampleContentTransformForFrame(testStartTime, &viewTransformOut, pointOut); + } + + /** + * Sample animations until we recover from overscroll. + * @param aExpectedScrollOffset the expected reported scroll offset + * throughout the animation + */ + void SampleAnimationUntilRecoveredFromOverscroll(const ParentLayerPoint& aExpectedScrollOffset) + { + const TimeDuration increment = TimeDuration::FromMilliseconds(1); + bool recoveredFromOverscroll = false; + ParentLayerPoint pointOut; + ViewTransform viewTransformOut; + while (apzc->SampleContentTransformForFrame(testStartTime, &viewTransformOut, pointOut)) { + // The reported scroll offset should be the same throughout. + EXPECT_EQ(aExpectedScrollOffset, pointOut); + + // Trigger computation of the overscroll tranform, to make sure + // no assetions fire during the calculation. + apzc->GetOverscrollTransform(); + + if (!apzc->IsOverscrolled()) { + recoveredFromOverscroll = true; + } + + testStartTime += increment; + } + EXPECT_TRUE(recoveredFromOverscroll); + apzc->AssertStateIsReset(); + } + void TestOverscroll(); AsyncPanZoomController::GestureBehavior mGestureBehavior; @@ -1137,36 +1191,23 @@ TEST_F(APZCBasicTester, PanningTransformNotifications) { check.Call("Done"); } +void APZCBasicTester::PanIntoOverscroll(int& aTime) +{ + int touchStart = 500; + int touchEnd = 10; + Pan(apzc, aTime, touchStart, touchEnd); + EXPECT_TRUE(apzc->IsOverscrolled()); +} + void APZCBasicTester::TestOverscroll() { // Pan sufficiently to hit overscroll behavior int time = 0; - int touchStart = 500; - int touchEnd = 10; - Pan(apzc, time, touchStart, touchEnd); - EXPECT_TRUE(apzc->IsOverscrolled()); + PanIntoOverscroll(time); // Check that we recover from overscroll via an animation. - const TimeDuration increment = TimeDuration::FromMilliseconds(1); - bool recoveredFromOverscroll = false; - ParentLayerPoint pointOut; - ViewTransform viewTransformOut; - while (apzc->SampleContentTransformForFrame(testStartTime, &viewTransformOut, pointOut)) { - // The reported scroll offset should be the same throughout. - EXPECT_EQ(ParentLayerPoint(0, 90), pointOut); - - // Trigger computation of the overscroll tranform, to make sure - // no assetions fire during the calculation. - apzc->GetOverscrollTransform(); - - if (!apzc->IsOverscrolled()) { - recoveredFromOverscroll = true; - } - - testStartTime += increment; - } - EXPECT_TRUE(recoveredFromOverscroll); - apzc->AssertStateIsReset(); + ParentLayerPoint expectedScrollOffset(0, GetScrollRange().YMost()); + SampleAnimationUntilRecoveredFromOverscroll(expectedScrollOffset); } @@ -1178,7 +1219,7 @@ TEST_F(APZCBasicTester, OverScrollPanning) { // Tests that an overscroll animation doesn't trigger an assertion failure // in the case where a sample has a velocity of zero. -TEST_F(APZCBasicTester, OverScroll_Bug1152051) { +TEST_F(APZCBasicTester, OverScroll_Bug1152051a) { SCOPED_GFX_PREF(APZOverscrollEnabled, bool, true); // Doctor the prefs to make the velocity zero at the end of the first sample. @@ -1197,6 +1238,44 @@ TEST_F(APZCBasicTester, OverScroll_Bug1152051) { TestOverscroll(); } +// Tests that ending an overscroll animation doesn't leave around state that +// confuses the next overscroll animation. +TEST_F(APZCBasicTester, OverScroll_Bug1152051b) { + SCOPED_GFX_PREF(APZOverscrollEnabled, bool, true); + + SCOPED_GFX_PREF(APZOverscrollStopDistanceThreshold, float, 0.1f); + + // Pan sufficiently to hit overscroll behavior + int time = 0; + PanIntoOverscroll(time); + + // Sample animations once, to give the fling animation started on touch-up + // a chance to realize it's overscrolled, and schedule a call to + // HandleFlingOverscroll(). + SampleAnimationOnce(); + + // Give the call to HandleFlingOverscroll() a chance to occur, creating + // an overscroll animation. + mcc->RunThroughDelayedTasks(); + + // Sample the overscroll animation once, to get it to initialize + // the first overscroll sample. + SampleAnimationOnce(); + + // Do a touch-down to cancel the overscroll animation, and then a touch-up + // to schedule a new one since we're still overscrolled. We don't pan because + // panning can trigger functions that clear the overscroll animation state + // in other ways. + TouchDown(apzc, 10, 10, time, nullptr); + TouchUp(apzc, 10, 10, time); + + // Sample the second overscroll animation to its end. + // If the ending of the first overscroll animation fails to clear state + // properly, this will assert. + ParentLayerPoint expectedScrollOffset(0, GetScrollRange().YMost()); + SampleAnimationUntilRecoveredFromOverscroll(expectedScrollOffset); +} + TEST_F(APZCBasicTester, OverScrollAbort) { SCOPED_GFX_PREF(APZOverscrollEnabled, bool, true); From 866e26fd0c02cb9a8048f9c6031bfccd207775ec Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Fri, 1 May 2015 16:34:36 -0600 Subject: [PATCH 51/58] Bug 1160393 - Enable webrtc logging for android; r=bwc --- build/mobile/remoteautomation.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/build/mobile/remoteautomation.py b/build/mobile/remoteautomation.py index 2a6a684e1cd..a57e04336eb 100644 --- a/build/mobile/remoteautomation.py +++ b/build/mobile/remoteautomation.py @@ -80,6 +80,14 @@ class RemoteAutomation(Automation): # Don't override the user's choice here. See bug 1049688. env.setdefault('MOZ_DISABLE_NONLOCAL_CONNECTIONS', '1') + # Set WebRTC logging in case it is not set yet. + # On Android, environment variables cannot contain ',' so the + # standard WebRTC setting for NSPR_LOG_MODULES is not available. + # env.setdefault('NSPR_LOG_MODULES', 'signaling:5,mtransport:5,datachannel:5,jsep:5,MediaPipelineFactory:5') + env.setdefault('R_LOG_LEVEL', '6') + env.setdefault('R_LOG_DESTINATION', 'stderr') + env.setdefault('R_LOG_VERBOSE', '1') + return env def waitForFinish(self, proc, utilityPath, timeout, maxTime, startTime, debuggerInfo, symbolsPath): From 2e682e3f7498f2593d2179c18cbacfc2a509e8c3 Mon Sep 17 00:00:00 2001 From: Geoff Brown Date: Fri, 1 May 2015 16:34:37 -0600 Subject: [PATCH 52/58] Bug 1160194 - Bump mozharness.json to revision 1da0d44cd6ab --- testing/mozharness/mozharness.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/testing/mozharness/mozharness.json b/testing/mozharness/mozharness.json index 6ae6934b132..1ed37b71363 100644 --- a/testing/mozharness/mozharness.json +++ b/testing/mozharness/mozharness.json @@ -1,4 +1,4 @@ { "repo": "https://hg.mozilla.org/build/mozharness", - "revision": "ca580fcfa627" + "revision": "1da0d44cd6ab" } From e45cd3431f4ed2d000824d18c479d524b0cc41de Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Sat, 2 May 2015 02:25:51 +0100 Subject: [PATCH 53/58] Bug 923193 - Avoid calling GetDeltaToPerspectiveOrigin for elements that don't have perspective. r=heycam --- layout/base/nsDisplayList.cpp | 8 ++++++-- layout/base/nsDisplayList.h | 13 +++++++++++-- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 5838dc24c46..0ccd51a77fc 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -4737,7 +4737,6 @@ nsDisplayTransform::FrameTransformProperties::FrameTransformProperties(const nsI : mFrame(aFrame) , mTransformList(aFrame->StyleDisplay()->mSpecifiedTransform) , mToTransformOrigin(GetDeltaToTransformOrigin(aFrame, aAppUnitsPerPixel, aBoundsOverride)) - , mToPerspectiveOrigin(GetDeltaToPerspectiveOrigin(aFrame, aAppUnitsPerPixel)) , mChildPerspective(0) { const nsStyleDisplay* parentDisp = nullptr; @@ -4747,6 +4746,11 @@ nsDisplayTransform::FrameTransformProperties::FrameTransformProperties(const nsI } if (parentDisp && parentDisp->mChildPerspective.GetUnit() == eStyleUnit_Coord) { mChildPerspective = parentDisp->mChildPerspective.GetCoordValue(); + // Calling GetDeltaToPerspectiveOrigin can be expensive, so we avoid + // calling it unnecessarily. + if (mChildPerspective > 0.0) { + mToPerspectiveOrigin = GetDeltaToPerspectiveOrigin(aFrame, aAppUnitsPerPixel); + } } } @@ -4844,7 +4848,7 @@ nsDisplayTransform::GetResultingTransformMatrixInternal(const FrameTransformProp /* At the point when perspective is applied, we have been translated to the transform origin. * The translation to the perspective origin is the difference between these values. */ - perspective.ChangeBasis(aProperties.mToPerspectiveOrigin - aProperties.mToTransformOrigin); + perspective.ChangeBasis(aProperties.GetToPerspectiveOrigin() - aProperties.mToTransformOrigin); result = result * perspective; } diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index fc2ee283f8d..998e01a7f04 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -3514,15 +3514,24 @@ public: : mFrame(nullptr) , mTransformList(aTransformList) , mToTransformOrigin(aToTransformOrigin) - , mToPerspectiveOrigin(aToPerspectiveOrigin) , mChildPerspective(aChildPerspective) + , mToPerspectiveOrigin(aToPerspectiveOrigin) {} + const Point3D& GetToPerspectiveOrigin() const + { + MOZ_ASSERT(mChildPerspective > 0, "Only valid with mChildPerspective > 0"); + return mToPerspectiveOrigin; + } + const nsIFrame* mFrame; nsRefPtr mTransformList; const Point3D mToTransformOrigin; - const Point3D mToPerspectiveOrigin; nscoord mChildPerspective; + + private: + // mToPerspectiveOrigin is only valid if mChildPerspective > 0. + Point3D mToPerspectiveOrigin; }; /** From cc888ff4add24fa2ccf35e5d0e1e161def061e8e Mon Sep 17 00:00:00 2001 From: Boris Zbarsky Date: Fri, 1 May 2015 22:33:01 -0400 Subject: [PATCH 54/58] Bug 1087330. Make the data structure we use for our promise microtask queue have O(1) first element removal, not O(N). r=khuey --- dom/promise/Promise.cpp | 14 +++++++------- xpcom/base/CycleCollectedJSRuntime.cpp | 2 +- xpcom/base/CycleCollectedJSRuntime.h | 6 ++++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/dom/promise/Promise.cpp b/dom/promise/Promise.cpp index 665de4c1c36..ab3500bad55 100644 --- a/dom/promise/Promise.cpp +++ b/dom/promise/Promise.cpp @@ -482,10 +482,10 @@ bool Promise::PerformMicroTaskCheckpoint() { CycleCollectedJSRuntime* runtime = CycleCollectedJSRuntime::Get(); - nsTArray>& microtaskQueue = + std::queue>& microtaskQueue = runtime->GetPromiseMicroTaskQueue(); - if (microtaskQueue.IsEmpty()) { + if (microtaskQueue.empty()) { return false; } @@ -495,11 +495,11 @@ Promise::PerformMicroTaskCheckpoint() } do { - nsCOMPtr runnable = microtaskQueue.ElementAt(0); + nsCOMPtr runnable = microtaskQueue.front(); MOZ_ASSERT(runnable); // This function can re-enter, so we remove the element before calling. - microtaskQueue.RemoveElementAt(0); + microtaskQueue.pop(); nsresult rv = runnable->Run(); if (NS_WARN_IF(NS_FAILED(rv))) { return false; @@ -507,7 +507,7 @@ Promise::PerformMicroTaskCheckpoint() if (cx.isSome()) { JS_CheckForInterrupt(cx.ref()); } - } while (!microtaskQueue.IsEmpty()); + } while (!microtaskQueue.empty()); return true; } @@ -1168,10 +1168,10 @@ Promise::DispatchToMicroTask(nsIRunnable* aRunnable) MOZ_ASSERT(aRunnable); CycleCollectedJSRuntime* runtime = CycleCollectedJSRuntime::Get(); - nsTArray>& microtaskQueue = + std::queue>& microtaskQueue = runtime->GetPromiseMicroTaskQueue(); - microtaskQueue.AppendElement(aRunnable); + microtaskQueue.push(aRunnable); } #if defined(DOM_PROMISE_DEPRECATED_REPORTING) diff --git a/xpcom/base/CycleCollectedJSRuntime.cpp b/xpcom/base/CycleCollectedJSRuntime.cpp index 283acec1458..04fa23b714b 100644 --- a/xpcom/base/CycleCollectedJSRuntime.cpp +++ b/xpcom/base/CycleCollectedJSRuntime.cpp @@ -961,7 +961,7 @@ CycleCollectedJSRuntime::SetPendingException(nsIException* aException) mPendingException = aException; } -nsTArray>& +std::queue>& CycleCollectedJSRuntime::GetPromiseMicroTaskQueue() { return mPromiseMicroTaskQueue; diff --git a/xpcom/base/CycleCollectedJSRuntime.h b/xpcom/base/CycleCollectedJSRuntime.h index c344b13b2fd..75b7d5c9b60 100644 --- a/xpcom/base/CycleCollectedJSRuntime.h +++ b/xpcom/base/CycleCollectedJSRuntime.h @@ -7,6 +7,8 @@ #ifndef mozilla_CycleCollectedJSRuntime_h__ #define mozilla_CycleCollectedJSRuntime_h__ +#include + #include "mozilla/DeferredFinalize.h" #include "mozilla/MemoryReporting.h" #include "jsapi.h" @@ -261,7 +263,7 @@ public: already_AddRefed GetPendingException() const; void SetPendingException(nsIException* aException); - nsTArray>& GetPromiseMicroTaskQueue(); + std::queue>& GetPromiseMicroTaskQueue(); nsCycleCollectionParticipant* GCThingParticipant(); nsCycleCollectionParticipant* ZoneParticipant(); @@ -322,7 +324,7 @@ private: nsCOMPtr mPendingException; - nsTArray> mPromiseMicroTaskQueue; + std::queue> mPromiseMicroTaskQueue; OOMState mOutOfMemoryState; OOMState mLargeAllocationFailureState; From 8d4c8b65774f8bfab2e6d3cdebbc315f28c5af3e Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Thu, 30 Apr 2015 09:58:58 -0700 Subject: [PATCH 55/58] Bug 1160356 - Make Date.UTC conform to ES3-6 in converting *all* arguments to number before computing the return value. r=evilpie --- js/src/jsdate.cpp | 70 +++++++++++++++++-- .../ecma_5/Date/UTC-convert-all-arguments.js | 70 +++++++++++++++++++ 2 files changed, 133 insertions(+), 7 deletions(-) create mode 100644 js/src/tests/ecma_5/Date/UTC-convert-all-arguments.js diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index 1b7f78678b5..bb2d2a17e55 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -614,21 +614,77 @@ date_msecFromArgs(JSContext* cx, CallArgs args, double* rval) return true; } -/* - * See ECMA 15.9.4.[3-10]; - */ +/* ES6 20.3.3.4. */ static bool date_UTC(JSContext* cx, unsigned argc, Value* vp) { CallArgs args = CallArgsFromVp(argc, vp); - double msec_time; - if (!date_msecFromArgs(cx, args, &msec_time)) + // Steps 1-2. + double y; + if (!ToNumber(cx, args.get(0), &y)) return false; - msec_time = TimeClip(msec_time); + // Steps 3-4. + double m; + if (!ToNumber(cx, args.get(1), &m)) + return false; - args.rval().setNumber(msec_time); + // Steps 5-6. + double dt; + if (args.length() >= 3) { + if (!ToNumber(cx, args[2], &dt)) + return false; + } else { + dt = 1; + } + + // Steps 7-8. + double h; + if (args.length() >= 4) { + if (!ToNumber(cx, args[3], &h)) + return false; + } else { + h = 0; + } + + // Steps 9-10. + double min; + if (args.length() >= 5) { + if (!ToNumber(cx, args[4], &min)) + return false; + } else { + min = 0; + } + + // Steps 11-12. + double s; + if (args.length() >= 6) { + if (!ToNumber(cx, args[5], &s)) + return false; + } else { + s = 0; + } + + // Steps 13-14. + double milli; + if (args.length() >= 7) { + if (!ToNumber(cx, args[6], &milli)) + return false; + } else { + milli = 0; + } + + // Step 15. + double yr = y; + if (!IsNaN(y)) { + double yint = ToInteger(y); + if (0 <= yint && yint <= 99) + yr = 1900 + yint; + } + + // Step 16. + args.rval().setDouble(TimeClip(MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli)))); return true; } diff --git a/js/src/tests/ecma_5/Date/UTC-convert-all-arguments.js b/js/src/tests/ecma_5/Date/UTC-convert-all-arguments.js new file mode 100644 index 00000000000..2fee8b951dd --- /dev/null +++ b/js/src/tests/ecma_5/Date/UTC-convert-all-arguments.js @@ -0,0 +1,70 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommonn.org/licenses/publicdomain/ + */ + +var BUGNUMBER = 1160356; +var summary = + "Date.UTC must convert *all* arguments to number, not return NaN early if " + + "a non-finite argument is encountered"; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +function expectThrowTypeError(f, i) +{ + try + { + f(); + throw new Error("didn't throw"); + } + catch (e) + { + assertEq(e, 42, "index " + i + ": expected 42, got " + e); + } +} + +var bad = + { toString: function() { throw 17; }, valueOf: function() { throw 42; } }; + +var args = + [ + [bad], + + [NaN, bad], + [Infinity, bad], + [1970, bad], + + [1970, NaN, bad], + [1970, Infinity, bad], + [1970, 4, bad], + + [1970, 4, NaN, bad], + [1970, 4, Infinity, bad], + [1970, 4, 17, bad], + + [1970, 4, 17, NaN, bad], + [1970, 4, 17, Infinity, bad], + [1970, 4, 17, 13, bad], + + [1970, 4, 17, 13, NaN, bad], + [1970, 4, 17, 13, Infinity, bad], + [1970, 4, 17, 13, 37, bad], + + [1970, 4, 17, 13, 37, NaN, bad], + [1970, 4, 17, 13, 37, Infinity, bad], + [1970, 4, 17, 13, 37, 23, bad], + ]; + +for (var i = 0, len = args.length; i < len; i++) + expectThrowTypeError(function() { Date.UTC.apply(null, args[i]); }, i); + +/******************************************************************************/ + +if (typeof reportCompare === "function") + reportCompare(true, true); + +print("Tests complete"); From 919127e63ff07e981b1a39cdbb150b2f07229dd1 Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Thu, 30 Apr 2015 09:58:58 -0700 Subject: [PATCH 56/58] Bug 1160356 - Reorganize the code for the Date function/constructor into three separate methods, to be more consistent with ES6's definition of it. Don't change the actual algorithm yet -- this is just code motion. r=evilpie --- js/src/jsdate.cpp | 106 +++++++++++++++++++++++++++++++--------------- 1 file changed, 71 insertions(+), 35 deletions(-) diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index bb2d2a17e55..2ac1b175481 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -3012,34 +3012,49 @@ static const JSFunctionSpec date_methods[] = { JS_FS_END }; -bool -js::DateConstructor(JSContext* cx, unsigned argc, Value* vp) +static bool +NewDateObject(JSContext* cx, const CallArgs& args, double d) { - CallArgs args = CallArgsFromVp(argc, vp); + JSObject* obj = NewDateObjectMsec(cx, d); + if (!obj) + return false; - /* Date called as function. */ - if (!args.isConstructing()) - return date_format(cx, NowAsMillis(), FORMATSPEC_FULL, args.rval()); + args.rval().setObject(*obj); + return true; +} - /* Date called as constructor. */ - double d; - if (args.length() == 0) { - /* ES5 15.9.3.3. */ - d = NowAsMillis(); - } else if (args.length() == 1) { - /* ES5 15.9.3.2. */ +static bool +ToDateString(JSContext* cx, const CallArgs& args, double d) +{ + return date_format(cx, d, FORMATSPEC_FULL, args.rval()); +} + +static bool +DateNoArguments(JSContext* cx, const CallArgs& args) +{ + MOZ_ASSERT(args.length() == 0); + + double now = NowAsMillis(); + + if (args.isConstructing()) + return NewDateObject(cx, args, now); + + return ToDateString(cx, args, now); +} + +static bool +DateOneArgument(JSContext* cx, const CallArgs& args) +{ + MOZ_ASSERT(args.length() == 1); + + if (args.isConstructing()) { + double d; - /* Step 1. */ if (!ToPrimitive(cx, args[0])) return false; if (args[0].isString()) { - /* Step 2. */ - JSString* str = args[0].toString(); - if (!str) - return false; - - JSLinearString* linearStr = str->ensureLinear(cx); + JSLinearString* linearStr = args[0].toString()->ensureLinear(cx); if (!linearStr) return false; @@ -3048,29 +3063,50 @@ js::DateConstructor(JSContext* cx, unsigned argc, Value* vp) else d = TimeClip(d); } else { - /* Step 3. */ if (!ToNumber(cx, args[0], &d)) return false; d = TimeClip(d); } - } else { - double msec_time; - if (!date_msecFromArgs(cx, args, &msec_time)) - return false; - if (IsFinite(msec_time)) { - msec_time = UTC(msec_time, &cx->runtime()->dateTimeInfo); - msec_time = TimeClip(msec_time); - } - d = msec_time; + return NewDateObject(cx, args, d); } - JSObject* obj = NewDateObjectMsec(cx, d); - if (!obj) - return false; + return ToDateString(cx, args, NowAsMillis()); +} - args.rval().setObject(*obj); - return true; +static bool +DateMultipleArguments(JSContext* cx, const CallArgs& args) +{ + MOZ_ASSERT(args.length() >= 2); + + if (args.isConstructing()) { + double millis; + if (!date_msecFromArgs(cx, args, &millis)) + return false; + + if (IsFinite(millis)) { + millis = UTC(millis, &cx->runtime()->dateTimeInfo); + millis = TimeClip(millis); + } + + return NewDateObject(cx, args, millis); + } + + return ToDateString(cx, args, NowAsMillis()); +} + +bool +js::DateConstructor(JSContext* cx, unsigned argc, Value* vp) +{ + CallArgs args = CallArgsFromVp(argc, vp); + + if (args.length() == 0) + return DateNoArguments(cx, args); + + if (args.length() == 1) + return DateOneArgument(cx, args); + + return DateMultipleArguments(cx, args); } static bool From 60f00b7950dfd6b6ce5427059553d4e577731073 Mon Sep 17 00:00:00 2001 From: Jeff Walden Date: Thu, 30 Apr 2015 09:58:58 -0700 Subject: [PATCH 57/58] Bug 1160356 - Make new Date(arg1, arg2, ...) conform to ES3-6 in converting *all* arguments to number before computing the return value. r=evilpie --- js/src/jsdate.cpp | 115 ++++++++++-------- .../Date/constructor-convert-all-arguments.js | 70 +++++++++++ 2 files changed, 137 insertions(+), 48 deletions(-) create mode 100644 js/src/tests/ecma_5/Date/constructor-convert-all-arguments.js diff --git a/js/src/jsdate.cpp b/js/src/jsdate.cpp index 2ac1b175481..88e361a2d8a 100644 --- a/js/src/jsdate.cpp +++ b/js/src/jsdate.cpp @@ -574,46 +574,6 @@ date_msecFromDate(double year, double mon, double mday, double hour, return MakeDate(MakeDay(year, mon, mday), MakeTime(hour, min, sec, msec)); } -/* compute the time in msec (unclipped) from the given args */ -#define MAXARGS 7 - -static bool -date_msecFromArgs(JSContext* cx, CallArgs args, double* rval) -{ - unsigned loop; - double array[MAXARGS]; - double msec_time; - - for (loop = 0; loop < MAXARGS; loop++) { - if (loop < args.length()) { - double d; - if (!ToNumber(cx, args[loop], &d)) - return false; - /* return NaN if any arg is not finite */ - if (!IsFinite(d)) { - *rval = GenericNaN(); - return true; - } - array[loop] = ToInteger(d); - } else { - if (loop == 2) { - array[loop] = 1; /* Default the date argument to 1. */ - } else { - array[loop] = 0; - } - } - } - - /* adjust 2-digit years into the 20th century */ - if (array[0] >= 0 && array[0] <= 99) - array[0] += 1900; - - msec_time = date_msecFromDate(array[0], array[1], array[2], - array[3], array[4], array[5], array[6]); - *rval = msec_time; - return true; -} - /* ES6 20.3.3.4. */ static bool date_UTC(JSContext* cx, unsigned argc, Value* vp) @@ -2947,7 +2907,7 @@ js::date_valueOf(JSContext* cx, unsigned argc, Value* vp) } static const JSFunctionSpec date_static_methods[] = { - JS_FN("UTC", date_UTC, MAXARGS,0), + JS_FN("UTC", date_UTC, 7,0), JS_FN("parse", date_parse, 1,0), JS_FN("now", date_now, 0,0), JS_FS_END @@ -3079,17 +3039,76 @@ DateMultipleArguments(JSContext* cx, const CallArgs& args) { MOZ_ASSERT(args.length() >= 2); + // Step 3. if (args.isConstructing()) { - double millis; - if (!date_msecFromArgs(cx, args, &millis)) + // Steps 3a-b. + double y; + if (!ToNumber(cx, args[0], &y)) return false; - if (IsFinite(millis)) { - millis = UTC(millis, &cx->runtime()->dateTimeInfo); - millis = TimeClip(millis); + // Steps 3c-d. + double m; + if (!ToNumber(cx, args[1], &m)) + return false; + + // Steps 3e-f. + double dt; + if (args.length() >= 3) { + if (!ToNumber(cx, args[2], &dt)) + return false; + } else { + dt = 1; } - return NewDateObject(cx, args, millis); + // Steps 3g-h. + double h; + if (args.length() >= 4) { + if (!ToNumber(cx, args[3], &h)) + return false; + } else { + h = 0; + } + + // Steps 3i-j. + double min; + if (args.length() >= 5) { + if (!ToNumber(cx, args[4], &min)) + return false; + } else { + min = 0; + } + + // Steps 3k-l. + double s; + if (args.length() >= 6) { + if (!ToNumber(cx, args[5], &s)) + return false; + } else { + s = 0; + } + + // Steps 3m-n. + double milli; + if (args.length() >= 7) { + if (!ToNumber(cx, args[6], &milli)) + return false; + } else { + milli = 0; + } + + // Step 3o. + double yr = y; + if (!IsNaN(y)) { + double yint = ToInteger(y); + if (0 <= yint && yint <= 99) + yr = 1900 + yint; + } + + // Step 3p. + double finalDate = MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli)); + + // Steps 3q-t. + return NewDateObject(cx, args, TimeClip(UTC(finalDate, &cx->runtime()->dateTimeInfo))); } return ToDateString(cx, args, NowAsMillis()); @@ -3144,7 +3163,7 @@ const Class DateObject::class_ = { nullptr, /* construct */ nullptr, /* trace */ { - GenericCreateConstructor, + GenericCreateConstructor, GenericCreatePrototype, date_static_methods, nullptr, diff --git a/js/src/tests/ecma_5/Date/constructor-convert-all-arguments.js b/js/src/tests/ecma_5/Date/constructor-convert-all-arguments.js new file mode 100644 index 00000000000..3a281cae220 --- /dev/null +++ b/js/src/tests/ecma_5/Date/constructor-convert-all-arguments.js @@ -0,0 +1,70 @@ +/* + * Any copyright is dedicated to the Public Domain. + * http://creativecommonn.org/licenses/publicdomain/ + */ + +var BUGNUMBER = 1160356; +var summary = + "new Date(...) must convert *all* arguments to number, not return NaN " + + "early if a non-finite argument is encountered"; + +print(BUGNUMBER + ": " + summary); + +/************** + * BEGIN TEST * + **************/ + +function expectThrowTypeError(f, i) +{ + try + { + f(); + throw new Error("didn't throw"); + } + catch (e) + { + assertEq(e, 42, "index " + i + ": expected 42, got " + e); + } +} + +var bad = + { toString: function() { throw 17; }, valueOf: function() { throw 42; } }; + +var funcs = + [ + function() { new Date(bad); }, + + function() { new Date(NaN, bad); }, + function() { new Date(Infinity, bad); }, + function() { new Date(1970, bad); }, + + function() { new Date(1970, NaN, bad); }, + function() { new Date(1970, Infinity, bad); }, + function() { new Date(1970, 4, bad); }, + + function() { new Date(1970, 4, NaN, bad); }, + function() { new Date(1970, 4, Infinity, bad); }, + function() { new Date(1970, 4, 17, bad); }, + + function() { new Date(1970, 4, 17, NaN, bad); }, + function() { new Date(1970, 4, 17, Infinity, bad); }, + function() { new Date(1970, 4, 17, 13, bad); }, + + function() { new Date(1970, 4, 17, 13, NaN, bad); }, + function() { new Date(1970, 4, 17, 13, Infinity, bad); }, + function() { new Date(1970, 4, 17, 13, 37, bad); }, + + function() { new Date(1970, 4, 17, 13, 37, NaN, bad); }, + function() { new Date(1970, 4, 17, 13, 37, Infinity, bad); }, + function() { new Date(1970, 4, 17, 13, 37, 23, bad); }, + ]; + +for (var i = 0, len = funcs.length; i < len; i++) + expectThrowTypeError(funcs[i]); + +/******************************************************************************/ + +if (typeof reportCompare === "function") + reportCompare(true, true); + +print("Tests complete"); From d2168c03dc8d2bbd30055c83a5d1ec1c1e4c92ed Mon Sep 17 00:00:00 2001 From: Philip Chee Date: Sun, 3 May 2015 00:15:40 +0800 Subject: [PATCH 58/58] Bug 1160770 - Unnecessary return in tabScrolling property in XPFE autocomplete.xml NPOTB r=Neil DONTBUILD --- xpfe/components/autocomplete/resources/content/autocomplete.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xpfe/components/autocomplete/resources/content/autocomplete.xml b/xpfe/components/autocomplete/resources/content/autocomplete.xml index c4834582afc..93b6dfdb0c9 100644 --- a/xpfe/components/autocomplete/resources/content/autocomplete.xml +++ b/xpfe/components/autocomplete/resources/content/autocomplete.xml @@ -277,7 +277,7 @@