merge mozilla-inbound to mozilla-central a=merge

This commit is contained in:
Carsten "Tomcat" Book 2015-10-14 12:46:09 +02:00
commit 0ecf764867
213 changed files with 1871 additions and 1504 deletions

View File

@ -39,13 +39,11 @@ ifndef MOZ_PROFILE_USE
# otherwise the rule in rules.mk doesn't run early enough.
$(TIERS) binaries:: CLOBBER $(configure_dir)/configure config.status backend.RecursiveMakeBackend
ifndef JS_STANDALONE
ifndef LIBXUL_SDK
ifdef COMPILE_ENVIRONMENT
$(TIERS) binaries:: $(topsrcdir)/js/src/configure js/src/config.status
endif
endif
endif
endif
ifdef JS_STANDALONE
.PHONY: CLOBBER
@ -106,7 +104,6 @@ install_manifest_depends = \
$(NULL)
ifndef JS_STANDALONE
ifndef LIBXUL_SDK
ifdef COMPILE_ENVIRONMENT
install_manifest_depends += \
$(topsrcdir)/js/src/configure \
@ -114,7 +111,6 @@ install_manifest_depends += \
$(NULL)
endif
endif
endif
.PHONY: install-manifests
install-manifests: $(addprefix install-,$(install_manifests))

View File

@ -3,10 +3,8 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if not CONFIG['LIBXUL_SDK']:
include('/toolkit/toolkit.mozbuild')
elif CONFIG['ENABLE_TESTS']:
DIRS += ['/testing/mochitest']
include('/toolkit/toolkit.mozbuild')
if CONFIG['MOZ_EXTENSIONS']:
DIRS += ['/extensions']

View File

@ -52,24 +52,14 @@ tools repackage:: $(libs-preqs)
sed -e 's/%APP_VERSION%/$(APP_VERSION)/' -e 's/%APP_NAME%/$(APP_NAME)/' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(DIST)/$(APP_NAME).app/$(LPROJ)/InfoPlist.strings
rsync -a --exclude 'mangle' --exclude 'shlibsign' --exclude-from='$(srcdir)/macbuild/Contents/MacOS-files.in' $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/Resources
rsync -a --include-from='$(srcdir)/macbuild/Contents/MacOS-files.in' --exclude '*' $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/MacOS
ifdef LIBXUL_SDK
cp $(LIBXUL_DIST)/bin/xulrunner$(BIN_SUFFIX) $(DIST)/$(APP_NAME).app/Contents/MacOS/$(APP_BINARY)
rsync -a --exclude nsinstall --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(DIST)/$(APP_NAME).app/Contents/Frameworks
else
$(RM) $(DIST)/$(APP_NAME).app/Contents/MacOS/$(PROGRAM)
rsync -aL $(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS
endif
cp -RL $(DIST)/branding/app.icns $(DIST)/$(APP_NAME).app/Contents/Resources/$(MOZ_APP_NAME).icns
printf APPLMOZB > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
else # MOZ_WIDGET_TOOLKIT != cocoa
libs::
ifdef LIBXUL_SDK
cp $(LIBXUL_DIST)/bin/xulrunner-stub$(BIN_SUFFIX) $(DIST)/bin/$(APP_BINARY)
$(NSINSTALL) -D $(DIST)/bin/xulrunner
(cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -)
endif
$(NSINSTALL) -D $(DIST)/bin/chrome/icons/default
# Copy the app icon for b2g-desktop

View File

@ -4,27 +4,26 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if not CONFIG['LIBXUL_SDK']:
if CONFIG['GAIADIR']:
GeckoProgram(CONFIG['MOZ_APP_NAME'] + "-bin")
else:
GeckoProgram(CONFIG['MOZ_APP_NAME'])
if CONFIG['MOZ_B2G_LOADER']:
SOURCES += [
'B2GLoader.cpp',
]
if CONFIG['GAIADIR']:
GeckoProgram(CONFIG['MOZ_APP_NAME'] + "-bin")
else:
GeckoProgram(CONFIG['MOZ_APP_NAME'])
if CONFIG['MOZ_B2G_LOADER']:
SOURCES += [
'nsBrowserApp.cpp',
'B2GLoader.cpp',
]
if CONFIG['_MSC_VER']:
# Always enter a Windows program through wmain, whether or not we're
# a console application.
WIN32_EXE_LDFLAGS += ['-ENTRY:wmainCRTStartup']
USE_LIBS += [
'zlib',
]
SOURCES += [
'nsBrowserApp.cpp',
]
if CONFIG['_MSC_VER']:
# Always enter a Windows program through wmain, whether or not we're
# a console application.
WIN32_EXE_LDFLAGS += ['-ENTRY:wmainCRTStartup']
USE_LIBS += [
'zlib',
]
for var in ('MOZ_APP_NAME', 'MOZ_APP_VERSION', 'MOZ_UPDATER'):
DEFINES[var] = CONFIG[var]

View File

@ -44,11 +44,7 @@ fi
# use custom widget for html:select
MOZ_USE_NATIVE_POPUP_WINDOWS=1
if test "$LIBXUL_SDK"; then
MOZ_XULRUNNER=1
else
MOZ_XULRUNNER=
fi
MOZ_MEDIA_NAVIGATOR=1

View File

@ -3,8 +3,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if not CONFIG['LIBXUL_SDK']:
include('/toolkit/toolkit.mozbuild')
include('/toolkit/toolkit.mozbuild')
if CONFIG['MOZ_EXTENSIONS']:
DIRS += ['/extensions']

View File

@ -3,10 +3,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if not CONFIG['LIBXUL_SDK']:
include('/toolkit/toolkit.mozbuild')
elif CONFIG['ENABLE_TESTS']:
DIRS += ['/testing/mochitest']
include('/toolkit/toolkit.mozbuild')
if CONFIG['MOZ_EXTENSIONS']:
DIRS += ['/extensions']

View File

@ -117,18 +117,10 @@ installers-%: clobber-% langpack-% repackage-win32-installer-% repackage-zip-%
# When we unpack b2g on MacOS X the platform.ini and application.ini are in slightly
# different locations that on all other platforms
ifeq (Darwin, $(OS_ARCH))
ifdef LIBXUL_SDK
GECKO_PLATFORM_INI_PATH='$(STAGEDIST)/../Frameworks/XUL.framework/Versions/$(MOZILLA_VERSION)/platform.ini'
else
GECKO_PLATFORM_INI_PATH='$(STAGEDIST)/platform.ini'
endif
B2G_APPLICATION_INI_PATH='$(STAGEDIST)/application.ini'
else
ifdef LIBXUL_SDK
GECKO_PLATFORM_INI_PATH='$(STAGEDIST)/xulrunner/platform.ini'
else
GECKO_PLATFORM_INI_PATH='$(STAGEDIST)/platform.ini'
endif
B2G_APPLICATION_INI_PATH='$(STAGEDIST)/application.ini'
endif

View File

@ -3,8 +3,7 @@
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
if not CONFIG['LIBXUL_SDK']:
include('/toolkit/toolkit.mozbuild')
include('/toolkit/toolkit.mozbuild')
if CONFIG['MOZ_EXTENSIONS']:
DIRS += ['/extensions']

View File

@ -62,12 +62,10 @@ libs::
$(INSTALL) $(IFLAGS1) $(DIST)/branding/default48.png $(FINAL_TARGET)/chrome/icons/default
endif
ifndef LIBXUL_SDK
# channel-prefs.js is handled separate from other prefs due to bug 756325
libs:: $(srcdir)/profile/channel-prefs.js
$(NSINSTALL) -D $(DIST)/bin/defaults/pref
$(call py_action,preprocessor,-Fsubstitution $(PREF_PPFLAGS) $(ACDEFINES) $^ -o $(DIST)/bin/defaults/pref/channel-prefs.js)
endif
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
@ -107,13 +105,3 @@ tools repackage:: $(PROGRAM)
cp -RL $(DIST)/branding/document.icns $(dist_dest)/Contents/Resources/document.icns
printf APPLMOZB > $(dist_dest)/Contents/PkgInfo
endif
ifdef LIBXUL_SDK #{
libs::
ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) #{
rsync -a --copy-unsafe-links $(LIBXUL_DIST)/XUL.framework $(dist_dest)/Contents/Frameworks
else
$(NSINSTALL) -D $(DIST)/bin/xulrunner
(cd $(LIBXUL_SDK)/bin && tar $(TAR_CREATE_FLAGS) - .) | (cd $(DIST)/bin/xulrunner && tar -xf -)
endif #} cocoa
endif #} LIBXUL_SDK

View File

@ -15,11 +15,6 @@ JS_PREFERENCE_FILES += [
'profile/firefox.js',
]
if CONFIG['LIBXUL_SDK']:
PREF_JS_EXPORTS += [
'profile/channel-prefs.js',
]
SOURCES += [
'nsBrowserApp.cpp',
]
@ -29,9 +24,6 @@ FINAL_TARGET_FILES.defaults.profile += ['profile/prefs.js']
DEFINES['APP_VERSION'] = CONFIG['MOZ_APP_VERSION']
if CONFIG['LIBXUL_SDK']:
DEFINES['LIBXUL_SDK'] = True
GENERATED_INCLUDES += [
'/build',
]

View File

@ -225,11 +225,6 @@ FileExists(const char *path)
#endif
}
#ifdef LIBXUL_SDK
# define XPCOM_PATH "xulrunner" XPCOM_FILE_PATH_SEPARATOR XPCOM_DLL
#else
# define XPCOM_PATH XPCOM_DLL
#endif
static nsresult
InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory)
{
@ -242,55 +237,13 @@ InitXPCOMGlue(const char *argv0, nsIFile **xreDirectory)
}
char *lastSlash = strrchr(exePath, XPCOM_FILE_PATH_SEPARATOR[0]);
if (!lastSlash || (size_t(lastSlash - exePath) > MAXPATHLEN - sizeof(XPCOM_PATH) - 1))
if (!lastSlash || (size_t(lastSlash - exePath) > MAXPATHLEN -
sizeof(XPCOM_DLL) - 1))
return NS_ERROR_FAILURE;
strcpy(lastSlash + 1, XPCOM_PATH);
lastSlash += sizeof(XPCOM_PATH) - sizeof(XPCOM_DLL);
strcpy(lastSlash + 1, XPCOM_DLL);
if (!FileExists(exePath)) {
#if defined(LIBXUL_SDK) && defined(XP_MACOSX)
// Check for <bundle>/Contents/Frameworks/XUL.framework/libxpcom.dylib
bool greFound = false;
CFBundleRef appBundle = CFBundleGetMainBundle();
if (!appBundle)
return NS_ERROR_FAILURE;
CFURLRef fwurl = CFBundleCopyPrivateFrameworksURL(appBundle);
CFURLRef absfwurl = nullptr;
if (fwurl) {
absfwurl = CFURLCopyAbsoluteURL(fwurl);
CFRelease(fwurl);
}
if (absfwurl) {
CFURLRef xulurl =
CFURLCreateCopyAppendingPathComponent(nullptr, absfwurl,
CFSTR("XUL.framework"),
true);
if (xulurl) {
CFURLRef xpcomurl =
CFURLCreateCopyAppendingPathComponent(nullptr, xulurl,
CFSTR("libxpcom.dylib"),
false);
if (xpcomurl) {
if (CFURLGetFileSystemRepresentation(xpcomurl, true,
(UInt8*) exePath,
sizeof(exePath)) &&
access(tbuffer, R_OK | X_OK) == 0) {
if (realpath(tbuffer, exePath)) {
greFound = true;
}
}
CFRelease(xpcomurl);
}
CFRelease(xulurl);
}
CFRelease(absfwurl);
}
}
if (!greFound) {
#endif
Output("Could not find the Mozilla runtime.\n");
return NS_ERROR_FAILURE;
}

View File

@ -20,10 +20,6 @@ endif
DEFINES += -DMOZ_APP_NAME=$(MOZ_APP_NAME) -DPREF_DIR=$(PREF_DIR)
ifdef LIBXUL_SDK
DEFINES += -DLIBXUL_SDK=1
endif
ifdef MOZ_DEBUG
DEFINES += -DMOZ_DEBUG=1
endif
@ -103,9 +99,7 @@ MOZ_PKG_MAC_ICON=branding/disk.icns
MOZ_PKG_MAC_EXTRA=--symlink '/Applications:/ '
endif
ifndef LIBXUL_SDK
INSTALL_SDK = 1
endif
include $(topsrcdir)/toolkit/mozapps/installer/signing.mk
include $(topsrcdir)/toolkit/mozapps/installer/packager.mk

View File

@ -709,15 +709,10 @@
@RESPATH@/defaults/autoconfig/prefcalls.js
@RESPATH@/browser/defaults/profile/prefs.js
#ifndef LIBXUL_SDK
; Warning: changing the path to channel-prefs.js can cause bugs (Bug 756325)
; Technically this is an app pref file, but we are keeping it in the original
; gre location for now.
@RESPATH@/defaults/pref/channel-prefs.js
#else
; For Fx-on-xr, channel-prefs lives with the app preferences. (Bug 762588)
@RESPATH@/@PREF_DIR@/channel-prefs.js
#endif
; Services (gre) prefs
#ifdef MOZ_SERVICES_NOTIFICATIONS

View File

@ -7,11 +7,7 @@ USE_RCS_MK := 1
include $(topsrcdir)/config/makefiles/makeutils.mk
ifdef MOZ_APP_BASENAME
ifdef LIBXUL_SDK
APP_INI_DEPS = $(LIBXUL_DIST)/bin/platform.ini
else
APP_INI_DEPS = $(topsrcdir)/config/milestone.txt
endif
MOZ_APP_BUILDID := $(shell cat $(DEPTH)/config/buildid)
APP_INI_DEPS += $(DEPTH)/config/buildid

View File

@ -157,16 +157,11 @@ if test -n "$MOZ_NATIVE_NSPR" -o -n "$NSPR_CFLAGS" -o -n "$NSPR_LIBS"; then
AC_MSG_ERROR([system NSPR does not support PR_UINT64 or including prtypes.h does not provide it]))
CFLAGS=$_SAVE_CFLAGS
elif test -z "$JS_POSIX_NSPR"; then
if test -z "$LIBXUL_SDK"; then
NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
if test -n "$GNU_CC"; then
NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
else
NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
fi
NSPR_CFLAGS="-I${LIBXUL_DIST}/include/nspr"
if test -n "$GNU_CC"; then
NSPR_LIBS="-L${LIBXUL_DIST}/lib -lnspr${NSPR_VERSION} -lplc${NSPR_VERSION} -lplds${NSPR_VERSION}"
else
NSPR_CFLAGS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --includedir="${LIBXUL_DIST}/include/nspr" --cflags`
NSPR_LIBS=`"${LIBXUL_DIST}"/sdk/bin/nspr-config --prefix="${LIBXUL_DIST}" --libdir="${LIBXUL_DIST}"/lib --libs`
NSPR_LIBS="${LIBXUL_DIST}/lib/nspr${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plc${NSPR_VERSION}.lib ${LIBXUL_DIST}/lib/plds${NSPR_VERSION}.lib "
fi
fi

View File

@ -101,17 +101,13 @@ automation/build: $(addprefix automation/,$(MOZ_AUTOMATION_TIERS))
AUTOMATION_EXTRA_CMDLINE-l10n-check = -j1
AUTOMATION_EXTRA_CMDLINE-pretty-l10n-check = -j1
# And force -j1 here until bug 1077670 is fixed.
AUTOMATION_EXTRA_CMDLINE-package-tests = -j1
AUTOMATION_EXTRA_CMDLINE-pretty-package-tests = -j1
# The commands only run if the corresponding MOZ_AUTOMATION_* variable is
# enabled. This means, for example, if we enable MOZ_AUTOMATION_UPLOAD, then
# 'buildsymbols' will only run if MOZ_AUTOMATION_BUILD_SYMBOLS is also set.
# However, the target automation/buildsymbols will still be executed in this
# case because it is a prerequisite of automation/upload.
define automation_commands
@$(MAKE) $1 $(AUTOMATION_EXTRA_CMDLINE-$1)
@+$(MAKE) $1 $(AUTOMATION_EXTRA_CMDLINE-$1)
$(call BUILDSTATUS,TIER_FINISH $1)
endef

View File

@ -64,7 +64,9 @@ def updated_env(env):
def build_tar_package(tar, name, base, directory):
name = os.path.realpath(name)
run_in(base, [tar,
"-c -%s -f" % ("J" if ".xz" in name else "j"),
"-c",
"-%s" % ("J" if ".xz" in name else "j"),
"-f",
name, directory])

View File

@ -301,7 +301,6 @@ ifndef IS_GYP_DIR
# NSPR_CFLAGS and NSS_CFLAGS must appear ahead of the other flags to avoid Linux
# builds wrongly picking up system NSPR/NSS header files.
OS_INCLUDES := \
$(if $(LIBXUL_SDK),-I$(LIBXUL_SDK)/include) \
$(NSPR_CFLAGS) $(NSS_CFLAGS) \
$(MOZ_JPEG_CFLAGS) \
$(MOZ_PNG_CFLAGS) \
@ -432,13 +431,8 @@ HOST_CXXFLAGS += $(HOST_DEFINES) $(MOZBUILD_HOST_CXXFLAGS)
# Override defaults
# Default location of include files
ifndef LIBXUL_SDK
IDL_PARSER_DIR = $(topsrcdir)/xpcom/idl-parser
IDL_PARSER_CACHE_DIR = $(DEPTH)/xpcom/idl-parser
else
IDL_PARSER_DIR = $(LIBXUL_SDK)/sdk/bin
IDL_PARSER_CACHE_DIR = $(LIBXUL_SDK)/sdk/bin
endif
SDK_LIB_DIR = $(DIST)/sdk/lib
SDK_BIN_DIR = $(DIST)/sdk/bin

View File

@ -5,9 +5,6 @@
include $(topsrcdir)/config/rules.mk
ifdef LIBXUL_SDK
$(error config/external/nspr/Makefile.in is not compatible with --enable-libxul-sdk=)
endif
ifdef MOZ_BUILD_NSPR
# Copy NSPR to the SDK

View File

@ -30,10 +30,6 @@ dist_idl_dir := $(DIST)/idl
dist_include_dir := $(DIST)/include
process_py := $(topsrcdir)/python/mozbuild/mozbuild/action/xpidl-process.py
ifdef LIBXUL_SDK
libxul_sdk_includes := -I$(LIBXUL_SDK)/idl
endif
# TODO we should use py_action, but that would require extra directories to be
# in the virtualenv.
%.xpt:

View File

@ -1148,7 +1148,7 @@ PREF_DIR = defaults/pref
# If DIST_SUBDIR is defined it indicates that app and gre dirs are
# different and that we are building app related resources. Hence,
# PREF_DIR should point to the app prefs location.
ifneq (,$(DIST_SUBDIR)$(XPI_NAME)$(LIBXUL_SDK))
ifneq (,$(DIST_SUBDIR)$(XPI_NAME))
PREF_DIR = defaults/preferences
endif

View File

@ -3344,11 +3344,7 @@ MOZ_CONFIG_NSPR()
dnl set GRE_MILESTONE
dnl ========================================================
if test -n "$LIBXUL_SDK"; then
GRE_MILESTONE=`$PYTHON "$_topsrcdir"/config/printconfigsetting.py "$LIBXUL_DIST"/bin/platform.ini Build Milestone`
else
GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
fi
GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
AC_SUBST(GRE_MILESTONE)
# set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
@ -3989,15 +3985,6 @@ if test -n "$WITH_APP_BASENAME" ; then
MOZ_APP_BASENAME="$WITH_APP_BASENAME"
fi
# Now is a good time to test for logic errors, define mismatches, etc.
case "$MOZ_BUILD_APP" in
xulrunner)
if test "$LIBXUL_SDK"; then
AC_MSG_ERROR([Building XULRunner --with-libxul-sdk doesn't make sense; XULRunner provides the libxul SDK.])
fi
;;
esac
# Special cases where we need to AC_DEFINE something. Also a holdover for apps
# that haven't made a confvars.sh yet. Don't add new stuff here, use
# MOZ_BUILD_APP.
@ -6276,11 +6263,6 @@ if test -z "$MOZ_ENABLE_GIO" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; th
MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
fi
dnl Do not build gio with libxul based apps
if test -n "$LIBXUL_SDK_DIR" -a `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
fi
if test `echo "$MOZ_EXTENSIONS" | grep -c gio` -ne 0; then
MOZ_GIO_COMPONENT=1
MOZ_EXTENSIONS=`echo $MOZ_EXTENSIONS | sed -e 's|gio||'`
@ -9139,8 +9121,7 @@ AC_SUBST(JS_SHARED_LIBRARY)
MOZ_CREATE_CONFIG_STATUS()
# No need to run subconfigures when building with LIBXUL_SDK_DIR
if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
if test "$COMPILE_ENVIRONMENT"; then
MOZ_SUBCONFIGURE_ICU()
MOZ_SUBCONFIGURE_FFI()
MOZ_SUBCONFIGURE_JEMALLOC()
@ -9208,8 +9189,7 @@ if test -n "$_subconfigure_subdir"; then
srcdir="$_save_srcdir"
fi
# No need to run subconfigures when building with LIBXUL_SDK_DIR
if test "$COMPILE_ENVIRONMENT" -a -z "$LIBXUL_SDK_DIR"; then
if test "$COMPILE_ENVIRONMENT"; then
export WRAP_LDFLAGS
@ -9288,7 +9268,7 @@ fi
AC_OUTPUT_SUBDIRS(js/src,$cache_file)
ac_configure_args="$_SUBDIR_CONFIG_ARGS"
fi # COMPILE_ENVIRONMENT && !LIBXUL_SDK_DIR
fi # COMPILE_ENVIRONMENT
export WRITE_MOZINFO=1
dnl we need to run config.status after js/src subconfigure because we're

View File

@ -295,7 +295,7 @@ this.AppsUtils = {
for (let id in aApps) {
let app = aApps[id];
if (app.localId == aLocalId) {
// Use the app kind and the app status to choose the right default CSP.
// Use the app status to choose the right default CSP.
try {
switch (app.appStatus) {
case Ci.nsIPrincipal.APP_STATUS_CERTIFIED:

View File

@ -646,7 +646,7 @@ this.AllPossiblePermissions = [];
AllPossiblePermissions.concat(["indexedDB", "offline-app", "pin-app"]);
})();
this.isExplicitInPermissionsTable = function(aPermName, aIntStatus, aAppKind) {
this.isExplicitInPermissionsTable = function(aPermName, aIntStatus) {
// Check to see if the 'webapp' is app/privileged/certified.
let appStatus;

View File

@ -1937,8 +1937,7 @@ this.DOMApplicationRegistry = {
PermissionsInstaller.installPermissions(
{ manifest: newManifest,
origin: app.origin,
manifestURL: app.manifestURL,
kind: app.kind },
manifestURL: app.manifestURL },
true);
}
this.updateDataStore(this.webapps[id].localId, app.origin,
@ -2382,8 +2381,7 @@ this.DOMApplicationRegistry = {
PermissionsInstaller.installPermissions({
manifest: aApp.manifest,
origin: aApp.origin,
manifestURL: aData.manifestURL,
kind: aApp.kind
manifestURL: aData.manifestURL
}, true);
}

View File

@ -41,10 +41,6 @@
#include "nsIWebNavigation.h"
#include "nsIXPConnect.h"
#ifdef MOZ_ENABLE_PROFILER_SPS
#include "nsIProfiler.h"
#endif
// The maximum allowed number of concurrent timers per page.
#define MAX_PAGE_TIMERS 10000
@ -827,23 +823,6 @@ Console::TimeStamp(JSContext* aCx, const JS::Handle<JS::Value> aData)
return;
}
#ifdef MOZ_ENABLE_PROFILER_SPS
if (aData.isString() && NS_IsMainThread()) {
if (!mProfiler) {
mProfiler = do_GetService("@mozilla.org/tools/profiler;1");
}
if (mProfiler) {
bool active = false;
if (NS_SUCCEEDED(mProfiler->IsActive(&active)) && active) {
nsAutoJSString stringValue;
if (stringValue.init(aCx, aData)) {
mProfiler->AddMarker(NS_ConvertUTF16toUTF8(stringValue).get());
}
}
}
}
#endif
Method(aCx, MethodTimeStamp, NS_LITERAL_STRING("timeStamp"), data);
}

View File

@ -20,7 +20,6 @@
class nsIConsoleAPIStorage;
class nsIPrincipal;
class nsIProfiler;
namespace mozilla {
namespace dom {
@ -205,9 +204,6 @@ private:
nsCOMPtr<nsPIDOMWindow> mWindow;
nsCOMPtr<nsIConsoleAPIStorage> mStorage;
nsRefPtr<JSObjectHolder> mSandbox;
#ifdef MOZ_ENABLE_PROFILER_SPS
nsCOMPtr<nsIProfiler> mProfiler;
#endif
nsDataHashtable<nsStringHashKey, DOMHighResTimeStamp> mTimerRegistry;
nsDataHashtable<nsStringHashKey, uint32_t> mCounterRegistry;

View File

@ -175,7 +175,7 @@ ClampToSubject(nsIGlobalObject* aGlobalOrNull)
nsIPrincipal* globalPrin = aGlobalOrNull->PrincipalOrNull();
NS_ENSURE_TRUE(globalPrin, GetCurrentGlobal());
if (!nsContentUtils::SubjectPrincipal()->SubsumesConsideringDomain(globalPrin)) {
if (!nsContentUtils::SubjectPrincipalOrSystemIfNativeCaller()->SubsumesConsideringDomain(globalPrin)) {
return GetCurrentGlobal();
}

View File

@ -4405,7 +4405,8 @@ FindSheet(const nsCOMArray<nsIStyleSheet>& aSheets, nsIURI* aSheetURI)
}
nsresult
nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheetURI)
nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType,
nsIURI* aSheetURI)
{
NS_PRECONDITION(aSheetURI, "null arg");
@ -4414,11 +4415,29 @@ nsDocument::LoadAdditionalStyleSheet(additionalSheetType aType, nsIURI* aSheetUR
return NS_ERROR_INVALID_ARG;
// Loading the sheet sync.
nsRefPtr<mozilla::css::Loader> loader = new mozilla::css::Loader();
nsRefPtr<css::Loader> loader = new css::Loader();
css::SheetParsingMode parsingMode;
switch (aType) {
case nsIDocument::eAgentSheet:
parsingMode = css::eAgentSheetFeatures;
break;
case nsIDocument::eUserSheet:
parsingMode = css::eUserSheetFeatures;
break;
case nsIDocument::eAuthorSheet:
parsingMode = css::eAuthorSheetFeatures;
break;
default:
MOZ_CRASH("impossible value for aType");
}
nsRefPtr<CSSStyleSheet> sheet;
nsresult rv = loader->LoadSheetSync(aSheetURI, aType == eAgentSheet,
true, getter_AddRefs(sheet));
nsresult rv = loader->LoadSheetSync(aSheetURI, parsingMode, true,
getter_AddRefs(sheet));
NS_ENSURE_SUCCESS(rv, rv);
sheet->SetOwningDocument(this);
@ -7014,8 +7033,8 @@ nsIDocument::GetHtmlChildElement(nsIAtom* aTag)
return nullptr;
}
nsIContent*
nsDocument::GetTitleContent(uint32_t aNamespace)
Element*
nsDocument::GetTitleElement()
{
// mMayHaveTitleElement will have been set to true if any HTML or SVG
// <title> element has been bound to this document. So if it's false,
@ -7025,19 +7044,26 @@ nsDocument::GetTitleContent(uint32_t aNamespace)
if (!mMayHaveTitleElement)
return nullptr;
Element* root = GetRootElement();
if (root && root->IsSVGElement(nsGkAtoms::svg)) {
// In SVG, the document's title must be a child
for (nsIContent* child = root->GetFirstChild();
child; child = child->GetNextSibling()) {
if (child->IsSVGElement(nsGkAtoms::title)) {
return child->AsElement();
}
}
return nullptr;
}
// We check the HTML namespace even for non-HTML documents, except SVG. This
// matches the spec and the behavior of all tested browsers.
nsRefPtr<nsContentList> list =
NS_GetContentList(this, aNamespace, NS_LITERAL_STRING("title"));
NS_GetContentList(this, kNameSpaceID_XHTML, NS_LITERAL_STRING("title"));
return list->Item(0, false);
}
nsIContent* first = list->Item(0, false);
void
nsDocument::GetTitleFromElement(uint32_t aNamespace, nsAString& aTitle)
{
nsIContent* title = GetTitleContent(aNamespace);
if (!title)
return;
nsContentUtils::GetNodeTextContent(title, false, aTitle);
return first ? first->AsElement() : nullptr;
}
NS_IMETHODIMP
@ -7054,26 +7080,24 @@ nsDocument::GetTitle(nsString& aTitle)
{
aTitle.Truncate();
nsIContent *rootElement = GetRootElement();
if (!rootElement)
Element* rootElement = GetRootElement();
if (!rootElement) {
return;
}
nsAutoString tmp;
switch (rootElement->GetNameSpaceID()) {
#ifdef MOZ_XUL
case kNameSpaceID_XUL:
rootElement->GetAttr(kNameSpaceID_None, nsGkAtoms::title, tmp);
break;
if (rootElement->IsXULElement()) {
rootElement->GetAttr(kNameSpaceID_None, nsGkAtoms::title, tmp);
} else
#endif
case kNameSpaceID_SVG:
if (rootElement->IsSVGElement(nsGkAtoms::svg)) {
GetTitleFromElement(kNameSpaceID_SVG, tmp);
break;
} // else fall through
default:
GetTitleFromElement(kNameSpaceID_XHTML, tmp);
break;
{
Element* title = GetTitleElement();
if (!title) {
return;
}
nsContentUtils::GetNodeTextContent(title, false, tmp);
}
tmp.CompressWhitespace();
@ -7083,41 +7107,56 @@ nsDocument::GetTitle(nsString& aTitle)
NS_IMETHODIMP
nsDocument::SetTitle(const nsAString& aTitle)
{
Element *rootElement = GetRootElement();
if (!rootElement)
Element* rootElement = GetRootElement();
if (!rootElement) {
return NS_OK;
switch (rootElement->GetNameSpaceID()) {
case kNameSpaceID_SVG:
return NS_OK; // SVG doesn't support setting a title
#ifdef MOZ_XUL
case kNameSpaceID_XUL:
return rootElement->SetAttr(kNameSpaceID_None, nsGkAtoms::title,
aTitle, true);
#endif
}
#ifdef MOZ_XUL
if (rootElement->IsXULElement()) {
return rootElement->SetAttr(kNameSpaceID_None, nsGkAtoms::title,
aTitle, true);
}
#endif
// Batch updates so that mutation events don't change "the title
// element" under us
mozAutoDocUpdate updateBatch(this, UPDATE_CONTENT_MODEL, true);
nsIContent* title = GetTitleContent(kNameSpaceID_XHTML);
if (!title) {
Element *head = GetHeadElement();
if (!head)
return NS_OK;
nsCOMPtr<Element> title = GetTitleElement();
if (rootElement->IsSVGElement(nsGkAtoms::svg)) {
if (!title) {
nsRefPtr<mozilla::dom::NodeInfo> titleInfo =
mNodeInfoManager->GetNodeInfo(nsGkAtoms::title, nullptr,
kNameSpaceID_SVG,
nsIDOMNode::ELEMENT_NODE);
NS_NewSVGElement(getter_AddRefs(title), titleInfo.forget(),
NOT_FROM_PARSER);
if (!title) {
return NS_OK;
}
rootElement->InsertChildAt(title, 0, true);
}
} else if (rootElement->IsHTMLElement()) {
if (!title) {
Element* head = GetHeadElement();
if (!head) {
return NS_OK;
}
{
nsRefPtr<mozilla::dom::NodeInfo> titleInfo;
titleInfo = mNodeInfoManager->GetNodeInfo(nsGkAtoms::title, nullptr,
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
kNameSpaceID_XHTML,
nsIDOMNode::ELEMENT_NODE);
title = NS_NewHTMLTitleElement(titleInfo.forget());
if (!title)
if (!title) {
return NS_OK;
}
}
head->AppendChildTo(title, true);
head->AppendChildTo(title, true);
}
} else {
return NS_OK;
}
return nsContentUtils::SetNodeTextContent(title, aTitle, false);
@ -9885,7 +9924,10 @@ nsresult
nsDocument::LoadChromeSheetSync(nsIURI* uri, bool isAgentSheet,
CSSStyleSheet** sheet)
{
return CSSLoader()->LoadSheetSync(uri, isAgentSheet, isAgentSheet, sheet);
css::SheetParsingMode mode =
isAgentSheet ? css::eAgentSheetFeatures
: css::eAuthorSheetFeatures;
return CSSLoader()->LoadSheetSync(uri, mode, isAgentSheet, sheet);
}
class nsDelayedEventDispatcher : public nsRunnable

View File

@ -1474,13 +1474,15 @@ protected:
nsIContent* GetFirstBaseNodeWithHref();
nsresult SetFirstBaseNodeWithHref(nsIContent *node);
// Get the first <title> element with the given IsNodeOfType type, or
// return null if there isn't one
nsIContent* GetTitleContent(uint32_t aNodeType);
// Find the first "title" element in the given IsNodeOfType type and
// append the concatenation of its text node children to aTitle. Do
// nothing if there is no such element.
void GetTitleFromElement(uint32_t aNodeType, nsAString& aTitle);
/**
* Returns the title element of the document as defined by the HTML
* specification, or null if there isn't one. For documents whose root
* element is an <svg:svg>, this is the first <svg:title> element that's a
* child of the root. For other documents, it's the first HTML title element
* in the document.
*/
Element* GetTitleElement();
public:
// Get our title
virtual void GetTitle(nsString& aTitle) override;

View File

@ -911,11 +911,11 @@ public:
mozilla::dom::Element* GetEditingHost();
/**
* Determing language. Look at the nearest ancestor element that has a lang
* Determining language. Look at the nearest ancestor element that has a lang
* attribute in the XML namespace or is an HTML/SVG element and has a lang in
* no namespace attribute.
* no namespace attribute. Returns false if no language was specified.
*/
void GetLang(nsAString& aResult) const {
bool GetLang(nsAString& aResult) const {
for (const nsIContent* content = this; content; content = content->GetParent()) {
if (content->GetAttrCount() > 0) {
// xml:lang has precedence over lang on HTML elements (see
@ -930,10 +930,11 @@ public:
NS_ASSERTION(hasAttr || aResult.IsEmpty(),
"GetAttr that returns false should not make string non-empty");
if (hasAttr) {
return;
return true;
}
}
}
return false;
}
// Overloaded from nsINode

View File

@ -661,6 +661,8 @@ public:
return GetBFCacheEntry() ? nullptr : mPresShell;
}
// Instead using this method, what you probably want is
// RemoveFromBFCacheSync() as we do in MessagePort and BroadcastChannel.
void DisallowBFCaching()
{
NS_ASSERTION(!mBFCacheEntry, "We're already in the bfcache!");

View File

@ -1098,7 +1098,8 @@ nsTreeSanitizer::SanitizeStyleSheet(const nsAString& aOriginal,
// Create the CSS parser, and parse the CSS text.
nsCSSParser parser(nullptr, sheet);
rv = parser.ParseSheet(aOriginal, aDocument->GetDocumentURI(), aBaseURI,
aDocument->NodePrincipal(), 0, false);
aDocument->NodePrincipal(), 0,
mozilla::css::eAuthorSheetFeatures);
NS_ENSURE_SUCCESS(rv, true);
// Mark the sheet as complete.
MOZ_ASSERT(!sheet->IsModified(),

View File

@ -25,6 +25,10 @@
#test5 {
height: 100px;
}
textarea, input {
-moz-appearance: none;
}
</style>
<script>
function convertEmToPx(aEm) {

View File

@ -16,6 +16,7 @@
#include "WorkerPrivate.h"
#include "WorkerRunnable.h"
#include "nsIBFCacheEntry.h"
#include "nsIDocument.h"
#include "nsISupportsPrimitives.h"
@ -127,9 +128,6 @@ public:
nsIDocument* doc = window->GetExtantDoc();
if (doc) {
mPrivateBrowsing = nsContentUtils::IsInPrivateBrowsing(doc);
// No bfcache when BroadcastChannel is used.
doc->DisallowBFCaching();
}
return true;
@ -381,9 +379,6 @@ BroadcastChannel::Constructor(const GlobalObject& aGlobal,
nsIDocument* doc = window->GetExtantDoc();
if (doc) {
privateBrowsing = nsContentUtils::IsInPrivateBrowsing(doc);
// No bfcache when BroadcastChannel is used.
doc->DisallowBFCaching();
}
} else {
JSContext* cx = aGlobal.Context();
@ -466,6 +461,8 @@ BroadcastChannel::PostMessageInternal(JSContext* aCx,
void
BroadcastChannel::PostMessageData(BroadcastChannelMessage* aData)
{
RemoveDocFromBFCache();
if (mActor) {
nsRefPtr<BCPostMessageRunnable> runnable =
new BCPostMessageRunnable(mActor, aData);
@ -666,6 +663,31 @@ BroadcastChannel::Observe(nsISupports* aSubject, const char* aTopic,
return NS_OK;
}
void
BroadcastChannel::RemoveDocFromBFCache()
{
if (!NS_IsMainThread()) {
return;
}
nsPIDOMWindow* window = GetOwner();
if (!window) {
return;
}
nsIDocument* doc = window->GetExtantDoc();
if (!doc) {
return;
}
nsCOMPtr<nsIBFCacheEntry> bfCacheEntry = doc->GetBFCacheEntry();
if (!bfCacheEntry) {
return;
}
bfCacheEntry->RemoveFromBFCacheSync();
}
NS_IMPL_CYCLE_COLLECTION_CLASS(BroadcastChannel)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(BroadcastChannel,

View File

@ -36,6 +36,8 @@ class BroadcastChannel final
, public nsIIPCBackgroundChildCreateCallback
, public nsIObserver
{
friend class BroadcastChannelChild;
NS_DECL_NSIIPCBACKGROUNDCHILDCREATECALLBACK
NS_DECL_NSIOBSERVER
@ -82,11 +84,6 @@ public:
void Shutdown();
bool IsClosed() const
{
return mState != StateActive;
}
private:
BroadcastChannel(nsPIDOMWindow* aWindow,
const PrincipalInfo& aPrincipalInfo,
@ -108,6 +105,13 @@ private:
return mIsKeptAlive;
}
bool IsClosed() const
{
return mState != StateActive;
}
void RemoveDocFromBFCache();
nsRefPtr<BroadcastChannelChild> mActor;
nsTArray<nsRefPtr<BroadcastChannelMessage>> mPendingMessages;

View File

@ -69,6 +69,8 @@ BroadcastChannelChild::RecvNotify(const ClonedMessageData& aData)
return true;
}
mBC->RemoveDocFromBFCache();
AutoJSAPI jsapi;
nsCOMPtr<nsIGlobalObject> globalObject;

View File

@ -23,3 +23,4 @@ support-files =
skip-if = e10s || buildapp == 'b2g'
[test_broadcastchannel_mozbrowser2.html]
skip-if = e10s || buildapp == 'b2g'
[test_bfcache.html]

View File

@ -0,0 +1,96 @@
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Test for bfcache and BroadcastChannel</title>
<script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
<link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
</head>
<body>
<script type="application/javascript">
/* This test is hard to follow so here a quick description of what it is about.
* We want to test that when BroadcastChannel is used in a bfcached page,
* this page is fully removed by bfcache.
*
* To test it we have 2 pages (testUrl1 and testUrl2).
* The steps are:
* - we show testUrl1. When this is shown page1Shown is called.
* - page1Shown creates a BroadcastChannel object, then it loads testUrl2.
* - page2Shown is called by testUrl2.
* - Based on expectedPersisted we use or not the BroadcastChannel object of
* testUrl1.
* - Then we call history.back() and testUrl1 will be loaded again.
* - when page1Shown is called by testUrl1, if BroadcastChannel has been used
* when testUrl2 was shown, we want event.persisted be false, otherwise
* true.
*/
var testUrl1 = "data:text/html,<script>onpageshow = function(e) { opener.page1Shown(e); };<" + "/script>";
var testUrl2 = "data:text/html,<script>onpageshow = function(e) { opener.page2Shown(e); };<" + "/script>";
var testWin;
var counter = 0;
var expectedPersisted = false;
var bc;
function page1Shown(e) {
info("Page1Shown: " + testWin.location.href);
if (counter == 0) {
ok(!e.persisted, "test page should have been persisted initially");
bc = new testWin.BroadcastChannel('a');
SimpleTest.executeSoon(function() {
info("New location: " + testUrl2);
testWin.location.href = testUrl2;
});
} else {
is(e.persisted, expectedPersisted, "test page should have been persisted in pageshow");
testWin.close();
runTest();
}
counter++;
}
function page2Shown(e) {
info("Page2Shown: " + testWin.location.href);
if (!expectedPersisted) {
SimpleTest.executeSoon(function() {
info("Posting a message.");
bc.postMessage(42);
});
}
SimpleTest.executeSoon(function() {
info("Going back");
testWin.history.back();
});
}
var tests = [
{ expectedPersisted: true },
{ expectedPersisted: false },
];
function runTest() {
if (!tests.length) {
SimpleTest.finish();
return;
}
var test = tests.shift();
counter = 0;
expectedPersisted = test.expectedPersisted;
testWin = window.open(testUrl1);
}
SimpleTest.waitForExplicitFinish();
runTest();
</script>
</body>
</html>

View File

@ -6,7 +6,6 @@
#include "CreateDirectoryTask.h"
#include "DOMError.h"
#include "mozilla/dom/Directory.h"
#include "mozilla/dom/FileSystemBase.h"
#include "mozilla/dom/FileSystemUtils.h"
@ -121,9 +120,7 @@ CreateDirectoryTask::HandlerCallback()
}
if (HasError()) {
nsRefPtr<DOMError> domError = new DOMError(mFileSystem->GetWindow(),
mErrorValue);
mPromise->MaybeRejectBrokenly(domError);
mPromise->MaybeReject(mErrorValue);
mPromise = nullptr;
return;
}

View File

@ -8,7 +8,6 @@
#include <algorithm>
#include "DOMError.h"
#include "mozilla/Preferences.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileSystemBase.h"
@ -297,9 +296,7 @@ CreateFileTask::HandlerCallback()
}
if (HasError()) {
nsRefPtr<DOMError> domError = new DOMError(mFileSystem->GetWindow(),
mErrorValue);
mPromise->MaybeRejectBrokenly(domError);
mPromise->MaybeReject(mErrorValue);
mPromise = nullptr;
mBlobData = nullptr;
return;

View File

@ -8,7 +8,6 @@
#include "js/Value.h"
#include "mozilla/dom/Directory.h"
#include "mozilla/dom/DOMError.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileSystemBase.h"
#include "mozilla/dom/FileSystemUtils.h"
@ -199,9 +198,7 @@ GetFileOrDirectoryTask::HandlerCallback()
}
if (HasError()) {
nsRefPtr<DOMError> domError = new DOMError(mFileSystem->GetWindow(),
mErrorValue);
mPromise->MaybeRejectBrokenly(domError);
mPromise->MaybeReject(mErrorValue);
mPromise = nullptr;
return;
}

View File

@ -6,7 +6,6 @@
#include "RemoveTask.h"
#include "DOMError.h"
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileSystemBase.h"
#include "mozilla/dom/FileSystemUtils.h"
@ -187,9 +186,7 @@ RemoveTask::HandlerCallback()
}
if (HasError()) {
nsRefPtr<DOMError> domError = new DOMError(mFileSystem->GetWindow(),
mErrorValue);
mPromise->MaybeRejectBrokenly(domError);
mPromise->MaybeReject(mErrorValue);
mPromise = nullptr;
return;
}

View File

@ -92,7 +92,7 @@ public:
// Initializes the reader, returns NS_OK on success, or NS_ERROR_FAILURE
// on failure.
virtual nsresult Init(MediaDecoderReader* aCloneDonor) = 0;
virtual nsresult Init() { return NS_OK; }
// Release media resources they should be released in dormant state
// The reader can be made usable again by calling ReadMetadata().

View File

@ -204,7 +204,7 @@ MediaDecoderStateMachine::MediaDecoderStateMachine(MediaDecoder* aDecoder,
mProducerID(ImageContainer::AllocateProducerID()),
mRealTime(aRealTime),
mDispatchedStateMachine(false),
mDelayedScheduler(this),
mDelayedScheduler(mTaskQueue),
mState(DECODER_STATE_DECODING_NONE, "MediaDecoderStateMachine::mState"),
mCurrentFrameID(0),
mObservedDuration(TimeUnit(), "MediaDecoderStateMachine::mObservedDuration"),
@ -1033,13 +1033,7 @@ bool MediaDecoderStateMachine::IsPlaying() const
nsresult MediaDecoderStateMachine::Init(MediaDecoderStateMachine* aCloneDonor)
{
MOZ_ASSERT(NS_IsMainThread());
MediaDecoderReader* cloneReader = nullptr;
if (aCloneDonor) {
cloneReader = aCloneDonor->mReader;
}
nsresult rv = mReader->Init(cloneReader);
nsresult rv = mReader->Init();
NS_ENSURE_SUCCESS(rv, rv);
ScheduleStateMachineCrossThread();
return NS_OK;
@ -2861,7 +2855,13 @@ MediaDecoderStateMachine::ScheduleStateMachineIn(int64_t aMicroseconds)
TimeStamp target = now + TimeDuration::FromMicroseconds(aMicroseconds);
SAMPLE_LOG("Scheduling state machine for %lf ms from now", (target - now).ToMilliseconds());
mDelayedScheduler.Ensure(target);
nsRefPtr<MediaDecoderStateMachine> self = this;
mDelayedScheduler.Ensure(target, [self] () {
self->OnDelayedSchedule();
}, [self] () {
self->NotReached();
});
}
bool MediaDecoderStateMachine::OnTaskQueue() const

View File

@ -679,51 +679,8 @@ private:
// yet to run.
bool mDispatchedStateMachine;
// Class for managing delayed dispatches of the state machine.
class DelayedScheduler {
public:
explicit DelayedScheduler(MediaDecoderStateMachine* aSelf)
: mSelf(aSelf), mMediaTimer(new MediaTimer()) {}
bool IsScheduled() const { return !mTarget.IsNull(); }
void Reset()
{
MOZ_ASSERT(mSelf->OnTaskQueue(), "Must be on state machine queue to disconnect");
if (IsScheduled()) {
mRequest.Disconnect();
mTarget = TimeStamp();
}
}
void Ensure(mozilla::TimeStamp& aTarget)
{
MOZ_ASSERT(mSelf->OnTaskQueue());
if (IsScheduled() && mTarget <= aTarget) {
return;
}
Reset();
mTarget = aTarget;
mRequest.Begin(mMediaTimer->WaitUntil(mTarget, __func__)->Then(
mSelf->OwnerThread(), __func__, mSelf,
&MediaDecoderStateMachine::OnDelayedSchedule,
&MediaDecoderStateMachine::NotReached));
}
void CompleteRequest()
{
MOZ_ASSERT(mSelf->OnTaskQueue());
mRequest.Complete();
mTarget = TimeStamp();
}
private:
MediaDecoderStateMachine* mSelf;
nsRefPtr<MediaTimer> mMediaTimer;
MozPromiseRequestHolder<mozilla::MediaTimerPromise> mRequest;
TimeStamp mTarget;
} mDelayedScheduler;
// Used to dispatch another round schedule with specific target time.
DelayedScheduler mDelayedScheduler;
// StartTimeRendezvous is a helper class that quarantines the first sample
// until it gets a sample from both channels, such that we can be guaranteed

View File

@ -166,7 +166,7 @@ MediaFormatReader::InitLayersBackendType()
static bool sIsEMEEnabled = false;
nsresult
MediaFormatReader::Init(MediaDecoderReader* aCloneDonor)
MediaFormatReader::Init()
{
MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread.");
PDMFactory::Init();

View File

@ -29,7 +29,7 @@ public:
virtual ~MediaFormatReader();
nsresult Init(MediaDecoderReader* aCloneDonor) override;
nsresult Init() override;
size_t SizeOfVideoQueueInFrames() override;
size_t SizeOfAudioQueueInFrames() override;

View File

@ -113,6 +113,58 @@ private:
bool mUpdateScheduled;
};
// Class for managing delayed dispatches on target thread.
class DelayedScheduler {
public:
explicit DelayedScheduler(AbstractThread* aTargetThread)
: mTargetThread(aTargetThread), mMediaTimer(new MediaTimer())
{
MOZ_ASSERT(mTargetThread);
}
bool IsScheduled() const { return !mTarget.IsNull(); }
void Reset()
{
MOZ_ASSERT(mTargetThread->IsCurrentThreadIn(),
"Must be on target thread to disconnect");
if (IsScheduled()) {
mRequest.Disconnect();
mTarget = TimeStamp();
}
}
template <typename ResolveFunc, typename RejectFunc>
void Ensure(mozilla::TimeStamp& aTarget,
ResolveFunc&& aResolver,
RejectFunc&& aRejector)
{
MOZ_ASSERT(mTargetThread->IsCurrentThreadIn());
if (IsScheduled() && mTarget <= aTarget) {
return;
}
Reset();
mTarget = aTarget;
mRequest.Begin(mMediaTimer->WaitUntil(mTarget, __func__)->Then(
mTargetThread, __func__,
Forward<ResolveFunc>(aResolver),
Forward<RejectFunc>(aRejector)));
}
void CompleteRequest()
{
MOZ_ASSERT(mTargetThread->IsCurrentThreadIn());
mRequest.Complete();
mTarget = TimeStamp();
}
private:
nsRefPtr<AbstractThread> mTargetThread;
nsRefPtr<MediaTimer> mMediaTimer;
MozPromiseRequestHolder<mozilla::MediaTimerPromise> mRequest;
TimeStamp mTarget;
};
} // namespace mozilla
#endif

View File

@ -35,11 +35,6 @@ AndroidMediaReader::AndroidMediaReader(AbstractMediaDecoder *aDecoder,
{
}
nsresult AndroidMediaReader::Init(MediaDecoderReader* aCloneDonor)
{
return NS_OK;
}
nsresult AndroidMediaReader::ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags)
{

View File

@ -12,7 +12,7 @@
#include "ImageContainer.h"
#include "nsAutoPtr.h"
#include "mozilla/layers/SharedRGBImage.h"
#include "MPAPI.h"
class nsACString;
@ -42,7 +42,6 @@ public:
AndroidMediaReader(AbstractMediaDecoder* aDecoder,
const nsACString& aContentType);
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
virtual nsresult ResetDecode();
virtual bool DecodeAudioData();

View File

@ -103,7 +103,7 @@ AppleMP3Reader::Read(uint32_t *aNumBytes, char *aData)
}
nsresult
AppleMP3Reader::Init(MediaDecoderReader* aCloneDonor)
AppleMP3Reader::Init()
{
AudioFileTypeID fileType = kAudioFileMP3Type;

View File

@ -20,7 +20,7 @@ public:
explicit AppleMP3Reader(AbstractMediaDecoder *aDecoder);
virtual ~AppleMP3Reader() override;
virtual nsresult Init(MediaDecoderReader* aCloneDonor) override;
virtual nsresult Init() override;
nsresult PushDataToDemuxer();

View File

@ -56,13 +56,6 @@ DirectShowReader::~DirectShowReader()
#endif
}
nsresult
DirectShowReader::Init(MediaDecoderReader* aCloneDonor)
{
MOZ_ASSERT(NS_IsMainThread(), "Must be on main thread.");
return NS_OK;
}
// Try to parse the MP3 stream to make sure this is indeed an MP3, get the
// estimated duration of the stream, and find the offset of the actual MP3
// frames in the stream, as DirectShow doesn't like large ID3 sections.

View File

@ -43,8 +43,6 @@ public:
virtual ~DirectShowReader();
nsresult Init(MediaDecoderReader* aCloneDonor) override;
bool DecodeAudioData() override;
bool DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold) override;

View File

@ -49,13 +49,6 @@ extern PRLogModuleInfo* GetGMPLog();
namespace gmp {
static bool
FileExists(nsIFile* aFile)
{
bool exists = false;
return aFile && NS_SUCCEEDED(aFile->Exists(&exists)) && exists;
}
GMPChild::GMPChild()
: mAsyncShutdown(nullptr)
, mGMPMessageLoop(MessageLoop::current())

View File

@ -41,6 +41,7 @@
#include "nsExceptionHandler.h"
#include "nsPrintfCString.h"
#endif
#include "nsIXULRuntime.h"
#include <limits>
namespace mozilla {
@ -148,6 +149,96 @@ GeckoMediaPluginServiceParent::Init()
return GetThread(getter_AddRefs(thread));
}
already_AddRefed<nsIFile>
CloneAndAppend(nsIFile* aFile, const nsAString& aDir)
{
nsCOMPtr<nsIFile> f;
nsresult rv = aFile->Clone(getter_AddRefs(f));
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
rv = f->Append(aDir);
if (NS_WARN_IF(NS_FAILED(rv))) {
return nullptr;
}
return f.forget();
}
static void
MoveAndOverwrite(nsIFile* aOldStorageDir,
nsIFile* aNewStorageDir,
const nsAString& aSubDir)
{
nsresult rv;
nsCOMPtr<nsIFile> srcDir(CloneAndAppend(aOldStorageDir, aSubDir));
if (NS_WARN_IF(!srcDir)) {
return;
}
if (!FileExists(srcDir)) {
// No sub-directory to be migrated.
return;
}
nsCOMPtr<nsIFile> dstDir(CloneAndAppend(aNewStorageDir, aSubDir));
if (FileExists(dstDir)) {
// We must have migrated before already, and then ran an old version
// of Gecko again which created storage at the old location. Overwrite
// the previously migrated storage.
rv = dstDir->Remove(true);
if (NS_WARN_IF(NS_FAILED(rv))) {
// MoveTo will fail.
return;
}
}
rv = srcDir->MoveTo(aNewStorageDir, EmptyString());
if (NS_WARN_IF(NS_FAILED(rv))) {
return;
}
}
static void
MigratePreGecko42StorageDir(nsIFile* aOldStorageDir,
nsIFile* aNewStorageDir)
{
MoveAndOverwrite(aOldStorageDir, aNewStorageDir, NS_LITERAL_STRING("id"));
MoveAndOverwrite(aOldStorageDir, aNewStorageDir, NS_LITERAL_STRING("storage"));
}
static nsresult
GMPPlatformString(nsAString& aOutPlatform)
{
// Append the OS and arch so that we don't reuse the storage if the profile is
// copied or used under a different bit-ness, or copied to another platform.
nsCOMPtr<nsIXULRuntime> runtime = do_GetService("@mozilla.org/xre/runtime;1");
if (!runtime) {
return NS_ERROR_FAILURE;
}
nsAutoCString OS;
nsresult rv = runtime->GetOS(OS);
if (NS_FAILED(rv)) {
return rv;
}
nsAutoCString arch;
rv = runtime->GetXPCOMABI(arch);
if (NS_FAILED(rv)) {
return rv;
}
nsCString platform;
platform.Append(OS);
platform.AppendLiteral("_");
platform.Append(arch);
aOutPlatform = NS_ConvertUTF8toUTF16(platform);
return NS_OK;
}
nsresult
GeckoMediaPluginServiceParent::InitStorage()
@ -181,6 +272,33 @@ GeckoMediaPluginServiceParent::InitStorage()
return rv;
}
nsCOMPtr<nsIFile> gmpDirWithoutPlatform;
rv = mStorageBaseDir->Clone(getter_AddRefs(gmpDirWithoutPlatform));
if (NS_FAILED(rv)) {
return rv;
}
nsAutoString platform;
rv = GMPPlatformString(platform);
if (NS_FAILED(rv)) {
return rv;
}
rv = mStorageBaseDir->Append(platform);
if (NS_WARN_IF(NS_FAILED(rv))) {
return rv;
}
rv = mStorageBaseDir->Create(nsIFile::DIRECTORY_TYPE, 0700);
if (NS_WARN_IF(NS_FAILED(rv) && rv != NS_ERROR_FILE_ALREADY_EXISTS)) {
return rv;
}
// Prior to 42, GMP storage was stored in $profile/gmp/. After 42, it's
// stored in $profile/gmp/$platform/. So we must migrate any old records
// from the old location to the new location, for forwards compatibility.
MigratePreGecko42StorageDir(gmpDirWithoutPlatform, mStorageBaseDir);
return GeckoMediaPluginService::Init();
}

View File

@ -64,4 +64,11 @@ ToBase64(const nsTArray<uint8_t>& aBytes)
return base64;
}
bool
FileExists(nsIFile* aFile)
{
bool exists = false;
return aFile && NS_SUCCEEDED(aFile->Exists(&exists)) && exists;
}
} // namespace mozilla

View File

@ -43,6 +43,9 @@ enum GMPCrashReason {
kInvalid,
};
bool
FileExists(nsIFile* aFile);
} // namespace mozilla
#endif

View File

@ -115,7 +115,7 @@ GStreamerReader::~GStreamerReader()
NS_ASSERTION(!mPlayBin, "No Shutdown() after Init()");
}
nsresult GStreamerReader::Init(MediaDecoderReader* aCloneDonor)
nsresult GStreamerReader::Init()
{
GStreamerFormatHelper::Instance();

View File

@ -40,7 +40,7 @@ public:
explicit GStreamerReader(AbstractMediaDecoder* aDecoder);
virtual ~GStreamerReader();
virtual nsresult Init(MediaDecoderReader* aCloneDonor) override;
virtual nsresult Init() override;
virtual nsRefPtr<ShutdownPromise> Shutdown() override;
virtual nsresult ResetDecode() override;
virtual bool DecodeAudioData() override;

View File

@ -152,7 +152,7 @@ OggReader::~OggReader()
MOZ_COUNT_DTOR(OggReader);
}
nsresult OggReader::Init(MediaDecoderReader* aCloneDonor) {
nsresult OggReader::Init() {
int ret = ogg_sync_init(&mOggState);
NS_ENSURE_TRUE(ret == 0, NS_ERROR_FAILURE);
return NS_OK;

View File

@ -50,7 +50,7 @@ protected:
~OggReader();
public:
virtual nsresult Init(MediaDecoderReader* aCloneDonor) override;
virtual nsresult Init() override;
virtual nsresult ResetDecode() override;
virtual bool DecodeAudioData() override;

View File

@ -283,12 +283,6 @@ MediaCodecReader::~MediaCodecReader()
{
}
nsresult
MediaCodecReader::Init(MediaDecoderReader* aCloneDonor)
{
return NS_OK;
}
void
MediaCodecReader::ReleaseMediaResources()
{

View File

@ -60,10 +60,6 @@ public:
MediaCodecReader(AbstractMediaDecoder* aDecoder);
virtual ~MediaCodecReader();
// Initializes the reader, returns NS_OK on success, or NS_ERROR_FAILURE
// on failure.
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
// Release media resources they should be released in dormant state
virtual void ReleaseMediaResources();

View File

@ -135,11 +135,6 @@ MediaOmxReader::~MediaOmxReader()
{
}
nsresult MediaOmxReader::Init(MediaDecoderReader* aCloneDonor)
{
return NS_OK;
}
already_AddRefed<AbstractMediaDecoder>
MediaOmxReader::SafeGetDecoder() {
nsRefPtr<AbstractMediaDecoder> decoder;

View File

@ -70,8 +70,6 @@ public:
MediaOmxReader(AbstractMediaDecoder* aDecoder);
~MediaOmxReader();
virtual nsresult Init(MediaDecoderReader* aCloneDonor);
protected:
virtual void NotifyDataArrivedInternal(uint32_t aLength, int64_t aOffset) override;
public:

View File

@ -26,11 +26,6 @@ RawReader::~RawReader()
MOZ_COUNT_DTOR(RawReader);
}
nsresult RawReader::Init(MediaDecoderReader* aCloneDonor)
{
return NS_OK;
}
nsresult RawReader::ResetDecode()
{
mCurrentFrame = 0;

View File

@ -20,7 +20,6 @@ protected:
~RawReader();
public:
virtual nsresult Init(MediaDecoderReader* aCloneDonor) override;
virtual nsresult ResetDecode() override;
virtual bool DecodeAudioData() override;

View File

@ -29,6 +29,13 @@
publicExponent: new Uint8Array([1, 0, 1])
}, "NotSupportedError", "1023-bit is too small to succeed"),
badCertificate({
name: "RSASSA-PKCS1-v1_5",
hash: "SHA-384",
modulusLength: 2048,
publicExponent: new Uint8Array([1, 0, 1])
}, "NotSupportedError", "SHA-384 isn't supported yet"),
badCertificate({
name: "ECDH",
namedCurve: "P-256"

View File

@ -116,11 +116,6 @@ WaveReader::~WaveReader()
MOZ_COUNT_DTOR(WaveReader);
}
nsresult WaveReader::Init(MediaDecoderReader* aCloneDonor)
{
return NS_OK;
}
nsresult WaveReader::ReadMetadata(MediaInfo* aInfo,
MetadataTags** aTags)
{

View File

@ -22,7 +22,6 @@ protected:
~WaveReader();
public:
virtual nsresult Init(MediaDecoderReader* aCloneDonor) override;
virtual bool DecodeAudioData() override;
virtual bool DecodeVideoFrame(bool &aKeyframeSkip,
int64_t aTimeThreshold) override;

View File

@ -206,7 +206,7 @@ MediaDecodeTask::CreateReader()
return false;
}
nsresult rv = mDecoderReader->Init(nullptr);
nsresult rv = mDecoderReader->Init();
if (NS_FAILED(rv)) {
return false;
}

View File

@ -168,14 +168,9 @@ WebMReader::Shutdown()
return MediaDecoderReader::Shutdown();
}
nsresult WebMReader::Init(MediaDecoderReader* aCloneDonor)
nsresult WebMReader::Init()
{
if (aCloneDonor) {
mBufferedState = static_cast<WebMReader*>(aCloneDonor)->mBufferedState;
} else {
mBufferedState = new WebMBufferedState;
}
mBufferedState = new WebMBufferedState;
return NS_OK;
}

View File

@ -70,7 +70,7 @@ protected:
public:
virtual nsRefPtr<ShutdownPromise> Shutdown() override;
virtual nsresult Init(MediaDecoderReader* aCloneDonor) override;
virtual nsresult Init() override;
virtual nsresult ResetDecode() override;
virtual bool DecodeAudioData() override;

View File

@ -199,7 +199,13 @@ private:
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
mSignatureAlg = SEC_OID_PKCS1_SHA1_WITH_RSA_ENCRYPTION;
KeyAlgorithmProxy& alg = mKeyPair->mPublicKey.get()->Algorithm();
if (alg.mType != KeyAlgorithmProxy::RSA ||
!alg.mRsa.mHash.mName.EqualsLiteral(WEBCRYPTO_ALG_SHA256)) {
return NS_ERROR_DOM_NOT_SUPPORTED_ERR;
}
mSignatureAlg = SEC_OID_PKCS1_SHA256_WITH_RSA_ENCRYPTION;
mAuthType = ssl_kea_rsa;
} else if (mAlgName.EqualsLiteral(WEBCRYPTO_ALG_ECDSA)) {

View File

@ -71,8 +71,7 @@ PermissionSettings.prototype = {
.createCodebasePrincipal(uri, {appId: app.localId, inBrowser: aBrowserFlag});
return isExplicitInPermissionsTable(aPermName,
principal.appStatus,
app.kind);
principal.appStatus);
},
set: function set(aPermName, aPermValue, aManifestURL, aOrigin,

View File

@ -35,7 +35,7 @@ this.PermissionSettingsModule = {
},
_isChangeAllowed: function(aPrincipal, aPermName, aAction, aAppKind) {
_isChangeAllowed: function(aPrincipal, aPermName, aAction) {
// Bug 812289:
// Change is allowed from a child process when all of the following
// conditions stand true:
@ -50,7 +50,7 @@ this.PermissionSettingsModule = {
// on permissionManager also but we currently don't.
let perm =
Services.perms.testExactPermissionFromPrincipal(aPrincipal,aPermName);
let isExplicit = isExplicitInPermissionsTable(aPermName, aPrincipal.appStatus, aAppKind);
let isExplicit = isExplicitInPermissionsTable(aPermName, aPrincipal.appStatus);
return (aAction === "unknown" &&
aPrincipal.appStatus === Ci.nsIPrincipal.APP_STATUS_NOT_INSTALLED) ||
@ -106,7 +106,7 @@ this.PermissionSettingsModule = {
}
if (aAllowAllChanges ||
this._isChangeAllowed(principal, aData.type, aData.value, app.kind)) {
this._isChangeAllowed(principal, aData.type, aData.value)) {
debug("add: " + aData.origin + " " + app.localId + " " + action);
Services.perms.addFromPrincipal(principal, aData.type, action);
return true;

View File

@ -148,7 +148,9 @@ SVGDocument::EnsureNonSVGUserAgentStyleSheetsLoaded()
NS_NewURI(getter_AddRefs(uri), spec);
if (uri) {
nsRefPtr<CSSStyleSheet> cssSheet;
cssLoader->LoadSheetSync(uri, true, true, getter_AddRefs(cssSheet));
cssLoader->LoadSheetSync(uri,
mozilla::css::eAgentSheetFeatures,
true, getter_AddRefs(cssSheet));
if (cssSheet) {
EnsureOnDemandBuiltInUASheet(cssSheet);
}

View File

@ -26,7 +26,6 @@ skip-if= buildapp == 'mulet'
skip-if = (toolkit == 'android' || buildapp == 'b2g' || buildapp == 'mulet')
support-files =
test_new_window_from_content_child.html
test_new_window_from_content_child.js
[browser_webapps_permissions.js]
# TODO: Re-enable permissions tests on Mac, bug 795334
skip-if = buildapp != "b2g"

View File

@ -35,10 +35,7 @@
each preference.
*/
Cu.import("resource://gre/modules/Services.jsm");
Cu.import("resource://gre/modules/Promise.jsm");
Cu.import("resource://gre/modules/Task.jsm");
Cu.import("resource://gre/modules/XPCOMUtils.jsm");
const kXULNS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
const kContentDoc = "http://www.example.com/browser/dom/tests/browser/test_new_window_from_content_child.html";
@ -91,117 +88,8 @@ registerCleanupFunction(function() {
Services.prefs.setIntPref(kNewWindowPrefKey, originalNewWindowPref);
Services.prefs.setIntPref(kNewWindowRestrictionPrefKey,
originalNewWindowRestrictionPref);
// If there are any content tabs leftover, make sure they're not going to
// block exiting with onbeforeunload.
for (let tab of gBrowser.tabs) {
let browser = gBrowser.getBrowserForTab(tab);
if (browser.contentDocument.location == kContentDoc) {
closeTab(tab);
}
}
});
/**
* WindowOpenListener is a very simple nsIWindowMediatorListener that
* listens for a new window opening to aExpectedURI. It has two Promises
* attached to it - openPromise and closePromise. As you'd expect,
* openPromise resolves when the window is opened, and closePromise
* resolves if and when a window with the same URI closes. There is
* no attempt to make sure that it's the same window opening and
* closing - we just use the URI.
*
* @param aExpectedURI the URI to watch for in a new window.
* @return nsIWindowMediatorListener
*/
function WindowOpenListener(aExpectedURI) {
this._openDeferred = Promise.defer();
this._closeDeferred = Promise.defer();
this._expectedURI = aExpectedURI;
}
WindowOpenListener.prototype = {
get openPromise() {
return this._openDeferred.promise;
},
get closePromise() {
return this._closeDeferred.promise;
},
onOpenWindow: function(aXULWindow) {
let domWindow = aXULWindow.QueryInterface(Ci.nsIInterfaceRequestor)
.getInterface(Ci.nsIDOMWindow);
let location = domWindow.document.location;
if (location == this._expectedURI) {
let deferred = this._openDeferred;
domWindow.addEventListener("load", function onWindowLoad() {
domWindow.removeEventListener("load", onWindowLoad);
deferred.resolve(domWindow);
})
}
},
onCloseWindow: function(aXULWindow) {
this._closeDeferred.resolve();
},
onWindowTitleChange: function(aXULWindow, aNewTitle) {},
QueryInterface: XPCOMUtils.generateQI([Ci.nsIWindowMediatorListener])
};
/**
* Adds the testing tab, and injects our frame script which
* allows us to send click events to links and other things.
*
* @return a Promise that resolves once the tab is loaded and ready.
*/
function loadAndSelectTestTab() {
let tab = gBrowser.addTab(kContentDoc);
gBrowser.selectedTab = tab;
let browser = gBrowser.getBrowserForTab(tab);
browser.messageManager.loadFrameScript(kContentScript, false);
let deferred = Promise.defer();
browser.addEventListener("DOMContentLoaded", function onBrowserLoad(aEvent) {
browser.removeEventListener("DOMContentLoaded", onBrowserLoad);
deferred.resolve(tab);
});
return deferred.promise;
}
/**
* Clears the onbeforeunload event handler from the testing tab,
* and then closes the tab.
*
* @param aTab the testing tab to close.
* @param a Promise that resolves once the tab has been closed.
*/
function closeTab(aTab) {
let deferred = Promise.defer();
let browserMM = gBrowser.getBrowserForTab(aTab).messageManager;
browserMM.sendAsyncMessage("TEST:allow-unload");
browserMM.addMessageListener("TEST:allow-unload:done", function(aMessage) {
gBrowser.removeTab(aTab);
deferred.resolve();
})
return deferred.promise;
}
/**
* Sends a click event on some item into a tab.
*
* @param aTab the tab to send the click event to
* @param aItemId the item within the tab content to click.
*/
function clickInTab(aTab, aItemId) {
let browserMM = gBrowser.getBrowserForTab(aTab).messageManager;
browserMM.sendAsyncMessage("TEST:click-item", {
details: aItemId,
});
}
/**
* For some expectation when a link is clicked, creates and
* returns a Promise that resolves when that expectation is
@ -213,62 +101,38 @@ function clickInTab(aTab, aItemId) {
* occurred - for example, if a new window was opened, this function
* closes it before resolving.
*
* @param aTab the tab with the test document
* @param aBrowser the <xul:browser> with the test document
* @param aExpectation one of kSameTab, kNewWin, or kNewTab.
* @return a Promise that resolves when the expectation is fulfilled,
* and cleaned up after.
*/
function prepareForResult(aTab, aExpectation) {
let deferred = Promise.defer();
let browser = gBrowser.getBrowserForTab(aTab);
function prepareForResult(aBrowser, aExpectation) {
switch(aExpectation) {
case kSameTab:
// We expect about:blank to be loaded in the current tab. In order
// to prevent us needing to reload the document and content script
// after browsing away, we'll detect the attempt by using onbeforeunload,
// and then cancel the unload. It's a hack, but it's also a pretty
// cheap way of detecting when we're browsing away in the test tab.
// The onbeforeunload event handler is set in the content script automatically.
browser.addEventListener("DOMWillOpenModalDialog", function onModalDialog() {
browser.removeEventListener("DOMWillOpenModalDialog", onModalDialog, true);
executeSoon(() => {
let stack = browser.parentNode;
let dialogs = stack.getElementsByTagNameNS(kXULNS, "tabmodalprompt");
dialogs[0].ui.button1.click()
deferred.resolve();
})
}, true);
return Task.spawn(function*() {
yield BrowserTestUtils.browserLoaded(aBrowser);
is(aBrowser.currentURI.spec, "about:robots", "Should be at about:robots");
// Now put the browser back where it came from
yield BrowserTestUtils.loadURI(aBrowser, kContentDoc);
yield BrowserTestUtils.browserLoaded(aBrowser);
});
break;
case kNewWin:
let listener = new WindowOpenListener("about:blank");
Services.wm.addListener(listener);
info("Waiting for a new about:blank window");
listener.openPromise.then(function(aWindow) {
info("Got the new about:blank window - closing it.");
executeSoon(() => {
aWindow.close();
});
listener.closePromise.then(() => {
info("New about:blank window closed!");
Services.wm.removeListener(listener);
deferred.resolve();
});
return Task.spawn(function*() {
let newWin = yield BrowserTestUtils.waitForNewWindow();
let newBrowser = newWin.gBrowser.selectedBrowser;
yield BrowserTestUtils.browserLoaded(newBrowser);
is(newBrowser.currentURI.spec, "about:robots", "Should be at about:robots");
yield BrowserTestUtils.closeWindow(newWin);
});
break;
case kNewTab:
gBrowser.tabContainer.addEventListener("TabOpen", function onTabOpen(aEvent) {
let newTab = aEvent.target;
let newBrowser = gBrowser.getBrowserForTab(newTab);
if (newBrowser.contentDocument.location.href == "about:blank") {
gBrowser.tabContainer.removeEventListener("TabOpen", onTabOpen);
executeSoon(() => {
gBrowser.removeTab(newTab);
deferred.resolve();
})
}
})
return Task.spawn(function*() {
let newTab = yield BrowserTestUtils.waitForNewTab(gBrowser);
is(newTab.linkedBrowser.currentURI.spec, "about:robots",
"Should be at about:robots");
yield BrowserTestUtils.removeTab(newTab);
});
break;
default:
ok(false, "prepareForResult can't handle an expectation of " + aExpectation)
@ -283,14 +147,16 @@ function prepareForResult(aTab, aExpectation) {
* perform as specified in the supplied aMatrix (kWinOpenDefault,
* for example).
*
* @param aLinkId the id of the link within the testing page to test.
* @param aLinkSelector a selector for the link within the testing page to click.
* @param aMatrix a testing matrix for the
* browser.link.open_newwindow and browser.link.open_newwindow.restriction
* prefs to test against. See kWinOpenDefault for an example.
*/
function testLinkWithMatrix(aLinkId, aMatrix) {
return Task.spawn(function* () {
let tab = yield loadAndSelectTestTab();
function testLinkWithMatrix(aLinkSelector, aMatrix) {
return BrowserTestUtils.withNewTab({
gBrowser,
url: kContentDoc,
}, function*(browser) {
// This nested for-loop is unravelling the matrix const
// we set up, and gives us three things through each tick
// of the inner loop:
@ -298,7 +164,6 @@ function testLinkWithMatrix(aLinkId, aMatrix) {
// 2) newWindowRestPref: a browser.link.open_newwindow.restriction pref to try
// 3) expectation: what we expect the click outcome on this link to be,
// which will either be kSameTab, kNewWin or kNewTab.
for (let newWindowPref in aMatrix) {
let expectations = aMatrix[newWindowPref];
for (let i = 0; i < expectations.length; ++i) {
@ -307,28 +172,31 @@ function testLinkWithMatrix(aLinkId, aMatrix) {
Services.prefs.setIntPref("browser.link.open_newwindow", newWindowPref);
Services.prefs.setIntPref("browser.link.open_newwindow.restriction", newWindowRestPref);
info("Clicking on " + aLinkId);
info("Clicking on " + aLinkSelector);
info("Testing with browser.link.open_newwindow = " + newWindowPref + " and " +
"browser.link.open_newwindow.restriction = " + newWindowRestPref);
info("Expecting: " + expectation);
let resultPromise = prepareForResult(tab, expectation);
clickInTab(tab, aLinkId);
let resultPromise = prepareForResult(browser, expectation);
BrowserTestUtils.synthesizeMouseAtCenter(aLinkSelector, {}, browser);
yield resultPromise;
ok(true, "Got expectation: " + expectation);
info("Got expectation: " + expectation);
}
}
yield closeTab(tab);
});
}
add_task(function* test_window_open_with_defaults() {
yield testLinkWithMatrix("winOpenDefault", kWinOpenDefault);
yield testLinkWithMatrix("#winOpenDefault", kWinOpenDefault);
});
add_task(function* test_window_open_with_non_defaults() {
yield testLinkWithMatrix("winOpenNonDefault", kWinOpenNonDefault);
yield testLinkWithMatrix("#winOpenNonDefault", kWinOpenNonDefault);
});
add_task(function* test_window_open_dialog() {
yield testLinkWithMatrix("#winOpenDialog", kWinOpenNonDefault);
});
add_task(function* test_target__blank() {
yield testLinkWithMatrix("targetBlank", kTargetBlank);
yield testLinkWithMatrix("#targetBlank", kTargetBlank);
});

View File

@ -6,18 +6,14 @@
<body>
<p><a id="winOpenDefault" href="#" onclick="return openWindow();">Open a new window via window.open with default features.</a></p>
<p><a id="winOpenNonDefault" href="#" onclick="return openWindow('resizable=no, toolbar=no, scrollbars=no, menubar=no, status=no, directories=no, height=100, width=500');">Open a new window via window.open with non-default features.</a></p>
<p><a id="targetBlank" href="about:blank" target="_blank">Open a new window via target="_blank".</a></p>
<p><a id="winOpenDialog" href="#" onclick="return openWindow('dialog=yes');">Open a new window via window.open with dialog=1.</a></p>
<p><a id="targetBlank" href="about:robots" target="_blank">Open a new window via target="_blank".</a></p>
</body>
</html>
<script>
function openWindow(aFeatures="") {
window.open("about:blank", "_blank", aFeatures);
window.open("about:robots", "_blank", aFeatures);
return false;
}
window.onbeforeunload = function(aEvent) {
return "We should not browse away from this document.";
}
</script>

View File

@ -1,19 +0,0 @@
// A hacky mechanism for catching and detecting that we're attempting
// to browse away is by setting the onbeforeunload event handler. We
// detect this dialog opening in the parent test script, and dismiss
// it.
function handleClickItem(aMessage) {
let itemId = aMessage.data.details;
content.console.log("Getting item with ID: " + itemId);
let item = content.document.getElementById(itemId);
item.click();
}
function handleAllowUnload(aMessage) {
content.onbeforeunload = null;
sendSyncMessage("TEST:allow-unload:done");
}
addMessageListener("TEST:click-item", handleClickItem);
addMessageListener("TEST:allow-unload", handleAllowUnload);

View File

@ -916,23 +916,6 @@ XULDocument::AttributeWillChange(nsIDocument* aDocument,
}
}
static bool
ShouldPersistAttribute(nsIDocument* aDocument, Element* aElement)
{
if (aElement->IsXULElement(nsGkAtoms::window)) {
if (nsCOMPtr<nsPIDOMWindow> window = aDocument->GetWindow()) {
bool isFullscreen;
window->GetFullScreen(&isFullscreen);
if (isFullscreen) {
// Don't persist attributes if it is window element and
// we are in fullscreen state.
return false;
}
}
}
return true;
}
void
XULDocument::AttributeChanged(nsIDocument* aDocument,
Element* aElement, int32_t aNameSpaceID,
@ -1007,19 +990,18 @@ XULDocument::AttributeChanged(nsIDocument* aDocument,
bool listener, resolved;
CheckBroadcasterHookup(aElement, &listener, &resolved);
if (ShouldPersistAttribute(aDocument, aElement)) {
// See if there is anything we need to persist in the localstore.
//
// XXX Namespace handling broken :-(
nsString persist;
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::persist, persist);
if (!persist.IsEmpty() &&
// XXXldb This should check that it's a token, not just a substring.
persist.Find(nsDependentAtomString(aAttribute)) >= 0) {
// See if there is anything we need to persist in the localstore.
//
// XXX Namespace handling broken :-(
nsAutoString persist;
aElement->GetAttr(kNameSpaceID_None, nsGkAtoms::persist, persist);
if (!persist.IsEmpty()) {
// XXXldb This should check that it's a token, not just a substring.
if (persist.Find(nsDependentAtomString(aAttribute)) >= 0) {
nsContentUtils::AddScriptRunner(NS_NewRunnableMethodWithArgs
<nsIContent*, int32_t, nsIAtom*>
(this, &XULDocument::DoPersist, aElement,
kNameSpaceID_None, aAttribute));
<nsIContent*, int32_t, nsIAtom*>
(this, &XULDocument::DoPersist, aElement, kNameSpaceID_None,
aAttribute));
}
}
}

View File

@ -687,7 +687,7 @@ nsXULElement::PerformAccesskey(bool aKeyCausesActivation,
}
if (aKeyCausesActivation &&
!content->IsAnyOfXULElements(nsGkAtoms::textbox, nsGkAtoms::menulist)) {
elm->ClickWithInputSource(nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD);
elm->ClickWithInputSource(nsIDOMMouseEvent::MOZ_SOURCE_KEYBOARD, aIsTrustedEvent);
}
} else {
return content->PerformAccesskey(aKeyCausesActivation, aIsTrustedEvent);
@ -1726,17 +1726,17 @@ nsXULElement::Blur(ErrorResult& rv)
NS_IMETHODIMP
nsXULElement::Click()
{
return ClickWithInputSource(nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN);
return ClickWithInputSource(nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN, /* aIsTrusted = */ true);
}
void
nsXULElement::Click(ErrorResult& rv)
{
rv = Click();
rv = ClickWithInputSource(nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN, nsContentUtils::IsCallerChrome());
}
nsresult
nsXULElement::ClickWithInputSource(uint16_t aInputSource)
nsXULElement::ClickWithInputSource(uint16_t aInputSource, bool aIsTrustedEvent)
{
if (BoolAttrIsTrue(nsGkAtoms::disabled))
return NS_OK;
@ -1748,13 +1748,11 @@ nsXULElement::ClickWithInputSource(uint16_t aInputSource)
// strong ref to PresContext so events don't destroy it
nsRefPtr<nsPresContext> context = shell->GetPresContext();
bool isCallerChrome = nsContentUtils::IsCallerChrome();
WidgetMouseEvent eventDown(isCallerChrome, eMouseDown,
WidgetMouseEvent eventDown(aIsTrustedEvent, eMouseDown,
nullptr, WidgetMouseEvent::eReal);
WidgetMouseEvent eventUp(isCallerChrome, eMouseUp,
WidgetMouseEvent eventUp(aIsTrustedEvent, eMouseUp,
nullptr, WidgetMouseEvent::eReal);
WidgetMouseEvent eventClick(isCallerChrome, eMouseClick, nullptr,
WidgetMouseEvent eventClick(aIsTrustedEvent, eMouseClick, nullptr,
WidgetMouseEvent::eReal);
eventDown.inputSource = eventUp.inputSource = eventClick.inputSource
= aInputSource;

View File

@ -401,7 +401,7 @@ public:
virtual bool PerformAccesskey(bool aKeyCausesActivation,
bool aIsTrustedEvent) override;
nsresult ClickWithInputSource(uint16_t aInputSource);
nsresult ClickWithInputSource(uint16_t aInputSource, bool aIsTrustedEvent);
virtual nsIContent *GetBindingParent() const override;
virtual bool IsNodeOfType(uint32_t aFlags) const override;

View File

@ -2843,7 +2843,8 @@ nsHTMLEditor::AddOverrideStyleSheet(const nsAString& aURL)
nsRefPtr<CSSStyleSheet> sheet;
// Editor override style sheets may want to style Gecko anonymous boxes
rv = ps->GetDocument()->CSSLoader()->
LoadSheetSync(uaURI, true, true, getter_AddRefs(sheet));
LoadSheetSync(uaURI, mozilla::css::eAgentSheetFeatures, true,
getter_AddRefs(sheet));
// Synchronous loads should ALWAYS return completed
NS_ENSURE_TRUE(sheet, NS_ERROR_NULL_POINTER);

View File

@ -1651,9 +1651,9 @@ nsWindowWatcher::CalculateChromeFlags(nsIDOMWindow* aParent,
if (aParent) {
aParent->GetFullScreen(&isFullScreen);
}
if (isFullScreen && openedFromContentScript) {
// If the parent window is in fullscreen & the caller context is content,
// dialog feature is disabled. (see bug 803675)
if (openedFromContentScript) {
// If the caller context is content, we do not support the
// dialog feature. See bug 1095236.
disableDialogFeature = true;
}

View File

@ -891,7 +891,6 @@ nsPermissionManager::InitDB(bool aRemoveFile)
return NS_ERROR_UNEXPECTED;
}
LogToConsole(NS_LITERAL_STRING("Get a connection to permissions.sqlite."));
bool tableExists = false;
mDBConn->TableExists(NS_LITERAL_CSTRING("moz_perms"), &tableExists);
@ -901,7 +900,6 @@ nsPermissionManager::InitDB(bool aRemoveFile)
if (!tableExists) {
rv = CreateTable();
NS_ENSURE_SUCCESS(rv, rv);
LogToConsole(NS_LITERAL_STRING("DB table(moz_perms) is created!"));
} else {
// table already exists; check the schema version before reading
int32_t dbSchemaVersion;

View File

@ -1010,6 +1010,15 @@ class Value
Value(const Value& v) = default;
#endif
/**
* Returns false if creating a NumberValue containing the given type would
* be lossy, true otherwise.
*/
template <typename T>
static bool isNumberRepresentable(const T t) {
return T(double(t)) == t;
}
/*** Mutators ***/
void setNull() {
@ -1611,7 +1620,7 @@ template <typename T>
static inline Value
NumberValue(const T t)
{
MOZ_ASSERT(T(double(t)) == t, "value creation would be lossy");
MOZ_ASSERT(Value::isNumberRepresentable(t), "value creation would be lossy");
return detail::MakeNumberValue<std::numeric_limits<T>::is_signed>::create(t);
}

View File

@ -53,6 +53,25 @@ static bool fuzzingSafe = false;
// OOM conditions.
static bool disableOOMFunctions = false;
static bool
EnvVarIsDefined(const char* name)
{
const char* value = getenv(name);
return value && *value;
}
#if defined(DEBUG) || defined(JS_OOM_BREAKPOINT)
static bool
EnvVarAsInt(const char* name, int* valueOut)
{
if (!EnvVarIsDefined(name))
return false;
*valueOut = atoi(getenv(name));
return true;
}
#endif
static bool
GetBuildConfiguration(JSContext* cx, unsigned argc, Value* vp)
{
@ -1072,6 +1091,93 @@ ResetOOMFailure(JSContext* cx, unsigned argc, Value* vp)
OOM_maxAllocations = UINT32_MAX;
return true;
}
static bool
OOMTest(JSContext* cx, unsigned argc, Value* vp)
{
CallArgs args = CallArgsFromVp(argc, vp);
if (args.length() != 1 || !args[0].isObject() || !args[0].toObject().is<JSFunction>()) {
JS_ReportError(cx, "oomTest() takes a single function argument.");
return false;
}
if (disableOOMFunctions) {
args.rval().setUndefined();
return true;
}
RootedFunction function(cx, &args[0].toObject().as<JSFunction>());
bool verbose = EnvVarIsDefined("OOM_VERBOSE");
unsigned threadStart = oom::THREAD_TYPE_MAIN;
unsigned threadEnd = oom::THREAD_TYPE_MAX;
// Test a single thread type if specified by the OOM_THREAD environment variable.
int threadOption = 0;
if (EnvVarAsInt("OOM_THREAD", &threadOption)) {
if (threadOption < oom::THREAD_TYPE_MAIN || threadOption > oom::THREAD_TYPE_MAX) {
JS_ReportError(cx, "OOM_THREAD value out of range.");
return false;
}
threadStart = threadOption;
threadEnd = threadOption + 1;
}
JS_SetGCZeal(cx, 0, JS_DEFAULT_ZEAL_FREQ);
for (unsigned thread = threadStart; thread < threadEnd; thread++) {
if (verbose)
fprintf(stderr, "thread %d\n", thread);
HelperThreadState().waitForAllThreads();
js::oom::targetThread = thread;
unsigned allocation = 1;
bool handledOOM;
do {
if (verbose)
fprintf(stderr, " allocation %d\n", allocation);
MOZ_ASSERT(!cx->isExceptionPending());
MOZ_ASSERT(!cx->runtime()->hadOutOfMemory);
OOM_maxAllocations = OOM_counter + allocation;
OOM_failAlways = false;
RootedValue result(cx);
bool ok = JS_CallFunction(cx, cx->global(), function,
HandleValueArray::empty(), &result);
handledOOM = OOM_counter >= OOM_maxAllocations;
OOM_maxAllocations = UINT32_MAX;
MOZ_ASSERT_IF(ok, !cx->isExceptionPending());
MOZ_ASSERT_IF(!ok, cx->isExceptionPending());
// Note that it is possible that the function throws an exception
// unconnected to OOM, in which case we ignore it. More correct
// would be to have the caller pass some kind of exception
// specification and to check the exception against it.
cx->clearPendingException();
cx->runtime()->hadOutOfMemory = false;
allocation++;
} while (handledOOM);
if (verbose) {
fprintf(stderr, " finished after %d allocations\n", allocation - 2);
}
}
js::oom::targetThread = js::oom::THREAD_TYPE_NONE;
args.rval().setUndefined();
return true;
}
#endif
static const js::Class FakePromiseClass = {
@ -3062,6 +3168,12 @@ static const JSFunctionSpecWithHelp TestingFunctions[] = {
"resetOOMFailure()",
" Remove the allocation failure scheduled by either oomAfterAllocations() or\n"
" oomAtAllocation() and return whether any allocation had been caused to fail."),
JS_FN_HELP("oomTest", OOMTest, 0, 0,
"oomTest(function)",
" Test that the passed function behaves correctly under OOM conditions by\n"
" repeatedly executing it and simulating allocation failure at successive\n"
" allocations until the function completes without seeing a failure."),
#endif
JS_FN_HELP("makeFakePromise", MakeFakePromise, 0, 0,
@ -3464,7 +3576,7 @@ js::DefineTestingFunctions(JSContext* cx, HandleObject obj, bool fuzzingSafe_,
bool disableOOMFunctions_)
{
fuzzingSafe = fuzzingSafe_;
if (getenv("MOZ_FUZZING_SAFE") && getenv("MOZ_FUZZING_SAFE")[0] != '0')
if (EnvVarIsDefined("MOZ_FUZZING_SAFE"))
fuzzingSafe = true;
disableOOMFunctions = disableOOMFunctions_;

View File

@ -213,9 +213,8 @@ elif [[ "$VARIANT" = "arm-sim" ||
export JSTESTS_EXTRA_ARGS=--jitflags=debug
elif [[ "$VARIANT" = arm64* ]]; then
# The ARM64 JIT is not yet fully functional, and asm.js does not work.
# Just run "make check". We mostly care about not breaking the build at this point.
# Just run "make check" and jsapi-tests.
RUN_JITTEST=false
RUN_JSAPITESTS=false
RUN_JSTESTS=false
fi

View File

@ -40,6 +40,17 @@ to store metadata about particular pieces of source code.
A `Debugger.Source` instance inherits the following accessor properties
from its prototype:
`canonicalId`
: A stable, unique identifier for the source referent. This identifier is
suitable for checking if two `Debugger.Source` instances originating from
different `Debugger` instances refer to the same source that was compiled by
SpiderMonkey. The `canonicalId` is reliable even when the source does not
have a URL, or shares the same URL as another source but has different
source text. It is more efficient to compare `canonicalId`s than to compare
source text character-by-character. The `canonicalId` is not suitable for
ordering comparisons such as "greater than" or "less than". It is not
suitable for checking the equality of sources across worker threads.
`text`
: The JavaScript source code, as a string. The value satisfies the
`Program`, `FunctionDeclaration`, or `FunctionExpression` productions in

View File

@ -1,39 +0,0 @@
// Function to test OOM handling by repeatedly calling a function and failing
// successive allocations.
if (!("oomAtAllocation" in this && "resetOOMFailure" in this && "oomThreadTypes" in this))
quit();
if ("gczeal" in this)
gczeal(0);
const verbose = ("os" in this) && os.getenv("OOM_VERBOSE");
// Test out of memory handing by calling a function f() while causing successive
// memory allocations to fail. Repeat until f() finishes without reaching the
// failing allocation.
function oomTest(f) {
for (let thread = 1; thread < oomThreadTypes(); thread++) {
if (verbose)
print("testing thread " + thread);
var i = 1;
var more;
do {
if (verbose)
print("fail at " + i);
try {
oomAtAllocation(i, thread);
f();
more = resetOOMFailure();
} catch (e) {
// Ignore exceptions.
more = resetOOMFailure();
}
i++;
} while(more);
if (verbose)
print("finished after " + (i - 2) + " failures");
}
}

View File

@ -1,4 +0,0 @@
// Binary: cache/js-dbg-64-462106f027af-linux
// Flags:
//
decompileBody(function () { });

View File

@ -2,12 +2,10 @@ var f = Function("a", "b", "return a + b;");
assertEq(f.toString(), "function anonymous(a, b) {\nreturn a + b;\n}");
assertEq(f.toSource(), "(function anonymous(a, b) {\nreturn a + b;\n})");
assertEq(decompileFunction(f), f.toString());
assertEq(decompileBody(f), "return a + b;");
f = Function("a", "...rest", "return rest[42] + b;");
assertEq(f.toString(), "function anonymous(a, ...rest) {\nreturn rest[42] + b;\n}");
assertEq(f.toSource(), "(function anonymous(a, ...rest) {\nreturn rest[42] + b;\n})")
assertEq(decompileFunction(f), f.toString());
assertEq(decompileBody(f), "return rest[42] + b;");
f = Function("");
assertEq(f.toString(), "function anonymous() {\n\n}");
f = Function("", "(abc)");

View File

@ -2,7 +2,6 @@ function f1(foo, bar) foo + bar;
assertEq(f1.toString(), "function f1(foo, bar) foo + bar");
assertEq(f1.toString(), f1.toSource());
assertEq(decompileFunction(f1), f1.toString());
assertEq(decompileBody(f1), "foo + bar;");
// No semicolon on purpose
function f2(foo, bar) foo + bar
assertEq(f2.toString(), "function f2(foo, bar) foo + bar");

View File

@ -4,4 +4,4 @@ function getgen() {
var gen;
(getgen() for (x of [1])).next();
assertEq(gen.toSource(), "function genexp() {\n [generator expression]\n}");
assertEq(decompileBody(gen), "\n [generator expression]\n");
assertEq(gen.toString(), gen.toSource());

View File

@ -2,14 +2,11 @@ var f1 = function f0(a, b) { return a + b; }
assertEq(f1.toSource(), "(function f0(a, b) { return a + b; })");
assertEq(f1.toString(), "function f0(a, b) { return a + b; }");
assertEq(decompileFunction(f1), f1.toString());
assertEq(decompileBody(f1), " return a + b; ");
var f2 = function (a, b) { return a + b; };
assertEq(f2.toSource(), "(function (a, b) { return a + b; })");
assertEq(f2.toString(), "function (a, b) { return a + b; }");
assertEq(decompileFunction(f2), f2.toString());
assertEq(decompileBody(f2), " return a + b; ");
var f3 = (function (a, b) { return a + b; });
assertEq(f3.toSource(), "(function (a, b) { return a + b; })");
assertEq(f3.toString(), "function (a, b) { return a + b; }");
assertEq(decompileFunction(f3), f3.toString());
assertEq(decompileBody(f3), " return a + b; ");

Some files were not shown because too many files have changed in this diff Show More