summaryrefslogtreecommitdiff
path: root/www/firefox/files/patch-rust-option
diff options
context:
space:
mode:
Diffstat (limited to 'www/firefox/files/patch-rust-option')
-rw-r--r--www/firefox/files/patch-rust-option569
1 files changed, 520 insertions, 49 deletions
diff --git a/www/firefox/files/patch-rust-option b/www/firefox/files/patch-rust-option
index 57da0de6038e..e60e11b111ee 100644
--- a/www/firefox/files/patch-rust-option
+++ b/www/firefox/files/patch-rust-option
@@ -1,4 +1,4 @@
-Revert bug 1284816 and bug 1341967 to postpone bustage on non-x86 archs.
+Revert bug 1284816, bug 1341967, bug 1336153 to postpone bustage on non-x86 archs.
diff --git browser/confvars.sh browser/confvars.sh
index d8dcd99c2757..740d9d3e5fcf 100755
@@ -56,11 +56,58 @@ index 267d989f1597..f709820e60ae 100644
if not rustc_info:
die(dedent('''\
Rust compiler not found.
+@@ -97,6 +110,9 @@ def rust_compiler(rustc_info, cargo_info):
+
+ return True
+
++set_define('MOZ_RUST', rust_compiler)
++set_config('MOZ_RUST', rust_compiler)
++
+ @template
+ def rust_triple_alias(host_or_target):
+ """Template defining the alias used for rustc's --target flag.
+@@ -227,7 +243,8 @@ set_config('RUST_HOST_TARGET', rust_host_triple)
+
+ @depends(rust_target_triple)
+ def rust_target_env_name(triple):
+- return triple.upper().replace('-','_')
++ if triple:
++ return triple.upper().replace('-','_')
+
+ # We need this to form various Cargo environment variables, as there is no
+ # uppercase function in make, and we don't want to shell out just for
+@@ -235,5 +252,6 @@ def rust_target_env_name(triple):
+ set_config('RUST_TARGET_ENV_NAME', rust_target_env_name)
+
+ # Until we remove all the other Rust checks in old-configure.
++add_old_configure_assignment('MOZ_RUST', rust_compiler)
+ add_old_configure_assignment('RUSTC', rustc)
+ add_old_configure_assignment('RUST_TARGET', rust_target_triple)
+diff --git config/rules.mk config/rules.mk
+index 94cc5556e3d0..7b143ebc5146 100644
+--- config/rules.mk
++++ config/rules.mk
+@@ -900,6 +900,7 @@ endif
+
+ $(foreach file,$(DUMP_SYMS_TARGETS),$(eval $(call syms_template,$(file),$(file)_syms.track)))
+
++ifdef MOZ_RUST
+ cargo_host_flag := --target=$(RUST_HOST_TARGET)
+ cargo_target_flag := --target=$(RUST_TARGET)
+
+@@ -1055,6 +1056,7 @@ force-cargo-host-program-build:
+
+ $(HOST_RUST_PROGRAMS): force-cargo-host-program-build
+ endif # HOST_RUST_PROGRAMS
++endif # MOZ_RUST
+
+ $(SOBJS):
+ $(REPORT_BUILD)
diff --git dom/media/MediaPrefs.h dom/media/MediaPrefs.h
index 4dcc659222a4..559334d89fd1 100644
--- dom/media/MediaPrefs.h
+++ dom/media/MediaPrefs.h
-@@ -165,7 +165,7 @@ private:
+@@ -183,7 +183,7 @@ private:
DECL_MEDIA_PREF("media.ogg.flac.enabled", FlacInOgg, bool, false);
DECL_MEDIA_PREF("media.flac.enabled", FlacEnabled, bool, true);
@@ -69,6 +116,42 @@ index 4dcc659222a4..559334d89fd1 100644
DECL_MEDIA_PREF("media.rust.test_mode", RustTestMode, bool, false);
#endif
+diff --git dom/media/gtest/moz.build dom/media/gtest/moz.build
+index c66ac4a9437f..e2203c0a4321 100644
+--- dom/media/gtest/moz.build
++++ dom/media/gtest/moz.build
+@@ -22,7 +22,6 @@ UNIFIED_SOURCES += [
+ 'TestMozPromise.cpp',
+ 'TestMP3Demuxer.cpp',
+ 'TestMP4Demuxer.cpp',
+- 'TestRust.cpp',
+ 'TestTrackEncoder.cpp',
+ 'TestVideoSegment.cpp',
+ 'TestVideoUtils.cpp',
+@@ -36,6 +35,9 @@ if CONFIG['MOZ_WEBM_ENCODER']:
+ 'TestWebMWriter.cpp',
+ ]
+
++if CONFIG['MOZ_RUST']:
++ UNIFIED_SOURCES += ['TestRust.cpp',]
++
+ TEST_HARNESS_FILES.gtest += [
+ '../test/gizmo-frag.mp4',
+ '../test/gizmo.mp4',
+diff --git media/libcubeb/src/moz.build media/libcubeb/src/moz.build
+index c65b53b80f63..8953f646e831 100644
+--- media/libcubeb/src/moz.build
++++ media/libcubeb/src/moz.build
+@@ -32,7 +32,8 @@ if CONFIG['MOZ_PULSEAUDIO']:
+ 'cubeb_pulse.c',
+ ]
+ DEFINES['USE_PULSE'] = True
+- DEFINES['USE_PULSE_RUST'] = True
++ if CONFIG['MOZ_RUST']:
++ DEFINES['USE_PULSE_RUST'] = True
+
+ if CONFIG['MOZ_JACK']:
+ SOURCES += [
diff --git media/libstagefright/binding/DecoderData.cpp media/libstagefright/binding/DecoderData.cpp
index 109ea329d154..a06e533b1e62 100644
--- media/libstagefright/binding/DecoderData.cpp
@@ -84,16 +167,16 @@ index 109ea329d154..a06e533b1e62 100644
+#endif // MOZ_RUST_MP4PARSE
using namespace stagefright;
-
-@@ -187,6 +189,7 @@ MP4VideoInfo::Update(const MetaData* aMetaData, const char* aMimeType)
-
+ using mozilla::media::TimeUnit;
+@@ -177,6 +179,7 @@ MP4VideoInfo::Update(const MetaData* aMetaData, const char* aMimeType)
+ FindData(aMetaData, kKeyAVCC, mExtraData);
}
+#ifdef MOZ_RUST_MP4PARSE
static void
UpdateTrackProtectedInfo(mozilla::TrackInfo& aConfig,
const mp4parse_sinf_info& aSinf)
-@@ -266,6 +269,7 @@ MP4VideoInfo::Update(const mp4parse_track_info* track,
+@@ -263,6 +266,7 @@ MP4VideoInfo::Update(const mp4parse_track_info* track,
mExtraData->AppendElements(video->extra_data.data, video->extra_data.length);
}
}
@@ -105,7 +188,7 @@ diff --git media/libstagefright/binding/MP4Metadata.cpp media/libstagefright/bin
index 5c3810d99a38..5d14dfd8b8a9 100644
--- media/libstagefright/binding/MP4Metadata.cpp
+++ media/libstagefright/binding/MP4Metadata.cpp
-@@ -19,14 +19,18 @@
+@@ -20,14 +20,18 @@
#include "mp4_demuxer/MP4Metadata.h"
#include "mp4_demuxer/Stream.h"
#include "MediaPrefs.h"
@@ -123,8 +206,8 @@ index 5c3810d99a38..5d14dfd8b8a9 100644
+#endif // MOZ_RUST_MP4PARSE
using namespace stagefright;
-
-@@ -101,6 +103,7 @@ private:
+ using mozilla::media::TimeUnit;
+@@ -105,6 +109,7 @@ private:
bool mCanSeek;
};
@@ -132,19 +215,35 @@ index 5c3810d99a38..5d14dfd8b8a9 100644
// Wrap an mp4_demuxer::Stream to remember the read offset.
class RustStreamAdaptor {
-@@ -145,9 +149,11 @@ private:
+@@ -151,6 +156,7 @@ private:
RustStreamAdaptor mRustSource;
mozilla::UniquePtr<mp4parse_parser, FreeMP4Parser> mRustParser;
};
+#endif // MOZ_RUST_MP4PARSE
+ class IndiceWrapperStagefright : public IndiceWrapper {
+ public:
+@@ -187,6 +193,7 @@ IndiceWrapperStagefright::GetIndice(size_t aIndex, Index::Indice& aIndice) const
+ return true;
+ }
+
++#ifdef MOZ_RUST_MP4PARSE
+ // the owner of mIndice is rust mp4 paser, so lifetime of this class
+ // SHOULD NOT longer than rust parser.
+ class IndiceWrapperRust : public IndiceWrapper
+@@ -232,9 +239,11 @@ IndiceWrapperRust::GetIndice(size_t aIndex, Index::Indice& aIndice) const
+ aIndice.sync = indice->sync;
+ return true;
+ }
++#endif // MOZ_RUST_MP4PARSE
+
MP4Metadata::MP4Metadata(Stream* aSource)
: mStagefright(MakeUnique<MP4MetadataStagefright>(aSource))
+#ifdef MOZ_RUST_MP4PARSE
, mRust(MakeUnique<MP4MetadataRust>(aSource))
- , mPreferRust(false)
+ , mPreferRust(MediaPrefs::EnableRustMP4Parser())
, mReportedAudioTrackTelemetry(false)
-@@ -155,6 +161,7 @@ MP4Metadata::MP4Metadata(Stream* aSource)
+@@ -242,6 +251,7 @@ MP4Metadata::MP4Metadata(Stream* aSource)
#ifndef RELEASE_OR_BETA
, mRustTestMode(MediaPrefs::RustTestMode())
#endif
@@ -152,44 +251,46 @@ index 5c3810d99a38..5d14dfd8b8a9 100644
{
}
-@@ -186,6 +193,7 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const
- {
- uint32_t numTracks = mStagefright->GetNumberTracks(aType);
+@@ -274,8 +284,11 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const
+ MP4Metadata::ResultAndTrackCount numTracks =
+ mStagefright->GetNumberTracks(aType);
+#ifdef MOZ_RUST_MP4PARSE
if (!mRust) {
++#endif // MOZ_RUST_MP4PARSE
return numTracks;
++#ifdef MOZ_RUST_MP4PARSE
}
-@@ -211,10 +219,12 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const
- mPreferRust = true;
- return numTracksRust;
- }
-+#endif // MOZ_RUST_MP4PARSE
- return numTracks;
+ MP4Metadata::ResultAndTrackCount numTracksRust =
+@@ -350,8 +363,10 @@ MP4Metadata::GetNumberTracks(mozilla::TrackInfo::TrackType aType) const
+ // Same non-error numbers, just return any.
+ // (Choosing Rust here, in case it carries a warning, we'd want to know that.)
+ return numTracksRust;
++#endif // MOZ_RUST_MP4PARSE
}
+#ifdef MOZ_RUST_MP4PARSE
bool MP4Metadata::ShouldPreferRust() const {
if (!mRust) {
return false;
-@@ -245,6 +255,7 @@ bool MP4Metadata::ShouldPreferRust() const {
+@@ -389,6 +404,7 @@ bool MP4Metadata::ShouldPreferRust() const {
// Otherwise, fall back.
return false;
}
+#endif // MOZ_RUST_MP4PARSE
- mozilla::UniquePtr<mozilla::TrackInfo>
- MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType,
-@@ -253,6 +264,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType,
- mozilla::UniquePtr<mozilla::TrackInfo> info =
- mStagefright->GetTrackInfo(aType, aTrackNumber);
+ static const char*
+ GetDifferentField(const mozilla::TrackInfo& info,
+@@ -443,6 +459,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType,
+ MP4Metadata::ResultAndTrackInfo info =
+ mStagefright->GetTrackInfo(aType, aTrackNumber);
+#ifdef MOZ_RUST_MP4PARSE
if (!mRust) {
return info;
}
-@@ -305,6 +317,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackTyp
+@@ -514,6 +531,7 @@ MP4Metadata::GetTrackInfo(mozilla::TrackInfo::TrackType aType,
if (mPreferRust) {
return infoRust;
}
@@ -197,15 +298,15 @@ index 5c3810d99a38..5d14dfd8b8a9 100644
return info;
}
-@@ -319,6 +334,7 @@ const CryptoFile&
+@@ -528,6 +546,7 @@ MP4Metadata::ResultAndCryptoFile
MP4Metadata::Crypto() const
{
- const CryptoFile& crypto = mStagefright->Crypto();
+ MP4Metadata::ResultAndCryptoFile crypto = mStagefright->Crypto();
+#ifdef MOZ_RUST_MP4PARSE
- const CryptoFile& rustCrypto = mRust->Crypto();
+ MP4Metadata::ResultAndCryptoFile rustCrypto = mRust->Crypto();
#ifndef RELEASE_OR_BETA
-@@ -330,6 +347,7 @@ MP4Metadata::Crypto() const
+@@ -548,6 +567,7 @@ MP4Metadata::Crypto() const
if (mPreferRust) {
return rustCrypto;
}
@@ -213,17 +314,59 @@ index 5c3810d99a38..5d14dfd8b8a9 100644
return crypto;
}
-@@ -594,6 +612,7 @@ MP4MetadataStagefright::Metadata(Stream* aSource)
- return parser->Metadata();
+@@ -556,17 +576,22 @@ MP4Metadata::ResultAndIndice
+ MP4Metadata::GetTrackIndice(mozilla::TrackID aTrackID)
+ {
+ FallibleTArray<Index::Indice> indiceSF;
++#ifdef MOZ_RUST_MP4PARSE
+ if (!mPreferRust
+ #ifndef RELEASE_OR_BETA
+ || mRustTestMode
+ #endif
+ ) {
++#endif // MOZ_RUST_MP4PARSE
+ MediaResult rv = mStagefright->ReadTrackIndex(indiceSF, aTrackID);
+ if (NS_FAILED(rv)) {
+ return {Move(rv), nullptr};
+ }
++#ifdef MOZ_RUST_MP4PARSE
+ }
++#endif // MOZ_RUST_MP4PARSE
+
++#ifdef MOZ_RUST_MP4PARSE
+ mp4parse_byte_data indiceRust = {};
+ if (mPreferRust
+ #ifndef RELEASE_OR_BETA
+@@ -592,13 +617,18 @@ MP4Metadata::GetTrackIndice(mozilla::TrackID aTrackID)
+ }
+ }
+ #endif
++#endif // MOZ_RUST_MP4PARSE
+
+ UniquePtr<IndiceWrapper> indice;
++#ifdef MOZ_RUST_MP4PARSE
+ if (mPreferRust) {
+ indice = mozilla::MakeUnique<IndiceWrapperRust>(indiceRust);
+ } else {
++#endif // MOZ_RUST_MP4PARSE
+ indice = mozilla::MakeUnique<IndiceWrapperStagefright>(indiceSF);
++#ifdef MOZ_RUST_MP4PARSE
+ }
++#endif // MOZ_RUST_MP4PARSE
+
+ return {NS_OK, Move(indice)};
+ }
+@@ -856,6 +886,7 @@ MP4MetadataStagefright::Metadata(Stream* aSource)
+ return {NS_OK, Move(buffer)};
}
+#ifdef MOZ_RUST_MP4PARSE
bool
RustStreamAdaptor::Read(uint8_t* buffer, uintptr_t size, size_t* bytes_read)
{
-@@ -859,5 +878,6 @@ MP4MetadataRust::Metadata(Stream* aSource)
+@@ -1152,5 +1183,6 @@ MP4MetadataRust::Metadata(Stream* aSource)
MOZ_ASSERT(false, "Not yet implemented");
- return nullptr;
+ return {NS_ERROR_NOT_IMPLEMENTED, nullptr};
}
+#endif // MOZ_RUST_MP4PARSE
@@ -272,7 +415,17 @@ diff --git media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h media/
index 492c9c1c1bc3..e16dbbd1155e 100644
--- media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h
+++ media/libstagefright/binding/include/mp4_demuxer/MP4Metadata.h
-@@ -36,6 +36,7 @@ public:
+@@ -13,7 +13,9 @@
+ #include "MediaInfo.h"
+ #include "MediaResult.h"
+ #include "Stream.h"
++#ifdef MOZ_RUST_MP4PARSE
+ #include "mp4parse.h"
++#endif // MOZ_RUST_MP4PARSE
+
+ namespace mp4_demuxer {
+
+@@ -82,6 +84,7 @@ public:
private:
UniquePtr<MP4MetadataStagefright> mStagefright;
@@ -280,7 +433,7 @@ index 492c9c1c1bc3..e16dbbd1155e 100644
UniquePtr<MP4MetadataRust> mRust;
mutable bool mPreferRust;
mutable bool mReportedAudioTrackTelemetry;
-@@ -44,6 +45,7 @@ private:
+@@ -90,6 +93,7 @@ private:
mutable bool mRustTestMode;
#endif
bool ShouldPreferRust() const;
@@ -288,6 +441,49 @@ index 492c9c1c1bc3..e16dbbd1155e 100644
};
} // namespace mp4_demuxer
+diff --git media/libstagefright/gtest/moz.build media/libstagefright/gtest/moz.build
+index be4d56fc93f7..66fdd365f8f3 100644
+--- media/libstagefright/gtest/moz.build
++++ media/libstagefright/gtest/moz.build
+@@ -38,12 +38,13 @@ TEST_HARNESS_FILES.gtest += [
+ 'test_case_1351094.mp4',
+ ]
+
+-UNIFIED_SOURCES += ['TestMP4Rust.cpp',]
+-TEST_HARNESS_FILES.gtest += [
+- '../../../dom/media/test/street.mp4',
+-]
+-LOCAL_INCLUDES += [
+- '../binding/include',
+-]
++if CONFIG['MOZ_RUST']:
++ UNIFIED_SOURCES += ['TestMP4Rust.cpp',]
++ TEST_HARNESS_FILES.gtest += [
++ '../../../dom/media/test/street.mp4',
++ ]
++ LOCAL_INCLUDES += [
++ '../binding/include',
++ ]
+
+ FINAL_LIBRARY = 'xul-gtest'
+diff --git media/libstagefright/moz.build media/libstagefright/moz.build
+index af5d1194d621..6725a0179989 100644
+--- media/libstagefright/moz.build
++++ media/libstagefright/moz.build
+@@ -83,9 +83,10 @@ SOURCES += [
+ 'system/core/libutils/VectorImpl.cpp',
+ ]
+
+-EXPORTS += [
+- 'binding/include/mp4parse.h',
+-]
++if CONFIG['MOZ_RUST']:
++ EXPORTS += [
++ 'binding/include/mp4parse.h',
++ ]
+
+ UNIFIED_SOURCES += [
+ 'binding/Adts.cpp',
diff --git mobile/android/confvars.sh mobile/android/confvars.sh
index e79b6f5c0707..eb62763acaf7 100644
--- mobile/android/confvars.sh
@@ -301,21 +497,98 @@ index e79b6f5c0707..eb62763acaf7 100644
# use custom widget for html:select
MOZ_USE_NATIVE_POPUP_WINDOWS=1
+diff --git netwerk/base/moz.build netwerk/base/moz.build
+index 61d022a9660e..e5ca1d77d859 100644
+--- netwerk/base/moz.build
++++ netwerk/base/moz.build
+@@ -256,7 +256,7 @@ UNIFIED_SOURCES += [
+ 'TLSServerSocket.cpp',
+ ]
+
+-if CONFIG['MOZ_RUST_URLPARSE']:
++if CONFIG['MOZ_RUST'] and CONFIG['MOZ_RUST_URLPARSE']:
+ EXPORTS.mozilla.net += [ 'RustURL.h' ]
+ UNIFIED_SOURCES += [ 'RustURL.cpp' ]
+
+diff --git netwerk/base/nsStandardURL.cpp netwerk/base/nsStandardURL.cpp
+index 608b918a4ecf..20bcdeb34ab8 100644
+--- netwerk/base/nsStandardURL.cpp
++++ netwerk/base/nsStandardURL.cpp
+@@ -858,6 +858,7 @@ nsStandardURL::BuildNormalizedSpec(const char *spec)
+ if (!SegmentIs(spec, mScheme, "resource") &&
+ !SegmentIs(spec, mScheme, "chrome")) {
+ nsAutoCString ipString;
++#ifdef MOZ_RUST
+ if (encHost.Length() > 0 &&
+ encHost.First() == '[' && encHost.Last() == ']' &&
+ ValidIPv6orHostname(encHost.get(), encHost.Length())) {
+@@ -866,7 +867,9 @@ nsStandardURL::BuildNormalizedSpec(const char *spec)
+ return rv;
+ }
+ encHost = ipString;
+- } else if (NS_SUCCEEDED(NormalizeIPv4(encHost, ipString))) {
++ } else
++#endif
++ if (NS_SUCCEEDED(NormalizeIPv4(encHost, ipString))) {
+ encHost = ipString;
+ }
+ }
+@@ -2112,6 +2115,7 @@ nsStandardURL::SetHost(const nsACString &input)
+
+ if (!SegmentIs(mScheme, "resource") && !SegmentIs(mScheme, "chrome")) {
+ nsAutoCString ipString;
++#ifdef MOZ_RUST
+ if (hostBuf.Length() > 0 &&
+ hostBuf.First() == '[' && hostBuf.Last() == ']' &&
+ ValidIPv6orHostname(hostBuf.get(), hostBuf.Length())) {
+@@ -2120,7 +2124,9 @@ nsStandardURL::SetHost(const nsACString &input)
+ return rv;
+ }
+ hostBuf = ipString;
+- } else if (NS_SUCCEEDED(NormalizeIPv4(hostBuf, ipString))) {
++ } else
++#endif
++ if (NS_SUCCEEDED(NormalizeIPv4(hostBuf, ipString))) {
+ hostBuf = ipString;
+ }
+ }
+diff --git old-configure.in old-configure.in
+index 717a94fcc692..54b29d737cc1 100644
+--- old-configure.in
++++ old-configure.in
+@@ -2330,9 +2330,14 @@ if test -n "$MOZ_MULET"; then
+ fi
+
+ # Propagate feature switches for code written in rust from confvars.sh
+-if test -n "$MOZ_RUST_URLPARSE"; then
+- AC_DEFINE(MOZ_RUST_URLPARSE)
+- AC_SUBST(MOZ_RUST_URLPARSE)
++if test -n "$MOZ_RUST"; then
++ if test -n "$MOZ_RUST_MP4PARSE"; then
++ AC_DEFINE(MOZ_RUST_MP4PARSE)
++ fi
++ if test -n "$MOZ_RUST_URLPARSE"; then
++ AC_DEFINE(MOZ_RUST_URLPARSE)
++ AC_SUBST(MOZ_RUST_URLPARSE)
++ fi
+ fi
+
+ AC_SUBST(MOZ_PHOENIX)
diff --git toolkit/components/telemetry/Histograms.json toolkit/components/telemetry/Histograms.json
index 061c55f6a5b6..e49dfd176952 100644
--- toolkit/components/telemetry/Histograms.json
+++ toolkit/components/telemetry/Histograms.json
-@@ -6996,7 +6996,8 @@
- "expires_in_version": "55",
+@@ -8320,7 +8320,8 @@
+ "expires_in_version": "60",
"kind": "boolean",
"bug_numbers": [1220885],
-- "description": "(Bug 1220885) Whether the rust mp4 demuxer successfully parsed a stream segment."
-+ "description": "(Bug 1220885) Whether the rust mp4 demuxer successfully parsed a stream segment.",
+- "description": "Whether the rust mp4 demuxer successfully parsed a stream segment."
++ "description": "Whether the rust mp4 demuxer successfully parsed a stream segment.",
+ "cpp_guard": "MOZ_RUST_MP4PARSE"
},
"MEDIA_RUST_MP4PARSE_ERROR_CODE": {
- "alert_emails": ["giles@mozilla.com", "kinetik@flim.org"],
-@@ -7004,21 +7005,24 @@
+ "record_in_processes": ["main", "content"],
+@@ -8329,7 +8330,8 @@
"kind": "enumerated",
"n_values": 32,
"bug_numbers": [1238420],
@@ -324,8 +597,9 @@ index 061c55f6a5b6..e49dfd176952 100644
+ "cpp_guard": "MOZ_RUST_MP4PARSE"
},
"MEDIA_RUST_MP4PARSE_TRACK_MATCH_AUDIO": {
- "alert_emails": ["giles@mozilla.com", "kinetik@flim.org"],
- "expires_in_version": "55",
+ "record_in_processes": ["main", "content"],
+@@ -8337,7 +8339,8 @@
+ "expires_in_version": "60",
"kind": "boolean",
"bug_numbers": [1231169],
- "description": "Whether rust and stagefight mp4 parser audio track results match."
@@ -333,8 +607,9 @@ index 061c55f6a5b6..e49dfd176952 100644
+ "cpp_guard": "MOZ_RUST_MP4PARSE"
},
"MEDIA_RUST_MP4PARSE_TRACK_MATCH_VIDEO": {
- "alert_emails": ["giles@mozilla.com", "kinetik@flim.org"],
- "expires_in_version": "55",
+ "record_in_processes": ["main", "content"],
+@@ -8345,7 +8348,8 @@
+ "expires_in_version": "60",
"kind": "boolean",
"bug_numbers": [1231169],
- "description": "Whether rust and stagefight mp4 parser video track results match."
@@ -342,4 +617,200 @@ index 061c55f6a5b6..e49dfd176952 100644
+ "cpp_guard": "MOZ_RUST_MP4PARSE"
},
"MEDIA_WMF_DECODE_ERROR": {
- "expires_in_version": "55",
+ "record_in_processes": ["main", "content", "gpu"],
+diff --git toolkit/library/gtest/moz.build toolkit/library/gtest/moz.build
+index 69a8fb1f4893..c684f48e456e 100644
+--- toolkit/library/gtest/moz.build
++++ toolkit/library/gtest/moz.build
+@@ -7,7 +7,6 @@
+ FINAL_TARGET = 'dist/bin/gtest'
+
+ USE_LIBS += [
+- 'gkrust-gtest',
+ 'static:xul',
+ # xul-gtest is an intermediate static library. It is used as FINAL_TARGET
+ # for gtest code.
+@@ -21,6 +20,11 @@ USE_LIBS += [
+ # before StaticXULComponentStart.
+ Libxul('xul-gtest-real')
+
++if CONFIG['MOZ_RUST']:
++ USE_LIBS += [
++ 'gkrust-gtest',
++ ]
++
+ DIRS += [
+ 'static',
+ ]
+diff --git toolkit/library/moz.build toolkit/library/moz.build
+index 650f6eaba980..191e90ceb09a 100644
+--- toolkit/library/moz.build
++++ toolkit/library/moz.build
+@@ -63,7 +63,7 @@ def Libxul(name):
+
+ # This option should go away in bug 1290972, but we need to wait until
+ # Rust 1.12 has been released.
+- if CONFIG['OS_ARCH'] == 'Darwin':
++ if CONFIG['MOZ_RUST'] and CONFIG['OS_ARCH'] == 'Darwin':
+ LDFLAGS += ['-Wl,-no_compact_unwind']
+
+ Libxul('xul')
+@@ -343,4 +343,5 @@ USE_LIBS += ['StaticXULComponentsEnd']
+ # The above library needs to be last for C++ purposes. This library,
+ # however, is entirely composed of Rust code, and needs to come after
+ # all the C++ code so any possible C++ -> Rust calls can be resolved.
+-USE_LIBS += ['gkrust']
++if CONFIG['MOZ_RUST']:
++ USE_LIBS += ['gkrust']
+diff --git toolkit/moz.configure toolkit/moz.configure
+index ac9d123224ce..e90da70f0fa5 100644
+--- toolkit/moz.configure
++++ toolkit/moz.configure
+@@ -88,8 +88,7 @@ include('../js/moz.configure')
+
+ # Rust
+ # ==============================================================
+-include('../build/moz.configure/rust.configure',
+- when='--enable-compile-environment')
++include('../build/moz.configure/rust.configure')
+
+
+ # L10N
+@@ -623,13 +622,13 @@ id_and_secret_keyfile('Leanplum SDK')
+ option('--enable-stylo', nargs='?', choices=('build',),
+ help='Include Stylo in the build and/or enable it at runtime')
+
+-@depends('--enable-stylo')
+-def stylo_config(value):
++@depends('--enable-stylo', '--enable-rust')
++def stylo_config(value, rust_enabled):
+ build_stylo = None
+ enable_stylo = None
+
+ # The default is to not build Stylo at all.
+- if value.origin == 'default':
++ if not rust_enabled or value.origin == 'default':
+ pass
+ elif value == 'build':
+ build_stylo = True
+@@ -769,12 +768,14 @@ set_config('SERVO_TARGET_DIR', servo_target_dir)
+ option('--enable-webrender', nargs='?', choices=('build',),
+ help='Include WebRender in the build and/or enable it at runtime')
+
+-@depends('--enable-webrender', milestone)
+-def webrender(value, milestone):
++@depends('--enable-webrender', '--enable-rust', milestone)
++def webrender(value, rust_enabled, milestone):
+ build_webrender = None
+ enable_webrender = None
+
+- if value.origin == 'default':
++ if not rust_enabled:
++ pass
++ elif value.origin == 'default':
+ # if nothing is specified, default to just building on Nightly
+ build_webrender = milestone.is_nightly
+ elif value == 'build':
+diff --git toolkit/toolkit.mozbuild toolkit/toolkit.mozbuild
+index b845aab48023..9215afc6dd2d 100644
+--- toolkit/toolkit.mozbuild
++++ toolkit/toolkit.mozbuild
+@@ -133,16 +133,23 @@ if CONFIG['MOZ_PREF_EXTENSIONS']:
+
+ DIRS += [
+ '/devtools',
+- '/toolkit/library',
+- '/toolkit/library/gtest/rust',
+- '/toolkit/library/rust',
+- '/toolkit/library/StaticXULComponentsEnd',
+ '/services',
+ '/startupcache',
+ '/js/ductwork/debugger',
+ '/other-licenses/snappy',
+ ]
+
++if CONFIG['MOZ_RUST']:
++ DIRS += [
++ '/toolkit/library/gtest/rust',
++ '/toolkit/library/rust',
++ ]
++
++DIRS += [
++ '/toolkit/library/StaticXULComponentsEnd',
++ '/toolkit/library',
++]
++
+ if 'gtk' in CONFIG['MOZ_WIDGET_TOOLKIT']:
+ DIRS += ['/toolkit/system/gnome']
+
+diff --git toolkit/xre/nsAppRunner.cpp toolkit/xre/nsAppRunner.cpp
+index 667c2eb1b365..6fb6cf102baa 100644
+--- toolkit/xre/nsAppRunner.cpp
++++ toolkit/xre/nsAppRunner.cpp
+@@ -227,11 +227,13 @@
+ extern uint32_t gRestartMode;
+ extern void InstallSignalHandlers(const char *ProgramName);
+
++#ifdef MOZ_RUST
+ // This workaround is fixed in Rust 1.19. For details, see bug 1358151.
+ // Implementation in toolkit/library/rust/shared/lib.rs
+ extern "C" {
+ void rust_init_please_remove_this_after_updating_rust_1_19();
+ }
++#endif
+
+ #define FILE_COMPATIBILITY_INFO NS_LITERAL_CSTRING("compatibility.ini")
+ #define FILE_INVALIDATE_CACHES NS_LITERAL_CSTRING(".purgecaches")
+@@ -3122,8 +3124,10 @@ XREMain::XRE_mainInit(bool* aExitFlag)
+ return 1;
+ *aExitFlag = false;
+
++#ifdef MOZ_RUST
+ // This workaround is fixed in Rust 1.19. For details, see bug 1358151.
+ rust_init_please_remove_this_after_updating_rust_1_19();
++#endif
+
+ atexit(UnexpectedExit);
+ auto expectedShutdown = mozilla::MakeScopeExit([&] {
+diff --git xpcom/base/nsDebugImpl.cpp xpcom/base/nsDebugImpl.cpp
+index e6bb623c258b..c49d61dce605 100644
+--- xpcom/base/nsDebugImpl.cpp
++++ xpcom/base/nsDebugImpl.cpp
+@@ -148,14 +148,20 @@ nsDebugImpl::Abort(const char* aFile, int32_t aLine)
+ return NS_OK;
+ }
+
++#ifdef MOZ_RUST
+ // From toolkit/library/rust/lib.rs
+ extern "C" void intentional_panic(const char* message);
++#endif
+
+ NS_IMETHODIMP
+ nsDebugImpl::RustPanic(const char* aMessage)
+ {
++#ifdef MOZ_RUST
+ intentional_panic(aMessage);
+ return NS_OK;
++#else
++ return NS_ERROR_NOT_IMPLEMENTED;
++#endif
+ }
+
+ NS_IMETHODIMP
+diff --git xpcom/rust/nsstring/gtest/moz.build xpcom/rust/nsstring/gtest/moz.build
+index 197411678815..5bed9e57e57d 100644
+--- xpcom/rust/nsstring/gtest/moz.build
++++ xpcom/rust/nsstring/gtest/moz.build
+@@ -4,8 +4,9 @@
+ # 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/.
+
+-UNIFIED_SOURCES += [
+- 'Test.cpp'
+-]
++if CONFIG['MOZ_RUST']:
++ UNIFIED_SOURCES += [
++ 'Test.cpp'
++ ]
+
+ FINAL_LIBRARY = 'xul-gtest'