зеркало из https://github.com/mozilla/gecko-dev.git
merge mozilla-inbound to mozilla-central
This commit is contained in:
Коммит
21a32c579f
42
Makefile.in
42
Makefile.in
|
@ -44,23 +44,23 @@ endif
|
|||
endif
|
||||
|
||||
CLOBBER: $(topsrcdir)/CLOBBER
|
||||
@echo "STOP! The CLOBBER file has changed."
|
||||
@echo "Please run the build through a sanctioned build wrapper, such as"
|
||||
@echo "'mach build' or client.mk."
|
||||
@echo 'STOP! The CLOBBER file has changed.'
|
||||
@echo 'Please run the build through a sanctioned build wrapper, such as'
|
||||
@echo '"mach build" or client.mk.'
|
||||
@exit 1
|
||||
|
||||
$(topsrcdir)/configure: $(topsrcdir)/configure.in
|
||||
@echo "STOP! configure.in has changed, and your configure is out of date."
|
||||
@echo "Please rerun autoconf and re-configure your build directory."
|
||||
@echo "To ignore this message, touch 'configure' in the source directory,"
|
||||
@echo "but your build might not succeed."
|
||||
@echo 'STOP! configure.in has changed, and your configure is out of date.'
|
||||
@echo 'Please rerun autoconf and re-configure your build directory.'
|
||||
@echo 'To ignore this message, touch "configure" in the source directory,'
|
||||
@echo 'but your build might not succeed.'
|
||||
@exit 1
|
||||
|
||||
config.status: $(topsrcdir)/configure
|
||||
@echo "STOP! configure has changed and needs to be run in this build directory."
|
||||
@echo "Please rerun configure."
|
||||
@echo "To ignore this message, touch 'config.status' in the build directory,"
|
||||
@echo "but your build might not succeed."
|
||||
@echo 'STOP! configure has changed and needs to be run in this build directory.'
|
||||
@echo 'Please rerun configure.'
|
||||
@echo 'To ignore this message, touch "config.status" in the build directory,'
|
||||
@echo 'but your build might not succeed.'
|
||||
@exit 1
|
||||
|
||||
# Regenerate the build backend if it is out of date. We only have this rule in
|
||||
|
@ -71,7 +71,7 @@ config.status: $(topsrcdir)/configure
|
|||
# builds. This cleanly avoids most of the pain.
|
||||
|
||||
backend.RecursiveMakeBackend:
|
||||
@echo "Build configuration changed. Regenerating backend."
|
||||
@echo 'Build configuration changed. Regenerating backend.'
|
||||
$(PYTHON) config.status
|
||||
|
||||
Makefile: backend.RecursiveMakeBackend
|
||||
|
@ -165,7 +165,7 @@ endif
|
|||
ifeq ($(OS_ARCH),Darwin)
|
||||
# need to pass arch flags for universal builds
|
||||
ifdef UNIVERSAL_BINARY
|
||||
MAKE_SYM_STORE_ARGS := -c -a "i386 x86_64" --vcs-info
|
||||
MAKE_SYM_STORE_ARGS := -c -a 'i386 x86_64' --vcs-info
|
||||
MAKE_SYM_STORE_PATH := $(DIST)/universal
|
||||
else
|
||||
MAKE_SYM_STORE_ARGS := -c -a $(OS_TEST) --vcs-info
|
||||
|
@ -194,9 +194,9 @@ buildsymbols:
|
|||
ifdef MOZ_CRASHREPORTER
|
||||
echo building symbol store
|
||||
$(RM) -r $(DIST)/crashreporter-symbols
|
||||
$(RM) "$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip"
|
||||
$(RM) '$(DIST)/$(SYMBOL_ARCHIVE_BASENAME).zip'
|
||||
$(NSINSTALL) -D $(DIST)/crashreporter-symbols
|
||||
OBJCOPY="$(OBJCOPY)" \
|
||||
OBJCOPY='$(OBJCOPY)' \
|
||||
$(PYTHON) $(topsrcdir)/toolkit/crashreporter/tools/symbolstore.py \
|
||||
$(MAKE_SYM_STORE_ARGS) \
|
||||
$(foreach dir,$(SYM_STORE_SOURCE_DIRS),-s $(dir)) \
|
||||
|
@ -207,17 +207,17 @@ ifdef MOZ_CRASHREPORTER
|
|||
echo packing symbols
|
||||
$(NSINSTALL) -D $(DIST)/$(PKG_PATH)
|
||||
cd $(DIST)/crashreporter-symbols && \
|
||||
zip -r9D "../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip" . -x "*test*" -x "*Test*"
|
||||
zip -r9D '../$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip' . -x '*test*' -x '*Test*'
|
||||
cd $(DIST)/crashreporter-symbols && \
|
||||
grep "sym" $(SYMBOL_INDEX_NAME) > $(SYMBOL_INDEX_NAME).tmp && \
|
||||
grep 'sym' $(SYMBOL_INDEX_NAME) > $(SYMBOL_INDEX_NAME).tmp && \
|
||||
mv $(SYMBOL_INDEX_NAME).tmp $(SYMBOL_INDEX_NAME)
|
||||
cd $(DIST)/crashreporter-symbols && \
|
||||
zip -r9D "../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip" . -i "*.sym" -i "*.txt" -x "*test*" -x "*Test*"
|
||||
zip -r9D '../$(PKG_PATH)$(SYMBOL_ARCHIVE_BASENAME).zip' . -i '*.sym' -i '*.txt' -x '*test*' -x '*Test*'
|
||||
endif # MOZ_CRASHREPORTER
|
||||
|
||||
uploadsymbols:
|
||||
ifdef MOZ_CRASHREPORTER
|
||||
$(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) "$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip"
|
||||
$(SHELL) $(topsrcdir)/toolkit/crashreporter/tools/upload_symbols.sh $(SYMBOL_INDEX_NAME) '$(DIST)/$(PKG_PATH)$(SYMBOL_FULL_ARCHIVE_BASENAME).zip'
|
||||
endif
|
||||
|
||||
# MOZ_SOURCE_STAMP is defined in package-name.mk with a deferred assignment.
|
||||
|
@ -238,7 +238,7 @@ endif
|
|||
else
|
||||
maybe_clobber_profiledbuild:
|
||||
$(RM) $(DIST)/bin/*.pgc
|
||||
find $(DIST)/$(MOZ_APP_NAME) -name "*.pgc" -exec mv {} $(DIST)/bin \;
|
||||
find $(DIST)/$(MOZ_APP_NAME) -name '*.pgc' -exec mv {} $(DIST)/bin \;
|
||||
endif
|
||||
|
||||
.PHONY: maybe_clobber_profiledbuild
|
||||
|
@ -247,7 +247,7 @@ endif
|
|||
# break x86_64 builds and SELinux users.
|
||||
ifeq ($(OS_TARGET)_$(TARGET_XPCOM_ABI),Linux_x86-gcc3)
|
||||
scheck::
|
||||
@relcount=`find $(DIST)/bin -name "*.so" | xargs objdump -R | grep R_386_PC32 | wc -l` && if test $$relcount -gt 0; then echo "FAILED: R_386_PC32 relocations detected in a shared library. Did you use a system header without adding it to config/system-headers?"; exit 1; else echo "PASSED"; fi
|
||||
@relcount=`find $(DIST)/bin -name '*.so' | xargs objdump -R | grep R_386_PC32 | wc -l` && if test $$relcount -gt 0; then echo 'FAILED: R_386_PC32 relocations detected in a shared library. Did you use a system header without adding it to config/system-headers?'; exit 1; else echo 'PASSED'; fi
|
||||
endif
|
||||
|
||||
ifdef BUILD_JS
|
||||
|
|
|
@ -65,7 +65,7 @@ UA_UPDATE_FILE = ua-update.json
|
|||
|
||||
$(UA_UPDATE_FILE): % : %.in
|
||||
# strip out comment lines, which are not valid in JSON
|
||||
sed -e "/^ *\\/\\//d" -e "/^ *$$/d" $^ > $@
|
||||
sed -e '/^ *\/\//d' -e '/^ *$$/d' $^ > $@
|
||||
|
||||
UA_UPDATE_FILES = $(UA_UPDATE_FILE)
|
||||
UA_UPDATE_DEST = $(FINAL_TARGET)
|
||||
|
@ -80,7 +80,7 @@ APP_ICON = b2g
|
|||
|
||||
source_repo ?= $(call getSourceRepo,$(srcdir)/..)
|
||||
ifneq (,$(filter http%,$(source_repo)))
|
||||
DEFINES += -DMOZ_SOURCE_REPO="$(source_repo)"
|
||||
DEFINES += -DMOZ_SOURCE_REPO='$(source_repo)'
|
||||
endif
|
||||
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
|
@ -118,10 +118,10 @@ libs-preqs = \
|
|||
|
||||
.PHONY: repackage
|
||||
tools repackage:: $(libs-preqs)
|
||||
rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app --exclude English.lproj
|
||||
rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
|
||||
sed -e "s/%MOZ_APP_VERSION%/$(MOZ_APP_VERSION)/" -e "s/%MOZ_APP_NAME%/$(MOZ_APP_NAME)/" -e "s/%APP_VERSION%/$(APP_VERSION)/" -e "s/%APP_NAME%/$(APP_NAME)/" -e "s/%APP_BINARY%/$(APP_BINARY)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
|
||||
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/Contents/Resources/$(AB).lproj/InfoPlist.strings
|
||||
rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents $(DIST)/$(APP_NAME).app --exclude English.lproj
|
||||
rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(DIST)/$(APP_NAME).app/Contents/Resources/$(AB).lproj
|
||||
sed -e 's/%MOZ_APP_VERSION%/$(MOZ_APP_VERSION)/' -e 's/%MOZ_APP_NAME%/$(MOZ_APP_NAME)/' -e 's/%APP_VERSION%/$(APP_VERSION)/' -e 's/%APP_NAME%/$(APP_NAME)/' -e 's/%APP_BINARY%/$(APP_BINARY)/' $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/$(APP_NAME).app/Contents/Info.plist
|
||||
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/Contents/Resources/$(AB).lproj/InfoPlist.strings
|
||||
rsync -a $(DIST)/bin/ $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)
|
||||
$(RM) $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/mangle $(DIST)/$(APP_NAME).app/Contents/$(APPFILES)/shlibsign
|
||||
ifdef LIBXUL_SDK
|
||||
|
@ -132,7 +132,7 @@ else
|
|||
rsync -aL $(PROGRAM) $(DIST)/$(APP_NAME).app/Contents/MacOS
|
||||
endif
|
||||
cp -RL $(srcdir)/b2g.icns $(DIST)/$(APP_NAME).app/Contents/Resources/$(MOZ_APP_NAME).icns
|
||||
printf "APPLMOZB" > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
|
||||
printf APPLMOZB > $(DIST)/$(APP_NAME).app/Contents/PkgInfo
|
||||
|
||||
else # MOZ_WIDGET_TOOLKIT != cocoa
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@ package:
|
|||
@$(MAKE) -C b2g/installer
|
||||
|
||||
install::
|
||||
@echo "B2G can't be installed directly."
|
||||
@echo 'B2G can't be installed directly.'
|
||||
@exit 1
|
||||
|
||||
upload::
|
||||
|
|
|
@ -62,11 +62,11 @@ ifdef MOZ_PKG_MANIFEST_P
|
|||
$(MOZ_PKG_MANIFEST): $(MOZ_PKG_MANIFEST_P) FORCE
|
||||
$(call py_action,preprocessor,$(DEFINES) $(ACDEFINES) $< -o $@)
|
||||
ifdef MOZ_CHROME_MULTILOCALE
|
||||
printf "\n[multilocale]\n" >> $@
|
||||
printf '\n[multilocale]\n' >> $@
|
||||
for LOCALE in $(MOZ_CHROME_MULTILOCALE) ;\
|
||||
do \
|
||||
printf "$(BINPATH)/chrome/$$LOCALE$(JAREXT)\n" >> $@; \
|
||||
printf "$(BINPATH)/chrome/$$LOCALE.manifest\n" >> $@; \
|
||||
printf '$(BINPATH)/chrome/$$LOCALE$(JAREXT)\n' >> $@; \
|
||||
printf '$(BINPATH)/chrome/$$LOCALE.manifest\n' >> $@; \
|
||||
done
|
||||
endif
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
|||
MOZ_PKG_MAC_DSSTORE=$(_ABS_DIST)/branding/dsstore
|
||||
MOZ_PKG_MAC_BACKGROUND=$(_ABS_DIST)/branding/background.png
|
||||
MOZ_PKG_MAC_ICON=$(_ABS_DIST)/branding/disk.icns
|
||||
MOZ_PKG_MAC_EXTRA=--symlink "/Applications:/ "
|
||||
MOZ_PKG_MAC_EXTRA=--symlink '/Applications:/ '
|
||||
endif
|
||||
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
|
@ -53,7 +53,7 @@ $(DIST)/branding:
|
|||
$(NSINSTALL) -D $@
|
||||
|
||||
libs::
|
||||
@if test -f "$(LOCALE_SRCDIR)/existing-profile-defaults.js"; then \
|
||||
@if test -f '$(LOCALE_SRCDIR)/existing-profile-defaults.js'; then \
|
||||
$(PYTHON) -m mozbuild.action.preprocessor $(PREF_PPFLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) \
|
||||
$(LOCALE_SRCDIR)/existing-profile-defaults.js -o $(FINAL_TARGET)/defaults/existing-profile-defaults.js; \
|
||||
fi
|
||||
|
@ -74,20 +74,20 @@ chrome-%:
|
|||
|
||||
repackage-win32-installer: WIN32_INSTALLER_OUT=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
|
||||
repackage-win32-installer: $(call ESCAPE_SPACE,$(WIN32_INSTALLER_IN)) $(SUBMAKEFILES) libs-$(AB_CD)
|
||||
@echo "Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT)."
|
||||
@echo 'Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT).'
|
||||
$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY) export
|
||||
$(MAKE) -C ../installer/windows CONFIG_DIR=l10ngen l10ngen/setup.exe l10ngen/7zSD.sfx
|
||||
$(MAKE) repackage-zip \
|
||||
AB_CD=$(AB_CD) \
|
||||
MOZ_PKG_FORMAT=SFX7Z \
|
||||
ZIP_IN="$(WIN32_INSTALLER_IN)" \
|
||||
ZIP_OUT="$(WIN32_INSTALLER_OUT)" \
|
||||
SFX_HEADER="$(PWD)/../installer/windows/l10ngen/7zSD.sfx \
|
||||
$(topsrcdir)/b2g/installer/windows/app.tag"
|
||||
ZIP_IN='$(WIN32_INSTALLER_IN)' \
|
||||
ZIP_OUT='$(WIN32_INSTALLER_OUT)' \
|
||||
SFX_HEADER='$(PWD)/../installer/windows/l10ngen/7zSD.sfx \
|
||||
$(topsrcdir)/b2g/installer/windows/app.tag'
|
||||
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
repackage-win32-installer-%:
|
||||
@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN="$(WIN32_INSTALLER_IN)"
|
||||
@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN='$(WIN32_INSTALLER_IN)'
|
||||
else
|
||||
repackage-win32-installer-%: ;
|
||||
endif
|
||||
|
@ -109,33 +109,33 @@ langpack: langpack-$(AB_CD)
|
|||
# tinderbox scripts. Alter it with caution.
|
||||
|
||||
installers-%: clobber-% langpack-% repackage-win32-installer-% repackage-zip-%
|
||||
@echo "repackaging done"
|
||||
@echo 'repackaging done'
|
||||
|
||||
# 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"
|
||||
GECKO_PLATFORM_INI_PATH='$(STAGEDIST)/../Frameworks/XUL.framework/Versions/$(MOZILLA_VERSION)/platform.ini'
|
||||
else
|
||||
GECKO_PLATFORM_INI_PATH="$(STAGEDIST)/platform.ini"
|
||||
GECKO_PLATFORM_INI_PATH='$(STAGEDIST)/platform.ini'
|
||||
endif
|
||||
B2G_APPLICATION_INI_PATH="$(STAGEDIST)/application.ini"
|
||||
B2G_APPLICATION_INI_PATH='$(STAGEDIST)/application.ini'
|
||||
else
|
||||
ifdef LIBXUL_SDK
|
||||
GECKO_PLATFORM_INI_PATH="$(STAGEDIST)/xulrunner/platform.ini"
|
||||
GECKO_PLATFORM_INI_PATH='$(STAGEDIST)/xulrunner/platform.ini'
|
||||
else
|
||||
GECKO_PLATFORM_INI_PATH="$(STAGEDIST)/platform.ini"
|
||||
GECKO_PLATFORM_INI_PATH='$(STAGEDIST)/platform.ini'
|
||||
endif
|
||||
B2G_APPLICATION_INI_PATH="$(STAGEDIST)/application.ini"
|
||||
B2G_APPLICATION_INI_PATH='$(STAGEDIST)/application.ini'
|
||||
endif
|
||||
|
||||
|
||||
ident:
|
||||
@printf "gecko_revision "
|
||||
@printf 'gecko_revision '
|
||||
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(GECKO_PLATFORM_INI_PATH) Build SourceStamp
|
||||
@printf "b2g_revision "
|
||||
@printf 'b2g_revision '
|
||||
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(B2G_APPLICATION_INI_PATH) App SourceStamp
|
||||
@printf "buildid "
|
||||
@printf 'buildid '
|
||||
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py $(B2G_APPLICATION_INI_PATH) App BuildID
|
||||
|
||||
merge-%:
|
||||
|
@ -150,5 +150,5 @@ endif
|
|||
l10n-check::
|
||||
$(RM) -rf x-test
|
||||
$(NSINSTALL) -D x-test/toolkit
|
||||
echo "#define MOZ_LANG_TITLE Just testing" > x-test/toolkit/defines.inc
|
||||
$(MAKE) installers-x-test L10NBASEDIR="$(PWD)" LOCALE_MERGEDIR="$(PWD)/mergedir"
|
||||
echo '#define MOZ_LANG_TITLE Just testing' > x-test/toolkit/defines.inc
|
||||
$(MAKE) installers-x-test L10NBASEDIR='$(PWD)' LOCALE_MERGEDIR='$(PWD)/mergedir'
|
||||
|
|
|
@ -13,11 +13,11 @@ AB_CD = en-US
|
|||
|
||||
DEFINES += \
|
||||
-DAB_CD=$(AB_CD) \
|
||||
-DFIREFOX_ICO=\"$(DIST)/branding/firefox.ico\" \
|
||||
-DDOCUMENT_ICO=\"$(DIST)/branding/document.ico\" \
|
||||
-DNEWWINDOW_ICO=\"$(DIST)/branding/newwindow.ico\" \
|
||||
-DNEWTAB_ICO=\"$(DIST)/branding/newtab.ico\" \
|
||||
-DPBMODE_ICO=\"$(DIST)/branding/pbmode.ico\" \
|
||||
-DFIREFOX_ICO='"$(DIST)/branding/firefox.ico"' \
|
||||
-DDOCUMENT_ICO='"$(DIST)/branding/document.ico"' \
|
||||
-DNEWWINDOW_ICO='"$(DIST)/branding/newwindow.ico"' \
|
||||
-DNEWTAB_ICO='"$(DIST)/branding/newtab.ico"' \
|
||||
-DPBMODE_ICO='"$(DIST)/branding/pbmode.ico"' \
|
||||
$(NULL)
|
||||
|
||||
ifdef LIBXUL_SDK #{
|
||||
|
@ -84,7 +84,7 @@ endif
|
|||
ifeq ($(OS_ARCH),OS2)
|
||||
RESFILE=splashos2.res
|
||||
RCFLAGS += -DMOZ_PHOENIX
|
||||
RCFLAGS += -DFIREFOX_ICO=\"$(DIST)/branding/firefox-os2.ico\" -DDOCUMENT_ICO=\"$(DIST)/branding/document-os2.ico\"
|
||||
RCFLAGS += -DFIREFOX_ICO='"$(DIST)/branding/firefox-os2.ico"' -DDOCUMENT_ICO='"$(DIST)/branding/document-os2.ico"'
|
||||
endif
|
||||
|
||||
PROGRAMS_DEST = $(DIST)/bin
|
||||
|
@ -166,10 +166,10 @@ MAC_BUNDLE_VERSION = $(shell $(PYTHON) $(srcdir)/macversion.py --version=$(MOZ_A
|
|||
tools repackage:: $(PROGRAM)
|
||||
$(MKDIR) -p $(dist_dest)/Contents/MacOS
|
||||
$(MKDIR) -p $(dist_dest)/Contents/Resources/$(AB).lproj
|
||||
rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents $(dist_dest) --exclude English.lproj
|
||||
rsync -a --exclude "*.in" $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(dist_dest)/Contents/Resources/$(AB).lproj
|
||||
sed -e "s/%APP_VERSION%/$(MOZ_APP_VERSION)/" -e "s/%MAC_APP_NAME%/$(MAC_APP_NAME)/" -e "s/%MOZ_MACBUNDLE_ID%/$(MOZ_MACBUNDLE_ID)/" -e "s/%MAC_BUNDLE_VERSION%/$(MAC_BUNDLE_VERSION)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(dist_dest)/Contents/Info.plist
|
||||
sed -e "s/%MAC_APP_NAME%/$(MAC_APP_NAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(dist_dest)/Contents/Resources/$(AB).lproj/InfoPlist.strings
|
||||
rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents $(dist_dest) --exclude English.lproj
|
||||
rsync -a --exclude '*.in' $(srcdir)/macbuild/Contents/Resources/English.lproj/ $(dist_dest)/Contents/Resources/$(AB).lproj
|
||||
sed -e 's/%APP_VERSION%/$(MOZ_APP_VERSION)/' -e 's/%MAC_APP_NAME%/$(MAC_APP_NAME)/' -e 's/%MOZ_MACBUNDLE_ID%/$(MOZ_MACBUNDLE_ID)/' -e 's/%MAC_BUNDLE_VERSION%/$(MAC_BUNDLE_VERSION)/' $(srcdir)/macbuild/Contents/Info.plist.in > $(dist_dest)/Contents/Info.plist
|
||||
sed -e 's/%MAC_APP_NAME%/$(MAC_APP_NAME)/' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | iconv -f UTF-8 -t UTF-16 > $(dist_dest)/Contents/Resources/$(AB).lproj/InfoPlist.strings
|
||||
rsync -a $(DIST)/bin/ $(dist_dest)/Contents/$(APPFILES)
|
||||
$(RM) $(dist_dest)/Contents/MacOS/$(PROGRAM)
|
||||
rsync -aL $(PROGRAM) $(dist_dest)/Contents/MacOS
|
||||
|
|
|
@ -17,35 +17,35 @@ exclude_files = \
|
|||
$(NULL)
|
||||
|
||||
$(FINAL_TARGET)/chrome/pdfjs.manifest: $(GLOBAL_DEPS)
|
||||
printf "manifest pdfjs/chrome.manifest" > $@
|
||||
printf 'manifest pdfjs/chrome.manifest' > $@
|
||||
|
||||
libs:: $(FINAL_TARGET)/chrome/pdfjs.manifest
|
||||
$(PYTHON) $(topsrcdir)/config/nsinstall.py \
|
||||
$(srcdir)/pdfjs \
|
||||
$(foreach exclude,$(exclude_files), -X $(srcdir)/pdfjs/$(exclude)) \
|
||||
$(FINAL_TARGET)/chrome
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest "manifest chrome/pdfjs.manifest")
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest 'manifest chrome/pdfjs.manifest')
|
||||
|
||||
ifdef NIGHTLY_BUILD
|
||||
$(FINAL_TARGET)/chrome/shumway.manifest: $(GLOBAL_DEPS)
|
||||
printf "manifest shumway/chrome.manifest" > $@
|
||||
printf 'manifest shumway/chrome.manifest' > $@
|
||||
|
||||
libs:: $(FINAL_TARGET)/chrome/shumway.manifest
|
||||
$(PYTHON) $(topsrcdir)/config/nsinstall.py \
|
||||
$(srcdir)/shumway \
|
||||
$(foreach exclude,$(exclude_files), -X $(srcdir)/shumway/$(exclude)) \
|
||||
$(FINAL_TARGET)/chrome
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest "manifest chrome/shumway.manifest")
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest 'manifest chrome/shumway.manifest')
|
||||
endif
|
||||
|
||||
ifdef MOZ_METRO
|
||||
$(DIST)/bin/metro/chrome/pdfjs.manifest: $(GLOBAL_DEPS)
|
||||
printf "manifest pdfjs/chrome.manifest" > $@
|
||||
printf 'manifest pdfjs/chrome.manifest' > $@
|
||||
|
||||
libs:: $(DIST)/bin/metro/chrome/pdfjs.manifest
|
||||
$(PYTHON) $(topsrcdir)/config/nsinstall.py \
|
||||
$(srcdir)/pdfjs \
|
||||
$(foreach exclude,$(exclude_files), -X $(srcdir)/pdfjs/$(exclude)) \
|
||||
$(DIST)/bin/metro/chrome
|
||||
$(call py_action,buildlist,$(DIST)/bin/metro/chrome.manifest "manifest chrome/pdfjs.manifest")
|
||||
$(call py_action,buildlist,$(DIST)/bin/metro/chrome.manifest 'manifest chrome/pdfjs.manifest')
|
||||
endif
|
||||
|
|
|
@ -92,7 +92,7 @@ ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT))
|
|||
MOZ_PKG_MAC_DSSTORE=branding/dsstore
|
||||
MOZ_PKG_MAC_BACKGROUND=branding/background.png
|
||||
MOZ_PKG_MAC_ICON=branding/disk.icns
|
||||
MOZ_PKG_MAC_EXTRA=--symlink "/Applications:/ "
|
||||
MOZ_PKG_MAC_EXTRA=--symlink '/Applications:/ '
|
||||
endif
|
||||
|
||||
ifndef LIBXUL_SDK
|
||||
|
@ -128,7 +128,7 @@ endif
|
|||
package-compare:: $(MOZ_PKG_MANIFEST)
|
||||
ifdef MOZ_PKG_MANIFEST_P
|
||||
cd $(DIST); find $(PKGCOMP_FIND_OPTS) $(FINDPATH) -type f | sort > bin-list.txt
|
||||
grep "^$(BINPATH)" $(MOZ_PKG_MANIFEST) | sed -e 's/^\///' | sort > $(DIST)/pack-list.txt
|
||||
grep '^$(BINPATH)' $(MOZ_PKG_MANIFEST) | sed -e 's/^\///' | sort > $(DIST)/pack-list.txt
|
||||
-diff -u $(DIST)/pack-list.txt $(DIST)/bin-list.txt
|
||||
rm -f $(DIST)/pack-list.txt $(DIST)/bin-list.txt
|
||||
endif
|
||||
|
|
|
@ -41,7 +41,7 @@ BRANDING_FILES = \
|
|||
DEFINES += \
|
||||
-DAB_CD=$(AB_CD) \
|
||||
-DMOZ_APP_NAME=$(MOZ_APP_NAME) \
|
||||
-DMOZ_APP_DISPLAYNAME="${MOZ_APP_DISPLAYNAME}" \
|
||||
-DMOZ_APP_DISPLAYNAME='${MOZ_APP_DISPLAYNAME}' \
|
||||
-DMOZILLA_VERSION=${MOZILLA_VERSION} \
|
||||
$(NULL)
|
||||
|
||||
|
|
|
@ -50,7 +50,7 @@ ifneq (,$(filter cocoa,$(MOZ_WIDGET_TOOLKIT)))
|
|||
MOZ_PKG_MAC_DSSTORE=$(_ABS_DIST)/branding/dsstore
|
||||
MOZ_PKG_MAC_BACKGROUND=$(_ABS_DIST)/branding/background.png
|
||||
MOZ_PKG_MAC_ICON=$(_ABS_DIST)/branding/disk.icns
|
||||
MOZ_PKG_MAC_EXTRA=--symlink "/Applications:/ "
|
||||
MOZ_PKG_MAC_EXTRA=--symlink '/Applications:/ '
|
||||
endif
|
||||
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
|
@ -61,10 +61,10 @@ UNINSTALLER_PACKAGE_HOOK = $(RM) -r $(STAGEDIST)/uninstall; \
|
|||
cp ../installer/windows/l10ngen/setup.exe $(_ABS_DIST)/l10n-stage; \
|
||||
$(NULL)
|
||||
|
||||
STUB_HOOK = $(NSINSTALL) -D "$(_ABS_DIST)/$(PKG_INST_PATH)"; \
|
||||
$(RM) "$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe"; \
|
||||
cp ../installer/windows/l10ngen/stub.exe "$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe"; \
|
||||
chmod 0755 "$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe"; \
|
||||
STUB_HOOK = $(NSINSTALL) -D '$(_ABS_DIST)/$(PKG_INST_PATH)'; \
|
||||
$(RM) '$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe'; \
|
||||
cp ../installer/windows/l10ngen/stub.exe '$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe'; \
|
||||
chmod 0755 '$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_STUB_BASENAME).exe'; \
|
||||
$(NULL)
|
||||
endif
|
||||
|
||||
|
@ -140,20 +140,20 @@ endif
|
|||
|
||||
repackage-win32-installer: WIN32_INSTALLER_OUT=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe
|
||||
repackage-win32-installer: $(call ESCAPE_WILDCARD,$(WIN32_INSTALLER_IN)) $(SUBMAKEFILES) libs-$(AB_CD)
|
||||
@echo "Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT)."
|
||||
@echo 'Repackaging $(WIN32_INSTALLER_IN) into $(WIN32_INSTALLER_OUT).'
|
||||
$(MAKE) -C $(DEPTH)/$(MOZ_BRANDING_DIRECTORY) export
|
||||
$(MAKE) -C ../installer/windows CONFIG_DIR=l10ngen l10ngen/setup.exe l10ngen/7zSD.sfx
|
||||
$(MAKE) repackage-zip \
|
||||
AB_CD=$(AB_CD) \
|
||||
MOZ_PKG_FORMAT=SFX7Z \
|
||||
ZIP_IN="$(WIN32_INSTALLER_IN)" \
|
||||
ZIP_OUT="$(WIN32_INSTALLER_OUT)" \
|
||||
SFX_HEADER="$(PWD)/../installer/windows/l10ngen/7zSD.sfx \
|
||||
$(topsrcdir)/browser/installer/windows/app.tag"
|
||||
ZIP_IN='$(WIN32_INSTALLER_IN)' \
|
||||
ZIP_OUT='$(WIN32_INSTALLER_OUT)' \
|
||||
SFX_HEADER='$(PWD)/../installer/windows/l10ngen/7zSD.sfx \
|
||||
$(topsrcdir)/browser/installer/windows/app.tag'
|
||||
|
||||
ifeq (WINNT,$(OS_ARCH))
|
||||
repackage-win32-installer-%: $(STAGEDIST)
|
||||
@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN="$(WIN32_INSTALLER_IN)"
|
||||
@$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN='$(WIN32_INSTALLER_IN)'
|
||||
|
||||
repackage-zip-%: repackage-win32-installer-%
|
||||
else
|
||||
|
@ -182,7 +182,7 @@ langpack: langpack-$(AB_CD)
|
|||
# tinderbox scripts. Alter it with caution.
|
||||
|
||||
installers-%: clobber-% langpack-% repackage-win32-installer-% repackage-zip-%
|
||||
@echo "repackaging done"
|
||||
@echo 'repackaging done'
|
||||
|
||||
ifdef MOZ_UPDATER
|
||||
# Note that we want updater.ini to be in the top directory, not the browser/
|
||||
|
@ -190,13 +190,13 @@ ifdef MOZ_UPDATER
|
|||
libs:: $(call MERGE_FILE,updater/updater.ini) $(call mkdir_deps,$(DIST)/bin)
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
cat $< $(srcdir)/../installer/windows/nsis/updater_append.ini | \
|
||||
sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \
|
||||
sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" > \
|
||||
sed -e 's/^InfoText=/Info=/' -e 's/^TitleText=/Title=/' | \
|
||||
sed -e 's/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/' > \
|
||||
$(FINAL_TARGET)/../updater.ini
|
||||
else
|
||||
cat $< | \
|
||||
sed -e "s/^InfoText=/Info=/" -e "s/^TitleText=/Title=/" | \
|
||||
sed -e "s/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/" > \
|
||||
sed -e 's/^InfoText=/Info=/' -e 's/^TitleText=/Title=/' | \
|
||||
sed -e 's/%MOZ_APP_DISPLAYNAME%/$(MOZ_APP_DISPLAYNAME)/' > \
|
||||
$(FINAL_TARGET)/../updater.ini
|
||||
endif
|
||||
endif
|
||||
|
@ -207,10 +207,10 @@ libs:: crashreporter-override.ini
|
|||
endif
|
||||
|
||||
ident:
|
||||
@printf "fx_revision "
|
||||
@printf 'fx_revision '
|
||||
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \
|
||||
$(STAGEDIST)/application.ini App SourceStamp
|
||||
@printf "buildid "
|
||||
@printf 'buildid '
|
||||
@$(PYTHON) $(topsrcdir)/config/printconfigsetting.py \
|
||||
$(STAGEDIST)/application.ini App BuildID
|
||||
|
||||
|
@ -227,7 +227,7 @@ l10n-check:: INNER_UNMAKE_PACKAGE=true
|
|||
l10n-check::
|
||||
$(RM) -rf x-test
|
||||
$(NSINSTALL) -D x-test/toolkit
|
||||
echo "#define MOZ_LANG_TITLE Just testing" > x-test/toolkit/defines.inc
|
||||
$(MAKE) installers-x-test L10NBASEDIR="$(PWD)" LOCALE_MERGEDIR="$(PWD)/mergedir"
|
||||
echo '#define MOZ_LANG_TITLE Just testing' > x-test/toolkit/defines.inc
|
||||
$(MAKE) installers-x-test L10NBASEDIR='$(PWD)' LOCALE_MERGEDIR='$(PWD)/mergedir'
|
||||
$(PYTHON) $(topsrcdir)/toolkit/mozapps/installer/unpack.py $(DIST)/l10n-stage/$(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)
|
||||
cd $(DIST)/l10n-stage && test $$(cat $(STAGEPATH)$(MOZ_PKG_DIR)$(_BINPATH)/update.locale) = x-test
|
||||
|
|
|
@ -12,7 +12,7 @@ DEFINES += -DGRE_BUILDID=$(GRE_BUILDID) -DMOZ_APP_BASENAME=$(MOZ_APP_BASENAME)
|
|||
|
||||
# 'application.ini' breaks firefox build config. So we use something different.
|
||||
metroapp.ini: metroapp.ini.in $(DEPTH)/config/buildid $(topsrcdir)/config/milestone.txt
|
||||
$(RM) "metroapp.ini"
|
||||
$(RM) metroapp.ini
|
||||
$(call py_action,preprocessor,$(DEFINES) $< -o $@)
|
||||
|
||||
libs:: metroapp.ini
|
||||
|
|
|
@ -19,6 +19,6 @@ BRANDFOLDER = $(notdir $(MOZ_BRANDING_DIRECTORY))
|
|||
|
||||
branding-$(BRANDFOLDER):
|
||||
$(MAKE) -C $(DEPTH)/browser/branding/$(BRANDFOLDER) \
|
||||
DIST_SUBDIR=$(DIST_SUBDIR) XPI_ROOT_APPID="$(XPI_ROOT_APPID)"
|
||||
DIST_SUBDIR=$(DIST_SUBDIR) XPI_ROOT_APPID='$(XPI_ROOT_APPID)'
|
||||
|
||||
libs:: branding-$(BRANDFOLDER)
|
||||
|
|
|
@ -24,7 +24,7 @@ include $(topsrcdir)/config/rules.mk
|
|||
# Metro reuses desktop search plugins
|
||||
libs::
|
||||
$(MAKE) -C $(DEPTH)/browser/locales searchplugins \
|
||||
DIST_SUBDIR=$(DIST_SUBDIR) XPI_ROOT_APPID="$(XPI_ROOT_APPID)"
|
||||
DIST_SUBDIR=$(DIST_SUBDIR) XPI_ROOT_APPID='$(XPI_ROOT_APPID)'
|
||||
|
||||
#########################################
|
||||
# Bookmarks
|
||||
|
@ -43,7 +43,7 @@ bookmarks-src = $(srcdir)/../generic/profile/bookmarks.json.in
|
|||
# The resulting bookmarks.json will get picked up and packaged by the
|
||||
# processing of the jar file in the parent directory.
|
||||
bookmarks: bookmarks.inc
|
||||
@echo "Generating: $@"
|
||||
@echo 'Generating: $@'
|
||||
$(call py_action,preprocessor, \
|
||||
-I $^ \
|
||||
-DAB_CD=$(AB_CD) \
|
||||
|
|
|
@ -14,11 +14,11 @@ INSTALL_TARGETS += ICON
|
|||
# the processing of the jar file in this directory.
|
||||
tab-selected-svg: $(srcdir)/../shared/tab-selected.svg
|
||||
$(call py_action,preprocessor, \
|
||||
--marker "%" -D TAB_SIDE=start \
|
||||
--marker % -D TAB_SIDE=start \
|
||||
$(ACDEFINES) \
|
||||
$(srcdir)/../shared/tab-selected.svg -o tab-selected-start.svg)
|
||||
$(call py_action,preprocessor, \
|
||||
--marker "%" -D TAB_SIDE=end \
|
||||
--marker % -D TAB_SIDE=end \
|
||||
$(ACDEFINES) \
|
||||
$(srcdir)/../shared/tab-selected.svg -o tab-selected-end.svg)
|
||||
|
||||
|
|
|
@ -14,11 +14,11 @@ INSTALL_TARGETS += ICON
|
|||
# the processing of the jar file in this directory.
|
||||
tab-selected-svg: $(srcdir)/../shared/tab-selected.svg
|
||||
$(call py_action,preprocessor, \
|
||||
--marker "%" -D TAB_SIDE=start \
|
||||
--marker % -D TAB_SIDE=start \
|
||||
$(ACDEFINES) \
|
||||
$(srcdir)/../shared/tab-selected.svg -o tab-selected-start.svg)
|
||||
$(call py_action,preprocessor, \
|
||||
--marker "%" -D TAB_SIDE=end \
|
||||
--marker % -D TAB_SIDE=end \
|
||||
$(ACDEFINES) \
|
||||
$(srcdir)/../shared/tab-selected.svg -o tab-selected-end.svg)
|
||||
|
||||
|
|
|
@ -28,14 +28,14 @@ DEFINES += -DAPP_BUILDID=$(APP_BUILDID)
|
|||
|
||||
APP_INI_DEPS += $(DEPTH)/config/autoconf.mk
|
||||
|
||||
MOZ_SOURCE_STAMP := $(firstword $(shell cd $(topsrcdir)/$(MOZ_BUILD_APP)/.. && hg parent --template="{node|short}\n" 2>/dev/null))
|
||||
MOZ_SOURCE_STAMP := $(firstword $(shell cd $(topsrcdir)/$(MOZ_BUILD_APP)/.. && hg parent --template='{node|short}\n' 2>/dev/null))
|
||||
ifdef MOZ_SOURCE_STAMP
|
||||
DEFINES += -DMOZ_SOURCE_STAMP="$(MOZ_SOURCE_STAMP)"
|
||||
DEFINES += -DMOZ_SOURCE_STAMP='$(MOZ_SOURCE_STAMP)'
|
||||
endif
|
||||
|
||||
source_repo ?= $(call getSourceRepo,$(topsrcdir)/$(MOZ_BUILD_APP)/..)
|
||||
ifneq (,$(source_repo))
|
||||
DEFINES += -DMOZ_SOURCE_REPO="$(source_repo)"
|
||||
DEFINES += -DMOZ_SOURCE_REPO='$(source_repo)'
|
||||
endif
|
||||
|
||||
endif
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
include $(MOZILLA_DIR)/build/binary-location.mk
|
||||
|
||||
browser_path := \"$(browser_path)\"
|
||||
browser_path := '"$(browser_path)"'
|
||||
|
||||
_PROFILE_DIR = $(TARGET_DEPTH)/_profile/pgo
|
||||
|
||||
|
@ -13,11 +13,11 @@ _CERTS_SRC_DIR = $(ABSOLUTE_TOPSRCDIR)/build/pgo/certs
|
|||
|
||||
AUTOMATION_PPARGS = \
|
||||
-DBROWSER_PATH=$(browser_path) \
|
||||
-DXPC_BIN_PATH=\"$(LIBXUL_DIST)/bin\" \
|
||||
-DBIN_SUFFIX=\"$(BIN_SUFFIX)\" \
|
||||
-DPROFILE_DIR=\"$(_PROFILE_DIR)\" \
|
||||
-DCERTS_SRC_DIR=\"$(_CERTS_SRC_DIR)\" \
|
||||
-DPERL="\"$(PERL)\"" \
|
||||
-DXPC_BIN_PATH='"$(LIBXUL_DIST)/bin"' \
|
||||
-DBIN_SUFFIX='"$(BIN_SUFFIX)"' \
|
||||
-DPROFILE_DIR='"$(_PROFILE_DIR)"' \
|
||||
-DCERTS_SRC_DIR='"$(_CERTS_SRC_DIR)"' \
|
||||
-DPERL='"$(PERL)"' \
|
||||
$(NULL)
|
||||
|
||||
ifeq ($(OS_ARCH),Darwin)
|
||||
|
|
|
@ -58,7 +58,7 @@ makedmg-%:
|
|||
|
||||
ifndef PACKAGES
|
||||
stage-packages makexpi-packages:
|
||||
@echo "Please set PACKAGES on the makefile command line or environment."
|
||||
@echo 'Please set PACKAGES on the makefile command line or environment.'
|
||||
|
||||
else #PACKAGES
|
||||
stage-packages:
|
||||
|
|
Двоичные данные
build/pgo/certs/cert8.db
Двоичные данные
build/pgo/certs/cert8.db
Двоичный файл не отображается.
|
@ -1,32 +0,0 @@
|
|||
-----BEGIN CERTIFICATE-----
|
||||
MIIFljCCBH6gAwIBAgIJAK/FPSJmJkkyMA0GCSqGSIb3DQEBBQUAMIHhMQswCQYD
|
||||
VQQGEwJVUzELMAkGA1UECBMCQ0ExFjAUBgNVBAcTDU1vdW50YWluIFZpZXcxIzAh
|
||||
BgNVBAoTGk1vemlsbGEgLSBFViBkZWJ1ZyB0ZXN0IENBMR0wGwYDVQQLExRTZWN1
|
||||
cml0eSBFbmdpbmVlcmluZzEmMCQGA1UEAxMdRVYgVGVzdGluZyAodW50cnVzdHdv
|
||||
cnRoeSkgQ0ExEzARBgNVBCkTCmV2LXRlc3QtY2ExLDAqBgkqhkiG9w0BCQEWHWNo
|
||||
YXJsYXRhbkB0ZXN0aW5nLmV4YW1wbGUuY29tMB4XDTEzMDIxNDE3NDkwMFoXDTIz
|
||||
MDIxMjE3NDkwMFowgeExCzAJBgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UE
|
||||
BxMNTW91bnRhaW4gVmlldzEjMCEGA1UEChMaTW96aWxsYSAtIEVWIGRlYnVnIHRl
|
||||
c3QgQ0ExHTAbBgNVBAsTFFNlY3VyaXR5IEVuZ2luZWVyaW5nMSYwJAYDVQQDEx1F
|
||||
ViBUZXN0aW5nICh1bnRydXN0d29ydGh5KSBDQTETMBEGA1UEKRMKZXYtdGVzdC1j
|
||||
YTEsMCoGCSqGSIb3DQEJARYdY2hhcmxhdGFuQHRlc3RpbmcuZXhhbXBsZS5jb20w
|
||||
ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCk+k5mvnrxhVdVnhaxCeDG
|
||||
ZC5kcC8951K3xTkh2JMtUpSQL2IoGLOZOWTNY+2wGNyHbdJjKDv1d0bzZfz3yDkB
|
||||
AbY6OcxS4WkwccKsyIzkdacpYWhi7kEFevm9p7TI8jdrpKmItrlqfZKfteh+K+DF
|
||||
XZF7xp6zpoUis6dykmk5v8RivpCZl7HIlsOW0wSqCocXWH/WWFgAQyozjW8MgGOL
|
||||
/eV2aLsx+yg7it9GMMtyidggwvlYM7O8vY0gJqQKXntbHq1zV7jIJ3bXzJceur+G
|
||||
Ce4HvsRHAQUSl6jUfm00aKkqS+1t3svZURIKM6qWAuIKMGcspv+L8lyn1KImG8M5
|
||||
AgMBAAGjggFNMIIBSTAdBgNVHQ4EFgQUyJg651hwk+3BV0rQvQZv9n2bWPYwggEY
|
||||
BgNVHSMEggEPMIIBC4AUyJg651hwk+3BV0rQvQZv9n2bWPahgeekgeQwgeExCzAJ
|
||||
BgNVBAYTAlVTMQswCQYDVQQIEwJDQTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEj
|
||||
MCEGA1UEChMaTW96aWxsYSAtIEVWIGRlYnVnIHRlc3QgQ0ExHTAbBgNVBAsTFFNl
|
||||
Y3VyaXR5IEVuZ2luZWVyaW5nMSYwJAYDVQQDEx1FViBUZXN0aW5nICh1bnRydXN0
|
||||
d29ydGh5KSBDQTETMBEGA1UEKRMKZXYtdGVzdC1jYTEsMCoGCSqGSIb3DQEJARYd
|
||||
Y2hhcmxhdGFuQHRlc3RpbmcuZXhhbXBsZS5jb22CCQCvxT0iZiZJMjAMBgNVHRME
|
||||
BTADAQH/MA0GCSqGSIb3DQEBBQUAA4IBAQAcKVLC9MbdSZjzkVBseCm6t49aIIBm
|
||||
xQrsTNV2Gnp5eIXBfUhNAfD0zbBcKHK9AfHmNT8ZK6iABjiOrnn6yQNufW5MMdNx
|
||||
+/4FtTmdlBPLpyuBY7re+XbIaPxr/jB9jJ1pmh52xH3wMkO7ATDQ2fqFnODFrUKS
|
||||
UpXzuydPnsCdu32KPSnewIrkDB10Sah7vw3uwASO2GWqaFtUDFWGpt6rYQTcOF8g
|
||||
7a6Zj0johBMQFHE3HDRebWxiOf21ppN/tvv0gtGiA0ZIXBezeLaJ+Hob1xTbi4sw
|
||||
sGYDKHPCrLuTZWXmkv0rAIkLLK4VHbsA5xYPQNJJsTpX3u0Z0vZxJd9/
|
||||
-----END CERTIFICATE-----
|
|
@ -101,8 +101,6 @@ https://mismatch.expired.example.com:443 privileged,cert=expired
|
|||
https://mismatch.untrusted.example.com:443 privileged,cert=untrusted
|
||||
https://untrusted-expired.example.com:443 privileged,cert=untrustedandexpired
|
||||
https://mismatch.untrusted-expired.example.com:443 privileged,cert=untrustedandexpired
|
||||
https://ev-valid.example.com:443 privileged,cert=evvalid
|
||||
https://ev-invalid.example.com:443 priviliged,cert=evinvalid
|
||||
|
||||
# This is here so that we don't load the default live bookmark over
|
||||
# the network in every test suite.
|
||||
|
|
|
@ -27,7 +27,7 @@ test-array$(DLL_SUFFIX) test-ctors$(DLL_SUFFIX): %$(DLL_SUFFIX): %.$(OBJ_SUFFIX)
|
|||
@rm -f $@.bak
|
||||
$(CURDIR)/elfhack -b -f $@
|
||||
# Fail if the backup file doesn't exist
|
||||
[ -f "$@.bak" ]
|
||||
[ -f '$@.bak' ]
|
||||
# Fail if the new library doesn't contain less relocations
|
||||
[ $$($(TOOLCHAIN_PREFIX)objdump -R $@.bak | wc -l) -gt $$(objdump -R $@ | wc -l) ]
|
||||
|
||||
|
|
|
@ -44,7 +44,7 @@ libs-preqs = \
|
|||
$(NULL)
|
||||
|
||||
libs:: $(libs-preqs)
|
||||
install --preserve-timestamps $(foreach f,$(REDIST_FILES),"$(WIN32_REDIST_DIR)"/$(f)) $(FINAL_TARGET)
|
||||
install --preserve-timestamps $(foreach f,$(REDIST_FILES),'$(WIN32_REDIST_DIR)'/$(f)) $(FINAL_TARGET)
|
||||
endif
|
||||
|
||||
endif # ! MOZ_DEBUG
|
||||
|
|
14
client.mk
14
client.mk
|
@ -204,7 +204,7 @@ ifdef WANT_MOZCONFIG_MK
|
|||
# For now, only output "export" lines from mozconfig2client-mk output.
|
||||
MOZCONFIG_MK_LINES := $(filter export||%,$(MOZCONFIG_OUT_LINES))
|
||||
$(OBJDIR)/.mozconfig.mk: $(FOUND_MOZCONFIG) $(call mkdir_deps,$(OBJDIR))
|
||||
$(if $(MOZCONFIG_MK_LINES),( $(foreach line,$(MOZCONFIG_MK_LINES), echo "$(subst ||, ,$(line))";) )) > $@
|
||||
$(if $(MOZCONFIG_MK_LINES),( $(foreach line,$(MOZCONFIG_MK_LINES), echo '$(subst ||, ,$(line))';) )) > $@
|
||||
|
||||
# Include that makefile so that it is created. This should not actually change
|
||||
# the environment since MOZCONFIG_CONTENT, which MOZCONFIG_OUT_LINES derives
|
||||
|
@ -278,7 +278,7 @@ else
|
|||
# this point when building multiple projects. Only MOZ_OBJDIR is available.
|
||||
set -e; \
|
||||
for mkfile in $(MOZ_PREFLIGHT_ALL); do \
|
||||
$(MAKE) -f $(TOPSRCDIR)/$$mkfile preflight_all TOPSRCDIR=$(TOPSRCDIR) MOZ_OBJDIR=$(MOZ_OBJDIR) MOZ_BUILD_PROJECTS="$(MOZ_BUILD_PROJECTS)"; \
|
||||
$(MAKE) -f $(TOPSRCDIR)/$$mkfile preflight_all TOPSRCDIR=$(TOPSRCDIR) MOZ_OBJDIR=$(MOZ_OBJDIR) MOZ_BUILD_PROJECTS='$(MOZ_BUILD_PROJECTS)'; \
|
||||
done
|
||||
endif
|
||||
endif
|
||||
|
@ -330,7 +330,7 @@ CONFIG_STATUS_DEPS := \
|
|||
$(NULL)
|
||||
|
||||
CONFIGURE_ENV_ARGS += \
|
||||
MAKE="$(MAKE)" \
|
||||
MAKE='$(MAKE)' \
|
||||
$(NULL)
|
||||
|
||||
# configure uses the program name to determine @srcdir@. Calling it without
|
||||
|
@ -363,8 +363,8 @@ configure:: $(configure-preqs)
|
|||
@echo cd $(OBJDIR);
|
||||
@echo $(CONFIGURE) $(CONFIGURE_ARGS)
|
||||
@cd $(OBJDIR) && $(BUILD_PROJECT_ARG) $(CONFIGURE_ENV_ARGS) $(CONFIGURE) $(CONFIGURE_ARGS) \
|
||||
|| ( echo "*** Fix above errors and then restart with\
|
||||
\"$(MAKE) -f client.mk build\"" && exit 1 )
|
||||
|| ( echo '*** Fix above errors and then restart with\
|
||||
"$(MAKE) -f client.mk build"' && exit 1 )
|
||||
@touch $(OBJDIR)/Makefile
|
||||
|
||||
ifneq (,$(MAKEFILE))
|
||||
|
@ -437,7 +437,7 @@ else
|
|||
# this point when building multiple projects. Only MOZ_OBJDIR is available.
|
||||
set -e; \
|
||||
for mkfile in $(MOZ_POSTFLIGHT_ALL); do \
|
||||
$(MAKE) -f $(TOPSRCDIR)/$$mkfile postflight_all TOPSRCDIR=$(TOPSRCDIR) MOZ_OBJDIR=$(MOZ_OBJDIR) MOZ_BUILD_PROJECTS="$(MOZ_BUILD_PROJECTS)"; \
|
||||
$(MAKE) -f $(TOPSRCDIR)/$$mkfile postflight_all TOPSRCDIR=$(TOPSRCDIR) MOZ_OBJDIR=$(MOZ_OBJDIR) MOZ_BUILD_PROJECTS='$(MOZ_BUILD_PROJECTS)'; \
|
||||
done
|
||||
endif
|
||||
endif
|
||||
|
@ -447,7 +447,7 @@ cleansrcdir:
|
|||
if [ -f Makefile ]; then \
|
||||
$(MAKE) distclean ; \
|
||||
else \
|
||||
echo "Removing object files from srcdir..."; \
|
||||
echo 'Removing object files from srcdir...'; \
|
||||
rm -fr `find . -type d \( -name .deps -print -o -name CVS \
|
||||
-o -exec test ! -d {}/CVS \; \) -prune \
|
||||
-o \( -name '*.[ao]' -o -name '*.so' \) -type f -print`; \
|
||||
|
|
|
@ -59,7 +59,7 @@ HOST_CFLAGS += -DUNICODE -D_UNICODE
|
|||
# supposed to be once per-build!
|
||||
export::
|
||||
ifdef MOZ_BUILD_DATE
|
||||
printf "%s" $(MOZ_BUILD_DATE) > buildid
|
||||
printf '%s' $(MOZ_BUILD_DATE) > buildid
|
||||
else
|
||||
$(PYTHON) $(topsrcdir)/toolkit/xre/make-platformini.py --print-buildid > buildid
|
||||
endif
|
||||
|
|
|
@ -811,7 +811,7 @@ endif
|
|||
MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
|
||||
|
||||
ifeq (OS2,$(OS_ARCH))
|
||||
RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(LIBXUL_DIST)"
|
||||
RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd '$(LIBXUL_DIST)'
|
||||
else
|
||||
ifneq (WINNT,$(OS_ARCH))
|
||||
RUN_TEST_PROGRAM = $(LIBXUL_DIST)/bin/run-mozilla.sh
|
||||
|
@ -848,7 +848,7 @@ EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) $(EXPAND_MKSHLIB_ARGS) -- $(MKSHLIB)
|
|||
|
||||
ifneq (,$(MOZ_LIBSTDCXX_TARGET_VERSION)$(MOZ_LIBSTDCXX_HOST_VERSION))
|
||||
ifneq ($(OS_ARCH),Darwin)
|
||||
CHECK_STDCXX = objdump -p $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' > /dev/null && echo "TEST-UNEXPECTED-FAIL | | We don't want these libstdc++ symbols to be used:" && objdump -T $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' && exit 1 || exit 0
|
||||
CHECK_STDCXX = objdump -p $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' > /dev/null && echo 'TEST-UNEXPECTED-FAIL | | We do not want these libstdc++ symbols to be used:' && objdump -T $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' && exit 1 || exit 0
|
||||
endif
|
||||
|
||||
ifdef MOZ_LIBSTDCXX_TARGET_VERSION
|
||||
|
|
|
@ -56,18 +56,18 @@ mkdir_deps =$(foreach dir,$(getargv),$(call slash_strip,$(dir)/.mkdir.done))
|
|||
#######################
|
||||
|
||||
%/.mkdir.done: # mkdir -p -p => mkdir -p
|
||||
$(subst $(space)-p,$(null),$(MKDIR)) -p "$(dir $@)"
|
||||
$(subst $(space)-p,$(null),$(MKDIR)) -p '$(dir $@)'
|
||||
# Make the timestamp old enough for not being a problem with symbolic links
|
||||
# targets depending on it. Use Jan 3, 1980 to accomodate any timezone where
|
||||
# 198001010000 would translate to something older than FAT epoch.
|
||||
@$(TOUCH) -t 198001030000 "$@"
|
||||
@$(TOUCH) -t 198001030000 '$@'
|
||||
|
||||
# A handful of makefiles are attempting "mkdir dot".
|
||||
# tbpl/valgrind builds are using this target
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=837754
|
||||
.mkdir.done:
|
||||
@echo "WARNING: $(MKDIR) -dot- requested by $(MAKE) -C $(CURDIR) $(MAKECMDGOALS)"
|
||||
@$(TOUCH) -t 198001030000 "$@"
|
||||
@echo 'WARNING: $(MKDIR) -dot- requested by $(MAKE) -C $(CURDIR) $(MAKECMDGOALS)'
|
||||
@$(TOUCH) -t 198001030000 '$@'
|
||||
|
||||
INCLUDED_AUTOTARGETS_MK = 1
|
||||
endif #}
|
||||
|
|
|
@ -25,8 +25,8 @@ ifdef IS_COMPONENT
|
|||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
|
||||
$(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
|
||||
ifndef NO_COMPONENTS_MANIFEST
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest")
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)")
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest 'manifest components/components.manifest')
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/components/components.manifest 'binary-component $(SHARED_LIBRARY)')
|
||||
endif
|
||||
endif # IS_COMPONENT
|
||||
endif # SHARED_LIBRARY
|
||||
|
@ -109,11 +109,11 @@ BINARIES_INSTALL_TARGETS := $(foreach category,$(INSTALL_TARGETS),$(if $(filter
|
|||
BINARIES_PP := $(MDDEPDIR)/binaries.pp
|
||||
|
||||
$(BINARIES_PP): Makefile $(wildcard backend.mk) $(call mkdir_deps,$(MDDEPDIR))
|
||||
@echo "$(strip $(foreach category,$(BINARIES_INSTALL_TARGETS),\
|
||||
@echo '$(strip $(foreach category,$(BINARIES_INSTALL_TARGETS),\
|
||||
$(foreach file,$($(category)_FILES) $($(category)_EXECUTABLES),\
|
||||
$($(category)_DEST)/$(notdir $(file)): $(file)%\
|
||||
)\
|
||||
))binaries: Makefile $(wildcard backend.mk)" | tr % '\n' > $@
|
||||
))binaries: Makefile $(wildcard backend.mk)' | tr % '\n' > $@
|
||||
|
||||
else
|
||||
binaries::
|
||||
|
|
|
@ -129,7 +129,7 @@ recurse_$(CURRENT_TIER):
|
|||
# Creating binaries-deps.mk directly would make us build it twice: once when beginning
|
||||
# the build because of the include, and once at the end because of the stamps.
|
||||
binaries-deps: $(addsuffix /binaries,$(CURRENT_DIRS))
|
||||
@$(call py_action,link_deps,-o $@.mk --group-by-depfile --topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) --guard $(addprefix ",$(addsuffix ",$^)))
|
||||
@$(call py_action,link_deps,-o $@.mk --group-by-depfile --topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) --guard $(addprefix ',$(addsuffix ',$^)))
|
||||
@$(TOUCH) $@
|
||||
|
||||
ifeq (recurse_binaries,$(MAKECMDGOALS))
|
||||
|
|
112
config/rules.mk
112
config/rules.mk
|
@ -129,7 +129,7 @@ check::
|
|||
|
||||
cppunittests-remote: DM_TRANS?=adb
|
||||
cppunittests-remote:
|
||||
@if [ "${TEST_DEVICE}" != "" -o "$(DM_TRANS)" = "adb" ]; then \
|
||||
@if [ '${TEST_DEVICE}' != '' -o '$(DM_TRANS)' = 'adb' ]; then \
|
||||
$(PYTHON) -u $(topsrcdir)/testing/remotecppunittests.py \
|
||||
--xre-path=$(DEPTH)/dist/bin \
|
||||
--localLib=$(DEPTH)/dist/$(MOZ_APP_NAME) \
|
||||
|
@ -137,7 +137,7 @@ cppunittests-remote:
|
|||
--deviceIP=${TEST_DEVICE} \
|
||||
$(subst .cpp,$(BIN_SUFFIX),$(CPP_UNIT_TESTS)) $(EXTRA_TEST_ARGS); \
|
||||
else \
|
||||
echo "please prepare your host with environment variables for TEST_DEVICE"; \
|
||||
echo 'please prepare your host with environment variables for TEST_DEVICE'; \
|
||||
fi
|
||||
|
||||
endif # COMPILE_ENVIRONMENT
|
||||
|
@ -364,13 +364,13 @@ ifdef MOZ_UPDATE_XTERM
|
|||
# Its good not to have a newline at the end of the titlebar string because it
|
||||
# makes the make -s output easier to read. Echo -n does not work on all
|
||||
# platforms, but we can trick printf into doing it.
|
||||
UPDATE_TITLE = printf "\033]0;%s in %s\007" $(1) $(relativesrcdir)/$(2) ;
|
||||
UPDATE_TITLE = printf '\033]0;%s in %s\007' $(1) $(relativesrcdir)/$(2) ;
|
||||
endif
|
||||
|
||||
ifdef MACH
|
||||
ifndef NO_BUILDSTATUS_MESSAGES
|
||||
define BUILDSTATUS
|
||||
@echo "BUILDSTATUS $1"
|
||||
@echo 'BUILDSTATUS $1'
|
||||
|
||||
endef
|
||||
endif
|
||||
|
@ -743,22 +743,22 @@ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
|
|||
$(EXPAND_LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
|
||||
ifdef MSMANIFEST_TOOL
|
||||
@if test -f $@.manifest; then \
|
||||
if test -f "$(srcdir)/$@.manifest"; then \
|
||||
echo "Embedding manifest from $(srcdir)/$@.manifest and $@.manifest"; \
|
||||
mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
if test -f '$(srcdir)/$@.manifest'; then \
|
||||
echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
|
||||
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
else \
|
||||
echo "Embedding manifest from $@.manifest"; \
|
||||
echo 'Embedding manifest from $@.manifest'; \
|
||||
mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
fi; \
|
||||
elif test -f "$(srcdir)/$@.manifest"; then \
|
||||
echo "Embedding manifest from $(srcdir)/$@.manifest"; \
|
||||
mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" -OUTPUTRESOURCE:$@\;1; \
|
||||
elif test -f '$(srcdir)/$@.manifest'; then \
|
||||
echo 'Embedding manifest from $(srcdir)/$@.manifest'; \
|
||||
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@\;1; \
|
||||
fi
|
||||
endif # MSVC with manifest tool
|
||||
ifdef MOZ_PROFILE_GENERATE
|
||||
# touch it a few seconds into the future to work around FAT's
|
||||
# 2-second granularity
|
||||
touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
|
||||
touch -t `date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
|
||||
endif
|
||||
else # !WINNT || GNU_CC
|
||||
$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE) $(STLPORT_LIBS)
|
||||
|
@ -778,16 +778,16 @@ ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
|
|||
$(EXPAND_LIBS_EXEC) -- $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
ifdef MSMANIFEST_TOOL
|
||||
@if test -f $@.manifest; then \
|
||||
if test -f "$(srcdir)/$@.manifest"; then \
|
||||
echo "Embedding manifest from $(srcdir)/$@.manifest and $@.manifest"; \
|
||||
mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
if test -f '$(srcdir)/$@.manifest'; then \
|
||||
echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
|
||||
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
else \
|
||||
echo "Embedding manifest from $@.manifest"; \
|
||||
echo 'Embedding manifest from $@.manifest'; \
|
||||
mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
fi; \
|
||||
elif test -f "$(srcdir)/$@.manifest"; then \
|
||||
echo "Embedding manifest from $(srcdir)/$@.manifest"; \
|
||||
mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" -OUTPUTRESOURCE:$@\;1; \
|
||||
elif test -f '$(srcdir)/$@.manifest'; then \
|
||||
echo 'Embedding manifest from $(srcdir)/$@.manifest'; \
|
||||
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@\;1; \
|
||||
fi
|
||||
endif # MSVC with manifest tool
|
||||
else
|
||||
|
@ -932,7 +932,7 @@ ifdef EMBED_MANIFEST_AT
|
|||
endif # EMBED_MANIFEST_AT
|
||||
endif # MSVC with manifest tool
|
||||
ifdef MOZ_PROFILE_GENERATE
|
||||
touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
|
||||
touch -t `date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
|
||||
endif
|
||||
endif # WINNT && !GCC
|
||||
@$(RM) foodummyfilefoo $(DELETE_AFTER_LINK)
|
||||
|
@ -949,14 +949,14 @@ _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
|
|||
|
||||
define MAKE_DEPS_AUTO_CC
|
||||
if test -d $(@D); then \
|
||||
echo "Building deps for $< using Sun Studio cc"; \
|
||||
echo 'Building deps for $< using Sun Studio cc'; \
|
||||
$(CC) $(COMPILE_CFLAGS) -xM $< >$(_MDDEPFILE) ; \
|
||||
$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
|
||||
fi
|
||||
endef
|
||||
define MAKE_DEPS_AUTO_CXX
|
||||
if test -d $(@D); then \
|
||||
echo "Building deps for $< using Sun Studio CC"; \
|
||||
echo 'Building deps for $< using Sun Studio CC'; \
|
||||
$(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \
|
||||
$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
|
||||
fi
|
||||
|
@ -1103,8 +1103,8 @@ ifeq ($(HOST_OS_ARCH),WINNT)
|
|||
# could be a file or a non-existent path, we cannot call 'pwd -W' directly
|
||||
# on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
|
||||
# on it, then merge with the rest of the path.
|
||||
root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\1|")
|
||||
non-root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\2|")
|
||||
root-path = $(shell echo $(1) | sed -e 's|\(/[^/]*\)/\?\(.*\)|\1|')
|
||||
non-root-path = $(shell echo $(1) | sed -e 's|\(/[^/]*\)/\?\(.*\)|\2|')
|
||||
normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(patsubst %/,%,$(shell cd $(call root-path,$(1)) && pwd -W))/$(call non-root-path,$(1)),$(1)))
|
||||
else
|
||||
normalizepath = $(1)
|
||||
|
@ -1178,8 +1178,8 @@ INSTALL_TARGETS += _XPT_NAME
|
|||
|
||||
ifndef NO_INTERFACES_MANIFEST
|
||||
libs:: $(call mkdir_deps,$(FINAL_TARGET)/components)
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPT_NAME)")
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest "manifest components/interfaces.manifest")
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/components/interfaces.manifest 'interfaces $(XPT_NAME)')
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest 'manifest components/interfaces.manifest')
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -1215,7 +1215,7 @@ endif
|
|||
EXTRA_MANIFESTS = $(filter %.manifest,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS))
|
||||
ifneq (,$(EXTRA_MANIFESTS))
|
||||
libs:: $(call mkdir_deps,$(FINAL_TARGET))
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest $(patsubst %,"manifest components/%",$(notdir $(EXTRA_MANIFESTS))))
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest $(patsubst %,'manifest components/%',$(notdir $(EXTRA_MANIFESTS))))
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
@ -1302,7 +1302,7 @@ ifdef XPI_ROOT_APPID
|
|||
# For add-on packaging we may specify that an application
|
||||
# sub-dir should be added to the root chrome manifest with
|
||||
# a specific application id.
|
||||
MAKE_JARS_FLAGS += --root-manifest-entry-appid="$(XPI_ROOT_APPID)"
|
||||
MAKE_JARS_FLAGS += --root-manifest-entry-appid='$(XPI_ROOT_APPID)'
|
||||
endif
|
||||
|
||||
# if DIST_SUBDIR is defined but XPI_ROOT_APPID is not there's
|
||||
|
@ -1339,34 +1339,34 @@ ifneq ($(XPI_PKGNAME),)
|
|||
tools realchrome::
|
||||
ifdef STRIP_XPI
|
||||
ifndef MOZ_DEBUG
|
||||
@echo "Stripping $(XPI_PKGNAME) package directory..."
|
||||
@echo 'Stripping $(XPI_PKGNAME) package directory...'
|
||||
@echo $(FINAL_TARGET)
|
||||
@cd $(FINAL_TARGET) && find . ! -type d \
|
||||
! -name "*.js" \
|
||||
! -name "*.xpt" \
|
||||
! -name "*.gif" \
|
||||
! -name "*.jpg" \
|
||||
! -name "*.png" \
|
||||
! -name "*.xpm" \
|
||||
! -name "*.txt" \
|
||||
! -name "*.rdf" \
|
||||
! -name "*.sh" \
|
||||
! -name "*.properties" \
|
||||
! -name "*.dtd" \
|
||||
! -name "*.html" \
|
||||
! -name "*.xul" \
|
||||
! -name "*.css" \
|
||||
! -name "*.xml" \
|
||||
! -name "*.jar" \
|
||||
! -name "*.dat" \
|
||||
! -name "*.tbl" \
|
||||
! -name "*.src" \
|
||||
! -name "*.reg" \
|
||||
! -name '*.js' \
|
||||
! -name '*.xpt' \
|
||||
! -name '*.gif' \
|
||||
! -name '*.jpg' \
|
||||
! -name '*.png' \
|
||||
! -name '*.xpm' \
|
||||
! -name '*.txt' \
|
||||
! -name '*.rdf' \
|
||||
! -name '*.sh' \
|
||||
! -name '*.properties' \
|
||||
! -name '*.dtd' \
|
||||
! -name '*.html' \
|
||||
! -name '*.xul' \
|
||||
! -name '*.css' \
|
||||
! -name '*.xml' \
|
||||
! -name '*.jar' \
|
||||
! -name '*.dat' \
|
||||
! -name '*.tbl' \
|
||||
! -name '*.src' \
|
||||
! -name '*.reg' \
|
||||
$(PLATFORM_EXCLUDE_LIST) \
|
||||
-exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \;
|
||||
endif
|
||||
endif
|
||||
@echo "Packaging $(XPI_PKGNAME).xpi..."
|
||||
@echo 'Packaging $(XPI_PKGNAME).xpi...'
|
||||
cd $(FINAL_TARGET) && $(ZIP) -qr ../$(XPI_PKGNAME).xpi *
|
||||
endif
|
||||
|
||||
|
@ -1376,8 +1376,8 @@ $(error XPI_NAME must be set for INSTALL_EXTENSION_ID)
|
|||
endif
|
||||
|
||||
tools::
|
||||
$(RM) -r "$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)"
|
||||
$(NSINSTALL) -D "$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)"
|
||||
$(RM) -r '$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
|
||||
$(NSINSTALL) -D '$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
|
||||
$(call copy_dir,$(FINAL_TARGET),$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID))
|
||||
|
||||
endif
|
||||
|
@ -1499,11 +1499,11 @@ install_targets_sanity = $(if $(filter-out $(notdir $@),$(notdir $(<))),$(error
|
|||
|
||||
$(sort $(foreach tier,$(INSTALL_TARGETS_TIERS),$(INSTALL_TARGETS_FILES_$(tier)))):
|
||||
$(install_targets_sanity)
|
||||
$(call install_cmd,$(IFLAGS1) "$<" "$(@D)")
|
||||
$(call install_cmd,$(IFLAGS1) '$<' '$(@D)')
|
||||
|
||||
$(sort $(foreach tier,$(INSTALL_TARGETS_TIERS),$(INSTALL_TARGETS_EXECUTABLES_$(tier)))):
|
||||
$(install_targets_sanity)
|
||||
$(call install_cmd,$(IFLAGS2) "$<" "$(@D)")
|
||||
$(call install_cmd,$(IFLAGS2) '$<' '$(@D)')
|
||||
|
||||
################################################################################
|
||||
# Preprocessing rules
|
||||
|
@ -1564,8 +1564,8 @@ $(foreach tier,$(PP_TARGETS_TIERS), \
|
|||
PP_TARGETS_ALL_RESULTS := $(sort $(foreach tier,$(PP_TARGETS_TIERS),$(PP_TARGETS_RESULTS_$(tier))))
|
||||
$(PP_TARGETS_ALL_RESULTS):
|
||||
$(if $(filter-out $(notdir $@),$(notdir $(<:.in=))),$(error Looks like $@ has an unexpected dependency on $< which breaks PP_TARGETS))
|
||||
$(RM) "$@"
|
||||
$(call py_action,preprocessor,--depend $(MDDEPDIR)/$(@F).pp $(PP_TARGET_FLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) "$<" -o "$@")
|
||||
$(RM) '$@'
|
||||
$(call py_action,preprocessor,--depend $(MDDEPDIR)/$(@F).pp $(PP_TARGET_FLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) '$<' -o '$@')
|
||||
|
||||
# The depfile is based on the filename, and we don't want conflicts. So check
|
||||
# there's only one occurrence of any given filename in PP_TARGETS_ALL_RESULTS.
|
||||
|
|
|
@ -413,6 +413,19 @@ freetype/ftsizes.h
|
|||
freetype/ftadvanc.h
|
||||
freetype/ftbitmap.h
|
||||
freetype/ftxf86.h
|
||||
freetype.h
|
||||
ftcache.h
|
||||
ftglyph.h
|
||||
ftsynth.h
|
||||
ftoutln.h
|
||||
ttnameid.h
|
||||
tttables.h
|
||||
t1tables.h
|
||||
ftlcdfil.h
|
||||
ftsizes.h
|
||||
ftadvanc.h
|
||||
ftbitmap.h
|
||||
ftxf86.h
|
||||
fribidi/fribidi.h
|
||||
FSp_fopen.h
|
||||
fstream
|
||||
|
|
|
@ -21,16 +21,16 @@ REF_MANIFEST = $(if $(USE_EXTENSION_MANIFEST),chrome.manifest,test.manifest)
|
|||
check-%::
|
||||
if test -d $(FINAL_TARGET); then rm -rf $(FINAL_TARGET); fi;
|
||||
$(MAKE) realchrome MOZ_CHROME_FILE_FORMAT=$*
|
||||
@echo "Comparing manifests..."
|
||||
@echo 'Comparing manifests...'
|
||||
@if ! sort $(MY_MANIFEST) | diff --text -U 0 $(srcdir)/../$(REF_MANIFEST).$* - ; then \
|
||||
echo "TEST-UNEXPECTED-FAIL | config/tests/$(REF_MANIFEST).$* | differing content in manifest!" ; \
|
||||
echo 'TEST-UNEXPECTED-FAIL | config/tests/$(REF_MANIFEST).$* | differing content in manifest!' ; \
|
||||
false; \
|
||||
fi
|
||||
@if [ $* = "jar" ]; then \
|
||||
@if [ $* = 'jar' ]; then \
|
||||
$(UNZIP) -d $(FINAL_TARGET)/chrome/test $(FINAL_TARGET)/chrome/test.jar; \
|
||||
fi
|
||||
@echo "Comparing packages..."
|
||||
@echo 'Comparing packages...'
|
||||
@if ! diff -ur $(srcdir)/../ref-simple $(FINAL_TARGET)/chrome/test ; then\
|
||||
echo "TEST-UNEXPECTED-FAIL | config/tests/ref-simple | different content in jar" ; \
|
||||
echo 'TEST-UNEXPECTED-FAIL | config/tests/ref-simple | different content in jar' ; \
|
||||
false; \
|
||||
fi
|
||||
|
|
|
@ -1695,7 +1695,7 @@ case "$host" in
|
|||
*mingw*)
|
||||
if test -n "$_WIN32_MSVC"; then
|
||||
HOST_AR=lib
|
||||
HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
|
||||
HOST_AR_FLAGS='-NOLOGO -OUT:$@'
|
||||
HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
|
||||
HOST_RANLIB='echo ranlib'
|
||||
else
|
||||
|
@ -2051,7 +2051,7 @@ ia64*-hpux*)
|
|||
AS="$(basename "$AS_BIN")"
|
||||
fi
|
||||
AR='lib'
|
||||
AR_FLAGS='-NOLOGO -OUT:"$@"'
|
||||
AR_FLAGS='-NOLOGO -OUT:$@'
|
||||
AR_EXTRACT=
|
||||
RANLIB='echo not_ranlib'
|
||||
STRIP='echo not_strip'
|
||||
|
|
|
@ -127,6 +127,7 @@
|
|||
#include "mozilla/dom/HTMLTemplateElement.h"
|
||||
|
||||
#include "nsStyledElement.h"
|
||||
#include "nsIContentInlines.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
|
|
@ -171,10 +171,11 @@ static const char* const gWebMTypes[3] = {
|
|||
nullptr
|
||||
};
|
||||
|
||||
static char const *const gWebMCodecs[4] = {
|
||||
static char const *const gWebMCodecs[5] = {
|
||||
"vp8",
|
||||
"vp8.0",
|
||||
"vorbis",
|
||||
"opus",
|
||||
nullptr
|
||||
};
|
||||
|
||||
|
|
|
@ -5,11 +5,16 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include "nsMemory.h"
|
||||
#include "MP3FrameParser.h"
|
||||
#include "VideoUtils.h"
|
||||
|
||||
|
||||
#define FROM_BIG_ENDIAN(X) ((uint32_t)((uint8_t)(X)[0] << 24 | (uint8_t)(X)[1] << 16 | \
|
||||
(uint8_t)(X)[2] << 8 | (uint8_t)(X)[3]))
|
||||
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
/*
|
||||
|
@ -161,6 +166,13 @@ MP3Parser::GetSampleRate()
|
|||
return mpeg_srates[frame.mVersion][frame.mSampleRate];
|
||||
}
|
||||
|
||||
uint32_t
|
||||
MP3Parser::GetSamplesPerFrame()
|
||||
{
|
||||
MP3Frame &frame = mData.mFrame;
|
||||
return mpeg_frame_samples[frame.mVersion][frame.mLayer];
|
||||
}
|
||||
|
||||
|
||||
/** ID3Parser methods **/
|
||||
|
||||
|
@ -222,12 +234,73 @@ ID3Parser::GetHeaderLength() const
|
|||
}
|
||||
|
||||
|
||||
/** VBR header helper stuff **/
|
||||
|
||||
// Helper function to find a VBR header in an MP3 frame.
|
||||
// Based on information from
|
||||
// http://www.codeproject.com/Articles/8295/MPEG-Audio-Frame-Header
|
||||
|
||||
const uint32_t VBRI_TAG = FROM_BIG_ENDIAN("VBRI");
|
||||
const uint32_t VBRI_OFFSET = 32 - sizeof(MP3Frame);
|
||||
const uint32_t VBRI_FRAME_COUNT_OFFSET = VBRI_OFFSET + 14;
|
||||
const uint32_t VBRI_MIN_FRAME_SIZE = VBRI_OFFSET + 26;
|
||||
|
||||
const uint32_t XING_TAG = FROM_BIG_ENDIAN("Xing");
|
||||
enum XingFlags {
|
||||
XING_HAS_NUM_FRAMES = 0x01,
|
||||
XING_HAS_NUM_BYTES = 0x02,
|
||||
XING_HAS_TOC = 0x04,
|
||||
XING_HAS_VBR_SCALE = 0x08
|
||||
};
|
||||
|
||||
static int64_t
|
||||
ParseXing(const char *aBuffer)
|
||||
{
|
||||
uint32_t flags = FROM_BIG_ENDIAN(aBuffer + 4);
|
||||
|
||||
if (!(flags & XING_HAS_NUM_FRAMES)) {
|
||||
NS_WARNING("VBR file without frame count. Duration estimation likely to "
|
||||
"be totally wrong.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
int64_t numFrames = -1;
|
||||
if (flags & XING_HAS_NUM_FRAMES) {
|
||||
numFrames = FROM_BIG_ENDIAN(aBuffer + 8);
|
||||
}
|
||||
|
||||
return numFrames;
|
||||
}
|
||||
|
||||
static int64_t
|
||||
FindNumVBRFrames(const nsAutoCString& aFrame)
|
||||
{
|
||||
const char *buffer = aFrame.get();
|
||||
const char *bufferEnd = aFrame.get() + aFrame.Length();
|
||||
|
||||
// VBRI header is nice and well-defined; let's try to find that first.
|
||||
if (aFrame.Length() > VBRI_MIN_FRAME_SIZE &&
|
||||
FROM_BIG_ENDIAN(buffer + VBRI_OFFSET) == VBRI_TAG) {
|
||||
return FROM_BIG_ENDIAN(buffer + VBRI_FRAME_COUNT_OFFSET);
|
||||
}
|
||||
|
||||
// We have to search for the Xing header as its position can change.
|
||||
for (; buffer + sizeof(XING_TAG) < bufferEnd; buffer++) {
|
||||
if (FROM_BIG_ENDIAN(buffer) == XING_TAG) {
|
||||
return ParseXing(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
/** MP3FrameParser methods **/
|
||||
|
||||
// Some MP3's have large ID3v2 tags, up to 150KB, so we allow lots of
|
||||
// skipped bytes to be read, just in case, before we give up and assume
|
||||
// we're not parsing an MP3 stream.
|
||||
static const uint32_t MAX_SKIPPED_BYTES = 200 * 1024;
|
||||
static const uint32_t MAX_SKIPPED_BYTES = 4096;
|
||||
|
||||
// The number of audio samples per MP3 frame. This is constant over all MP3
|
||||
// streams. With this constant, the stream's sample rate, and an estimated
|
||||
|
@ -241,12 +314,14 @@ enum {
|
|||
|
||||
MP3FrameParser::MP3FrameParser(int64_t aLength)
|
||||
: mLock("MP3FrameParser.mLock"),
|
||||
mTotalID3Size(0),
|
||||
mTotalFrameSize(0),
|
||||
mNumFrames(0),
|
||||
mFrameCount(0),
|
||||
mOffset(0),
|
||||
mLength(aLength),
|
||||
mMP3Offset(-1),
|
||||
mSampleRate(0),
|
||||
mSamplesPerSecond(0),
|
||||
mFirstFrameEnd(-1),
|
||||
mIsMP3(MAYBE_MP3)
|
||||
{ }
|
||||
|
||||
|
@ -257,7 +332,6 @@ nsresult MP3FrameParser::ParseBuffer(const uint8_t* aBuffer,
|
|||
{
|
||||
// Iterate forwards over the buffer, looking for ID3 tag, or MP3
|
||||
// Frame headers.
|
||||
|
||||
const uint8_t *buffer = aBuffer;
|
||||
const uint8_t *bufferEnd = aBuffer + aLength;
|
||||
|
||||
|
@ -271,6 +345,8 @@ nsresult MP3FrameParser::ParseBuffer(const uint8_t* aBuffer,
|
|||
buffer = ch + mID3Parser.GetHeaderLength() - (ID3_HEADER_LENGTH - 1);
|
||||
ch = buffer;
|
||||
|
||||
mTotalID3Size += mID3Parser.GetHeaderLength();
|
||||
|
||||
// Yes, this is an MP3!
|
||||
mIsMP3 = DEFINITELY_MP3;
|
||||
|
||||
|
@ -279,43 +355,95 @@ nsresult MP3FrameParser::ParseBuffer(const uint8_t* aBuffer,
|
|||
}
|
||||
}
|
||||
|
||||
// The first MP3 frame in a variable bitrate stream can contain metadata
|
||||
// for duration estimation and seeking, so we buffer that first frame here.
|
||||
if (aStreamOffset < mFirstFrameEnd) {
|
||||
uint64_t copyLen = std::min((int64_t)aLength, mFirstFrameEnd - aStreamOffset);
|
||||
mFirstFrame.Append((const char *)buffer, copyLen);
|
||||
buffer += copyLen;
|
||||
}
|
||||
|
||||
while (buffer < bufferEnd) {
|
||||
uint16_t frameLen = mMP3Parser.ParseFrameLength(*buffer);
|
||||
|
||||
if (frameLen) {
|
||||
// We've found an MP3 frame!
|
||||
// This is the first frame (and the only one we'll bother parsing), so:
|
||||
// * Mark this stream as MP3;
|
||||
// * Store the offset at which the MP3 data started; and
|
||||
// * Start buffering the frame, as it might contain handy metadata.
|
||||
|
||||
if (mMP3Offset < 0) {
|
||||
// Found our first frame: mark this stream as MP3 and let the decoder
|
||||
// know where in the stream the MP3 data starts.
|
||||
mIsMP3 = DEFINITELY_MP3;
|
||||
// We're at the last byte of an MP3Frame, so MP3 data started
|
||||
// sizeof - 1 bytes ago.
|
||||
mMP3Offset = aStreamOffset
|
||||
+ (buffer - aBuffer)
|
||||
- (sizeof(MP3Frame) - 1);
|
||||
// We're now sure this is an MP3 stream.
|
||||
mIsMP3 = DEFINITELY_MP3;
|
||||
|
||||
// We need to know these to convert the number of frames in the stream
|
||||
// to the length of the stream in seconds.
|
||||
mSamplesPerSecond = mMP3Parser.GetSampleRate();
|
||||
mSamplesPerFrame = mMP3Parser.GetSamplesPerFrame();
|
||||
|
||||
// If the stream has a constant bitrate, we should only need the length
|
||||
// of the first frame and the length (in bytes) of the stream to
|
||||
// estimate the length (in seconds).
|
||||
mTotalFrameSize += frameLen;
|
||||
mFrameCount++;
|
||||
|
||||
// If |mMP3Offset| isn't set then this is the first MP3 frame we have
|
||||
// seen in the stream, which is useful for duration estimation.
|
||||
if (mMP3Offset > -1) {
|
||||
uint16_t skip = frameLen - sizeof(MP3Frame);
|
||||
buffer += skip ? skip : 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
mSampleRate = mMP3Parser.GetSampleRate();
|
||||
mTotalFrameSize += frameLen;
|
||||
mNumFrames++;
|
||||
// Remember the offset of the MP3 stream.
|
||||
// We're at the last byte of an MP3Frame, so MP3 data started
|
||||
// sizeof(MP3Frame) - 1 bytes ago.
|
||||
mMP3Offset = aStreamOffset
|
||||
+ (buffer - aBuffer)
|
||||
- (sizeof(MP3Frame) - 1);
|
||||
|
||||
buffer++;
|
||||
|
||||
// If the stream has a variable bitrate, the first frame has metadata
|
||||
// we need for duration estimation and seeking. Start buffering it so we
|
||||
// can parse it later.
|
||||
mFirstFrameEnd = mMP3Offset + frameLen;
|
||||
uint64_t currOffset = buffer - aBuffer + aStreamOffset;
|
||||
uint64_t copyLen = std::min(mFirstFrameEnd - currOffset,
|
||||
(uint64_t)(bufferEnd - buffer));
|
||||
mFirstFrame.Append((const char *)buffer, copyLen);
|
||||
|
||||
buffer += copyLen;
|
||||
|
||||
buffer += frameLen - sizeof(MP3Frame);
|
||||
} else {
|
||||
// Nothing to see here. Move along.
|
||||
buffer++;
|
||||
}
|
||||
}
|
||||
|
||||
*aOutBytesRead = buffer - aBuffer;
|
||||
|
||||
if (mFirstFrameEnd > -1 && mFirstFrameEnd <= aStreamOffset + buffer - aBuffer) {
|
||||
// We have our whole first frame. Try to find a VBR header.
|
||||
mNumFrames = FindNumVBRFrames(mFirstFrame);
|
||||
mFirstFrameEnd = -1;
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
void MP3FrameParser::Parse(const char* aBuffer, uint32_t aLength, int64_t aOffset)
|
||||
void MP3FrameParser::Parse(const char* aBuffer, uint32_t aLength, uint64_t aOffset)
|
||||
{
|
||||
MutexAutoLock mon(mLock);
|
||||
|
||||
if (HasExactDuration()) {
|
||||
// We know the duration; nothing to do here.
|
||||
return;
|
||||
}
|
||||
|
||||
const uint8_t* buffer = reinterpret_cast<const uint8_t*>(aBuffer);
|
||||
int32_t length = aLength;
|
||||
int64_t offset = aOffset;
|
||||
uint64_t offset = aOffset;
|
||||
|
||||
// Got some data we have seen already. Skip forward to what we need.
|
||||
if (aOffset < mOffset) {
|
||||
|
@ -335,6 +463,12 @@ void MP3FrameParser::Parse(const char* aBuffer, uint32_t aLength, int64_t aOffse
|
|||
// Only reset this if it hasn't finished yet.
|
||||
mID3Parser.Reset();
|
||||
}
|
||||
|
||||
if (mFirstFrameEnd > -1) {
|
||||
NS_WARNING("Discontinuity in input while buffering first frame.");
|
||||
mFirstFrameEnd = -1;
|
||||
}
|
||||
|
||||
mMP3Parser.Reset();
|
||||
}
|
||||
|
||||
|
@ -352,7 +486,10 @@ void MP3FrameParser::Parse(const char* aBuffer, uint32_t aLength, int64_t aOffse
|
|||
mOffset = offset + bytesRead;
|
||||
|
||||
// If we've parsed lots of data and we still have nothing, just give up.
|
||||
if (!mID3Parser.IsParsed() && !mNumFrames && mOffset > MAX_SKIPPED_BYTES) {
|
||||
// We don't count ID3 headers towards that count, as MP3 files can have
|
||||
// massive ID3 sections.
|
||||
if (!mID3Parser.IsParsed() && mMP3Offset < 0 &&
|
||||
mOffset - mTotalID3Size > MAX_SKIPPED_BYTES) {
|
||||
mIsMP3 = NOT_MP3;
|
||||
}
|
||||
}
|
||||
|
@ -361,22 +498,25 @@ int64_t MP3FrameParser::GetDuration()
|
|||
{
|
||||
MutexAutoLock mon(mLock);
|
||||
|
||||
if (!mNumFrames || !mSampleRate) {
|
||||
if (mMP3Offset < 0) {
|
||||
return -1; // Not a single frame decoded yet
|
||||
}
|
||||
|
||||
// Estimate the total number of frames in the file from the average frame
|
||||
// size we've seen so far, and the length of the file.
|
||||
double avgFrameSize = (double)mTotalFrameSize / mNumFrames;
|
||||
|
||||
// Need to cut out the header here. Ignore everything up to the first MP3
|
||||
// frames.
|
||||
double estimatedFrames = (double)(mLength - mMP3Offset) / avgFrameSize;
|
||||
double frames;
|
||||
if (mNumFrames < 0) {
|
||||
// Estimate the number of frames in the stream based on the average frame
|
||||
// size and the length of the MP3 file.
|
||||
double frameSize = (double)mTotalFrameSize / mFrameCount;
|
||||
frames = (double)(mLength - mMP3Offset) / frameSize;
|
||||
} else {
|
||||
// We know the exact number of frames from the VBR header.
|
||||
frames = mNumFrames;
|
||||
}
|
||||
|
||||
// The duration of each frame is constant over a given stream.
|
||||
double usPerFrame = USECS_PER_S * SAMPLES_PER_FRAME / mSampleRate;
|
||||
double usPerFrame = USECS_PER_S * mSamplesPerFrame / mSamplesPerSecond;
|
||||
|
||||
return estimatedFrames * usPerFrame;
|
||||
return frames * usPerFrame;
|
||||
}
|
||||
|
||||
int64_t MP3FrameParser::GetMP3Offset()
|
||||
|
@ -385,4 +525,24 @@ int64_t MP3FrameParser::GetMP3Offset()
|
|||
return mMP3Offset;
|
||||
}
|
||||
|
||||
bool MP3FrameParser::ParsedHeaders()
|
||||
{
|
||||
// We have seen both the beginning and the end of the first MP3 frame in the
|
||||
// stream.
|
||||
return mMP3Offset > -1 && mFirstFrameEnd < 0;
|
||||
}
|
||||
|
||||
bool MP3FrameParser::HasExactDuration()
|
||||
{
|
||||
return ParsedHeaders() && mNumFrames > -1;
|
||||
}
|
||||
|
||||
bool MP3FrameParser::NeedsData()
|
||||
{
|
||||
// If we don't know the duration exactly then either:
|
||||
// - we're still waiting for a VBR header; or
|
||||
// - we look at all frames to constantly update our duration estimate.
|
||||
return IsMP3() && !HasExactDuration();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -5,7 +5,9 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include "mozilla/Mutex.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
|
@ -57,6 +59,9 @@ public:
|
|||
// Get the sample rate from the current header.
|
||||
uint32_t GetSampleRate();
|
||||
|
||||
// Get the number of samples per frame.
|
||||
uint32_t GetSamplesPerFrame();
|
||||
|
||||
private:
|
||||
uint32_t mCurrentChar;
|
||||
union {
|
||||
|
@ -102,7 +107,7 @@ public:
|
|||
return mIsMP3 != NOT_MP3;
|
||||
}
|
||||
|
||||
void Parse(const char* aBuffer, uint32_t aLength, int64_t aStreamOffset);
|
||||
void Parse(const char* aBuffer, uint32_t aLength, uint64_t aStreamOffset);
|
||||
|
||||
// Returns the duration, in microseconds. If the entire stream has not
|
||||
// been parsed yet, this is an estimate based on the bitrate of the
|
||||
|
@ -113,6 +118,18 @@ public:
|
|||
// no MP3 frame has been detected yet.
|
||||
int64_t GetMP3Offset();
|
||||
|
||||
// Returns true if we've seen the whole first frame of the MP3 stream, and
|
||||
// therefore can make an estimate on the stream duration.
|
||||
// Otherwise, returns false.
|
||||
bool ParsedHeaders();
|
||||
|
||||
// Returns true if we know the exact duration of the MP3 stream;
|
||||
// false otherwise.
|
||||
bool HasExactDuration();
|
||||
|
||||
// Returns true if the parser needs more data for duration estimation.
|
||||
bool NeedsData();
|
||||
|
||||
private:
|
||||
|
||||
// Parses aBuffer, starting at offset 0. Returns the number of bytes
|
||||
|
@ -135,24 +152,47 @@ private:
|
|||
// MP3 frame header parser.
|
||||
MP3Parser mMP3Parser;
|
||||
|
||||
// If we read |MAX_SKIPPED_BYTES| from the stream without finding any MP3
|
||||
// frames, we give up and report |NOT_MP3|. Here we track the cumulative size
|
||||
// of any ID3 headers we've seen so big ID3 sections aren't counted towards
|
||||
// skipped bytes.
|
||||
uint32_t mTotalID3Size;
|
||||
|
||||
// All fields below are protected by mLock
|
||||
|
||||
// We keep stats on the size of all the frames we've seen, as well as how many
|
||||
// so that we can estimate the duration of the rest of the stream.
|
||||
uint64_t mTotalFrameSize;
|
||||
uint64_t mNumFrames;
|
||||
uint64_t mFrameCount;
|
||||
|
||||
// Offset of the last data parsed. This is the end offset of the last data
|
||||
// block parsed, so it's the start offset we expect to get on the next
|
||||
// call to Parse().
|
||||
int64_t mOffset;
|
||||
uint64_t mOffset;
|
||||
|
||||
// Total length of the stream in bytes.
|
||||
int64_t mLength;
|
||||
int64_t mLength;
|
||||
|
||||
// Offset of first MP3 frame in the bitstream. Has value -1 until the
|
||||
// first MP3 frame is found.
|
||||
int64_t mMP3Offset;
|
||||
|
||||
// Number of audio samples per second. Fixed through the whole file.
|
||||
uint16_t mSampleRate;
|
||||
// The exact number of frames in this stream, if we know it. -1 otherwise.
|
||||
int64_t mNumFrames;
|
||||
|
||||
// Number of audio samples per second and per frame. Fixed through the whole
|
||||
// file. If we know these variables as well as the number of frames in the
|
||||
// file, we can get an exact duration for the stream.
|
||||
uint16_t mSamplesPerSecond;
|
||||
uint16_t mSamplesPerFrame;
|
||||
|
||||
// If the MP3 has a variable bitrate, then there *should* be metadata about
|
||||
// the encoding in the first frame. We buffer the first frame here.
|
||||
nsAutoCString mFirstFrame;
|
||||
|
||||
// While we are reading the first frame, this is the stream offset of the
|
||||
// last byte of that frame. -1 at all other times.
|
||||
int64_t mFirstFrameEnd;
|
||||
|
||||
enum eIsMP3 {
|
||||
MAYBE_MP3, // We're giving the stream the benefit of the doubt...
|
||||
|
|
|
@ -86,17 +86,12 @@ static void _AudioSampleCallback(void *aThis,
|
|||
* put it in |aData|, and return true.
|
||||
* Otherwise, put as much data as is left into |aData|, set |aNumBytes| to the
|
||||
* amount of data we have left, and return false.
|
||||
*
|
||||
* This function also passes the read data on to the MP3 frame parser for
|
||||
* stream duration estimation.
|
||||
*/
|
||||
nsresult
|
||||
AppleMP3Reader::ReadAndNotify(uint32_t *aNumBytes, char *aData)
|
||||
AppleMP3Reader::Read(uint32_t *aNumBytes, char *aData)
|
||||
{
|
||||
MediaResource *resource = mDecoder->GetResource();
|
||||
|
||||
uint64_t offset = resource->Tell();
|
||||
|
||||
// Loop until we have all the data asked for, or we've reached EOS
|
||||
uint32_t totalBytes = 0;
|
||||
uint32_t numBytes;
|
||||
|
@ -111,18 +106,6 @@ AppleMP3Reader::ReadAndNotify(uint32_t *aNumBytes, char *aData)
|
|||
}
|
||||
} while(totalBytes < *aNumBytes && numBytes);
|
||||
|
||||
// Pass the buffer to the MP3 frame parser to improve our duration estimate.
|
||||
if (mMP3FrameParser.IsMP3()) {
|
||||
mMP3FrameParser.Parse(aData, totalBytes, offset);
|
||||
uint64_t duration = mMP3FrameParser.GetDuration();
|
||||
if (duration != mDuration) {
|
||||
LOGD("Updating media duration to %lluus\n", duration);
|
||||
mDuration = duration;
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mDecoder->UpdateEstimatedMediaDuration(duration);
|
||||
}
|
||||
}
|
||||
|
||||
*aNumBytes = totalBytes;
|
||||
|
||||
// We will have read some data in the last iteration iff we filled the buffer.
|
||||
|
@ -286,7 +269,7 @@ AppleMP3Reader::DecodeAudioData()
|
|||
char bytes[AUDIO_READ_BYTES];
|
||||
uint32_t numBytes = AUDIO_READ_BYTES;
|
||||
|
||||
nsresult readrv = ReadAndNotify(&numBytes, bytes);
|
||||
nsresult readrv = Read(&numBytes, bytes);
|
||||
|
||||
// This function calls |AudioSampleCallback| above, synchronously, when it
|
||||
// finds compressed MP3 frame.
|
||||
|
@ -374,16 +357,21 @@ AppleMP3Reader::ReadMetadata(MediaInfo* aInfo,
|
|||
*/
|
||||
OSStatus rv;
|
||||
nsresult readrv;
|
||||
uint32_t offset = 0;
|
||||
do {
|
||||
char bytes[AUDIO_READ_BYTES];
|
||||
uint32_t numBytes = AUDIO_READ_BYTES;
|
||||
readrv = ReadAndNotify(&numBytes, bytes);
|
||||
readrv = Read(&numBytes, bytes);
|
||||
|
||||
rv = AudioFileStreamParseBytes(mAudioFileStream,
|
||||
numBytes,
|
||||
bytes,
|
||||
0 /* flags */);
|
||||
|
||||
mMP3FrameParser.Parse(bytes, numBytes, offset);
|
||||
|
||||
offset += numBytes;
|
||||
|
||||
// We have to do our decoder setup from the callback. When it's done it will
|
||||
// set mStreamReady.
|
||||
} while (!mStreamReady && !rv && NS_SUCCEEDED(readrv));
|
||||
|
@ -398,12 +386,18 @@ AppleMP3Reader::ReadMetadata(MediaInfo* aInfo,
|
|||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
if (!mMP3FrameParser.IsMP3()) {
|
||||
LOGE("Frame parser failed to parse MP3 stream\n");
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
aInfo->mAudio.mRate = mAudioSampleRate;
|
||||
aInfo->mAudio.mChannels = mAudioChannels;
|
||||
aInfo->mAudio.mHasAudio = mStreamReady;
|
||||
|
||||
{
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mDuration = mMP3FrameParser.GetDuration();
|
||||
mDecoder->SetMediaDuration(mDuration);
|
||||
}
|
||||
|
||||
|
@ -515,4 +509,25 @@ AppleMP3Reader::Seek(int64_t aTime,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
void
|
||||
AppleMP3Reader::NotifyDataArrived(const char* aBuffer,
|
||||
uint32_t aLength,
|
||||
int64_t aOffset)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
if (!mMP3FrameParser.NeedsData()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mMP3FrameParser.Parse(aBuffer, aLength, aOffset);
|
||||
|
||||
uint64_t duration = mMP3FrameParser.GetDuration();
|
||||
if (duration != mDuration) {
|
||||
LOGD("Updating media duration to %lluus\n", duration);
|
||||
mDuration = duration;
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mDecoder->UpdateEstimatedMediaDuration(duration);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -47,9 +47,13 @@ public:
|
|||
AudioFileStreamPropertyID aPropertyID,
|
||||
UInt32 *aFlags);
|
||||
|
||||
virtual void NotifyDataArrived(const char* aBuffer,
|
||||
uint32_t aLength,
|
||||
int64_t aOffset) MOZ_OVERRIDE;
|
||||
|
||||
private:
|
||||
void SetupDecoder();
|
||||
nsresult ReadAndNotify(uint32_t *aNumBytes, char *aData);
|
||||
nsresult Read(uint32_t *aNumBytes, char *aData);
|
||||
|
||||
static OSStatus PassthroughInputDataCallback(AudioConverterRef aAudioConverter,
|
||||
UInt32 *aNumDataPackets,
|
||||
|
|
|
@ -67,6 +67,29 @@ DirectShowReader::Init(MediaDecoderReader* aCloneDonor)
|
|||
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.
|
||||
static nsresult
|
||||
ParseMP3Headers(MP3FrameParser *aParser, MediaResource *aResource)
|
||||
{
|
||||
const uint32_t MAX_READ_SIZE = 4096;
|
||||
|
||||
uint64_t offset = 0;
|
||||
while (aParser->NeedsData() && !aParser->ParsedHeaders()) {
|
||||
uint32_t bytesRead;
|
||||
char buffer[MAX_READ_SIZE];
|
||||
nsresult rv = aResource->ReadAt(offset, buffer,
|
||||
MAX_READ_SIZE, &bytesRead);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
aParser->Parse(buffer, bytesRead, offset);
|
||||
offset += bytesRead;
|
||||
}
|
||||
|
||||
return aParser->IsMP3() ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
// Windows XP's MP3 decoder filter. This is available on XP only, on Vista
|
||||
// and later we can use the DMO Wrapper filter and MP3 decoder DMO.
|
||||
static const GUID CLSID_MPEG_LAYER_3_DECODER_FILTER =
|
||||
|
@ -89,6 +112,9 @@ DirectShowReader::ReadMetadata(MediaInfo* aInfo,
|
|||
reinterpret_cast<void**>(static_cast<IGraphBuilder**>(byRef(mGraph))));
|
||||
NS_ENSURE_TRUE(SUCCEEDED(hr) && mGraph, NS_ERROR_FAILURE);
|
||||
|
||||
rv = ParseMP3Headers(&mMP3FrameParser, mDecoder->GetResource());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
#ifdef DEBUG
|
||||
// Add the graph to the Running Object Table so that we can connect
|
||||
// to this graph with GraphEdit/GraphStudio. Note: on Vista and up you must
|
||||
|
@ -113,7 +139,7 @@ DirectShowReader::ReadMetadata(MediaInfo* aInfo,
|
|||
mSourceFilter = new SourceFilter(MEDIATYPE_Stream, MEDIASUBTYPE_MPEG1Audio);
|
||||
NS_ENSURE_TRUE(mSourceFilter, NS_ERROR_FAILURE);
|
||||
|
||||
rv = mSourceFilter->Init(mDecoder->GetResource());
|
||||
rv = mSourceFilter->Init(mDecoder->GetResource(), mMP3FrameParser.GetMP3Offset());
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
hr = mGraph->AddFilter(mSourceFilter, L"MozillaDirectShowSource");
|
||||
|
@ -184,11 +210,10 @@ DirectShowReader::ReadMetadata(MediaInfo* aInfo,
|
|||
mDecoder->SetMediaSeekable(false);
|
||||
}
|
||||
|
||||
int64_t duration = 0;
|
||||
hr = mMediaSeeking->GetDuration(&duration);
|
||||
int64_t duration = mMP3FrameParser.GetDuration();
|
||||
if (SUCCEEDED(hr)) {
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mDecoder->SetMediaDuration(RefTimeToUsecs(duration));
|
||||
mDecoder->SetMediaDuration(duration);
|
||||
}
|
||||
|
||||
LOG("Successfully initialized DirectShow MP3 decoder.");
|
||||
|
|
|
@ -668,73 +668,15 @@ SourceFilter::GetMediaType() const
|
|||
return &mMediaType;
|
||||
}
|
||||
|
||||
static uint32_t
|
||||
Read(MediaResource* aResource,
|
||||
const int64_t aOffset,
|
||||
char* aBuffer,
|
||||
const uint32_t aBytesToRead)
|
||||
{
|
||||
uint32_t totalBytesRead = 0;
|
||||
while (totalBytesRead < aBytesToRead) {
|
||||
uint32_t bytesRead = 0;
|
||||
nsresult rv = aResource->ReadAt(aOffset + totalBytesRead,
|
||||
aBuffer+totalBytesRead,
|
||||
aBytesToRead-totalBytesRead,
|
||||
&bytesRead);
|
||||
if (NS_FAILED(rv) || bytesRead == 0) {
|
||||
// Error or end of stream?
|
||||
break;
|
||||
}
|
||||
totalBytesRead += bytesRead;
|
||||
}
|
||||
return totalBytesRead;
|
||||
}
|
||||
|
||||
// Parses the MP3 stream and returns the offset of the first MP3
|
||||
// sync frame after the ID3v2 headers. This is used to trim off
|
||||
// the ID3v2 headers, as DirectShow can't handle large ID3v2 tags.
|
||||
static nsresult
|
||||
GetMP3DataOffset(MediaResource* aResource, int64_t* aOutOffset)
|
||||
{
|
||||
MP3FrameParser parser;
|
||||
int64_t offset = 0;
|
||||
const uint32_t len = 1024;
|
||||
char buffer[len];
|
||||
do {
|
||||
uint32_t bytesRead = Read(aResource, offset, buffer, len);
|
||||
if (bytesRead == 0) {
|
||||
break;
|
||||
}
|
||||
parser.Parse(buffer, bytesRead, offset);
|
||||
offset += bytesRead;
|
||||
} while (parser.GetMP3Offset() == -1 && parser.IsMP3());
|
||||
|
||||
if (!parser.IsMP3() || parser.GetMP3Offset() == -1) {
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
*aOutOffset = parser.GetMP3Offset();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult
|
||||
SourceFilter::Init(MediaResource* aResource)
|
||||
SourceFilter::Init(MediaResource* aResource, int64_t aMP3Offset)
|
||||
{
|
||||
LOG("SourceFilter::Init()");
|
||||
|
||||
// Get the offset of MP3 data in the stream, and pass that into
|
||||
// the output pin so that the stream that we present to DirectShow
|
||||
// does not contain ID3v2 tags. DirectShow can't properly parse some
|
||||
// streams' ID3v2 tags.
|
||||
int64_t mp3DataOffset = 0;
|
||||
nsresult rv = GetMP3DataOffset(aResource, &mp3DataOffset);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
LOG("First MP3 sync/data frame lies at offset %lld", mp3DataOffset);
|
||||
|
||||
mOutputPin = new OutputPin(aResource,
|
||||
this,
|
||||
mLock,
|
||||
mp3DataOffset);
|
||||
aMP3Offset);
|
||||
NS_ENSURE_TRUE(mOutputPin != nullptr, NS_ERROR_FAILURE);
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
SourceFilter(const GUID& aMajorType, const GUID& aSubType);
|
||||
~SourceFilter();
|
||||
|
||||
nsresult Init(MediaResource *aResource);
|
||||
nsresult Init(MediaResource *aResource, int64_t aMP3Offset);
|
||||
|
||||
// BaseFilter overrides.
|
||||
// Only one output - the byte stream.
|
||||
|
|
|
@ -5,6 +5,7 @@
|
|||
* You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsError.h"
|
||||
#include "nsMimeTypes.h"
|
||||
#include "MediaDecoderStateMachine.h"
|
||||
#include "AbstractMediaDecoder.h"
|
||||
#include "MediaResource.h"
|
||||
|
@ -57,6 +58,8 @@ typedef enum {
|
|||
|
||||
GStreamerReader::GStreamerReader(AbstractMediaDecoder* aDecoder)
|
||||
: MediaDecoderReader(aDecoder),
|
||||
mMP3FrameParser(aDecoder->GetResource()->GetLength()),
|
||||
mUseParserDuration(false),
|
||||
mPlayBin(nullptr),
|
||||
mBus(nullptr),
|
||||
mSource(nullptr),
|
||||
|
@ -243,6 +246,35 @@ void GStreamerReader::PlayBinSourceSetup(GstAppSrc* aSource)
|
|||
gst_caps_unref(caps);
|
||||
}
|
||||
|
||||
/**
|
||||
* If this stream is an MP3, we want to parse the headers to estimate the
|
||||
* stream duration.
|
||||
*/
|
||||
nsresult GStreamerReader::ParseMP3Headers()
|
||||
{
|
||||
MediaResource *resource = mDecoder->GetResource();
|
||||
|
||||
const uint32_t MAX_READ_BYTES = 4096;
|
||||
|
||||
uint64_t offset = 0;
|
||||
char bytes[MAX_READ_BYTES];
|
||||
uint32_t bytesRead;
|
||||
do {
|
||||
nsresult rv = resource->ReadAt(offset, bytes, MAX_READ_BYTES, &bytesRead);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NS_ENSURE_TRUE(bytesRead, NS_ERROR_FAILURE);
|
||||
|
||||
mMP3FrameParser.Parse(bytes, bytesRead, offset);
|
||||
offset += bytesRead;
|
||||
} while (!mMP3FrameParser.ParsedHeaders());
|
||||
|
||||
if (mMP3FrameParser.IsMP3()) {
|
||||
mLastParserDuration = mMP3FrameParser.GetDuration();
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult GStreamerReader::ReadMetadata(MediaInfo* aInfo,
|
||||
MetadataTags** aTags)
|
||||
{
|
||||
|
@ -338,16 +370,32 @@ nsresult GStreamerReader::ReadMetadata(MediaInfo* aInfo,
|
|||
}
|
||||
}
|
||||
|
||||
bool isMP3 = mDecoder->GetResource()->GetContentType().EqualsASCII(AUDIO_MP3);
|
||||
if (isMP3) {
|
||||
ParseMP3Headers();
|
||||
}
|
||||
|
||||
/* report the duration */
|
||||
gint64 duration;
|
||||
GstFormat format = GST_FORMAT_TIME;
|
||||
if (gst_element_query_duration(GST_ELEMENT(mPlayBin),
|
||||
|
||||
if (isMP3 && mMP3FrameParser.IsMP3()) {
|
||||
// The MP3FrameParser has reported a duration; use that over the gstreamer
|
||||
// reported duration for inter-platform consistency.
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mUseParserDuration = true;
|
||||
mLastParserDuration = mMP3FrameParser.GetDuration();
|
||||
mDecoder->SetMediaDuration(mLastParserDuration);
|
||||
|
||||
} else if (gst_element_query_duration(GST_ELEMENT(mPlayBin),
|
||||
&format, &duration) && format == GST_FORMAT_TIME) {
|
||||
// Otherwise use the gstreamer duration.
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
LOG(PR_LOG_DEBUG, ("returning duration %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (duration)));
|
||||
duration = GST_TIME_AS_USECONDS (duration);
|
||||
mDecoder->SetMediaDuration(duration);
|
||||
|
||||
} else {
|
||||
mDecoder->SetMediaSeekable(false);
|
||||
}
|
||||
|
@ -1019,5 +1067,33 @@ void GStreamerReader::Eos()
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* If this is an MP3 stream, pass any new data we get to the MP3 frame parser
|
||||
* for duration estimation.
|
||||
*/
|
||||
void GStreamerReader::NotifyDataArrived(const char *aBuffer,
|
||||
uint32_t aLength,
|
||||
int64_t aOffset)
|
||||
{
|
||||
MOZ_ASSERT(NS_IsMainThread());
|
||||
|
||||
if (HasVideo()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!mMP3FrameParser.NeedsData()) {
|
||||
return;
|
||||
}
|
||||
|
||||
mMP3FrameParser.Parse(aBuffer, aLength, aOffset);
|
||||
|
||||
int64_t duration = mMP3FrameParser.GetDuration();
|
||||
if (duration != mLastParserDuration && mUseParserDuration) {
|
||||
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
|
||||
mLastParserDuration = duration;
|
||||
mDecoder->UpdateEstimatedMediaDuration(mLastParserDuration);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -5,6 +5,8 @@
|
|||
#if !defined(GStreamerReader_h_)
|
||||
#define GStreamerReader_h_
|
||||
|
||||
#include <map>
|
||||
|
||||
#include <gst/gst.h>
|
||||
#include <gst/app/gstappsrc.h>
|
||||
#include <gst/app/gstappsink.h>
|
||||
|
@ -17,8 +19,9 @@
|
|||
#pragma GCC diagnostic ignored "-Wreserved-user-defined-literal"
|
||||
#include <gst/video/video.h>
|
||||
#pragma GCC diagnostic pop
|
||||
#include <map>
|
||||
|
||||
#include "MediaDecoderReader.h"
|
||||
#include "MP3FrameParser.h"
|
||||
#include "nsRect.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -52,6 +55,10 @@ public:
|
|||
int64_t aCurrentTime);
|
||||
virtual nsresult GetBuffered(dom::TimeRanges* aBuffered, int64_t aStartTime);
|
||||
|
||||
virtual void NotifyDataArrived(const char *aBuffer,
|
||||
uint32_t aLength,
|
||||
int64_t aOffset) MOZ_OVERRIDE;
|
||||
|
||||
virtual bool HasAudio() {
|
||||
return mInfo.HasAudio();
|
||||
}
|
||||
|
@ -129,6 +136,20 @@ private:
|
|||
static void EosCb(GstAppSink* aSink, gpointer aUserData);
|
||||
void Eos();
|
||||
|
||||
// Try to find MP3 headers in this stream using our MP3 frame parser.
|
||||
nsresult ParseMP3Headers();
|
||||
|
||||
// Use our own MP3 parser here, largely for consistency with other platforms.
|
||||
MP3FrameParser mMP3FrameParser;
|
||||
|
||||
// We want to be able to decide in |ReadMetadata| whether or not we use the
|
||||
// duration from the MP3 frame parser, as this backend supports more than just
|
||||
// MP3. But |NotifyDataArrived| can update the duration and is often called
|
||||
// _before_ |ReadMetadata|. This flag stops the former from using the parser
|
||||
// duration until we are sure we want to.
|
||||
bool mUseParserDuration;
|
||||
int64_t mLastParserDuration;
|
||||
|
||||
GstElement* mPlayBin;
|
||||
GstBus* mBus;
|
||||
GstAppSrc* mSource;
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
#include <string.h>
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include "nsDebug.h"
|
||||
|
@ -38,35 +39,6 @@ extern PRLogModuleInfo* gMediaDecoderLog;
|
|||
#define LOG(type, msg)
|
||||
#endif
|
||||
|
||||
// Reads a little-endian encoded unsigned 32bit integer at p.
|
||||
static uint32_t LEUint32(const unsigned char* p)
|
||||
{
|
||||
return p[0] +
|
||||
(p[1] << 8) +
|
||||
(p[2] << 16) +
|
||||
(p[3] << 24);
|
||||
}
|
||||
|
||||
// Reads a little-endian encoded 64bit integer at p.
|
||||
static int64_t LEInt64(const unsigned char* p)
|
||||
{
|
||||
uint32_t lo = LEUint32(p);
|
||||
uint32_t hi = LEUint32(p + 4);
|
||||
return static_cast<int64_t>(lo) | (static_cast<int64_t>(hi) << 32);
|
||||
}
|
||||
|
||||
// Reads a little-endian encoded unsigned 16bit integer at p.
|
||||
static uint16_t LEUint16(const unsigned char* p)
|
||||
{
|
||||
return p[0] + (p[1] << 8);
|
||||
}
|
||||
|
||||
// Reads a little-endian encoded signed 16bit integer at p.
|
||||
inline int16_t LEInt16(const unsigned char* p)
|
||||
{
|
||||
return static_cast<int16_t>(LEUint16(p));
|
||||
}
|
||||
|
||||
/** Decoder base class for Ogg-encapsulated streams. */
|
||||
OggCodecState*
|
||||
OggCodecState::Create(ogg_page* aPage)
|
||||
|
@ -826,18 +798,7 @@ nsresult VorbisState::ReconstructVorbisGranulepos()
|
|||
#ifdef MOZ_OPUS
|
||||
OpusState::OpusState(ogg_page* aBosPage) :
|
||||
OggCodecState(aBosPage, true),
|
||||
mRate(0),
|
||||
mNominalRate(0),
|
||||
mChannels(0),
|
||||
mPreSkip(0),
|
||||
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
|
||||
mGain(1.0f),
|
||||
#else
|
||||
mGain_Q16(65536),
|
||||
#endif
|
||||
mChannelMapping(0),
|
||||
mStreams(0),
|
||||
mCoupledStreams(0),
|
||||
mParser(nullptr),
|
||||
mDecoder(nullptr),
|
||||
mSkip(0),
|
||||
mPrevPacketGranulepos(0),
|
||||
|
@ -869,7 +830,7 @@ nsresult OpusState::Reset(bool aStart)
|
|||
// Reset the decoder.
|
||||
opus_multistream_decoder_ctl(mDecoder, OPUS_RESET_STATE);
|
||||
// Let the seek logic handle pre-roll if we're not seeking to the start.
|
||||
mSkip = aStart ? mPreSkip : 0;
|
||||
mSkip = aStart ? mParser->mPreSkip : 0;
|
||||
// This lets us distinguish the first page being the last page vs. just
|
||||
// not having processed the previous page when we encounter the last page.
|
||||
mPrevPageGranulepos = aStart ? 0 : -1;
|
||||
|
@ -895,14 +856,14 @@ bool OpusState::Init(void)
|
|||
|
||||
NS_ASSERTION(mDecoder == nullptr, "leaking OpusDecoder");
|
||||
|
||||
mDecoder = opus_multistream_decoder_create(mRate,
|
||||
mChannels,
|
||||
mStreams,
|
||||
mCoupledStreams,
|
||||
mMappingTable,
|
||||
mDecoder = opus_multistream_decoder_create(mParser->mRate,
|
||||
mParser->mChannels,
|
||||
mParser->mStreams,
|
||||
mParser->mCoupledStreams,
|
||||
mParser->mMappingTable,
|
||||
&error);
|
||||
|
||||
mSkip = mPreSkip;
|
||||
mSkip = mParser->mPreSkip;
|
||||
|
||||
LOG(PR_LOG_DEBUG, ("Opus decoder init, to skip %d", mSkip));
|
||||
|
||||
|
@ -915,147 +876,26 @@ bool OpusState::DecodeHeader(ogg_packet* aPacket)
|
|||
switch(mPacketCount++) {
|
||||
// Parse the id header.
|
||||
case 0: {
|
||||
if (aPacket->bytes < 19 || memcmp(aPacket->packet, "OpusHead", 8)) {
|
||||
LOG(PR_LOG_DEBUG, ("Invalid Opus file: unrecognized header"));
|
||||
return false;
|
||||
}
|
||||
|
||||
mRate = 48000; // The Opus decoder runs at 48 kHz regardless.
|
||||
|
||||
int version = aPacket->packet[8];
|
||||
// Accept file format versions 0.x.
|
||||
if ((version & 0xf0) != 0) {
|
||||
LOG(PR_LOG_DEBUG, ("Rejecting unknown Opus file version %d", version));
|
||||
return false;
|
||||
}
|
||||
|
||||
mChannels = aPacket->packet[9];
|
||||
if (mChannels<1) {
|
||||
LOG(PR_LOG_DEBUG, ("Invalid Opus file: Number of channels %d", mChannels));
|
||||
return false;
|
||||
}
|
||||
mPreSkip = LEUint16(aPacket->packet + 10);
|
||||
mNominalRate = LEUint32(aPacket->packet + 12);
|
||||
double gain_dB = LEInt16(aPacket->packet + 16) / 256.0;
|
||||
mParser = new OpusParser;
|
||||
if(!mParser->DecodeHeader(aPacket->packet, aPacket->bytes)) {
|
||||
return false;
|
||||
}
|
||||
mRate = mParser->mRate;
|
||||
mChannels = mParser->mChannels;
|
||||
mPreSkip = mParser->mPreSkip;
|
||||
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
|
||||
mGain = static_cast<float>(pow(10,0.05*gain_dB));
|
||||
mGain = mParser->mGain;
|
||||
#else
|
||||
mGain_Q16 = static_cast<int32_t>(std::min(65536*pow(10,0.05*gain_dB)+0.5,
|
||||
static_cast<double>(INT32_MAX)));
|
||||
#endif
|
||||
mChannelMapping = aPacket->packet[18];
|
||||
|
||||
if (mChannelMapping == 0) {
|
||||
// Mapping family 0 only allows two channels
|
||||
if (mChannels>2) {
|
||||
LOG(PR_LOG_DEBUG, ("Invalid Opus file: too many channels (%d) for"
|
||||
" mapping family 0.", mChannels));
|
||||
return false;
|
||||
}
|
||||
mStreams = 1;
|
||||
mCoupledStreams = mChannels - 1;
|
||||
mMappingTable[0] = 0;
|
||||
mMappingTable[1] = 1;
|
||||
} else if (mChannelMapping == 1) {
|
||||
// Currently only up to 8 channels are defined for mapping family 1
|
||||
if (mChannels>8) {
|
||||
LOG(PR_LOG_DEBUG, ("Invalid Opus file: too many channels (%d) for"
|
||||
" mapping family 1.", mChannels));
|
||||
return false;
|
||||
}
|
||||
if (aPacket->bytes>20+mChannels) {
|
||||
mStreams = aPacket->packet[19];
|
||||
mCoupledStreams = aPacket->packet[20];
|
||||
int i;
|
||||
for (i=0; i<mChannels; i++)
|
||||
mMappingTable[i] = aPacket->packet[21+i];
|
||||
} else {
|
||||
LOG(PR_LOG_DEBUG, ("Invalid Opus file: channel mapping %d,"
|
||||
" but no channel mapping table", mChannelMapping));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
LOG(PR_LOG_DEBUG, ("Invalid Opus file: unsupported channel mapping "
|
||||
"family %d", mChannelMapping));
|
||||
return false;
|
||||
}
|
||||
if (mStreams < 1) {
|
||||
LOG(PR_LOG_DEBUG, ("Invalid Opus file: no streams"));
|
||||
return false;
|
||||
}
|
||||
if (mCoupledStreams > mStreams) {
|
||||
LOG(PR_LOG_DEBUG, ("Invalid Opus file: more coupled streams (%d) than "
|
||||
"total streams (%d)", mCoupledStreams, mStreams));
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
LOG(PR_LOG_DEBUG, ("Opus stream header:"));
|
||||
LOG(PR_LOG_DEBUG, (" channels: %d", mChannels));
|
||||
LOG(PR_LOG_DEBUG, (" preskip: %d", mPreSkip));
|
||||
LOG(PR_LOG_DEBUG, (" original: %d Hz", mNominalRate));
|
||||
LOG(PR_LOG_DEBUG, (" gain: %.2f dB", gain_dB));
|
||||
LOG(PR_LOG_DEBUG, ("Channel Mapping:"));
|
||||
LOG(PR_LOG_DEBUG, (" family: %d", mChannelMapping));
|
||||
LOG(PR_LOG_DEBUG, (" streams: %d", mStreams));
|
||||
mGain_Q16 = mParser->mGain_Q16;
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
// Parse the metadata header.
|
||||
case 1: {
|
||||
if (aPacket->bytes < 16 || memcmp(aPacket->packet, "OpusTags", 8))
|
||||
return false;
|
||||
|
||||
// Copy out the raw comment lines, but only do basic validation
|
||||
// checks against the string packing: too little data, too many
|
||||
// comments, or comments that are too long. Rejecting these cases
|
||||
// helps reduce the propagation of broken files.
|
||||
// We do not ensure they are valid UTF-8 here, nor do we validate
|
||||
// the required ASCII_TAG=value format of the user comments.
|
||||
const unsigned char* buf = aPacket->packet + 8;
|
||||
uint32_t bytes = aPacket->bytes - 8;
|
||||
uint32_t len;
|
||||
// Read the vendor string.
|
||||
len = LEUint32(buf);
|
||||
buf += 4;
|
||||
bytes -= 4;
|
||||
if (len > bytes)
|
||||
return false;
|
||||
mVendorString = nsCString(reinterpret_cast<const char*>(buf), len);
|
||||
buf += len;
|
||||
bytes -= len;
|
||||
// Read the user comments.
|
||||
if (bytes < 4)
|
||||
return false;
|
||||
uint32_t ncomments = LEUint32(buf);
|
||||
buf += 4;
|
||||
bytes -= 4;
|
||||
// If there are so many comments even their length fields
|
||||
// won't fit in the packet, stop reading now.
|
||||
if (ncomments > (bytes>>2))
|
||||
return false;
|
||||
uint32_t i;
|
||||
for (i = 0; i < ncomments; i++) {
|
||||
if (bytes < 4)
|
||||
if(!mParser->DecodeTags(aPacket->packet, aPacket->bytes)) {
|
||||
return false;
|
||||
len = LEUint32(buf);
|
||||
buf += 4;
|
||||
bytes -= 4;
|
||||
if (len > bytes)
|
||||
return false;
|
||||
mTags.AppendElement(nsCString(reinterpret_cast<const char*>(buf), len));
|
||||
buf += len;
|
||||
bytes -= len;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
LOG(PR_LOG_DEBUG, ("Opus metadata header:"));
|
||||
LOG(PR_LOG_DEBUG, (" vendor: %s", mVendorString.get()));
|
||||
for (uint32_t i = 0; i < mTags.Length(); i++) {
|
||||
LOG(PR_LOG_DEBUG, (" %s", mTags[i].get()));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -1077,8 +917,8 @@ MetadataTags* OpusState::GetTags()
|
|||
MetadataTags* tags;
|
||||
|
||||
tags = new MetadataTags;
|
||||
for (uint32_t i = 0; i < mTags.Length(); i++) {
|
||||
AddVorbisComment(tags, mTags[i].Data(), mTags[i].Length());
|
||||
for (uint32_t i = 0; i < mParser->mTags.Length(); i++) {
|
||||
AddVorbisComment(tags, mParser->mTags[i].Data(), mParser->mTags[i].Length());
|
||||
}
|
||||
|
||||
return tags;
|
||||
|
@ -1090,7 +930,7 @@ int64_t OpusState::Time(int64_t aGranulepos)
|
|||
if (!mActive)
|
||||
return -1;
|
||||
|
||||
return Time(mPreSkip, aGranulepos);
|
||||
return Time(mParser->mPreSkip, aGranulepos);
|
||||
}
|
||||
|
||||
int64_t OpusState::Time(int aPreSkip, int64_t aGranulepos)
|
||||
|
@ -1328,13 +1168,13 @@ bool SkeletonState::DecodeIndex(ogg_packet* aPacket)
|
|||
return false;
|
||||
}
|
||||
|
||||
uint32_t serialno = LEUint32(aPacket->packet + INDEX_SERIALNO_OFFSET);
|
||||
int64_t numKeyPoints = LEInt64(aPacket->packet + INDEX_NUM_KEYPOINTS_OFFSET);
|
||||
uint32_t serialno = LittleEndian::readUint32(aPacket->packet + INDEX_SERIALNO_OFFSET);
|
||||
int64_t numKeyPoints = LittleEndian::readInt64(aPacket->packet + INDEX_NUM_KEYPOINTS_OFFSET);
|
||||
|
||||
int64_t endTime = 0, startTime = 0;
|
||||
const unsigned char* p = aPacket->packet;
|
||||
|
||||
int64_t timeDenom = LEInt64(aPacket->packet + INDEX_TIME_DENOM_OFFSET);
|
||||
int64_t timeDenom = LittleEndian::readInt64(aPacket->packet + INDEX_TIME_DENOM_OFFSET);
|
||||
if (timeDenom == 0) {
|
||||
LOG(PR_LOG_DEBUG, ("Ogg Skeleton Index packet for stream %u has 0 "
|
||||
"timestamp denominator.", serialno));
|
||||
|
@ -1342,7 +1182,7 @@ bool SkeletonState::DecodeIndex(ogg_packet* aPacket)
|
|||
}
|
||||
|
||||
// Extract the start time.
|
||||
CheckedInt64 t = CheckedInt64(LEInt64(p + INDEX_FIRST_NUMER_OFFSET)) * USECS_PER_S;
|
||||
CheckedInt64 t = CheckedInt64(LittleEndian::readInt64(p + INDEX_FIRST_NUMER_OFFSET)) * USECS_PER_S;
|
||||
if (!t.isValid()) {
|
||||
return (mActive = false);
|
||||
} else {
|
||||
|
@ -1350,7 +1190,7 @@ bool SkeletonState::DecodeIndex(ogg_packet* aPacket)
|
|||
}
|
||||
|
||||
// Extract the end time.
|
||||
t = LEInt64(p + INDEX_LAST_NUMER_OFFSET) * USECS_PER_S;
|
||||
t = LittleEndian::readInt64(p + INDEX_LAST_NUMER_OFFSET) * USECS_PER_S;
|
||||
if (!t.isValid()) {
|
||||
return (mActive = false);
|
||||
} else {
|
||||
|
@ -1531,13 +1371,13 @@ bool SkeletonState::DecodeHeader(ogg_packet* aPacket)
|
|||
{
|
||||
nsAutoRef<ogg_packet> autoRelease(aPacket);
|
||||
if (IsSkeletonBOS(aPacket)) {
|
||||
uint16_t verMajor = LEUint16(aPacket->packet + SKELETON_VERSION_MAJOR_OFFSET);
|
||||
uint16_t verMinor = LEUint16(aPacket->packet + SKELETON_VERSION_MINOR_OFFSET);
|
||||
uint16_t verMajor = LittleEndian::readUint16(aPacket->packet + SKELETON_VERSION_MAJOR_OFFSET);
|
||||
uint16_t verMinor = LittleEndian::readUint16(aPacket->packet + SKELETON_VERSION_MINOR_OFFSET);
|
||||
|
||||
// Read the presentation time. We read this before the version check as the
|
||||
// presentation time exists in all versions.
|
||||
int64_t n = LEInt64(aPacket->packet + SKELETON_PRESENTATION_TIME_NUMERATOR_OFFSET);
|
||||
int64_t d = LEInt64(aPacket->packet + SKELETON_PRESENTATION_TIME_DENOMINATOR_OFFSET);
|
||||
int64_t n = LittleEndian::readInt64(aPacket->packet + SKELETON_PRESENTATION_TIME_NUMERATOR_OFFSET);
|
||||
int64_t d = LittleEndian::readInt64(aPacket->packet + SKELETON_PRESENTATION_TIME_DENOMINATOR_OFFSET);
|
||||
mPresentationTime = d == 0 ? 0 : (static_cast<float>(n) / static_cast<float>(d)) * USECS_PER_S;
|
||||
|
||||
mVersion = SKELETON_VERSION(verMajor, verMinor);
|
||||
|
@ -1548,7 +1388,7 @@ bool SkeletonState::DecodeHeader(ogg_packet* aPacket)
|
|||
return false;
|
||||
|
||||
// Extract the segment length.
|
||||
mLength = LEInt64(aPacket->packet + SKELETON_FILE_LENGTH_OFFSET);
|
||||
mLength = LittleEndian::readInt64(aPacket->packet + SKELETON_FILE_LENGTH_OFFSET);
|
||||
|
||||
LOG(PR_LOG_DEBUG, ("Skeleton segment length: %lld", mLength));
|
||||
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
#include <map>
|
||||
#endif
|
||||
|
||||
#include "OpusParser.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
// Deallocates a packet, used in OggPacketQueue below.
|
||||
|
@ -341,7 +343,6 @@ public:
|
|||
|
||||
// Various fields from the Ogg Opus header.
|
||||
int mRate; // Sample rate the decoder uses (always 48 kHz).
|
||||
uint32_t mNominalRate; // Original sample rate of the data (informational).
|
||||
int mChannels; // Number of channels the stream encodes.
|
||||
uint16_t mPreSkip; // Number of samples to strip after decoder reset.
|
||||
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
|
||||
|
@ -349,11 +350,8 @@ public:
|
|||
#else
|
||||
int32_t mGain_Q16; // Gain to apply to the decoder output.
|
||||
#endif
|
||||
int mChannelMapping; // Channel mapping family.
|
||||
int mStreams; // Number of packed streams in each packet.
|
||||
int mCoupledStreams; // Number of packed coupled streams in each packet.
|
||||
unsigned char mMappingTable[255]; // Channel mapping table.
|
||||
|
||||
nsAutoPtr<OpusParser> mParser;
|
||||
OpusMSDecoder *mDecoder;
|
||||
|
||||
int mSkip; // Number of samples left to trim before playback.
|
||||
|
@ -366,9 +364,6 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
nsCString mVendorString; // Encoder vendor string from the header.
|
||||
nsTArray<nsCString> mTags; // Unparsed comment strings from the header.
|
||||
|
||||
// Reconstructs the granulepos of Opus packets stored in the
|
||||
// mUnstamped array. mUnstamped must be filled with consecutive packets from
|
||||
// the stream, with the last packet having a known granulepos. Using this
|
||||
|
|
|
@ -78,6 +78,12 @@ public:
|
|||
virtual nsresult Seek(int64_t aTime, int64_t aStartTime, int64_t aEndTime, int64_t aCurrentTime);
|
||||
virtual nsresult GetBuffered(dom::TimeRanges* aBuffered, int64_t aStartTime);
|
||||
|
||||
// Downmix multichannel Audio samples to Stereo.
|
||||
// It is used from Vorbis and Opus decoders.
|
||||
// Input are the buffer contains multichannel data,
|
||||
// the number of channels and the number of frames.
|
||||
static void DownmixToStereo(nsAutoArrayPtr<AudioDataValue>& buffer,
|
||||
uint32_t& channel, int32_t frames);
|
||||
private:
|
||||
// This monitor should be taken when reading or writing to mIsChained.
|
||||
ReentrantMonitor mMonitor;
|
||||
|
@ -223,12 +229,6 @@ private:
|
|||
// audio queue.
|
||||
nsresult DecodeOpus(ogg_packet* aPacket);
|
||||
|
||||
// Downmix multichannel Audio samples to Stereo.
|
||||
// It is used from Vorbis and Opus decoders.
|
||||
// Input are the buffer contains multichannel data,
|
||||
// the number of channels and the number of frames.
|
||||
void DownmixToStereo(nsAutoArrayPtr<AudioDataValue>& buffer,
|
||||
uint32_t& channel, int32_t frames);
|
||||
|
||||
// Decodes a packet of Theora data, and inserts its frame into the
|
||||
// video queue. May return NS_ERROR_OUT_OF_MEMORY. Caller must have obtained
|
||||
|
|
|
@ -0,0 +1,197 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* 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 <string.h>
|
||||
|
||||
#include "mozilla/DebugOnly.h"
|
||||
#include "mozilla/Endian.h"
|
||||
#include <stdint.h>
|
||||
|
||||
#include "OpusParser.h"
|
||||
|
||||
#include "nsDebug.h"
|
||||
#include "MediaDecoderReader.h"
|
||||
#include "VideoUtils.h"
|
||||
#include <algorithm>
|
||||
|
||||
#include "opus/opus.h"
|
||||
extern "C" {
|
||||
#include "opus/opus_multistream.h"
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
#ifdef PR_LOGGING
|
||||
extern PRLogModuleInfo* gMediaDecoderLog;
|
||||
#define OPUS_LOG(type, msg) PR_LOG(gMediaDecoderLog, type, msg)
|
||||
#else
|
||||
#define OPUS_LOG(type, msg)
|
||||
#endif
|
||||
|
||||
OpusParser::OpusParser():
|
||||
mRate(0),
|
||||
mNominalRate(0),
|
||||
mChannels(0),
|
||||
mPreSkip(0),
|
||||
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
|
||||
mGain(1.0f),
|
||||
#else
|
||||
mGain_Q16(65536),
|
||||
#endif
|
||||
mChannelMapping(0),
|
||||
mStreams(0),
|
||||
mCoupledStreams(0)
|
||||
{ }
|
||||
|
||||
bool OpusParser::DecodeHeader(unsigned char* aData, size_t aLength)
|
||||
{
|
||||
if (aLength < 19 || memcmp(aData, "OpusHead", 8)) {
|
||||
OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: unrecognized header"));
|
||||
return false;
|
||||
}
|
||||
|
||||
mRate = 48000; // The Opus decoder runs at 48 kHz regardless.
|
||||
|
||||
int version = aData[8];
|
||||
// Accept file format versions 0.x.
|
||||
if ((version & 0xf0) != 0) {
|
||||
OPUS_LOG(PR_LOG_DEBUG, ("Rejecting unknown Opus file version %d", version));
|
||||
return false;
|
||||
}
|
||||
|
||||
mChannels = aData[9];
|
||||
if (mChannels<1) {
|
||||
OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: Number of channels %d", mChannels));
|
||||
return false;
|
||||
}
|
||||
|
||||
mPreSkip = LittleEndian::readUint16(aData + 10);
|
||||
mNominalRate = LittleEndian::readUint32(aData + 12);
|
||||
double gain_dB = LittleEndian::readInt16(aData + 16) / 256.0;
|
||||
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
|
||||
mGain = static_cast<float>(pow(10,0.05*gain_dB));
|
||||
#else
|
||||
mGain_Q16 = static_cast<int32_t>(std::min(65536*pow(10,0.05*gain_dB)+0.5,
|
||||
static_cast<double>(INT32_MAX)));
|
||||
#endif
|
||||
mChannelMapping = aData[18];
|
||||
|
||||
if (mChannelMapping == 0) {
|
||||
// Mapping family 0 only allows two channels
|
||||
if (mChannels>2) {
|
||||
OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: too many channels (%d) for"
|
||||
" mapping family 0.", mChannels));
|
||||
return false;
|
||||
}
|
||||
mStreams = 1;
|
||||
mCoupledStreams = mChannels - 1;
|
||||
mMappingTable[0] = 0;
|
||||
mMappingTable[1] = 1;
|
||||
} else if (mChannelMapping == 1) {
|
||||
// Currently only up to 8 channels are defined for mapping family 1
|
||||
if (mChannels>8) {
|
||||
OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: too many channels (%d) for"
|
||||
" mapping family 1.", mChannels));
|
||||
return false;
|
||||
}
|
||||
if (aLength>static_cast<unsigned>(20+mChannels)) {
|
||||
mStreams = aData[19];
|
||||
mCoupledStreams = aData[20];
|
||||
int i;
|
||||
for (i=0; i<mChannels; i++)
|
||||
mMappingTable[i] = aData[21+i];
|
||||
} else {
|
||||
OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: channel mapping %d,"
|
||||
" but no channel mapping table", mChannelMapping));
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: unsupported channel mapping "
|
||||
"family %d", mChannelMapping));
|
||||
return false;
|
||||
}
|
||||
if (mStreams < 1) {
|
||||
OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: no streams"));
|
||||
return false;
|
||||
}
|
||||
if (mCoupledStreams > mStreams) {
|
||||
OPUS_LOG(PR_LOG_DEBUG, ("Invalid Opus file: more coupled streams (%d) than "
|
||||
"total streams (%d)", mCoupledStreams, mStreams));
|
||||
return false;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
OPUS_LOG(PR_LOG_DEBUG, ("Opus stream header:"));
|
||||
OPUS_LOG(PR_LOG_DEBUG, (" channels: %d", mChannels));
|
||||
OPUS_LOG(PR_LOG_DEBUG, (" preskip: %d", mPreSkip));
|
||||
OPUS_LOG(PR_LOG_DEBUG, (" original: %d Hz", mNominalRate));
|
||||
OPUS_LOG(PR_LOG_DEBUG, (" gain: %.2f dB", gain_dB));
|
||||
OPUS_LOG(PR_LOG_DEBUG, ("Channel Mapping:"));
|
||||
OPUS_LOG(PR_LOG_DEBUG, (" family: %d", mChannelMapping));
|
||||
OPUS_LOG(PR_LOG_DEBUG, (" streams: %d", mStreams));
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
bool OpusParser::DecodeTags(unsigned char* aData, size_t aLength)
|
||||
{
|
||||
if (aLength < 16 || memcmp(aData, "OpusTags", 8))
|
||||
return false;
|
||||
|
||||
// Copy out the raw comment lines, but only do basic validation
|
||||
// checks against the string packing: too little data, too many
|
||||
// comments, or comments that are too long. Rejecting these cases
|
||||
// helps reduce the propagation of broken files.
|
||||
// We do not ensure they are valid UTF-8 here, nor do we validate
|
||||
// the required ASCII_TAG=value format of the user comments.
|
||||
const unsigned char* buf = aData + 8;
|
||||
uint32_t bytes = aLength - 8;
|
||||
uint32_t len;
|
||||
// Read the vendor string.
|
||||
len = LittleEndian::readUint32(buf);
|
||||
buf += 4;
|
||||
bytes -= 4;
|
||||
if (len > bytes)
|
||||
return false;
|
||||
mVendorString = nsCString(reinterpret_cast<const char*>(buf), len);
|
||||
buf += len;
|
||||
bytes -= len;
|
||||
// Read the user comments.
|
||||
if (bytes < 4)
|
||||
return false;
|
||||
uint32_t ncomments = LittleEndian::readUint32(buf);
|
||||
buf += 4;
|
||||
bytes -= 4;
|
||||
// If there are so many comments even their length fields
|
||||
// won't fit in the packet, stop reading now.
|
||||
if (ncomments > (bytes>>2))
|
||||
return false;
|
||||
uint32_t i;
|
||||
for (i = 0; i < ncomments; i++) {
|
||||
if (bytes < 4)
|
||||
return false;
|
||||
len = LittleEndian::readUint32(buf);
|
||||
buf += 4;
|
||||
bytes -= 4;
|
||||
if (len > bytes)
|
||||
return false;
|
||||
mTags.AppendElement(nsCString(reinterpret_cast<const char*>(buf), len));
|
||||
buf += len;
|
||||
bytes -= len;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
OPUS_LOG(PR_LOG_DEBUG, ("Opus metadata header:"));
|
||||
OPUS_LOG(PR_LOG_DEBUG, (" vendor: %s", mVendorString.get()));
|
||||
for (uint32_t i = 0; i < mTags.Length(); i++) {
|
||||
OPUS_LOG(PR_LOG_DEBUG, (" %s", mTags[i].get()));
|
||||
}
|
||||
#endif
|
||||
return true;
|
||||
}
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
@ -0,0 +1,54 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* vim:set ts=2 sw=2 sts=2 et cindent: */
|
||||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
#if !defined(OpusParser_h_)
|
||||
#define OpusParser_h_
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
#include <opus/opus.h>
|
||||
#include "opus/opus_multistream.h"
|
||||
|
||||
#include "nsTArray.h"
|
||||
#include "nsString.h"
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class OpusParser
|
||||
{
|
||||
public:
|
||||
OpusParser();
|
||||
|
||||
bool DecodeHeader(unsigned char* aData, size_t aLength);
|
||||
bool DecodeTags(unsigned char* aData, size_t aLength);
|
||||
|
||||
// Various fields from the Ogg Opus header.
|
||||
int mRate; // Sample rate the decoder uses (always 48 kHz).
|
||||
uint32_t mNominalRate; // Original sample rate of the data (informational).
|
||||
int mChannels; // Number of channels the stream encodes.
|
||||
uint16_t mPreSkip; // Number of samples to strip after decoder reset.
|
||||
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
|
||||
float mGain; // Gain to apply to decoder output.
|
||||
#else
|
||||
int32_t mGain_Q16; // Gain to apply to the decoder output.
|
||||
#endif
|
||||
int mChannelMapping; // Channel mapping family.
|
||||
int mStreams; // Number of packed streams in each packet.
|
||||
int mCoupledStreams; // Number of packed coupled streams in each packet.
|
||||
unsigned char mMappingTable[255]; // Channel mapping table.
|
||||
|
||||
// Granule position (end sample) of the last decoded Opus packet. This is
|
||||
// used to calculate the amount we should trim from the last packet.
|
||||
int64_t mPrevPacketGranulepos;
|
||||
|
||||
nsTArray<nsCString> mTags; // Unparsed comment strings from the header.
|
||||
|
||||
nsCString mVendorString; // Encoder vendor string from the header.
|
||||
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
||||
#endif
|
|
@ -9,6 +9,7 @@ EXPORTS += [
|
|||
'OggDecoder.h',
|
||||
'OggReader.h',
|
||||
'OggWriter.h',
|
||||
'OpusParser.h',
|
||||
]
|
||||
|
||||
UNIFIED_SOURCES += [
|
||||
|
@ -16,6 +17,7 @@ UNIFIED_SOURCES += [
|
|||
'OggDecoder.cpp',
|
||||
'OggReader.cpp',
|
||||
'OggWriter.cpp',
|
||||
'OpusParser.cpp',
|
||||
]
|
||||
|
||||
FAIL_ON_WARNINGS = True
|
||||
|
|
Двоичный файл не отображается.
|
@ -188,6 +188,16 @@ var gPlayTests = [
|
|||
// owl.mp3 as above, but with something even funnier going on in the ID3v2 tag
|
||||
// that causes DirectShow to fail.
|
||||
{ name:"owl-funnier-id3.mp3", type:"audio/mpeg", duration:3.29 },
|
||||
// One second of silence with ~140KB of ID3 tags. Usually when the first MP3
|
||||
// frame is at such a high offset into the file, MP3FrameParser will give up
|
||||
// and report that the stream is not MP3. However, it does not count ID3 tags
|
||||
// in that offset. This test case makes sure that ID3 exclusion holds.
|
||||
{ name:"huge-id3.mp3", type:"audio/mpeg", duration:1.00 },
|
||||
// A truncated VBR MP3 with just enough frames to keep most decoders happy.
|
||||
// The Xing header reports the length of the file to be around 10 seconds, but
|
||||
// there is really only one second worth of data. We want MP3FrameParser to
|
||||
// trust the header, so this should be reported as 10 seconds.
|
||||
{ name:"vbr-head.mp3", type:"audio/mpeg", duration:10.00 },
|
||||
|
||||
// Invalid file
|
||||
{ name:"bogus.duh", type:"bogus/duh", duration:Number.NaN }
|
||||
|
|
|
@ -97,6 +97,7 @@ support-files =
|
|||
fragment_noplay.js
|
||||
fragment_play.js
|
||||
gizmo.mp4
|
||||
huge-id3.mp3
|
||||
id3tags.mp3
|
||||
invalid-cmap-s0c0.opus
|
||||
invalid-cmap-s0c2.opus
|
||||
|
@ -164,6 +165,7 @@ support-files =
|
|||
variable-preskip.opus
|
||||
variable-samplerate.ogg
|
||||
variable-samplerate.opus
|
||||
vbr-head.mp3
|
||||
vbr.mp3
|
||||
VID_0001.ogg
|
||||
video-overhang.ogg
|
||||
|
|
Двоичный файл не отображается.
|
@ -16,6 +16,8 @@
|
|||
#include "vpx/vp8dx.h"
|
||||
#include "vpx/vpx_decoder.h"
|
||||
|
||||
#include "OggReader.h"
|
||||
|
||||
using mozilla::NesteggPacketHolder;
|
||||
|
||||
template <>
|
||||
|
@ -141,6 +143,11 @@ WebMReader::WebMReader(AbstractMediaDecoder* aDecoder)
|
|||
mContext(nullptr),
|
||||
mPacketCount(0),
|
||||
mChannels(0),
|
||||
#ifdef MOZ_OPUS
|
||||
mOpusParser(nullptr),
|
||||
mOpusDecoder(nullptr),
|
||||
mSkip(0),
|
||||
#endif
|
||||
mVideoTrack(0),
|
||||
mAudioTrack(0),
|
||||
mAudioStartUsec(-1),
|
||||
|
@ -177,6 +184,11 @@ WebMReader::~WebMReader()
|
|||
vorbis_info_clear(&mVorbisInfo);
|
||||
vorbis_comment_clear(&mVorbisComment);
|
||||
|
||||
if (mOpusDecoder) {
|
||||
opus_multistream_decoder_destroy(mOpusDecoder);
|
||||
mOpusDecoder = nullptr;
|
||||
}
|
||||
|
||||
MOZ_COUNT_DTOR(WebMReader);
|
||||
}
|
||||
|
||||
|
@ -338,51 +350,83 @@ nsresult WebMReader::ReadMetadata(MediaInfo* aInfo,
|
|||
mAudioTrack = track;
|
||||
mHasAudio = true;
|
||||
mInfo.mAudio.mHasAudio = true;
|
||||
mAudioCodec = nestegg_track_codec_id(mContext, track);
|
||||
mCodecDelay = params.codec_delay;
|
||||
|
||||
// Get the Vorbis header data
|
||||
unsigned int nheaders = 0;
|
||||
r = nestegg_track_codec_data_count(mContext, track, &nheaders);
|
||||
if (r == -1 || nheaders != 3) {
|
||||
Cleanup();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (mAudioCodec == NESTEGG_CODEC_VORBIS) {
|
||||
// Get the Vorbis header data
|
||||
unsigned int nheaders = 0;
|
||||
r = nestegg_track_codec_data_count(mContext, track, &nheaders);
|
||||
if (r == -1 || nheaders != 3) {
|
||||
Cleanup();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
for (uint32_t header = 0; header < nheaders; ++header) {
|
||||
for (uint32_t header = 0; header < nheaders; ++header) {
|
||||
unsigned char* data = 0;
|
||||
size_t length = 0;
|
||||
|
||||
r = nestegg_track_codec_data(mContext, track, header, &data, &length);
|
||||
if (r == -1) {
|
||||
Cleanup();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
ogg_packet opacket = InitOggPacket(data, length, header == 0, false, 0);
|
||||
|
||||
r = vorbis_synthesis_headerin(&mVorbisInfo,
|
||||
&mVorbisComment,
|
||||
&opacket);
|
||||
if (r != 0) {
|
||||
Cleanup();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
r = vorbis_synthesis_init(&mVorbisDsp, &mVorbisInfo);
|
||||
if (r != 0) {
|
||||
Cleanup();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
r = vorbis_block_init(&mVorbisDsp, &mVorbisBlock);
|
||||
if (r != 0) {
|
||||
Cleanup();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mInfo.mAudio.mRate = mVorbisDsp.vi->rate;
|
||||
mInfo.mAudio.mChannels = mVorbisDsp.vi->channels;
|
||||
mChannels = mInfo.mAudio.mChannels;
|
||||
#ifdef MOZ_OPUS
|
||||
} else if (mAudioCodec == NESTEGG_CODEC_OPUS) {
|
||||
unsigned char* data = 0;
|
||||
size_t length = 0;
|
||||
|
||||
r = nestegg_track_codec_data(mContext, track, header, &data, &length);
|
||||
r = nestegg_track_codec_data(mContext, track, 0, &data, &length);
|
||||
if (r == -1) {
|
||||
Cleanup();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
ogg_packet opacket = InitOggPacket(data, length, header == 0, false, 0);
|
||||
|
||||
r = vorbis_synthesis_headerin(&mVorbisInfo,
|
||||
&mVorbisComment,
|
||||
&opacket);
|
||||
if (r != 0) {
|
||||
mOpusParser = new OpusParser;
|
||||
if (!mOpusParser->DecodeHeader(data, length)) {
|
||||
Cleanup();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
r = vorbis_synthesis_init(&mVorbisDsp, &mVorbisInfo);
|
||||
if (r != 0) {
|
||||
if (!InitOpusDecoder()) {
|
||||
Cleanup();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mInfo.mAudio.mRate = mOpusParser->mRate;
|
||||
|
||||
mInfo.mAudio.mChannels = mOpusParser->mChannels;
|
||||
mInfo.mAudio.mChannels = mInfo.mAudio.mChannels > 2 ? 2 : mInfo.mAudio.mChannels;
|
||||
#endif
|
||||
} else {
|
||||
Cleanup();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
r = vorbis_block_init(&mVorbisDsp, &mVorbisBlock);
|
||||
if (r != 0) {
|
||||
Cleanup();
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
mInfo.mAudio.mRate = mVorbisDsp.vi->rate;
|
||||
mInfo.mAudio.mChannels = mVorbisDsp.vi->channels;
|
||||
mChannels = mInfo.mAudio.mChannels;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -396,6 +440,25 @@ nsresult WebMReader::ReadMetadata(MediaInfo* aInfo,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
#ifdef MOZ_OPUS
|
||||
bool WebMReader::InitOpusDecoder()
|
||||
{
|
||||
int r;
|
||||
|
||||
NS_ASSERTION(mOpusDecoder == nullptr, "leaking OpusDecoder");
|
||||
|
||||
mOpusDecoder = opus_multistream_decoder_create(mOpusParser->mRate,
|
||||
mOpusParser->mChannels,
|
||||
mOpusParser->mStreams,
|
||||
mOpusParser->mCoupledStreams,
|
||||
mOpusParser->mMappingTable,
|
||||
&r);
|
||||
mSkip = mOpusParser->mPreSkip;
|
||||
|
||||
return r == OPUS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
ogg_packet WebMReader::InitOggPacket(unsigned char* aData,
|
||||
size_t aLength,
|
||||
bool aBOS,
|
||||
|
@ -429,7 +492,7 @@ bool WebMReader::DecodeAudioPacket(nestegg_packet* aPacket, int64_t aOffset)
|
|||
return false;
|
||||
}
|
||||
|
||||
const uint32_t rate = mVorbisDsp.vi->rate;
|
||||
const uint32_t rate = mInfo.mAudio.mRate;
|
||||
uint64_t tstamp_usecs = tstamp / NS_PER_USEC;
|
||||
if (mAudioStartUsec == -1) {
|
||||
// This is the first audio chunk. Assume the start time of our decode
|
||||
|
@ -471,27 +534,164 @@ bool WebMReader::DecodeAudioPacket(nestegg_packet* aPacket, int64_t aOffset)
|
|||
if (r == -1) {
|
||||
return false;
|
||||
}
|
||||
if (mAudioCodec == NESTEGG_CODEC_VORBIS) {
|
||||
ogg_packet opacket = InitOggPacket(data, length, false, false, -1);
|
||||
|
||||
ogg_packet opacket = InitOggPacket(data, length, false, false, -1);
|
||||
if (vorbis_synthesis(&mVorbisBlock, &opacket) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (vorbis_synthesis(&mVorbisBlock, &opacket) != 0) {
|
||||
return false;
|
||||
}
|
||||
if (vorbis_synthesis_blockin(&mVorbisDsp,
|
||||
&mVorbisBlock) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (vorbis_synthesis_blockin(&mVorbisDsp,
|
||||
&mVorbisBlock) != 0) {
|
||||
return false;
|
||||
}
|
||||
|
||||
VorbisPCMValue** pcm = 0;
|
||||
int32_t frames = 0;
|
||||
while ((frames = vorbis_synthesis_pcmout(&mVorbisDsp, &pcm)) > 0) {
|
||||
nsAutoArrayPtr<AudioDataValue> buffer(new AudioDataValue[frames * mChannels]);
|
||||
for (uint32_t j = 0; j < mChannels; ++j) {
|
||||
VorbisPCMValue* channel = pcm[j];
|
||||
for (uint32_t i = 0; i < uint32_t(frames); ++i) {
|
||||
buffer[i*mChannels + j] = MOZ_CONVERT_VORBIS_SAMPLE(channel[i]);
|
||||
VorbisPCMValue** pcm = 0;
|
||||
int32_t frames = 0;
|
||||
while ((frames = vorbis_synthesis_pcmout(&mVorbisDsp, &pcm)) > 0) {
|
||||
nsAutoArrayPtr<AudioDataValue> buffer(new AudioDataValue[frames * mChannels]);
|
||||
for (uint32_t j = 0; j < mChannels; ++j) {
|
||||
VorbisPCMValue* channel = pcm[j];
|
||||
for (uint32_t i = 0; i < uint32_t(frames); ++i) {
|
||||
buffer[i*mChannels + j] = MOZ_CONVERT_VORBIS_SAMPLE(channel[i]);
|
||||
}
|
||||
}
|
||||
|
||||
CheckedInt64 duration = FramesToUsecs(frames, rate);
|
||||
if (!duration.isValid()) {
|
||||
NS_WARNING("Int overflow converting WebM audio duration");
|
||||
return false;
|
||||
}
|
||||
CheckedInt64 total_duration = FramesToUsecs(total_frames, rate);
|
||||
if (!total_duration.isValid()) {
|
||||
NS_WARNING("Int overflow converting WebM audio total_duration");
|
||||
return false;
|
||||
}
|
||||
|
||||
CheckedInt64 time = total_duration + tstamp_usecs;
|
||||
if (!time.isValid()) {
|
||||
NS_WARNING("Int overflow adding total_duration and tstamp_usecs");
|
||||
nestegg_free_packet(aPacket);
|
||||
return false;
|
||||
};
|
||||
|
||||
total_frames += frames;
|
||||
AudioQueue().Push(new AudioData(aOffset,
|
||||
time.value(),
|
||||
duration.value(),
|
||||
frames,
|
||||
buffer.forget(),
|
||||
mChannels));
|
||||
mAudioFrames += frames;
|
||||
if (vorbis_synthesis_read(&mVorbisDsp, frames) != 0) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else if (mAudioCodec == NESTEGG_CODEC_OPUS) {
|
||||
#ifdef MOZ_OPUS
|
||||
uint32_t channels = mOpusParser->mChannels;
|
||||
|
||||
// Maximum value is 63*2880, so there's no chance of overflow.
|
||||
int32_t frames_number = opus_packet_get_nb_frames(data, length);
|
||||
|
||||
if (frames_number <= 0)
|
||||
return false; // Invalid packet header.
|
||||
int32_t samples = opus_packet_get_samples_per_frame(data,
|
||||
(opus_int32) rate);
|
||||
int32_t frames = frames_number*samples;
|
||||
|
||||
// A valid Opus packet must be between 2.5 and 120 ms long.
|
||||
if (frames < 120 || frames > 5760)
|
||||
return false;
|
||||
nsAutoArrayPtr<AudioDataValue> buffer(new AudioDataValue[frames * channels]);
|
||||
|
||||
// Decode to the appropriate sample type.
|
||||
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
|
||||
int ret = opus_multistream_decode_float(mOpusDecoder,
|
||||
data, length,
|
||||
buffer, frames, false);
|
||||
#else
|
||||
int ret = opus_multistream_decode(mOpusDecoder,
|
||||
data, length,
|
||||
buffer, frames, false);
|
||||
#endif
|
||||
if (ret < 0)
|
||||
return false;
|
||||
NS_ASSERTION(ret == frames, "Opus decoded too few audio samples");
|
||||
|
||||
// Trim the initial frames while the decoder is settling.
|
||||
if (mSkip > 0) {
|
||||
int32_t skipFrames = std::min(mSkip, frames);
|
||||
if (skipFrames == frames) {
|
||||
// discard the whole packet
|
||||
mSkip -= frames;
|
||||
LOG(PR_LOG_DEBUG, ("Opus decoder skipping %d frames"
|
||||
" (whole packet)", frames));
|
||||
return true;
|
||||
}
|
||||
int32_t keepFrames = frames - skipFrames;
|
||||
int samples = keepFrames * channels;
|
||||
nsAutoArrayPtr<AudioDataValue> trimBuffer(new AudioDataValue[samples]);
|
||||
for (int i = 0; i < samples; i++)
|
||||
trimBuffer[i] = buffer[skipFrames*channels + i];
|
||||
|
||||
frames = keepFrames;
|
||||
buffer = trimBuffer;
|
||||
|
||||
mSkip -= skipFrames;
|
||||
LOG(PR_LOG_DEBUG, ("Opus decoder skipping %d frames", skipFrames));
|
||||
}
|
||||
|
||||
int64_t discardPadding = 0;
|
||||
r = nestegg_packet_discard_padding(aPacket, &discardPadding);
|
||||
if (discardPadding > 0) {
|
||||
CheckedInt64 discardFrames = UsecsToFrames(discardPadding * NS_PER_USEC, rate);
|
||||
if (!discardFrames.isValid()) {
|
||||
NS_WARNING("Int overflow in DiscardPadding");
|
||||
return false;
|
||||
}
|
||||
int32_t keepFrames = frames - discardFrames.value();
|
||||
if (keepFrames > 0) {
|
||||
int samples = keepFrames * channels;
|
||||
nsAutoArrayPtr<AudioDataValue> trimBuffer(new AudioDataValue[samples]);
|
||||
for (int i = 0; i < samples; i++)
|
||||
trimBuffer[i] = buffer[i];
|
||||
frames = keepFrames;
|
||||
buffer = trimBuffer;
|
||||
} else {
|
||||
LOG(PR_LOG_DEBUG, ("Opus decoder discarding whole packet"
|
||||
" ( %d frames) as padding", frames));
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Apply the header gain if one was specified.
|
||||
#ifdef MOZ_SAMPLE_TYPE_FLOAT32
|
||||
if (mOpusParser->mGain != 1.0f) {
|
||||
float gain = mOpusParser->mGain;
|
||||
int samples = frames * channels;
|
||||
for (int i = 0; i < samples; i++) {
|
||||
buffer[i] *= gain;
|
||||
}
|
||||
}
|
||||
#else
|
||||
if (mOpusParser->mGain_Q16 != 65536) {
|
||||
int64_t gain_Q16 = mOpusParser->mGain_Q16;
|
||||
int samples = frames * channels;
|
||||
for (int i = 0; i < samples; i++) {
|
||||
int32_t val = static_cast<int32_t>((gain_Q16*buffer[i] + 32768)>>16);
|
||||
buffer[i] = static_cast<AudioDataValue>(MOZ_CLIP_TO_15(val));
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// More than 2 decoded channels must be downmixed to stereo.
|
||||
if (channels > 2) {
|
||||
// Opus doesn't provide a channel mapping for more than 8 channels,
|
||||
// so we can't downmix more than that.
|
||||
if (channels > 8)
|
||||
return false;
|
||||
OggReader::DownmixToStereo(buffer, channels, frames);
|
||||
}
|
||||
|
||||
CheckedInt64 duration = FramesToUsecs(frames, rate);
|
||||
|
@ -499,30 +699,25 @@ bool WebMReader::DecodeAudioPacket(nestegg_packet* aPacket, int64_t aOffset)
|
|||
NS_WARNING("Int overflow converting WebM audio duration");
|
||||
return false;
|
||||
}
|
||||
CheckedInt64 total_duration = FramesToUsecs(total_frames, rate);
|
||||
if (!total_duration.isValid()) {
|
||||
NS_WARNING("Int overflow converting WebM audio total_duration");
|
||||
return false;
|
||||
}
|
||||
|
||||
CheckedInt64 time = total_duration + tstamp_usecs;
|
||||
|
||||
CheckedInt64 time = tstamp_usecs;
|
||||
if (!time.isValid()) {
|
||||
NS_WARNING("Int overflow adding total_duration and tstamp_usecs");
|
||||
nestegg_free_packet(aPacket);
|
||||
return false;
|
||||
};
|
||||
|
||||
total_frames += frames;
|
||||
AudioQueue().Push(new AudioData(aOffset,
|
||||
AudioQueue().Push(new AudioData(mDecoder->GetResource()->Tell(),
|
||||
time.value(),
|
||||
duration.value(),
|
||||
frames,
|
||||
buffer.forget(),
|
||||
mChannels));
|
||||
|
||||
mAudioFrames += frames;
|
||||
if (vorbis_synthesis_read(&mVorbisDsp, frames) != 0) {
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
return false;
|
||||
#endif /* MOZ_OPUS */
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#include "vorbis/codec.h"
|
||||
#endif
|
||||
|
||||
#ifdef MOZ_OPUS
|
||||
#include "OpusParser.h"
|
||||
#endif
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
class WebMBufferedState;
|
||||
|
@ -154,6 +158,11 @@ protected:
|
|||
bool aEOS,
|
||||
int64_t aGranulepos);
|
||||
|
||||
#ifdef MOZ_OPUS
|
||||
// Setup opus decoder
|
||||
bool InitOpusDecoder();
|
||||
#endif
|
||||
|
||||
// Decode a nestegg packet of audio data. Push the audio data on the
|
||||
// audio queue. Returns true when there's more audio to decode,
|
||||
// false if the audio is finished, end of file has been reached,
|
||||
|
@ -182,6 +191,14 @@ private:
|
|||
uint32_t mPacketCount;
|
||||
uint32_t mChannels;
|
||||
|
||||
|
||||
#ifdef MOZ_OPUS
|
||||
// Opus decoder state
|
||||
nsAutoPtr<OpusParser> mOpusParser;
|
||||
OpusMSDecoder *mOpusDecoder;
|
||||
int mSkip; // Number of samples left to trim before playback.
|
||||
#endif
|
||||
|
||||
// Queue of video and audio packets that have been read but not decoded. These
|
||||
// must only be accessed from the state machine thread.
|
||||
WebMPacketQueue mVideoPackets;
|
||||
|
@ -197,6 +214,9 @@ private:
|
|||
// Number of audio frames we've decoded since decoding began at mAudioStartMs.
|
||||
uint64_t mAudioFrames;
|
||||
|
||||
// Number of nanoseconds that must be discarded from the start of the Stream.
|
||||
uint64_t mCodecDelay;
|
||||
|
||||
// Parser state and computed offset-time mappings. Shared by multiple
|
||||
// readers when decoder has been cloned. Main thread only.
|
||||
nsRefPtr<WebMBufferedState> mBufferedState;
|
||||
|
@ -211,6 +231,10 @@ private:
|
|||
// Booleans to indicate if we have audio and/or video data
|
||||
bool mHasVideo;
|
||||
bool mHasAudio;
|
||||
|
||||
// Codec ID of audio track
|
||||
int mAudioCodec;
|
||||
|
||||
};
|
||||
|
||||
} // namespace mozilla
|
||||
|
|
|
@ -343,12 +343,12 @@ WebappsApplication.prototype = {
|
|||
this._downloadError = null;
|
||||
|
||||
this.initDOMRequestHelper(aWindow, [
|
||||
"Webapps:CheckForUpdate:Return:KO",
|
||||
"Webapps:Connect:Return:OK",
|
||||
"Webapps:Connect:Return:KO",
|
||||
"Webapps:FireEvent",
|
||||
"Webapps:GetConnections:Return:OK",
|
||||
"Webapps:UpdateState"
|
||||
{ name: "Webapps:CheckForUpdate:Return:KO", weakRef: true },
|
||||
{ name: "Webapps:Connect:Return:OK", weakRef: true },
|
||||
{ name: "Webapps:Connect:Return:KO", weakRef: true },
|
||||
{ name: "Webapps:FireEvent", weakRef: true },
|
||||
{ name: "Webapps:GetConnections:Return:OK", weakRef: true },
|
||||
{ name: "Webapps:UpdateState", weakRef: true }
|
||||
]);
|
||||
|
||||
cpmm.sendAsyncMessage("Webapps:RegisterForMessages", {
|
||||
|
@ -649,14 +649,13 @@ WebappsApplication.prototype = {
|
|||
* mozIDOMApplicationMgmt object
|
||||
*/
|
||||
function WebappsApplicationMgmt(aWindow) {
|
||||
this.initDOMRequestHelper(aWindow, [
|
||||
{ name: "Webapps:GetAll:Return:OK", strongRef: true },
|
||||
{ name: "Webapps:GetAll:Return:KO", strongRef: true },
|
||||
{ name: "Webapps:Uninstall:Return:OK", strongRef: true },
|
||||
{ name: "Webapps:Uninstall:Broadcast:Return:OK", strongRef: true },
|
||||
{ name: "Webapps:Uninstall:Return:KO", strongRef: true },
|
||||
{ name: "Webapps:Install:Return:OK", strongRef: true },
|
||||
{ name: "Webapps:GetNotInstalled:Return:OK", strongRef: true }]);
|
||||
this.initDOMRequestHelper(aWindow, ["Webapps:GetAll:Return:OK",
|
||||
"Webapps:GetAll:Return:KO",
|
||||
"Webapps:Uninstall:Return:OK",
|
||||
"Webapps:Uninstall:Broadcast:Return:OK",
|
||||
"Webapps:Uninstall:Return:KO",
|
||||
"Webapps:Install:Return:OK",
|
||||
"Webapps:GetNotInstalled:Return:OK"]);
|
||||
|
||||
cpmm.sendAsyncMessage("Webapps:RegisterForMessages",
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ this.DOMRequestIpcHelper = function DOMRequestIpcHelper() {
|
|||
// }
|
||||
//
|
||||
// where each property is the name of the message and its value is a boolean
|
||||
// that indicates if the listener is strong or not.
|
||||
// that indicates if the listener is weak or not.
|
||||
this._listeners = null;
|
||||
this._requests = null;
|
||||
this._window = null;
|
||||
|
@ -48,9 +48,8 @@ this.DOMRequestIpcHelper = function DOMRequestIpcHelper() {
|
|||
|
||||
DOMRequestIpcHelper.prototype = {
|
||||
/**
|
||||
* An object which "inherits" from DOMRequestIpcHelper, declares its own
|
||||
* queryInterface method and adds at least one weak listener to the Message
|
||||
* Manager MUST implement Ci.nsISupportsWeakReference.
|
||||
* An object which "inherits" from DOMRequestIpcHelper and declares its own
|
||||
* queryInterface method MUST implement Ci.nsISupportsWeakReference.
|
||||
*/
|
||||
QueryInterface: XPCOMUtils.generateQI([Ci.nsISupportsWeakReference,
|
||||
Ci.nsIObserver]),
|
||||
|
@ -60,13 +59,13 @@ DOMRequestIpcHelper.prototype = {
|
|||
* - objects of this form:
|
||||
* {
|
||||
* name: "messageName",
|
||||
* strongRef: false
|
||||
* weakRef: false
|
||||
* }
|
||||
* where 'name' is the message identifier and 'strongRef' a boolean
|
||||
* indicating if the listener should be a strong referred one or not.
|
||||
* where 'name' is the message identifier and 'weakRef' a boolean
|
||||
* indicating if the listener should be a weak referred one or not.
|
||||
*
|
||||
* - or only strings containing the message name, in which case the listener
|
||||
* will be added as a weak reference by default.
|
||||
* will be added as a strong reference by default.
|
||||
*/
|
||||
addMessageListeners: function(aMessages) {
|
||||
if (!aMessages) {
|
||||
|
@ -86,16 +85,16 @@ DOMRequestIpcHelper.prototype = {
|
|||
// If the listener is already set and it is of the same type we just
|
||||
// bail out. If it is not of the same type, we throw an exception.
|
||||
if (this._listeners[name] != undefined) {
|
||||
if (!!aMsg.strongRef == this._listeners[name]) {
|
||||
if (!!aMsg.weakRef == this._listeners[name]) {
|
||||
return;
|
||||
} else {
|
||||
throw Cr.NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
aMsg.strongRef ? cpmm.addMessageListener(name, this)
|
||||
: cpmm.addWeakMessageListener(name, this);
|
||||
this._listeners[name] = !!aMsg.strongRef;
|
||||
aMsg.weakRef ? cpmm.addWeakMessageListener(name, this)
|
||||
: cpmm.addMessageListener(name, this);
|
||||
this._listeners[name] = !!aMsg.weakRef;
|
||||
});
|
||||
},
|
||||
|
||||
|
@ -117,8 +116,8 @@ DOMRequestIpcHelper.prototype = {
|
|||
return;
|
||||
}
|
||||
|
||||
this._listeners[aName] ? cpmm.removeMessageListener(aName, this)
|
||||
: cpmm.removeWeakMessageListener(aName, this);
|
||||
this._listeners[aName] ? cpmm.removeWeakMessageListener(aName, this)
|
||||
: cpmm.removeMessageListener(aName, this);
|
||||
delete this._listeners[aName];
|
||||
});
|
||||
},
|
||||
|
@ -132,13 +131,13 @@ DOMRequestIpcHelper.prototype = {
|
|||
* - objects of this form:
|
||||
* {
|
||||
* name: 'messageName',
|
||||
* strongRef: false
|
||||
* weakRef: false
|
||||
* }
|
||||
* where 'name' is the message identifier and 'strongRef' a boolean
|
||||
* indicating if the listener should be a strong referred one or not.
|
||||
* where 'name' is the message identifier and 'weakRef' a boolean
|
||||
* indicating if the listener should be a weak referred one or not.
|
||||
*
|
||||
* - or only strings containing the message name, in which case the listener
|
||||
* will be added as a weak referred one by default.
|
||||
* will be added as a strong referred one by default.
|
||||
*/
|
||||
initDOMRequestHelper: function(aWindow, aMessages) {
|
||||
// Query our required interfaces to force a fast fail if they are not
|
||||
|
@ -177,8 +176,8 @@ DOMRequestIpcHelper.prototype = {
|
|||
|
||||
if (this._listeners) {
|
||||
Object.keys(this._listeners).forEach((aName) => {
|
||||
this._listeners[aName] ? cpmm.removeMessageListener(aName, this)
|
||||
: cpmm.removeWeakMessageListener(aName, this);
|
||||
this._listeners[aName] ? cpmm.removeWeakMessageListener(aName, this)
|
||||
: cpmm.removeMessageListener(aName, this);
|
||||
delete this._listeners[aName];
|
||||
});
|
||||
}
|
||||
|
|
|
@ -201,10 +201,10 @@
|
|||
ok(true, "== InitDOMRequestHelper with objects array");
|
||||
initDOMRequestHelperTest([{
|
||||
name: "name1",
|
||||
strongRef: false
|
||||
weakRef: false
|
||||
}, {
|
||||
name: "nameN",
|
||||
strongRef: true
|
||||
weakRef: true
|
||||
}]);
|
||||
checkMessageListeners({"name1": false, "nameN": true}, 2);
|
||||
next();
|
||||
|
@ -243,10 +243,10 @@
|
|||
ok(true, "== AddMessageListeners new listeners, objects array");
|
||||
addMessageListenersTest([{
|
||||
name: "name5",
|
||||
strongRef: true
|
||||
weakRef: true
|
||||
}, {
|
||||
name: "name6",
|
||||
strongRef: false
|
||||
weakRef: false
|
||||
}], {
|
||||
"name1": false,
|
||||
"name2": false,
|
||||
|
@ -320,7 +320,7 @@
|
|||
function() {
|
||||
ok(true, "== AddMessageListeners, same message, different kind");
|
||||
try {
|
||||
addMessageListenersTest({name: "name4", strongRef: true}, {
|
||||
addMessageListenersTest({name: "name4", weakRef: true}, {
|
||||
"name4": true,
|
||||
"name5": true,
|
||||
"name6": false,
|
||||
|
@ -435,7 +435,7 @@
|
|||
},
|
||||
function() {
|
||||
ok(true, "== Test window destroyed with weak messages and without GC");
|
||||
checkWindowDestruction({ messages: [{ name: "foo", strongRef: false }],
|
||||
checkWindowDestruction({ messages: [{ name: "foo", weakRef: true }],
|
||||
gc: false }, function(uninitCalled) {
|
||||
ok(uninitCalled, "uninit() should have been called");
|
||||
next();
|
||||
|
@ -443,7 +443,7 @@
|
|||
},
|
||||
function() {
|
||||
ok(true, "== Test window destroyed with weak messages and with GC");
|
||||
checkWindowDestruction({ messages: [{ name: "foo", strongRef: false }],
|
||||
checkWindowDestruction({ messages: [{ name: "foo", weakRef: true }],
|
||||
gc: true }, function(uninitCalled) {
|
||||
ok(!uninitCalled, "uninit() should NOT have been called");
|
||||
next();
|
||||
|
@ -451,7 +451,7 @@
|
|||
},
|
||||
function() {
|
||||
ok(true, "== Test window destroyed with strong messages and without GC");
|
||||
checkWindowDestruction({ messages: [{ name: "foo", strongRef: true }],
|
||||
checkWindowDestruction({ messages: [{ name: "foo", weakRef: false }],
|
||||
gc: false }, function(uninitCalled) {
|
||||
ok(uninitCalled, "uninit() should have been called");
|
||||
next();
|
||||
|
@ -459,7 +459,7 @@
|
|||
},
|
||||
function() {
|
||||
ok(true, "== Test window destroyed with strong messages and with GC");
|
||||
checkWindowDestruction({ messages: [{ name: "foo", strongRef: true }],
|
||||
checkWindowDestruction({ messages: [{ name: "foo", weakRef: false }],
|
||||
gc: true }, function(uninitCalled) {
|
||||
ok(uninitCalled, "uninit() should have been called");
|
||||
next();
|
||||
|
|
|
@ -218,7 +218,6 @@ MOCHITEST_FILES += \
|
|||
test_browserElement_oop_PromptConfirm.html \
|
||||
test_browserElement_oop_CookiesNotThirdParty.html \
|
||||
test_browserElement_oop_Close.html \
|
||||
test_browserElement_oop_CloseApp.html \
|
||||
test_browserElement_oop_OpenWindow.html \
|
||||
test_browserElement_oop_OpenWindowInFrame.html \
|
||||
test_browserElement_oop_OpenWindowRejected.html \
|
||||
|
@ -251,4 +250,7 @@ MOCHITEST_FILES += \
|
|||
# Disabled until we fix bug 906096.
|
||||
# test_browserElement_oop_SetInputMethodActive.html \
|
||||
|
||||
# Disabled until we fix bug 925200
|
||||
# test_browserElement_oop_CloseApp.html \
|
||||
|
||||
endif #}
|
||||
|
|
|
@ -2,9 +2,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/.
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
_SUPPORT_FILES = \
|
||||
SUPPORT_FILES = \
|
||||
testharness.js \
|
||||
testharnessreport.js \
|
||||
testharness.css \
|
||||
|
@ -12,5 +10,5 @@ _SUPPORT_FILES = \
|
|||
WebIDLParser.js \
|
||||
$(NULL)
|
||||
|
||||
libs:: $(_SUPPORT_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/resources
|
||||
SUPPORT_DEST = $(DEPTH)/_tests/testing/mochitest/resources
|
||||
INSTALL_TARGETS += SUPPORT
|
||||
|
|
|
@ -1,20 +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/.
|
||||
|
||||
_DATA_FILES = \
|
||||
data/cfhtml-chromium.txt \
|
||||
data/cfhtml-firefox.txt \
|
||||
data/cfhtml-ie.txt \
|
||||
data/cfhtml-ooo.txt \
|
||||
data/cfhtml-nocontext.txt \
|
||||
$(NULL)
|
||||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
libs::
|
||||
(cd $(srcdir) && tar $(TAR_CREATE_FLAGS) - browserscope 2> /dev/null) | (cd $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir) && tar -xf -)
|
||||
|
||||
libs:: $(_DATA_FILES)
|
||||
$(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir)/data
|
|
@ -1,5 +1,63 @@
|
|||
[DEFAULT]
|
||||
support-files =
|
||||
browserscope/test_richtext2.html
|
||||
browserscope/test_richtext.html
|
||||
browserscope/lib/richtext2/current_revision
|
||||
browserscope/lib/richtext2/richtext2/common.py
|
||||
browserscope/lib/richtext2/richtext2/unittestexample.html
|
||||
browserscope/lib/richtext2/richtext2/static/editable-dM.html
|
||||
browserscope/lib/richtext2/richtext2/static/editable.css
|
||||
browserscope/lib/richtext2/richtext2/static/editable-body.html
|
||||
browserscope/lib/richtext2/richtext2/static/editable-div.html
|
||||
browserscope/lib/richtext2/richtext2/static/js/variables.js
|
||||
browserscope/lib/richtext2/richtext2/static/js/range-bootstrap.js
|
||||
browserscope/lib/richtext2/richtext2/static/js/range.js
|
||||
browserscope/lib/richtext2/richtext2/static/js/output.js
|
||||
browserscope/lib/richtext2/richtext2/static/js/compare.js
|
||||
browserscope/lib/richtext2/richtext2/static/js/canonicalize.js
|
||||
browserscope/lib/richtext2/richtext2/static/js/pad.js
|
||||
browserscope/lib/richtext2/richtext2/static/js/run.js
|
||||
browserscope/lib/richtext2/richtext2/static/js/units.js
|
||||
browserscope/lib/richtext2/richtext2/static/common.css
|
||||
browserscope/lib/richtext2/richtext2/__init__.py
|
||||
browserscope/lib/richtext2/richtext2/handlers.py
|
||||
browserscope/lib/richtext2/richtext2/templates/output.html
|
||||
browserscope/lib/richtext2/richtext2/templates/richtext2.html
|
||||
browserscope/lib/richtext2/richtext2/tests/forwarddelete.py
|
||||
browserscope/lib/richtext2/richtext2/tests/selection.py
|
||||
browserscope/lib/richtext2/richtext2/tests/queryIndeterm.py
|
||||
browserscope/lib/richtext2/richtext2/tests/unapplyCSS.py
|
||||
browserscope/lib/richtext2/richtext2/tests/apply.py
|
||||
browserscope/lib/richtext2/richtext2/tests/unapply.py
|
||||
browserscope/lib/richtext2/richtext2/tests/change.py
|
||||
browserscope/lib/richtext2/richtext2/tests/queryState.py
|
||||
browserscope/lib/richtext2/richtext2/tests/queryValue.py
|
||||
browserscope/lib/richtext2/richtext2/tests/__init__.py
|
||||
browserscope/lib/richtext2/richtext2/tests/insert.py
|
||||
browserscope/lib/richtext2/richtext2/tests/queryEnabled.py
|
||||
browserscope/lib/richtext2/richtext2/tests/applyCSS.py
|
||||
browserscope/lib/richtext2/richtext2/tests/changeCSS.py
|
||||
browserscope/lib/richtext2/richtext2/tests/delete.py
|
||||
browserscope/lib/richtext2/richtext2/tests/querySupported.py
|
||||
browserscope/lib/richtext2/README
|
||||
browserscope/lib/richtext2/update_from_upstream
|
||||
browserscope/lib/richtext2/LICENSE
|
||||
browserscope/lib/richtext2/README.Mozilla
|
||||
browserscope/lib/richtext2/currentStatus.js
|
||||
browserscope/lib/richtext/current_revision
|
||||
browserscope/lib/richtext/README
|
||||
browserscope/lib/richtext/update_from_upstream
|
||||
browserscope/lib/richtext/LICENSE
|
||||
browserscope/lib/richtext/README.Mozilla
|
||||
browserscope/lib/richtext/richtext/editable.html
|
||||
browserscope/lib/richtext/richtext/richtext.html
|
||||
browserscope/lib/richtext/richtext/js/range.js
|
||||
browserscope/lib/richtext/currentStatus.js
|
||||
data/cfhtml-chromium.txt
|
||||
data/cfhtml-firefox.txt
|
||||
data/cfhtml-ie.txt
|
||||
data/cfhtml-ooo.txt
|
||||
data/cfhtml-nocontext.txt
|
||||
file_bug549262.html
|
||||
file_bug674770-1.html
|
||||
file_select_all_without_body.html
|
||||
|
|
|
@ -22,7 +22,7 @@ ifdef MOZ_ANGLE_RENDERER
|
|||
|
||||
libs::
|
||||
ifdef MOZ_D3DCOMPILER_CAB
|
||||
expand "$(MOZ_D3DCOMPILER_CAB)" -F:$(MOZ_D3DCOMPILER_DLL) "$(DIST)/bin"
|
||||
expand '$(MOZ_D3DCOMPILER_CAB)' -F:$(MOZ_D3DCOMPILER_DLL) '$(DIST)/bin'
|
||||
endif
|
||||
|
||||
endif
|
||||
|
|
|
@ -28,7 +28,7 @@ RCFILE = $(srcdir)/libEGL.rc
|
|||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
CXXFLAGS += -I"$(MOZ_DIRECTX_SDK_PATH)/include"
|
||||
CXXFLAGS += -I'$(MOZ_DIRECTX_SDK_PATH)/include'
|
||||
|
||||
#OS_LIBS += $(call EXPAND_LIBNAME,dwmapi)
|
||||
|
||||
|
@ -39,8 +39,8 @@ OS_LIBS += -ld3d9 -llibGLESv2
|
|||
|
||||
else
|
||||
|
||||
EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib" \
|
||||
"$(DIST)/lib/libGLESv2.lib" \
|
||||
EXTRA_DSO_LDOPTS = '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib' \
|
||||
'$(DIST)/lib/libGLESv2.lib' \
|
||||
delayimp.lib
|
||||
|
||||
endif
|
||||
|
|
|
@ -44,7 +44,7 @@ RCFILE = $(srcdir)/libGLESv2.rc
|
|||
|
||||
include $(topsrcdir)/config/rules.mk
|
||||
|
||||
CXXFLAGS += -I"$(MOZ_DIRECTX_SDK_PATH)/include"
|
||||
CXXFLAGS += -I'$(MOZ_DIRECTX_SDK_PATH)/include'
|
||||
|
||||
ifdef GNU_CC
|
||||
|
||||
|
@ -55,8 +55,8 @@ OS_LIBS += -ld3d9 -ldxguid
|
|||
|
||||
else
|
||||
|
||||
EXTRA_DSO_LDOPTS = "$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib" \
|
||||
"$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/dxguid.lib" \
|
||||
EXTRA_DSO_LDOPTS = '$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/d3d9.lib' \
|
||||
'$(MOZ_DIRECTX_SDK_PATH)/lib/$(MOZ_DIRECTX_SDK_CPU_SUFFIX)/dxguid.lib' \
|
||||
delayimp.lib
|
||||
|
||||
endif
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "gfxPlatform.h" // for gfxPlatform, gfxImageFormat
|
||||
#include "mozilla/layers/ISurfaceAllocator.h" // for ISurfaceAllocator, etc
|
||||
#include "mozilla/layers/ImageClient.h" // for ImageClient
|
||||
#include "mozilla/layers/ImageDataSerializer.h" // for ImageDataSerializer
|
||||
#include "mozilla/layers/LayersSurfaces.h" // for SurfaceDescriptor, etc
|
||||
#include "mozilla/layers/TextureClient.h" // for BufferTextureClient, etc
|
||||
#include "mozilla/layers/ImageBridgeChild.h" // for ImageBridgeChild
|
||||
|
@ -203,8 +204,12 @@ SharedRGBImage::Allocate(gfx::IntSize aSize, gfx::SurfaceFormat aFormat)
|
|||
uint8_t*
|
||||
SharedRGBImage::GetBuffer()
|
||||
{
|
||||
return mTextureClient ? mTextureClient->GetBuffer()
|
||||
: nullptr;
|
||||
if (!mTextureClient) {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ImageDataSerializer serializer(mTextureClient->GetBuffer());
|
||||
return serializer.GetData();
|
||||
}
|
||||
|
||||
gfxIntSize
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "nsUnicodeScriptCodes.h"
|
||||
#include "nsDataHashtable.h"
|
||||
#include "harfbuzz/hb.h"
|
||||
#include "mozilla/gfx/2D.h"
|
||||
|
||||
typedef struct _cairo_scaled_font cairo_scaled_font_t;
|
||||
typedef struct gr_face gr_face;
|
||||
|
|
|
@ -82,9 +82,9 @@ ifeq (cocoa,$(MOZ_WIDGET_TOOLKIT)) #{
|
|||
|
||||
libs::
|
||||
$(NSINSTALL) -D $(DIST)/bin/$(PROGRAM).app
|
||||
rsync -a -C --exclude "*.in" $(srcdir)/macbuild/Contents $(DIST)/bin/$(PROGRAM).app
|
||||
sed -e "s/%PROGRAM%/$(PROGRAM)/" $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/bin/$(PROGRAM).app/Contents/Info.plist
|
||||
sed -e "s/%APP_NAME%/$(MOZ_APP_DISPLAYNAME)/" $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | \
|
||||
rsync -a -C --exclude '*.in' $(srcdir)/macbuild/Contents $(DIST)/bin/$(PROGRAM).app
|
||||
sed -e 's/%PROGRAM%/$(PROGRAM)/' $(srcdir)/macbuild/Contents/Info.plist.in > $(DIST)/bin/$(PROGRAM).app/Contents/Info.plist
|
||||
sed -e 's/%APP_NAME%/$(MOZ_APP_DISPLAYNAME)/' $(srcdir)/macbuild/Contents/Resources/English.lproj/InfoPlist.strings.in | \
|
||||
iconv -f UTF-8 -t UTF-16 > $(DIST)/bin/$(PROGRAM).app/Contents/Resources/English.lproj/InfoPlist.strings
|
||||
$(NSINSTALL) -D $(DIST)/bin/$(PROGRAM).app/Contents/MacOS
|
||||
$(NSINSTALL) $(PROGRAM) $(DIST)/bin/$(PROGRAM).app/Contents/MacOS
|
||||
|
|
|
@ -70,6 +70,6 @@ export-preqs = \
|
|||
$(NULL)
|
||||
|
||||
export:: $(export-preqs)
|
||||
echo "#include <event.h>" > $(DIST)/third_party/libevent/event.h
|
||||
echo '#include <event.h>' > $(DIST)/third_party/libevent/event.h
|
||||
|
||||
endif # }
|
||||
|
|
|
@ -93,14 +93,31 @@ class Anchor : AnchorPermitted<T>
|
|||
Anchor() { }
|
||||
explicit Anchor(T t) { hold = t; }
|
||||
inline ~Anchor();
|
||||
T &get() { return hold; }
|
||||
const T &get() const { return hold; }
|
||||
void set(const T &t) { hold = t; }
|
||||
void operator=(const T &t) { hold = t; }
|
||||
void clear() { hold = 0; }
|
||||
|
||||
private:
|
||||
T hold;
|
||||
|
||||
/*
|
||||
* Rooting analysis considers use of operator= to be a use of an anchor.
|
||||
* For simplicity, Anchor is treated as if it contained a GC thing, from
|
||||
* construction. Thus if we had
|
||||
*
|
||||
* void operator=(const T &t) { hold = t; }
|
||||
*
|
||||
* and this code
|
||||
*
|
||||
* JS::Anchor<JSString*> anchor;
|
||||
* stuff that could GC, producing |str|;
|
||||
* anchor = str;
|
||||
*
|
||||
* the last line would be seen as a hazard, because the final = would "use"
|
||||
* |anchor| that is a GC thing -- which could have been moved around by the
|
||||
* GC. The workaround is to structure your code so that JS::Anchor is
|
||||
* always constructed, living for however long the corresponding value must
|
||||
* live.
|
||||
*/
|
||||
void operator=(const T &t) MOZ_DELETE;
|
||||
|
||||
Anchor(const Anchor &other) MOZ_DELETE;
|
||||
void operator=(const Anchor &other) MOZ_DELETE;
|
||||
};
|
||||
|
|
|
@ -954,10 +954,6 @@ class Value
|
|||
data = STRING_TO_JSVAL_IMPL(str);
|
||||
}
|
||||
|
||||
void setString(const JS::Anchor<JSString *> &str) {
|
||||
setString(str.get());
|
||||
}
|
||||
|
||||
void setObject(JSObject &obj) {
|
||||
MOZ_ASSERT(!IsPoisonedPtr(&obj));
|
||||
data = OBJECT_TO_JSVAL_IMPL(&obj);
|
||||
|
@ -1592,7 +1588,6 @@ class MutableValueOperations : public ValueOperations<Outer>
|
|||
bool setNumber(uint32_t ui) { return value()->setNumber(ui); }
|
||||
bool setNumber(double d) { return value()->setNumber(d); }
|
||||
void setString(JSString *str) { this->value()->setString(str); }
|
||||
void setString(const JS::Anchor<JSString *> &str) { this->value()->setString(str); }
|
||||
void setObject(JSObject &obj) { this->value()->setObject(obj); }
|
||||
void setObjectOrNull(JSObject *arg) { this->value()->setObjectOrNull(arg); }
|
||||
};
|
||||
|
@ -1623,7 +1618,6 @@ class HeapBase<JS::Value> : public ValueOperations<JS::Heap<JS::Value> >
|
|||
void setBoolean(bool b) { setBarriered(JS::BooleanValue(b)); }
|
||||
void setMagic(JSWhyMagic why) { setBarriered(JS::MagicValue(why)); }
|
||||
void setString(JSString *str) { setBarriered(JS::StringValue(str)); }
|
||||
void setString(const JS::Anchor<JSString *> &str) { setBarriered(JS::StringValue(str.get())); }
|
||||
void setObject(JSObject &obj) { setBarriered(JS::ObjectValue(obj)); }
|
||||
|
||||
bool setNumber(uint32_t ui) {
|
||||
|
|
|
@ -16,7 +16,7 @@ endif
|
|||
|
||||
TOPLEVEL_BUILD := 1
|
||||
|
||||
run_for_side_effects := $(shell echo "MAKE: $(MAKE)")
|
||||
run_for_side_effects := $(shell echo 'MAKE: $(MAKE)')
|
||||
STATIC_LIBRARY_NAME = js_static
|
||||
LIBS = $(NSPR_LIBS)
|
||||
|
||||
|
@ -141,7 +141,7 @@ MOZILLA_DTRACE_SRC = $(srcdir)/devtools/javascript-trace.d
|
|||
endif
|
||||
|
||||
backend.RecursiveMakeBackend:
|
||||
@echo "Build configuration changed. Regenerating backend."
|
||||
@echo 'Build configuration changed. Regenerating backend.'
|
||||
$(PYTHON) config.status
|
||||
|
||||
Makefile: backend.RecursiveMakeBackend
|
||||
|
@ -172,7 +172,7 @@ EXTRA_DSO_LDOPTS += -Wl,-version-script,symverscript
|
|||
|
||||
symverscript: symverscript.in
|
||||
$(call py_action,preprocessor, \
|
||||
-DVERSION="$(subst -,_,$(LIBRARY_NAME))" $< -o $@)
|
||||
-DVERSION='$(subst -,_,$(LIBRARY_NAME))' $< -o $@)
|
||||
|
||||
EXTRA_DEPS += symverscript
|
||||
endif
|
||||
|
@ -319,7 +319,7 @@ check:: check-style check-jit-test
|
|||
# --no-extensions is set to skip that test. Remove as soon as possible.
|
||||
check-jstests:
|
||||
RC=0; \
|
||||
for f in `echo "$(JITFLAGS)" | tr ',' '\n'`; \
|
||||
for f in `echo '$(JITFLAGS)' | tr ',' '\n'`; \
|
||||
do \
|
||||
$(wildcard $(RUN_TEST_PROGRAM)) $(PYTHON) -u $(srcdir)/tests/jstests.py \
|
||||
--tinderbox --no-progress \
|
||||
|
@ -478,20 +478,20 @@ endif
|
|||
# Set the various definitions that will be substituted for js-config
|
||||
# and for the pck-config .pc file.
|
||||
JS_CONFIG_SUBSTITUTIONS=\
|
||||
-Dprefix="$(prefix)" \
|
||||
-Dexec_prefix="$(exec_prefix)" \
|
||||
-Dincludedir="$(includedir)" \
|
||||
-Dlibdir="$(libdir)" \
|
||||
-DMOZILLA_VERSION="$(MOZILLA_VERSION)" \
|
||||
-DLIBRARY_NAME="$(LIBRARY_NAME)" \
|
||||
-DJS_CONFIG_LIBS="$(JS_CONFIG_LIBS)" \
|
||||
-DJS_CONFIG_MOZ_JS_LIBS="$(JS_CONFIG_MOZ_JS_LIBS)" \
|
||||
-DMOZJS_MAJOR_VERSION="$(MOZJS_MAJOR_VERSION)" \
|
||||
-DMOZJS_MINOR_VERSION="$(MOZJS_MINOR_VERSION)" \
|
||||
-DMOZJS_PATCH_VERSION="$(MOZJS_PATCH_VERSION)" \
|
||||
-DMOZJS_ALPHA="$(MOZJS_ALPHA)" \
|
||||
-DNSPR_CFLAGS="$(NSPR_CFLAGS)" \
|
||||
-DNSPR_PKGCONF_CHECK="$(NSPR_PKGCONF_CHECK)" \
|
||||
-Dprefix='$(prefix)' \
|
||||
-Dexec_prefix='$(exec_prefix)' \
|
||||
-Dincludedir='$(includedir)' \
|
||||
-Dlibdir='$(libdir)' \
|
||||
-DMOZILLA_VERSION='$(MOZILLA_VERSION)' \
|
||||
-DLIBRARY_NAME='$(LIBRARY_NAME)' \
|
||||
-DJS_CONFIG_LIBS='$(JS_CONFIG_LIBS)' \
|
||||
-DJS_CONFIG_MOZ_JS_LIBS='$(JS_CONFIG_MOZ_JS_LIBS)' \
|
||||
-DMOZJS_MAJOR_VERSION='$(MOZJS_MAJOR_VERSION)' \
|
||||
-DMOZJS_MINOR_VERSION='$(MOZJS_MINOR_VERSION)' \
|
||||
-DMOZJS_PATCH_VERSION='$(MOZJS_PATCH_VERSION)' \
|
||||
-DMOZJS_ALPHA='$(MOZJS_ALPHA)' \
|
||||
-DNSPR_CFLAGS='$(NSPR_CFLAGS)' \
|
||||
-DNSPR_PKGCONF_CHECK='$(NSPR_PKGCONF_CHECK)' \
|
||||
$(NULL)
|
||||
|
||||
$(JS_CONFIG_NAME): js-config.in Makefile $(DEPTH)/config/autoconf.mk $(topsrcdir)/config/config.mk $(topsrcdir)/config/rules.mk
|
||||
|
@ -573,7 +573,7 @@ ETWProvider.h ETWProvider.rc ETWProvider.mof: ETWProvider.man
|
|||
$(MC) -um -mof $^
|
||||
|
||||
ETWProvider.res: ETWProvider.rc
|
||||
$(RC) -r -i "$(SDKDIR)Include" $^
|
||||
$(RC) -r -i '$(SDKDIR)Include' $^
|
||||
|
||||
export:: ETWProvider.res
|
||||
|
||||
|
|
|
@ -811,7 +811,7 @@ endif
|
|||
MERGE_FILES = $(foreach f,$(1),$(call MERGE_FILE,$(f)))
|
||||
|
||||
ifeq (OS2,$(OS_ARCH))
|
||||
RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd "$(LIBXUL_DIST)"
|
||||
RUN_TEST_PROGRAM = $(topsrcdir)/build/os2/test_os2.cmd '$(LIBXUL_DIST)'
|
||||
else
|
||||
ifneq (WINNT,$(OS_ARCH))
|
||||
RUN_TEST_PROGRAM = $(LIBXUL_DIST)/bin/run-mozilla.sh
|
||||
|
@ -848,7 +848,7 @@ EXPAND_MKSHLIB = $(EXPAND_LIBS_EXEC) $(EXPAND_MKSHLIB_ARGS) -- $(MKSHLIB)
|
|||
|
||||
ifneq (,$(MOZ_LIBSTDCXX_TARGET_VERSION)$(MOZ_LIBSTDCXX_HOST_VERSION))
|
||||
ifneq ($(OS_ARCH),Darwin)
|
||||
CHECK_STDCXX = objdump -p $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' > /dev/null && echo "TEST-UNEXPECTED-FAIL | | We don't want these libstdc++ symbols to be used:" && objdump -T $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' && exit 1 || exit 0
|
||||
CHECK_STDCXX = objdump -p $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' > /dev/null && echo 'TEST-UNEXPECTED-FAIL | | We do not want these libstdc++ symbols to be used:' && objdump -T $(1) | grep -e 'GLIBCXX_3\.4\.\(9\|[1-9][0-9]\)' && exit 1 || exit 0
|
||||
endif
|
||||
|
||||
ifdef MOZ_LIBSTDCXX_TARGET_VERSION
|
||||
|
|
|
@ -56,18 +56,18 @@ mkdir_deps =$(foreach dir,$(getargv),$(call slash_strip,$(dir)/.mkdir.done))
|
|||
#######################
|
||||
|
||||
%/.mkdir.done: # mkdir -p -p => mkdir -p
|
||||
$(subst $(space)-p,$(null),$(MKDIR)) -p "$(dir $@)"
|
||||
$(subst $(space)-p,$(null),$(MKDIR)) -p '$(dir $@)'
|
||||
# Make the timestamp old enough for not being a problem with symbolic links
|
||||
# targets depending on it. Use Jan 3, 1980 to accomodate any timezone where
|
||||
# 198001010000 would translate to something older than FAT epoch.
|
||||
@$(TOUCH) -t 198001030000 "$@"
|
||||
@$(TOUCH) -t 198001030000 '$@'
|
||||
|
||||
# A handful of makefiles are attempting "mkdir dot".
|
||||
# tbpl/valgrind builds are using this target
|
||||
# https://bugzilla.mozilla.org/show_bug.cgi?id=837754
|
||||
.mkdir.done:
|
||||
@echo "WARNING: $(MKDIR) -dot- requested by $(MAKE) -C $(CURDIR) $(MAKECMDGOALS)"
|
||||
@$(TOUCH) -t 198001030000 "$@"
|
||||
@echo 'WARNING: $(MKDIR) -dot- requested by $(MAKE) -C $(CURDIR) $(MAKECMDGOALS)'
|
||||
@$(TOUCH) -t 198001030000 '$@'
|
||||
|
||||
INCLUDED_AUTOTARGETS_MK = 1
|
||||
endif #}
|
||||
|
|
|
@ -25,8 +25,8 @@ ifdef IS_COMPONENT
|
|||
$(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(FINAL_TARGET)/components
|
||||
$(ELF_DYNSTR_GC) $(FINAL_TARGET)/components/$(SHARED_LIBRARY)
|
||||
ifndef NO_COMPONENTS_MANIFEST
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest "manifest components/components.manifest")
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/components/components.manifest "binary-component $(SHARED_LIBRARY)")
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest 'manifest components/components.manifest')
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/components/components.manifest 'binary-component $(SHARED_LIBRARY)')
|
||||
endif
|
||||
endif # IS_COMPONENT
|
||||
endif # SHARED_LIBRARY
|
||||
|
@ -109,11 +109,11 @@ BINARIES_INSTALL_TARGETS := $(foreach category,$(INSTALL_TARGETS),$(if $(filter
|
|||
BINARIES_PP := $(MDDEPDIR)/binaries.pp
|
||||
|
||||
$(BINARIES_PP): Makefile $(wildcard backend.mk) $(call mkdir_deps,$(MDDEPDIR))
|
||||
@echo "$(strip $(foreach category,$(BINARIES_INSTALL_TARGETS),\
|
||||
@echo '$(strip $(foreach category,$(BINARIES_INSTALL_TARGETS),\
|
||||
$(foreach file,$($(category)_FILES) $($(category)_EXECUTABLES),\
|
||||
$($(category)_DEST)/$(notdir $(file)): $(file)%\
|
||||
)\
|
||||
))binaries: Makefile $(wildcard backend.mk)" | tr % '\n' > $@
|
||||
))binaries: Makefile $(wildcard backend.mk)' | tr % '\n' > $@
|
||||
|
||||
else
|
||||
binaries::
|
||||
|
|
|
@ -129,7 +129,7 @@ recurse_$(CURRENT_TIER):
|
|||
# Creating binaries-deps.mk directly would make us build it twice: once when beginning
|
||||
# the build because of the include, and once at the end because of the stamps.
|
||||
binaries-deps: $(addsuffix /binaries,$(CURRENT_DIRS))
|
||||
@$(call py_action,link_deps,-o $@.mk --group-by-depfile --topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) --guard $(addprefix ",$(addsuffix ",$^)))
|
||||
@$(call py_action,link_deps,-o $@.mk --group-by-depfile --topsrcdir $(topsrcdir) --topobjdir $(DEPTH) --dist $(DIST) --guard $(addprefix ',$(addsuffix ',$^)))
|
||||
@$(TOUCH) $@
|
||||
|
||||
ifeq (recurse_binaries,$(MAKECMDGOALS))
|
||||
|
|
|
@ -129,7 +129,7 @@ check::
|
|||
|
||||
cppunittests-remote: DM_TRANS?=adb
|
||||
cppunittests-remote:
|
||||
@if [ "${TEST_DEVICE}" != "" -o "$(DM_TRANS)" = "adb" ]; then \
|
||||
@if [ '${TEST_DEVICE}' != '' -o '$(DM_TRANS)' = 'adb' ]; then \
|
||||
$(PYTHON) -u $(topsrcdir)/testing/remotecppunittests.py \
|
||||
--xre-path=$(DEPTH)/dist/bin \
|
||||
--localLib=$(DEPTH)/dist/$(MOZ_APP_NAME) \
|
||||
|
@ -137,7 +137,7 @@ cppunittests-remote:
|
|||
--deviceIP=${TEST_DEVICE} \
|
||||
$(subst .cpp,$(BIN_SUFFIX),$(CPP_UNIT_TESTS)) $(EXTRA_TEST_ARGS); \
|
||||
else \
|
||||
echo "please prepare your host with environment variables for TEST_DEVICE"; \
|
||||
echo 'please prepare your host with environment variables for TEST_DEVICE'; \
|
||||
fi
|
||||
|
||||
endif # COMPILE_ENVIRONMENT
|
||||
|
@ -364,13 +364,13 @@ ifdef MOZ_UPDATE_XTERM
|
|||
# Its good not to have a newline at the end of the titlebar string because it
|
||||
# makes the make -s output easier to read. Echo -n does not work on all
|
||||
# platforms, but we can trick printf into doing it.
|
||||
UPDATE_TITLE = printf "\033]0;%s in %s\007" $(1) $(relativesrcdir)/$(2) ;
|
||||
UPDATE_TITLE = printf '\033]0;%s in %s\007' $(1) $(relativesrcdir)/$(2) ;
|
||||
endif
|
||||
|
||||
ifdef MACH
|
||||
ifndef NO_BUILDSTATUS_MESSAGES
|
||||
define BUILDSTATUS
|
||||
@echo "BUILDSTATUS $1"
|
||||
@echo 'BUILDSTATUS $1'
|
||||
|
||||
endef
|
||||
endif
|
||||
|
@ -743,22 +743,22 @@ ifeq (_WINNT,$(GNU_CC)_$(OS_ARCH))
|
|||
$(EXPAND_LD) -NOLOGO -OUT:$@ -PDB:$(LINK_PDBFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(PROGOBJS) $(RESFILE) $(LIBS) $(EXTRA_LIBS) $(OS_LIBS)
|
||||
ifdef MSMANIFEST_TOOL
|
||||
@if test -f $@.manifest; then \
|
||||
if test -f "$(srcdir)/$@.manifest"; then \
|
||||
echo "Embedding manifest from $(srcdir)/$@.manifest and $@.manifest"; \
|
||||
mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
if test -f '$(srcdir)/$@.manifest'; then \
|
||||
echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
|
||||
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
else \
|
||||
echo "Embedding manifest from $@.manifest"; \
|
||||
echo 'Embedding manifest from $@.manifest'; \
|
||||
mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
fi; \
|
||||
elif test -f "$(srcdir)/$@.manifest"; then \
|
||||
echo "Embedding manifest from $(srcdir)/$@.manifest"; \
|
||||
mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" -OUTPUTRESOURCE:$@\;1; \
|
||||
elif test -f '$(srcdir)/$@.manifest'; then \
|
||||
echo 'Embedding manifest from $(srcdir)/$@.manifest'; \
|
||||
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@\;1; \
|
||||
fi
|
||||
endif # MSVC with manifest tool
|
||||
ifdef MOZ_PROFILE_GENERATE
|
||||
# touch it a few seconds into the future to work around FAT's
|
||||
# 2-second granularity
|
||||
touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
|
||||
touch -t `date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
|
||||
endif
|
||||
else # !WINNT || GNU_CC
|
||||
$(EXPAND_CCC) -o $@ $(CXXFLAGS) $(PROGOBJS) $(RESFILE) $(WIN32_EXE_LDFLAGS) $(LDFLAGS) $(WRAP_LDFLAGS) $(LIBS_DIR) $(LIBS) $(MOZ_GLUE_PROGRAM_LDFLAGS) $(OS_LIBS) $(EXTRA_LIBS) $(BIN_FLAGS) $(EXE_DEF_FILE) $(STLPORT_LIBS)
|
||||
|
@ -778,16 +778,16 @@ ifeq (_WINNT,$(GNU_CC)_$(HOST_OS_ARCH))
|
|||
$(EXPAND_LIBS_EXEC) -- $(HOST_LD) -NOLOGO -OUT:$@ -PDB:$(HOST_PDBFILE) $(HOST_OBJS) $(WIN32_EXE_LDFLAGS) $(HOST_LDFLAGS) $(HOST_LIBS) $(HOST_EXTRA_LIBS)
|
||||
ifdef MSMANIFEST_TOOL
|
||||
@if test -f $@.manifest; then \
|
||||
if test -f "$(srcdir)/$@.manifest"; then \
|
||||
echo "Embedding manifest from $(srcdir)/$@.manifest and $@.manifest"; \
|
||||
mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
if test -f '$(srcdir)/$@.manifest'; then \
|
||||
echo 'Embedding manifest from $(srcdir)/$@.manifest and $@.manifest'; \
|
||||
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
else \
|
||||
echo "Embedding manifest from $@.manifest"; \
|
||||
echo 'Embedding manifest from $@.manifest'; \
|
||||
mt.exe -NOLOGO -MANIFEST $@.manifest -OUTPUTRESOURCE:$@\;1; \
|
||||
fi; \
|
||||
elif test -f "$(srcdir)/$@.manifest"; then \
|
||||
echo "Embedding manifest from $(srcdir)/$@.manifest"; \
|
||||
mt.exe -NOLOGO -MANIFEST "$(win_srcdir)/$@.manifest" -OUTPUTRESOURCE:$@\;1; \
|
||||
elif test -f '$(srcdir)/$@.manifest'; then \
|
||||
echo 'Embedding manifest from $(srcdir)/$@.manifest'; \
|
||||
mt.exe -NOLOGO -MANIFEST '$(win_srcdir)/$@.manifest' -OUTPUTRESOURCE:$@\;1; \
|
||||
fi
|
||||
endif # MSVC with manifest tool
|
||||
else
|
||||
|
@ -932,7 +932,7 @@ ifdef EMBED_MANIFEST_AT
|
|||
endif # EMBED_MANIFEST_AT
|
||||
endif # MSVC with manifest tool
|
||||
ifdef MOZ_PROFILE_GENERATE
|
||||
touch -t `date +%Y%m%d%H%M.%S -d "now+5seconds"` pgo.relink
|
||||
touch -t `date +%Y%m%d%H%M.%S -d 'now+5seconds'` pgo.relink
|
||||
endif
|
||||
endif # WINNT && !GCC
|
||||
@$(RM) foodummyfilefoo $(DELETE_AFTER_LINK)
|
||||
|
@ -949,14 +949,14 @@ _MDDEPFILE = $(MDDEPDIR)/$(@F).pp
|
|||
|
||||
define MAKE_DEPS_AUTO_CC
|
||||
if test -d $(@D); then \
|
||||
echo "Building deps for $< using Sun Studio cc"; \
|
||||
echo 'Building deps for $< using Sun Studio cc'; \
|
||||
$(CC) $(COMPILE_CFLAGS) -xM $< >$(_MDDEPFILE) ; \
|
||||
$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
|
||||
fi
|
||||
endef
|
||||
define MAKE_DEPS_AUTO_CXX
|
||||
if test -d $(@D); then \
|
||||
echo "Building deps for $< using Sun Studio CC"; \
|
||||
echo 'Building deps for $< using Sun Studio CC'; \
|
||||
$(CXX) $(COMPILE_CXXFLAGS) -xM $< >$(_MDDEPFILE) ; \
|
||||
$(PYTHON) $(topsrcdir)/build/unix/add_phony_targets.py $(_MDDEPFILE) ; \
|
||||
fi
|
||||
|
@ -1103,8 +1103,8 @@ ifeq ($(HOST_OS_ARCH),WINNT)
|
|||
# could be a file or a non-existent path, we cannot call 'pwd -W' directly
|
||||
# on the path. Instead, we extract the root path (i.e. "c:/"), call 'pwd -W'
|
||||
# on it, then merge with the rest of the path.
|
||||
root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\1|")
|
||||
non-root-path = $(shell echo $(1) | sed -e "s|\(/[^/]*\)/\?\(.*\)|\2|")
|
||||
root-path = $(shell echo $(1) | sed -e 's|\(/[^/]*\)/\?\(.*\)|\1|')
|
||||
non-root-path = $(shell echo $(1) | sed -e 's|\(/[^/]*\)/\?\(.*\)|\2|')
|
||||
normalizepath = $(foreach p,$(1),$(if $(filter /%,$(1)),$(patsubst %/,%,$(shell cd $(call root-path,$(1)) && pwd -W))/$(call non-root-path,$(1)),$(1)))
|
||||
else
|
||||
normalizepath = $(1)
|
||||
|
@ -1178,8 +1178,8 @@ INSTALL_TARGETS += _XPT_NAME
|
|||
|
||||
ifndef NO_INTERFACES_MANIFEST
|
||||
libs:: $(call mkdir_deps,$(FINAL_TARGET)/components)
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/components/interfaces.manifest "interfaces $(XPT_NAME)")
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest "manifest components/interfaces.manifest")
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/components/interfaces.manifest 'interfaces $(XPT_NAME)')
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest 'manifest components/interfaces.manifest')
|
||||
endif
|
||||
endif
|
||||
|
||||
|
@ -1215,7 +1215,7 @@ endif
|
|||
EXTRA_MANIFESTS = $(filter %.manifest,$(EXTRA_COMPONENTS) $(EXTRA_PP_COMPONENTS))
|
||||
ifneq (,$(EXTRA_MANIFESTS))
|
||||
libs:: $(call mkdir_deps,$(FINAL_TARGET))
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest $(patsubst %,"manifest components/%",$(notdir $(EXTRA_MANIFESTS))))
|
||||
$(call py_action,buildlist,$(FINAL_TARGET)/chrome.manifest $(patsubst %,'manifest components/%',$(notdir $(EXTRA_MANIFESTS))))
|
||||
endif
|
||||
|
||||
################################################################################
|
||||
|
@ -1302,7 +1302,7 @@ ifdef XPI_ROOT_APPID
|
|||
# For add-on packaging we may specify that an application
|
||||
# sub-dir should be added to the root chrome manifest with
|
||||
# a specific application id.
|
||||
MAKE_JARS_FLAGS += --root-manifest-entry-appid="$(XPI_ROOT_APPID)"
|
||||
MAKE_JARS_FLAGS += --root-manifest-entry-appid='$(XPI_ROOT_APPID)'
|
||||
endif
|
||||
|
||||
# if DIST_SUBDIR is defined but XPI_ROOT_APPID is not there's
|
||||
|
@ -1339,34 +1339,34 @@ ifneq ($(XPI_PKGNAME),)
|
|||
tools realchrome::
|
||||
ifdef STRIP_XPI
|
||||
ifndef MOZ_DEBUG
|
||||
@echo "Stripping $(XPI_PKGNAME) package directory..."
|
||||
@echo 'Stripping $(XPI_PKGNAME) package directory...'
|
||||
@echo $(FINAL_TARGET)
|
||||
@cd $(FINAL_TARGET) && find . ! -type d \
|
||||
! -name "*.js" \
|
||||
! -name "*.xpt" \
|
||||
! -name "*.gif" \
|
||||
! -name "*.jpg" \
|
||||
! -name "*.png" \
|
||||
! -name "*.xpm" \
|
||||
! -name "*.txt" \
|
||||
! -name "*.rdf" \
|
||||
! -name "*.sh" \
|
||||
! -name "*.properties" \
|
||||
! -name "*.dtd" \
|
||||
! -name "*.html" \
|
||||
! -name "*.xul" \
|
||||
! -name "*.css" \
|
||||
! -name "*.xml" \
|
||||
! -name "*.jar" \
|
||||
! -name "*.dat" \
|
||||
! -name "*.tbl" \
|
||||
! -name "*.src" \
|
||||
! -name "*.reg" \
|
||||
! -name '*.js' \
|
||||
! -name '*.xpt' \
|
||||
! -name '*.gif' \
|
||||
! -name '*.jpg' \
|
||||
! -name '*.png' \
|
||||
! -name '*.xpm' \
|
||||
! -name '*.txt' \
|
||||
! -name '*.rdf' \
|
||||
! -name '*.sh' \
|
||||
! -name '*.properties' \
|
||||
! -name '*.dtd' \
|
||||
! -name '*.html' \
|
||||
! -name '*.xul' \
|
||||
! -name '*.css' \
|
||||
! -name '*.xml' \
|
||||
! -name '*.jar' \
|
||||
! -name '*.dat' \
|
||||
! -name '*.tbl' \
|
||||
! -name '*.src' \
|
||||
! -name '*.reg' \
|
||||
$(PLATFORM_EXCLUDE_LIST) \
|
||||
-exec $(STRIP) $(STRIP_FLAGS) {} >/dev/null 2>&1 \;
|
||||
endif
|
||||
endif
|
||||
@echo "Packaging $(XPI_PKGNAME).xpi..."
|
||||
@echo 'Packaging $(XPI_PKGNAME).xpi...'
|
||||
cd $(FINAL_TARGET) && $(ZIP) -qr ../$(XPI_PKGNAME).xpi *
|
||||
endif
|
||||
|
||||
|
@ -1376,8 +1376,8 @@ $(error XPI_NAME must be set for INSTALL_EXTENSION_ID)
|
|||
endif
|
||||
|
||||
tools::
|
||||
$(RM) -r "$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)"
|
||||
$(NSINSTALL) -D "$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)"
|
||||
$(RM) -r '$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
|
||||
$(NSINSTALL) -D '$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID)'
|
||||
$(call copy_dir,$(FINAL_TARGET),$(DIST)/bin$(DIST_SUBDIR:%=/%)/extensions/$(INSTALL_EXTENSION_ID))
|
||||
|
||||
endif
|
||||
|
@ -1499,11 +1499,11 @@ install_targets_sanity = $(if $(filter-out $(notdir $@),$(notdir $(<))),$(error
|
|||
|
||||
$(sort $(foreach tier,$(INSTALL_TARGETS_TIERS),$(INSTALL_TARGETS_FILES_$(tier)))):
|
||||
$(install_targets_sanity)
|
||||
$(call install_cmd,$(IFLAGS1) "$<" "$(@D)")
|
||||
$(call install_cmd,$(IFLAGS1) '$<' '$(@D)')
|
||||
|
||||
$(sort $(foreach tier,$(INSTALL_TARGETS_TIERS),$(INSTALL_TARGETS_EXECUTABLES_$(tier)))):
|
||||
$(install_targets_sanity)
|
||||
$(call install_cmd,$(IFLAGS2) "$<" "$(@D)")
|
||||
$(call install_cmd,$(IFLAGS2) '$<' '$(@D)')
|
||||
|
||||
################################################################################
|
||||
# Preprocessing rules
|
||||
|
@ -1564,8 +1564,8 @@ $(foreach tier,$(PP_TARGETS_TIERS), \
|
|||
PP_TARGETS_ALL_RESULTS := $(sort $(foreach tier,$(PP_TARGETS_TIERS),$(PP_TARGETS_RESULTS_$(tier))))
|
||||
$(PP_TARGETS_ALL_RESULTS):
|
||||
$(if $(filter-out $(notdir $@),$(notdir $(<:.in=))),$(error Looks like $@ has an unexpected dependency on $< which breaks PP_TARGETS))
|
||||
$(RM) "$@"
|
||||
$(call py_action,preprocessor,--depend $(MDDEPDIR)/$(@F).pp $(PP_TARGET_FLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) "$<" -o "$@")
|
||||
$(RM) '$@'
|
||||
$(call py_action,preprocessor,--depend $(MDDEPDIR)/$(@F).pp $(PP_TARGET_FLAGS) $(DEFINES) $(ACDEFINES) $(XULPPFLAGS) '$<' -o '$@')
|
||||
|
||||
# The depfile is based on the filename, and we don't want conflicts. So check
|
||||
# there's only one occurrence of any given filename in PP_TARGETS_ALL_RESULTS.
|
||||
|
|
|
@ -413,6 +413,19 @@ freetype/ftsizes.h
|
|||
freetype/ftadvanc.h
|
||||
freetype/ftbitmap.h
|
||||
freetype/ftxf86.h
|
||||
freetype.h
|
||||
ftcache.h
|
||||
ftglyph.h
|
||||
ftsynth.h
|
||||
ftoutln.h
|
||||
ttnameid.h
|
||||
tttables.h
|
||||
t1tables.h
|
||||
ftlcdfil.h
|
||||
ftsizes.h
|
||||
ftadvanc.h
|
||||
ftbitmap.h
|
||||
ftxf86.h
|
||||
fribidi/fribidi.h
|
||||
FSp_fopen.h
|
||||
fstream
|
||||
|
|
|
@ -1320,7 +1320,7 @@ case "$host" in
|
|||
*mingw*)
|
||||
if test -n "$_WIN32_MSVC"; then
|
||||
HOST_AR=lib
|
||||
HOST_AR_FLAGS='-NOLOGO -OUT:"$@"'
|
||||
HOST_AR_FLAGS='-NOLOGO -OUT:$@'
|
||||
HOST_CFLAGS="$HOST_CFLAGS -TC -nologo -Fd\$(HOST_PDBFILE)"
|
||||
HOST_RANLIB='echo ranlib'
|
||||
else
|
||||
|
@ -1619,7 +1619,7 @@ ia64*-hpux*)
|
|||
AS="$(basename "$AS_BIN")"
|
||||
fi
|
||||
AR='lib'
|
||||
AR_FLAGS='-NOLOGO -OUT:"$@"'
|
||||
AR_FLAGS='-NOLOGO -OUT:$@'
|
||||
AR_EXTRACT=
|
||||
RANLIB='echo not_ranlib'
|
||||
STRIP='echo not_strip'
|
||||
|
|
|
@ -433,39 +433,39 @@ info_TEXINFOS = doc/libffi.texi
|
|||
# values defined in terms of make variables, as is the case for CC and
|
||||
# friends when we are called from the top level Makefile.
|
||||
AM_MAKEFLAGS = \
|
||||
"AR_FLAGS=$(AR_FLAGS)" \
|
||||
"CC_FOR_BUILD=$(CC_FOR_BUILD)" \
|
||||
"CFLAGS=$(CFLAGS)" \
|
||||
"CXXFLAGS=$(CXXFLAGS)" \
|
||||
"CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \
|
||||
"CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \
|
||||
"INSTALL=$(INSTALL)" \
|
||||
"INSTALL_DATA=$(INSTALL_DATA)" \
|
||||
"INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \
|
||||
"INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \
|
||||
"JC1FLAGS=$(JC1FLAGS)" \
|
||||
"LDFLAGS=$(LDFLAGS)" \
|
||||
"LIBCFLAGS=$(LIBCFLAGS)" \
|
||||
"LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \
|
||||
"MAKE=$(MAKE)" \
|
||||
"MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \
|
||||
"PICFLAG=$(PICFLAG)" \
|
||||
"PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \
|
||||
"RUNTESTFLAGS=$(RUNTESTFLAGS)" \
|
||||
"SHELL=$(SHELL)" \
|
||||
"exec_prefix=$(exec_prefix)" \
|
||||
"infodir=$(infodir)" \
|
||||
"libdir=$(libdir)" \
|
||||
"mandir=$(mandir)" \
|
||||
"prefix=$(prefix)" \
|
||||
"AR=$(AR)" \
|
||||
"AS=$(AS)" \
|
||||
"CC=$(CC)" \
|
||||
"CXX=$(CXX)" \
|
||||
"LD=$(LD)" \
|
||||
"NM=$(NM)" \
|
||||
"RANLIB=$(RANLIB)" \
|
||||
"DESTDIR=$(DESTDIR)"
|
||||
'AR_FLAGS=$(AR_FLAGS)' \
|
||||
'CC_FOR_BUILD=$(CC_FOR_BUILD)' \
|
||||
'CFLAGS=$(CFLAGS)' \
|
||||
'CXXFLAGS=$(CXXFLAGS)' \
|
||||
'CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)' \
|
||||
'CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)' \
|
||||
'INSTALL=$(INSTALL)' \
|
||||
'INSTALL_DATA=$(INSTALL_DATA)' \
|
||||
'INSTALL_PROGRAM=$(INSTALL_PROGRAM)' \
|
||||
'INSTALL_SCRIPT=$(INSTALL_SCRIPT)' \
|
||||
'JC1FLAGS=$(JC1FLAGS)' \
|
||||
'LDFLAGS=$(LDFLAGS)' \
|
||||
'LIBCFLAGS=$(LIBCFLAGS)' \
|
||||
'LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)' \
|
||||
'MAKE=$(MAKE)' \
|
||||
'MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)' \
|
||||
'PICFLAG=$(PICFLAG)' \
|
||||
'PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)' \
|
||||
'RUNTESTFLAGS=$(RUNTESTFLAGS)' \
|
||||
'SHELL=$(SHELL)' \
|
||||
'exec_prefix=$(exec_prefix)' \
|
||||
'infodir=$(infodir)' \
|
||||
'libdir=$(libdir)' \
|
||||
'mandir=$(mandir)' \
|
||||
'prefix=$(prefix)' \
|
||||
'AR=$(AR)' \
|
||||
'AS=$(AS)' \
|
||||
'CC=$(CC)' \
|
||||
'CXX=$(CXX)' \
|
||||
'LD=$(LD)' \
|
||||
'NM=$(NM)' \
|
||||
'RANLIB=$(RANLIB)' \
|
||||
'DESTDIR=$(DESTDIR)'
|
||||
|
||||
MAKEOVERRIDES =
|
||||
ACLOCAL_AMFLAGS = $(ACLOCAL_AMFLAGS) -I m4
|
||||
|
|
|
@ -76,6 +76,6 @@ allFunctions.txt: src_body.xdb
|
|||
|
||||
rootingHazards.txt: gcFunctions.lst suppressedFunctions.lst gcTypes.txt analyzeRoots.js annotations.js gen-hazards.sh
|
||||
@echo Started computation of $@ at $$(date)
|
||||
time env JS=$(JS) ANALYZE="$(ANALYSIS_SCRIPT_DIR)/analyzeRoots.js" SIXGILL="$(SIXGILL)" "$(ANALYSIS_SCRIPT_DIR)/gen-hazards.sh" $(JOBS) > $@.tmp
|
||||
time env JS=$(JS) ANALYZE='$(ANALYSIS_SCRIPT_DIR)/analyzeRoots.js' SIXGILL='$(SIXGILL)' '$(ANALYSIS_SCRIPT_DIR)/gen-hazards.sh' $(JOBS) > $@.tmp
|
||||
mv $@.tmp $@
|
||||
@echo Finished computation of $@ at $$(date)
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
function f(x) {
|
||||
var a = x;
|
||||
return a / 10;
|
||||
}
|
||||
for (var i=0; i<100; i++)
|
||||
assertEq(f(i * 10), i);
|
||||
|
||||
function g(x) {
|
||||
var y = x + 1;
|
||||
return y / y;
|
||||
}
|
||||
for (var i=0; i<100; i++)
|
||||
assertEq(g(i), 1);
|
|
@ -1,6 +0,0 @@
|
|||
function test() {
|
||||
var x = 0.0;
|
||||
for (var i = 0; i < 100; i++)
|
||||
-("") >> (x / x);
|
||||
}
|
||||
test();
|
|
@ -0,0 +1,652 @@
|
|||
// |jit-test| ion-eager
|
||||
|
||||
// bug 944963
|
||||
function bug944963(x, y) {
|
||||
(+(xy))(y % y)
|
||||
}
|
||||
for (var i = 0; i < 10; i++) {
|
||||
try {
|
||||
(function() {
|
||||
bug944963(0, (~Math.fround(-8)))
|
||||
})()
|
||||
} catch (e) {}
|
||||
}
|
||||
|
||||
// bug 900437
|
||||
function bug900437() {
|
||||
var x = 0.0;
|
||||
for (var i = 0; i < 10; i++)
|
||||
-("") >> (x / x);
|
||||
}
|
||||
bug900437();
|
||||
bug900437();
|
||||
|
||||
// bug 715460
|
||||
function f(x) {
|
||||
var a = x;
|
||||
return a / 10;
|
||||
}
|
||||
function g(x) {
|
||||
var y = x + 1;
|
||||
return y / y;
|
||||
}
|
||||
for (var i=0; i<10; i++)
|
||||
assertEq(f(i * 10), i);
|
||||
for (var i=0; i<10; i++)
|
||||
assertEq(g(i), 1);
|
||||
|
||||
// bug 939893
|
||||
function bug939893() {
|
||||
bug_g();
|
||||
}
|
||||
function bug_g() {
|
||||
bug_h(undefined >>> 0, +undefined);
|
||||
}
|
||||
function bug_h(x) {
|
||||
Math.max(x ? ((x / x) | 0) : 0);
|
||||
}
|
||||
for (var a = 0; a < 2; ++a) {
|
||||
bug939893();
|
||||
}
|
||||
|
||||
// Assorted tests.
|
||||
|
||||
function sdiv_truncate(y) {
|
||||
return (y / y)|0;
|
||||
}
|
||||
assertEq(sdiv_truncate(5), 1);
|
||||
assertEq(sdiv_truncate(1), 1);
|
||||
assertEq(sdiv_truncate(-1), 1);
|
||||
assertEq(sdiv_truncate(0), 0);
|
||||
assertEq(sdiv_truncate(-0), 0);
|
||||
assertEq(sdiv_truncate(1.1), 1);
|
||||
assertEq(sdiv_truncate(-1.1), 1);
|
||||
assertEq(sdiv_truncate(Infinity), 0);
|
||||
assertEq(sdiv_truncate(NaN), 0);
|
||||
assertEq(sdiv_truncate(undefined), 0);
|
||||
assertEq(sdiv_truncate(null), 0);
|
||||
|
||||
function sdiv(y) {
|
||||
return y / y;
|
||||
}
|
||||
assertEq(sdiv(5), 1);
|
||||
assertEq(sdiv(1), 1);
|
||||
assertEq(sdiv(-1), 1);
|
||||
assertEq(sdiv(0), NaN);
|
||||
assertEq(sdiv(-0), NaN);
|
||||
assertEq(sdiv(1.1), 1);
|
||||
assertEq(sdiv(-1.1), 1);
|
||||
assertEq(sdiv(Infinity), NaN);
|
||||
assertEq(sdiv(NaN), NaN);
|
||||
assertEq(sdiv(undefined), NaN);
|
||||
assertEq(sdiv(null), NaN);
|
||||
|
||||
function udiv_truncate(y) {
|
||||
var yu = y>>>0;
|
||||
return (yu / yu)|0;
|
||||
}
|
||||
assertEq(udiv_truncate(5), 1);
|
||||
assertEq(udiv_truncate(1), 1);
|
||||
assertEq(udiv_truncate(-1), 1);
|
||||
assertEq(udiv_truncate(0), 0);
|
||||
assertEq(udiv_truncate(-0), 0);
|
||||
assertEq(udiv_truncate(1.1), 1);
|
||||
assertEq(udiv_truncate(-1.1), 1);
|
||||
assertEq(udiv_truncate(Infinity), 0);
|
||||
assertEq(udiv_truncate(NaN), 0);
|
||||
assertEq(udiv_truncate(undefined), 0);
|
||||
assertEq(udiv_truncate(null), 0);
|
||||
|
||||
function shifted_udiv_truncate(y) {
|
||||
var yu = y>>>1;
|
||||
return (yu / yu)|0;
|
||||
}
|
||||
assertEq(shifted_udiv_truncate(5), 1);
|
||||
assertEq(shifted_udiv_truncate(2), 1);
|
||||
assertEq(shifted_udiv_truncate(1), 0);
|
||||
assertEq(shifted_udiv_truncate(-1), 1);
|
||||
assertEq(shifted_udiv_truncate(0), 0);
|
||||
assertEq(shifted_udiv_truncate(-0), 0);
|
||||
assertEq(shifted_udiv_truncate(1.1), 0);
|
||||
assertEq(shifted_udiv_truncate(-1.1), 1);
|
||||
assertEq(shifted_udiv_truncate(Infinity), 0);
|
||||
assertEq(shifted_udiv_truncate(NaN), 0);
|
||||
assertEq(shifted_udiv_truncate(undefined), 0);
|
||||
assertEq(shifted_udiv_truncate(null), 0);
|
||||
|
||||
function udiv(y) {
|
||||
var yu = y>>>0;
|
||||
return yu / yu;
|
||||
}
|
||||
assertEq(udiv(5), 1);
|
||||
assertEq(udiv(1), 1);
|
||||
assertEq(udiv(-1), 1);
|
||||
assertEq(udiv(0), NaN);
|
||||
assertEq(udiv(-0), NaN);
|
||||
assertEq(udiv(1.1), 1);
|
||||
assertEq(udiv(-1.1), 1);
|
||||
assertEq(udiv(Infinity), NaN);
|
||||
assertEq(udiv(NaN), NaN);
|
||||
assertEq(udiv(undefined), NaN);
|
||||
assertEq(udiv(null), NaN);
|
||||
|
||||
function shifted_udiv(y) {
|
||||
var yu = y>>>1;
|
||||
return yu / yu;
|
||||
}
|
||||
assertEq(shifted_udiv(5), 1);
|
||||
assertEq(shifted_udiv(2), 1);
|
||||
assertEq(shifted_udiv(1), NaN);
|
||||
assertEq(shifted_udiv(-1), 1);
|
||||
assertEq(shifted_udiv(0), NaN);
|
||||
assertEq(shifted_udiv(-0), NaN);
|
||||
assertEq(shifted_udiv(1.1), NaN);
|
||||
assertEq(shifted_udiv(-1.1), 1);
|
||||
assertEq(shifted_udiv(Infinity), NaN);
|
||||
assertEq(shifted_udiv(NaN), NaN);
|
||||
assertEq(shifted_udiv(undefined), NaN);
|
||||
assertEq(shifted_udiv(null), NaN);
|
||||
|
||||
function smod_truncate(y) {
|
||||
return (y % y)|0;
|
||||
}
|
||||
assertEq(smod_truncate(5), 0);
|
||||
assertEq(smod_truncate(1), 0);
|
||||
assertEq(smod_truncate(-1), 0);
|
||||
assertEq(smod_truncate(0), 0);
|
||||
assertEq(smod_truncate(-0), 0);
|
||||
assertEq(smod_truncate(1.1), 0);
|
||||
assertEq(smod_truncate(-1.1), 0);
|
||||
assertEq(smod_truncate(Infinity), 0);
|
||||
assertEq(smod_truncate(NaN), 0);
|
||||
assertEq(smod_truncate(undefined), 0);
|
||||
assertEq(smod_truncate(null), 0);
|
||||
|
||||
function smod(y) {
|
||||
return y % y;
|
||||
}
|
||||
assertEq(smod(5), 0);
|
||||
assertEq(smod(1), 0);
|
||||
assertEq(smod(-1), -0);
|
||||
assertEq(smod(0), NaN);
|
||||
assertEq(smod(-0), NaN);
|
||||
assertEq(smod(1.1), 0);
|
||||
assertEq(smod(-1.1), -0);
|
||||
assertEq(smod(Infinity), NaN);
|
||||
assertEq(smod(NaN), NaN);
|
||||
assertEq(smod(undefined), NaN);
|
||||
assertEq(smod(null), NaN);
|
||||
|
||||
function umod_truncate(y) {
|
||||
var yu = y>>>0;
|
||||
return (yu % yu)|0;
|
||||
}
|
||||
assertEq(umod_truncate(5), 0);
|
||||
assertEq(umod_truncate(1), 0);
|
||||
assertEq(umod_truncate(-1), 0);
|
||||
assertEq(umod_truncate(0), 0);
|
||||
assertEq(umod_truncate(-0), 0);
|
||||
assertEq(umod_truncate(1.1), 0);
|
||||
assertEq(umod_truncate(-1.1), 0);
|
||||
assertEq(umod_truncate(Infinity), 0);
|
||||
assertEq(umod_truncate(NaN), 0);
|
||||
assertEq(umod_truncate(undefined), 0);
|
||||
assertEq(umod_truncate(null), 0);
|
||||
|
||||
function shifted_umod_truncate(y) {
|
||||
var yu = y>>>1;
|
||||
return (yu % yu)|0;
|
||||
}
|
||||
assertEq(shifted_umod_truncate(5), 0);
|
||||
assertEq(shifted_umod_truncate(2), 0);
|
||||
assertEq(shifted_umod_truncate(1), 0);
|
||||
assertEq(shifted_umod_truncate(-1), 0);
|
||||
assertEq(shifted_umod_truncate(0), 0);
|
||||
assertEq(shifted_umod_truncate(-0), 0);
|
||||
assertEq(shifted_umod_truncate(1.1), 0);
|
||||
assertEq(shifted_umod_truncate(-1.1), 0);
|
||||
assertEq(shifted_umod_truncate(Infinity), 0);
|
||||
assertEq(shifted_umod_truncate(NaN), 0);
|
||||
assertEq(shifted_umod_truncate(undefined), 0);
|
||||
assertEq(shifted_umod_truncate(null), 0);
|
||||
|
||||
function umod(y) {
|
||||
var yu = y>>>0;
|
||||
return yu % yu;
|
||||
}
|
||||
assertEq(umod(5), 0);
|
||||
assertEq(umod(1), 0);
|
||||
assertEq(umod(-1), 0);
|
||||
assertEq(umod(0), NaN);
|
||||
assertEq(umod(-0), NaN);
|
||||
assertEq(umod(1.1), 0);
|
||||
assertEq(umod(-1.1), 0);
|
||||
assertEq(umod(Infinity), NaN);
|
||||
assertEq(umod(NaN), NaN);
|
||||
assertEq(umod(undefined), NaN);
|
||||
assertEq(umod(null), NaN);
|
||||
|
||||
function shifted_umod(y) {
|
||||
var yu = y>>>1;
|
||||
return yu % yu;
|
||||
}
|
||||
assertEq(shifted_umod(5), 0);
|
||||
assertEq(shifted_umod(2), 0);
|
||||
assertEq(shifted_umod(1), NaN);
|
||||
assertEq(shifted_umod(-1), 0);
|
||||
assertEq(shifted_umod(0), NaN);
|
||||
assertEq(shifted_umod(-0), NaN);
|
||||
assertEq(shifted_umod(1.1), NaN);
|
||||
assertEq(shifted_umod(-1.1), 0);
|
||||
assertEq(shifted_umod(Infinity), NaN);
|
||||
assertEq(shifted_umod(NaN), NaN);
|
||||
assertEq(shifted_umod(undefined), NaN);
|
||||
assertEq(shifted_umod(null), NaN);
|
||||
|
||||
function sdiv_truncate_nonzero(y) {
|
||||
if (y == 0) return -202;
|
||||
return (y / y)|0;
|
||||
}
|
||||
assertEq(sdiv_truncate_nonzero(5), 1);
|
||||
assertEq(sdiv_truncate_nonzero(1), 1);
|
||||
assertEq(sdiv_truncate_nonzero(-1), 1);
|
||||
assertEq(sdiv_truncate_nonzero(0), -202);
|
||||
assertEq(sdiv_truncate_nonzero(-0), -202);
|
||||
assertEq(sdiv_truncate_nonzero(1.1), 1);
|
||||
assertEq(sdiv_truncate_nonzero(-1.1), 1);
|
||||
assertEq(sdiv_truncate_nonzero(Infinity), 0);
|
||||
assertEq(sdiv_truncate_nonzero(NaN), 0);
|
||||
assertEq(sdiv_truncate_nonzero(undefined), 0);
|
||||
assertEq(sdiv_truncate_nonzero(null), 0);
|
||||
|
||||
function sdiv_nonzero(y) {
|
||||
if (y == 0) return -202;
|
||||
return y / y;
|
||||
}
|
||||
assertEq(sdiv_nonzero(5), 1);
|
||||
assertEq(sdiv_nonzero(1), 1);
|
||||
assertEq(sdiv_nonzero(-1), 1);
|
||||
assertEq(sdiv_nonzero(0), -202);
|
||||
assertEq(sdiv_nonzero(-0), -202);
|
||||
assertEq(sdiv_nonzero(1.1), 1);
|
||||
assertEq(sdiv_nonzero(-1.1), 1);
|
||||
assertEq(sdiv_nonzero(Infinity), NaN);
|
||||
assertEq(sdiv_nonzero(NaN), NaN);
|
||||
assertEq(sdiv_nonzero(undefined), NaN);
|
||||
assertEq(sdiv_nonzero(null), NaN);
|
||||
|
||||
function udiv_truncate_nonzero(y) {
|
||||
var yu = y>>>0;
|
||||
if (yu == 0) return -202;
|
||||
return (yu / yu)|0;
|
||||
}
|
||||
assertEq(udiv_truncate_nonzero(5), 1);
|
||||
assertEq(udiv_truncate_nonzero(1), 1);
|
||||
assertEq(udiv_truncate_nonzero(-1), 1);
|
||||
assertEq(udiv_truncate_nonzero(0), -202);
|
||||
assertEq(udiv_truncate_nonzero(-0), -202);
|
||||
assertEq(udiv_truncate_nonzero(1.1), 1);
|
||||
assertEq(udiv_truncate_nonzero(-1.1), 1);
|
||||
assertEq(udiv_truncate_nonzero(Infinity), -202);
|
||||
assertEq(udiv_truncate_nonzero(NaN), -202);
|
||||
assertEq(udiv_truncate_nonzero(undefined), -202);
|
||||
assertEq(udiv_truncate_nonzero(null), -202);
|
||||
|
||||
function shifted_udiv_truncate_nonzero(y) {
|
||||
var yu = y>>>1;
|
||||
if (yu == 0) return -202;
|
||||
return (yu / yu)|0;
|
||||
}
|
||||
assertEq(shifted_udiv_truncate_nonzero(5), 1);
|
||||
assertEq(shifted_udiv_truncate_nonzero(2), 1);
|
||||
assertEq(shifted_udiv_truncate_nonzero(1), -202);
|
||||
assertEq(shifted_udiv_truncate_nonzero(-1), 1);
|
||||
assertEq(shifted_udiv_truncate_nonzero(0), -202);
|
||||
assertEq(shifted_udiv_truncate_nonzero(-0), -202);
|
||||
assertEq(shifted_udiv_truncate_nonzero(1.1), -202);
|
||||
assertEq(shifted_udiv_truncate_nonzero(-1.1), 1);
|
||||
assertEq(shifted_udiv_truncate_nonzero(Infinity), -202);
|
||||
assertEq(shifted_udiv_truncate_nonzero(NaN), -202);
|
||||
assertEq(shifted_udiv_truncate_nonzero(undefined), -202);
|
||||
assertEq(shifted_udiv_truncate_nonzero(null), -202);
|
||||
|
||||
function udiv_nonzero(y) {
|
||||
var yu = y>>>0;
|
||||
if (yu == 0) return -202;
|
||||
return yu / yu;
|
||||
}
|
||||
assertEq(udiv_nonzero(5), 1);
|
||||
assertEq(udiv_nonzero(1), 1);
|
||||
assertEq(udiv_nonzero(-1), 1);
|
||||
assertEq(udiv_nonzero(0), -202);
|
||||
assertEq(udiv_nonzero(-0), -202);
|
||||
assertEq(udiv_nonzero(1.1), 1);
|
||||
assertEq(udiv_nonzero(-1.1), 1);
|
||||
assertEq(udiv_nonzero(Infinity), -202);
|
||||
assertEq(udiv_nonzero(NaN), -202);
|
||||
assertEq(udiv_nonzero(undefined), -202);
|
||||
assertEq(udiv_nonzero(null), -202);
|
||||
|
||||
function shifted_udiv_nonzero(y) {
|
||||
var yu = y>>>1;
|
||||
if (yu == 0) return -202;
|
||||
return yu / yu;
|
||||
}
|
||||
assertEq(shifted_udiv_nonzero(5), 1);
|
||||
assertEq(shifted_udiv_nonzero(2), 1);
|
||||
assertEq(shifted_udiv_nonzero(1), -202);
|
||||
assertEq(shifted_udiv_nonzero(-1), 1);
|
||||
assertEq(shifted_udiv_nonzero(0), -202);
|
||||
assertEq(shifted_udiv_nonzero(-0), -202);
|
||||
assertEq(shifted_udiv_nonzero(1.1), -202);
|
||||
assertEq(shifted_udiv_nonzero(-1.1), 1);
|
||||
assertEq(shifted_udiv_nonzero(Infinity), -202);
|
||||
assertEq(shifted_udiv_nonzero(NaN), -202);
|
||||
assertEq(shifted_udiv_nonzero(undefined), -202);
|
||||
assertEq(shifted_udiv_nonzero(null), -202);
|
||||
|
||||
function smod_truncate_nonzero(y) {
|
||||
if (y == 0) return -202;
|
||||
return (y % y)|0;
|
||||
}
|
||||
assertEq(smod_truncate_nonzero(5), 0);
|
||||
assertEq(smod_truncate_nonzero(1), 0);
|
||||
assertEq(smod_truncate_nonzero(-1), 0);
|
||||
assertEq(smod_truncate_nonzero(0), -202);
|
||||
assertEq(smod_truncate_nonzero(-0), -202);
|
||||
assertEq(smod_truncate_nonzero(1.1), 0);
|
||||
assertEq(smod_truncate_nonzero(-1.1), 0);
|
||||
assertEq(smod_truncate_nonzero(Infinity), 0);
|
||||
assertEq(smod_truncate_nonzero(NaN), 0);
|
||||
assertEq(smod_truncate_nonzero(undefined), 0);
|
||||
assertEq(smod_truncate_nonzero(null), 0);
|
||||
|
||||
function smod_nonzero(y) {
|
||||
if (y == 0) return -202;
|
||||
return y % y;
|
||||
}
|
||||
assertEq(smod_nonzero(5), 0);
|
||||
assertEq(smod_nonzero(1), 0);
|
||||
assertEq(smod_nonzero(-1), -0);
|
||||
assertEq(smod_nonzero(0), -202);
|
||||
assertEq(smod_nonzero(-0), -202);
|
||||
assertEq(smod_nonzero(1.1), 0);
|
||||
assertEq(smod_nonzero(-1.1), -0);
|
||||
assertEq(smod_nonzero(Infinity), NaN);
|
||||
assertEq(smod_nonzero(NaN), NaN);
|
||||
assertEq(smod_nonzero(undefined), NaN);
|
||||
assertEq(smod_nonzero(null), NaN);
|
||||
|
||||
function umod_truncate_nonzero(y) {
|
||||
var yu = y>>>0;
|
||||
if (yu == 0) return -202;
|
||||
return (yu % yu)|0;
|
||||
}
|
||||
assertEq(umod_truncate_nonzero(5), 0);
|
||||
assertEq(umod_truncate_nonzero(1), 0);
|
||||
assertEq(umod_truncate_nonzero(-1), 0);
|
||||
assertEq(umod_truncate_nonzero(0), -202);
|
||||
assertEq(umod_truncate_nonzero(-0), -202);
|
||||
assertEq(umod_truncate_nonzero(1.1), 0);
|
||||
assertEq(umod_truncate_nonzero(-1.1), 0);
|
||||
assertEq(umod_truncate_nonzero(Infinity), -202);
|
||||
assertEq(umod_truncate_nonzero(NaN), -202);
|
||||
assertEq(umod_truncate_nonzero(undefined), -202);
|
||||
assertEq(umod_truncate_nonzero(null), -202);
|
||||
|
||||
function shifted_umod_truncate_nonzero(y) {
|
||||
var yu = y>>>1;
|
||||
if (yu == 0) return -202;
|
||||
return (yu % yu)|0;
|
||||
}
|
||||
assertEq(shifted_umod_truncate_nonzero(5), 0);
|
||||
assertEq(shifted_umod_truncate_nonzero(2), 0);
|
||||
assertEq(shifted_umod_truncate_nonzero(1), -202);
|
||||
assertEq(shifted_umod_truncate_nonzero(-1), 0);
|
||||
assertEq(shifted_umod_truncate_nonzero(0), -202);
|
||||
assertEq(shifted_umod_truncate_nonzero(-0), -202);
|
||||
assertEq(shifted_umod_truncate_nonzero(1.1), -202);
|
||||
assertEq(shifted_umod_truncate_nonzero(-1.1), 0);
|
||||
assertEq(shifted_umod_truncate_nonzero(Infinity), -202);
|
||||
assertEq(shifted_umod_truncate_nonzero(NaN), -202);
|
||||
assertEq(shifted_umod_truncate_nonzero(undefined), -202);
|
||||
assertEq(shifted_umod_truncate_nonzero(null), -202);
|
||||
|
||||
function umod_nonzero(y) {
|
||||
var yu = y>>>0;
|
||||
if (yu == 0) return -202;
|
||||
return yu % yu;
|
||||
}
|
||||
assertEq(umod_nonzero(5), 0);
|
||||
assertEq(umod_nonzero(1), 0);
|
||||
assertEq(umod_nonzero(-1), 0);
|
||||
assertEq(umod_nonzero(0), -202);
|
||||
assertEq(umod_nonzero(-0), -202);
|
||||
assertEq(umod_nonzero(1.1), 0);
|
||||
assertEq(umod_nonzero(-1.1), 0);
|
||||
assertEq(umod_nonzero(Infinity), -202);
|
||||
assertEq(umod_nonzero(NaN), -202);
|
||||
assertEq(umod_nonzero(undefined), -202);
|
||||
assertEq(umod_nonzero(null), -202);
|
||||
|
||||
function shifted_umod_nonzero(y) {
|
||||
var yu = y>>>1;
|
||||
if (yu == 0) return -202;
|
||||
return yu % yu;
|
||||
}
|
||||
assertEq(shifted_umod_nonzero(5), 0);
|
||||
assertEq(shifted_umod_nonzero(2), 0);
|
||||
assertEq(shifted_umod_nonzero(1), -202);
|
||||
assertEq(shifted_umod_nonzero(-1), 0);
|
||||
assertEq(shifted_umod_nonzero(0), -202);
|
||||
assertEq(shifted_umod_nonzero(-0), -202);
|
||||
assertEq(shifted_umod_nonzero(1.1), -202);
|
||||
assertEq(shifted_umod_nonzero(-1.1), 0);
|
||||
assertEq(shifted_umod_nonzero(Infinity), -202);
|
||||
assertEq(shifted_umod_nonzero(NaN), -202);
|
||||
assertEq(shifted_umod_nonzero(undefined), -202);
|
||||
assertEq(shifted_umod_nonzero(null), -202);
|
||||
|
||||
function sdiv_truncate_positive(y) {
|
||||
if (y <= 0) return -202;
|
||||
return (y / y)|0;
|
||||
}
|
||||
assertEq(sdiv_truncate_positive(5), 1);
|
||||
assertEq(sdiv_truncate_positive(1), 1);
|
||||
assertEq(sdiv_truncate_positive(-1), -202);
|
||||
assertEq(sdiv_truncate_positive(0), -202);
|
||||
assertEq(sdiv_truncate_positive(-0), -202);
|
||||
assertEq(sdiv_truncate_positive(1.1), 1);
|
||||
assertEq(sdiv_truncate_positive(-1.1), -202);
|
||||
assertEq(sdiv_truncate_positive(Infinity), 0);
|
||||
assertEq(sdiv_truncate_positive(NaN), 0);
|
||||
assertEq(sdiv_truncate_positive(undefined), 0);
|
||||
assertEq(sdiv_truncate_positive(null), -202);
|
||||
|
||||
function sdiv_positive(y) {
|
||||
if (y <= 0) return -202;
|
||||
return y / y;
|
||||
}
|
||||
assertEq(sdiv_positive(5), 1);
|
||||
assertEq(sdiv_positive(1), 1);
|
||||
assertEq(sdiv_positive(-1), -202);
|
||||
assertEq(sdiv_positive(0), -202);
|
||||
assertEq(sdiv_positive(-0), -202);
|
||||
assertEq(sdiv_positive(1.1), 1);
|
||||
assertEq(sdiv_positive(-1.1), -202);
|
||||
assertEq(sdiv_positive(Infinity), NaN);
|
||||
assertEq(sdiv_positive(NaN), NaN);
|
||||
assertEq(sdiv_positive(undefined), NaN);
|
||||
assertEq(sdiv_positive(null), -202);
|
||||
|
||||
function udiv_truncate_positive(y) {
|
||||
var yu = y>>>0;
|
||||
if (yu <= 0) return -202;
|
||||
return (yu / yu)|0;
|
||||
}
|
||||
assertEq(udiv_truncate_positive(5), 1);
|
||||
assertEq(udiv_truncate_positive(1), 1);
|
||||
assertEq(udiv_truncate_positive(-1), 1);
|
||||
assertEq(udiv_truncate_positive(0), -202);
|
||||
assertEq(udiv_truncate_positive(-0), -202);
|
||||
assertEq(udiv_truncate_positive(1.1), 1);
|
||||
assertEq(udiv_truncate_positive(-1.1), 1);
|
||||
assertEq(udiv_truncate_positive(Infinity), -202);
|
||||
assertEq(udiv_truncate_positive(NaN), -202);
|
||||
assertEq(udiv_truncate_positive(undefined), -202);
|
||||
assertEq(udiv_truncate_positive(null), -202);
|
||||
|
||||
function shifted_udiv_truncate_positive(y) {
|
||||
var yu = y>>>1;
|
||||
if (yu <= 0) return -202;
|
||||
return (yu / yu)|0;
|
||||
}
|
||||
assertEq(shifted_udiv_truncate_positive(5), 1);
|
||||
assertEq(shifted_udiv_truncate_positive(2), 1);
|
||||
assertEq(shifted_udiv_truncate_positive(1), -202);
|
||||
assertEq(shifted_udiv_truncate_positive(-1), 1);
|
||||
assertEq(shifted_udiv_truncate_positive(0), -202);
|
||||
assertEq(shifted_udiv_truncate_positive(-0), -202);
|
||||
assertEq(shifted_udiv_truncate_positive(1.1), -202);
|
||||
assertEq(shifted_udiv_truncate_positive(-1.1), 1);
|
||||
assertEq(shifted_udiv_truncate_positive(Infinity), -202);
|
||||
assertEq(shifted_udiv_truncate_positive(NaN), -202);
|
||||
assertEq(shifted_udiv_truncate_positive(undefined), -202);
|
||||
assertEq(shifted_udiv_truncate_positive(null), -202);
|
||||
|
||||
function udiv_positive(y) {
|
||||
var yu = y>>>0;
|
||||
if (yu <= 0) return -202;
|
||||
return yu / yu;
|
||||
}
|
||||
assertEq(udiv_positive(5), 1);
|
||||
assertEq(udiv_positive(1), 1);
|
||||
assertEq(udiv_positive(-1), 1);
|
||||
assertEq(udiv_positive(0), -202);
|
||||
assertEq(udiv_positive(-0), -202);
|
||||
assertEq(udiv_positive(1.1), 1);
|
||||
assertEq(udiv_positive(-1.1), 1);
|
||||
assertEq(udiv_positive(Infinity), -202);
|
||||
assertEq(udiv_positive(NaN), -202);
|
||||
assertEq(udiv_positive(undefined), -202);
|
||||
assertEq(udiv_positive(null), -202);
|
||||
|
||||
function shifted_udiv_positive(y) {
|
||||
var yu = y>>>1;
|
||||
if (yu <= 0) return -202;
|
||||
return yu / yu;
|
||||
}
|
||||
assertEq(shifted_udiv_positive(5), 1);
|
||||
assertEq(shifted_udiv_positive(2), 1);
|
||||
assertEq(shifted_udiv_positive(1), -202);
|
||||
assertEq(shifted_udiv_positive(-1), 1);
|
||||
assertEq(shifted_udiv_positive(0), -202);
|
||||
assertEq(shifted_udiv_positive(-0), -202);
|
||||
assertEq(shifted_udiv_positive(1.1), -202);
|
||||
assertEq(shifted_udiv_positive(-1.1), 1);
|
||||
assertEq(shifted_udiv_positive(Infinity), -202);
|
||||
assertEq(shifted_udiv_positive(NaN), -202);
|
||||
assertEq(shifted_udiv_positive(undefined), -202);
|
||||
assertEq(shifted_udiv_positive(null), -202);
|
||||
|
||||
function smod_truncate_positive(y) {
|
||||
if (y <= 0) return -202;
|
||||
return (y % y)|0;
|
||||
}
|
||||
assertEq(smod_truncate_positive(5), 0);
|
||||
assertEq(smod_truncate_positive(1), 0);
|
||||
assertEq(smod_truncate_positive(-1), -202);
|
||||
assertEq(smod_truncate_positive(0), -202);
|
||||
assertEq(smod_truncate_positive(-0), -202);
|
||||
assertEq(smod_truncate_positive(1.1), 0);
|
||||
assertEq(smod_truncate_positive(-1.1), -202);
|
||||
assertEq(smod_truncate_positive(Infinity), 0);
|
||||
assertEq(smod_truncate_positive(NaN), 0);
|
||||
assertEq(smod_truncate_positive(undefined), 0);
|
||||
assertEq(smod_truncate_positive(null), -202);
|
||||
|
||||
function smod_positive(y) {
|
||||
if (y <= 0) return -202;
|
||||
return y % y;
|
||||
}
|
||||
assertEq(smod_positive(5), 0);
|
||||
assertEq(smod_positive(1), 0);
|
||||
assertEq(smod_positive(-1), -202);
|
||||
assertEq(smod_positive(0), -202);
|
||||
assertEq(smod_positive(-0), -202);
|
||||
assertEq(smod_positive(1.1), 0);
|
||||
assertEq(smod_positive(-1.1), -202);
|
||||
assertEq(smod_positive(Infinity), NaN);
|
||||
assertEq(smod_positive(NaN), NaN);
|
||||
assertEq(smod_positive(undefined), NaN);
|
||||
assertEq(smod_positive(null), -202);
|
||||
|
||||
function umod_truncate_positive(y) {
|
||||
var yu = y>>>0;
|
||||
if (yu <= 0) return -202;
|
||||
return (yu % yu)|0;
|
||||
}
|
||||
assertEq(umod_truncate_positive(5), 0);
|
||||
assertEq(umod_truncate_positive(1), 0);
|
||||
assertEq(umod_truncate_positive(-1), 0);
|
||||
assertEq(umod_truncate_positive(0), -202);
|
||||
assertEq(umod_truncate_positive(-0), -202);
|
||||
assertEq(umod_truncate_positive(1.1), 0);
|
||||
assertEq(umod_truncate_positive(-1.1), 0);
|
||||
assertEq(umod_truncate_positive(Infinity), -202);
|
||||
assertEq(umod_truncate_positive(NaN), -202);
|
||||
assertEq(umod_truncate_positive(undefined), -202);
|
||||
assertEq(umod_truncate_positive(null), -202);
|
||||
|
||||
function shifted_umod_truncate_positive(y) {
|
||||
var yu = y>>>1;
|
||||
if (yu <= 0) return -202;
|
||||
return (yu % yu)|0;
|
||||
}
|
||||
assertEq(shifted_umod_truncate_positive(5), 0);
|
||||
assertEq(shifted_umod_truncate_positive(2), 0);
|
||||
assertEq(shifted_umod_truncate_positive(1), -202);
|
||||
assertEq(shifted_umod_truncate_positive(-1), 0);
|
||||
assertEq(shifted_umod_truncate_positive(0), -202);
|
||||
assertEq(shifted_umod_truncate_positive(-0), -202);
|
||||
assertEq(shifted_umod_truncate_positive(1.1), -202);
|
||||
assertEq(shifted_umod_truncate_positive(-1.1), 0);
|
||||
assertEq(shifted_umod_truncate_positive(Infinity), -202);
|
||||
assertEq(shifted_umod_truncate_positive(NaN), -202);
|
||||
assertEq(shifted_umod_truncate_positive(undefined), -202);
|
||||
assertEq(shifted_umod_truncate_positive(null), -202);
|
||||
|
||||
function umod_positive(y) {
|
||||
var yu = y>>>0;
|
||||
if (yu <= 0) return -202;
|
||||
return yu % yu;
|
||||
}
|
||||
assertEq(umod_positive(5), 0);
|
||||
assertEq(umod_positive(1), 0);
|
||||
assertEq(umod_positive(-1), 0);
|
||||
assertEq(umod_positive(0), -202);
|
||||
assertEq(umod_positive(-0), -202);
|
||||
assertEq(umod_positive(1.1), 0);
|
||||
assertEq(umod_positive(-1.1), 0);
|
||||
assertEq(umod_positive(Infinity), -202);
|
||||
assertEq(umod_positive(NaN), -202);
|
||||
assertEq(umod_positive(undefined), -202);
|
||||
assertEq(umod_positive(null), -202);
|
||||
|
||||
function shifted_umod_positive(y) {
|
||||
var yu = y>>>1;
|
||||
if (yu <= 0) return -202;
|
||||
return yu % yu;
|
||||
}
|
||||
assertEq(shifted_umod_positive(5), 0);
|
||||
assertEq(shifted_umod_positive(2), 0);
|
||||
assertEq(shifted_umod_positive(1), -202);
|
||||
assertEq(shifted_umod_positive(-1), 0);
|
||||
assertEq(shifted_umod_positive(0), -202);
|
||||
assertEq(shifted_umod_positive(-0), -202);
|
||||
assertEq(shifted_umod_positive(1.1), -202);
|
||||
assertEq(shifted_umod_positive(-1.1), 0);
|
||||
assertEq(shifted_umod_positive(Infinity), -202);
|
||||
assertEq(shifted_umod_positive(NaN), -202);
|
||||
assertEq(shifted_umod_positive(undefined), -202);
|
||||
assertEq(shifted_umod_positive(null), -202);
|
|
@ -389,6 +389,62 @@ BacktrackingAllocator::groupAndQueueRegisters()
|
|||
|
||||
static const size_t MAX_ATTEMPTS = 2;
|
||||
|
||||
bool
|
||||
BacktrackingAllocator::tryAllocateFixed(LiveInterval *interval, bool *success,
|
||||
bool *pfixed, LiveInterval **pconflicting)
|
||||
{
|
||||
// Spill intervals which are required to be in a certain stack slot.
|
||||
if (!interval->requirement()->allocation().isRegister()) {
|
||||
IonSpew(IonSpew_RegAlloc, "stack allocation requirement");
|
||||
interval->setAllocation(interval->requirement()->allocation());
|
||||
*success = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
AnyRegister reg = interval->requirement()->allocation().toRegister();
|
||||
return tryAllocateRegister(registers[reg.code()], interval, success, pfixed, pconflicting);
|
||||
}
|
||||
|
||||
bool
|
||||
BacktrackingAllocator::tryAllocateNonFixed(LiveInterval *interval, bool *success,
|
||||
bool *pfixed, LiveInterval **pconflicting)
|
||||
{
|
||||
// If we want, but do not require an interval to be in a specific
|
||||
// register, only look at that register for allocating and evict
|
||||
// or spill if it is not available. Picking a separate register may
|
||||
// be even worse than spilling, as it will still necessitate moves
|
||||
// and will tie up more registers than if we spilled.
|
||||
if (interval->hint()->kind() == Requirement::FIXED) {
|
||||
AnyRegister reg = interval->hint()->allocation().toRegister();
|
||||
if (!tryAllocateRegister(registers[reg.code()], interval, success, pfixed, pconflicting))
|
||||
return false;
|
||||
if (*success)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Spill intervals which have no hint or register requirement.
|
||||
if (interval->requirement()->kind() == Requirement::NONE) {
|
||||
spill(interval);
|
||||
*success = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!*pconflicting || minimalInterval(interval)) {
|
||||
// Search for any available register which the interval can be
|
||||
// allocated to.
|
||||
for (size_t i = 0; i < AnyRegister::Total; i++) {
|
||||
if (!tryAllocateRegister(registers[i], interval, success, pfixed, pconflicting))
|
||||
return false;
|
||||
if (*success)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// We failed to allocate this interval.
|
||||
JS_ASSERT(!*success);
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
BacktrackingAllocator::processInterval(LiveInterval *interval)
|
||||
{
|
||||
|
@ -426,51 +482,25 @@ BacktrackingAllocator::processInterval(LiveInterval *interval)
|
|||
LiveInterval *conflict;
|
||||
for (size_t attempt = 0;; attempt++) {
|
||||
if (canAllocate) {
|
||||
// Spill intervals which are required to be in a certain stack slot.
|
||||
if (interval->requirement()->kind() == Requirement::FIXED &&
|
||||
!interval->requirement()->allocation().isRegister())
|
||||
{
|
||||
IonSpew(IonSpew_RegAlloc, "stack allocation requirement");
|
||||
interval->setAllocation(interval->requirement()->allocation());
|
||||
return true;
|
||||
}
|
||||
|
||||
bool success = false;
|
||||
fixed = false;
|
||||
conflict = nullptr;
|
||||
|
||||
// If we want, but do not require an interval to be in a specific
|
||||
// register, only look at that register for allocating and evict
|
||||
// or spill if it is not available. Picking a separate register may
|
||||
// be even worse than spilling, as it will still necessitate moves
|
||||
// and will tie up more registers than if we spilled.
|
||||
if (interval->hint()->kind() == Requirement::FIXED) {
|
||||
AnyRegister reg = interval->hint()->allocation().toRegister();
|
||||
bool success;
|
||||
if (!tryAllocateRegister(registers[reg.code()], interval, &success, &fixed, &conflict))
|
||||
// Ok, let's try allocating for this interval.
|
||||
if (interval->requirement()->kind() == Requirement::FIXED) {
|
||||
if (!tryAllocateFixed(interval, &success, &fixed, &conflict))
|
||||
return false;
|
||||
} else {
|
||||
if (!tryAllocateNonFixed(interval, &success, &fixed, &conflict))
|
||||
return false;
|
||||
if (success)
|
||||
return true;
|
||||
}
|
||||
|
||||
// Spill intervals which have no hint or register requirement.
|
||||
if (interval->requirement()->kind() == Requirement::NONE) {
|
||||
spill(interval);
|
||||
// If that worked, we're done!
|
||||
if (success)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (!conflict || minimalInterval(interval)) {
|
||||
// Search for any available register which the interval can be
|
||||
// allocated to.
|
||||
for (size_t i = 0; i < AnyRegister::Total; i++) {
|
||||
bool success;
|
||||
if (!tryAllocateRegister(registers[i], interval, &success, &fixed, &conflict))
|
||||
return false;
|
||||
if (success)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Failed to allocate a register for this interval.
|
||||
// If that didn't work, but we have a non-fixed LiveInterval known
|
||||
// to be conflicting, maybe we can evict it and try again.
|
||||
if (attempt < MAX_ATTEMPTS &&
|
||||
!fixed &&
|
||||
conflict &&
|
||||
|
@ -659,12 +689,8 @@ BacktrackingAllocator::tryAllocateRegister(PhysicalRegister &r, LiveInterval *in
|
|||
if (reg->isDouble() != r.reg.isFloat())
|
||||
return true;
|
||||
|
||||
if (interval->requirement()->kind() == Requirement::FIXED) {
|
||||
if (interval->requirement()->allocation() != LAllocation(r.reg)) {
|
||||
IonSpew(IonSpew_RegAlloc, "%s does not match fixed requirement", r.reg.name());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
JS_ASSERT_IF(interval->requirement()->kind() == Requirement::FIXED,
|
||||
interval->requirement()->allocation() == LAllocation(r.reg));
|
||||
|
||||
for (size_t i = 0; i < interval->numRanges(); i++) {
|
||||
AllocatedRange range(interval, interval->getRange(i)), existing;
|
||||
|
|
|
@ -192,6 +192,8 @@ class BacktrackingAllocator
|
|||
bool tryGroupRegisters(uint32_t vreg0, uint32_t vreg1);
|
||||
bool tryGroupReusedRegister(uint32_t def, uint32_t use);
|
||||
bool groupAndQueueRegisters();
|
||||
bool tryAllocateFixed(LiveInterval *interval, bool *success, bool *pfixed, LiveInterval **pconflicting);
|
||||
bool tryAllocateNonFixed(LiveInterval *interval, bool *success, bool *pfixed, LiveInterval **pconflicting);
|
||||
bool processInterval(LiveInterval *interval);
|
||||
bool processGroup(VirtualRegisterGroup *group);
|
||||
bool setIntervalRequirement(LiveInterval *interval);
|
||||
|
|
|
@ -1420,7 +1420,8 @@ MMod::foldsTo(TempAllocator &alloc, bool useValueNumbers)
|
|||
bool
|
||||
MMod::fallible() const
|
||||
{
|
||||
return !isTruncated();
|
||||
return !isTruncated() &&
|
||||
(isUnsigned() || canBeDivideByZero() || canBeNegativeDividend());
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -894,6 +894,7 @@ CodeGeneratorX86Shared::visitDivSelfI(LDivSelfI *ins)
|
|||
Register output = ToRegister(ins->output());
|
||||
MDiv *mir = ins->mir();
|
||||
|
||||
// If we can't divide by zero, lowering should have just used a constant one.
|
||||
JS_ASSERT(mir->canBeDivideByZero());
|
||||
|
||||
masm.testl(op, op);
|
||||
|
@ -991,6 +992,39 @@ CodeGeneratorX86Shared::visitDivI(LDivI *ins)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CodeGeneratorX86Shared::visitModSelfI(LModSelfI *ins)
|
||||
{
|
||||
Register op = ToRegister(ins->op());
|
||||
Register output = ToRegister(ins->output());
|
||||
MMod *mir = ins->mir();
|
||||
|
||||
// If we're not fallible, lowering should have just used a constant zero.
|
||||
JS_ASSERT(mir->fallible());
|
||||
JS_ASSERT(mir->canBeDivideByZero() || (!mir->isUnsigned() && mir->canBeNegativeDividend()));
|
||||
|
||||
masm.testl(op, op);
|
||||
|
||||
// For a negative operand, we need to return negative zero. We can't
|
||||
// represent that as an int32, so bail if that happens.
|
||||
if (!mir->isUnsigned() && mir->canBeNegativeDividend()) {
|
||||
if (!bailoutIf(Assembler::Signed, ins->snapshot()))
|
||||
return false;
|
||||
}
|
||||
|
||||
// For a zero operand, we need to return NaN. We can't
|
||||
// represent that as an int32, so bail if that happens.
|
||||
if (mir->canBeDivideByZero()) {
|
||||
if (!bailoutIf(Assembler::Zero, ins->snapshot()))
|
||||
return false;
|
||||
}
|
||||
|
||||
// For any other value, return 0.
|
||||
masm.mov(ImmWord(0), output);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
CodeGeneratorX86Shared::visitModPowTwoI(LModPowTwoI *ins)
|
||||
{
|
||||
|
@ -1068,16 +1102,11 @@ CodeGeneratorX86Shared::visitModI(LModI *ins)
|
|||
Register remainder = ToRegister(ins->remainder());
|
||||
Register lhs = ToRegister(ins->lhs());
|
||||
Register rhs = ToRegister(ins->rhs());
|
||||
Register temp = ToRegister(ins->getTemp(0));
|
||||
|
||||
// Required to use idiv.
|
||||
JS_ASSERT(lhs == eax);
|
||||
JS_ASSERT(remainder == edx);
|
||||
JS_ASSERT(temp == eax);
|
||||
|
||||
if (lhs != temp) {
|
||||
masm.mov(lhs, temp);
|
||||
lhs = temp;
|
||||
}
|
||||
JS_ASSERT(ToRegister(ins->getTemp(0)) == eax);
|
||||
|
||||
Label done;
|
||||
ReturnZero *ool = nullptr;
|
||||
|
|
|
@ -94,6 +94,7 @@ class CodeGeneratorX86Shared : public CodeGeneratorShared
|
|||
virtual bool visitDivSelfI(LDivSelfI *ins);
|
||||
virtual bool visitModI(LModI *ins);
|
||||
virtual bool visitModPowTwoI(LModPowTwoI *ins);
|
||||
virtual bool visitModSelfI(LModSelfI *ins);
|
||||
virtual bool visitBitNotI(LBitNotI *ins);
|
||||
virtual bool visitBitOpI(LBitOpI *ins);
|
||||
virtual bool visitShiftI(LShiftI *ins);
|
||||
|
|
|
@ -114,6 +114,25 @@ class LModI : public LBinaryMath<1>
|
|||
}
|
||||
};
|
||||
|
||||
// Modulo of a number by itself. Returns 0 unless the number is zero.
|
||||
class LModSelfI : public LInstructionHelper<1, 1, 0>
|
||||
{
|
||||
public:
|
||||
LIR_HEADER(ModSelfI)
|
||||
|
||||
LModSelfI(const LAllocation &op) {
|
||||
setOperand(0, op);
|
||||
}
|
||||
|
||||
const LAllocation *op() {
|
||||
return getOperand(0);
|
||||
}
|
||||
|
||||
MMod *mir() const {
|
||||
return mir_->toMod();
|
||||
}
|
||||
};
|
||||
|
||||
// This class performs a simple x86 'div', yielding either a quotient or remainder depending on
|
||||
// whether this instruction is defined to output eax (quotient) or edx (remainder).
|
||||
class LUDivOrMod : public LBinaryMath<1>
|
||||
|
|
|
@ -190,7 +190,23 @@ LIRGeneratorX86Shared::lowerModI(MMod *mod)
|
|||
return defineReuseInput(lir, mod, 0);
|
||||
}
|
||||
}
|
||||
LModI *lir = new LModI(useRegister(mod->lhs()), useRegister(mod->rhs()), tempFixed(eax));
|
||||
|
||||
// Optimize x%x. The comments in lowerDivI apply here as well, except
|
||||
// that we return 0 for all cases except when x is 0 and we're not
|
||||
// truncated.
|
||||
if (mod->rhs() == mod->lhs()) {
|
||||
if (mod->isTruncated())
|
||||
return define(new LInteger(0), mod);
|
||||
|
||||
LModSelfI *lir = new LModSelfI(useRegisterAtStart(mod->lhs()));
|
||||
if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo))
|
||||
return false;
|
||||
return define(lir, mod);
|
||||
}
|
||||
|
||||
LModI *lir = new LModI(useFixedAtStart(mod->lhs(), eax),
|
||||
useRegister(mod->rhs()),
|
||||
tempFixed(eax));
|
||||
if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo))
|
||||
return false;
|
||||
return defineFixed(lir, mod, LAllocation(AnyRegister(edx)));
|
||||
|
@ -210,18 +226,18 @@ bool
|
|||
LIRGeneratorX86Shared::lowerUDiv(MDiv *div)
|
||||
{
|
||||
// Optimize x/x. The comments in lowerDivI apply here as well.
|
||||
if (div->getOperand(0) == div->getOperand(1)) {
|
||||
if (div->lhs() == div->rhs()) {
|
||||
if (!div->canBeDivideByZero())
|
||||
return define(new LInteger(1), div);
|
||||
|
||||
LDivSelfI *lir = new LDivSelfI(useRegisterAtStart(div->getOperand(0)));
|
||||
LDivSelfI *lir = new LDivSelfI(useRegisterAtStart(div->lhs()));
|
||||
if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo))
|
||||
return false;
|
||||
return define(lir, div);
|
||||
}
|
||||
|
||||
LUDivOrMod *lir = new LUDivOrMod(useFixedAtStart(div->getOperand(0), eax),
|
||||
useRegister(div->getOperand(1)),
|
||||
LUDivOrMod *lir = new LUDivOrMod(useFixedAtStart(div->lhs(), eax),
|
||||
useRegister(div->rhs()),
|
||||
tempFixed(edx));
|
||||
if (div->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo))
|
||||
return false;
|
||||
|
@ -231,8 +247,19 @@ LIRGeneratorX86Shared::lowerUDiv(MDiv *div)
|
|||
bool
|
||||
LIRGeneratorX86Shared::lowerUMod(MMod *mod)
|
||||
{
|
||||
LUDivOrMod *lir = new LUDivOrMod(useFixedAtStart(mod->getOperand(0), eax),
|
||||
useRegister(mod->getOperand(1)),
|
||||
// Optimize x%x. The comments in lowerModI apply here as well.
|
||||
if (mod->lhs() == mod->rhs()) {
|
||||
if (mod->isTruncated())
|
||||
return define(new LInteger(0), mod);
|
||||
|
||||
LModSelfI *lir = new LModSelfI(useRegisterAtStart(mod->lhs()));
|
||||
if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo))
|
||||
return false;
|
||||
return define(lir, mod);
|
||||
}
|
||||
|
||||
LUDivOrMod *lir = new LUDivOrMod(useFixedAtStart(mod->lhs(), eax),
|
||||
useRegister(mod->rhs()),
|
||||
tempFixed(eax));
|
||||
if (mod->fallible() && !assignSnapshot(lir, Bailout_BaselineInfo))
|
||||
return false;
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
_(DivSelfI) \
|
||||
_(ModI) \
|
||||
_(ModPowTwoI) \
|
||||
_(ModSelfI) \
|
||||
_(PowHalfD) \
|
||||
_(AsmJSUInt32ToDouble) \
|
||||
_(AsmJSUInt32ToFloat32) \
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
_(DivSelfI) \
|
||||
_(ModI) \
|
||||
_(ModPowTwoI) \
|
||||
_(ModSelfI) \
|
||||
_(PowHalfD) \
|
||||
_(AsmJSUInt32ToDouble) \
|
||||
_(AsmJSUInt32ToFloat32) \
|
||||
|
|
|
@ -1669,11 +1669,6 @@ JS_RemoveScriptRootRT(JSRuntime *rt, JSScript **rp)
|
|||
RemoveRoot(rt, (void *)rp);
|
||||
}
|
||||
|
||||
JS_NEVER_INLINE JS_PUBLIC_API(void)
|
||||
JS_AnchorPtr(void *p)
|
||||
{
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(bool)
|
||||
JS_AddExtraGCRootsTracer(JSRuntime *rt, JSTraceDataOp traceOp, void *data)
|
||||
{
|
||||
|
|
|
@ -1987,13 +1987,6 @@ JS_RemoveObjectRootRT(JSRuntime *rt, JSObject **rp);
|
|||
extern JS_PUBLIC_API(void)
|
||||
JS_RemoveScriptRootRT(JSRuntime *rt, JSScript **rp);
|
||||
|
||||
/*
|
||||
* C-compatible version of the Anchor class. It should be called after the last
|
||||
* use of the variable it protects.
|
||||
*/
|
||||
extern JS_NEVER_INLINE JS_PUBLIC_API(void)
|
||||
JS_AnchorPtr(void *p);
|
||||
|
||||
/*
|
||||
* Register externally maintained GC roots.
|
||||
*
|
||||
|
|
|
@ -1095,11 +1095,14 @@ ArrayJoin(JSContext *cx, CallArgs &args)
|
|||
return false;
|
||||
seplen = sepstr->length();
|
||||
} else {
|
||||
static const jschar comma = ',';
|
||||
sepchars = ,
|
||||
seplen = 1;
|
||||
HandlePropertyName comma = cx->names().comma;
|
||||
sepstr = comma;
|
||||
sepchars = comma->chars();
|
||||
seplen = comma->length();
|
||||
}
|
||||
|
||||
JS::Anchor<JSString*> anchor(sepstr);
|
||||
|
||||
// Step 6 is implicit in the loops below
|
||||
|
||||
StringBuffer sb(cx);
|
||||
|
@ -1124,9 +1127,6 @@ ArrayJoin(JSContext *cx, CallArgs &args)
|
|||
return false;
|
||||
}
|
||||
|
||||
// Ensure that sepstr stays alive longer than sepchars.
|
||||
JS_AnchorPtr(sepstr);
|
||||
|
||||
// Step 11
|
||||
JSString *str = sb.finishString();
|
||||
if (!str)
|
||||
|
|
|
@ -564,7 +564,8 @@ JS_FRIEND_API(bool)
|
|||
js::GetOriginalEval(JSContext *cx, HandleObject scope, MutableHandleObject eval)
|
||||
{
|
||||
assertSameCompartment(cx, scope);
|
||||
return scope->global().getOrCreateEval(cx, eval);
|
||||
Rooted<GlobalObject *> global(cx, &scope->global());
|
||||
return GlobalObject::getOrCreateEval(cx, global, eval);
|
||||
}
|
||||
|
||||
JS_FRIEND_API(void)
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
macro(Collator, Collator, "Collator") \
|
||||
macro(CollatorCompareGet, CollatorCompareGet, "Intl_Collator_compare_get") \
|
||||
macro(columnNumber, columnNumber, "columnNumber") \
|
||||
macro(comma, comma, ",") \
|
||||
macro(compare, compare, "compare") \
|
||||
macro(configurable, configurable, "configurable") \
|
||||
macro(construct, construct, "construct") \
|
||||
|
|
|
@ -99,7 +99,7 @@ ReportMoreArgsNeeded(JSContext *cx, const char *name, unsigned required)
|
|||
}
|
||||
|
||||
static inline bool
|
||||
EnsureFunctionHasScript(JSContext *cx, JSFunction *fun)
|
||||
EnsureFunctionHasScript(JSContext *cx, HandleFunction fun)
|
||||
{
|
||||
if (fun->isInterpretedLazy()) {
|
||||
AutoCompartment ac(cx, fun);
|
||||
|
@ -109,7 +109,7 @@ EnsureFunctionHasScript(JSContext *cx, JSFunction *fun)
|
|||
}
|
||||
|
||||
static inline JSScript *
|
||||
GetOrCreateFunctionScript(JSContext *cx, JSFunction *fun)
|
||||
GetOrCreateFunctionScript(JSContext *cx, HandleFunction fun)
|
||||
{
|
||||
MOZ_ASSERT(fun->isInterpreted());
|
||||
if (!EnsureFunctionHasScript(cx, fun))
|
||||
|
@ -707,8 +707,11 @@ Debugger::wrapDebuggeeValue(JSContext *cx, MutableHandleValue vp)
|
|||
if (vp.isObject()) {
|
||||
RootedObject obj(cx, &vp.toObject());
|
||||
|
||||
if (obj->is<JSFunction>() && !EnsureFunctionHasScript(cx, &obj->as<JSFunction>()))
|
||||
return false;
|
||||
if (obj->is<JSFunction>()) {
|
||||
RootedFunction fun(cx, &obj->as<JSFunction>());
|
||||
if (!EnsureFunctionHasScript(cx, fun))
|
||||
return false;
|
||||
}
|
||||
|
||||
DependentAddPtr<ObjectWeakMap> p(cx, objects, obj);
|
||||
if (p) {
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче