diff --git a/editor/libeditor/HTMLEditor.h b/editor/libeditor/HTMLEditor.h index 9947a597f008..1bdd7cb4e724 100644 --- a/editor/libeditor/HTMLEditor.h +++ b/editor/libeditor/HTMLEditor.h @@ -472,7 +472,7 @@ public: * activation of an inline table editing UI element * @param aUIAnonymousElement [IN] the inline table editing UI element */ - nsresult DoInlineTableEditingAction(Element& aUIAnonymousElement); + nsresult DoInlineTableEditingAction(const Element& aUIAnonymousElement); protected: class BlobReader final : public nsIEditorBlobListener diff --git a/editor/libeditor/HTMLInlineTableEditor.cpp b/editor/libeditor/HTMLInlineTableEditor.cpp index 7160e24c99d3..c27060bc75db 100644 --- a/editor/libeditor/HTMLInlineTableEditor.cpp +++ b/editor/libeditor/HTMLInlineTableEditor.cpp @@ -123,7 +123,7 @@ HTMLEditor::HideInlineTableEditingUI() } nsresult -HTMLEditor::DoInlineTableEditingAction(Element& aElement) +HTMLEditor::DoInlineTableEditingAction(const Element& aElement) { nsAutoString anonclass; aElement.GetAttr(kNameSpaceID_None, nsGkAtoms::_moz_anonclass, anonclass); diff --git a/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java b/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java index 20fcbe89622b..88783a2d673a 100644 --- a/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java +++ b/mobile/android/base/java/org/mozilla/gecko/CrashReporter.java @@ -5,6 +5,7 @@ package org.mozilla.gecko; +import java.util.Enumeration; import java.util.HashMap; import java.util.Map; import java.io.BufferedReader; @@ -27,6 +28,11 @@ import java.security.MessageDigest; import java.util.zip.GZIPOutputStream; import org.mozilla.gecko.AppConstants.Versions; +import org.mozilla.gecko.GeckoProfile; +import org.mozilla.gecko.telemetry.pingbuilders.TelemetryCrashPingBuilder; +import org.mozilla.gecko.telemetry.TelemetryDispatcher; +import org.mozilla.gecko.util.INIParser; +import org.mozilla.gecko.util.INISection; import org.mozilla.gecko.util.ProxySelector; import android.annotation.SuppressLint; @@ -121,6 +127,7 @@ public class CrashReporter extends AppCompatActivity } @Override + @SuppressLint("WrongThread") // We don't have a worker thread for the TelemetryDispatcher public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); // mHandler is created here so runnables can be run on the main thread @@ -148,6 +155,30 @@ public class CrashReporter extends AppCompatActivity mExtrasStringMap = new HashMap(); readStringsFromFile(mPendingExtrasFile.getPath(), mExtrasStringMap); + try { + // Find the profile name and path. Since we don't have any other way of getting it within + // this context we extract it from the crash dump path. + final File profileDir = passedMinidumpFile.getParentFile().getParentFile(); + final String profileName = getProfileName(profileDir); + + if (profileName != null) { + // Extract the crash dump ID and telemetry client ID, we need profile access for the latter. + final String passedMinidumpName = passedMinidumpFile.getName(); + // Strip the .dmp suffix from the minidump name to obtain the crash ID. + final String crashId = passedMinidumpName.substring(0, passedMinidumpName.length() - 4); + final GeckoProfile profile = GeckoProfile.get(this, profileName, profileDir); + final String clientId = profile.getClientId(); + + // Assemble and send the crash ping + final TelemetryCrashPingBuilder pingBuilder = + new TelemetryCrashPingBuilder(crashId, clientId, mExtrasStringMap); + final TelemetryDispatcher dispatcher = new TelemetryDispatcher(profileDir.getPath(), profileName); + dispatcher.queuePingForUpload(this, pingBuilder); + } + } catch (GeckoProfileDirectories.NoMozillaDirectoryException | IOException e) { + Log.e(LOGTAG, "Cannot send the crash ping: ", e); + } + // Notify GeckoApp that we've crashed, so it can react appropriately during the next start. try { File crashFlag = new File(GeckoProfileDirectories.getMozillaDirectory(this), "CRASHED"); @@ -274,6 +305,29 @@ public class CrashReporter extends AppCompatActivity backgroundSendReport(); } + private String getProfileName(File profileDir) throws GeckoProfileDirectories.NoMozillaDirectoryException { + final File mozillaDir = GeckoProfileDirectories.getMozillaDirectory(this); + final INIParser parser = GeckoProfileDirectories.getProfilesINI(mozillaDir); + String profileName = null; + + if (parser.getSections() != null) { + for (Enumeration e = parser.getSections().elements(); e.hasMoreElements(); ) { + final INISection section = e.nextElement(); + final String path = section.getStringProperty("Path"); + final boolean isRelative = (section.getIntProperty("IsRelative") == 1); + + if ((isRelative && path.equals(profileDir.getName())) || + path.equals(profileDir.getPath())) { + profileName = section.getStringProperty("Name"); + break; + } + } + } + + return profileName; + } + + private void computeMinidumpHash(File extraFile, File minidump) { try { FileInputStream stream = new FileInputStream(minidump); diff --git a/mobile/android/base/java/org/mozilla/gecko/telemetry/TelemetryDispatcher.java b/mobile/android/base/java/org/mozilla/gecko/telemetry/TelemetryDispatcher.java index 83a4a2221c50..d2303281eaf4 100644 --- a/mobile/android/base/java/org/mozilla/gecko/telemetry/TelemetryDispatcher.java +++ b/mobile/android/base/java/org/mozilla/gecko/telemetry/TelemetryDispatcher.java @@ -10,6 +10,7 @@ import android.content.Context; import android.support.annotation.WorkerThread; import android.util.Log; import org.mozilla.gecko.telemetry.pingbuilders.TelemetryCorePingBuilder; +import org.mozilla.gecko.telemetry.pingbuilders.TelemetryCrashPingBuilder; import org.mozilla.gecko.telemetry.schedulers.TelemetryUploadScheduler; import org.mozilla.gecko.telemetry.schedulers.TelemetryUploadAllPingsImmediatelyScheduler; import org.mozilla.gecko.telemetry.stores.TelemetryJSONFilePingStore; @@ -55,8 +56,10 @@ public class TelemetryDispatcher { private static final String STORE_CONTAINER_DIR_NAME = "telemetry_java"; private static final String CORE_STORE_DIR_NAME = "core"; + private static final String CRASH_STORE_DIR_NAME = "crash"; private final TelemetryJSONFilePingStore coreStore; + private final TelemetryJSONFilePingStore crashStore; private final TelemetryUploadAllPingsImmediatelyScheduler uploadAllPingsImmediatelyScheduler; @@ -68,6 +71,7 @@ public class TelemetryDispatcher { // when the ping is stored. However, for simplicity, we use the json store and accept the possible // loss of data (see bug 1243585 comment 16+ for more). coreStore = new TelemetryJSONFilePingStore(new File(storePath, CORE_STORE_DIR_NAME), profileName); + crashStore = new TelemetryJSONFilePingStore(new File(storePath, CRASH_STORE_DIR_NAME), profileName); uploadAllPingsImmediatelyScheduler = new TelemetryUploadAllPingsImmediatelyScheduler(); } @@ -86,6 +90,14 @@ public class TelemetryDispatcher { queuePingForUpload(context, ping, coreStore, uploadAllPingsImmediatelyScheduler); } + /** + * Queues the given crash ping for upload and potentially schedules upload. This method can be called from any thread. + */ + public void queuePingForUpload(final Context context, final TelemetryCrashPingBuilder pingBuilder) { + final TelemetryOutgoingPing ping = pingBuilder.build(); + queuePingForUpload(context, ping, crashStore, uploadAllPingsImmediatelyScheduler); + } + /* package-private */ static class QueuePingRunnable implements Runnable { private final Context applicationContext; private final TelemetryOutgoingPing ping; diff --git a/mobile/android/base/java/org/mozilla/gecko/telemetry/pingbuilders/TelemetryCrashPingBuilder.java b/mobile/android/base/java/org/mozilla/gecko/telemetry/pingbuilders/TelemetryCrashPingBuilder.java new file mode 100644 index 000000000000..b2f04e3f1777 --- /dev/null +++ b/mobile/android/base/java/org/mozilla/gecko/telemetry/pingbuilders/TelemetryCrashPingBuilder.java @@ -0,0 +1,224 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +package org.mozilla.gecko.telemetry.pingbuilders; + +import android.util.Log; + +import org.mozilla.gecko.sync.ExtendedJSONObject; +import org.mozilla.gecko.sync.NonObjectJSONException; +import org.mozilla.gecko.util.StringUtils; + +import java.io.IOException; +import java.text.DateFormat; +import java.text.SimpleDateFormat; +import java.util.Arrays; +import java.util.Date; +import java.util.HashMap; +import java.util.Map.Entry; +import java.util.TimeZone; + +/** + * Builds a {@link TelemetryOutgoingPing} representing a crash ping. + * + * See https://firefox-source-docs.mozilla.org/toolkit/components/telemetry/telemetry/data/crash-ping.html + * for details on the crash ping. + */ +public class TelemetryCrashPingBuilder extends TelemetryPingBuilder { + private static final String LOGTAG = "GeckoTelemetryCrashPingBuilder"; + + private static final int PING_VERSION = 1; + + private static final String ISO8601_DATE = "yyyy-MM-dd"; + private static final String ISO8601_DATE_HOURS = "yyyy-MM-dd'T'HH':00:00.000Z'"; + + // The following list should be kept in sync with the one in CrashManager.jsm + private static final String[] ANNOTATION_WHITELIST = { + "AsyncShutdownTimeout", + "AvailablePageFile", + "AvailablePhysicalMemory", + "AvailableVirtualMemory", + "BlockedDllList", + "BlocklistInitFailed", + "BuildID", + "ContainsMemoryReport", + "CrashTime", + "EventLoopNestingLevel", + "ipc_channel_error", + "IsGarbageCollecting", + "MozCrashReason", + "OOMAllocationSize", + "ProductID", + "ProductName", + "ReleaseChannel", + "RemoteType", + "SecondsSinceLastCrash", + "ShutdownProgress", + "StartupCrash", + "SystemMemoryUsePercentage", + "TextureUsage", + "TotalPageFile", + "TotalPhysicalMemory", + "TotalVirtualMemory", + "UptimeTS", + "User32BeforeBlocklist", + "Version", + }; + + public TelemetryCrashPingBuilder(String crashId, String clientId, HashMap annotations) { + super(TelemetryPingBuilder.UNIFIED_TELEMETRY_VERSION); + + payload.put("type", "crash"); + payload.put("id", docID); + payload.put("version", TelemetryPingBuilder.UNIFIED_TELEMETRY_VERSION); + payload.put("creationDate", currentDate(ISO8601_DATE_HOURS)); + payload.put("clientId", clientId); + + // Parse the telemetry environment and extract relevant fields from it + ExtendedJSONObject env = null; + String architecture = null; + String xpcomAbi = null; + + try { + env = new ExtendedJSONObject(annotations.get("TelemetryEnvironment")); + final ExtendedJSONObject build = env.getObject("build"); + + if (build != null) { + architecture = build.getString("architecture"); + xpcomAbi = build.getString("xpcomAbi"); + } + } catch (NonObjectJSONException | IOException e) { + Log.w(LOGTAG, "Couldn't parse the telemetry environment, the ping will be incomplete"); + } + + if (env != null) { + payload.put("environment", env); + } + + payload.put("payload", createPayloadNode(crashId, annotations)); + payload.put("application", createApplicationNode(annotations, architecture, xpcomAbi)); + } + + /** + * Return the current date as a string in the specified format. + * + * @param format The date format, the following constants are provided: + * ISO8601_DATE - the ISO 8601 date format, YYYY-MM-DD + * ISO8601_DATE_HOURS - the ISO 8601 full date format, YYYY-MM-DDTHH:00:00.000Z + * @returns The formatted date as a string + */ + private static String currentDate(String format) { + TimeZone tz = TimeZone.getTimeZone("UTC"); + DateFormat df = new SimpleDateFormat(format); + df.setTimeZone(tz); + + return df.format(new Date()); + } + + /** + * Creates the ping's "payload" node which contains most of the information + * about the crash and the "metadata" sub-node holding various annotations. + * + * @param crashId The UUID identifying the crash + * @param annotations A map holding the crash annotations + * @returns A JSON object representing the ping's payload node + */ + private static ExtendedJSONObject createPayloadNode(String crashId, HashMap annotations) { + ExtendedJSONObject node = new ExtendedJSONObject(); + + node.put("sessionId", annotations.get("TelemetrySessionId")); + node.put("version", PING_VERSION); + node.put("crashDate", currentDate(ISO8601_DATE)); + node.put("crashTime", currentDate(ISO8601_DATE_HOURS)); + node.put("hasCrashEnvironment", true); + node.put("crashId", crashId); + node.put("minidumpSha256Hash", annotations.get("MinidumpSha256Hash")); + node.put("processType", "main"); + + try { + final ExtendedJSONObject stackTraces = new ExtendedJSONObject(annotations.get("StackTraces")); + node.put("stackTraces", stackTraces); + } catch (NonObjectJSONException | IOException e) { + Log.w(LOGTAG, "Couldn't parse the stack traces, the ping will be incomplete"); + } + + // Assemble the payload metadata + node.put("metadata", createMetadataNode(annotations)); + + return node; + } + + /** + * Creates the ping's "metadata" node which is nested under the "payload" one. This node + * contains all the non-PII annotations found in the crash dump. + * + * @param annotations A map holding the crash annotations + * @returns A JSON object representing the ping's metadata node + */ + private static ExtendedJSONObject createMetadataNode(HashMap annotations) { + ExtendedJSONObject node = new ExtendedJSONObject(); + + for (Entry pair : annotations.entrySet()) { + if (Arrays.binarySearch(ANNOTATION_WHITELIST, pair.getKey()) >= 0) { + node.put(pair.getKey(), pair.getValue()); + } + } + + return node; + } + + /** + * Creates the ping's "application" node. This contains version and build information about the + * crashed application. + * + * @param annotations A map holding the crash annotations + * @param architecture The platform architecture + * @param xpcomAbi The XPCOM ABI version + * @returns A JSON object representing the ping's application node + */ + private static ExtendedJSONObject createApplicationNode(HashMap annotations, + String architecture, String xpcomAbi) { + ExtendedJSONObject node = new ExtendedJSONObject(); + final String version = annotations.get("Version"); + + node.put("vendor", annotations.get("Vendor")); + node.put("name", annotations.get("ProductName")); + node.put("buildId", annotations.get("BuildID")); + node.put("displayVersion", version); + node.put("platformVersion", version); + node.put("version", version); + node.put("channel", annotations.get("ReleaseChannel")); + + if (architecture != null) { + node.put("architecture", architecture); + } + + if (xpcomAbi != null) { + node.put("xpcomAbi", xpcomAbi); + } + + return node; + } + + @Override + public String getDocType() { + return "crash"; + } + + @Override + public String[] getMandatoryFields() { + return new String[] { + "application", + "clientId", + "creationDate", + "environment", + "id", + "payload", + "type", + "version", + }; + } +} diff --git a/mobile/android/base/java/org/mozilla/gecko/telemetry/pingbuilders/TelemetryPingBuilder.java b/mobile/android/base/java/org/mozilla/gecko/telemetry/pingbuilders/TelemetryPingBuilder.java index e42714b95d1d..492ba4244d87 100644 --- a/mobile/android/base/java/org/mozilla/gecko/telemetry/pingbuilders/TelemetryPingBuilder.java +++ b/mobile/android/base/java/org/mozilla/gecko/telemetry/pingbuilders/TelemetryPingBuilder.java @@ -25,13 +25,23 @@ abstract class TelemetryPingBuilder { // In the server url, the initial path directly after the "scheme://host:port/" private static final String SERVER_INITIAL_PATH = "submit/telemetry"; + // By default Fennec ping's use the old telemetry version, this can be overridden + private static final int DEFAULT_TELEMETRY_VERSION = 1; + + // Unified telemetry is version 4 + public static final int UNIFIED_TELEMETRY_VERSION = 4; + private final String serverPath; protected final ExtendedJSONObject payload; protected final String docID; public TelemetryPingBuilder() { + this(DEFAULT_TELEMETRY_VERSION); + } + + public TelemetryPingBuilder(int version) { docID = UUID.randomUUID().toString(); - serverPath = getTelemetryServerPath(getDocType(), docID); + serverPath = getTelemetryServerPath(getDocType(), docID, version); payload = new ExtendedJSONObject(); } @@ -66,9 +76,11 @@ abstract class TelemetryPingBuilder { * http://hostname/submit/telemetry/docId/docType/appName/appVersion/appUpdateChannel/appBuildID * * @param docType The name of the ping (e.g. "main") + * @param docID A UUID that identifies the ping + * @param version The ping format version * @return a url at which to POST the telemetry data to */ - private static String getTelemetryServerPath(final String docType, final String docID) { + private static String getTelemetryServerPath(final String docType, final String docID, int version) { final String appName = AppConstants.MOZ_APP_BASENAME; final String appVersion = AppConstants.MOZ_APP_VERSION; final String appUpdateChannel = AppConstants.MOZ_UPDATE_CHANNEL; @@ -82,6 +94,7 @@ abstract class TelemetryPingBuilder { appName + '/' + appVersion + '/' + appUpdateChannel + '/' + - appBuildId; + appBuildId + + (version == UNIFIED_TELEMETRY_VERSION ? "?v=4" : ""); } } diff --git a/mobile/android/base/moz.build b/mobile/android/base/moz.build index b10a1ca39933..4381f44658aa 100644 --- a/mobile/android/base/moz.build +++ b/mobile/android/base/moz.build @@ -877,6 +877,7 @@ gbjar.sources += ['java/org/mozilla/gecko/' + x for x in [ 'telemetry/measurements/SearchCountMeasurements.java', 'telemetry/measurements/SessionMeasurements.java', 'telemetry/pingbuilders/TelemetryCorePingBuilder.java', + 'telemetry/pingbuilders/TelemetryCrashPingBuilder.java', 'telemetry/pingbuilders/TelemetryLocalPingBuilder.java', 'telemetry/pingbuilders/TelemetryPingBuilder.java', 'telemetry/pingbuilders/TelemetrySyncEventPingBuilder.java', diff --git a/old-configure.in b/old-configure.in index 6cd3b249e30c..5ad6e327a0fe 100644 --- a/old-configure.in +++ b/old-configure.in @@ -4085,8 +4085,8 @@ dnl ======================================================== MOZ_TREE_CAIRO=1 MOZ_ARG_ENABLE_BOOL(system-cairo, -[ --enable-system-cairo Use system cairo (located with pkgconfig)], -MOZ_TREE_CAIRO=, +[ --enable-system-cairo Obsolete: do not use this option], +AC_MSG_ERROR(--enable-system-cairo is not supported), MOZ_TREE_CAIRO=1 ) MOZ_TREE_PIXMAN=1 @@ -4096,112 +4096,88 @@ MOZ_TREE_PIXMAN=, MOZ_TREE_PIXMAN=force, MOZ_TREE_PIXMAN=1 ) -# System cairo depends on system pixman -if test "$MOZ_TREE_PIXMAN" = "force"; then - if test -z "$MOZ_TREE_CAIRO"; then - AC_MSG_ERROR([--disable-system-pixman is incompatible with --enable-system-cairo.]) - else - MOZ_TREE_PIXMAN=1 - fi -elif test -z "$MOZ_TREE_CAIRO"; then - MOZ_TREE_PIXMAN= -fi - if test "$MOZ_TREE_PIXMAN"; then AC_DEFINE(MOZ_TREE_PIXMAN) else PKG_CHECK_MODULES(MOZ_PIXMAN, pixman-1 >= 0.19.2) fi -if test "$MOZ_TREE_CAIRO"; then - MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo" - AC_DEFINE(MOZ_TREE_CAIRO) +MOZ_CAIRO_CFLAGS="-I${DIST}/include/cairo" +AC_DEFINE(MOZ_TREE_CAIRO) - if test "$OS_ARCH" = "WINNT"; then - # For now we assume that we will have a uint64_t available through - # one of the above headers or mozstdint.h. - AC_DEFINE(HAVE_UINT64_T) - fi - - # Define macros for cairo-features.h - TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1" - if test "$MOZ_X11"; then - XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1" - XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1" - PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1" - fi - if test "$_HAVE_FREETYPE2"; then - FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1" - MOZ_ENABLE_CAIRO_FT=1 - CAIRO_FT_CFLAGS="$FT2_CFLAGS" - fi - - case "$MOZ_WIDGET_TOOLKIT" in - cocoa | uikit) - QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1" - QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1" - QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1" - ;; - windows) - WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1" - WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1" - WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1" - WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1" - MOZ_ENABLE_D2D_SURFACE=1 - - if test "$COMPILE_ENVIRONMENT"; then - - dnl D3D10 Layers depend on D2D Surfaces. - if test -n "$WIN32_D2D_SURFACE_FEATURE"; then - MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1) - fi - fi - ;; - esac - if test "$USE_FC_FREETYPE"; then - FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1" - fi - AC_SUBST(MOZ_ENABLE_CAIRO_FT) - AC_SUBST(MOZ_ENABLE_D2D_SURFACE) - AC_SUBST(MOZ_ENABLE_D3D10_LAYER) - - AC_SUBST(PS_SURFACE_FEATURE) - AC_SUBST(SVG_SURFACE_FEATURE) - AC_SUBST(XLIB_SURFACE_FEATURE) - AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE) - AC_SUBST(QUARTZ_SURFACE_FEATURE) - AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE) - AC_SUBST(WIN32_SURFACE_FEATURE) - AC_SUBST(OS2_SURFACE_FEATURE) - AC_SUBST(DIRECTFB_SURFACE_FEATURE) - AC_SUBST(FT_FONT_FEATURE) - AC_SUBST(FC_FONT_FEATURE) - AC_SUBST(WIN32_FONT_FEATURE) - AC_SUBST(WIN32_DWRITE_FONT_FEATURE) - AC_SUBST(WIN32_D2D_SURFACE_FEATURE) - AC_SUBST(QUARTZ_FONT_FEATURE) - AC_SUBST(PNG_FUNCTIONS_FEATURE) - AC_SUBST(QT_SURFACE_FEATURE) - AC_SUBST(TEE_SURFACE_FEATURE) - - if test "$MOZ_X11"; then - MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender" - fi - - CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h -else - PKG_CHECK_MODULES(CAIRO, cairo >= $CAIRO_VERSION) - MOZ_CAIRO_CFLAGS="$CAIRO_CFLAGS" - MOZ_CAIRO_LIBS="$CAIRO_LIBS" - PKG_CHECK_MODULES(CAIRO_TEE, cairo-tee >= $CAIRO_VERSION) - if test "$MOZ_X11"; then - PKG_CHECK_MODULES(CAIRO_XRENDER, cairo-xlib-xrender >= $CAIRO_VERSION) - MOZ_CAIRO_LIBS="$MOZ_CAIRO_LIBS $XLDFLAGS $CAIRO_XRENDER_LIBS" - MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_LIBS" - MOZ_CAIRO_CFLAGS="$MOZ_CAIRO_CFLAGS $CAIRO_XRENDER_CFLAGS" - fi +if test "$OS_ARCH" = "WINNT"; then + # For now we assume that we will have a uint64_t available through + # one of the above headers or mozstdint.h. + AC_DEFINE(HAVE_UINT64_T) fi +# Define macros for cairo-features.h +TEE_SURFACE_FEATURE="#define CAIRO_HAS_TEE_SURFACE 1" +if test "$MOZ_X11"; then + XLIB_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_SURFACE 1" + XLIB_XRENDER_SURFACE_FEATURE="#define CAIRO_HAS_XLIB_XRENDER_SURFACE 1" + PS_SURFACE_FEATURE="#define CAIRO_HAS_PS_SURFACE 1" +fi +if test "$_HAVE_FREETYPE2"; then + FT_FONT_FEATURE="#define CAIRO_HAS_FT_FONT 1" + MOZ_ENABLE_CAIRO_FT=1 + CAIRO_FT_CFLAGS="$FT2_CFLAGS" +fi + +case "$MOZ_WIDGET_TOOLKIT" in + cocoa | uikit) + QUARTZ_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_SURFACE 1" + QUARTZ_IMAGE_SURFACE_FEATURE="#define CAIRO_HAS_QUARTZ_IMAGE_SURFACE 1" + QUARTZ_FONT_FEATURE="#define CAIRO_HAS_QUARTZ_FONT 1" + ;; + windows) + WIN32_D2D_SURFACE_FEATURE="#define CAIRO_HAS_D2D_SURFACE 1" + WIN32_DWRITE_FONT_FEATURE="#define CAIRO_HAS_DWRITE_FONT 1" + WIN32_FONT_FEATURE="#define CAIRO_HAS_WIN32_FONT 1" + WIN32_SURFACE_FEATURE="#define CAIRO_HAS_WIN32_SURFACE 1" + MOZ_ENABLE_D2D_SURFACE=1 + + if test "$COMPILE_ENVIRONMENT"; then + + dnl D3D10 Layers depend on D2D Surfaces. + if test -n "$WIN32_D2D_SURFACE_FEATURE"; then + MOZ_CHECK_HEADER(d3d10.h, MOZ_ENABLE_D3D10_LAYER=1) + fi + fi + ;; +esac +if test "$USE_FC_FREETYPE"; then + FC_FONT_FEATURE="#define CAIRO_HAS_FC_FONT 1" +fi +AC_SUBST(MOZ_ENABLE_CAIRO_FT) +AC_SUBST(MOZ_ENABLE_D2D_SURFACE) +AC_SUBST(MOZ_ENABLE_D3D10_LAYER) + +AC_SUBST(PS_SURFACE_FEATURE) +AC_SUBST(SVG_SURFACE_FEATURE) +AC_SUBST(XLIB_SURFACE_FEATURE) +AC_SUBST(XLIB_XRENDER_SURFACE_FEATURE) +AC_SUBST(QUARTZ_SURFACE_FEATURE) +AC_SUBST(QUARTZ_IMAGE_SURFACE_FEATURE) +AC_SUBST(WIN32_SURFACE_FEATURE) +AC_SUBST(OS2_SURFACE_FEATURE) +AC_SUBST(DIRECTFB_SURFACE_FEATURE) +AC_SUBST(FT_FONT_FEATURE) +AC_SUBST(FC_FONT_FEATURE) +AC_SUBST(WIN32_FONT_FEATURE) +AC_SUBST(WIN32_DWRITE_FONT_FEATURE) +AC_SUBST(WIN32_D2D_SURFACE_FEATURE) +AC_SUBST(QUARTZ_FONT_FEATURE) +AC_SUBST(PNG_FUNCTIONS_FEATURE) +AC_SUBST(QT_SURFACE_FEATURE) +AC_SUBST(TEE_SURFACE_FEATURE) + +if test "$MOZ_X11"; then + MOZ_CAIRO_OSLIBS="$MOZ_CAIRO_OSLIBS $XLDFLAGS -lXrender" +fi + +CAIRO_FEATURES_H=gfx/cairo/cairo/src/cairo-features.h + case "$MOZ_WIDGET_TOOLKIT" in android) TK_CFLAGS="$MOZ_CAIRO_CFLAGS $MOZ_PIXMAN_CFLAGS" diff --git a/uriloader/exthandler/win/nsOSHelperAppService.cpp b/uriloader/exthandler/win/nsOSHelperAppService.cpp index b68e35257a7f..c57d19284f1d 100644 --- a/uriloader/exthandler/win/nsOSHelperAppService.cpp +++ b/uriloader/exthandler/win/nsOSHelperAppService.cpp @@ -28,8 +28,6 @@ #define LOG(args) MOZ_LOG(mLog, mozilla::LogLevel::Debug, args) // helper methods: forward declarations... -static nsresult GetExtensionFrom4xRegistryInfo(const nsACString& aMimeType, - nsString& aFileExtension); static nsresult GetExtensionFromWindowsMimeDatabase(const nsACString& aMimeType, nsString& aFileExtension); @@ -76,45 +74,6 @@ static nsresult GetExtensionFromWindowsMimeDatabase(const nsACString& aMimeType, return NS_OK; } -// We have a serious problem!! I have this content type and the windows registry only gives me -// helper apps based on extension. Right now, we really don't have a good place to go for -// trying to figure out the extension for a particular mime type....One short term hack is to look -// this information in 4.x (it's stored in the windows regsitry). -static nsresult GetExtensionFrom4xRegistryInfo(const nsACString& aMimeType, - nsString& aFileExtension) -{ - nsCOMPtr regKey = - do_CreateInstance("@mozilla.org/windows-registry-key;1"); - if (!regKey) - return NS_ERROR_NOT_AVAILABLE; - - nsresult rv = regKey-> - Open(nsIWindowsRegKey::ROOT_KEY_CURRENT_USER, - NS_LITERAL_STRING("Software\\Netscape\\Netscape Navigator\\Suffixes"), - nsIWindowsRegKey::ACCESS_QUERY_VALUE); - if (NS_FAILED(rv)) - return NS_ERROR_NOT_AVAILABLE; - - rv = regKey->ReadStringValue(NS_ConvertASCIItoUTF16(aMimeType), - aFileExtension); - if (NS_FAILED(rv)) - return NS_OK; - - aFileExtension.Insert(char16_t('.'), 0); - - // this may be a comma separated list of extensions...just take the - // first one for now... - - int32_t pos = aFileExtension.FindChar(char16_t(',')); - if (pos > 0) { - // we have a comma separated list of types... - // truncate everything after the first comma (including the comma) - aFileExtension.Truncate(pos); - } - - return NS_OK; -} - nsresult nsOSHelperAppService::OSProtocolHandlerExists(const char * aProtocolScheme, bool * aHandlerExists) { // look up the protocol scheme in the windows registry....if we find a match then we have a handler for it... @@ -496,14 +455,9 @@ already_AddRefed nsOSHelperAppService::GetMIMEInfoFromOS(const nsAC */ if (!aMIMEType.IsEmpty() && !aMIMEType.LowerCaseEqualsLiteral(APPLICATION_OCTET_STREAM)) { - // (1) try to use the windows mime database to see if there is a mapping to a file extension - // (2) try to see if we have some left over 4.x registry info we can peek at... + // try to use the windows mime database to see if there is a mapping to a file extension GetExtensionFromWindowsMimeDatabase(aMIMEType, fileExtension); LOG(("Windows mime database: extension '%s'\n", fileExtension.get())); - if (fileExtension.IsEmpty()) { - GetExtensionFrom4xRegistryInfo(aMIMEType, fileExtension); - LOG(("4.x Registry: extension '%s'\n", fileExtension.get())); - } } // If we found an extension for the type, do the lookup RefPtr mi;