diff --git a/.hgtags b/.hgtags index 0337764bd980..ba79f6b2be49 100644 --- a/.hgtags +++ b/.hgtags @@ -26,3 +26,4 @@ d7d64f68423b68a671f623f123e90057ebc49dac UPDATE_PACKAGING_R6 0000000000000000000000000000000000000000 THUNDERBIRD_3_0a3_RELEASE 0cd41f5990807fb6ab52cb59ba3c8e8247281045 GECKO_1_9_1_BASE 8df5a90281cd4d75835e4b7696da200555eed15f GECKO_1_9_1_BASE +8a601ed6bc4c7b3d1e35aa9e81f257512d984bd5 FENNEC_A2 diff --git a/accessible/src/atk/nsAppRootAccessible.cpp b/accessible/src/atk/nsAppRootAccessible.cpp index 8dbc4e11e8c5..4e3a63f503e7 100644 --- a/accessible/src/atk/nsAppRootAccessible.cpp +++ b/accessible/src/atk/nsAppRootAccessible.cpp @@ -563,6 +563,9 @@ nsApplicationAccessibleWrap::Init() // it will overwrite gail_util g_type_class_unref(g_type_class_ref(MAI_TYPE_UTIL)); + // Init atk-bridge now + PR_SetEnv("NO_AT_BRIDGE=0"); + // load and initialize atk-bridge library rv = LoadGtkModule(sAtkBridge); if (NS_SUCCEEDED(rv)) { diff --git a/browser/app/profile/firefox.js b/browser/app/profile/firefox.js index 91dad5fa7cbe..0d258edef5fb 100644 --- a/browser/app/profile/firefox.js +++ b/browser/app/profile/firefox.js @@ -431,7 +431,7 @@ pref("intl.charsetmenu.browser.more2", "chrome://global/locale/intl.properties" pref("intl.charsetmenu.browser.more3", "chrome://global/locale/intl.properties"); pref("intl.charsetmenu.browser.more4", "chrome://global/locale/intl.properties"); pref("intl.charsetmenu.browser.more5", "chrome://global/locale/intl.properties"); -pref("intl.charsetmenu.browser.unicode", "chrome://global/locale/intl.properties"); +pref("intl.charsetmenu.browser.unicode", "UTF-8, UTF-16LE, UTF-16BE, UTF-32, UTF-32LE, UTF-32BE"); pref("intl.charset.detector", "chrome://global/locale/intl.properties"); pref("intl.charset.default", "chrome://global-platform/locale/intl.properties"); pref("font.language.group", "chrome://global/locale/intl.properties"); diff --git a/browser/base/content/aboutRobots-icon-rtl.png b/browser/base/content/aboutRobots-icon-rtl.png index 0cf87d712919..f35501684ad1 100644 Binary files a/browser/base/content/aboutRobots-icon-rtl.png and b/browser/base/content/aboutRobots-icon-rtl.png differ diff --git a/browser/components/feeds/test/Makefile.in b/browser/components/feeds/test/Makefile.in index 1360a42b7273..36265d91dab6 100644 --- a/browser/components/feeds/test/Makefile.in +++ b/browser/components/feeds/test/Makefile.in @@ -45,6 +45,10 @@ include $(DEPTH)/config/autoconf.mk MODULE = test_browser_feeds XPCSHELL_TESTS = unit +DIRS = \ + chrome \ + $(NULL) + include $(topsrcdir)/config/rules.mk _TEST_FILES = test_bug408328.html \ diff --git a/browser/components/feeds/test/chrome/Makefile.in b/browser/components/feeds/test/chrome/Makefile.in new file mode 100644 index 000000000000..ed3f8d957b1a --- /dev/null +++ b/browser/components/feeds/test/chrome/Makefile.in @@ -0,0 +1,61 @@ +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is mozilla.org code. +# +# The Initial Developer of the Original Code is +# Mozilla.org. +# Portions created by the Initial Developer are Copyright (C) 2005 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = ../../../../.. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ +relativesrcdir = browser/components/feeds/test/chrome + +include $(DEPTH)/config/autoconf.mk +include $(topsrcdir)/config/rules.mk + +# sample_feed.atom was copied from toolkit/components/places/tests/chrome +_HTTP_FILES = \ + sample_feed.atom \ + $(NULL) + +_CHROME_FILES = \ + test_423060.xul \ + $(NULL) + +libs:: $(_HTTP_FILES) + $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/tests/$(relativesrcdir) + +libs:: $(_CHROME_FILES) + $(INSTALL) $(foreach f,$^,"$f") $(DEPTH)/_tests/testing/mochitest/chrome/$(relativesrcdir) + diff --git a/browser/components/feeds/test/chrome/sample_feed.atom b/browser/components/feeds/test/chrome/sample_feed.atom new file mode 100644 index 000000000000..add75efb4d68 --- /dev/null +++ b/browser/components/feeds/test/chrome/sample_feed.atom @@ -0,0 +1,23 @@ + + + + Example Feed + + 2003-12-13T18:30:02Z + + + John Doe + + urn:uuid:60a76c80-d399-11d9-b93C-0003939e0af6 + + + + Atom-Powered Robots Run Amok + + urn:uuid:1225c695-cfb8-4ebb-aaaa-80da344efa6a + 2003-12-13T18:30:02Z + + Some text. + + + diff --git a/toolkit/components/places/tests/chrome/test_423060.xul b/browser/components/feeds/test/chrome/test_423060.xul similarity index 100% rename from toolkit/components/places/tests/chrome/test_423060.xul rename to browser/components/feeds/test/chrome/test_423060.xul diff --git a/browser/installer/windows/nsis/installer.nsi b/browser/installer/windows/nsis/installer.nsi index 12ecf3ba16d2..cb1c24d884d5 100755 --- a/browser/installer/windows/nsis/installer.nsi +++ b/browser/installer/windows/nsis/installer.nsi @@ -57,7 +57,8 @@ RequestExecutionLevel user !system 'echo ; > shortcuts.ini' !system 'echo ; > summary.ini' -; USE_UAC_PLUGIN is temporary until Thunderbird has been updated to use the UAC plugin +; USE_UAC_PLUGIN is temporary until all applications have been updated to use +; the UAC plugin !define USE_UAC_PLUGIN Var TmpVal @@ -72,7 +73,6 @@ Var AddDesktopSC !include FileFunc.nsh !include LogicLib.nsh !include MUI.nsh -!include TextFunc.nsh !include WinMessages.nsh !include WinVer.nsh !include WordFunc.nsh @@ -83,11 +83,6 @@ Var AddDesktopSC !insertmacro StrFilter !insertmacro WordReplace -; NSIS provided macros that we have overridden -!include overrides.nsh -!insertmacro LocateNoDetails -!insertmacro TextCompareNoDetails - ; The following includes are custom. !include branding.nsi !include defines.nsi @@ -105,7 +100,6 @@ VIAddVersionKey "OriginalFilename" "setup.exe" !insertmacro ChangeMUIHeaderImage !insertmacro CheckForFilesInUse !insertmacro CleanUpdatesDir -!insertmacro CloseApp !insertmacro CopyFilesFromDir !insertmacro CreateRegKey !insertmacro GetPathFromString @@ -289,10 +283,9 @@ Section "-Application" APP_IDX ClearErrors ReadRegStr $R0 HKLM "Software\Apple Computer, Inc.\QuickTime" "InstallDir" ${Unless} ${Errors} - Push $R0 - ${GetPathFromRegStr} - Pop $R0 - ${Unless} ${Errors} + ${GetLongPath} $R0 "$R0" + ${Unless} $R0 == "" + ClearErrors GetFullPathName $R0 "$R0\Plugins\nsIQTScriptablePlugin.xpt" ${Unless} ${Errors} ${LogHeader} "Copying QuickTime Scriptable Component" @@ -368,8 +361,12 @@ Section "-Application" APP_IDX ${FixClassKeys} ; On install always add the FirefoxHTML and FirefoxURL keys. - ; An empty string is used for the 5th param because FirefoxHTML is not a - ; protocol handler. + ; An empty string is used for the 5th param because FirefoxHTML and FirefoxURL + ; are not protocol handlers. + ${GetLongPath} "$INSTDIR\${FileMainEXE}" $8 + StrCpy $2 "$\"$8$\" -requestPending -osint -url $\"%1$\"" + StrCpy $3 "$\"%1$\",,0,0,,,," + ${AddDDEHandlerValues} "FirefoxHTML" "$2" "$8,1" "${AppRegName} Document" "" \ "${DDEApplication}" "$3" "WWW_OpenURL" diff --git a/browser/installer/windows/nsis/uninstaller.nsi b/browser/installer/windows/nsis/uninstaller.nsi index f2cbd9d48c2f..fe05d2e57fce 100755 --- a/browser/installer/windows/nsis/uninstaller.nsi +++ b/browser/installer/windows/nsis/uninstaller.nsi @@ -52,7 +52,8 @@ RequestExecutionLevel user !addplugindir ./ -; USE_UAC_PLUGIN is temporary until Thunderbird has been updated to use the UAC plugin +; USE_UAC_PLUGIN is temporary until all applications have been updated to use +; the UAC plugin !define USE_UAC_PLUGIN ; prevents compiling of the reg write logging. @@ -65,7 +66,6 @@ Var TmpVal !include FileFunc.nsh !include LogicLib.nsh !include MUI.nsh -!include TextFunc.nsh !include WinMessages.nsh !include WinVer.nsh !include WordFunc.nsh diff --git a/browser/locales/Makefile.in b/browser/locales/Makefile.in index c230cb2ac6af..f423884e370a 100644 --- a/browser/locales/Makefile.in +++ b/browser/locales/Makefile.in @@ -84,11 +84,12 @@ APP_VERSION := $(shell cat $(srcdir)/../config/version.txt) PWD := $(shell pwd) core_abspath = $(if $(findstring :,$(1)),$(1),$(if $(filter /%,$(1)),$(1),$(PWD)/$(1))) -# ZIP_IN is defaulted to be compatible with the files the wget-en-US target -# pulls. You may override ZIP_IN if you provide your own files. You also _must_ -# override ZIP_IN when MOZ_PKG_PRETTYNAMES is defined - the default will not +# These are defaulted to be compatible with the files the wget-en-US target +# pulls. You may override them if you provide your own files. You _must_ +# override them when MOZ_PKG_PRETTYNAMES is defined - the defaults will not # work in that case. ZIP_IN ?= $(_ABS_DIST)/$(PACKAGE) +WIN32_INSTALLER_IN ?= $(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe DEFINES += \ -DAB_CD=$(AB_CD) \ @@ -240,7 +241,6 @@ endif chmod 0755 $(WIN32_INSTALLER_OUT) ifeq (WINNT,$(OS_ARCH)) -repackage-win32-installer-%: WIN32_INSTALLER_IN=$(_ABS_DIST)/$(PKG_INST_PATH)$(PKG_INST_BASENAME).exe repackage-win32-installer-%: $(WIN32_INSTALLER_IN) libs-% @$(MAKE) repackage-win32-installer AB_CD=$* WIN32_INSTALLER_IN=$(WIN32_INSTALLER_IN) else @@ -250,7 +250,7 @@ endif ifneq (,$(filter mac cocoa,$(MOZ_WIDGET_TOOLKIT))) STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME)/$(_APPNAME)/Contents/MacOS else -STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_APPNAME) +STAGEDIST = $(_ABS_DIST)/l10n-stage/$(MOZ_PKG_DIR) endif $(STAGEDIST): AB_CD:=en-US @@ -318,7 +318,6 @@ endif $(NSINSTALL) -D $(DIST)/$(PKG_PATH) mv -f "$(DIST)/l10n-stage/$(PACKAGE)" "$(DIST)/$(PACKAGE)" -repackage-zip-%: ZIP_IN=$(_ABS_DIST)/$(PACKAGE) repackage-zip-%: $(ZIP_IN) $(STAGEDIST) libs-% @$(MAKE) repackage-zip AB_CD=$* ZIP_IN=$(ZIP_IN) @@ -330,7 +329,7 @@ langpack-%: libs-% $(NSINSTALL) -D $(DIST)/$(PKG_LANGPACK_PATH) $(PERL) $(topsrcdir)/config/preprocessor.pl $(DEFINES) $(ACDEFINES) -I$(call EXPAND_LOCALE_SRCDIR,toolkit/locales)/defines.inc -I$(LOCALE_SRCDIR)/defines.inc $(srcdir)/generic/install.rdf > $(FINAL_TARGET)/install.rdf cd $(DIST)/xpi-stage/locale-$(AB_CD) && \ - $(ZIP) -r9D $(LANGPACK_FILE) install.rdf chrome/$(AB_CD).jar chrome.manifest + $(ZIP) -r9D $(LANGPACK_FILE) install.rdf chrome chrome.manifest -x chrome/$(AB_CD).manifest # This is a generic target that will make a langpack, repack ZIP (+tarball) # builds, and repack an installer if applicable. It is called from the @@ -425,6 +424,17 @@ endif # Set the permissions that the folders will have in ftp once uploaded chmod -vR 775 $(UPLOAD_DIR) +l10n-upload-%: AB_CD=$* +l10n-upload-%: + $(PYTHON) $(topsrcdir)/build/upload.py --base-path $(DIST) "$(DIST)/$(PACKAGE)" $(DIST)/$(LANGPACK) +ifdef MOZ_MAKE_COMPLETE_MAR + $(PYTHON) $(topsrcdir)/build/upload.py --base-path $(DIST) $(DIST)/$(COMPLETE_MAR) +endif +ifeq (WINNT, $(OS_ARCH)) + $(PYTHON) $(topsrcdir)/build/upload.py --base-path $(DIST) "$(INSTALLER_PACKAGE)" +endif + + merge-%: ifdef LOCALE_MERGEDIR $(RM) -rf $(LOCALE_MERGEDIR) diff --git a/browser/themes/gnomestripe/browser/Privacy-16.png b/browser/themes/gnomestripe/browser/Privacy-16.png index 650986c94cbf..70c5dae5fb87 100644 Binary files a/browser/themes/gnomestripe/browser/Privacy-16.png and b/browser/themes/gnomestripe/browser/Privacy-16.png differ diff --git a/browser/themes/gnomestripe/browser/Search-glass-rtl.png b/browser/themes/gnomestripe/browser/Search-glass-rtl.png index 01fb204fd6be..6f3687d0ac4c 100644 Binary files a/browser/themes/gnomestripe/browser/Search-glass-rtl.png and b/browser/themes/gnomestripe/browser/Search-glass-rtl.png differ diff --git a/browser/themes/gnomestripe/browser/Toolbar-small.png b/browser/themes/gnomestripe/browser/Toolbar-small.png index 8a10dbe5de95..dceffee8562e 100644 Binary files a/browser/themes/gnomestripe/browser/Toolbar-small.png and b/browser/themes/gnomestripe/browser/Toolbar-small.png differ diff --git a/browser/themes/gnomestripe/browser/Toolbar.png b/browser/themes/gnomestripe/browser/Toolbar.png index 85910b16ee4f..a1dca6a7220f 100644 Binary files a/browser/themes/gnomestripe/browser/Toolbar.png and b/browser/themes/gnomestripe/browser/Toolbar.png differ diff --git a/browser/themes/gnomestripe/browser/identity.png b/browser/themes/gnomestripe/browser/identity.png index 44dbb88b359a..f3f790e9efd4 100644 Binary files a/browser/themes/gnomestripe/browser/identity.png and b/browser/themes/gnomestripe/browser/identity.png differ diff --git a/browser/themes/gnomestripe/browser/pageInfo.png b/browser/themes/gnomestripe/browser/pageInfo.png index c77b368c73d0..2cbb15df97fd 100644 Binary files a/browser/themes/gnomestripe/browser/pageInfo.png and b/browser/themes/gnomestripe/browser/pageInfo.png differ diff --git a/browser/themes/gnomestripe/browser/preferences/Options.png b/browser/themes/gnomestripe/browser/preferences/Options.png index 4ffe4dceaa1e..a32fb7a3dee9 100644 Binary files a/browser/themes/gnomestripe/browser/preferences/Options.png and b/browser/themes/gnomestripe/browser/preferences/Options.png differ diff --git a/browser/themes/gnomestripe/browser/preview.png b/browser/themes/gnomestripe/browser/preview.png index 11cd60fe49c6..ec75f5cdf424 100644 Binary files a/browser/themes/gnomestripe/browser/preview.png and b/browser/themes/gnomestripe/browser/preview.png differ diff --git a/browser/themes/gnomestripe/browser/tabbrowser/newtab.png b/browser/themes/gnomestripe/browser/tabbrowser/newtab.png index e2a388d5dff7..032e3ff2856e 100644 Binary files a/browser/themes/gnomestripe/browser/tabbrowser/newtab.png and b/browser/themes/gnomestripe/browser/tabbrowser/newtab.png differ diff --git a/browser/themes/pinstripe/browser/tabbrowser/newtab.png b/browser/themes/pinstripe/browser/tabbrowser/newtab.png index 52300d11fadb..3bfdac142749 100644 Binary files a/browser/themes/pinstripe/browser/tabbrowser/newtab.png and b/browser/themes/pinstripe/browser/tabbrowser/newtab.png differ diff --git a/browser/themes/winstripe/browser/tabbrowser/newtab.png b/browser/themes/winstripe/browser/tabbrowser/newtab.png index f31f7d05e2ac..53fbe3c12561 100644 Binary files a/browser/themes/winstripe/browser/tabbrowser/newtab.png and b/browser/themes/winstripe/browser/tabbrowser/newtab.png differ diff --git a/build/upload.py b/build/upload.py index d7ea1afbed42..d6f039cf5438 100644 --- a/build/upload.py +++ b/build/upload.py @@ -57,6 +57,7 @@ import sys, os from optparse import OptionParser +from subprocess import Popen, PIPE from util import check_call def RequireEnvironmentVariable(v): @@ -104,7 +105,10 @@ def AppendOptionalArgsToSSHCommandline(cmdline, port, ssh_key): if port is not None: cmdline.append("-P%d" % port) if ssh_key is not None: - cmdline.extend(["-i", WindowsPathToMsysPath(ssh_key)]) + # Don't interpret ~ paths - ssh can handle that on its own + if not ssh_key.startswith('~'): + ssh_key = WindowsPathToMsysPath(ssh_key) + cmdline.extend(["-o", "IdentityFile=%s" % ssh_key]) def DoSSHCommand(command, user, host, port=None, ssh_key=None): """Execute command on user@host using ssh. Optionally use @@ -112,7 +116,12 @@ def DoSSHCommand(command, user, host, port=None, ssh_key=None): cmdline = ["ssh"] AppendOptionalArgsToSSHCommandline(cmdline, port, ssh_key) cmdline.extend(["%s@%s" % (user, host), command]) - check_call(cmdline) + cmd = Popen(cmdline, stdout=PIPE) + retcode = cmd.wait() + if retcode != 0: + raise Exception("Command %s returned non-zero exit code: %i" % \ + (cmdline, retcode)) + return cmd.stdout.read().strip() def DoSCPFile(file, remote_path, user, host, port=None, ssh_key=None): """Upload file to user@host:remote_path using scp. Optionally use @@ -135,13 +144,19 @@ def GetRemotePath(path, local_file, base_path): dir = dir[len(base_path)+1:].replace('\\','/') return path + dir -def UploadFiles(user, host, path, files, verbose=False, port=None, ssh_key=None, base_path=None, post_upload_command=None): +def UploadFiles(user, host, path, files, verbose=False, port=None, ssh_key=None, base_path=None, upload_to_temp_dir=False, post_upload_command=None): """Upload each file in the list files to user@host:path. Optionally pass port and ssh_key to the ssh commands. If base_path is not None, upload - files including their path relative to base_path. If post_upload_command - is not None, execute that command on the remote host after uploading - all files, passing it the upload path, and the full paths to all files - uploaded. If verbose is True, print status updates while working.""" + files including their path relative to base_path. If upload_to_temp_dir is + True files will be uploaded to a temporary directory on the remote server. + Generally, you should have a post upload command specified in these cases + that can move them around to their correct location(s). + If post_upload_command is not None, execute that command on the remote host + after uploading all files, passing it the upload path, and the full paths to + all files uploaded. + If verbose is True, print status updates while working.""" + if upload_to_temp_dir: + path = DoSSHCommand("mktemp -d", user, host, port=port, ssh_key=ssh_key) if not path.endswith("/"): path += "/" if base_path is not None: @@ -163,20 +178,28 @@ def UploadFiles(user, host, path, files, verbose=False, port=None, ssh_key=None, print "Running post-upload command: " + post_upload_command file_list = '"' + '" "'.join(remote_files) + '"' DoSSHCommand('%s "%s" %s' % (post_upload_command, path, file_list), user, host, port=port, ssh_key=ssh_key) + if upload_to_temp_dir: + DoSSHCommand("rm -rf %s" % path, user, host, port=port, ssh_key=ssh_key) if verbose: print "Upload complete" if __name__ == '__main__': host = RequireEnvironmentVariable('UPLOAD_HOST') user = RequireEnvironmentVariable('UPLOAD_USER') - path = RequireEnvironmentVariable('UPLOAD_PATH') + path = OptionalEnvironmentVariable('UPLOAD_PATH') + upload_to_temp_dir = OptionalEnvironmentVariable('UPLOAD_TO_TEMP') port = OptionalEnvironmentVariable('UPLOAD_PORT') if port is not None: port = int(port) key = OptionalEnvironmentVariable('UPLOAD_SSH_KEY') post_upload_command = OptionalEnvironmentVariable('POST_UPLOAD_CMD') + if (not path and not upload_to_temp_dir) or (path and upload_to_temp_dir): + print "One (and only one of UPLOAD_PATH or UPLOAD_TO_TEMP must be " + \ + "defined." + sys.exit(1) if sys.platform == 'win32': - path = FixupMsysPath(path) + if path is not None: + path = FixupMsysPath(path) if post_upload_command is not None: post_upload_command = FixupMsysPath(post_upload_command) @@ -190,10 +213,10 @@ if __name__ == '__main__': sys.exit(1) try: UploadFiles(user, host, path, args, base_path=options.base_path, - port=port, ssh_key=key, post_upload_command=post_upload_command, + port=port, ssh_key=key, upload_to_temp_dir=upload_to_temp_dir, + post_upload_command=post_upload_command, verbose=True) except IOError, (strerror): print strerror except Exception, (err): print err - diff --git a/config/autoconf.mk.in b/config/autoconf.mk.in index 80339f290377..0444e40fbf9e 100644 --- a/config/autoconf.mk.in +++ b/config/autoconf.mk.in @@ -132,7 +132,6 @@ MOZ_USE_NATIVE_UCONV = @MOZ_USE_NATIVE_UCONV@ MOZ_BRANDING_DIRECTORY = @MOZ_BRANDING_DIRECTORY@ XPCOM_USE_LEA = @XPCOM_USE_LEA@ JS_ULTRASPARC_OPTS = @JS_ULTRASPARC_OPTS@ -JS_STATIC_BUILD = @JS_STATIC_BUILD@ MOZ_ENABLE_POSTSCRIPT = @MOZ_ENABLE_POSTSCRIPT@ MOZ_INSTALLER = @MOZ_INSTALLER@ MOZ_UPDATER = @MOZ_UPDATER@ diff --git a/config/config.mk b/config/config.mk index 9a222eacdf73..910032530147 100644 --- a/config/config.mk +++ b/config/config.mk @@ -73,6 +73,8 @@ CHECK_VARS := \ SHORT_LIBNAME \ XPI_PKGNAME \ INSTALL_EXTENSION_ID \ + SHARED_LIBRARY_NAME \ + STATIC_LIBRARY_NAME \ $(NULL) # checks for internal spaces or trailing spaces in the variable @@ -359,6 +361,18 @@ DSO_PIC_CFLAGS= endif endif +ifndef SHARED_LIBRARY_NAME +ifdef LIBRARY_NAME +SHARED_LIBRARY_NAME=$(LIBRARY_NAME) +endif +endif + +ifndef STATIC_LIBRARY_NAME +ifdef LIBRARY_NAME +STATIC_LIBRARY_NAME=$(LIBRARY_NAME) +endif +endif + # This comes from configure ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE NO_PROFILE_GUIDED_OPTIMIZE = 1 diff --git a/config/mangle.c b/config/mangle.c deleted file mode 100644 index b4e945811367..000000000000 --- a/config/mangle.c +++ /dev/null @@ -1,139 +0,0 @@ -/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ -/* ***** BEGIN LICENSE BLOCK ***** - * Version: MPL 1.1/GPL 2.0/LGPL 2.1 - * - * The contents of this file are subject to the Mozilla Public License Version - * 1.1 (the "License"); you may not use this file except in compliance with - * the License. You may obtain a copy of the License at - * http://www.mozilla.org/MPL/ - * - * Software distributed under the License is distributed on an "AS IS" basis, - * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License - * for the specific language governing rights and limitations under the - * License. - * - * The Original Code is mozilla.org code. - * - * The Initial Developer of the Original Code is - * Netscape Communications Corporation. - * Portions created by the Initial Developer are Copyright (C) 1998 - * the Initial Developer. All Rights Reserved. - * - * Contributor(s): - * - * Alternatively, the contents of this file may be used under the terms of - * either of the GNU General Public License Version 2 or later (the "GPL"), - * or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), - * in which case the provisions of the GPL or the LGPL are applicable instead - * of those above. If you wish to allow use of your version of this file only - * under the terms of either the GPL or the LGPL, and not to allow others to - * use your version of this file under the terms of the MPL, indicate your - * decision by deleting the provisions above and replace them with the notice - * and other provisions required by the GPL or the LGPL. If you do not delete - * the provisions above, a recipient may use your version of this file under - * the terms of any one of the MPL, the GPL or the LGPL. - * - * ***** END LICENSE BLOCK ***** */ - -#include -#include -#include - -HANDLE hMangleFile; - -void Usage(void) -{ - fprintf(stderr, "MANGLE: \n"); -} - -BOOL MangleFile( const char *real_name, const char *mangle_name ) -{ - int len; - DWORD dwWritten; - char buffer[2048]; - - if( mangle_name && *mangle_name && strcmpi(real_name, mangle_name) ) { - printf("Mangle: renaming %s to %s\n", real_name, mangle_name); - - if( ! MoveFile(real_name, "X_MANGLE.TMP") ) { - fprintf(stderr, "MANGLE: cannot rename %s to X_MANGLE.TMP\n", - real_name); - return FALSE; - } - - if( ! MoveFile("X_MANGLE.TMP", mangle_name) ) { - MoveFile("X_MANGLE.TMP", real_name); - fprintf(stderr, "MANGLE: cannot rename X_MANGLE.TMP to %s\n", - mangle_name); - return FALSE; - } - - len = sprintf(buffer, "mv %s %s\r\n", mangle_name, real_name); - - if( (WriteFile( hMangleFile, buffer, len, &dwWritten, NULL ) == FALSE) || - (dwWritten != len) ) { - fprintf(stderr, "MANGLE: error writing to UNMANGLE.BAT\n"); - return FALSE; - } - } - return TRUE; -} - - -int main( int argc, char *argv[] ) -{ - WIN32_FIND_DATA find_data; - HANDLE hFoundFile; - - if( argc != 1 ) { - Usage(); - return 2; - } - - - hMangleFile = CreateFile("unmangle.bat", /* name */ - GENERIC_READ|GENERIC_WRITE, /* access mode */ - 0, /* share mode */ - NULL, /* security descriptor */ - CREATE_NEW, /* how to create */ - FILE_ATTRIBUTE_NORMAL, /* file attributes */ - NULL ); /* template file */ - - if( hMangleFile == INVALID_HANDLE_VALUE ) { - if( GetLastError() == ERROR_FILE_EXISTS ) { - fprintf(stderr, "MANGLE: UNMANGLE.BAT already exists\n"); - } else { - fprintf(stderr, "MANGLE: cannot open UNMANGLE.BAT\n"); - } - return 1; - } - - if( (hFoundFile = FindFirstFile("*.*", &find_data)) == INVALID_HANDLE_VALUE ) { - fprintf(stderr, "MANGLE: cannot read directory\n"); - return 1; - } - - do { - if( !MangleFile(find_data.cFileName, find_data.cAlternateFileName) ) { - fprintf(stderr, "MANGLE: cannot rename %s to %s\n", - find_data.cFileName, find_data.cAlternateFileName ); - - FindClose( hFoundFile ); - CloseHandle( hMangleFile ); - return 1; - } - } while( FindNextFile(hFoundFile, &find_data) ); - FindClose( hFoundFile ); - - { - int len; - DWORD dwWritten; - char buffer[255]; - - len = sprintf(buffer, "del unmangle.bat\r\n"); - WriteFile ( hMangleFile, buffer, len, &dwWritten, NULL ); - } - CloseHandle( hMangleFile ); - - return 0; -} diff --git a/config/mangle.exe b/config/mangle.exe deleted file mode 100755 index de63cd81d88b..000000000000 Binary files a/config/mangle.exe and /dev/null differ diff --git a/config/rules.mk b/config/rules.mk index 5e6b589add1c..1d5b7443da1e 100644 --- a/config/rules.mk +++ b/config/rules.mk @@ -219,15 +219,15 @@ endif # ENABLE_TESTS # ifndef LIBRARY -ifdef LIBRARY_NAME +ifdef STATIC_LIBRARY_NAME ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH))) ifdef SHORT_LIBNAME -LIBRARY_NAME := $(SHORT_LIBNAME) -endif -endif -LIBRARY := $(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX) +STATIC_LIBRARY_NAME := $(SHORT_LIBNAME) endif endif +LIBRARY := $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX) +endif # STATIC_LIBRARY_NAME +endif # LIBRARY ifndef HOST_LIBRARY ifdef HOST_LIBRARY_NAME @@ -244,9 +244,9 @@ MKSHLIB = $(MKCSHLIB) endif ifdef MAKE_FRAMEWORK -SHARED_LIBRARY := $(LIBRARY_NAME) +SHARED_LIBRARY := $(SHARED_LIBRARY_NAME) else -SHARED_LIBRARY := $(DLL_PREFIX)$(LIBRARY_NAME)$(DLL_SUFFIX) +SHARED_LIBRARY := $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX) endif ifeq ($(OS_ARCH),OS2) @@ -254,7 +254,7 @@ DEF_FILE := $(SHARED_LIBRARY:.dll=.def) endif ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH))) -IMPORT_LIBRARY := $(LIB_PREFIX)$(LIBRARY_NAME).$(IMPORT_LIB_SUFFIX) +IMPORT_LIBRARY := $(LIB_PREFIX)$(SHARED_LIBRARY_NAME).$(IMPORT_LIB_SUFFIX) endif ifdef MOZ_ENABLE_LIBXUL @@ -319,8 +319,8 @@ CODFILE=$(basename $(@F)).cod endif ifdef MOZ_MAPINFO -ifdef LIBRARY_NAME -MAPFILE=$(LIBRARY_NAME).map +ifdef SHARED_LIBRARY_NAME +MAPFILE=$(SHARED_LIBRARY_NAME).map else MAPFILE=$(basename $(@F)).map endif # LIBRARY_NAME @@ -333,15 +333,8 @@ endif ifdef MAPFILE OS_LDFLAGS += -MAP:$(MAPFILE) -#CFLAGS += -Fm$(MAPFILE) -#CXXFLAGS += -Fm$(MAPFILE) endif -#ifdef CODFILE -#CFLAGS += -Fa$(CODFILE) -FAsc -#CFLAGS += -Fa$(CODFILE) -FAsc -#endif - endif # !GNU_CC ifdef ENABLE_CXX_EXCEPTIONS @@ -841,13 +834,13 @@ ifdef LIBRARY_NAME ifdef EXPORT_LIBRARY ifdef IS_COMPONENT ifdef BUILD_STATIC_LIBS - @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(LIBRARY_NAME) + @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(STATIC_LIBRARY_NAME) ifdef MODULE_NAME @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMP_NAMES) $(MODULE_NAME) endif -endif -else - $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(LIBRARY_NAME) +endif # BUILD_STATIC_LIBS +else # !IS_COMPONENT + $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(STATIC_LIBRARY_NAME) endif # IS_COMPONENT endif # EXPORT_LIBRARY endif # LIBRARY_NAME @@ -1183,7 +1176,7 @@ endif ifeq ($(OS_ARCH),OS2) $(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS) rm -f $@ - echo LIBRARY $(LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@ + echo LIBRARY $(SHARED_LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@ echo PROTMODE >> $@ echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@ echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@ diff --git a/config/system-headers b/config/system-headers index 9a03619aef4b..d043e60d6c0b 100644 --- a/config/system-headers +++ b/config/system-headers @@ -304,6 +304,8 @@ gtk/gtkclipboard.h gtk/gtkcontainer.h gtk/gtkdialog.h gtk/gtkentry.h +gtk/gtkfilechooser.h +gtk/gtkfilechooserdialog.h gtk/gtkfixed.h gtk/gtk.h gtk/gtkiconfactory.h @@ -312,6 +314,7 @@ gtk/gtkimmulticontext.h gtk/gtkinvisible.h gtk/gtkmain.h gtk/gtkmessagedialog.h +gtk/gtkmisc.h gtk/gtkobject.h gtk/gtkprinter.h gtk/gtkprintjob.h diff --git a/configure.in b/configure.in index fdb3427996ed..f5a77b3c8a12 100644 --- a/configure.in +++ b/configure.in @@ -2958,17 +2958,6 @@ dnl NB - later gcc versions require -mmmx for this header to be successfully dnl included (or another option which implies it, such as -march=pentium-mmx) AC_CHECK_HEADERS(mmintrin.h) -AC_MSG_CHECKING(for ARM SIMD support) -AC_TRY_COMPILE([], - [asm("uqadd8 r1, r1, r2");], - result="yes", result="no") -AC_MSG_RESULT("$result") -if test "$result" = "yes"; then - AC_DEFINE(HAVE_ARM_SIMD) - HAVE_ARM_SIMD=1 -fi -AC_SUBST(HAVE_ARM_SIMD) - dnl Check whether the compiler supports the new-style C++ standard dnl library headers (i.e. ) or needs the old "new.h" AC_LANG_CPLUSPLUS @@ -3158,6 +3147,17 @@ AC_SUBST(XLDFLAGS) AC_SUBST(XLIBS) AC_SUBST(XT_LIBS) +AC_MSG_CHECKING(for ARM SIMD support) +AC_TRY_COMPILE([], + [asm("uqadd8 r1, r1, r2");], + result="yes", result="no") +AC_MSG_RESULT("$result") +if test "$result" = "yes"; then + AC_DEFINE(HAVE_ARM_SIMD) + HAVE_ARM_SIMD=1 +fi +AC_SUBST(HAVE_ARM_SIMD) + dnl ======================================================== dnl = pthread support dnl = Start by checking whether the system support pthreads @@ -4379,7 +4379,6 @@ NECKO_COOKIES=1 NECKO_DISK_CACHE=1 NECKO_PROTOCOLS_DEFAULT="about data file ftp gopher http res viewsource" NECKO_SMALL_BUFFERS= -JS_STATIC_BUILD= XPC_IDISPATCH_SUPPORT= @@ -4472,7 +4471,6 @@ basic) NECKO_SMALL_BUFFERS=1 NS_DISABLE_LOGGING=1 NS_PRINTING= - JS_STATIC_BUILD=1 ;; minimal) @@ -4520,7 +4518,6 @@ minimal) NECKO_SMALL_BUFFERS=1 NS_DISABLE_LOGGING=1 NS_PRINTING= - JS_STATIC_BUILD=1 ;; *) @@ -7187,25 +7184,6 @@ else XPCOM_LIBS="$DYNAMIC_XPCOM_LIBS" fi -dnl ======================================================== -dnl = Force JS to be a static lib -dnl ======================================================== -MOZ_ARG_ENABLE_BOOL(js-static-build, -[ --enable-js-static-build Force js to be a static lib], - JS_STATIC_BUILD=1, - JS_STATIC_BUILD= ) - -AC_SUBST(JS_STATIC_BUILD) - -if test -n "$JS_STATIC_BUILD"; then - AC_DEFINE(EXPORT_JS_API) - -if test -z "$BUILD_STATIC_LIBS"; then - AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static]) -fi - -fi - dnl ======================================================== dnl = dnl = Standalone module options @@ -8334,6 +8312,7 @@ if test -z "$MOZ_NATIVE_NSPR"; then ac_configure_args="$ac_configure_args --with-nspr-cflags='$NSPR_CFLAGS'" ac_configure_args="$ac_configure_args --with-nspr-libs='$NSPR_LIBS'" fi +ac_configure_args="$ac_configure_args --with-dist-dir=../../dist" ac_configure_args="$ac_configure_args --includedir=$dist/include" ac_configure_args="$ac_configure_args --bindir=$dist/bin" ac_configure_args="$ac_configure_args --libdir=$dist/lib" diff --git a/content/base/src/nsGkAtomList.h b/content/base/src/nsGkAtomList.h index 905438540ef1..87fc511c497b 100755 --- a/content/base/src/nsGkAtomList.h +++ b/content/base/src/nsGkAtomList.h @@ -300,7 +300,7 @@ GK_ATOM(document, "document") GK_ATOM(DOMAttrModified, "DOMAttrModified") GK_ATOM(DOMCharacterDataModified, "DOMCharacterDataModified") GK_ATOM(DOMNodeInserted, "DOMNodeInserted") -GK_ATOM(DOMNodeInsertedIntoDocument, "DOMNodeInsertedInfoDocument") +GK_ATOM(DOMNodeInsertedIntoDocument, "DOMNodeInsertedIntoDocument") GK_ATOM(DOMNodeRemoved, "DOMNodeRemoved") GK_ATOM(DOMNodeRemovedFromDocument, "DOMNodeRemovedFromDocument") GK_ATOM(DOMSubtreeModified, "DOMSubtreeModified") diff --git a/content/base/src/nsImageLoadingContent.cpp b/content/base/src/nsImageLoadingContent.cpp index 575912b4bcfa..b5f017f6c00e 100644 --- a/content/base/src/nsImageLoadingContent.cpp +++ b/content/base/src/nsImageLoadingContent.cpp @@ -121,11 +121,11 @@ nsImageLoadingContent::DestroyImageLoadingContent() { // Cancel our requests so they won't hold stale refs to us if (mCurrentRequest) { - mCurrentRequest->Cancel(NS_ERROR_FAILURE); + mCurrentRequest->CancelAndForgetObserver(NS_ERROR_FAILURE); mCurrentRequest = nsnull; } if (mPendingRequest) { - mPendingRequest->Cancel(NS_ERROR_FAILURE); + mPendingRequest->CancelAndForgetObserver(NS_ERROR_FAILURE); mPendingRequest = nsnull; } } diff --git a/content/base/test/Makefile.in b/content/base/test/Makefile.in index 7823db1c48a2..cb372b71b8bc 100644 --- a/content/base/test/Makefile.in +++ b/content/base/test/Makefile.in @@ -270,6 +270,8 @@ _TEST_FILES = test_bug5141.html \ test_bug444322.html \ bug444322.txt \ bug444322.js \ + test_bug455629.html \ + bug455629-helper.svg \ $(NULL) # Disabled for now. Mochitest isn't reliable enough for these. diff --git a/content/base/test/bug455629-helper.svg b/content/base/test/bug455629-helper.svg new file mode 100644 index 000000000000..38098585edf0 --- /dev/null +++ b/content/base/test/bug455629-helper.svg @@ -0,0 +1,6 @@ + + + + + + diff --git a/content/base/test/test_bug455629.html b/content/base/test/test_bug455629.html new file mode 100644 index 000000000000..cd4690b1df29 --- /dev/null +++ b/content/base/test/test_bug455629.html @@ -0,0 +1,64 @@ + + + + + Test for Bug 455629 + + + + + +Mozilla Bug 455629 +

+ +
+
+
+
+
+
+
+
+
+
+ + diff --git a/content/events/src/nsDOMMouseScrollEvent.cpp b/content/events/src/nsDOMMouseScrollEvent.cpp index 0338aaa2ff52..2293f65c906f 100644 --- a/content/events/src/nsDOMMouseScrollEvent.cpp +++ b/content/events/src/nsDOMMouseScrollEvent.cpp @@ -46,6 +46,14 @@ nsDOMMouseScrollEvent::nsDOMMouseScrollEvent(nsPresContext* aPresContext, : nsDOMMouseEvent(aPresContext, aEvent ? aEvent : new nsMouseScrollEvent(PR_FALSE, 0, nsnull)) { + if (aEvent) { + mEventIsInternal = PR_FALSE; + } else { + mEventIsInternal = PR_TRUE; + mEvent->time = PR_Now(); + mEvent->refPoint.x = mEvent->refPoint.y = 0; + } + if(mEvent->eventStructType == NS_MOUSE_SCROLL_EVENT) { nsMouseScrollEvent* mouseEvent = static_cast(mEvent); mDetail = mouseEvent->delta; diff --git a/content/html/document/src/nsHTMLContentSink.cpp b/content/html/document/src/nsHTMLContentSink.cpp index 0ba96e520113..faee86c5850d 100644 --- a/content/html/document/src/nsHTMLContentSink.cpp +++ b/content/html/document/src/nsHTMLContentSink.cpp @@ -334,7 +334,7 @@ public: nsresult OpenContainer(const nsIParserNode& aNode); nsresult CloseContainer(const nsHTMLTag aTag, PRBool aMalformed); nsresult AddLeaf(const nsIParserNode& aNode); - nsresult AddLeaf(nsGenericHTMLElement* aContent); + nsresult AddLeaf(nsIContent* aContent); nsresult AddComment(const nsIParserNode& aNode); nsresult End(); @@ -898,6 +898,7 @@ SinkContext::HaveNotifiedForCurrentContent() const nsIContent * SinkContext::Node::Add(nsIContent *child) { + NS_ASSERTION(mContent, "No parent to insert/append into!"); if (mInsertionPoint != -1) { NS_ASSERTION(mNumFlushed == mContent->GetChildCount(), "Inserting multiple children without flushing."); @@ -1153,7 +1154,7 @@ SinkContext::AddLeaf(const nsIParserNode& aNode) } nsresult -SinkContext::AddLeaf(nsGenericHTMLElement* aContent) +SinkContext::AddLeaf(nsIContent* aContent) { NS_ASSERTION(mStackPos > 0, "leaf w/o container"); if (mStackPos <= 0) { @@ -1470,13 +1471,8 @@ SinkContext::FlushText(PRBool* aDidFlush, PRBool aReleaseLast) mLastTextNodeSize += mTextLength; mTextLength = 0; - // Add text to its parent - NS_ASSERTION(mStackPos > 0, "leaf w/o container"); - if (mStackPos <= 0) { - return NS_ERROR_FAILURE; - } - - DidAddContent(mStack[mStackPos - 1].Add(mLastTextNode)); + rv = AddLeaf(mLastTextNode); + NS_ENSURE_SUCCESS(rv, rv); didFlush = PR_TRUE; } @@ -2889,13 +2885,8 @@ nsresult HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode) { nsresult result = NS_OK; - nsGenericHTMLElement* parent = nsnull; if (mCurrentContext) { - parent = mCurrentContext->mStack[mCurrentContext->mStackPos - 1].mContent; - } - - if (parent) { // Create content object nsCOMPtr element; nsCOMPtr nodeInfo; @@ -2923,7 +2914,8 @@ HTMLContentSink::ProcessLINKTag(const nsIParserNode& aNode) if (NS_FAILED(result)) { return result; } - parent->AppendChildTo(element, PR_FALSE); + + mCurrentContext->AddLeaf(element); // s are leaves if (ssle) { ssle->SetEnableUpdates(PR_TRUE); diff --git a/content/mathml/content/crashtests/462929-1.html b/content/mathml/content/crashtests/462929-1.html new file mode 100644 index 000000000000..386d8e138f95 --- /dev/null +++ b/content/mathml/content/crashtests/462929-1.html @@ -0,0 +1,12 @@ + + + + + + + diff --git a/content/mathml/content/crashtests/crashtests.list b/content/mathml/content/crashtests/crashtests.list new file mode 100644 index 000000000000..064093053391 --- /dev/null +++ b/content/mathml/content/crashtests/crashtests.list @@ -0,0 +1 @@ +load 462929-1.html diff --git a/content/xbl/src/nsXBLBinding.cpp b/content/xbl/src/nsXBLBinding.cpp index 356dfdc4b171..6576781ca269 100644 --- a/content/xbl/src/nsXBLBinding.cpp +++ b/content/xbl/src/nsXBLBinding.cpp @@ -725,6 +725,21 @@ nsXBLBinding::GenerateAnonymousContent() if (ni->NamespaceID() != kNameSpaceID_XUL || (localName != nsGkAtoms::observes && localName != nsGkAtoms::_template)) { + // Undo InstallAnonymousContent + PRUint32 childCount = mContent->GetChildCount(); +#ifdef MOZ_XUL + nsCOMPtr xuldoc(do_QueryInterface(doc)); +#endif + for (PRUint32 k = 0; k < childCount; ++k) { + nsIContent* child = mContent->GetChildAt(k); + child->UnbindFromTree(); +#ifdef MOZ_XUL + if (xuldoc) { + xuldoc->RemoveSubtreeFromDocument(child); + } +#endif + } + // Kill all anonymous content. mContent = nsnull; bindingManager->SetContentListFor(mBoundElement, nsnull); diff --git a/content/xbl/src/nsXBLEventHandler.cpp b/content/xbl/src/nsXBLEventHandler.cpp index b85be41cb8a4..46df94f972d6 100644 --- a/content/xbl/src/nsXBLEventHandler.cpp +++ b/content/xbl/src/nsXBLEventHandler.cpp @@ -103,7 +103,7 @@ PRBool nsXBLMouseEventHandler::EventMatched(nsIDOMEvent* aEvent) { nsCOMPtr mouse(do_QueryInterface(aEvent)); - return mProtoHandler->MouseEventMatched(mouse); + return mouse && mProtoHandler->MouseEventMatched(mouse); } nsXBLKeyEventHandler::nsXBLKeyEventHandler(nsIAtom* aEventType, PRUint8 aPhase, diff --git a/content/xslt/src/xslt/txStylesheet.h b/content/xslt/src/xslt/txStylesheet.h index d76e1b99747c..5f6228f1fbe9 100644 --- a/content/xslt/src/xslt/txStylesheet.h +++ b/content/xslt/src/xslt/txStylesheet.h @@ -191,7 +191,7 @@ private: txOwningExpandedNameMap mKeys; // Array of all txStripSpaceTests, sorted in acending order - nsTPtrArray mStripSpaceTests; + nsTArray > mStripSpaceTests; // Default templates nsAutoPtr mContainerTemplate; diff --git a/content/xslt/tests/mochitest/Makefile.in b/content/xslt/tests/mochitest/Makefile.in index 87c99419c02e..ad957d9d77d5 100644 --- a/content/xslt/tests/mochitest/Makefile.in +++ b/content/xslt/tests/mochitest/Makefile.in @@ -46,6 +46,7 @@ include $(topsrcdir)/config/rules.mk _TEST_FILES = test_bug319374.xhtml \ test_bug440974.html \ + test_bug427060.html \ $(NULL) libs:: $(_TEST_FILES) diff --git a/content/xslt/tests/mochitest/test_bug427060.html b/content/xslt/tests/mochitest/test_bug427060.html new file mode 100644 index 000000000000..3acc61b2a412 --- /dev/null +++ b/content/xslt/tests/mochitest/test_bug427060.html @@ -0,0 +1,54 @@ + + + + + Test for Bug 427060 + + + + + +Mozilla Bug 427060 +

+ +
+
+
+ + diff --git a/dom/src/base/crashtests/462947.html b/dom/src/base/crashtests/462947.html new file mode 100644 index 000000000000..09581b3081ad --- /dev/null +++ b/dom/src/base/crashtests/462947.html @@ -0,0 +1,13 @@ + + + + + + + + diff --git a/dom/src/base/crashtests/crashtests.list b/dom/src/base/crashtests/crashtests.list index 2c218e9f84d0..afcaef696f6e 100644 --- a/dom/src/base/crashtests/crashtests.list +++ b/dom/src/base/crashtests/crashtests.list @@ -7,4 +7,5 @@ load 359432-1.xhtml load 369413-1.html load 372554-1.html load 404869-1.xul +load 462947.html load 439206-1.html diff --git a/dom/tests/mochitest/Makefile.in b/dom/tests/mochitest/Makefile.in index 42f4bd3b3ca8..daa65a391115 100644 --- a/dom/tests/mochitest/Makefile.in +++ b/dom/tests/mochitest/Makefile.in @@ -46,6 +46,7 @@ DIRS += \ dom-level0 \ dom-level1-core \ dom-level2-core \ + dom-level2-html \ ajax \ bugs \ chrome \ @@ -54,9 +55,5 @@ DIRS += \ geolocation \ $(NULL) -# dom-level2-html disabled due to failures on multiple platforms -# (bug 427878) -# dom-level2-html \ - include $(topsrcdir)/config/rules.mk diff --git a/dom/tests/mochitest/dom-level2-html/Makefile.in b/dom/tests/mochitest/dom-level2-html/Makefile.in index 7ba5d730a4c1..b101987f3eaf 100644 --- a/dom/tests/mochitest/dom-level2-html/Makefile.in +++ b/dom/tests/mochitest/dom-level2-html/Makefile.in @@ -134,6 +134,9 @@ _TEST_FILES_A = \ test_HTMLCollection12.html \ $(NULL) +# This test is failing on all platforms -- bug 471139 +# test_HTMLDocument12.html \ +# _TEST_FILES_B = \ test_HTMLDirectoryElement01.html \ test_HTMLDivElement01.html \ @@ -148,7 +151,6 @@ _TEST_FILES_B = \ test_HTMLDocument09.html \ test_HTMLDocument10.html \ test_HTMLDocument11.html \ - test_HTMLDocument12.html \ test_HTMLDocument13.html \ test_HTMLDocument14.html \ test_HTMLDocument15.html \ diff --git a/extensions/layout-debug/ui/jar.mn b/extensions/layout-debug/ui/jar.mn index aa29eab7d40a..9d0d5c5ac5ea 100644 --- a/extensions/layout-debug/ui/jar.mn +++ b/extensions/layout-debug/ui/jar.mn @@ -1,4 +1,6 @@ layoutdebug.jar: +% content layoutdebug %content/layoutdebug/ +% locale layoutdebug en-US %locale/en-US/layoutdebug/ content/layoutdebug/contents.rdf (content/contents.rdf) content/layoutdebug/layoutdebug.xul (content/layoutdebug.xul) content/layoutdebug/layoutdebug.js (content/layoutdebug.js) diff --git a/gfx/cairo/cairo/src/cairo-win32-font.c b/gfx/cairo/cairo/src/cairo-win32-font.c index 879cfac79d40..c86cab5a5fcc 100644 --- a/gfx/cairo/cairo/src/cairo-win32-font.c +++ b/gfx/cairo/cairo/src/cairo-win32-font.c @@ -158,7 +158,8 @@ _compute_transform (cairo_win32_scaled_font_t *scaled_font, { cairo_status_t status; - if (NEARLY_ZERO (sc->yx) && NEARLY_ZERO (sc->xy)) { + if (NEARLY_ZERO (sc->yx) && NEARLY_ZERO (sc->xy) && + !NEARLY_ZERO (sc->xx) && !NEARLY_ZERO (sc->yy)) { scaled_font->preserve_axes = TRUE; scaled_font->x_scale = sc->xx; scaled_font->swap_x = (sc->xx < 0); @@ -166,7 +167,8 @@ _compute_transform (cairo_win32_scaled_font_t *scaled_font, scaled_font->swap_y = (sc->yy < 0); scaled_font->swap_axes = FALSE; - } else if (NEARLY_ZERO (sc->xx) && NEARLY_ZERO (sc->yy)) { + } else if (NEARLY_ZERO (sc->xx) && NEARLY_ZERO (sc->yy) && + !NEARLY_ZERO (sc->yx) && !NEARLY_ZERO (sc->xy)) { scaled_font->preserve_axes = TRUE; scaled_font->x_scale = sc->yx; scaled_font->swap_x = (sc->yx < 0); diff --git a/gfx/src/thebes/nsThebesDeviceContext.cpp b/gfx/src/thebes/nsThebesDeviceContext.cpp index 19803875ba44..45cd7da03cac 100644 --- a/gfx/src/thebes/nsThebesDeviceContext.cpp +++ b/gfx/src/thebes/nsThebesDeviceContext.cpp @@ -240,7 +240,7 @@ nsThebesDeviceContext::SetDPI() dpi = 96; #elif defined(MOZ_WIDGET_QT) - // TODO: get real DPI here with Qt methods + // TODO: get real DPI here with Qt methods dpi = 96; #else #error undefined platform dpi @@ -445,8 +445,8 @@ nsThebesDeviceContext::CheckFontExistence(const nsString& aFaceName) NS_IMETHODIMP nsThebesDeviceContext::GetDepth(PRUint32& aDepth) { - nsCOMPtr primaryScreen; if (mDepth == 0) { + nsCOMPtr primaryScreen; mScreenManager->GetPrimaryScreen(getter_AddRefs(primaryScreen)); primaryScreen->GetColorDepth(reinterpret_cast(&mDepth)); } diff --git a/gfx/thebes/public/gfxFont.h b/gfx/thebes/public/gfxFont.h index 2c794f5ea942..c67029e8413c 100644 --- a/gfx/thebes/public/gfxFont.h +++ b/gfx/thebes/public/gfxFont.h @@ -1608,7 +1608,7 @@ public: // The value should be lower value of first font's metrics and the bad font's metrics. // Otherwise, this returns from first font's metrics. enum { UNDERLINE_OFFSET_NOT_SET = PR_INT16_MAX }; - gfxFloat GetUnderlineOffset() { + virtual gfxFloat GetUnderlineOffset() { if (mUnderlineOffset == UNDERLINE_OFFSET_NOT_SET) mUnderlineOffset = GetFontAt(0)->GetMetrics().underlineOffset; return mUnderlineOffset; diff --git a/gfx/thebes/public/gfxFontUtils.h b/gfx/thebes/public/gfxFontUtils.h index 27f1e4b1f415..bd7d52ea4097 100644 --- a/gfx/thebes/public/gfxFontUtils.h +++ b/gfx/thebes/public/gfxFontUtils.h @@ -333,17 +333,23 @@ public: // for use with Windows T2Embed API AddFontResource type API's // effectively hide existing fonts with matching names aHeaderLen is // the size of the header buffer on input, the actual size of the - // EOT header on output aIsCFF returns whether the font has PS style - // glyphs or not (as opposed to TrueType glyphs) + // EOT header on output static nsresult MakeEOTHeader(const PRUint8 *aFontData, PRUint32 aFontDataLength, - nsTArray *aHeader, PRBool *aIsCFF); + nsTArray *aHeader); #endif // checks for valid SFNT table structure, returns true if valid // does *not* guarantee that all font data is valid static PRBool - ValidateSFNTHeaders(const PRUint8 *aFontData, PRUint32 aFontDataLength); + ValidateSFNTHeaders(const PRUint8 *aFontData, PRUint32 aFontDataLength, + PRBool *aIsCFF = nsnull); + + // create a new name table and build a new font with that name table + // appended on the end, returns true on success + static nsresult + RenameFont(const nsAString& aName, const PRUint8 *aFontData, + PRUint32 aFontDataLength, nsTArray *aNewFont); static inline bool IsJoiner(PRUint32 ch) { return (ch == 0x200C || diff --git a/gfx/thebes/public/gfxWindowsFonts.h b/gfx/thebes/public/gfxWindowsFonts.h index df5634158269..e9ca54629d6a 100644 --- a/gfx/thebes/public/gfxWindowsFonts.h +++ b/gfx/thebes/public/gfxWindowsFonts.h @@ -370,6 +370,8 @@ public: nsTArray > *list); void UpdateFontList(); + virtual gfxFloat GetUnderlineOffset(); + protected: void InitFontList(); diff --git a/gfx/thebes/src/gfxFontUtils.cpp b/gfx/thebes/src/gfxFontUtils.cpp index 43ee60a14e55..ce4dde89c89d 100644 --- a/gfx/thebes/src/gfxFontUtils.cpp +++ b/gfx/thebes/src/gfxFontUtils.cpp @@ -46,7 +46,7 @@ #include "nsIPrefLocalizedString.h" #include "nsISupportsPrimitives.h" #include "nsIStreamBufferAccess.h" -#include "nsILocalFile.h" +#include "nsMemory.h" #define NO_RANGE_FOUND 126 // bit 126 in the font unicode ranges is required to be 0 @@ -477,6 +477,7 @@ void gfxFontUtils::GetPrefsFontList(const char *aPrefName, nsTArray& a #pragma pack(1) struct AutoSwap_PRUint16 { + AutoSwap_PRUint16(PRUint16 aValue) { value = NS_SWAP16(aValue); } operator PRUint16() const { return NS_SWAP16(value); } operator PRUint32() const { return NS_SWAP16(value); } operator PRUint64() const { return NS_SWAP16(value); } @@ -484,17 +485,20 @@ struct AutoSwap_PRUint16 { }; struct AutoSwap_PRInt16 { + AutoSwap_PRInt16(PRInt16 aValue) { value = NS_SWAP16(aValue); } operator PRInt16() const { return NS_SWAP16(value); } operator PRUint32() const { return NS_SWAP16(value); } PRInt16 value; }; struct AutoSwap_PRUint32 { + AutoSwap_PRUint32(PRUint32 aValue) { value = NS_SWAP32(aValue); } operator PRUint32() const { return NS_SWAP32(value); } PRUint32 value; }; struct AutoSwap_PRUint64 { + AutoSwap_PRUint64(PRUint64 aValue) { value = NS_SWAP64(aValue); } operator PRUint64() const { return NS_SWAP64(value); } PRUint64 value; }; @@ -557,8 +561,10 @@ struct NameRecord { enum { NAME_ID_FAMILY = 1, NAME_ID_STYLE = 2, + NAME_ID_UNIQUE = 3, NAME_ID_FULL = 4, NAME_ID_VERSION = 5, + NAME_ID_POSTSCRIPT = 6, PLATFORM_ID_UNICODE = 0, // Mac OS uses this typically PLATFORM_ID_MICROSOFT = 3, ENCODING_ID_MICROSOFT_UNICODEBMP = 1, // with Microsoft platformID, BMP-only Unicode encoding @@ -637,7 +643,9 @@ CopySwapUTF16(const PRUint16 *aInBuf, PRUint16 *aOutBuf, PRUint32 aLen) } PRBool -gfxFontUtils::ValidateSFNTHeaders(const PRUint8 *aFontData, PRUint32 aFontDataLength) +gfxFontUtils::ValidateSFNTHeaders(const PRUint8 *aFontData, + PRUint32 aFontDataLength, + PRBool *aIsCFF) { NS_ASSERTION(aFontData && aFontDataLength != 0, "null font data"); @@ -655,6 +663,9 @@ gfxFontUtils::ValidateSFNTHeaders(const PRUint8 *aFontData, PRUint32 aFontDataLe NS_WARNING("invalid font (SFNT version)"); return PR_FALSE; } + + if (aIsCFF) + *aIsCFF = (sfntVersion == 'OTTO'); // iterate through the table headers to find the head, name and OS/2 tables PRBool foundHead = PR_FALSE, foundOS2 = PR_FALSE, foundName = PR_FALSE; @@ -670,11 +681,13 @@ gfxFontUtils::ValidateSFNTHeaders(const PRUint8 *aFontData, PRUint32 aFontDataLe } // table directory entries begin immediately following SFNT header - const TableDirEntry *dirEntry = reinterpret_cast(aFontData + sizeof(SFNTHeader)); + const TableDirEntry *dirEntry = + reinterpret_cast(aFontData + sizeof(SFNTHeader)); PRUint32 checksum = 0; // checksum for font = (checksum of header) + (checksum of tables) - const AutoSwap_PRUint32 *headerData = reinterpret_cast(aFontData); + const AutoSwap_PRUint32 *headerData = + reinterpret_cast(aFontData); // header length is in bytes, checksum calculated in longwords for (i = 0; i < (headerLen >> 2); i++, headerData++) { @@ -798,6 +811,149 @@ gfxFontUtils::ValidateSFNTHeaders(const PRUint8 *aFontData, PRUint32 aFontDataLe return PR_TRUE; } +nsresult +gfxFontUtils::RenameFont(const nsAString& aName, const PRUint8 *aFontData, + PRUint32 aFontDataLength, nsTArray *aNewFont) +{ + NS_ASSERTION(aNewFont, "null font data array"); + + PRUint64 dataLength(aFontDataLength); + + // new name table + static const PRUint32 neededNameIDs[] = {NameRecord::NAME_ID_FAMILY, + NameRecord::NAME_ID_STYLE, + NameRecord::NAME_ID_UNIQUE, + NameRecord::NAME_ID_FULL, + NameRecord::NAME_ID_POSTSCRIPT}; + + // calculate new name table size + PRUint16 nameCount = NS_ARRAY_LENGTH(neededNameIDs); + + // leave room for null-terminator + PRUint16 nameStrLength = (aName.Length() + 1) * sizeof(PRUnichar); + + // round name table size up to 4-byte multiple + PRUint32 nameTableSize = (sizeof(NameHeader) + + sizeof(NameRecord) * nameCount + + nameStrLength + + 3) & ~3; + + if (dataLength + nameTableSize > PR_UINT32_MAX) + return NS_ERROR_FAILURE; + + PRUint32 adjFontDataSize = aFontDataLength + nameTableSize; + + // create new buffer: old font data plus new name table + if (!aNewFont->AppendElements(adjFontDataSize)) + return NS_ERROR_OUT_OF_MEMORY; + + // copy the old font data + PRUint8 *newFontData = reinterpret_cast(aNewFont->Elements()); + + memcpy(newFontData, aFontData, aFontDataLength); + + // null out the last 4 bytes for checksum calculations + memset(newFontData + adjFontDataSize - 4, 0, 4); + + NameHeader *nameHeader = reinterpret_cast(newFontData + + aFontDataLength); + + // -- name header + nameHeader->format = 0; + nameHeader->count = nameCount; + nameHeader->stringOffset = sizeof(NameHeader) + nameCount * sizeof(NameRecord); + + // -- name records + PRUint32 i; + NameRecord *nameRecord = reinterpret_cast(nameHeader + 1); + + for (i = 0; i < nameCount; i++, nameRecord++) { + nameRecord->platformID = NameRecord::PLATFORM_ID_MICROSOFT; + nameRecord->encodingID = NameRecord::ENCODING_ID_MICROSOFT_UNICODEBMP; + nameRecord->languageID = NameRecord::LANG_ID_MICROSOFT_EN_US; + nameRecord->nameID = neededNameIDs[i]; + nameRecord->offset = 0; + nameRecord->length = nameStrLength; + } + + // -- string data, located after the name records, stored in big-endian form + PRUnichar *strData = reinterpret_cast(nameRecord); + + const PRUnichar *nameStr = aName.BeginReading(); + const PRUnichar *nameStrEnd = aName.EndReading(); + while (nameStr < nameStrEnd) { + PRUnichar ch = *nameStr++; + *strData++ = NS_SWAP16(ch); + } + *strData = 0; // add null termination + + // adjust name table header to point to the new name table + SFNTHeader *sfntHeader = reinterpret_cast(newFontData); + + // table directory entries begin immediately following SFNT header + TableDirEntry *dirEntry = + reinterpret_cast(newFontData + sizeof(SFNTHeader)); + + PRUint32 numTables = sfntHeader->numTables; + PRBool foundName = PR_FALSE; + + for (i = 0; i < numTables; i++, dirEntry++) { + if (dirEntry->tag == 'name') { + foundName = PR_TRUE; + break; + } + } + + // function only called if font validates, so this should always be true + NS_ASSERTION(foundName, "attempt to rename font with no name table"); + + // note: dirEntry now points to name record + + // recalculate name table checksum + PRUint32 checkSum = 0; + AutoSwap_PRUint32 *nameData = reinterpret_cast (nameHeader); + AutoSwap_PRUint32 *nameDataEnd = nameData + (nameTableSize >> 2); + + while (nameData < nameDataEnd) + checkSum = checkSum + *nameData++; + + // adjust name table entry to point to new name table + dirEntry->offset = aFontDataLength; + dirEntry->length = nameTableSize; + dirEntry->checkSum = checkSum; + + // fix up checksums + PRUint32 checksum = 0; + + // checksum for font = (checksum of header) + (checksum of tables) + PRUint32 headerLen = sizeof(SFNTHeader) + sizeof(TableDirEntry) * numTables; + const AutoSwap_PRUint32 *headerData = + reinterpret_cast(newFontData); + + // header length is in bytes, checksum calculated in longwords + for (i = 0; i < (headerLen >> 2); i++, headerData++) { + checksum += *headerData; + } + + PRUint32 headOffset = 0; + dirEntry = reinterpret_cast(newFontData + sizeof(SFNTHeader)); + + for (i = 0; i < numTables; i++, dirEntry++) { + if (dirEntry->tag == 'head') { + headOffset = dirEntry->offset; + } + checksum += dirEntry->checkSum; + } + + NS_ASSERTION(headOffset != 0, "no head table for font"); + + HeadTable *headData = reinterpret_cast(newFontData + headOffset); + + headData->checkSumAdjustment = HeadTable::HEAD_CHECKSUM_CALC_CONST - checksum; + + return NS_OK; +} + // Embedded OpenType (EOT) handling // needed for dealing with downloadable fonts on Windows // @@ -892,21 +1048,17 @@ DumpEOTHeader(PRUint8 *aHeader, PRUint32 aHeaderLen) nsresult gfxFontUtils::MakeEOTHeader(const PRUint8 *aFontData, PRUint32 aFontDataLength, - nsTArray *aHeader, PRBool *aIsCFF) + nsTArray *aHeader) { NS_ASSERTION(aFontData && aFontDataLength != 0, "null font data"); NS_ASSERTION(aHeader, "null header"); NS_ASSERTION(aHeader->Length() == 0, "non-empty header passed in"); - NS_ASSERTION(aIsCFF, "null boolean ptr"); - - // assume TrueType - *aIsCFF = PR_FALSE; if (!aHeader->AppendElements(sizeof(EOTFixedHeader))) return NS_ERROR_OUT_OF_MEMORY; - EOTFixedHeader *eotHeader = reinterpret_cast (aHeader->Elements()); + EOTFixedHeader *eotHeader = reinterpret_cast(aHeader->Elements()); memset(eotHeader, 0, sizeof(EOTFixedHeader)); PRUint32 fontDataSize = aFontDataLength; @@ -975,7 +1127,6 @@ gfxFontUtils::MakeEOTHeader(const PRUint8 *aFontData, PRUint32 aFontDataLength, case 'CFF ': // PS-style cubic glyph table foundGlyphs = PR_TRUE; - *aIsCFF = PR_TRUE; break; default: diff --git a/gfx/thebes/src/gfxQuartzFontCache.h b/gfx/thebes/src/gfxQuartzFontCache.h index 802a895f776d..0be3a16b5f37 100644 --- a/gfx/thebes/src/gfxQuartzFontCache.h +++ b/gfx/thebes/src/gfxQuartzFontCache.h @@ -85,7 +85,9 @@ public: protected: // for use with data fonts - MacOSFontEntry(ATSUFontID aFontID, PRUint16 aWeight, PRUint16 aStretch, PRUint32 aItalicStyle, gfxUserFontData *aUserFontData); + MacOSFontEntry(const nsAString& aPostscriptName, ATSUFontID aFontID, + PRUint16 aWeight, PRUint16 aStretch, PRUint32 aItalicStyle, + gfxUserFontData *aUserFontData); PRUint32 mTraits; MacOSFamilyEntry *mFamily; diff --git a/gfx/thebes/src/gfxQuartzFontCache.mm b/gfx/thebes/src/gfxQuartzFontCache.mm index 2461a91b79db..a47eeacb7f66 100644 --- a/gfx/thebes/src/gfxQuartzFontCache.mm +++ b/gfx/thebes/src/gfxQuartzFontCache.mm @@ -2,12 +2,13 @@ * ***** BEGIN LICENSE BLOCK ***** * Version: BSD * - * Copyright (C) 2006 Mozilla Corporation. All rights reserved. + * Copyright (C) 2006-2008 Mozilla Corporation. All rights reserved. * * Contributor(s): * Vladimir Vukicevic * Masayuki Nakano * John Daggett + * Jonathan Kew * * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. * @@ -117,7 +118,7 @@ gfxQuartzFontCache::GenerateFontListKey(const nsAString& aKeyName, nsAString& aR #pragma mark- MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, - PRInt32 aAppleWeight, PRUint32 aTraits, MacOSFamilyEntry *aFamily) + PRInt32 aAppleWeight, PRUint32 aTraits, MacOSFamilyEntry *aFamily) : gfxFontEntry(aPostscriptName), mTraits(aTraits), mFamily(aFamily), mATSUFontID(0), mATSUIDInitialized(0) { @@ -127,10 +128,12 @@ MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, mFixedPitch = (mTraits & NSFixedPitchFontMask ? 1 : 0); } -MacOSFontEntry::MacOSFontEntry(ATSUFontID aFontID, PRUint16 aWeight, PRUint16 aStretch, PRUint32 aItalicStyle, gfxUserFontData *aUserFontData) +MacOSFontEntry::MacOSFontEntry(const nsAString& aPostscriptName, ATSUFontID aFontID, + PRUint16 aWeight, PRUint16 aStretch, PRUint32 aItalicStyle, + gfxUserFontData *aUserFontData) { // xxx - stretch is basically ignored for now - + mATSUIDInitialized = PR_TRUE; mATSUFontID = aFontID; mUserFontData = aUserFontData; @@ -143,23 +146,7 @@ MacOSFontEntry::MacOSFontEntry(ATSUFontID aFontID, PRUint16 aWeight, PRUint16 aS (mFixedPitch ? NSFixedPitchFontMask : 0) | (mWeight >= 600 ? NSBoldFontMask : NSUnboldFontMask); - // get the postscript name - OSStatus err; - NSString *psname = NULL; - - // now lookup the Postscript name - err = ATSFontGetPostScriptName((ATSFontRef) aFontID, kATSOptionFlagsDefault, (CFStringRef*) (&psname)); - if (err == noErr) { - GetStringForNSString(psname, mName); - [psname release]; - } else { - mIsValid = PR_FALSE; -#ifdef DEBUG - char warnBuf[1024]; - sprintf(warnBuf, "ATSFontGetPostScriptName err = %d", (PRInt32)err); - NS_WARNING(warnBuf); -#endif - } + mName = aPostscriptName; } const nsString& @@ -706,7 +693,7 @@ const PRUint32 kNonNormalTraits = NSItalicFontMask | NSBoldFontMask | NSNarrowFo void gfxQuartzFontCache::InitFontList() { - ATSGeneration currentGeneration = ATSGeneration(); + ATSGeneration currentGeneration = ATSGetGeneration(); // need to ignore notifications after adding each font if (mATSGeneration == currentGeneration) @@ -1338,73 +1325,106 @@ gfxQuartzFontCache::MakePlatformFont(const gfxFontEntry *aProxyEntry, return nsnull; } - ATSUFontID fontID; + ATSFontRef fontRef; ATSFontContainerRef containerRef; - err = ATSFontActivateFromMemory(const_cast(aFontData), aLength, - kPrivateATSFontContextPrivate, - kATSFontFormatUnspecified, - NULL, - kATSOptionFlagsDoNotNotify, - &containerRef); + // we get occasional failures when multiple fonts are activated in quick succession + // if the ATS font cache is damaged; to work around this, we can retry the activation + const PRUint32 kMaxRetries = 3; + PRUint32 retryCount = 0; + while (retryCount++ < kMaxRetries) { + err = ATSFontActivateFromMemory(const_cast(aFontData), aLength, + kPrivateATSFontContextPrivate, + kATSFontFormatUnspecified, + NULL, + kATSOptionFlagsDoNotNotify, + &containerRef); + mATSGeneration = ATSGetGeneration(); - if (err != noErr) { + if (err != noErr) { #if DEBUG - char warnBuf[1024]; - const gfxProxyFontEntry *proxyEntry = - static_cast (aProxyEntry); - sprintf(warnBuf, "downloaded font error, ATSFontActivateFromMemory err: %d for (%s)", - PRInt32(err), - NS_ConvertUTF16toUTF8(proxyEntry->mFamily->Name()).get()); - NS_WARNING(warnBuf); + char warnBuf[1024]; + const gfxProxyFontEntry *proxyEntry = + static_cast (aProxyEntry); + sprintf(warnBuf, "downloaded font error, ATSFontActivateFromMemory err: %d for (%s)", + PRInt32(err), + NS_ConvertUTF16toUTF8(proxyEntry->mFamily->Name()).get()); + NS_WARNING(warnBuf); #endif - return nsnull; - } + return nsnull; + } - mATSGeneration = ATSGeneration(); - - // ignoring containers with multiple fonts, use the first face only for now - err = ATSFontFindFromContainer(containerRef, kATSOptionFlagsDefault, 1, - (ATSFontRef*)&fontID, NULL); - if (err != noErr) { + // ignoring containers with multiple fonts, use the first face only for now + err = ATSFontFindFromContainer(containerRef, kATSOptionFlagsDefault, 1, + &fontRef, NULL); + if (err != noErr) { #if DEBUG - char warnBuf[1024]; - const gfxProxyFontEntry *proxyEntry = - static_cast (aProxyEntry); - sprintf(warnBuf, "downloaded font error, ATSFontFindFromContainer err: %d for (%s)", - PRInt32(err), - NS_ConvertUTF16toUTF8(proxyEntry->mFamily->Name()).get()); - NS_WARNING(warnBuf); + char warnBuf[1024]; + const gfxProxyFontEntry *proxyEntry = + static_cast (aProxyEntry); + sprintf(warnBuf, "downloaded font error, ATSFontFindFromContainer err: %d for (%s)", + PRInt32(err), + NS_ConvertUTF16toUTF8(proxyEntry->mFamily->Name()).get()); + NS_WARNING(warnBuf); #endif - ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault); - return nsnull; - } + ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault); + return nsnull; + } - // font entry will own this - MacOSUserFontData *userFontData = new MacOSUserFontData(containerRef); - - if (!userFontData) { - ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault); - return nsnull; - } + // now lookup the Postscript name; this may fail if the font cache is bad + OSStatus err; + NSString *psname = NULL; + nsAutoString postscriptName; + err = ATSFontGetPostScriptName(fontRef, kATSOptionFlagsDefault, (CFStringRef*) (&psname)); + if (err == noErr) { + GetStringForNSString(psname, postscriptName); + [psname release]; + } else { +#ifdef DEBUG + char warnBuf[1024]; + const gfxProxyFontEntry *proxyEntry = + static_cast (aProxyEntry); + sprintf(warnBuf, "ATSFontGetPostScriptName err = %d for (%s), retries = %d", (PRInt32)err, + NS_ConvertUTF16toUTF8(proxyEntry->mFamily->Name()).get(), retryCount); + NS_WARNING(warnBuf); +#endif + ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault); + // retry the activation a couple of times if this fails + // (may be a transient failure due to ATS font cache issues) + continue; + } - PRUint16 w = aProxyEntry->mWeight; - NS_ASSERTION(w >= 100 && w <= 900, "bogus font weight value!"); + // font entry will own this + MacOSUserFontData *userFontData = new MacOSUserFontData(containerRef); - MacOSFontEntry *newFontEntry = - new MacOSFontEntry(fontID, w, aProxyEntry->mStretch, - (PRUint32(aProxyEntry->mItalic) ? - FONT_STYLE_ITALIC : - FONT_STYLE_NORMAL), - userFontData); + if (!userFontData) { + ATSFontDeactivate(containerRef, NULL, kATSOptionFlagsDefault); + return nsnull; + } - if (!newFontEntry) { - delete userFontData; - return nsnull; - } - - // if something is funky about this font, delete immediately - if (newFontEntry && !newFontEntry->mIsValid) { + PRUint16 w = aProxyEntry->mWeight; + NS_ASSERTION(w >= 100 && w <= 900, "bogus font weight value!"); + + // create the font entry + MacOSFontEntry *newFontEntry = + new MacOSFontEntry(postscriptName, + FMGetFontFromATSFontRef(fontRef), + w, aProxyEntry->mStretch, + (PRUint32(aProxyEntry->mItalic) ? + FONT_STYLE_ITALIC : + FONT_STYLE_NORMAL), + userFontData); + + if (!newFontEntry) { + delete userFontData; + return nsnull; + } + + // if we succeeded (which should always be the case), return the new font + if (newFontEntry->mIsValid) + return newFontEntry; + + // if something is funky about this font, delete immediately #if DEBUG char warnBuf[1024]; const gfxProxyFontEntry *proxyEntry = @@ -1414,10 +1434,17 @@ gfxQuartzFontCache::MakePlatformFont(const gfxFontEntry *aProxyEntry, NS_WARNING(warnBuf); #endif delete newFontEntry; - return nsnull; + + // We don't retry from here; the ATS font cache issue would have caused failure earlier + // so if we get here, there's something else bad going on within our font data structures. + // Currently, there should be no way to reach here, as fontentry creation cannot fail + // except by memory allocation failure. + NS_WARNING("invalid font entry for a newly activated font"); + break; } - return newFontEntry; + // if we get here, the activation failed (even with possible retries); can't use this font + return nsnull; } diff --git a/gfx/thebes/src/gfxWindowsFonts.cpp b/gfx/thebes/src/gfxWindowsFonts.cpp index 9d2c8e17b3f0..3e2dc6a925fb 100644 --- a/gfx/thebes/src/gfxWindowsFonts.cpp +++ b/gfx/thebes/src/gfxWindowsFonts.cpp @@ -981,6 +981,17 @@ gfxWindowsFontGroup::InitFontList() mFonts.AppendElements(mFontEntries.Length()); } + // force the underline offset to get recalculated + mUnderlineOffset = UNDERLINE_OFFSET_NOT_SET; +} + +gfxFloat +gfxWindowsFontGroup::GetUnderlineOffset() +{ + if (mUnderlineOffset != UNDERLINE_OFFSET_NOT_SET) + return mUnderlineOffset; + + // not yet initialized, need to calculate if (!mStyle.systemFont) { for (PRUint32 i = 0; i < mFontEntries.Length(); ++i) { if (mFontEntries[i]->mIsBadUnderlineFont) { @@ -992,6 +1003,10 @@ gfxWindowsFontGroup::InitFontList() } } + if (mUnderlineOffset == UNDERLINE_OFFSET_NOT_SET) + mUnderlineOffset = GetFontAt(0)->GetMetrics().underlineOffset; + + return mUnderlineOffset; } static PRBool @@ -1351,7 +1366,7 @@ public: mAlternativeString(nsnull), mScriptItem(aItem), mScript(aItem->a.eScript), mGroup(aGroup), mNumGlyphs(0), mMaxGlyphs(ESTIMATE_MAX_GLYPHS(aLength)), - mFontSelected(PR_FALSE) + mFontSelected(PR_FALSE), mForceGDIPlace(PR_FALSE) { NS_ASSERTION(mMaxGlyphs < 65535, "UniscribeItem is too big, ScriptShape() will fail!"); mGlyphs.SetLength(mMaxGlyphs); @@ -1404,6 +1419,19 @@ public: continue; } + // Uniscribe can't do shaping with some fonts, so it sets the + // fNoGlyphIndex flag in the SCRIPT_ANALYSIS structure to indicate + // this. This occurs with CFF fonts loaded with + // AddFontMemResourceEx but it's not clear what the other cases + // are, so just log a warning for now. + // see http://msdn.microsoft.com/en-us/library/ms776520(VS.85).aspx + + if (sa.fNoGlyphIndex) { + mForceGDIPlace = PR_TRUE; + NS_WARNING("Uniscribe refuses to shape with given font"); + return ShapeGDI(); + } + if (rv == E_PENDING) { if (shapeDC == mDC) { // we already tried this once, something failed, give up @@ -1528,6 +1556,9 @@ public: mOffsets.SetLength(mNumGlyphs); mAdvances.SetLength(mNumGlyphs); + if (mForceGDIPlace) + return PlaceGDI(); + PRBool allCJK = PR_TRUE; // Some fonts don't get along with Uniscribe so we'll use GDI to @@ -1771,6 +1802,11 @@ private: PRPackedBool mFontSelected; + // when shaping, Uniscribe refuses to shape with some fonts + // (e.g. CFF fonts loaded with AddFontMemResourceEx), so need + // to force GDI placement + PRPackedBool mForceGDIPlace; + nsTArray mRanges; }; diff --git a/gfx/thebes/src/gfxWindowsPlatform.cpp b/gfx/thebes/src/gfxWindowsPlatform.cpp index 396723da936f..07a9e0bcb98f 100644 --- a/gfx/thebes/src/gfxWindowsPlatform.cpp +++ b/gfx/thebes/src/gfxWindowsPlatform.cpp @@ -633,21 +633,15 @@ gfxWindowsPlatform::LookupLocalFont(const nsAString& aFontName) return data.mFontEntry; } -// make a unique font name, limited on Windows to 31 two-byte characters -static void MakeUniqueFontName(PRUnichar aName[LF_FACESIZE]) +static void MakeUniqueFontName(nsAString& aName) { + char buf[50]; + static PRUint32 fontCount = 0; ++fontCount; - char buf[LF_FACESIZE]; - sprintf(buf, "mozfont%8.8x%8.8x", ::GetTickCount(), fontCount); // slightly retarded, figure something better later... - - nsCAutoString fontName(buf); - - PRUint32 nameLen = PR_MIN(fontName.Length(), LF_FACESIZE - 1); - memcpy(aName, nsPromiseFlatString(NS_ConvertUTF8toUTF16(fontName)).get(), nameLen * 2); - aName[nameLen] = 0; + aName.AssignASCII(buf); } // from t2embapi.h, included in Platform SDK 6.1 but not 6.0 @@ -705,17 +699,22 @@ static void InitializeFontEmbeddingProcs() class WinUserFontData : public gfxUserFontData { public: - WinUserFontData(HANDLE aFontRef) - : mFontRef(aFontRef) + WinUserFontData(HANDLE aFontRef, PRBool aIsCFF) + : mFontRef(aFontRef), mIsCFF(aIsCFF) { } virtual ~WinUserFontData() { - ULONG pulStatus; - TTDeleteEmbeddedFontPtr(mFontRef, 0, &pulStatus); + if (mIsCFF) { + RemoveFontMemResourceEx(mFontRef); + } else { + ULONG pulStatus; + TTDeleteEmbeddedFontPtr(mFontRef, 0, &pulStatus); + } } HANDLE mFontRef; + PRPackedBool mIsCFF; }; // used to control stream read by Windows TTLoadEmbeddedFont API @@ -791,22 +790,55 @@ gfxWindowsPlatform::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, if (!TTLoadEmbeddedFontPtr || !TTDeleteEmbeddedFontPtr) return nsnull; - if (!gfxFontUtils::ValidateSFNTHeaders(aFontData, aLength)) + PRBool isCFF; + if (!gfxFontUtils::ValidateSFNTHeaders(aFontData, aLength, &isCFF)) return nsnull; - // create an eot header - nsAutoTArray eotHeader; - PRUint8 *buffer; - PRUint32 eotlen; - PRUnichar fontName[LF_FACESIZE]; - PRBool isCFF; - nsresult rv; HANDLE fontRef; - PRInt32 ret; - { - rv = gfxFontUtils::MakeEOTHeader(aFontData, aLength, &eotHeader, &isCFF); + nsAutoString uniqueName; + MakeUniqueFontName(uniqueName); + + if (isCFF) { + // Postscript-style glyphs, swizzle name table, load directly + nsTArray newFontData; + + rv = gfxFontUtils::RenameFont(uniqueName, aFontData, aLength, &newFontData); + + if (NS_FAILED(rv)) + return nsnull; + + DWORD numFonts = 0; + + PRUint8 *fontData = reinterpret_cast (newFontData.Elements()); + PRUint32 fontLength = newFontData.Length(); + NS_ASSERTION(fontData, "null font data after renaming"); + + // http://msdn.microsoft.com/en-us/library/ms533942(VS.85).aspx + // "A font that is added by AddFontMemResourceEx is always private + // to the process that made the call and is not enumerable." + fontRef = AddFontMemResourceEx(fontData, fontLength, + 0 /* reserved */, &numFonts); + + if (!fontRef) + return nsnull; + + // only load fonts with a single face contained in the data + if (fontRef && numFonts != 1) { + RemoveFontMemResourceEx(fontRef); + return nsnull; + } + } else { + // TrueType-style glyphs, use EOT library + nsAutoTArray eotHeader; + PRUint8 *buffer; + PRUint32 eotlen; + + PRUint32 nameLen = PR_MIN(uniqueName.Length(), LF_FACESIZE - 1); + nsPromiseFlatString fontName(Substring(uniqueName, 0, nameLen)); + + rv = gfxFontUtils::MakeEOTHeader(aFontData, aLength, &eotHeader); if (NS_FAILED(rv)) return nsnull; @@ -814,27 +846,32 @@ gfxWindowsPlatform::MakePlatformFont(const gfxProxyFontEntry *aProxyEntry, eotlen = eotHeader.Length(); buffer = reinterpret_cast (eotHeader.Elements()); + PRInt32 ret; ULONG privStatus, pulStatus; - MakeUniqueFontName(fontName); EOTFontStreamReader eotReader(aFontData, aLength, buffer, eotlen); ret = TTLoadEmbeddedFontPtr(&fontRef, TTLOAD_PRIVATE, &privStatus, LICENSE_PREVIEWPRINT, &pulStatus, EOTFontStreamReader::ReadEOTStream, - &eotReader, fontName, 0, 0); + &eotReader, (PRUnichar*)(fontName.get()), 0, 0); + if (ret != E_NONE) + return nsnull; } - if (ret != E_NONE) - return nsnull; // make a new font entry using the unique name - WinUserFontData *winUserFontData = new WinUserFontData(fontRef); + WinUserFontData *winUserFontData = new WinUserFontData(fontRef, isCFF); PRUint16 w = (aProxyEntry->mWeight == 0 ? 400 : aProxyEntry->mWeight); - return FontEntry::CreateFontEntry(nsDependentString(fontName), + FontEntry *fe = FontEntry::CreateFontEntry(uniqueName, gfxWindowsFontType(isCFF ? GFX_FONT_TYPE_PS_OPENTYPE : GFX_FONT_TYPE_TRUETYPE) /*type*/, PRUint32(aProxyEntry->mItalic ? FONT_STYLE_ITALIC : FONT_STYLE_NORMAL), w, winUserFontData); + + if (fe && isCFF) + fe->mForceGDI = PR_TRUE; + + return fe; } PRBool diff --git a/js/src/Makefile.in b/js/src/Makefile.in index a19ed8714f31..634e651fb7e2 100644 --- a/js/src/Makefile.in +++ b/js/src/Makefile.in @@ -56,15 +56,18 @@ ifndef JS_MOZ_INSTALL NSDISTMODE = copy endif -MODULE = js -LIBRARY_NAME = mozjs -GRE_MODULE = 1 +ifdef JS_NATIVE_EDITLINE +DIRS += editline +endif + +# editline needs to get built before the shell +DIRS += shell + +MODULE = js +LIBRARY_NAME = mozjs +STATIC_LIBRARY_NAME = js_static +GRE_MODULE = 1 -PROGRAM = js$(BIN_SUFFIX) -# The shell uses some 'HIDDEN' symbols to produce statistics, so we -# link directly against the .o files, not against the JS shared -# library. -PROGOBJS = js.$(OBJ_SUFFIX) $(OBJS) LIBS = $(NSPR_LIBS) ifdef GNU_CXX @@ -104,10 +107,12 @@ endif # other modules which are always built shared. Failure to do so results in # the js code getting copied into xpinstall and jsd as well as mozilla-bin, # and then the static data cells used for locking no longer work. +# +# In fact, we now build both a static and a shared library, as the +# JS shell would like to link to the static library. -ifndef JS_STATIC_BUILD FORCE_SHARED_LIB = 1 -endif +FORCE_STATIC_LIB = 1 ifeq (86,$(findstring 86,$(OS_TEST))) ifeq (64,$(findstring 64,$(OS_TEST))) @@ -619,20 +624,22 @@ install:: $(INSTALLED_HEADERS) install:: $(SCRIPTS) $(PROGRAM) $(INSTALL) $(IFLAGS2) $^ $(bindir) +install:: $(LIBRARY) +ifneq (,$(LIBRARY)) + $(INSTALL) $(IFLAGS1) $(LIBRARY) $(libdir) +endif +ifneq (,$(IMPORT_LIBRARY)) + $(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(libdir) +endif + # The Mozilla top-level makefiles use install-runtime-libs directly to # place an additional copy of the libraries in the 'dist/bin' # directory. install:: install-runtime-libs install-runtime-libs:: $(LIBRARY) $(SHARED_LIBRARY) $(IMPORT_LIBRARY) -ifneq (,$(LIBRARY)) - $(INSTALL) $(IFLAGS1) $(LIBRARY) $(libdir) -endif ifneq (,$(SHARED_LIBRARY)) $(INSTALL) $(IFLAGS2) $(SHARED_LIBRARY) $(libdir) endif -ifneq (,$(IMPORT_LIBRARY)) - $(INSTALL) $(IFLAGS2) $(IMPORT_LIBRARY) $(libdir) -endif # Extra dependancies and rules for auto-generated headers host_jskwgen.$(OBJ_SUFFIX): jsversion.h jskeyword.tbl diff --git a/js/src/config/autoconf.mk.in b/js/src/config/autoconf.mk.in index d82e6146d12c..606393e4da9b 100644 --- a/js/src/config/autoconf.mk.in +++ b/js/src/config/autoconf.mk.in @@ -64,7 +64,12 @@ mandir = @mandir@ installdir = $(libdir)/$(MOZ_APP_NAME)-$(MOZ_APP_VERSION) sdkdir = $(libdir)/$(MOZ_APP_NAME)-devel-$(MOZ_APP_VERSION) -DIST = $(DEPTH)/dist +TOP_DIST = @TOP_DIST@ +ifneq (,$(filter /%,$(TOP_DIST))) +DIST = $(TOP_DIST) +else +DIST = $(DEPTH)/$(TOP_DIST) +endif MOZ_JS_LIBS = @MOZ_JS_LIBS@ @@ -101,7 +106,6 @@ MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@ BUILD_STATIC_LIBS = @BUILD_STATIC_LIBS@ ENABLE_TESTS = @ENABLE_TESTS@ JS_ULTRASPARC_OPTS = @JS_ULTRASPARC_OPTS@ -JS_STATIC_BUILD = @JS_STATIC_BUILD@ TAR=@TAR@ @@ -264,6 +268,9 @@ NSPR_LIBS = @NSPR_LIBS@ USE_DEPENDENT_LIBS = @USE_DEPENDENT_LIBS@ +JS_NATIVE_EDITLINE = @JS_NATIVE_EDITLINE@ +EDITLINE_LIBS = @EDITLINE_LIBS@ + # MKSHLIB_FORCE_ALL is used to force the linker to include all object # files present in an archive. MKSHLIB_UNFORCE_ALL reverts the linker # to normal behavior. Makefile's that create shared libraries out of diff --git a/js/src/config/config.mk b/js/src/config/config.mk index 9a222eacdf73..910032530147 100644 --- a/js/src/config/config.mk +++ b/js/src/config/config.mk @@ -73,6 +73,8 @@ CHECK_VARS := \ SHORT_LIBNAME \ XPI_PKGNAME \ INSTALL_EXTENSION_ID \ + SHARED_LIBRARY_NAME \ + STATIC_LIBRARY_NAME \ $(NULL) # checks for internal spaces or trailing spaces in the variable @@ -359,6 +361,18 @@ DSO_PIC_CFLAGS= endif endif +ifndef SHARED_LIBRARY_NAME +ifdef LIBRARY_NAME +SHARED_LIBRARY_NAME=$(LIBRARY_NAME) +endif +endif + +ifndef STATIC_LIBRARY_NAME +ifdef LIBRARY_NAME +STATIC_LIBRARY_NAME=$(LIBRARY_NAME) +endif +endif + # This comes from configure ifdef MOZ_PROFILE_GUIDED_OPTIMIZE_DISABLE NO_PROFILE_GUIDED_OPTIMIZE = 1 diff --git a/js/src/config/rules.mk b/js/src/config/rules.mk index 5e6b589add1c..1d5b7443da1e 100644 --- a/js/src/config/rules.mk +++ b/js/src/config/rules.mk @@ -219,15 +219,15 @@ endif # ENABLE_TESTS # ifndef LIBRARY -ifdef LIBRARY_NAME +ifdef STATIC_LIBRARY_NAME ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH))) ifdef SHORT_LIBNAME -LIBRARY_NAME := $(SHORT_LIBNAME) -endif -endif -LIBRARY := $(LIB_PREFIX)$(LIBRARY_NAME).$(LIB_SUFFIX) +STATIC_LIBRARY_NAME := $(SHORT_LIBNAME) endif endif +LIBRARY := $(LIB_PREFIX)$(STATIC_LIBRARY_NAME).$(LIB_SUFFIX) +endif # STATIC_LIBRARY_NAME +endif # LIBRARY ifndef HOST_LIBRARY ifdef HOST_LIBRARY_NAME @@ -244,9 +244,9 @@ MKSHLIB = $(MKCSHLIB) endif ifdef MAKE_FRAMEWORK -SHARED_LIBRARY := $(LIBRARY_NAME) +SHARED_LIBRARY := $(SHARED_LIBRARY_NAME) else -SHARED_LIBRARY := $(DLL_PREFIX)$(LIBRARY_NAME)$(DLL_SUFFIX) +SHARED_LIBRARY := $(DLL_PREFIX)$(SHARED_LIBRARY_NAME)$(DLL_SUFFIX) endif ifeq ($(OS_ARCH),OS2) @@ -254,7 +254,7 @@ DEF_FILE := $(SHARED_LIBRARY:.dll=.def) endif ifneq (,$(filter OS2 WINNT WINCE,$(OS_ARCH))) -IMPORT_LIBRARY := $(LIB_PREFIX)$(LIBRARY_NAME).$(IMPORT_LIB_SUFFIX) +IMPORT_LIBRARY := $(LIB_PREFIX)$(SHARED_LIBRARY_NAME).$(IMPORT_LIB_SUFFIX) endif ifdef MOZ_ENABLE_LIBXUL @@ -319,8 +319,8 @@ CODFILE=$(basename $(@F)).cod endif ifdef MOZ_MAPINFO -ifdef LIBRARY_NAME -MAPFILE=$(LIBRARY_NAME).map +ifdef SHARED_LIBRARY_NAME +MAPFILE=$(SHARED_LIBRARY_NAME).map else MAPFILE=$(basename $(@F)).map endif # LIBRARY_NAME @@ -333,15 +333,8 @@ endif ifdef MAPFILE OS_LDFLAGS += -MAP:$(MAPFILE) -#CFLAGS += -Fm$(MAPFILE) -#CXXFLAGS += -Fm$(MAPFILE) endif -#ifdef CODFILE -#CFLAGS += -Fa$(CODFILE) -FAsc -#CFLAGS += -Fa$(CODFILE) -FAsc -#endif - endif # !GNU_CC ifdef ENABLE_CXX_EXCEPTIONS @@ -841,13 +834,13 @@ ifdef LIBRARY_NAME ifdef EXPORT_LIBRARY ifdef IS_COMPONENT ifdef BUILD_STATIC_LIBS - @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(LIBRARY_NAME) + @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMPS) $(STATIC_LIBRARY_NAME) ifdef MODULE_NAME @$(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_COMP_NAMES) $(MODULE_NAME) endif -endif -else - $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(LIBRARY_NAME) +endif # BUILD_STATIC_LIBS +else # !IS_COMPONENT + $(PERL) -I$(MOZILLA_DIR)/config $(MOZILLA_DIR)/config/build-list.pl $(FINAL_LINK_LIBS) $(STATIC_LIBRARY_NAME) endif # IS_COMPONENT endif # EXPORT_LIBRARY endif # LIBRARY_NAME @@ -1183,7 +1176,7 @@ endif ifeq ($(OS_ARCH),OS2) $(DEF_FILE): $(OBJS) $(SHARED_LIBRARY_LIBS) rm -f $@ - echo LIBRARY $(LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@ + echo LIBRARY $(SHARED_LIBRARY_NAME) INITINSTANCE TERMINSTANCE > $@ echo PROTMODE >> $@ echo CODE LOADONCALL MOVEABLE DISCARDABLE >> $@ echo DATA PRELOAD MOVEABLE MULTIPLE NONSHARED >> $@ diff --git a/js/src/config/system-headers b/js/src/config/system-headers index 9a03619aef4b..d043e60d6c0b 100644 --- a/js/src/config/system-headers +++ b/js/src/config/system-headers @@ -304,6 +304,8 @@ gtk/gtkclipboard.h gtk/gtkcontainer.h gtk/gtkdialog.h gtk/gtkentry.h +gtk/gtkfilechooser.h +gtk/gtkfilechooserdialog.h gtk/gtkfixed.h gtk/gtk.h gtk/gtkiconfactory.h @@ -312,6 +314,7 @@ gtk/gtkimmulticontext.h gtk/gtkinvisible.h gtk/gtkmain.h gtk/gtkmessagedialog.h +gtk/gtkmisc.h gtk/gtkobject.h gtk/gtkprinter.h gtk/gtkprintjob.h diff --git a/js/src/configure.in b/js/src/configure.in index 52bbc3cffa7e..6eb44d4a1c4c 100644 --- a/js/src/configure.in +++ b/js/src/configure.in @@ -160,6 +160,17 @@ then fi MOZ_BUILD_ROOT=`pwd` +dnl Choose where to put the 'dist' directory. +dnl ============================================================== + +MOZ_ARG_WITH_STRING(dist-dir, +[ --with-dist-dir=DIR Use DIR as 'dist' staging area. DIR may be + relative to the top of SpiderMonkey build tree, + or absolute.], + TOP_DIST=$withval, + TOP_DIST=dist) +AC_SUBST(TOP_DIST) + dnl Default to MSVC for win32 dnl ============================================================== if test -z "$CROSS_COMPILE"; then @@ -2784,17 +2795,6 @@ dnl NB - later gcc versions require -mmmx for this header to be successfully dnl included (or another option which implies it, such as -march=pentium-mmx) AC_CHECK_HEADERS(mmintrin.h) -AC_MSG_CHECKING(for ARM SIMD support) -AC_TRY_COMPILE([], - [asm("uqadd8 r1, r1, r2");], - result="yes", result="no") -AC_MSG_RESULT("$result") -if test "$result" = "yes"; then - AC_DEFINE(HAVE_ARM_SIMD) - HAVE_ARM_SIMD=1 -fi -AC_SUBST(HAVE_ARM_SIMD) - dnl Check whether the compiler supports the new-style C++ standard dnl library headers (i.e. ) or needs the old "new.h" AC_LANG_CPLUSPLUS @@ -2880,6 +2880,17 @@ if test "$MOZ_ARM_VFP"; then AC_DEFINE(NJ_ARM_VFP) fi +AC_MSG_CHECKING(for ARM SIMD support) +AC_TRY_COMPILE([], + [asm("uqadd8 r1, r1, r2");], + result="yes", result="no") +AC_MSG_RESULT("$result") +if test "$result" = "yes"; then + AC_DEFINE(HAVE_ARM_SIMD) + HAVE_ARM_SIMD=1 +fi +AC_SUBST(HAVE_ARM_SIMD) + dnl ======================================================== dnl = pthread support dnl = Start by checking whether the system support pthreads @@ -3797,7 +3808,6 @@ MOZ_ARG_HEADER(Application) BUILD_STATIC_LIBS= ENABLE_TESTS=1 MOZ_DBGRINFO_MODULES= -JS_STATIC_BUILD= dnl ======================================================== dnl = @@ -4735,23 +4745,33 @@ MOZ_ARG_ENABLE_BOOL(static, BUILD_STATIC_LIBS=) dnl ======================================================== -dnl = Force JS to be a static lib +dnl = Link js shell to system readline dnl ======================================================== -MOZ_ARG_ENABLE_BOOL(js-static-build, -[ --enable-js-static-build Force js to be a static lib], - JS_STATIC_BUILD=1, - JS_STATIC_BUILD= ) +MOZ_ARG_ENABLE_BOOL(readline, +[ --enable-readline Link js shell to system readline library], + JS_WANT_READLINE=1, + JS_WANT_READLINE= ) -AC_SUBST(JS_STATIC_BUILD) - -if test -n "$JS_STATIC_BUILD"; then - AC_DEFINE(EXPORT_JS_API) - -if test -z "$BUILD_STATIC_LIBS"; then - AC_MSG_ERROR([--enable-js-static-build is only compatible with --enable-static]) -fi +JS_NATIVE_EDITLINE= +EDITLINE_LIBS= +dnl Conveniently, Win32 sets SKIP_LIBRARY_CHECKS... +if test -z "$SKIP_LIBRARY_CHECKS"; then + if test -n "$JS_WANT_READLINE"; then + AC_CHECK_LIB(readline, readline, + EDITLINE_LIBS="-lreadline", + AC_MSG_ERROR([No system readline library found.])) + else + dnl By default, we use editline + JS_NATIVE_EDITLINE=1 + EDITLINE_LIBS='$(DEPTH)/editline/$(LIB_PREFIX)editline.$(LIB_SUFFIX)' + fi + + dnl Either way, we want to build with line editing support. + AC_DEFINE(EDITLINE) fi +AC_SUBST(JS_NATIVE_EDITLINE) +AC_SUBST(EDITLINE_LIBS) dnl ======================================================== dnl = @@ -5136,11 +5156,18 @@ mv confdefs.h.save confdefs.h MAKEFILES=" Makefile + shell/Makefile config/Makefile config/autoconf.mk config/mkdepend/Makefile " +if test -n "$JS_NATIVE_EDITLINE"; then + MAKEFILES="$MAKEFILES +editline/Makefile +" +fi + dnl dnl Run a perl script to quickly create the makefiles. dnl If it succeeds, it outputs a shell command to set CONFIG_FILES diff --git a/js/src/editline/Makefile.in b/js/src/editline/Makefile.in new file mode 100644 index 000000000000..acf5a6ddb839 --- /dev/null +++ b/js/src/editline/Makefile.in @@ -0,0 +1,55 @@ +# -*- Mode: makefile -*- +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is Spidermonkey build system. +# +# The Initial Developer of the Original Code is +# The Mozilla Foundation. +# Portions created by the Initial Developer are Copyright (C) 2008 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Ted Mielczarek +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = .. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +LIBRARY_NAME = editline +FORCE_STATIC_LIB = 1 + +CSRCS = editline.c sysunix.c + +DEFINES += -DANSI_ARROWS -DHAVE_TCGETATTR -DHIDE -DUSE_DIRENT -DSYS_UNIX \ + -DHAVE_STDLIB -DUNIQUE_HISTORY + +include $(topsrcdir)/config/rules.mk diff --git a/js/src/jsobj.cpp b/js/src/jsobj.cpp index 5441554b1c7d..69f4d7bb9937 100644 --- a/js/src/jsobj.cpp +++ b/js/src/jsobj.cpp @@ -1266,7 +1266,7 @@ obj_eval(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) } if (obj != callerScopeChain) { ok = js_CheckPrincipalsAccess(cx, obj, - caller->script->principals, + JS_StackFramePrincipals(cx, caller), cx->runtime->atomState.evalAtom); if (!ok) goto out; diff --git a/js/src/shell/Makefile.in b/js/src/shell/Makefile.in new file mode 100644 index 000000000000..bf59bb69b64c --- /dev/null +++ b/js/src/shell/Makefile.in @@ -0,0 +1,60 @@ +# -*- Mode: makefile -*- +# +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is Spidermonkey build system. +# +# The Initial Developer of the Original Code is +# The Mozilla Foundation. +# Portions created by the Initial Developer are Copyright (C) 2008 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Ted Mielczarek +# +# Alternatively, the contents of this file may be used under the terms of +# either of the GNU General Public License Version 2 or later (the "GPL"), +# or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +DEPTH = .. +topsrcdir = @top_srcdir@ +srcdir = @srcdir@ +VPATH = @srcdir@ + +include $(DEPTH)/config/autoconf.mk + +PROGRAM = js$(BIN_SUFFIX) +CPPSRCS = js.cpp + +DEFINES += -DEXPORT_JS_API + +LIBS = $(NSPR_LIBS) $(EDITLINE_LIBS) $(DEPTH)/$(LIB_PREFIX)js_static.$(LIB_SUFFIX) + +LOCAL_INCLUDES += -I$(topsrcdir) -I.. + +include $(topsrcdir)/config/rules.mk + +# People expect the js shell to wind up in the top-level JS dir. +libs:: + $(INSTALL) $(IFLAGS2) $(PROGRAM) $(DEPTH) diff --git a/js/src/js.cpp b/js/src/shell/js.cpp similarity index 100% rename from js/src/js.cpp rename to js/src/shell/js.cpp diff --git a/js/src/xpconnect/src/xpcwrappednative.cpp b/js/src/xpconnect/src/xpcwrappednative.cpp index 057f443c5453..e375fc499d3e 100644 --- a/js/src/xpconnect/src/xpcwrappednative.cpp +++ b/js/src/xpconnect/src/xpcwrappednative.cpp @@ -1444,10 +1444,10 @@ return_tearoff: if(XPCNativeWrapper::IsNativeWrapperClass(clazz)) { - if(pobj2) - *pobj2 = cur; - - return XPCNativeWrapper::GetWrappedNative(cur); + unsafeObj = + XPCNativeWrapper::GetWrappedNative(cur)->GetFlatJSObject(); + return GetWrappedNativeOfJSObject(cx, unsafeObj, funobj, pobj2, + pTearOff); } if(IsXPCSafeJSObjectWrapperClass(clazz) && diff --git a/layout/base/nsCSSFrameConstructor.cpp b/layout/base/nsCSSFrameConstructor.cpp index a3936095dde3..408b1022f3e1 100644 --- a/layout/base/nsCSSFrameConstructor.cpp +++ b/layout/base/nsCSSFrameConstructor.cpp @@ -10143,6 +10143,7 @@ nsCSSFrameConstructor::EndUpdate() RecalcQuotesAndCounters(); NS_ASSERTION(mUpdateCount == 1, "Odd update count"); } + --mUpdateCount; if (mFocusSuppressCount) { NS_UnsuppressFocusEvent(); --mFocusSuppressCount; diff --git a/layout/base/nsCSSFrameConstructor.h b/layout/base/nsCSSFrameConstructor.h index 2b1e93ebfb1c..06e2bd09baec 100644 --- a/layout/base/nsCSSFrameConstructor.h +++ b/layout/base/nsCSSFrameConstructor.h @@ -85,7 +85,10 @@ class nsCSSFrameConstructor { public: nsCSSFrameConstructor(nsIDocument *aDocument, nsIPresShell* aPresShell); - ~nsCSSFrameConstructor(void) { } + ~nsCSSFrameConstructor(void) { + NS_ASSERTION(mUpdateCount == 0, "Dying in the middle of our own update?"); + NS_ASSERTION(mFocusSuppressCount == 0, "Focus suppression will be wrong"); + } // Maintain global objects - gXBLService static nsIXBLService * GetXBLService(); diff --git a/layout/base/nsDocumentViewer.cpp b/layout/base/nsDocumentViewer.cpp index 6d1870895a42..786809aa4fe1 100644 --- a/layout/base/nsDocumentViewer.cpp +++ b/layout/base/nsDocumentViewer.cpp @@ -1320,7 +1320,7 @@ DocumentViewerImpl::Close(nsISHEntry *aSHEntry) // out of band cleanup of webshell mDocument->SetScriptGlobalObject(nsnull); - if (!mSHEntry) + if (!mSHEntry && mDocument) mDocument->RemovedFromDocShell(); } diff --git a/layout/base/nsImageLoader.cpp b/layout/base/nsImageLoader.cpp index f917dbb115c2..90f4fb78fa46 100644 --- a/layout/base/nsImageLoader.cpp +++ b/layout/base/nsImageLoader.cpp @@ -74,7 +74,7 @@ nsImageLoader::~nsImageLoader() mPresContext = nsnull; if (mRequest) { - mRequest->Cancel(NS_ERROR_FAILURE); + mRequest->CancelAndForgetObserver(NS_ERROR_FAILURE); } } @@ -95,7 +95,7 @@ nsImageLoader::Destroy() mPresContext = nsnull; if (mRequest) { - mRequest->Cancel(NS_ERROR_FAILURE); + mRequest->CancelAndForgetObserver(NS_ERROR_FAILURE); } mRequest = nsnull; @@ -122,7 +122,7 @@ nsImageLoader::Load(imgIRequest *aImage) } // Now cancel the old request so it won't hold a stale ref to us. - mRequest->Cancel(NS_ERROR_FAILURE); + mRequest->CancelAndForgetObserver(NS_ERROR_FAILURE); mRequest = nsnull; } diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index af6817e3f40e..b037bf8c2472 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -762,7 +762,6 @@ struct nsCallbackEventRequest // ---------------------------------------------------------------------------- class nsPresShellEventCB; -class nsAutoCauseReflowNotifier; class PresShell : public nsIPresShell, public nsIViewObserver, public nsStubDocumentObserver, @@ -1013,13 +1012,6 @@ protected: void UnsuppressAndInvalidate(); - void WillCauseReflow() { - nsContentUtils::AddScriptBlocker(); - ++mChangeNestCount; - } - nsresult DidCauseReflow(); - friend class nsAutoCauseReflowNotifier; - void WillDoReflow(); void DidDoReflow(); nsresult ProcessReflowCommands(PRBool aInterruptible); @@ -1133,11 +1125,6 @@ protected: PRPackedBool mIgnoreFrameDestruction; PRPackedBool mHaveShutDown; - - // This is used to protect ourselves from triggering reflow while in the - // middle of frame construction and the like... it really shouldn't be - // needed, one hopes, but it is for now. - PRUint32 mChangeNestCount; nsIFrame* mCurrentEventFrame; nsCOMPtr mCurrentEventContent; @@ -1216,29 +1203,6 @@ private: nsPluginEnumCallback aCallback); }; -class nsAutoCauseReflowNotifier -{ -public: - nsAutoCauseReflowNotifier(PresShell* aShell) - : mShell(aShell) - { - mShell->WillCauseReflow(); - } - ~nsAutoCauseReflowNotifier() - { - // This check should not be needed. Currently the only place that seem - // to need it is the code that deals with bug 337586. - if (!mShell->mHaveShutDown) { - mShell->DidCauseReflow(); - } - else { - nsContentUtils::RemoveScriptBlocker(); - } - } - - PresShell* mShell; -}; - class NS_STACK_CLASS nsPresShellEventCB : public nsDispatchingCallback { public: @@ -2408,7 +2372,7 @@ PresShell::InitialReflow(nscoord aWidth, nscoord aHeight) MOZ_TIMER_START(mFrameCreationWatch); { - nsAutoCauseReflowNotifier reflowNotifier(this); + nsAutoScriptBlocker scriptBlocker; mFrameConstructor->BeginUpdate(); if (!rootFrame) { @@ -2554,7 +2518,7 @@ PresShell::ResizeReflow(nscoord aWidth, nscoord aHeight) // the way don't have region accumulation issues? { - nsAutoCauseReflowNotifier crNotifier(this); + nsAutoScriptBlocker scriptBlocker; WillDoReflow(); // Kick off a top-down reflow @@ -3089,7 +3053,6 @@ PresShell::RestoreRootScrollPosition() // scrollable frame will cause it to reenter ScrollToRestoredPosition(), and // it'll get all confused. nsAutoScriptBlocker scriptBlocker; - ++mChangeNestCount; if (historyState) { nsIFrame* scrollFrame = GetRootScrollFrame(); @@ -3103,8 +3066,6 @@ PresShell::RestoreRootScrollPosition() } } } - - --mChangeNestCount; } void @@ -3384,10 +3345,7 @@ PresShell::RecreateFramesFor(nsIContent* aContent) nsStyleChangeList changeList; changeList.AppendChange(nsnull, aContent, nsChangeHint_ReconstructFrame); - // Mark ourselves as not safe to flush while we're doing frame construction. - ++mChangeNestCount; nsresult rv = mFrameConstructor->ProcessRestyledFrames(changeList); - --mChangeNestCount; batch.EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC); #ifdef ACCESSIBILITY @@ -4487,29 +4445,21 @@ PresShell::HandlePostedReflowCallbacks() NS_IMETHODIMP PresShell::IsSafeToFlush(PRBool& aIsSafeToFlush) { - // XXX technically we don't need to check anything but - // nsContentUtils::IsSafeToRunScript here since that should be false - // if any of the other flags are set. - + aIsSafeToFlush = nsContentUtils::IsSafeToRunScript(); +#ifdef DEBUG // Not safe if we are reflowing or in the middle of frame construction - aIsSafeToFlush = !mIsReflowing && - !mChangeNestCount; - - if (aIsSafeToFlush) { - // Not safe if we are painting - nsIViewManager* viewManager = GetViewManager(); - if (viewManager) { - PRBool isPainting = PR_FALSE; - viewManager->IsPainting(isPainting); - if (isPainting) { - aIsSafeToFlush = PR_FALSE; - } + PRBool isSafeToFlush = !mIsReflowing; + // Not safe if we are painting + nsIViewManager* viewManager = GetViewManager(); + if (viewManager) { + PRBool isPainting = PR_FALSE; + viewManager->IsPainting(isPainting); + if (isPainting) { + isSafeToFlush = PR_FALSE; } } - - NS_ASSERTION(aIsSafeToFlush == nsContentUtils::IsSafeToRunScript(), - "Someone forgot to block scripts"); - + NS_ASSERTION(!aIsSafeToFlush || isSafeToFlush, "Missing a script blocker!"); +#endif return NS_OK; } @@ -4622,7 +4572,7 @@ PresShell::CharacterDataChanged(nsIDocument *aDocument, NS_PRECONDITION(!mIsDocumentGone, "Unexpected CharacterDataChanged"); NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument"); - nsAutoCauseReflowNotifier crNotifier(this); + nsAutoScriptBlocker scriptBlocker; if (mCaret) { // Invalidate the caret's current location before we call into the frame @@ -4664,7 +4614,7 @@ PresShell::ContentStatesChanged(nsIDocument* aDocument, NS_PRECONDITION(aDocument == mDocument, "Unexpected aDocument"); if (mDidInitialReflow) { - nsAutoCauseReflowNotifier crNotifier(this); + nsAutoScriptBlocker scriptBlocker; mFrameConstructor->ContentStatesChanged(aContent1, aContent2, aStateMask); VERIFY_STYLE_TREE; } @@ -4686,7 +4636,7 @@ PresShell::AttributeChanged(nsIDocument* aDocument, // initial reflow to begin observing the document. That would // squelch any other inappropriate notifications as well. if (mDidInitialReflow) { - nsAutoCauseReflowNotifier crNotifier(this); + nsAutoScriptBlocker scriptBlocker; mFrameConstructor->AttributeChanged(aContent, aNameSpaceID, aAttribute, aModType, aStateMask); VERIFY_STYLE_TREE; @@ -4706,7 +4656,7 @@ PresShell::ContentAppended(nsIDocument *aDocument, return; } - nsAutoCauseReflowNotifier crNotifier(this); + nsAutoScriptBlocker scriptBlocker; MOZ_TIMER_DEBUGLOG(("Start: Frame Creation: PresShell::ContentAppended(), this=%p\n", this)); MOZ_TIMER_START(mFrameCreationWatch); @@ -4735,7 +4685,7 @@ PresShell::ContentInserted(nsIDocument* aDocument, return; } - nsAutoCauseReflowNotifier crNotifier(this); + nsAutoScriptBlocker scriptBlocker; // Call this here so it only happens for real content mutations and // not cases when the frame constructor calls its own methods to force @@ -4766,7 +4716,7 @@ PresShell::ContentRemoved(nsIDocument *aDocument, // it can clean up any state related to the content. mPresContext->EventStateManager()->ContentRemoved(aChild); - nsAutoCauseReflowNotifier crNotifier(this); + nsAutoScriptBlocker scriptBlocker; // Call this here so it only happens for real content mutations and // not cases when the frame constructor calls its own methods to force @@ -4784,7 +4734,7 @@ PresShell::ContentRemoved(nsIDocument *aDocument, nsresult PresShell::ReconstructFrames(void) { - nsAutoCauseReflowNotifier crNotifier(this); + nsAutoScriptBlocker scriptBlocker; mFrameConstructor->BeginUpdate(); nsresult rv = mFrameConstructor->ReconstructDocElementHierarchy(); VERIFY_STYLE_TREE; @@ -5591,7 +5541,7 @@ PresShell::HandleEvent(nsIView *aView, { NS_ASSERTION(aView, "null view"); - if (mIsDestroying || mIsReflowing || mChangeNestCount) { + if (mIsDestroying || !nsContentUtils::IsSafeToRunScript()) { return NS_OK; } @@ -5603,9 +5553,6 @@ PresShell::HandleEvent(nsIView *aView, } #endif - NS_ASSERTION(nsContentUtils::IsSafeToRunScript(), - "How did we get here if it's not safe to run scripts?"); - // Check for a theme change up front, since the frame type is irrelevant if (aEvent->message == NS_THEMECHANGED && mPresContext) { mPresContext->ThemeChanged(); @@ -6049,10 +5996,9 @@ PresShell::IsVisible() NS_IMETHODIMP_(void) PresShell::WillPaint() { - // Don't reenter reflow and don't reflow during frame construction. Also - // don't bother reflowing if some viewmanager in our tree is painting while + // Don't bother reflowing if some viewmanager in our tree is painting while // we still have painting suppressed. - if (mIsReflowing || mChangeNestCount || mPaintingSuppressed) { + if (mPaintingSuppressed) { return; } @@ -6264,25 +6210,6 @@ PresShell::PostReflowEvent() } } -nsresult -PresShell::DidCauseReflow() -{ - NS_ASSERTION(mChangeNestCount != 0, "Unexpected call to DidCauseReflow()"); - if (--mChangeNestCount == 0) { - // We may have had more reflow commands appended to the queue during - // our reflow. Make sure these get processed at some point. - - // XXXbz why is this really needed? ProcessReflowCommands handles posting - // reflow events if there are reflow roots remaining, and FrameNeedsReflow - // posts events as needed as well. I think we should remove this. - PostReflowEvent(); - } - - nsContentUtils::RemoveScriptBlocker(); - - return NS_OK; -} - void PresShell::WillDoReflow() { @@ -6632,9 +6559,7 @@ PresShell::Observe(nsISupports* aSubject, // construction. { nsAutoScriptBlocker scriptBlocker; - ++mChangeNestCount; mFrameConstructor->ProcessRestyledFrames(changeList); - --mChangeNestCount; } batch.EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC); @@ -7214,9 +7139,10 @@ PresShell::VerifyIncrementalReflow() // Note that after we create the shell, we must make sure to destroy it sh->SetVerifyReflowEnable(PR_FALSE); // turn off verify reflow while we're reflowing the test frame tree vm->SetViewObserver((nsIViewObserver *)((PresShell*)sh.get())); - WillCauseReflow(); - sh->InitialReflow(r.width, r.height); - DidCauseReflow(); + { + nsAutoScriptBlocker scriptBlocker; + sh->InitialReflow(r.width, r.height); + } mDocument->BindingManager()->ProcessAttachedQueue(); sh->FlushPendingNotifications(Flush_Layout); sh->SetVerifyReflowEnable(PR_TRUE); // turn on verify reflow again now that we're done reflowing the test frame tree diff --git a/layout/base/tests/test_bug458898.html b/layout/base/tests/test_bug458898.html index b2f15c805e23..d3929692121c 100644 --- a/layout/base/tests/test_bug458898.html +++ b/layout/base/tests/test_bug458898.html @@ -22,10 +22,15 @@ SimpleTest.waitForExplicitFinish(); netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); var win = window.openDialog("data:text/html,
"); +// doesn't succeed on SeaMonkey currently, see bug 469331 +// mark it todo there instead +var testfunc_h = (navigator.userAgent.match(/ SeaMonkey\//)) ? todo : ok; +var testfunc_w = (navigator.userAgent.match(/Windows/)) ? ok : testfunc_h; + function loaded() { win.sizeToContent(); - ok(win.innerWidth >= 100, "innerWidth"); - ok(win.innerHeight >= 200, "innerHeight"); + testfunc_w(win.innerWidth >= 100, "innerWidth"); + testfunc_h(win.innerHeight >= 200, "innerHeight"); win.close(); SimpleTest.finish(); } diff --git a/layout/generic/crashtests/435529.html b/layout/generic/crashtests/435529.html new file mode 100644 index 000000000000..736e3377cb13 --- /dev/null +++ b/layout/generic/crashtests/435529.html @@ -0,0 +1,20 @@ + + + + + + +
AB
+ + diff --git a/layout/generic/crashtests/436823.html b/layout/generic/crashtests/436823.html new file mode 100644 index 000000000000..aa6caeff1541 --- /dev/null +++ b/layout/generic/crashtests/436823.html @@ -0,0 +1,10 @@ + + + + + + +
A B
+ + + diff --git a/layout/generic/crashtests/crashtests.list b/layout/generic/crashtests/crashtests.list index 27e2217195d9..d7913f87ac41 100644 --- a/layout/generic/crashtests/crashtests.list +++ b/layout/generic/crashtests/crashtests.list @@ -154,6 +154,8 @@ load 426272-1.html load 428263-1.html load 429981-1.html load 430352-1.html +load 435529.html +load 436823.html load 437156-1.html load 438259-1.html load 438509-1.html diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 4f8497459e1d..156f70542749 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -99,6 +99,7 @@ #include "nsITextControlFrame.h" #include "nsINameSpaceManager.h" #include "nsIPercentHeightObserver.h" +#include "nsStyleStructInlines.h" #ifdef IBMBIDI #include "nsBidiPresUtils.h" @@ -553,6 +554,16 @@ nsFrame::GetOffsets(PRInt32 &aStart, PRInt32 &aEnd) const /* virtual */ void nsFrame::DidSetStyleContext(nsStyleContext* aOldStyleContext) { + // We have to start loading the border image before or during reflow, + // because the border-image's width overrides only apply once the + // image is loaded. Starting the load of the image means we'll get a + // reflow when the image loads. (Otherwise, if the image loads + // between reflow and paint, we never get the notification and our + // size ends up wrong.) + imgIRequest *borderImage = GetStyleBorder()->GetBorderImage(); + if (borderImage) { + PresContext()->LoadBorderImage(borderImage, this); + } } /* virtual */ nsMargin diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index efd313c99e3b..9b08cd639699 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -57,7 +57,6 @@ #include "nsIPercentHeightObserver.h" #include "nsContentUtils.h" #include "nsLayoutUtils.h" -#include "nsStyleStructInlines.h" #ifdef IBMBIDI #include "nsBidiUtils.h" #endif @@ -287,17 +286,6 @@ nsHTMLReflowState::Init(nsPresContext* aPresContext, InitResizeFlags(aPresContext); - // We have to start loading the border image now, because the - // border-image's width overrides only apply once the image is loaded. - // Starting the load of the image means we'll get a reflow when the - // image loads. (If we didn't do it now, and the image loaded between - // reflow and paint, we'd never get the notification, and our size - // would be wrong.) - imgIRequest *borderImage = mStyleBorder->GetBorderImage(); - if (borderImage) { - aPresContext->LoadBorderImage(borderImage, frame); - } - NS_ASSERTION((mFrameType == NS_CSS_FRAME_TYPE_INLINE && !frame->IsFrameOfType(nsIFrame::eReplaced)) || frame->GetType() == nsGkAtoms::textFrame || diff --git a/layout/generic/nsImageFrame.h b/layout/generic/nsImageFrame.h index c1e66ae45766..fd17a3eb22da 100644 --- a/layout/generic/nsImageFrame.h +++ b/layout/generic/nsImageFrame.h @@ -307,11 +307,11 @@ private: { // in case the pref service releases us later if (mLoadingImage) { - mLoadingImage->Cancel(NS_ERROR_FAILURE); + mLoadingImage->CancelAndForgetObserver(NS_ERROR_FAILURE); mLoadingImage = nsnull; } if (mBrokenImage) { - mBrokenImage->Cancel(NS_ERROR_FAILURE); + mBrokenImage->CancelAndForgetObserver(NS_ERROR_FAILURE); mBrokenImage = nsnull; } } diff --git a/layout/reftests/border-image/10x5multicolor.png b/layout/reftests/border-image/10x5multicolor.png index a7d888a32188..7940d1abc7c6 100644 Binary files a/layout/reftests/border-image/10x5multicolor.png and b/layout/reftests/border-image/10x5multicolor.png differ diff --git a/layout/reftests/border-image/3x3multicolor.png b/layout/reftests/border-image/3x3multicolor.png index 9be62f07a0f1..586102670ad8 100644 Binary files a/layout/reftests/border-image/3x3multicolor.png and b/layout/reftests/border-image/3x3multicolor.png differ diff --git a/layout/reftests/border-image/4x4multicolor.png b/layout/reftests/border-image/4x4multicolor.png index c2518c3e10c6..4b817a1264d6 100644 Binary files a/layout/reftests/border-image/4x4multicolor.png and b/layout/reftests/border-image/4x4multicolor.png differ diff --git a/layout/reftests/box-properties/abspos-replaced-width-offset-margin-narrow.png b/layout/reftests/box-properties/abspos-replaced-width-offset-margin-narrow.png index 77a369ec1b28..b36c5f4f9922 100644 Binary files a/layout/reftests/box-properties/abspos-replaced-width-offset-margin-narrow.png and b/layout/reftests/box-properties/abspos-replaced-width-offset-margin-narrow.png differ diff --git a/layout/reftests/box-properties/abspos-replaced-width-offset-margin-wide.png b/layout/reftests/box-properties/abspos-replaced-width-offset-margin-wide.png index 7a27adf95087..ef3fce2dce36 100644 Binary files a/layout/reftests/box-properties/abspos-replaced-width-offset-margin-wide.png and b/layout/reftests/box-properties/abspos-replaced-width-offset-margin-wide.png differ diff --git a/layout/reftests/bugs/213834-1-ref.html b/layout/reftests/bugs/213834-1-ref.html new file mode 100644 index 000000000000..a7ca2076efd7 --- /dev/null +++ b/layout/reftests/bugs/213834-1-ref.html @@ -0,0 +1,3 @@ +Bug 213834 reftest - reference +
+text	text
diff --git a/layout/reftests/bugs/213834-1.html b/layout/reftests/bugs/213834-1.html new file mode 100644 index 000000000000..4ccbd14ee10d --- /dev/null +++ b/layout/reftests/bugs/213834-1.html @@ -0,0 +1,3 @@ +Bug 213834 reftest - test +
+text	text
diff --git a/layout/reftests/bugs/468473-1-ref.xul b/layout/reftests/bugs/468473-1-ref.xul new file mode 100644 index 000000000000..617cd6aaf7e7 --- /dev/null +++ b/layout/reftests/bugs/468473-1-ref.xul @@ -0,0 +1,10 @@ + + + + +